예제 #1
0
        public void Save(SerializedData dataAsset)
        {
            var serializedObject = new SerializedObject(mContext);

            API.iplSceneSave(mScene, serializedObject.Get());
            serializedObject.WriteToFile(dataAsset);
        }
        public override void OnInspectorGUI()
        {
            serializedObject.Update();

            EditorGUILayout.PropertyField(mAsset);

            if (mAsset.objectReferenceValue == null)
            {
                EditorGUILayout.HelpBox(
                    "This Dynamic Object has not been exported to an asset yet. Please click Export Dynamic Object " +
                    "to do so.", MessageType.Warning);
            }

            EditorGUILayout.Space();

            if (GUILayout.Button("Export Dynamic Object"))
            {
                if (mAsset.objectReferenceValue == null)
                {
                    var name = (target as SteamAudioDynamicObject).gameObject.scene.name + "_" + target.name;
                    mAsset.objectReferenceValue = SerializedData.PromptForNewAsset(name);
                    serializedObject.ApplyModifiedProperties();
                }

                SteamAudioManager.ExportDynamicObject(target as SteamAudioDynamicObject, false);
            }

            if (GUILayout.Button("Export Dynamic Object as OBJ"))
            {
                SteamAudioManager.ExportDynamicObject(target as SteamAudioDynamicObject, true);
            }

            serializedObject.ApplyModifiedProperties();
        }
        public override void OnInspectorGUI()
        {
            serializedObject.Update();

            EditorGUILayout.PropertyField(mAsset);

            var scene = (target as SteamAudioStaticMesh).gameObject.scene;

            if (mAsset.objectReferenceValue == null)
            {
                EditorGUILayout.HelpBox(
                    "This scene has not been exported. Click Steam Audio > Export Active Scene to export.",
                    MessageType.Warning);
            }
            else if (mSceneNameWhenExported.stringValue != scene.name)
            {
                EditorGUILayout.HelpBox(
                    string.Format("This geometry was last exported for the scene {0}. If this is not what you " +
                                  "intended, click Export As New Asset below.", mSceneNameWhenExported.stringValue),
                    MessageType.Warning);

                if (GUILayout.Button("Export As New Asset"))
                {
                    mAsset.objectReferenceValue        = SerializedData.PromptForNewAsset(scene.name);
                    mSceneNameWhenExported.stringValue = scene.name;
                    serializedObject.ApplyModifiedProperties();

                    SteamAudioManager.ExportScene(scene, false);
                }
            }

            serializedObject.ApplyModifiedProperties();
        }
예제 #4
0
        public void Save(SerializedData dataAsset)
        {
            var serializedObject = new SerializedObject(mContext);

            API.iplStaticMeshSave(mStaticMesh, serializedObject.Get());
            serializedObject.WriteToFile(dataAsset);
            serializedObject.Release();
        }
예제 #5
0
        public SerializedData GetAsset()
        {
            if (asset == null)
            {
                asset = SerializedData.PromptForNewAsset(gameObject.scene.name + "_" + name);
            }

            return(asset);
        }
        public StaticMesh(Context context, Scene scene, SerializedData dataAsset)
        {
            mContext = context;

            var serializedObject = new SerializedObject(context, dataAsset);

            var status = API.iplStaticMeshLoad(scene.Get(), serializedObject.Get(), null, IntPtr.Zero, out mStaticMesh);
            if (status != Error.Success)
                throw new Exception(string.Format("Unable to load static mesh ({0}). [{1}]", dataAsset.name, status));
        }
        public int Save(SerializedData dataAsset, bool flush = true)
        {
            var serializedObject = new SerializedObject(mContext);

            API.iplProbeBatchSave(mProbeBatch, serializedObject.Get());
            var size = (int)serializedObject.GetSize();

            serializedObject.WriteToFile(dataAsset, flush);
            return(size);
        }
예제 #8
0
        public static void FlushWrite(SerializedData dataAsset)
        {
#if UNITY_EDITOR
            var assetPaths = new string[1];
            assetPaths[0] = AssetDatabase.GetAssetPath(dataAsset);

            // TODO: Deprecate older versions of Unity.
#if UNITY_2017_3_OR_NEWER
            AssetDatabase.ForceReserializeAssets(assetPaths);
#endif
#endif
        }
예제 #9
0
        public Scene(Context context, SceneSettings sceneSettings, SerializedData dataAsset)
        {
            mContext = context;

            var serializedObject = new SerializedObject(context, dataAsset);
            var status           = API.iplSceneLoad(context.Get(), ref sceneSettings, serializedObject.Get(), null, IntPtr.Zero, out mScene);

            if (status != Error.Success)
            {
                throw new Exception(string.Format("Unable to load scene [{0}]", status.ToString()));
            }
        }
        public ProbeBatch(Context context, SerializedData dataAsset)
        {
            mContext = context;

            var serializedObject = new SerializedObject(context, dataAsset);

            var status = API.iplProbeBatchLoad(context.Get(), serializedObject.Get(), out mProbeBatch);

            if (status != Error.Success)
            {
                Debug.LogError(string.Format("Unable to load Probe Batch from {0}.", dataAsset.name));
                mProbeBatch = IntPtr.Zero;
            }
        }
예제 #11
0
        public SerializedObject(Context context, SerializedData dataAsset)
        {
            var data = dataAsset.data;

            mDataBuffer = Marshal.AllocHGlobal(data.Length);

            Marshal.Copy(data, 0, mDataBuffer, data.Length);

            var serializedObjectSettings = new SerializedObjectSettings {
            };

            serializedObjectSettings.data = mDataBuffer;
            serializedObjectSettings.size = (UIntPtr)data.Length;

            API.iplSerializedObjectCreate(context.Get(), ref serializedObjectSettings, out mSerializedObject);
        }
예제 #12
0
        public void WriteToFile(SerializedData dataAsset, bool flush = true)
        {
            var dataSize   = GetSize();
            var dataBuffer = GetData();

            dataAsset.data = new byte[(int)dataSize];
            Marshal.Copy(dataBuffer, dataAsset.data, 0, (int)dataSize);

            if (flush)
            {
                FlushWrite(dataAsset);
            }
            else
            {
                if (sAssetsToFlush == null)
                {
                    sAssetsToFlush = new List <SerializedData>();
                }

                sAssetsToFlush.Add(dataAsset);
            }
        }