[Bf-blender-cvs] [aae8e211006] master: BMesh Py API: Expose color alpha

Campbell Barton noreply at git.blender.org
Sun Nov 12 05:39:53 CET 2017


Commit: aae8e211006a1d9099397727b48201b865504750
Author: Campbell Barton
Date:   Sun Nov 12 15:48:24 2017 +1100
Branches: master
https://developer.blender.org/rBaae8e211006a1d9099397727b48201b865504750

BMesh Py API: Expose color alpha

===================================================================

M	source/blender/python/bmesh/bmesh_py_types_meshdata.c

===================================================================

diff --git a/source/blender/python/bmesh/bmesh_py_types_meshdata.c b/source/blender/python/bmesh/bmesh_py_types_meshdata.c
index b01d3f89d4e..7984f625d96 100644
--- a/source/blender/python/bmesh/bmesh_py_types_meshdata.c
+++ b/source/blender/python/bmesh/bmesh_py_types_meshdata.c
@@ -370,12 +370,12 @@ PyObject *BPy_BMVertSkin_CreatePyObject(struct MVertSkin *mvertskin)
 
 static void mloopcol_to_float(const MLoopCol *mloopcol, float r_col[3])
 {
-	rgb_uchar_to_float(r_col, (const unsigned char *)&mloopcol->r);
+	rgba_uchar_to_float(r_col, (const unsigned char *)&mloopcol->r);
 }
 
 static void mloopcol_from_float(MLoopCol *mloopcol, const float col[3])
 {
-	rgb_float_to_uchar((unsigned char *)&mloopcol->r, col);
+	rgba_float_to_uchar((unsigned char *)&mloopcol->r, col);
 }
 
 static unsigned char mathutils_bmloopcol_cb_index = -1;
@@ -436,8 +436,8 @@ static void bm_init_types_bmloopcol(void)
 
 int BPy_BMLoopColor_AssignPyObject(struct MLoopCol *mloopcol, PyObject *value)
 {
-	float tvec[3];
-	if (mathutils_array_parse(tvec, 3, 3, value, "BMLoopCol") != -1) {
+	float tvec[4];
+	if (mathutils_array_parse(tvec, 4, 4, value, "BMLoopCol") != -1) {
 		mloopcol_from_float(mloopcol, tvec);
 		return 0;
 	}
@@ -450,7 +450,7 @@ PyObject *BPy_BMLoopColor_CreatePyObject(struct MLoopCol *data)
 {
 	PyObject *color_capsule;
 	color_capsule = PyCapsule_New(data, NULL, NULL);
-	return Color_CreatePyObject_cb(color_capsule, mathutils_bmloopcol_cb_index, 0);
+	return Vector_CreatePyObject_cb(color_capsule, 4, mathutils_bmloopcol_cb_index, 0);
 }
 
 #undef MLOOPCOL_FROM_CAPSULE



More information about the Bf-blender-cvs mailing list