Exemplo n.º 1
0
 public BoneViewModel(RigEditorViewModel rig, IHaveBones parent, RigResource.RigResource.Bone bone, BoneManager manager)
 {
     if (rig == null)
     {
         throw new ArgumentNullException("rig");
     }
     if (bone == null)
     {
         throw new ArgumentNullException("bone");
     }
     if (manager == null)
     {
         throw new ArgumentNullException("manager");
     }
     mRig      = rig;
     mChildren = new ObservableCollection <BoneViewModel>();
     mParent   = parent;
     mBone     = bone;
     mManager  = manager;
     foreach (RigResource.RigResource.Bone b in manager.GetChildren(mBone))
     {
         mChildren.Add(new BoneViewModel(mRig, this, b, mManager));
     }
     mRotation                  = new EulerAngle(new Quaternion(bone.Orientation.A, bone.Orientation.B, bone.Orientation.C, bone.Orientation.D));
     manager.BoneAdded         += OnBoneAdded;
     manager.BoneRemoved       += OnBoneRemoved;
     manager.BoneParentChanged += OnBoneParentChanged;
     mSetOppositeCommand        = new UserCommand <BoneViewModel>(x => true, ExecuteSetOpposite);
 }
Exemplo n.º 2
0
        private static void ExecuteMatrixInfo(RigEditorViewModel param)
        {
            var sb = new StringBuilder();

            foreach (RigResource.RigResource.Bone b in param.Manager.Bones)
            {
                GetInfo(param.Manager, b, sb);
            }
            var dialog = new InfoDialog(sb.ToString(), "Matrix Info");

            dialog.ShowDialog();
        }
Exemplo n.º 3
0
 public BoneViewModel(RigEditorViewModel rig, IHaveBones parent, RigResource.RigResource.Bone bone, BoneManager manager)
 {
     if (rig == null) throw new ArgumentNullException("rig");
     if (bone == null) throw new ArgumentNullException("bone");
     if (manager == null) throw new ArgumentNullException("manager");
     mRig = rig;
     mChildren = new ObservableCollection<BoneViewModel>();
     mParent = parent;
     mBone = bone;
     mManager = manager;
     foreach (RigResource.RigResource.Bone b in manager.GetChildren(mBone))
     {
         mChildren.Add(new BoneViewModel(mRig, this, b, mManager));
     }
     mRotation = new EulerAngle(new Quaternion(bone.Orientation.A, bone.Orientation.B, bone.Orientation.C, bone.Orientation.D));
     manager.BoneAdded += OnBoneAdded;
     manager.BoneRemoved += OnBoneRemoved;
     manager.BoneParentChanged += OnBoneParentChanged;
     mSetOppositeCommand = new UserCommand<BoneViewModel>(x => true, ExecuteSetOpposite);
 }
Exemplo n.º 4
0
        private static void Main(string[] args)
        {
            byte[] buffer = null;
            using (Stream s = File.OpenRead(args[0]))
            {
                buffer = new byte[s.Length];
                s.Read(buffer, 0, buffer.Length);
            }
            var app = new Application();
            var rig = new RigResource.RigResource(0, new MemoryStream(buffer));
            var viewModel = new RigEditorViewModel(rig);
            var win = new MainWindow(viewModel);
            app.Run(win);

            if (viewModel.IsSaving)
            {
                byte[] output = rig.AsBytes;
                using (FileStream s = File.Create(args[0]))
                {
                    s.Write(output, 0, output.Length);
                }
            }
        }
Exemplo n.º 5
0
 private static void ExecuteMatrixInfo(RigEditorViewModel param)
 {
     var sb = new StringBuilder();
     foreach (RigResource.RigResource.Bone b in param.Manager.Bones)
     {
         GetInfo(param.Manager, b, sb);
     }
     var dialog = new InfoDialog(sb.ToString(), "Matrix Info");
     dialog.ShowDialog();
 }