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:
authorArystanbek Dyussenov <arystan.d@gmail.com>2009-08-08 15:33:34 +0400
committerArystanbek Dyussenov <arystan.d@gmail.com>2009-08-08 15:33:34 +0400
commit8fa528cef8faa4f5ce2f6ff4f6e2f5b08709d08e (patch)
treedcac07d93b680a1971347b1b236c254412d03baf /source/blender/makesrna/intern/rna_object_api.c
parent3c3f8c3018d369ef72a05c93ed1171f887704c05 (diff)
Added Object.find_armature() to find armature connected to object. Previously this was BPyObject.getObjectArmature()
Diffstat (limited to 'source/blender/makesrna/intern/rna_object_api.c')
-rw-r--r--source/blender/makesrna/intern/rna_object_api.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/source/blender/makesrna/intern/rna_object_api.c b/source/blender/makesrna/intern/rna_object_api.c
index 881c2bdf549..8192801d9fb 100644
--- a/source/blender/makesrna/intern/rna_object_api.c
+++ b/source/blender/makesrna/intern/rna_object_api.c
@@ -63,6 +63,7 @@
#include "DNA_scene_types.h"
#include "DNA_meshdata_types.h"
#include "DNA_curve_types.h"
+#include "DNA_modifier_types.h"
#include "MEM_guardedalloc.h"
@@ -309,6 +310,29 @@ static void rna_Object_make_display_list(Object *ob, bContext *C)
DAG_object_flush_update(sce, ob, OB_RECALC_DATA);
}
+static Object *rna_Object_find_armature(Object *ob)
+{
+ Object *ob_arm = NULL;
+
+ if (ob->type != OB_MESH) return NULL;
+
+ if (ob->parent && ob->partype == PARSKEL && ob->parent->type == OB_ARMATURE) {
+ ob_arm = ob->parent;
+ }
+ else {
+ ModifierData *mod = (ModifierData*)ob->modifiers.first;
+ while (mod) {
+ if (mod->type == eModifierType_Armature) {
+ ob_arm = ((ArmatureModifierData*)mod)->object;
+ }
+
+ mod = mod->next;
+ }
+ }
+
+ return ob_arm;
+}
+
/*
static void rna_Mesh_assign_verts_to_group(Object *ob, bDeformGroup *group, int *indices, int totindex, float weight, int assignmode)
{
@@ -409,6 +433,12 @@ void RNA_api_object(StructRNA *srna)
parm= RNA_def_enum(func, "type", assign_mode_items, 0, "", "Vertex assign mode.");
RNA_def_property_flag(parm, PROP_REQUIRED);
+ /* Armature */
+ func= RNA_def_function(srna, "find_armature", "rna_Object_find_armature");
+ RNA_def_function_ui_description(func, "Find armature influencing this object as a parent or via a modifier.");
+ parm= RNA_def_pointer(func, "ob_arm", "Object", "", "Armature object influencing this object or NULL.");
+ RNA_def_function_return(func, parm);
+
/* DAG */
func= RNA_def_function(srna, "make_display_list", "rna_Object_make_display_list");
RNA_def_function_ui_description(func, "Update object's display data."); /* XXX describe better */