ComponentTransitPtr SceneNodeTreeComponentGenerator::getTreeComponent(Tree* const Parent, const boost::any& Value, bool IsSelected, bool Expanded, bool Leaf, UInt32 Row, bool HasFocus) { NodeUnrecPtr TheNode; try { TheNode = boost::any_cast<NodeUnrecPtr>(Value); } catch (boost::bad_any_cast &) { //Could not convert to FieldContinerFieldPath return ComponentTransitPtr(NULL); } //Get the text for the label std::string LabelText(""); if(TheNode != NULL) { const Char8* name(getName(TheNode)); if(name) { LabelText += std::string(name) + " "; } if(TheNode->getCore() != NULL) { LabelText += std::string("[") + TheNode->getCore()->getType().getCName() + "]"; } else { LabelText += "[NULL core]"; } } else { LabelText += "NULL"; } ComponentRecPtr GenComp = getTreeComponentText(Parent, LabelText, IsSelected, Expanded, Leaf, Row, HasFocus); if(TheNode != NULL && !(TheNode->getTravMask() & getTravMask())) { GenComp->setEnabled(false); } return ComponentTransitPtr(GenComp); }
void Node::updateVolume(void) { // still valid or static, nothing to do if(_sfVolume.getValue().isValid () == true || _sfVolume.getValue().isStatic() == true || getTravMask() == 0x0000 ) { return; } // be careful to not change the real volume. If two threads // are updating the same aspect this will lead to chaos BoxVolume vol = _sfVolume.getValue(); MFUnrecChildNodePtr::const_iterator cIt = this->getMFChildren()->begin(); MFUnrecChildNodePtr::const_iterator cEnd = this->getMFChildren()->end(); vol.setEmpty(); for(; cIt != cEnd; ++cIt) { if(*cIt != NULL && (*cIt)->getTravMask()) { (*cIt)->updateVolume(); vol.extendBy((*cIt)->getVolume()); } } // test for null core. Shouldn't happen, but just in case... if(getCore() != NULL) { getCore()->adjustVolume(vol); } // don't propagate the static flag from children vol.setStatic(false); editSField(VolumeFieldMask); _sfVolume.setValue(vol); }
void StagedViewport::renderWithStage(RenderActionBase *action) { _pTravValidator->incEventCounter(); if(this->getTravMask() == 0x0000) return; if(getCamera() == NULL) { SWARNING << "Viewport::render: no Camera, can not render!" << std::endl; return; } if(getBackground() == NULL) { SWARNING << "Viewport::render: no Background, can not render!" << std::endl; return; } if(getRoot() == NULL) { SWARNING << "Viewport::render: no root, can not render!" << std::endl; return; } #if 0 // Have to check GV activate(); #endif action->setCamera (getCamera ()); action->setBackground(getBackground()); action->setViewarea (this ); action->setTravMask (getTravMask() ); action->apply(_stageNode); // Blit the result // myTarget && stageTarget => assume stage renders into stageTarget, blit this into myTarget (TODO) // !myTarget && stageTarget => assume stage renders into stageTarget, blit this into back buffer // !myTarget && !stageTarget => assume stage renders into back buffer, no blitting // myTarget && !stageTarget => assume stage renders into myTarget, no blitting StageUnrecPtr stage = getStage(); FrameBufferObjectUnrecPtr myTarget = this->getTarget(); FrameBufferObjectUnrecPtr stageTarget = stage->getRenderTarget(); FrameBufferObjectUnrecPtr theTarget = stageTarget ? stageTarget : myTarget; if( !myTarget && stageTarget ) stretchTargetToFrameBuffer(action, theTarget); //Window *pWin = action->getWindow(); //if((pWin->getDrawMode() & Window::PartitionDrawMask) == // Window::SequentialPartitionDraw) //{ // DrawEnv oEnv; // oEnv.setWindow(action->getWindow()); // oEnv.setTileFullSize(getCamera()->tileGetFullSize()); // oEnv.setTileRegion (getCamera()->tileGetRegion ()); // oEnv.setDrawerId (action->getDrawerId ()); // oEnv.setDrawableId(action->getDrawableId()); // for(UInt16 i=0; i < getMFForegrounds()->size(); i++) // { // Foreground *pForeground = getForegrounds(i); // FrameBufferObject *pTarget = this->getTarget(); // if(pTarget != NULL) // { // pTarget->activate(&oEnv); // } // pForeground->draw(&oEnv, this); // if(pTarget != NULL) // { // pTarget->deactivate(&oEnv); // } // } //} //else //{ // if(_pForegroundTask == NULL) // { // _pForegroundTask = // new ViewportDrawTask(this, ViewportDrawTask::Foregrounds); // } // pWin->queueTaskFromDrawer(_pForegroundTask); //} #if 0 // Have to check GV deactivate(); #endif }
void DepthFirstStateAction::pushChildren(const NodePtr &pNode, ResultE result) { if(result & (NewActionTypes::Skip | NewActionTypes::Break | NewActionTypes::Quit )) { setChildrenListEnabled(false); setNumPasses (1 ); getExtraChildrenList().clear(); return; } ChildrenList &cl = getChildrenList (); ExtraChildrenList &ecl = getExtraChildrenList(); if(getChildrenListEnabled() == true) { for(UInt32 i = 0, size = cl.getSize(); i < size; ++i) { if(( cl.getActive(i) == true ) && ( cl.getChild (i) != NullFC) && ((cl.getChild (i)->getTravMask() & getTravMask()) != 0 ) ) { // gained refs: child incRefCount(_itActiveState); _nodeStack.push_back( NodeStackEntry(cl.getChild(i), _itActiveState, 1)); } } } else { MFNodePtr::const_iterator itChildren = pNode->getMFChildren()->begin(); MFNodePtr::const_iterator endChildren = pNode->getMFChildren()->end (); for(; itChildren != endChildren; ++itChildren) { if(( *itChildren != NullFC) && (((*itChildren)->getTravMask() & getTravMask()) != 0 ) ) { // gained refs: child incRefCount(_itActiveState); _nodeStack.push_back( NodeStackEntry(*itChildren, _itActiveState, 1)); } } } for(UInt32 i = 0, size = ecl.getSize(); i < size; ++i) { if(( ecl.getActive(i) == true ) && ( ecl.getChild (i) != NullFC) && ((ecl.getChild (i)->getTravMask() & getTravMask()) != 0 ) ) { // gained refs: extra child incRefCount(_itActiveState); _nodeStack.push_back( NodeStackEntry(ecl.getChild(i), _itActiveState, 1)); } } setChildrenListEnabled(false); ecl.clear ( ); setNumPasses (1 ); }