Adds isSRGB and invertSmoothness checkboxes to terrain material editor

Added ability for assimp loader to ignore cached DTS shapes on demand when building shape data
Added assimp importer options to asset import config settings set
Moved variableInspector field types folder from tools/assetBrowser/scripts to tools/guis
This commit is contained in:
Areloch 2019-11-11 01:40:55 -06:00
parent d8cc73f5a1
commit 796a95b8a5
14 changed files with 125 additions and 22 deletions

View file

@ -28,19 +28,32 @@ function setupImportConfigSettingsList()
ImportAssetConfigSettingsList.addNewConfigSetting("Meshes/ImportMesh", "Import Mesh", "bool", "", "1", "", "ToggleImportMesh");
ImportAssetConfigSettingsList.addNewConfigSetting("Meshes/DoUpAxisOverride", "Do Up-axis Override", "bool", "", "0", "");
ImportAssetConfigSettingsList.addNewConfigSetting("Meshes/UpAxisOverride", "Up-axis Override", "list", "", "Z_AXIS", "X_AXIS,Y_AXIS,Z_AXIS");
ImportAssetConfigSettingsList.addNewConfigSetting("Meshes/ScaleOverride", "Do Scale Override", "bool", "", "0", "");
ImportAssetConfigSettingsList.addNewConfigSetting("Meshes/DoScaleOverride", "Do Scale Override", "bool", "", "0", "");
ImportAssetConfigSettingsList.addNewConfigSetting("Meshes/ScaleOverride", "Scale Override", "float", "", "1", "");
ImportAssetConfigSettingsList.addNewConfigSetting("Meshes/IgnoreNodeScale", "Ignore Node Scale", "bool", "", "0", "");
ImportAssetConfigSettingsList.addNewConfigSetting("Meshes/AdjustCenter", "Adjust Center", "bool", "", "0", "");
ImportAssetConfigSettingsList.addNewConfigSetting("Meshes/AdjustFloor", "Adjust Floor", "bool", "", "0", "");
ImportAssetConfigSettingsList.addNewConfigSetting("Meshes/CollapseSubmeshes", "Collapse Submeshes", "bool", "", "0", "");
ImportAssetConfigSettingsList.addNewConfigSetting("Meshes/LODType", "LOD Type", "list", "", "TrailingNumber", "TrailingNumber,DetectDTS");
ImportAssetConfigSettingsList.addNewConfigSetting("Meshes/LODType", "LOD Type", "list", "", "TrailingNumber", "TrailingNumber,DetectDTS,SingleSize");
//ImportAssetConfigSettingsList.addNewConfigSetting("TrailingNumber", "Trailing Number", "float", "", "2", "", "Mesh");
ImportAssetConfigSettingsList.addNewConfigSetting("Meshes/ImportedNodes", "Imported Nodes", "command", "", "", "");
ImportAssetConfigSettingsList.addNewConfigSetting("Meshes/IgnoreNodes", "Ignore Nodes", "command", "", "", "");
ImportAssetConfigSettingsList.addNewConfigSetting("Meshes/ImportMeshes", "Import Meshes", "command", "", "", "");
ImportAssetConfigSettingsList.addNewConfigSetting("Meshes/IgnoreMeshes", "Imported Meshes", "command", "", "", "");
//Assimp/Collada params
ImportAssetConfigSettingsList.addNewConfigSetting("Meshes/convertLeftHanded", "Convert To Left Hand", "bool", "", "0", "");
ImportAssetConfigSettingsList.addNewConfigSetting("Meshes/calcTangentSpace", "Calculate Tangent Space", "bool", "", "0", "");
ImportAssetConfigSettingsList.addNewConfigSetting("Meshes/removeRedundantMats", "Remove Redundant Materials", "bool", "", "0", "");
ImportAssetConfigSettingsList.addNewConfigSetting("Meshes/genUVCoords", "Generate UV Corrdinates", "bool", "", "0", "");
ImportAssetConfigSettingsList.addNewConfigSetting("Meshes/TransformUVs", "Transform UV Coordinates", "bool", "", "0", "");
ImportAssetConfigSettingsList.addNewConfigSetting("Meshes/flipUVCoords", "Flip UV Coordinates", "bool", "", "0", "");
ImportAssetConfigSettingsList.addNewConfigSetting("Meshes/findInstances", "Find Instances", "bool", "", "0", "");
ImportAssetConfigSettingsList.addNewConfigSetting("Meshes/limitBoneWeights", "Limit Bone Weights", "bool", "", "0", "");
ImportAssetConfigSettingsList.addNewConfigSetting("Meshes/JoinIdenticalVerts", "Join Identical Verts", "bool", "", "0", "");
ImportAssetConfigSettingsList.addNewConfigSetting("Meshes/reverseWindingOrder", "Flip Winding Order", "bool", "", "0", "");
ImportAssetConfigSettingsList.addNewConfigSetting("Meshes/invertNormals", "Invert Normals", "bool", "", "0", "");
//Materials
ImportAssetConfigSettingsList.addNewConfigSetting("Materials/ImportMaterials", "Import Materials", "bool", "", "1", "");
ImportAssetConfigSettingsList.addNewConfigSetting("Materials/CreateComposites", "Create Composites", "bool", "", "1", "");
@ -54,6 +67,8 @@ function setupImportConfigSettingsList()
ImportAssetConfigSettingsList.addNewConfigSetting("Animations/ImportAnimations", "Import Animations", "bool", "", "1", "");
ImportAssetConfigSettingsList.addNewConfigSetting("Animations/SeparateAnimations", "Separate Animations", "bool", "", "1", "");
ImportAssetConfigSettingsList.addNewConfigSetting("Animations/SeparateAnimationPrefix", "Separate Animation Prefix", "string", "", "", "");
ImportAssetConfigSettingsList.addNewConfigSetting("Animations/animTiming", "Animation Timing", "list", "", "Seconds", "Frames,Seconds,Milliseconds");
ImportAssetConfigSettingsList.addNewConfigSetting("Animations/animFPS", "Animation FPS", "float", "", "2", "");
//Collision
ImportAssetConfigSettingsList.addNewConfigSetting("Collision/GenerateCollisions", "Generate Collisions", "bool", "", "1", "");

View file

@ -60,7 +60,7 @@ function AssetBrowser::prepareImportShapeAsset(%this, %assetItem)
}
else
{
GetShapeInfo(%assetItem.filePath, %shapeInfo);
GetShapeInfo(%assetItem.filePath, %shapeInfo, false);
}
%assetItem.shapeInfo = %shapeInfo;
@ -241,7 +241,33 @@ function AssetBrowser::importShapeAsset(%this, %assetItem)
else
$TSShapeConstructor::neverImportMat = $TSShapeConstructor::neverImportMat TAB getToken(%ignoreMaterialList, ",;", %i);
}
}
}
if(getAssetImportConfigValue("Materials/DoUpAxisOverride", "") $= "1")
%constructor.upAxis = getAssetImportConfigValue("Meshes/UpAxisOverride", "Z_AXIS");
%constructor.lodType = getAssetImportConfigValue("Meshes/LODType", "0");
//%constructor.singleDetailSize = getAssetImportConfigValue("Meshes/convertLeftHanded", "0");
%constructor.alwaysImport = getAssetImportConfigValue("Meshes/ImportedNodes", "");
%constructor.neverImport = getAssetImportConfigValue("Meshes/IgnoreNodes", "");
%constructor.alwaysImportMesh = getAssetImportConfigValue("Meshes/ImportMeshes", "");
%constructor.neverImportMesh = getAssetImportConfigValue("Meshes/IgnoreMeshes", "");
%constructor.ignoreNodeScale = getAssetImportConfigValue("Meshes/IgnoreNodeScale", "0");
%constructor.adjustCenter = getAssetImportConfigValue("Meshes/AdjustCenter", "0");
%constructor.adjustFloor = getAssetImportConfigValue("Meshes/AdjustFloor", "0");
%constructor.convertLeftHanded = getAssetImportConfigValue("Meshes/convertLeftHanded", "0");
%constructor.calcTangentSpace = getAssetImportConfigValue("Meshes/calcTangentSpace", "0");
%constructor.genUVCoords = getAssetImportConfigValue("Meshes/genUVCoords", "0");
%constructor.flipUVCoords = getAssetImportConfigValue("Meshes/flipUVCoords", "0");
%constructor.findInstances = getAssetImportConfigValue("Meshes/findInstances", "0");
%constructor.limitBoneWeights = getAssetImportConfigValue("Meshes/limitBoneWeights", "0");
%constructor.joinIdenticalVerts = getAssetImportConfigValue("Meshes/joinIdenticalVerts", "0");
%constructor.reverseWindingOrder = getAssetImportConfigValue("Meshes/reverseWindingOrder", "0");
%constructor.invertNormals = getAssetImportConfigValue("Meshes/invertNormals", "0");
%constructor.removeRedundantMats = getAssetImportConfigValue("Meshes/removeRedundantMats", "0");
%constructor.animTiming = getAssetImportConfigValue("Animations/animTiming", "Seconds");
%constructor.animFPS = getAssetImportConfigValue("Animations/animFPS", "2");
%constructor.neverImportMat = $TSShapeConstructor::neverImportMat;
ShapeEditor.saveConstructor( %constructor );

View file

@ -1,92 +0,0 @@
function GuiInspectorVariableGroup::buildAssetDependenciesField(%this, %fieldName, %fieldLabel, %fieldDesc, %fieldDefaultVal, %fieldDataVals, %callbackName, %ownerObj)
{
%extent = 200;
%fieldCtrl = %this.createInspectorField();
%extent = %this.stack.getExtent();
%width = mRound(%extent/2);
%height = 20;
%inset = 10;
%editControl = new GuiPopUpMenuCtrl() {
class = "guiInspectorListField";
maxPopupHeight = "200";
sbUsesNAColor = "0";
reverseTextList = "0";
bitmapBounds = "16 16";
maxLength = "1024";
Margin = "0 0 0 0";
Padding = "0 0 0 0";
AnchorTop = "1";
AnchorBottom = "0";
AnchorLeft = "1";
AnchorRight = "0";
isContainer = "0";
Profile = "ToolsGuiPopUpMenuProfile";
HorizSizing = "right";
VertSizing = "bottom";
Position = %fieldCtrl.edit.position;
Extent = %fieldCtrl.edit.extent;
MinExtent = "8 2";
canSave = "1";
Visible = "1";
tooltipprofile = "ToolsGuiToolTipProfile";
tooltip = %tooltip;
text = %fieldDefaultVal;
hovertime = "1000";
ownerObject = %ownerObj;
fieldName = %fieldName;
callbackName = %callbackName;
};
//set the field value
if(getSubStr(%this.fieldName, 0, 1) $= "$")
{
if(%fieldName $= "")
%editControl.setText(%fieldName);
}
else if(isObject(%ownerObj))
{
//regular variable
%setCommand = %editControl @ ".setText(" @ %ownerObj @ "." @ %fieldName @ ");";
eval(%setCommand);
}
%listCount = getTokenCount(%fieldDataVals, ",");
for(%i=0; %i < %listCount; %i++)
{
%entryText = getToken(%fieldDataVals, ",", %i);
%editControl.add(%entryText);
}
%fieldCtrl.setCaption(%fieldLabel);
%fieldCtrl.setEditControl(%editControl);
//echo("GuiInspectorListField - " @ %editControl.getID() @ " - " @ %fieldName);
%this.addInspectorField(%fieldCtrl);
}
function guiInspectorListField::onSelect( %this, %id, %text )
{
if(getSubStr(%this.fieldName, 0, 1) $= "$")
{
//ah, a global var, just do it straight, then
%setCommand = %this.fieldName @ " = \"" @ %text @ "\";";
}
else if(isObject(%this.ownerObj))
{
//regular variable
%setCommand = %this.ownerObject @ "." @ %this.fieldName @ " = \"" @ %text @ "\";";
}
else if(%this.callbackName !$= "")
{
%setCommand = %this.callbackName @ "(\"" @ %this.fieldName @ "\",\"" @ %text @"\");";
}
eval(%setCommand);
}

View file

@ -1,12 +0,0 @@
function GuiVariableInspector::onInspectorFieldModified(%this, %targetObj, %fieldName, %index, %oldValue, %newValue)
{
echo("FIELD CHANGED: " @ %fieldName @ " from " @ %oldValue @ " to " @ %newValue);
}
function GuiInspectorVariableGroup::onConstructField(%this, %fieldName, %fieldLabel, %fieldTypeName, %fieldDesc, %fieldDefaultVal, %fieldDataVals, %callbackName, %ownerObj)
{
%inspector = %this.getParent();
%makeCommand = %this @ ".build" @ %fieldTypeName @ "Field(\""@ %fieldName @ "\",\"" @ %fieldLabel @ "\",\"" @ %fieldDesc @ "\",\"" @
%fieldDefaultVal @ "\",\"" @ %fieldDataVals @ "\",\"" @ %inspector @ "." @ %callbackName @ "\",\"" @ %ownerObj @"\");";
eval(%makeCommand);
}

View file

@ -1,124 +0,0 @@
function GuiInspectorVariableGroup::buildListField(%this, %fieldName, %fieldLabel, %fieldDesc, %fieldDefaultVal, %fieldDataVals, %callbackName, %ownerObj)
{
%extent = 200;
%fieldCtrl = %this.createInspectorField();
%extent = %this.stack.getExtent();
%width = mRound(%extent/2);
%height = 20;
%inset = 10;
/*%container = new GuiControl() {
canSaveDynamicFields = "0";
Profile = "EditorContainerProfile";
HorizSizing = "right";
VertSizing = "bottom";
Position = "0 0";
Extent = %extent.x SPC %height;
MinExtent = "8 2";
canSave = "0";
Visible = "1";
hovertime = "100";
tooltip = %tooltip;
tooltipProfile = "EditorToolTipProfile";
};
%labelControl = new GuiTextCtrl() {
canSaveDynamicFields = "0";
Profile = "EditorFontHLBold";
HorizSizing = "right";
VertSizing = "bottom";
Position = %inset SPC "0";
Extent = %width + %inset SPC %height;
MinExtent = "8 2";
canSave = "0";
Visible = "1";
hovertime = "100";
tooltip = %tooltip;
tooltipProfile = "EditorToolTipProfile";
text = %fieldLabel;
maxLength = "1024";
};*/
%editControl = new GuiPopUpMenuCtrl() {
class = "guiInspectorListField";
maxPopupHeight = "200";
sbUsesNAColor = "0";
reverseTextList = "0";
bitmapBounds = "16 16";
maxLength = "1024";
Margin = "0 0 0 0";
Padding = "0 0 0 0";
AnchorTop = "1";
AnchorBottom = "0";
AnchorLeft = "1";
AnchorRight = "0";
isContainer = "0";
Profile = "ToolsGuiPopUpMenuProfile";
HorizSizing = "right";
VertSizing = "bottom";
Position = %fieldCtrl.edit.position;
Extent = %fieldCtrl.edit.extent;
MinExtent = "8 2";
canSave = "1";
Visible = "1";
tooltipprofile = "ToolsGuiToolTipProfile";
tooltip = %tooltip;
text = %fieldDefaultVal;
hovertime = "1000";
ownerObject = %ownerObj;
fieldName = %fieldName;
callbackName = %callbackName;
};
//set the field value
if(getSubStr(%this.fieldName, 0, 1) $= "$")
{
if(%fieldName $= "")
%editControl.setText(%fieldName);
}
else if(isObject(%ownerObj))
{
//regular variable
%setCommand = %editControl @ ".setText(" @ %ownerObj @ "." @ %fieldName @ ");";
eval(%setCommand);
}
%listCount = getTokenCount(%fieldDataVals, ",");
for(%i=0; %i < %listCount; %i++)
{
%entryText = getToken(%fieldDataVals, ",", %i);
%editControl.add(%entryText);
}
%fieldCtrl.setCaption(%fieldLabel);
%fieldCtrl.setEditControl(%editControl);
//echo("GuiInspectorListField - " @ %editControl.getID() @ " - " @ %fieldName);
%this.addInspectorField(%fieldCtrl);
}
function guiInspectorListField::onSelect( %this, %id, %text )
{
if(getSubStr(%this.fieldName, 0, 1) $= "$")
{
//ah, a global var, just do it straight, then
%setCommand = %this.fieldName @ " = \"" @ %text @ "\";";
}
else if(isObject(%this.ownerObj))
{
//regular variable
%setCommand = %this.ownerObject @ "." @ %this.fieldName @ " = \"" @ %text @ "\";";
}
else if(%this.callbackName !$= "")
{
%setCommand = %this.callbackName @ "(\"" @ %this.fieldName @ "\",\"" @ %text @"\");";
}
eval(%setCommand);
}

View file

@ -1,39 +0,0 @@
function GuiInspectorVariableGroup::buildModuleDependenciesButtonField(%this, %fieldName, %fieldLabel, %fieldDesc, %fieldDefaultVal, %fieldDataVals, %callbackName, %ownerObj)
{
%extent = %this.stack.getExtent();
%width = mRound(%extent/2);
%height = 20;
%button = new GuiButtonCtrl()
{
extent = %extent.x SPC %height;
text = "Edit Module Dependencies";
class = "ModuleDependenciesButton";
profile = "ToolsGuiButtonProfile";
};
%this.stack.add(%button);
}
function ModuleDependenciesButton::onClick( %this )
{
/*if(getSubStr(%this.fieldName, 0, 1) $= "$")
{
//ah, a global var, just do it straight, then
%setCommand = %this.fieldName @ " = \"" @ %text @ "\";";
}
else if(isObject(%this.ownerObj))
{
//regular variable
%setCommand = %this.ownerObject @ "." @ %this.fieldName @ " = \"" @ %text @ "\";";
}
else if(%this.callbackName !$= "")
{
%setCommand = %this.callbackName @ "(\"" @ %this.fieldName @ "\",\"" @ %text @"\");";
}
eval(%setCommand);*/
echo("AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA");
}