mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-02-04 14:24:53 +08:00
[ios] Provide the ability to convert an Attachment into a BoundingBoxAttachment. (#2671)
Co-authored-by: liqiang <liqiangbj01@kanyun.com>
This commit is contained in:
parent
a815fc40d8
commit
648170f325
@ -2424,6 +2424,16 @@ spine_attachment spine_attachment_copy(spine_attachment attachment) {
|
|||||||
return (spine_attachment) _attachment->copy();
|
return (spine_attachment) _attachment->copy();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
spine_bounding_box_attachment spine_attachment_cast_to_bounding_box_attachment(spine_attachment attachment) {
|
||||||
|
if (attachment == nullptr) return nullptr;
|
||||||
|
Attachment *_attachment = (Attachment *)attachment;
|
||||||
|
if (_attachment->getRTTI().isExactly(BoundingBoxAttachment::rtti)) {
|
||||||
|
BoundingBoxAttachment *boundingBox = static_cast<BoundingBoxAttachment *>(_attachment);
|
||||||
|
return (spine_bounding_box_attachment)boundingBox;
|
||||||
|
}
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
void spine_attachment_dispose(spine_attachment attachment) {
|
void spine_attachment_dispose(spine_attachment attachment) {
|
||||||
if (attachment == nullptr) return;
|
if (attachment == nullptr) return;
|
||||||
Attachment *_attachment = (Attachment *) attachment;
|
Attachment *_attachment = (Attachment *) attachment;
|
||||||
|
|||||||
@ -630,6 +630,8 @@ SPINE_CPP_LITE_EXPORT const utf8 *spine_attachment_get_name(spine_attachment att
|
|||||||
SPINE_CPP_LITE_EXPORT spine_attachment_type spine_attachment_get_type(spine_attachment attachment);
|
SPINE_CPP_LITE_EXPORT spine_attachment_type spine_attachment_get_type(spine_attachment attachment);
|
||||||
// @ignore
|
// @ignore
|
||||||
SPINE_CPP_LITE_EXPORT spine_attachment spine_attachment_copy(spine_attachment attachment);
|
SPINE_CPP_LITE_EXPORT spine_attachment spine_attachment_copy(spine_attachment attachment);
|
||||||
|
// @optional
|
||||||
|
SPINE_CPP_LITE_EXPORT spine_bounding_box_attachment spine_attachment_cast_to_bounding_box_attachment(spine_attachment attachment);
|
||||||
SPINE_CPP_LITE_EXPORT void spine_attachment_dispose(spine_attachment attachment);
|
SPINE_CPP_LITE_EXPORT void spine_attachment_dispose(spine_attachment attachment);
|
||||||
|
|
||||||
SPINE_CPP_LITE_EXPORT spine_vector spine_point_attachment_compute_world_position(spine_point_attachment attachment, spine_bone bone);
|
SPINE_CPP_LITE_EXPORT spine_vector spine_point_attachment_compute_world_position(spine_point_attachment attachment, spine_bone bone);
|
||||||
|
|||||||
@ -2553,6 +2553,11 @@ public final class Attachment: NSObject {
|
|||||||
return spine_attachment_get_type(wrappee)
|
return spine_attachment_get_type(wrappee)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@discardableResult
|
||||||
|
public func castToBoundingBoxAttachment() -> BoundingBoxAttachment? {
|
||||||
|
return spine_attachment_cast_to_bounding_box_attachment(wrappee).flatMap { .init($0) }
|
||||||
|
}
|
||||||
|
|
||||||
public func dispose() {
|
public func dispose() {
|
||||||
if disposed { return }
|
if disposed { return }
|
||||||
disposed = true
|
disposed = true
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user