Added support for event callbacks

This commit is contained in:
Robert Osfield
2005-03-07 14:16:15 +00:00
parent 238341b0da
commit c59b28ac3f
2 changed files with 35 additions and 0 deletions

View File

@@ -130,6 +130,11 @@ bool Drawable_writeLocalData(const Object& obj, Output& fw)
fw.writeObject(*drawable.getUpdateCallback());
}
if (drawable.getEventCallback())
{
fw.writeObject(*drawable.getEventCallback());
}
if (drawable.getCullCallback())
{
fw.writeObject(*drawable.getCullCallback());

View File

@@ -110,6 +110,27 @@ bool Node_readLocalData(Object& obj, Input& fr)
}
while (fr.matchSequence("EventCallback {"))
{
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) {
if (node.getEventCallback() == NULL) {
node.setEventCallback(nodecallback);
} else {
node.getEventCallback()->addNestedCallback(nodecallback);
}
}
else ++fr;
}
iteratorAdvanced = true;
}
while (fr.matchSequence("CullCallbacks {"))
{
int entry = fr[0].getNoNestedBrackets();
@@ -183,6 +204,15 @@ bool Node_writeLocalData(const Object& obj, Output& fw)
fw.indent() << "}" << std::endl;
}
if (node.getEventCallback())
{
fw.indent() << "EventCallbacks {" << std::endl;
fw.moveIn();
fw.writeObject(*node.getEventCallback());
fw.moveOut();
fw.indent() << "}" << std::endl;
}
if (node.getCullCallback())
{
fw.indent() << "CullCallbacks {" << std::endl;