private void DrawDetailArea()
        {
            EditorGUILayout.BeginVertical("Box");
            if (_entryList.index >= 0 && _entryList.index < _entryList.serializedProperty.arraySize)
            {
                var element = _entryList.serializedProperty.GetArrayElementAtIndex(_entryList.index);

                var propType = element.FindPropertyRelative(PROP_TYPE);

                SPEditorGUILayout.PropertyField(propType);
                SPEditorGUILayout.PropertyField(element.FindPropertyRelative(PROP_NAME));
                SPEditorGUILayout.PropertyField(element.FindPropertyRelative(PROP_DESCRIPTIVENAME));

                switch ((InputSettings.InputType)propType.enumValueIndex)
                {
                case InputSettings.InputType.KeyOrMouseButton:
                {
                    SPEditorGUILayout.PropertyField(element.FindPropertyRelative(PROP_DESCRIPTIVENAMENEGATIVE));
                    SPEditorGUILayout.PropertyField(element.FindPropertyRelative(PROP_NEGATIVEBUTTON));
                    SPEditorGUILayout.PropertyField(element.FindPropertyRelative(PROP_POSITIVEBUTTON));
                    SPEditorGUILayout.PropertyField(element.FindPropertyRelative(PROP_ALTNEGATIVEBUTTON));
                    SPEditorGUILayout.PropertyField(element.FindPropertyRelative(PROP_ALTPOSITIVEBUTTON));
                    SPEditorGUILayout.PropertyField(element.FindPropertyRelative(PROP_GRAVITY));
                    SPEditorGUILayout.PropertyField(element.FindPropertyRelative(PROP_DEAD));
                    SPEditorGUILayout.PropertyField(element.FindPropertyRelative(PROP_SENSITIVITY));
                    SPEditorGUILayout.PropertyField(element.FindPropertyRelative(PROP_SNAP));
                    SPEditorGUILayout.PropertyField(element.FindPropertyRelative(PROP_INVERT));
                    SPEditorGUILayout.PropertyField(element.FindPropertyRelative(PROP_JOYNUM));

                    element.FindPropertyRelative(PROP_AXIS).enumValueIndex = 0;
                }
                break;

                case InputSettings.InputType.MouseMovement:
                case InputSettings.InputType.JoystickAxis:
                {
                    SPEditorGUILayout.PropertyField(element.FindPropertyRelative(PROP_AXIS));
                    SPEditorGUILayout.PropertyField(element.FindPropertyRelative(PROP_DEAD));
                    SPEditorGUILayout.PropertyField(element.FindPropertyRelative(PROP_SENSITIVITY));
                    SPEditorGUILayout.PropertyField(element.FindPropertyRelative(PROP_INVERT));
                    SPEditorGUILayout.PropertyField(element.FindPropertyRelative(PROP_JOYNUM));

                    element.FindPropertyRelative(PROP_DESCRIPTIVENAMENEGATIVE).stringValue = string.Empty;
                    element.FindPropertyRelative(PROP_NEGATIVEBUTTON).stringValue          = string.Empty;
                    element.FindPropertyRelative(PROP_POSITIVEBUTTON).stringValue          = string.Empty;
                    element.FindPropertyRelative(PROP_ALTNEGATIVEBUTTON).stringValue       = string.Empty;
                    element.FindPropertyRelative(PROP_ALTPOSITIVEBUTTON).stringValue       = string.Empty;
                    element.FindPropertyRelative(PROP_GRAVITY).floatValue = 0f;
                    element.FindPropertyRelative(PROP_SNAP).boolValue     = false;
                }
                break;
                }
            }
            else
            {
                EditorGUILayout.HelpBox("Select a target to edit.", MessageType.Info);
            }
            EditorGUILayout.EndVertical();
        }
        protected override void OnSPInspectorGUI()
        {
            this.serializedObject.Update();

            this.DrawPropertyField(EditorHelper.PROP_SCRIPT);
            this.DrawPropertyField(EditorHelper.PROP_ORDER);
            this.DrawPropertyField(EditorHelper.PROP_ACTIVATEON);


            EditorGUILayout.BeginVertical("Box");

            //draw conditions blocks
            var conditionsArrayProp = this.serializedObject.FindProperty(PROP_CONDITIONS);

            if (conditionsArrayProp.arraySize == 0)
            {
                conditionsArrayProp.arraySize = 1;
            }

            for (int i = 0; i < conditionsArrayProp.arraySize; i++)
            {
                EditorGUILayout.LabelField((i == 0) ? "IF" : "ELSE IF");
                var conditionBlockProp = conditionsArrayProp.GetArrayElementAtIndex(i);
                var conditionProp      = conditionBlockProp.FindPropertyRelative(PROP_CONDITIONBLOCK_CONDITION);

                var r = EditorGUILayout.GetControlRect(false, _variantDrawer.GetPropertyHeight(conditionProp, GUIContent.none));
                _variantDrawer.OnGUI(r, conditionProp, GUIContent.none);

                var triggerProp = conditionBlockProp.FindPropertyRelative(PROP_CONDITIONBLOCK_TRIGGER);
                SPEditorGUILayout.PropertyField(triggerProp);
            }

            //draw else
            EditorGUILayout.LabelField("ELSE");
            SPEditorGUILayout.PropertyField(this.serializedObject.FindProperty(PROP_ELSECONDITION));

            //draw add buttons
            var fullRect  = EditorGUILayout.GetControlRect();
            var leftRect  = new Rect(fullRect.xMin, fullRect.yMin, fullRect.width / 2f, fullRect.height);
            var rightRect = new Rect(fullRect.xMin + leftRect.width, fullRect.yMin, fullRect.width / 2f, fullRect.height);

            if (GUI.Button(leftRect, "Add Condition"))
            {
                conditionsArrayProp.arraySize++;
            }
            if (GUI.Button(rightRect, "Remove Condition"))
            {
                conditionsArrayProp.arraySize--;
            }

            EditorGUILayout.EndVertical();

            this.DrawDefaultInspectorExcept(EditorHelper.PROP_SCRIPT, EditorHelper.PROP_ORDER, EditorHelper.PROP_ACTIVATEON, PROP_CONDITIONS, PROP_ELSECONDITION);


            this.serializedObject.ApplyModifiedProperties();
        }
Exemple #3
0
        protected override void OnSPInspectorGUI()
        {
            this.serializedObject.Update();

            this.DrawPropertyField(EditorHelper.PROP_SCRIPT);



            var assetIdProp = this.serializedObject.FindProperty(PROP_ASSETID);
            var go          = GameObjectUtil.GetGameObjectFromSource(this.serializedObject.targetObject);

            if (go != null)
            {
                switch (PrefabUtility.GetPrefabType(go))
                {
                case PrefabType.None:
                    SPEditorGUILayout.PropertyField(assetIdProp);
                    break;

                case PrefabType.Prefab:
                {
                    if (string.IsNullOrEmpty(assetIdProp.stringValue))
                    {
                        var path = AssetHelper.GetRelativeResourcePath(AssetDatabase.GetAssetPath(go));
                        assetIdProp.stringValue = (string.IsNullOrEmpty(path)) ? go.name : path;
                    }
                    SPEditorGUILayout.PropertyField(assetIdProp);
                    break;
                }

                case PrefabType.PrefabInstance:
                {
                    if (string.IsNullOrEmpty(assetIdProp.stringValue))
                    {
                        go = PrefabUtility.GetPrefabParent(go) as GameObject;
                        if (go != null)
                        {
                            var path = AssetHelper.GetRelativeResourcePath(AssetDatabase.GetAssetPath(go));
                            assetIdProp.stringValue = (string.IsNullOrEmpty(path)) ? go.name : path;
                        }
                    }
                    SPEditorGUILayout.PropertyField(assetIdProp);
                    break;
                }

                default:
                    //do nothing
                    break;
                }
            }



            this.DrawDefaultInspectorExcept(EditorHelper.PROP_SCRIPT, PROP_ASSETID);

            this.serializedObject.ApplyModifiedProperties();
        }
        protected override void OnSPInspectorGUI()
        {
            this.serializedObject.Update();

            this.DrawPropertyField(EditorHelper.PROP_SCRIPT);
            this.DrawPropertyField(PROP_ORDER);

            var propMode = this.serializedObject.FindProperty(PROP_MODE);
            SPEditorGUILayout.PropertyField(propMode);

            this.DrawTargetAnimatorProperty();

            switch (propMode.GetEnumValue<i_PlayAnimation.PlayByMode>())
            {
                case i_PlayAnimation.PlayByMode.PlayAnim:
                    {
                        this.serializedObject.FindProperty(PROP_ID).stringValue = string.Empty;

                        var clipProp = this.serializedObject.FindProperty(PROP_CLIP);
                        var obj = EditorGUILayout.ObjectField(EditorHelper.TempContent(clipProp.displayName), clipProp.objectReferenceValue, typeof(UnityEngine.Object), true);
                        if (obj == null || obj is AnimationClip || obj is IScriptableAnimationClip)
                            clipProp.objectReferenceValue = obj;
                        else if (GameObjectUtil.IsGameObjectSource(obj))
                            clipProp.objectReferenceValue = ObjUtil.GetAsFromSource<IScriptableAnimationClip>(obj) as UnityEngine.Object;

                        this.DrawPropertyField(PROP_SETTINGS);
                    }
                    break;
                case i_PlayAnimation.PlayByMode.PlayAnimByID:
                    {
                        this.serializedObject.FindProperty(PROP_CLIP).objectReferenceValue = null;

                        this.DrawPropertyField(PROP_ID);

                        if(this.serializedObject.FindProperty(PROP_TARGETANIMATOR).FindPropertyRelative(TriggerableTargetObjectPropertyDrawer.PROP_TARGET).objectReferenceValue is Animation)
                        {
                            this.DrawPropertyField(PROP_SETTINGS);
                        }
                    }
                    break;
                case i_PlayAnimation.PlayByMode.PlayAnimFromResource:
                    {
                        this.serializedObject.FindProperty(PROP_CLIP).objectReferenceValue = null;

                        this.DrawPropertyField(PROP_ID);

                        this.DrawPropertyField(PROP_SETTINGS);
                    }
                    break;
            }
            
            this.DrawDefaultInspectorExcept(EditorHelper.PROP_SCRIPT, PROP_ORDER, PROP_MODE, PROP_TARGETANIMATOR, PROP_ID, PROP_CLIP, PROP_SETTINGS);

            this.serializedObject.ApplyModifiedProperties();
        }
Exemple #5
0
        private void DrawAnimSettings()
        {
            var propApply = this.serializedObject.FindProperty(PROP_APPLYSETTINGS);

            SPEditorGUILayout.PropertyField(propApply);
            if (propApply.boolValue)
            {
                //this.DrawPropertyField(PROP_SETTINGS);
                EditorGUI.indentLevel++;
                SPEditorGUILayout.FlatChildPropertyField(this.serializedObject.FindProperty(PROP_SETTINGS));
                EditorGUI.indentLevel--;
            }
        }
Exemple #6
0
        public virtual void DrawBuildOptions()
        {
            //TODO - upgrade this to more specialized build options gui
            this.DrawPropertyField(PROP_BUILDTARGET);
            this.DrawPropertyField(PROP_BUILDOPTIONS);

            var propDefineSymbols = this.serializedObject.FindProperty(PROP_DEFINESYMBOLS);

            SPEditorGUILayout.PropertyField(propDefineSymbols);
            if (propDefineSymbols.boolValue)
            {
                this.DrawPropertyField(PROP_SYMBOLS);
            }
        }
Exemple #7
0
        protected override void OnSPInspectorGUI()
        {
            this.serializedObject.Update();

            this.DrawPropertyField(EditorHelper.PROP_SCRIPT);
            this.DrawPropertyField(EditorHelper.PROP_ORDER);
            this.DrawPropertyField(EditorHelper.PROP_ACTIVATEON);


            EditorGUILayout.BeginVertical("Box");
            var conditionsArrayProp = this.serializedObject.FindProperty("_conditions");

            for (int i = 0; i < conditionsArrayProp.arraySize; i++)
            {
                EditorGUILayout.LabelField(string.Format("Condition {0}", i));
                var conditionBlockProp = conditionsArrayProp.GetArrayElementAtIndex(i);
                var conditionProp      = conditionBlockProp.FindPropertyRelative("_condition");

                var r = EditorGUILayout.GetControlRect(false, _variantDrawer.GetPropertyHeight(conditionProp, GUIContent.none));
                _variantDrawer.OnGUI(r, conditionProp, GUIContent.none);

                var triggerProp = conditionBlockProp.FindPropertyRelative("_trigger");
                SPEditorGUILayout.PropertyField(triggerProp);
            }

            var fullRect  = EditorGUILayout.GetControlRect();
            var leftRect  = new Rect(fullRect.xMin, fullRect.yMin, fullRect.width / 2f, fullRect.height);
            var rightRect = new Rect(fullRect.xMin + leftRect.width, fullRect.yMin, fullRect.width / 2f, fullRect.height);

            if (GUI.Button(leftRect, "Add Condition"))
            {
                conditionsArrayProp.arraySize++;
            }
            if (GUI.Button(rightRect, "Remove Condition"))
            {
                conditionsArrayProp.arraySize--;
            }

            EditorGUILayout.EndVertical();

            this.DrawDefaultInspectorExcept(EditorHelper.PROP_SCRIPT, EditorHelper.PROP_ORDER, EditorHelper.PROP_ACTIVATEON, "_conditions");


            this.serializedObject.ApplyModifiedProperties();
        }
        protected override void OnSPInspectorGUI()
        {
            this.serializedObject.Update();

            _targetProp = this.serializedObject.FindProperty(PROP_TARGET);

            this.DrawPropertyField(EditorHelper.PROP_SCRIPT);
            this.DrawPropertyField(PROP_TIMESUPPLIER);
            SPEditorGUILayout.PropertyField(_targetProp);
            this.DrawPropertyField(PROP_TWEENTOKEN);
            _dataList.DoLayoutList();
            this.DrawPropertyField(PROP_ONCOMPLETE);


            this.DrawDefaultInspectorExcept(EditorHelper.PROP_SCRIPT, PROP_TARGET, PROP_TIMESUPPLIER, PROP_ONCOMPLETE, PROP_TWEENTOKEN);

            this.serializedObject.ApplyModifiedProperties();
        }
        protected override void OnSPInspectorGUI()
        {
            this.serializedObject.Update();

            var iterator = serializedObject.GetIterator();

            for (bool enterChildren = true; iterator.NextVisible(enterChildren); enterChildren = false)
            {
                if (iterator.name == PROP_MODIFIERS)
                {
                    this.DrawModifierTypes(iterator);
                }
                else
                {
                    SPEditorGUILayout.PropertyField(iterator, true);
                }
            }

            this.serializedObject.ApplyModifiedProperties();
        }
Exemple #10
0
        protected override void OnSPInspectorGUI()
        {
            this.serializedObject.Update();

            var propReflect = this.serializedObject.FindProperty(PROP_REFLECTNAMES);

            SPEditorGUILayout.PropertyField(propReflect);

            var propVars = this.serializedObject.FindProperty(PROP_VARIABLES);
            var lbl_Vars = EditorHelper.TempContent("Variables");

            _variablesDrawer.ConfigurePropertyList((TypeReferencePropertyDrawer.GetTypeFromTypeReference(propReflect)));
            var h = _variablesDrawer.GetPropertyHeight(propVars, lbl_Vars);
            var r = EditorGUILayout.GetControlRect(true, _variablesDrawer.GetPropertyHeight(propVars, lbl_Vars));

            _variablesDrawer.OnGUI(r, propVars, lbl_Vars);

            this.DrawDefaultInspectorExcept(EditorHelper.PROP_SCRIPT, PROP_REFLECTNAMES, PROP_VARIABLES);

            this.serializedObject.ApplyModifiedProperties();
        }
        protected override void OnSPInspectorGUI()
        {
            this.serializedObject.Update();


            this.DrawDefaultInspectorExcept(PROP_STATEMACHINE, PROP_STATE, PROP_WAITON);

            var stateMachineProp = this.serializedObject.FindProperty(PROP_STATEMACHINE);

            SPEditorGUILayout.PropertyField(stateMachineProp);

            var src = GameObjectUtil.GetGameObjectFromSource(stateMachineProp.objectReferenceValue);

            if (src != null)
            {
                var states = ParentComponentStateSupplier <IAIState> .GetComponentsOnTarg(src, false).ToArray();

                var stateProp = this.serializedObject.FindProperty(PROP_STATE);

                int index = System.Array.IndexOf(states, stateProp.objectReferenceValue);
                var names = (from s in states select EditorHelper.TempContent(s.DisplayName)).ToArray();

                EditorGUI.BeginChangeCheck();
                index = EditorGUILayout.Popup(EditorHelper.TempContent("State"), index, names);
                if (EditorGUI.EndChangeCheck())
                {
                    stateProp.objectReferenceValue = (index >= 0) ? states[index] as UnityEngine.Object : null;
                }
            }
            else
            {
                EditorGUILayout.LabelField("State", "*Select a State Machine first*");
            }


            this.DrawPropertyField(PROP_WAITON);


            this.serializedObject.ApplyModifiedProperties();
        }
Exemple #12
0
        public bool OnGUILayout(SerializedProperty property, GUIContent label, bool includeChildren, GUILayoutOption[] options)
        {
            if (label == null)
            {
                label = EditorHelper.TempContent(property.displayName);
            }

            if (!includeChildren || !property.hasVisibleChildren)
            {
                //return ScriptAttributeUtility.SharedNullInternalPropertyHandler.OnGUILayout(property, label, includeChildren, options);
                return(EditorGUILayout.PropertyField(property, label, includeChildren, options));
            }

            EditorGUI.BeginChangeCheck();

            //draw header
            property.isExpanded = EditorGUILayout.Foldout(property.isExpanded, label);

            //draw children
            if (property.isExpanded)
            {
                var iterator = property.Copy();
                var end      = property.GetEndProperty();
                for (bool enterChildren = true; iterator.NextVisible(enterChildren); enterChildren = false)
                {
                    if (SerializedProperty.EqualContents(iterator, end))
                    {
                        break;
                    }

                    SPEditorGUILayout.PropertyField(iterator, EditorHelper.TempContent(iterator.displayName), iterator.hasVisibleChildren, options);
                }
            }

            return(EditorGUI.EndChangeCheck());
        }
        protected override void OnSPInspectorGUI()
        {
            this.serializedObject.Update();

            this.DrawPropertyField(EditorHelper.PROP_SCRIPT);



            if (Application.isPlaying)
            {
                GUI.enabled = false;
            }

            this.DrawPropertyField(PROP_NOTIFTYPE);

            var useGlobalProp = this.serializedObject.FindProperty(PROP_USEGLOBAL);
            var targetProp    = this.serializedObject.FindProperty(PROP_TARGET);

            SPEditorGUILayout.PropertyField(useGlobalProp);
            if (useGlobalProp.boolValue)
            {
                targetProp.objectReferenceValue = null;
            }
            else
            {
                SPEditorGUILayout.PropertyField(targetProp);
            }

            GUI.enabled = true;



            this.DrawDefaultInspectorExcept(EditorHelper.PROP_SCRIPT, PROP_NOTIFTYPE, PROP_USEGLOBAL, PROP_TARGET);

            this.serializedObject.ApplyModifiedProperties();
        }
        protected void DrawConditionsBlock()
        {
            EditorGUILayout.BeginVertical("Box");

            VariantReference vref = EditorHelper.GetTargetObjectOfProperty(this.serializedObject.FindProperty(PROP_TARGET)) as VariantReference;

            System.Type enumType = vref != null?vref.GetPropertyReturnType() : null;

            if (enumType != null && !enumType.IsEnum)
            {
                enumType = null;
            }

            //draw conditions blocks
            var conditionsArrayProp = this.serializedObject.FindProperty(PROP_CONDITIONS);

            for (int i = 0; i < conditionsArrayProp.arraySize; i++)
            {
                var conditionBlockProp = conditionsArrayProp.GetArrayElementAtIndex(i);
                var valueProp          = conditionBlockProp.FindPropertyRelative(PROP_CONDITIONBLOCK_VALUE);
                var flagsProp          = conditionBlockProp.FindPropertyRelative(PROP_CONDITIONBLOCK_FLAGS);

                EditorGUILayout.LabelField((enumType != null) ? "Case " + ConvertUtil.ToEnumOfType(enumType, valueProp.intValue).ToString() + ":": "Case " + valueProp.intValue.ToString() + ":", EditorStyles.boldLabel);

                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.PrefixLabel("Value");

                if (enumType == null)
                {
                    valueProp.intValue = EditorGUILayout.IntField(valueProp.intValue);
                }
                else
                {
                    switch ((i_TriggerOnEnumState.EnumFlagTestModes)flagsProp.intValue)
                    {
                    case i_TriggerOnEnumState.EnumFlagTestModes.NoFlag:
                    {
                        valueProp.intValue = ConvertUtil.ToInt(EditorGUILayout.EnumPopup(ConvertUtil.ToEnumOfType(enumType, valueProp.intValue)));
                    }
                    break;

                    default:
                    {
                        //valueProp.intValue = ConvertUtil.ToInt(EditorGUILayout.EnumFlagsField(ConvertUtil.ToEnumOfType(enumType, valueProp.intValue)));
                        valueProp.intValue = SPEditorGUILayout.EnumFlagField(enumType, valueProp.intValue);
                    }
                    break;
                    }
                }

                flagsProp.intValue = ConvertUtil.ToInt(EditorGUILayout.EnumPopup((i_TriggerOnEnumState.EnumFlagTestModes)flagsProp.intValue));
                EditorGUILayout.EndHorizontal();

                var triggerProp = conditionBlockProp.FindPropertyRelative(PROP_CONDITIONBLOCK_TRIGGER);
                SPEditorGUILayout.PropertyField(triggerProp);

                EditorGUILayout.Space();
            }

            //draw else
            EditorGUILayout.LabelField("Default Case:", EditorStyles.boldLabel);
            SPEditorGUILayout.PropertyField(this.serializedObject.FindProperty(PROP_DEFAULTCONDITION));

            EditorGUILayout.Space();

            //draw add buttons
            var fullRect  = EditorGUILayout.GetControlRect();
            var leftRect  = new Rect(fullRect.xMin, fullRect.yMin, fullRect.width / 2f, fullRect.height);
            var rightRect = new Rect(fullRect.xMin + leftRect.width, fullRect.yMin, fullRect.width / 2f, fullRect.height);

            if (GUI.Button(leftRect, "Add Condition"))
            {
                conditionsArrayProp.arraySize++;
            }
            if (GUI.Button(rightRect, "Remove Condition"))
            {
                conditionsArrayProp.arraySize--;
            }

            EditorGUILayout.EndVertical();
        }
        private void DrawModifierTypes(SerializedProperty prop)
        {
            //TODO - we want to include a drop down that only lists the IStateModifiers that actually exist on the nodes...

            SPEditorGUILayout.PropertyField(prop, true);
        }
Exemple #16
0
        protected override void OnSPInspectorGUI()
        {
            this.serializedObject.Update();

            var targ = this.target as AIController;

            if (targ == null)
            {
                return;
            }

            this.DrawPropertyField(EditorHelper.PROP_SCRIPT);

            var sourceProp = this.serializedObject.FindProperty(PROP_STATESOURCE);

            SPEditorGUILayout.PropertyField(sourceProp);

            var cache     = SPGUI.DisableIfPlaying();
            var stateProp = this.serializedObject.FindProperty(PROP_DEFAULTSTATE);

            switch (sourceProp.GetEnumValue <AIStateMachineSourceMode>())
            {
            case AIStateMachineSourceMode.SelfSourced:
            {
                var states = ComponentStateSupplier <IAIState> .GetComponentsOnTarg(targ.gameObject).Cast <Component>().ToArray();

                stateProp.objectReferenceValue = SPEditorGUILayout.SelectComponentField(stateProp.displayName, states, stateProp.objectReferenceValue as Component);
            }
            break;

            case AIStateMachineSourceMode.ChildSourced:
            {
                var states = ParentComponentStateSupplier <IAIState> .GetComponentsOnTarg(targ.gameObject, false);

                var names = (from s in states select EditorHelper.TempContent(GameObjectUtil.GetGameObjectFromSource(s).name + " (" + s.GetType().Name + ")")).ToArray();
                int i     = states.IndexOf(stateProp.objectReferenceValue);
                i = EditorGUILayout.Popup(EditorHelper.TempContent(stateProp.displayName), i, names);
                stateProp.objectReferenceValue = (i >= 0) ? states[i] as UnityEngine.Object : null;
            }
            break;

            default:
            {
                var states = ArrayUtil.Empty <Component>();
                stateProp.objectReferenceValue = SPEditorGUILayout.SelectComponentField(stateProp.displayName, states, stateProp.objectReferenceValue as Component);
            }
            break;
            }

            cache.Reset();


            this.DrawDefaultInspectorExcept(EditorHelper.PROP_SCRIPT, PROP_STATESOURCE, PROP_DEFAULTSTATE);

            this.serializedObject.ApplyModifiedProperties();


            if (Application.isPlaying)
            {
                if (targ.States != null && targ.States.Current != null)
                {
                    var c   = targ.States.Current;
                    var msg = string.Format("Currently active state is {0} ({1}).", c.DisplayName, c.GetType().Name);
                    EditorGUILayout.HelpBox(msg, MessageType.Info);
                }
                else
                {
                    EditorGUILayout.HelpBox("Currently active state is null.", MessageType.Info);
                }
            }
        }
        protected override void OnSPInspectorGUI()
        {
            this.serializedObject.Update();

            this.DrawPropertyField(EditorHelper.PROP_SCRIPT);
            this.DrawPropertyField(PROP_ORDER);
            this.DrawPropertyField(PROP_ACTIVATEON);

            this.DrawTargetAnimatorProperty();

            var controller = this.serializedObject.FindProperty(PROP_TARGETANIMATOR).FindPropertyRelative(TriggerableTargetObjectPropertyDrawer.PROP_TARGET).objectReferenceValue;

            if (controller is Animation || controller is SPLegacyAnimController)
            {
                var propMode = this.serializedObject.FindProperty(PROP_MODE);
                SPEditorGUILayout.PropertyField(propMode);

                switch (propMode.GetEnumValue <i_PlayAnimation.PlayByMode>())
                {
                case i_PlayAnimation.PlayByMode.PlayAnim:
                {
                    this.serializedObject.FindProperty(PROP_ID).stringValue = string.Empty;

                    var clipProp = this.serializedObject.FindProperty(PROP_CLIP);
                    var obj      = EditorGUILayout.ObjectField(EditorHelper.TempContent(clipProp.displayName), clipProp.objectReferenceValue, typeof(UnityEngine.Object), true);
                    if (obj == null || obj is AnimationClip || obj is IScriptableAnimationClip)
                    {
                        clipProp.objectReferenceValue = obj;
                    }
                    else if (GameObjectUtil.IsGameObjectSource(obj))
                    {
                        clipProp.objectReferenceValue = ObjUtil.GetAsFromSource <IScriptableAnimationClip>(obj) as UnityEngine.Object;
                    }
                }
                break;

                case i_PlayAnimation.PlayByMode.PlayAnimByID:
                {
                    this.serializedObject.FindProperty(PROP_CLIP).objectReferenceValue = null;

                    //this.DrawPropertyField(PROP_ID);
                    this.DrawAnimIdSelector(controller);
                }
                break;

                case i_PlayAnimation.PlayByMode.PlayAnimFromResource:
                {
                    this.serializedObject.FindProperty(PROP_CLIP).objectReferenceValue = null;

                    this.DrawPropertyField(PROP_ID);
                }
                break;
                }

                this.DrawAnimSettings();
                this.DrawPropertyField(PROP_QUEUEMODE);
                this.DrawPropertyField(PROP_PLAYMODE);
                this.DrawPropertyField(PROP_CROSSFADEDUR);
            }
            else if (controller is ISPAnimator)
            {
                var propId = this.serializedObject.FindProperty(PROP_ID);
                propId.stringValue = DrawSPAnimatorFunctionPopup(EditorGUILayout.GetControlRect(), controller as ISPAnimator, propId.stringValue);
            }
            else if (controller is ISPAnimationSource)
            {
                this.serializedObject.FindProperty(PROP_MODE).SetEnumValue <i_PlayAnimation.PlayByMode>(i_PlayAnimation.PlayByMode.PlayAnimByID);
                this.serializedObject.FindProperty(PROP_CLIP).objectReferenceValue = null;

                this.DrawPropertyField(PROP_ID);
                this.DrawAnimSettings();
                this.DrawPropertyField(PROP_QUEUEMODE);
                this.DrawPropertyField(PROP_PLAYMODE);
                this.DrawPropertyField(PROP_CROSSFADEDUR);
            }

            this.DrawDefaultInspectorExcept(EditorHelper.PROP_SCRIPT, PROP_ORDER, PROP_ACTIVATEON, PROP_MODE, PROP_TARGETANIMATOR, PROP_ID, PROP_CLIP, PROP_SETTINGSMASK, PROP_SETTINGS, PROP_QUEUEMODE, PROP_PLAYMODE, PROP_CROSSFADEDUR);

            this.serializedObject.ApplyModifiedProperties();
        }