Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ts][pixi-v7][pixi-v8] Add option to sync attachment visibility to slot object #2731

Closed
davidetan opened this issue Jan 9, 2025 · 1 comment
Assignees

Comments

@davidetan
Copy link
Collaborator

Pixi users have often requested an option to sync attachment visibility with slot objects.
See:

A solution was initially proposed here, but the user eventually agreed to use the afterUpdateWorldTransforms method, as demonstrated below:

const slot = spineboy.skeleton.findSlot("empty");
spineboy.afterUpdateWorldTransforms = () => pixiObject.visible = Boolean(slot.attachment);

Proposal

We should consider modifying the addSlotObject method to include an options object. This would allow for future extensibility while addressing this specific need. The proposed signature is:

addSlotObject(slotRef: number | string | Slot, pixiObject: DisplayObject, options?: { syncToAttachment?: boolean }): void

By default, syncToAttachment would be set to false to avoid breaking changes.

Additionally, it may be necessary to expose a method to modify the options associated with a slot object after its creation.

@davidetan
Copy link
Collaborator Author

Implemented in 2c00d86 for v8 e 6f8ed12 for v7.

The signature is slightly changed to:

addSlotObject (slotRef: number | string | Slot, pixiObject: Container, options?: { followAttachmentTimeline?: boolean }): void

It will be released in 4.2.71 soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant