Example #1
0
        public override void OnInspectorGUI()
        {
            serializedObject.Update();

            SteamAudioGeometry geometry = serializedObject.targetObject as SteamAudioGeometry;

            EditorGUILayout.Space();
            bool toggleValue = serializedObject.FindProperty("exportAllChildren").boolValue;

            if (geometry.transform.childCount != 0)
            {
                serializedObject.FindProperty("exportAllChildren").boolValue = GUILayout.Toggle(toggleValue, " Export All Children");
            }

            EditorGUILayout.Space();
            EditorGUILayout.LabelField("Geometry Statistics", EditorStyles.boldLabel);
            EditorGUILayout.LabelField("Vertices", geometry.GetNumVertices().ToString());
            EditorGUILayout.LabelField("Triangles", geometry.GetNumTriangles().ToString());

            if (geometry.gameObject.GetComponent <Terrain>() != null)
            {
                EditorGUILayout.LabelField("Terrain Export Settings", EditorStyles.boldLabel);
                EditorGUILayout.PropertyField(serializedObject.FindProperty("TerrainSimplificationLevel"));
            }

            EditorGUILayout.Space();

            serializedObject.ApplyModifiedProperties();
        }
Example #2
0
        SteamAudioGeometry[] FilterGameObjectsWithDynamicGeometry(SteamAudioGeometry[] objects)
        {
            if (objects == null || objects.Length <= 0)
            {
                return(null);
            }

            var numExcluded = 0;
            var excluded    = new bool[objects.Length];

            for (var i = 0; i < objects.Length; ++i)
            {
                var dynamicObjects = objects[i].GetComponentsInParent <SteamAudioDynamicObject>();
                excluded[i] = (dynamicObjects != null && dynamicObjects.Length > 0);
                if (excluded[i])
                {
                    ++numExcluded;
                }
            }
            var numIncluded = objects.Length - numExcluded;

            var filteredObjects = new SteamAudioGeometry[numIncluded];
            var index           = 0;

            for (var i = 0; i < objects.Length; ++i)
            {
                if (excluded[i])
                {
                    continue;
                }
                filteredObjects[index] = objects[i];
                ++index;
            }

            return(filteredObjects);
        }