コード例 #1
0
        private void Reset(SerializedPropertyBindEvent evt)
        {
            Clear();

            var bindProperty = evt.bindProperty;

            m_SerializedProperty = bindProperty;
            if (bindProperty == null)
            {
                return;
            }

            var handler = ScriptAttributeUtility.GetHandler(m_SerializedProperty);

            if (handler.hasPropertyDrawer)
            {
                var customPropertyGUI = handler.propertyDrawer.CreatePropertyGUI(m_SerializedProperty);
                if (customPropertyGUI == null)
                {
                    customPropertyGUI = new IMGUIContainer(() =>
                    {
                        var originalWideMode = InspectorElement.SetWideModeForWidth(this);

                        try
                        {
                            EditorGUI.BeginChangeCheck();
                            m_SerializedProperty.serializedObject.Update();

                            EditorGUILayout.PropertyField(m_SerializedProperty, true);

                            m_SerializedProperty.serializedObject.ApplyModifiedProperties();
                            if (EditorGUI.EndChangeCheck())
                            {
                                DispatchPropertyChangedEvent();
                            }
                        }
                        finally
                        {
                            EditorGUIUtility.wideMode = originalWideMode;
                        }
                    });
                }
                else
                {
                    RegisterPropertyChangesOnCustomDrawerElement(customPropertyGUI);
                }
                hierarchy.Add(customPropertyGUI);
            }
            else
            {
                var field = CreateFieldFromProperty(bindProperty);
                if (field != null)
                {
                    hierarchy.Add(field);
                }
            }
        }
コード例 #2
0
        private void Reset(SerializedPropertyBindEvent evt)
        {
            Clear();

            var bindProperty = evt.bindProperty;

            m_SerializedProperty = bindProperty;
            if (bindProperty == null)
            {
                return;
            }

            var handler = ScriptAttributeUtility.GetHandler(m_SerializedProperty);

            if (handler.hasPropertyDrawer)
            {
                var customPropertyGUI = handler.propertyDrawer.CreatePropertyGUI(m_SerializedProperty);
                if (customPropertyGUI == null)
                {
                    customPropertyGUI = new IMGUIContainer(() =>
                    {
                        EditorGUI.BeginChangeCheck();
                        m_SerializedProperty.serializedObject.Update();

                        EditorGUILayout.PropertyField(m_SerializedProperty, true);

                        m_SerializedProperty.serializedObject.ApplyModifiedProperties();
                        EditorGUI.EndChangeCheck();
                    });
                }
                hierarchy.Add(customPropertyGUI);
            }
            else
            {
                var field = CreateFieldFromProperty(bindProperty);
                if (field != null)
                {
                    hierarchy.Add(field);
                }
            }
        }
コード例 #3
0
 private void Reset(SerializedPropertyBindEvent evt)
 {
     Reset(evt.bindProperty);
 }