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>2010-02-22 15:25:58 +0300
committerCampbell Barton <ideasman42@gmail.com>2010-02-22 15:25:58 +0300
commit4ef1fd1078bbdb8ecb905fc9cd3db60c378408b0 (patch)
tree408bbfb210658cae5a9075791d59dc4c7a4623a9 /source/blender
parentdd03793f4edd455c09a1a2273e5e991dd3bd702b (diff)
game engine support for recording animation back & some other minor changes.
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/editors/space_view3d/view3d_view.c4
-rw-r--r--source/blender/makesdna/DNA_scene_types.h1
-rw-r--r--source/blender/makesrna/intern/rna_scene.c25
-rw-r--r--source/blender/python/intern/bpy_rna.c77
-rw-r--r--source/blender/windowmanager/intern/wm_event_system.c1
5 files changed, 70 insertions, 38 deletions
diff --git a/source/blender/editors/space_view3d/view3d_view.c b/source/blender/editors/space_view3d/view3d_view.c
index 59051c7a894..09d8d79f8f5 100644
--- a/source/blender/editors/space_view3d/view3d_view.c
+++ b/source/blender/editors/space_view3d/view3d_view.c
@@ -1690,8 +1690,8 @@ void game_set_commmandline_options(GameData *gm)
test= (gm->flag & GAME_ENABLE_ALL_FRAMES);
SYS_WriteCommandLineInt(syshandle, "fixedtime", test);
-// a= (G.fileflags & G_FILE_GAME_TO_IPO);
-// SYS_WriteCommandLineInt(syshandle, "game2ipo", a);
+ test= (gm->flag & GAME_ENABLE_ANIMATION_RECORD);
+ SYS_WriteCommandLineInt(syshandle, "animation_record", test);
test= (gm->flag & GAME_IGNORE_DEPRECATION_WARNINGS);
SYS_WriteCommandLineInt(syshandle, "ignore_deprecation_warnings", test);
diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h
index 2bea683b392..928637a0047 100644
--- a/source/blender/makesdna/DNA_scene_types.h
+++ b/source/blender/makesdna/DNA_scene_types.h
@@ -487,6 +487,7 @@ typedef struct GameData {
#define GAME_GLSL_NO_NODES (1 << 10)
#define GAME_GLSL_NO_EXTRA_TEX (1 << 11)
#define GAME_IGNORE_DEPRECATION_WARNINGS (1 << 12)
+#define GAME_ENABLE_ANIMATION_RECORD (1 << 13)
/* GameData.matmode */
#define GAME_MAT_TEXFACE 0
diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c
index c947edd7d6d..d0745e8d159 100644
--- a/source/blender/makesrna/intern/rna_scene.c
+++ b/source/blender/makesrna/intern/rna_scene.c
@@ -1501,51 +1501,46 @@ static void rna_def_scene_game_data(BlenderRNA *brna)
prop= RNA_def_property(srna, "use_occlusion_culling", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "mode", (1 << 5)); //XXX mode hardcoded // WO_DBVT_CULLING
RNA_def_property_ui_text(prop, "DBVT culling", "Use optimized Bullet DBVT tree for view frustrum and occlusion culling");
- RNA_def_property_update(prop, NC_SCENE, NULL);
// not used // deprecated !!!!!!!!!!!!!
prop= RNA_def_property(srna, "activity_culling", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "mode", (1 << 3)); //XXX mode hardcoded
RNA_def_property_ui_text(prop, "Activity Culling", "Activity culling is enabled");
- RNA_def_property_update(prop, NC_SCENE, NULL);
// not used // deprecated !!!!!!!!!!!!!
prop= RNA_def_property(srna, "activity_culling_box_radius", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "activityBoxRadius");
RNA_def_property_range(prop, 0.0, 1000.0);
RNA_def_property_ui_text(prop, "box radius", "Radius of the activity bubble, in Manhattan length. Objects outside the box are activity-culled");
- RNA_def_property_update(prop, NC_SCENE, NULL);
/* booleans */
- prop= RNA_def_property(srna, "all_frames", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", GAME_ENABLE_ALL_FRAMES);
- RNA_def_property_ui_text(prop, "All Frames", "Render as many frames as possible, rather than respecting framerate");
- RNA_def_property_update(prop, NC_SCENE, NULL);
-
prop= RNA_def_property(srna, "show_debug_properties", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", GAME_SHOW_DEBUG_PROPS);
RNA_def_property_ui_text(prop, "Show Debug Properties", "Show properties marked for debugging while the game runs");
- RNA_def_property_update(prop, NC_SCENE, NULL);
prop= RNA_def_property(srna, "show_framerate_profile", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", GAME_SHOW_FRAMERATE);
RNA_def_property_ui_text(prop, "Show Framerate and Profile", "Show framerate and profiling information while the game runs");
- RNA_def_property_update(prop, NC_SCENE, NULL);
prop= RNA_def_property(srna, "show_physics_visualization", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", GAME_SHOW_PHYSICS);
RNA_def_property_ui_text(prop, "Show Physics Visualization", "Show a visualization of physics bounds and interactions");
- RNA_def_property_update(prop, NC_SCENE, NULL);
- prop= RNA_def_property(srna, "display_lists", PROP_BOOLEAN, PROP_NONE);
+ prop= RNA_def_property(srna, "use_frame_rate", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", GAME_ENABLE_ALL_FRAMES);
+ RNA_def_property_ui_text(prop, "Use Frame Rate", "Respect the frame rate rather then rendering as many frames as possible");
+
+ prop= RNA_def_property(srna, "use_display_lists", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", GAME_DISPLAY_LISTS);
RNA_def_property_ui_text(prop, "Display Lists", "Use display lists to speed up rendering by keeping geometry on the GPU");
- RNA_def_property_update(prop, NC_SCENE, NULL);
- prop= RNA_def_property(srna, "deprecation_warnings", PROP_BOOLEAN, PROP_NONE);
+ prop= RNA_def_property(srna, "use_deprecation_warnings", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", GAME_IGNORE_DEPRECATION_WARNINGS);
RNA_def_property_ui_text(prop, "Deprecation Warnings", "Print warnings when using deprecated features in the python API");
- RNA_def_property_update(prop, NC_SCENE, NULL);
+
+ prop= RNA_def_property(srna, "use_animation_record", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", GAME_ENABLE_ANIMATION_RECORD);
+ RNA_def_property_ui_text(prop, "Record Animation", "Record animation to fcurves");
/* materials */
prop= RNA_def_property(srna, "material_mode", PROP_ENUM, PROP_NONE);
diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c
index 29c262d5815..e9290b69265 100644
--- a/source/blender/python/intern/bpy_rna.c
+++ b/source/blender/python/intern/bpy_rna.c
@@ -1639,47 +1639,81 @@ static PyObject *pyrna_struct_values(BPy_PropertyRNA *self)
return BPy_Wrap_GetValues(self->ptr.id.data, group);
}
-static PyObject *pyrna_struct_keyframe_insert(BPy_StructRNA *self, PyObject *args)
+/* internal use for insert and delete */
+int pyrna_struct_keyframe_parse(PointerRNA *ptr, PyObject *args, char *error_prefix,
+ char **path_full, int *index, float *cfra) /* return values */
{
- char *path, *path_full;
- int index= -1; /* default to all */
- float cfra = CTX_data_scene(BPy_GetContext())->r.cfra;
+ char *path;
PropertyRNA *prop;
- PyObject *result;
- if (!PyArg_ParseTuple(args, "s|if:keyframe_insert", &path, &index, &cfra))
- return NULL;
+ if (!PyArg_ParseTuple(args, "s|if", &path, &index, &cfra)) {
+ PyErr_Format(PyExc_TypeError, "%.200s: expected a string and optionally an int and float arguments", error_prefix);
+ return -1;
+ }
- if (self->ptr.data==NULL) {
- PyErr_Format( PyExc_TypeError, "keyframe_insert, this struct has no data, cant be animated", path);
- return NULL;
+ if (ptr->data==NULL) {
+ PyErr_Format(PyExc_TypeError, "%.200s: this struct has no data, can't be animated", error_prefix);
+ return -1;
}
- prop = RNA_struct_find_property(&self->ptr, path);
+ prop = RNA_struct_find_property(ptr, path);
if (prop==NULL) {
- PyErr_Format( PyExc_TypeError, "keyframe_insert, property \"%s\" not found", path);
- return NULL;
+ PyErr_Format( PyExc_TypeError, "%.200s: property \"%s\" not found", error_prefix, path);
+ return -1;
}
- if (!RNA_property_animateable(&self->ptr, prop)) {
- PyErr_Format( PyExc_TypeError, "keyframe_insert, property \"%s\" not animatable", path);
- return NULL;
+ if (!RNA_property_animateable(ptr, prop)) {
+ PyErr_Format( PyExc_TypeError, "%.200s: property \"%s\" not animatable", error_prefix, path);
+ return -1;
}
- path_full= RNA_path_from_ID_to_property(&self->ptr, prop);
+ *path_full= RNA_path_from_ID_to_property(ptr, prop);
- if (path_full==NULL) {
- PyErr_Format( PyExc_TypeError, "keyframe_insert, could not make path to \"%s\"", path);
- return NULL;
+ if (*path_full==NULL) {
+ PyErr_Format( PyExc_TypeError, "%.200s: could not make path to \"%s\"", error_prefix, path);
+ return -1;
}
- result= PyBool_FromLong( insert_keyframe((ID *)self->ptr.id.data, NULL, NULL, path_full, index, cfra, 0));
+ if(*cfra==FLT_MAX)
+ *cfra= CTX_data_scene(BPy_GetContext())->r.cfra;
+
+ return 0; /* success */
+}
+
+static PyObject *pyrna_struct_keyframe_insert(BPy_StructRNA *self, PyObject *args)
+{
+ PyObject *result;
+ /* args, pyrna_struct_keyframe_parse handles these */
+ char *path_full= NULL;
+ int index= -1;
+ float cfra= FLT_MAX;
+
+ if(pyrna_struct_keyframe_parse(&self->ptr, args, "keyframe_insert", &path_full, &index, &cfra) == -1)
+ return NULL;
+
+ result= PyBool_FromLong(insert_keyframe((ID *)self->ptr.id.data, NULL, NULL, path_full, index, cfra, 0));
MEM_freeN(path_full);
return result;
}
+static PyObject *pyrna_struct_keyframe_delete(BPy_StructRNA *self, PyObject *args)
+{
+ PyObject *result;
+ /* args, pyrna_struct_keyframe_parse handles these */
+ char *path_full= NULL;
+ int index= -1;
+ float cfra= FLT_MAX;
+
+ if(pyrna_struct_keyframe_parse(&self->ptr, args, "keyframe_delete", &path_full, &index, &cfra) == -1)
+ return NULL;
+
+ result= PyBool_FromLong(delete_keyframe((ID *)self->ptr.id.data, NULL, NULL, path_full, index, cfra, 0));
+ MEM_freeN(path_full);
+
+ return result;
+}
static PyObject *pyrna_struct_driver_add(BPy_StructRNA *self, PyObject *args)
{
@@ -2659,6 +2693,7 @@ static struct PyMethodDef pyrna_struct_methods[] = {
/* maybe this become and ID function */
{"keyframe_insert", (PyCFunction)pyrna_struct_keyframe_insert, METH_VARARGS, NULL},
+// {"keyframe_delete", (PyCFunction)pyrna_struct_keyframe_delete, METH_VARARGS, NULL}, // WIP
{"driver_add", (PyCFunction)pyrna_struct_driver_add, METH_VARARGS, NULL},
{"is_property_set", (PyCFunction)pyrna_struct_is_property_set, METH_VARARGS, NULL},
{"is_property_hidden", (PyCFunction)pyrna_struct_is_property_hidden, METH_VARARGS, NULL},
diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c
index 92780d1b973..b72bc02aca6 100644
--- a/source/blender/windowmanager/intern/wm_event_system.c
+++ b/source/blender/windowmanager/intern/wm_event_system.c
@@ -28,6 +28,7 @@
#include <stdlib.h>
#include <string.h>
+#include <math.h>
#include "DNA_listBase.h"
#include "DNA_screen_types.h"