Get() public static method

Returns a behavior editor that can be used to edit the given behavior type.
public static Get ( Type behaviorType ) : IBehaviorEditor
behaviorType System.Type /// The type of behavior to edit. This should derive from BaseBehavior. ///
return IBehaviorEditor
Example #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);
            }
        }
Example #2
0
        public override void OnPreviewSettings()
        {
            fiIInspectorPreview preview = BehaviorEditor.Get(target.GetType()) as fiIInspectorPreview;

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

            BehaviorEditor.Get(target.GetType()).SceneGUI(target);
        }
Example #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();
                }
            }
        }
Example #6
0
        public override bool HasPreviewGUI()
        {
            IBehaviorEditor editor = BehaviorEditor.Get(target.GetType());

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