0000903: V0.13 - Change Individual face color on solid is missing (finish this in 0.14)
This commit is contained in:
parent
64e1c3635d
commit
3cc9818713
|
@ -1143,6 +1143,38 @@ bool StdCmdPlacement::isActive(void)
|
|||
return (Gui::Control().activeDialog()==0);
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
// Std_TransformManip
|
||||
//===========================================================================
|
||||
DEF_STD_CMD_A(StdCmdTransformManip);
|
||||
|
||||
StdCmdTransformManip::StdCmdTransformManip()
|
||||
: Command("Std_TransformManip")
|
||||
{
|
||||
sGroup = QT_TR_NOOP("Edit");
|
||||
sMenuText = QT_TR_NOOP("Transform");
|
||||
sToolTipText = QT_TR_NOOP("Transform the selected object in the 3d view");
|
||||
sStatusTip = QT_TR_NOOP("Transform the selected object in the 3d view");
|
||||
sWhatsThis = "Std_TransformManip";
|
||||
}
|
||||
|
||||
void StdCmdTransformManip::activated(int iMsg)
|
||||
{
|
||||
if (getActiveGuiDocument()->getInEdit())
|
||||
getActiveGuiDocument()->resetEdit();
|
||||
std::vector<App::DocumentObject*> sel = Gui::Selection().getObjectsOfType(App::GeoFeature::getClassTypeId());
|
||||
Gui::ViewProvider* vp = Application::Instance->getViewProvider(sel.front());
|
||||
// FIXME: Need a way to force 'Transform' edit mode
|
||||
// #0000477: Proper interface for edit modes of view provider
|
||||
if (vp)
|
||||
getActiveGuiDocument()->setEdit(vp, Gui::ViewProvider::Transform);
|
||||
}
|
||||
|
||||
bool StdCmdTransformManip::isActive(void)
|
||||
{
|
||||
return Gui::Selection().countObjectsOfType(App::GeoFeature::getClassTypeId()) == 1;
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
// Std_Alignment
|
||||
//===========================================================================
|
||||
|
@ -1284,6 +1316,7 @@ void CreateDocCommands(void)
|
|||
rcCmdMgr.addCommand(new StdCmdRefresh());
|
||||
rcCmdMgr.addCommand(new StdCmdTransform());
|
||||
rcCmdMgr.addCommand(new StdCmdPlacement());
|
||||
rcCmdMgr.addCommand(new StdCmdTransformManip());
|
||||
rcCmdMgr.addCommand(new StdCmdAlignment());
|
||||
rcCmdMgr.addCommand(new StdCmdEdit());
|
||||
}
|
||||
|
|
|
@ -120,6 +120,14 @@ bool MenuItem::insertItem(MenuItem* before, MenuItem* item)
|
|||
return false;
|
||||
}
|
||||
|
||||
MenuItem* MenuItem::afterItem(MenuItem* item) const
|
||||
{
|
||||
int pos = _items.indexOf(item);
|
||||
if (pos < 0 || pos+1 == _items.size())
|
||||
return 0;
|
||||
return _items.at(pos+1);
|
||||
}
|
||||
|
||||
void MenuItem::removeItem(MenuItem* item)
|
||||
{
|
||||
int pos = _items.indexOf(item);
|
||||
|
|
|
@ -51,6 +51,7 @@ public:
|
|||
|
||||
void appendItem(MenuItem*);
|
||||
bool insertItem(MenuItem*, MenuItem*);
|
||||
MenuItem* afterItem(MenuItem*) const;
|
||||
void removeItem(MenuItem*);
|
||||
void clear();
|
||||
|
||||
|
|
|
@ -442,7 +442,7 @@ MenuItem* StdWorkbench::setupMenuBar() const
|
|||
*edit << "Std_Undo" << "Std_Redo" << "Separator" << "Std_Cut" << "Std_Copy"
|
||||
<< "Std_Paste" << "Std_DuplicateSelection" << "Separator"
|
||||
<< "Std_Refresh" << "Std_BoxSelection" << "Std_SelectAll" << "Std_Delete"
|
||||
<< "Std_Placement" << "Std_Alignment"
|
||||
<< "Separator" << "Std_Placement" /*<< "Std_TransformManip"*/ << "Std_Alignment"
|
||||
<< "Std_Edit" << "Separator" << "Std_DlgPreferences";
|
||||
|
||||
// Standard views
|
||||
|
|
|
@ -1347,6 +1347,42 @@ bool CmdCheckGeometry::isActive(void)
|
|||
return (hasActiveDocument() && !Gui::Control().activeDialog() && objectsSelected);
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
// Part_CheckGeometry
|
||||
//===========================================================================
|
||||
|
||||
DEF_STD_CMD_A(CmdColorPerFace);
|
||||
|
||||
CmdColorPerFace::CmdColorPerFace()
|
||||
: Command("Part_ColorPerFace")
|
||||
{
|
||||
sAppModule = "Part";
|
||||
sGroup = QT_TR_NOOP("Part");
|
||||
sMenuText = QT_TR_NOOP("Color per face");
|
||||
sToolTipText = QT_TR_NOOP("Set color per face");
|
||||
sStatusTip = sToolTipText;
|
||||
sWhatsThis = "Part_ColorPerFace";
|
||||
}
|
||||
|
||||
void CmdColorPerFace::activated(int iMsg)
|
||||
{
|
||||
if (getActiveGuiDocument()->getInEdit())
|
||||
getActiveGuiDocument()->resetEdit();
|
||||
std::vector<App::DocumentObject*> sel = Gui::Selection().getObjectsOfType(Part::Feature::getClassTypeId());
|
||||
Gui::ViewProvider* vp = Gui::Application::Instance->getViewProvider(sel.front());
|
||||
// FIXME: Need a way to force 'Color' edit mode
|
||||
// #0000477: Proper interface for edit modes of view provider
|
||||
if (vp)
|
||||
getActiveGuiDocument()->setEdit(vp, Gui::ViewProvider::Color);
|
||||
}
|
||||
|
||||
bool CmdColorPerFace::isActive(void)
|
||||
{
|
||||
Base::Type partid = Base::Type::fromName("Part::Feature");
|
||||
bool objectSelected = Gui::Selection().countObjectsOfType(partid) == 1;
|
||||
return (hasActiveDocument() && !Gui::Control().activeDialog() && objectSelected);
|
||||
}
|
||||
|
||||
|
||||
void CreatePartCommands(void)
|
||||
{
|
||||
|
@ -1381,4 +1417,5 @@ void CreatePartCommands(void)
|
|||
rcCmdMgr.addCommand(new CmdPartOffset());
|
||||
rcCmdMgr.addCommand(new CmdPartThickness());
|
||||
rcCmdMgr.addCommand(new CmdCheckGeometry());
|
||||
rcCmdMgr.addCommand(new CmdColorPerFace());
|
||||
}
|
||||
|
|
|
@ -75,6 +75,18 @@ Gui::MenuItem* Workbench::setupMenuBar() const
|
|||
<< "Part_RuledSurface" << "Part_Loft" << "Part_Sweep"
|
||||
<< "Part_Offset" << "Part_Thickness";
|
||||
|
||||
// leave this for 0.14 until #0000477 is fixed
|
||||
#if 0
|
||||
Gui::MenuItem* view = root->findItem("&View");
|
||||
if (view) {
|
||||
Gui::MenuItem* appr = view->findItem("Std_RandomColor");
|
||||
appr = view->afterItem(appr);
|
||||
Gui::MenuItem* face = new Gui::MenuItem();
|
||||
face->setCommand("Part_ColorPerFace");
|
||||
view->insertItem(appr, face);
|
||||
}
|
||||
#endif
|
||||
|
||||
return root;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user