Exemplo n.º 1
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);
        }
Exemplo n.º 2
0
    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);
    }
    void update_from_tool()
    {
        track_changes = false;

        dimension_x.text = ActiveParameterSet.GetValueDouble("dimension_x").ToString();
        dimension_y.text = ActiveParameterSet.GetValueDouble("dimension_y").ToString();
        dimension_z.text = ActiveParameterSet.GetValueDouble("dimension_z").ToString();

        scale_x.text = ActiveParameterSet.GetValueDouble("scale_x").ToString();
        scale_y.text = ActiveParameterSet.GetValueDouble("scale_y").ToString();
        scale_z.text = ActiveParameterSet.GetValueDouble("scale_z").ToString();

        uniform.isOn = ActiveParameterSet.GetValueBool("uniform");

        track_changes = true;
    }
    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;
    }
Exemplo n.º 5
0
 void update_from_tool()
 {
     allowBackface.isOn = ActiveParameterSet.GetValueBool("allow_backface_hits");
 }