Esempio n. 1
0
void
SoRotor::notify(SoNotList *list)
//
////////////////////////////////////////////////////////////////////////
{
    SoNotRec *rec = list->getFirstRec();

    // only interested in a field-to-container notification
    if (rec->getType() == SoNotRec::CONTAINER &&
	rec->getBase() == this &&
	list->getLastField() == &rotation) {

	if (rotationSensor)
	    rotationSensor->schedule();
    }

    SoRotation::notify(list);
}
Esempio n. 2
0
/*!
  Called from entity we are monitoring when it changes.

  If this is an immediate sensor, the field and node (if any) causing
  the change will be stored and can be fetched by getTriggerField()
  and getTriggerNode(). If the triggerpath flag has been set, the path
  down to the node is also found and stored for later retrieval by
  getTriggerPath().

  \sa setTriggerPathFlag()
*/
void
SoDataSensor::notify(SoNotList * l)
{
  if (this->triggerpath != NULL) {
    this->triggerpath->unref();
    this->triggerpath = NULL;
  }
  this->triggerfield = NULL;
  this->triggernode = NULL;

  if (this->getPriority() == 0) {
    this->triggerfield = l->getLastField();
    SoNotRec * record = l->getFirstRecAtNode();
    this->triggernode = (SoNode *) (record ? record->getBase() : NULL);

    if (this->findpath && this->triggernode) {
      const SoNotRec * record = l->getLastRec();
      // find last record with node base (we know there's at least one
      // because of triggernode)
      while (!record->getBase()->isOfType(SoNode::getClassTypeId())) {
        record = record->getPrevious();
      }
      // create path down to triggernode
      this->triggerpath = new SoPath((SoNode*)record->getBase());
      this->triggerpath->ref();
      while (record->getBase() != this->triggernode) {
        record = record->getPrevious();
        this->triggerpath->append((SoNode*) record->getBase());
      }
    }

    this->triggeroperationtype = record ? record->getOperationType() : SoNotRec::UNSPECIFIED;
    this->triggerindex = record ? record->getIndex() : -1;
    this->triggerfieldnumindices = record ? record->getFieldNumIndices() : 0;
    this->triggergroupchild = (SoNode *) (record ? record->getGroupChild() : NULL);
    this->triggergroupprevchild = (SoNode *) (record ? record->getGroupPrevChild() : NULL);
  }
  this->schedule();
}