Example #1
0
        public void Attach()
        {
            var skeletonComponent = GetComponent <ISkeletonComponent>();

            var skeletonRenderer = skeletonComponent as SkeletonRenderer;

            if (skeletonRenderer != null)
            {
                this.applyPMA = skeletonRenderer.pmaVertexColors;
            }
            else
            {
                var skeletonGraphic = skeletonComponent as SkeletonGraphic;
                if (skeletonGraphic != null)
                {
                    this.applyPMA = skeletonGraphic.SpineMeshGenerator.PremultiplyVertexColors;
                }
            }

            Shader attachmentShader = applyPMA ? Shader.Find(DefaultPMAShader) : Shader.Find(DefaultStraightAlphaShader);

            loader = loader ?? new SpriteAttachmentLoader(sprite, attachmentShader, applyPMA);

            if (attachment == null)
            {
                attachment = loader.NewRegionAttachment(null, sprite.name, "");
            }

            skeletonComponent.Skeleton.FindSlot(slot).Attachment = attachment;

            if (!keepLoaderInMemory)
            {
                loader = null;
            }
        }
Example #2
0
        public static RegionAttachment ToRegionAttachment(this Sprite sprite, string shaderName = "Spine/Skeleton")
        {
            var loader = new SpriteAttachmentLoader(sprite, Shader.Find(shaderName));
            var att    = loader.NewRegionAttachment(null, sprite.name, "");

            loader = null;
            return(att);
        }
Example #3
0
        public static RegionAttachment ToRegionAttachment(this Sprite sprite, Shader shader, bool applyPMA)
        {
            var loader = new SpriteAttachmentLoader(sprite, shader, applyPMA);
            var att    = loader.NewRegionAttachment(null, sprite.name, "");

            loader = null;
            return(att);
        }
Example #4
0
        public void Attach()
        {
            var skeletonRenderer = GetComponent <SkeletonRenderer>();

            if (loader == null)
            {
                //create loader instance, tell it what sprite and shader to use
                loader = new SpriteAttachmentLoader(sprite, Shader.Find("Spine/Skeleton"));
            }

            if (attachment == null)
            {
                attachment = loader.NewRegionAttachment(null, sprite.name, "");
            }

            skeletonRenderer.skeleton.FindSlot(slot).Attachment = attachment;

            if (!keepLoaderInMemory)
            {
                loader = null;
            }
        }
Example #5
0
		public void Attach () {
			var skeletonComponent = GetComponent<ISkeletonComponent>();

			var skeletonRenderer = skeletonComponent as SkeletonRenderer;
			if (skeletonRenderer != null)
				this.applyPMA = skeletonRenderer.pmaVertexColors;
			else {
				var skeletonGraphic = skeletonComponent as SkeletonGraphic;
				if (skeletonGraphic != null)
					this.applyPMA = skeletonGraphic.SpineMeshGenerator.PremultiplyVertexColors;
			}

			Shader attachmentShader = applyPMA ? Shader.Find(DefaultPMAShader) : Shader.Find(DefaultStraightAlphaShader);

			loader = loader ?? new SpriteAttachmentLoader(sprite, attachmentShader, applyPMA);

			if (attachment == null)
				attachment = loader.NewRegionAttachment(null, sprite.name, "");

			skeletonComponent.Skeleton.FindSlot(slot).Attachment = attachment;

			if (!keepLoaderInMemory)
				loader = null;
		}
		public static RegionAttachment ToRegionAttachment (this Sprite sprite, string shaderName = "Spine/Skeleton") {
			var loader = new SpriteAttachmentLoader(sprite, Shader.Find(shaderName));
			var att = loader.NewRegionAttachment(null, sprite.name, "");
			loader = null;
			return att;
		}
        public static RegionAttachment ToRegionAttachment(this UnityEngine.Sprite sprite, Shader shader, bool applyPMA)
        {
            SpriteAttachmentLoader spriteAttachmentLoader = new SpriteAttachmentLoader(sprite, shader, applyPMA);

            return(spriteAttachmentLoader.NewRegionAttachment(null, sprite.name, string.Empty));
        }
Example #8
0
		public static RegionAttachment ToRegionAttachment (this Sprite sprite, Shader shader, bool applyPMA) {
			var loader = new SpriteAttachmentLoader(sprite, shader, applyPMA);
			var att = loader.NewRegionAttachment(null, sprite.name, "");
			loader = null;
			return att;
		}