private static void FindReplaceRecursive(BoneViewModel bone, String find, String replace) { bone.BoneName = bone.BoneName.Replace(find, replace); foreach (BoneViewModel child in bone.Children) { FindReplaceRecursive(child, find, replace); } }
private static void PrefixRecursive(BoneViewModel bone, String prefix) { bone.BoneName = prefix + bone.BoneName; foreach (BoneViewModel child in bone.Children) { PrefixRecursive(child, prefix); } }
private static void ExecuteDeleteBone(BoneViewModel target) { foreach (RigResource.RigResource.Bone bone in target.Manager.GetChildren(target.Bone)) { target.Manager.SetParent(bone, target.Parent is BoneViewModel ? ((BoneViewModel)target.Parent).Bone : null); } target.Manager.DeleteBone(target.Bone, false); }
private static void SuffixRecursive(BoneViewModel bone, String suffix) { bone.BoneName = bone.BoneName + suffix; foreach (BoneViewModel child in bone.Children) { SuffixRecursive(child, suffix); } }
private static bool HasNonDescendants(BoneViewModel bone) { if (IsABone(bone)) { IEnumerable <RigResource.RigResource.Bone> descendants = bone.Manager.GetDescendants(bone.Bone); return(bone.Manager.Bones.Any(x => x != bone.Bone && !descendants.Contains(x))); } return(false); }
private static void ExecuteSuffix(BoneViewModel target) { var dialog = new StringInputDialog("Suffix Names in Hierarchy..."); bool result = dialog.ShowDialog() ?? false; if (result) { SuffixRecursive(target, dialog.Value); } }
private static void ExecuteFindReplace(BoneViewModel target) { var dialog = new FindReplaceDialog("Find and Replace in Hierarchy..."); bool result = dialog.ShowDialog() ?? false; if (result) { FindReplaceRecursive(target, dialog.Find, dialog.Replace); } }
private static void ExecuteRotationMatrixInput(BoneViewModel bone) { var q = bone.Bone.Orientation; var m = new Matrix(new Quaternion(q.A, q.B, q.C, q.D)); var dialog = new MatrixInputDialog(m, "Rotation Matrix Input"); bool result = dialog.ShowDialog() ?? false; if (result) { bone.Rotation = new EulerAngle(dialog.Value); } }
private static void ExecuteSetParent(BoneViewModel target) { IOrderedEnumerable <RigResource.RigResource.Bone> descendants = target.Manager.GetDescendants(target.Bone).OrderBy(x => x.Name); List <RigResource.RigResource.Bone> choices = target.Manager.Bones.Where(x => x != target.Bone && !descendants.Contains(x)).ToList(); choices.Sort((x, y) => x.Name.CompareTo(y.Name)); var dialog = new BoneSelectDialog(choices, "Select a New Parent..."); bool result = dialog.ShowDialog() ?? false; if (result) { target.Manager.SetParent(target.Bone, dialog.SelectedBone); } }
private static void ExecuteDeleteHierarchy(BoneViewModel target) { target.Manager.DeleteBone(target.Bone, true); }
private static void ExecuteUnparent(BoneViewModel target) { target.Manager.SetParent(target.Bone, null); }
private static bool IsAParent(BoneViewModel bone) { return(IsABone(bone) && bone.Children.Count > 0); }
private static bool IsAChild(BoneViewModel bone) { return(IsABone(bone) && bone.Parent is BoneViewModel); }
private static bool IsABone(BoneViewModel bone) { return(bone != null); }
private static void ExecuteCloneHierarchy(BoneViewModel target) { CloneHierarchy(target.Manager, target.Bone, target.Manager.GetParent(target.Bone)); }
private static void ExecuteClone(BoneViewModel target) { target.Manager.AddBone(new RigResource.RigResource.Bone(0, null, target.Bone), target.Parent is BoneViewModel ? ((BoneViewModel)target.Parent).Bone : null); }
private static void ExecuteAddBone(BoneViewModel target) { target.Manager.AddBone(new RigResource.RigResource.Bone(0, null, new Vertex(0, null), new s3pi.Interfaces.Quaternion(0, null, 0f, 0f, 0f, 1f), new Vertex(0, null), NEW_BONE_NAME, target.Manager.Bones.Count, -1, FNV32.GetHash(NEW_BONE_NAME), 0x23), target.Bone); }