Skip to content

Commit

Permalink
GeometryView -- add context menu entry for applying color to children.
Browse files Browse the repository at this point in the history
  • Loading branch information
osschar committed Oct 27, 2014
1 parent a02b5d1 commit 1aaad1c
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 6 deletions.
2 changes: 2 additions & 0 deletions Fireworks/Core/interface/FWGeoTopNode.h
Expand Up @@ -50,6 +50,8 @@ class FWGeoTopNode : public TEveElementList,
kVisSelfOff,
kVisChldOn,
kVisChldOff,
kApplyChldCol,
kApplyChldColRec,
kCamera,
kPrintMaterial,
kPrintPath,
Expand Down
4 changes: 4 additions & 0 deletions Fireworks/Core/interface/FWGeometryTableManagerBase.h
Expand Up @@ -78,6 +78,8 @@ class FWGeometryTableManagerBase : public FWTableManagerBase
bool testBitAny(UChar_t f) const { return (m_flags & f) != 0; }

void switchBit(UChar_t f) { testBit(f) ? resetBit(f) : setBit(f); }

void copyColorTransparency(const NodeInfo& x) { m_color = x.m_color; m_transparency = x.m_transparency; }
};


Expand Down Expand Up @@ -161,6 +163,8 @@ class FWGeometryTableManagerBase : public FWTableManagerBase
virtual bool getVisibilityChld(const NodeInfo& nodeInfo) const;
virtual bool getVisibility (const NodeInfo& nodeInfo) const;

virtual void applyColorTranspToDaughters(int selectedIdx, bool recurse);

bool isNodeRendered(int idx, int top_node_idx) const;

static void getNNodesTotal(TGeoNode* geoNode, int& off);
Expand Down
8 changes: 5 additions & 3 deletions Fireworks/Core/src/FWGeoTopNode.cc
Expand Up @@ -378,13 +378,15 @@ FWPopupMenu* FWGeoTopNode::setPopupMenu(int iX, int iY, TGLViewer* v, bool overl
FWPopupMenu* nodePopup = new FWPopupMenu();

nodePopup->AddEntry("Set As Top Node", kSetTopNode);
nodePopup->AddEntry("Set As Top Node And Reset Camera", kSetTopNodeCam);
nodePopup->AddEntry("Set As Top Node and Reset Camera", kSetTopNodeCam);
nodePopup->AddSeparator();
if (v) {
nodePopup->AddEntry("Rnr Off", kVisSelfOff);
}
nodePopup->AddEntry("Rnr Off For All Children", kVisChldOff);
nodePopup->AddEntry("Rnr On For All Children", kVisChldOn);
nodePopup->AddEntry("Turn Render On For Children", kVisChldOn);
nodePopup->AddEntry("Turn Render Off For Children", kVisChldOff);
nodePopup->AddEntry("Apply Color To Children", kApplyChldCol);
nodePopup->AddEntry("Apply Color Recursively", kApplyChldColRec);
nodePopup->AddSeparator();

if (overlap)
Expand Down
30 changes: 29 additions & 1 deletion Fireworks/Core/src/FWGeometryTableManagerBase.cc
Expand Up @@ -323,7 +323,8 @@ void FWGeometryTableManagerBase::setVisibilityChld(NodeInfo& data, bool x)
{
data.setBitVal(kVisNodeChld, x);
}
//______________________________________________________________________________

//------------------------------------------------------------------------------

void FWGeometryTableManagerBase::setDaughtersSelfVisibility(int selectedIdx, bool v)
{
Expand All @@ -349,11 +350,38 @@ bool FWGeometryTableManagerBase::getVisibility(const NodeInfo& data) const
return data.testBit(kVisNodeSelf);
}

//------------------------------------------------------------------------------

bool FWGeometryTableManagerBase::getVisibilityChld(const NodeInfo& data) const
{
return data.testBit(kVisNodeChld);
}

//------------------------------------------------------------------------------

void FWGeometryTableManagerBase::applyColorTranspToDaughters(int selectedIdx, bool recurse)
{
NodeInfo &nInfo = m_entries[selectedIdx];
TGeoNode *parentNode = nInfo.m_node;
int nD = parentNode->GetNdaughters();
int dOff = 0;
for (int n = 0; n != nD; ++n)
{
int idx = selectedIdx + 1 + n + dOff;
NodeInfo& data = m_entries[idx];

data.copyColorTransparency(nInfo);

if (recurse)
{
applyColorTranspToDaughters(idx, recurse);
}

getNNodesTotal(parentNode->GetDaughter(n), dOff);
}
}

//------------------------------------------------------------------------------

bool FWGeometryTableManagerBase::isNodeRendered(int idx, int topNodeIdx) const
{
Expand Down
14 changes: 12 additions & 2 deletions Fireworks/Core/src/FWGeometryTableViewBase.cc
Expand Up @@ -522,10 +522,20 @@ void FWGeometryTableViewBase::chosenItem(int menuIdx)
break;

case FWGeoTopNode::kVisChldOn:
getTableManager()->setDaughtersSelfVisibility(selectedIdx, true);
getTableManager()->setDaughtersSelfVisibility(selectedIdx, true);
refreshTable3D();
break;


case FWGeoTopNode::kApplyChldCol:
getTableManager()->applyColorTranspToDaughters(selectedIdx, false);
refreshTable3D();
break;

case FWGeoTopNode::kApplyChldColRec:
getTableManager()->applyColorTranspToDaughters(selectedIdx, true);
refreshTable3D();
break;

case FWGeoTopNode::kPrintMaterial:
gv->InspectMaterial();
break;
Expand Down

0 comments on commit 1aaad1c

Please sign in to comment.