mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-01-19 20:24:49 +00:00
Fixed gui editor drag and drop behavior for image, shape, and sound
Ensure BitmapFile is given a proper default
This commit is contained in:
parent
5397c168bc
commit
0e6c33f78a
|
|
@ -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) \
|
||||
|
|
|
|||
|
|
@ -132,6 +132,7 @@ GuiBitmapButtonCtrl::GuiBitmapButtonCtrl()
|
|||
mBitmapName = StringTable->EmptyString();
|
||||
mBitmap = NULL;
|
||||
mBitmapAsset.registerRefreshNotify(this);
|
||||
mBitmapFile = String::EmptyString;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -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
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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 )
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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 )
|
||||
|
|
|
|||
|
|
@ -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 )
|
||||
|
|
|
|||
Loading…
Reference in a new issue