void PointerNode::manipulate (int b) { // Immediately when the user presses the manipulate button, we check to see // if we are pointing at a new node. ie, we make sure the user is NOT // pointing at a dragger anymore, and if (b && spinApp::Instance().getContext()->isServer()) { if (1) //!getDraggerFromIntersections()) { GroupNode *lastNode = dynamic_cast<GroupNode*>(lastManipulated->s_thing); GroupNode *newNode = dynamic_cast<GroupNode*>(getNodeFromIntersections(0)); if (newNode && (newNode!=lastNode)) { dragger_ = NULL; if (lastNode) lastNode->setManipulator("NULL"); newNode->setManipulator(lastManipulatorType_.c_str()); lastManipulated = newNode->getNodeSymbol(); } } } // then we just set the 'doManipulation' flag, which will doManipulation = (bool) b; BROADCAST(this, "si", "manipulate", this->getManipulate()); }
void PointerNode::setManipulator(const char *manipulatorType) { if (spinApp::Instance().getContext()->isServer()) { GroupNode *lastNode = dynamic_cast<GroupNode*>(lastManipulated->s_thing); // see if there is an intersection with a GroupNode, and if so, tell // that node to enable the manipulator GroupNode *n = dynamic_cast<GroupNode*>(getNodeFromIntersections(0)); if (n) { // if we're targetting a new node, make sure that the last // manipulated node's dragger gets turned off: if ((lastNode) && (n != lastNode)) lastNode->setManipulator("NULL"); n->setManipulator(manipulatorType); lastManipulated = n->getNodeSymbol(); } // if there was no intersection, load the manipulator on the last object // that was manipulated else if (lastNode) { lastNode->setManipulator(manipulatorType); } lastManipulatorType_ = std::string(manipulatorType); } else { BROADCAST(this, "ss", "setManipulator", manipulatorType); } }