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-28 21:03:04 +0300
committerCampbell Barton <ideasman42@gmail.com>2009-12-28 21:03:04 +0300
commit8177f343a0303a66e36f2b78566045c0dea0b406 (patch)
treeb1b63d0aac8df1cfb349895fceeff1047cecc43e /source/blender/makesrna/intern/rna_object_api.c
parent32656ad4ba6af89fcbd8247bc219e55be802ebdc (diff)
- object.add_shape_key(name="Key", from_mix=True)
- ensure new shape key names are unique - Transfer ShapeKey now can have its settings changes (redo operator)
Diffstat (limited to 'source/blender/makesrna/intern/rna_object_api.c')
-rw-r--r--source/blender/makesrna/intern/rna_object_api.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/source/blender/makesrna/intern/rna_object_api.c b/source/blender/makesrna/intern/rna_object_api.c
index 63b4549f7c9..481e92d1ac9 100644
--- a/source/blender/makesrna/intern/rna_object_api.c
+++ b/source/blender/makesrna/intern/rna_object_api.c
@@ -309,6 +309,21 @@ static Object *rna_Object_find_armature(Object *ob)
return ob_arm;
}
+static KeyBlock *rna_Object_add_shape_key(Object *ob, bContext *C, ReportList *reports, char *name, int from_mix)
+{
+ Scene *scene= CTX_data_scene(C);
+ KeyBlock *kb= NULL;
+
+ if((kb=object_insert_shape_key(scene, ob, name, from_mix))) {
+ WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob);
+ }
+ else {
+ BKE_reportf(reports, RPT_ERROR, "Object \"%s\"does not support shapes.", ob->id.name+2);
+ }
+
+ return kb;
+}
+
int rna_Object_is_visible(Object *ob, bContext *C)
{
return !(ob->restrictflag & OB_RESTRICT_VIEW) && ob->lay & CTX_data_scene(C)->lay;
@@ -414,6 +429,15 @@ void RNA_api_object(StructRNA *srna)
parm= RNA_def_pointer(func, "ob_arm", "Object", "", "Armature object influencing this object or NULL.");
RNA_def_function_return(func, parm);
+ /* Shape key */
+ func= RNA_def_function(srna, "add_shape_key", "rna_Object_add_shape_key");
+ RNA_def_function_ui_description(func, "Add shape key to an object.");
+ RNA_def_function_flag(func, FUNC_USE_CONTEXT|FUNC_USE_REPORTS);
+ parm= RNA_def_string(func, "name", "Key", 0, "", "Unique name for the new keylock."); /* optional */
+ parm= RNA_def_boolean(func, "from_mix", 1, "", "Create new shape from existing mix of shapes.");
+ parm= RNA_def_pointer(func, "key", "ShapeKey", "", "New shape keyblock.");
+ 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 */