public void JustMovingBones_WeightRemained_NeverCallSetMesh() { var root = m_Model.bones.ElementAt(0); var child_1 = m_Model.bones.ElementAt(1); var child_1_2 = m_Model.bones.ElementAt(3); var child_1_2_2 = m_Model.bones.ElementAt(5); m_Model.MoveBone(root, Vector2.one); m_Model.MoveBone(child_1, Vector2.one); m_Model.MoveTip(child_1_2, Vector2.one); m_Model.MoveTip(child_1_2_2, Vector2.one); m_CacheManager.SetSpriteBoneRawData(m_SpriteId, m_Model.GetRawData()); m_CacheManager.Apply(); m_MeshDPMock.DidNotReceiveWithAnyArgs().SetVertices(Arg.Any <GUID>(), Arg.Any <Vertex2DMetaData[]>()); }
private void MoveBoneNode(IBone bone, Vector3 d) { RecordUndo(bone, "bone bone move"); // In normal movement mode, moving a bone node will move only the node (head) but keep the tip intact (retaining tip's position). // All its offspring will not be affected by this movement. // If the parent tip is snapped to this bone, the parent tip will move together with this bone. // If any sibling(s) bone is snapped to this bone, those will move together too. if (!state.freeMoving) { var offspringOfSelected = m_OffspringOfSelected[bone]; var offspringOfParent = m_OffspringOfParent[bone]; var siblingToMoveTogether = m_SiblingToMoveTogether[bone]; // Backup the old tip's position, moving the bone will alter the tip, since tip is calculated from bone's position. var oldtip = bone.tip; // Move the bone to the destinate position, snap if necessary. var snapped = false; if (!bone.isRoot && ShouldSnap(d, bone.parent.tip)) { m_Model.MoveBone(bone, bone.parent.tip); snapped = true; } else if (!bone.isRoot && ShouldSnap(d, bone.parent.position)) { m_Model.MoveBone(bone, bone.parent.position); snapped = true; } if (!snapped) { m_Model.MoveBone(bone, d); } // Restore the tip to its old position m_Model.MoveTip(bone, oldtip); // Sibling bones should move together if they snapped to the bone before. foreach (var siblingBone in siblingToMoveTogether) { // Move, restore tip. var oldChildTip = siblingBone.tip; m_Model.MoveBone(siblingBone, d); m_Model.MoveTip(siblingBone, oldChildTip); } // Update parent's tip position if this bone was snapped to the tip before. if (m_UpdateParentTip[bone]) { m_Model.MoveTip(bone.parent, d); } } // In free movement mode, moving a bone will move the head but keep the tip intact. // All its offspring will not be affected by this movement. // Unlike normal movement mode, sibling and parent tip will not be affected by this movement. else { var oldtip = bone.tip; m_Model.MoveBone(bone, d); m_Model.MoveTip(bone, oldtip); } m_View.Refresh(); }