mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-01-19 20:24:49 +00:00
Added sanity check to ensure that the requested file to be scaled via saveScaledImage actually exists
Shifts integration of other modules with the OptionsMenu so other modules can inject their own options categories to a callOnModules hook Updated ExampleModule to use new options menu integration angle to show example option Deleted unneeded dropdown_textEdit_image asset def from baseUI Fixed incorrect internal values for the terrainIcon_image asset def that made it present as a redundant terrain material asset Cleaned up old, bad loadFilters calls and replaced them with the proper refresh() calls. Removed old, bad calls for jumping through the asset browser's tree from when it was still hardcoded organization, which cuts down a lot of error spam Cleaned up some of the asset type's preview image assignment code to be more reliable Made terrain materials now use a similar preview proxy shape as regular materials Fixed erroneous duplicate GuiInspectorTypeShapeAssetPtr::onControlDropped, which was breaking drag-n-drop actions of shapeAssets into inspector fields Added proper logic for drag-n-drop actions of imageAssets into inspector fields Add sanity check after creating new asset to avoid redundant attempts at initialization of the new asset Fixed ConvexShape Editor tooling so you can now use the UI to apply the selected material to the selected surface Added tools menu to the menubar with the Project Importer entry so the PI can be launched from either tool Implemented ability to drag-n-drop imageAssets onto MaterialEditor map fields and have it work Implemented ability to drag-n-drop imageAssets onto TerrainMaterial Editor map fields and have it work Made the TerrainMaterial editor dialogue have a non-modal background so you can interact with the editor as normal while it's up Add sanity check to avoid attempting to mark EditorTree items if we couldn't find it's id renamed BaseMap references in terrain material editor to diffuseMap for consistency
This commit is contained in:
parent
05a6a249ea
commit
dff83182e2
|
|
@ -1373,6 +1373,11 @@ DefineEngineFunction(saveScaledImage, bool, (const char* bitmapSource, const cha
|
|||
return false;
|
||||
}
|
||||
|
||||
if (!Platform::isFile(bitmapSource))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
//First, gotta check the extension, as we have some extra work to do if it's
|
||||
//a DDS file
|
||||
const char* ret = dStrrchr(bitmapSource, '.');
|
||||
|
|
|
|||
|
|
@ -204,7 +204,7 @@ void GuiConvexEditorCtrl::setVisible( bool val )
|
|||
mConvexHL = NULL;
|
||||
mFaceHL = -1;
|
||||
|
||||
setSelection( NULL, -1 );
|
||||
setSelection( NULL, -1 );
|
||||
|
||||
WorldEditor *wedit;
|
||||
if ( Sim::findObject( "EWorldEditor", wedit ) )
|
||||
|
|
|
|||
|
|
@ -81,7 +81,6 @@ function ExampleModule::initClient(%this)
|
|||
exec(%prefPath @ "/keybinds." @ $TorqueScriptFileExtension);
|
||||
|
||||
%this.queueExec("./scripts/inputCommands");
|
||||
addOptionsMenuCategory("Example Options", "testExampleOptions();");
|
||||
}
|
||||
|
||||
//This is called when a game session client successfuly connects to a game server.
|
||||
|
|
@ -108,7 +107,17 @@ function ExampleModule::onDestroyClientConnection(%this)
|
|||
ExampleMoveMap.pop();
|
||||
}
|
||||
|
||||
function ExampleModule::populateOptionsMenuCategories(%this)
|
||||
{
|
||||
addOptionsMenuCategory("Example Options", "testExampleOptions();");
|
||||
}
|
||||
|
||||
function testExampleOptions()
|
||||
{
|
||||
OptionsMenuSettingsList.clear();
|
||||
|
||||
OptionName.setText("");
|
||||
OptionDescription.setText("");
|
||||
|
||||
addListOption("Test Option", "This is a test option", $testOptionValue, "OptionA\tOptionB");
|
||||
}
|
||||
|
|
@ -63,6 +63,8 @@ function OptionsMenu::onAdd(%this)
|
|||
addOptionsMenuCategory("Audio", "populateAudioSettingsList();");
|
||||
addOptionsMenuCategory("Keyboard & Mouse", "populateKeyboardMouseSettingsList();");
|
||||
addOptionsMenuCategory("Gamepad", "populateGamepadSettingsList();");
|
||||
|
||||
callOnModules("populateOptionsMenuCategories", "Game");
|
||||
}
|
||||
|
||||
function OptionsMenuSettingsList::onAdd(%this)
|
||||
|
|
@ -900,7 +902,10 @@ function OptionsMenu::onKeybindChanged(%this, %actionMap, %keybind)
|
|||
//
|
||||
function addOptionsMenuCategory(%categoryName, %selectCallback)
|
||||
{
|
||||
OptionsMenu.optionsCategories.add(%categoryName, %selectCallback);
|
||||
//Don't add duplicates!
|
||||
%index = OptionsMenu.optionsCategories.getIndexFromKey(%categoryName);
|
||||
if(%index == -1)
|
||||
OptionsMenu.optionsCategories.add(%categoryName, %selectCallback);
|
||||
}
|
||||
|
||||
function removeOptionsMenuCategory(%categoryName)
|
||||
|
|
|
|||
|
|
@ -1,8 +0,0 @@
|
|||
<ImageAsset
|
||||
canSave="true"
|
||||
canSaveDynamicFields="true"
|
||||
AssetName="dropdown_textEdit_image"
|
||||
imageFile="@assetFile=dropdown-textEdit.png"
|
||||
UseMips="true"
|
||||
isHDRImage="false"
|
||||
imageType="Albedo" />
|
||||
|
|
@ -1,8 +1,8 @@
|
|||
<ImageAsset
|
||||
canSave="true"
|
||||
canSaveDynamicFields="true"
|
||||
AssetName="terrainMaterialIcon_image"
|
||||
imageFile="@assetFile=terrainMaterialIcon.png"
|
||||
AssetName="terrainIcon_image"
|
||||
imageFile="@assetFile=terrainIcon.png"
|
||||
UseMips="true"
|
||||
isHDRImage="false"
|
||||
imageType="Albedo" />
|
||||
|
|
|
|||
|
|
@ -915,13 +915,7 @@ function AssetBrowser::deleteMaterial( %this, %materialName, %secondFilter, %sec
|
|||
AssetBrowserPerMan.saveDirty();
|
||||
}
|
||||
|
||||
AssetBrowser.preloadFilter();
|
||||
}
|
||||
|
||||
function AssetBrowser::thumbnailCountUpdate(%this)
|
||||
{
|
||||
$Pref::AssetBrowser::ThumbnailCountIndex = AssetBrowser-->materialPreviewCountPopup.getSelected();
|
||||
AssetBrowser.LoadFilter( AssetBrowser.currentFilter, AssetBrowser.currentStaticFilter );
|
||||
AssetBrowser.refresh();
|
||||
}
|
||||
|
||||
function AssetBrowser::toggleTagFilterPopup(%this)
|
||||
|
|
|
|||
|
|
@ -54,12 +54,7 @@ function AssetBrowser::createComponentAsset(%this)
|
|||
%moduleDef = ModuleDatabase.findModule(%moduleName, 1);
|
||||
AssetDatabase.addDeclaredAsset(%moduleDef, %tamlpath);
|
||||
|
||||
AssetBrowser.loadFilters();
|
||||
|
||||
%treeItemId = AssetBrowserFilterTree.findItemByName(%moduleName);
|
||||
%smItem = AssetBrowserFilterTree.findChildItemByName(%treeItemId, "ComponentAsset");
|
||||
|
||||
AssetBrowserFilterTree.onSelect(%smItem);
|
||||
AssetBrowser.refresh();
|
||||
|
||||
return %tamlpath;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,12 +28,7 @@ function AssetBrowser::createCubemapAsset(%this)
|
|||
%moduleDef = ModuleDatabase.findModule(%moduleName, 1);
|
||||
AssetDatabase.addDeclaredAsset(%moduleDef, %tamlpath);
|
||||
|
||||
AssetBrowser.loadFilters();
|
||||
|
||||
%treeItemId = AssetBrowserFilterTree.findItemByName(%moduleName);
|
||||
%smItem = AssetBrowserFilterTree.findChildItemByName(%treeItemId, "CubemapAsset");
|
||||
|
||||
AssetBrowserFilterTree.onSelect(%smItem);
|
||||
AssetBrowser.refresh();
|
||||
|
||||
return %tamlpath;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -73,21 +73,10 @@ function AssetBrowser::duplicateGameObjectAsset(%this, %assetDef, %targetModule)
|
|||
AssetDatabase.addDeclaredAsset(%moduleDef, %tamlPath);
|
||||
|
||||
//Refresh the browser
|
||||
AssetBrowser.loadFilters();
|
||||
|
||||
//Ensure our context is set
|
||||
%treeItemId = AssetBrowserFilterTree.findItemByName(%targetModule);
|
||||
%smItem = AssetBrowserFilterTree.findChildItemByName(%treeItemId, "GameObjectAsset");
|
||||
|
||||
AssetBrowserFilterTree.selectItem(%smItem);
|
||||
AssetBrowser.refresh();
|
||||
|
||||
//Rename it for convenience
|
||||
AssetBrowser.performRenameAsset(%assetName, "New" @ %assetName);
|
||||
|
||||
//Expand and refresh the target module
|
||||
AssetBrowserFilterTree.expandItem(%treeItemId,true);
|
||||
|
||||
AssetBrowserFilterTree.buildVisibleTree();
|
||||
}
|
||||
|
||||
//not used
|
||||
|
|
|
|||
|
|
@ -79,12 +79,7 @@ function AssetBrowser::createGUIAsset(%this)
|
|||
%moduleDef = ModuleDatabase.findModule(%moduleName, 1);
|
||||
AssetDatabase.addDeclaredAsset(%moduleDef, %tamlpath);
|
||||
|
||||
AssetBrowser.loadFilters();
|
||||
|
||||
%treeItemId = AssetBrowserFilterTree.findItemByName(%moduleName);
|
||||
%smItem = AssetBrowserFilterTree.findChildItemByName(%treeItemId, "GUIs");
|
||||
|
||||
AssetBrowserFilterTree.onSelect(%smItem);
|
||||
AssetBrowser.refresh();
|
||||
|
||||
return %tamlpath;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -233,13 +233,17 @@ function AssetBrowser::buildImageAssetPreview(%this, %assetDef, %previewData)
|
|||
|
||||
//Revalidate. If it didn't work, just use the default placeholder one
|
||||
if(!isFile(%previewFilePath))
|
||||
%previewAssetName = "ToolsModule:genericAssetIcon_image";
|
||||
{
|
||||
%previewData.previewImage = "ToolsModule:genericAssetIcon_image";
|
||||
}
|
||||
else
|
||||
{
|
||||
%previewData.previewImage = %previewAssetName;
|
||||
}
|
||||
|
||||
%previewData.assetName = %assetDef.assetName;
|
||||
%previewData.assetPath = %assetDef.scriptFile;
|
||||
|
||||
%previewData.previewImage = %previewAssetName;
|
||||
|
||||
%previewData.assetFriendlyName = %assetDef.assetName;
|
||||
%previewData.assetDesc = %assetDef.description;
|
||||
|
||||
|
|
@ -324,7 +328,14 @@ function GuiInspectorTypeImageAssetPtr::onControlDropped( %this, %payload, %posi
|
|||
|
||||
if(%assetType $= "ImageAsset")
|
||||
{
|
||||
echo("DROPPED A IMAGE ON AN IMAGE ASSET COMPONENT FIELD!");
|
||||
%module = %payload.moduleName;
|
||||
%asset = %payload.assetName;
|
||||
|
||||
%oldValue = %this.targetObject.bitmapAsset;
|
||||
%arrayIndex = "";
|
||||
|
||||
%targetObject = %this.targetObject;
|
||||
%targetObject.bitmapAsset = %module @ ":" @ %asset;
|
||||
}
|
||||
|
||||
EWorldEditor.isDirty = true;
|
||||
|
|
|
|||
|
|
@ -61,11 +61,6 @@ function AssetBrowser::createLevelAsset(%this)
|
|||
|
||||
AssetBrowser.refresh();
|
||||
|
||||
%treeItemId = AssetBrowserFilterTree.findItemByName(%moduleName);
|
||||
%smItem = AssetBrowserFilterTree.findChildItemByName(%treeItemId, "Levels");
|
||||
|
||||
AssetBrowserFilterTree.onSelect(%smItem);
|
||||
|
||||
return %tamlpath;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -24,12 +24,7 @@ function AssetBrowser::createMaterialAsset(%this)
|
|||
%moduleDef = ModuleDatabase.findModule(%moduleName, 1);
|
||||
AssetDatabase.addDeclaredAsset(%moduleDef, %tamlpath);
|
||||
|
||||
AssetBrowser.loadFilters();
|
||||
|
||||
%treeItemId = AssetBrowserFilterTree.findItemByName(%moduleName);
|
||||
%smItem = AssetBrowserFilterTree.findChildItemByName(%treeItemId, "Materials");
|
||||
|
||||
AssetBrowserFilterTree.onSelect(%smItem);
|
||||
AssetBrowser.refresh();
|
||||
|
||||
return %tamlpath;
|
||||
}
|
||||
|
|
@ -428,7 +423,7 @@ function AssetBrowser::importMaterialAsset(%this, %assetItem)
|
|||
|
||||
function AssetBrowser::buildMaterialAssetPreview(%this, %assetDef, %previewData)
|
||||
{
|
||||
%module = %this.dirHandler.getModuleFromAddress(makeRelativePath(filePath(%assetDef.getScriptPath())));
|
||||
%module = %this.dirHandler.getModuleFromAddress(makeRelativePath(filePath(AssetDatabase.getAssetFilePath(%assetDef.getAssetId()))));
|
||||
%previewPath = "tools/resources/previewCache/" @ %module.moduleId @ "/";
|
||||
|
||||
if(!IsDirectory(%previewPath))
|
||||
|
|
@ -460,8 +455,8 @@ function AssetBrowser::buildMaterialAssetPreview(%this, %assetDef, %previewData)
|
|||
{
|
||||
displayEditorLoadingGui("Generating Material Asset Preview...");
|
||||
|
||||
if(isObject(%assetDef.materialDefinitionName))
|
||||
{
|
||||
if(isObject(%assetDef.materialDefinitionName))
|
||||
{
|
||||
%previewShapeDef = AssetDatabase.acquireAsset("ToolsModule:previewSphereShape");
|
||||
%generatedFilePath = %previewShapeDef.generateCachedPreviewImage(256, %assetDef.materialDefinitionName);
|
||||
|
||||
|
|
@ -488,13 +483,17 @@ function AssetBrowser::buildMaterialAssetPreview(%this, %assetDef, %previewData)
|
|||
|
||||
//Revalidate. If it didn't work, just use the default placeholder one
|
||||
if(!isFile(%previewFilePath))
|
||||
%previewAssetName = "ToolsModule:materialIcon_image";
|
||||
{
|
||||
%previewData.previewImage = "ToolsModule:materialIcon_image";
|
||||
}
|
||||
else
|
||||
{
|
||||
%previewData.previewImage = "ToolsModule:" @ %previewAssetName;
|
||||
}
|
||||
|
||||
%previewData.assetName = %assetDef.assetName;
|
||||
%previewData.assetPath = %assetDef.scriptFile;
|
||||
|
||||
%previewData.previewImage = "ToolsModule:" @ %previewAssetName;//%assetDef.fileName;
|
||||
|
||||
%previewData.assetFriendlyName = %assetDef.assetName;
|
||||
%previewData.assetDesc = %assetDef.description;
|
||||
|
||||
|
|
|
|||
|
|
@ -26,12 +26,7 @@ function AssetBrowser::createShapeAsset(%this)
|
|||
%moduleDef = ModuleDatabase.findModule(%moduleName, 1);
|
||||
AssetDatabase.addDeclaredAsset(%moduleDef, %tamlpath);
|
||||
|
||||
AssetBrowser.loadFilters();
|
||||
|
||||
%treeItemId = AssetBrowserFilterTree.findItemByName(%moduleName);
|
||||
%smItem = AssetBrowserFilterTree.findChildItemByName(%treeItemId, "ShapeAsset");
|
||||
|
||||
AssetBrowserFilterTree.onSelect(%smItem);
|
||||
AssetBrowser.refresh();
|
||||
|
||||
return %tamlpath;
|
||||
}
|
||||
|
|
@ -302,13 +297,17 @@ function AssetBrowser::buildShapeAssetPreview(%this, %assetDef, %previewData)
|
|||
|
||||
//Revalidate. If it didn't work, just use the default placeholder one
|
||||
if(!isFile(%previewFilePath))
|
||||
%previewAssetName = "ToolsModule:genericAssetIcon_image";
|
||||
{
|
||||
%previewData.previewImage = "ToolsModule:genericAssetIcon_image";
|
||||
}
|
||||
else
|
||||
{
|
||||
%previewData.previewImage = "ToolsModule:" @ %previewAssetName;
|
||||
}
|
||||
|
||||
%previewData.assetName = %assetDef.assetName;
|
||||
%previewData.assetPath = %assetDef.fileName;
|
||||
|
||||
%previewData.previewImage = "ToolsModule:" @ %previewAssetName;//%assetDef.fileName;
|
||||
|
||||
%previewData.assetFriendlyName = %assetDef.assetName;
|
||||
%previewData.assetDesc = %assetDef.description;
|
||||
%previewData.tooltip = "Asset Name: " @ %assetDef.assetName @ "\n" @
|
||||
|
|
|
|||
|
|
@ -75,7 +75,7 @@ function AssetBrowser::onSoundAssetEditorDropped(%this, %assetDef, %position)
|
|||
|
||||
}
|
||||
|
||||
function GuiInspectorTypeShapeAssetPtr::onControlDropped( %this, %payload, %position )
|
||||
function GuiInspectorTypeSoundAssetPtr::onControlDropped( %this, %payload, %position )
|
||||
{
|
||||
Canvas.popDialog(EditorDragAndDropLayer);
|
||||
|
||||
|
|
|
|||
|
|
@ -47,12 +47,7 @@ function AssetBrowser::createStateMachineAsset(%this)
|
|||
%moduleDef = ModuleDatabase.findModule(%moduleName, 1);
|
||||
AssetDatabase.addDeclaredAsset(%moduleDef, %tamlpath);
|
||||
|
||||
AssetBrowser.loadFilters();
|
||||
|
||||
%treeItemId = AssetBrowserFilterTree.findItemByName(%moduleName);
|
||||
%smItem = AssetBrowserFilterTree.findChildItemByName(%treeItemId, "StateMachines");
|
||||
|
||||
AssetBrowserFilterTree.onSelect(%smItem);
|
||||
AssetBrowser.refresh();
|
||||
|
||||
return %tamlpath;
|
||||
}
|
||||
|
|
@ -123,21 +118,10 @@ function AssetBrowser::duplicateStateMachineAsset(%this, %assetDef)
|
|||
AssetDatabase.addDeclaredAsset(%moduleDef, %tamlPath);
|
||||
|
||||
//Refresh the browser
|
||||
AssetBrowser.loadFilters();
|
||||
|
||||
//Ensure our context is set
|
||||
%treeItemId = AssetBrowserFilterTree.findItemByName(%targetModule);
|
||||
%smItem = AssetBrowserFilterTree.findChildItemByName(%treeItemId, "StateMachineAsset");
|
||||
|
||||
AssetBrowserFilterTree.selectItem(%smItem);
|
||||
AssetBrowser.refresh();
|
||||
|
||||
//Rename it for convenience
|
||||
AssetBrowser.performRenameAsset(%assetName, "New" @ %assetName);
|
||||
|
||||
//Expand and refresh the target module
|
||||
AssetBrowserFilterTree.expandItem(%treeItemId,true);
|
||||
|
||||
AssetBrowserFilterTree.buildVisibleTree();
|
||||
}
|
||||
|
||||
function AssetBrowser::renameGameObjectAsset(%this, %assetDef, %newAssetId, %originalName, %newName)
|
||||
|
|
|
|||
|
|
@ -91,15 +91,85 @@ function AssetBrowser::deleteTerrainMaterialAsset(%this, %assetDef)
|
|||
|
||||
function AssetBrowser::buildTerrainMaterialAssetPreview(%this, %assetDef, %previewData)
|
||||
{
|
||||
%module = %this.dirHandler.getModuleFromAddress(makeRelativePath(filePath(AssetDatabase.getAssetFilePath(%assetDef.getAssetId()))));
|
||||
%previewPath = "tools/resources/previewCache/" @ %module.moduleId @ "/";
|
||||
|
||||
if(!IsDirectory(%previewPath))
|
||||
{
|
||||
%this.dirHandler.createFolder(%previewPath);
|
||||
}
|
||||
|
||||
%generatePreview = false;
|
||||
|
||||
%previewFilePath = %previewPath @ %assetDef.assetName @ "_Preview.dds";
|
||||
if(!isFile(%previewFilePath))
|
||||
{
|
||||
%generatePreview = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(isObject(%assetDef.materialDefinitionName))
|
||||
{
|
||||
if(compareFileTimes(%assetDef.materialDefinitionName.getDiffuseMap(), %previewFilePath) == 1 ||
|
||||
compareFileTimes(%assetDef.materialDefinitionName.getFilename(), %previewFilePath) == 1)
|
||||
%generatePreview = true;
|
||||
}
|
||||
}
|
||||
|
||||
%previewAssetName = %module.moduleId @ "_" @ %assetDef.assetName @ "_PreviewImage";
|
||||
|
||||
if(%generatePreview)
|
||||
{
|
||||
displayEditorLoadingGui("Generating Material Asset Preview...");
|
||||
|
||||
if(isObject(%assetDef.materialDefinitionName))
|
||||
{
|
||||
%previewShapeDef = AssetDatabase.acquireAsset("ToolsModule:previewSphereShape");
|
||||
%generatedFilePath = %previewShapeDef.generateCachedPreviewImage(256, %assetDef.materialDefinitionName);
|
||||
|
||||
pathCopy(%generatedFilePath, %previewFilePath);
|
||||
fileDelete(%generatedFilePath);
|
||||
|
||||
%previewAsset = new ImageAsset()
|
||||
{
|
||||
assetName = %previewAssetName;
|
||||
versionId = 1;
|
||||
imageFile = fileName(%previewFilePath);
|
||||
};
|
||||
|
||||
%previewImgAssetPath = %previewPath @ %previewAsset.assetName @ ".asset.taml";
|
||||
%assetImportSuccessful = TAMLWrite(%previewAsset, %previewImgAssetPath);
|
||||
|
||||
%toolsModuleDef = ModuleDatabase.findModule("ToolsModule",1);
|
||||
|
||||
%success = AssetDatabase.addDeclaredAsset(%toolsModuleDef, %previewImgAssetPath);
|
||||
}
|
||||
|
||||
hideEditorLoadingGui();
|
||||
}
|
||||
|
||||
//Revalidate. If it didn't work, just use the default placeholder one
|
||||
if(!isFile(%previewFilePath))
|
||||
{
|
||||
%previewData.previewImage = "ToolsModule:terrainMaterialIcon_image";
|
||||
}
|
||||
else
|
||||
{
|
||||
%previewData.previewImage = "ToolsModule:" @ %previewAssetName;
|
||||
}
|
||||
|
||||
%previewData.assetName = %assetDef.assetName;
|
||||
%previewData.assetPath = "";
|
||||
%previewData.doubleClickCommand = "";
|
||||
|
||||
%previewData.previewImage = "ToolsModule:terrainMaterialIcon_image";
|
||||
|
||||
%previewData.assetFriendlyName = %assetDef.gameObjectName;
|
||||
%previewData.assetDesc = %assetDef.description;
|
||||
%previewData.tooltip = %assetDef.gameObjectName;
|
||||
|
||||
%previewData.tooltip = "Asset Name: " @ %assetDef.assetName @
|
||||
"\nAsset Type: Terrain Material Asset" @
|
||||
"\nAsset Definition ID: " @ %assetDef @
|
||||
"\nDefinition Path: " @ %assetDef.getScriptPath();
|
||||
}
|
||||
|
||||
function GuiInspectorTypeTerrainMaterialAssetPtr::onClick( %this, %fieldName )
|
||||
|
|
|
|||
|
|
@ -163,7 +163,7 @@ function AssetBrowser::performRenameAsset(%this, %originalAssetName, %newName)
|
|||
%ModuleItem = AssetBrowser-->filterTree.findItemByName(%moduleName);
|
||||
|
||||
// TODO is this correct?
|
||||
%assetType = %ModuleItem.getClassName();
|
||||
/*%assetType = %ModuleItem.getClassName();
|
||||
|
||||
%assetTypeId = AssetBrowser-->filterTree.findChildItemByName(%ModuleItem, %assetType);
|
||||
|
||||
|
|
@ -172,7 +172,7 @@ function AssetBrowser::performRenameAsset(%this, %originalAssetName, %newName)
|
|||
%selectedItem = AssetBrowser-->filterTree.getSelectedItem();
|
||||
AssetBrowser-->filterTree.scrollVisibleByObjectId(%selectedItem);
|
||||
|
||||
AssetBrowser-->filterTree.buildVisibleTree();
|
||||
AssetBrowser-->filterTree.buildVisibleTree();*/
|
||||
}
|
||||
|
||||
function renameAssetFile(%assetDef, %newName)
|
||||
|
|
|
|||
|
|
@ -182,11 +182,14 @@ function CreateNewAsset()
|
|||
Canvas.popDialog(AssetBrowser_newAsset);
|
||||
|
||||
//Load it
|
||||
%moduleDef = ModuleDatabase.findModule(%moduleName,1);
|
||||
AssetDatabase.addDeclaredAsset(%moduleDef, %assetFilePath);
|
||||
//For utilities' sake, we'll acquire it immediately so it can be utilized
|
||||
//without delay if it's got any script/dependencies stuff
|
||||
AssetDatabase.acquireAsset("\"" @ %moduleName @ ":" @ %assetName @ "\"");
|
||||
if(!AssetDatabase.isDeclaredAsset(%moduleName @ ":" @ %assetName))
|
||||
{
|
||||
%moduleDef = ModuleDatabase.findModule(%moduleName,1);
|
||||
AssetDatabase.addDeclaredAsset(%moduleDef, %assetFilePath);
|
||||
//For utilities' sake, we'll acquire it immediately so it can be utilized
|
||||
//without delay if it's got any script/dependencies stuff
|
||||
AssetDatabase.acquireAsset("\"" @ %moduleName @ ":" @ %assetName @ "\"");
|
||||
}
|
||||
|
||||
if(AssetBrowser_newAsset.callbackFunc !$= "")
|
||||
{
|
||||
|
|
|
|||
|
|
@ -179,7 +179,7 @@ function ConvexEditorMaterialBtn::gotMaterialName(%this, %name)
|
|||
|
||||
ConvexEditorOptionsWindow-->matPreviewBtn.setBitmap(getAssetPreviewImage(%diffusemap));
|
||||
|
||||
ConvexEditorOptionsWindow.activeMaterial = %materialAsset.materialDefinitionName;
|
||||
ConvexEditorOptionsWindow.activeMaterial = %materialAsset.getAssetId();
|
||||
}
|
||||
|
||||
function ConvexEditorMaterialApplyBtn::onClick(%this)
|
||||
|
|
|
|||
|
|
@ -187,6 +187,15 @@ function GuiEditCanvas::onCreateMenu(%this)
|
|||
item[9] = "Clear Guides" TAB "" TAB "GuiEditor.clearGuides();";
|
||||
};
|
||||
|
||||
new PopupMenu()
|
||||
{
|
||||
superClass = "MenuBuilder";
|
||||
barTitle = "Tools";
|
||||
internalName = "ToolsMenu";
|
||||
|
||||
item[0] = "Project Importer" TAB "" TAB "ProjectImporter::beginProjectImport();";
|
||||
};
|
||||
|
||||
new PopupMenu()
|
||||
{
|
||||
superClass = "MenuBuilder";
|
||||
|
|
|
|||
|
|
@ -260,6 +260,7 @@ $guiContent = new GuiControl(MaterialEditorGui,EditorGuiGroup) {
|
|||
position = "6 21";
|
||||
Extent = "185 52";
|
||||
HorizSizing = "width";
|
||||
className = "materialEditorDiffuseMapContainer";
|
||||
|
||||
new GuiBitmapCtrl() {
|
||||
canSaveDynamicFields = "0";
|
||||
|
|
@ -412,6 +413,7 @@ $guiContent = new GuiControl(MaterialEditorGui,EditorGuiGroup) {
|
|||
position = "6 79";
|
||||
Extent = "185 52";
|
||||
HorizSizing = "width";
|
||||
className = "materialEditorNormalMapContainer";
|
||||
|
||||
new GuiBitmapCtrl() {
|
||||
canSaveDynamicFields = "0";
|
||||
|
|
@ -764,6 +766,7 @@ $guiContent = new GuiControl(MaterialEditorGui,EditorGuiGroup) {
|
|||
position = "6 364";
|
||||
Extent = "185 52";
|
||||
HorizSizing = "width";
|
||||
className = "materialEditorORMConfigMapContainer";
|
||||
|
||||
new GuiBitmapCtrl() {
|
||||
canSaveDynamicFields = "0";
|
||||
|
|
@ -985,6 +988,7 @@ $guiContent = new GuiControl(MaterialEditorGui,EditorGuiGroup) {
|
|||
isContainer = "1";
|
||||
canSave = "1";
|
||||
canSaveDynamicFields = "0";
|
||||
className = "materialEditorRoughnessMapContainer";
|
||||
|
||||
new GuiBitmapCtrl() {
|
||||
bitmapAsset = "ToolsModule:unknownImage_image";
|
||||
|
|
@ -1221,6 +1225,7 @@ $guiContent = new GuiControl(MaterialEditorGui,EditorGuiGroup) {
|
|||
isContainer = "1";
|
||||
canSave = "1";
|
||||
canSaveDynamicFields = "0";
|
||||
className = "materialEditorAOMapContainer";
|
||||
|
||||
new GuiBitmapCtrl() {
|
||||
bitmapAsset = "ToolsModule:unknownImage_image";
|
||||
|
|
@ -1457,6 +1462,7 @@ $guiContent = new GuiControl(MaterialEditorGui,EditorGuiGroup) {
|
|||
isContainer = "1";
|
||||
canSave = "1";
|
||||
canSaveDynamicFields = "0";
|
||||
className = "materialEditorMetalMapContainer";
|
||||
|
||||
new GuiBitmapCtrl() {
|
||||
bitmapAsset = "ToolsModule:unknownImage_image";
|
||||
|
|
@ -1710,6 +1716,8 @@ $guiContent = new GuiControl(MaterialEditorGui,EditorGuiGroup) {
|
|||
isContainer = "1";
|
||||
canSave = "1";
|
||||
canSaveDynamicFields = "0";
|
||||
className = "materialEditorGlowMapContainer";
|
||||
|
||||
new GuiBitmapCtrl() {
|
||||
bitmapAsset = "ToolsModule:unknownImage_image";
|
||||
wrap = "0";
|
||||
|
|
@ -1945,6 +1953,7 @@ $guiContent = new GuiControl(MaterialEditorGui,EditorGuiGroup) {
|
|||
position = "6 193";
|
||||
Extent = "185 52";
|
||||
HorizSizing = "width";
|
||||
className = "materialEditorDetailMapContainer";
|
||||
|
||||
new GuiBitmapCtrl() {
|
||||
canSaveDynamicFields = "0";
|
||||
|
|
@ -2090,6 +2099,7 @@ $guiContent = new GuiControl(MaterialEditorGui,EditorGuiGroup) {
|
|||
position = "6 136";
|
||||
Extent = "185 52";
|
||||
HorizSizing = "width";
|
||||
className = "materialEditorDetailNormalMapContainer";
|
||||
|
||||
new GuiBitmapCtrl() {
|
||||
canSaveDynamicFields = "0";
|
||||
|
|
@ -2235,6 +2245,7 @@ $guiContent = new GuiControl(MaterialEditorGui,EditorGuiGroup) {
|
|||
position = "6 136";
|
||||
Extent = "185 52";
|
||||
HorizSizing = "width";
|
||||
className = "materialEditorOverlayMapContainer";
|
||||
|
||||
new GuiBitmapCtrl() {
|
||||
canSaveDynamicFields = "0";
|
||||
|
|
@ -2361,6 +2372,7 @@ $guiContent = new GuiControl(MaterialEditorGui,EditorGuiGroup) {
|
|||
position = "6 250";
|
||||
Extent = "185 52";
|
||||
HorizSizing = "width";
|
||||
className = "materialEditorLightMapContainer";
|
||||
|
||||
new GuiBitmapCtrl() {
|
||||
canSaveDynamicFields = "0";
|
||||
|
|
@ -2487,6 +2499,7 @@ $guiContent = new GuiControl(MaterialEditorGui,EditorGuiGroup) {
|
|||
position = "6 307";
|
||||
Extent = "185 52";
|
||||
HorizSizing = "width";
|
||||
className = "materialEditorToneMapContainer";
|
||||
|
||||
new GuiBitmapCtrl() {
|
||||
canSaveDynamicFields = "0";
|
||||
|
|
|
|||
|
|
@ -1174,8 +1174,8 @@ function MaterialEditorGui::updateTextureMap( %this, %type, %action )
|
|||
function MaterialEditorGui::doUpdateTextureMap( %this, %assetId )
|
||||
{
|
||||
if(%assetId !$= "")
|
||||
{
|
||||
%layer = MaterialEditorGui.currentLayer;
|
||||
{
|
||||
%layer = MaterialEditorGui.currentLayer;
|
||||
|
||||
%type = %this.updatingTextureType;
|
||||
|
||||
|
|
@ -2420,3 +2420,81 @@ function MaterialEditorGui::doSwapMaterial(%this, %materialAsset)
|
|||
{
|
||||
MaterialEditorGui.showMaterialChangeSaveDialog(%materialAsset);
|
||||
}
|
||||
|
||||
//
|
||||
//
|
||||
function matEdDragNDropMapAssignment(%type, %payload)
|
||||
{
|
||||
%assetType = %payload.assetType;
|
||||
if(%assetType !$= "ImageAsset")
|
||||
return;
|
||||
|
||||
%module = %payload.moduleName;
|
||||
%assetName = %payload.assetName;
|
||||
%assetId = %module @ ":" @ %assetName;
|
||||
|
||||
MaterialEditorGui.updatingTextureType = %type;
|
||||
MaterialEditorGui.guiSync( materialEd_previewMaterial );
|
||||
|
||||
MaterialEditorGui.doUpdateTextureMap( %assetId );
|
||||
}
|
||||
|
||||
function materialEditorDiffuseMapContainer::onControlDropped( %this, %payload, %position )
|
||||
{
|
||||
matEdDragNDropMapAssignment("Diffuse", %payload);
|
||||
}
|
||||
|
||||
function materialEditorNormalMapContainer::onControlDropped( %this, %payload, %position )
|
||||
{
|
||||
matEdDragNDropMapAssignment("Normal", %payload);
|
||||
}
|
||||
|
||||
function materialEditorORMConfigMapContainer::onControlDropped( %this, %payload, %position )
|
||||
{
|
||||
matEdDragNDropMapAssignment("ORMConfig", %payload);
|
||||
}
|
||||
|
||||
function materialEditorRoughnessMapContainer::onControlDropped( %this, %payload, %position )
|
||||
{
|
||||
matEdDragNDropMapAssignment("Roughness", %payload);
|
||||
}
|
||||
|
||||
function materialEditorAOMapContainer::onControlDropped( %this, %payload, %position )
|
||||
{
|
||||
matEdDragNDropMapAssignment("AO", %payload);
|
||||
}
|
||||
|
||||
function materialEditorMetalMapContainer::onControlDropped( %this, %payload, %position )
|
||||
{
|
||||
matEdDragNDropMapAssignment("Metal", %payload);
|
||||
}
|
||||
|
||||
function materialEditorGlowMapContainer::onControlDropped( %this, %payload, %position )
|
||||
{
|
||||
matEdDragNDropMapAssignment("Glow", %payload);
|
||||
}
|
||||
|
||||
function materialEditorDetailMapContainer::onControlDropped( %this, %payload, %position )
|
||||
{
|
||||
matEdDragNDropMapAssignment("Detail", %payload);
|
||||
}
|
||||
|
||||
function materialEditorDetailNormalMapContainer::onControlDropped( %this, %payload, %position )
|
||||
{
|
||||
matEdDragNDropMapAssignment("DetailNormal", %payload);
|
||||
}
|
||||
|
||||
function materialEditorOverlayMapContainer::onControlDropped( %this, %payload, %position )
|
||||
{
|
||||
matEdDragNDropMapAssignment("Overlay", %payload);
|
||||
}
|
||||
|
||||
function materialEditorLightMapContainer::onControlDropped( %this, %payload, %position )
|
||||
{
|
||||
matEdDragNDropMapAssignment("Light", %payload);
|
||||
}
|
||||
|
||||
function materialEditorToneMapContainer::onControlDropped( %this, %payload, %position )
|
||||
{
|
||||
matEdDragNDropMapAssignment("Tone", %payload);
|
||||
}
|
||||
|
|
@ -5,7 +5,7 @@ $guiContent = new GuiControl(TerrainMaterialDlg,EditorGuiGroup) {
|
|||
minExtent = "8 2";
|
||||
horizSizing = "right";
|
||||
vertSizing = "bottom";
|
||||
profile = "ToolsGuiDefaultProfile";
|
||||
profile = "ToolsGuiDefaultNonModalProfile";
|
||||
visible = "1";
|
||||
active = "1";
|
||||
tooltipProfile = "ToolsGuiToolTipProfile";
|
||||
|
|
@ -256,7 +256,7 @@ $guiContent = new GuiControl(TerrainMaterialDlg,EditorGuiGroup) {
|
|||
canSave = "1";
|
||||
canSaveDynamicFields = "0";
|
||||
};
|
||||
new GuiContainer(BaseMapContainer) {
|
||||
new GuiContainer(DiffuseMapContainer) {
|
||||
margin = "0 0 0 0";
|
||||
padding = "0 0 0 0";
|
||||
anchorTop = "1";
|
||||
|
|
@ -312,7 +312,7 @@ $guiContent = new GuiControl(TerrainMaterialDlg,EditorGuiGroup) {
|
|||
tooltipProfile = "ToolsGuiToolTipProfile";
|
||||
hovertime = "1000";
|
||||
isContainer = "0";
|
||||
internalName = "texBaseMap";
|
||||
internalName = "texDiffuseMap";
|
||||
canSave = "1";
|
||||
canSaveDynamicFields = "0";
|
||||
};
|
||||
|
|
@ -334,7 +334,7 @@ $guiContent = new GuiControl(TerrainMaterialDlg,EditorGuiGroup) {
|
|||
profile = "ToolsGuiDefaultProfile";
|
||||
visible = "1";
|
||||
active = "1";
|
||||
command = "TerrainMaterialDlg.updateTextureMap(\"BaseMap\");";
|
||||
command = "TerrainMaterialDlg.updateTextureMap(\"DiffuseMap\");";
|
||||
tooltipProfile = "ToolsGuiDefaultProfile";
|
||||
tooltip = "Change the Active Diffuse Map for this layer";
|
||||
hovertime = "1000";
|
||||
|
|
@ -402,7 +402,7 @@ $guiContent = new GuiControl(TerrainMaterialDlg,EditorGuiGroup) {
|
|||
profile = "ToolsGuiButtonProfile";
|
||||
visible = "1";
|
||||
active = "1";
|
||||
command = "TerrainMaterialDlg.updateTextureMap(\"BaseMap\");";
|
||||
command = "TerrainMaterialDlg.updateTextureMap(\"DiffuseMap\");";
|
||||
tooltipProfile = "ToolsGuiToolTipProfile";
|
||||
hovertime = "1000";
|
||||
isContainer = "0";
|
||||
|
|
@ -427,7 +427,7 @@ $guiContent = new GuiControl(TerrainMaterialDlg,EditorGuiGroup) {
|
|||
profile = "ToolsGuiDefaultProfile";
|
||||
visible = "1";
|
||||
active = "1";
|
||||
command = "TerrainMaterialDlg.clearTextureMap(\"BaseMap\");";
|
||||
command = "TerrainMaterialDlg.clearTextureMap(\"DiffuseMap\");";
|
||||
tooltipProfile = "ToolsGuiToolTipProfile";
|
||||
hovertime = "1000";
|
||||
isContainer = "0";
|
||||
|
|
|
|||
|
|
@ -2313,11 +2313,13 @@ function EWorldEditor::SetActiveScene(%this, %sceneObj)
|
|||
{
|
||||
$ActiveEditingScene.isEditing = false;
|
||||
%itemId = EditorTree.findItemByObjectId($ActiveScene);
|
||||
EditorTree.markItem(%itemId);
|
||||
if(%itemId != -1)
|
||||
EditorTree.markItem(%itemId);
|
||||
}
|
||||
|
||||
%itemId = EditorTree.findItemByObjectId(%sceneObj);
|
||||
EditorTree.markItem(%itemId);
|
||||
if(%itemId != -1)
|
||||
EditorTree.markItem(%itemId);
|
||||
|
||||
$ActiveEditingScene = %sceneObj;
|
||||
$ActiveEditingScene.isEditing = true;
|
||||
|
|
|
|||
|
|
@ -269,27 +269,27 @@ function TerrainMaterialDlg::changeTerrainMatMapAsset(%this)
|
|||
|
||||
%imgAsset = AssetBrowser.selectedAsset;
|
||||
if(%imgAsset !$= "")
|
||||
{
|
||||
{
|
||||
%targetMap.asset = %imgAsset;
|
||||
%image = %imgAsset;
|
||||
|
||||
if(%this.updateTargetMap $= "DetailMap")
|
||||
{
|
||||
{
|
||||
//show the supplemental maps
|
||||
NormalMapContainer.callOnChildren("setActive", true);
|
||||
ORMMapContainer.callOnChildren("setActive", true);
|
||||
MacroMapContainer.callOnChildren("setActive", true);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
%image = $TerrainMaterialEditor::emptyMaterialImage;
|
||||
}
|
||||
|
||||
%targetMap.setBitmap( getAssetPreviewImage(%image) );
|
||||
|
||||
%targetMapName = %targetMap @ "AssetId";
|
||||
%targetMapName.setText(%imgAsset);
|
||||
%targetMapNameText = %this.findObjectByInternalName(%this.updateTargetMap @ "AssetId", true);
|
||||
%targetMapNameText.setText(%imgAsset);
|
||||
|
||||
TerrainMaterialDlg.matDirty = true;
|
||||
}
|
||||
|
|
@ -412,7 +412,7 @@ function TerrainMaterialDlg::setActiveMaterial( %this, %mat )
|
|||
%imgPath = %mat.getDiffuseMap();
|
||||
%imgPathText = %imgPath !$= "" && %imgPath !$= $TerrainMaterialEditor::emptyMaterialImage ? %mat.getDiffuseMapAsset() : "None";
|
||||
%this-->diffuseMapAssetId.setText( %imgPathText );
|
||||
%this-->texBaseMap.setBitmap( getAssetPreviewImage(%imgPath) );
|
||||
%this-->texDiffuseMap.setBitmap( getAssetPreviewImage(%imgPath) );
|
||||
|
||||
//
|
||||
%imgPath = %mat.getNormalMap();
|
||||
|
|
@ -487,7 +487,7 @@ function TerrainMaterialDlg::saveDirtyMaterial( %this, %mat )
|
|||
|
||||
|
||||
//---
|
||||
%newDiffuse = %this-->texBaseMap.getBitmap();
|
||||
%newDiffuse = %this-->texDiffuseMap.getBitmap();
|
||||
if(%newDiffuse $= $TerrainMaterialEditor::emptyMaterialImage || %newDiffuse $= %blankBitmap)
|
||||
%newDiffuse = "";
|
||||
|
||||
|
|
@ -741,3 +741,45 @@ function TerrainMaterialDlgBlendHeightContrastTextEdit::onValidate(%this)
|
|||
TerrainMaterialDlg.activeMat.blendHeightContrast = %this.getText();
|
||||
TerrainMaterialDlg.matDirty = true;
|
||||
}
|
||||
|
||||
//
|
||||
//
|
||||
function terrMatEdDragNDropMapAssignment(%mapName, %payload)
|
||||
{
|
||||
%assetType = %payload.assetType;
|
||||
if(%assetType !$= "ImageAsset")
|
||||
return;
|
||||
|
||||
%module = %payload.moduleName;
|
||||
%assetName = %payload.assetName;
|
||||
%assetId = %module @ ":" @ %assetName;
|
||||
|
||||
TerrainMaterialDlg.updateTargetMap = %mapName;
|
||||
AssetBrowser.selectedAsset = %assetId;
|
||||
TerrainMaterialDlg.changeTerrainMatMapAsset();
|
||||
}
|
||||
|
||||
function DiffuseMapContainer::onControlDropped( %this, %payload, %position )
|
||||
{
|
||||
terrMatEdDragNDropMapAssignment("DiffuseMap", %payload);
|
||||
}
|
||||
|
||||
function DetailMapContainer::onControlDropped( %this, %payload, %position )
|
||||
{
|
||||
terrMatEdDragNDropMapAssignment("DetailMap", %payload);
|
||||
}
|
||||
|
||||
function NormalMapContainer::onControlDropped( %this, %payload, %position )
|
||||
{
|
||||
terrMatEdDragNDropMapAssignment("NormalMap", %payload);
|
||||
}
|
||||
|
||||
function ORMMapContainer::onControlDropped( %this, %payload, %position )
|
||||
{
|
||||
terrMatEdDragNDropMapAssignment("ORMMap", %payload);
|
||||
}
|
||||
|
||||
function MacroMapContainer::onControlDropped( %this, %payload, %position )
|
||||
{
|
||||
terrMatEdDragNDropMapAssignment("MacroMap", %payload);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue