From a8205240e3eb2e7558a3f861bc2a65c6a9647878 Mon Sep 17 00:00:00 2001 From: Daniel Buckmaster Date: Wed, 26 Sep 2012 23:28:58 +1000 Subject: [PATCH 1/3] Made Item network members properly in the editor. --- Engine/source/T3D/item.cpp | 5 +++++ Engine/source/T3D/item.h | 1 + 2 files changed, 6 insertions(+) diff --git a/Engine/source/T3D/item.cpp b/Engine/source/T3D/item.cpp index 80f10a1ea..5caf8e5c4 100644 --- a/Engine/source/T3D/item.cpp +++ b/Engine/source/T3D/item.cpp @@ -457,6 +457,11 @@ void Item::onDeleteNotify( SimObject *obj ) Parent::onDeleteNotify( obj ); } +void Item::inspectPostApply() +{ + setMaskBits(InitialUpdateMask); +} + // Lighting: ----------------------------------------------------------------- void Item::registerLights(LightManager * lightManager, bool lightingScene) diff --git a/Engine/source/T3D/item.h b/Engine/source/T3D/item.h index fd6822b7c..b3020009e 100644 --- a/Engine/source/T3D/item.h +++ b/Engine/source/T3D/item.h @@ -149,6 +149,7 @@ class Item: public ShapeBase bool buildPolyList(PolyListContext context, AbstractPolyList* polyList, const Box3F &box, const SphereF &sphere); void buildConvex(const Box3F& box, Convex* convex); void onDeleteNotify(SimObject*); + void inspectPostApply(); protected: void _updatePhysics(); From 0f22ca64d4806b8eecef5905c4ed8405ca271551 Mon Sep 17 00:00:00 2001 From: Daniel Buckmaster Date: Thu, 27 Sep 2012 08:11:48 +1000 Subject: [PATCH 2/3] Moved mask updated to protected member set functions. --- Engine/source/T3D/item.cpp | 24 +++++++++++++++++------- Engine/source/T3D/item.h | 4 +++- 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/Engine/source/T3D/item.cpp b/Engine/source/T3D/item.cpp index 5caf8e5c4..fbc7b7ca6 100644 --- a/Engine/source/T3D/item.cpp +++ b/Engine/source/T3D/item.cpp @@ -457,11 +457,6 @@ void Item::onDeleteNotify( SimObject *obj ) Parent::onDeleteNotify( obj ); } -void Item::inspectPostApply() -{ - setMaskBits(InitialUpdateMask); -} - // Lighting: ----------------------------------------------------------------- void Item::registerLights(LightManager * lightManager, bool lightingScene) @@ -1281,11 +1276,26 @@ DefineEngineMethod( Item, getLastStickyNormal, const char *, (),, //---------------------------------------------------------------------------- +bool Item::_setStatic(void *object, const char *index, const char *data) +{ + Item *i = static_cast(object); + i->mAtRest = false; + i->setMaskBits(InitialUpdateMask | PositionMask); + return true; +} + +bool Item::_setRotate(void *object, const char *index, const char *data) +{ + Item *i = static_cast(object); + i->setMaskBits(InitialUpdateMask | RotationMask); + return true; +} + void Item::initPersistFields() { addGroup("Misc"); - addField("static", TypeBool, Offset(mStatic, Item), "If true, the object is not moving in the world (and will not be updated through the network).\n"); - addField("rotate", TypeBool, Offset(mRotate, Item), "If true, the object will automatically rotate around its Z axis.\n"); + addProtectedField("static", TypeBool, Offset(mStatic, Item), &_setStatic, &defaultProtectedGetFn, "If true, the object is not moving in the world (and will not be updated through the network).\n"); + addProtectedField("rotate", TypeBool, Offset(mRotate, Item), &_setRotate, &defaultProtectedGetFn, "If true, the object will automatically rotate around its Z axis.\n"); endGroup("Misc"); Parent::initPersistFields(); diff --git a/Engine/source/T3D/item.h b/Engine/source/T3D/item.h index b3020009e..27e46fb70 100644 --- a/Engine/source/T3D/item.h +++ b/Engine/source/T3D/item.h @@ -149,7 +149,9 @@ class Item: public ShapeBase bool buildPolyList(PolyListContext context, AbstractPolyList* polyList, const Box3F &box, const SphereF &sphere); void buildConvex(const Box3F& box, Convex* convex); void onDeleteNotify(SimObject*); - void inspectPostApply(); + + static bool _setStatic(void *object, const char *index, const char *data); + static bool _setRotate(void *object, const char *index, const char *data); protected: void _updatePhysics(); From f10ea8bbd4e7ca24e80b178e15e58b38a22b8589 Mon Sep 17 00:00:00 2001 From: Daniel Buckmaster Date: Fri, 28 Sep 2012 07:28:00 +1000 Subject: [PATCH 3/3] Fixed mAtRest logic when setting static flag. --- Engine/source/T3D/item.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Engine/source/T3D/item.cpp b/Engine/source/T3D/item.cpp index fbc7b7ca6..6546404e8 100644 --- a/Engine/source/T3D/item.cpp +++ b/Engine/source/T3D/item.cpp @@ -1279,7 +1279,7 @@ DefineEngineMethod( Item, getLastStickyNormal, const char *, (),, bool Item::_setStatic(void *object, const char *index, const char *data) { Item *i = static_cast(object); - i->mAtRest = false; + i->mAtRest = dAtob(data); i->setMaskBits(InitialUpdateMask | PositionMask); return true; } @@ -1294,7 +1294,7 @@ bool Item::_setRotate(void *object, const char *index, const char *data) void Item::initPersistFields() { addGroup("Misc"); - addProtectedField("static", TypeBool, Offset(mStatic, Item), &_setStatic, &defaultProtectedGetFn, "If true, the object is not moving in the world (and will not be updated through the network).\n"); + addProtectedField("static", TypeBool, Offset(mStatic, Item), &_setStatic, &defaultProtectedGetFn, "If true, the object is not moving in the world.\n"); addProtectedField("rotate", TypeBool, Offset(mRotate, Item), &_setRotate, &defaultProtectedGetFn, "If true, the object will automatically rotate around its Z axis.\n"); endGroup("Misc");