Merge pull request #756 from Areloch/MiscFixes20220403

Misc Fixes 2022/04/03
This commit is contained in:
Brian Roberts 2022-04-04 19:41:21 -05:00 committed by GitHub
commit 3b9414b5f9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
49 changed files with 588 additions and 249 deletions

View file

@ -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
//-----------------------------------------------------------------------------

View file

@ -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();
}

View file

@ -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();
}

View file

@ -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();
}

View file

@ -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<Material*>(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")
{

View file

@ -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");

View file

@ -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;

View file

@ -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")

View file

@ -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.

View file

@ -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";

View file

@ -1,8 +0,0 @@
<ImageAsset
canSave="true"
canSaveDynamicFields="true"
AssetName="default_irradiance_image"
imageFile="@assetFile=default_irradiance.dds"
UseMips="true"
isHDRImage="false"
imageType="Albedo" />

View file

@ -1,8 +0,0 @@
<ImageAsset
canSave="true"
canSaveDynamicFields="true"
AssetName="default_prefilter_image"
imageFile="@assetFile=default_prefilter.dds"
UseMips="true"
isHDRImage="false"
imageType="Albedo" />

View file

@ -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;

View file

@ -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 $= "")

View file

@ -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

View file

@ -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();
}
}
}

View file

@ -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);

View file

@ -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);

View file

@ -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);

View file

@ -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);

View file

@ -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);
};
%previewAsset = new ImageAsset()
{
assetName = %previewAssetName;
versionId = 1;
imageFile = fileName(%previewFilePath);
};
%previewAssetName = "ToolsModule:" @ %previewAssetName;
%previewImgAssetPath = %previewPath @ %previewAsset.assetName @ ".asset.taml";
%assetImportSuccessful = TAMLWrite(%previewAsset, %previewImgAssetPath);
%previewAssetName = "ToolsModule:" @ %previewAssetName;
%previewImgAssetPath = %previewPath @ %previewAsset.assetName @ ".asset.taml";
%assetImportSuccessful = TAMLWrite(%previewAsset, %previewImgAssetPath);
%toolsModuleDef = ModuleDatabase.findModule("ToolsModule",1);
%toolsModuleDef = ModuleDatabase.findModule("ToolsModule",1);
%success = AssetDatabase.addDeclaredAsset(%toolsModuleDef, %previewImgAssetPath);
%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);

View file

@ -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);

View file

@ -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);
};
%previewAsset = new ImageAsset()
{
assetName = %previewAssetName;
versionId = 1;
imageFile = fileName(%previewFilePath);
};
%previewImgAssetPath = %previewPath @ %previewAsset.assetName @ ".asset.taml";
%assetImportSuccessful = TAMLWrite(%previewAsset, %previewImgAssetPath);
%previewImgAssetPath = %previewPath @ %previewAsset.assetName @ ".asset.taml";
%assetImportSuccessful = TAMLWrite(%previewAsset, %previewImgAssetPath);
%toolsModuleDef = ModuleDatabase.findModule("ToolsModule",1);
%toolsModuleDef = ModuleDatabase.findModule("ToolsModule",1);
%success = AssetDatabase.addDeclaredAsset(%toolsModuleDef, %previewImgAssetPath);
%success = AssetDatabase.addDeclaredAsset(%toolsModuleDef, %previewImgAssetPath);
}
}
else
{
error("Failed to generate preview for material: " @ %assetDef.materialDefinitionName);
}
hideEditorLoadingGui();
@ -505,10 +514,14 @@ function AssetBrowser::buildMaterialAssetPreview(%this, %assetDef, %previewData)
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)
{

View file

@ -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);

View file

@ -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";

View file

@ -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);
};
%previewAsset = new ImageAsset()
{
assetName = %previewAssetName;
versionId = 1;
imageFile = fileName(%previewFilePath);
};
%previewImgAssetPath = %previewPath @ %previewAsset.assetName @ ".asset.taml";
%assetImportSuccessful = TAMLWrite(%previewAsset, %previewImgAssetPath);
%previewImgAssetPath = %previewPath @ %previewAsset.assetName @ ".asset.taml";
%assetImportSuccessful = TAMLWrite(%previewAsset, %previewImgAssetPath);
%toolsModuleDef = ModuleDatabase.findModule("ToolsModule",1);
%toolsModuleDef = ModuleDatabase.findModule("ToolsModule",1);
%success = AssetDatabase.addDeclaredAsset(%toolsModuleDef, %previewImgAssetPath);
%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)
{

View file

@ -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();
}

View file

@ -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;

View file

@ -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;

View file

@ -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);
};
%previewAsset = new ImageAsset()
{
assetName = %previewAssetName;
versionId = 1;
imageFile = fileName(%previewFilePath);
};
%previewImgAssetPath = %previewPath @ %previewAsset.assetName @ ".asset.taml";
%assetImportSuccessful = TAMLWrite(%previewAsset, %previewImgAssetPath);
%previewImgAssetPath = %previewPath @ %previewAsset.assetName @ ".asset.taml";
%assetImportSuccessful = TAMLWrite(%previewAsset, %previewImgAssetPath);
%toolsModuleDef = ModuleDatabase.findModule("ToolsModule",1);
%toolsModuleDef = ModuleDatabase.findModule("ToolsModule",1);
%success = AssetDatabase.addDeclaredAsset(%toolsModuleDef, %previewImgAssetPath);
%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 )

View file

@ -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

View file

@ -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!");

View file

@ -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();";
};
}

View file

@ -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";

View file

@ -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;

View file

@ -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");

Binary file not shown.

Before

Width:  |  Height:  |  Size: 276 B

After

Width:  |  Height:  |  Size: 8.7 KiB

View file

@ -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);
}
//---------------------------------------------------------------------------------------------

View file

@ -4445,6 +4445,7 @@ $guiContent = new GuiControl(MaterialEditorGui,EditorGuiGroup) {
VertSizing = "bottom";
Position = "0 95";
Extent = "212 25";
visible = "0";
new GuiBitmapCtrl(){
position="2 2";

View file

@ -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);

View file

@ -9,7 +9,7 @@
mapTo="ReflectProbePreviewMat">
<Material.Stages>
<Stages_beginarray
DiffuseMapAsset="ToolsModule:occluderProxyImage_image"
DiffuseMapAsset="Core_Rendering:NoMaterial"
diffuseColor="1 1 1 1"
roughness="0"
metalness="1"/>

View file

@ -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";

View file

@ -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

View file

@ -536,7 +536,7 @@ $guiContent = new GuiControl(TerrainMaterialDlg,EditorGuiGroup) {
profile = "ToolsGuiDefaultProfile";
tooltipProfile = "ToolsGuiToolTipProfile";
};
new GuiContainer(ORMMapContainer) {
new GuiContainer(ORMConfigMapContainer) {
position = "6 314";
extent = "261 64";
horizSizing = "width";
@ -576,7 +576,7 @@ $guiContent = new GuiControl(TerrainMaterialDlg,EditorGuiGroup) {
profile = "ToolsGuiTextProfile";
tooltipProfile = "ToolsGuiToolTipProfile";
isContainer = "0";
internalName = "ORMMapAssetId";
internalName = "ORMConfigMapAssetId";
};
new GuiButtonCtrl() {
text = "Edit";
@ -584,7 +584,7 @@ $guiContent = new GuiControl(TerrainMaterialDlg,EditorGuiGroup) {
extent = "40 16";
horizSizing = "left";
profile = "ToolsGuiButtonProfile";
command = "TerrainMaterialDlg.updateTextureMap(\"OrmConfigMap\");";
command = "TerrainMaterialDlg.updateTextureMap(\"ORMConfigMap\");";
tooltipProfile = "ToolsGuiToolTipProfile";
};
new GuiBitmapButtonCtrl() {

View file

@ -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 );
}

View file

@ -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 )

View file

@ -262,8 +262,8 @@ function TerrainMaterialDlg::clearTextureMap(%this, %mapName)
NormalMapContainer.callOnChildren("setActive", false);
%this.clearTextureMap("NormalMap");
ORMMapContainer.callOnChildren("setActive", false);
%this.clearTextureMap("ORMMap");
ORMConfigMapContainer.callOnChildren("setActive", false);
%this.clearTextureMap("ORMConfigMap");
MacroMapContainer.callOnChildren("setActive", false);
%this.clearTextureMap("MacroMap");
@ -292,7 +292,7 @@ function TerrainMaterialDlg::changeTerrainMatMapAsset(%this)
{
//show the supplemental maps
NormalMapContainer.callOnChildren("setActive", true);
ORMMapContainer.callOnChildren("setActive", true);
ORMConfigMapContainer.callOnChildren("setActive", true);
MacroMapContainer.callOnChildren("setActive", true);
}
}
@ -377,13 +377,13 @@ function TerrainMaterialDlg::activateMaterialCtrls( %this, %active )
if(%this-->texDetailMap.getBitmap() $= "" || %this-->texDetailMap.getBitmap() $= $TerrainMaterialEditor::emptyMaterialImage)
{
NormalMapContainer.callOnChildren("setActive", false);
ORMMapContainer.callOnChildren("setActive", false);
ORMConfigMapContainer.callOnChildren("setActive", false);
MacroMapContainer.callOnChildren("setActive", false);
}
else
{
NormalMapContainer.callOnChildren("setActive", true);
ORMMapContainer.callOnChildren("setActive", true);
ORMConfigMapContainer.callOnChildren("setActive", true);
MacroMapContainer.callOnChildren("setActive", true);
}
}
@ -438,7 +438,7 @@ function TerrainMaterialDlg::setActiveMaterial( %this, %mat )
//
%imgPath = %mat.getORMConfigMap();
%imgPathText = %imgPath !$= "" && %imgPath !$= $TerrainMaterialEditor::emptyMaterialImage ? %mat.getORMConfigMapAsset() : "None";
%this-->ORMMapAssetId.setText( %imgPathText );
%this-->ORMConfigMapAssetId.setText( %imgPathText );
%this-->texORMConfigMap.setBitmap( getAssetPreviewImage(%imgPath) );
//
@ -656,7 +656,7 @@ function TerrainMaterialDlg::saveDirtyMaterial( %this, %materialAssetId )
%newNormal = "";
//---
%newormConfig = %this-->ORMMapAssetId.text;
%newormConfig = %this-->ORMConfigMapAssetId.text;
if(%newormConfig $= "None")
%newormConfig = "";
@ -995,9 +995,9 @@ function NormalMapContainer::onControlDropped( %this, %payload, %position )
terrMatEdDragNDropMapAssignment("NormalMap", %payload);
}
function ORMMapContainer::onControlDropped( %this, %payload, %position )
function ORMConfigMapContainer::onControlDropped( %this, %payload, %position )
{
terrMatEdDragNDropMapAssignment("ORMMap", %payload);
terrMatEdDragNDropMapAssignment("ORMConfigMap", %payload);
}
function MacroMapContainer::onControlDropped( %this, %payload, %position )