diff options
-rw-r--r-- | release/scripts/ui/properties_object.py | 10 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/subsurf_ccg.c | 1 | ||||
-rw-r--r-- | source/blender/editors/animation/anim_markers.c | 4 | ||||
-rw-r--r-- | source/blender/editors/object/object_add.c | 4 | ||||
-rw-r--r-- | source/blender/editors/object/object_group.c | 86 | ||||
-rw-r--r-- | source/blender/editors/object/object_intern.h | 1 | ||||
-rw-r--r-- | source/blender/editors/object/object_ops.c | 1 | ||||
-rw-r--r-- | source/blender/editors/object/object_relations.c | 6 | ||||
-rw-r--r-- | source/blender/editors/space_nla/nla_edit.c | 4 | ||||
-rw-r--r-- | source/blender/makesrna/RNA_enum_types.h | 4 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_operators.c | 37 |
11 files changed, 86 insertions, 72 deletions
diff --git a/release/scripts/ui/properties_object.py b/release/scripts/ui/properties_object.py index 7169d936904..043a0d2434b 100644 --- a/release/scripts/ui/properties_object.py +++ b/release/scripts/ui/properties_object.py @@ -155,13 +155,11 @@ class OBJECT_PT_groups(ObjectButtonsPanel): ob = context.object wide_ui = context.region.width > narrowui - if wide_ui: - split = layout.split() - split.operator_menu_enum("object.group_add", "group") - split.label() - else: - layout.operator_menu_enum("object.group_add", "group") + split = layout.split(percentage=0.8, align=True) + split.operator("object.group_link", text="Link to Group") + split.operator("object.group_add", text="", icon='ZOOMIN') + # XXX, this is bad practice, yes, I wrote it :( - campbell index = 0 value = str(tuple(context.scene.cursor_location)) for group in bpy.data.groups: diff --git a/source/blender/blenkernel/intern/subsurf_ccg.c b/source/blender/blenkernel/intern/subsurf_ccg.c index db63f094160..72236a76032 100644 --- a/source/blender/blenkernel/intern/subsurf_ccg.c +++ b/source/blender/blenkernel/intern/subsurf_ccg.c @@ -844,6 +844,7 @@ static void ccgDM_copyFinalVertArray(DerivedMesh *dm, MVert *mvert) for(x = 1; x < edgeSize - 1; x++, i++) { vd= ccgSubSurf_getEdgeData(ss, e, x); copy_v3_v3(mvert[i].co, vd->co); + /* XXX, This gives errors with -fpe, the normals dont seem to be unit length - campbell */ normal_float_to_short_v3(mvert[i].no, vd->no); } } diff --git a/source/blender/editors/animation/anim_markers.c b/source/blender/editors/animation/anim_markers.c index d1c1fa64ad2..edad0b724d7 100644 --- a/source/blender/editors/animation/anim_markers.c +++ b/source/blender/editors/animation/anim_markers.c @@ -1069,7 +1069,7 @@ static void MARKER_OT_delete(wmOperatorType *ot) static int ed_marker_make_links_scene_exec(bContext *C, wmOperator *op) { ListBase *markers= context_get_markers(C); - Scene *scene_to= BLI_findlink(&CTX_data_main(C)->scene, RNA_enum_get(op->ptr, "type")); + Scene *scene_to= BLI_findlink(&CTX_data_main(C)->scene, RNA_enum_get(op->ptr, "scene")); TimeMarker *marker, *marker_new; if(scene_to==NULL) { @@ -1110,7 +1110,7 @@ static void MARKER_OT_make_links_scene(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; /* properties */ - prop= RNA_def_enum(ot->srna, "type", DummyRNA_NULL_items, 0, "Type", ""); + prop= RNA_def_enum(ot->srna, "scene", DummyRNA_NULL_items, 0, "Scene", ""); RNA_def_enum_funcs(prop, RNA_scene_itemf); } diff --git a/source/blender/editors/object/object_add.c b/source/blender/editors/object/object_add.c index f490ca19a31..5410ebf6906 100644 --- a/source/blender/editors/object/object_add.c +++ b/source/blender/editors/object/object_add.c @@ -850,7 +850,7 @@ void OBJECT_OT_lamp_add(wmOperatorType *ot) static int group_instance_add_exec(bContext *C, wmOperator *op) { - Group *group= BLI_findlink(&CTX_data_main(C)->group, RNA_enum_get(op->ptr, "type")); + Group *group= BLI_findlink(&CTX_data_main(C)->group, RNA_enum_get(op->ptr, "group")); int enter_editmode; unsigned int layer; @@ -895,7 +895,7 @@ void OBJECT_OT_group_instance_add(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; /* properties */ - prop= RNA_def_enum(ot->srna, "type", DummyRNA_NULL_items, 0, "Type", ""); + prop= RNA_def_enum(ot->srna, "group", DummyRNA_NULL_items, 0, "Group", ""); RNA_def_enum_funcs(prop, RNA_group_itemf); ot->prop= prop; ED_object_add_generic_props(ot, FALSE); diff --git a/source/blender/editors/object/object_group.c b/source/blender/editors/object/object_group.c index 73ca6e02132..ba609bd9bb3 100644 --- a/source/blender/editors/object/object_group.c +++ b/source/blender/editors/object/object_group.c @@ -52,6 +52,7 @@ #include "RNA_access.h" #include "RNA_define.h" +#include "RNA_enum_types.h" #include "object_intern.h" @@ -224,84 +225,71 @@ void GROUP_OT_create(wmOperatorType *ot) static int group_add_exec(bContext *C, wmOperator *op) { - Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data; - Base *base; Group *group; - int value= RNA_enum_get(op->ptr, "group"); - if(!ob) + if(ob == NULL) return OPERATOR_CANCELLED; - - base= object_in_scene(ob, scene); - if(!base) - return OPERATOR_CANCELLED; - - if(value == -1) - group= add_group( "Group" ); - else - group= BLI_findlink(&bmain->group, value); - if(group) { - add_to_group(group, ob, scene, NULL); /* base will be used if found */ - } + group= add_group("Group"); + add_to_group(group, ob, scene, NULL); WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob); - + return OPERATOR_FINISHED; } -static EnumPropertyItem group_items[]= { - {-1, "ADD_NEW", 0, "Add New Group", ""}, - {0, NULL, 0, NULL, NULL}}; - -static EnumPropertyItem *group_itemf(bContext *C, PointerRNA *ptr, int *free) -{ - Main *bmain= CTX_data_main(C); - Group *group; - EnumPropertyItem tmp = {0, "", 0, "", ""}; - EnumPropertyItem *item= NULL; - int a, totitem= 0; +void OBJECT_OT_group_add(wmOperatorType *ot) +{ + /* identifiers */ + ot->name= "Add to Group"; + ot->idname= "OBJECT_OT_group_add"; + ot->description = "Add an object to a new group"; - RNA_enum_items_add_value(&item, &totitem, group_items, -1); + /* api callbacks */ + ot->exec= group_add_exec; + + /* flags */ + ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; +} - if (bmain) { - if(bmain->group.first) - RNA_enum_item_add_separator(&item, &totitem); +static int group_link_exec(bContext *C, wmOperator *op) +{ + Scene *scene= CTX_data_scene(C); + Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data; + Group *group= BLI_findlink(&CTX_data_main(C)->group, RNA_enum_get(op->ptr, "group")); - for(a=0, group=bmain->group.first; group; group=group->id.next, a++) { - tmp.value= a; - tmp.identifier= group->id.name+2; - tmp.name= group->id.name+2; - RNA_enum_item_add(&item, &totitem, &tmp); - } - } + if(ELEM(NULL, ob, group)) + return OPERATOR_CANCELLED; + + add_to_group(group, ob, scene, NULL); - RNA_enum_item_end(&item, &totitem); - *free= 1; + WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob); - return item; + return OPERATOR_FINISHED; } -void OBJECT_OT_group_add(wmOperatorType *ot) +void OBJECT_OT_group_link(wmOperatorType *ot) { PropertyRNA *prop; /* identifiers */ - ot->name= "Add to Group"; - ot->idname= "OBJECT_OT_group_add"; - ot->description = "Add an object to an existing group, or create new"; + ot->name= "Link to Group"; + ot->idname= "OBJECT_OT_group_link"; + ot->description = "Add an object to an existing group"; /* api callbacks */ - ot->exec= group_add_exec; + ot->exec= group_link_exec; + ot->invoke= WM_enum_search_invoke; /* flags */ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; /* properties */ - prop= RNA_def_enum(ot->srna, "group", group_items, -1, "Group", "Group to add object to."); - RNA_def_enum_funcs(prop, group_itemf); + prop= RNA_def_enum(ot->srna, "group", DummyRNA_NULL_items, 0, "Group", ""); + RNA_def_enum_funcs(prop, RNA_group_local_itemf); + ot->prop= prop; } static int group_remove_exec(bContext *C, wmOperator *op) diff --git a/source/blender/editors/object/object_intern.h b/source/blender/editors/object/object_intern.h index 0f79168e5b3..21a4f305a77 100644 --- a/source/blender/editors/object/object_intern.h +++ b/source/blender/editors/object/object_intern.h @@ -212,6 +212,7 @@ void OBJECT_OT_shape_key_move(struct wmOperatorType *ot); /* object_group.c */ void OBJECT_OT_group_add(struct wmOperatorType *ot); +void OBJECT_OT_group_link(struct wmOperatorType *ot); void OBJECT_OT_group_remove(struct wmOperatorType *ot); /* object_bake.c */ diff --git a/source/blender/editors/object/object_ops.c b/source/blender/editors/object/object_ops.c index 75d07f72d5b..662ea4c200c 100644 --- a/source/blender/editors/object/object_ops.c +++ b/source/blender/editors/object/object_ops.c @@ -193,6 +193,7 @@ void ED_operatortypes_object(void) WM_operatortype_append(LATTICE_OT_make_regular); WM_operatortype_append(OBJECT_OT_group_add); + WM_operatortype_append(OBJECT_OT_group_link); WM_operatortype_append(OBJECT_OT_group_remove); WM_operatortype_append(OBJECT_OT_hook_add_selobj); diff --git a/source/blender/editors/object/object_relations.c b/source/blender/editors/object/object_relations.c index a6a955e6df8..939c868e19e 100644 --- a/source/blender/editors/object/object_relations.c +++ b/source/blender/editors/object/object_relations.c @@ -1146,7 +1146,7 @@ void link_to_scene(unsigned short nr) static int make_links_scene_exec(bContext *C, wmOperator *op) { - Scene *scene_to= BLI_findlink(&CTX_data_main(C)->scene, RNA_enum_get(op->ptr, "type")); + Scene *scene_to= BLI_findlink(&CTX_data_main(C)->scene, RNA_enum_get(op->ptr, "scene")); if(scene_to==NULL) { BKE_report(op->reports, RPT_ERROR, "Scene not found"); @@ -1264,8 +1264,8 @@ void OBJECT_OT_make_links_scene(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; /* properties */ - prop= RNA_def_enum(ot->srna, "type", DummyRNA_NULL_items, 0, "Type", ""); - RNA_def_enum_funcs(prop, RNA_scene_itemf); + prop= RNA_def_enum(ot->srna, "scene", DummyRNA_NULL_items, 0, "Scene", ""); + RNA_def_enum_funcs(prop, RNA_scene_local_itemf); } void OBJECT_OT_make_links_data(wmOperatorType *ot) diff --git a/source/blender/editors/space_nla/nla_edit.c b/source/blender/editors/space_nla/nla_edit.c index 79aac30a7a4..b017a6102e9 100644 --- a/source/blender/editors/space_nla/nla_edit.c +++ b/source/blender/editors/space_nla/nla_edit.c @@ -260,7 +260,7 @@ static int nlaedit_add_actionclip_exec (bContext *C, wmOperator *op) cfra= (float)CFRA; /* get action to use */ - act= BLI_findlink(&CTX_data_main(C)->action, RNA_enum_get(op->ptr, "type")); + act= BLI_findlink(&CTX_data_main(C)->action, RNA_enum_get(op->ptr, "action")); if (act == NULL) { BKE_report(op->reports, RPT_ERROR, "No valid Action to add."); @@ -336,7 +336,7 @@ void NLA_OT_actionclip_add (wmOperatorType *ot) /* props */ // TODO: this would be nicer as an ID-pointer... - prop= RNA_def_enum(ot->srna, "type", DummyRNA_NULL_items, 0, "Type", ""); + prop= RNA_def_enum(ot->srna, "action", DummyRNA_NULL_items, 0, "Action", ""); RNA_def_enum_funcs(prop, RNA_action_itemf); ot->prop= prop; } diff --git a/source/blender/makesrna/RNA_enum_types.h b/source/blender/makesrna/RNA_enum_types.h index c8d9febb96f..fd96d1d41d7 100644 --- a/source/blender/makesrna/RNA_enum_types.h +++ b/source/blender/makesrna/RNA_enum_types.h @@ -101,9 +101,13 @@ EnumPropertyItem *rna_TransformOrientation_itemf(struct bContext *C, struct Poin /* Generic functions, return an enum from library data, index is the position * in the linked list can add more for different types as needed */ EnumPropertyItem *RNA_action_itemf(struct bContext *C, struct PointerRNA *ptr, int *free); +EnumPropertyItem *RNA_action_local_itemf(struct bContext *C, struct PointerRNA *ptr, int *free); EnumPropertyItem *RNA_group_itemf(struct bContext *C, struct PointerRNA *ptr, int *free); +EnumPropertyItem *RNA_group_local_itemf(struct bContext *C, struct PointerRNA *ptr, int *free); EnumPropertyItem *RNA_image_itemf(struct bContext *C, struct PointerRNA *ptr, int *free); +EnumPropertyItem *RNA_image_local_itemf(struct bContext *C, struct PointerRNA *ptr, int *free); EnumPropertyItem *RNA_scene_itemf(struct bContext *C, struct PointerRNA *ptr, int *free); +EnumPropertyItem *RNA_scene_local_itemf(struct bContext *C, struct PointerRNA *ptr, int *free); #endif /* RNA_ENUM_TYPES */ diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c index 594ee937d63..de748d204ff 100644 --- a/source/blender/windowmanager/intern/wm_operators.c +++ b/source/blender/windowmanager/intern/wm_operators.c @@ -3252,7 +3252,7 @@ void wm_window_keymap(wmKeyConfig *keyconf) } /* Generic itemf's for operators that take library args */ -static EnumPropertyItem *rna_id_itemf(bContext *C, PointerRNA *ptr, int *free, ID *id) +static EnumPropertyItem *rna_id_itemf(bContext *C, PointerRNA *ptr, int *free, ID *id, int local) { EnumPropertyItem *item= NULL, item_tmp; int totitem= 0; @@ -3261,9 +3261,11 @@ static EnumPropertyItem *rna_id_itemf(bContext *C, PointerRNA *ptr, int *free, I memset(&item_tmp, 0, sizeof(item_tmp)); for( ; id; id= id->next) { - item_tmp.identifier= item_tmp.name= id->name+2; - item_tmp.value= i++; - RNA_enum_item_add(&item, &totitem, &item_tmp); + if(local==FALSE || id->lib==NULL) { + item_tmp.identifier= item_tmp.name= id->name+2; + item_tmp.value= i++; + RNA_enum_item_add(&item, &totitem, &item_tmp); + } } RNA_enum_item_end(&item, &totitem); @@ -3275,17 +3277,36 @@ static EnumPropertyItem *rna_id_itemf(bContext *C, PointerRNA *ptr, int *free, I /* can add more as needed */ EnumPropertyItem *RNA_action_itemf(bContext *C, PointerRNA *ptr, int *free) { - return rna_id_itemf(C, ptr, free, C ? (ID *)CTX_data_main(C)->action.first : NULL); + return rna_id_itemf(C, ptr, free, C ? (ID *)CTX_data_main(C)->action.first : NULL, FALSE); +} +EnumPropertyItem *RNA_action_local_itemf(bContext *C, PointerRNA *ptr, int *free) +{ + return rna_id_itemf(C, ptr, free, C ? (ID *)CTX_data_main(C)->action.first : NULL, TRUE); } + EnumPropertyItem *RNA_group_itemf(bContext *C, PointerRNA *ptr, int *free) { - return rna_id_itemf(C, ptr, free, C ? (ID *)CTX_data_main(C)->group.first : NULL); + return rna_id_itemf(C, ptr, free, C ? (ID *)CTX_data_main(C)->group.first : NULL, FALSE); +} +EnumPropertyItem *RNA_group_local_itemf(bContext *C, PointerRNA *ptr, int *free) +{ + return rna_id_itemf(C, ptr, free, C ? (ID *)CTX_data_main(C)->group.first : NULL, TRUE); } + EnumPropertyItem *RNA_image_itemf(bContext *C, PointerRNA *ptr, int *free) { - return rna_id_itemf(C, ptr, free, C ? (ID *)CTX_data_main(C)->image.first : NULL); + return rna_id_itemf(C, ptr, free, C ? (ID *)CTX_data_main(C)->image.first : NULL, FALSE); +} +EnumPropertyItem *RNA_image_local_itemf(bContext *C, PointerRNA *ptr, int *free) +{ + return rna_id_itemf(C, ptr, free, C ? (ID *)CTX_data_main(C)->image.first : NULL, TRUE); } + EnumPropertyItem *RNA_scene_itemf(bContext *C, PointerRNA *ptr, int *free) { - return rna_id_itemf(C, ptr, free, C ? (ID *)CTX_data_main(C)->scene.first : NULL); + return rna_id_itemf(C, ptr, free, C ? (ID *)CTX_data_main(C)->scene.first : NULL, FALSE); +} +EnumPropertyItem *RNA_scene_local_itemf(bContext *C, PointerRNA *ptr, int *free) +{ + return rna_id_itemf(C, ptr, free, C ? (ID *)CTX_data_main(C)->scene.first : NULL, TRUE); } |