public void Start()
    {
        ITool curTool = CC.ActiveContext.ToolManager.ActiveRightTool;

        if (curTool == null)
        {
            return;
        }
        Tool = curTool as MeshEditorTool;
        if (Tool == null)
        {
            return;
        }
        ActiveParameterSet = Tool.Parameters;

        deleteTri = UnityUIUtil.FindButtonAndAddClickHandler(this.gameObject, "DeleteTriangleButton", () => {
            clear_selection(); set_selection(deleteTri, MeshEditorTool.EditOperations.DeleteTriangle);
        });
        deleteEdge = UnityUIUtil.FindButtonAndAddClickHandler(this.gameObject, "DeleteEdgeButton", () => {
            clear_selection(); set_selection(deleteEdge, MeshEditorTool.EditOperations.DeleteEdge);
        });
        deleteVtx = UnityUIUtil.FindButtonAndAddClickHandler(this.gameObject, "DeleteVertexButton", () => {
            clear_selection(); set_selection(deleteVtx, MeshEditorTool.EditOperations.DeleteVertex);
        });
        deleteComponent = UnityUIUtil.FindButtonAndAddClickHandler(this.gameObject, "DeleteComponentButton", () => {
            clear_selection(); set_selection(deleteComponent, MeshEditorTool.EditOperations.DeleteComponent);
        });
        deleteRing = UnityUIUtil.FindButtonAndAddClickHandler(this.gameObject, "DeleteRingButton", () => {
            clear_selection(); set_selection(deleteRing, MeshEditorTool.EditOperations.DeleteBorderRing);
        });

        collapseEdge = UnityUIUtil.FindButtonAndAddClickHandler(this.gameObject, "CollapseButton", () => {
            clear_selection(); set_selection(collapseEdge, MeshEditorTool.EditOperations.CollapseEdge);
        });
        flipEdge = UnityUIUtil.FindButtonAndAddClickHandler(this.gameObject, "FlipButton", () => {
            clear_selection(); set_selection(flipEdge, MeshEditorTool.EditOperations.FlipEdge);
        });
        splitEdge = UnityUIUtil.FindButtonAndAddClickHandler(this.gameObject, "SplitButton", () => {
            clear_selection(); set_selection(splitEdge, MeshEditorTool.EditOperations.SplitEdge);
        });


        pokeFace = UnityUIUtil.FindButtonAndAddClickHandler(this.gameObject, "PokeTriangleButton", () => {
            clear_selection(); set_selection(pokeFace, MeshEditorTool.EditOperations.PokeTriangle);
        });
        bridgeEdges = UnityUIUtil.FindButtonAndAddClickHandler(this.gameObject, "BridgeButton", () => {
            clear_selection(); set_selection(bridgeEdges, MeshEditorTool.EditOperations.BridgeEdges);
        });


        allowBackface = UnityUIUtil.FindToggleAndConnectToSource(this.gameObject, "BackfaceToggle",
                                                                 () => { return(ActiveParameterSet.GetValueBool("allow_backface_hits")); },
                                                                 (boolValue) => { ActiveParameterSet.SetValue("allow_backface_hits", boolValue); });

        set_selection(deleteTri, MeshEditorTool.EditOperations.DeleteTriangle);
    }
Beispiel #2
0
        public Toggle RegisterToggle(string toggleName, string toolParamName)
        {
            Toggle toggle = UnityUIUtil.FindToggleAndConnectToSource(this.gameObject, toggleName,
                                                                     () => { return(ActiveParameterSet.GetValueBool(toolParamName)); },
                                                                     (boolValue) => { ActiveParameterSet.SetValue(toolParamName, boolValue); update_values_from_tool(); });

            TabOrder.Add(toggle);

            toggle_params.Add(new ToggleParam()
            {
                widget = toggle, paramName = toolParamName
            });

            return(toggle);
        }
Beispiel #3
0
        public void Start()
        {
            CC.Settings.OnNewSettings     += Settings_OnNewSettings;
            CC.Settings.OnSettingModified += Settings_OnSettingModified;

            enableBridging = UnityUIUtil.FindToggleAndConnectToSource(this.gameObject, "EnableBridgingToggle",
                                                                      () => { return(CC.Settings.EnableBridging); },
                                                                      (boolValue) => { CC.Settings.EnableBridging = boolValue; });

            maxDistance = UnityUIUtil.FindInputAndAddFloatHandlers(this.gameObject, "MaxBridgeDistInputField",
                                                                   () => { return((float)CC.Settings.MaxBridgeDistanceMM); },
                                                                   (floatValue) => { CC.Settings.MaxBridgeDistanceMM = Math.Round(floatValue, 2); }, 0.01f, 500.00f);
            maxDistanceRow = maxDistance.transform.parent.gameObject;

            is_expanded = true;
            update_visibility();
        }
Beispiel #4
0
        public void Start()
        {
            CC.Settings.OnNewSettings     += Settings_OnNewSettings;
            CC.Settings.OnSettingModified += Settings_OnSettingModified;

            generateSupport = UnityUIUtil.FindToggleAndConnectToSource(this.gameObject, "GenerateSupportToggle",
                                                                       () => { return(CC.Settings.GenerateSupport); },
                                                                       (boolValue) => { CC.Settings.GenerateSupport = boolValue; });

            overhangAngle = UnityUIUtil.FindInputAndAddFloatHandlers(this.gameObject, "OverhangAngleInputField",
                                                                     () => { return((float)CC.Settings.OverhangAngleDeg); },
                                                                     (floatValue) => { CC.Settings.OverhangAngleDeg = Math.Round(floatValue, 2); }, 0.01f, 89.99f);
            overhangAngleRow = overhangAngle.transform.parent.gameObject;

            supportMinZTips = UnityUIUtil.FindToggleAndConnectToSource(this.gameObject, "SupportTipsToggle",
                                                                       () => { return(CC.Settings.SupportMinZTips); },
                                                                       (boolValue) => { CC.Settings.SupportMinZTips = boolValue; });
            supportMinZTipsRow = supportMinZTips.transform.parent.gameObject;

            supportSpacing = UnityUIUtil.FindInputAndAddFloatHandlers(this.gameObject, "SupportSpacingInputField",
                                                                      () => { return((float)CC.Settings.SupportStepX); },
                                                                      (floatValue) => { CC.Settings.SupportStepX = Math.Round(floatValue, 5); }, 1.0f, 9999.0f);
            supportSpacingRow = supportSpacing.transform.parent.gameObject;

            supportShell = UnityUIUtil.FindToggleAndConnectToSource(this.gameObject, "SupportShellToggle",
                                                                    () => { return(CC.Settings.EnableSupportShell); },
                                                                    (boolValue) => { CC.Settings.EnableSupportShell = boolValue; });
            supportShellRow = supportShell.transform.parent.gameObject;

            supportReleaseOpt = UnityUIUtil.FindToggleAndConnectToSource(this.gameObject, "SupportReleaseOptToggle",
                                                                         () => { return(CC.Settings.EnableSupportReleaseOpt); },
                                                                         (boolValue) => { CC.Settings.EnableSupportReleaseOpt = boolValue; });

            supportGap = UnityUIUtil.FindInputAndAddFloatHandlers(this.gameObject, "SupportGapInputField",
                                                                  () => { return((float)CC.Settings.SupportSolidSpace); },
                                                                  (floatValue) => { CC.Settings.SupportSolidSpace = Math.Round(floatValue, 5); }, 0.0f, 100.0f);
            supportGapRow = supportGap.transform.parent.gameObject;

            is_expanded = true;
            update_visibility();
        }
    public void Start()
    {
        // Machine Settings panel
        CC.ObjSettings.OnNewSettings     += Settings_OnNewSettings;
        CC.ObjSettings.OnSettingModified += Settings_OnSettingModified;

        objectType = UnityUIUtil.FindDropDownAndAddHandlers(Panel, "ObjectTypeDropDown",
                                                            () => { return(CC.ObjSettings.ObjectTypeInt); },
                                                            (intValue) => { CC.ObjSettings.ObjectTypeInt = intValue; },
                                                            (int)PrintMeshSettings.ObjectTypes.Solid, (int)PrintMeshSettings.ObjectTypes.Ignored);

        noVoids = UnityUIUtil.FindToggleAndConnectToSource(Panel, "NoVoidsToggle",
                                                           () => { return(CC.ObjSettings.NoVoids); },
                                                           (boolValue) => { CC.ObjSettings.NoVoids = boolValue; });

        shellOnly = UnityUIUtil.FindToggleAndConnectToSource(Panel, "ShellOnlyToggle",
                                                             () => { return(CC.ObjSettings.OuterShellOnly); },
                                                             (boolValue) => { CC.ObjSettings.OuterShellOnly = boolValue; });

        openMeshMode = UnityUIUtil.FindDropDownAndAddHandlers(Panel, "OpenMeshesDropDown",
                                                              () => { return(CC.ObjSettings.OpenModeInt); },
                                                              (intValue) => { CC.ObjSettings.OpenModeInt = intValue; },
                                                              (int)PrintMeshSettings.OpenMeshModes.Default, (int)PrintMeshSettings.OpenMeshModes.Ignored);

        clearance = UnityUIUtil.FindInputAndAddFloatHandlers(this.gameObject, "ClearanceInputField",
                                                             () => { return((float)CC.ObjSettings.Clearance); },
                                                             (floatValue) => { CC.ObjSettings.Clearance = Math.Round(floatValue, 3); }, -100.0f, 100.0f);
        clearanceRow = clearance.transform.parent.gameObject;

        offsetxy = UnityUIUtil.FindInputAndAddFloatHandlers(this.gameObject, "XYOffsetInputField",
                                                            () => { return((float)CC.ObjSettings.OffsetXY); },
                                                            (floatValue) => { CC.ObjSettings.OffsetXY = Math.Round(floatValue, 3); }, -100.0f, 100.0f);
        offsetxyRow = offsetxy.transform.parent.gameObject;

        autoReload = UnityUIUtil.FindToggleAndConnectToSource(Panel, "AutoUpdateToggle",
                                                              () => { return(CC.ObjSettings.AutoReloadChanges); },
                                                              (boolValue) => { CC.ObjSettings.AutoReloadChanges = boolValue; });
        autoReload.interactable = false;
    }
Beispiel #6
0
        public void Start()
        {
            CC.Settings.OnNewSettings     += Settings_OnNewSettings;
            CC.Settings.OnSettingModified += Settings_OnSettingModified;

            layerHeight = UnityUIUtil.FindInputAndAddFloatHandlers(this.gameObject, "LayerHeightInputField",
                                                                   () => { return((float)CC.Settings.LayerHeightMM); },
                                                                   (floatValue) => { CC.Settings.LayerHeightMM = Math.Round(floatValue, 5); }, 0.01f, 10.0f);

            infill = UnityUIUtil.FindInputAndAddFloatHandlers(this.gameObject, "InfillSpacingInputField",
                                                              () => { return((float)CC.Settings.InfillStepX); },
                                                              (floatValue) => { CC.Settings.InfillStepX = Math.Round(floatValue, 5); }, 1.0f, 9999.0f);

            shells = UnityUIUtil.FindInputAndAddIntHandlers(this.gameObject, "ShellsInputField",
                                                            () => { return(CC.Settings.OuterShells); },
                                                            (intValue) => { CC.Settings.OuterShells = intValue; }, 1, 1000);

            roofLayers = UnityUIUtil.FindInputAndAddIntHandlers(this.gameObject, "RoofLayersInputField",
                                                                () => { return(CC.Settings.RoofLayers); },
                                                                (intValue) => { CC.Settings.RoofLayers = intValue; }, 0, 999999);

            floorLayers = UnityUIUtil.FindInputAndAddIntHandlers(this.gameObject, "FloorLayersInputField",
                                                                 () => { return(CC.Settings.FloorLayers); },
                                                                 (intValue) => { CC.Settings.FloorLayers = intValue; }, 0, 999999);

            clipOverlaps = UnityUIUtil.FindToggleAndConnectToSource(this.gameObject, "ClipSelfOverlapsToggle",
                                                                    () => { return(CC.Settings.ClipSelfOverlaps); },
                                                                    (boolValue) => { CC.Settings.ClipSelfOverlaps = boolValue; });

            interiorSolidRegionShells = UnityUIUtil.FindInputAndAddIntHandlers(this.gameObject, "InteriorSolidRegionShellsInputField",
                                                                               () => { return(CC.Settings.InteriorSolidRegionShells); },
                                                                               (intValue) => { CC.Settings.InteriorSolidRegionShells = intValue; }, 0, 999999);

            openMeshMode = UnityUIUtil.FindDropDownAndAddHandlers(this.gameObject, "OpenMeshesDropDown",
                                                                  () => { return(CC.Settings.OpenModeInt); },
                                                                  (intValue) => { CC.Settings.OpenModeInt = intValue; }, (int)PrintSettings.OpenMeshMode.Clipped, (int)PrintSettings.OpenMeshMode.Ignored);
        }
    public void Start()
    {
        ITool curTool = CC.ActiveContext.ToolManager.ActiveRightTool;

        if (curTool == null)
        {
            return;
        }
        Tool = curTool as SetDimensionsTool;
        if (Tool == null)
        {
            return;
        }
        ActiveParameterSet = Tool.Parameters;

        dimension_x = UnityUIUtil.FindInputAndAddFloatHandlers(this.gameObject, "WidthInput",
                                                               () => { return((float)ActiveParameterSet.GetValueDouble("dimension_x")); },
                                                               (floatValue) => { set_value("dimension_x", floatValue); update_from_tool(); },
                                                               0, 9999999.0f);
        dimension_y = UnityUIUtil.FindInputAndAddFloatHandlers(this.gameObject, "HeightInput",
                                                               () => { return((float)ActiveParameterSet.GetValueDouble("dimension_y")); },
                                                               (floatValue) => { set_value("dimension_y", floatValue); update_from_tool(); },
                                                               0, 9999999.0f);
        dimension_z = UnityUIUtil.FindInputAndAddFloatHandlers(this.gameObject, "DepthInput",
                                                               () => { return((float)ActiveParameterSet.GetValueDouble("dimension_z")); },
                                                               (floatValue) => { set_value("dimension_z", floatValue); update_from_tool(); },
                                                               0, 9999999.0f);
        tabber.Add(dimension_x); tabber.Add(dimension_z); tabber.Add(dimension_y);

        scale_x = UnityUIUtil.FindInputAndAddFloatHandlers(this.gameObject, "WidthXInput",
                                                           () => { return((float)ActiveParameterSet.GetValueDouble("scale_x")); },
                                                           (floatValue) => { set_value("scale_x", floatValue); update_from_tool(); },
                                                           0, 9999999.0f);
        scale_y = UnityUIUtil.FindInputAndAddFloatHandlers(this.gameObject, "HeightXInput",
                                                           () => { return((float)ActiveParameterSet.GetValueDouble("scale_y")); },
                                                           (floatValue) => { set_value("scale_y", floatValue); update_from_tool(); },
                                                           0, 9999999.0f);
        scale_z = UnityUIUtil.FindInputAndAddFloatHandlers(this.gameObject, "DepthXInput",
                                                           () => { return((float)ActiveParameterSet.GetValueDouble("scale_z")); },
                                                           (floatValue) => { set_value("scale_z", floatValue); update_from_tool(); },
                                                           0, 9999999.0f);
        tabber.Add(scale_x); tabber.Add(scale_z); tabber.Add(scale_y);


        uniform = UnityUIUtil.FindToggleAndConnectToSource(this.gameObject, "UniformToggle",
                                                           () => { return(ActiveParameterSet.GetValueBool("uniform")); },
                                                           (boolValue) => { set_value("uniform", boolValue); });
        tabber.Add(uniform);

        objectFrame = UnityUIUtil.FindToggleAndConnectToSource(this.gameObject, "ObjectFrameToggle",
                                                               () => { return(ActiveParameterSet.GetValueBool("use_object_frame")); },
                                                               (boolValue) => { set_value("use_object_frame", boolValue); });
        tabber.Add(objectFrame);
        objectFrameRow = objectFrame.transform.parent.gameObject;

        // this doesn't work yet because we need to also change the visible dimensions...
        //objectFrameRow.SetVisible(Tool.Targets.Count() == 1);
        objectFrameRow.SetVisible(false);

        update_from_tool();

        curTool.Parameters.OnParameterModified += on_parameter_modified;
    }