public BoneRiggingSelector(LVDEditor.StringWrapper s)
 {
     InitializeComponent();
     str           = s;
     initialValue  = str.data;
     textBox1.Text = charsToString(initialValue);
     currentValue  = initialValue;
 }
Пример #2
0
        private void singleBindToBoneToolStripMenuItem_Click(object sender, EventArgs e)
        {
            /*if(mc.vbn.bones == null)
             * {
             *  MessageBox.Show("No Skeleton Found");
             *  return;
             * }*/
            NUD.Mesh mesh = (NUD.Mesh)treeView1.SelectedNode;
            char[]   d    = "None".ToCharArray();
            LVDEditor.StringWrapper str = new LVDEditor.StringWrapper()
            {
                data = d
            };
            foreach (TreeNode node in treeView1.Nodes)
            {
                if (node is ModelContainer)
                {
                    ModelContainer mc = (ModelContainer)node;
                    if (treeView1.SelectedNode.Parent == mc.NUD)
                    {
                        if (mc.VBN.bones.Count > mesh.singlebind && mesh.singlebind != -1)
                        {
                            str = new LVDEditor.StringWrapper()
                            {
                                data = mc.VBN.bones[mesh.singlebind].Text.ToCharArray()
                            }
                        }
                    }
                    ;
                }
            }

            BoneRiggingSelector brs = new BoneRiggingSelector(str)
            {
                ModelContainers = GetModelContainers()
            };

            brs.ShowDialog();
            if (!brs.Cancelled)
            {
                mesh.boneflag   = 8;
                mesh.singlebind = brs.boneIndex;
                foreach (NUD.Polygon poly in mesh.Nodes)
                {
                    poly.polflag  = 0;
                    poly.vertSize = poly.vertSize & 0x0F;
                    foreach (NUD.Vertex vi in poly.vertices)
                    {
                        vi.node.Clear();
                        vi.node.Add(mesh.singlebind);
                        vi.weight.Clear();
                        vi.weight.Add(1);
                    }
                }
                ((NUD)treeView1.SelectedNode.Parent).PreRender();
            }
        }
Пример #3
0
        private void Clicked(object sender, EventArgs e)
        {
            LVDEditor.StringWrapper name = new LVDEditor.StringWrapper()
            {
                data = new char[0x40]
            };
            if (bone != null)
            {
                name.data = bone.Text.ToCharArray();
            }
            BoneRiggingSelector brs = new BoneRiggingSelector(name);

            brs.ModelContainers.Add(new ModelContainer()
            {
                VBN = vbn
            });
            brs.CurrentBone = bone;
            brs.ShowDialog();
            if (!brs.Cancelled)
            {
                if (brs.SelectedNone)
                {
                    bone   = null;
                    boneId = noBone;
                }
                else
                {
                    if (brs.CurrentBone == null)
                    {
                        MessageBox.Show("Please select a bone or hit 'None'/'Cancel'", "Bone Selector issue",
                                        MessageBoxButtons.OK);
                        boneId = noBone;
                    }
                    else
                    {
                        bone   = brs.CurrentBone;
                        boneId = bone.boneId;
                    }
                }
                OnBoneChanged(new EventArgs());
            }
            if (bone == null)
            {
                Text = "None";
            }
            else
            {
                Text = bone.Text;
            }
        }
Пример #4
0
        private void treeView1_NodeMouseDoubleClick(object sender, TreeNodeMouseClickEventArgs e)
        {
            if (treeView1.SelectedNode is NUD.Mesh)
            {
                NUD.Mesh mesh = (NUD.Mesh)treeView1.SelectedNode;
                char[]   d    = "None".ToCharArray();
                LVDEditor.StringWrapper str = new LVDEditor.StringWrapper()
                {
                    data = d
                };
                foreach (ModelContainer mc in Runtime.ModelContainers)
                {
                    if (treeView1.SelectedNode.Parent.Tag == mc.nud)
                    {
                        if (mc.vbn.bones.Count > mesh.singlebind && mesh.singlebind != -1)
                        {
                            str = new LVDEditor.StringWrapper()
                            {
                                data = mc.vbn.bones[mesh.singlebind].boneName
                            }
                        }
                    }
                }
                ;

                BoneRiggingSelector brs = new BoneRiggingSelector(str);
                brs.ShowDialog();
                if (!brs.Cancelled)
                {
                    mesh.singlebind = brs.boneIndex;
                    foreach (NUD.Polygon poly in mesh.polygons)
                    {
                        foreach (NUD.Vertex vi in poly.vertices)
                        {
                            vi.node.Clear();
                            vi.node.Add(mesh.singlebind);
                            vi.weight.Clear();
                            vi.weight.Add(1);
                        }
                    }
                    ((NUD)treeView1.SelectedNode.Parent.Tag).PreRender();
                }
            }
            else if (treeView1.SelectedNode is NUD.Polygon)
            {
                polySelected((NUD.Polygon)treeView1.SelectedNode, $"{treeView1.SelectedNode.Parent.Text} {treeView1.SelectedNode.Text}");
            }
        }
Пример #5
0
        private void singleBindToBoneToolStripMenuItem_Click(object sender, EventArgs e)
        {
            NUD.Mesh mesh = (NUD.Mesh)treeView1.SelectedNode;
            char[]   d    = "None".ToCharArray();
            LVDEditor.StringWrapper str = new LVDEditor.StringWrapper()
            {
                data = d
            };
            foreach (ModelContainer mc in Runtime.ModelContainers)
            {
                if (treeView1.SelectedNode.Parent.Tag == mc.nud)
                {
                    if (mc.vbn.bones.Count > mesh.singlebind && mesh.singlebind != -1)
                    {
                        str = new LVDEditor.StringWrapper()
                        {
                            data = mc.vbn.bones[mesh.singlebind].boneName
                        }
                    }
                }
            }
            ;

            BoneRiggingSelector brs = new BoneRiggingSelector(str);

            brs.ShowDialog();
            if (!brs.Cancelled)
            {
                mesh.boneflag   = 8;
                mesh.singlebind = brs.boneIndex;
                foreach (NUD.Polygon poly in mesh.polygons)
                {
                    poly.polflag  = 0;
                    poly.vertSize = poly.vertSize & 0x0F;
                    foreach (NUD.Vertex vi in poly.vertices)
                    {
                        vi.node.Clear();
                        vi.node.Add(mesh.singlebind);
                        vi.weight.Clear();
                        vi.weight.Add(1);
                    }
                }
                ((NUD)treeView1.SelectedNode.Parent.Tag).PreRender();
            }
        }