コード例 #1
0
        /// <summary>
        /// Displays a GUI enabling the user to create a mesh based on the camera's Z-buffer.
        /// </summary>
        public override void OnInspectorGUI()
        {
            // Start the GUI.
            GeneralToolkit.EditorStart(serializedObject, _targetObject);

            // Start a change check.
            EditorGUI.BeginChangeCheck();

            // Enable the user to choose the camera model.
            GeneralToolkit.EditorNewSection("Camera model");
            CameraModelEditor.SectionCamera(_objectCameraModel);

            // End the change check.
            bool shouldUpdatePreview = EditorGUI.EndChangeCheck();

            // Enable the user to choose parameters for depth processing.
            GeneralToolkit.EditorNewSection("Depth processing parameters");
            SectionDepthProcessing(_targetObject.GetCameraModel().isOmnidirectional);

            // Enable the user to generate the mesh.
            GeneralToolkit.EditorNewSection("Generate");
            SectionGenerateButton();

            // End the GUI.
            GeneralToolkit.EditorEnd(serializedObject);

            // If the preview window should be updated, notify the target object.
            if (shouldUpdatePreview)
            {
                ((PerViewMeshesQSTRDB)_targetObject).UpdateCameraModel();
            }
        }
コード例 #2
0
        /// <summary>
        /// Enables the user to choose the camera parameters.
        /// </summary>
        private void SectionCameraParameters()
        {
            bool isGUIEnabled = GUI.enabled;

            GUI.enabled = isGUIEnabled && !_propertyLockSetup.boolValue;
            string label   = "Prefab: ";
            string tooltip = "Camera object used for acquisition.";

            tooltip += " If this value is left to null, the script will use a default camera.";
            tooltip += " Otherwise, a specific prefab can be used to apply post-processing effects to the captured image.";
            tooltip += " Modifying the acquisition camera parameters will modify the prefab.";
            EditorGUILayout.PropertyField(_propertyCameraPrefab, new GUIContent(label, tooltip));
            _objectCameraSetup.Update();
            CameraModelEditor.SectionCamera(new SerializedObject(_targetObject.cameraSetup.cameraModels[0]));
            _objectCameraSetup.ApplyModifiedProperties();
            GUI.enabled = isGUIEnabled;
        }