Ejemplo n.º 1
0
        private void UnlinkGroup(MDL0GroupNode group)
        {
            switch (group._type)
            {
            case MDLResourceType.Bones: { _boneGroup = null; _boneList = null; break; }

            case MDLResourceType.Materials: { _matGroup = null; _matList = null; break; }

            case MDLResourceType.Shaders: { _shadGroup = null; _shadList = null; break; }

            case MDLResourceType.Polygons: { _polyGroup = null; _polyList = null; break; }
                //case MDLResourceType.Textures: { _texGroup = null; _texList = null; break; }
            }
        }
Ejemplo n.º 2
0
 public void LinkGroup(MDL0GroupNode group)
 {
     switch (group._type)
     {
         case MDLResourceType.Definitions: { _defGroup = group; _defList = group._children; break; }
         case MDLResourceType.Bones: { _boneGroup = group; _boneList = group._children; break; }
         case MDLResourceType.Materials: { _matGroup = group; _matList = group._children; break; }
         case MDLResourceType.Shaders: { _shadGroup = group; _shadList = group._children; break; }
         case MDLResourceType.Vertices: { _vertGroup = group; _vertList = group._children; break; }
         case MDLResourceType.Normals: { _normGroup = group; _normList = group._children; break; }
         case MDLResourceType.UVs: { _uvGroup = group; _uvList = group._children; break; }
         case MDLResourceType.Colors: { _colorGroup = group; _colorList = group._children; break; }
         case MDLResourceType.Objects: { _objGroup = group; _objList = group._children; break; }
         case MDLResourceType.Textures: { _texGroup = group; _texList = group._children; break; }
         case MDLResourceType.Palettes: { _pltGroup = group; _pltList = group._children; break; }
         case MDLResourceType.FurLayerCoords: { _furPosGroup = group; _furPosList = group._children; break; }
         case MDLResourceType.FurVectors: { _furVecGroup = group; _furVecList = group._children; break; }
     }
 }
Ejemplo n.º 3
0
        public MDL0TextureNode FindOrCreateTexture(string name)
        {
            if (_texGroup == null)
                AddChild(_texGroup = new MDL0GroupNode(MDLResourceType.Textures), false);
            else
                foreach (MDL0TextureNode n in _texGroup.Children)
                    if (n._name == name)
                        return n;

            MDL0TextureNode node = new MDL0TextureNode(name);
            _texGroup.AddChild(node, false);

            return node;
        }
Ejemplo n.º 4
0
        //public void AutoMetal()
        //{
        //    ((MDL0Node)_resource).AutoMetalMaterials = true;
        //}
        public MDL0VertexNode NewVertex()
        {
            if (_modelViewerOpen)
                return null;

            MDL0Node model = ((MDL0Node)_resource);

            MDL0GroupNode g = model._vertGroup;
            if (g == null)
            {
                model.AddChild(g = new MDL0GroupNode(MDLResourceType.Vertices), true);
                model._vertGroup = g; model._vertList = g.Children;
            }

            MDL0VertexNode node = new MDL0VertexNode() { Name = "VertexSet" + ((MDL0Node)_resource)._vertList.Count };
            node.Vertices = new Vector3[] { new Vector3(0) };
            g.AddChild(node, true);
            node._forceRebuild = true;
            node.Rebuild(true);
            node.SignalPropertyChange();

            FindResource(node, true).EnsureVisible();

            return node;
        }
Ejemplo n.º 5
0
        public MDL0UVNode NewUV()
        {
            if (_modelViewerOpen)
                return null;

            MDL0Node model = ((MDL0Node)_resource);

            MDL0GroupNode g = model._uvGroup;
            if (g == null)
            {
                model.AddChild(g = new MDL0GroupNode(MDLResourceType.UVs), true);
                model._uvGroup = g; model._uvList = g.Children;
            }

            MDL0UVNode node = new MDL0UVNode() { Name = "#" + ((MDL0Node)_resource)._uvList.Count };
            node.Points = new Vector2[] { new Vector2(0) };
            g.AddChild(node, true);
            node._forceRebuild = true;
            node.Rebuild(true);
            node.SignalPropertyChange();

            FindResource(node, true).EnsureVisible();

            return node;
        }
Ejemplo n.º 6
0
        public void NewShader()
        {
            if (_modelViewerOpen)
                return;

            MDL0Node model = ((MDL0Node)_resource);

            if (model._shadGroup == null)
            {
                MDL0GroupNode g = model._shadGroup;
                if (g == null)
                {
                    model.AddChild(g = new MDL0GroupNode(MDLResourceType.Shaders), true);
                    model._shadGroup = g; model._shadList = g.Children;
                }
            }

            if (model._shadList != null && model._matList != null)
            if (model._shadList.Count < model._matList.Count)
            {
                MDL0ShaderNode shader = new MDL0ShaderNode();
                model._shadGroup.AddChild(shader);
                shader.Default();
                shader.Rebuild(true);

                BaseWrapper b = FindResource(shader, true);
                if (b != null)
                    b.EnsureVisible();
            }
        }
Ejemplo n.º 7
0
        public void NewMaterial()
        {
            if (_modelViewerOpen)
                return;

            MDL0Node model = ((MDL0Node)_resource);

            if (model._matGroup == null)
            {
                MDL0GroupNode g = model._matGroup;
                if (g == null)
                {
                    model.AddChild(g = new MDL0GroupNode(MDLResourceType.Materials), true);
                    model._matGroup = g; model._matList = g.Children;
                }
            }

            MDL0MaterialNode mat = new MDL0MaterialNode();
            model._matGroup.AddChild(mat);
            mat.Name = "Material" + mat.Index;
            mat.New = true;
            if (model._shadGroup == null)
            {
                MDL0GroupNode g = model._shadGroup;
                if (g == null)
                {
                    model.AddChild(g = new MDL0GroupNode(MDLResourceType.Shaders), true);
                    model._shadGroup = g; model._shadList = g.Children;
                }
            }
            if (model._shadList.Count == 0)
                NewShader();

            mat.ShaderNode = (MDL0ShaderNode)model._shadList[0];
            mat.AddChild(new MDL0MaterialRefNode() { Name = "MatRef0" });
            mat.Rebuild(true);

            BaseWrapper b = FindResource(mat, true);
            if (b != null)
                b.EnsureVisible();
        }
Ejemplo n.º 8
0
        public MDL0ColorNode NewColor()
        {
            if (_modelViewerOpen)
                return null;

            MDL0Node model = ((MDL0Node)_resource);

            MDL0GroupNode g = model._colorGroup;
            if (g == null)
            {
                model.AddChild(g = new MDL0GroupNode(MDLResourceType.Colors), true);
                model._colorGroup = g; model._colorList = g.Children;
            }

            MDL0ColorNode node = new MDL0ColorNode() { Name = "ColorSet" + ((MDL0Node)_resource)._colorList.Count };
            node.Colors = new RGBAPixel[] { new RGBAPixel() { A = 255, R = 128, G = 128, B = 128 } };
            g.AddChild(node, true);

            node.Rebuild(true);
            node.SignalPropertyChange();

            FindResource(node, true).EnsureVisible();

            return node;
        }