[コスプレクリエーター]スピンオフ動画の正確な外枠を取得します.
// TS
//
GetSpineWorldRect(spine: sp.Skeleton): cc.Rect {
let rect = cc.rect();
let hasData = false;
if (spine) {
if (spine['_skeleton']) {
let offset = {
x: 0,
y: 0,
set: function (x: number, y: number) {
this.x = x;
this.y = y;
}
}
let size = {
x: 0,
y: 0,
set: function (x: number, y: number) {
this.x = x;
this.y = y;
}
}
let tmp = new Array();
spine['_skeleton'].getBounds(offset, size, tmp);
rect.x = offset.x;
rect.y = offset.y;
rect.width = size.x;
rect.height = size.y;
hasData = true;
}
}
if (!hasData || (rect.x == 0 && rect.y == 0 && rect.width == 0 && rect.height == 0)) {
rect.x = -50;
rect.y = -50;
rect.width = 100;
rect.height = 100;
}
return rect;
}
エンジンコードとブレークポイントのデータ構造を参照してください.参照
https://blog.csdn.net/Pan_mouren/articale/detail/93500860