public RegionAttachment NewRegionAttachment (Skin skin, String name, String path) { AtlasRegion region = atlas.FindRegion(path); if (region == null) throw new Exception("Region not found in atlas: " + path + " (region attachment: " + name + ")"); RegionAttachment attachment = new RegionAttachment(name); attachment.RendererObject = region; attachment.SetUVs(region.u, region.v, region.u2, region.v2, region.rotate); attachment.regionOffsetX = region.offsetX; attachment.regionOffsetY = region.offsetY; attachment.regionWidth = region.width; attachment.regionHeight = region.height; attachment.regionOriginalWidth = region.originalWidth; attachment.regionOriginalHeight = region.originalHeight; return attachment; }
public Attachment NewAttachment(Skin skin, AttachmentType type, String name) { switch (type) { case AttachmentType.region: AtlasRegion region = atlas.FindRegion(name); if (region == null) { throw new Exception("Region not found in atlas: " + name + " (" + type + ")"); } RegionAttachment attachment = new RegionAttachment(name); attachment.RendererObject = region; attachment.SetUVs(region.u, region.v, region.u2, region.v2, region.rotate); attachment.regionOffsetX = region.offsetX; attachment.regionOffsetY = region.offsetY; attachment.regionWidth = region.width; attachment.regionHeight = region.height; attachment.regionOriginalWidth = region.originalWidth; attachment.regionOriginalHeight = region.originalHeight; return(attachment); case AttachmentType.boundingbox: return(new BoundingBoxAttachment(name)); } throw new Exception("Unknown attachment type: " + type); }
/// <return>May be null to not load any attachment.</return> public RegionAttachment NewRegionAttachment(Skin skin, string name, string path) { var attachment = new RegionAttachment(name); var region = mAtlas.FindRegion(name); // if (region == null) throw new Error("Region not found in atlas: " + name); attachment.RendererObject = region; return(attachment); }
void Apply (SkeletonRenderer skeletonRenderer) { atlas = atlasAsset.GetAtlas(); float scale = skeletonRenderer.skeletonDataAsset.scale; var enumerator = attachments.GetEnumerator(); while (enumerator.MoveNext()) { var entry = (SlotRegionPair)enumerator.Current; var slot = skeletonRenderer.skeleton.FindSlot(entry.slot); var region = atlas.FindRegion(entry.region); slot.Attachment = region.ToRegionAttachment(entry.region, scale); } }
public Attachment NewAttachment(AttachmentType type, String name) { switch (type) { case AttachmentType.region: AtlasRegion region = atlas.FindRegion(name); if (region == null) { throw new Exception("Region not found in atlas: " + name + " (" + type + ")"); } RegionAttachment attachment = new RegionAttachment(name); attachment.Region = region; return(attachment); } throw new Exception("Unknown attachment type: " + type); }