Added a AnimationPathCallback which can update both a MatrixTransform and a
PositionAttitudeTransform, removed the equivialnt callbacks once found in these transform classes. Changed the NodeCallback class so its derived from osg::Object instead of osg::Referenced to allow it to be saved out in the .osg format. Added support for Update and Cull callbacks into the .osg file format. Added support for AnimationPathCallback into the .osg file format.
This commit is contained in:
@@ -95,6 +95,37 @@ bool Node_readLocalData(Object& obj, Input& fr)
|
||||
}
|
||||
|
||||
|
||||
static ref_ptr<NodeCallback> s_nodecallback = new osg::NodeCallback;
|
||||
while (fr.matchSequence("UpdateCallback {"))
|
||||
{
|
||||
int entry = fr[0].getNoNestedBrackets();
|
||||
fr += 2;
|
||||
|
||||
while (!fr.eof() && fr[0].getNoNestedBrackets()>entry)
|
||||
{
|
||||
NodeCallback* nodecallback = dynamic_cast<NodeCallback*>(fr.readObjectOfType(*s_nodecallback));
|
||||
if (nodecallback) node.setUpdateCallback(nodecallback);
|
||||
else ++fr;
|
||||
}
|
||||
iteratorAdvanced = true;
|
||||
|
||||
}
|
||||
|
||||
while (fr.matchSequence("CullCallback {"))
|
||||
{
|
||||
int entry = fr[0].getNoNestedBrackets();
|
||||
fr += 2;
|
||||
|
||||
while (!fr.eof() && fr[0].getNoNestedBrackets()>entry)
|
||||
{
|
||||
NodeCallback* nodecallback = dynamic_cast<NodeCallback*>(fr.readObjectOfType(*s_nodecallback));
|
||||
if (nodecallback) node.setUpdateCallback(nodecallback);
|
||||
else ++fr;
|
||||
}
|
||||
iteratorAdvanced = true;
|
||||
|
||||
}
|
||||
|
||||
return iteratorAdvanced;
|
||||
}
|
||||
|
||||
@@ -147,6 +178,24 @@ bool Node_writeLocalData(const Object& obj, Output& fw)
|
||||
{
|
||||
fw.writeObject(*node.getStateSet());
|
||||
}
|
||||
|
||||
if (node.getUpdateCallback())
|
||||
{
|
||||
fw.indent() << "UpdateCallbacks {" << std::endl;
|
||||
fw.moveIn();
|
||||
fw.writeObject(*node.getUpdateCallback());
|
||||
fw.moveOut();
|
||||
fw.indent() << "}" << std::endl;
|
||||
}
|
||||
|
||||
if (node.getCullCallback())
|
||||
{
|
||||
fw.indent() << "CullCallbacks {" << std::endl;
|
||||
fw.moveIn();
|
||||
fw.writeObject(*node.getCullCallback());
|
||||
fw.moveOut();
|
||||
fw.indent() << "}" << std::endl;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user