More updating of editor icons to assets

Fixed handling of convex shape editor's active and default materials
Fixed assignment of material for convex shapes via editor
Fixed material editor map assignment logic
Added utility function to detect possible duplicate files in project to ProjectImporter
Added conversion of legacy sky and water classes to importer
Fixed bufferLen issue with guiTreeViewCtrl
This commit is contained in:
Areloch 2021-08-07 19:27:01 -05:00
parent 2f5f585aaf
commit 555c563b39
18 changed files with 147 additions and 30 deletions

View file

@ -207,7 +207,7 @@ GuiControl* GuiInspectorTypeCubemapAssetPtr::constructEditControl()
dSprintf(szBuffer, sizeof(szBuffer), "CubemapEditor.openCubemapAsset(%d.getText());", retCtrl->getId());
mShapeEdButton->setField("Command", szBuffer);
char bitmapName[512] = "tools/worldEditor/images/toolbar/shape-editor";
char bitmapName[512] = "ToolsModule:shape_editor_n_image";
mShapeEdButton->setBitmap(StringTable->insert(bitmapName));
mShapeEdButton->setDataField(StringTable->insert("Profile"), NULL, "GuiButtonProfile");

View file

@ -282,7 +282,7 @@ DefineEngineMethod(className, get##name##Asset, const char*, (), , assetText(nam
}\
DefineEngineMethod(className, set##name, bool, (const char* mat), , assetText(name,assignment. first tries asset then material name.))\
{\
return object->_set##name(StringTable->insert(map));\
return object->_set##name(StringTable->insert(mat));\
}
#define INIT_MATERIALASSET(name) \

View file

@ -160,7 +160,7 @@ GuiControl* GuiInspectorTypeParticleAssetPtr::constructEditControl()
dSprintf(szBuffer, sizeof(szBuffer), "echo(\"Game Object Editor not implemented yet!\");", retCtrl->getId());
mSMEdButton->setField("Command", szBuffer);
char bitmapName[512] = "tools/worldEditor/images/toolbar/shape-editor";
char bitmapName[512] = "ToolsModule:shape_editor_n_image";
mSMEdButton->setBitmap(StringTable->insert(bitmapName));
mSMEdButton->setDataField(StringTable->insert("Profile"), NULL, "GuiButtonProfile");

View file

@ -195,7 +195,7 @@ GuiControl* GuiInspectorTypeStateMachineAssetPtr::constructEditControl()
dSprintf(szBuffer, sizeof(szBuffer), "StateMachineEditor.loadStateMachineAsset(%d.getText()); Canvas.pushDialog(StateMachineEditor);", retCtrl->getId());
mSMEdButton->setField("Command", szBuffer);
char bitmapName[512] = "tools/worldEditor/images/toolbar/shape-editor";
char bitmapName[512] = "ToolsModule:shape_editor_n_image";
mSMEdButton->setBitmap(StringTable->insert(bitmapName));
mSMEdButton->setDataField(StringTable->insert("Profile"), NULL, "GuiButtonProfile");

View file

@ -2170,3 +2170,5 @@ void ConvexShape::Geometry::generate(const Vector< PlaneF > &planes, const Vecto
faces.push_back( newFace );
}
}
DEF_MATERIALASSET_BINDS(ConvexShape, Material);

View file

@ -586,8 +586,8 @@ S32 GuiTreeViewCtrl::Item::getDisplayTextWidth(GFont *font)
if( bufLen == 0 )
return 0;
// Add space for the string terminator
bufLen++;
// Add space for the string terminator and marker
bufLen += 2;
char *buf = (char*)txtAlloc.alloc(bufLen);
getDisplayText(bufLen, buf);

View file

@ -220,7 +220,7 @@ GuiControl* GuiInspectorTypeMaterialName::construct(const char* command)
mBrowseButton->setField( "Command", szBuffer );
//temporary static button name
char bitmapName[512] = "tools/materialEditor/gui/change-material-btn";
char bitmapName[512] = "ToolsModule:change_material_btn_n_image";
mBrowseButton->setBitmap( StringTable->insert(bitmapName) );
mBrowseButton->setDataField( StringTable->insert("Profile"), NULL, "GuiButtonProfile" );
@ -326,7 +326,7 @@ GuiControl* GuiInspectorTypeTerrainMaterialName::construct(const char* command)
mBrowseButton->setField( "Command", szBuffer );
//temporary static button name
char bitmapName[512] = "tools/gui/images/layers-btn";
char bitmapName[512] = "ToolsModule:tools/gui/images/layers_btn_n_image";
mBrowseButton->setBitmap(StringTable->insert(bitmapName) );
mBrowseButton->setDataField( StringTable->insert("Profile"), NULL, "GuiButtonProfile" );
@ -804,7 +804,7 @@ GuiControl* GuiInspectorTypeShapeFilename::constructEditControl()
dSprintf(szBuffer, sizeof(szBuffer), "ShapeEditorPlugin.open(%d.getText());", retCtrl->getId());
mShapeEdButton->setField("Command", szBuffer);
char bitmapName[512] = "tools/worldEditor/images/toolbar/shape-editor";
char bitmapName[512] = "ToolsModule:shape_editor_n_image";
mShapeEdButton->setBitmap(StringTable->insert(bitmapName));
mShapeEdButton->setDataField(StringTable->insert("Profile"), NULL, "GuiButtonProfile");
@ -956,7 +956,7 @@ GuiControl* GuiInspectorTypeRectUV::constructEditControl()
mBrowseButton->setField( "Command", szBuffer );
//temporary static button name
char bitmapName[512] = "tools/gui/images/uv-editor-btn";
char bitmapName[512] = "ToolsModule:uv_editor_btn_n_image";
mBrowseButton->setBitmap(StringTable->insert(bitmapName) );
mBrowseButton->setDataField( StringTable->insert("Profile"), NULL, "GuiButtonProfile" );
@ -1544,7 +1544,7 @@ GuiControl* GuiInspectorTypeBitMask32Helper::constructEditControl()
mButton->setField( "Command", szBuffer );
mButton->setField( "buttonType", "ToggleButton" );
mButton->setDataField( StringTable->insert("Profile"), NULL, "GuiInspectorButtonProfile" );
mButton->setBitmap(StringTable->insert("tools/gui/images/arrowBtn.png") );
mButton->setBitmap(StringTable->insert("ToolsModule:arrowBtn_image") );
mButton->setStateOn( true );
mButton->setExtent( 16, 16 );
mButton->registerObject();

View file

@ -257,7 +257,7 @@ bool GuiInspectorDynamicField::onAdd()
mParent->getId() );
// FIXME Hardcoded image
mDeleteButton->setField( "Bitmap", "tools/gui/images/iconDelete" );
mDeleteButton->setField( "Bitmap", "ToolsModule:iconDelete_image" );
mDeleteButton->setField( "Text", "X" );
mDeleteButton->setField( "Command", szBuffer );
mDeleteButton->setSizing( horizResizeLeft, vertResizeCenter );

View file

@ -60,7 +60,7 @@ bool GuiInspectorDynamicGroup::createContent()
addFieldBtn->setControlProfile( dynamic_cast<GuiControlProfile*>(profilePtr) );
// FIXME Hardcoded image
addFieldBtn->setBitmap(StringTable->insert("tools/gui/images/iconAdd.png"));
addFieldBtn->setBitmap(StringTable->insert("ToolsModule:iconAdd_image"));
char commandBuf[64];
dSprintf(commandBuf, 64, "%d.addDynamicField();", this->getId());

View file

@ -529,7 +529,7 @@ void GuiConvexEditorCtrl::on3DMouseDragged(const Gui3DMouseEvent & event)
setupShape( newShape );
newShape->setField("material", mConvexSEL->getMaterialName());
newShape->_setMaterial(mConvexSEL->getMaterial());
submitUndo( CreateShape, newShape );
@ -1459,8 +1459,8 @@ bool GuiConvexEditorCtrl::isShapeValid( ConvexShape *shape )
void GuiConvexEditorCtrl::setupShape( ConvexShape *shape )
{
shape->setField( "materialAsset", mMaterialName );
shape->registerObject();
shape->_setMaterial(mMaterialName);
updateShape( shape );
Scene* scene = Scene::getRootScene();
@ -2284,9 +2284,10 @@ ConvexEditorTool::EventResult ConvexEditorCreateTool::on3DMouseDown( const Gui3D
mNewConvex->setTransform( objMat );
mNewConvex->setField( "materialAsset", Parent::mEditor->mMaterialName );
mNewConvex->registerObject();
mNewConvex->_setMaterial(Parent::mEditor->mMaterialName);
mPlaneSizes.set( 0.1f, 0.1f, 0.1f );
mNewConvex->resizePlanes( mPlaneSizes );
mEditor->updateShape( mNewConvex );
@ -2509,7 +2510,7 @@ ConvexShape* ConvexEditorCreateTool::extrudeShapeFromFace( ConvexShape *inShape,
}
//newShape->setField( "material", Parent::mEditor->mMaterialName );
newShape->setField("materialAsset", inShape->getMaterialName());
newShape->_setMaterial(inShape->getMaterial());
newShape->registerObject();
mEditor->updateShape( newShape );

View file

@ -129,7 +129,7 @@ void PostEffectVis::open( PostEffect *pfx )
bmpCtrl->setSizing( GuiControl::horizResizeWidth, GuiControl::vertResizeHeight );
bmpCtrl->setExtent( 341, 181 );
bmpCtrl->setDataField( StringTable->insert( "wrap" ), NULL, "1" );
bmpCtrl->setBitmap( "tools/gui/images/transp_grid" );
bmpCtrl->setBitmap( "ToolsModule:transp_grid_image" );
bmpCtrl->registerObject();
winCtrl->addObject( bmpCtrl );

View file

@ -31,6 +31,13 @@ function ConvexEditorGui::onWake( %this )
%mat = EditorSettings.Value("ConvexEditor/MaterialName");
if(AssetDatabase.isDeclaredAsset(%mat))
{
%matName = AssetDatabase.acquireAsset(%mat).materialDefinitionName;
AssetDatabase.releaseAsset(%mat);
%mat = %matName;
}
ConvexEditorOptionsWindow-->matPreviewBtn.setBitmap(%mat.getDiffuseMap(0));
ConvexEditorOptionsWindow.activeMaterial = %mat;
@ -68,7 +75,8 @@ function ConvexEditorGui::onSelectionChanged( %this, %shape, %face )
ConvexEditorDeleteFaceBtn.setActive( true );
ConvexEditorOptionsWindow-->defMatPreviewBtn.setText("");
ConvexEditorOptionsWindow-->defMatPreviewBtn.setBitmap(%shape.material.getDiffuseMap(0));
%shapeMat = %shape.getMaterial();
ConvexEditorOptionsWindow-->defMatPreviewBtn.setBitmap(%shapeMat.getDiffuseMap(0));
ConvexEditorOptionsWindow.activeShape = %shape;
@ -234,7 +242,7 @@ function ConvexEditorDefaultMaterialBtn::gotMaterialName(%this, %name)
ConvexEditorOptionsWindow-->defMatPreviewBtn.setBitmap(%diffusemap);
ConvexEditorOptionsWindow.activeShape.material = %materialAsset.materialDefinitionName;
ConvexEditorOptionsWindow.activeShape.setMaterial(%name);
ConvexEditorGui.updateShape();
}

View file

@ -862,11 +862,11 @@ function GuiEditorTabBook::onTabSelected( %this, %text, %index )
%sidebar-->button3.setVisible( true );
%sidebar-->button4.setVisible( true );
%sidebar-->button4.setBitmap( "tools/gui/images/delete" );
%sidebar-->button4.setBitmap( "ToolsModule:iconDelete_image" );
%sidebar-->button4.command = "GuiEditor.deleteSelection();";
%sidebar-->button4.tooltip = "Delete Selected Control(s)";
%sidebar-->button3.setBitmap( "tools/gui/images/visible" );
%sidebar-->button3.setBitmap( "ToolsModule:visible_n_image" );
%sidebar-->button3.command = "GuiEditor.toggleHideSelection();";
%sidebar-->button3.tooltip = "Hide Selected Control(s)";
@ -877,19 +877,19 @@ function GuiEditorTabBook::onTabSelected( %this, %text, %index )
%sidebar-->button3.setVisible( true );
%sidebar-->button4.setVisible( true );
%sidebar-->button4.setBitmap( "tools/gui/images/delete" );
%sidebar-->button4.setBitmap( "ToolsModule:iconDelete_image" );
%sidebar-->button4.command = "GuiEditor.showDeleteProfileDialog( GuiEditorProfilesTree.getSelectedProfile() );";
%sidebar-->button4.tooltip = "Delete Selected Profile";
%sidebar-->button3.setBitmap( "tools/gui/images/new" );
%sidebar-->button3.setBitmap( "ToolsModule:new_n_image" );
%sidebar-->button3.command = "GuiEditor.createNewProfile( \"Unnamed\" );";
%sidebar-->button3.tooltip = "Create New Profile with Default Values";
%sidebar-->button2.setBitmap( "tools/gui/images/copy-btn" );
%sidebar-->button2.setBitmap( "ToolsModule:copy_btn_n_image" );
%sidebar-->button2.command = "GuiEditor.createNewProfile( GuiEditorProfilesTree.getSelectedProfile().getName(), GuiEditorProfilesTree.getSelectedProfile() );";
%sidebar-->button2.tooltip = "Create New Profile by Copying the Selected Profile";
%sidebar-->button1.setBitmap( "tools/gui/images/reset-icon" );
%sidebar-->button1.setBitmap( "ToolsModule:reset_icon_n_image" );
%sidebar-->button1.command = "GuiEditor.revertProfile( GuiEditorProfilesTree.getSelectedProfile() );";
%sidebar-->button1.tooltip = "Revert Changes to the Selected Profile";

View file

@ -1226,6 +1226,8 @@ function MaterialEditorGui::updateTextureMap( %this, %type, %action )
{
%layer = MaterialEditorGui.currentLayer;
%this.updatingTextureType = %type;
%bitmapCtrl = MaterialEditorPropertiesWindow.findObjectByInternalName( %type @ "MapDisplayBitmap", true );
%textCtrl = MaterialEditorPropertiesWindow.findObjectByInternalName( %type @ "MapNameText", true );
@ -1263,7 +1265,7 @@ function MaterialEditorGui::doUpdateTextureMap( %this, %assetId )
{
%bitmapCtrl.setBitmap(%texture);
%bitmap = %bitmapCtrl.bitmap;
%bitmap = %bitmapCtrl.getBitmap();
%bitmap = strreplace(%bitmap,"tools/materialEditor/scripts/","");
%bitmapCtrl.setBitmap(%bitmap);
%textCtrl.setText(%assetId);

View file

@ -214,7 +214,7 @@ $PE_guielement_ext_colorpicker = "18 18";
groupNum = "-1";
buttonType = "PushButton";
useMouseEvents = "0";
bitmap = "tools/gui/images/new";
bitmap = "ToolsModule:new_image";
tooltip = "Create New Emitter";
};
new GuiBitmapButtonCtrl() {

View file

@ -468,6 +468,32 @@ function T3Dpre4ProjectImporter::beginCodeFilesImport(%this)
{
%outLine = %this.call("processLevelInfoLine", %line);
if(%line !$= %outLine)
{
%fileWasChanged = true;
%line = %outLine;
}
}
}
else if(%className $= "Sky")
{
if(%this.isMethod("processSkyLine"))
{
%outLine = %this.call("processSkyLine", %line);
if(%line !$= %outLine)
{
%fileWasChanged = true;
%line = %outLine;
}
}
}
else if(%className $= "Water")
{
if(%this.isMethod("processWaterLine"))
{
%outLine = %this.call("processWaterLine", %line);
if(%line !$= %outLine)
{
%fileWasChanged = true;
@ -761,6 +787,26 @@ function T3Dpre4ProjectImporter::processLevelInfoLine(%this, %line)
return %line;
}
function T3Dpre4ProjectImporter::processSkyLine(%this, %line)
{
%outline = strreplace(%line, "Sky", "Skybox");
if(%outLine !$= %line)
return %outLine;
else
return %line;
}
function T3Dpre4ProjectImporter::processWaterLine(%this, %line)
{
%outline = strreplace(%line, "Water", "WaterPlane");
if(%outLine !$= %line)
return %outLine;
else
return %line;
}
//==============================================================================
// GUIs
//==============================================================================

View file

@ -1221,4 +1221,62 @@ function doDeleteAssetDefinitions()
echo("===========================================");
echo("Finished Deleting Asset Definitions");
echo("===========================================");
}
function scanForDuplicateFiles(%toTestFile)
{
echo("===========================================");
echo("Scanning for duplicate files!");
echo("===========================================");
//First, wipe out any files inside the folder first
%file = findFirstFileMultiExpr( "*/*.*", true);
while( %file !$= "" )
{
//We only really care about content files for this
if(!endsWith(%file, "dts") &&
!endsWith(%file, "dae") &&
!endsWith(%file, "fbx") &&
!endsWith(%file, "ter") &&
!endsWith(%file, "png") &&
!endsWith(%file, "jpg") &&
!endsWith(%file, "jpeg") &&
!endsWith(%file, "dds"))
{
%file = findNextFileMultiExpr( "*/*.*" );
continue;
}
%filename = fileName(%file);
%fileExt = fileExt(%file);
%filePath = filePath(%file);
if(%toTestFile $= "")
{
scanForDuplicateFiles(%file);
}
else
{
%testFilename = fileName(%toTestFile);
%testFileExt = fileExt(%toTestFile);
%testFilePath = filePath(%toTestFile);
if(%testFilename $= %filename && %testFileExt $= %fileExt)
{
//name matches, lets double check it'd actually cause a collision via the module it'd be in
%moduleName = AssetBrowser.dirHandler.getModuleFromAddress(%file).ModuleId;
%testModuleName = AssetBrowser.dirHandler.getModuleFromAddress(%testFilename).ModuleId;
if(%moduleName !$= "" && %testModuleName !$= "" && %moduleName $= %testModuleName)
{
//report the probable duplicate
error("Probable duplicate asset detected!");
error("Files: " @ %file @ " and " @ %toTestFile @ " have matching names and exist within the same module!");
}
}
}
%file = findNextFileMultiExpr( "*/*.*" );
}
}

View file

@ -83,7 +83,7 @@
<Group
name="ConvexEditor">
<Setting
name="materialName">Grid_512_Orange</Setting>
name="materialName">Prototyping:WallOrange</Setting>
</Group>
<Group
name="DatablockEditor">