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-09-11 22:09:58 +0400
committerArystanbek Dyussenov <arystan.d@gmail.com>2009-09-11 22:09:58 +0400
commit3b2ad838e8c628a468ee19ac77fb1336dd6072cf (patch)
treebc1e229f3055e4114086775122c7a47facb42679 /source/blender/makesrna/intern/rna_scene_api.c
parent7220792f187f91a2ef3eb0c930a13674b2a8a80a (diff)
parent15d77f17a40398a63f95e16607deb81257c02698 (diff)
Merge with -r 22620:23107.
Next: update scripts and merge in 2.5.
Diffstat (limited to 'source/blender/makesrna/intern/rna_scene_api.c')
-rw-r--r--source/blender/makesrna/intern/rna_scene_api.c50
1 files changed, 47 insertions, 3 deletions
diff --git a/source/blender/makesrna/intern/rna_scene_api.c b/source/blender/makesrna/intern/rna_scene_api.c
index 076fe38ed2f..fa21257be29 100644
--- a/source/blender/makesrna/intern/rna_scene_api.c
+++ b/source/blender/makesrna/intern/rna_scene_api.c
@@ -1,5 +1,5 @@
/**
- * $Id: rna_object_api.c 21115 2009-06-23 19:17:59Z kazanbas $
+ * $Id$
*
* ***** BEGIN GPL LICENSE BLOCK *****
*
@@ -21,7 +21,7 @@
* All rights reserved.
*
*
- * Contributor(s): Blender Foundation
+ * Contributor(s): Arystanbek Dyussenov, Joshua Leung
*
* ***** END GPL LICENSE BLOCK *****
*/
@@ -30,13 +30,16 @@
#include <stdio.h>
#include "RNA_define.h"
+#include "RNA_enum_types.h"
#include "RNA_types.h"
+#include "DNA_anim_types.h"
#include "DNA_object_types.h"
#include "DNA_scene_types.h"
#ifdef RNA_RUNTIME
+#include "BKE_animsys.h"
#include "BKE_scene.h"
#include "BKE_depsgraph.h"
@@ -81,6 +84,33 @@ static void rna_Scene_set_frame(Scene *sce, bContext *C, int frame)
WM_event_add_notifier(C, NC_SCENE|ND_FRAME, sce);
}
+static KeyingSet *rna_Scene_add_keying_set(Scene *sce, ReportList *reports,
+ char name[], int absolute, int insertkey_needed, int insertkey_visual)
+{
+ KeyingSet *ks= NULL;
+ short flag=0, keyingflag=0;
+
+ /* validate flags */
+ if (absolute)
+ flag |= KEYINGSET_ABSOLUTE;
+ if (insertkey_needed)
+ keyingflag |= INSERTKEY_NEEDED;
+ if (insertkey_visual)
+ keyingflag |= INSERTKEY_MATRIX;
+
+ /* call the API func, and set the active keyingset index */
+ ks= BKE_keyingset_add(&sce->keyingsets, name, flag, keyingflag);
+
+ if (ks) {
+ sce->active_keyingset= BLI_countlist(&sce->keyingsets);
+ return ks;
+ }
+ else {
+ BKE_report(reports, RPT_ERROR, "Keying Set could not be added.");
+ return NULL;
+ }
+}
+
#else
void RNA_api_scene(StructRNA *srna)
@@ -105,7 +135,21 @@ void RNA_api_scene(StructRNA *srna)
RNA_def_function_ui_description(func, "Set scene frame updating all objects immediately.");
parm= RNA_def_int(func, "frame", 0, MINAFRAME, MAXFRAME, "", "Frame number to set.", MINAFRAME, MAXFRAME);
RNA_def_property_flag(parm, PROP_REQUIRED);
+
+ /* Add Keying Set */
+ func= RNA_def_function(srna, "add_keying_set", "rna_Scene_add_keying_set");
+ RNA_def_function_ui_description(func, "Add a new Keying Set to Scene.");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS);
+ /* returns the new KeyingSet */
+ parm= RNA_def_pointer(func, "keyingset", "KeyingSet", "", "Newly created Keying Set.");
+ RNA_def_function_return(func, parm);
+ /* name */
+ RNA_def_string(func, "name", "KeyingSet", 64, "Name", "Name of Keying Set");
+ /* flags */
+ RNA_def_boolean(func, "absolute", 1, "Absolute", "Keying Set defines specific paths/settings to be keyframed (i.e. is not reliant on context info)");
+ /* keying flags */
+ RNA_def_boolean(func, "insertkey_needed", 0, "Insert Keyframes - Only Needed", "Only insert keyframes where they're needed in the relevant F-Curves.");
+ RNA_def_boolean(func, "insertkey_visual", 0, "Insert Keyframes - Visual", "Insert keyframes based on 'visual transforms'.");
}
#endif
-