mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-14 16:14:38 +00:00
Fixed logic for parsing registerDatablock paths to trim script extensions during import conversion
Fixed creation of materialAsset from AB to properly generate companion script file Fixed logic in project import that if we import in a legacy module script, we get rid of the newly generated one in favor of the old one
This commit is contained in:
parent
bdf32f4f7b
commit
2f5f585aaf
5 changed files with 60 additions and 24 deletions
|
|
@ -8,18 +8,21 @@ function AssetBrowser::createMaterialAsset(%this)
|
|||
%assetPath = AssetBrowser.dirHandler.currentAddress @ "/";
|
||||
|
||||
%tamlpath = %assetPath @ %assetName @ ".asset.taml";
|
||||
%sgfPath = %assetPath @ %assetName @ ".sgf";
|
||||
%scriptPath = %assetPath @ %assetName @ "." @ $TorqueScriptFileExtension;
|
||||
|
||||
%asset = new MaterialAsset()
|
||||
{
|
||||
AssetName = %assetName;
|
||||
versionId = 1;
|
||||
shaderData = "";
|
||||
shaderGraph = %sgfPath;
|
||||
materialDefinitionName = %assetName;
|
||||
scriptFile = %assetName @ "." @ $TorqueScriptFileExtension;
|
||||
};
|
||||
|
||||
TamlWrite(%asset, %tamlpath);
|
||||
|
||||
%mat = new Material(%assetName);
|
||||
%mat.save(%scriptPath);
|
||||
|
||||
%moduleDef = ModuleDatabase.findModule(%moduleName, 1);
|
||||
AssetDatabase.addDeclaredAsset(%moduleDef, %tamlpath);
|
||||
|
||||
|
|
@ -43,18 +46,6 @@ function AssetBrowser::editMaterialAsset(%this, %assetDef)
|
|||
MaterialEditorGui.setActiveMaterial( %assetDef.materialDefinitionName );
|
||||
|
||||
AssetBrowser.hideDialog();
|
||||
|
||||
//
|
||||
//
|
||||
/*%assetDef.materialDefinitionName.reload();
|
||||
$Tools::materialEditorList = "";
|
||||
EWorldEditor.clearSelection();
|
||||
MaterialEditorGui.currentObject = 0;
|
||||
MaterialEditorGui.currentMode = "asset";
|
||||
MaterialEditorGui.currentMaterial = %assetDef.materialDefinitionName;
|
||||
MaterialEditorGui.setActiveMaterial( %assetDef.materialDefinitionName);
|
||||
EditorGui.setEditor(MaterialEditorPlugin);
|
||||
AssetBrowser.hideDialog();*/
|
||||
}
|
||||
|
||||
//Renames the asset
|
||||
|
|
|
|||
|
|
@ -340,7 +340,7 @@ function MaterialEditorGui::prepareActiveObject( %this, %override )
|
|||
{
|
||||
%fieldName = %obj.getField(%i);
|
||||
|
||||
if( %obj.getFieldType(%fieldName) !$= "TypeMaterialAssetId" && %obj.getFieldType(%fieldName) !$= "TypeMaterialName")
|
||||
if( %obj.getFieldType(%fieldName) !$= "TypeMaterialAssetId" /*&& %obj.getFieldType(%fieldName) !$= "TypeMaterialName"*/)
|
||||
continue;
|
||||
|
||||
if( !%canSupportMaterial )
|
||||
|
|
|
|||
|
|
@ -505,7 +505,7 @@ function T3Dpre4ProjectImporter::beginCodeFilesImport(%this)
|
|||
}
|
||||
}
|
||||
}
|
||||
else if(strIsMatchExpr("*datablock*(*)*", %line))
|
||||
else if(strIsMatchExpr("*datablock*(*)*", %line) && (strPos(%line, "registerDatablock") == -1))
|
||||
{
|
||||
%className = findObjectClass(%line, "datablock");
|
||||
|
||||
|
|
|
|||
|
|
@ -263,6 +263,23 @@ function ProjectImportWizardPage4::openPage(%this)
|
|||
$ProjectImporter::importTool.copyFiles();
|
||||
else
|
||||
ProjectImportWindow.nextStep();
|
||||
|
||||
//if we gen'd a new module setup, double check we didn't copy over a module script file under a legacy extension
|
||||
if(!$ProjectImporter::useExistingModule)
|
||||
{
|
||||
%newModuleName = $ProjectImporter::moduleName;
|
||||
%moduleFilePath = "data/" @ %newModuleName;
|
||||
|
||||
if($TorqueScriptFileExtension !$= "cs")
|
||||
{
|
||||
%moduleScriptFilePath = %moduleFilePath @ "/" @ %newModuleName @ ".cs";
|
||||
if(isFile(%moduleScriptFilePath))
|
||||
{
|
||||
//yep, that exists, so we'll assume it was the file we wanted, so remove the generated one
|
||||
fileDelete(%moduleFilePath @ "/" @ %newModuleName @ "." @ $TorqueScriptFileExtension);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function ProjectImportWizardPage4::processPage(%this)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue