コード例 #1
0
        public override void OnPreviewGUI(Rect r, GUIStyle background)
        {
            fiIInspectorPreview preview = BehaviorEditor.Get(target.GetType()) as fiIInspectorPreview;

            if (preview != null)
            {
                preview.OnPreviewGUI(r, background);
            }
        }
コード例 #2
0
        public override void OnPreviewSettings()
        {
            fiIInspectorPreview preview = BehaviorEditor.Get(target.GetType()) as fiIInspectorPreview;

            if (preview != null)
            {
                preview.OnPreviewSettings();
            }
        }
コード例 #3
0
        public void OnSceneGUI()
        {
            if (target == null)
            {
                return;
            }

            BehaviorEditor.Get(target.GetType()).SceneGUI(target);
        }
コード例 #4
0
        public static void ShowInspectorForSerializedObject(UnityObject[] targets)
        {
            CheckForNewBaseBehaviorType(targets[0].GetType());
            DrawOpenScriptButton(targets[0]);

            // TODO: How do we show a mixed value?
            // TODO: We could have a global call of some sort?
            // TODO: We have the edit path w.r.t. metadata, so we can compute the
            //       deltas at the start and then export it as a list which
            //       property editors can check against.

            // Capture object state if we are doing multi-object editing.
            var preeditState = new SavedObject();

            if (fiSettings.EnableMultiEdit && targets.Length > 1)
            {
                preeditState = new SavedObject(targets[0]);
            }

            // Run the editor
            BehaviorEditor.Get(targets[0].GetType()).EditWithGUILayout(targets[0]);

            // Inspector for the serialized state
            var inspectedObject = targets[0] as ISerializedObject;

            if (inspectedObject != null)
            {
                EditorGUI.BeginChangeCheck();
                DrawSerializedState(inspectedObject);
                if (EditorGUI.EndChangeCheck())
                {
                    EditorUtility.SetDirty(targets[0]);
                    inspectedObject.RestoreState();
                }
            }

            // Apply changes to other objects that are being edited.
            if (fiSettings.EnableMultiEdit && targets.Length > 1)
            {
                var posteditState = new SavedObject(targets[0]);
                var delta         = new SavedObjectDelta(posteditState, preeditState);
                for (int i = 1; i < targets.Length; ++i)
                {
                    UnityObject obj = targets[i];
                    delta.ApplyChanges(ref obj);
                }
            }
        }
        public static void ShowInspectorForSerializedObject(UnityObject target)
        {
            DrawOpenScriptButton(target);

            // Run the editor
            BehaviorEditor.Get(target.GetType()).EditWithGUILayout(target);

            // Inspector for the serialized state
            var inspectedObject = target as ISerializedObject;

            if (inspectedObject != null)
            {
                EditorGUI.BeginChangeCheck();
                DrawSerializedState(inspectedObject);
                if (EditorGUI.EndChangeCheck())
                {
                    EditorUtility.SetDirty(target);
                    inspectedObject.RestoreState();
                }
            }
        }
コード例 #6
0
        public override bool HasPreviewGUI()
        {
            IBehaviorEditor editor = BehaviorEditor.Get(target.GetType());

            return(editor is fiIInspectorPreview);
        }
コード例 #7
0
 public void OnDisable()
 {
     BehaviorEditor.Get(target.GetType()).OnEditorDeactivate(target);
 }
コード例 #8
0
 public void OnEnable()
 {
     BehaviorEditor.Get(target.GetType()).OnEditorActivate(target);
 }
 public void OnSceneGUI()
 {
     BehaviorEditor.Get(target.GetType()).SceneGUI(target);
 }