public BoneEditor(PictureBox picBox) { setViewport(picBox); picBox.MouseClick += picBox_MouseClick; picBox.MouseDown += picBox_MouseDown; picBox.MouseUp += picBox_MouseUp; picBox.MouseMove += picBox_MouseMove; picBox.KeyDown += BoneEditor_KeyDown; picBox.KeyUp += BoneEditor_KeyUp; picBox.LostFocus += picBox_LostFocus; SelectMode = SelectModes.Bones; rootPos = new PointF(0,0); bones.Add(root); Bone b = root; b = AddBone(b); b = AddBone(b); b = AddBone(b); b = AddBone(b); GreedStep = 20; SnapGrid = false; DrawGrid = false; Character = new BAnimator.Character(); Character.RootBone = root; }
public BoneGraphics(Character parent) { IsRoot = false; Character = parent; Group = null; Order = 0; Length = 100; Angle = 0; }
public static Character Load(string filename) { BinaryReader reader = new BinaryReader(File.OpenRead(filename)); Character ch = new Character(); string file_id = reader.ReadString(); if (file_id != _file_id) { throw new Exception("Wrong file id"); } int version = reader.ReadInt32(); if (version == 1) LoadV1(ch, reader); return ch; }
public BoneGraphicsManager(Character ch) { parent = ch; }
public void LoadCharacter(Character ch) { Character = ch; root = ch.RootBone; bones.Clear(); bones.Add(root); AddSubBones(root); RefreshBonesNode(); RefreshBonesTree(); Redraw(); }
private static void LoadV1(Character ch, BinaryReader reader) { ch.Name = reader.ReadString(); ch.Author = reader.ReadString(); ch.Description = reader.ReadString(); //root bone read Bone root = new Bone(); root.Name = reader.ReadString(); uint id = reader.ReadUInt32(); bool isroot = reader.ReadBoolean(); if (!isroot) { throw new Exception("Неожиданная ошибка при чтении файла: первая кость не помечена, как корневая"); } ch.RootBone = root; int children = reader.ReadInt32(); for (int i = 0; i < children; i++) { ReadBone(root, reader); } }