public void UpdateWeightInspector(ISpriteMeshData spriteMeshData, string[] boneNames, ISelection <int> selection, ICacheUndo cacheUndo) { m_WeightInspectorPanel.weightInspector.spriteMeshData = spriteMeshData; m_WeightInspectorPanel.weightInspector.boneNames = ModuleUtility.ToGUIContentArray(boneNames); m_WeightInspectorPanel.weightInspector.selection = selection; m_WeightInspectorPanel.weightInspector.cacheUndo = cacheUndo; }
public BoneCache[] CreateBoneCacheFromSpriteBones(SpriteBone[] spriteBones, float scale) { var bones = Array.ConvertAll(spriteBones, b => CreateCache <BoneCache>()); for (var i = 0; i < spriteBones.Length; ++i) { var spriteBone = spriteBones[i]; var bone = bones[i]; if (spriteBone.parentId >= 0) { bone.SetParent(bones[spriteBone.parentId]); } bone.name = spriteBone.name; bone.localLength = spriteBone.length * scale; bone.depth = spriteBone.position.z; bone.localPosition = (Vector2)spriteBone.position * scale; bone.localRotation = spriteBone.rotation; bone.bindPoseColor = ModuleUtility.CalculateNiceColor(i, 6); } foreach (var bone in bones) { if (bone.parentBone != null && bone.parentBone.localLength > 0f && (bone.position - bone.parentBone.endPosition).sqrMagnitude < 0.005f) { bone.parentBone.chainedChild = bone; } } return(bones); }
public static BoneCache CreateBone(this SkeletonCache skeleton, BoneCache parentBone, Vector3 position, Vector3 endPosition, bool isChained, string name) { Debug.Assert(skeleton != null); if (parentBone != null) { Debug.Assert(skeleton.Contains(parentBone)); } var bone = skeleton.skinningCache.CreateCache <BoneCache>(); bone.SetParent(parentBone); bone.name = name; bone.bindPoseColor = ModuleUtility.CalculateNiceColor(skeleton.BoneCount, 6); bone.position = position; bone.endPosition = endPosition; if (isChained && parentBone != null) { parentBone.chainedChild = bone; } skeleton.AddBone(bone); return(bone); }
internal Rect Do(int controlID) { var eventType = Event.current.GetTypeForControl(controlID); if (eventType == EventType.MouseDown) { m_StartPosition = ModuleUtility.GUIToWorld(Event.current.mousePosition); m_Position = m_StartPosition; } if (eventType == EventType.Layout) { HandleUtility.AddDefaultControl(controlID); } m_Position = Slider2D.Do(controlID, m_Position); var rect = new Rect(); rect.min = m_StartPosition; rect.max = m_Position; return(rect); }
protected override Color GetBoneColorRaw(int index) { return(ModuleUtility.CalculateNiceColor(index, 6)); }
public Vector3 GUIToWorld(Vector2 guiPosition, Vector3 planeNormal, Vector3 planePosition) { return(ModuleUtility.GUIToWorld(guiPosition, planeNormal, planePosition)); }
public Vector3 GUIToWorld(Vector2 guiPosition) { return(ModuleUtility.GUIToWorld(guiPosition)); }