| [11009] | 1 | |
|---|
| 2 | |
|---|
| 3 | |
|---|
| 4 | |
|---|
| 5 | |
|---|
| 6 | |
|---|
| 7 | |
|---|
| 8 | |
|---|
| 9 | |
|---|
| 10 | |
|---|
| 11 | |
|---|
| 12 | |
|---|
| 13 | |
|---|
| 14 | |
|---|
| 15 | |
|---|
| 16 | #include <osgDB/Input> |
|---|
| 17 | #include <osgDB/Output> |
|---|
| 18 | #include <osgDB/Registry> |
|---|
| 19 | #include <osgDB/ReaderWriter> |
|---|
| 20 | #include <osg/io_utils> |
|---|
| 21 | #include <osgAnimation/StackedTransformElement> |
|---|
| 22 | #include <osgAnimation/UpdateMatrixTransform> |
|---|
| 23 | |
|---|
| 24 | |
|---|
| 25 | using namespace osg; |
|---|
| 26 | using namespace osgDB; |
|---|
| 27 | |
|---|
| 28 | bool UpdateMatrixTransform_readLocalData(Object& obj, Input& fr) |
|---|
| 29 | { |
|---|
| 30 | bool iteratorAdvanced = false; |
|---|
| 31 | |
|---|
| 32 | osgAnimation::UpdateMatrixTransform& updateCallback = dynamic_cast<osgAnimation::UpdateMatrixTransform&>(obj); |
|---|
| 33 | osgAnimation::StackedTransform& stackedTransform = updateCallback.getStackedTransforms(); |
|---|
| 34 | |
|---|
| 35 | int entry = fr[0].getNoNestedBrackets(); |
|---|
| 36 | while (!fr.eof() && fr[0].getNoNestedBrackets() == entry && fr.matchSequence("%w {")) |
|---|
| 37 | { |
|---|
| 38 | osgAnimation::StackedTransformElement* element = dynamic_cast<osgAnimation::StackedTransformElement*>(fr.readObject()); |
|---|
| 39 | if (element) |
|---|
| 40 | stackedTransform.push_back(element); |
|---|
| 41 | } |
|---|
| 42 | return iteratorAdvanced; |
|---|
| 43 | } |
|---|
| 44 | |
|---|
| 45 | |
|---|
| 46 | |
|---|
| 47 | bool UpdateMatrixTransform_writeLocalData(const Object& obj, Output& fw) |
|---|
| 48 | { |
|---|
| 49 | const osgAnimation::UpdateMatrixTransform* uc = dynamic_cast<const osgAnimation::UpdateMatrixTransform*>(&obj); |
|---|
| 50 | const osgAnimation::StackedTransform& transforms = uc->getStackedTransforms(); |
|---|
| 51 | for (osgAnimation::StackedTransform::const_iterator it = transforms.begin(); it != transforms.end(); ++it) |
|---|
| 52 | { |
|---|
| [11034] | 53 | osgAnimation::StackedTransformElement* element = it->get(); |
|---|
| [11009] | 54 | if (element) |
|---|
| 55 | fw.writeObject(*element); |
|---|
| 56 | } |
|---|
| 57 | return true; |
|---|
| 58 | } |
|---|
| 59 | |
|---|
| 60 | |
|---|
| 61 | RegisterDotOsgWrapperProxy g_UpdateMatrixTransformProxy |
|---|
| 62 | ( |
|---|
| 63 | new osgAnimation::UpdateMatrixTransform, |
|---|
| 64 | "osgAnimation::UpdateMatrixTransform", |
|---|
| 65 | "Object NodeCallback osgAnimation::UpdateMatrixTransform", |
|---|
| 66 | &UpdateMatrixTransform_readLocalData, |
|---|
| 67 | &UpdateMatrixTransform_writeLocalData, |
|---|
| 68 | DotOsgWrapper::READ_AND_WRITE |
|---|
| 69 | ); |
|---|