Remote Controllable Scene Graph

Embed indices of children into Node identifier
eg Node_A 1\1\
 

Eg To load a file filename into Node_A

Locally - Send Request

// load file locally into Node_A
pfNode* tmp = pfdLoadFile(filename);
Node_A->addChild(tmp);
//get the string encoding for this node Node_A
string node_str = nodeToStr(Node_A);
//send request
LOAD_CHILD node_str filename

Remotely - Handle Request

//receive request
LOAD_CHILD ?1\1\? filename
//get the node for the string above
pfNode* parent = strToNode(?1\1?);
//perform loading locally
pfNode* tmp = pfdLoadFile(filename);
Parent->addChild(tmp);
 

string nodeToStr(pfNode* node) {
string str;
pfNode* curNode = node;
pfNode* parent = curNode->getParent();
while (parent!=NULL) {
int index = parent->search(curNode);
str.insertInFront(index+"\");
curNode = parent;
parent = curNode->getParent();
}

return str;

}
pfNode* strToNode(string str) {
pfNode* node = root of scene graph;
int index = strtok(str,"\");
while (!endOfString(str)) {
node = node->getChild(index);
}
return str;
}