Example #1
0
        public override void OnInspectorGUI()
        {
            if (mChildList == null)
            {
                SetupChildList();
            }

            // Ordinary properties
            base.OnInspectorGUI();

            // Blends
            m_BlendsEditor.DrawEditorCombo(
                "Create New Blender Asset",
                Target.gameObject.name + " Blends", "asset", string.Empty,
                "Custom Blends", false);

            // vcam children
            EditorGUILayout.Separator();
            EditorGUI.BeginChangeCheck();
            mChildList.DoLayoutList();
            if (EditorGUI.EndChangeCheck())
            {
                serializedObject.ApplyModifiedProperties();
            }
        }
        public override void OnInspectorGUI()
        {
            BeginInspector();

            // Show the active camera and blend
            GUI.enabled = false;
            ICinemachineCamera vcam      = Target.ActiveVirtualCamera;
            Transform          activeCam = (vcam != null && vcam.VirtualCameraGameObject != null)
                ? vcam.VirtualCameraGameObject.transform : null;

            EditorGUILayout.ObjectField("Live Camera", activeCam, typeof(Transform), true);
            EditorGUILayout.DelayedTextField(
                "Live Blend", Target.ActiveBlend != null
                ? Target.ActiveBlend.Description : string.Empty);
            GUI.enabled = true;

            // Normal properties
            DrawRemainingPropertiesInInspector();

            // Blender
            m_BlendsEditor.DrawEditorCombo(
                "Create New Blender Asset",
                Target.gameObject.name + " Blends", "asset", string.Empty,
                "Custom Blends", false);

            mEventsExpanded = EditorGUILayout.Foldout(mEventsExpanded, "Events");
            if (mEventsExpanded)
            {
                EditorGUILayout.PropertyField(FindProperty(x => x.m_CameraCutEvent));
                EditorGUILayout.PropertyField(FindProperty(x => x.m_CameraActivatedEvent));
            }
            serializedObject.ApplyModifiedProperties();
        }
        public override void OnInspectorGUI()
        {
            if (mInstructionList == null)
            {
                SetupInstructionList();
            }
            if (mChildList == null)
            {
                SetupChildList();
            }

            if (Target.m_AnimatedTarget == null)
            {
                EditorGUILayout.HelpBox("An Animated Target is required", MessageType.Error);
            }

            // Ordinary properties
            base.OnInspectorGUI();

            // Layer index
            EditorGUI.BeginChangeCheck();
            UpdateTargetStates();
            UpdateCameraCandidates();
            SerializedProperty layerProp = serializedObject.FindProperty(() => Target.m_LayerIndex);
            int currentLayer             = layerProp.intValue;
            int layerSelection           = EditorGUILayout.Popup("Layer", currentLayer, mLayerNames);

            if (currentLayer != layerSelection)
            {
                layerProp.intValue = layerSelection;
            }
            EditorGUILayout.PropertyField(serializedObject.FindProperty(() => Target.m_DefaultBlend));
            if (EditorGUI.EndChangeCheck())
            {
                serializedObject.ApplyModifiedProperties();
                Target.ValidateInstructions();
            }

            // Blends
            EditorGUILayout.Separator();
            m_BlendsEditor.DrawEditorCombo(
                "Create New Blender Asset",
                Target.gameObject.name + " Blends", "asset", string.Empty,
                "Custom Blends", false);

            // Instructions
            EditorGUI.BeginChangeCheck();
            EditorGUILayout.Separator();
            mInstructionList.DoLayoutList();

            // vcam children
            EditorGUILayout.Separator();
            mChildList.DoLayoutList();
            if (EditorGUI.EndChangeCheck())
            {
                serializedObject.ApplyModifiedProperties();
                Target.ValidateInstructions();
            }
        }
        public override void OnInspectorGUI()
        {
            BeginInspector();
            if (mChildList == null)
            {
                SetupChildList();
            }

            m_ColliderState = GetColliderState();
            switch (m_ColliderState)
            {
            case ColliderState.ColliderOnParent:
            case ColliderState.ColliderOnAllChildren:
                break;

            case ColliderState.NoCollider:
                EditorGUILayout.HelpBox(
                    "ClearShot requires a Collider extension to rank the shots.  Either add one to the ClearShot itself, or to each of the child cameras.",
                    MessageType.Warning);
                break;

            case ColliderState.ColliderOnSomeChildren:
                EditorGUILayout.HelpBox(
                    "Some child cameras do not have a Collider extension.  ClearShot requires a Collider on all the child cameras, or alternatively on the ClearShot iself.",
                    MessageType.Warning);
                break;

            case ColliderState.ColliderOnChildrenAndParent:
                EditorGUILayout.HelpBox(
                    "There is a Collider extention on the ClearShot camera, and also on some of its child cameras.  You can't have both.",
                    MessageType.Error);
                break;
            }

            DrawHeaderInInspector();
            DrawPropertyInInspector(FindProperty(x => x.m_Priority));
            DrawTargetsInInspector(FindProperty(x => x.m_Follow), FindProperty(x => x.m_LookAt));
            DrawRemainingPropertiesInInspector();

            // Blends
            m_BlendsEditor.DrawEditorCombo(
                "Create New Blender Asset",
                Target.gameObject.name + " Blends", "asset", string.Empty,
                "Custom Blends", false);

            // vcam children
            EditorGUILayout.Separator();
            EditorGUI.BeginChangeCheck();
            mChildList.DoLayoutList();
            if (EditorGUI.EndChangeCheck())
            {
                serializedObject.ApplyModifiedProperties();
            }

            // Extensions
            DrawExtensionsWidgetInInspector();
        }
        public override void OnInspectorGUI()
        {
            serializedObject.Update();
            DrawPropertiesExcluding(serializedObject, m_excludeFields);
            serializedObject.ApplyModifiedProperties();

            m_SettingsEditor.DrawEditorCombo(
                "Create New Noise Asset",
                Target.gameObject.name + " Noise Settings", "asset", string.Empty,
                "Noise Settings", true);

            serializedObject.ApplyModifiedProperties();
        }
        public override void OnInspectorGUI()
        {
            serializedObject.Update();

            // Show the active camera and blend
            GUI.enabled = false;
            ICinemachineCamera vcam      = Target.ActiveVirtualCamera;
            Transform          activeCam = (vcam != null && vcam.VirtualCameraGameObject != null)
                ? vcam.VirtualCameraGameObject.transform : null;

            EditorGUILayout.ObjectField("Live Camera", activeCam, typeof(Transform), true);
            EditorGUILayout.DelayedTextField(
                "Live Blend", Target.ActiveBlend != null
                ? Target.ActiveBlend.Description : string.Empty);
            GUI.enabled = true;

            // Normal properties
            List <string> excludeFields = new List <string>
            {
                "m_Script",
                SerializedPropertyHelper.PropertyName(() => Target.m_CameraCutEvent),
                SerializedPropertyHelper.PropertyName(() => Target.m_CameraActivatedEvent)
            };

            if (Target.OutputCamera != null && !Target.OutputCamera.orthographic)
            {
                excludeFields.Add(SerializedPropertyHelper.PropertyName(() => Target.m_PixelPerfect));
                excludeFields.Add(SerializedPropertyHelper.PropertyName(() => Target.m_PixelsPerUnit));
            }
            else if (!Target.m_PixelPerfect)
            {
                excludeFields.Add(SerializedPropertyHelper.PropertyName(() => Target.m_PixelsPerUnit));
            }

            DrawPropertiesExcluding(serializedObject, excludeFields.ToArray());

            m_SettingsEditor.DrawEditorCombo(
                "Create New Blender Asset",
                Target.gameObject.name + " Blends", "asset", string.Empty,
                "Custom Blends", false);

            mEventsExpanded = EditorGUILayout.Foldout(mEventsExpanded, "Events");
            if (mEventsExpanded)
            {
                EditorGUILayout.PropertyField(serializedObject.FindProperty(() => Target.m_CameraCutEvent));
                EditorGUILayout.PropertyField(serializedObject.FindProperty(() => Target.m_CameraActivatedEvent));
            }
            serializedObject.ApplyModifiedProperties();
        }
        public override void OnInspectorGUI()
        {
            serializedObject.Update();

            if (Target.m_Definition == null)
            {
                EditorGUILayout.HelpBox("A Noise Definition is required", MessageType.Error);
            }

            DrawPropertiesExcluding(serializedObject, m_excludeFields);
            serializedObject.ApplyModifiedProperties();

            m_SettingsEditor.DrawEditorCombo(
                "Create New Noise Asset",
                Target.gameObject.name + " Noise Settings", "asset", string.Empty,
                "Noise Settings", true);

            serializedObject.ApplyModifiedProperties();
        }
        public override void OnInspectorGUI()
        {
            BeginInspector();
            if (mInstructionList == null)
            {
                SetupInstructionList();
            }
            if (mChildList == null)
            {
                SetupChildList();
            }

            if (Target.m_AnimatedTarget == null)
            {
                EditorGUILayout.HelpBox("An Animated Target is required", MessageType.Warning);
            }

            // Ordinary properties
            DrawHeaderInInspector();
            DrawPropertyInInspector(FindProperty(x => x.m_Priority));
            DrawTargetsInInspector(FindProperty(x => x.m_Follow), FindProperty(x => x.m_LookAt));
            DrawPropertyInInspector(FindProperty(x => x.m_AnimatedTarget));

            // Layer index
            EditorGUI.BeginChangeCheck();
            UpdateTargetStates();
            UpdateCameraCandidates();
            SerializedProperty layerProp = FindAndExcludeProperty(x => x.m_LayerIndex);
            int currentLayer             = layerProp.intValue;
            int layerSelection           = EditorGUILayout.Popup("Layer", currentLayer, mLayerNames);

            if (currentLayer != layerSelection)
            {
                layerProp.intValue = layerSelection;
            }
            if (EditorGUI.EndChangeCheck())
            {
                serializedObject.ApplyModifiedProperties();
                Target.ValidateInstructions();
            }

            DrawRemainingPropertiesInInspector();

            // Blends
            m_BlendsEditor.DrawEditorCombo(
                "Create New Blender Asset",
                Target.gameObject.name + " Blends", "asset", string.Empty,
                "Custom Blends", false);

            // Instructions
            EditorGUI.BeginChangeCheck();
            EditorGUILayout.Separator();
            mInstructionList.DoLayoutList();

            // vcam children
            EditorGUILayout.Separator();
            mChildList.DoLayoutList();
            if (EditorGUI.EndChangeCheck())
            {
                serializedObject.ApplyModifiedProperties();
                Target.ValidateInstructions();
            }

            // Extensions
            DrawExtensionsWidgetInInspector();
        }