コード例 #1
0
    public static void AddSelectItem(GameObject item)
    {
        if (instance.selected.transform.childCount == 0)
        {
            instance.selected.transform.position = item.transform.root.position;

            var sRend = item.transform.root.gameObject.GetComponentInChildren <SkinnedMeshRenderer>();
            if (sRend != null)
            {
                BlendshapeEditor.ShowMenu(sRend, item.transform.root.gameObject.GetComponentInChildren <InfoOnBlock>());
            }
            else
            {
                BlendshapeEditor.HideMenu();
            }
        }
        if (item.transform.root.gameObject == instance.selected)
        {
            var curr = item.transform;
            for (int i = 0; i < 200; i++)
            {
                if (curr == null)
                {
                    return;
                }
                if (curr.gameObject.GetComponent <InfoOnBlock>())
                {
                    curr.SetParent(null, true);
                    break;
                }
                curr = curr.parent;
            }
        }
        else
        {
            item.transform.SetParent(instance.selected.transform, true);
        }

        instance.ShowHandles();
    }
コード例 #2
0
    public static void SelectItem(GameObject item)
    {
        if (item == instance.selected)
        {
            DeselectAll();
            return;
        }
        instance.selected.transform.DetachChildren();
        instance.selected.transform.position = item.transform.position;

        item.transform.SetParent(instance.selected.transform, true);

        instance.ShowHandles();
        var sRend = item.GetComponentInChildren <SkinnedMeshRenderer>();

        if (sRend != null)
        {
            BlendshapeEditor.ShowMenu(sRend, item.GetComponentInChildren <InfoOnBlock>());
        }
        else
        {
            BlendshapeEditor.HideMenu();
        }
    }