Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYimingWu <xp8110@outlook.com>2019-11-27 05:18:09 +0300
committerYimingWu <xp8110@outlook.com>2019-11-27 05:18:09 +0300
commit5aa70ac589819f5fad037b179241d68067845b77 (patch)
treeb03a0d6c23ea657d250e599cdb237725d472e63d /source/blender/python
parentc2fbf7668df77b99110932ffc11893697d3d6d3d (diff)
parent7af560438966c5b3f7a0203fefd8bbad80d201c9 (diff)
Merge remote-tracking branch 'origin/master' into temp-lanpr-review
Diffstat (limited to 'source/blender/python')
-rw-r--r--source/blender/python/bmesh/bmesh_py_types.c2
-rw-r--r--source/blender/python/bmesh/bmesh_py_types_meshdata.c18
-rw-r--r--source/blender/python/intern/bpy_rna.c3
-rw-r--r--source/blender/python/mathutils/mathutils_Quaternion.c36
4 files changed, 49 insertions, 10 deletions
diff --git a/source/blender/python/bmesh/bmesh_py_types.c b/source/blender/python/bmesh/bmesh_py_types.c
index 89d15edb0bd..af595de2ee4 100644
--- a/source/blender/python/bmesh/bmesh_py_types.c
+++ b/source/blender/python/bmesh/bmesh_py_types.c
@@ -1543,7 +1543,7 @@ static PyObject *bpy_bm_elem_copy_from(BPy_BMElem *self, BPy_BMElem *value)
}
if (value->ele != self->ele) {
- BM_elem_attrs_copy(value->bm, self->bm, value->ele, self->ele);
+ BM_elem_attrs_copy_ex(value->bm, self->bm, value->ele, self->ele, 0xff, CD_MASK_BM_ELEM_PYPTR);
}
Py_RETURN_NONE;
diff --git a/source/blender/python/bmesh/bmesh_py_types_meshdata.c b/source/blender/python/bmesh/bmesh_py_types_meshdata.c
index 2e15c1d9ce0..0fd6d74c324 100644
--- a/source/blender/python/bmesh/bmesh_py_types_meshdata.c
+++ b/source/blender/python/bmesh/bmesh_py_types_meshdata.c
@@ -384,19 +384,21 @@ PyObject *BPy_BMLoopColor_CreatePyObject(struct MLoopCol *data)
* This is python type wraps a deform vert as a python dictionary,
* hiding the #MDeformWeight on access, since the mapping is very close, eg:
*
- * C:
- * weight = defvert_find_weight(dv, group_nr);
- * defvert_remove_group(dv, dw)
+ * \code{.c}
+ * weight = defvert_find_weight(dv, group_nr);
+ * defvert_remove_group(dv, dw)
+ * \endcode
*
- * Py:
- * weight = dv[group_nr]
- * del dv[group_nr]
+ * \code{.py}
+ * weight = dv[group_nr]
+ * del dv[group_nr]
+ * \endcode
*
- * \note: there is nothing BMesh specific here,
+ * \note There is nothing BMesh specific here,
* its only that BMesh is the only part of blender that uses a hand written api like this.
* This type could eventually be used to access lattice weights.
*
- * \note: Many of blender-api's dict-like-wrappers act like ordered dicts,
+ * \note Many of blender-api's dict-like-wrappers act like ordered dicts,
* This is intentionally _not_ ordered, the weights can be in any order and it won't matter,
* the order should not be used in the api in any meaningful way (as with a python dict)
* only expose as mapping, not a sequence.
diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c
index 4c14f8ca8d3..6fb2b2fd7ee 100644
--- a/source/blender/python/intern/bpy_rna.c
+++ b/source/blender/python/intern/bpy_rna.c
@@ -2596,7 +2596,8 @@ static PyObject *pyrna_prop_collection_subscript_slice(BPy_PropertyRNA *self,
return list;
}
-/** TODO - dimensions
+/**
+ * TODO - dimensions
* \note Could also use pyrna_prop_array_to_py_index(self, count) in a loop, but it's much slower
* since at the moment it reads (and even allocates) the entire array for each index.
*/
diff --git a/source/blender/python/mathutils/mathutils_Quaternion.c b/source/blender/python/mathutils/mathutils_Quaternion.c
index c64d6b09387..d7cccd5c352 100644
--- a/source/blender/python/mathutils/mathutils_Quaternion.c
+++ b/source/blender/python/mathutils/mathutils_Quaternion.c
@@ -404,6 +404,38 @@ static PyObject *Quaternion_rotate(QuaternionObject *self, PyObject *value)
Py_RETURN_NONE;
}
+PyDoc_STRVAR(Quaternion_make_compatible_doc,
+ ".. method:: make_compatible(other)\n"
+ "\n"
+ " Make this quaternion compatible with another,\n"
+ " so interpolating between them works as intended.\n");
+static PyObject *Quaternion_make_compatible(QuaternionObject *self, PyObject *value)
+{
+ float quat[QUAT_SIZE];
+ float tquat[QUAT_SIZE];
+
+ if (BaseMath_ReadCallback_ForWrite(self) == -1) {
+ return NULL;
+ }
+
+ if (mathutils_array_parse(tquat,
+ QUAT_SIZE,
+ QUAT_SIZE,
+ value,
+ "Quaternion.make_compatible(other), invalid 'other' arg") == -1) {
+ return NULL;
+ }
+
+ /* Can only operate on unit length quaternions. */
+ const float quat_len = normalize_qt_qt(quat, self->quat);
+ quat_to_compatible_quat(self->quat, quat, tquat);
+ mul_qt_fl(self->quat, quat_len);
+
+ (void)BaseMath_WriteCallback(self);
+
+ Py_RETURN_NONE;
+}
+
/* ----------------------------Quaternion.normalize()---------------- */
/* Normalize the quaternion. This may change the angle as well as the
* rotation axis, as all of (w, x, y, z) are scaled. */
@@ -1430,6 +1462,10 @@ static struct PyMethodDef Quaternion_methods[] = {
Quaternion_rotation_difference_doc},
{"slerp", (PyCFunction)Quaternion_slerp, METH_VARARGS, Quaternion_slerp_doc},
{"rotate", (PyCFunction)Quaternion_rotate, METH_O, Quaternion_rotate_doc},
+ {"make_compatible",
+ (PyCFunction)Quaternion_make_compatible,
+ METH_O,
+ Quaternion_make_compatible_doc},
/* base-math methods */
{"freeze", (PyCFunction)BaseMathObject_freeze, METH_NOARGS, BaseMathObject_freeze_doc},