mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-01-19 20:24:49 +00:00
Fixes the handling of creator entries in the asset browser
This commit is contained in:
parent
4bed40e545
commit
c6213f0d12
|
|
@ -1,14 +1,14 @@
|
|||
function AssetBrowser::buildCreatorPreview(%this, %assetDef, %previewData)
|
||||
AssetBrowser::registerObjectType("Creator", "Creator's");
|
||||
|
||||
function Creator::buildBrowserElement(%this, %className, %previewData)
|
||||
{
|
||||
%class = %assetDef.val[0];
|
||||
%name = %assetDef.val[1];
|
||||
%func = %assetDef.val[2];
|
||||
|
||||
%previewData.assetName = %name;
|
||||
//echo("Creator::buildBrowserElement() - " @ %this @ ", " @ %previewData);
|
||||
//%this.dump();
|
||||
%previewData.assetName = %this.val1;
|
||||
%previewData.assetPath = "";
|
||||
%previewData.moduleName = "";
|
||||
|
||||
%previewData.previewImage = "ToolsModule:" @ %class @ "_image";
|
||||
%previewData.previewImage = "ToolsModule:" @ %this.val0 @ "_image";
|
||||
|
||||
if(!AssetDatabase.isDeclaredAsset(%previewData.previewImage))
|
||||
{
|
||||
|
|
@ -18,10 +18,9 @@ function AssetBrowser::buildCreatorPreview(%this, %assetDef, %previewData)
|
|||
%previewData.previewImage = "ToolsModule:GuiControl_image";
|
||||
}
|
||||
|
||||
//%previewData.assetFriendlyName = %assetDef.assetName;
|
||||
%previewData.assetDesc = %assetDef;
|
||||
%previewData.tooltip = "This creates a new object of the class " @ %class;
|
||||
%previewData.doubleClickCommand = %func;
|
||||
%previewData.assetDesc = %this;
|
||||
%previewData.tooltip = "This creates a new object of the class " @ %this.val0;
|
||||
%previewData.doubleClickCommand = %this.val2;
|
||||
}
|
||||
|
||||
function AssetBrowser::onFinishCreateObject(%this, %objId)
|
||||
|
|
@ -29,32 +28,32 @@ function AssetBrowser::onFinishCreateObject(%this, %objId)
|
|||
%objId.position = %this.createdObjectPos;
|
||||
}
|
||||
|
||||
function AssetBrowser::onCreatorEditorDropped(%this, %assetDef, %position)
|
||||
function Creator::onWorldEditorDropped(%this, %position)
|
||||
{
|
||||
if(EditorIsActive())
|
||||
{
|
||||
%targetPosition = EWorldEditor.unproject(%position SPC 1);
|
||||
%camPos = LocalClientConnection.camera.getPosition();
|
||||
%rayResult = containerRayCast(%camPos, %targetPosition, -1);
|
||||
|
||||
%pos = ObjectCreator.getCreateObjectPosition();
|
||||
%targetPosition = EWorldEditor.unproject(%position SPC 1);
|
||||
%camPos = LocalClientConnection.camera.getPosition();
|
||||
%rayResult = containerRayCast(%camPos, %targetPosition, -1);
|
||||
|
||||
%pos = ObjectCreator.getCreateObjectPosition();
|
||||
|
||||
if(%rayResult != 0)
|
||||
{
|
||||
%pos = getWords(%rayResult, 1, 3);
|
||||
}
|
||||
else
|
||||
{
|
||||
%pos = "0 0 0";
|
||||
}
|
||||
|
||||
%func = %assetDef.val[2];
|
||||
|
||||
%this.createdObjectPos = %pos;
|
||||
%newObj = eval(%func);
|
||||
if(%rayResult != 0)
|
||||
{
|
||||
%pos = getWords(%rayResult, 1, 3);
|
||||
}
|
||||
else
|
||||
{
|
||||
%pos = "0 0 0";
|
||||
}
|
||||
|
||||
%func = %this.val[2];
|
||||
|
||||
$CurrentAssetBrowser.createdObjectPos = %pos;
|
||||
%newObj = eval(%func);
|
||||
}
|
||||
else if(GuiEditorIsActive())
|
||||
{
|
||||
%placeholderVar = "";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue