Explorar o código

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.

OTHGMars %!s(int64=6) %!d(string=hai) anos
pai
achega
55c01fc4ca

+ 687 - 0
Templates/BaseGame/game/tools/gui/assimpImport.ed.gui

@@ -0,0 +1,687 @@
+//--- OBJECT WRITE BEGIN ---
+%guiContent = new GuiControl(AssimpImportDlg,EditorGuiGroup) {
+   isContainer = "1";
+   Profile = "ToolsGuiDefaultProfile";
+   HorizSizing = "width";
+   VertSizing = "height";
+   position = "0 0";
+   Extent = "1024 768";
+   MinExtent = "8 2";
+   canSave = "1";
+   Visible = "1";
+   tooltipprofile = "ToolsGuiToolTipProfile";
+   hovertime = "1000";
+   canSaveDynamicFields = "0";
+
+   new GuiWindowCtrl() {
+      resizeWidth = "0";
+      resizeHeight = "0";
+      canMove = "1";
+      canClose = "1";
+      canMinimize = "0";
+      canMaximize = "0";
+      minSize = "50 50";
+      closeCommand = "Canvas.popDialog(AssimpImportDlg);";
+      EdgeSnap = "1";
+      text = "Open Asset Import Library";
+      Margin = "0 0 0 0";
+      Padding = "0 0 0 0";
+      AnchorTop = "1";
+      AnchorBottom = "0";
+      AnchorLeft = "1";
+      AnchorRight = "0";
+      isContainer = "1";
+      Profile = "ToolsGuiWindowProfile";
+      HorizSizing = "center";
+      VertSizing = "center";
+      position = "254 136";
+      Extent = "416 390";
+      MinExtent = "8 8";
+      canSave = "1";
+      Visible = "1";
+      Accelerator = "escape";
+      tooltipprofile = "ToolsGuiToolTipProfile";
+      hovertime = "1000";
+      internalName = "window";
+      canSaveDynamicFields = "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 = "ToolsGuiTextRightProfile";
+         HorizSizing = "right";
+         VertSizing = "bottom";
+         position = "10 31";
+         Extent = "40 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 = "56 30";
+         Extent = "66 18";
+         MinExtent = "8 2";
+         canSave = "1";
+         Visible = "1";
+         tooltipprofile = "ToolsGuiToolTipProfile";
+         hovertime = "1000";
+         internalName = "upAxis";
+         canSaveDynamicFields = "0";
+      };
+      
+      new GuiCheckBoxCtrl() {
+         useInactiveState = "0";
+         text = " Convert To Left Handed";
+         groupNum = "-1";
+         buttonType = "ToggleButton";
+         useMouseEvents = "0";
+         isContainer = "0";
+         Profile = "ToolsGuiCheckBoxProfile";
+         HorizSizing = "right";
+         VertSizing = "bottom";
+         position = "10 50";
+         Extent = "200 13";
+         MinExtent = "8 2";
+         canSave = "1";
+         Visible = "1";
+         variable = "$Assimp::ConvertToLeftHanded";
+         tooltipprofile = "ToolsGuiToolTipProfile";
+         ToolTip = "Converts the model to left-handed";
+         hovertime = "1000";
+         internalName = "overrideScale";
+         canSaveDynamicFields = "0";
+      };
+      
+      new GuiCheckBoxCtrl() {
+         useInactiveState = "0";
+         text = " Triangulate";
+         groupNum = "-1";
+         buttonType = "ToggleButton";
+         useMouseEvents = "0";
+         isContainer = "0";
+         Profile = "ToolsGuiCheckBoxProfile";
+         HorizSizing = "right";
+         VertSizing = "bottom";
+         position = "10 70";
+         Extent = "200 13";
+         MinExtent = "8 2";
+         canSave = "1";
+         Visible = "1";
+         Active = "0";
+         variable = "$Assimp::Triangulate";
+         tooltipprofile = "ToolsGuiToolTipProfile";
+         ToolTip = "Triangulate polygons with more than 3 edges.";
+         hovertime = "1000";
+         internalName = "overrideScale";
+         canSaveDynamicFields = "0";
+      };
+
+      new GuiCheckBoxCtrl() {
+         useInactiveState = "0";
+         text = " Calculate Tangent Space";
+         groupNum = "-1";
+         buttonType = "ToggleButton";
+         useMouseEvents = "0";
+         isContainer = "0";
+         Profile = "ToolsGuiCheckBoxProfile";
+         HorizSizing = "right";
+         VertSizing = "bottom";
+         position = "10 90";
+         Extent = "200 13";
+         MinExtent = "8 2";
+         canSave = "1";
+         Visible = "1";
+         variable = "$Assimp::CalcTangentSpace";
+         tooltipprofile = "ToolsGuiToolTipProfile";
+         ToolTip = "Calculate tangents and bitangents, if possible.";
+         hovertime = "1000";
+         internalName = "overrideScale";
+         canSaveDynamicFields = "0";
+      };
+      
+      new GuiCheckBoxCtrl() {
+         useInactiveState = "0";
+         text = " Validate Data Structure";
+         groupNum = "-1";
+         buttonType = "ToggleButton";
+         useMouseEvents = "0";
+         isContainer = "0";
+         Profile = "ToolsGuiCheckBoxProfile";
+         HorizSizing = "right";
+         VertSizing = "bottom";
+         position = "10 110";
+         Extent = "200 13";
+         MinExtent = "8 2";
+         canSave = "1";
+         Visible = "1";
+         variable = "$Assimp::ValidateDataStructure";
+         tooltipprofile = "ToolsGuiToolTipProfile";
+         ToolTip = "Perform a full validation of the loader's output.";
+         hovertime = "1000";
+         internalName = "overrideScale";
+         canSaveDynamicFields = "0";
+      };
+      
+      new GuiCheckBoxCtrl() {
+         useInactiveState = "0";
+         text = " Improve Cache Locality";
+         groupNum = "-1";
+         buttonType = "ToggleButton";
+         useMouseEvents = "0";
+         isContainer = "0";
+         Profile = "ToolsGuiCheckBoxProfile";
+         HorizSizing = "right";
+         VertSizing = "bottom";
+         position = "10 130";
+         Extent = "200 13";
+         MinExtent = "8 2";
+         canSave = "1";
+         Visible = "1";
+         variable = "$Assimp::ImproveCacheLocality";
+         tooltipprofile = "ToolsGuiToolTipProfile";
+         ToolTip = "Improve the cache locality of the output vertices.";
+         hovertime = "1000";
+         internalName = "overrideScale";
+         canSaveDynamicFields = "0";
+      };
+         
+      new GuiCheckBoxCtrl() {
+         useInactiveState = "0";
+         text = " Remove Redundant Materials";
+         groupNum = "-1";
+         buttonType = "ToggleButton";
+         useMouseEvents = "0";
+         isContainer = "0";
+         Profile = "ToolsGuiCheckBoxProfile";
+         HorizSizing = "right";
+         VertSizing = "bottom";
+         position = "10 150";
+         Extent = "200 13";
+         MinExtent = "8 2";
+         canSave = "1";
+         Visible = "1";
+         variable = "$Assimp::RemoveRedundantMaterials";
+         tooltipprofile = "ToolsGuiToolTipProfile";
+         ToolTip = "Removes redundant materials.";
+         hovertime = "1000";
+         internalName = "overrideScale";
+         canSaveDynamicFields = "0";
+      };
+      
+      new GuiCheckBoxCtrl() {
+         useInactiveState = "0";
+         text = " Find Degenerates";
+         groupNum = "-1";
+         buttonType = "ToggleButton";
+         useMouseEvents = "0";
+         isContainer = "0";
+         Profile = "ToolsGuiCheckBoxProfile";
+         HorizSizing = "right";
+         VertSizing = "bottom";
+         position = "10 170";
+         Extent = "200 13";
+         MinExtent = "8 2";
+         canSave = "1";
+         Visible = "1";
+         variable = "$Assimp::FindDegenerates";
+         tooltipprofile = "ToolsGuiToolTipProfile";
+         ToolTip = "Remove degenerated polygons from the import.";
+         hovertime = "1000";
+         internalName = "overrideScale";
+         canSaveDynamicFields = "0";
+      };
+      
+      new GuiCheckBoxCtrl() {
+         useInactiveState = "0";
+         text = " Find Invalid Data";
+         groupNum = "-1";
+         buttonType = "ToggleButton";
+         useMouseEvents = "0";
+         isContainer = "0";
+         Profile = "ToolsGuiCheckBoxProfile";
+         HorizSizing = "right";
+         VertSizing = "bottom";
+         position = "10 190";
+         Extent = "200 13";
+         MinExtent = "8 2";
+         canSave = "1";
+         Visible = "1";
+         variable = "$Assimp::FindInvalidData";
+         tooltipprofile = "ToolsGuiToolTipProfile";
+         ToolTip = "Detect invalid model data, such as invalid normal vectors.";
+         hovertime = "1000";
+         internalName = "overrideScale";
+         canSaveDynamicFields = "0";
+      };
+      
+      new GuiCheckBoxCtrl() {
+         useInactiveState = "0";
+         text = " Generate UV Coordinates";
+         groupNum = "-1";
+         buttonType = "ToggleButton";
+         useMouseEvents = "0";
+         isContainer = "0";
+         Profile = "ToolsGuiCheckBoxProfile";
+         HorizSizing = "right";
+         VertSizing = "bottom";
+         position = "10 210";
+         Extent = "200 13";
+         MinExtent = "8 2";
+         canSave = "1";
+         Visible = "1";
+         variable = "$Assimp::GenUVCoords";
+         tooltipprofile = "ToolsGuiToolTipProfile";
+         ToolTip = "Convert spherical, cylindrical, box and planar mapping to proper UVs.";
+         hovertime = "1000";
+         internalName = "overrideScale";
+         canSaveDynamicFields = "0";
+      };
+      
+      new GuiCheckBoxCtrl() {
+         useInactiveState = "0";
+         text = " Transform UV Coordinates";
+         groupNum = "-1";
+         buttonType = "ToggleButton";
+         useMouseEvents = "0";
+         isContainer = "0";
+         Profile = "ToolsGuiCheckBoxProfile";
+         HorizSizing = "right";
+         VertSizing = "bottom";
+         position = "10 230";
+         Extent = "200 13";
+         MinExtent = "8 2";
+         canSave = "1";
+         Visible = "1";
+         variable = "$Assimp::TransformUVCoords";
+         tooltipprofile = "ToolsGuiToolTipProfile";
+         ToolTip = "Preprocess UV transformations (scaling, translation ...)";
+         hovertime = "1000";
+         internalName = "overrideScale";
+         canSaveDynamicFields = "0";
+      };
+      
+      new GuiCheckBoxCtrl() {
+         useInactiveState = "0";
+         text = " Flip UV Coordinates";
+         groupNum = "-1";
+         buttonType = "ToggleButton";
+         useMouseEvents = "0";
+         isContainer = "0";
+         Profile = "ToolsGuiCheckBoxProfile";
+         HorizSizing = "right";
+         VertSizing = "bottom";
+         position = "10 250";
+         Extent = "200 13";
+         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.";
+         hovertime = "1000";
+         internalName = "overrideScale";
+         canSaveDynamicFields = "0";
+      };
+      
+      new GuiCheckBoxCtrl() {
+         useInactiveState = "0";
+         text = " Limit Bone Weights";
+         groupNum = "-1";
+         buttonType = "ToggleButton";
+         useMouseEvents = "0";
+         isContainer = "0";
+         Profile = "ToolsGuiCheckBoxProfile";
+         HorizSizing = "right";
+         VertSizing = "bottom";
+         position = "10 290";
+         Extent = "200 13";
+         MinExtent = "8 2";
+         canSave = "1";
+         Visible = "1";
+         variable = "$Assimp::LimitBoneWeights";
+         tooltipprofile = "ToolsGuiToolTipProfile";
+         ToolTip = "Limit bone weights to 4 per vertex.";
+         hovertime = "1000";
+         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";
+         buttonType = "PushButton";
+         useMouseEvents = "0";
+         isContainer = "0";
+         Profile = "ToolsGuiButtonProfile";
+         HorizSizing = "right";
+         VertSizing = "bottom";
+         position = "120 348";
+         Extent = "86 22";
+         MinExtent = "8 2";
+         canSave = "1";
+         Visible = "1";
+         Command = "AssimpImportDlg.onOK();";
+         tooltipprofile = "ToolsGuiToolTipProfile";
+         ToolTip = "Load the COLLADA model";
+         hovertime = "1000";
+         canSaveDynamicFields = "0";
+      };
+      new GuiButtonCtrl() {
+         text = "Cancel";
+         groupNum = "-1";
+         buttonType = "PushButton";
+         useMouseEvents = "0";
+         isContainer = "0";
+         Profile = "ToolsGuiButtonProfile";
+         HorizSizing = "right";
+         VertSizing = "bottom";
+         position = "220 348";
+         Extent = "86 22";
+         MinExtent = "8 2";
+         canSave = "1";
+         Visible = "1";
+         Command = "AssimpImportDlg.onCancel();";
+         tooltipprofile = "ToolsGuiToolTipProfile";
+         ToolTip = "Exit without loading the COLLADA model";
+         hovertime = "1000";
+         canSaveDynamicFields = "0";
+      };
+   };
+};
+//--- OBJECT WRITE END ---
+
+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);
+}
+
+function AssimpImportDlg::onCancel(%this)
+{
+   Canvas.popDialog(%this);
+   ColladaImportTreeView.clear();
+}
+
+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);
+   $assimp::forceLoad = true;
+}

+ 18 - 0
Templates/BaseGame/game/tools/gui/colladaImport.ed.gui

@@ -1696,3 +1696,21 @@ function convertColladaModels(%pattern)
 
 
    $collada::forceLoadDAE = false;
    $collada::forceLoadDAE = false;
 }
 }
+
+function showImportDialog(%shapePath, %cmd)
+{
+   %this.path = %shapePath;
+   %this.cmd = %cmd;
+
+   if ( fileExt(%shapePath) $= ".dts" || fileExt(%shapePath) $= ".dsq" 
+      || fileExt(%shapePath) $= ".dae" || fileExt(%shapePath) $= ".kmz" )
+   {
+      // Regular Load
+      ColladaImportDlg.showDialog(%shapePath, %cmd);
+   } else if ( isSupportedFormat(stripChars(fileExt(%shapePath), ".")) )
+   {
+      // Assimp Load
+      if ( isObject(AssimpImportDlg) )
+         AssimpImportDlg.showDialog(%shapePath, %cmd);
+   }
+}

+ 2 - 1
Templates/BaseGame/game/tools/gui/guiDialogs.ed.cs

@@ -35,4 +35,5 @@ exec("./GuiEaseEditDlg.ed.cs");
 exec("./guiObjectInspector.ed.cs");
 exec("./guiObjectInspector.ed.cs");
 exec("./uvEditor.ed.gui");
 exec("./uvEditor.ed.gui");
 exec("./objectSelection.ed.cs");
 exec("./objectSelection.ed.cs");
-exec("./postFxManager.gui");
+exec("./postFxManager.gui");
+exec("./assimpImport.ed.gui");

+ 2 - 2
Templates/BaseGame/game/tools/worldEditor/scripts/editors/creator.ed.cs

@@ -675,7 +675,7 @@ function EWCreatorWindow::addShapeIcon( %this, %datablock )
    %shapePath = ( %datablock.shapeFile !$= "" ) ? %datablock.shapeFile : %datablock.shapeName;
    %shapePath = ( %datablock.shapeFile !$= "" ) ? %datablock.shapeFile : %datablock.shapeName;
    
    
    %createCmd = "EWCreatorWindow.createObject( \\\"" @ %cmd @ "\\\" );";
    %createCmd = "EWCreatorWindow.createObject( \\\"" @ %cmd @ "\\\" );";
-   %ctrl.altCommand = "ColladaImportDlg.showDialog( \"" @ %shapePath @ "\", \"" @ %createCmd @ "\" );";
+   %ctrl.altCommand = "showImportDialog( \"" @ %shapePath @ "\", \"" @ %createCmd @ "\" );";
 
 
    %ctrl.iconBitmap = EditorIconRegistry::findIconByClassName( %class );
    %ctrl.iconBitmap = EditorIconRegistry::findIconByClassName( %class );
    %ctrl.text = %name;
    %ctrl.text = %name;
@@ -701,7 +701,7 @@ function EWCreatorWindow::addStaticIcon( %this, %fullPath )
           "Last Modified: " @ fileModifiedTime( %fullPath );
           "Last Modified: " @ fileModifiedTime( %fullPath );
 
 
    %createCmd = "EWCreatorWindow.createStatic( \\\"" @ %fullPath @ "\\\" );";
    %createCmd = "EWCreatorWindow.createStatic( \\\"" @ %fullPath @ "\\\" );";
-   %ctrl.altCommand = "ColladaImportDlg.showDialog( \"" @ %fullPath @ "\", \"" @ %createCmd @ "\" );";
+   %ctrl.altCommand = "showImportDialog( \"" @ %fullPath @ "\", \"" @ %createCmd @ "\" );";
 
 
    %ctrl.iconBitmap = ( ( %ext $= ".dts" ) ? EditorIconRegistry::findIconByClassName( "TSStatic" ) : "tools/gui/images/iconCollada" );
    %ctrl.iconBitmap = ( ( %ext $= ".dts" ) ? EditorIconRegistry::findIconByClassName( "TSStatic" ) : "tools/gui/images/iconCollada" );
    %ctrl.text = %file;
    %ctrl.text = %file;

+ 286 - 16
Templates/Full/game/tools/gui/assimpImport.ed.gui

@@ -45,26 +45,52 @@
       internalName = "window";
       internalName = "window";
       canSaveDynamicFields = "0";
       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";
          isContainer = "0";
-         Profile = "ToolsGuiCheckBoxProfile";
+         Profile = "ToolsGuiTextRightProfile";
          HorizSizing = "right";
          HorizSizing = "right";
          VertSizing = "bottom";
          VertSizing = "bottom";
-         position = "10 30";
-         Extent = "200 13";
+         position = "10 31";
+         Extent = "40 16";
          MinExtent = "8 2";
          MinExtent = "8 2";
          canSave = "1";
          canSave = "1";
          Visible = "1";
          Visible = "1";
-         variable = "$Assimp::SwapYZ";
          tooltipprofile = "ToolsGuiToolTipProfile";
          tooltipprofile = "ToolsGuiToolTipProfile";
-         ToolTip = "Corrects transformations so Z is up.";
          hovertime = "1000";
          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";
          canSaveDynamicFields = "0";
       };
       };
       
       
@@ -106,6 +132,7 @@
          MinExtent = "8 2";
          MinExtent = "8 2";
          canSave = "1";
          canSave = "1";
          Visible = "1";
          Visible = "1";
+         Active = "0";
          variable = "$Assimp::Triangulate";
          variable = "$Assimp::Triangulate";
          tooltipprofile = "ToolsGuiToolTipProfile";
          tooltipprofile = "ToolsGuiToolTipProfile";
          ToolTip = "Triangulate polygons with more than 3 edges.";
          ToolTip = "Triangulate polygons with more than 3 edges.";
@@ -300,7 +327,7 @@
       
       
       new GuiCheckBoxCtrl() {
       new GuiCheckBoxCtrl() {
          useInactiveState = "0";
          useInactiveState = "0";
-         text = " Find Instances";
+         text = " Flip UV Coordinates";
          groupNum = "-1";
          groupNum = "-1";
          buttonType = "ToggleButton";
          buttonType = "ToggleButton";
          useMouseEvents = "0";
          useMouseEvents = "0";
@@ -313,6 +340,28 @@
          MinExtent = "8 2";
          MinExtent = "8 2";
          canSave = "1";
          canSave = "1";
          Visible = "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";
          variable = "$Assimp::FindInstances";
          tooltipprofile = "ToolsGuiToolTipProfile";
          tooltipprofile = "ToolsGuiToolTipProfile";
          ToolTip = "search for instanced meshes and remove them by references to one master.";
          ToolTip = "search for instanced meshes and remove them by references to one master.";
@@ -331,7 +380,7 @@
          Profile = "ToolsGuiCheckBoxProfile";
          Profile = "ToolsGuiCheckBoxProfile";
          HorizSizing = "right";
          HorizSizing = "right";
          VertSizing = "bottom";
          VertSizing = "bottom";
-         position = "10 270";
+         position = "10 290";
          Extent = "200 13";
          Extent = "200 13";
          MinExtent = "8 2";
          MinExtent = "8 2";
          canSave = "1";
          canSave = "1";
@@ -343,7 +392,196 @@
          internalName = "overrideScale";
          internalName = "overrideScale";
          canSaveDynamicFields = "0";
          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() {
       new GuiButtonCtrl() {
          text = "OK";
          text = "OK";
          groupNum = "-1";
          groupNum = "-1";
@@ -392,10 +630,37 @@ function AssimpImportDlg::showDialog(%this, %shapePath, %cmd)
 {
 {
    %this.path = %shapePath;
    %this.path = %shapePath;
    %this.cmd = %cmd;
    %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
    //Triangulate is a default(currently mandatory) behavior
    $Assimp::Triangulate = true;
    $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);
    Canvas.pushDialog(%this);
 }
 }
 
 
@@ -410,6 +675,11 @@ function AssimpImportDlg::onOK(%this)
    Canvas.popDialog(%this);
    Canvas.popDialog(%this);
    ColladaImportTreeView.clear();
    ColladaImportTreeView.clear();
 
 
+   $Assimp::OverrideUpAxis = %this-->upAxis.getSelected();
+
+   $Assimp::lodType = %this-->lodType.getSelected();
+   $Assimp::singleDetailSize = %this-->singleDetailSize.getText();
+
    // Load the shape (always from the DAE)
    // Load the shape (always from the DAE)
    $assimp::forceLoad = true;
    $assimp::forceLoad = true;
    eval(%this.cmd);
    eval(%this.cmd);

+ 1 - 1
Templates/Full/game/tools/shapeEditor/scripts/shapeEditor.ed.cs

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