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:
authorCampbell Barton <ideasman42@gmail.com>2006-08-17 11:14:29 +0400
committerCampbell Barton <ideasman42@gmail.com>2006-08-17 11:14:29 +0400
commit314fbb4ff5195455d32f9c9c7794e53f7d7014be (patch)
treef4527b6507a0e0a96b789e7da152e50cb45e8267 /source/blender/python/api2_2x/Armature.c
parentb3e431baabe1b597324bf6c98cdac26c2e8da429 (diff)
Added Armature.New()
Diffstat (limited to 'source/blender/python/api2_2x/Armature.c')
-rw-r--r--source/blender/python/api2_2x/Armature.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/source/blender/python/api2_2x/Armature.c b/source/blender/python/api2_2x/Armature.c
index ff18c755956..e7cb301b64d 100644
--- a/source/blender/python/api2_2x/Armature.c
+++ b/source/blender/python/api2_2x/Armature.c
@@ -1248,14 +1248,46 @@ AttributeError:
sModuleBadArgs, "Get(): ", "- Expects (optional) string sequence");
}
+
+//----------------Blender.Armature.New()
+static PyObject *M_Armature_New(PyObject * self, PyObject * args)
+{
+ char *name = "Armature";
+ struct bArmature *armature;
+ BPy_Armature *obj;
+ char buf[21];
+
+ if( !PyArg_ParseTuple( args, "|s", &name ) )
+ return EXPP_ReturnPyObjError( PyExc_TypeError,
+ "expected nothing or a string as argument" );
+
+ armature= add_armature();
+ armature->id.us = 0;
+ obj = PyArmature_FromArmature(armature); //*new*
+
+ if( !obj )
+ return EXPP_ReturnPyObjError( PyExc_RuntimeError,
+ "PyObject_New() failed" );
+
+ PyOS_snprintf( buf, sizeof( buf ), "%s", name );
+ rename_id( &armature->id, buf );
+
+ obj->armature = armature;
+ return (PyObject *)obj;
+}
+
+
//-------------------MODULE METHODS DEFINITION-----------------------------
static char M_Armature_Get_doc[] = "(name) - return the armature with the name 'name', \
returns None if not found.\n If 'name' is not specified, it returns a list of all \
armatures in the\ncurrent scene.";
+static char M_Armature_New_doc[] = "(name) - return a new armature object.";
+
struct PyMethodDef M_Armature_methods[] = {
{"Get", M_Armature_Get, METH_VARARGS, M_Armature_Get_doc},
+ {"New", M_Armature_New, METH_VARARGS, M_Armature_New_doc},
{NULL, NULL, 0, NULL}
};
//------------------VISIBLE PROTOTYPE IMPLEMENTATION-----------------------