Improve handling of non-default script filenames

This commit is contained in:
Lukas Aldershaab 2021-01-07 12:01:09 +01:00
parent 099dd4f1f3
commit 9ccaa6d3ea
118 changed files with 534 additions and 528 deletions

View file

@ -475,7 +475,7 @@ function MaterialEditorGui::isMatEditorMaterial(%this, %material)
{
return ( %material.getFilename() $= "" ||
%material.getFilename() $= "tools/gui/materialSelector.ed.gui" ||
%material.getFilename() $= "tools/materialEditor/scripts/materialEditor.ed.tscript" );
%material.getFilename() $= "tools/materialEditor/scripts/materialEditor.ed." @ $TorqueScriptFileExtension );
}
function MaterialEditorGui::setMaterialNotDirty(%this)
@ -521,13 +521,13 @@ function MaterialEditorGui::setMaterialDirty(%this)
%k = %pos + 1;
}
%savePath = getSubStr( %shapePath , 0 , %k );
%savePath = %savePath @ "materials.tscript";
%savePath = %savePath @ "materials." @ $TorqueScriptFileExtension;
matEd_PersistMan.setDirty(MaterialEditorGui.currentMaterial, %savePath);
}
else
{
matEd_PersistMan.setDirty(MaterialEditorGui.currentMaterial, "art/materials.tscript");
matEd_PersistMan.setDirty(MaterialEditorGui.currentMaterial, "art/materials." @ $TorqueScriptFileExtension);
}
}
else
@ -1840,7 +1840,7 @@ function MaterialEditorGui::createNewCubemap( %this, %cubemap )
parentGroup = RootGroup;
};
matEd_cubemapEdPerMan.setDirty( %cubemap, "art/materials.tscript" );
matEd_cubemapEdPerMan.setDirty( %cubemap, "art/materials." @ $TorqueScriptFileExtension );
matEd_cubemapEdPerMan.saveDirty();
return %cubemap;
@ -1857,7 +1857,7 @@ function MaterialEditorGui::setCubemapDirty(%this)
// materials created in the materail selector are given that as its filename, so we run another check
if( MaterialEditorGui.isMatEditorMaterial( %cubemap ) )
matEd_cubemapEdPerMan.setDirty(%cubemap, "art/materials.tscript");
matEd_cubemapEdPerMan.setDirty(%cubemap, "art/materials." @ $TorqueScriptFileExtension);
else
matEd_cubemapEdPerMan.setDirty(%cubemap);
}
@ -2384,7 +2384,7 @@ function MaterialEditorGui::switchMaterial( %this, %material )
and updates the engines libraries accordingly in order to make this change per
object/per objects instances/per target. Before this functionality is enacted,
there is a popup beforehand that will ask if you are sure if you want to make
this change. Making this change will physically alter possibly two materials.tscript
this change. Making this change will physically alter possibly two materials." @ $TorqueScriptFileExtension @ "
files in order to move the (%fromMaterial, %toMaterial), replacing the
(%fromMaterials)'s mapTo to "unmapped_mat".
-------------------------------------------------------------------------------*/
@ -2424,7 +2424,7 @@ function MaterialEditorGui::changeMaterial(%this, %fromMaterial, %toMaterial)
%k = %count + 1;
}
%fileName = getSubStr( %sourcePath , 0 , %k );
%fileName = %fileName @ "materials.tscript";
%fileName = %fileName @ "materials." @ $TorqueScriptFileExtension;
%action.toMaterialNewFname = %fileName;

View file

@ -326,7 +326,7 @@ function ActionChangeMaterial::redo(%this)
MaterialEditorGui.currentObject = %this.object;
if( %this.toMaterial.getFilename() !$= "tools/gui/materialSelector.ed.gui" ||
%this.toMaterial.getFilename() !$= "tools/materialEditor/scripts/materialEditor.ed.tscript")
%this.toMaterial.getFilename() !$= "tools/materialEditor/scripts/materialEditor.ed." @ $TorqueScriptFileExtension)
{
matEd_PersistMan.removeObjectFromFile(%this.toMaterial);
}
@ -357,7 +357,7 @@ function ActionChangeMaterial::undo(%this)
MaterialEditorGui.currentObject = %this.object;
if( %this.toMaterial.getFilename() !$= "tools/gui/materialSelector.ed.gui" ||
%this.toMaterial.getFilename() !$= "tools/materialEditor/scripts/materialEditor.ed.tscript")
%this.toMaterial.getFilename() !$= "tools/materialEditor/scripts/materialEditor.ed." @ $TorqueScriptFileExtension)
{
matEd_PersistMan.removeObjectFromFile(%this.toMaterial);
}
@ -442,7 +442,7 @@ function ActionDeleteMaterial::redo(%this)
}
if( %this.oldMaterial.getFilename() !$= "tools/gui/materialSelector.ed.gui" ||
%this.oldMaterial.getFilename() !$= "tools/materialEditor/scripts/materialEditor.ed.tscript")
%this.oldMaterial.getFilename() !$= "tools/materialEditor/scripts/materialEditor.ed." @ $TorqueScriptFileExtension)
{
matEd_PersistMan.removeObjectFromFile(%this.oldMaterial);
}