コード例 #1
0
ファイル: mathutils_Color.c プロジェクト: OldBrunet/BGERTPS
/* subtraction in-place: obj -= obj */
static PyObject *Color_isub(PyObject *v1, PyObject *v2)
{
	ColorObject *color1= NULL, *color2= NULL;

	if (!ColorObject_Check(v1) || !ColorObject_Check(v2)) {
		PyErr_SetString(PyExc_TypeError,
		                "Color subtraction: "
		                "arguments not valid for this operation");
		return NULL;
	}
	color1 = (ColorObject*)v1;
	color2 = (ColorObject*)v2;

	if(BaseMath_ReadCallback(color1) == -1 || BaseMath_ReadCallback(color2) == -1)
		return NULL;

	sub_vn_vn(color1->col, color2->col, COLOR_SIZE);

	(void)BaseMath_WriteCallback(color1);
	Py_INCREF(v1);
	return v1;
}
コード例 #2
0
ファイル: mathutils_Color.c プロジェクト: mik0001/Blender
/* subtraction in-place: obj -= obj */
static PyObject *Color_isub(PyObject *v1, PyObject *v2)
{
	ColorObject *color1= NULL, *color2= NULL;

	if (!ColorObject_Check(v1) || !ColorObject_Check(v2)) {
		PyErr_Format(PyExc_TypeError,
		             "Color subtraction: (%s -= %s) "
		             "invalid type for this operation",
		             Py_TYPE(v1)->tp_name, Py_TYPE(v2)->tp_name);
		return NULL;
	}
	color1 = (ColorObject*)v1;
	color2 = (ColorObject*)v2;

	if (BaseMath_ReadCallback(color1) == -1 || BaseMath_ReadCallback(color2) == -1)
		return NULL;

	sub_vn_vn(color1->col, color2->col, COLOR_SIZE);

	(void)BaseMath_WriteCallback(color1);
	Py_INCREF(v1);
	return v1;
}