Пример #1
0
    public void Start()
    {
        // Machine Settings panel
        CC.Settings.OnNewSettings     += Settings_OnNewSettings;
        CC.Settings.OnSettingModified += Settings_OnSettingModified;

        layerRangeMin = UnityUIUtil.FindInputAndAddIntHandlers(this.gameObject, "LayerRangeMinInputField",
                                                               () => { return(CC.Settings.LayerRangeMin); },
                                                               (intValue) => { CC.Settings.LayerRangeMin = intValue; }, 1, 999999);

        layerRangeMax = UnityUIUtil.FindInputAndAddIntHandlers(this.gameObject, "LayerRangeMaxInputField",
                                                               () => { return(CC.Settings.LayerRangeMax); },
                                                               (intValue) => { CC.Settings.LayerRangeMax = intValue; }, 1, 999999999 + 1);

        startLayers = UnityUIUtil.FindInputAndAddIntHandlers(this.gameObject, "StartLayersInputField",
                                                             () => { return(CC.Settings.StartLayers); },
                                                             (intValue) => { CC.Settings.StartLayers = intValue; }, 0, 100);

        startLayerHeight = UnityUIUtil.FindInputAndAddFloatHandlers(this.gameObject, "StartLayerHeightInputField",
                                                                    () => { return((float)CC.Settings.StartLayerHeightMM); },
                                                                    (floatValue) => { CC.Settings.StartLayerHeightMM = Math.Round(floatValue, 5); }, 0.01f, 10.0f);
        startLayerHeightRow = startLayerHeight.transform.parent.gameObject;

        is_expanded = true;
        update_visibility();
    }
Пример #2
0
        public InputField RegisterIntInput(string inputName, string toolParamName, Interval1i validRange)
        {
            InputField input = UnityUIUtil.FindInputAndAddIntHandlers(this.gameObject, inputName,
                                                                      () => { return(ActiveParameterSet.GetValueInt(toolParamName)); },
                                                                      (intValue) => { ActiveParameterSet.SetValue <int>(toolParamName, intValue); update_values_from_tool(); },
                                                                      validRange.a, validRange.b);

            TabOrder.Add(input);

            int_params.Add(new IntInputParam()
            {
                widget = input, paramName = toolParamName
            });

            return(input);
        }
Пример #3
0
    public void Start()
    {
        // Machine Settings panel
        CC.Settings.OnNewSettings     += Settings_OnNewSettings;
        CC.Settings.OnSettingModified += Settings_OnSettingModified;

        nozzleWidth = UnityUIUtil.FindInputAndAddFloatHandlers(this.gameObject, "NozzleWidthInputField",
                                                               () => { return((float)CC.Settings.NozzleDiameterMM); },
                                                               (floatValue) => { CC.Settings.NozzleDiameterMM = Math.Round(floatValue, 5); }, 0.05f, 50.0f);

        filamentDiam = UnityUIUtil.FindInputAndAddFloatHandlers(this.gameObject, "FilamentDiamInputField",
                                                                () => { return((float)CC.Settings.FilamentDiameterMM); },
                                                                (floatValue) => { CC.Settings.FilamentDiameterMM = Math.Round(floatValue, 5); }, 0.05f, 10.0f);

        nozzleTemp = UnityUIUtil.FindInputAndAddIntHandlers(this.gameObject, "ExtruderTempInputField",
                                                            () => { return(CC.Settings.ExtruderTempC); },
                                                            (intValue) => { CC.Settings.ExtruderTempC = intValue; }, 10, 500);

        bedTemp = UnityUIUtil.FindInputAndAddIntHandlers(this.gameObject, "BedTempInputField",
                                                         () => { return(CC.Settings.BedTempC); },
                                                         (intValue) => { CC.Settings.BedTempC = intValue; }, 0, 100);
        bedTempGO = bedTemp.gameObject.transform.parent.gameObject;
        bedTempGO.SetVisible(CC.Settings.HasHeatedBed);

        printSpeed = UnityUIUtil.FindInputAndAddIntHandlers(this.gameObject, "PrintSpeedInputField",
                                                            () => { return(CC.Settings.PrintSpeedMMS); },
                                                            (intValue) => { CC.Settings.PrintSpeedMMS = intValue; }, 10, 1000);

        travelSpeed = UnityUIUtil.FindInputAndAddIntHandlers(this.gameObject, "TravelSpeedInputField",
                                                             () => { return(CC.Settings.TravelSpeedMMS); },
                                                             (intValue) => { CC.Settings.TravelSpeedMMS = intValue; }, 10, 1000);

        fanSpeed = UnityUIUtil.FindInputAndAddIntHandlers(this.gameObject, "FanSpeedInput",
                                                          () => { return(CC.Settings.FanSpeedX); },
                                                          (intValue) => { CC.Settings.FanSpeedX = intValue; }, 0, 100);

        bedSizeX = UnityUIUtil.FindInputAndAddIntHandlers(this.gameObject, "BedSizeXInputField",
                                                          () => { return(CC.Settings.BedSizeXMM); },
                                                          (intValue) => { CC.Settings.BedSizeXMM = intValue; }, 10, 10000);
        bedSizeY = UnityUIUtil.FindInputAndAddIntHandlers(this.gameObject, "BedSizeYInputField",
                                                          () => { return(CC.Settings.BedSizeYMM); },
                                                          (intValue) => { CC.Settings.BedSizeYMM = intValue; }, 10, 10000);
        bedSizeZ = UnityUIUtil.FindInputAndAddIntHandlers(this.gameObject, "BedSizeZInputField",
                                                          () => { return(CC.Settings.BedSizeZMM); },
                                                          (intValue) => { CC.Settings.BedSizeZMM = intValue; }, 10, 10000);
    }
Пример #4
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);
        }
Пример #5
0
    // 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();
    }