Ejemplo n.º 1
0
        internal static bool DrawSettings(SerializedObject so,
                                          AlembicRecorderSettings settings,
                                          string pathSettings, ref SavedBool foldCaptureComponents, ref SavedBool foldMeshComponents, bool recorder)
        {
            bool dirty = false;

            if (!recorder)
            {
                // output path
                GUILayout.Space(5);
                EditorGUILayout.LabelField("Output Path", EditorStyles.boldLabel);
                {
                    EditorGUILayout.BeginHorizontal();

                    EditorGUI.BeginChangeCheck();
                    settings.OutputPath = EditorGUILayout.TextField(settings.OutputPath);
                    if (EditorGUI.EndChangeCheck())
                    {
                        dirty = true;
                    }

                    if (GUILayout.Button("...", GUILayout.Width(24)))
                    {
                        var dir      = "";
                        var filename = "";
                        try
                        {
                            dir      = Path.GetDirectoryName(settings.OutputPath);
                            filename = Path.GetFileName(settings.OutputPath);
                        }
                        catch (Exception)
                        {
                        }

                        var path = EditorUtility.SaveFilePanel("Output Path", dir, filename, "abc");
                        if (path.Length > 0)
                        {
                            settings.OutputPath = path;
                            dirty = true;
                        }
                    }

                    EditorGUILayout.EndHorizontal();
                }
                GUILayout.Space(5);
            }


            // alembic settings
            EditorGUILayout.LabelField("Alembic Settings", EditorStyles.boldLabel);
            {
                EditorGUILayout.PropertyField(so.FindProperty(pathSettings + "conf.xformType"));
                if (!recorder)
                {
                    var timeSamplingType = so.FindProperty(pathSettings + "conf.timeSamplingType");
                    EditorGUILayout.PropertyField(timeSamplingType);
                    if (timeSamplingType.intValue == (int)TimeSamplingType.Uniform)
                    {
                        EditorGUI.indentLevel++;
                        EditorGUILayout.PropertyField(so.FindProperty(pathSettings + "conf.frameRate"));
                        EditorGUILayout.PropertyField(so.FindProperty(pathSettings + "fixDeltaTime"));
                        EditorGUI.indentLevel--;
                    }
                }

                EditorGUILayout.PropertyField(so.FindProperty(pathSettings + "conf.swapHandedness"));
                EditorGUILayout.PropertyField(so.FindProperty(pathSettings + "conf.swapFaces"));
                EditorGUILayout.PropertyField(so.FindProperty(pathSettings + "conf.scaleFactor"));
            }
            GUILayout.Space(5);


            // capture settings
            EditorGUILayout.LabelField("Capture Settings", EditorStyles.boldLabel);
            var scope = so.FindProperty(pathSettings + "scope");

            EditorGUILayout.PropertyField(scope);
            if (scope.intValue == (int)ExportScope.TargetBranch)
            {
                EditorGUI.indentLevel++;
                EditorGUI.BeginChangeCheck();
                settings.TargetBranch = EditorGUILayout.ObjectField("Target", settings.TargetBranch, typeof(GameObject), true) as GameObject;
                if (EditorGUI.EndChangeCheck())
                {
                    dirty = true;
                }
                EditorGUI.indentLevel--;
            }
            EditorGUILayout.PropertyField(so.FindProperty(pathSettings + "assumeNonSkinnedMeshesAreConstant"), new GUIContent("Static MeshRenderers"));
            GUILayout.Space(5);

            foldCaptureComponents.value = EditorGUILayout.Foldout(foldCaptureComponents, "Capture Components");
            if (foldCaptureComponents)
            {
                EditorGUI.indentLevel++;
                EditorGUILayout.PropertyField(so.FindProperty(pathSettings + "captureMeshRenderer"), new GUIContent("MeshRenderer"));
                EditorGUILayout.PropertyField(so.FindProperty(pathSettings + "captureSkinnedMeshRenderer"), new GUIContent("SkinnedMeshRenderer"));
                EditorGUILayout.PropertyField(so.FindProperty(pathSettings + "captureCamera"), new GUIContent("Camera"));
                EditorGUI.indentLevel--;
            }


            foldMeshComponents.value = EditorGUILayout.Foldout(foldMeshComponents, "Mesh Components");
            if (foldMeshComponents)
            {
                EditorGUI.indentLevel++;
                EditorGUILayout.PropertyField(so.FindProperty(pathSettings + "meshNormals"), new GUIContent("Normals"));
                EditorGUILayout.PropertyField(so.FindProperty(pathSettings + "meshUV0"), new GUIContent("UV 0"));
                EditorGUILayout.PropertyField(so.FindProperty(pathSettings + "meshUV1"), new GUIContent("UV 1"));
                EditorGUILayout.PropertyField(so.FindProperty(pathSettings + "meshColors"), new GUIContent("Vertex Color"));
                EditorGUILayout.PropertyField(so.FindProperty(pathSettings + "meshSubmeshes"), new GUIContent("Submeshes"));
                EditorGUI.indentLevel--;
            }

            return(dirty);
        }
Ejemplo n.º 2
0
 public void OnEnable()
 {
     m_foldCaptureComponents = new SavedBool($"{target.GetType()}.m_foldCaptureComponents", false);
     m_foldMeshComponents    = new SavedBool($"{target.GetType()}.m_foldMeshComponents", false);
 }