From 2ce48d0e6f396cf37d693119135efb3722236550 Mon Sep 17 00:00:00 2001 From: Areloch Date: Thu, 3 Dec 2020 00:11:35 -0600 Subject: [PATCH] Cleanup of some log errors and spam with assets --- .../assetBrowser/scripts/assetBrowser.cs | 75 +------------------ .../scripts/assetTypes/material.cs | 3 +- .../assetBrowser/scripts/directoryHandling.cs | 5 +- 3 files changed, 5 insertions(+), 78 deletions(-) diff --git a/Templates/BaseGame/game/tools/assetBrowser/scripts/assetBrowser.cs b/Templates/BaseGame/game/tools/assetBrowser/scripts/assetBrowser.cs index fcee0645d..46ddfe9a0 100644 --- a/Templates/BaseGame/game/tools/assetBrowser/scripts/assetBrowser.cs +++ b/Templates/BaseGame/game/tools/assetBrowser/scripts/assetBrowser.cs @@ -256,7 +256,7 @@ function AssetBrowser::selectAsset( %this, %asset ) %this.changeAsset(); } - Inspector.refresh(); + EWInspectorWindow.refresh(); AssetBrowser.hideDialog(); } @@ -2242,79 +2242,6 @@ function EWorldEditor::onControlDropped( %this, %payload, %position ) eval(%buildCommand); } - /*if(%assetType $= "ImageAsset") - { - echo("WorldEditor::onControlDropped - dropped an ImageAsset onto the editor window. Todo: Implement dropping image/material into scene"); - } - else if(%assetType $= "ShapeAsset") - { - echo("DROPPED A SHAPE ON THE EDITOR WINDOW!"); - - /*%staticShapeObjDef = AssetDatabase.acquireAsset("Core_GameObjects:StaticShapeObject"); - - %newEntity = %staticShapeObjDef.createObject(); - - %newEntity.position = %pos; - %newEntity-->MeshComponent.MeshAsset = %module @ ":" @ %asset; - - %newEntity.dirtyGameObject = true; //because if we're specifically setting the mesh asset, it's dirty*/ - - /*%newEntity = new TSStatic() - { - position = %pos; - shapeAsset = %module @ ":" @ %asset; - }; - - getScene(0).add(%newEntity); - - EWorldEditor.clearSelection(); - EWorldEditor.selectObject(%newEntity); - } - else if(%assetType $= "MaterialAsset") - { - echo("WorldEditor::onControlDropped - dropped an MaterialAsset onto the editor window. Todo: Implement dropping image/material into scene"); - } - else if(%assetType $= "GameObjectAsset") - { - echo("WorldEditor::onControlDropped - dropped an GameObjectAsset onto the editor window."); - - %goAssetDef = AssetDatabase.acquireAsset(%module @ ":" @%asset); - - AssetBrowser.dragAndDropGameObjectAsset(%goAssetDef, EWorldEditor); - } - else if(%assetType $= "ComponentAsset") - { - %newEntity = new Entity() - { - position = %pos; - }; - - %assetDef = AssetDatabase.acquireAsset(%module @ ":" @ %asset); - - if(%assetDef.componentClass $= "Component") - eval("$tmpVar = new " @ %assetDef.componentClass @ "() { class = " @ %assetDef.componentName @ "; }; %newEntity.add($tmpVar);"); - else - eval("$tmpVar = new " @ %assetDef.componentClass @ "() {}; %newEntity.add($tmpVar);"); - - getScene(0).add(%newEntity); - - EWorldEditor.clearSelection(); - EWorldEditor.selectObject(%newEntity); - } - else if(%assetType $= "ScriptAsset") //do we want to do it this way? - { - %newEntity = new Entity() - { - position = %pos; - class = %asset; - }; - - getScene(0).add(%newEntity); - - EWorldEditor.clearSelection(); - EWorldEditor.selectObject(%newEntity); - }*/ - EWorldEditor.isDirty = true; } diff --git a/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/material.cs b/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/material.cs index 57f143de1..b0582b6b4 100644 --- a/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/material.cs +++ b/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/material.cs @@ -458,7 +458,7 @@ function AssetBrowser::buildMaterialAssetPreview(%this, %assetDef, %previewData) else if(%assetDef.materialDefinitionName.diffuseMapAsset[0] !$= "") { %imgAsset = AssetDatabase.acquireAsset(%assetDef.materialDefinitionName.diffuseMapAsset[0]); - %previewData.previewImage = %imgAsset.getImageFilename(); + %previewData.previewImage = %imgAsset.getImagePath(); } else %previewData.previewImage = "tools/assetBrowser/art/materialIcon"; @@ -510,7 +510,6 @@ function GuiInspectorTypeMaterialAssetPtr::onControlDropped( %this, %payload, %p if(%assetType $= "MaterialAsset") { - echo("DROPPED A MATERIAL ON A MATERIAL ASSET COMPONENT FIELD!"); //%assetDef = AssetDatabase.acquireAsset(%module @ ":" @ %assetName); %this.setMaterialAsset(%module @ ":" @ %assetName); diff --git a/Templates/BaseGame/game/tools/assetBrowser/scripts/directoryHandling.cs b/Templates/BaseGame/game/tools/assetBrowser/scripts/directoryHandling.cs index 6d200d5f9..f40904ea8 100644 --- a/Templates/BaseGame/game/tools/assetBrowser/scripts/directoryHandling.cs +++ b/Templates/BaseGame/game/tools/assetBrowser/scripts/directoryHandling.cs @@ -239,7 +239,8 @@ function directoryHandler::expandTreeToAddress(%this, %address) { //break down the address %folderCount = getTokenCount(%address, "/"); - %this.treeCtrl.expandItem(0); + %rootId = AssetBrowser-->filterTree.findItemByName("Content"); + %this.treeCtrl.expandItem(%rootId); if(startsWith(%address, "Data/") || startsWith(%address, "Tools/") || startsWith(%address, "Core/")) { @@ -258,7 +259,7 @@ function directoryHandler::expandTreeToAddress(%this, %address) %this.treeCtrl.expandItem(%curItem); } - %this.treeCtrl.expandItem(0); + %this.treeCtrl.expandItem(%rootId); } function directoryHandler::createFolder(%this, %folderPath)