public void SetTreeItemColorValue(TreeViewItemBase <BoneCache> bone, Color color) { if (bone != null && bone.customData != null) { using (m_Model.UndoScope(TextContent.boneColor)) { m_Model.SetBoneColor(bone.customData, color); m_SkinningEvents.boneColorChanged.Invoke(bone.customData); } } }
public void SetTreeItemDepthValue(TreeViewItemBase <BoneCache> bone, int value) { if (bone != null && bone.customData != null) { using (m_Model.UndoScope(TextContent.boneDepth)) { m_Model.SetDepth(bone.customData, value); m_SkinningEvents.boneNameChanged.Invoke(bone.customData); } } }
void SetChildrenVisibility(TreeViewItemBase <BoneCache> bone, bool visible) { if (bone.children == null) { return; } foreach (var childBone in bone.children) { var cb = childBone as TreeViewItemBase <BoneCache>; SetChildrenVisibility(cb, visible); m_Model.SetVisibility(cb.customData, visible); } }
public bool CanReparent(TreeViewItemBase <BoneCache> parent, List <TreeViewItem> draggedItems) { TreeViewItemBase <BoneCache> currentParent = parent; while (currentParent != null) { if (draggedItems.Contains(currentParent)) { return(false); } currentParent = currentParent.parent as TreeViewItemBase <BoneCache>; } return(true); }
private static void AddTreeViewItem(IList <TreeViewItem> rows, BoneCache bone, BoneCache[] bones, int depth) { var item = new TreeViewItemBase <BoneCache>(bone.GetInstanceID(), depth, bone.name, bone); rows.Add(item); var children = bones.Where(x => x.parentBone == bone).ToArray(); System.Array.Sort(children, (a, b) => a.siblingIndex.CompareTo(b.siblingIndex)); foreach (var childBone in children) { AddTreeViewItem(rows, childBone, bones, depth + 1); } }
public void SetTreeItemVisibility(TreeViewItemBase <BoneCache> item, bool visible, bool includeChildren) { var bone = item.customData; if (bone != null && bone.isVisible != visible) { using (m_Model.UndoScope(TextContent.visibilityChange)) { m_Model.SetVisibility(item.customData, visible); if (includeChildren) { // toggle all children as well SetChildrenVisibility(item, visible); } } } }
private List <TreeViewItem> CreateTreeGroup(int level, CharacterGroupCache[] groups, CharacterPartCache[] parts, int depth) { var items = new List <TreeViewItem>(); for (int j = 0; j < groups.Length; ++j) { if (groups[j].parentGroup == level) { var item = new TreeViewItemBase <ISpriteVisibilityItem>(groups[j].GetInstanceID(), depth, groups[j].name, new SpriteVisibilityGroupItem() { group = groups[j], }); items.Add(item); var children = new List <ISpriteVisibilityItem>(); // find all sprite that has this group var groupParts = parts.Where(x => x.parentGroup == j); foreach (var part in groupParts) { var ii = CreateTreeViewItem(part, groups, depth + 1); items.Add(ii); var visibilityItem = ii as TreeViewItemBase <ISpriteVisibilityItem>; if (visibilityItem != null) { children.Add(visibilityItem.customData); } } var childItemes = CreateTreeGroup(j, groups, parts, depth + 1); foreach (var iii in childItemes) { items.Add(iii); var visibilityItem = iii as TreeViewItemBase <ISpriteVisibilityItem>; if (visibilityItem != null) { children.Add(visibilityItem.customData); } } (item.customData as SpriteVisibilityGroupItem).childItems = children.ToArray(); } } return(items); }
public void ReparentItems(TreeViewItemBase <BoneCache> newParent, List <TreeViewItem> draggedItems, int insertAtIndex) { if ((m_Model.hasCharacter && m_Model.mode != SkinningMode.Character) || (!m_Model.hasCharacter && m_Model.mode == SkinningMode.Character)) { return; } var parent = newParent != null ? newParent.customData : null; using (m_Model.UndoScope(TextContent.setParentBone)) { for (var i = draggedItems.Count - 1; i >= 0; --i) { var bone = ((TreeViewItemBase <BoneCache>)draggedItems[i]).customData; m_Model.SetBoneParent(parent, bone, insertAtIndex); m_SkinningEvents.skeletonTopologyChanged.Invoke(bone.skeleton); } } }
public int GetTreeItemDepthValue(TreeViewItemBase <BoneCache> bone) { return(m_Model.GetDepth(bone.customData)); }
public bool GetTreeItemVisibility(TreeViewItemBase <BoneCache> item) { return(m_Model.GetVisibility(item.customData)); }
public Color GetTreeItemColorValue(TreeViewItemBase <BoneCache> bone) { return(m_Model.GetBoneColor(bone.customData)); }