diff --git a/Engine/source/terrain/terrMaterial.cpp b/Engine/source/terrain/terrMaterial.cpp index 02b776f58..57ba0d6be 100644 --- a/Engine/source/terrain/terrMaterial.cpp +++ b/Engine/source/terrain/terrMaterial.cpp @@ -65,7 +65,9 @@ TerrainMaterial::TerrainMaterial() mMacroSize( 200.0f ), mMacroStrength( 0.7f ), mMacroDistance( 500.0f ), - mParallaxScale( 0.0f ) + mParallaxScale( 0.0f ), + mIsSRGB(false), + mInvertSmoothness(false) { } @@ -97,7 +99,10 @@ void TerrainMaterial::initPersistFields() addField( "parallaxScale", TypeF32, Offset( mParallaxScale, TerrainMaterial ), "Used to scale the height from the normal map to give some self " "occlusion effect (aka parallax) to the terrain material" ); - addField("pbrConfigMap", TypeStringFilename, Offset(mCompositeMap, TerrainMaterial), "Composite map for the material"); + addField("pbrConfigMap", TypeStringFilename, Offset(mCompositeMap, TerrainMaterial), "Composite map for the PBR Configuration of the material"); + addField("isSRGB", TypeBool, Offset(mIsSRGB, TerrainMaterial), "Is the PBR Config map's image in sRGB format?"); + addField("invertSmoothness", TypeBool, Offset(mInvertSmoothness, TerrainMaterial), "Should the smoothness channel of the PBR Config map be inverted?"); + Parent::initPersistFields(); // Gotta call this at least once or it won't get created! diff --git a/Engine/source/terrain/terrMaterial.h b/Engine/source/terrain/terrMaterial.h index 923eca950..b96c37cea 100644 --- a/Engine/source/terrain/terrMaterial.h +++ b/Engine/source/terrain/terrMaterial.h @@ -77,6 +77,9 @@ protected: /// F32 mParallaxScale; + bool mIsSRGB; + bool mInvertSmoothness; + public: TerrainMaterial(); diff --git a/Engine/source/ts/assimp/assimpShapeLoader.cpp b/Engine/source/ts/assimp/assimpShapeLoader.cpp index 78938910b..9dc561aba 100644 --- a/Engine/source/ts/assimp/assimpShapeLoader.cpp +++ b/Engine/source/ts/assimp/assimpShapeLoader.cpp @@ -799,7 +799,7 @@ TSShape* assimpLoadShape(const Torque::Path &path) return tss; } -DefineEngineFunction(GetShapeInfo, bool, (const char* shapePath, const char* ctrl), , +DefineEngineFunction(GetShapeInfo, bool, (const char* shapePath, const char* ctrl, bool loadCachedDts), ("", "", true), "(string shapePath, GuiTreeViewCtrl ctrl) Collect scene information from " "a shape file and store it in a GuiTreeView control. This function is " "used by the assimp import gui to show a preview of the scene contents " @@ -820,7 +820,7 @@ DefineEngineFunction(GetShapeInfo, bool, (const char* shapePath, const char* ctr // Check if a cached DTS is available => no need to import the source file // if we can load the DTS instead Torque::Path path(shapePath); - if (AssimpShapeLoader::canLoadCachedDTS(path)) + if (loadCachedDts && AssimpShapeLoader::canLoadCachedDTS(path)) return false; AssimpShapeLoader loader; diff --git a/Templates/BaseGame/game/tools/Tools.cs b/Templates/BaseGame/game/tools/Tools.cs index 15a3fd5c7..fcbcf66ed 100644 --- a/Templates/BaseGame/game/tools/Tools.cs +++ b/Templates/BaseGame/game/tools/Tools.cs @@ -17,7 +17,7 @@ function ToolsModule::onCreate(%this) // ---------------------------------------------------------------------------- ModuleDatabase.LoadExplicit( "MainEditor" ); - ModuleDatabase.LoadExplicit( "Tools_ObjectViewer" ); + //ModuleDatabase.LoadExplicit( "Tools_ObjectViewer" ); } function ToolsModule::onDestroy(%this) diff --git a/Templates/BaseGame/game/tools/assetBrowser/main.cs b/Templates/BaseGame/game/tools/assetBrowser/main.cs index b9ddf94ba..03e61a316 100644 --- a/Templates/BaseGame/game/tools/assetBrowser/main.cs +++ b/Templates/BaseGame/game/tools/assetBrowser/main.cs @@ -96,11 +96,6 @@ function initializeAssetBrowser() exec("./scripts/assetTypes/folder.cs"); exec("./scripts/assetTypes/terrain.cs"); exec("./scripts/assetTypes/terrainMaterial.cs"); - - exec("./scripts/fieldTypes/fieldTypes.cs"); - exec("./scripts/fieldTypes/listField.cs"); - exec("./scripts/fieldTypes/moduleDependencies.cs"); - exec("./scripts/fieldTypes/assetDependencies.cs"); new ScriptObject( AssetBrowserPlugin ) { diff --git a/Templates/BaseGame/game/tools/assetBrowser/scripts/assetImportConfig.cs b/Templates/BaseGame/game/tools/assetBrowser/scripts/assetImportConfig.cs index 842f442f9..699810464 100644 --- a/Templates/BaseGame/game/tools/assetBrowser/scripts/assetImportConfig.cs +++ b/Templates/BaseGame/game/tools/assetBrowser/scripts/assetImportConfig.cs @@ -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", ""); diff --git a/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/shape.cs b/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/shape.cs index 35a2f4343..81e56e18a 100644 --- a/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/shape.cs +++ b/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/shape.cs @@ -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 ); diff --git a/Templates/BaseGame/game/tools/assetBrowser/scripts/fieldTypes/assetDependencies.cs b/Templates/BaseGame/game/tools/gui/fieldTypes/assetDependencies.cs similarity index 100% rename from Templates/BaseGame/game/tools/assetBrowser/scripts/fieldTypes/assetDependencies.cs rename to Templates/BaseGame/game/tools/gui/fieldTypes/assetDependencies.cs diff --git a/Templates/BaseGame/game/tools/assetBrowser/scripts/fieldTypes/fieldTypes.cs b/Templates/BaseGame/game/tools/gui/fieldTypes/fieldTypes.cs similarity index 100% rename from Templates/BaseGame/game/tools/assetBrowser/scripts/fieldTypes/fieldTypes.cs rename to Templates/BaseGame/game/tools/gui/fieldTypes/fieldTypes.cs diff --git a/Templates/BaseGame/game/tools/assetBrowser/scripts/fieldTypes/listField.cs b/Templates/BaseGame/game/tools/gui/fieldTypes/listField.cs similarity index 100% rename from Templates/BaseGame/game/tools/assetBrowser/scripts/fieldTypes/listField.cs rename to Templates/BaseGame/game/tools/gui/fieldTypes/listField.cs diff --git a/Templates/BaseGame/game/tools/assetBrowser/scripts/fieldTypes/moduleDependencies.cs b/Templates/BaseGame/game/tools/gui/fieldTypes/moduleDependencies.cs similarity index 100% rename from Templates/BaseGame/game/tools/assetBrowser/scripts/fieldTypes/moduleDependencies.cs rename to Templates/BaseGame/game/tools/gui/fieldTypes/moduleDependencies.cs diff --git a/Templates/BaseGame/game/tools/gui/guiDialogs.ed.cs b/Templates/BaseGame/game/tools/gui/guiDialogs.ed.cs index acd1afd91..c1e9fa5ac 100644 --- a/Templates/BaseGame/game/tools/gui/guiDialogs.ed.cs +++ b/Templates/BaseGame/game/tools/gui/guiDialogs.ed.cs @@ -35,4 +35,9 @@ exec("./guiObjectInspector.ed.cs"); exec("./uvEditor.ed.gui"); exec("./objectSelection.ed.cs"); exec("./postFxManager.gui"); -exec("./assimpImport.ed.gui"); \ No newline at end of file +exec("./assimpImport.ed.gui"); + +exec("./fieldTypes/assetDependencies.cs"); +exec("./fieldTypes/fieldTypes.cs"); +exec("./fieldTypes/listField.cs"); +exec("./fieldTypes/moduleDependencies.cs"); diff --git a/Templates/BaseGame/game/tools/worldEditor/gui/guiTerrainMaterialDlg.ed.gui b/Templates/BaseGame/game/tools/worldEditor/gui/guiTerrainMaterialDlg.ed.gui index 5c39cbbf5..abad64d46 100644 --- a/Templates/BaseGame/game/tools/worldEditor/gui/guiTerrainMaterialDlg.ed.gui +++ b/Templates/BaseGame/game/tools/worldEditor/gui/guiTerrainMaterialDlg.ed.gui @@ -165,7 +165,7 @@ new GuiBitmapCtrl() { bitmap = "core/art/gui/images/separator-v"; - color = "255 255 255 255"; + color = "White"; wrap = "0"; position = "1 0"; extent = "183 2"; @@ -739,7 +739,7 @@ anchorLeft = "1"; anchorRight = "0"; position = "6 184"; - extent = "185 50"; + extent = "185 64"; minExtent = "8 2"; horizSizing = "width"; vertSizing = "bottom"; @@ -888,12 +888,52 @@ canSave = "1"; canSaveDynamicFields = "0"; }; + new GuiCheckBoxCtrl() { + text = " Is sRGB"; + groupNum = "-1"; + buttonType = "ToggleButton"; + useMouseEvents = "0"; + position = "55 32"; + extent = "119 16"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "ToolsGuiCheckBoxProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "ToolsGuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + internalName = "isSRGb"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiCheckBoxCtrl() { + text = " Invert Smoothness"; + groupNum = "-1"; + buttonType = "ToggleButton"; + useMouseEvents = "0"; + position = "55 48"; + extent = "119 16"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "ToolsGuiCheckBoxProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "ToolsGuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + internalName = "invertSmoothness"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; }; new GuiBitmapCtrl() { bitmap = "tools/gui/images/separator-v"; color = "255 255 255 255"; wrap = "0"; - position = "6 238"; + position = "6 254"; extent = "175 2"; minExtent = "8 2"; horizSizing = "width"; @@ -914,7 +954,7 @@ anchorBottom = "0"; anchorLeft = "1"; anchorRight = "0"; - position = "6 245"; + position = "6 261"; extent = "185 72"; minExtent = "8 2"; horizSizing = "width"; @@ -1222,7 +1262,7 @@ bitmap = "tools/gui/images/separator-v"; color = "255 255 255 255"; wrap = "0"; - position = "6 320"; + position = "6 336"; extent = "175 2"; minExtent = "8 2"; horizSizing = "width"; @@ -1243,7 +1283,7 @@ anchorBottom = "0"; anchorLeft = "1"; anchorRight = "0"; - position = "6 327"; + position = "6 343"; extent = "185 72"; minExtent = "8 2"; horizSizing = "width"; diff --git a/Templates/BaseGame/game/tools/worldEditor/scripts/interfaces/terrainMaterialDlg.ed.cs b/Templates/BaseGame/game/tools/worldEditor/scripts/interfaces/terrainMaterialDlg.ed.cs index 5cd3e38d3..2c57ce159 100644 --- a/Templates/BaseGame/game/tools/worldEditor/scripts/interfaces/terrainMaterialDlg.ed.cs +++ b/Templates/BaseGame/game/tools/worldEditor/scripts/interfaces/terrainMaterialDlg.ed.cs @@ -449,6 +449,9 @@ function TerrainMaterialDlg::setActiveMaterial( %this, %mat ) %this-->macroSizeCtrl.setText( %mat.macroSize ); %this-->macroStrengthCtrl.setText( %mat.macroStrength ); %this-->macroDistanceCtrl.setText( %mat.macroDistance ); + + %this-->isSRGB.setValue( %mat.isSRGB ); + %this-->invertSmoothness.setValue( %mat.invertSmoothness ); %this.activateMaterialCtrls( true ); } @@ -508,6 +511,9 @@ function TerrainMaterialDlg::saveDirtyMaterial( %this, %mat ) %macroStrength = %this-->macroStrengthCtrl.getText(); %macroDistance = %this-->macroDistanceCtrl.getText(); + %isSRGB = %this-->isSRGB.getValue(); + %invertSmoothness = %this-->invertSmoothness.getValue(); + // If no properties of this materials have changed, // return. @@ -525,7 +531,9 @@ function TerrainMaterialDlg::saveDirtyMaterial( %this, %mat ) %mat.macroSize == %macroSize && %mat.macroStrength == %macroStrength && %mat.macroDistance == %macroDistance && - %mat.parallaxScale == %parallaxScale ) + %mat.parallaxScale == %parallaxScale && + %mat.isSRGB == %isSRGB && + %mat.invertSmoothness == %invertSmoothness) return; // Make sure the material name is unique. @@ -560,6 +568,8 @@ function TerrainMaterialDlg::saveDirtyMaterial( %this, %mat ) %mat.macroDistance = %macroDistance; %mat.useSideProjection = %useSideProjection; %mat.parallaxScale = %parallaxScale; + %mat.isSRGB = %isSRGB; + %mat.invertSmoothness = %invertSmoothness; // Mark the material as dirty and needing saving. @@ -606,6 +616,8 @@ function TerrainMaterialDlg::snapshotMaterials( %this ) macroDistance = %mat.macroDistance; useSideProjection = %mat.useSideProjection; parallaxScale = %mat.parallaxScale; + isSRGB = %mat.isSRGB; + invertSmoothness = %mat.invertSmoothness; }; } } @@ -641,6 +653,8 @@ function TerrainMaterialDlg::restoreMaterials( %this ) %mat.macroDistance = %obj.macroDistance; %mat.useSideProjection = %obj.useSideProjection; %mat.parallaxScale = %obj.parallaxScale; + %mat.isSRGB = %obj.isSRGB; + %mat.invertSmoothness = %obj.invertSmoothness; } }