public static Get ( |
||
behaviorType | /// The type of behavior to edit. This should derive from BaseBehavior. /// | |
return | IBehaviorEditor |
public override void OnPreviewGUI(Rect r, GUIStyle background) { fiIInspectorPreview preview = BehaviorEditor.Get(target.GetType()) as fiIInspectorPreview; if (preview != null) { preview.OnPreviewGUI(r, background); } }
public override void OnPreviewSettings() { fiIInspectorPreview preview = BehaviorEditor.Get(target.GetType()) as fiIInspectorPreview; if (preview != null) { preview.OnPreviewSettings(); } }
public void OnSceneGUI() { if (target == null) { return; } BehaviorEditor.Get(target.GetType()).SceneGUI(target); }
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(); } } }
public override bool HasPreviewGUI() { IBehaviorEditor editor = BehaviorEditor.Get(target.GetType()); return(editor is fiIInspectorPreview); }
public void OnDisable() { BehaviorEditor.Get(target.GetType()).OnEditorDeactivate(target); }
public void OnEnable() { BehaviorEditor.Get(target.GetType()).OnEditorActivate(target); }
public void OnSceneGUI() { BehaviorEditor.Get(target.GetType()).SceneGUI(target); }