Exemplo n.º 1
0
        /// <summary>
        /// - if not replace input, convert preview to print
        /// - if replace, if one target and one preview, keep target and replace w/ mesh from preview
        ///   - otherwise remove targets and convert preview to print
        /// </summary>
        static void standard_mesh_tool_handler(List <DMeshSO> targets, DMeshSO previewSO, bool replace_input, string newNameStr = null)
        {
            if (replace_input)
            {
                if (targets.Count == 1)
                {
                    replace_single(targets[0], previewSO);
                    CC.ActiveScene.RemoveSceneObject(previewSO, true);
                }
                else
                {
                    foreach (DMeshSO so in targets)
                    {
                        CCActions.RemovePrintMesh(so as PrintMeshSO);
                    }
                    if (newNameStr != null)
                    {
                        previewSO.Name = UniqueNames.GetNext(newNameStr);
                    }
                    convert_to_print_mesh(previewSO);
                }
            }
            else
            {
                if (newNameStr != null)
                {
                    previewSO.Name = UniqueNames.GetNext(newNameStr);
                }

                convert_to_print_mesh(previewSO);
            }
        }
Exemplo n.º 2
0
        public static void OnApply_SeparateSolidsTool(SeparateSolidsTool tool, List <DMeshSO> previews)
        {
            bool replace_input = tool.Parameters.GetValueBool("replace_input");

            if (replace_input)
            {
                foreach (DMeshSO so in tool.Targets)
                {
                    CCActions.RemovePrintMesh(so as PrintMeshSO);
                }
            }

            foreach (var so in previews)
            {
                so.Name = UniqueNames.GetNext("SeparatedPart");
                convert_to_print_mesh(so);
            }
            CC.ActiveScene.History.PushInteractionCheckpoint();
        }