mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-02-20 15:13:45 +00:00
Fixes issue where Regenerate Bounds button for SceneGroup/SubScenes wasn't displaying by moving it to Editing inspector group
Added mode toggle for if changing the transform influences the child objects of a SubScene or not Added onSelected/onUnselected callbacks for SimObjects to allow contextual behavior in the editor Added functionality of programmatic/dynamic Tool Button Palettes Added logic so when selecting SubScenes the world editor palette has new buttons for letting the move/rotate actions influence the child objects
This commit is contained in:
parent
10d1aeca1f
commit
e2d0cc1981
11 changed files with 318 additions and 25 deletions
|
|
@ -119,7 +119,7 @@ void SceneGroup::onInspect(GuiInspector* inspector)
|
|||
Parent::onInspect(inspector);
|
||||
|
||||
//Put the SubScene group before everything that'd be SubScene-effecting, for orginazational purposes
|
||||
GuiInspectorGroup* sceneGroupGrp = inspector->findExistentGroup(StringTable->insert("SceneGroup"));
|
||||
GuiInspectorGroup* sceneGroupGrp = inspector->findExistentGroup(StringTable->insert("Editing"));
|
||||
if (!sceneGroupGrp)
|
||||
return;
|
||||
|
||||
|
|
|
|||
|
|
@ -10,6 +10,8 @@
|
|||
#include "gui/editor/inspector/group.h"
|
||||
#include "T3D/gameBase/gameBase.h"
|
||||
|
||||
bool SubScene::smTransformChildren = false;
|
||||
|
||||
IMPLEMENT_CO_NETOBJECT_V1(SubScene);
|
||||
|
||||
S32 SubScene::mUnloadTimeoutMs = 5000;
|
||||
|
|
@ -86,6 +88,10 @@ void SubScene::consoleInit()
|
|||
|
||||
Con::addVariable("$SubScene::UnloadTimeoutMS", TypeBool, &SubScene::mUnloadTimeoutMs, "The amount of time in milliseconds it takes for a SubScene to be unloaded if it's inactive.\n"
|
||||
"@ingroup Editors\n");
|
||||
|
||||
Con::addVariable("$SubScene::transformChildren", TypeBool, &SubScene::smTransformChildren,
|
||||
"@brief If true, then transform manipulations modify child objects. If false, only triggering bounds is manipulated\n\n"
|
||||
"@ingroup Editors");
|
||||
}
|
||||
|
||||
void SubScene::addObject(SimObject* object)
|
||||
|
|
@ -163,6 +169,30 @@ void SubScene::inspectPostApply()
|
|||
setMaskBits(-1);
|
||||
}
|
||||
|
||||
void SubScene::setTransform(const MatrixF& mat)
|
||||
{
|
||||
if(SubScene::smTransformChildren)
|
||||
{
|
||||
Parent::setTransform(mat);
|
||||
}
|
||||
else
|
||||
{
|
||||
SceneObject::setTransform(mat);
|
||||
}
|
||||
}
|
||||
|
||||
void SubScene::setRenderTransform(const MatrixF& mat)
|
||||
{
|
||||
if (SubScene::smTransformChildren)
|
||||
{
|
||||
Parent::setRenderTransform(mat);
|
||||
}
|
||||
else
|
||||
{
|
||||
SceneObject::setRenderTransform(mat);
|
||||
}
|
||||
}
|
||||
|
||||
bool SubScene::evaluateCondition()
|
||||
{
|
||||
if (!mLoadIf.isEmpty())
|
||||
|
|
|
|||
|
|
@ -23,6 +23,9 @@ public:
|
|||
|
||||
void onLevelChanged() {}
|
||||
|
||||
protected:
|
||||
static bool smTransformChildren;
|
||||
|
||||
private:
|
||||
DECLARE_LEVELASSET(SubScene, Level, onLevelChanged);
|
||||
|
||||
|
|
@ -47,6 +50,7 @@ private:
|
|||
U32 mCurrTick;
|
||||
|
||||
bool mGlobalLayer;
|
||||
|
||||
public:
|
||||
SubScene();
|
||||
virtual ~SubScene();
|
||||
|
|
@ -71,6 +75,9 @@ public:
|
|||
//void onEditorDisable() override;
|
||||
void inspectPostApply() override;
|
||||
|
||||
void setTransform(const MatrixF& mat) override;
|
||||
void setRenderTransform(const MatrixF& mat) override;
|
||||
|
||||
bool testBox(const Box3F& testBox);
|
||||
bool evaluateCondition();
|
||||
void _onSelected() override;
|
||||
|
|
|
|||
|
|
@ -101,6 +101,8 @@ SimObjectId SimObject::smForcedId = 0;
|
|||
bool SimObject::preventNameChanging = false;
|
||||
|
||||
IMPLEMENT_CALLBACK(SimObject, onInspectPostApply, void, (SimObject* obj), (obj), "Generic callback for when an object is edited");
|
||||
IMPLEMENT_CALLBACK(SimObject, onSelected, void, (SimObject* obj), (obj), "Generic callback for when an object is selected");
|
||||
IMPLEMENT_CALLBACK(SimObject, onUnselected, void, (SimObject* obj), (obj), "Generic callback for when an object is un-selected");
|
||||
|
||||
namespace Sim
|
||||
{
|
||||
|
|
@ -527,6 +529,14 @@ bool SimObject::save(const char *pcFileName, bool bOnlySelected, const char *pre
|
|||
|
||||
}
|
||||
|
||||
bool SimObject::saveAppend(const char* pcFileName, bool bOnlySelected, const char* preappend)
|
||||
{
|
||||
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
SimPersistID* SimObject::getOrCreatePersistentId()
|
||||
|
|
@ -2207,11 +2217,13 @@ void SimObject::setSelected( bool sel )
|
|||
{
|
||||
mFlags.set( Selected );
|
||||
_onSelected();
|
||||
onSelected_callback(this);
|
||||
}
|
||||
else
|
||||
{
|
||||
mFlags.clear( Selected );
|
||||
_onUnselected();
|
||||
onUnselected_callback(this);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -579,6 +579,7 @@ class SimObject: public ConsoleObject, public TamlCallbacks
|
|||
|
||||
/// Save object as a TorqueScript File.
|
||||
virtual bool save( const char* pcFilePath, bool bOnlySelected = false, const char *preappend = NULL );
|
||||
virtual bool saveAppend(const char* pcFilePath, bool bOnlySelected = false, const char* preappend = NULL);
|
||||
|
||||
/// Check if a method exists in the objects current namespace.
|
||||
virtual bool isMethod( const char* methodName );
|
||||
|
|
@ -981,6 +982,8 @@ class SimObject: public ConsoleObject, public TamlCallbacks
|
|||
|
||||
DECLARE_CONOBJECT( SimObject );
|
||||
DECLARE_CALLBACK(void, onInspectPostApply, (SimObject* obj));
|
||||
DECLARE_CALLBACK(void, onSelected, (SimObject* obj));
|
||||
DECLARE_CALLBACK(void, onUnselected, (SimObject* obj));
|
||||
|
||||
static SimObject* __findObject( const char* id ) { return Sim::findObject( id ); }
|
||||
static const char* __getObjectId( ConsoleObject* object )
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue