mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-02-13 11:43:49 +00:00
Fixes the inspector/component editor to display the components attached to an entity correctly in the inspector.
This commit is contained in:
parent
74b7e4cd89
commit
c74a7b1bc2
10 changed files with 513 additions and 44 deletions
|
|
@ -32,6 +32,7 @@
|
|||
#include "gui/editor/inspector/entityGroup.h"
|
||||
#include "gui/editor/inspector/mountingGroup.h"
|
||||
#include "gui/editor/inspector/componentGroup.h"
|
||||
#include "T3D/components/component.h"
|
||||
|
||||
IMPLEMENT_CONOBJECT(GuiInspector);
|
||||
|
||||
|
|
@ -590,6 +591,13 @@ void GuiInspector::refresh()
|
|||
//Entity inspector group
|
||||
if (mTargets.first()->getClassRep()->isSubclassOf("Entity"))
|
||||
{
|
||||
//Put the GameObject group before everything that'd be gameobject-effecting, for orginazational purposes
|
||||
GuiInspectorGroup *gameObject = new GuiInspectorGroup("GameObject", this);
|
||||
|
||||
gameObject->registerObject();
|
||||
mGroups.push_back(gameObject);
|
||||
addObject(gameObject);
|
||||
|
||||
GuiInspectorEntityGroup *components = new GuiInspectorEntityGroup("Components", this);
|
||||
if (components != NULL)
|
||||
{
|
||||
|
|
@ -598,6 +606,29 @@ void GuiInspector::refresh()
|
|||
addObject(components);
|
||||
}
|
||||
|
||||
Entity* selectedEntity = dynamic_cast<Entity*>(mTargets.first().getObject());
|
||||
|
||||
U32 compCount = selectedEntity->getComponentCount();
|
||||
//Now, add the component groups
|
||||
for (U32 c = 0; c < compCount; ++c)
|
||||
{
|
||||
Component* comp = selectedEntity->getComponent(c);
|
||||
|
||||
String compName;
|
||||
if (comp->getFriendlyName() != StringTable->EmptyString())
|
||||
compName = comp->getFriendlyName();
|
||||
else
|
||||
compName = comp->getComponentName();
|
||||
|
||||
GuiInspectorGroup *compGroup = new GuiInspectorComponentGroup(compName, this, comp);
|
||||
if (compGroup != NULL)
|
||||
{
|
||||
compGroup->registerObject();
|
||||
mGroups.push_back(compGroup);
|
||||
addObject(compGroup);
|
||||
}
|
||||
}
|
||||
|
||||
//Mounting group override
|
||||
GuiInspectorGroup *mounting = new GuiInspectorMountingGroup("Mounting", this);
|
||||
if (mounting != NULL)
|
||||
|
|
@ -608,20 +639,6 @@ void GuiInspector::refresh()
|
|||
}
|
||||
}
|
||||
|
||||
if (mTargets.first()->getClassRep()->isSubclassOf("Component"))
|
||||
{
|
||||
//Build the component field groups as the component describes it
|
||||
Component* comp = dynamic_cast<Component*>(mTargets.first().getPointer());
|
||||
|
||||
if (comp->getComponentFieldCount() > 0)
|
||||
{
|
||||
GuiInspectorComponentGroup *compGroup = new GuiInspectorComponentGroup("Component Fields", this);
|
||||
compGroup->registerObject();
|
||||
mGroups.push_back(compGroup);
|
||||
addObject(compGroup);
|
||||
}
|
||||
}
|
||||
|
||||
// Create the inspector groups for static fields.
|
||||
|
||||
for( TargetVector::iterator iter = mTargets.begin(); iter != mTargets.end(); ++ iter )
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue