diff --git a/spine-cpp/spine-cpp/include/spine/ConstraintData.h b/spine-cpp/spine-cpp/include/spine/ConstraintData.h index ab51f3298..9b9e51e5e 100644 --- a/spine-cpp/spine-cpp/include/spine/ConstraintData.h +++ b/spine-cpp/spine-cpp/include/spine/ConstraintData.h @@ -30,40 +30,32 @@ #ifndef Spine_Constraint_h #define Spine_Constraint_h -#include +#include #include +#include namespace spine { - /// The interface for all constraints. - class SP_API ConstraintData : public SpineObject { - - friend class SkeletonBinary; - - RTTI_DECL + class Constraint; + class Skeleton; + /// Base class for all constraint data. + template + class SP_API ConstraintData : public PosedData

{ public: - ConstraintData(const String &name); - + ConstraintData(const String &name, P* setup); virtual ~ConstraintData(); - /// The IK constraint's name, which is unique within the skeleton. - const String &getName(); - - /// The ordinal for the order a skeleton's constraints will be applied. - size_t getOrder(); - - void setOrder(size_t inValue); - - /// Whether the constraint is only active for a specific skin. - bool isSkinRequired(); - - void setSkinRequired(bool inValue); - - private: - const String _name; - size_t _order; - bool _skinRequired; + /// Creates a constraint instance. + virtual T* create(Skeleton& skeleton) = 0; }; + + template + ConstraintData::ConstraintData(const String &name, P* setup) : PosedData

(name, setup) { + } + + template + ConstraintData::~ConstraintData() { + } } #endif /* Spine_Constraint_h */ diff --git a/spine-cpp/spine-cpp/src/spine/ConstraintData.cpp b/spine-cpp/spine-cpp/src/spine/ConstraintData.cpp index 1be0b2ddc..9c44db0ff 100644 --- a/spine-cpp/spine-cpp/src/spine/ConstraintData.cpp +++ b/spine-cpp/spine-cpp/src/spine/ConstraintData.cpp @@ -29,32 +29,5 @@ #include -using namespace spine; - -RTTI_IMPL_NOPARENT(ConstraintData) - -ConstraintData::ConstraintData(const String &name) : _name(name), _order(0), _skinRequired(false) { -} - -ConstraintData::~ConstraintData() { -} - -const String &ConstraintData::getName() { - return _name; -} - -size_t ConstraintData::getOrder() { - return _order; -} - -void ConstraintData::setOrder(size_t inValue) { - _order = inValue; -} - -bool ConstraintData::isSkinRequired() { - return _skinRequired; -} - -void ConstraintData::setSkinRequired(bool inValue) { - _skinRequired = inValue; -} +// Template class - implementation is in the header file +using namespace spine; \ No newline at end of file