mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-12 15:14:35 +00:00
clean out unnecessary position set
add a new route for the asset browser to create things in the form of ".on" @ %assetType @ "GUIEditorDropped(" @ %assetDef @ ",\"" @ %pos @ "\");";
demonstrate it with a soundasset creating a GuiAudioCtrl when drug onto the canvas
This commit is contained in:
parent
54a4510bc6
commit
733c9d4b6d
3 changed files with 29 additions and 12 deletions
|
|
@ -2582,12 +2582,24 @@ function GuiEditor::onControlDropped(%this, %payload, %position)
|
|||
//dealing with an actual asset, so build the assetName
|
||||
%assetId = %payload.moduleName @ ":" @ %payload.assetName;
|
||||
%assetType = AssetDatabase.getAssetType(%assetId);
|
||||
|
||||
if(%assetType $= "ImageAsset")
|
||||
|
||||
if(AssetBrowser.isMethod("on" @ %assetType @ "GUIEditorDropped"))
|
||||
{
|
||||
%cmd = "return new guiBitmapCtrl();";
|
||||
%ctrl = eval( %cmd );
|
||||
%ctrl.bitmap = %assetId;
|
||||
%module = %payload.moduleName;
|
||||
%asset = %payload.assetName;
|
||||
%assetDef = AssetDatabase.acquireAsset(%module @ ":" @ %asset);
|
||||
%buildCommand = AssetBrowser @ ".on" @ %assetType @ "GUIEditorDropped(" @ %assetDef @ ",\"" @ %pos @ "\");";
|
||||
eval(%buildCommand);
|
||||
}
|
||||
else
|
||||
{
|
||||
//fallback example
|
||||
if(%assetType $= "ImageAsset")
|
||||
{
|
||||
%cmd = "return new guiBitmapCtrl();";
|
||||
%ctrl = eval( %cmd );
|
||||
%ctrl.bitmap = %assetId;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue