svn merge ^/trunk/blender -r48114:48119

This commit is contained in:
Campbell Barton
2012-06-20 14:15:01 +00:00
6 changed files with 122 additions and 7 deletions

View File

@@ -979,7 +979,9 @@ class VIEW3D_MT_object_group(Menu):
layout = self.layout
layout.operator("group.create")
# layout.operator_menu_enum("group.objects_remove", "group") # BUGGY
layout.operator("group.objects_remove")
layout.operator("group.objects_remove_all")
layout.separator()

View File

@@ -1453,7 +1453,7 @@ void BKE_mask_spline_ensure_deform(MaskSpline *spline)
// printf("SPLINE ALLOC %p %d\n", spline->points_deform, allocated_points);
if (spline->points_deform == NULL || allocated_points != spline->tot_point) {
printf("alloc new deform spline\n");
// printf("alloc new deform spline\n");
if (spline->points_deform) {
int i;

View File

@@ -160,7 +160,7 @@ void GROUP_OT_objects_remove_active(wmOperatorType *ot)
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
static int group_objects_remove_exec(bContext *C, wmOperator *UNUSED(op))
static int group_objects_remove_all_exec(bContext *C, wmOperator *UNUSED(op))
{
Main *bmain = CTX_data_main(C);
Scene *scene = CTX_data_scene(C);
@@ -180,21 +180,115 @@ static int group_objects_remove_exec(bContext *C, wmOperator *UNUSED(op))
return OPERATOR_FINISHED;
}
void GROUP_OT_objects_remove(wmOperatorType *ot)
void GROUP_OT_objects_remove_all(wmOperatorType *ot)
{
/* identifiers */
ot->name = "Remove From Groups";
ot->description = "Remove selected objects from all groups";
ot->idname = "GROUP_OT_objects_remove";
ot->name = "Remove From All Groups";
ot->description = "Remove selected objects from all groups or a selected group";
ot->idname = "GROUP_OT_objects_remove_all";
/* api callbacks */
ot->exec = group_objects_remove_exec;
ot->exec = group_objects_remove_all_exec;
ot->poll = ED_operator_objectmode;
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
}
static int group_objects_remove_exec(bContext *C, wmOperator *op)
{
Object *ob = ED_object_context(C);
Main *bmain = CTX_data_main(C);
Scene *scene = CTX_data_scene(C);
int group_object_index = RNA_enum_get(op->ptr, "group");
/* first get the group back from the enum index, quite awkward and UI spesific */
if (ob) {
Group *group = NULL;
int i = 0;
while ((group = find_group(ob, group))) {
if (i == group_object_index) {
break;
}
i++;
}
/* now remove all selected objects from the group */
if (group) {
CTX_DATA_BEGIN (C, Base *, base, selected_editable_bases)
{
rem_from_group(group, base->object, scene, base);
}
CTX_DATA_END;
DAG_scene_sort(bmain, scene);
WM_event_add_notifier(C, NC_GROUP | NA_EDITED, NULL);
return OPERATOR_FINISHED;
}
}
return OPERATOR_CANCELLED;
}
/* can be called with C == NULL */
static EnumPropertyItem *group_objects_remove_itemf(bContext *C, PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), int *free)
{
Object *ob = ED_object_context(C);
EnumPropertyItem *item = NULL, item_tmp = {0};
int totitem = 0;
if (C == NULL) {
return DummyRNA_NULL_items;
}
/* check that the action exists */
if (ob) {
Group *group = NULL;
int i = 0;
while ((group = find_group(ob, group))) {
item_tmp.identifier = item_tmp.name = group->id.name + 2;
/* item_tmp.icon = ICON_ARMATURE_DATA; */
item_tmp.value = i;
RNA_enum_item_add(&item, &totitem, &item_tmp);
}
i++;
}
RNA_enum_item_end(&item, &totitem);
*free = 1;
return item;
}
void GROUP_OT_objects_remove(wmOperatorType *ot)
{
PropertyRNA *prop;
/* identifiers */
ot->name = "Remove From Group";
ot->description = "Remove selected objects from all groups or a selected group";
ot->idname = "GROUP_OT_objects_remove";
/* api callbacks */
ot->exec = group_objects_remove_exec;
ot->invoke = WM_menu_invoke;
ot->poll = ED_operator_objectmode;
/* flags */
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
/* properties */
prop = RNA_def_enum(ot->srna, "group", DummyRNA_NULL_items, 0, "Group", "The group to remove this object from");
RNA_def_enum_funcs(prop, group_objects_remove_itemf);
ot->prop = prop;
}
static int group_create_exec(bContext *C, wmOperator *op)
{
Main *bmain = CTX_data_main(C);

View File

@@ -139,6 +139,7 @@ void LATTICE_OT_make_regular(struct wmOperatorType *ot);
/* object_group.c */
void GROUP_OT_create(struct wmOperatorType *ot);
void GROUP_OT_objects_remove_all(struct wmOperatorType *ot);
void GROUP_OT_objects_remove(struct wmOperatorType *ot);
void GROUP_OT_objects_add_active(struct wmOperatorType *ot);
void GROUP_OT_objects_remove_active(struct wmOperatorType *ot);

View File

@@ -105,6 +105,7 @@ void ED_operatortypes_object(void)
WM_operatortype_append(OBJECT_OT_select_mirror);
WM_operatortype_append(GROUP_OT_create);
WM_operatortype_append(GROUP_OT_objects_remove_all);
WM_operatortype_append(GROUP_OT_objects_remove);
WM_operatortype_append(GROUP_OT_objects_add_active);
WM_operatortype_append(GROUP_OT_objects_remove_active);
@@ -394,6 +395,7 @@ void ED_keymap_object(wmKeyConfig *keyconf)
WM_keymap_verify_item(keymap, "GROUP_OT_create", GKEY, KM_PRESS, KM_CTRL, 0);
WM_keymap_verify_item(keymap, "GROUP_OT_objects_remove", GKEY, KM_PRESS, KM_CTRL | KM_ALT, 0);
WM_keymap_verify_item(keymap, "GROUP_OT_objects_remove_all", GKEY, KM_PRESS, KM_SHIFT | KM_CTRL | KM_ALT, 0);
WM_keymap_verify_item(keymap, "GROUP_OT_objects_add_active", GKEY, KM_PRESS, KM_SHIFT | KM_CTRL, 0);
WM_keymap_verify_item(keymap, "GROUP_OT_objects_remove_active", GKEY, KM_PRESS, KM_SHIFT | KM_ALT, 0);

View File

@@ -387,6 +387,19 @@ static int debug_mode_libmv(int UNUSED(argc), const char **UNUSED(argv), void *U
}
#endif
static int set_debug_value(int argc, const char **argv, void *UNUSED(data))
{
if (argc > 1) {
G.rt = atoi(argv[1]);
return 1;
}
else {
printf("\nError: you must specify debug value to set.\n");
return 0;
}
}
static int set_fpe(int UNUSED(argc), const char **UNUSED(argv), void *UNUSED(data))
{
#if defined(__linux__) || defined(_WIN32) || defined(OSX_SSE_FPE)
@@ -1115,6 +1128,7 @@ static void setupArguments(bContext *C, bArgs *ba, SYS_SystemHandle *syshandle)
BLI_argsAdd(ba, 1, "-a", NULL, playback_doc, playback_mode, NULL);
BLI_argsAdd(ba, 1, "-d", "--debug", debug_doc, debug_mode, ba);
#ifdef WITH_FFMPEG
BLI_argsAdd(ba, 1, NULL, "--debug-ffmpeg", "\n\tEnable debug messages from FFmpeg library", debug_mode_generic, (void *)G_DEBUG_FFMPEG);
#endif
@@ -1129,6 +1143,8 @@ static void setupArguments(bContext *C, bArgs *ba, SYS_SystemHandle *syshandle)
BLI_argsAdd(ba, 1, NULL, "--debug-libmv", "\n\tEnable debug messages from libmv library", debug_mode_libmv, NULL);
#endif
BLI_argsAdd(ba, 1, NULL, "--debug-value", "<value>\n\tSet debug value of <value> on startup\n", set_debug_value, NULL);
BLI_argsAdd(ba, 1, NULL, "--verbose", "<verbose>\n\tSet logging verbosity level.", set_verbosity, NULL);
BLI_argsAdd(ba, 1, NULL, "--factory-startup", "\n\tSkip reading the "STRINGIFY (BLENDER_STARTUP_FILE)" in the users home directory", set_factory_startup, NULL);