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:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>2008-11-21 22:14:38 +0300
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2008-11-21 22:14:38 +0300
commitc6da2a59d88a75d00890de5ae1d79408e7f9f906 (patch)
tree13491555b978c1ec3e6b99caeceaebb7bbbe28ed /source/blender/editors/space_time
parent129585285c47a016cf93fb183117eb86ce544461 (diff)
RNA
* Added RNA for operators. This still uses ID properties internally, but through the RNA API now. The OP_get/set_* API that was used is replaced by the RNA API. Currently RNA properties for operators are defined at runtime since it means operator registration can be done in a single function. * Changed the existing operators to use this system, I haven't defined user interface names yet though. I also think there need to be some conventions on which properties to expose to make these operators usable in macros, for example if mouse coordinates should be stored or not. * When using ID properties through defined RNA properties, it now checks that the ID property actually matches the RNA property and removes/overwrites it otherwise. This ensures that you can safely get/set arrays for example without having to worry that some external thing may have changed the length. * Documentation now has some information on RNA + ID properties. http://wiki.blender.org/index.php/BlenderDev/Blender2.5/RNA
Diffstat (limited to 'source/blender/editors/space_time')
-rw-r--r--source/blender/editors/space_time/Makefile1
-rw-r--r--source/blender/editors/space_time/SConscript3
-rw-r--r--source/blender/editors/space_time/time_ops.c18
3 files changed, 14 insertions, 8 deletions
diff --git a/source/blender/editors/space_time/Makefile b/source/blender/editors/space_time/Makefile
index c64a81695bf..20877b48559 100644
--- a/source/blender/editors/space_time/Makefile
+++ b/source/blender/editors/space_time/Makefile
@@ -44,6 +44,7 @@ CPPFLAGS += -I../../blenloader
CPPFLAGS += -I../../blenkernel
CPPFLAGS += -I../../blenlib
CPPFLAGS += -I../../makesdna
+CPPFLAGS += -I../../makesrna
CPPFLAGS += -I../../imbuf
CPPFLAGS += -I../../python
CPPFLAGS += -I$(NAN_GUARDEDALLOC)/include
diff --git a/source/blender/editors/space_time/SConscript b/source/blender/editors/space_time/SConscript
index b83e79ff3e6..5295aa25e28 100644
--- a/source/blender/editors/space_time/SConscript
+++ b/source/blender/editors/space_time/SConscript
@@ -4,6 +4,7 @@ Import ('env')
sources = env.Glob('*.c')
incs = '../include ../../blenlib ../../blenkernel ../../makesdna ../../imbuf'
-incs += '../../windowmanager #/intern/guardedalloc #/extern/glew/include'
+incs += ' ../../windowmanager #/intern/guardedalloc #/extern/glew/include'
+incs += ' ../../makesrna'
env.BlenderLib ( 'bf_editors_space_time', sources, Split(incs), [], libtype=['core','intern'], priority=[35, 40] )
diff --git a/source/blender/editors/space_time/time_ops.c b/source/blender/editors/space_time/time_ops.c
index bc9cb3fa762..e95f0238ab5 100644
--- a/source/blender/editors/space_time/time_ops.c
+++ b/source/blender/editors/space_time/time_ops.c
@@ -42,6 +42,9 @@
#include "UI_interface.h"
#include "UI_view2d.h"
+#include "RNA_access.h"
+#include "RNA_define.h"
+
#include "WM_api.h"
#include "WM_types.h"
@@ -50,11 +53,7 @@
static int change_frame_init(bContext *C, wmOperator *op)
{
SpaceTime *stime= C->area->spacedata.first;
- int cfra;
- if(!OP_get_int(op, "frame", &cfra))
- return 0;
-
stime->flag |= TIME_CFRA_NUM;
return 1;
@@ -64,7 +63,7 @@ static void change_frame_apply(bContext *C, wmOperator *op)
{
int cfra;
- OP_get_int(op, "frame", &cfra);
+ cfra= RNA_int_get(op->rna, "frame");
if(cfra < MINFRAME)
cfra= MINFRAME;
@@ -120,7 +119,7 @@ static int frame_from_event(bContext *C, wmEvent *event)
static int change_frame_invoke(bContext *C, wmOperator *op, wmEvent *event)
{
- OP_verify_int(op, "frame", frame_from_event(C, event), NULL);
+ RNA_int_default(op->rna, "frame", frame_from_event(C, event));
change_frame_init(C, op);
change_frame_apply(C, op);
@@ -141,7 +140,7 @@ static int change_frame_modal(bContext *C, wmOperator *op, wmEvent *event)
/* execute the events */
switch(event->type) {
case MOUSEMOVE:
- OP_set_int(op, "frame", frame_from_event(C, event));
+ RNA_int_set(op->rna, "frame", frame_from_event(C, event));
change_frame_apply(C, op);
break;
@@ -159,6 +158,8 @@ static int change_frame_modal(bContext *C, wmOperator *op, wmEvent *event)
void ED_TIME_OT_change_frame(wmOperatorType *ot)
{
+ PropertyRNA *prop;
+
/* identifiers */
ot->name= "Change frame";
ot->idname= "ED_TIME_OT_change_frame";
@@ -168,6 +169,9 @@ void ED_TIME_OT_change_frame(wmOperatorType *ot)
ot->invoke= change_frame_invoke;
ot->cancel= change_frame_cancel;
ot->modal= change_frame_modal;
+
+ /* rna */
+ prop= RNA_def_property(ot->rna, "frame", PROP_INT, PROP_NONE);
}
/* ************************** registration **********************************/