|
@@ -57,10 +57,6 @@ GuiControl* GuiInspectorTypeMenuBase::constructEditControl()
|
|
|
{
|
|
|
GuiControl* retCtrl = new GuiPopUpMenuCtrl();
|
|
|
|
|
|
- // If we couldn't construct the control, bail!
|
|
|
- if( retCtrl == NULL )
|
|
|
- return retCtrl;
|
|
|
-
|
|
|
GuiPopUpMenuCtrl *menu = dynamic_cast<GuiPopUpMenuCtrl*>(retCtrl);
|
|
|
|
|
|
// Let's make it look pretty.
|
|
@@ -218,25 +214,21 @@ GuiControl* GuiInspectorTypeMaterialName::construct(const char* command)
|
|
|
//return retCtrl;
|
|
|
mBrowseButton = new GuiBitmapButtonCtrl();
|
|
|
|
|
|
- if ( mBrowseButton != NULL )
|
|
|
- {
|
|
|
- RectI browseRect( Point2I( ( getLeft() + getWidth()) - 26, getTop() + 2), Point2I(20, getHeight() - 4) );
|
|
|
+ RectI browseRect( Point2I( ( getLeft() + getWidth()) - 26, getTop() + 2), Point2I(20, getHeight() - 4) );
|
|
|
|
|
|
- char szBuffer[512];
|
|
|
- dSprintf( szBuffer, 512, command, getId());
|
|
|
- mBrowseButton->setField( "Command", szBuffer );
|
|
|
+ dSprintf( szBuffer, 512, command, getId());
|
|
|
+ mBrowseButton->setField( "Command", szBuffer );
|
|
|
|
|
|
- //temporary static button name
|
|
|
- char bitmapName[512] = "tools/materialEditor/gui/change-material-btn";
|
|
|
- mBrowseButton->setBitmap( bitmapName );
|
|
|
+ //temporary static button name
|
|
|
+ char bitmapName[512] = "tools/materialEditor/gui/change-material-btn";
|
|
|
+ mBrowseButton->setBitmap( bitmapName );
|
|
|
|
|
|
- mBrowseButton->setDataField( StringTable->insert("Profile"), NULL, "GuiButtonProfile" );
|
|
|
- mBrowseButton->registerObject();
|
|
|
- addObject( mBrowseButton );
|
|
|
+ mBrowseButton->setDataField( StringTable->insert("Profile"), NULL, "GuiButtonProfile" );
|
|
|
+ mBrowseButton->registerObject();
|
|
|
+ addObject( mBrowseButton );
|
|
|
|
|
|
- // Position
|
|
|
- mBrowseButton->resize( browseRect.point, browseRect.extent );
|
|
|
- }
|
|
|
+ // Position
|
|
|
+ mBrowseButton->resize( browseRect.point, browseRect.extent );
|
|
|
|
|
|
return retCtrl;
|
|
|
}
|
|
@@ -328,25 +320,21 @@ GuiControl* GuiInspectorTypeTerrainMaterialName::construct(const char* command)
|
|
|
//return retCtrl;
|
|
|
mBrowseButton = new GuiBitmapButtonCtrl();
|
|
|
|
|
|
- if ( mBrowseButton != NULL )
|
|
|
- {
|
|
|
- RectI browseRect( Point2I( ( getLeft() + getWidth()) - 26, getTop() + 2), Point2I(20, getHeight() - 4) );
|
|
|
+ RectI browseRect( Point2I( ( getLeft() + getWidth()) - 26, getTop() + 2), Point2I(20, getHeight() - 4) );
|
|
|
|
|
|
- char szBuffer[512];
|
|
|
- dSprintf( szBuffer, 512, command, getId());
|
|
|
- mBrowseButton->setField( "Command", szBuffer );
|
|
|
+ dSprintf( szBuffer, 512, command, getId());
|
|
|
+ mBrowseButton->setField( "Command", szBuffer );
|
|
|
|
|
|
- //temporary static button name
|
|
|
- char bitmapName[512] = "tools/gui/images/layers-btn";
|
|
|
- mBrowseButton->setBitmap( bitmapName );
|
|
|
+ //temporary static button name
|
|
|
+ char bitmapName[512] = "tools/gui/images/layers-btn";
|
|
|
+ mBrowseButton->setBitmap( bitmapName );
|
|
|
|
|
|
- mBrowseButton->setDataField( StringTable->insert("Profile"), NULL, "GuiButtonProfile" );
|
|
|
- mBrowseButton->registerObject();
|
|
|
- addObject( mBrowseButton );
|
|
|
+ mBrowseButton->setDataField( StringTable->insert("Profile"), NULL, "GuiButtonProfile" );
|
|
|
+ mBrowseButton->registerObject();
|
|
|
+ addObject( mBrowseButton );
|
|
|
|
|
|
- // Position
|
|
|
- mBrowseButton->resize( browseRect.point, browseRect.extent );
|
|
|
- }
|
|
|
+ // Position
|
|
|
+ mBrowseButton->resize( browseRect.point, browseRect.extent );
|
|
|
|
|
|
return retCtrl;
|
|
|
}
|
|
@@ -414,10 +402,6 @@ GuiControl* GuiInspectorTypeCheckBox::constructEditControl()
|
|
|
{
|
|
|
GuiControl* retCtrl = new GuiCheckBoxCtrl();
|
|
|
|
|
|
- // If we couldn't construct the control, bail!
|
|
|
- if( retCtrl == NULL )
|
|
|
- return retCtrl;
|
|
|
-
|
|
|
GuiCheckBoxCtrl *check = dynamic_cast<GuiCheckBoxCtrl*>(retCtrl);
|
|
|
|
|
|
// Let's make it look pretty.
|
|
@@ -485,10 +469,6 @@ GuiControl* GuiInspectorTypeFileName::constructEditControl()
|
|
|
{
|
|
|
GuiControl* retCtrl = new GuiTextEditCtrl();
|
|
|
|
|
|
- // If we couldn't construct the control, bail!
|
|
|
- if( retCtrl == NULL )
|
|
|
- return retCtrl;
|
|
|
-
|
|
|
// Let's make it look pretty.
|
|
|
retCtrl->setDataField( StringTable->insert("profile"), NULL, "GuiInspectorTextEditRightProfile" );
|
|
|
retCtrl->setDataField( StringTable->insert("tooltipprofile"), NULL, "GuiToolTipProfile" );
|
|
@@ -504,20 +484,17 @@ GuiControl* GuiInspectorTypeFileName::constructEditControl()
|
|
|
|
|
|
mBrowseButton = new GuiButtonCtrl();
|
|
|
|
|
|
- if( mBrowseButton != NULL )
|
|
|
- {
|
|
|
- RectI browseRect( Point2I( ( getLeft() + getWidth()) - 26, getTop() + 2), Point2I(20, getHeight() - 4) );
|
|
|
- char szBuffer[512];
|
|
|
- dSprintf( szBuffer, 512, "getLoadFilename(\"*.*|*.*\", \"%d.apply\", %d.getData());", getId(), getId() );
|
|
|
- mBrowseButton->setField( "Command", szBuffer );
|
|
|
- mBrowseButton->setField( "text", "..." );
|
|
|
- mBrowseButton->setDataField( StringTable->insert("Profile"), NULL, "GuiInspectorButtonProfile" );
|
|
|
- mBrowseButton->registerObject();
|
|
|
- addObject( mBrowseButton );
|
|
|
+ RectI browseRect( Point2I( ( getLeft() + getWidth()) - 26, getTop() + 2), Point2I(20, getHeight() - 4) );
|
|
|
|
|
|
- // Position
|
|
|
- mBrowseButton->resize( browseRect.point, browseRect.extent );
|
|
|
- }
|
|
|
+ dSprintf( szBuffer, 512, "getLoadFilename(\"*.*|*.*\", \"%d.apply\", %d.getData());", getId(), getId() );
|
|
|
+ mBrowseButton->setField( "Command", szBuffer );
|
|
|
+ mBrowseButton->setField( "text", "..." );
|
|
|
+ mBrowseButton->setDataField( StringTable->insert("Profile"), NULL, "GuiInspectorButtonProfile" );
|
|
|
+ mBrowseButton->registerObject();
|
|
|
+ addObject( mBrowseButton );
|
|
|
+
|
|
|
+ // Position
|
|
|
+ mBrowseButton->resize( browseRect.point, browseRect.extent );
|
|
|
|
|
|
return retCtrl;
|
|
|
}
|
|
@@ -769,23 +746,20 @@ GuiControl* GuiInspectorTypeShapeFilename::constructEditControl()
|
|
|
|
|
|
// Create "Open in ShapeEditor" button
|
|
|
mShapeEdButton = new GuiBitmapButtonCtrl();
|
|
|
- if ( mShapeEdButton != NULL )
|
|
|
- {
|
|
|
- char szBuffer[512];
|
|
|
- dSprintf( szBuffer, sizeof(szBuffer), "ShapeEditorPlugin.open(%d.getText());", retCtrl->getId() );
|
|
|
- mShapeEdButton->setField( "Command", szBuffer );
|
|
|
|
|
|
- char bitmapName[512] = "tools/worldEditor/images/toolbar/shape-editor";
|
|
|
- mShapeEdButton->setBitmap( bitmapName );
|
|
|
+ dSprintf(szBuffer, sizeof(szBuffer), "ShapeEditorPlugin.open(%d.getText());", retCtrl->getId());
|
|
|
+ mShapeEdButton->setField("Command", szBuffer);
|
|
|
|
|
|
- mShapeEdButton->setDataField( StringTable->insert("Profile"), NULL, "GuiButtonProfile" );
|
|
|
- mShapeEdButton->setDataField( StringTable->insert("tooltipprofile"), NULL, "GuiToolTipProfile" );
|
|
|
- mShapeEdButton->setDataField( StringTable->insert("hovertime"), NULL, "1000" );
|
|
|
- mShapeEdButton->setDataField( StringTable->insert("tooltip"), NULL, "Open this file in the Shape Editor" );
|
|
|
+ char bitmapName[512] = "tools/worldEditor/images/toolbar/shape-editor";
|
|
|
+ mShapeEdButton->setBitmap(bitmapName);
|
|
|
|
|
|
- mShapeEdButton->registerObject();
|
|
|
- addObject( mShapeEdButton );
|
|
|
- }
|
|
|
+ mShapeEdButton->setDataField(StringTable->insert("Profile"), NULL, "GuiButtonProfile");
|
|
|
+ mShapeEdButton->setDataField(StringTable->insert("tooltipprofile"), NULL, "GuiToolTipProfile");
|
|
|
+ mShapeEdButton->setDataField(StringTable->insert("hovertime"), NULL, "1000");
|
|
|
+ mShapeEdButton->setDataField(StringTable->insert("tooltip"), NULL, "Open this file in the Shape Editor");
|
|
|
+
|
|
|
+ mShapeEdButton->registerObject();
|
|
|
+ addObject(mShapeEdButton);
|
|
|
|
|
|
return retCtrl;
|
|
|
}
|
|
@@ -842,10 +816,6 @@ GuiControl* GuiInspectorTypeCommand::constructEditControl()
|
|
|
{
|
|
|
GuiButtonCtrl* retCtrl = new GuiButtonCtrl();
|
|
|
|
|
|
- // If we couldn't construct the control, bail!
|
|
|
- if( retCtrl == NULL )
|
|
|
- return retCtrl;
|
|
|
-
|
|
|
// Let's make it look pretty.
|
|
|
retCtrl->setDataField( StringTable->insert("profile"), NULL, "GuiInspectorTextEditProfile" );
|
|
|
|
|
@@ -926,25 +896,21 @@ GuiControl* GuiInspectorTypeRectUV::constructEditControl()
|
|
|
//return retCtrl;
|
|
|
mBrowseButton = new GuiBitmapButtonCtrl();
|
|
|
|
|
|
- if ( mBrowseButton != NULL )
|
|
|
- {
|
|
|
- RectI browseRect( Point2I( ( getLeft() + getWidth()) - 26, getTop() + 2), Point2I(20, getHeight() - 4) );
|
|
|
+ RectI browseRect( Point2I( ( getLeft() + getWidth()) - 26, getTop() + 2), Point2I(20, getHeight() - 4) );
|
|
|
|
|
|
- char szBuffer[512];
|
|
|
- dSprintf( szBuffer, 512, "uvEditor.showDialog(\"%d.apply\", %d, %d.getText());", getId(), mInspector->getInspectObject()->getId(), retCtrl->getId());
|
|
|
- mBrowseButton->setField( "Command", szBuffer );
|
|
|
+ dSprintf( szBuffer, 512, "uvEditor.showDialog(\"%d.apply\", %d, %d.getText());", getId(), mInspector->getInspectObject()->getId(), retCtrl->getId());
|
|
|
+ mBrowseButton->setField( "Command", szBuffer );
|
|
|
|
|
|
- //temporary static button name
|
|
|
- char bitmapName[512] = "tools/gui/images/uv-editor-btn";
|
|
|
- mBrowseButton->setBitmap( bitmapName );
|
|
|
+ //temporary static button name
|
|
|
+ char bitmapName[512] = "tools/gui/images/uv-editor-btn";
|
|
|
+ mBrowseButton->setBitmap( bitmapName );
|
|
|
|
|
|
- mBrowseButton->setDataField( StringTable->insert("Profile"), NULL, "GuiButtonProfile" );
|
|
|
- mBrowseButton->registerObject();
|
|
|
- addObject( mBrowseButton );
|
|
|
+ mBrowseButton->setDataField( StringTable->insert("Profile"), NULL, "GuiButtonProfile" );
|
|
|
+ mBrowseButton->registerObject();
|
|
|
+ addObject( mBrowseButton );
|
|
|
|
|
|
- // Position
|
|
|
- mBrowseButton->resize( browseRect.point, browseRect.extent );
|
|
|
- }
|
|
|
+ // Position
|
|
|
+ mBrowseButton->resize( browseRect.point, browseRect.extent );
|
|
|
|
|
|
return retCtrl;
|
|
|
}
|
|
@@ -1084,10 +1050,6 @@ GuiControl* GuiInspectorTypeColor::constructEditControl()
|
|
|
{
|
|
|
GuiControl* retCtrl = new GuiTextEditCtrl();
|
|
|
|
|
|
- // If we couldn't construct the control, bail!
|
|
|
- if( retCtrl == NULL )
|
|
|
- return retCtrl;
|
|
|
-
|
|
|
// Let's make it look pretty.
|
|
|
retCtrl->setDataField( StringTable->insert("profile"), NULL, "GuiInspectorTextEditProfile" );
|
|
|
|
|
@@ -1101,46 +1063,42 @@ GuiControl* GuiInspectorTypeColor::constructEditControl()
|
|
|
|
|
|
mBrowseButton = new GuiSwatchButtonCtrl();
|
|
|
|
|
|
- if ( mBrowseButton != NULL )
|
|
|
- {
|
|
|
- RectI browseRect( Point2I( ( getLeft() + getWidth()) - 26, getTop() + 2), Point2I(20, getHeight() - 4) );
|
|
|
- mBrowseButton->setDataField( StringTable->insert("Profile"), NULL, "GuiInspectorSwatchButtonProfile" );
|
|
|
- mBrowseButton->registerObject();
|
|
|
- addObject( mBrowseButton );
|
|
|
+ RectI browseRect( Point2I( ( getLeft() + getWidth()) - 26, getTop() + 2), Point2I(20, getHeight() - 4) );
|
|
|
+ mBrowseButton->setDataField( StringTable->insert("Profile"), NULL, "GuiInspectorSwatchButtonProfile" );
|
|
|
+ mBrowseButton->registerObject();
|
|
|
+ addObject( mBrowseButton );
|
|
|
|
|
|
- char szColor[512];
|
|
|
- if( _getColorConversionFunction() )
|
|
|
- dSprintf( szColor, 512, "%s( %d.color )", _getColorConversionFunction(), mBrowseButton->getId() );
|
|
|
- else
|
|
|
- dSprintf( szColor, 512, "%d.color", mBrowseButton->getId() );
|
|
|
+ char szColor[2048];
|
|
|
+ if( _getColorConversionFunction() )
|
|
|
+ dSprintf( szColor, 512, "%s( %d.color )", _getColorConversionFunction(), mBrowseButton->getId() );
|
|
|
+ else
|
|
|
+ dSprintf( szColor, 512, "%d.color", mBrowseButton->getId() );
|
|
|
|
|
|
- // If the inspector supports the alternate undo recording path,
|
|
|
- // use this here.
|
|
|
-
|
|
|
- char szBuffer[2048];
|
|
|
- GuiInspector* inspector = getInspector();
|
|
|
- if( inspector->isMethod( "onInspectorPreFieldModification" ) )
|
|
|
- {
|
|
|
- dSprintf( szBuffer, sizeof( szBuffer ),
|
|
|
- "%d.onInspectorPreFieldModification(\"%s\",\"%s\"); %s(%s, \"%d.onInspectorPostFieldModification(); %d.applyWithoutUndo\", %d.getRoot(), \"%d.applyWithoutUndo\", \"%d.onInspectorDiscardFieldModification(); %%unused=\");",
|
|
|
- inspector->getId(), getRawFieldName(), getArrayIndex(),
|
|
|
- mColorFunction, szColor, inspector->getId(), getId(),
|
|
|
- getId(),
|
|
|
- getId(),
|
|
|
- inspector->getId()
|
|
|
- );
|
|
|
- }
|
|
|
- else
|
|
|
- dSprintf( szBuffer, sizeof( szBuffer ),
|
|
|
- "%s(%s, \"%d.apply\", %d.getRoot());",
|
|
|
- mColorFunction, szColor, getId(), getId() );
|
|
|
-
|
|
|
- mBrowseButton->setConsoleCommand( szBuffer );
|
|
|
- mBrowseButton->setUseMouseEvents( true ); // Allow drag&drop.
|
|
|
+ // If the inspector supports the alternate undo recording path,
|
|
|
+ // use this here.
|
|
|
|
|
|
- // Position
|
|
|
- mBrowseButton->resize( browseRect.point, browseRect.extent );
|
|
|
+ GuiInspector* inspector = getInspector();
|
|
|
+ if( inspector->isMethod( "onInspectorPreFieldModification" ) )
|
|
|
+ {
|
|
|
+ dSprintf( szBuffer, sizeof( szBuffer ),
|
|
|
+ "%d.onInspectorPreFieldModification(\"%s\",\"%s\"); %s(%s, \"%d.onInspectorPostFieldModification(); %d.applyWithoutUndo\", %d.getRoot(), \"%d.applyWithoutUndo\", \"%d.onInspectorDiscardFieldModification(); %%unused=\");",
|
|
|
+ inspector->getId(), getRawFieldName(), getArrayIndex(),
|
|
|
+ mColorFunction, szColor, inspector->getId(), getId(),
|
|
|
+ getId(),
|
|
|
+ getId(),
|
|
|
+ inspector->getId()
|
|
|
+ );
|
|
|
}
|
|
|
+ else
|
|
|
+ dSprintf( szBuffer, sizeof( szBuffer ),
|
|
|
+ "%s(%s, \"%d.apply\", %d.getRoot());",
|
|
|
+ mColorFunction, szColor, getId(), getId() );
|
|
|
+
|
|
|
+ mBrowseButton->setConsoleCommand( szBuffer );
|
|
|
+ mBrowseButton->setUseMouseEvents( true ); // Allow drag&drop.
|
|
|
+
|
|
|
+ // Position
|
|
|
+ mBrowseButton->resize( browseRect.point, browseRect.extent );
|
|
|
|
|
|
return retCtrl;
|
|
|
}
|
|
@@ -1277,10 +1235,6 @@ GuiControl* GuiInspectorTypeS32::constructEditControl()
|
|
|
{
|
|
|
GuiControl* retCtrl = new GuiTextEditSliderCtrl();
|
|
|
|
|
|
- // If we couldn't construct the control, bail!
|
|
|
- if( retCtrl == NULL )
|
|
|
- return retCtrl;
|
|
|
-
|
|
|
retCtrl->setDataField( StringTable->insert("profile"), NULL, "GuiInspectorTextEditProfile" );
|
|
|
|
|
|
// Don't forget to register ourselves
|