예제 #1
0
        private DatasmithMeshInfo GenerateMeshInfo(Guid ObjectID, List <Mesh> Meshes, List <ObjectAttributes> Attributes)
        {
            DatasmithMeshInfo MeshInfo = null;

            if (GuidToHierarchyNodeDictionary.TryGetValue(ObjectID, out RhinoSceneHierarchyNode HierarchyNode))
            {
                Vector3d   PivotOffset     = FDatasmithRhinoMeshExporter.CenterMeshesOnPivot(Meshes);
                List <int> MaterialIndices = new List <int>(Attributes.Count);
                for (int AttributeIndex = 0; AttributeIndex < Attributes.Count; ++AttributeIndex)
                {
                    int MaterialIndex = GetMaterialIndexFromAttributes(HierarchyNode, Attributes[AttributeIndex]);
                    MaterialIndices.Add(MaterialIndex);
                }

                string Name  = FDatasmithFacadeElement.GetStringHash("M:" + HierarchyNode.Info.Name);
                string Label = HierarchyNode.Info.Label;

                MeshInfo = new DatasmithMeshInfo(Meshes, PivotOffset, MaterialIndices, Name, Label);
            }
            else
            {
                RhinoApp.WriteLine("Could not find the corresponding hierarchy node for the object ID: {0}", ObjectID);
            }

            return(MeshInfo);
        }
        public static Rhino.Commands.Result ExportScene(DatasmithRhinoSceneParser SceneParser, FDatasmithFacadeScene DatasmithScene)
        {
            FDatasmithRhinoProgressManager.Instance.StartMainTaskProgress("Exporting Materials", 0.2f);
            FDatasmithRhinoMaterialExporter.ExportMaterials(DatasmithScene, SceneParser);

            FDatasmithRhinoProgressManager.Instance.StartMainTaskProgress("Exporting Meshes", 0.7f);
            FDatasmithRhinoMeshExporter.ExportMeshes(DatasmithScene, SceneParser);

            FDatasmithRhinoProgressManager.Instance.StartMainTaskProgress("Exporting Actors", 0.8f);
            ExportActors(DatasmithScene, SceneParser);

            return(Rhino.Commands.Result.Success);
        }