diff options
Diffstat (limited to 'source/blender/editors')
-rw-r--r-- | source/blender/editors/interface/interface.c | 2 | ||||
-rw-r--r-- | source/blender/editors/screen/screen_context.c | 31 | ||||
-rw-r--r-- | source/blender/editors/screen/screen_intern.h | 2 | ||||
-rw-r--r-- | source/blender/editors/space_image/space_image.c | 10 | ||||
-rw-r--r-- | source/blender/editors/space_info/Makefile | 1 | ||||
-rw-r--r-- | source/blender/editors/space_info/SConscript | 2 | ||||
-rw-r--r-- | source/blender/editors/space_nla/Makefile | 1 | ||||
-rw-r--r-- | source/blender/editors/space_nla/SConscript | 2 | ||||
-rw-r--r-- | source/blender/editors/space_node/space_node.c | 8 | ||||
-rw-r--r-- | source/blender/editors/space_sound/Makefile | 1 | ||||
-rw-r--r-- | source/blender/editors/space_sound/SConscript | 2 | ||||
-rw-r--r-- | source/blender/editors/space_text/space_text.c | 6 | ||||
-rw-r--r-- | source/blender/editors/space_view3d/space_view3d.c | 84 | ||||
-rw-r--r-- | source/blender/editors/transform/transform_ops.c | 3 |
14 files changed, 85 insertions, 70 deletions
diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c index 194ccd285bf..2f78c4e8fff 100644 --- a/source/blender/editors/interface/interface.c +++ b/source/blender/editors/interface/interface.c @@ -600,7 +600,7 @@ void uiEndBlock(const bContext *C, uiBlock *block) /* temp? Proper check for greying out */ if(but->opname) { wmOperatorType *ot= WM_operatortype_find(but->opname); - if(ot==NULL || ot->poll((bContext *)C)==0) { + if(ot==NULL || (ot->poll && ot->poll((bContext *)C)==0)) { but->flag |= UI_BUT_DISABLED; but->lock = 1; } diff --git a/source/blender/editors/screen/screen_context.c b/source/blender/editors/screen/screen_context.c index 2406c1c5e32..11d1d019005 100644 --- a/source/blender/editors/screen/screen_context.c +++ b/source/blender/editors/screen/screen_context.c @@ -25,6 +25,7 @@ */ #include <stdlib.h> +#include <string.h> #include "DNA_object_types.h" #include "DNA_scene_types.h" @@ -33,44 +34,48 @@ #include "BKE_context.h" #include "BKE_utildefines.h" -int ed_screen_context(const bContext *C, bContextDataMember member, bContextDataResult *result) +#include "RNA_access.h" + +int ed_screen_context(const bContext *C, const char *member, bContextDataResult *result) { bScreen *sc= CTX_wm_screen(C); Scene *scene= sc->scene; Base *base; - if(member == CTX_DATA_SCENE) { - CTX_data_pointer_set(result, scene); + if(CTX_data_equals(member, "scene")) { + CTX_data_id_pointer_set(result, &scene->id); return 1; } - else if(ELEM(member, CTX_DATA_SELECTED_OBJECTS, CTX_DATA_SELECTED_BASES)) { + else if(CTX_data_equals(member, "selected_objects") || CTX_data_equals(member, "selected_bases")) { + int selected_objects= CTX_data_equals(member, "selected_objects"); + for(base=scene->base.first; base; base=base->next) { if((base->flag & SELECT) && (base->lay & scene->lay)) { - if(member == CTX_DATA_SELECTED_OBJECTS) - CTX_data_list_add(result, base->object); + if(selected_objects) + CTX_data_id_list_add(result, &base->object->id); else - CTX_data_list_add(result, base); + CTX_data_list_add(result, &scene->id, &RNA_UnknownType, base); } } return 1; } - else if(member == CTX_DATA_ACTIVE_BASE) { + else if(CTX_data_equals(member, "active_base")) { if(scene->basact) - CTX_data_pointer_set(result, scene->basact); + CTX_data_pointer_set(result, &scene->id, &RNA_UnknownType, &scene->basact); return 1; } - else if(member == CTX_DATA_ACTIVE_OBJECT) { + else if(CTX_data_equals(member, "active_object")) { if(scene->basact) - CTX_data_pointer_set(result, scene->basact->object); + CTX_data_id_pointer_set(result, &scene->basact->object->id); return 1; } - else if(member == CTX_DATA_EDIT_OBJECT) { + else if(CTX_data_equals(member, "edit_object")) { /* convenience for now, 1 object per scene in editmode */ if(scene->obedit) - CTX_data_pointer_set(result, scene->obedit); + CTX_data_id_pointer_set(result, &scene->obedit->id); return 1; } diff --git a/source/blender/editors/screen/screen_intern.h b/source/blender/editors/screen/screen_intern.h index f39ca7d4c3e..a0804f3e633 100644 --- a/source/blender/editors/screen/screen_intern.h +++ b/source/blender/editors/screen/screen_intern.h @@ -55,7 +55,7 @@ AZone *is_in_area_actionzone(ScrArea *sa, int x, int y); void ed_screen_fullarea(bContext *C, ScrArea *sa); /* screen_context.c */ -void ed_screen_context(const bContext *C, bContextDataMember member, bContextDataResult *result); +void ed_screen_context(const bContext *C, const char *member, bContextDataResult *result); /* screendump.c */ void SCREEN_OT_screenshot(struct wmOperatorType *ot); diff --git a/source/blender/editors/space_image/space_image.c b/source/blender/editors/space_image/space_image.c index 419eb913edd..deff9935b7e 100644 --- a/source/blender/editors/space_image/space_image.c +++ b/source/blender/editors/space_image/space_image.c @@ -304,16 +304,12 @@ static void image_listener(ScrArea *sa, wmNotifier *wmn) } } -static int image_context(const bContext *C, bContextDataMember member, bContextDataResult *result) +static int image_context(const bContext *C, const char *member, bContextDataResult *result) { SpaceImage *sima= (SpaceImage*)CTX_wm_space_data(C); - if(member == CTX_DATA_EDIT_IMAGE) { - CTX_data_pointer_set(result, ED_space_image(sima)); - return 1; - } - else if(member == CTX_DATA_EDIT_IMAGE_BUFFER) { - CTX_data_pointer_set(result, ED_space_image_buffer(sima)); + if(CTX_data_equals(member, "edit_image")) { + CTX_data_id_pointer_set(result, (ID*)ED_space_image(sima)); return 1; } diff --git a/source/blender/editors/space_info/Makefile b/source/blender/editors/space_info/Makefile index 13f7a0d169f..bc04ddc7824 100644 --- a/source/blender/editors/space_info/Makefile +++ b/source/blender/editors/space_info/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../../blenfont diff --git a/source/blender/editors/space_info/SConscript b/source/blender/editors/space_info/SConscript index 9723a7fcfe2..05afcae162e 100644 --- a/source/blender/editors/space_info/SConscript +++ b/source/blender/editors/space_info/SConscript @@ -3,7 +3,7 @@ Import ('env') sources = env.Glob('*.c') -incs = '../include ../../blenlib ../../blenkernel ../../makesdna ../../imbuf ../../blenfont' +incs = '../include ../../blenlib ../../blenkernel ../../makesdna ../../makesrna ../../imbuf ../../blenfont' incs += ' ../../windowmanager #/intern/guardedalloc #/extern/glew/include' defs = [] diff --git a/source/blender/editors/space_nla/Makefile b/source/blender/editors/space_nla/Makefile index 85405a2a3f5..43f010e6adc 100644 --- a/source/blender/editors/space_nla/Makefile +++ b/source/blender/editors/space_nla/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_nla/SConscript b/source/blender/editors/space_nla/SConscript index c6a4f34292f..790e3ad822c 100644 --- a/source/blender/editors/space_nla/SConscript +++ b/source/blender/editors/space_nla/SConscript @@ -3,7 +3,7 @@ Import ('env') sources = env.Glob('*.c') -incs = '../include ../../blenlib ../../blenkernel ../../makesdna ../../imbuf' +incs = '../include ../../blenlib ../../blenkernel ../../makesdna ../../makesrna ../../imbuf' incs += ' ../../windowmanager #/intern/guardedalloc #/extern/glew/include' env.BlenderLib ( 'bf_editors_space_nla', sources, Split(incs), [], libtype=['core'], priority=[85] ) diff --git a/source/blender/editors/space_node/space_node.c b/source/blender/editors/space_node/space_node.c index 1d2aa148e18..493ef6954b5 100644 --- a/source/blender/editors/space_node/space_node.c +++ b/source/blender/editors/space_node/space_node.c @@ -60,6 +60,8 @@ #include "UI_resources.h" #include "UI_view2d.h" +#include "RNA_access.h" + #include "node_intern.h" // own include /* ******************** default callbacks for node space ***************** */ @@ -277,16 +279,16 @@ static void node_region_listener(ARegion *ar, wmNotifier *wmn) } } -static int node_context(const bContext *C, bContextDataMember member, bContextDataResult *result) +static int node_context(const bContext *C, const char *member, bContextDataResult *result) { SpaceNode *snode= (SpaceNode*)CTX_wm_space_data(C); - if(member == CTX_DATA_SELECTED_NODES) { + if(CTX_data_equals(member, "selected_nodes")) { bNode *node; for(next_node(snode->edittree); (node=next_node(NULL));) { if(node->flag & SELECT) { - CTX_data_list_add(result, node); + CTX_data_list_add(result, &snode->edittree->id, &RNA_Node, node); } } return 1; diff --git a/source/blender/editors/space_sound/Makefile b/source/blender/editors/space_sound/Makefile index 9b1e95bf3a6..4d375282223 100644 --- a/source/blender/editors/space_sound/Makefile +++ b/source/blender/editors/space_sound/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_sound/SConscript b/source/blender/editors/space_sound/SConscript index 9e57223cc2a..e4fffb53e4c 100644 --- a/source/blender/editors/space_sound/SConscript +++ b/source/blender/editors/space_sound/SConscript @@ -3,7 +3,7 @@ Import ('env') sources = env.Glob('*.c') -incs = '../include ../../blenlib ../../blenkernel ../../makesdna ../../imbuf' +incs = '../include ../../blenlib ../../blenkernel ../../makesdna ../../makesrna ../../imbuf' incs += ' ../../windowmanager #/intern/guardedalloc #/extern/glew/include' env.BlenderLib ( 'bf_editors_space_sound', sources, Split(incs), [], libtype=['core'], priority=[75] ) diff --git a/source/blender/editors/space_text/space_text.c b/source/blender/editors/space_text/space_text.c index a854ebe72d9..363d3016adf 100644 --- a/source/blender/editors/space_text/space_text.c +++ b/source/blender/editors/space_text/space_text.c @@ -284,12 +284,12 @@ static void text_keymap(struct wmWindowManager *wm) WM_keymap_add_item(keymap, "TEXT_OT_insert", KM_TEXTINPUT, KM_ANY, KM_ANY, 0); // last! } -static int text_context(const bContext *C, bContextDataMember member, bContextDataResult *result) +static int text_context(const bContext *C, const char *member, bContextDataResult *result) { SpaceText *st= CTX_wm_space_text(C); - if(member == CTX_DATA_EDIT_TEXT) { - CTX_data_pointer_set(result, st->text); + if(CTX_data_equals(member, "edit_text")) { + CTX_data_id_pointer_set(result, &st->text->id); return 1; } diff --git a/source/blender/editors/space_view3d/space_view3d.c b/source/blender/editors/space_view3d/space_view3d.c index 4e2a0090244..ab04fbdd490 100644 --- a/source/blender/editors/space_view3d/space_view3d.c +++ b/source/blender/editors/space_view3d/space_view3d.c @@ -62,6 +62,8 @@ #include "UI_resources.h" #include "UI_view2d.h" +#include "RNA_access.h" + #include "view3d_intern.h" // own include /* ******************** manage regions ********************* */ @@ -519,7 +521,7 @@ static int object_is_libdata(Object *ob) return 0; } -static int view3d_context(const bContext *C, bContextDataMember member, bContextDataResult *result) +static int view3d_context(const bContext *C, const char *member, bContextDataResult *result) { View3D *v3d= CTX_wm_view3d(C); Scene *scene= CTX_data_scene(C); @@ -527,29 +529,33 @@ static int view3d_context(const bContext *C, bContextDataMember member, bContext if(v3d==NULL) return 0; - if(ELEM(member, CTX_DATA_SELECTED_OBJECTS, CTX_DATA_SELECTED_BASES)) { + if(CTX_data_equals(member, "selected_objects") || CTX_data_equals(member, "selected_bases")) { + int selected_objects= CTX_data_equals(member, "selected_objects"); + for(base=scene->base.first; base; base=base->next) { if((base->flag & SELECT) && (base->lay & v3d->lay)) { if((base->object->restrictflag & OB_RESTRICT_VIEW)==0) { - if(member == CTX_DATA_SELECTED_OBJECTS) - CTX_data_list_add(result, base->object); + if(selected_objects) + CTX_data_id_list_add(result, &base->object->id); else - CTX_data_list_add(result, base); + CTX_data_list_add(result, &scene->id, &RNA_UnknownType, base); } } } return 1; } - else if(ELEM(member, CTX_DATA_SELECTED_EDITABLE_OBJECTS, CTX_DATA_SELECTED_EDITABLE_BASES)) { + else if(CTX_data_equals(member, "selected_editable_objects") || CTX_data_equals(member, "selected_editable_bases")) { + int selected_editable_objects= CTX_data_equals(member, "selected_editable_objects"); + for(base=scene->base.first; base; base=base->next) { if((base->flag & SELECT) && (base->lay & v3d->lay)) { if((base->object->restrictflag & OB_RESTRICT_VIEW)==0) { if(0==object_is_libdata(base->object)) { - if(member == CTX_DATA_SELECTED_EDITABLE_OBJECTS) - CTX_data_list_add(result, base->object); + if(selected_editable_objects) + CTX_data_id_list_add(result, &base->object->id); else - CTX_data_list_add(result, base); + CTX_data_list_add(result, &scene->id, &RNA_UnknownType, base); } } } @@ -557,38 +563,41 @@ static int view3d_context(const bContext *C, bContextDataMember member, bContext return 1; } - else if(ELEM(member, CTX_DATA_VISIBLE_OBJECTS, CTX_DATA_VISIBLE_BASES)) { + else if(CTX_data_equals(member, "visible_objects") || CTX_data_equals(member, "visible_bases")) { + int visible_objects= CTX_data_equals(member, "visible_objects"); + for(base=scene->base.first; base; base=base->next) { if(base->lay & v3d->lay) { if((base->object->restrictflag & OB_RESTRICT_VIEW)==0) { - if(member == CTX_DATA_VISIBLE_OBJECTS) - CTX_data_list_add(result, base->object); + if(visible_objects) + CTX_data_id_list_add(result, &base->object->id); else - CTX_data_list_add(result, base); + CTX_data_list_add(result, &scene->id, &RNA_UnknownType, base); } } } return 1; } - else if(member == CTX_DATA_ACTIVE_BASE) { + else if(CTX_data_equals(member, "active_base")) { if(scene->basact && (scene->basact->lay & v3d->lay)) if((scene->basact->object->restrictflag & OB_RESTRICT_VIEW)==0) - CTX_data_pointer_set(result, scene->basact); + CTX_data_pointer_set(result, &scene->id, &RNA_UnknownType, scene->basact); return 1; } - else if(member == CTX_DATA_ACTIVE_OBJECT) { + else if(CTX_data_equals(member, "active_object")) { if(scene->basact && (scene->basact->lay & v3d->lay)) if((scene->basact->object->restrictflag & OB_RESTRICT_VIEW)==0) - CTX_data_pointer_set(result, scene->basact->object); + CTX_data_id_pointer_set(result, &scene->basact->object->id); return 1; } - else if(ELEM(member, CTX_DATA_VISIBLE_BONES, CTX_DATA_EDITABLE_BONES)) { + else if(CTX_data_equals(member, "visible_bones") || CTX_data_equals(member, "editable_bones")) { Object *obedit= scene->obedit; // XXX get from context? bArmature *arm= (obedit) ? obedit->data : NULL; EditBone *ebone, *flipbone=NULL; + int editable_bones= CTX_data_equals(member, "editable_bones"); if (arm && arm->edbo) { /* Attention: X-Axis Mirroring is also handled here... */ @@ -605,21 +614,21 @@ static int view3d_context(const bContext *C, bContextDataMember member, bContext flipbone = ED_armature_bone_get_mirrored(arm->edbo, ebone); /* if we're filtering for editable too, use the check for that instead, as it has selection check too */ - if (member == CTX_DATA_EDITABLE_BONES) { + if (editable_bones) { /* only selected + editable */ if (EBONE_EDITABLE(ebone)) { - CTX_data_list_add(result, ebone); + CTX_data_list_add(result, &arm->id, &RNA_UnknownType, ebone); if ((flipbone) && !(flipbone->flag & BONE_SELECTED)) - CTX_data_list_add(result, flipbone); + CTX_data_list_add(result, &arm->id, &RNA_UnknownType, flipbone); } } else { /* only include bones if visible */ - CTX_data_list_add(result, ebone); + CTX_data_list_add(result, &arm->id, &RNA_UnknownType, ebone); if ((flipbone) && EBONE_VISIBLE(arm, flipbone)==0) - CTX_data_list_add(result, flipbone); + CTX_data_list_add(result, &arm->id, &RNA_UnknownType, flipbone); } } } @@ -627,10 +636,11 @@ static int view3d_context(const bContext *C, bContextDataMember member, bContext return 1; } } - else if(ELEM(member, CTX_DATA_SELECTED_BONES, CTX_DATA_SELECTED_EDITABLE_BONES)) { + else if(CTX_data_equals(member, "selected_bones") || CTX_data_equals(member, "selected_editable_bones")) { Object *obedit= scene->obedit; // XXX get from context? bArmature *arm= (obedit) ? obedit->data : NULL; EditBone *ebone, *flipbone=NULL; + int selected_editable_bones= CTX_data_equals(member, "selected_editable_bones"); if (arm && arm->edbo) { /* Attention: X-Axis Mirroring is also handled here... */ @@ -647,21 +657,21 @@ static int view3d_context(const bContext *C, bContextDataMember member, bContext flipbone = ED_armature_bone_get_mirrored(arm->edbo, ebone); /* if we're filtering for editable too, use the check for that instead, as it has selection check too */ - if (member == CTX_DATA_SELECTED_EDITABLE_BONES) { + if (selected_editable_bones) { /* only selected + editable */ if (EBONE_EDITABLE(ebone)) { - CTX_data_list_add(result, ebone); + CTX_data_list_add(result, &arm->id, &RNA_UnknownType, ebone); if ((flipbone) && !(flipbone->flag & BONE_SELECTED)) - CTX_data_list_add(result, flipbone); + CTX_data_list_add(result, &arm->id, &RNA_UnknownType, flipbone); } } else { /* only include bones if selected */ - CTX_data_list_add(result, ebone); + CTX_data_list_add(result, &arm->id, &RNA_UnknownType, ebone); if ((flipbone) && !(flipbone->flag & BONE_SELECTED)) - CTX_data_list_add(result, flipbone); + CTX_data_list_add(result, &arm->id, &RNA_UnknownType, flipbone); } } } @@ -669,7 +679,7 @@ static int view3d_context(const bContext *C, bContextDataMember member, bContext return 1; } } - else if(member == CTX_DATA_VISIBLE_PCHANS) { + else if(CTX_data_equals(member, "visible_pchans")) { Object *obact= OBACT; bArmature *arm= (obact) ? obact->data : NULL; bPoseChannel *pchan; @@ -678,14 +688,14 @@ static int view3d_context(const bContext *C, bContextDataMember member, bContext for (pchan= obact->pose->chanbase.first; pchan; pchan= pchan->next) { /* ensure that PoseChannel is on visible layer and is not hidden in PoseMode */ if ((pchan->bone) && (arm->layer & pchan->bone->layer) && !(pchan->bone->flag & BONE_HIDDEN_P)) { - CTX_data_list_add(result, pchan); + CTX_data_list_add(result, &obact->id, &RNA_PoseChannel, pchan); } } return 1; } } - else if(member == CTX_DATA_SELECTED_PCHANS) { + else if(CTX_data_equals(member, "selected_pchans")) { Object *obact= OBACT; bArmature *arm= (obact) ? obact->data : NULL; bPoseChannel *pchan; @@ -695,14 +705,14 @@ static int view3d_context(const bContext *C, bContextDataMember member, bContext /* ensure that PoseChannel is on visible layer and is not hidden in PoseMode */ if ((pchan->bone) && (arm->layer & pchan->bone->layer) && !(pchan->bone->flag & BONE_HIDDEN_P)) { if (pchan->bone->flag & (BONE_SELECTED|BONE_ACTIVE)) - CTX_data_list_add(result, pchan); + CTX_data_list_add(result, &obact->id, &RNA_PoseChannel, pchan); } } return 1; } } - else if(member == CTX_DATA_ACTIVE_BONE) { + else if(CTX_data_equals(member, "active_bone")) { Object *obedit= scene->obedit; // XXX get from context? bArmature *arm= (obedit) ? obedit->data : NULL; EditBone *ebone; @@ -711,7 +721,7 @@ static int view3d_context(const bContext *C, bContextDataMember member, bContext for (ebone= arm->edbo->first; ebone; ebone= ebone->next) { if (EBONE_VISIBLE(arm, ebone)) { if (ebone->flag & BONE_ACTIVE) { - CTX_data_pointer_set(result, ebone); + CTX_data_pointer_set(result, &arm->id, &RNA_UnknownType, ebone); return 1; } @@ -720,13 +730,13 @@ static int view3d_context(const bContext *C, bContextDataMember member, bContext } } - else if(member == CTX_DATA_ACTIVE_PCHAN) { + else if(CTX_data_equals(member, "active_pchan")) { Object *obact= OBACT; bPoseChannel *pchan; pchan= get_active_posechannel(obact); if (pchan) { - CTX_data_pointer_set(result, pchan); + CTX_data_pointer_set(result, &obact->id, &RNA_PoseChannel, pchan); return 1; } } diff --git a/source/blender/editors/transform/transform_ops.c b/source/blender/editors/transform/transform_ops.c index 719ae144913..fc4b0117bcb 100644 --- a/source/blender/editors/transform/transform_ops.c +++ b/source/blender/editors/transform/transform_ops.c @@ -492,8 +492,7 @@ void TFM_OT_transform(struct wmOperatorType *ot) RNA_def_float_vector(ot->srna, "value", 4, NULL, -FLT_MAX, FLT_MAX, "Values", "", -FLT_MAX, FLT_MAX); - RNA_def_enum(ot->srna, "proportional", proportional_mode_types, 0, "Proportional Edition", ""); - RNA_def_float(ot->srna, "proportional_size", 1, 0, FLT_MAX, "Proportional Size", "", 0, 100); + Properties_Proportional(ot); RNA_def_boolean(ot->srna, "mirror", 0, "Mirror Edition", ""); RNA_def_boolean_vector(ot->srna, "constraint_axis", 3, NULL, "Constraint Axis", ""); |