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>2009-12-02 18:37:07 +0300
committerCampbell Barton <ideasman42@gmail.com>2009-12-02 18:37:07 +0300
commitce36cdac0490593efb6740ea00884f610846d01a (patch)
tree835a65d9570cb5f132bc785fbba041754aaa15bd /source/blender/makesrna/intern/rna_main_api.c
parent863668a145477299be704de33ce282ad94bcba37 (diff)
- bpy.data.add_armature()
- rigify testnig function, creates all example metarigs, processes and generates graphs for before and after.
Diffstat (limited to 'source/blender/makesrna/intern/rna_main_api.c')
-rw-r--r--source/blender/makesrna/intern/rna_main_api.c39
1 files changed, 35 insertions, 4 deletions
diff --git a/source/blender/makesrna/intern/rna_main_api.c b/source/blender/makesrna/intern/rna_main_api.c
index 379cf75d450..70dab957fb9 100644
--- a/source/blender/makesrna/intern/rna_main_api.c
+++ b/source/blender/makesrna/intern/rna_main_api.c
@@ -33,21 +33,22 @@
#include "RNA_types.h"
#include "RNA_enum_types.h"
-#include "DNA_object_types.h"
-#include "DNA_material_types.h"
-#include "DNA_mesh_types.h"
-
#ifdef RNA_RUNTIME
#include "BKE_main.h"
#include "BKE_mesh.h"
+#include "BKE_armature.h"
#include "BKE_library.h"
#include "BKE_object.h"
#include "BKE_material.h"
#include "BKE_image.h"
#include "BKE_texture.h"
+#include "DNA_armature_types.h"
#include "DNA_lamp_types.h"
+#include "DNA_material_types.h"
+#include "DNA_mesh_types.h"
+#include "DNA_object_types.h"
static Mesh *rna_Main_add_mesh(Main *main, char *name)
{
@@ -66,6 +67,23 @@ static void rna_Main_remove_mesh(Main *main, ReportList *reports, Mesh *me)
/* XXX python now has invalid pointer? */
}
+static void rna_Main_remove_armature(Main *main, ReportList *reports, bArmature *arm)
+{
+ if(arm->id.us == 0)
+ free_libblock(&main->armature, arm);
+ else
+ BKE_report(reports, RPT_ERROR, "Armature must have zero users to be removed.");
+
+ /* XXX python now has invalid pointer? */
+}
+
+static bArmature *rna_Main_add_armature(Main *main, char *name)
+{
+ bArmature *arm= add_armature(name);
+ arm->id.us--;
+ return arm;
+}
+
static Lamp *rna_Main_add_lamp(Main *main, char *name)
{
Lamp *la= add_lamp(name);
@@ -164,6 +182,19 @@ void RNA_api_main(StructRNA *srna)
parm= RNA_def_pointer(func, "mesh", "Mesh", "", "Mesh to remove.");
RNA_def_property_flag(parm, PROP_REQUIRED);
+ func= RNA_def_function(srna, "add_armature", "rna_Main_add_armature");
+ RNA_def_function_ui_description(func, "Add a new armature.");
+ parm= RNA_def_string(func, "name", "Armature", 0, "", "New name for the datablock.");
+ RNA_def_property_flag(parm, PROP_REQUIRED);
+ parm= RNA_def_pointer(func, "armature", "Armature", "", "New armature.");
+ RNA_def_function_return(func, parm);
+
+ func= RNA_def_function(srna, "remove_armature", "rna_Main_remove_armature");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ RNA_def_function_ui_description(func, "Remove an armature if it has zero users.");
+ parm= RNA_def_pointer(func, "armature", "Armature", "", "Armature to remove.");
+ RNA_def_property_flag(parm, PROP_REQUIRED);
+
func= RNA_def_function(srna, "add_lamp", "rna_Main_add_lamp");
RNA_def_function_ui_description(func, "Add a new lamp.");
parm= RNA_def_string(func, "name", "Lamp", 0, "", "New name for the datablock.");