mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-15 08:34:40 +00:00
Tweak to the Component Fields to properly refresh the group.
This commit is contained in:
parent
89672ea0ab
commit
6ec899620d
2 changed files with 44 additions and 49 deletions
|
|
@ -616,10 +616,13 @@ void GuiInspector::refresh()
|
||||||
//Build the component field groups as the component describes it
|
//Build the component field groups as the component describes it
|
||||||
Component* comp = dynamic_cast<Component*>(mTargets.first().getPointer());
|
Component* comp = dynamic_cast<Component*>(mTargets.first().getPointer());
|
||||||
|
|
||||||
GuiInspectorComponentGroup *compGroup = new GuiInspectorComponentGroup("Component Fields", this);
|
if (comp->getComponentFieldCount() > 0)
|
||||||
compGroup->registerObject();
|
{
|
||||||
mGroups.push_back(compGroup);
|
GuiInspectorComponentGroup *compGroup = new GuiInspectorComponentGroup("Component Fields", this);
|
||||||
addObject(compGroup);
|
compGroup->registerObject();
|
||||||
|
mGroups.push_back(compGroup);
|
||||||
|
addObject(compGroup);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -76,21 +76,13 @@ bool GuiInspectorComponentGroup::inspectGroup()
|
||||||
if (!mParent || !mParent->getNumInspectObjects())
|
if (!mParent || !mParent->getNumInspectObjects())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
clearFields();
|
||||||
|
|
||||||
// to prevent crazy resizing, we'll just freeze our stack for a sec..
|
// to prevent crazy resizing, we'll just freeze our stack for a sec..
|
||||||
mStack->freeze(true);
|
mStack->freeze(true);
|
||||||
|
|
||||||
mStack->clear();
|
|
||||||
|
|
||||||
bool bNoGroup = false;
|
bool bNoGroup = false;
|
||||||
|
|
||||||
// Un-grouped fields are all sorted into the 'general' group
|
|
||||||
if (dStricmp(mCaption, "General") == 0)
|
|
||||||
bNoGroup = true;
|
|
||||||
|
|
||||||
// Just delete all fields and recreate them (like the dynamicGroup)
|
|
||||||
// because that makes creating controls for array fields a lot easier
|
|
||||||
clearFields();
|
|
||||||
|
|
||||||
bool bNewItems = false;
|
bool bNewItems = false;
|
||||||
bool bMakingArray = false;
|
bool bMakingArray = false;
|
||||||
GuiStackControl *pArrayStack = NULL;
|
GuiStackControl *pArrayStack = NULL;
|
||||||
|
|
@ -116,52 +108,47 @@ bool GuiInspectorComponentGroup::inspectGroup()
|
||||||
fieldGui->init(mParent, this);
|
fieldGui->init(mParent, this);
|
||||||
|
|
||||||
AbstractClassRep::Field *refField;
|
AbstractClassRep::Field *refField;
|
||||||
//check statics
|
|
||||||
refField = const_cast<AbstractClassRep::Field *>(comp->findField(field->mFieldName));
|
//check dynamics
|
||||||
if (!refField)
|
SimFieldDictionary* fieldDictionary = comp->getFieldDictionary();
|
||||||
|
SimFieldDictionaryIterator itr(fieldDictionary);
|
||||||
|
|
||||||
|
while (*itr)
|
||||||
{
|
{
|
||||||
//check dynamics
|
SimFieldDictionary::Entry* entry = *itr;
|
||||||
SimFieldDictionary* fieldDictionary = comp->getFieldDictionary();
|
if (entry->slotName == field->mFieldName)
|
||||||
SimFieldDictionaryIterator itr(fieldDictionary);
|
|
||||||
|
|
||||||
while (*itr)
|
|
||||||
{
|
{
|
||||||
SimFieldDictionary::Entry* entry = *itr;
|
AbstractClassRep::Field f;
|
||||||
if (entry->slotName == field->mFieldName)
|
f.pFieldname = StringTable->insert(field->mFieldName);
|
||||||
{
|
|
||||||
AbstractClassRep::Field f;
|
|
||||||
f.pFieldname = StringTable->insert(field->mFieldName);
|
|
||||||
|
|
||||||
if (field->mFieldDescription)
|
if (field->mFieldDescription)
|
||||||
f.pFieldDocs = field->mFieldDescription;
|
f.pFieldDocs = field->mFieldDescription;
|
||||||
|
|
||||||
f.type = field->mFieldType;
|
f.type = field->mFieldType;
|
||||||
f.offset = -1;
|
f.offset = -1;
|
||||||
f.elementCount = 1;
|
f.elementCount = 1;
|
||||||
f.validator = NULL;
|
f.validator = NULL;
|
||||||
f.flag = 0; //change to be the component type
|
f.flag = 0; //change to be the component type
|
||||||
|
|
||||||
f.setDataFn = &defaultProtectedSetFn;
|
f.setDataFn = &defaultProtectedSetFn;
|
||||||
f.getDataFn = &defaultProtectedGetFn;
|
f.getDataFn = &defaultProtectedGetFn;
|
||||||
f.writeDataFn = &defaultProtectedWriteFn;
|
f.writeDataFn = &defaultProtectedWriteFn;
|
||||||
|
|
||||||
if (!dStrcmp(field->mGroup, ""))
|
f.pFieldDocs = field->mFieldDescription;
|
||||||
f.pGroupname = "Component";
|
|
||||||
else
|
|
||||||
f.pGroupname = field->mGroup;
|
|
||||||
|
|
||||||
ConsoleBaseType* conType = ConsoleBaseType::getType(field->mFieldType);
|
f.pGroupname = "Component Fields";
|
||||||
AssertFatal(conType, "ConsoleObject::addField - invalid console type");
|
|
||||||
f.table = conType->getEnumTable();
|
|
||||||
|
|
||||||
tempFields.push_back(f);
|
ConsoleBaseType* conType = ConsoleBaseType::getType(field->mFieldType);
|
||||||
|
AssertFatal(conType, "ConsoleObject::addField - invalid console type");
|
||||||
|
f.table = conType->getEnumTable();
|
||||||
|
|
||||||
refField = &f;
|
tempFields.push_back(f);
|
||||||
|
|
||||||
break;
|
refField = &f;
|
||||||
}
|
|
||||||
++itr;
|
break;
|
||||||
}
|
}
|
||||||
|
++itr;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!refField)
|
if (!refField)
|
||||||
|
|
@ -216,6 +203,11 @@ ConsoleMethod(GuiInspectorComponentGroup, inspectGroup, bool, 2, 2, "Refreshes t
|
||||||
|
|
||||||
void GuiInspectorComponentGroup::clearFields()
|
void GuiInspectorComponentGroup::clearFields()
|
||||||
{
|
{
|
||||||
|
// delete everything else
|
||||||
|
mStack->clear();
|
||||||
|
|
||||||
|
// clear the mChildren list.
|
||||||
|
mChildren.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
SimFieldDictionary::Entry* GuiInspectorComponentGroup::findDynamicFieldInDictionary(StringTableEntry fieldName)
|
SimFieldDictionary::Entry* GuiInspectorComponentGroup::findDynamicFieldInDictionary(StringTableEntry fieldName)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue