diff options
author | Campbell Barton <ideasman42@gmail.com> | 2013-03-21 18:12:04 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2013-03-21 18:12:04 +0400 |
commit | 401fdf5065bf8180833cf789ac4e5bfbc6ce1a8c (patch) | |
tree | 8f08cdd7e0f6c07e456756fd0bd1b3e1aa282801 /source/blender/makesrna/intern/rna_object_api.c | |
parent | fa0e2603f507f14fb341f1e6b0a8d30d798cf274 (diff) |
py api: add Object.update_from_editmode(),
Useful for python exporters to avoid toggling editmode on export, moved into own function ED_object_editmode_load(obedit).
Diffstat (limited to 'source/blender/makesrna/intern/rna_object_api.c')
-rw-r--r-- | source/blender/makesrna/intern/rna_object_api.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/source/blender/makesrna/intern/rna_object_api.c b/source/blender/makesrna/intern/rna_object_api.c index 2b7df1ca317..e7e8821a2f9 100644 --- a/source/blender/makesrna/intern/rna_object_api.c +++ b/source/blender/makesrna/intern/rna_object_api.c @@ -391,6 +391,14 @@ void rna_Object_dm_info(struct Object *ob, int type, char *result) } } } + +static int rna_Object_update_from_editmode(Object *ob) +{ + if (ob->mode & OB_MODE_EDIT) { + return ED_object_editmode_load(ob); + } + return false; +} #endif /* NDEBUG */ #else /* RNA_RUNTIME */ @@ -567,6 +575,11 @@ void RNA_api_object(StructRNA *srna) RNA_def_property_flag(parm, PROP_THICK_WRAP); /* needed for string return value */ RNA_def_function_output(func, parm); #endif /* NDEBUG */ + + func = RNA_def_function(srna, "update_from_editmode", "rna_Object_update_from_editmode"); + RNA_def_function_ui_description(func, "Load the objects edit-mode data intp the object data"); + parm = RNA_def_boolean(func, "result", 0, "", "Success"); + RNA_def_function_return(func, parm); } |