Beispiel #1
0
        ///
        /// BlendShape List のElement描画
        ///
        public static bool DrawBlendShapeBinding(Rect position, SerializedProperty property,
                                                 PreviewSceneManager scene)
        {
            bool changed = false;

            if (scene != null)
            {
                var height = 16;

                var y    = position.y;
                var rect = new Rect(position.x, y, position.width, height);
                int pathIndex;
                if (StringPopup(rect, property.FindPropertyRelative("RelativePath"), scene.SkinnedMeshRendererPathList, out pathIndex))
                {
                    changed = true;
                }

                y   += height;
                rect = new Rect(position.x, y, position.width, height);
                int blendShapeIndex;
                if (IntPopup(rect, property.FindPropertyRelative("Index"), scene.GetBlendShapeNames(pathIndex), out blendShapeIndex))
                {
                    changed = true;
                }

                y   += height;
                rect = new Rect(position.x, y, position.width, height);
                if (FloatSlider(rect, property.FindPropertyRelative("Weight"), 100))
                {
                    changed = true;
                }
            }
            return(changed);
        }
        ///
        /// BlendShape List のElement描画
        ///
        public static bool DrawBlendShapeBinding(Rect position, SerializedProperty property,
                                                 PreviewSceneManager scene)
        {
            bool changed = false;

            if (scene != null)
            {
                var height = 16;

                var y    = position.y;
                var rect = new Rect(position.x, y, position.width, height);
                int pathIndex;
                var(relChanged, oldIndex) = StringPopup(rect, property.FindPropertyRelative("RelativePath"), scene.SkinnedMeshRendererPathList, out pathIndex);
                if (relChanged)
                {
                    changed = true;
                }

                y   += height;
                rect = new Rect(position.x, y, position.width, height);
                if (!relChanged && oldIndex == -1)
                {
                    EditorGUI.HelpBox(rect, "renderer not found ! please fix", MessageType.Error);
                }
                else
                {
                    int blendShapeIndex;
                    if (IntPopup(rect, property.FindPropertyRelative("Index"), scene.GetBlendShapeNames(pathIndex), out blendShapeIndex))
                    {
                        changed = true;
                    }
                }

                y   += height;
                rect = new Rect(position.x, y, position.width, height);
                if (FloatSlider(rect, property.FindPropertyRelative("Weight"), 100))
                {
                    changed = true;
                }
            }
            return(changed);
        }