mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-04-25 06:15:36 +00:00
Merge branch 'development' into imageAsset_refactor_rev3
This commit is contained in:
commit
0da0903599
4189 changed files with 29881 additions and 635347 deletions
|
|
@ -54,7 +54,7 @@ void GuiEaseViewCtrl::initPersistFields()
|
|||
|
||||
addField("ease", TypeEaseF, Offset( mEase, GuiEaseViewCtrl ) );
|
||||
addField("easeColor", TypeColorF, Offset( mEaseColor, GuiEaseViewCtrl ) );
|
||||
addField("easeWidth", TypeF32, Offset(mEaseWidth, GuiEaseViewCtrl ) );
|
||||
addFieldV("easeWidth", TypeRangedF32, Offset(mEaseWidth, GuiEaseViewCtrl ), &CommonValidators::PositiveNonZeroFloat);
|
||||
addField("axisColor", TypeColorF, Offset( mAxisColor, GuiEaseViewCtrl ) );
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -152,7 +152,7 @@ void GuiEditCtrl::initPersistFields()
|
|||
"If true, selection edges will snap into alignment when moved or resized." );
|
||||
addField( "snapToCenters", TypeBool, Offset( mSnapToCenters, GuiEditCtrl ),
|
||||
"If true, selection centers will snap into alignment when moved or resized." );
|
||||
addField( "snapSensitivity", TypeS32, Offset( mSnapSensitivity, GuiEditCtrl ),
|
||||
addFieldV( "snapSensitivity", TypeRangedS32, Offset( mSnapSensitivity, GuiEditCtrl ), &CommonValidators::PositiveInt,
|
||||
"Distance in pixels that edge and center snapping will work across." );
|
||||
endGroup( "Snapping" );
|
||||
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@
|
|||
#include "guiFilterCtrl.h"
|
||||
#include "math/mMath.h"
|
||||
#include "gfx/gfxDrawUtil.h"
|
||||
#include "console/typeValidators.h"
|
||||
|
||||
|
||||
IMPLEMENT_CONOBJECT(GuiFilterCtrl);
|
||||
|
|
@ -51,7 +52,7 @@ GuiFilterCtrl::GuiFilterCtrl()
|
|||
void GuiFilterCtrl::initPersistFields()
|
||||
{
|
||||
docsURL;
|
||||
addField("controlPoints", TypeS32, Offset(mControlPointRequest, GuiFilterCtrl),
|
||||
addFieldV("controlPoints", TypeRangedS32, Offset(mControlPointRequest, GuiFilterCtrl), &CommonValidators::NaturalNumber,
|
||||
"Total number of control points in the spline curve." );
|
||||
addField("filter", TypeF32Vector, Offset(mFilter, GuiFilterCtrl),
|
||||
"Vector of control points." );
|
||||
|
|
|
|||
|
|
@ -105,7 +105,7 @@ void GuiGraphCtrl::initPersistFields()
|
|||
docsURL;
|
||||
addGroup( "Graph" );
|
||||
|
||||
addField( "centerY", TypeF32, Offset( mCenterY, GuiGraphCtrl ),
|
||||
addFieldV( "centerY", TypeRangedF32, Offset( mCenterY, GuiGraphCtrl ), &CommonValidators::NormalizedFloat,
|
||||
"Ratio of where to place the center coordinate of the graph on the Y axis. 0.5=middle height of control.\n\n"
|
||||
"This allows to account for graphs that have only positive or only negative data points, for example." );
|
||||
|
||||
|
|
@ -119,7 +119,7 @@ void GuiGraphCtrl::initPersistFields()
|
|||
"Name of the variable to automatically plot on the curves. If empty, auto-plotting "
|
||||
"is disabled for the respective curve." );
|
||||
|
||||
addField( "plotInterval", TypeS32, Offset( mAutoPlotDelay, GuiGraphCtrl ), MaxPlots,
|
||||
addFieldV( "plotInterval", TypeRangedS32, Offset( mAutoPlotDelay, GuiGraphCtrl ), &CommonValidators::PositiveInt, MaxPlots,
|
||||
"Interval between auto-plots of #plotVariable for the respective curve (in milliseconds)." );
|
||||
|
||||
endGroup( "Graph" );
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@
|
|||
#include "gui/editor/inspector/dynamicGroup.h"
|
||||
#include "gui/containers/guiScrollCtrl.h"
|
||||
#include "gui/editor/inspector/customField.h"
|
||||
#include "console/typeValidators.h"
|
||||
|
||||
IMPLEMENT_CONOBJECT(GuiInspector);
|
||||
|
||||
|
|
@ -38,6 +39,12 @@ ConsoleDocClass( GuiInspector,
|
|||
);
|
||||
|
||||
|
||||
IMPLEMENT_CALLBACK(GuiInspector, onPreInspectObject, void, (SimObject* object), (object),
|
||||
"Called prior to inspecting a new object.\n");
|
||||
|
||||
IMPLEMENT_CALLBACK(GuiInspector, onPostInspectObject, void, (SimObject* object), (object),
|
||||
"Called after inspecting a new object.\n");
|
||||
|
||||
//#define DEBUG_SPEW
|
||||
|
||||
|
||||
|
|
@ -71,7 +78,7 @@ void GuiInspector::initPersistFields()
|
|||
docsURL;
|
||||
addGroup( "Inspector" );
|
||||
|
||||
addField( "dividerMargin", TypeS32, Offset( mDividerMargin, GuiInspector ) );
|
||||
addFieldV( "dividerMargin", TypeRangedS32, Offset( mDividerMargin, GuiInspector ), &CommonValidators::PositiveInt);
|
||||
|
||||
addField( "groupFilters", TypeRealString, Offset( mGroupFilters, GuiInspector ),
|
||||
"Specify groups that should be shown or not. Specifying 'shown' implicitly does 'not show' all other groups. Example string: +name -otherName" );
|
||||
|
|
@ -79,7 +86,7 @@ void GuiInspector::initPersistFields()
|
|||
addField( "showCustomFields", TypeBool, Offset( mShowCustomFields, GuiInspector ),
|
||||
"If false the custom fields Name, Id, and Source Class will not be shown." );
|
||||
|
||||
addField("forcedArrayIndex", TypeS32, Offset(mForcedArrayIndex, GuiInspector));
|
||||
addFieldV("forcedArrayIndex", TypeRangedS32, Offset(mForcedArrayIndex, GuiInspector), &CommonValidators::NegDefaultInt);
|
||||
|
||||
addField("searchText", TypeString, Offset(mSearchText, GuiInspector), "A string that, if not blank, is used to filter shown fields");
|
||||
endGroup( "Inspector" );
|
||||
|
|
@ -325,11 +332,14 @@ bool GuiInspector::isInspectingObject( SimObject* object )
|
|||
//-----------------------------------------------------------------------------
|
||||
|
||||
void GuiInspector::inspectObject( SimObject *object )
|
||||
{
|
||||
{
|
||||
onPreInspectObject_callback((mTargets.size() > 1)? mTargets[0] : NULL);
|
||||
|
||||
if( mTargets.size() > 1 || !isInspectingObject( object ) )
|
||||
clearInspectObjects();
|
||||
|
||||
addInspectObject( object );
|
||||
onPostInspectObject_callback(object);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
|
@ -349,7 +359,8 @@ void GuiInspector::clearInspectObjects()
|
|||
void GuiInspector::addInspectObject( SimObject* object, bool autoSync )
|
||||
{
|
||||
// If we are already inspecting the object, just update the groups.
|
||||
|
||||
|
||||
onPreInspectObject_callback((mTargets.size() > 1) ? mTargets[0] : NULL);
|
||||
if( isInspectingObject( object ) )
|
||||
{
|
||||
#ifdef DEBUG_SPEW
|
||||
|
|
@ -379,6 +390,7 @@ void GuiInspector::addInspectObject( SimObject* object, bool autoSync )
|
|||
|
||||
if( autoSync )
|
||||
refresh();
|
||||
onPostInspectObject_callback(object);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
|
@ -629,7 +641,7 @@ void GuiInspector::refresh()
|
|||
GuiInspectorGroup *newGroup = new GuiInspectorGroup( itr->pGroupname, this );
|
||||
newGroup->setForcedArrayIndex(mForcedArrayIndex);
|
||||
|
||||
newGroup->registerObject();
|
||||
newGroup->registerObject();
|
||||
if( !newGroup->getNumFields() )
|
||||
{
|
||||
#ifdef DEBUG_SPEW
|
||||
|
|
@ -995,6 +1007,21 @@ DefineEngineMethod(GuiInspector, findExistentGroup, S32, (const char* groupName)
|
|||
return group ? group->getId() : 0;
|
||||
}
|
||||
|
||||
DefineEngineMethod(GuiInspector, getInspectedGroupCount, S32, (), ,
|
||||
"How many inspected groups there are.\n"
|
||||
"@return how many inspected groups there are")
|
||||
{
|
||||
return object->getGroups().size();
|
||||
}
|
||||
|
||||
DefineEngineMethod(GuiInspector, getInspectedGroup, GuiInspectorGroup*, (S32 key), ,
|
||||
"Finds an existing GuiInspectorGroup if it exists and returns it's Id.\n"
|
||||
"@param key nth group out of the list of groups."
|
||||
"@return id of the GuiInspectorGroup")
|
||||
{
|
||||
return object->getGroups()[key];
|
||||
}
|
||||
|
||||
DefineEngineMethod(GuiInspector, removeGroup, void, (const char* groupName), ,
|
||||
"Finds an existing GuiInspectorGroup if it exists removes it.\n"
|
||||
"@param groupName Name of the new GuiInspectorGroup to find in this Inspector.")
|
||||
|
|
|
|||
|
|
@ -174,7 +174,9 @@ public:
|
|||
StringTableEntry getSearchText() { return mSearchText; }
|
||||
|
||||
void setSearchText(StringTableEntry searchText);
|
||||
|
||||
Vector<GuiInspectorGroup*> getGroups() { return mGroups; };
|
||||
DECLARE_CALLBACK(void, onPreInspectObject, (SimObject* object) );
|
||||
DECLARE_CALLBACK(void, onPostInspectObject, (SimObject* object) );
|
||||
protected:
|
||||
|
||||
typedef Vector< SimObjectPtr< SimObject > > TargetVector;
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@
|
|||
#include "math/mEase.h"
|
||||
#include "math/mathTypes.h"
|
||||
#include "sim/actionMap.h"
|
||||
|
||||
#include "console/typeValidators.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// GuiInspectorTypeMenuBase
|
||||
|
|
@ -1350,6 +1350,117 @@ void GuiInspectorTypeS32::setValue( StringTableEntry newValue )
|
|||
ctrl->setText( newValue );
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// GuiInspectorTypeRangedF32
|
||||
//-----------------------------------------------------------------------------
|
||||
IMPLEMENT_CONOBJECT(GuiInspectorTypeRangedF32);
|
||||
|
||||
ConsoleDocClass(GuiInspectorTypeRangedF32,
|
||||
"@brief Inspector field type for range-clamped F32\n\n"
|
||||
"Editor use only.\n\n"
|
||||
"@internal"
|
||||
);
|
||||
|
||||
void GuiInspectorTypeRangedF32::consoleInit()
|
||||
{
|
||||
Parent::consoleInit();
|
||||
|
||||
ConsoleBaseType::getType(TypeRangedF32)->setInspectorFieldType("GuiInspectorTypeRangedF32");
|
||||
}
|
||||
|
||||
GuiControl* GuiInspectorTypeRangedF32::constructEditControl()
|
||||
{
|
||||
GuiControl* retCtrl = new GuiTextEditSliderCtrl();
|
||||
|
||||
retCtrl->setDataField(StringTable->insert("profile"), NULL, "GuiInspectorTextEditProfile");
|
||||
|
||||
// Don't forget to register ourselves
|
||||
_registerEditControl(retCtrl);
|
||||
|
||||
char szBuffer[512];
|
||||
dSprintf(szBuffer, 512, "%d.apply(%d.getText());", getId(), retCtrl->getId());
|
||||
retCtrl->setField("AltCommand", szBuffer);
|
||||
FRangeValidator* validator = dynamic_cast<FRangeValidator*>(mField->validator);
|
||||
if (validator)
|
||||
{
|
||||
retCtrl->setField("format", "%g");
|
||||
retCtrl->setField("range", String::ToString("%g %g", validator->getMin(), validator->getMax()));
|
||||
if (validator->getFidelity()>0.0f)
|
||||
retCtrl->setField("increment", String::ToString("%g", (validator->getMax()-validator->getMin())/validator->getFidelity()));
|
||||
else
|
||||
retCtrl->setField("increment", String::ToString("%g", 0.01));
|
||||
}
|
||||
return retCtrl;
|
||||
}
|
||||
|
||||
void GuiInspectorTypeRangedF32::setValue(StringTableEntry newValue)
|
||||
{
|
||||
GuiTextEditSliderCtrl* ctrl = dynamic_cast<GuiTextEditSliderCtrl*>(mEdit);
|
||||
if (ctrl != NULL)
|
||||
ctrl->setText(newValue);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// GuiInspectorTypeRangedS32
|
||||
//-----------------------------------------------------------------------------
|
||||
IMPLEMENT_CONOBJECT(GuiInspectorTypeRangedS32);
|
||||
|
||||
ConsoleDocClass(GuiInspectorTypeRangedS32,
|
||||
"@brief Inspector field type for range-clamped S32\n\n"
|
||||
"Editor use only.\n\n"
|
||||
"@internal"
|
||||
);
|
||||
|
||||
void GuiInspectorTypeRangedS32::consoleInit()
|
||||
{
|
||||
Parent::consoleInit();
|
||||
|
||||
ConsoleBaseType::getType(TypeRangedS32)->setInspectorFieldType("GuiInspectorTypeRangedS32");
|
||||
}
|
||||
|
||||
GuiControl* GuiInspectorTypeRangedS32::constructEditControl()
|
||||
{
|
||||
GuiControl* retCtrl = new GuiTextEditSliderCtrl();
|
||||
|
||||
retCtrl->setDataField(StringTable->insert("profile"), NULL, "GuiInspectorTextEditProfile");
|
||||
|
||||
// Don't forget to register ourselves
|
||||
_registerEditControl(retCtrl);
|
||||
|
||||
char szBuffer[512];
|
||||
dSprintf(szBuffer, 512, "%d.apply(%d.getText());", getId(), retCtrl->getId());
|
||||
retCtrl->setField("AltCommand", szBuffer);
|
||||
IRangeValidator* validator = dynamic_cast<IRangeValidator*>(mField->validator);
|
||||
|
||||
retCtrl->setField("increment", "1");
|
||||
retCtrl->setField("format", "%d");
|
||||
retCtrl->setField("range", "-2147483648 2147483647");
|
||||
|
||||
if (validator)
|
||||
{
|
||||
retCtrl->setField("range", String::ToString("%d %d", validator->getMin(), validator->getMax()));
|
||||
if (validator->getFidelity() > 1)
|
||||
retCtrl->setField("increment", String::ToString("%d", (validator->getMax() - validator->getMin()) / validator->getFidelity()));
|
||||
}
|
||||
else
|
||||
{
|
||||
IRangeValidatorScaled* scaledValidator = dynamic_cast<IRangeValidatorScaled*>(mField->validator);
|
||||
if (scaledValidator)
|
||||
{
|
||||
retCtrl->setField("range", String::ToString("%d %d", scaledValidator->getMin(), scaledValidator->getMax()));
|
||||
if (validator->getFidelity() > 1)
|
||||
retCtrl->setField("increment", String::ToString("%d", scaledValidator->getScaleFactor()));
|
||||
}
|
||||
}
|
||||
return retCtrl;
|
||||
}
|
||||
|
||||
void GuiInspectorTypeRangedS32::setValue(StringTableEntry newValue)
|
||||
{
|
||||
GuiTextEditSliderCtrl* ctrl = dynamic_cast<GuiTextEditSliderCtrl*>(mEdit);
|
||||
if (ctrl != NULL)
|
||||
ctrl->setText(newValue);
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
// GuiInspectorTypeS32Mask
|
||||
//-----------------------------------------------------------------------------
|
||||
|
|
@ -1522,6 +1633,32 @@ void GuiInspectorTypeBitMask32::setValue( StringTableEntry value )
|
|||
{
|
||||
U32 mask = dAtoui( value );
|
||||
|
||||
if (mask == 0 && mask != -1) //zero we need to double check. -1 we know is all on
|
||||
{
|
||||
BitSet32 bitMask;
|
||||
const EngineEnumTable* table = mField->table;
|
||||
if (!table)
|
||||
{
|
||||
ConsoleBaseType* type = ConsoleBaseType::getType(mField->type);
|
||||
if (type && type->getEnumTable())
|
||||
table = type->getEnumTable();
|
||||
}
|
||||
|
||||
if (table)
|
||||
{
|
||||
const EngineEnumTable& t = *table;
|
||||
const U32 numEntries = t.getNumValues();
|
||||
String inString(value);
|
||||
|
||||
for (U32 i = 0; i < numEntries; i++)
|
||||
{
|
||||
if (inString.find(t[i].getName()) != String::NPos)
|
||||
bitMask.set(t[i].getInt());
|
||||
}
|
||||
mask = bitMask.getMask();
|
||||
}
|
||||
}
|
||||
|
||||
for ( U32 i = 0; i < mArrayCtrl->size(); i++ )
|
||||
{
|
||||
GuiCheckBoxCtrl *pCheckBox = dynamic_cast<GuiCheckBoxCtrl*>( mArrayCtrl->at(i) );
|
||||
|
|
|
|||
|
|
@ -473,6 +473,35 @@ public:
|
|||
void setValue( StringTableEntry newValue ) override;
|
||||
};
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// TypeRangedF32 GuiInspectorField class
|
||||
//------------------------------------------------------------------------------
|
||||
class GuiInspectorTypeRangedF32 : public GuiInspectorField
|
||||
{
|
||||
private:
|
||||
typedef GuiInspectorField Parent;
|
||||
public:
|
||||
DECLARE_CONOBJECT(GuiInspectorTypeRangedF32);
|
||||
static void consoleInit();
|
||||
|
||||
GuiControl* constructEditControl() override;
|
||||
void setValue(StringTableEntry newValue) override;
|
||||
};
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// TypeRangedS32 GuiInspectorField class
|
||||
//------------------------------------------------------------------------------
|
||||
class GuiInspectorTypeRangedS32 : public GuiInspectorField
|
||||
{
|
||||
private:
|
||||
typedef GuiInspectorField Parent;
|
||||
public:
|
||||
DECLARE_CONOBJECT(GuiInspectorTypeRangedS32);
|
||||
static void consoleInit();
|
||||
|
||||
GuiControl* constructEditControl() override;
|
||||
void setValue(StringTableEntry newValue) override;
|
||||
};
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// TypeBitMask32 GuiInspectorField class
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@
|
|||
#include "gfx/primBuilder.h"
|
||||
#include "console/engineAPI.h"
|
||||
#include "gui/editor/guiPopupMenuCtrl.h"
|
||||
#include "console/typeValidators.h"
|
||||
|
||||
// menu bar:
|
||||
// basic idea - fixed height control bar at the top of a window, placed and sized in gui editor
|
||||
|
|
@ -188,9 +189,9 @@ void GuiMenuBar::onRemove()
|
|||
void GuiMenuBar::initPersistFields()
|
||||
{
|
||||
docsURL;
|
||||
addField("padding", TypeS32, Offset( mPadding, GuiMenuBar ),"Extra padding to add to the bounds of the control.\n");
|
||||
addFieldV("padding", TypeRangedS32, Offset( mPadding, GuiMenuBar ), &CommonValidators::PositiveInt,"Extra padding to add to the bounds of the control.\n");
|
||||
|
||||
addField("menubarHeight", TypeS32, Offset(mMenubarHeight, GuiMenuBar), "Sets the height of the menubar when attached to the canvas.\n");
|
||||
addFieldV("menubarHeight", TypeRangedS32, Offset(mMenubarHeight, GuiMenuBar), &CommonValidators::PositiveInt, "Sets the height of the menubar when attached to the canvas.\n");
|
||||
|
||||
Parent::initPersistFields();
|
||||
}
|
||||
|
|
@ -506,6 +507,16 @@ void GuiMenuBar::onAction()
|
|||
mouseDownMenu->popupMenu->showPopup(root, pos.x, pos.y);
|
||||
}
|
||||
|
||||
void GuiMenuBar::closeMenu()
|
||||
{
|
||||
if(mouseDownMenu)
|
||||
mouseDownMenu->popupMenu->hidePopup();
|
||||
|
||||
mouseOverMenu = NULL;
|
||||
mouseDownMenu = NULL;
|
||||
mMouseInMenu = false;
|
||||
}
|
||||
|
||||
// Process a tick
|
||||
void GuiMenuBar::processTick()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -247,6 +247,10 @@ void GuiPopupMenuTextListCtrl::onMouseUp(const GuiEvent &event)
|
|||
{
|
||||
if (item->mEnabled)
|
||||
{
|
||||
if(mMenuBar)
|
||||
{
|
||||
mMenuBar->closeMenu();
|
||||
}
|
||||
Con::executef(mPopup, "onSelectItem", Con::getIntArg(getSelectedCell().y), item->mText.isNotEmpty() ? item->mText : String(""));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@
|
|||
#include "console/engineAPI.h"
|
||||
#include "gfx/gfxDevice.h"
|
||||
#include "gfx/gfxDrawUtil.h"
|
||||
#include "console/typeValidators.h"
|
||||
|
||||
#include "gui/editor/guiRectHandles.h"
|
||||
|
||||
|
|
@ -55,7 +56,7 @@ void GuiRectHandles::initPersistFields()
|
|||
{
|
||||
docsURL;
|
||||
addField("handleRect", TypeRectF, Offset(mHandleRect, GuiRectHandles), "RectF of handle's box." );
|
||||
addField("handleSize", TypeS32, Offset(mHandleSize, GuiRectHandles), "Size of handles in pixels." );
|
||||
addFieldV("handleSize", TypeRangedS32, Offset(mHandleSize, GuiRectHandles), &CommonValidators::NaturalNumber, "Size of handles in pixels." );
|
||||
addField("useCustomColor", TypeBool, Offset(mUseCustomColor, GuiRectHandles), "Use given custom color for handles." );
|
||||
addField("handleColor", TypeColorI, Offset(mHandleColor, GuiRectHandles), "Use given custom color for handles." );
|
||||
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@
|
|||
#include "console/consoleTypes.h"
|
||||
#include "gui/core/guiCanvas.h"
|
||||
#include "gui/core/guiDefaultControlRender.h"
|
||||
#include "console/typeValidators.h"
|
||||
|
||||
IMPLEMENT_CONOBJECT(GuiSeparatorCtrl);
|
||||
|
||||
|
|
@ -77,9 +78,9 @@ void GuiSeparatorCtrl::initPersistFields()
|
|||
"Optional text label to display." );
|
||||
addField("type", TYPEID< separatorTypeOptions >(), Offset(mSeparatorType, GuiSeparatorCtrl),
|
||||
"Orientation of separator." );
|
||||
addField("borderMargin", TypeS32, Offset(mMargin, GuiSeparatorCtrl));
|
||||
addFieldV("borderMargin", TypeRangedS32, Offset(mMargin, GuiSeparatorCtrl), &CommonValidators::PositiveInt);
|
||||
addField("invisible", TypeBool, Offset(mInvisible, GuiSeparatorCtrl));// Nonsense. Should use GuiControl's visibility.
|
||||
addField("leftMargin", TypeS32, Offset(mTextLeftMargin, GuiSeparatorCtrl),
|
||||
addFieldV("leftMargin", TypeRangedS32, Offset(mTextLeftMargin, GuiSeparatorCtrl), &CommonValidators::PositiveInt,
|
||||
"Left margin of text label." );
|
||||
|
||||
Parent::initPersistFields();
|
||||
|
|
|
|||
|
|
@ -174,7 +174,7 @@ void GuiShapeEdPreview::initPersistFields()
|
|||
addGroup( "Detail Stats" );
|
||||
addField( "fixedDetail", TypeBool, Offset( mFixedDetail, GuiShapeEdPreview ),
|
||||
"If false, the current detail is selected based on camera distance" );
|
||||
addField( "orbitDist", TypeF32, Offset( mOrbitDist, GuiShapeEdPreview ),
|
||||
addFieldV( "orbitDist", TypeRangedF32, Offset( mOrbitDist, GuiShapeEdPreview ), &CommonValidators::PositiveFloat,
|
||||
"The current distance from the camera to the model" );
|
||||
addProtectedField( "currentDL", TypeS32, Offset( mCurrentDL, GuiShapeEdPreview ), &setFieldCurrentDL, &defaultProtectedGetFn,
|
||||
"The current detail level" );
|
||||
|
|
|
|||
|
|
@ -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());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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.")
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue