[cpp] 4.3 porting WIP

This commit is contained in:
Mario Zechner 2025-06-11 12:51:03 +02:00
parent 878403d271
commit 2e369a8130
2 changed files with 42 additions and 89 deletions

View File

@ -31,95 +31,67 @@
#define Spine_SlotData_h #define Spine_SlotData_h
#include <spine/BlendMode.h> #include <spine/BlendMode.h>
#include <spine/SpineObject.h> #include <spine/PosedData.h>
#include <spine/SpineString.h> #include <spine/SpineString.h>
#include <spine/Color.h> #include <spine/RTTI.h>
namespace spine { namespace spine {
class BoneData; class BoneData;
class SlotPose;
/// Stores the setup pose for a Slot.
class SP_API SlotData : public PosedData<SlotPose> {
RTTI_DECL
class SP_API SlotData : public SpineObject {
friend class SkeletonBinary; friend class SkeletonBinary;
friend class SkeletonJson; friend class SkeletonJson;
friend class AttachmentTimeline; friend class AttachmentTimeline;
friend class RGBATimeline; friend class RGBATimeline;
friend class RGBTimeline; friend class RGBTimeline;
friend class AlphaTimeline; friend class AlphaTimeline;
friend class RGBA2Timeline; friend class RGBA2Timeline;
friend class RGB2Timeline; friend class RGB2Timeline;
friend class DeformTimeline; friend class DeformTimeline;
friend class DrawOrderTimeline; friend class DrawOrderTimeline;
friend class EventTimeline; friend class EventTimeline;
friend class IkConstraintTimeline; friend class IkConstraintTimeline;
friend class PathConstraintMixTimeline; friend class PathConstraintMixTimeline;
friend class PathConstraintPositionTimeline; friend class PathConstraintPositionTimeline;
friend class PathConstraintSpacingTimeline; friend class PathConstraintSpacingTimeline;
friend class ScaleTimeline; friend class ScaleTimeline;
friend class ShearTimeline; friend class ShearTimeline;
friend class TransformConstraintTimeline; friend class TransformConstraintTimeline;
friend class TranslateTimeline; friend class TranslateTimeline;
friend class TwoColorTimeline; friend class TwoColorTimeline;
public: public:
SlotData(int index, const String &name, BoneData &boneData); SlotData(int index, const String& name, BoneData& boneData);
/// The index of the slot in Skeleton::getSlots().
int getIndex(); int getIndex();
const String &getName(); /// The bone this slot belongs to.
BoneData& getBoneData();
BoneData &getBoneData(); void setAttachmentName(const String& attachmentName);
Color &getColor(); /// The name of the attachment that is visible for this slot in the setup pose, or empty if no attachment is visible.
const String& getAttachmentName();
Color &getDarkColor();
bool hasDarkColor();
void setHasDarkColor(bool inValue);
/// May be empty.
const String &getAttachmentName();
void setAttachmentName(const String &inValue);
/// The blend mode for drawing the slot's attachment.
BlendMode getBlendMode(); BlendMode getBlendMode();
void setBlendMode(BlendMode blendMode);
void setBlendMode(BlendMode inValue); /// False if the slot was hidden in Spine and nonessential data was exported. Does not affect runtime rendering.
bool isVisible();
bool isVisible(); void setVisible(bool visible);
void setVisible(bool inValue);
private: private:
const int _index; const int _index;
String _name; BoneData& _boneData;
BoneData &_boneData;
Color _color;
Color _darkColor;
bool _hasDarkColor;
String _attachmentName; String _attachmentName;
BlendMode _blendMode; BlendMode _blendMode;
bool _visible; bool _visible;
}; };
} }

View File

@ -28,72 +28,53 @@
*****************************************************************************/ *****************************************************************************/
#include <spine/SlotData.h> #include <spine/SlotData.h>
#include <spine/SlotPose.h>
#include <spine/BoneData.h>
#include <assert.h> #include <assert.h>
using namespace spine; using namespace spine;
SlotData::SlotData(int index, const String &name, BoneData &boneData) : _index(index), RTTI_IMPL_NOPARENT(SlotData)
_name(name),
_boneData(boneData), SlotData::SlotData(int index, const String& name, BoneData& boneData) :
_color(1, 1, 1, 1), PosedData<SlotPose>(name, new (__FILE__, __LINE__) SlotPose()),
_darkColor(0, 0, 0, 0), _index(index),
_hasDarkColor(false), _boneData(boneData),
_attachmentName(), _attachmentName(),
_blendMode(BlendMode_Normal), _blendMode(BlendMode_Normal),
_visible(true) { _visible(true) {
assert(_index >= 0); assert(index >= 0);
assert(_name.length() > 0);
} }
int SlotData::getIndex() { int SlotData::getIndex() {
return _index; return _index;
} }
const String &SlotData::getName() { BoneData& SlotData::getBoneData() {
return _name;
}
BoneData &SlotData::getBoneData() {
return _boneData; return _boneData;
} }
Color &SlotData::getColor() { void SlotData::setAttachmentName(const String& attachmentName) {
return _color; _attachmentName = attachmentName;
} }
Color &SlotData::getDarkColor() { const String& SlotData::getAttachmentName() {
return _darkColor;
}
bool SlotData::hasDarkColor() {
return _hasDarkColor;
}
void SlotData::setHasDarkColor(bool inValue) {
_hasDarkColor = inValue;
}
const String &SlotData::getAttachmentName() {
return _attachmentName; return _attachmentName;
} }
void SlotData::setAttachmentName(const String &inValue) {
_attachmentName = inValue;
}
BlendMode SlotData::getBlendMode() { BlendMode SlotData::getBlendMode() {
return _blendMode; return _blendMode;
} }
void SlotData::setBlendMode(BlendMode inValue) { void SlotData::setBlendMode(BlendMode blendMode) {
_blendMode = inValue; _blendMode = blendMode;
} }
bool SlotData::isVisible() { bool SlotData::isVisible() {
return _visible; return _visible;
} }
void SlotData::setVisible(bool inValue) { void SlotData::setVisible(bool visible) {
this->_visible = inValue; _visible = visible;
} }