show/hide children automagically for simgroups via inspector

operates by shifting oninspectpostapply callback further down the inheritance hieracrchy and add some scripts to trigger sethidden and setlocked for all sceneobjects in a given simgroup if the states are set for that group
This commit is contained in:
AzaezelX 2020-03-29 17:36:33 -05:00
parent 482b179baa
commit bf50af7954
5 changed files with 11 additions and 4 deletions

View file

@ -57,6 +57,8 @@ SimObjectId SimObject::smForcedId = 0;
bool SimObject::preventNameChanging = false; bool SimObject::preventNameChanging = false;
IMPLEMENT_CALLBACK(SimObject, onInspectPostApply, void, (SimObject* obj), (obj), "Generic callback for when an object is edited");
namespace Sim namespace Sim
{ {
// Defined in simManager.cpp // Defined in simManager.cpp
@ -2237,6 +2239,7 @@ void SimObject::inspectPreApply()
void SimObject::inspectPostApply() void SimObject::inspectPostApply()
{ {
onInspectPostApply_callback(this);
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------

View file

@ -965,6 +965,7 @@ class SimObject: public ConsoleObject, public TamlCallbacks
virtual void getConsoleMethodData(const char * fname, S32 routingId, S32 * type, S32 * minArgs, S32 * maxArgs, void ** callback, const char ** usage) {} virtual void getConsoleMethodData(const char * fname, S32 routingId, S32 * type, S32 * minArgs, S32 * maxArgs, void ** callback, const char ** usage) {}
DECLARE_CONOBJECT( SimObject ); DECLARE_CONOBJECT( SimObject );
DECLARE_CALLBACK(void, onInspectPostApply, (SimObject* obj));
static SimObject* __findObject( const char* id ) { return Sim::findObject( id ); } static SimObject* __findObject( const char* id ) { return Sim::findObject( id ); }
static const char* __getObjectId( ConsoleObject* object ) static const char* __getObjectId( ConsoleObject* object )

View file

@ -93,7 +93,6 @@ ConsoleDocClass( SceneObject,
"@ingroup gameObjects\n" "@ingroup gameObjects\n"
); );
IMPLEMENT_CALLBACK(SceneObject, onInspectPostApply, void, (SceneObject* obj), (obj),"Generic callback for when an object is edited");
#ifdef TORQUE_TOOLS #ifdef TORQUE_TOOLS
extern bool gEditingMission; extern bool gEditingMission;
#endif #endif
@ -377,7 +376,6 @@ void SceneObject::inspectPostApply()
{ {
if( isServerObject() ) if( isServerObject() )
setMaskBits( MountedMask ); setMaskBits( MountedMask );
onInspectPostApply_callback(this);
Parent::inspectPostApply(); Parent::inspectPostApply();
} }

View file

@ -794,7 +794,6 @@ class SceneObject : public NetObject, private SceneContainer::Link, public Proce
static bool _setGameObject(void* object, const char* index, const char* data); static bool _setGameObject(void* object, const char* index, const char* data);
DECLARE_CONOBJECT( SceneObject ); DECLARE_CONOBJECT( SceneObject );
DECLARE_CALLBACK(void, onInspectPostApply, (SceneObject* obj));
private: private:
SceneObject( const SceneObject& ); ///< @deprecated disallowed SceneObject( const SceneObject& ); ///< @deprecated disallowed

View file

@ -489,4 +489,10 @@ function foCollaps (%this, %tab){
case "container2": case "container2":
%tab.visible = "0"; %tab.visible = "0";
} }
} }
function simGroup::onInspectPostApply(%this)
{
%this.callOnChildren("setHidden",%this.hidden);
%this.callOnChildren("setLocked",%this.locked);
}