コード例 #1
0
        /// <summary>
        /// convert preview SO to print mesh, discard preview
        /// TODO: be able to swap/transfer preview into print
        /// </summary>
        static PrintMeshSO convert_to_print_mesh(DMeshSO previewSO)
        {
            previewSO.EnableSpatial = true;
            PrintMeshSO printMeshSO = previewSO.DuplicateSubtype <PrintMeshSO>();

            printMeshSO.Name = previewSO.Name;
            printMeshSO.AssignSOMaterial(CCMaterials.PrintMeshMaterial);

            CC.ActiveScene.RemoveSceneObject(previewSO, true);

            CCActions.AddNewPrintMesh(printMeshSO);

            return(printMeshSO);
        }
コード例 #2
0
        public static void OnApply_GenerateGraphSupportsTool(GenerateGraphSupportsTool tool, DMeshSO previewSO)
        {
            if (previewSO.Mesh.TriangleCount == 0)
            {
                return;
            }

            if (tool.Targets.Count() == CC.Objects.PrintMeshes.Count)
            {
                CC.Settings.GenerateSupport = false;
            }

            PrintMeshSO printSO = convert_to_print_mesh(previewSO);

            printSO.Name = UniqueNames.GetNext("Tree Support");
            printSO.Settings.ObjectType = PrintMeshSettings.ObjectTypes.Support;
            printSO.AssignSOMaterial(CCMaterials.SupportMeshMaterial);
            CC.ActiveScene.History.PushInteractionCheckpoint();
        }
コード例 #3
0
 public static void OnApply_AddHoleTool(AddHoleTool tool)
 {
     if (tool.HoleType == AddHoleTool.HoleTypes.CavityObject)
     {
         PrintMeshSO printSO = convert_to_print_mesh(tool.GetOutputSO());
         printSO.Name = UniqueNames.GetNext("Hole");
         printSO.Settings.ObjectType = PrintMeshSettings.ObjectTypes.Cavity;
         printSO.AssignSOMaterial(CCMaterials.CavityMeshMaterial);
     }
     else
     {
         bool    replace_input = tool.Parameters.GetValueBool("replace_input");
         DMeshSO previewSO     = tool.GetOutputSO();
         previewSO.EnableSpatial = true;   // required because preview has no spatial DS
         standard_mesh_tool_handler(new List <DMeshSO>()
         {
             tool.TargetSO as DMeshSO
         }, previewSO, replace_input);
     }
     CC.ActiveScene.History.PushInteractionCheckpoint();
 }
コード例 #4
0
        protected void update_mesh_material(PrintMeshSO so)
        {
            bool enable_shadow = true;

            if (so.Settings.ObjectType == PrintMeshSettings.ObjectTypes.Support)
            {
                so.AssignSOMaterial(CCMaterials.SupportMeshMaterial);
            }
            else if (so.Settings.ObjectType == PrintMeshSettings.ObjectTypes.Cavity)
            {
                so.AssignSOMaterial(CCMaterials.CavityMeshMaterial);
            }
            else if (so.Settings.ObjectType == PrintMeshSettings.ObjectTypes.CropRegion)
            {
                so.AssignSOMaterial(CCMaterials.CropRegionMeshMaterial);
                enable_shadow = false;
            }
            else if (so.Settings.ObjectType == PrintMeshSettings.ObjectTypes.Ignored)
            {
                so.AssignSOMaterial(CCMaterials.IgnoreMeshMaterial);
                enable_shadow = false;
            }
            else if (so.Mesh.CachedIsClosed == false)
            {
                so.AssignSOMaterial(CCMaterials.OpenPrintMeshMaterial);
            }
            else
            {
                so.AssignSOMaterial(CCMaterials.PrintMeshMaterial);
            }

            if (enable_shadow != so.ShadowsEnabled)
            {
                so.SetShadowsEnabled(enable_shadow);
            }
        }