Converts the ad-hoc design of the Material Editor to utilize the same inspector interface as most everything else does.

- Overhauls the material editor to simplify and streamline the logic behind it since the inspector does most of the work
- Tweak a few order positions of materialdefinition fields to work better
- Sets AO, Rough and Metal channel fields to use an enum type for human readability
- Updates the MaterialPreview gui control to work with assetIds
- MatEd now supports setting of parent material to inherit from
- Creating a new material now can prompt selecting an existing material to inherit from
- Can now edit the mapTo value of a material in the matEd
- New standalone Composite Texture Editor window for convering AO, Roughness and Metalness maps in a material to an ORMMap
- Can also star the creation of a composite texture via RMB context menu in AB on an image asset
- Moved logic of CubemapEditor from MatEd to it's own stuff
- Made ImageAsset fields now be more clear when they have nothing assigned, and also have a clear button to empty the field's value so it's consistent across the board
- Reorganized the layout of the gui and image files for the MatEd to be easier to navigate
- MaterialEditor now overlays the EditorGUI instead of being forcefully embedded in it, allowing easy editing of the MatEd Gui via the Gui editor
This commit is contained in:
JeffR 2025-08-03 12:03:02 -05:00
parent 8e93753b15
commit f3cad0d77e
173 changed files with 3713 additions and 6977 deletions

View file

@ -1050,6 +1050,15 @@ DefineEngineMethod(GuiInspectorField, setCaption, void, (String newCaption),, "(
object->setCaption(StringTable->insert(newCaption.c_str()));
}
DefineEngineMethod(GuiInspectorField, getFieldName, const char*, (), , "() - Gets the fieldName of the field.")
{
constexpr U32 bufSize = 128;
char* retBuffer = Con::getReturnBuffer(bufSize);
dSprintf(retBuffer, bufSize, "%s", object->getFieldName());
return retBuffer;
}
DefineEngineMethod(GuiInspectorField, setSpecialEditVariableName, void, (String newCaption), , "() - Sets the variable name for special edit fields.")
{
object->setSpecialEditVariableName(StringTable->insert(newCaption.c_str()));

View file

@ -132,6 +132,8 @@ class GuiInspectorField : public GuiControl
/// this is exposed in case someone wants to override the normal caption.
virtual void setCaption( StringTableEntry caption ) { mCaption = caption; }
virtual StringTableEntry getCaption() { return mCaption; }
void setEditControl(GuiControl* editCtrl);
void setHeightOverride(bool useOverride, U32 heightOverride);

View file

@ -211,7 +211,7 @@ GuiInspectorField *GuiInspectorGroup::findField( const char *fieldName )
for( ; i != mChildren.end(); i++ )
{
if( (*i)->getFieldName() != NULL && dStricmp( (*i)->getFieldName(), fieldName ) == 0 )
if( ((*i)->getFieldName() != NULL && dStricmp( (*i)->getFieldName(), fieldName ) == 0) || ((*i)->getCaption() != StringTable->EmptyString() && dStricmp((*i)->getCaption(), fieldName) == 0) )
return (*i);
}
@ -834,3 +834,26 @@ DefineEngineMethod(GuiInspectorGroup, setForcedArrayIndex, void, (S32 arrayIndex
{
object->setForcedArrayIndex(arrayIndex);
}
DefineEngineMethod(GuiInspectorGroup, findField, S32, (const char* fieldName),,
"Finds an Inspector field in this group of a given name.\n"
"@param fieldName The name of the field to be found.\n"
"@return Field SimObjectId")
{
if (dStrEqual(fieldName, ""))
return 0;
GuiInspectorField* field = object->findField(StringTable->insert(fieldName));
if (field == nullptr)
return 0;
return field->getId();
}
DefineEngineMethod(GuiInspectorGroup, refresh, void, (), ,
"Finds an Inspector field in this group of a given name.\n"
"@param fieldName The name of the field to be found.\n"
"@return Field SimObjectId")
{
object->inspectGroup();
}