Merge branch 'development' into imageAsset_refactor_rev3

This commit is contained in:
marauder2k7 2025-03-24 20:07:06 +00:00 committed by GitHub
commit 0da0903599
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4189 changed files with 29881 additions and 635347 deletions

View file

@ -86,6 +86,7 @@ void GuiInspectorDynamicField::setData( const char* data, bool callbacks )
// give the target a chance to validate
target->inspectPostApply();
Con::executef(mInspector, "onPostInspectorFieldModified", mInspector->getIdString(), target->getIdString());
}
}

View file

@ -233,7 +233,7 @@ void GuiInspectorField::setFirstResponder( GuiControl *firstResponder )
{
Parent::setFirstResponder( firstResponder );
if ( firstResponder == this || firstResponder == mEdit )
if (( firstResponder == this || firstResponder == mEdit ) && (firstResponder && firstResponder->isProperlyAdded()))
{
mInspector->setHighlightField( this );
}
@ -275,7 +275,7 @@ void GuiInspectorField::setWordData(const S32& wordIndex, const char* data, bool
const char* wordData = StringUnit::getUnit(fieldData, wordIndex, " \t\n");
S32 type = mField->type;
if (type == TypeS8 || type == TypeS32 || type == TypeF32 || type == TypeS32Vector
if (type == TypeS8 || type == TypeS16 || type == TypeS32 || type == TypeF32 || type == TypeS32Vector
|| type == TypeF32Vector
|| type == TypeColorI
|| type == TypeColorF
@ -323,7 +323,7 @@ void GuiInspectorField::setWordData(const S32& wordIndex, const char* data, bool
const char* wordData = StringUnit::getUnit(fieldData, wordIndex, " \t\n");
S32 type = mField->type;
if (type == TypeS8 || type == TypeS32 || type == TypeF32 || type == TypeS32Vector
if (type == TypeS8 || type == TypeS16 || type == TypeS32 || type == TypeF32 || type == TypeS32Vector
|| type == TypeF32Vector
|| type == TypeColorI
|| type == TypeColorF
@ -396,7 +396,7 @@ void GuiInspectorField::setWordData(const S32& wordIndex, const char* data, bool
const char* wordData = StringUnit::getUnit(fieldData, wordIndex, " \t\n");
S32 type = mField->type;
if (type == TypeS8 || type == TypeS32 || type == TypeF32 || type == TypeS32Vector
if (type == TypeS8 || type == TypeS16 || type == TypeS32 || type == TypeF32 || type == TypeS32Vector
|| type == TypeF32Vector
|| type == TypeColorI
|| type == TypeColorF
@ -544,7 +544,7 @@ void GuiInspectorField::setData( const char* data, bool callbacks )
String newValue = strData;
S32 type= mField->type;
ConsoleValue evaluationResult;
if( type == TypeS8 || type == TypeS32 || type == TypeF32 )
if( type == TypeS8 || type == TypeS16 || type == TypeS32 || type == TypeF32 )
{
char buffer[ 2048 ];
expandEscape( buffer, newValue );
@ -615,6 +615,8 @@ void GuiInspectorField::setData( const char* data, bool callbacks )
// Give the target a chance to validate.
target->inspectPostApply();
if (String::compare(oldValue.c_str(), newValue.c_str()) != 0)
Con::executef(mInspector, "onPostInspectorFieldModified", mInspector->getIdString(), target->getIdString());
}
if( callbacks && numTargets > 1 )
@ -851,7 +853,8 @@ void GuiInspectorField::setHLEnabled( bool enabled )
edit->setCursorPos(0);
}
}
_executeSelectedCallback();
if (isProperlyAdded())
_executeSelectedCallback();
}
}
@ -930,6 +933,34 @@ void GuiInspectorField::_setFieldDocs( StringTableEntry docs )
else
mFieldDocs = docs;
}
String inDocs(docs);
String outDocs("");
String outLine("");
S32 newline = inDocs.find('\n');
if (newline == -1)
outDocs = docs;
else
{
U32 uCount = StringUnit::getUnitCount(inDocs, " ");
for (U32 i = 0; i < uCount; i++)
{
String docWord = StringUnit::getUnit(inDocs, i, " ");
if (!docWord.isEmpty())
outLine += docWord;
if (outLine.length() > 80)
{
outLine += "\n";
outDocs += outLine;
outLine.clear();
}
else
outLine += " ";
}
}
outDocs += String("\n") + outLine;
mTooltip = outDocs;
}
void GuiInspectorField::setHeightOverride(bool useOverride, U32 heightOverride)

View file

@ -282,7 +282,7 @@ bool GuiInspectorGroup::inspectGroup()
bGrabItems = false;
continue;
}
// Skip field if it has the HideInInspectors flag set.
if (field->flag.test(AbstractClassRep::FIELD_HideInInspectors))
@ -761,6 +761,26 @@ void GuiInspectorGroup::removeInspectorField(StringTableEntry name)
}
}
void GuiInspectorGroup::hideInspectorField(StringTableEntry fieldName, bool setHidden)
{
SimObject* inspectObj = mParent->getInspectObject();
if (inspectObj == nullptr)
return;
AbstractClassRep::Field* field = const_cast<AbstractClassRep::Field*>(inspectObj->getClassRep()->findField(fieldName));
if (field == NULL)
{
Con::errorf("fieldName not found: %s.%s", inspectObj->getName(), fieldName);
return;
}
if (setHidden)
field->flag.set(AbstractClassRep::FIELD_HideInInspectors);
else
field->flag.clear(AbstractClassRep::FIELD_HideInInspectors);
}
DefineEngineMethod(GuiInspectorGroup, createInspectorField, GuiInspectorField*, (), , "createInspectorField()")
{
return object->createInspectorField();
@ -798,6 +818,16 @@ DefineEngineMethod(GuiInspectorGroup, removeField, void, (const char* fieldName)
object->removeInspectorField(StringTable->insert(fieldName));
}
DefineEngineMethod(GuiInspectorGroup, hideField, void, (const char* fieldName, bool setHidden), (true),
"Removes a Inspector field to this group of a given name.\n"
"@param fieldName The name of the field to be removed.")
{
if (dStrEqual(fieldName, ""))
return;
object->hideInspectorField(StringTable->insert(fieldName), setHidden);
}
DefineEngineMethod(GuiInspectorGroup, setForcedArrayIndex, void, (S32 arrayIndex), (-1),
"Sets the ForcedArrayIndex for the group. Used to force presentation of arrayed fields to only show a specific field index."
"@param arrayIndex The specific field index for arrayed fields to show. Use -1 or blank arg to go back to normal behavior.")

View file

@ -86,6 +86,7 @@ public:
void addInspectorField(StringTableEntry name, StringTableEntry typeName, const char* description, const char* callbackName);
void addInspectorField(GuiInspectorField* field);
void removeInspectorField(StringTableEntry name);
void hideInspectorField(StringTableEntry fieldName, bool setHidden);
void setForcedArrayIndex(const S32& arrayIndex = -1)
{