Beispiel #1
0
 private void CreateSelectPoly()
 {
     message.LabelReflesh("選択用矩形オブジェクト生成");
     message.StatusBar.Value = 0;
     this.vS = new VertexSelect();
     message.StatusBar.Value = message.StatusBar.Maximum;
 }
Beispiel #2
0
        public void MakeMorph(IPEConnector connector, MyPMX mypmx, VertexSelect vs, Form1 form)
        {
            float  diff = form.Morphdiffernce;
            IPXPmx pmx  = connector.Pmx.GetCurrentState();

            if (mypmx.VertexArray.Count() != pmx.Vertex.Count)
            {
                MessageBox.Show("本体とプラグインのモデル頂点数が異なるのでこの操作はキャンセルされました。");
                return;
            }

            basePos.Clear();
            morphedPos.Clear();
            for (int i = 0; i < pmx.Vertex.Count; i++)
            {
                Vector3 morphPosI = mypmx.VertexArray[i].Position;
                Vector3 basePosI  = new Vector3(pmx.Vertex[i].UV.U, pmx.Vertex[i].UV.V, 0);
                if (Math.Abs(basePosI.X - morphPosI.X) > diff || Math.Abs(basePosI.Y - morphPosI.Y) > diff)
                {
                    basePos.Add(i, basePosI); morphedPos.Add(i, morphPosI);
                }
            }
            form.SetMorphedCount(basePos.Count);
            vs.selectedVertexIndex = this.GetMorphTargetIndex();
        }
Beispiel #3
0
        public void ReadMorph(IPEConnector connector, MyPMX mypmx, VertexSelect vs, Form1 form)
        {
            IPXPmx pmx = connector.Pmx.GetCurrentState();

            if (mypmx.VertexArray.Count() != pmx.Vertex.Count)
            {
                MessageBox.Show("本体とプラグインのモデル頂点数が異なるのでこの操作はキャンセルされました。");
                return;
            }

            basePos.Clear();
            morphedPos.Clear();
            int morphindex = form.SelectedUVMorph();

            if (morphindex < 0)
            {
                MessageBox.Show("UVモーフが選べません"); return;
            }
            var uvMorph = pmx.Morph[morphindex];

            foreach (IPXUVMorphOffset offset in uvMorph.Offsets)
            {
                IPXVertex v      = offset.Vertex;
                int       index  = pmx.Vertex.IndexOf(v);
                Vector3   baseI  = new Vector3(v.UV.U, v.UV.V, 0);
                Vector3   morphI = baseI + new Vector3(offset.Offset.X, offset.Offset.Y, 0);
                try
                {
                    this.basePos.Add(index, baseI);
                    this.morphedPos.Add(index, morphI);
                }
                catch { MessageBox.Show(index.ToString()); throw; }
            }
            form.SetMorphedCount(basePos.Count);
            vs.selectedVertexIndex = this.GetMorphTargetIndex();
        }