mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-01-19 20:24:49 +00:00
47 lines
1.3 KiB
C#
47 lines
1.3 KiB
C#
|
|
function SelectAssetPath::onWake(%this)
|
||
|
|
{
|
||
|
|
}
|
||
|
|
|
||
|
|
//SelectAssetPath.showDialog();
|
||
|
|
function SelectAssetPath::showDialog(%this, %startingPath, %callback)
|
||
|
|
{
|
||
|
|
if(!isObject(%this.dirHandler))
|
||
|
|
%this.dirHandler = makedirectoryHandler(SelectAssetPath-->folderTree, "Core,Tools,cache,shaderCache", "");
|
||
|
|
|
||
|
|
SelectAssetPath-->folderTree.clear();
|
||
|
|
|
||
|
|
SelectAssetPath-->folderTree.buildIconTable( ":tools/classIcons/Prefab:tools/classIcons/Prefab" @
|
||
|
|
":tools/classIcons/SimSet:tools/classIcons/SimSet");
|
||
|
|
|
||
|
|
%this.dirHandler.currentPath = %startingPath;
|
||
|
|
%this.callback = %callback;
|
||
|
|
|
||
|
|
%dataItem = SelectAssetPath-->folderTree.insertItem(0, "Data");
|
||
|
|
%this.dirHandler.loadFolders("Data", %dataItem);
|
||
|
|
|
||
|
|
Canvas.pushDialog(SelectAssetPath);
|
||
|
|
}
|
||
|
|
|
||
|
|
function selectAssetPathTree::onSelect(%this, %itemId)
|
||
|
|
{
|
||
|
|
if(%itemId == 1)
|
||
|
|
//can't select root
|
||
|
|
return;
|
||
|
|
|
||
|
|
SelectAssetPath.selectedTreeItem = %itemId;
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
function SelectAssetPath::selectPath(%this)
|
||
|
|
{
|
||
|
|
//do callback
|
||
|
|
%selectedId = %this.selectedTreeItem;
|
||
|
|
%selectedPath = %this-->folderTree.getItemValue(%selectedId) @ "/" @ %this-->folderTree.getItemText(%selectedId);
|
||
|
|
|
||
|
|
if(%this.callback !$= "")
|
||
|
|
{
|
||
|
|
eval( "" @ %this.callback @ "(\"" @ %selectedPath @ "\");");
|
||
|
|
}
|
||
|
|
|
||
|
|
Canvas.popDialog(SelectAssetPath);
|
||
|
|
}
|