diff --git a/Engine/source/T3D/assets/GUIAsset.cpp b/Engine/source/T3D/assets/GUIAsset.cpp index a8f4fe0f3..7c1aa1d0a 100644 --- a/Engine/source/T3D/assets/GUIAsset.cpp +++ b/Engine/source/T3D/assets/GUIAsset.cpp @@ -226,6 +226,13 @@ DefineEngineMethod(GUIAsset, getScriptPath, const char*, (), , { return object->getScriptPath(); } + +DefineEngineMethod(GUIAsset, getGUIPath, const char*, (), , + "Gets the GUI file path associated to this asset.\n" + "@return The full script file path.") +{ + return object->getGUIPath(); +} #endif //----------------------------------------------------------------------------- diff --git a/Engine/source/T3D/assets/MaterialAsset.cpp b/Engine/source/T3D/assets/MaterialAsset.cpp index 6eb4ea200..77b22cc24 100644 --- a/Engine/source/T3D/assets/MaterialAsset.cpp +++ b/Engine/source/T3D/assets/MaterialAsset.cpp @@ -449,8 +449,7 @@ DefineEngineStaticMethod(MaterialAsset, findMaterialDefinitionByAssetId, S32, (c DefineEngineMethod(MaterialAsset, getScriptPath, const char*, (), , - "Queries the Asset Database to see if any asset exists that is associated with the provided material name.\n" - "@return The AssetId of the associated asset, if any.") + "Gets the script file path for the asset.") { return object->getScriptPath(); } diff --git a/Engine/source/T3D/assets/PostEffectAsset.cpp b/Engine/source/T3D/assets/PostEffectAsset.cpp index e20aedef7..2b8a7091c 100644 --- a/Engine/source/T3D/assets/PostEffectAsset.cpp +++ b/Engine/source/T3D/assets/PostEffectAsset.cpp @@ -206,3 +206,21 @@ void PostEffectAsset::setGLSLShaderFile(const char* pShaderFile) // Refresh the asset. refreshAsset(); } + +DefineEngineMethod(PostEffectAsset, getScriptPath, const char*, (), , + "Gets the script file path for the asset.") +{ + return object->getScriptPath(); +} + +DefineEngineMethod(PostEffectAsset, getHLSLShaderPath, const char*, (), , + "Gets the HLSL Shader file path for the asset.") +{ + return object->getHLSLShaderPath(); +} + +DefineEngineMethod(PostEffectAsset, getGLSLShaderPath, const char*, (), , + "Gets the GLSL Shader file path for the asset.") +{ + return object->getGLSLShaderPath(); +} diff --git a/Engine/source/T3D/assets/ShapeAnimationAsset.cpp b/Engine/source/T3D/assets/ShapeAnimationAsset.cpp index f7e1b6aa5..649fc7bca 100644 --- a/Engine/source/T3D/assets/ShapeAnimationAsset.cpp +++ b/Engine/source/T3D/assets/ShapeAnimationAsset.cpp @@ -204,3 +204,9 @@ DefineEngineMethod(ShapeAnimationAsset, getAnimationCount, S32, (), , { return object->getAnimationCount(); } + +DefineEngineMethod(ShapeAnimationAsset, getAnimationPath, const char*, (), , + "Gets the Animation file path associated to this asset.") +{ + return object->getAnimationPath(); +} diff --git a/Engine/source/T3D/assets/ShapeAsset.cpp b/Engine/source/T3D/assets/ShapeAsset.cpp index fb3be2341..231d42cb9 100644 --- a/Engine/source/T3D/assets/ShapeAsset.cpp +++ b/Engine/source/T3D/assets/ShapeAsset.cpp @@ -576,9 +576,12 @@ const char* ShapeAsset::generateCachedPreviewImage(S32 resolution, String overri // We need to create our own instance to render with. TSShapeInstance* shape = new TSShapeInstance(mShape, true); - if(overrideMaterial.isNotEmpty()) - shape->reSkin(overrideMaterial, mShape->materialList->getMaterialName(0)); - + if (overrideMaterial.isNotEmpty()) + { + Material *tMat = dynamic_cast(Sim::findObject(overrideMaterial)); + if (tMat) + shape->reSkin(tMat->mMapTo, mShape->materialList->getMaterialName(0)); + } // Animate the shape once. shape->animate(0); @@ -676,7 +679,7 @@ DefineEngineMethod(ShapeAsset, getAnimation, ShapeAnimationAsset*, (S32 index), return object->getAnimation(index); } -DefineEngineMethod(ShapeAsset, getShapeFile, const char*, (), , +DefineEngineMethod(ShapeAsset, getShapePath, const char*, (), , "Gets the shape's file path\n" "@return The filename of the shape file") { diff --git a/Engine/source/gfx/gfxTextureManager.cpp b/Engine/source/gfx/gfxTextureManager.cpp index 8341b1b6c..733f3ba7f 100644 --- a/Engine/source/gfx/gfxTextureManager.cpp +++ b/Engine/source/gfx/gfxTextureManager.cpp @@ -46,8 +46,6 @@ S32 GFXTextureManager::smTextureReductionLevel = 0; String GFXTextureManager::smMissingTexturePath(Con::getVariable("$Core::MissingTexturePath")); String GFXTextureManager::smUnavailableTexturePath(Con::getVariable("$Core::UnAvailableTexturePath")); String GFXTextureManager::smWarningTexturePath(Con::getVariable("$Core::WarningTexturePath")); -String GFXTextureManager::smDefaultIrradianceCubemapPath(Con::getVariable("$Core::DefaultIrradianceCubemap")); -String GFXTextureManager::smDefaultPrefilterCubemapPath(Con::getVariable("$Core::DefaultPrefilterCubemap")); String GFXTextureManager::smBRDFTexturePath(Con::getVariable("$Core::BRDFTexture")); GFXTextureManager::EventSignal GFXTextureManager::smEventSignal; @@ -75,14 +73,6 @@ void GFXTextureManager::init() "The file path of the texture used to warn the developer.\n" "@ingroup GFX\n" ); - Con::addVariable("$Core::DefaultIrradianceCubemap", TypeRealString, &smDefaultIrradianceCubemapPath, - "The file path of the texture used as the default irradiance cubemap for PBR.\n" - "@ingroup GFX\n"); - - Con::addVariable("$Core::DefaultPrefilterCubemap", TypeRealString, &smDefaultPrefilterCubemapPath, - "The file path of the texture used as the default specular cubemap for PBR.\n" - "@ingroup GFX\n"); - Con::addVariable("$Core::BRDFTexture", TypeRealString, &smBRDFTexturePath, "The file path of the texture used as the default irradiance cubemap for PBR.\n" "@ingroup GFX\n"); diff --git a/Engine/source/gfx/gfxTextureManager.h b/Engine/source/gfx/gfxTextureManager.h index 5e4d7a070..90a8a4bc6 100644 --- a/Engine/source/gfx/gfxTextureManager.h +++ b/Engine/source/gfx/gfxTextureManager.h @@ -75,9 +75,6 @@ public: /// Provide the path to the texture used to warn the developer static const String& getWarningTexturePath() { return smWarningTexturePath; } - static const String& getDefaultIrradianceCubemapPath() { return smDefaultIrradianceCubemapPath; } - static const String& getDefaultPrefilterCubemapPath() { return smDefaultPrefilterCubemapPath; } - static const String& getBRDFTexturePath() { return smBRDFTexturePath; } /// Update width and height based on available resources. @@ -217,8 +214,6 @@ protected: /// File path to the warning texture static String smWarningTexturePath; - static String smDefaultIrradianceCubemapPath; - static String smDefaultPrefilterCubemapPath; static String smBRDFTexturePath; GFXTextureObject *mListHead; diff --git a/Engine/source/gui/core/guiTypes.cpp b/Engine/source/gui/core/guiTypes.cpp index 85032a2ed..dd5874ee9 100644 --- a/Engine/source/gui/core/guiTypes.cpp +++ b/Engine/source/gui/core/guiTypes.cpp @@ -735,7 +735,7 @@ DefineEngineMethod( GuiControlProfile, getStringWidth, S32, (const char* string) "@param string String to get the width of." "@return width of the string in pixels." ) { - return object->mFont->getStrNWidth( string, dStrlen( string ) ); + return (object->mFont) ? object->mFont->getStrNWidth( string, dStrlen( string ) ) : -1; } DefineEngineMethod(GuiControlProfile, getBitmap, const char*, (), , "get name") diff --git a/Engine/source/renderInstance/renderImposterMgr.cpp b/Engine/source/renderInstance/renderImposterMgr.cpp index e0b8b3156..ab547e4fc 100644 --- a/Engine/source/renderInstance/renderImposterMgr.cpp +++ b/Engine/source/renderInstance/renderImposterMgr.cpp @@ -133,6 +133,7 @@ void RenderImposterMgr::_renderDeferred( const SceneRenderState *state, RenderDe void RenderImposterMgr::_innerRender( const SceneRenderState *state, RenderDeferredMgr *deferredBin ) { + if (deferredBin == NULL) return; PROFILE_SCOPE( RenderImposterMgr_InnerRender ); // Capture the GFX stats for this render. diff --git a/Templates/BaseGame/game/core/rendering/Core_Rendering.tscript b/Templates/BaseGame/game/core/rendering/Core_Rendering.tscript index ae6168dea..955c9d3da 100644 --- a/Templates/BaseGame/game/core/rendering/Core_Rendering.tscript +++ b/Templates/BaseGame/game/core/rendering/Core_Rendering.tscript @@ -5,8 +5,6 @@ function Core_Rendering::onCreate(%this) $Core::UnAvailableTexturePath = "core/rendering/images/unavailable"; $Core::WarningTexturePath = "core/rendering/images/warnMat"; $Core::CommonShaderPath = "core/rendering/shaders"; - $Core::DefaultIrradianceCubemap = "core/rendering/images/default_irradiance.dds"; - $Core::DefaultPrefilterCubemap = "core/rendering/images/default_prefilter.dds"; $Core::BRDFTexture = "core/rendering/images/brdfTexture.dds"; $Core::NoImageAssetFallback = "Core_Rendering:missingTexture_image"; diff --git a/Templates/BaseGame/game/core/rendering/images/default_irradiance.dds b/Templates/BaseGame/game/core/rendering/images/default_irradiance.dds deleted file mode 100644 index 4cd4bdc6e..000000000 Binary files a/Templates/BaseGame/game/core/rendering/images/default_irradiance.dds and /dev/null differ diff --git a/Templates/BaseGame/game/core/rendering/images/default_irradiance_image.asset.taml b/Templates/BaseGame/game/core/rendering/images/default_irradiance_image.asset.taml deleted file mode 100644 index 99da51304..000000000 --- a/Templates/BaseGame/game/core/rendering/images/default_irradiance_image.asset.taml +++ /dev/null @@ -1,8 +0,0 @@ - diff --git a/Templates/BaseGame/game/core/rendering/images/default_prefilter.dds b/Templates/BaseGame/game/core/rendering/images/default_prefilter.dds deleted file mode 100644 index 0d9e41939..000000000 Binary files a/Templates/BaseGame/game/core/rendering/images/default_prefilter.dds and /dev/null differ diff --git a/Templates/BaseGame/game/core/rendering/images/default_prefilter_image.asset.taml b/Templates/BaseGame/game/core/rendering/images/default_prefilter_image.asset.taml deleted file mode 100644 index 5a87d27d0..000000000 --- a/Templates/BaseGame/game/core/rendering/images/default_prefilter_image.asset.taml +++ /dev/null @@ -1,8 +0,0 @@ - diff --git a/Templates/BaseGame/game/core/rendering/scripts/graphicsOptions.tscript b/Templates/BaseGame/game/core/rendering/scripts/graphicsOptions.tscript index a03745ccb..9284af583 100644 --- a/Templates/BaseGame/game/core/rendering/scripts/graphicsOptions.tscript +++ b/Templates/BaseGame/game/core/rendering/scripts/graphicsOptions.tscript @@ -453,7 +453,7 @@ new SimGroup( LightingQualityList ) class = "GraphicsQualityLevel"; caseSensitive = true; - displayName = "High"; + displayName = "Highest"; key["$pref::maximumNumOfLights"] = -1; key["$pref::useLightFade"] = false; @@ -821,6 +821,11 @@ function _makePrettyResString( %resString, %giveAspectRation ) %width = getWord( %resString, $WORD::RES_X ); %height = getWord( %resString, $WORD::RES_Y ); + //If it's an x, it means we've got the human-readable 'x' in the middle + //so skip it + if(%height $= "x") + %height = getWord( %resString, 2 ); + %aspect = %width / %height; %aspect = mRound( %aspect * 100 ) * 0.01; diff --git a/Templates/BaseGame/game/data/UI/guis/optionsMenu.tscript b/Templates/BaseGame/game/data/UI/guis/optionsMenu.tscript index 8851d1990..2dd1d7f10 100644 --- a/Templates/BaseGame/game/data/UI/guis/optionsMenu.tscript +++ b/Templates/BaseGame/game/data/UI/guis/optionsMenu.tscript @@ -46,6 +46,9 @@ //headbob //FOV +$yesNoList = "No\tYes"; +$onOffList = "Off\tOn"; + function OptionsMenu::onAdd(%this) { if(!isObject(%this.optionsCategories)) @@ -159,6 +162,7 @@ function OptionsMenu::apply(%this) %hasVideoChanges = false; %hasPostFXChanges = false; %hasAudioChanges = false; + %hasGraphicsChanges = false; for(%i=0; %i < %this.unappliedChanges.count(); %i++) { %targetVar = %this.unappliedChanges.getKey(%i); @@ -184,7 +188,10 @@ function OptionsMenu::apply(%this) if(!%wasKeybind) { - %currentValue = getVariable(%targetVar); + %sanitizedVar = strReplace(%targetVar, "[", ""); + %sanitizedVar = strReplace(%sanitizedVar, "]", ""); + %sanitizedVar = strReplace(%sanitizedVar, ",", "_"); + %currentValue = getVariable(%sanitizedVar); if(%currentValue !$= %newValue) { setVariable(%targetVar, %newValue); @@ -195,22 +202,6 @@ function OptionsMenu::apply(%this) { MessageBoxOK( "Change requires restart", "Please restart the game for a display device change to take effect." ); } - else if(startsWith(%targetVar, "$pref::Graphics::")) - { - //isolate the quality group name, like $pref::Graphics::LightingQuality - //we grab LightingQuality - %qualityGroupName = getSubStr(%targetVar, 17); - if(isObject(%qualityGroupName @ "List")) - { - //yep, it's a quality group, so apply it - (%qualityGroupName @ "List").applySetting(%newValue); - } - - if(%qualityGroupName $= "TextureQuality") - { - reloadTextures(); - } - } else if(startsWith(%targetVar, "$pref::PostFX::")) { %hasPostFXChanges = true; @@ -218,11 +209,26 @@ function OptionsMenu::apply(%this) else if(startsWith(%targetVar, "$pref::Video::")) { %hasVideoChanges = true; + + //if it's the resolution, it's possible we got the human-friendly + //version stored off. if so, reprocess into the usable state + if(%targetVar $= "$pref::Video::Resolution") + { + if(strpos(%newValue, " x ") != -1) + { + %newValue = strreplace(%newValue, " x ", " "); + setVariable(%targetVar, %newValue); + } + } } else if(startsWith(%targetVar, "$pref::SFX::")) { %hasAudioChanges = true; } + else if(startsWith(%targetVar, "$pref::Graphics::")) + { + %hasGraphicsChanges = true; + } } } } @@ -265,6 +271,11 @@ function OptionsMenu::apply(%this) updateAudioSettings(); } + if(%hasGraphicsChanges) + { + updateGraphicsSettings(); + } + //Finally, write our prefs to file %prefPath = getPrefpath(); export("$pref::*", %prefPath @ "/clientPrefs." @ $TorqueScriptFileExtension, false); @@ -282,8 +293,17 @@ function OptionsMenu::resetToDefaults(%this) function OptionsMenu::refresh(%this) { + %cat = %this.currentCategory; if(%this.currentCategory !$= "") { + if(!isInt(%this.currentCategory)) + { + %this.currentCategory = getOptionsCategoryIndexByName(%this.currentCategory); + } + + if(%this.currentCategory == -1) + return; + %category = %this.optionsCategories.getKey(%this.currentCategory); %command = %this.optionsCategories.getValue(%this.currentCategory); eval(%command); @@ -299,7 +319,10 @@ function OptionsMenu::getOptionVariableValue(%this, %variableName) return strreplace(%value, "\"", ""); } - return getVariable(%variableName); + %sanitizedVar = strReplace(%variableName, "[", ""); + %sanitizedVar = strReplace(%sanitizedVar, "]", ""); + %sanitizedVar = strReplace(%sanitizedVar, ",", "_"); + return getVariable(%sanitizedVar); } function OptionsMenuSelectButton::onVisible(%this, %state) @@ -321,6 +344,8 @@ function populateDisplaySettingsList() { OptionsMenuSettingsList.clear(); + OptionsMenu.currentCategory = "Display"; + OptionName.setText(""); OptionDescription.setText(""); @@ -378,20 +403,26 @@ function populateDisplaySettingsList() if(%mode !$= "Borderless") { %resolutionList = getScreenResolutionList($pref::Video::deviceId, $pref::Video::deviceMode); - OptionsMenuSettingsList.addOptionRow("Resolution", "$pref::Video::Resolution", %resolutionList, false, "", true, "Resolution of the game window", _makePrettyResString( $pref::Video::mode )); + %resolution = OptionsMenu.getOptionVariableValue("$pref::Video::Resolution"); + if(%resolution $= "") + %resolution = $pref::Video::mode; + + %resolution = _makePrettyResString(%resolution); + + OptionsMenuSettingsList.addOptionRow("Resolution", "$pref::Video::Resolution", %resolutionList, false, "", true, "Resolution of the game window", %resolution); } - OptionsMenuSettingsList.addOptionRow("VSync", "$pref::Video::disableVerticalSync", "No\tYes", false, "", true, "", convertBoolToYesNo(!$pref::Video::disableVerticalSync)); + OptionsMenuSettingsList.addOptionBoolRow("VSync", "$pref::Video::disableVerticalSync", $yesNoList, false, "", true, ""); %refreshList = getScreenRefreshList($pref::Video::mode); - OptionsMenuSettingsList.addOptionRow("Refresh Rate", "$pref::Video::RefreshRate", %refreshList, false, "", true, "", $pref::Video::RefreshRate); + OptionsMenuSettingsList.addOptionRow("Refresh Rate", "$pref::Video::RefreshRate", %refreshList, false, "", true, "", OptionsMenu.getOptionVariableValue("$pref::Video::RefreshRate")); //move to gameplay tab - OptionsMenuSettingsList.addSliderRow("Field of View", "", 75, 5, "65 100", ""); + //OptionsMenuSettingsList.addSliderRow("Field of View", "", 75, 5, "65 100", ""); - OptionsMenuSettingsList.addSliderRow("Brightness", "", 0.5, 0.1, "0 1", ""); - OptionsMenuSettingsList.addSliderRow("Contrast", "", 0.5, 0.1, "0 1", ""); + //OptionsMenuSettingsList.addSliderRow("Brightness", "", 0.5, 0.1, "0 1", ""); + //OptionsMenuSettingsList.addSliderRow("Contrast", "", 0.5, 0.1, "0 1", ""); } // @@ -401,32 +432,76 @@ function populateGraphicsSettingsList() { OptionsMenuSettingsList.clear(); + OptionsMenu.currentCategory = "Graphics"; + OptionName.setText(""); OptionDescription.setText(""); %yesNoList = "No\tYes"; %onOffList = "Off\tOn"; - %highMedLow = "Low\tMedium\tHigh"; %anisoFilter = "Off\t4\t8\t16"; %aaFilter = "Off\t1\t2\t4"; - OptionsMenuSettingsList.addOptionRow("Lighting Quality", "$pref::Graphics::LightingQuality", getQualityLevels(LightingQualityList), false, "", true, "Amount and drawdistance of local lights", getCurrentQualityLevel(LightingQualityList)); - OptionsMenuSettingsList.addOptionRow("Shadow Quality", "$pref::Graphics::ShadowQuality", getQualityLevels(ShadowQualityList), false, "", true, "Shadow revolution quality", getCurrentQualityLevel(ShadowQualityList)); - OptionsMenuSettingsList.addOptionRow("Soft Shadow Quality", "$pref::Graphics::SoftShadowQuality", getQualityLevels(SoftShadowList), false, "", true, "Amount of softening applied to shadowmaps", getCurrentQualityLevel(SoftShadowList)); - OptionsMenuSettingsList.addOptionRow("Mesh Quality", "$pref::Graphics::MeshQuality", getQualityLevels(MeshQualityGroup), false, "", true, "Fidelity of rendering of mesh objects", getCurrentQualityLevel(MeshQualityGroup)); - OptionsMenuSettingsList.addOptionRow("Object Draw Distance", "$pref::Graphics::ObjectDrawDistance", getQualityLevels(MeshDrawDistQualityGroup), false, "", true, "Dictates if and when static objects fade out in the distance", getCurrentQualityLevel(MeshDrawDistQualityGroup)); - OptionsMenuSettingsList.addOptionRow("Texture Quality", "$pref::Graphics::TextureQuality", getQualityLevels(TextureQualityGroup), false, "", true, "Fidelity of textures", getCurrentQualityLevel(TextureQualityGroup)); - OptionsMenuSettingsList.addOptionRow("Terrain Quality", "$pref::Graphics::TerrainQuality", getQualityLevels(TerrainQualityGroup), false, "", true, "Quality level of terrain objects", getCurrentQualityLevel(TerrainQualityGroup)); - OptionsMenuSettingsList.addOptionRow("Decal Lifetime", "$pref::Graphics::DecalLifetime", getQualityLevels(DecalLifetimeGroup), false, "", true, "How long decals are rendered", getCurrentQualityLevel(DecalLifetimeGroup)); - OptionsMenuSettingsList.addOptionRow("Ground Cover Density", "$pref::Graphics::GroundCoverDensity", getQualityLevels(GroundCoverDensityGroup), false, "", true, "Density of ground cover items, such as grass", getCurrentQualityLevel(GroundCoverDensityGroup)); - OptionsMenuSettingsList.addOptionRow("Shader Quality", "$pref::Graphics::ShaderQuality", getQualityLevels(ShaderQualityGroup), false, "", true, "Dictates the overall shader quality level, adjusting what features are enabled.", getCurrentQualityLevel(ShaderQualityGroup)); - OptionsMenuSettingsList.addOptionRow("Anisotropic Filtering", "$pref::Video::defaultAnisotropy", %anisoFilter, false, "", true, "Amount of Anisotropic Filtering on textures, which dictates their sharpness at a distance", $pref::Video::defaultAnisotropy); - OptionsMenuSettingsList.addOptionRow("Anti-Aliasing", "$pref::Video::AA", %aaFilter, false, "", true, "Amount of Post-Processing Anti-Aliasing applied to rendering", $pref::Video::AA); - OptionsMenuSettingsList.addOptionRow("Parallax", "$pref::Video::disableParallaxMapping", %onOffList, false, "", true, "Whether the surface parallax shader effect is enabled", convertBoolToOnOff(!$pref::Video::disableParallaxMapping)); - OptionsMenuSettingsList.addOptionRow("Water Reflections", "$pref::Water::disableTrueReflections", %onOffList, false, "", true, "Whether water reflections are enabled", convertBoolToOnOff(!$pref::Water::disableTrueReflections)); - OptionsMenuSettingsList.addOptionRow("SSAO", "$pref::PostFX::EnableSSAO", %onOffList, false, "", true, "Whether Screen-Space Ambient Occlusion is enabled", convertBoolToOnOff($pref::PostFX::EnableSSAO)); - OptionsMenuSettingsList.addOptionRow("Depth of Field", "$pref::PostFX::EnableDOF", %onOffList, false, "", true, "Whether the Depth of Field effect is enabled", convertBoolToOnOff($pref::PostFX::EnableDOF)); - OptionsMenuSettingsList.addOptionRow("Vignette", "$pref::PostFX::EnableVignette", %onOffList, false, "", true, "Whether the vignette effect is enabled", convertBoolToOnOff($pref::PostFX::EnableVignette)); - OptionsMenuSettingsList.addOptionRow("Light Rays", "$pref::PostFX::EnableLightRays", %onOffList, false, "", true, "Whether the light rays effect is enabled", convertBoolToOnOff($pref::PostFX::EnableLightRays)); + OptionsMenuSettingsList.addOptionQualityLevelRow("Lighting Quality", "$pref::Graphics::LightingQuality", + LightingQualityList, false, "", true, "Amount and drawdistance of local lights"); + OptionsMenuSettingsList.addOptionQualityLevelRow("Shadow Quality", "$pref::Graphics::ShadowQuality", + ShadowQualityList, false, "", true, "Shadow revolution quality"); + + %shadowQuality = OptionsMenu.getOptionVariableValue("$pref::Graphics::ShadowQuality"); + if(%shadowQuality !$= "None") + { + OptionsMenuSettingsList.addOptionQualityLevelRow("Soft Shadow Quality", "$pref::Graphics::SoftShadowQuality", + SoftShadowList, false, "", true, "Amount of softening applied to shadowmaps"); + } + + OptionsMenuSettingsList.addOptionQualityLevelRow("Mesh Quality", "$pref::Graphics::MeshQuality", + MeshQualityGroup, false, "", true, "Fidelity of rendering of mesh objects"); + OptionsMenuSettingsList.addOptionQualityLevelRow("Object Draw Distance", "$pref::Graphics::ObjectDrawDistance", + MeshDrawDistQualityGroup, false, "", true, "Dictates if and when static objects fade out in the distance"); + OptionsMenuSettingsList.addOptionQualityLevelRow("Texture Quality", "$pref::Graphics::TextureQuality", + TextureQualityGroup, false, "", true, "Fidelity of textures"); + OptionsMenuSettingsList.addOptionQualityLevelRow("Terrain Quality", "$pref::Graphics::TerrainQuality", + TerrainQualityGroup, false, "", true, "Quality level of terrain objects"); + OptionsMenuSettingsList.addOptionQualityLevelRow("Decal Lifetime", "$pref::Graphics::DecalLifetime", + DecalLifetimeGroup, false, "", true, "How long decals are rendered"); + OptionsMenuSettingsList.addOptionQualityLevelRow("Ground Cover Density", "$pref::Graphics::GroundCoverDensity", + GroundCoverDensityGroup, false, "", true, "Density of ground cover items, such as grass"); + OptionsMenuSettingsList.addOptionQualityLevelRow("Shader Quality", "$pref::Graphics::ShaderQuality", + ShaderQualityGroup, false, "", true, "Dictates the overall shader quality level, adjusting what features are enabled."); + OptionsMenuSettingsList.addOptionRow("Anisotropic Filtering", "$pref::Video::defaultAnisotropy", %anisoFilter, false, "", true, "Amount of Anisotropic Filtering on textures, which dictates their sharpness at a distance"); + OptionsMenuSettingsList.addOptionRow("Anti-Aliasing", "$pref::Video::AA", %aaFilter, false, "", true, "Amount of Post-Processing Anti-Aliasing applied to rendering"); + OptionsMenuSettingsList.addOptionBoolRow("Parallax", "$pref::Video::disableParallaxMapping", %onOffList, false, "", true, "Whether the surface parallax shader effect is enabled"); + OptionsMenuSettingsList.addOptionBoolRow("Water Reflections", "$pref::Water::disableTrueReflections", %onOffList, false, "", true, "Whether water reflections are enabled"); + OptionsMenuSettingsList.addOptionBoolRow("SSAO", "$pref::PostFX::EnableSSAO", %onOffList, false, "", true, "Whether Screen-Space Ambient Occlusion is enabled"); + OptionsMenuSettingsList.addOptionBoolRow("Depth of Field", "$pref::PostFX::EnableDOF", %onOffList, false, "", true, "Whether the Depth of Field effect is enabled"); + OptionsMenuSettingsList.addOptionBoolRow("Vignette", "$pref::PostFX::EnableVignette", %onOffList, false, "", true, "Whether the vignette effect is enabled"); + OptionsMenuSettingsList.addOptionBoolRow("Light Rays", "$pref::PostFX::EnableLightRays", %onOffList, false, "", true, "Whether the light rays effect is enabled"); +} + +function updateGraphicsSettings() +{ + if($pref::Graphics::LightingQuality !$= getCurrentQualityLevel(LightingQualityList)) + LightingQualityList.applySetting($pref::Graphics::LightingQuality); + if($pref::Graphics::ShadowQuality !$= getCurrentQualityLevel(ShadowQualityList)) + ShadowQualityList.applySetting($pref::Graphics::ShadowQuality); + if($pref::Graphics::SoftShadowQuality !$= getCurrentQualityLevel(SoftShadowList)) + SoftShadowList.applySetting($pref::Graphics::SoftShadowQuality); + + if($pref::Graphics::MeshQuality !$= getCurrentQualityLevel(MeshQualityGroup)) + MeshQualityGroup.applySetting($pref::Graphics::MeshQuality); + if($pref::Graphics::ObjectDrawDistance !$= getCurrentQualityLevel(MeshDrawDistQualityGroup)) + MeshDrawDistQualityGroup.applySetting($pref::Graphics::ObjectDrawDistance); + if($pref::Graphics::TextureQuality !$= getCurrentQualityLevel(TextureQualityGroup)) + { + TextureQualityGroup.applySetting($pref::Graphics::TextureQuality); + + reloadTextures(); + } + if($pref::Graphics::TerrainQuality !$= getCurrentQualityLevel(TerrainQualityGroup)) + TerrainQualityGroup.applySetting($pref::Graphics::TerrainQuality); + if($pref::Graphics::DecalLifetime !$= getCurrentQualityLevel(DecalLifetimeGroup)) + DecalLifetimeGroup.applySetting($pref::Graphics::DecalLifetime); + if($pref::Graphics::GroundCoverDensity !$= getCurrentQualityLevel(GroundCoverDensityGroup)) + GroundCoverDensityGroup.applySetting($pref::Graphics::GroundCoverDensity); } function updateDisplaySettings() @@ -522,6 +597,8 @@ function populateAudioSettingsList() { OptionsMenuSettingsList.clear(); + OptionsMenu.currentCategory = "Audio"; + OptionName.setText(""); OptionDescription.setText(""); @@ -557,13 +634,13 @@ function populateAudioSettingsList() } } - OptionsMenuSettingsList.addOptionRow("Audio Provider", "$pref::SFX::AudioProvider", %audioProviderList, false, "audioProviderChanged", true, "", $currentAudioProvider); - OptionsMenuSettingsList.addOptionRow("Audio Device", "$pref::SFX::device", %audioDeviceList, false, "", true, $pref::SFX::device); + OptionsMenuSettingsList.addOptionRow("Audio Provider", "$pref::SFX::AudioProvider", %audioProviderList, false, "audioProviderChanged", true, ""); + OptionsMenuSettingsList.addOptionRow("Audio Device", "$pref::SFX::device", %audioDeviceList, false, "", true); - OptionsMenuSettingsList.addSliderRow("Master Volume", "$pref::SFX::masterVolume", $pref::SFX::masterVolume, 0.1, "0 1", ""); - OptionsMenuSettingsList.addSliderRow("GUI Volume", "$pref::SFX::channelVolume[ $GuiAudioType]", $pref::SFX::channelVolume[ $GuiAudioType], 0.1, "0 1", ""); - OptionsMenuSettingsList.addSliderRow("Effects Volume", "$pref::SFX::channelVolume[ $SimAudioType ]", $pref::SFX::channelVolume[ $SimAudioType ], 0.1, "0 1", ""); - OptionsMenuSettingsList.addSliderRow("Music Volume", "$pref::SFX::channelVolume[ $MusicAudioType ]", $pref::SFX::channelVolume[ $MusicAudioType ], 0.1, "0 1", ""); + OptionsMenuSettingsList.addSliderRow("Master Volume", "$pref::SFX::masterVolume", 0.1, "0 1", ""); + OptionsMenuSettingsList.addSliderRow("GUI Volume", "$pref::SFX::channelVolume[" @ $GuiAudioType @ "]", 0.1, "0 1", ""); + OptionsMenuSettingsList.addSliderRow("Effects Volume", "$pref::SFX::channelVolume[" @ $SimAudioType @ "]", 0.1, "0 1", ""); + OptionsMenuSettingsList.addSliderRow("Music Volume", "$pref::SFX::channelVolume[" @ $MusicAudioType @ "]", 0.1, "0 1", ""); } function audioProviderChanged() @@ -613,6 +690,8 @@ function populateKeyboardMouseSettingsList() { OptionsMenuSettingsList.clear(); + OptionsMenu.currentCategory = "Keyboard & Mouse"; + OptionName.setText(""); OptionDescription.setText(""); @@ -626,6 +705,8 @@ function populateGamepadSettingsList() { OptionsMenuSettingsList.clear(); + OptionsMenu.currentCategory = "Gamepad"; + OptionName.setText(""); OptionDescription.setText(""); @@ -717,21 +798,57 @@ function OptionsMenuSettingsList::addOptionRow(%this, %label, %targetPrefVar, %o %option.targetPrefVar = %targetPrefVar; //create a var-option association - //now some override trickery, if we have a value cached for unapplied changes, swapsies the defaultValue out - //with the unapplied, allowing us to change options categories without losing changes - %unappliedPrefIndex = OptionsMenu.unappliedChanges.getIndexFromValue(%targetPrefVar); - if(%unappliedPrefIndex != -1) - { - %unappliedValue = OptionsMenu.unappliedChanges.getValue(%unappliedPrefIndex); - %defaultValue = %unappliedValue; - } - %option.setListSetting(%label, %optionsList, %wrapOptions, %callback, %enabled, %description, %defaultValue); %this.add(%option); } -function OptionsMenuSettingsList::addSliderRow(%this, %label, %targetPrefVar, %defaultValue, %increment, %range, %callback, %enabled, %description) +function OptionsMenuSettingsList::addOptionQualityLevelRow(%this, %label, %targetPrefVar, %qualityLevelList, %wrapOptions, %callback, %enabled, %description, %defaultValue) +{ + if(%defaultValue $= "") + { + %unappliedPrefIndex = OptionsMenu.unappliedChanges.getIndexFromKey(%targetPrefVar); + if(%unappliedPrefIndex != -1) + { + %value = OptionsMenu.unappliedChanges.getValue(%unappliedPrefIndex); + %defaultValue = strreplace(%value, "\"", ""); + } + + if(%defaultValue $= "") + { + %sanitizedVar = strReplace(%targetPrefVar, "[", ""); + %sanitizedVar = strReplace(%sanitizedVar, "]", ""); + %sanitizedVar = strReplace(%sanitizedVar, ",", "_"); + %defaultValue = getVariable(%sanitizedVar); + } + + if(%defaultValue $= "") + %defaultValue = getCurrentQualityLevel(%qualityLevelList); + } + + return %this.addOptionRow(%label, %targetPrefVar, getQualityLevels(%qualityLevelList), + %wrapOptions, %callback, %enabled, %description, %defaultValue); +} + +function OptionsMenuSettingsList::addOptionBoolRow(%this, %label, %targetPrefVar, %qualityLevelList, %wrapOptions, %callback, %enabled, %description, %defaultValue) +{ + if(%defaultValue $= "") + %defaultValue = OptionsMenu.getOptionVariableValue(%targetPrefVar); + + if(%qualityLevelList $= $yesNoList && isInt(%defaultValue)) + { + %defaultValue = convertBoolToYesNo(!%defaultValue); + } + else if(%qualityLevelList $= $onOffList && isInt(%defaultValue)) + { + %defaultValue = convertBoolToOnOff(!%defaultValue); + } + + return %this.addOptionRow(%label, %targetPrefVar, %qualityLevelList, + %wrapOptions, %callback, %enabled, %description, %defaultValue); +} + +function OptionsMenuSettingsList::addSliderRow(%this, %label, %targetPrefVar, %increment, %range, %callback, %enabled, %description, %defaultValue) { if(%enabled $= "") %enabled = true; @@ -752,14 +869,8 @@ function OptionsMenuSettingsList::addSliderRow(%this, %label, %targetPrefVar, %d %option.targetPrefVar = %targetPrefVar; //create a var-option association - //now some override trickery, if we have a value cached for unapplied changes, swapsies the defaultValue out - //with the unapplied, allowing us to change options categories without losing changes - %unappliedPrefIndex = OptionsMenu.unappliedChanges.getIndexFromValue(%targetPrefVar); - if(%unappliedPrefIndex != -1) - { - %unappliedValue = OptionsMenu.unappliedChanges.getValue(%unappliedPrefIndex); - %defaultValue = %unappliedValue; - } + if(%defaultValue $= "") + %defaultValue = OptionsMenu.getOptionVariableValue(%targetPrefVar); %option.setSliderSetting(%label, %defaultValue, %increment, %range, %callback, %enabled, %description); @@ -809,16 +920,20 @@ function convertBoolToYesNo(%val) { if(%val == 1) return "Yes"; - else + else if(%val == 0) return "No"; + + return %val; } function convertBoolToOnOff(%val) { if(%val == 1) return "On"; - else + else if(%val == 0) return "Off"; + + return %val; } function getDisplayDeviceName() @@ -883,7 +998,7 @@ function MenuOptionsButton::onChange(%this) } //Update the UI in case there's responsive logic - schedule(32, OptionsMenu, "refresh"); + OptionsMenu.schedule(32, "refresh"); } function OptionsMenu::onKeybindChanged(%this, %actionMap, %keybind) @@ -913,6 +1028,17 @@ function removeOptionsMenuCategory(%categoryName) OptionsMenu.optionsCategories.erase(%index); } +function getOptionsCategoryIndexByName(%categoryName) +{ + for(%i=0; %i < OptionsMenu.optionsCategories.count(); %i++) + { + if(OptionsMenu.optionsCategories.getKey(%i) $= %categoryName) + return %i; + } + + return -1; +} + function addListOption(%label, %description, %targetPrefVar, %optionsList, %wrapOptions, %callback, %enabled) { if(%wrapOptions $= "") diff --git a/Templates/BaseGame/game/data/defaults.tscript b/Templates/BaseGame/game/data/defaults.tscript index d45116ff9..acd2a0f43 100644 --- a/Templates/BaseGame/game/data/defaults.tscript +++ b/Templates/BaseGame/game/data/defaults.tscript @@ -125,11 +125,6 @@ $pref::SFX::channelVolume6 = 1; $pref::SFX::channelVolume7 = 1; $pref::SFX::channelVolume8 = 1; -$pref::SFX::channelVolume[1] = 1; -$pref::SFX::channelVolume[2] = 1; -$pref::SFX::channelVolume[3] = 1; -$pref::SFX::channelVolume[4] = 1; - $pref::PostEffect::PreferedHDRFormat = "GFXFormatR8G8B8A8"; /// This is an scalar which can be used to reduce the diff --git a/Templates/BaseGame/game/tools/assetBrowser/scripts/assetBrowser.tscript b/Templates/BaseGame/game/tools/assetBrowser/scripts/assetBrowser.tscript index fc3e3576c..eca3729f7 100644 --- a/Templates/BaseGame/game/tools/assetBrowser/scripts/assetBrowser.tscript +++ b/Templates/BaseGame/game/tools/assetBrowser/scripts/assetBrowser.tscript @@ -1088,7 +1088,7 @@ function AssetBrowserPreviewButton::onRightClick(%this) //Do some enabling/disabling of options depending on asset type EditAssetPopup.enableItem(0, true); - EditAssetPopup.enableItem(7, true); + EditAssetPopup.enableItem(9, true); //Is it an editable type? if(%assetType $= "ImageAsset" /*|| %assetType $= "GameObjectAsset"*/ || %assetType $= "CppAsset") @@ -1101,9 +1101,18 @@ function AssetBrowserPreviewButton::onRightClick(%this) || %assetType $= "MaterialAsset" || %assetType $= "ParticleAsset" || %assetType $= "PostEffectAsset" || %assetType $= "ScriptAsset" || %assetType $= "StateMachineAsset") { - EditAssetPopup.enableItem(7, false); + EditAssetPopup.enableItem(9, false); } + %assetDef = AssetDatabase.acquireAsset(EditAssetPopup.assetId); + if(%assetDef.originalFilePath $= "" || !isFile(%assetDef.originalFilePath)) + { + //if we have no noted original import file path or it's invalid + //we can't reimport either + EditAssetPopup.enableItem(9, false); + } + AssetDatabase.releaseAsset(EditAssetPopup.assetId); + if(%assetType $= "LevelAsset") { EditLevelAssetPopup.showPopup(Canvas); @@ -2403,19 +2412,14 @@ function AssetBrowserFilterTree::onControlDropped( %this, %payload, %position ) %assetName = %payload.assetName; %moduleName = %payload.moduleName; - echo("DROPPED A " @ %assetType @ " ON THE ASSET BROWSER NAVIGATION TREE!"); - %item = %this.getItemAtPosition(%position); - echo("DROPPED IT ON ITEM " @ %item); - %parent = %this.getParentItem(%item); if(%item != 1) { //we're a folder entry, cool %path = %this.getItemValue(%item) @ "/" @ %this.getItemText(%item); - echo("DROPPED IT ON PATH " @ %path); if(%path !$= AssetBrowser.dirHandler.CurrentAddress) { @@ -2430,7 +2434,11 @@ function AssetBrowserFilterTree::onControlDropped( %this, %payload, %position ) //Do any cleanup required given the type if(AssetBrowser.isMethod("moveFolder")) + { eval(AssetBrowser @ ".moveFolder(\""@%originFolder@"\",\""@%path@"\");"); + + AssetBrowser.refresh(); + } } else { @@ -2443,6 +2451,8 @@ function AssetBrowserFilterTree::onControlDropped( %this, %payload, %position ) { %command = AssetBrowser @ ".move" @ %assetType @ "(" @ %assetDef @ ",\"" @ %path @ "\");"; eval(AssetBrowser @ ".move" @ %assetType @ "(" @ %assetDef @ ",\"" @ %path @ "\");"); + + AssetBrowser.refresh(); } } } diff --git a/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/cpp.tscript b/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/cpp.tscript index 66f7cb64a..a42431bfd 100644 --- a/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/cpp.tscript +++ b/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/cpp.tscript @@ -204,7 +204,7 @@ function AssetBrowser::deleteCpp(%this, %assetDef) function AssetBrowser::moveCpp(%this, %assetDef, %destination) { %currentModule = AssetDatabase.getAssetModule(%assetDef.getAssetId()); - %targetModule = AssetBrowser.getModuleFromAddress(%destination); + %targetModule = AssetBrowser.dirHandler.getModuleFromAddress(%destination); %newAssetPath = moveAssetFile(%assetDef, %destination); diff --git a/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/cubemap.tscript b/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/cubemap.tscript index b050d37cd..c2a5429f3 100644 --- a/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/cubemap.tscript +++ b/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/cubemap.tscript @@ -69,7 +69,7 @@ function AssetBrowser::deleteCubemapAsset(%this, %assetDef) function AssetBrowser::moveCubemapAsset(%this, %assetDef, %destination) { /*%currentModule = AssetDatabase.getAssetModule(%assetDef.getAssetId()); - %targetModule = AssetBrowser.getModuleFromAddress(%destination); + %targetModule = AssetBrowser.dirHandler.getModuleFromAddress(%destination); %newAssetPath = moveAssetFile(%assetDef, %destination); diff --git a/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/gameObject.tscript b/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/gameObject.tscript index c25eda8f4..7cff48ba5 100644 --- a/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/gameObject.tscript +++ b/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/gameObject.tscript @@ -233,7 +233,7 @@ function AssetBrowser::deleteGameObjectAsset(%this, %assetDef) function AssetBrowser::moveGameObjectAsset(%this, %assetDef, %destination) { %currentModule = AssetDatabase.getAssetModule(%assetDef.getAssetId()); - %targetModule = AssetBrowser.getModuleFromAddress(%destination); + %targetModule = AssetBrowser.dirHandler.getModuleFromAddress(%destination); %newAssetPath = moveAssetFile(%assetDef, %destination); diff --git a/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/gui.tscript b/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/gui.tscript index dfebccb47..7a5f66a64 100644 --- a/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/gui.tscript +++ b/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/gui.tscript @@ -145,15 +145,15 @@ function AssetBrowser::deleteGUIAsset(%this, %assetDef) function AssetBrowser::moveGUIAsset(%this, %assetDef, %destination) { %currentModule = AssetDatabase.getAssetModule(%assetDef.getAssetId()); - %targetModule = AssetBrowser.getModuleFromAddress(%destination); + %targetModule = AssetBrowser.dirHandler.getModuleFromAddress(%destination); %newAssetPath = moveAssetFile(%assetDef, %destination); if(%newAssetPath $= "") return false; - moveAssetLooseFile(%assetDef.guifile, %destination); - moveAssetLooseFile(%assetDef.scriptFile, %destination); + moveAssetLooseFile(%assetDef.getGUIPath(), %destination); + moveAssetLooseFile(%assetDef.getScriptPath(), %destination); AssetDatabase.removeDeclaredAsset(%assetDef.getAssetId()); AssetDatabase.addDeclaredAsset(%targetModule, %newAssetPath); diff --git a/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/image.tscript b/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/image.tscript index 0dbebd39b..df8b2467c 100644 --- a/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/image.tscript +++ b/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/image.tscript @@ -175,8 +175,11 @@ function AssetBrowser::importImageAsset(%this, %assetItem) AssetDatabase.refreshAsset(%assetId); } -function AssetBrowser::buildImageAssetPreview(%this, %assetDef, %previewData) +function AssetBrowser::buildImageAssetPreview(%this, %assetDef, %previewData, %forcePreviewRegenerate) { + if(%forcePreviewRegenerate $= "") + %forcePreviewRegenerate = false; + %module = %this.dirHandler.getModuleFromAddress(makeRelativePath(filePath(%assetDef.getImagePath()))); %previewPath = "tools/resources/previewCache/" @ %module.moduleId @ "/"; @@ -195,7 +198,7 @@ function AssetBrowser::buildImageAssetPreview(%this, %assetDef, %previewData) %previewAssetName = %module.moduleId @ "_" @ %assetDef.assetName @ "_PreviewImage"; - if(%generatePreview) + if(%generatePreview || %forcePreviewRegenerate) { displayEditorLoadingGui("Generating Image Asset Preview..."); @@ -203,20 +206,23 @@ function AssetBrowser::buildImageAssetPreview(%this, %assetDef, %previewData) if(%success) { - %previewAsset = new ImageAsset() + if(!AssetDatabase.isDeclaredAsset("ToolsModule:" @ %previewAssetName)) { - assetName = %previewAssetName; - versionId = 1; - imageFile = fileName(%previewFilePath); - }; - - %previewAssetName = "ToolsModule:" @ %previewAssetName; - %previewImgAssetPath = %previewPath @ %previewAsset.assetName @ ".asset.taml"; - %assetImportSuccessful = TAMLWrite(%previewAsset, %previewImgAssetPath); - - %toolsModuleDef = ModuleDatabase.findModule("ToolsModule",1); + %previewAsset = new ImageAsset() + { + assetName = %previewAssetName; + versionId = 1; + imageFile = fileName(%previewFilePath); + }; - %success = AssetDatabase.addDeclaredAsset(%toolsModuleDef, %previewImgAssetPath); + %previewAssetName = "ToolsModule:" @ %previewAssetName; + %previewImgAssetPath = %previewPath @ %previewAsset.assetName @ ".asset.taml"; + %assetImportSuccessful = TAMLWrite(%previewAsset, %previewImgAssetPath); + + %toolsModuleDef = ModuleDatabase.findModule("ToolsModule",1); + + %success = AssetDatabase.addDeclaredAsset(%toolsModuleDef, %previewImgAssetPath); + } } else { @@ -303,14 +309,14 @@ function AssetBrowser::deleteImageAsset(%this, %assetDef) function AssetBrowser::moveImageAsset(%this, %assetDef, %destination) { %currentModule = AssetDatabase.getAssetModule(%assetDef.getAssetId()); - %targetModule = AssetBrowser.getModuleFromAddress(%destination); + %targetModule = AssetBrowser.dirHandler.getModuleFromAddress(%destination); %newAssetPath = moveAssetFile(%assetDef, %destination); if(%newAssetPath $= "") return false; - moveAssetLooseFile(%assetDef.imageFile, %destination); + moveAssetLooseFile(%assetDef.getImagePath(), %destination); AssetDatabase.removeDeclaredAsset(%assetDef.getAssetId()); AssetDatabase.addDeclaredAsset(%targetModule, %newAssetPath); diff --git a/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/level.tscript b/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/level.tscript index 23be49e9f..07ce53fce 100644 --- a/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/level.tscript +++ b/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/level.tscript @@ -113,14 +113,18 @@ function AssetBrowser::deleteLevelAsset(%this, %assetDef) function AssetBrowser::moveLevelAsset(%this, %assetDef, %destination) { %currentModule = AssetDatabase.getAssetModule(%assetDef.getAssetId()); - %targetModule = AssetBrowser.getModuleFromAddress(%destination); + %targetModule = AssetBrowser.dirHandler.getModuleFromAddress(%destination); %newAssetPath = moveAssetFile(%assetDef, %destination); if(%newAssetPath $= "") return false; - moveAssetLooseFile(%assetDef.LevelFile, %destination); + moveAssetLooseFile(%assetDef.getLevelPath(), %destination); + moveAssetLooseFile(%assetDef.getLevelPath(), %destination); + moveAssetLooseFile(%assetDef.getPreviewImagePath(), %destination); + moveAssetLooseFile(%assetDef.getPostFXPresetPath(), %destination); + moveAssetLooseFile(%assetDef.getDecalsPath(), %destination); AssetDatabase.removeDeclaredAsset(%assetDef.getAssetId()); AssetDatabase.addDeclaredAsset(%targetModule, %newAssetPath); diff --git a/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/material.tscript b/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/material.tscript index 27a3dc58d..debcaffd8 100644 --- a/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/material.tscript +++ b/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/material.tscript @@ -69,14 +69,14 @@ function AssetBrowser::deleteMaterialAsset(%this, %assetDef) function AssetBrowser::moveMaterialAsset(%this, %assetDef, %destination) { %currentModule = AssetDatabase.getAssetModule(%assetDef.getAssetId()); - %targetModule = AssetBrowser.getModuleFromAddress(%destination); + %targetModule = AssetBrowser.dirHandler.getModuleFromAddress(%destination); %newAssetPath = moveAssetFile(%assetDef, %destination); if(%newAssetPath $= "") return false; - moveAssetLooseFile(%assetDef.scriptPath, %destination); + moveAssetLooseFile(%assetDef.getScriptPath(), %destination); AssetDatabase.removeDeclaredAsset(%assetDef.getAssetId()); AssetDatabase.addDeclaredAsset(%targetModule, %newAssetPath); @@ -424,8 +424,11 @@ function AssetBrowser::importMaterialAsset(%this, %assetItem) AssetDatabase.refreshAsset(%assetId); } -function AssetBrowser::buildMaterialAssetPreview(%this, %assetDef, %previewData) -{ +function AssetBrowser::buildMaterialAssetPreview(%this, %assetDef, %previewData, %forcePreviewRegenerate) +{ + if(%forcePreviewRegenerate $= "") + %forcePreviewRegenerate = false; + %module = %this.dirHandler.getModuleFromAddress(makeRelativePath(filePath(AssetDatabase.getAssetFilePath(%assetDef.getAssetId())))); %previewPath = "tools/resources/previewCache/" @ %module.moduleId @ "/"; @@ -447,14 +450,13 @@ function AssetBrowser::buildMaterialAssetPreview(%this, %assetDef, %previewData) { if(compareFileTimes(%assetDef.materialDefinitionName.getDiffuseMap(0), %previewFilePath) == 1 || compareFileTimes(%assetDef.materialDefinitionName.getFilename(), %previewFilePath) == 1) - %generatePreview = true; - + %generatePreview = true; } } %previewAssetName = %module.moduleId @ "_" @ %assetDef.assetName @ "_PreviewImage"; - if(%generatePreview) + if(%generatePreview || %forcePreviewRegenerate) { displayEditorLoadingGui("Generating Material Asset Preview..."); @@ -466,19 +468,26 @@ function AssetBrowser::buildMaterialAssetPreview(%this, %assetDef, %previewData) pathCopy(%generatedFilePath, %previewFilePath); fileDelete(%generatedFilePath); - %previewAsset = new ImageAsset() + if(!AssetDatabase.isDeclaredAsset("ToolsModule:" @ %previewAssetName)) { - assetName = %previewAssetName; - versionId = 1; - imageFile = fileName(%previewFilePath); - }; - - %previewImgAssetPath = %previewPath @ %previewAsset.assetName @ ".asset.taml"; - %assetImportSuccessful = TAMLWrite(%previewAsset, %previewImgAssetPath); - - %toolsModuleDef = ModuleDatabase.findModule("ToolsModule",1); + %previewAsset = new ImageAsset() + { + assetName = %previewAssetName; + versionId = 1; + imageFile = fileName(%previewFilePath); + }; - %success = AssetDatabase.addDeclaredAsset(%toolsModuleDef, %previewImgAssetPath); + %previewImgAssetPath = %previewPath @ %previewAsset.assetName @ ".asset.taml"; + %assetImportSuccessful = TAMLWrite(%previewAsset, %previewImgAssetPath); + + %toolsModuleDef = ModuleDatabase.findModule("ToolsModule",1); + + %success = AssetDatabase.addDeclaredAsset(%toolsModuleDef, %previewImgAssetPath); + } + } + else + { + error("Failed to generate preview for material: " @ %assetDef.materialDefinitionName); } hideEditorLoadingGui(); @@ -504,11 +513,15 @@ function AssetBrowser::buildMaterialAssetPreview(%this, %assetDef, %previewData) %previewData.doubleClickCommand = "AssetBrowser.selectAsset( AssetBrowser.selectedAsset );"; else %previewData.doubleClickCommand = "AssetBrowser.editAsset( "@%assetDef@" );"; + + %definitionPath = %assetDef.getScriptPath(); + if(%definitionPath $= "") + %definitionPath = %assetDef.getFilename(); %previewData.tooltip = "Asset Name: " @ %assetDef.assetName @ "\nAsset Type: Material Asset" @ "\nAsset Definition ID: " @ %assetDef @ - "\nDefinition Path: " @ %assetDef.getScriptPath(); + "\nDefinition Path: " @ %definitionPath; if(!%this.selectMode) { diff --git a/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/postFX.tscript b/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/postFX.tscript index 704a6ddf2..a51390370 100644 --- a/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/postFX.tscript +++ b/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/postFX.tscript @@ -140,16 +140,16 @@ function AssetBrowser::deletePostEffectAsset(%this, %assetDef) function AssetBrowser::movePostEffectAsset(%this, %assetDef, %destination) { %currentModule = AssetDatabase.getAssetModule(%assetDef.getAssetId()); - %targetModule = AssetBrowser.getModuleFromAddress(%destination); + %targetModule = AssetBrowser.dirHandler.getModuleFromAddress(%destination); %newAssetPath = moveAssetFile(%assetDef, %destination); if(%newAssetPath $= "") return false; - moveAssetLooseFile(%assetDef.scriptPath, %destination); - moveAssetLooseFile(%assetDef.hlslShader, %destination); - moveAssetLooseFile(%assetDef.glslShader, %destination); + moveAssetLooseFile(%assetDef.getScriptPath(), %destination); + moveAssetLooseFile(%assetDef.getHLSLShaderPath(), %destination); + moveAssetLooseFile(%assetDef.getGLSLShaderPath(), %destination); AssetDatabase.removeDeclaredAsset(%assetDef.getAssetId()); AssetDatabase.addDeclaredAsset(%targetModule, %newAssetPath); diff --git a/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/script.tscript b/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/script.tscript index 1bf590f80..7b308b624 100644 --- a/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/script.tscript +++ b/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/script.tscript @@ -36,7 +36,7 @@ function AssetBrowser::editScriptAsset(%this, %assetDef) { %scriptFile = %assetDef.scriptFile; - EditorOpenFileInTorsion(makeFullPath(%scriptFile), 0); + //EditorOpenFileInTorsion(makeFullPath(%scriptFile), 0); } function AssetBrowser::duplicateScriptAsset(%this, %assetDef, %targetModule) @@ -76,14 +76,14 @@ function AssetBrowser::deleteScriptAsset(%this, %assetDef) function AssetBrowser::moveScriptAsset(%this, %assetDef, %destination) { %currentModule = AssetDatabase.getAssetModule(%assetDef.getAssetId()); - %targetModule = AssetBrowser.getModuleFromAddress(%destination); + %targetModule = AssetBrowser.dirHandler.getModuleFromAddress(%destination); %newAssetPath = moveAssetFile(%assetDef, %destination); if(%newAssetPath $= "") return false; - moveAssetLooseFile(%assetDef.scriptFile, %destination); + moveAssetLooseFile(%assetDef.getScriptPath(), %destination); AssetDatabase.removeDeclaredAsset(%assetDef.getAssetId()); AssetDatabase.addDeclaredAsset(%targetModule, %newAssetPath); @@ -93,7 +93,7 @@ function AssetBrowser::buildScriptAssetPreview(%this, %assetDef, %previewData) { %previewData.assetName = %assetDef.assetName; %previewData.assetPath = %assetDef.scriptFile; - %previewData.doubleClickCommand = "EditorOpenFileInTorsion( \""@%previewData.assetPath@"\", 0 );"; + //%previewData.doubleClickCommand = "EditorOpenFileInTorsion( \""@%previewData.assetPath@"\", 0 );"; if(%assetDef.isServerSide) %previewData.previewImage = "ToolsModule:serverScriptIcon_image"; @@ -109,7 +109,7 @@ function AssetBrowser::buildTScriptPreview(%this, %assetDef, %previewData) { %previewData.assetName = %assetDef.assetName; %previewData.assetPath = %assetDef.scriptFile; - %previewData.doubleClickCommand = "EditorOpenFileInTorsion( \""@%previewData.assetPath@"\", 0 );"; + //%previewData.doubleClickCommand = "EditorOpenFileInTorsion( \""@%previewData.assetPath@"\", 0 );"; if(%assetDef.isServerSide) %previewData.previewImage = "ToolsModule:serverScriptIcon_image"; diff --git a/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/shape.tscript b/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/shape.tscript index 15c48079b..250e7c6ac 100644 --- a/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/shape.tscript +++ b/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/shape.tscript @@ -46,6 +46,23 @@ function AssetBrowser::deleteShapeAsset(%this, %assetDef) } +function AssetBrowser::moveShapeAsset(%this, %assetDef, %destination) +{ + %currentModule = AssetDatabase.getAssetModule(%assetDef.getAssetId()); + %targetModule = AssetBrowser.dirHandler.getModuleFromAddress(%destination); + + %newAssetPath = moveAssetFile(%assetDef, %destination); + + if(%newAssetPath $= "") + return false; + + moveAssetLooseFile(%assetDef.getShapePath(), %destination); + moveAssetLooseFile(%assetDef.getShapeConstructorFilePath(), %destination); + + AssetDatabase.removeDeclaredAsset(%assetDef.getAssetId()); + AssetDatabase.addDeclaredAsset(%targetModule, %newAssetPath); +} + function AssetBrowser::prepareImportShapeAsset(%this, %assetItem) { ImportActivityLog.add("Preparing Shape for Import: " @ %assetItem.assetName); @@ -246,9 +263,12 @@ function AssetBrowser::importShapeAsset(%this, %assetItem) AssetDatabase.refreshAsset(%assetId); } -function AssetBrowser::buildShapeAssetPreview(%this, %assetDef, %previewData) +function AssetBrowser::buildShapeAssetPreview(%this, %assetDef, %previewData, %forcePreviewRegenerate) { - %module = %this.dirHandler.getModuleFromAddress(makeRelativePath(filePath(%assetDef.getShapeFile()))); + if(%forcePreviewRegenerate $= "") + %forcePreviewRegenerate = false; + + %module = %this.dirHandler.getModuleFromAddress(makeRelativePath(filePath(%assetDef.getShapePath()))); %previewPath = "tools/resources/previewCache/" @ %module.moduleId @ "/"; if(!IsDirectory(%previewPath)) @@ -259,14 +279,14 @@ function AssetBrowser::buildShapeAssetPreview(%this, %assetDef, %previewData) %generatePreview = false; %previewFilePath = %previewPath @ %assetDef.assetName @ "_Preview.dds"; - if(!isFile(%previewFilePath) || (compareFileTimes(%assetDef.getShapeFile(), %previewFilePath) == 1)) + if(!isFile(%previewFilePath) || (compareFileTimes(%assetDef.getShapePath(), %previewFilePath) == 1)) { %generatePreview = true; } %previewAssetName = %module.moduleId @ "_" @ %assetDef.assetName @ "_PreviewImage"; - if(%generatePreview) + if(%generatePreview || %forcePreviewRegenerate) { displayEditorLoadingGui("Generating Shape Asset Preview..."); @@ -278,19 +298,22 @@ function AssetBrowser::buildShapeAssetPreview(%this, %assetDef, %previewData) pathCopy(%filePath, %previewFilePath); fileDelete(%filePath); //cleanup - %previewAsset = new ImageAsset() + if(!AssetDatabase.isDeclaredAsset("ToolsModule:" @ %previewAssetName)) { - assetName = %previewAssetName; - versionId = 1; - imageFile = fileName(%previewFilePath); - }; - - %previewImgAssetPath = %previewPath @ %previewAsset.assetName @ ".asset.taml"; - %assetImportSuccessful = TAMLWrite(%previewAsset, %previewImgAssetPath); - - %toolsModuleDef = ModuleDatabase.findModule("ToolsModule",1); + %previewAsset = new ImageAsset() + { + assetName = %previewAssetName; + versionId = 1; + imageFile = fileName(%previewFilePath); + }; - %success = AssetDatabase.addDeclaredAsset(%toolsModuleDef, %previewImgAssetPath); + %previewImgAssetPath = %previewPath @ %previewAsset.assetName @ ".asset.taml"; + %assetImportSuccessful = TAMLWrite(%previewAsset, %previewImgAssetPath); + + %toolsModuleDef = ModuleDatabase.findModule("ToolsModule",1); + + %success = AssetDatabase.addDeclaredAsset(%toolsModuleDef, %previewImgAssetPath); + } hideEditorLoadingGui(); } @@ -313,7 +336,7 @@ function AssetBrowser::buildShapeAssetPreview(%this, %assetDef, %previewData) %previewData.tooltip = "Asset Name: " @ %assetDef.assetName @ "\n" @ "Asset Type: Shape Asset\n" @ "Asset Definition ID: " @ %assetDef @ "\n" @ - "Shape File path: " @ %assetDef.getShapeFile(); + "Shape File path: " @ %assetDef.getShapePath(); if(%this.selectMode) { diff --git a/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/shapeAnimation.tscript b/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/shapeAnimation.tscript index 5e43c126e..bb76e40d0 100644 --- a/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/shapeAnimation.tscript +++ b/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/shapeAnimation.tscript @@ -31,6 +31,22 @@ function AssetBrowser::editShapeAnimationAsset(%this, %assetDef) ShapeEditorPlugin.openShapeAsset(%assetDef); } +function AssetBrowser::moveShapeAnimationAsset(%this, %assetDef, %destination) +{ + %currentModule = AssetDatabase.getAssetModule(%assetDef.getAssetId()); + %targetModule = AssetBrowser.dirHandler.getModuleFromAddress(%destination); + + %newAssetPath = moveAssetFile(%assetDef, %destination); + + if(%newAssetPath $= "") + return false; + + moveAssetLooseFile(%assetDef.getAnimationPath(), %destination); + + AssetDatabase.removeDeclaredAsset(%assetDef.getAssetId()); + AssetDatabase.addDeclaredAsset(%targetModule, %newAssetPath); +} + function AssetBrowser::buildShapeAnimationAssetPreview(%this, %assetDef, %previewData) { %previewData.assetName = %assetDef.animationName; @@ -51,5 +67,5 @@ function AssetBrowser::buildShapeAnimationAssetPreview(%this, %assetDef, %previe %previewData.assetFriendlyName = %assetDef.assetName; %previewData.assetDesc = %assetDef.description; - %previewData.tooltip = %assetDef.friendlyName @ "\n" @ %assetDef @ "\nShape File path: " @ %assetDef.getShapeFile(); + %previewData.tooltip = %assetDef.friendlyName @ "\n" @ %assetDef @ "\nShape File path: " @ %assetDef.getShapePath(); } \ No newline at end of file diff --git a/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/sound.tscript b/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/sound.tscript index 8cc63bdf4..1730e5882 100644 --- a/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/sound.tscript +++ b/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/sound.tscript @@ -11,6 +11,22 @@ function AssetBrowser::onSoundAssetChanged(%this, %assetDef) sfxStop($PreviewSoundSource); } +function AssetBrowser::moveSoundAsset(%this, %assetDef, %destination) +{ + %currentModule = AssetDatabase.getAssetModule(%assetDef.getAssetId()); + %targetModule = AssetBrowser.dirHandler.getModuleFromAddress(%destination); + + %newAssetPath = moveAssetFile(%assetDef, %destination); + + if(%newAssetPath $= "") + return false; + + moveAssetLooseFile(%assetDef.getSoundPath(), %destination); + + AssetDatabase.removeDeclaredAsset(%assetDef.getAssetId()); + AssetDatabase.addDeclaredAsset(%targetModule, %newAssetPath); +} + function AssetBrowser::buildSoundAssetPreview(%this, %assetDef, %previewData) { %previewData.assetName = %assetDef.assetName; diff --git a/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/terrain.tscript b/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/terrain.tscript index c7e8fe92e..9d5d3c5b8 100644 --- a/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/terrain.tscript +++ b/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/terrain.tscript @@ -161,6 +161,22 @@ function AssetBrowser::deleteTerrainAsset(%this, %assetDef) { } +function AssetBrowser::moveTerrainAsset(%this, %assetDef, %destination) +{ + %currentModule = AssetDatabase.getAssetModule(%assetDef.getAssetId()); + %targetModule = AssetBrowser.dirHandler.getModuleFromAddress(%destination); + + %newAssetPath = moveAssetFile(%assetDef, %destination); + + if(%newAssetPath $= "") + return false; + + moveAssetLooseFile(%assetDef.getTerrainFilePath(), %destination); + + AssetDatabase.removeDeclaredAsset(%assetDef.getAssetId()); + AssetDatabase.addDeclaredAsset(%targetModule, %newAssetPath); +} + function AssetBrowser::buildTerrainAssetPreview(%this, %assetDef, %previewData) { %previewData.assetName = %assetDef.assetName; diff --git a/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/terrainMaterial.tscript b/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/terrainMaterial.tscript index 8df0a1fa3..8176d0da0 100644 --- a/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/terrainMaterial.tscript +++ b/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/terrainMaterial.tscript @@ -93,8 +93,27 @@ function AssetBrowser::deleteTerrainMaterialAsset(%this, %assetDef) { } -function AssetBrowser::buildTerrainMaterialAssetPreview(%this, %assetDef, %previewData) +function AssetBrowser::moveTerrainMaterialAsset(%this, %assetDef, %destination) { + %currentModule = AssetDatabase.getAssetModule(%assetDef.getAssetId()); + %targetModule = AssetBrowser.dirHandler.getModuleFromAddress(%destination); + + %newAssetPath = moveAssetFile(%assetDef, %destination); + + if(%newAssetPath $= "") + return false; + + moveAssetLooseFile(%assetDef.getScriptPath(), %destination); + + AssetDatabase.removeDeclaredAsset(%assetDef.getAssetId()); + AssetDatabase.addDeclaredAsset(%targetModule, %newAssetPath); +} + +function AssetBrowser::buildTerrainMaterialAssetPreview(%this, %assetDef, %previewData, %forcePreviewRegenerate) +{ + if(%forcePreviewRegenerate $= "") + %forcePreviewRegenerate = false; + %module = %this.dirHandler.getModuleFromAddress(makeRelativePath(filePath(AssetDatabase.getAssetFilePath(%assetDef.getAssetId())))); %previewPath = "tools/resources/previewCache/" @ %module.moduleId @ "/"; @@ -122,31 +141,35 @@ function AssetBrowser::buildTerrainMaterialAssetPreview(%this, %assetDef, %previ %previewAssetName = %module.moduleId @ "_" @ %assetDef.assetName @ "_PreviewImage"; - if(%generatePreview) + if(%generatePreview || %forcePreviewRegenerate) { displayEditorLoadingGui("Generating Material Asset Preview..."); if(isObject(%assetDef.materialDefinitionName)) { %previewShapeDef = AssetDatabase.acquireAsset("ToolsModule:previewSphereShape"); - %generatedFilePath = %previewShapeDef.generateCachedPreviewImage(256, %assetDef.materialDefinitionName); + %generatedFilePath = %previewShapeDef.generateCachedPreviewImage(256, DummyTerrMatPreview); pathCopy(%generatedFilePath, %previewFilePath); fileDelete(%generatedFilePath); - %previewAsset = new ImageAsset() + + if(!AssetDatabase.isDeclaredAsset("ToolsModule:" @ %previewAssetName)) { - assetName = %previewAssetName; - versionId = 1; - imageFile = fileName(%previewFilePath); - }; - - %previewImgAssetPath = %previewPath @ %previewAsset.assetName @ ".asset.taml"; - %assetImportSuccessful = TAMLWrite(%previewAsset, %previewImgAssetPath); - - %toolsModuleDef = ModuleDatabase.findModule("ToolsModule",1); + %previewAsset = new ImageAsset() + { + assetName = %previewAssetName; + versionId = 1; + imageFile = fileName(%previewFilePath); + }; - %success = AssetDatabase.addDeclaredAsset(%toolsModuleDef, %previewImgAssetPath); + %previewImgAssetPath = %previewPath @ %previewAsset.assetName @ ".asset.taml"; + %assetImportSuccessful = TAMLWrite(%previewAsset, %previewImgAssetPath); + + %toolsModuleDef = ModuleDatabase.findModule("ToolsModule",1); + + %success = AssetDatabase.addDeclaredAsset(%toolsModuleDef, %previewImgAssetPath); + } } hideEditorLoadingGui(); @@ -170,10 +193,14 @@ function AssetBrowser::buildTerrainMaterialAssetPreview(%this, %assetDef, %previ %previewData.assetDesc = %assetDef.description; %previewData.tooltip = %assetDef.gameObjectName; + %definitionPath = %assetDef.getScriptPath(); + if(%definitionPath $= "") + %definitionPath = %assetDef.getFilename(); + %previewData.tooltip = "Asset Name: " @ %assetDef.assetName @ "\nAsset Type: Terrain Material Asset" @ "\nAsset Definition ID: " @ %assetDef @ - "\nDefinition Path: " @ %assetDef.getScriptPath(); + "\nDefinition Path: " @ %definitionPath; } function GuiInspectorTypeTerrainMaterialAssetPtr::onClick( %this, %fieldName ) diff --git a/Templates/BaseGame/game/tools/assetBrowser/scripts/editAsset.tscript b/Templates/BaseGame/game/tools/assetBrowser/scripts/editAsset.tscript index 2d088f27a..6267462ee 100644 --- a/Templates/BaseGame/game/tools/assetBrowser/scripts/editAsset.tscript +++ b/Templates/BaseGame/game/tools/assetBrowser/scripts/editAsset.tscript @@ -111,7 +111,19 @@ function AssetBrowser::refreshAsset(%this, %assetId) } //------------------------------------------------------------ +function AssetBrowser::regeneratePreviewImage(%this) +{ + %assetDef = AssetDatabase.acquireAsset(EditAssetPopup.assetId); + %dummyObj = new ScriptObject(); + %regenCommand = "AssetBrowser.build" @ EditAssetPopup.assetType @ + "Preview(" @%assetDef @ "," @ %dummyObj @ ", true);"; + eval(%regenCommand); + %dummyObj.delete(); + AssetDatabase.releaseAsset(EditAssetPopup.assetId); +} + +//------------------------------------------------------------ function AssetBrowser::renameAsset(%this) { //Find out what type it is diff --git a/Templates/BaseGame/game/tools/assetBrowser/scripts/newAsset.tscript b/Templates/BaseGame/game/tools/assetBrowser/scripts/newAsset.tscript index c402456cd..e3a813862 100644 --- a/Templates/BaseGame/game/tools/assetBrowser/scripts/newAsset.tscript +++ b/Templates/BaseGame/game/tools/assetBrowser/scripts/newAsset.tscript @@ -139,6 +139,19 @@ function newAssetUpdatePath(%newPath) NewAssetTargetModule.text = AssetBrowser.dirHandler.getModuleFromAddress(AssetBrowser.dirHandler.currentAddress).ModuleId; } +// +function NewAssetTargetModule::onSelect(%this, %idx, %idy) +{ + %newModuleName = %this.getText(); + + %currentTargetPath = NewAssetTargetAddress.getText(); + if(!startsWith(%currentTargetPath, "data/" @ %newModuleName @ "/")) + { + NewAssetTargetAddress.setText("data/" @ %newModuleName @ "/"); + } +} + +// //We do a quick validation that mandatory fields are filled in before passing along to the asset-type specific function function CreateNewAsset() { @@ -172,9 +185,41 @@ function CreateNewAsset() return; } + //First, we need to make sure we're not creating a conflicting asset + if(AssetDatabase.isDeclaredAsset(%moduleName @ ":" @ %assetName)) + { + toolsMessageBoxOK( "Error", "An asset with the ID: " @ %moduleName @ ":" @ %assetName + @ " already exists! Please review and rename."); + return; + } + + %assetType = AssetBrowser.newAssetSettings.assetType; + + if(%assetType $= "MaterialAsset" || %assetType $= "TerrainMaterialAsset" || + %assetType $= "GUIAsset") + { + if(isObject(%assetName)) + { + toolsMessageBoxOK( "Error", "Attempted to create a new asset that requires " @ + "a unique name, as the object definition must be unique. " @ + "Please use a new name."); + return; + } + } + + %currentTargetPath = NewAssetTargetAddress.getText(); + %modulePath = makeRelativePath(ModuleDatabase.findModule(%moduleName).ModulePath); + + if(!startsWith(%currentTargetPath, %modulePath)) + { + toolsMessageBoxOK( "Error", "Attempting to create a new asset in an invalid path. " @ + "Please set the target path to be within the target module folder."); + return; + } + + AssetBrowser.newAssetSettings.moduleName = %moduleName; - %assetType = AssetBrowser.newAssetSettings.assetType; if(%assetType $= "") { toolsMessageBoxOK( "Error", "Attempted to make a new asset with no type!"); diff --git a/Templates/BaseGame/game/tools/assetBrowser/scripts/popupMenus.tscript b/Templates/BaseGame/game/tools/assetBrowser/scripts/popupMenus.tscript index 3294387b0..c4f0cca7b 100644 --- a/Templates/BaseGame/game/tools/assetBrowser/scripts/popupMenus.tscript +++ b/Templates/BaseGame/game/tools/assetBrowser/scripts/popupMenus.tscript @@ -28,11 +28,13 @@ function AssetBrowser::buildPopupMenus(%this) item[ 2 ] = "Reload Asset" TAB "" TAB "AssetBrowser.refreshAsset();"; item[ 3 ] = "Asset Properties" TAB "" TAB "AssetBrowser.editAssetInfo();"; item[ 4 ] = "-"; - Item[ 5 ] = "Duplicate Asset" TAB "" TAB "AssetBrowser.duplicateAsset();"; + item[ 5 ] = "Duplicate Asset" TAB "" TAB "AssetBrowser.duplicateAsset();"; item[ 6 ] = "-"; - item[ 7 ] = "Re-Import Asset" TAB "" TAB "AssetBrowser.reImportAsset();"; + item[ 7 ] = "Regenerate Preview Image" TAB "" TAB "AssetBrowser.regeneratePreviewImage();"; item[ 8 ] = "-"; - item[ 9 ] = "Delete Asset" TAB "" TAB "AssetBrowser.deleteAsset();"; + item[ 9 ] = "Re-Import Asset" TAB "" TAB "AssetBrowser.reImportAsset();"; + item[ 10 ] = "-"; + item[ 11 ] = "Delete Asset" TAB "" TAB "AssetBrowser.deleteAsset();"; jumpFileName = ""; jumpLineNumber = ""; @@ -182,7 +184,7 @@ function AssetBrowser::buildPopupMenus(%this) item[9] = "-"; item[10] = "Create New Module" TAB "" TAB "AssetBrowser.CreateNewModule();"; item[11] = "-"; - item[12] = "Import Loose Files" TAB "" TAB "AssetBrowser.importLooseFiles();"; + item[12] = "View Loose Files" TAB "" TAB "AssetBrowser.importLooseFiles();"; }; } diff --git a/Templates/BaseGame/game/tools/forestEditor/forestEditToolbar.ed.gui b/Templates/BaseGame/game/tools/forestEditor/forestEditToolbar.ed.gui index 5590f016e..d5e204bcb 100644 --- a/Templates/BaseGame/game/tools/forestEditor/forestEditToolbar.ed.gui +++ b/Templates/BaseGame/game/tools/forestEditor/forestEditToolbar.ed.gui @@ -110,7 +110,7 @@ $guiContent = new GuiControl(ForestEditToolbar,EditorGuiGroup) { MinExtent = "8 16"; canSave = "1"; Visible = "1"; - AltCommand = "ForestTools->BrushTool.size = $ThisControl.getValue();"; + AltCommand = "ForestTools->BrushTool.size = mClamp($ThisControl.getValue(), 1, getWord(ETerrainEditor.maxBrushSize, 0));"; validate = "ForestEditorGui.validateBrushSize();"; tooltipprofile = "ToolsGuiToolTipProfile"; hovertime = "1000"; diff --git a/Templates/BaseGame/game/tools/forestEditor/forestEditorGui.tscript b/Templates/BaseGame/game/tools/forestEditor/forestEditorGui.tscript index dd88668a1..d039d1c86 100644 --- a/Templates/BaseGame/game/tools/forestEditor/forestEditorGui.tscript +++ b/Templates/BaseGame/game/tools/forestEditor/forestEditorGui.tscript @@ -220,7 +220,7 @@ function selectNewForestMesh(%selectedShapeAssetId) //%str = "datablock TSForestItemData( " @ %name @ " ) { shapeFile = \"" @ %fullPath @ "\"; };"; //eval( %str ); - //%fullPath = AssetDatabase.acquireAsset(%selectedShapeAssetId).getShapeFile(); + //%fullPath = AssetDatabase.acquireAsset(%selectedShapeAssetId).getShapePath(); new TSForestItemData(%name) { shapeAsset = %selectedShapeAssetId; diff --git a/Templates/BaseGame/game/tools/gui/editorSettingsWindow.ed.tscript b/Templates/BaseGame/game/tools/gui/editorSettingsWindow.ed.tscript index 848a625aa..52f7ff309 100644 --- a/Templates/BaseGame/game/tools/gui/editorSettingsWindow.ed.tscript +++ b/Templates/BaseGame/game/tools/gui/editorSettingsWindow.ed.tscript @@ -300,7 +300,7 @@ function ESettingsWindow::getGeneralSettings(%this) SettingsInspector.endGroup(); SettingsInspector.startGroup("Paths"); - SettingsInspector.addSettingsField("WorldEditor/torsionPath", "Torsion Path", "filename", ""); + //SettingsInspector.addSettingsField("WorldEditor/torsionPath", "Torsion Path", "filename", ""); SettingsInspector.endGroup(); SettingsInspector.startGroup("Theme"); diff --git a/Templates/BaseGame/game/tools/gui/images/tab_border.png b/Templates/BaseGame/game/tools/gui/images/tab_border.png index 59703d159..3261e6d8b 100644 Binary files a/Templates/BaseGame/game/tools/gui/images/tab_border.png and b/Templates/BaseGame/game/tools/gui/images/tab_border.png differ diff --git a/Templates/BaseGame/game/tools/guiEditor/scripts/guiEditorCanvas.ed.tscript b/Templates/BaseGame/game/tools/guiEditor/scripts/guiEditorCanvas.ed.tscript index 59df87bd9..f7c373ed7 100644 --- a/Templates/BaseGame/game/tools/guiEditor/scripts/guiEditorCanvas.ed.tscript +++ b/Templates/BaseGame/game/tools/guiEditor/scripts/guiEditorCanvas.ed.tscript @@ -254,9 +254,13 @@ function GuiEditCanvas::onWindowClose(%this) function GuiEditCanvas::create( %this ) { - GuiEditorNewGuiDialog.init( "NewGui", "GuiControl" ); + AssetBrowser.setupCreateNewAsset("GUIAsset", AssetBrowser.selectedModule, "GuiEditCanvas.finishCreateNewGUI"); +} - Canvas.pushDialog( GuiEditorNewGuiDialog ); +function GuiEditCanvas::finishCreateNewGUI(%this, %newGUIAssetId) +{ + %assetDef = AssetDatabase.acquireAsset(%newGUIAssetId); + AssetBrowser.editAsset(%assetDef); } //--------------------------------------------------------------------------------------------- diff --git a/Templates/BaseGame/game/tools/materialEditor/gui/guiMaterialPropertiesWindow.ed.gui b/Templates/BaseGame/game/tools/materialEditor/gui/guiMaterialPropertiesWindow.ed.gui index d1d46b2b1..43351bc82 100644 --- a/Templates/BaseGame/game/tools/materialEditor/gui/guiMaterialPropertiesWindow.ed.gui +++ b/Templates/BaseGame/game/tools/materialEditor/gui/guiMaterialPropertiesWindow.ed.gui @@ -4445,6 +4445,7 @@ $guiContent = new GuiControl(MaterialEditorGui,EditorGuiGroup) { VertSizing = "bottom"; Position = "0 95"; Extent = "212 25"; + visible = "0"; new GuiBitmapCtrl(){ position="2 2"; diff --git a/Templates/BaseGame/game/tools/materialEditor/scripts/materialEditor.ed.tscript b/Templates/BaseGame/game/tools/materialEditor/scripts/materialEditor.ed.tscript index cf2afc7b3..cb093ea21 100644 --- a/Templates/BaseGame/game/tools/materialEditor/scripts/materialEditor.ed.tscript +++ b/Templates/BaseGame/game/tools/materialEditor/scripts/materialEditor.ed.tscript @@ -38,25 +38,34 @@ function MaterialEditorGui::establishMaterials(%this) }; //Material used to preview other materials in the editor. - singleton Material(materialEd_previewMaterial) + if(!isObject(materialEd_previewMaterial)) { - mapTo = "matEd_mappedMat"; - diffuseMapAsset[0] = "ToolsModule:matEd_mappedMat_image"; - }; + singleton Material(materialEd_previewMaterial) + { + mapTo = "matEd_mappedMat"; + diffuseMapAsset[0] = "ToolsModule:matEd_mappedMat_image"; + }; + } - singleton CustomMaterial( materialEd_justAlphaMaterial ) + if(!isObject(materialEd_previewMaterial)) { - mapTo = "matEd_mappedMatB"; - texture[0] = materialEd_previewMaterial.getdiffuseMap(0); - }; + singleton CustomMaterial( materialEd_justAlphaMaterial ) + { + mapTo = "matEd_mappedMatB"; + texture[0] = materialEd_previewMaterial.getdiffuseMap(0); + }; + } - //Custom shader to allow the display of just the alpha channel. - singleton ShaderData( materialEd_justAlphaShader ) + if(!isObject(materialEd_previewMaterial)) { - DXVertexShaderFile = "shaders/alphaOnlyV.hlsl"; - DXPixelShaderFile = "shaders/alphaOnlyP.hlsl"; - pixVersion = 1.0; - }; + //Custom shader to allow the display of just the alpha channel. + singleton ShaderData( materialEd_justAlphaShader ) + { + DXVertexShaderFile = "shaders/alphaOnlyV.hlsl"; + DXPixelShaderFile = "shaders/alphaOnlyP.hlsl"; + pixVersion = 1.0; + }; + } } function MaterialEditorGui::open(%this) @@ -843,6 +852,11 @@ function MaterialEditorGui::guiSync( %this, %material ) MaterialEditorPropertiesWindow-->isSRGBCheckbox.setValue((%material).isSRGB[%layer]); MaterialEditorPropertiesWindow-->invertRoughnessCheckbox.setValue((%material).invertRoughness[%layer]); } + else + { + MaterialEditorPropertiesWindow-->RoughnessSlider.setValue((%material).roughness, true); + MaterialEditorPropertiesWindow-->MetalnessSlider.setValue((%material).metalness, true); + } MaterialEditorPropertiesWindow-->isSRGBCheckbox.setVisible(%hasOrmMap); MaterialEditorPropertiesWindow-->invertRoughnessCheckbox.setVisible(%hasOrmMap); diff --git a/Templates/BaseGame/game/tools/resources/ReflectProbePreviewMat.asset.taml b/Templates/BaseGame/game/tools/resources/ReflectProbePreviewMat.asset.taml index e136ff6b4..746181b76 100644 --- a/Templates/BaseGame/game/tools/resources/ReflectProbePreviewMat.asset.taml +++ b/Templates/BaseGame/game/tools/resources/ReflectProbePreviewMat.asset.taml @@ -9,7 +9,7 @@ mapTo="ReflectProbePreviewMat"> diff --git a/Templates/BaseGame/game/tools/shapeEditor/gui/shapeEdAdvancedWindow.ed.gui b/Templates/BaseGame/game/tools/shapeEditor/gui/shapeEdAdvancedWindow.ed.gui index 5ea1e4072..c98aa777f 100644 --- a/Templates/BaseGame/game/tools/shapeEditor/gui/shapeEdAdvancedWindow.ed.gui +++ b/Templates/BaseGame/game/tools/shapeEditor/gui/shapeEdAdvancedWindow.ed.gui @@ -164,6 +164,7 @@ $guiContent = new GuiWindowCollapseCtrl(ShapeEdAdvancedWindow, EditorGuiGroup) { hovertime = "500"; isContainer = true; internalName = "levelsInactive"; + color = "128 128 128 255"; }; new GuiTextCtrl() { text = "0"; @@ -691,6 +692,7 @@ $guiContent = new GuiWindowCollapseCtrl(ShapeEdAdvancedWindow, EditorGuiGroup) { }; new GuiBitmapCtrl(){ bitmapAsset = "ToolsModule:inactive_overlay_image"; + color = "128 128 128 255"; position = "4 18"; Extent = "193 64"; tooltip = "Imposters must be enabled, and an imposter detail level selected to edit these properties"; diff --git a/Templates/BaseGame/game/tools/shapeEditor/scripts/shapeEditor.ed.tscript b/Templates/BaseGame/game/tools/shapeEditor/scripts/shapeEditor.ed.tscript index f7181fd69..2be4dd630 100644 --- a/Templates/BaseGame/game/tools/shapeEditor/scripts/shapeEditor.ed.tscript +++ b/Templates/BaseGame/game/tools/shapeEditor/scripts/shapeEditor.ed.tscript @@ -1784,7 +1784,7 @@ function ShapeEdSeqFromMenu::onBrowseSelect( %this, %assetId ) %this.setText( %assetId ); %assetDef = AssetDatabase.acquireAsset(%assetId); - %shapePath = %assetDef.getShapeFile(); + %shapePath = %assetDef.getShapePath(); AssetDatabase.releaseAsset(%assetId); ShapeEdSequences.onEditSequenceSource( %shapePath ); @@ -3010,7 +3010,7 @@ function ShapeEditor::autoAddDetails( %this, %dest ) // Determine the base name of the input file (MyShape_LOD in the example above) // and use that to find any other shapes in the set. %assetDef = AssetDatabase.acquireAsset(%dest.baseShapeAsset); - %shapeFile = %assetDef.getShapeFile(); + %shapeFile = %assetDef.getShapePath(); AssetDatabase.releaseAsset(%dest.baseShapeAsset); %base = fileBase( %shapeFile ); @@ -3058,7 +3058,7 @@ function ShapeEditor::addLODFromFile( %this, %dest, %assetId, %size, %allowUnmat { %assetDef = AssetDatabase.acquireAsset(%assetId); %csPath = %assetDef.getShapeConstructorFilePath(); - %filename = %assetDef.getShapeFile(); + %filename = %assetDef.getShapePath(); AssetDatabase.releaseAsset(%assetId); // Get (or create) a TSShapeConstructor object for the source shape. Need to diff --git a/Templates/BaseGame/game/tools/worldEditor/scripts/editors/creator.ed.tscript b/Templates/BaseGame/game/tools/worldEditor/scripts/editors/creator.ed.tscript index fc047c19b..6f57ffd0f 100644 --- a/Templates/BaseGame/game/tools/worldEditor/scripts/editors/creator.ed.tscript +++ b/Templates/BaseGame/game/tools/worldEditor/scripts/editors/creator.ed.tscript @@ -82,6 +82,7 @@ function ObjectCreator::setNewObjectGroup( %this, %group ) %group = %group.getID(); %this.objectGroup = %group; %itemId = EditorTree.findItemByObjectId( %group ); + if(%itemId != -1) EditorTree.markItem( %itemId ); } diff --git a/Templates/BaseGame/game/tools/worldEditor/scripts/editors/terrainEditor.ed.tscript b/Templates/BaseGame/game/tools/worldEditor/scripts/editors/terrainEditor.ed.tscript index 68d03f4e8..b570d3c59 100644 --- a/Templates/BaseGame/game/tools/worldEditor/scripts/editors/terrainEditor.ed.tscript +++ b/Templates/BaseGame/game/tools/worldEditor/scripts/editors/terrainEditor.ed.tscript @@ -136,7 +136,7 @@ function EPainter::updateLayers( %this, %matIndex ) VertSizing = "bottom"; position = ( %listwidth - 20 ) SPC "26"; Extent = "17 17"; - command = "EPainter.showMaterialDeleteDlg( " @ %matInternalName @ " );"; + command = "EPainter.showMaterialDeleteDlg( \"" @ %matInternalName @ "\" );"; }; }; @@ -193,7 +193,7 @@ function EPainter::showMaterialDeleteDlg( %this, %matInternalName ) { toolsMessageBoxYesNo( "Confirmation", "Really remove material '" @ %matInternalName @ "' from the terrain?", - %this @ ".removeMaterial( " @ %matInternalName @ " );", "" ); + %this @ ".removeMaterial( \"" @ %matInternalName @ "\" );", "" ); } function EPainter::removeMaterial( %this, %matInternalName )