void SpawnHierarchyButton(string label, string tooltip, SkeletonUtilityBone.Mode mode, bool pos, bool rot, bool sca, params GUILayoutOption[] options)
        {
            GUIContent content = new GUIContent(label, tooltip);

            if (GUILayout.Button(content, options))
            {
                if (skeletonUtility.skeletonRenderer == null)
                {
                    skeletonUtility.skeletonRenderer = skeletonUtility.GetComponent <SkeletonRenderer>();
                }

                if (skeletonUtility.boneRoot != null)
                {
                    return;
                }

                skeletonUtility.SpawnHierarchy(mode, pos, rot, sca);

                SkeletonUtilityBone[] boneComps = skeletonUtility.GetComponentsInChildren <SkeletonUtilityBone>();
                foreach (SkeletonUtilityBone b in boneComps)
                {
                    AttachIcon(b);
                }
            }
        }
    void OnEnable()
    {
        skeletonUtility  = GetComponent <SkeletonUtility>();
        skeletonRenderer = skeletonUtility.GetComponent <SkeletonRenderer>();
        skeleton         = skeletonRenderer.Skeleton;

        if (skeleton == null)
        {
            skeletonRenderer.Initialize(false);
            skeletonRenderer.LateUpdate();
            skeleton = skeletonRenderer.skeleton;
        }
    }
		void OnEnable () {
			skeletonUtility = (SkeletonUtility)target;
			skeletonRenderer = skeletonUtility.GetComponent<SkeletonRenderer>();
			skeleton = skeletonRenderer.skeleton;
			transform = skeletonRenderer.transform;

			if (skeleton == null) {
				skeletonRenderer.Initialize(false);
				skeletonRenderer.LateUpdate();

				skeleton = skeletonRenderer.skeleton;
			}

			UpdateAttachments();
			isPrefab |= PrefabUtility.GetPrefabType(this.target) == PrefabType.Prefab;
		}
        void OnEnable()
        {
            skeletonUtility  = (SkeletonUtility)target;
            skeletonRenderer = skeletonUtility.GetComponent <SkeletonRenderer>();
            skeleton         = skeletonRenderer.skeleton;
            transform        = skeletonRenderer.transform;

            if (skeleton == null)
            {
                skeletonRenderer.Initialize(false);
                skeletonRenderer.LateUpdate();

                skeleton = skeletonRenderer.skeleton;
            }

            UpdateAttachments();
            isPrefab |= PrefabUtility.GetPrefabType(this.target) == PrefabType.Prefab;
        }
	void OnEnable () {
		skeletonUtility = (SkeletonUtility)target;
		skeletonRenderer = skeletonUtility.GetComponent<SkeletonRenderer>();
		skeleton = skeletonRenderer.skeleton;
		transform = skeletonRenderer.transform;

		if (skeleton == null) {
			skeletonRenderer.Reset();
			skeletonRenderer.LateUpdate();

			skeleton = skeletonRenderer.skeleton;
		}

		UpdateAttachments();

		if (PrefabUtility.GetPrefabType(this.target) == PrefabType.Prefab)
			isPrefab = true;

	}
        void OnEnable()
        {
            skeletonUtility  = (SkeletonUtility)target;
            skeletonRenderer = skeletonUtility.GetComponent <SkeletonRenderer>();
            skeleton         = skeletonRenderer.Skeleton;

            if (skeleton == null)
            {
                skeletonRenderer.Initialize(false);
                skeletonRenderer.LateUpdate();
                skeleton = skeletonRenderer.skeleton;
            }

            if (!skeletonRenderer.valid)
            {
                return;
            }

            isPrefab |= PrefabUtility.GetPrefabType(this.target) == PrefabType.Prefab;
        }
示例#7
0
    void OnEnable()
    {
        skeletonUtility  = (SkeletonUtility)target;
        skeletonRenderer = skeletonUtility.GetComponent <SkeletonRenderer>();
        skeleton         = skeletonRenderer.skeleton;
        transform        = skeletonRenderer.transform;

        if (skeleton == null)
        {
            skeletonRenderer.Reset();
            skeletonRenderer.LateUpdate();

            skeleton = skeletonRenderer.skeleton;
        }

        UpdateAttachments();

        if (PrefabUtility.GetPrefabType(this.target) == PrefabType.Prefab)
        {
            isPrefab = true;
        }
    }
    public void Init()
    {
        skeletonUtility  = GetComponent <SkeletonUtility>();
        skeletonRenderer = skeletonUtility.GetComponent <SkeletonRenderer>();
        skeleton         = skeletonRenderer.skeleton;
        Skin defaultSkin    = skeleton.Data.DefaultSkin;
        Skin skin           = skeleton.Skin ?? defaultSkin;
        bool notDefaultSkin = skin != defaultSkin;

        attachmentTable.Clear();
        //Debug.Log(skeleton.Slots.Count);
        for (int i = skeleton.Slots.Count - 1; i >= 0; i--)
        {
            var attachments = new List <Attachment>();
            attachmentTable.Add(skeleton.Slots.Items[i], attachments);
            skin.FindAttachmentsForSlot(i, attachments); // Add skin attachments.
            if (notDefaultSkin)
            {
                defaultSkin.FindAttachmentsForSlot(i, attachments);                 // Add default skin attachments.
            }
        }

        activeSkin = skeleton.Skin;
    }