public void Start()
        {
            CC.OnPrinterSelectionModified           += CC_OnPrinterSelectionModified;
            CC.OnPresetSelectionModified            += CC_OnPresetSelectionModified;
            CC.Settings.OnSettingModified           += Settings_OnSettingModified;
            CC.PrinterDB.OnManufacturerListModified += OnManufacturerListModified;

            mfgDropDown = UnityUIUtil.FindDropDownAndAddHandlers("Manufacturer",
                                                                 () => { return(find_mfg_index(CC.PrinterDB.ActiveManufacturer)); },
                                                                 (intValue) => { select_mfg_by_index(intValue); });

            modelDropDown = UnityUIUtil.FindDropDownAndAddHandlers("Model",
                                                                   () => { return(find_model_index(CC.PrinterDB.ActiveMachine)); },
                                                                   (intValue) => { select_model_by_index(intValue); });

            presetDropDown = UnityUIUtil.FindDropDownAndAddHandlers("Preset",
                                                                    () => { return(find_preset_index(CC.PrinterDB.ActivePreset)); },
                                                                    (intValue) => { select_preset_by_index(intValue); });

            saveButton = UnityUIUtil.FindButtonAndAddClickHandler("PresetSaveButton", on_save_preset_clicked);
            UnityUIUtil.SetColors(saveButton, CotangentUI.ModifiedSettingColor, CotangentUI.DisabledButtonColor);
            resetButton = UnityUIUtil.FindButtonAndAddClickHandler("PresetResetButton", on_reset_preset_clicked);
            UnityUIUtil.SetColors(resetButton, CotangentUI.ModifiedSettingColor, CotangentUI.DisabledButtonColor);
            deleteButton = UnityUIUtil.FindButtonAndAddClickHandler("PresetDeleteButton", on_delete_preset_clicked);
            UnityUIUtil.SetColors(saveButton, CotangentUI.ModifiedSettingColor, CotangentUI.DisabledButtonColor);
            editButton = UnityUIUtil.FindButtonAndAddClickHandler("PresetEditButton", on_edit_preset_clicked);

            panel_requires_update = true;
        }
    protected override void register_parameters()
    {
        closingMode = base.RegisterDropDown("FillTypeDropDown", "fill_type",
                                            new List <string>()
        {
            "Trivial", "Minimal", "Smooth"
        },
                                            new List <int>()
        {
            (int)FillHolesTool.FillTypes.Trivial,
            (int)FillHolesTool.FillTypes.Minimal,
            (int)FillHolesTool.FillTypes.Smooth
        });

        showHidden = base.RegisterToggle("ShowHiddenToggle", "show_hidden");

        minimalPanel  = this.gameObject.FindChildByName("MinimalPanel", true);
        smoothPanel   = this.gameObject.FindChildByName("SmoothPanel", true);
        fillAllButton = UnityUIUtil.FindButtonAndAddClickHandler(this.gameObject, "FillAllButton", on_fill_all_clicked);

        minOptimizeTris     = base.RegisterToggle("MinimalOptimizeTrisToggle", "optimize_tris");
        minOptTrisTolerance = base.RegisterFloatInput("MinimalOptTrisTolInput", "optimize_tris_deviation_thresh", new Interval1d(0, 1));

        smoothAutoTargetEdgeLen = base.RegisterToggle("AutoEdgeLengthToggle", "auto_edge_length");
        smoothTargetEdgeLen     = base.RegisterFloatInput("TargetEdgeLenInput", "edge_length", new Interval1d(0.01, 100));
        smoothOptRounds         = base.RegisterIntInput("OptimizationRoundsInput", "smooth_opt_rounds", new Interval1i(1, 999));

        statusText = UnityUIUtil.FindTextAndSet(this.gameObject, "StatusText", "");
    }
    protected override void register_parameters()
    {
        offsetDistance = base.RegisterFloatInput("DistanceInput", "distance", new Interval1d(-500, 500));

        simpleCellSize    = base.RegisterFloatInput("SimpleCellSizeInput", "all_cell_size", new Interval1d(0.25f, 500.0f));
        simpleCellSizeRow = this.gameObject.FindChildByName("SimpleCellSizeParam", true);

        gridCellCount    = base.RegisterIntInput("GridCellCountInput", "grid_cell_count", new Interval1i(4, 2048));
        gridCellCountRow = this.gameObject.FindChildByName("GridCellCountParam", true);
        gridCellSize     = base.RegisterFloatInput("GridCellSizeInput", "grid_cell_size", new Interval1d(0.001f, 500.0f));
        gridCellSizeRow  = this.gameObject.FindChildByName("GridCellSizeParam", true);

        meshCellCount    = base.RegisterIntInput("MeshCellCountInput", "mesh_cell_count", new Interval1i(4, 2048));
        meshCellCountRow = this.gameObject.FindChildByName("MeshCellCountParam", true);
        meshCellSize     = base.RegisterFloatInput("MeshCellSizeInput", "mesh_cell_size", new Interval1d(0.001f, 500.0f));
        meshCellSizeRow  = this.gameObject.FindChildByName("MeshCellSizeParam", true);

        minComponentSize    = base.RegisterFloatInput("MinComponentSizeInput", "min_component_size", new Interval1d(0.0f, 500.0f));
        minComponentSizeRow = this.gameObject.FindChildByName("MinComponentSizeParam", true);

        replaceInput = base.RegisterToggle("ReplaceInputToggle", "replace_input");

        basicButton = UnityUIUtil.FindButtonAndAddClickHandler(this.gameObject, "BasicToggleButton", on_basic_expert_toggle);
        TabOrder.Add(basicButton.gameObject);
    }
    protected override void register_parameters()
    {
        unionButton      = UnityUIUtil.FindButtonAndAddClickHandler(this.gameObject, "UnionButton", on_union);
        differenceButton = UnityUIUtil.FindButtonAndAddClickHandler(this.gameObject, "DifferenceButton", on_difference);
        intersectButton  = UnityUIUtil.FindButtonAndAddClickHandler(this.gameObject, "IntersectButton", on_intersection);

        simpleCellSize    = base.RegisterFloatInput("SimpleCellSizeInput", "all_cell_size", new Interval1d(0.25f, 500.0f));
        simpleCellSizeRow = this.gameObject.FindChildByName("SimpleCellSizeParam", true);

        gridCellCount    = base.RegisterIntInput("GridCellCountInput", "grid_cell_count", new Interval1i(4, 2048));
        gridCellCountRow = this.gameObject.FindChildByName("GridCellCountParam", true);
        gridCellSize     = base.RegisterFloatInput("GridCellSizeInput", "grid_cell_size", new Interval1d(0.001f, 500.0f));
        gridCellSizeRow  = this.gameObject.FindChildByName("GridCellSizeParam", true);

        meshCellCount    = base.RegisterIntInput("MeshCellCountInput", "mesh_cell_count", new Interval1i(4, 2048));
        meshCellCountRow = this.gameObject.FindChildByName("MeshCellCountParam", true);
        meshCellSize     = base.RegisterFloatInput("MeshCellSizeInput", "mesh_cell_size", new Interval1d(0.001f, 500.0f));
        meshCellSizeRow  = this.gameObject.FindChildByName("MeshCellSizeParam", true);

        minComponentSize    = base.RegisterFloatInput("MinComponentSizeInput", "min_component_size", new Interval1d(0.0f, 500.0f));
        minComponentSizeRow = this.gameObject.FindChildByName("MinComponentSizeParam", true);

        replaceInput = base.RegisterToggle("ReplaceInputToggle", "replace_input");

        basicButton = UnityUIUtil.FindButtonAndAddClickHandler(this.gameObject, "BasicToggleButton", on_basic_expert_toggle);
        TabOrder.Add(basicButton.gameObject);

        // always starts w/ union?
        UnityUIUtil.SetColors(unionButton, Colorf.LightGreen, Colorf.DimGrey);
    }
Exemple #5
0
    protected override void register_parameters()
    {
        wallthickness = base.RegisterFloatInput("WallThicknessInput", "wall_thickness", new Interval1d(0.0001f, 9999f));

        simpleCellSize    = base.RegisterFloatInput("SimpleCellSizeInput", "all_cell_size", new Interval1d(0.25f, 500.0f));
        simpleCellSizeRow = this.gameObject.FindChildByName("SimpleCellSizeParam", true);

        gridCellCount    = base.RegisterIntInput("GridCellCountInput", "grid_cell_count", new Interval1i(4, 2048));
        gridCellCountRow = this.gameObject.FindChildByName("GridCellCountParam", true);
        gridCellSize     = base.RegisterFloatInput("GridCellSizeInput", "grid_cell_size", new Interval1d(0.001f, 500.0f));
        gridCellSizeRow  = this.gameObject.FindChildByName("GridCellSizeParam", true);

        meshCellCount    = base.RegisterIntInput("MeshCellCountInput", "mesh_cell_count", new Interval1i(4, 2048));
        meshCellCountRow = this.gameObject.FindChildByName("MeshCellCountParam", true);
        meshCellSize     = base.RegisterFloatInput("MeshCellSizeInput", "mesh_cell_size", new Interval1d(0.001f, 500.0f));
        meshCellSizeRow  = this.gameObject.FindChildByName("MeshCellSizeParam", true);

        minComponentSize    = base.RegisterFloatInput("MinComponentSizeInput", "min_component_size", new Interval1d(0.0f, 500.0f));
        minComponentSizeRow = this.gameObject.FindChildByName("MinComponentSizeParam", true);

        enableInfill = base.RegisterToggle("EnableInfillToggle", "add_infill");

        infillThickness    = base.RegisterFloatInput("InfillThicknessInput", "infill_thickness", new Interval1d(1.0f, 500.0f));
        infillThicknessRow = this.gameObject.FindChildByName("InfillThicknessParam", true);
        infillSpacing      = base.RegisterFloatInput("InfillSpacingInput", "infill_spacing", new Interval1d(1.0f, 500.0f));
        infillSpacingRow   = this.gameObject.FindChildByName("InfillSpacingParam", true);

        showInputObjects = base.RegisterToggle("ShowOriginalToggle", "show_original");
        replaceInput     = base.RegisterToggle("ReplaceInputToggle", "replace_input");

        basicButton = UnityUIUtil.FindButtonAndAddClickHandler(this.gameObject, "BasicToggleButton", on_basic_expert_toggle);
        TabOrder.Add(basicButton.gameObject);

        update_basic_expert_visibility();
    }
Exemple #6
0
        public static void ShowModalConfirmDialog(
            string title, string instructions,
            string confirmText, string cancelText,
            object target,
            Action <object> onAccept, Action <object> onCancel)
        {
            GameObject dialog = GameObject.Instantiate <GameObject>(Resources.Load <GameObject>("ModalConfirmCancelDialog"));

            UnityUIUtil.FindTextAndSet(dialog, "Title", title);
            UnityUIUtil.FindTextAndSet(dialog, "InfoText", instructions);
            UnityUIUtil.FindTextAndSet(dialog, "OKText", confirmText);
            UnityUIUtil.FindTextAndSet(dialog, "CancelText", cancelText);

            Button cancelButton = UnityUIUtil.FindButtonAndAddClickHandler(dialog, "Cancel", () => {
                if (onCancel != null)
                {
                    onCancel(target);
                }
                context.RegisterNextFrameAction(() => {
                    GameObject.Destroy(dialog);
                });
            });

            Button okButton = UnityUIUtil.FindButtonAndAddClickHandler(dialog, "OK", () => {
                onAccept(target);
                context.RegisterNextFrameAction(() => {
                    GameObject.Destroy(dialog);
                });
            });

            okButton.Select();

            MainUICanvas.AddChild(dialog, false);
        }
 // Use this for initialization
 public void Start()
 {
     printModeButton  = UnityUIUtil.FindButtonAndAddClickHandler("PrintButton", on_print_mode);
     repairModeButton = UnityUIUtil.FindButtonAndAddClickHandler("RepairButton", on_repair_mode);
     modelModeButton  = UnityUIUtil.FindButtonAndAddClickHandler("ModelButton", on_model_mode);
     set_highlight(AppViewMode.PrintView);
     highlighted = AppViewMode.PrintView;
 }
Exemple #8
0
    // Use this for initialization
    public void Start()
    {
        acceptButton = UnityUIUtil.FindButtonAndAddClickHandler("AcceptButton", on_accept);
        cancelButton = UnityUIUtil.FindButtonAndAddClickHandler("CancelButton", on_cancel);

        UnityUIUtil.SetColors(acceptButton, canAcceptColor, cantAcceptColor);
        UnityUIUtil.SetColors(cancelButton, cancelColor, cantAcceptColor);
    }
Exemple #9
0
    // Use this for initialization
    public void Start()
    {
        okButton        = UnityUIUtil.FindButtonAndAddClickHandler(this.gameObject, "OKButton", on_ok_clicked);
        cancelButton    = UnityUIUtil.FindButtonAndAddClickHandler(this.gameObject, "CancelButton", on_cancel_clicked);
        submitNewButton = UnityUIUtil.FindButtonAndAddClickHandler(this.gameObject, "SubmitButton", on_submit_clicked);

        MfgListView = UnityUtil.FindChildByName(this.gameObject, "ManufacturerListView");
        populate_list();
    }
    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);
    }
    // Use this for initialization
    public void Start()
    {
        dismissButton = UnityUIUtil.FindButtonAndAddClickHandler(this.gameObject, "DimissButton", dismiss_on_click);
        start_time    = FPlatform.RealTime();

        if (FPlatform.InUnityEditor())
        {
            dismiss_on_click();
        }
    }
    protected override void register_parameters()
    {
        fillHoles      = base.RegisterToggle("FillHolesToggle", "fill_holes");
        otherSide      = base.RegisterToggle("FlipSideToggle", "reverse_normal");
        keepBoth       = base.RegisterToggle("KeepBothToggle", "keep_both");
        minimalFill    = base.RegisterToggle("MinimalFillToggle", "minimal_fill");
        fillEdgeLength = base.RegisterFloatInput("FillEdgeLengthInput", "fill_edge_length", new Interval1d(0.01, 10000));

        setPlaneButton = UnityUIUtil.FindButtonAndAddClickHandler(this.gameObject, "SetPlaneFromClickButton", on_set_plane_clicked);
    }
Exemple #13
0
    // Use this for initialization
    public void Start()
    {
        installNowButton    = UnityUIUtil.FindButtonAndAddClickHandler(this.gameObject, "InstallNowButton", install_now);
        installOnExitButton = UnityUIUtil.FindButtonAndAddClickHandler(this.gameObject, "InstallOnExitButton", install_on_exit);
        installLaterButton  = UnityUIUtil.FindButtonAndAddClickHandler(this.gameObject, "InstallLaterButton", install_later);

        downloadPanel = this.gameObject.FindChildByName("DownloadPanel", true);
        downloadText  = UnityUIUtil.FindText(this.gameObject, "DownloadingText");
        cancelButton  = UnityUIUtil.FindButtonAndAddClickHandler(this.gameObject, "CancelButton", cancel_download);
        downloadPanel.SetVisible(false);
    }
Exemple #14
0
 // Use this for initialization
 public void Start()
 {
     try {
         undoButton      = UnityUIUtil.FindButtonAndAddClickHandler("UndoButton", on_undo_clicked);
         redoButton      = UnityUIUtil.FindButtonAndAddClickHandler("RedoButton", on_redo_clicked);
         fitToViewButton = UnityUIUtil.FindButtonAndAddClickHandler("FitToViewButton", on_fit_view_clicked);
         prefsButton     = UnityUIUtil.FindButtonAndAddClickHandler("PreferencesButton", () => { CCActions.ShowPreferencesDialog(); });
     } catch (Exception e) {
         DebugUtil.Log("ScenePanelSetup Start(): " + e.Message);
     }
 }
    // Use this for initialization
    public void Start()
    {
        Panel  = this.gameObject;
        Canvas = Panel.transform.parent.gameObject;

        objectsButton   = UnityUIUtil.FindButtonAndAddClickHandler("ObjectsButton", on_objects_clicked);
        positionButton  = UnityUIUtil.FindButtonAndAddClickHandler("PositionButton", on_position_clicked);
        printUtilButton = UnityUIUtil.FindButtonAndAddClickHandler("PrintUtilButton", on_print_util_clicked);

        standard_colors = objectsButton.colors;
        active_colors   = standard_colors; active_colors.normalColor = active_colors.pressedColor; active_colors.highlightedColor = active_colors.pressedColor;
    }
    // Use this for initialization
    public void Start()
    {
        Panel  = this.gameObject;
        Canvas = Panel.transform.parent.gameObject;

        healToolsButton  = UnityUIUtil.FindButtonAndAddClickHandler("HealButton", on_heal_clicked);
        triToolsButton   = UnityUIUtil.FindButtonAndAddClickHandler("TriToolsButton", on_tritools_clicked);
        modelToolsButton = UnityUIUtil.FindButtonAndAddClickHandler("ModelToolsButton", on_modeltools_clicked);
        objectsButton    = UnityUIUtil.FindButtonAndAddClickHandler("ObjectsButton", on_objects_clicked);

        standard_colors = healToolsButton.colors;
        active_colors   = standard_colors; active_colors.normalColor = active_colors.pressedColor; active_colors.highlightedColor = active_colors.pressedColor;
    }
Exemple #17
0
    // Use this for initialization
    public void Start()
    {
        sceneButton  = UnityUIUtil.FindButtonAndAddClickHandler("SceneTab", on_scene);
        objectButton = UnityUIUtil.FindButtonAndAddClickHandler("ObjectTab", on_object);

        scenePanel  = this.gameObject.FindChildByName("SceneScrollView", true);
        objectPanel = this.gameObject.FindChildByName("ObjectScrollView", true);

        visiblePanel = VisiblePanel.ObjectPanel;
        update_visibility();

        panelSetup = this;
    }
Exemple #18
0
    protected override void register_parameters()
    {
        shellType = base.RegisterDropDown("ShellTypeDropDown", "shell_type",
                                          new List <string>()
        {
            "Voxel", "Extrusion"
        },
                                          new List <int>()
        {
            (int)MeshShellTool.ShellTypes.DistanceField,
            (int)MeshShellTool.ShellTypes.Extrusion
        });

        directionType = base.RegisterDropDown("ShellDirectionDropDown", "shell_direction",
                                              new List <string>()
        {
            "Inset", "Outset", "Symmetric"
        },
                                              new List <int>()
        {
            (int)MeshShellTool.ShellDirections.Inner,
            (int)MeshShellTool.ShellDirections.Outer,
            (int)MeshShellTool.ShellDirections.Symmetric,
        });

        shellThickness = base.RegisterFloatInput("ShellThicknessInput", "shell_thickness", new Interval1d(0.0001f, 9999f));

        simpleCellSize    = base.RegisterFloatInput("SimpleCellSizeInput", "all_cell_size", new Interval1d(0.25f, 500.0f));
        simpleCellSizeRow = this.gameObject.FindChildByName("SimpleCellSizeParam", true);

        gridCellCount    = base.RegisterIntInput("GridCellCountInput", "grid_cell_count", new Interval1i(4, 2048));
        gridCellCountRow = this.gameObject.FindChildByName("GridCellCountParam", true);
        gridCellSize     = base.RegisterFloatInput("GridCellSizeInput", "grid_cell_size", new Interval1d(0.001f, 500.0f));
        gridCellSizeRow  = this.gameObject.FindChildByName("GridCellSizeParam", true);

        meshCellCount    = base.RegisterIntInput("MeshCellCountInput", "mesh_cell_count", new Interval1i(4, 2048));
        meshCellCountRow = this.gameObject.FindChildByName("MeshCellCountParam", true);
        meshCellSize     = base.RegisterFloatInput("MeshCellSizeInput", "mesh_cell_size", new Interval1d(0.001f, 500.0f));
        meshCellSizeRow  = this.gameObject.FindChildByName("MeshCellSizeParam", true);

        minComponentSize    = base.RegisterFloatInput("MinComponentSizeInput", "min_component_size", new Interval1d(0.0f, 500.0f));
        minComponentSizeRow = this.gameObject.FindChildByName("MinComponentSizeParam", true);

        showInputObjects = base.RegisterToggle("ShowOriginalToggle", "show_original");
        replaceInput     = base.RegisterToggle("ReplaceInputToggle", "replace_input");

        basicButton = UnityUIUtil.FindButtonAndAddClickHandler(this.gameObject, "BasicToggleButton", on_basic_expert_toggle);
        TabOrder.Add(basicButton.gameObject);

        update_basic_expert_visibility();
    }
Exemple #19
0
    // Use this for initialization
    public void Start()
    {
        saveButton   = UnityUIUtil.FindButtonAndAddClickHandler(this.gameObject, "Save", on_save_clicked);
        cancelButton = UnityUIUtil.FindButtonAndAddClickHandler(this.gameObject, "Cancel", on_cancel_clicked);

        UnityUIUtil.FindButtonAndAddClickHandler(this.gameObject, "CloseButton", destroy_dialog);

        GameObject textfieldGO = this.gameObject.FindChildByName("TextArea", true);

        settingsText = textfieldGO.GetComponent <TMP_InputField>();

        titleText = UnityUIUtil.FindTextAndSet(this.gameObject, "Title", "Edit Preset");
        errorText = UnityUIUtil.FindTextAndSet(this.gameObject, "ErrorMessage", " ");

        CC.OnPresetSelectionModified  += CC_OnPresetSelectionModified;
        CC.OnPrinterSelectionModified += CC_OnPrinterSelectionModified;
    }
    // Use this for initialization
    public void Start()
    {
        Panel  = this.gameObject;
        Canvas = CotangentUI.MainUICanvas;

        try {
            openButton        = UnityUIUtil.FindButtonAndAddClickHandler("OpenButton", on_open_clicked);
            importButton      = UnityUIUtil.FindButtonAndAddClickHandler("ImportButton", on_import_clicked);
            saveButton        = UnityUIUtil.FindButtonAndAddClickHandler("SaveButton", on_save_clicked);
            saveAsButton      = UnityUIUtil.FindButtonAndAddClickHandler("SaveAsButton", on_save_as_clicked);
            exportGCodeButton = UnityUIUtil.FindButtonAndAddClickHandler("ExportButton", on_export_clicked);
            exportMeshButton  = UnityUIUtil.FindButtonAndAddClickHandler("ExportMeshButton", on_export_mesh_clicked);
            moreButton        = UnityUIUtil.FindButtonAndAddClickHandler("MoreButton", on_more_clicked);

            UnityUIUtil.SetColors(saveButton, CotangentUI.ModifiedSettingColor, CotangentUI.DisabledButtonColor);
        }catch (Exception e) {
            DebugUtil.Log("ScenePanelSetup Start(): " + e.Message);
        }
    }
Exemple #21
0
    private PanelRow add_new_row(PrintMeshSO so)
    {
        PanelRow row = new PanelRow();

        row.SO = so;

        row.panel = GameObject.Instantiate <GameObject>(Resources.Load <GameObject>("SceneBrowserPrintSOPanel"));
        this.gameObject.AddChild(row.panel, false);

        row.label      = UnityUIUtil.FindText(row.panel, "SONameLabel");
        row.label.text = so.Name;

        row.rowButton             = UnityUIUtil.FindButtonAndAddClickHandler(row.panel, "RowButton", () => { on_row_clicked(row); });
        row.rowButton.image.color = defaultRowColor;

        row.visibleButton = UnityUIUtil.FindButtonAndAddClickHandler(row.panel, "VisibleButton", () => { on_visible_clicked(row); });

        return(row);
    }
Exemple #22
0
    // Use this for initialization
    public void Start()
    {
        var anybutton = UnityUIUtil.FindButtonAndAddClickHandler(this.gameObject, "ShowSlicesToggleButton", null);

        ColorBlock normalColor = anybutton.colors;
        ColorBlock onColor     = normalColor; onColor.normalColor = Colorf.LightGreen; onColor.highlightedColor = Colorf.LightGreen;
        ColorBlock offColor    = normalColor; offColor.normalColor = CotangentUI.DisabledButtonColor; offColor.highlightedColor = CotangentUI.DisabledButtonColor;

        frameButton = UnityUIUtil.FindButtonAndAddClickHandler(this.gameObject, "FrameToggle", on_frame_clicked);

        slicesButton = UnityUIUtil.FindButtonAndAddToggleBehavior(this.gameObject, "ShowSlicesToggleButton",
                                                                  () => { return(CC.Slicer.ShowSlicePolylines); },
                                                                  (bSet) => { CC.Slicer.ShowSlicePolylines = bSet; },
                                                                  (bVal, btn) => { btn.colors = (bVal) ? onColor : offColor; });

        pathsButton = UnityUIUtil.FindButtonAndAddToggleBehavior(this.gameObject, "ShowToolpathsToggle",
                                                                 () => { return(CC.Objects.ShowToolpaths); },
                                                                 (bSet) => { CC.Objects.ShowToolpaths = bSet; },
                                                                 (bVal, btn) => { btn.colors = (bVal) ? onColor : offColor; });

        clipPlaneButton = UnityUIUtil.FindButtonAndAddToggleBehavior(this.gameObject, "EnableClipPlaneToggle",
                                                                     () => { return(CCActions.ClipPlaneEnabled); },
                                                                     (bSet) => { CCActions.ClipPlaneEnabled = bSet; },
                                                                     (bVal, btn) => { btn.colors = (bVal) ? onColor : offColor; });

        wireframeButton = UnityUIUtil.FindButtonAndAddToggleBehavior(this.gameObject, "WireframeToggle",
                                                                     () => { return(CCActions.WireframeEnabled); },
                                                                     (bSet) => { CCActions.WireframeEnabled = bSet; },
                                                                     (bVal, btn) => { btn.colors = (bVal) ? onColor : offColor; }, true);

        boundariesButton = UnityUIUtil.FindButtonAndAddToggleBehavior(this.gameObject, "BoundariesToggle",
                                                                      () => { return(CC.MeshAnalysis.EnableMeshBoundaries); },
                                                                      (bSet) => { CC.MeshAnalysis.EnableMeshBoundaries = bSet; },
                                                                      (bVal, btn) => { btn.colors = (bVal) ? onColor : offColor; }, true);

        cavitiesButton = UnityUIUtil.FindButtonAndAddToggleBehavior(this.gameObject, "CavitiesToggle",
                                                                    () => { return(CC.MeshAnalysis.EnableCavities); },
                                                                    (bSet) => { CC.MeshAnalysis.EnableCavities = bSet; },
                                                                    (bVal, btn) => { btn.colors = (bVal) ? onColor : offColor; }, true);
    }
Exemple #23
0
        public static void GetStringFromDialog(string title, string instructions, object target,
                                               Func <string, bool> ValidatorF, Action <string, object> onAccept, Action onCancel)
        {
            GameObject dialog = GameObject.Instantiate <GameObject>(Resources.Load <GameObject>("GetStringDialog"));

            UnityUIUtil.FindTextAndSet(dialog, "Title", title);
            UnityUIUtil.FindTextAndSet(dialog, "InfoText", instructions);

            Button cancelButton = UnityUIUtil.FindButtonAndAddClickHandler(dialog, "Cancel", () => {
                if (onCancel != null)
                {
                    onCancel();
                }
                context.RegisterNextFrameAction(() => {
                    GameObject.Destroy(dialog);
                });
            });

            var input = UnityUIUtil.FindInput(dialog, "TextEntry");

            Button okButton = UnityUIUtil.FindButtonAndAddClickHandler(dialog, "OK", () => {
                if (input.text.Length == 0)
                {
                    return;
                }
                if (ValidatorF != null && ValidatorF(input.text) == false)
                {
                    return;
                }

                onAccept(input.text, target);
                context.RegisterNextFrameAction(() => {
                    GameObject.Destroy(dialog);
                });
            });

            input.Select();

            MainUICanvas.AddChild(dialog, false);
        }
Exemple #24
0
        public static void ShowModalMessageDialog(
            string title, string message,
            string confirmText,
            object target,
            Action <object> onAccept)
        {
            GameObject dialog = GameObject.Instantiate <GameObject>(Resources.Load <GameObject>("ModalMessageDialog"));

            UnityUIUtil.FindTextAndSet(dialog, "Title", title);
            UnityUIUtil.FindTextAndSet(dialog, "InfoText", message);
            UnityUIUtil.FindTextAndSet(dialog, "OKText", confirmText);

            Button okButton = UnityUIUtil.FindButtonAndAddClickHandler(dialog, "OK", () => {
                onAccept?.Invoke(target);
                context.RegisterNextFrameAction(() => {
                    GameObject.Destroy(dialog);
                });
            });

            okButton.Select();
            MainUICanvas.AddChild(dialog, false);
        }
    protected override void register_parameters()
    {
        closingMode = base.RegisterDropDown("ClosingTypeDropDown", "closing_type",
                                            new List <string>()
        {
            "Robust", "Precise", "Fast"
        },
                                            new List <int>()
        {
            (int)GenerateClosedMeshTool.ClosingTypes.WindingNumberGrid,
            (int)GenerateClosedMeshTool.ClosingTypes.WindingNumberAnalytic,
            (int)GenerateClosedMeshTool.ClosingTypes.LevelSet
        });

        simpleCellSize    = base.RegisterFloatInput("SimpleCellSizeInput", "all_cell_size", new Interval1d(0.25f, 500.0f));
        simpleCellSizeRow = this.gameObject.FindChildByName("SimpleCellSizeParam", true);

        gridCellCount    = base.RegisterIntInput("GridCellCountInput", "grid_cell_count", new Interval1i(4, 2048));
        gridCellCountRow = this.gameObject.FindChildByName("GridCellCountParam", true);
        gridCellSize     = base.RegisterFloatInput("GridCellSizeInput", "grid_cell_size", new Interval1d(0.001f, 500.0f));
        gridCellSizeRow  = this.gameObject.FindChildByName("GridCellSizeParam", true);

        meshCellCount    = base.RegisterIntInput("MeshCellCountInput", "mesh_cell_count", new Interval1i(4, 2048));
        meshCellCountRow = this.gameObject.FindChildByName("MeshCellCountParam", true);
        meshCellSize     = base.RegisterFloatInput("MeshCellSizeInput", "mesh_cell_size", new Interval1d(0.001f, 500.0f));
        meshCellSizeRow  = this.gameObject.FindChildByName("MeshCellSizeParam", true);

        minComponentSize    = base.RegisterFloatInput("MinComponentSizeInput", "min_component_size", new Interval1d(0.0f, 500.0f));
        minComponentSizeRow = this.gameObject.FindChildByName("MinComponentSizeParam", true);

        offsetDistance = base.RegisterFloatInput("OffsetDistanceInput", "offset_distance", new Interval1d(-500, 500));
        windingIso     = base.RegisterFloatInput("WindingIsoInput", "winding_inflate", new Interval1d(0.01, 0.99));

        replaceInput = base.RegisterToggle("ReplaceInputToggle", "replace_input");

        basicButton = UnityUIUtil.FindButtonAndAddClickHandler(this.gameObject, "BasicToggleButton", on_basic_expert_toggle);
        TabOrder.Add(basicButton.gameObject);
    }
    protected override void register_parameters()
    {
        operationMode = base.RegisterDropDown("OpTypeDropDown", "op_type",
                                              new List <string>()
        {
            "Expand", "Contract", "Erode", "Fill"
        },
                                              new List <int>()
        {
            (int)MeshMorphologyTool.OperationTypes.Dilate,
            (int)MeshMorphologyTool.OperationTypes.Contract,
            (int)MeshMorphologyTool.OperationTypes.Open,
            (int)MeshMorphologyTool.OperationTypes.Close
        });

        offsetDistance = base.RegisterFloatInput("DistanceInput", "distance", new Interval1d(-500, 500));

        simpleCellSize    = base.RegisterFloatInput("SimpleCellSizeInput", "all_cell_size", new Interval1d(0.25f, 500.0f));
        simpleCellSizeRow = this.gameObject.FindChildByName("SimpleCellSizeParam", true);

        gridCellCount    = base.RegisterIntInput("GridCellCountInput", "grid_cell_count", new Interval1i(4, 2048));
        gridCellCountRow = this.gameObject.FindChildByName("GridCellCountParam", true);
        gridCellSize     = base.RegisterFloatInput("GridCellSizeInput", "grid_cell_size", new Interval1d(0.001f, 500.0f));
        gridCellSizeRow  = this.gameObject.FindChildByName("GridCellSizeParam", true);

        meshCellCount    = base.RegisterIntInput("MeshCellCountInput", "mesh_cell_count", new Interval1i(4, 2048));
        meshCellCountRow = this.gameObject.FindChildByName("MeshCellCountParam", true);
        meshCellSize     = base.RegisterFloatInput("MeshCellSizeInput", "mesh_cell_size", new Interval1d(0.001f, 500.0f));
        meshCellSizeRow  = this.gameObject.FindChildByName("MeshCellSizeParam", true);

        minComponentSize    = base.RegisterFloatInput("MinComponentSizeInput", "min_component_size", new Interval1d(0.0f, 500.0f));
        minComponentSizeRow = this.gameObject.FindChildByName("MinComponentSizeParam", true);

        replaceInput = base.RegisterToggle("ReplaceInputToggle", "replace_input");

        basicButton = UnityUIUtil.FindButtonAndAddClickHandler(this.gameObject, "BasicToggleButton", on_basic_expert_toggle);
        TabOrder.Add(basicButton.gameObject);
    }
Exemple #27
0
    // Use this for initialization
    public void Start()
    {
        try {
            statusBG        = this.gameObject.FindChildByName("InfoBG", true);
            layerText       = UnityUIUtil.FindText(statusBG, "LayerText");
            layerUpButton   = UnityUIUtil.FindButtonAndAddClickHandler(this.gameObject, "LayerUpButton", on_up_button);
            layerDownButton = UnityUIUtil.FindButtonAndAddClickHandler(this.gameObject, "LayerDownButton", on_down_button);

            ButtonLongPress layerUpHold = layerUpButton.gameObject.AddComponent <ButtonLongPress>();
            layerUpHold.HoldTime = 0.5f; layerUpHold.RepeatTime = 0.1f;
            layerUpHold.onLongPress.AddListener(on_up_button_longpress);

            ButtonLongPress layerDownHold = layerDownButton.gameObject.AddComponent <ButtonLongPress>();
            layerDownHold.HoldTime = 0.5f; layerDownHold.RepeatTime = 0.1f;
            layerDownHold.onLongPress.AddListener(on_down_button_longpress);

            statusBG.SetVisible(false);
            visible   = false;
            cur_layer = -1;
        } catch (Exception e) {
            DebugUtil.Log("StatusPanelSetup Start(): " + e.Message);
        }
    }
 // Use this for initialization
 public void Start()
 {
     cancelButton       = UnityUIUtil.FindButtonAndAddClickHandler(this.gameObject, "CancelButton", on_cancel);
     exportButton       = UnityUIUtil.FindButtonAndAddClickHandler(this.gameObject, "ExportButton", on_export);
     exportAlwaysButton = UnityUIUtil.FindButtonAndAddClickHandler(this.gameObject, "ExportAlwaysButton", on_export_always);
 }
 // Use this for initialization
 public void Start()
 {
     closeButton           = UnityUIUtil.FindButtonAndAddClickHandler(this.gameObject, "CloseButton", on_close);
     privacySettingsButton = UnityUIUtil.FindButtonAndAddClickHandler(this.gameObject, "PrivacySettingsButton", on_privacy_settings);
 }
    // Use this for initialization
    public void Start()
    {
        dismissButton = UnityUIUtil.FindButtonAndAddClickHandler(this.gameObject, "DismissButton", on_dismiss);
        UnityUIUtil.FindTextAndSet(this.gameObject, "VersionText", string.Format("v{0}.{1}.{2}",
                                                                                 CotangentVersion.CurrentVersion.a, CotangentVersion.CurrentVersion.b, CotangentVersion.CurrentVersion.c));

        prefsTabButton   = UnityUIUtil.FindButtonAndAddClickHandler(this.gameObject, "PreferencesButton", on_prefs_tab);
        prefsTab         = this.gameObject.FindChildByName("PreferencesPanel", true);
        privacyTabButton = UnityUIUtil.FindButtonAndAddClickHandler(this.gameObject, "PrivacyButton", on_privacy_tab);
        privacyTab       = this.gameObject.FindChildByName("PrivacyPanel", true);
        aboutTabButton   = UnityUIUtil.FindButtonAndAddClickHandler(this.gameObject, "AboutButton", on_about_tab);
        aboutTab         = this.gameObject.FindChildByName("AboutPanel", true);



        startupWorkspace = new MappedDropDown(
            this.gameObject.FindChildByName("StartupWorkspaceDropDown", true).GetComponent <Dropdown>(),
            () => { return((int)CCPreferences.StartupWorkspace); },
            (intValue) => { CCPreferences.StartupWorkspace = (AppViewMode)intValue; });
        startupWorkspace.SetOptions(
            new List <string>()
        {
            "Print", "Repair", "Model"
        },
            new List <int>()
        {
            (int)AppViewMode.PrintView,
            (int)AppViewMode.RepairView,
            (int)AppViewMode.ModelView
        });
        startupWorkspace.SetFromId((int)CCPreferences.StartupWorkspace);


        graphicsQuality = new MappedDropDown(
            this.gameObject.FindChildByName("GraphicsQualityDropDown", true).GetComponent <Dropdown>(),
            () => { return((int)CCPreferences.GraphicsQuality); },
            (intValue) => { CCPreferences.GraphicsQuality = (CCPreferences.GraphicsQualityLevels)intValue; });
        graphicsQuality.SetOptions(
            new List <string>()
        {
            "Maximum", "High", "Medium", "Low", "Fastest"
        },
            new List <int>()
        {
            (int)CCPreferences.GraphicsQualityLevels.Max,
            (int)CCPreferences.GraphicsQualityLevels.High,
            (int)CCPreferences.GraphicsQualityLevels.Medium,
            (int)CCPreferences.GraphicsQualityLevels.Low,
            (int)CCPreferences.GraphicsQualityLevels.Fastest
        });
        graphicsQuality.SetFromId((int)CCPreferences.GraphicsQuality);


        cameraMode = new MappedDropDown(
            this.gameObject.FindChildByName("CameraModeDropDown", true).GetComponent <Dropdown>(),
            () => { return((int)CCPreferences.CameraMode); },
            (intValue) => { CCPreferences.CameraMode = (CCPreferences.CameraModes)intValue; });
        cameraMode.SetOptions(
            new List <string>()
        {
            "Perspective", "Orthographic"
        },
            new List <int>()
        {
            (int)CCPreferences.CameraModes.Perspective,
            (int)CCPreferences.CameraModes.Orthographic
        });
        cameraMode.SetFromId((int)CCPreferences.CameraMode);



        importXFormMode = new MappedDropDown(
            this.gameObject.FindChildByName("ImportXFormDropdown", true).GetComponent <Dropdown>(),
            () => { return((int)CCPreferences.ImportTransformMode); },
            (intValue) => { CCPreferences.ImportTransformMode = (CCPreferences.ImportTransformModes)intValue; });
        importXFormMode.SetOptions(
            new List <string>()
        {
            "Auto-Center First", "Auto-Center All", "No Transformations"
        },
            new List <int>()
        {
            (int)CCPreferences.ImportTransformModes.AutoCenterFirst,
            (int)CCPreferences.ImportTransformModes.AutoCenterAll,
            (int)CCPreferences.ImportTransformModes.NoAutoCenter
        });
        importXFormMode.SetFromId((int)CCPreferences.ImportTransformMode);


        importAssistantMode = new MappedDropDown(
            this.gameObject.FindChildByName("ImportAssistantModeDropdown", true).GetComponent <Dropdown>(),
            () => { return((int)CCPreferences.ImportAssistantMode); },
            (intValue) => { CCPreferences.ImportAssistantMode = (CCPreferences.ImportAssistantModes)intValue; });
        importAssistantMode.SetOptions(
            new List <string>()
        {
            "All Assistants", "Mesh Size Only", "Dimensions Only", "Disabled"
        },
            new List <int>()
        {
            (int)CCPreferences.ImportAssistantModes.All,
            (int)CCPreferences.ImportAssistantModes.MeshSizeOnly,
            (int)CCPreferences.ImportAssistantModes.PhysicalSizeOnly,
            (int)CCPreferences.ImportAssistantModes.Disabled
        });
        importAssistantMode.SetFromId((int)CCPreferences.ImportAssistantMode);


        largeMeshSizeInput = UnityUIUtil.FindInputAndAddIntHandlers(this.gameObject, "LargeMeshSizeInput",
                                                                    () => { return(CCPreferences.LargeMeshImportThreshold); },
                                                                    (intValue) => { CCPreferences.LargeMeshImportThreshold = intValue; },
                                                                    10000, 999999999);
        largeMeshSizeInput.text = CCPreferences.LargeMeshImportThreshold.ToString();


        unityPolicyButton = UnityUIUtil.FindButtonAndAddClickHandler(this.gameObject, "PrivacyPolicyButton", on_unity_privacy_policy);


        // about dialog
        UnityUIUtil.FindButtonAndAddClickHandler(this.gameObject, "GradientspaceWebButton", on_open_gradientspace_site);
        UnityUIUtil.FindButtonAndAddClickHandler(this.gameObject, "CotangentWebButton", on_open_cotangent_site);


        on_prefs_tab();
    }