mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-03 10:22:45 -04:00
use python_repr() to make linmath pickleable
This commit is contained in:
parent
9c24c092dd
commit
09878b64b0
@ -288,6 +288,29 @@ write(ostream &out, int indent_level) const {
|
||||
<< "\n";
|
||||
}
|
||||
|
||||
#ifdef HAVE_PYTHON
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: LMatrix3::python_repr
|
||||
// Access: Published
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE_LINMATH void FLOATNAME(LMatrix3)::
|
||||
python_repr(ostream &out, const string &class_name) const {
|
||||
out << class_name << "("
|
||||
<< MAYBE_ZERO(_m.m._00) << ", "
|
||||
<< MAYBE_ZERO(_m.m._01) << ", "
|
||||
<< MAYBE_ZERO(_m.m._02) << ", "
|
||||
|
||||
<< MAYBE_ZERO(_m.m._10) << ", "
|
||||
<< MAYBE_ZERO(_m.m._11) << ", "
|
||||
<< MAYBE_ZERO(_m.m._12) << ", "
|
||||
|
||||
<< MAYBE_ZERO(_m.m._20) << ", "
|
||||
<< MAYBE_ZERO(_m.m._21) << ", "
|
||||
<< MAYBE_ZERO(_m.m._22) << ")";
|
||||
}
|
||||
#endif // HAVE_PYTHON
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: LMatrix3::generate_hash
|
||||
// Access: Public
|
||||
|
@ -188,6 +188,9 @@ PUBLISHED:
|
||||
|
||||
void output(ostream &out) const;
|
||||
void write(ostream &out, int indent_level = 0) const;
|
||||
#ifdef HAVE_PYTHON
|
||||
void python_repr(ostream &out, const string &class_name) const;
|
||||
#endif
|
||||
|
||||
public:
|
||||
INLINE_LINMATH void generate_hash(ChecksumHashGenerator &hashgen) const;
|
||||
|
@ -196,6 +196,37 @@ output(ostream &out) const {
|
||||
<< " ]";
|
||||
}
|
||||
|
||||
#ifdef HAVE_PYTHON
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: LMatrix4::python_repr
|
||||
// Access: Published
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE_LINMATH void FLOATNAME(LMatrix4)::
|
||||
python_repr(ostream &out, const string &class_name) const {
|
||||
out << class_name << "("
|
||||
<< MAYBE_ZERO(_m.m._00) << ", "
|
||||
<< MAYBE_ZERO(_m.m._01) << ", "
|
||||
<< MAYBE_ZERO(_m.m._02) << ", "
|
||||
<< MAYBE_ZERO(_m.m._03) << ", "
|
||||
|
||||
<< MAYBE_ZERO(_m.m._10) << ", "
|
||||
<< MAYBE_ZERO(_m.m._11) << ", "
|
||||
<< MAYBE_ZERO(_m.m._12) << ", "
|
||||
<< MAYBE_ZERO(_m.m._13) << ", "
|
||||
|
||||
<< MAYBE_ZERO(_m.m._20) << ", "
|
||||
<< MAYBE_ZERO(_m.m._21) << ", "
|
||||
<< MAYBE_ZERO(_m.m._22) << ", "
|
||||
<< MAYBE_ZERO(_m.m._23) << ", "
|
||||
|
||||
<< MAYBE_ZERO(_m.m._30) << ", "
|
||||
<< MAYBE_ZERO(_m.m._31) << ", "
|
||||
<< MAYBE_ZERO(_m.m._32) << ", "
|
||||
<< MAYBE_ZERO(_m.m._33) << ")";
|
||||
}
|
||||
#endif // HAVE_PYTHON
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: LMatrix4::write
|
||||
// Access: Public
|
||||
|
@ -181,6 +181,9 @@ PUBLISHED:
|
||||
|
||||
void output(ostream &out) const;
|
||||
void write(ostream &out, int indent_level = 0) const;
|
||||
#ifdef HAVE_PYTHON
|
||||
void python_repr(ostream &out, const string &class_name) const;
|
||||
#endif
|
||||
|
||||
public:
|
||||
INLINE_LINMATH void generate_hash(ChecksumHashGenerator &hashgen) const;
|
||||
|
@ -188,3 +188,15 @@ INLINE_LINMATH FLOATNAME(LPoint2) FLOATNAME(LPoint2)::
|
||||
operator / (FLOATTYPE scalar) const {
|
||||
return FLOATNAME(LPoint2)(FLOATNAME(LVecBase2)::operator / (scalar));
|
||||
}
|
||||
|
||||
#ifdef HAVE_PYTHON
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: LPoint2::python_repr
|
||||
// Access: Published
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE_LINMATH void FLOATNAME(LPoint2)::
|
||||
python_repr(ostream &out, const string &class_name) const {
|
||||
FLOATNAME(LVecBase2)::python_repr(out, class_name);
|
||||
}
|
||||
#endif // HAVE_PYTHON
|
||||
|
@ -51,6 +51,10 @@ PUBLISHED:
|
||||
INLINE_LINMATH FLOATNAME(LPoint2) operator * (FLOATTYPE scalar) const;
|
||||
INLINE_LINMATH FLOATNAME(LPoint2) operator / (FLOATTYPE scalar) const;
|
||||
|
||||
#ifdef HAVE_PYTHON
|
||||
INLINE_LINMATH void python_repr(ostream &out, const string &class_name) const;
|
||||
#endif
|
||||
|
||||
public:
|
||||
static TypeHandle get_class_type() {
|
||||
return _type_handle;
|
||||
|
@ -236,3 +236,14 @@ rfu(FLOATTYPE right_v, FLOATTYPE fwd_v, FLOATTYPE up_v,
|
||||
FLOATNAME(LVector3)::rfu(right_v, fwd_v, up_v, cs);
|
||||
}
|
||||
|
||||
#ifdef HAVE_PYTHON
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: LPoint3::python_repr
|
||||
// Access: Published
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE_LINMATH void FLOATNAME(LPoint3)::
|
||||
python_repr(ostream &out, const string &class_name) const {
|
||||
FLOATNAME(LVecBase3)::python_repr(out, class_name);
|
||||
}
|
||||
#endif // HAVE_PYTHON
|
||||
|
@ -65,6 +65,11 @@ PUBLISHED:
|
||||
FLOATTYPE fwd,
|
||||
FLOATTYPE up,
|
||||
CoordinateSystem cs = CS_default);
|
||||
|
||||
#ifdef HAVE_PYTHON
|
||||
INLINE_LINMATH void python_repr(ostream &out, const string &class_name) const;
|
||||
#endif
|
||||
|
||||
public:
|
||||
static TypeHandle get_class_type() {
|
||||
return _type_handle;
|
||||
|
@ -208,3 +208,15 @@ INLINE_LINMATH FLOATNAME(LPoint4) FLOATNAME(LPoint4)::
|
||||
operator / (FLOATTYPE scalar) const {
|
||||
return FLOATNAME(LPoint4)(FLOATNAME(LVecBase4)::operator / (scalar));
|
||||
}
|
||||
|
||||
#ifdef HAVE_PYTHON
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: LPoint4::python_repr
|
||||
// Access: Published
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE_LINMATH void FLOATNAME(LPoint4)::
|
||||
python_repr(ostream &out, const string &class_name) const {
|
||||
FLOATNAME(LVecBase4)::python_repr(out, class_name);
|
||||
}
|
||||
#endif // HAVE_PYTHON
|
||||
|
@ -52,6 +52,10 @@ PUBLISHED:
|
||||
INLINE_LINMATH FLOATNAME(LPoint4) operator * (FLOATTYPE scalar) const;
|
||||
INLINE_LINMATH FLOATNAME(LPoint4) operator / (FLOATTYPE scalar) const;
|
||||
|
||||
#ifdef HAVE_PYTHON
|
||||
INLINE_LINMATH void python_repr(ostream &out, const string &class_name) const;
|
||||
#endif
|
||||
|
||||
public:
|
||||
static TypeHandle get_class_type() {
|
||||
return _type_handle;
|
||||
|
@ -592,6 +592,20 @@ output(ostream &out) const {
|
||||
<< MAYBE_ZERO(_v.v._1);
|
||||
}
|
||||
|
||||
#ifdef HAVE_PYTHON
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: LVecBase2::python_repr
|
||||
// Access: Published
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE_LINMATH void FLOATNAME(LVecBase2)::
|
||||
python_repr(ostream &out, const string &class_name) const {
|
||||
out << class_name << "("
|
||||
<< MAYBE_ZERO(_v.v._0) << ", "
|
||||
<< MAYBE_ZERO(_v.v._1) << ")";
|
||||
}
|
||||
#endif // HAVE_PYTHON
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: LVecBase2::generate_hash
|
||||
// Access: Public
|
||||
|
@ -112,6 +112,9 @@ PUBLISHED:
|
||||
INLINE_LINMATH bool almost_equal(const FLOATNAME(LVecBase2) &other) const;
|
||||
|
||||
INLINE_LINMATH void output(ostream &out) const;
|
||||
#ifdef HAVE_PYTHON
|
||||
INLINE_LINMATH void python_repr(ostream &out, const string &class_name) const;
|
||||
#endif
|
||||
|
||||
public:
|
||||
INLINE_LINMATH void generate_hash(ChecksumHashGenerator &hashgen) const;
|
||||
|
@ -764,6 +764,21 @@ output(ostream &out) const {
|
||||
<< MAYBE_ZERO(_v.v._2);
|
||||
}
|
||||
|
||||
#ifdef HAVE_PYTHON
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: LVecBase3::python_repr
|
||||
// Access: Published
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE_LINMATH void FLOATNAME(LVecBase3)::
|
||||
python_repr(ostream &out, const string &class_name) const {
|
||||
out << class_name << "("
|
||||
<< MAYBE_ZERO(_v.v._0) << ", "
|
||||
<< MAYBE_ZERO(_v.v._1) << ", "
|
||||
<< MAYBE_ZERO(_v.v._2) << ")";
|
||||
}
|
||||
#endif // HAVE_PYTHON
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: LVecBase3::generate_hash
|
||||
|
@ -122,6 +122,9 @@ PUBLISHED:
|
||||
INLINE_LINMATH bool almost_equal(const FLOATNAME(LVecBase3) &other) const;
|
||||
|
||||
INLINE_LINMATH void output(ostream &out) const;
|
||||
#ifdef HAVE_PYTHON
|
||||
INLINE_LINMATH void python_repr(ostream &out, const string &class_name) const;
|
||||
#endif
|
||||
|
||||
public:
|
||||
INLINE_LINMATH void generate_hash(ChecksumHashGenerator &hashgen) const;
|
||||
|
@ -714,6 +714,22 @@ output(ostream &out) const {
|
||||
<< MAYBE_ZERO(_v.v._3);
|
||||
}
|
||||
|
||||
#ifdef HAVE_PYTHON
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: LVecBase4::python_repr
|
||||
// Access: Published
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE_LINMATH void FLOATNAME(LVecBase4)::
|
||||
python_repr(ostream &out, const string &class_name) const {
|
||||
out << class_name << "("
|
||||
<< MAYBE_ZERO(_v.v._0) << ", "
|
||||
<< MAYBE_ZERO(_v.v._1) << ", "
|
||||
<< MAYBE_ZERO(_v.v._2) << ", "
|
||||
<< MAYBE_ZERO(_v.v._3) << ")";
|
||||
}
|
||||
#endif // HAVE_PYTHON
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: LVecBase4::generate_hash
|
||||
// Access: Public
|
||||
|
@ -117,6 +117,9 @@ PUBLISHED:
|
||||
INLINE_LINMATH bool almost_equal(const FLOATNAME(LVecBase4) &other) const;
|
||||
|
||||
INLINE_LINMATH void output(ostream &out) const;
|
||||
#ifdef HAVE_PYTHON
|
||||
INLINE_LINMATH void python_repr(ostream &out, const string &class_name) const;
|
||||
#endif
|
||||
|
||||
public:
|
||||
INLINE_LINMATH void generate_hash(ChecksumHashGenerator &hashgen) const;
|
||||
|
@ -221,3 +221,15 @@ operator / (FLOATTYPE scalar) const {
|
||||
FLOATTYPE recip_scalar = 1.0f/scalar;
|
||||
return FLOATNAME(LVector2)(FLOATNAME(LVecBase2)::operator * (recip_scalar));
|
||||
}
|
||||
|
||||
#ifdef HAVE_PYTHON
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: LVector2::python_repr
|
||||
// Access: Published
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE_LINMATH void FLOATNAME(LVector2)::
|
||||
python_repr(ostream &out, const string &class_name) const {
|
||||
FLOATNAME(LVecBase2)::python_repr(out, class_name);
|
||||
}
|
||||
#endif // HAVE_PYTHON
|
||||
|
@ -47,6 +47,10 @@ PUBLISHED:
|
||||
INLINE_LINMATH FLOATNAME(LVector2) operator * (FLOATTYPE scalar) const;
|
||||
INLINE_LINMATH FLOATNAME(LVector2) operator / (FLOATTYPE scalar) const;
|
||||
|
||||
#ifdef HAVE_PYTHON
|
||||
INLINE_LINMATH void python_repr(ostream &out, const string &class_name) const;
|
||||
#endif
|
||||
|
||||
public:
|
||||
static TypeHandle get_class_type() {
|
||||
return _type_handle;
|
||||
|
@ -383,3 +383,14 @@ rfu(FLOATTYPE right_v, FLOATTYPE fwd_v, FLOATTYPE up_v,
|
||||
return FLOATNAME(LVector3)(right_v,vy,vz);
|
||||
}
|
||||
|
||||
#ifdef HAVE_PYTHON
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: LVector3::python_repr
|
||||
// Access: Published
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE_LINMATH void FLOATNAME(LVector3)::
|
||||
python_repr(ostream &out, const string &class_name) const {
|
||||
FLOATNAME(LVecBase3)::python_repr(out, class_name);
|
||||
}
|
||||
#endif // HAVE_PYTHON
|
||||
|
@ -69,6 +69,10 @@ PUBLISHED:
|
||||
INLINE_LINMATH static FLOATNAME(LVector3) rfu(FLOATTYPE right,
|
||||
FLOATTYPE fwd,FLOATTYPE up, CoordinateSystem cs = CS_default);
|
||||
|
||||
#ifdef HAVE_PYTHON
|
||||
INLINE_LINMATH void python_repr(ostream &out, const string &class_name) const;
|
||||
#endif
|
||||
|
||||
public:
|
||||
static TypeHandle get_class_type() {
|
||||
return _type_handle;
|
||||
|
@ -242,3 +242,15 @@ operator / (FLOATTYPE scalar) const {
|
||||
FLOATTYPE recip_scalar = 1.0f/scalar;
|
||||
return FLOATNAME(LVector4)(FLOATNAME(LVecBase4)::operator * (recip_scalar));
|
||||
}
|
||||
|
||||
#ifdef HAVE_PYTHON
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: LVector4::python_repr
|
||||
// Access: Published
|
||||
// Description:
|
||||
////////////////////////////////////////////////////////////////////
|
||||
INLINE_LINMATH void FLOATNAME(LVector4)::
|
||||
python_repr(ostream &out, const string &class_name) const {
|
||||
FLOATNAME(LVecBase4)::python_repr(out, class_name);
|
||||
}
|
||||
#endif // HAVE_PYTHON
|
||||
|
@ -49,6 +49,10 @@ PUBLISHED:
|
||||
INLINE_LINMATH FLOATNAME(LVector4) operator * (FLOATTYPE scalar) const;
|
||||
INLINE_LINMATH FLOATNAME(LVector4) operator / (FLOATTYPE scalar) const;
|
||||
|
||||
#ifdef HAVE_PYTHON
|
||||
INLINE_LINMATH void python_repr(ostream &out, const string &class_name) const;
|
||||
#endif
|
||||
|
||||
public:
|
||||
static TypeHandle get_class_type() {
|
||||
return _type_handle;
|
||||
|
Loading…
x
Reference in New Issue
Block a user