diff --git a/Engine/source/T3D/assets/ImageAsset.h b/Engine/source/T3D/assets/ImageAsset.h index 99230fb76..f05514803 100644 --- a/Engine/source/T3D/assets/ImageAsset.h +++ b/Engine/source/T3D/assets/ImageAsset.h @@ -264,7 +264,7 @@ public: { \ imageAssetId = query.mAssetList[0]; \ } \ - else if(Torque::FS::IsFile(_in) || (_in[0] == '$' || _in[0] == '#')) \ + else if(Torque::FS::IsFile(_in) || (_in[0] == '$' || _in[0] == '#')) \ { \ imageAssetId = ImageAsset::getAssetIdByFilename(_in); \ if (imageAssetId == ImageAsset::smNoImageAssetFallback) \ diff --git a/Engine/source/gui/buttons/guiBitmapButtonCtrl.cpp b/Engine/source/gui/buttons/guiBitmapButtonCtrl.cpp index e6f063428..f2ee24d43 100644 --- a/Engine/source/gui/buttons/guiBitmapButtonCtrl.cpp +++ b/Engine/source/gui/buttons/guiBitmapButtonCtrl.cpp @@ -132,6 +132,7 @@ GuiBitmapButtonCtrl::GuiBitmapButtonCtrl() mBitmapName = StringTable->EmptyString(); mBitmap = NULL; mBitmapAsset.registerRefreshNotify(this); + mBitmapFile = String::EmptyString; } //----------------------------------------------------------------------------- diff --git a/Templates/BaseGame/game/tools/assetBrowser/scripts/assetBrowser.tscript b/Templates/BaseGame/game/tools/assetBrowser/scripts/assetBrowser.tscript index 78a17d041..d53e8a4cb 100644 --- a/Templates/BaseGame/game/tools/assetBrowser/scripts/assetBrowser.tscript +++ b/Templates/BaseGame/game/tools/assetBrowser/scripts/assetBrowser.tscript @@ -2515,7 +2515,7 @@ function GuiEditor::onControlDropped(%this, %payload, %position) %assetId = %payload.moduleName @ ":" @ %payload.assetName; %assetType = AssetDatabase.getAssetType(%assetId); - AssetBrowser.callAssetTypeFunc(%assetType, "GUIEditorDropped", %payload.moduleName, %payload.assetName, %pos); + %ctrl = AssetBrowser.callAssetTypeFunc(%assetType, "onGUIEditorDropped", %payload.moduleName, %payload.assetName, %pos); } else { diff --git a/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/genericAsset.tscript b/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/genericAsset.tscript index 1b7b569ac..b725748f3 100644 --- a/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/genericAsset.tscript +++ b/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/genericAsset.tscript @@ -319,18 +319,18 @@ function GenericAsset::onSaveProperties(%this) //Called when the asset's Preview has been dragged and dropped into the world editor //This would usually spawn an associated instance, or a scene object that can utilize the //asset in question(ie, Dropping a SoundAsset spawns a SoundEmitter) -function GenericAsset::onWorldEditorDropped(%this, %position) +/*function GenericAsset::onWorldEditorDropped(%this, %position) { echo("GenericAsset::onWorldEditorDropped() - " @ %this @ ", " @ %position); -} +}*/ //Called when the asset's Preview has been dragged and dropped into the GUI editor //This would usually spawn an associated instance, or a gui object that can utilize the //asset in question(ie, Dropping a SoundAsset spawns a guiAudioCtrl) -function GenericAsset::onGuiEditorDropped(%this, %position) +/*function GenericAsset::onGuiEditorDropped(%this, %position) { echo("GenericAsset::onGuiEditorDropped() - " @ %this @ ", " @ %position); -} +}*/ //An example case of handling other specialized editors, such as dropping a Datablock //Preview into the DatablockEditor. This would be very case-by-case diff --git a/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/image.tscript b/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/image.tscript index 0a9350d50..f571f2aa6 100644 --- a/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/image.tscript +++ b/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/image.tscript @@ -84,6 +84,18 @@ function ImageAsset::onSaveProperties(%this) { GenericAsset::onSaveProperties(%this); } + +function ImageAsset::onGuiEditorDropped(%this, %position) +{ + %assetId = %this.getAssetId(); + %cmd = "new GuiBitmapCtrl(){"; + %cmd = %cmd @ "BitmapAsset =\""@ %assetId @"\";"; + %cmd = %cmd @ "position =\""@ %position @"\";"; + %cmd = %cmd @ "};"; + %ctrl = GuiEditCanvas.createObject(%cmd); + + return %ctrl; +} function GuiInspectorTypeImageAssetPtr::onControlDropped( %this, %payload, %position ) { diff --git a/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/shape.tscript b/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/shape.tscript index c4fad9a5d..6bad1868a 100644 --- a/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/shape.tscript +++ b/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/shape.tscript @@ -148,9 +148,16 @@ function ShapeAsset::onWorldEditorDropped(%assetDef, %position) MECreateUndoAction::submit(%newStatic ); } -function ShapeAsset::onGUIEditorDropped(%assetDef, %position) +function ShapeAsset::onGUIEditorDropped(%this, %position) { + %assetId = %this.getAssetId(); + %cmd = "new GuiObjectView(){"; + %cmd = %cmd @ "ModelAsset =\""@ %assetId @"\";"; + %cmd = %cmd @ "position =\""@ %position @"\";"; + %cmd = %cmd @ "};"; + %ctrl = GuiEditCanvas.createObject(%cmd); + return %ctrl; } function GuiInspectorTypeShapeAssetPtr::onControlDropped( %this, %payload, %position ) diff --git a/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/sound.tscript b/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/sound.tscript index 8ed6919bf..5a90c3d6b 100644 --- a/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/sound.tscript +++ b/Templates/BaseGame/game/tools/assetBrowser/scripts/assetTypes/sound.tscript @@ -87,6 +87,8 @@ function SoundAsset::onGUIEditorDropped(%this, %position) %cmd = %cmd @ "};"; %ctrl = GuiEditCanvas.createObject(%cmd); //echo(%ctrl SPC "created"); + + return %ctrl; } function GuiInspectorTypeSoundAssetPtr::onControlDropped( %this, %payload, %position )