mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-04-28 07:45:40 +00:00
Corrected the logic for the GenerateComposite import config rule so it only applies if there's any of the ORM maps detected
Added new import config rule: AlwaysPresentImageMaps so it will add entries for the regular map inputs on a material, even if they weren't actually found Disabled a number of inactive popup menu items Added Create New Module to normal add asset popup for more obvious/simplified use-flow Adjusted the editor loading logic so it will properly display the loading splash to inform loading is happening instead of just lagging Adjusted the assimp shape loader code so if it doesn't find a texture, and thus just sets a material value as the material color, it has a more parsable formatting
This commit is contained in:
parent
388b568739
commit
ec63be32e3
11 changed files with 322 additions and 269 deletions
|
|
@ -1064,7 +1064,7 @@ function ImportAssetWindow::refreshChildItem(%this, %id)
|
|||
{
|
||||
position = %filePathBtnPos SPC "0";
|
||||
extent = %height SPC %height;
|
||||
command = "ImportAssetOptionsWindow.findMissingFile(" @ %assetItem @ ");";
|
||||
command = "ImportAssetWindow.findMissingFile(" @ %assetItem @ ");";
|
||||
text = "...";
|
||||
internalName = "InputPathButton";
|
||||
tooltip = %toolTip;
|
||||
|
|
|
|||
|
|
@ -45,6 +45,8 @@ function setupImportConfigSettingsList()
|
|||
ImportAssetConfigSettingsList.addNewConfigSetting("Materials/UseDiffuseSuffixOnOriginImage", "Use Diffuse Suffix for Origin Image", "bool", "", "1", "");
|
||||
ImportAssetConfigSettingsList.addNewConfigSetting("Materials/UseExistingMaterials", "Use Existing Materials", "bool", "", "1", "");
|
||||
ImportAssetConfigSettingsList.addNewConfigSetting("Materials/IgnoreMaterials", "Ignore Materials", "command", "", "", "");
|
||||
ImportAssetConfigSettingsList.addNewConfigSetting("Materials/AlwaysPresentImageMaps", "Always Present Image Maps", "bool",
|
||||
"Wether to always display all normal material map fields, even if an image isn't detected.", "", "");
|
||||
|
||||
//Animations
|
||||
ImportAssetConfigSettingsList.addNewConfigSetting("Animations/ImportAnimations", "Import Animations", "bool", "", "1", "");
|
||||
|
|
@ -289,6 +291,7 @@ function ImportAssetConfigEditorWindow::addNewConfig(%this)
|
|||
AssetImportSettings.setValue("Materials/CreateComposites", "1");
|
||||
AssetImportSettings.setValue("Materials/UseDiffuseSuffixOnOriginImage", "1");
|
||||
AssetImportSettings.setValue("Materials/UseExistingMaterials", "1");
|
||||
AssetImportSettings.setValue("Materials/AlwaysPresentImageMaps", "0");
|
||||
|
||||
//Animations
|
||||
AssetImportSettings.setValue("Animations/ImportAnimations", "1");
|
||||
|
|
|
|||
|
|
@ -33,23 +33,14 @@ function AssetBrowser::createMaterialAsset(%this)
|
|||
|
||||
function AssetBrowser::editMaterialAsset(%this, %assetDef)
|
||||
{
|
||||
//if(EditorSettings.materialEditMode $= "MaterialEditor")
|
||||
//{
|
||||
%assetDef.materialDefinitionName.reload();
|
||||
|
||||
EditorGui.setEditor(MaterialEditorPlugin);
|
||||
|
||||
MaterialEditorGui.currentMaterial = %assetDef.materialDefinitionName;
|
||||
MaterialEditorGui.setActiveMaterial( %assetDef.materialDefinitionName );
|
||||
|
||||
AssetBrowser.hideDialog();
|
||||
/*}
|
||||
else
|
||||
{
|
||||
Canvas.pushDialog(ShaderEditor);
|
||||
ShaderEditorGraph.loadGraph(%assetDef.shaderGraph);
|
||||
$ShaderGen::targetShaderFile = filePath(%assetDef.shaderGraph) @"/"@fileBase(%assetDef.shaderGraph);
|
||||
//} */
|
||||
%assetDef.materialDefinitionName.reload();
|
||||
|
||||
EditorGui.setEditor(MaterialEditorPlugin);
|
||||
|
||||
MaterialEditorGui.currentMaterial = %assetDef.materialDefinitionName;
|
||||
MaterialEditorGui.setActiveMaterial( %assetDef.materialDefinitionName );
|
||||
|
||||
AssetBrowser.hideDialog();
|
||||
}
|
||||
|
||||
function AssetBrowser::prepareImportMaterialAsset(%this, %assetItem)
|
||||
|
|
@ -93,6 +84,13 @@ function AssetBrowser::prepareImportMaterialAsset(%this, %assetItem)
|
|||
%diffuseAsset = AssetBrowser.addImportingAsset("Image", %targetFilePath, %assetItem);
|
||||
%assetItem.diffuseImageAsset = %diffuseAsset;
|
||||
}
|
||||
else if(getAssetImportConfigValue("Materials/AlwaysPresentImageMaps", "0") == 1)
|
||||
{
|
||||
//In the event we don't have this image asset, but we DO wish to always display the field(affording when names don't aline with
|
||||
//the material name), then we go ahead and create a blank entry
|
||||
%suff = getTokenCount(%diffuseTypeSuffixes, ",;") == 0 ? "_albedo" : getToken(%diffuseTypeSuffixes, ",;", 0);
|
||||
%diffuseAsset = AssetBrowser.addImportingAsset("Image", %assetItem.AssetName @ %suff, %assetItem);
|
||||
}
|
||||
}
|
||||
|
||||
//Now, iterate over our comma-delimited suffixes to see if we have any matches. We'll use the first match in each case, if any.
|
||||
|
|
@ -108,28 +106,14 @@ function AssetBrowser::prepareImportMaterialAsset(%this, %assetItem)
|
|||
%normalAsset = AssetBrowser.addImportingAsset("Image", %targetFilePath, %assetItem);
|
||||
%assetItem.normalImageAsset = %normalAsset;
|
||||
}
|
||||
}
|
||||
/*if(%assetItem.specularImageAsset $= "")
|
||||
{
|
||||
//Specular
|
||||
%listCount = getTokenCount(ImportAssetWindow.activeImportConfig.SpecularTypeSuffixes, ",;");
|
||||
|
||||
%foundFile = 0;
|
||||
for(%i=0; %i < %listCount; %i++)
|
||||
else if(getAssetImportConfigValue("Materials/AlwaysPresentImageMaps", "0") == 1)
|
||||
{
|
||||
%entryText = getToken(ImportAssetWindow.activeImportConfig.SpecularTypeSuffixes, ",;", %i);
|
||||
|
||||
%targetFilePath = %fileDir @ "/" @ %filename @ %entryText @ %fileExt;
|
||||
%foundFile = isFile(%targetFilePath);
|
||||
|
||||
if(%foundFile)
|
||||
{
|
||||
%specularAsset = AssetBrowser.addImportingAsset("Image", %targetFilePath, %assetItem);
|
||||
%assetItem.specularImageAsset = %specularAsset;
|
||||
break;
|
||||
}
|
||||
//In the event we don't have this image asset, but we DO wish to always display the field(affording when names don't aline with
|
||||
//the material name), then we go ahead and create a blank entry
|
||||
%suff = getTokenCount(%normalTypeSuffixes, ",;") == 0 ? "_normal" : getToken(%normalTypeSuffixes, ",;", 0);
|
||||
%normalAsset = AssetBrowser.addImportingAsset("Image", %assetItem.AssetName @ %suff, %assetItem);
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
if(%assetItem.metalImageAsset $= "")
|
||||
{
|
||||
|
|
@ -142,6 +126,13 @@ function AssetBrowser::prepareImportMaterialAsset(%this, %assetItem)
|
|||
%metalAsset = AssetBrowser.addImportingAsset("Image", %targetFilePath, %assetItem);
|
||||
%assetItem.metalImageAsset = %metalAsset;
|
||||
}
|
||||
else if(getAssetImportConfigValue("Materials/AlwaysPresentImageMaps", "0") == 1)
|
||||
{
|
||||
//In the event we don't have this image asset, but we DO wish to always display the field(affording when names don't aline with
|
||||
//the material name), then we go ahead and create a blank entry
|
||||
%suff = getTokenCount(%metalnessTypeSuffixes, ",;") == 0 ? "_metalness" : getToken(%metalnessTypeSuffixes, ",;", 0);
|
||||
%metalAsset = AssetBrowser.addImportingAsset("Image", %assetItem.AssetName @ %suff, %assetItem);
|
||||
}
|
||||
}
|
||||
|
||||
if(%assetItem.roughnessImageAsset $= "")
|
||||
|
|
@ -155,6 +146,13 @@ function AssetBrowser::prepareImportMaterialAsset(%this, %assetItem)
|
|||
%roughnessAsset = AssetBrowser.addImportingAsset("Image", %targetFilePath, %assetItem);
|
||||
%assetItem.roughnessImageAsset = %roughnessAsset;
|
||||
}
|
||||
else if(getAssetImportConfigValue("Materials/AlwaysPresentImageMaps", "0") == 1)
|
||||
{
|
||||
//In the event we don't have this image asset, but we DO wish to always display the field(affording when names don't aline with
|
||||
//the material name), then we go ahead and create a blank entry
|
||||
%suff = getTokenCount(%roughnessTypeSuffixes, ",;") == 0 ? "_roughness" : getToken(%roughnessTypeSuffixes, ",;", 0);
|
||||
%roughnessAsset = AssetBrowser.addImportingAsset("Image", %assetItem.AssetName @ %suff, %assetItem);
|
||||
}
|
||||
}
|
||||
|
||||
if(%assetItem.smoothnessImageAsset $= "")
|
||||
|
|
@ -168,6 +166,13 @@ function AssetBrowser::prepareImportMaterialAsset(%this, %assetItem)
|
|||
%smoothnessAsset = AssetBrowser.addImportingAsset("Image", %targetFilePath, %assetItem);
|
||||
%assetItem.SmoothnessImageAsset = %smoothnessAsset;
|
||||
}
|
||||
else if(getAssetImportConfigValue("Materials/AlwaysPresentImageMaps", "0") == 1)
|
||||
{
|
||||
//In the event we don't have this image asset, but we DO wish to always display the field(affording when names don't aline with
|
||||
//the material name), then we go ahead and create a blank entry
|
||||
%suff = getTokenCount(%smoothnessTypeSuffixes, ",;") == 0 ? "_smoothness" : getToken(%smoothnessTypeSuffixes, ",;", 0);
|
||||
%smoothnessAsset = AssetBrowser.addImportingAsset("Image", %assetItem.AssetName @ %suff, %assetItem);
|
||||
}
|
||||
}
|
||||
|
||||
if(%assetItem.AOImageAsset $= "")
|
||||
|
|
@ -181,6 +186,13 @@ function AssetBrowser::prepareImportMaterialAsset(%this, %assetItem)
|
|||
%AOAsset = AssetBrowser.addImportingAsset("Image", %targetFilePath, %assetItem);
|
||||
%assetItem.AOImageAsset = %AOAsset;
|
||||
}
|
||||
else if(getAssetImportConfigValue("Materials/AlwaysPresentImageMaps", "0") == 1)
|
||||
{
|
||||
//In the event we don't have this image asset, but we DO wish to always display the field(affording when names don't aline with
|
||||
//the material name), then we go ahead and create a blank entry
|
||||
%suff = getTokenCount(%aoTypeSuffixes, ",;") == 0 ? "_AO" : getToken(%aoTypeSuffixes, ",;", 0);
|
||||
%AOAsset = AssetBrowser.addImportingAsset("Image", %assetItem.AssetName @ %suff, %assetItem);
|
||||
}
|
||||
}
|
||||
|
||||
if(%assetItem.compositeImageAsset $= "")
|
||||
|
|
@ -194,10 +206,20 @@ function AssetBrowser::prepareImportMaterialAsset(%this, %assetItem)
|
|||
%compositeAsset = AssetBrowser.addImportingAsset("Image", %targetFilePath, %assetItem);
|
||||
%assetItem.compositeImageAsset = %compositeAsset;
|
||||
}
|
||||
else if(getAssetImportConfigValue("Materials/AlwaysPresentImageMaps", "0") == 1)
|
||||
{
|
||||
//In the event we don't have this image asset, but we DO wish to always display the field(affording when names don't aline with
|
||||
//the material name), then we go ahead and create a blank entry
|
||||
%suff = getTokenCount(%compositeTypeSuffixes, ",;") == 0 ? "_composite" : getToken(%compositeTypeSuffixes, ",;", 0);
|
||||
%compositeAsset = AssetBrowser.addImportingAsset("Image", %assetItem.AssetName @ %suff, %assetItem);
|
||||
}
|
||||
}
|
||||
|
||||
//If after the above we didn't find any, check to see if we should be generating one
|
||||
if(%assetItem.compositeImageAsset $= "" && getAssetImportConfigValue("Materials/CreateComposites", "1") == 1)
|
||||
if(%assetItem.compositeImageAsset $= "" &&
|
||||
(%assetItem.roughnessImageAsset !$= "" || %assetItem.AOImageAsset !$= "" || %assetItem.metalnessImageAsset !$= "") &&
|
||||
getAssetImportConfigValue("Materials/CreateComposites", "1") == 1 &&
|
||||
getAssetImportConfigValue("Materials/AlwaysPresentImageMaps", "0") == 0)
|
||||
{
|
||||
%assetItem.roughnessImageAsset.skip = true;
|
||||
%assetItem.AOImageAsset.skip = true;
|
||||
|
|
|
|||
|
|
@ -114,12 +114,20 @@ function AssetBrowser::prepareImportShapeAsset(%this, %assetItem)
|
|||
}
|
||||
else
|
||||
{
|
||||
//we need to try and find our material, since the shapeInfo wasn't able to find it automatically
|
||||
%filePath = findImageFile(filePath(%assetItem.filePath), %matName);
|
||||
if(%filePath !$= "" && isFile(%filePath))
|
||||
AssetBrowser.addImportingAsset("Material", %filePath, %assetItem);
|
||||
//check to see if it's actually just a flat color
|
||||
if(getWordCount(%filePath) == 4 && getWord(%filePath, 0) $= "Color:")
|
||||
{
|
||||
AssetBrowser.addImportingAsset("Material", %matName, %assetItem);
|
||||
}
|
||||
else
|
||||
AssetBrowser.addImportingAsset("Material", filePath(%assetItem.filePath) @ "/" @ %matName, %assetItem);
|
||||
{
|
||||
//we need to try and find our material, since the shapeInfo wasn't able to find it automatically
|
||||
%filePath = findImageFile(filePath(%assetItem.filePath), %matName);
|
||||
if(%filePath !$= "" && isFile(%filePath))
|
||||
AssetBrowser.addImportingAsset("Material", %filePath, %assetItem);
|
||||
else
|
||||
AssetBrowser.addImportingAsset("Material", filePath(%assetItem.filePath) @ "/" @ %matName, %assetItem);
|
||||
}
|
||||
}
|
||||
|
||||
%materialItem = %assetItem.shapeInfo.getNextSibling(%materialItem);
|
||||
|
|
@ -133,12 +141,20 @@ function AssetBrowser::prepareImportShapeAsset(%this, %assetItem)
|
|||
}
|
||||
else
|
||||
{
|
||||
//we need to try and find our material, since the shapeInfo wasn't able to find it automatically
|
||||
%filePath = findImageFile(filePath(%assetItem.filePath), %matName);
|
||||
if(%filePath !$= "" && isFile(%filePath))
|
||||
AssetBrowser.addImportingAsset("Material", %filePath, %assetItem);
|
||||
//check to see if it's actually just a flat color
|
||||
if(getWordCount(%filePath) == 4 && getWord(%filePath, 0) $= "Color:")
|
||||
{
|
||||
AssetBrowser.addImportingAsset("Material", %matName, %assetItem);
|
||||
}
|
||||
else
|
||||
AssetBrowser.addImportingAsset("Material", filePath(%assetItem.filePath) @ "/" @ %matName, %assetItem);
|
||||
{
|
||||
//we need to try and find our material, since the shapeInfo wasn't able to find it automatically
|
||||
%filePath = findImageFile(filePath(%assetItem.filePath), %matName);
|
||||
if(%filePath !$= "" && isFile(%filePath))
|
||||
AssetBrowser.addImportingAsset("Material", %filePath, %assetItem);
|
||||
else
|
||||
AssetBrowser.addImportingAsset("Material", filePath(%assetItem.filePath) @ "/" @ %matName, %assetItem);
|
||||
}
|
||||
}
|
||||
|
||||
%materialItem = %assetItem.shapeInfo.getNextSibling(%materialItem);
|
||||
|
|
|
|||
|
|
@ -11,6 +11,8 @@ function AssetBrowser::buildPopupMenus(%this)
|
|||
item[ 0 ] = "Create New Module" TAB "" TAB "AssetBrowser.CreateNewModule();";
|
||||
item[ 1 ] = "Refresh Module Dependencies" TAB "" TAB "AssetBrowser.RefreshModuleDependencies();";
|
||||
};
|
||||
|
||||
AddNewModulePopup.enableItem(1, false);
|
||||
}
|
||||
|
||||
if( !isObject( EditAssetPopup ) )
|
||||
|
|
@ -153,6 +155,8 @@ function AssetBrowser::buildPopupMenus(%this)
|
|||
item[4] = "Create Level" TAB "" TAB "AssetBrowser.setupCreateNewAsset(\"LevelAsset\", AssetBrowser.selectedModule);";//"AssetBrowser.createNewLevelAsset(\"NewLevel\", AssetBrowser.selectedModule);";
|
||||
item[5] = "-";
|
||||
item[6] = "Create C++ Asset" TAB AddNewCppAssetPopup;
|
||||
item[7] = "-";
|
||||
item[8] = "Create New Module" TAB "" TAB "AssetBrowser.CreateNewModule();";
|
||||
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue