Exemple #1
0
        protected override void InitializeCore()
        {
            RegisterExportHandler <Model>((path) => Data.Save(path));
            RegisterExportHandler <Assimp.Scene>(path => ModelExporter.ExportFile(Data, path));

            RegisterReplaceHandler <Model>(path =>
            {
                var model = Resource.Load <Model>(path);
                if (model != null)
                {
                    Data.ReplaceWith(model);
                }

                return(Data);
            });
            RegisterReplaceHandler <Assimp.Scene>(path =>
            {
                var model = ModelConverterUtility.ConvertAssimpModel(path);
                if (model != null)
                {
                    Data.ReplaceWith(model);
                }

                return(Data);
            });

            RegisterModelUpdateHandler(() =>
            {
                var model = new Model(Version);
                if (Textures != null && Nodes.Contains(Textures))
                {
                    model.Textures = Textures.Data;
                }

                if (Materials != null && Nodes.Contains(Materials))
                {
                    model.Materials = Materials.Data;
                }

                if (Scene != null && Nodes.Contains(Scene))
                {
                    model.Scene = Scene.Data;
                }

                if (ChunkType000100F9 != null && Nodes.Contains(ChunkType000100F9))
                {
                    model.ChunkType000100F9 = ChunkType000100F9.Data;
                }

                if (ChunkType000100F8 != null && Nodes.Contains(ChunkType000100F8))
                {
                    model.ChunkType000100F8 = ChunkType000100F8.Data;
                }

                if (AnimationPack != null && Nodes.Contains(AnimationPack))
                {
                    model.AnimationPack = AnimationPack.Data;
                }

                return(model);
            });
            RegisterCustomHandler("Add New Animation Pack", () =>
            {
                Data.AnimationPack = new AnimationPack(Data.Version);
                InitializeView(true);
            });
            RegisterCustomHandler("Add New Chunk Type 000100F9", () =>
            {
                Data.ChunkType000100F9 = new ChunkType000100F9(Data.Version);
                InitializeView(true);
            });
            RegisterCustomHandler("Add New Chunk Type 000100F8", () =>
            {
                Data.ChunkType000100F8 = new ChunkType000100F8(Data.Version);
                InitializeView(true);
            });
        }
Exemple #2
0
 protected override void ExportCore(Scene obj, Stream stream, string filename = null)
 {
     ModelExporter.ExportFile(obj, filename);
 }