mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-04-27 23:35:45 +00:00
Added getShapeConstructorFilePath console function on shapeAsset
Fixed typo in import config settings for DuplicateAutoResolution Converted TSShapeConstructor to utilize assets Updated shape editor to work with assetified constructors Converted guiBitmapButtonCtrl to use assets
This commit is contained in:
parent
52c83d19e1
commit
88ae8a9665
181 changed files with 2343 additions and 1577 deletions
|
|
@ -70,7 +70,7 @@
|
|||
tooltipprofile = "ToolsGuiToolTipProfile";
|
||||
ToolTip = "Show grid";
|
||||
hovertime = "1000";
|
||||
bitmap = "tools/gui/images/menubar/show-grid";
|
||||
bitmapAsset = "ToolsModule:show_grid_n_image";
|
||||
text = "";
|
||||
groupNum = "-1";
|
||||
buttonType = "ToggleButton";
|
||||
|
|
@ -92,7 +92,7 @@
|
|||
tooltipprofile = "ToolsGuiToolTipProfile";
|
||||
ToolTip = "Fit Camera to Shape (F)";
|
||||
hovertime = "1000";
|
||||
bitmap = "tools/gui/images/menubar/fit-selection";
|
||||
bitmapAsset = "ToolsModule:fit_selection_n_image";
|
||||
text = "";
|
||||
groupNum = "-1";
|
||||
buttonType = "PushButton";
|
||||
|
|
@ -114,7 +114,7 @@
|
|||
tooltipprofile = "ToolsGuiToolTipProfile";
|
||||
ToolTip = "Orbit the selected node";
|
||||
hovertime = "1000";
|
||||
bitmap = "tools/gui/images/menubar/orbit-cam";
|
||||
bitmapAsset = "ToolsModule:orbit_cam_n_image";
|
||||
text = "";
|
||||
groupNum = "-1";
|
||||
buttonType = "ToggleButton";
|
||||
|
|
@ -143,7 +143,7 @@
|
|||
tooltipprofile = "ToolsGuiToolTipProfile";
|
||||
ToolTip = "Show Nodes (N)";
|
||||
hovertime = "1000";
|
||||
bitmap = "tools/shapeEditor/images/shownodes_btn";
|
||||
bitmapAsset = "ToolsModule:shownodes_btn_n_image";
|
||||
groupNum = "-1";
|
||||
buttonType = "ToggleButton";
|
||||
useMouseEvents = "0";
|
||||
|
|
@ -164,7 +164,7 @@
|
|||
tooltipprofile = "ToolsGuiToolTipProfile";
|
||||
ToolTip = "Toggle shape transparency in the preview window (T)";
|
||||
hovertime = "1000";
|
||||
bitmap = "tools/shapeEditor/images/ghost_btn";
|
||||
bitmapAsset = "ToolsModule:ghost_btn_n_image";
|
||||
buttonType = "ToggleButton";
|
||||
groupNum = "0";
|
||||
useMouseEvents = "0";
|
||||
|
|
@ -185,7 +185,7 @@
|
|||
tooltipprofile = "ToolsGuiToolTipProfile";
|
||||
ToolTip = "Toggle shape wireframe in the preview window (R)";
|
||||
hovertime = "1000";
|
||||
bitmap = "tools/shapeEditor/images/show-wireframe";
|
||||
bitmapAsset = "ToolsModule:show_wireframe_n_image";
|
||||
buttonType = "ToggleButton";
|
||||
groupNum = "0";
|
||||
useMouseEvents = "0";
|
||||
|
|
@ -214,7 +214,7 @@
|
|||
tooltipprofile = "ToolsGuiToolTipProfile";
|
||||
ToolTip = "Toggle shape bounding box in the preview window";
|
||||
hovertime = "1000";
|
||||
bitmap = "tools/shapeEditor/images/object-bounds";
|
||||
bitmapAsset = "ToolsModule:object_bounds_n_image";
|
||||
groupNum = "-1";
|
||||
buttonType = "ToggleButton";
|
||||
useMouseEvents = "0";
|
||||
|
|
@ -236,7 +236,7 @@
|
|||
tooltipprofile = "ToolsGuiToolTipProfile";
|
||||
ToolTip = "Toggle selected object bounding box in the preview window";
|
||||
hovertime = "1000";
|
||||
bitmap = "tools/shapeEditor/images/object-fit-bounds";
|
||||
bitmapAsset = "ToolsModule:object_fit_bounds_n_image";
|
||||
groupNum = "-1";
|
||||
buttonType = "ToggleButton";
|
||||
useMouseEvents = "0";
|
||||
|
|
@ -258,7 +258,7 @@
|
|||
tooltipprofile = "ToolsGuiToolTipProfile";
|
||||
ToolTip = "Toggle rendering of collision meshes in the preview window";
|
||||
hovertime = "1000";
|
||||
bitmap = "tools/shapeEditor/images/collision-shape";
|
||||
bitmapAsset = "ToolsModule:collision_shape_n_image";
|
||||
groupNum = "-1";
|
||||
buttonType = "ToggleButton";
|
||||
useMouseEvents = "0";
|
||||
|
|
@ -286,7 +286,7 @@
|
|||
tooltipprofile = "ToolsGuiToolTipProfile";
|
||||
ToolTip = "Toggle Advanced Properties Window";
|
||||
hovertime = "1000";
|
||||
bitmap = "tools/shapeEditor/images/detail-levels_btn";
|
||||
bitmapAsset = "ToolsModule:detail_levels_btn_n_image";
|
||||
buttonType = "ToggleButton";
|
||||
groupNum = "0";
|
||||
useMouseEvents = "0";
|
||||
|
|
|
|||
|
|
@ -846,7 +846,7 @@
|
|||
profile = "ToolsGuiTextProfile";
|
||||
};
|
||||
new GuiBitmapButtonCtrl() {
|
||||
bitmap = "tools/gui/images/delete";
|
||||
bitmapAsset = "ToolsModule:delete_n_image";
|
||||
groupNum = "-1";
|
||||
buttonType = "PushButton";
|
||||
useMouseEvents = "0";
|
||||
|
|
@ -865,7 +865,7 @@
|
|||
isContainer = "0";
|
||||
};
|
||||
new GuiBitmapButtonCtrl() {
|
||||
bitmap = "tools/gui/images/new";
|
||||
bitmapAsset = "ToolsModule:new_n_image";
|
||||
groupNum = "-1";
|
||||
buttonType = "PushButton";
|
||||
useMouseEvents = "0";
|
||||
|
|
@ -989,7 +989,7 @@
|
|||
canSaveDynamicFields = "0";
|
||||
};
|
||||
new GuiBitmapButtonCtrl() {
|
||||
bitmap = "tools/shapeEditor/images/playfwd_btn";
|
||||
bitmapAsset = "ToolsModule:playfwd_btn_n_image";
|
||||
groupNum = "0";
|
||||
buttonType = "ToggleButton";
|
||||
useMouseEvents = "0";
|
||||
|
|
@ -1171,7 +1171,7 @@
|
|||
};
|
||||
};
|
||||
new GuiBitmapButtonCtrl() {
|
||||
bitmap = "tools/gui/images/delete";
|
||||
bitmapAsset = "ToolsModule:delete_n_image";
|
||||
groupNum = "-1";
|
||||
buttonType = "PushButton";
|
||||
useMouseEvents = "0";
|
||||
|
|
@ -1190,7 +1190,7 @@
|
|||
canSaveDynamicFields = "0";
|
||||
};
|
||||
new GuiBitmapButtonCtrl() {
|
||||
bitmap = "tools/gui/images/new";
|
||||
bitmapAsset = "ToolsModule:new_n_image";
|
||||
groupNum = "-1";
|
||||
buttonType = "PushButton";
|
||||
useMouseEvents = "0";
|
||||
|
|
@ -1229,7 +1229,7 @@
|
|||
canSaveDynamicFields = "0";
|
||||
};
|
||||
new GuiBitmapButtonCtrl() {
|
||||
bitmap = "tools/shapeEditor/images/playbkwd_btn";
|
||||
bitmapAsset = "ToolsModule:playbkwd_btn_n_image";
|
||||
groupNum = "0";
|
||||
buttonType = "RadioButton";
|
||||
useMouseEvents = "0";
|
||||
|
|
@ -1250,7 +1250,7 @@
|
|||
canSaveDynamicFields = "0";
|
||||
};
|
||||
new GuiBitmapButtonCtrl() {
|
||||
bitmap = "tools/shapeEditor/images/pause_btn";
|
||||
bitmapAsset = "ToolsModule:pause_btn_n_image";
|
||||
groupNum = "0";
|
||||
buttonType = "RadioButton";
|
||||
useMouseEvents = "0";
|
||||
|
|
@ -1271,7 +1271,7 @@
|
|||
canSaveDynamicFields = "0";
|
||||
};
|
||||
new GuiBitmapButtonCtrl() {
|
||||
bitmap = "tools/shapeEditor/images/playfwd_btn";
|
||||
bitmapAsset = "ToolsModule:playfwd_btn_n_image";
|
||||
groupNum = "0";
|
||||
buttonType = "RadioButton";
|
||||
useMouseEvents = "0";
|
||||
|
|
|
|||
|
|
@ -207,7 +207,7 @@
|
|||
groupNum = "0";
|
||||
buttonType = "PushButton";
|
||||
useMouseEvents = "0";
|
||||
bitmap = "tools/shapeEditor/images/back_btn";
|
||||
bitmapAsset = "ToolsModule:back_btn_n_image";
|
||||
};
|
||||
new GuiBitmapButtonCtrl() {
|
||||
canSaveDynamicFields = "0";
|
||||
|
|
@ -227,7 +227,7 @@
|
|||
groupNum = "0";
|
||||
buttonType = "PushButton";
|
||||
useMouseEvents = "0";
|
||||
bitmap = "tools/shapeEditor/images/stepback_btn";
|
||||
bitmapAsset = "ToolsModule:stepback_btn_n_image";
|
||||
internalName = "stepBkwdBtn";
|
||||
};
|
||||
new GuiControl() {
|
||||
|
|
@ -263,7 +263,7 @@
|
|||
groupNum = "0";
|
||||
buttonType = "RadioButton";
|
||||
useMouseEvents = "0";
|
||||
bitmap = "tools/shapeEditor/images/playbkwd_btn";
|
||||
bitmapAsset = "ToolsModule:playbkwd_btn_n_image";
|
||||
};
|
||||
new GuiBitmapButtonCtrl() {
|
||||
internalName = "pauseBtn";
|
||||
|
|
@ -284,7 +284,7 @@
|
|||
groupNum = "0";
|
||||
buttonType = "RadioButton";
|
||||
useMouseEvents = "0";
|
||||
bitmap = "tools/shapeEditor/images/pause_btn";
|
||||
bitmapAsset = "ToolsModule:pause_btn_n_image";
|
||||
};
|
||||
new GuiBitmapButtonCtrl() {
|
||||
internalName = "playFwdBtn";
|
||||
|
|
@ -305,7 +305,7 @@
|
|||
groupNum = "0";
|
||||
buttonType = "RadioButton";
|
||||
useMouseEvents = "0";
|
||||
bitmap = "tools/shapeEditor/images/playfwd_btn";
|
||||
bitmapAsset = "ToolsModule:playfwd_btn_n_image";
|
||||
};
|
||||
};
|
||||
new GuiBitmapButtonCtrl() {
|
||||
|
|
@ -326,7 +326,7 @@
|
|||
groupNum = "0";
|
||||
buttonType = "PushButton";
|
||||
useMouseEvents = "0";
|
||||
bitmap = "tools/shapeEditor/images/stepfwd_btn";
|
||||
bitmapAsset = "ToolsModule:stepfwd_btn_n_image";
|
||||
internalName = "stepFwdBtn";
|
||||
};
|
||||
new GuiBitmapButtonCtrl() {
|
||||
|
|
@ -347,7 +347,7 @@
|
|||
groupNum = "0";
|
||||
buttonType = "PushButton";
|
||||
useMouseEvents = "0";
|
||||
bitmap = "tools/shapeEditor/images/fwd_btn";
|
||||
bitmapAsset = "ToolsModule:fwd_btn_n_image";
|
||||
};
|
||||
new GuiButtonCtrl() {
|
||||
canSaveDynamicFields = "0";
|
||||
|
|
@ -388,7 +388,7 @@
|
|||
groupNum = "0";
|
||||
buttonType = "ToggleButton";
|
||||
useMouseEvents = "0";
|
||||
bitmap = "tools/shapeEditor/images/pingpong_btn";
|
||||
bitmapAsset = "ToolsModule:pingpong_btn_n_image";
|
||||
};
|
||||
new GuiTextEditCtrl() {
|
||||
internalName = "timeScale";
|
||||
|
|
@ -417,7 +417,7 @@
|
|||
position = "39 0";
|
||||
Extent = "8 13";
|
||||
MinExtent = "1 1";
|
||||
bitmap = "tools/shapeEditor/images/seq_bar-in";
|
||||
bitmapAsset = "ToolsModule:seq_bar_in_n_image";
|
||||
ToolTip = "Set the In Point to the Current Frame";
|
||||
Command = "ShapeEdSequences.onEditSeqInOut(\"in\", ShapeEdSeqSlider.getValue());";
|
||||
};
|
||||
|
|
@ -429,7 +429,7 @@
|
|||
position = "765 0";
|
||||
Extent = "8 13";
|
||||
MinExtent = "1 1";
|
||||
bitmap = "tools/shapeEditor/images/seq_bar-out";
|
||||
bitmapAsset = "ToolsModule:seq_bar_out_n_image";
|
||||
ToolTip = "Set the Out Point to the Current Frame";
|
||||
Command = "ShapeEdSequences.onEditSeqInOut(\"out\", ShapeEdSeqSlider.getValue());";
|
||||
};
|
||||
|
|
|
|||
|
|
@ -430,7 +430,7 @@
|
|||
groupNum = "0";
|
||||
buttonType = "PushButton";
|
||||
useMouseEvents = "0";
|
||||
bitmap = "tools/gui/images/new";
|
||||
bitmapAsset = "ToolsModule:new_n_image";
|
||||
};
|
||||
new GuiBitmapButtonCtrl() {
|
||||
internalName = "deleteTriggerBtn";
|
||||
|
|
@ -451,7 +451,7 @@
|
|||
groupNum = "0";
|
||||
buttonType = "PushButton";
|
||||
useMouseEvents = "0";
|
||||
bitmap = "tools/gui/images/delete";
|
||||
bitmapAsset = "ToolsModule:delete_n_image";
|
||||
};
|
||||
// Trigger list
|
||||
new GuiControl() {
|
||||
|
|
@ -617,7 +617,7 @@
|
|||
treeView = ShapeEdNodeTreeView;
|
||||
};
|
||||
new GuiBitmapButtonCtrl() {
|
||||
bitmap = "tools/gui/images/clear-icon";
|
||||
bitmapAsset = "ToolsModule:clear_icon_n_image";
|
||||
groupNum = "-1";
|
||||
buttonType = "PushButton";
|
||||
useMouseEvents = "0";
|
||||
|
|
@ -1393,7 +1393,7 @@
|
|||
groupNum = "0";
|
||||
buttonType = "PushButton";
|
||||
useMouseEvents = "0";
|
||||
bitmap = "tools/gui/images/save-icon";
|
||||
bitmapAsset = "ToolsModule:save_icon_n_image";
|
||||
};
|
||||
new GuiBitmapButtonCtrl() {
|
||||
internalName = "newBtn";
|
||||
|
|
@ -1414,7 +1414,7 @@
|
|||
groupNum = "0";
|
||||
buttonType = "PushButton";
|
||||
useMouseEvents = "0";
|
||||
bitmap = "tools/gui/images/new";
|
||||
bitmapAsset = "ToolsModule:new_n_image";
|
||||
};
|
||||
new GuiBitmapButtonCtrl() {
|
||||
internalName = "deleteBtn";
|
||||
|
|
@ -1435,7 +1435,7 @@
|
|||
groupNum = "0";
|
||||
buttonType = "PushButton";
|
||||
useMouseEvents = "0";
|
||||
bitmap = "tools/gui/images/delete";
|
||||
bitmapAsset = "ToolsModule:delete_n_image";
|
||||
};
|
||||
};
|
||||
//--- OBJECT WRITE END ---
|
||||
|
|
|
|||
|
|
@ -213,7 +213,7 @@
|
|||
groupNum = "0";
|
||||
buttonType = "PushButton";
|
||||
useMouseEvents = "0";
|
||||
bitmap = "tools/gui/images/folderUp";
|
||||
bitmapAsset = "ToolsModule:folderUp_image";
|
||||
};
|
||||
new GuiPopUpMenuCtrl(ShapeEdSelectMenu) {
|
||||
canSaveDynamicFields = "0";
|
||||
|
|
|
|||
|
|
@ -117,7 +117,7 @@ function ShapeEditorPlugin::onWorldEditorStartup(%this)
|
|||
|
||||
// Add ourselves to the ToolsToolbar
|
||||
%tooltip = "Shape Editor (" @ %accel @ ")";
|
||||
EditorGui.addToToolsToolbar( "ShapeEditorPlugin", "ShapeEditorPalette", expandFilename("tools/worldEditor/images/toolbar/shape-editor"), %tooltip );
|
||||
EditorGui.addToToolsToolbar( "ShapeEditorPlugin", "ShapeEditorPalette", "ToolsModule:shape_editor_n_image", %tooltip );
|
||||
|
||||
// Add ourselves to the Editor Settings window
|
||||
exec( "./gui/ShapeEditorSettingsTab.gui" );
|
||||
|
|
@ -148,17 +148,17 @@ function ShapeEditorPlugin::onWorldEditorStartup(%this)
|
|||
function ShapeEditorPlugin::openShapeAsset(%this, %assetDef)
|
||||
{
|
||||
%this.selectedAssetDef = %assetDef;
|
||||
%this.open(makeRelativePath(%this.selectedAssetDef.getShapeFile()));
|
||||
%this.open(%this.selectedAssetDef);
|
||||
}
|
||||
|
||||
function ShapeEditorPlugin::openShapeAssetId(%this, %assetId)
|
||||
{
|
||||
%this.selectedAssetDef = AssetDatabase.acquireAsset(%assetId);
|
||||
//%this.selectedAssetDef = %assetDef;
|
||||
%this.open(makeRelativePath(%this.selectedAssetDef.getShapeFile()));
|
||||
%this.open(%this.selectedAssetDef);
|
||||
}
|
||||
|
||||
function ShapeEditorPlugin::open(%this, %filename)
|
||||
function ShapeEditorPlugin::open(%this, %shapeAsset)
|
||||
{
|
||||
if ( !%this.isActivated )
|
||||
{
|
||||
|
|
@ -210,14 +210,14 @@ function ShapeEditorPlugin::open(%this, %filename)
|
|||
}
|
||||
|
||||
// Select the new shape
|
||||
if (isObject(ShapeEditor.shape) && (ShapeEditor.shape.baseShape $= %filename))
|
||||
if (isObject(ShapeEditor.shape) && (ShapeEditor.shape.baseShapeAsset $= %shapeAsset))
|
||||
{
|
||||
// Shape is already selected => re-highlight the selected material if necessary
|
||||
ShapeEdMaterials.updateSelectedMaterial(ShapeEdMaterials-->highlightMaterial.getValue());
|
||||
}
|
||||
else if (%filename !$= "")
|
||||
else if (%shapeAsset !$= "")
|
||||
{
|
||||
ShapeEditor.selectShape(%filename, ShapeEditor.isDirty());
|
||||
ShapeEditor.selectShape(%shapeAsset, ShapeEditor.isDirty());
|
||||
|
||||
// 'fitToShape' only works after the GUI has been rendered, so force a repaint first
|
||||
Canvas.repaint();
|
||||
|
|
|
|||
|
|
@ -242,18 +242,22 @@ function ShapeEditor::findConstructor( %this, %path )
|
|||
return -1;
|
||||
}
|
||||
|
||||
function ShapeEditor::createConstructor( %this, %path )
|
||||
function ShapeEditor::createConstructor( %this, %assetId )
|
||||
{
|
||||
%name = strcapitalise( fileBase( %path ) ) @ strcapitalise( getSubStr( fileExt( %path ), 1, 3 ) );
|
||||
%name = strreplace( %name, "-", "_" );
|
||||
%name = strreplace( %name, ".", "_" );
|
||||
%name = AssetDatabase.getAssetName(%assetId);
|
||||
//%name = strcapitalise( fileBase( %path ) ) @ strcapitalise( getSubStr( fileExt( %path ), 1, 3 ) );
|
||||
//%name = strreplace( %name, "-", "_" );
|
||||
//%name = strreplace( %name, ".", "_" );
|
||||
%name = getUniqueName( %name );
|
||||
return new TSShapeConstructor( %name ) { baseShape = %path; };
|
||||
return new TSShapeConstructor( %name ) { baseShapeAsset = %assetId; };
|
||||
}
|
||||
|
||||
function ShapeEditor::saveConstructor( %this, %constructor )
|
||||
{
|
||||
%savepath = filePath( %constructor.baseShape ) @ "/" @ fileBase( %constructor.baseShape ) @ "." @ $TorqueScriptFileExtension;
|
||||
%assetDef = AssetDatabase.acquireAsset(%constructor.baseShapeAsset);
|
||||
%savepath = %assetDef.getShapeConstructorFilePath();
|
||||
AssetDatabase.releaseAsset(%constructor.baseShapeAsset);
|
||||
|
||||
new PersistenceManager( shapeEd_perMan );
|
||||
shapeEd_perMan.setDirty( %constructor, %savepath );
|
||||
shapeEd_perMan.saveDirtyObject( %constructor );
|
||||
|
|
@ -276,7 +280,7 @@ function ShapeEdSelectWindow::onSelect( %this, %path )
|
|||
}
|
||||
}
|
||||
|
||||
function ShapeEditor::selectShape( %this, %path, %saveOld )
|
||||
function ShapeEditor::selectShape( %this, %shapeAsset, %saveOld )
|
||||
{
|
||||
ShapeEdShapeView.setModel( "" );
|
||||
|
||||
|
|
@ -288,7 +292,7 @@ function ShapeEditor::selectShape( %this, %path, %saveOld )
|
|||
else if ( ShapeEditor.isDirty() )
|
||||
{
|
||||
// Purge all unsaved changes
|
||||
%oldPath = ShapeEditor.shape.baseShape;
|
||||
%oldPath = ShapeEditor.shape.baseShapeAsset;
|
||||
ShapeEditor.shape.delete();
|
||||
ShapeEditor.shape = 0;
|
||||
|
||||
|
|
@ -296,9 +300,9 @@ function ShapeEditor::selectShape( %this, %path, %saveOld )
|
|||
}
|
||||
|
||||
// Initialise the shape preview window
|
||||
if ( !ShapeEdShapeView.setModel( %path ) )
|
||||
if ( !ShapeEdShapeView.setShapeAsset( %shapeAsset.getAssetId() ) )
|
||||
{
|
||||
toolsMessageBoxOK( "Error", "Failed to load '" @ %path @ "'. Check the console for error messages." );
|
||||
toolsMessageBoxOK( "Error", "Failed to load '" @ %shapeAsset.getAssetId() @ "'. Check the console for error messages." );
|
||||
return;
|
||||
}
|
||||
ShapeEdShapeView.fitToShape();
|
||||
|
|
@ -307,13 +311,13 @@ function ShapeEditor::selectShape( %this, %path, %saveOld )
|
|||
ShapeEditor.setDirty( false );
|
||||
|
||||
// Get ( or create ) the TSShapeConstructor object for this shape
|
||||
ShapeEditor.shape = ShapeEditor.findConstructor( %path );
|
||||
ShapeEditor.shape = findShapeConstructorByAssetId( %shapeAsset.getAssetId() );
|
||||
if ( ShapeEditor.shape <= 0 )
|
||||
{
|
||||
ShapeEditor.shape = %this.createConstructor( %path );
|
||||
ShapeEditor.shape = %this.createConstructor( %shapeAsset );
|
||||
if ( ShapeEditor.shape <= 0 )
|
||||
{
|
||||
error( "ShapeEditor: Error - could not select " @ %path );
|
||||
error( "ShapeEditor: Error - could not select " @ %shapeAsset.getAssetId() );
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
@ -330,7 +334,7 @@ function ShapeEditor::selectShape( %this, %path, %saveOld )
|
|||
ShapeEdSelectWindow.updateHints();
|
||||
|
||||
// Update editor status bar
|
||||
EditorGuiStatusBar.setSelection( %path );
|
||||
EditorGuiStatusBar.setSelection( %shapeAsset.getAssetId() );
|
||||
}
|
||||
|
||||
// Handle a selection in the MissionGroup shape selector
|
||||
|
|
@ -1761,7 +1765,8 @@ function ShapeEdSeqFromMenu::onSelect( %this, %id, %text )
|
|||
%this.setText( %seqFrom );
|
||||
|
||||
// Allow the user to browse for an external source of animation data
|
||||
getLoadFormatFilename( %this @ ".onBrowseSelect", %this.lastPath );
|
||||
//getLoadFormatFilename( %this @ ".onBrowseSelect", %this.lastPath );
|
||||
AssetBrowser.showDialog("ShapeAsset", %this @ ".onBrowseSelect");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -1769,12 +1774,17 @@ function ShapeEdSeqFromMenu::onSelect( %this, %id, %text )
|
|||
}
|
||||
}
|
||||
|
||||
function ShapeEdSeqFromMenu::onBrowseSelect( %this, %path )
|
||||
function ShapeEdSeqFromMenu::onBrowseSelect( %this, %assetId )
|
||||
{
|
||||
%path = makeRelativePath( %path, getMainDotCSDir() );
|
||||
%this.lastPath = %path;
|
||||
%this.setText( %path );
|
||||
ShapeEdSequences.onEditSequenceSource( %path );
|
||||
//%path = makeRelativePath( %path, getMainDotCSDir() );
|
||||
//%this.lastPath = %path;
|
||||
%this.setText( %assetId );
|
||||
|
||||
%assetDef = AssetDatabase.acquireAsset(%assetId);
|
||||
%shapePath = %assetDef.getShapeFile();
|
||||
AssetDatabase.releaseAsset(%assetId);
|
||||
|
||||
ShapeEdSequences.onEditSequenceSource( %shapePath );
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
|
@ -2342,7 +2352,7 @@ function ShapeEdMaterials::editSelectedMaterial( %this )
|
|||
// materials.
|
||||
pushInstantGroup();
|
||||
%this.tempShape = new TSStatic() {
|
||||
shapeName = ShapeEditor.shape.baseShape;
|
||||
shapeAsset = ShapeEditor.shape.baseShapeAsset;
|
||||
collisionType = "None";
|
||||
};
|
||||
popInstantGroup();
|
||||
|
|
@ -2886,16 +2896,16 @@ function ShapeEdDetails::onSetObjectNode( %this )
|
|||
}
|
||||
}
|
||||
|
||||
function ShapeEdDetails::onAddMeshFromFile( %this, %path )
|
||||
function ShapeEdDetails::onAddMeshFromFile( %this, %assetId )
|
||||
{
|
||||
if ( %path $= "" )
|
||||
if ( %assetId $= "" )
|
||||
{
|
||||
getLoadFormatFilename( %this @ ".onAddMeshFromFile", %this.lastPath );
|
||||
AssetBrowser.showDialog("ShapeAsset", %this @ ".onAddMeshFromFile", "", "", "");
|
||||
return;
|
||||
}
|
||||
|
||||
%path = makeRelativePath( %path, getMainDotCSDir() );
|
||||
%this.lastPath = %path;
|
||||
//%path = makeRelativePath( %path, getMainDotCSDir() );
|
||||
//%this.lastPath = %path;
|
||||
|
||||
// Determine the detail level to use for the new geometry
|
||||
if ( %this-->addGeomTo.getText() $= "current detail" )
|
||||
|
|
@ -2904,8 +2914,8 @@ function ShapeEdDetails::onAddMeshFromFile( %this, %path )
|
|||
}
|
||||
else
|
||||
{
|
||||
%base = AssetDatabase.getAssetName(%assetId);
|
||||
// Check if the file has an LODXXX hint at the end of it
|
||||
%base = fileBase( %path );
|
||||
%pos = strstr( %base, "_LOD" );
|
||||
if ( %pos > 0 )
|
||||
%size = getSubStr( %base, %pos + 4, strlen( %base ) ) + 0;
|
||||
|
|
@ -2917,7 +2927,7 @@ function ShapeEdDetails::onAddMeshFromFile( %this, %path )
|
|||
%size++;
|
||||
}
|
||||
|
||||
ShapeEditor.doAddMeshFromFile( %path, %size );
|
||||
ShapeEditor.doAddMeshFromFile( %assetId, %size );
|
||||
}
|
||||
|
||||
function ShapeEdDetails::onDeleteMesh( %this )
|
||||
|
|
@ -2996,7 +3006,11 @@ function ShapeEditor::autoAddDetails( %this, %dest )
|
|||
//
|
||||
// Determine the base name of the input file (MyShape_LOD in the example above)
|
||||
// and use that to find any other shapes in the set.
|
||||
%base = fileBase( %dest.baseShape );
|
||||
%assetDef = AssetDatabase.acquireAsset(%dest.baseShapeAsset);
|
||||
%shapeFile = %assetDef.getShapeFile();
|
||||
AssetDatabase.releaseAsset(%dest.baseShapeAsset);
|
||||
|
||||
%base = fileBase( %shapeFile );
|
||||
%pos = strstr( %base, "_LOD" );
|
||||
if ( %pos < 0 )
|
||||
{
|
||||
|
|
@ -3008,7 +3022,7 @@ function ShapeEditor::autoAddDetails( %this, %dest )
|
|||
|
||||
echo( "Base is: " @ %base );
|
||||
|
||||
%filePatterns = filePath( %dest.baseShape ) @ "/" @ %base @ "*" @ fileExt( %dest.baseShape );
|
||||
%filePatterns = filePath( %shapeFile ) @ "/" @ %base @ "*" @ fileExt( %shapeFile );
|
||||
|
||||
echo( "Pattern is: " @ %filePatterns );
|
||||
|
||||
|
|
@ -3017,7 +3031,7 @@ function ShapeEditor::autoAddDetails( %this, %dest )
|
|||
{
|
||||
%fullPath = makeRelativePath( %fullPath, getMainDotCSDir() );
|
||||
|
||||
if ( %fullPath !$= %dest.baseShape )
|
||||
if ( %fullPath !$= %shapeFile )
|
||||
{
|
||||
echo( "Found LOD shape file: " @ %fullPath );
|
||||
|
||||
|
|
@ -3037,15 +3051,19 @@ function ShapeEditor::autoAddDetails( %this, %dest )
|
|||
}
|
||||
}
|
||||
|
||||
function ShapeEditor::addLODFromFile( %this, %dest, %filename, %size, %allowUnmatched )
|
||||
function ShapeEditor::addLODFromFile( %this, %dest, %assetId, %size, %allowUnmatched )
|
||||
{
|
||||
%assetDef = AssetDatabase.acquireAsset(%assetId);
|
||||
%csPath = %assetDef.getShapeConstructorFilePath();
|
||||
%filename = %assetDef.getShapeFile();
|
||||
AssetDatabase.releaseAsset(%assetId);
|
||||
|
||||
// Get (or create) a TSShapeConstructor object for the source shape. Need to
|
||||
// exec the script manually as the resource may not have been loaded yet
|
||||
%csPath = filePath( %filename ) @ "/" @ fileBase( %filename ) @ "." @ $TorqueScriptFileExtension;
|
||||
if ( isFile( %csPath ) )
|
||||
exec( %csPath );
|
||||
|
||||
%source = ShapeEditor.findConstructor( %filename );
|
||||
%source = findShapeConstructorByAssetId( %assetId );
|
||||
if ( %source == -1 )
|
||||
%source = ShapeEditor.createConstructor( %filename );
|
||||
%source.lodType = "SingleSize";
|
||||
|
|
@ -3053,7 +3071,7 @@ function ShapeEditor::addLODFromFile( %this, %dest, %filename, %size, %allowUnma
|
|||
|
||||
// Create a temporary TSStatic to ensure the resource is loaded
|
||||
%temp = new TSStatic() {
|
||||
shapeName = %filename;
|
||||
shapeAsset = %assetId;
|
||||
collisionType = "None";
|
||||
};
|
||||
|
||||
|
|
@ -3254,7 +3272,7 @@ function ShapeEdMountWindow::update_onMountSelectionChanged( %this )
|
|||
%this-->mountSeq.clear();
|
||||
%this-->mountSeq.add( "<rootpose>", 0 );
|
||||
|
||||
%tss = ShapeEditor.findConstructor( %shapePath );
|
||||
%tss = findShapeConstructorByFilename( %shapePath );
|
||||
if ( !isObject( %tss ) )
|
||||
%tss = ShapeEditor.createConstructor( %shapePath );
|
||||
if ( isObject( %tss ) )
|
||||
|
|
|
|||
|
|
@ -1007,10 +1007,10 @@ function ActionRemoveMesh::undo( %this )
|
|||
|
||||
//------------------------------------------------------------------------------
|
||||
// Add meshes from file
|
||||
function ShapeEditor::doAddMeshFromFile( %this, %filename, %size )
|
||||
function ShapeEditor::doAddMeshFromFile( %this, %assetId, %size )
|
||||
{
|
||||
%action = %this.createAction( ActionAddMeshFromFile, "Add mesh from file" );
|
||||
%action.filename = %filename;
|
||||
%action.assetId = %assetId;
|
||||
%action.size = %size;
|
||||
|
||||
%this.doAction( %action );
|
||||
|
|
@ -1018,7 +1018,7 @@ function ShapeEditor::doAddMeshFromFile( %this, %filename, %size )
|
|||
|
||||
function ActionAddMeshFromFile::doit( %this )
|
||||
{
|
||||
%this.meshList = ShapeEditor.addLODFromFile( ShapeEditor.shape, %this.filename, %this.size, 1 );
|
||||
%this.meshList = ShapeEditor.addLODFromFile( ShapeEditor.shape, %this.assetId, %this.size, 1 );
|
||||
if ( %this.meshList !$= "" )
|
||||
{
|
||||
%count = getFieldCount( %this.meshList );
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue