diff --git a/Engine/source/T3D/assets/CubemapAsset.cpp b/Engine/source/T3D/assets/CubemapAsset.cpp index 656c3d63d..db2c7c213 100644 --- a/Engine/source/T3D/assets/CubemapAsset.cpp +++ b/Engine/source/T3D/assets/CubemapAsset.cpp @@ -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"); diff --git a/Engine/source/T3D/assets/MaterialAsset.h b/Engine/source/T3D/assets/MaterialAsset.h index 206d18e97..3ba5cdce4 100644 --- a/Engine/source/T3D/assets/MaterialAsset.h +++ b/Engine/source/T3D/assets/MaterialAsset.h @@ -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) \ diff --git a/Engine/source/T3D/assets/ParticleAsset.cpp b/Engine/source/T3D/assets/ParticleAsset.cpp index aed6ee2df..566611355 100644 --- a/Engine/source/T3D/assets/ParticleAsset.cpp +++ b/Engine/source/T3D/assets/ParticleAsset.cpp @@ -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"); diff --git a/Engine/source/T3D/assets/stateMachineAsset.cpp b/Engine/source/T3D/assets/stateMachineAsset.cpp index dcd0ed3b5..c58b486cd 100644 --- a/Engine/source/T3D/assets/stateMachineAsset.cpp +++ b/Engine/source/T3D/assets/stateMachineAsset.cpp @@ -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"); diff --git a/Engine/source/T3D/convexShape.cpp b/Engine/source/T3D/convexShape.cpp index 7e92e0171..99f3f418a 100644 --- a/Engine/source/T3D/convexShape.cpp +++ b/Engine/source/T3D/convexShape.cpp @@ -2170,3 +2170,5 @@ void ConvexShape::Geometry::generate(const Vector< PlaneF > &planes, const Vecto faces.push_back( newFace ); } } + +DEF_MATERIALASSET_BINDS(ConvexShape, Material); diff --git a/Engine/source/gui/controls/guiTreeViewCtrl.cpp b/Engine/source/gui/controls/guiTreeViewCtrl.cpp index 31bb189c7..e2804b1f1 100644 --- a/Engine/source/gui/controls/guiTreeViewCtrl.cpp +++ b/Engine/source/gui/controls/guiTreeViewCtrl.cpp @@ -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); diff --git a/Engine/source/gui/editor/guiInspectorTypes.cpp b/Engine/source/gui/editor/guiInspectorTypes.cpp index 76b2b3d1a..4529d6392 100644 --- a/Engine/source/gui/editor/guiInspectorTypes.cpp +++ b/Engine/source/gui/editor/guiInspectorTypes.cpp @@ -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(); diff --git a/Engine/source/gui/editor/inspector/dynamicField.cpp b/Engine/source/gui/editor/inspector/dynamicField.cpp index 743d5c3b5..cebaa890a 100644 --- a/Engine/source/gui/editor/inspector/dynamicField.cpp +++ b/Engine/source/gui/editor/inspector/dynamicField.cpp @@ -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 ); diff --git a/Engine/source/gui/editor/inspector/dynamicGroup.cpp b/Engine/source/gui/editor/inspector/dynamicGroup.cpp index c56a985c8..7b003cefe 100644 --- a/Engine/source/gui/editor/inspector/dynamicGroup.cpp +++ b/Engine/source/gui/editor/inspector/dynamicGroup.cpp @@ -60,7 +60,7 @@ bool GuiInspectorDynamicGroup::createContent() addFieldBtn->setControlProfile( dynamic_cast(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()); diff --git a/Engine/source/gui/worldEditor/guiConvexShapeEditorCtrl.cpp b/Engine/source/gui/worldEditor/guiConvexShapeEditorCtrl.cpp index 4fcb9c6b8..0e494602a 100644 --- a/Engine/source/gui/worldEditor/guiConvexShapeEditorCtrl.cpp +++ b/Engine/source/gui/worldEditor/guiConvexShapeEditorCtrl.cpp @@ -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 ); diff --git a/Engine/source/postFx/postEffectVis.cpp b/Engine/source/postFx/postEffectVis.cpp index 3d87eaaf8..5d3d351c0 100644 --- a/Engine/source/postFx/postEffectVis.cpp +++ b/Engine/source/postFx/postEffectVis.cpp @@ -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 ); diff --git a/Templates/BaseGame/game/tools/convexEditor/convexEditorGui.tscript b/Templates/BaseGame/game/tools/convexEditor/convexEditorGui.tscript index 76e241c36..65266a382 100644 --- a/Templates/BaseGame/game/tools/convexEditor/convexEditorGui.tscript +++ b/Templates/BaseGame/game/tools/convexEditor/convexEditorGui.tscript @@ -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(); } \ No newline at end of file diff --git a/Templates/BaseGame/game/tools/guiEditor/scripts/guiEditor.ed.tscript b/Templates/BaseGame/game/tools/guiEditor/scripts/guiEditor.ed.tscript index 71988bf9a..3c5d36d89 100644 --- a/Templates/BaseGame/game/tools/guiEditor/scripts/guiEditor.ed.tscript +++ b/Templates/BaseGame/game/tools/guiEditor/scripts/guiEditor.ed.tscript @@ -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"; diff --git a/Templates/BaseGame/game/tools/materialEditor/scripts/materialEditor.ed.tscript b/Templates/BaseGame/game/tools/materialEditor/scripts/materialEditor.ed.tscript index 94c3a021c..af0e1879a 100644 --- a/Templates/BaseGame/game/tools/materialEditor/scripts/materialEditor.ed.tscript +++ b/Templates/BaseGame/game/tools/materialEditor/scripts/materialEditor.ed.tscript @@ -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); diff --git a/Templates/BaseGame/game/tools/particleEditor/ParticleEditor.ed.gui b/Templates/BaseGame/game/tools/particleEditor/ParticleEditor.ed.gui index 8ed697c1c..7864a7f00 100644 --- a/Templates/BaseGame/game/tools/particleEditor/ParticleEditor.ed.gui +++ b/Templates/BaseGame/game/tools/particleEditor/ParticleEditor.ed.gui @@ -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() { diff --git a/Templates/BaseGame/game/tools/projectImporter/scripts/pre40/T3Dpre4ProjectImporter.tscript b/Templates/BaseGame/game/tools/projectImporter/scripts/pre40/T3Dpre4ProjectImporter.tscript index bdc29ac8b..4e6d9cc80 100644 --- a/Templates/BaseGame/game/tools/projectImporter/scripts/pre40/T3Dpre4ProjectImporter.tscript +++ b/Templates/BaseGame/game/tools/projectImporter/scripts/pre40/T3Dpre4ProjectImporter.tscript @@ -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 //============================================================================== diff --git a/Templates/BaseGame/game/tools/projectImporter/scripts/projectImporter.tscript b/Templates/BaseGame/game/tools/projectImporter/scripts/projectImporter.tscript index 7d13f93fd..eff77c7d4 100644 --- a/Templates/BaseGame/game/tools/projectImporter/scripts/projectImporter.tscript +++ b/Templates/BaseGame/game/tools/projectImporter/scripts/projectImporter.tscript @@ -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( "*/*.*" ); + } } \ No newline at end of file diff --git a/Templates/BaseGame/game/tools/settings.xml b/Templates/BaseGame/game/tools/settings.xml index 610c77918..225b2d67e 100644 --- a/Templates/BaseGame/game/tools/settings.xml +++ b/Templates/BaseGame/game/tools/settings.xml @@ -83,7 +83,7 @@ Grid_512_Orange + name="materialName">Prototyping:WallOrange