Example #1
0
        public void Prepare()
        {
            scenes[0].Prepare();

            // Do not export empty arrays
            if (NodesList.Count > 0)
            {
                nodes = NodesList.ToArray();
                NodesList.ForEach(node => node.Prepare());
            }
            if (CamerasList.Count > 0)
            {
                cameras = CamerasList.ToArray();
            }
            if (BuffersList.Count > 0)
            {
                buffers = BuffersList.ToArray();
            }
            if (BufferViewsList.Count > 0)
            {
                bufferViews = BufferViewsList.ToArray();
            }
            if (AccessorsList.Count > 0)
            {
                accessors = AccessorsList.ToArray();
            }
            if (MeshesList.Count > 0)
            {
                meshes = MeshesList.ToArray();
            }
            if (MaterialsList.Count > 0)
            {
                materials = MaterialsList.ToArray();
            }
            if (TexturesList.Count > 0)
            {
                textures = TexturesList.ToArray();
            }
            if (ImagesList.Count > 0)
            {
                images = ImagesList.ToArray();
            }
            if (SamplersList.Count > 0)
            {
                samplers = SamplersList.ToArray();
            }
            if (AnimationsList.Count > 0)
            {
                animations = AnimationsList.ToArray();
                AnimationsList.ForEach(animation => animation.Prepare());
            }
            if (SkinsList.Count > 0)
            {
                skins = SkinsList.ToArray();
            }
        }
Example #2
0
        public void Prepare()
        {
            scenes[0].Prepare();

            // Do not export empty arrays
            if (NodesList.Count > 0)
            {
                nodes = NodesList.ToArray();
                NodesList.ForEach(node => node.Prepare());
            }
            if (CamerasList.Count > 0)
            {
                cameras = CamerasList.ToArray();
            }
            if (BuffersList.Count > 0)
            {
                buffers = BuffersList.ToArray();
            }
            if (BufferViewsList.Count > 0)
            {
                bufferViews = BufferViewsList.ToArray();
            }
            if (AccessorsList.Count > 0)
            {
                accessors = AccessorsList.ToArray();
            }
            if (MeshesList.Count > 0)
            {
                meshes = MeshesList.ToArray();
            }
            if (MaterialsList.Count > 0)
            {
                materials = MaterialsList.ToArray();
            }
            if (TexturesList.Count > 0)
            {
                textures = TexturesList.ToArray();
            }
            if (ImagesList.Count > 0)
            {
                images = ImagesList.ToArray();
            }
            if (SamplersList.Count > 0)
            {
                samplers = SamplersList.ToArray();
            }
            if (AnimationsList.Count > 0)
            {
                var animationsList = new List <GLTFAnimation>();
                AnimationsList.ForEach(animation =>
                {
                    animation.Prepare();
                    // Exclude empty animations
                    if (animation.channels != null)
                    {
                        animationsList.Add(animation);
                    }
                });
                if (animationsList.Count > 0)
                {
                    animations = animationsList.ToArray();
                }
            }
            if (SkinsList.Count > 0)
            {
                skins = SkinsList.ToArray();
            }
            if (extensionsUsed != null && extensionsUsed.Count == 0)
            {
                extensionsUsed = null;
            }
            if (extensionsRequired != null && extensionsRequired.Count == 0)
            {
                extensionsRequired = null;
            }
        }