Ejemplo n.º 1
0
 public abstract void DrawInternal(GUIContent content, CRect rect = null);
Ejemplo n.º 2
0
 public abstract void DrawInternal(GUIContent content, CRect rect = null, bool useEditorIndent = false);
Ejemplo n.º 3
0
        public override void DrawInternal(GUIContent content, CRect rect = null, bool useEditorIndent = false, bool isInHeader = false)
        {
            PreDraw();
            shaderEditor.currentProperty = this;
            this.materialProperty        = shaderEditor.properties[property_index];
            if (shaderEditor.isLockedMaterial)
            {
                EditorGUI.BeginDisabledGroup(!(is_animatable && (is_animated || is_renaming)) && !exempt_from_locked_disabling);
            }
            int oldIndentLevel = EditorGUI.indentLevel;

            if (!useEditorIndent)
            {
                EditorGUI.indentLevel = xOffset + 1;
            }

            if (doCustomDrawLogic)
            {
                DrawDefault();
            }
            else if (doDrawTwoFields)
            {
                Rect  r          = GUILayoutUtility.GetRect(content, Styles.vectorPropertyStyle);
                float labelWidth = (r.width - EditorGUIUtility.labelWidth) / 2;;
                r.width -= labelWidth;
                shaderEditor.editor.ShaderProperty(r, this.materialProperty, content);

                r.x    += r.width;
                r.width = labelWidth;
                float prevLabelW = EditorGUIUtility.labelWidth;
                EditorGUIUtility.labelWidth = 0;
                shaderEditor.propertyDictionary[options.reference_property].Draw(new CRect(r), new GUIContent());
                EditorGUIUtility.labelWidth = prevLabelW;
            }
            else if (doForceIntoOneLine)
            {
                shaderEditor.editor.ShaderProperty(GUILayoutUtility.GetRect(content, Styles.vectorPropertyStyle), this.materialProperty, content);
            }
            else if (doCustomHeightOffset)
            {
                shaderEditor.editor.ShaderProperty(
                    GUILayoutUtility.GetRect(EditorGUIUtility.currentViewWidth, shaderEditor.editor.GetPropertyHeight(this.materialProperty, content.text) + customHeightOffset)
                    , this.materialProperty, content);
            }
            else if (rect != null)
            {
                shaderEditor.editor.ShaderProperty(rect.r, this.materialProperty, content);
            }
            else
            {
                shaderEditor.editor.ShaderProperty(this.materialProperty, content);
            }

            EditorGUI.indentLevel = oldIndentLevel;
            if (rect == null)
            {
                DrawingData.lastGuiObjectRect = GUILayoutUtility.GetLastRect();
            }
            else
            {
                DrawingData.lastGuiObjectRect = rect.r;
            }
            if (shaderEditor.isLockedMaterial)
            {
                EditorGUI.EndDisabledGroup();
            }
        }