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:
authorWillian Padovani Germano <wpgermano@gmail.com>2004-01-23 05:59:54 +0300
committerWillian Padovani Germano <wpgermano@gmail.com>2004-01-23 05:59:54 +0300
commit5d8c7e453746e0114caddb5a5cb11cdac6f5ed3b (patch)
tree93b00e5ca2be30352f69fb7239f25e08d3dec8ae /source/blender/python/api2_2x/Bone.c
parentf237bb28bf8558a360dbfe03a52dfbce863dbdd8 (diff)
BPython:
- local tentative fix for BLI_gethome(), which returns '.blender' appended only on some Windows systems. Created bpymenu_gethome() to check and add '.blender' if needed. - changed name: .Bpymenus to Bpymenus as suggested by GSR - trivial additions: Object module: added methods .set/getSize Armature/Bone module: bone.set???() methods now accept both n floats or a list of n floats: fff or (fff). All these additions were requested by user Carlos Lopez (Klopes). - New doc: for module Registry.
Diffstat (limited to 'source/blender/python/api2_2x/Bone.c')
-rw-r--r--source/blender/python/api2_2x/Bone.c73
1 files changed, 51 insertions, 22 deletions
diff --git a/source/blender/python/api2_2x/Bone.c b/source/blender/python/api2_2x/Bone.c
index c0dade51140..94ce51cf275 100644
--- a/source/blender/python/api2_2x/Bone.c
+++ b/source/blender/python/api2_2x/Bone.c
@@ -455,14 +455,20 @@ PyObject *Bone_setRoll(BPy_Bone *self, PyObject *args)
static PyObject *Bone_setHead(BPy_Bone *self, PyObject *args)
{
float f1,f2,f3;
+ int status;
if (!self->bone) (EXPP_ReturnPyObjError (PyExc_RuntimeError,
"couldn't get attribute from a NULL bone"));
-
- if (!PyArg_ParseTuple(args, "fff", &f1,&f2,&f3))
+
+ if (PyObject_Length (args) == 3)
+ status = PyArg_ParseTuple (args, "fff", &f1, &f2, &f3);
+ else
+ status = PyArg_ParseTuple (args, "(fff)", &f1, &f2, &f3);
+
+ if (!status)
return (EXPP_ReturnPyObjError (PyExc_AttributeError,
- "expected 3 float arguments"));
-
+ "expected 3 (or a list of 3) float arguments"));
+
self->bone->head[0] = f1;
self->bone->head[1] = f2;
self->bone->head[2] = f3;
@@ -475,14 +481,20 @@ static PyObject *Bone_setHead(BPy_Bone *self, PyObject *args)
static PyObject *Bone_setTail(BPy_Bone *self, PyObject *args)
{
float f1,f2,f3;
+ int status;
if (!self->bone) (EXPP_ReturnPyObjError (PyExc_RuntimeError,
"couldn't get attribute from a NULL bone"));
-
- if (!PyArg_ParseTuple(args, "fff", &f1,&f2,&f3))
+
+ if (PyObject_Length (args) == 3)
+ status = PyArg_ParseTuple (args, "fff", &f1, &f2, &f3);
+ else
+ status = PyArg_ParseTuple (args, "(fff)", &f1, &f2, &f3);
+
+ if (!status)
return (EXPP_ReturnPyObjError (PyExc_AttributeError,
- "expected 3 float arguments"));
-
+ "expected 3 (or a list of 3) float arguments"));
+
self->bone->tail[0] = f1;
self->bone->tail[1] = f2;
self->bone->tail[2] = f3;
@@ -495,14 +507,20 @@ static PyObject *Bone_setTail(BPy_Bone *self, PyObject *args)
static PyObject *Bone_setLoc(BPy_Bone *self, PyObject *args)
{
float f1,f2,f3;
+ int status;
if (!self->bone) (EXPP_ReturnPyObjError (PyExc_RuntimeError,
"couldn't get attribute from a NULL bone"));
-
- if (!PyArg_ParseTuple(args, "fff", &f1,&f2,&f3))
+
+ if (PyObject_Length (args) == 3)
+ status = PyArg_ParseTuple (args, "fff", &f1, &f2, &f3);
+ else
+ status = PyArg_ParseTuple (args, "(fff)", &f1, &f2, &f3);
+
+ if (!status)
return (EXPP_ReturnPyObjError (PyExc_AttributeError,
- "expected 3 float arguments"));
-
+ "expected 3 (or a list of 3) float arguments"));
+
self->bone->loc[0] = f1;
self->bone->loc[1] = f2;
self->bone->loc[2] = f3;
@@ -515,14 +533,20 @@ static PyObject *Bone_setLoc(BPy_Bone *self, PyObject *args)
static PyObject *Bone_setSize(BPy_Bone *self, PyObject *args)
{
float f1,f2,f3;
+ int status;
if (!self->bone) (EXPP_ReturnPyObjError (PyExc_RuntimeError,
"couldn't get attribute from a NULL bone"));
-
- if (!PyArg_ParseTuple(args, "fff", &f1,&f2,&f3))
+
+ if (PyObject_Length (args) == 3)
+ status = PyArg_ParseTuple (args, "fff", &f1, &f2, &f3);
+ else
+ status = PyArg_ParseTuple (args, "(fff)", &f1, &f2, &f3);
+
+ if (!status)
return (EXPP_ReturnPyObjError (PyExc_AttributeError,
- "expected 3 float arguments"));
-
+ "expected 3 (or a list of 3) float arguments"));
+
self->bone->size[0] = f1;
self->bone->size[1] = f2;
self->bone->size[2] = f3;
@@ -535,14 +559,20 @@ static PyObject *Bone_setSize(BPy_Bone *self, PyObject *args)
static PyObject *Bone_setQuat(BPy_Bone *self, PyObject *args)
{
float f1,f2,f3,f4;
+ int status;
if (!self->bone) (EXPP_ReturnPyObjError (PyExc_RuntimeError,
"couldn't get attribute from a NULL bone"));
-
- if (!PyArg_ParseTuple(args, "ffff", &f1,&f2,&f3,&f4))
+
+ if (PyObject_Length (args) == 4)
+ status = PyArg_ParseTuple (args, "ffff", &f1, &f2, &f3, &f4);
+ else
+ status = PyArg_ParseTuple (args, "(ffff)", &f1, &f2, &f3, &f4);
+
+ if (!status)
return (EXPP_ReturnPyObjError (PyExc_AttributeError,
- "expected 4 float arguments"));
-
+ "expected 4 (or a list of 4) float arguments"));
+
self->bone->quat[0] = f1;
self->bone->quat[1] = f2;
self->bone->quat[2] = f3;
@@ -552,7 +582,6 @@ static PyObject *Bone_setQuat(BPy_Bone *self, PyObject *args)
return Py_None;
}
-
/*****************************************************************************/
/* Function: Bone_dealloc */
/* Description: This is a callback function for the BPy_Bone type. It is */
@@ -707,7 +736,7 @@ int Bone_CheckPyObject (PyObject *py_obj)
/*****************************************************************************/
struct Bone* Bone_FromPyObject (PyObject *py_obj)
{
- BPy_Bone * blen_obj;
+ BPy_Bone * blen_obj;
blen_obj = (BPy_Bone*)py_obj;
return (blen_obj->bone);