public void SetNewBoneNameWithBiggerCounter_AutoNamingAlwaysIncrementFromBiggest() { var root = m_Model.CreateNewRoot(Vector3.zero); var bone1 = m_Model.CreateNewChildBone(root, Vector3.one); var bone2 = m_Model.CreateNewChildBone(bone1, Vector3.right); m_Model.SetBoneName(bone2, "bone_10"); var bone11 = m_Model.CreateNewChildBone(bone2, Vector3.zero); Assert.AreEqual("bone_11", bone11.name); m_Model.SetBoneName(bone11, "bone_9"); var boneNew11 = m_Model.CreateNewChildBone(bone2, Vector3.zero); Assert.AreEqual("bone_11", boneNew11.name); }
// Name display and editing // - rect : Workspace position and size. public void DoInfoPanel(Rect rect) { // Early out, don't display if no bone or multiple bones are selected. if (!selectingBone || selectingMultipleBone) { return; } // Define the working area. m_InfoView.SetRect(rect); // Display name, handle rename. var selectedBone = state.selectedBones[0]; var newName = selectedBone.name; if (m_InfoView.HandleName(ref newName)) { m_Model.SetBoneName(selectedBone, newName); } if (IsConflictWithOtherBoneNames(selectedBone)) { m_InfoView.DisplayDuplicateBoneNameWarning(); } // Detect if user asked for a "select next bone for renaming" if (m_InfoView.HandleNextSelection()) { if (state.selectedBones.Count == 1 && !state.normalCreating && !state.freeCreating) { // Cycle to the next bone... var nextBone = m_Model.bones.First(); var takeTheNext = false; foreach (var n in m_Model.bones) { if (takeTheNext) { nextBone = n; break; } if (selectedBone == n) { takeTheNext = true; } } // ... select it. state.selectedBones.Clear(); state.selectedBones.Add(nextBone); } } }
public void DeleteATail_AddBackATail_WeightStillInvalidedForFirstTail() { InvalidateBoneIndex(5, m_ExpectedVertices); var child_1_2 = m_Model.bones.ElementAt(3); var child_1_2_2 = m_Model.bones.ElementAt(5); m_Model.DeleteBone(child_1_2_2); var newBone = m_Model.CreateNewChildBone(child_1_2, Vector2.zero); // Rename to preserve order m_Model.SetBoneName(newBone, "child_1_2_2"); m_CacheManager.SetSpriteBoneRawData(m_SpriteId, m_Model.GetRawData()); m_CacheManager.Apply(); m_MeshDPMock.Received(1).SetVertices(m_SpriteId, Arg.Is <Vertex2DMetaData[]>(x => CompareVertices(m_ExpectedVertices, x))); }