Пример #1
0
        void DrawAttributeInfo(Scene scene)
        {
            // Separator.
            EditorGUILayout.LabelField("", GUI.skin.horizontalSlider);

            EditorGUILayout.LabelField("Property Opinions", EditorStyles.boldLabel);
            EditorGUILayout.LabelField("Name: " + selectedAttribute.GetName());
            EditorGUILayout.LabelField("Type: " + selectedAttribute.GetTypeName().GetTfType().GetTypeName());
            EditorGUILayout.LabelField("IsArray: " + selectedAttribute.GetTypeName().IsArray());
            EditorGUILayout.LabelField("Composed Path: " + selectedAttribute.GetPath());
            EditorGUILayout.LabelField("Variability: " + selectedAttribute.GetVariability());
            EditorGUILayout.LabelField("Is Custom: " + selectedAttribute.IsCustom());
            double upper, lower, hasSamples;

            selectedAttribute.GetBracketingTimeSamples(scene.Time.GetValueOrDefault(), out lower, out upper,
                                                       out hasSamples);
            if (hasSamples > 0)
            {
                EditorGUILayout.LabelField("Braketing TimeSamples: [ " + lower + ", " + upper + " ]");
            }
            else
            {
                EditorGUILayout.LabelField("Braketing TimeSamples: [ ]");
            }

            EditorGUILayout.LabelField("TimeSamples: ");
            GUILayout.TextArea(string.Join(",",
                                           selectedAttribute.GetTimeSamples().Select(p => p.ToString()).ToArray()));

            // Spec are the low level API  in Sdf, the enable one to read and write a layer without
            // going through the composition graph. This is the fastest way to write USD data, but
            // also the most complicated.
            //
            // A property stack is an ordered list of all opinions about what this value should be.
            // The visualization below is a great debugging aid in production when something looks
            // wrong, but you have no idea why your value (opinion) isn't winning. It lets the user
            // understand how composition is working and shows them exactly what files are contributing
            // the final result.

            EditorGUILayout.LabelField("Authored Values: ");
            var specs = selectedAttribute.GetPropertyStack();

            if (specs.Count == 0)
            {
                EditorGUILayout.LabelField("[ Attribute has no authored opinions ]", EditorStyles.boldLabel);
            }

            foreach (var propSpec in specs)
            {
                EditorGUILayout.LabelField(propSpec.GetLayer().GetIdentifier());
            }

            // Separator.
            EditorGUILayout.LabelField("", GUI.skin.horizontalSlider);
        }