Enables the assimp import options gui when loaded from the shape editor.

Adds new assimp options to the importer gui.
Copies the importer gui to the BaseGame template.
This commit is contained in:
OTHGMars 2019-04-15 19:03:10 -04:00
parent 2d20995867
commit 6111eb466e
6 changed files with 996 additions and 20 deletions

View file

@ -45,26 +45,52 @@
internalName = "window";
canSaveDynamicFields = "0";
new GuiCheckBoxCtrl() {
useInactiveState = "0";
text = " Swap Y and Z coordinates.";
groupNum = "-1";
buttonType = "ToggleButton";
useMouseEvents = "0";
new GuiTextCtrl() {
text = "Up Axis";
maxLength = "1024";
Margin = "0 0 0 0";
Padding = "0 0 0 0";
AnchorTop = "1";
AnchorBottom = "0";
AnchorLeft = "1";
AnchorRight = "0";
isContainer = "0";
Profile = "ToolsGuiCheckBoxProfile";
Profile = "ToolsGuiTextRightProfile";
HorizSizing = "right";
VertSizing = "bottom";
position = "10 30";
Extent = "200 13";
position = "10 31";
Extent = "40 16";
MinExtent = "8 2";
canSave = "1";
Visible = "1";
variable = "$Assimp::SwapYZ";
tooltipprofile = "ToolsGuiToolTipProfile";
ToolTip = "Corrects transformations so Z is up.";
hovertime = "1000";
internalName = "overrideScale";
canSaveDynamicFields = "0";
};
new GuiPopUpMenuCtrl() {
maxPopupHeight = "200";
sbUsesNAColor = "0";
reverseTextList = "0";
bitmapBounds = "16 16";
maxLength = "1024";
Margin = "0 0 0 0";
Padding = "0 0 0 0";
AnchorTop = "1";
AnchorBottom = "0";
AnchorLeft = "1";
AnchorRight = "0";
isContainer = "0";
Profile = "ToolsGuiPopUpMenuProfile";
HorizSizing = "right";
VertSizing = "bottom";
position = "56 30";
Extent = "66 18";
MinExtent = "8 2";
canSave = "1";
Visible = "1";
tooltipprofile = "ToolsGuiToolTipProfile";
hovertime = "1000";
internalName = "upAxis";
canSaveDynamicFields = "0";
};
@ -106,6 +132,7 @@
MinExtent = "8 2";
canSave = "1";
Visible = "1";
Active = "0";
variable = "$Assimp::Triangulate";
tooltipprofile = "ToolsGuiToolTipProfile";
ToolTip = "Triangulate polygons with more than 3 edges.";
@ -300,7 +327,7 @@
new GuiCheckBoxCtrl() {
useInactiveState = "0";
text = " Find Instances";
text = " Flip UV Coordinates";
groupNum = "-1";
buttonType = "ToggleButton";
useMouseEvents = "0";
@ -313,6 +340,28 @@
MinExtent = "8 2";
canSave = "1";
Visible = "1";
variable = "$Assimp::FlipUVs";
tooltipprofile = "ToolsGuiToolTipProfile";
ToolTip = "This step flips all UV coordinates along the y-axis and adjusts material settings and bitangents accordingly.\nAssimp uses TL(0,0):BR(1,1). T3D uses TL(0,1):BR(1,0). This will be needed for most textured models.";
hovertime = "1000";
canSaveDynamicFields = "0";
};
new GuiCheckBoxCtrl() {
useInactiveState = "0";
text = " Find Instances";
groupNum = "-1";
buttonType = "ToggleButton";
useMouseEvents = "0";
isContainer = "0";
Profile = "ToolsGuiCheckBoxProfile";
HorizSizing = "right";
VertSizing = "bottom";
position = "10 270";
Extent = "200 13";
MinExtent = "8 2";
canSave = "1";
Visible = "1";
variable = "$Assimp::FindInstances";
tooltipprofile = "ToolsGuiToolTipProfile";
ToolTip = "search for instanced meshes and remove them by references to one master.";
@ -331,7 +380,7 @@
Profile = "ToolsGuiCheckBoxProfile";
HorizSizing = "right";
VertSizing = "bottom";
position = "10 270";
position = "10 290";
Extent = "200 13";
MinExtent = "8 2";
canSave = "1";
@ -343,7 +392,196 @@
internalName = "overrideScale";
canSaveDynamicFields = "0";
};
new GuiTextCtrl() {
text = "LOD";
maxLength = "1024";
Margin = "0 0 0 0";
Padding = "0 0 0 0";
AnchorTop = "1";
AnchorBottom = "0";
AnchorLeft = "1";
AnchorRight = "0";
isContainer = "0";
Profile = "ToolsGuiTextRightProfile";
HorizSizing = "right";
VertSizing = "bottom";
position = "210 31";
Extent = "22 16";
MinExtent = "8 2";
canSave = "1";
Visible = "1";
tooltipprofile = "ToolsGuiToolTipProfile";
hovertime = "1000";
canSaveDynamicFields = "0";
};
new GuiPopUpMenuCtrl() {
maxPopupHeight = "200";
sbUsesNAColor = "0";
reverseTextList = "0";
bitmapBounds = "16 16";
maxLength = "1024";
Margin = "0 0 0 0";
Padding = "0 0 0 0";
AnchorTop = "1";
AnchorBottom = "0";
AnchorLeft = "1";
AnchorRight = "0";
isContainer = "0";
Profile = "ToolsGuiPopUpMenuProfile";
HorizSizing = "right";
VertSizing = "bottom";
position = "238 30";
Extent = "92 18";
MinExtent = "8 2";
canSave = "1";
Visible = "1";
tooltipprofile = "ToolsGuiToolTipProfile";
ToolTip = "Method used to determine LOD for meshes in the model";
hovertime = "1000";
internalName = "lodType";
canSaveDynamicFields = "0";
};
new GuiTextEditCtrl() {
historySize = "0";
password = "0";
tabComplete = "0";
sinkAllKeyEvents = "0";
passwordMask = "*";
text = "2";
maxLength = "1024";
Margin = "0 0 0 0";
Padding = "0 0 0 0";
AnchorTop = "1";
AnchorBottom = "0";
AnchorLeft = "1";
AnchorRight = "0";
isContainer = "0";
Profile = "ToolsGuiTextEditProfile";
HorizSizing = "right";
VertSizing = "bottom";
position = "338 30";
Extent = "49 18";
MinExtent = "8 2";
canSave = "1";
Visible = "1";
tooltipprofile = "ToolsGuiToolTipProfile";
ToolTip = "Detail size for all meshes in this model (when LOD type is SingleSize)";
hovertime = "1000";
internalName = "singleDetailSize";
canSaveDynamicFields = "0";
};
new GuiCheckBoxCtrl() {
useInactiveState = "0";
text = " Center Model";
groupNum = "-1";
buttonType = "ToggleButton";
useMouseEvents = "0";
isContainer = "0";
Profile = "ToolsGuiCheckBoxProfile";
HorizSizing = "right";
VertSizing = "bottom";
position = "210 50";
Extent = "200 13";
MinExtent = "8 2";
canSave = "1";
Visible = "1";
variable = "$Assimp::adjustCenter";
tooltipprofile = "ToolsGuiToolTipProfile";
ToolTip = "Translates model so the origin is at the center";
hovertime = "1000";
canSaveDynamicFields = "0";
};
new GuiCheckBoxCtrl() {
useInactiveState = "0";
text = " Floor Model";
groupNum = "-1";
buttonType = "ToggleButton";
useMouseEvents = "0";
isContainer = "0";
Profile = "ToolsGuiCheckBoxProfile";
HorizSizing = "right";
VertSizing = "bottom";
position = "210 70";
Extent = "200 13";
MinExtent = "8 2";
canSave = "1";
Visible = "1";
variable = "$Assimp::adjustFloor";
tooltipprofile = "ToolsGuiToolTipProfile";
ToolTip = "Translates model so the origin is at the bottom";
hovertime = "1000";
canSaveDynamicFields = "0";
};
new GuiCheckBoxCtrl() {
useInactiveState = "0";
text = " Join Identical Vertices";
groupNum = "-1";
buttonType = "ToggleButton";
useMouseEvents = "0";
isContainer = "0";
Profile = "ToolsGuiCheckBoxProfile";
HorizSizing = "right";
VertSizing = "bottom";
position = "210 90";
Extent = "200 13";
MinExtent = "8 2";
canSave = "1";
Visible = "1";
variable = "$Assimp::JoinIdenticalVertices";
tooltipprofile = "ToolsGuiToolTipProfile";
ToolTip = "Identifies and joins identical vertex data sets within all imported meshes.";
hovertime = "1000";
canSaveDynamicFields = "0";
};
new GuiCheckBoxCtrl() {
useInactiveState = "0";
text = " Flip Winding Order";
groupNum = "-1";
buttonType = "ToggleButton";
useMouseEvents = "0";
isContainer = "0";
Profile = "ToolsGuiCheckBoxProfile";
HorizSizing = "right";
VertSizing = "bottom";
position = "210 110";
Extent = "200 13";
MinExtent = "8 2";
canSave = "1";
Visible = "1";
variable = "$Assimp::FlipWindingOrder";
tooltipprofile = "ToolsGuiToolTipProfile";
ToolTip = "This step adjusts the output face winding order to be clockwise. The default face winding order is counter clockwise.";
hovertime = "1000";
canSaveDynamicFields = "0";
};
new GuiCheckBoxCtrl() {
useInactiveState = "0";
text = " Invert Normals";
groupNum = "-1";
buttonType = "ToggleButton";
useMouseEvents = "0";
isContainer = "0";
Profile = "ToolsGuiCheckBoxProfile";
HorizSizing = "right";
VertSizing = "bottom";
position = "210 130";
Extent = "200 13";
MinExtent = "8 2";
canSave = "1";
Visible = "1";
variable = "$Assimp::FlipNormals";
tooltipprofile = "ToolsGuiToolTipProfile";
ToolTip = "Reverse the normal vector direction for all normals.";
hovertime = "1000";
canSaveDynamicFields = "0";
};
new GuiButtonCtrl() {
text = "OK";
groupNum = "-1";
@ -392,10 +630,37 @@ function AssimpImportDlg::showDialog(%this, %shapePath, %cmd)
{
%this.path = %shapePath;
%this.cmd = %cmd;
// $Assimp::OverrideUpAxis value. Default is z-axis (no change to transforms)
if ($Assimp::OverrideUpAxis $= "")
$Assimp::OverrideUpAxis = 2;
%this-->upAxis.clear();
%this-->upAxis.add("X_AXIS", 0);
%this-->upAxis.add("Y_AXIS", 1);
%this-->upAxis.add("Z_AXIS", 2);
%this-->upAxis.setSelected($Assimp::OverrideUpAxis);
if ($Assimp::lodType $= "")
$Assimp::lodType = 0;
%this-->lodType.clear();
%this-->lodType.add("DetectDTS", 0);
%this-->lodType.add("SingleSize", 1);
%this-->lodType.add("TrailingNumber", 2);
%this-->lodType.setSelected($Assimp::lodType);
if ($Assimp::singleDetailSize $= "")
$Assimp::singleDetailSize = "2";
%this-->singleDetailSize.text = $Assimp::singleDetailSize;
//Triangulate is a default(currently mandatory) behavior
$Assimp::Triangulate = true;
//FlipWindingOrder assimp uses ccw, t3d uses cw. Is there any reason to expose this?
$Assimp::FlipWindingOrder = true;
// $Assimp::FlipUVs will be needed for virtually all textured models
$Assimp::FlipUVs = true;
Canvas.pushDialog(%this);
}
@ -410,6 +675,11 @@ function AssimpImportDlg::onOK(%this)
Canvas.popDialog(%this);
ColladaImportTreeView.clear();
$Assimp::OverrideUpAxis = %this-->upAxis.getSelected();
$Assimp::lodType = %this-->lodType.getSelected();
$Assimp::singleDetailSize = %this-->singleDetailSize.getText();
// Load the shape (always from the DAE)
$assimp::forceLoad = true;
eval(%this.cmd);

View file

@ -267,7 +267,7 @@ function ShapeEdSelectWindow::onSelect( %this, %path )
else
{
%cmd = "ShapeEditor.selectShape( \"" @ %path @ "\", false );";
ColladaImportDlg.showDialog( %path, %cmd );
showImportDialog( %path, %cmd );
}
}