diff --git a/Engine/source/gui/editor/guiInspectorTypes.cpp b/Engine/source/gui/editor/guiInspectorTypes.cpp index f18166be1..39b59d1ea 100644 --- a/Engine/source/gui/editor/guiInspectorTypes.cpp +++ b/Engine/source/gui/editor/guiInspectorTypes.cpp @@ -1797,15 +1797,9 @@ void GuiInspectorType2DValue::constructEditControlChildren(GuiControl* retCtrl, mCtrlX->setDataField(StringTable->insert("profile"), NULL, "GuiInspectorTextEditProfile"); mCtrlX->setDataField(StringTable->insert("tooltipprofile"), NULL, "GuiToolTipProfile"); - mCtrlX->setDataField(StringTable->insert("format"), NULL, "%g"); - mCtrlX->setDataField(StringTable->insert("range"), NULL, "-1e+32 1e+32"); - mCtrlX->setDataField(StringTable->insert("increment"), NULL, "0.0001"); mCtrlY->setDataField(StringTable->insert("profile"), NULL, "GuiInspectorTextEditProfile"); mCtrlY->setDataField(StringTable->insert("tooltipprofile"), NULL, "GuiToolTipProfile"); - mCtrlY->setDataField(StringTable->insert("format"), NULL, "%g"); - mCtrlY->setDataField(StringTable->insert("range"), NULL, "-1e+32 1e+32"); - mCtrlY->setDataField(StringTable->insert("increment"), NULL, "0.0001"); mLabelX->setDataField(StringTable->insert("profile"), NULL, "ToolsGuiXDimensionText"); mLabelY->setDataField(StringTable->insert("profile"), NULL, "ToolsGuiYDimensionText"); @@ -1943,9 +1937,6 @@ void GuiInspectorType3DValue::constructEditControlChildren(GuiControl* retCtrl, mCtrlZ->setDataField(StringTable->insert("profile"), NULL, "GuiInspectorTextEditProfile"); mCtrlZ->setDataField(StringTable->insert("tooltipprofile"), NULL, "GuiToolTipProfile"); - mCtrlZ->setDataField(StringTable->insert("format"), NULL, "%g"); - mCtrlZ->setDataField(StringTable->insert("range"), NULL, "-1e+32 1e+32"); - mCtrlZ->setDataField(StringTable->insert("increment"), NULL, "0.0001"); mLabelZ->setDataField(StringTable->insert("profile"), NULL, "ToolsGuiZDimensionText"); diff --git a/Engine/source/gui/editor/inspector/field.cpp b/Engine/source/gui/editor/inspector/field.cpp index 17350f325..75c7cd923 100644 --- a/Engine/source/gui/editor/inspector/field.cpp +++ b/Engine/source/gui/editor/inspector/field.cpp @@ -266,11 +266,36 @@ void GuiInspectorField::onRightMouseUp( const GuiEvent &event ) //----------------------------------------------------------------------------- void GuiInspectorField::setWordData(const S32& wordIndex, const char* data, bool callbacks) { + if (mSpecialEditField) { if (mTargetObject != nullptr && mVariableName != StringTable->EmptyString()) { const char* fieldData = mTargetObject->getDataField(mVariableName, NULL); + const char* wordData = StringUnit::getUnit(fieldData, wordIndex, " \t\n"); + + S32 type = mField->type; + if (type == TypeS8 || type == TypeS32 || type == TypeF32 || type == TypeS32Vector + || type == TypeF32Vector + || type == TypeColorI + || type == TypeColorF + || type == TypePoint2I + || type == TypePoint2F + || type == TypePoint3F + || type == TypePoint4F + || type == TypeRectI + || type == TypeRectF + || type == TypeMatrixPosition + || type == TypeMatrixRotation + || type == TypeBox3F + || type == TypeRectUV + || type == TypeRotationF) + { + if (dAtof(wordData) != dAtof(data)) + return; + } + else if(dStrEqual(wordData, data)) + return; StringBuilder newFieldData; const U32 wordCount = StringUnit::getUnitCount(fieldData, " \t\n"); @@ -295,6 +320,30 @@ void GuiInspectorField::setWordData(const S32& wordIndex, const char* data, bool else if (mVariableName != StringTable->EmptyString()) { const char* fieldData = Con::getVariable(mVariableName, ""); + const char* wordData = StringUnit::getUnit(fieldData, wordIndex, " \t\n"); + + S32 type = mField->type; + if (type == TypeS8 || type == TypeS32 || type == TypeF32 || type == TypeS32Vector + || type == TypeF32Vector + || type == TypeColorI + || type == TypeColorF + || type == TypePoint2I + || type == TypePoint2F + || type == TypePoint3F + || type == TypePoint4F + || type == TypeRectI + || type == TypeRectF + || type == TypeMatrixPosition + || type == TypeMatrixRotation + || type == TypeBox3F + || type == TypeRectUV + || type == TypeRotationF) + { + if (dAtof(wordData) != dAtof(data)) + return; + } + else if (dStrEqual(wordData, data)) + return; StringBuilder newFieldData; const U32 wordCount = StringUnit::getUnitCount(fieldData, " \t\n"); @@ -326,6 +375,59 @@ void GuiInspectorField::setWordData(const S32& wordIndex, const char* data, bool String strData = data; const U32 numTargets = mInspector->getNumInspectObjects(); + bool changed = false; + for (U32 i = 0; i < numTargets; ++i) + { + //For now, for simplicity's sake, you can only edit the components in a simple edit + SimObject* target = NULL; + if (numTargets == 1) + { + target = mTargetObject; + + if (!target) + target = mInspector->getInspectObject(i); + } + else + { + target = mInspector->getInspectObject(i); + } + + const char* fieldData = target->getDataField(mField->pFieldname, mFieldArrayIndex); + const char* wordData = StringUnit::getUnit(fieldData, wordIndex, " \t\n"); + + S32 type = mField->type; + if (type == TypeS8 || type == TypeS32 || type == TypeF32 || type == TypeS32Vector + || type == TypeF32Vector + || type == TypeColorI + || type == TypeColorF + || type == TypePoint2I + || type == TypePoint2F + || type == TypePoint3F + || type == TypePoint4F + || type == TypeRectI + || type == TypeRectF + || type == TypeMatrixPosition + || type == TypeMatrixRotation + || type == TypeBox3F + || type == TypeRectUV + || type == TypeRotationF) + { + if (dAtof(wordData) != dAtof(data)) + { + changed = true; + break; + } + } + else if (!dStrEqual(wordData, data)) + { + changed = true; + break; + } + } + + if(!changed) + return; + if (callbacks && numTargets > 1) Con::executef(mInspector, "onBeginCompoundEdit");