diff options
author | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2012-12-12 02:00:22 +0400 |
---|---|---|
committer | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2012-12-12 02:00:22 +0400 |
commit | 53d845ba69dee3b285e1584e987517f3e238078c (patch) | |
tree | ac15723377effdbf12c3156dd216ef20ec01b353 /source/blender/editors | |
parent | c9dc80111b63fc1b28cae27d6f7ed02ee3bd53db (diff) |
A big cleaning patch by Bastien Montagne (thanks a lot!)
* Split and moved Cycles’ render layers panels into the render_layer
context as well (would be nice to hide this context when not needed,
e.g. with the BGE, but this is not so easy to do nicely...).
* Fixed some inconsistencies with trunk (probably due to svn merge
glitches) using r52858 as reference. Also recovered the missing
release/bin/blender-softwaregl file.
* A bunch of style code fixes in Blender's own code (not Freestyle
itself yet): line lengths, spaces around operators, block formatting,
headers, etc. In rna_linestyle.c, color_blend_items was replaced by
ramp_blend_items (exported from rna_material.c).
Diffstat (limited to 'source/blender/editors')
-rw-r--r-- | source/blender/editors/animation/anim_channels_defines.c | 10 | ||||
-rw-r--r-- | source/blender/editors/animation/anim_filter.c | 16 | ||||
-rw-r--r-- | source/blender/editors/interface/interface_templates.c | 3 | ||||
-rw-r--r-- | source/blender/editors/interface/resources.c | 6 | ||||
-rw-r--r-- | source/blender/editors/mesh/editmesh_tools.c | 12 | ||||
-rw-r--r-- | source/blender/editors/render/render_shading.c | 491 | ||||
-rw-r--r-- | source/blender/editors/space_buttons/space_buttons.c | 2 | ||||
-rw-r--r-- | source/blender/editors/space_file/filelist.c | 2 | ||||
-rw-r--r-- | source/blender/editors/transform/transform.c | 6 |
9 files changed, 276 insertions, 272 deletions
diff --git a/source/blender/editors/animation/anim_channels_defines.c b/source/blender/editors/animation/anim_channels_defines.c index 3153cc72562..643c2c4dfe0 100644 --- a/source/blender/editors/animation/anim_channels_defines.c +++ b/source/blender/editors/animation/anim_channels_defines.c @@ -2013,7 +2013,7 @@ static bAnimChannelType ACF_DSNTREE = /* LineStyle Expander ------------------------------------------- */ -// TODO: just get this from RNA? +/* TODO: just get this from RNA? */ static int acf_dslinestyle_icon(bAnimListElem *UNUSED(ale)) { return ICON_BRUSH_DATA; /* FIXME */ @@ -2023,7 +2023,7 @@ static int acf_dslinestyle_icon(bAnimListElem *UNUSED(ale)) static int acf_dslinestyle_setting_flag(bAnimContext *UNUSED(ac), int setting, short *neg) { /* clear extra return data first */ - *neg= 0; + *neg = 0; switch (setting) { case ACHANNEL_SETTING_EXPAND: /* expanded */ @@ -2033,7 +2033,7 @@ static int acf_dslinestyle_setting_flag(bAnimContext *UNUSED(ac), int setting, s return ADT_NLA_EVAL_OFF; case ACHANNEL_SETTING_VISIBLE: /* visible (only in Graph Editor) */ - *neg= 1; + *neg = 1; return ADT_CURVES_NOT_VISIBLE; case ACHANNEL_SETTING_SELECT: /* selected */ @@ -2047,10 +2047,10 @@ static int acf_dslinestyle_setting_flag(bAnimContext *UNUSED(ac), int setting, s /* get pointer to the setting */ static void *acf_dslinestyle_setting_ptr(bAnimListElem *ale, int setting, short *type) { - FreestyleLineStyle *linestyle= (FreestyleLineStyle *)ale->data; + FreestyleLineStyle *linestyle = (FreestyleLineStyle *)ale->data; /* clear extra return data first */ - *type= 0; + *type = 0; switch (setting) { case ACHANNEL_SETTING_EXPAND: /* expanded */ diff --git a/source/blender/editors/animation/anim_filter.c b/source/blender/editors/animation/anim_filter.c index dffef5c131f..86cb805c68a 100644 --- a/source/blender/editors/animation/anim_filter.c +++ b/source/blender/editors/animation/anim_filter.c @@ -739,15 +739,15 @@ static bAnimListElem *make_new_animlistelem(void *data, short datatype, ID *owne break; case ANIMTYPE_DSLINESTYLE: { - FreestyleLineStyle *linestyle= (FreestyleLineStyle *)data; - AnimData *adt= linestyle->adt; + FreestyleLineStyle *linestyle = (FreestyleLineStyle *)data; + AnimData *adt = linestyle->adt; - ale->flag= FILTER_LS_SCED(linestyle); + ale->flag = FILTER_LS_SCED(linestyle); - ale->key_data= (adt) ? adt->action : NULL; - ale->datatype= ALE_ACT; + ale->key_data = (adt) ? adt->action : NULL; + ale->datatype = ALE_ACT; - ale->adt= BKE_animdata_from_id(data); + ale->adt = BKE_animdata_from_id(data); } break; case ANIMTYPE_DSPART: @@ -1532,7 +1532,7 @@ static size_t animdata_filter_ds_linestyle (bAnimContext *ac, ListBase *anim_dat SceneRenderLayer *srl; size_t items = 0; - for (srl= sce->r.layers.first; srl; srl= srl->next) { + for (srl = sce->r.layers.first; srl; srl = srl->next) { FreestyleLineSet *lineset; /* skip render layers without Freestyle enabled */ @@ -1540,7 +1540,7 @@ static size_t animdata_filter_ds_linestyle (bAnimContext *ac, ListBase *anim_dat continue; /* loop over linesets defined in the render layer */ - for (lineset= srl->freestyleConfig.linesets.first; lineset; lineset= lineset->next) { + for (lineset = srl->freestyleConfig.linesets.first; lineset; lineset = lineset->next) { FreestyleLineStyle *linestyle = lineset->linestyle; ListBase tmp_data = {NULL, NULL}; size_t tmp_items = 0; diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c index 84ee0ffebe1..2b8ee10af1a 100644 --- a/source/blender/editors/interface/interface_templates.c +++ b/source/blender/editors/interface/interface_templates.c @@ -2412,7 +2412,8 @@ static void list_item_row(bContext *C, uiLayout *layout, PointerRNA *ptr, Pointe uiBlockSetEmboss(block, UI_EMBOSS); uiDefButR(block, OPTION, 0, "", 0, 0, UI_UNIT_X, UI_UNIT_Y, ptr, "use_textures", i, 0, 0, 0, 0, NULL); } - else if (RNA_struct_is_a(itemptr->type, &RNA_SceneRenderLayer) || RNA_struct_is_a(itemptr->type, &RNA_FreestyleLineSet)) { + else if (RNA_struct_is_a(itemptr->type, &RNA_SceneRenderLayer) || + RNA_struct_is_a(itemptr->type, &RNA_FreestyleLineSet)) { uiItemL(sub, name, icon); uiBlockSetEmboss(block, UI_EMBOSS); uiDefButR(block, OPTION, 0, "", 0, 0, UI_UNIT_X, UI_UNIT_Y, itemptr, "use", 0, 0, 0, 0, 0, NULL); diff --git a/source/blender/editors/interface/resources.c b/source/blender/editors/interface/resources.c index d0189e0f5b4..dce0de3fec0 100644 --- a/source/blender/editors/interface/resources.c +++ b/source/blender/editors/interface/resources.c @@ -1976,9 +1976,9 @@ void init_userdef_do_versions(void) { bTheme *btheme; - for(btheme= U.themes.first; btheme; btheme= btheme->next) { - /* check for alpha==0 is safe, then color was never set */ - if(btheme->tv3d.freestyle_edge_mark[3]==0) { + for (btheme = U.themes.first; btheme; btheme = btheme->next) { + /* check for alpha == 0 is safe, then color was never set */ + if (btheme->tv3d.freestyle_edge_mark[3] == 0) { rgba_char_args_set(btheme->tv3d.freestyle_edge_mark, 0x7f, 0xff, 0x7f, 255); rgba_char_args_set(btheme->tv3d.freestyle_face_mark, 0x7f, 0xff, 0x7f, 51); } diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c index 3ff33b79f55..3f8f573cf07 100644 --- a/source/blender/editors/mesh/editmesh_tools.c +++ b/source/blender/editors/mesh/editmesh_tools.c @@ -1271,11 +1271,11 @@ static int edbm_vert_connect(bContext *C, wmOperator *op) } else { EDBM_selectmode_flush(em); /* so newly created edges get the selection state from the vertex */ - - EDBM_update_generic(C, em, TRUE); - return len ? OPERATOR_FINISHED : OPERATOR_CANCELLED; -} + EDBM_update_generic(C, em, TRUE); + + return len ? OPERATOR_FINISHED : OPERATOR_CANCELLED; + } } void MESH_OT_vert_connect(wmOperatorType *ot) @@ -5772,7 +5772,8 @@ static int edbm_mark_freestyle_edge(bContext *C, wmOperator *op) BMIter iter; int clear = RNA_boolean_get(op->ptr, "clear"); - if (em == NULL) return OPERATOR_FINISHED; + if (em == NULL) + return OPERATOR_FINISHED; /* auto-enable seams drawing */ if (clear == 0) { @@ -5865,4 +5866,3 @@ void MESH_OT_mark_freestyle_face(wmOperatorType *ot) RNA_def_boolean(ot->srna, "clear", 0, "Clear", ""); } - diff --git a/source/blender/editors/render/render_shading.c b/source/blender/editors/render/render_shading.c index 5e23015f194..928930c61f9 100644 --- a/source/blender/editors/render/render_shading.c +++ b/source/blender/editors/render/render_shading.c @@ -576,73 +576,74 @@ void SCENE_OT_render_layer_remove(wmOperatorType *ot) static int freestyle_module_add_exec(bContext *C, wmOperator *UNUSED(op)) { - Scene *scene= CTX_data_scene(C); - SceneRenderLayer *srl = (SceneRenderLayer*) BLI_findlink(&scene->r.layers, scene->r.actlay); + Scene *scene = CTX_data_scene(C); + SceneRenderLayer *srl = BLI_findlink(&scene->r.layers, scene->r.actlay); FRS_add_module(&srl->freestyleConfig); - WM_event_add_notifier(C, NC_SCENE|ND_RENDER_OPTIONS, scene); - + WM_event_add_notifier(C, NC_SCENE | ND_RENDER_OPTIONS, scene); + return OPERATOR_FINISHED; } void SCENE_OT_freestyle_module_add(wmOperatorType *ot) { /* identifiers */ - ot->name= "Add Freestyle Module"; - ot->idname= "SCENE_OT_freestyle_module_add"; - ot->description="Add a style module into the list of modules"; - + ot->name = "Add Freestyle Module"; + ot->idname = "SCENE_OT_freestyle_module_add"; + ot->description = "Add a style module into the list of modules"; + /* api callbacks */ - ot->exec= freestyle_module_add_exec; + ot->exec = freestyle_module_add_exec; /* flags */ - ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; } static int freestyle_module_remove_exec(bContext *C, wmOperator *UNUSED(op)) { - Scene *scene= CTX_data_scene(C); - SceneRenderLayer *srl = (SceneRenderLayer*) BLI_findlink(&scene->r.layers, scene->r.actlay); - PointerRNA ptr= CTX_data_pointer_get_type(C, "freestyle_module", &RNA_FreestyleModuleSettings); - FreestyleModuleConfig *module= ptr.data; + Scene *scene = CTX_data_scene(C); + SceneRenderLayer *srl = BLI_findlink(&scene->r.layers, scene->r.actlay); + PointerRNA ptr = CTX_data_pointer_get_type(C, "freestyle_module", &RNA_FreestyleModuleSettings); + FreestyleModuleConfig *module = ptr.data; FRS_delete_module(&srl->freestyleConfig, module); - WM_event_add_notifier(C, NC_SCENE|ND_RENDER_OPTIONS, scene); - + WM_event_add_notifier(C, NC_SCENE | ND_RENDER_OPTIONS, scene); + return OPERATOR_FINISHED; } void SCENE_OT_freestyle_module_remove(wmOperatorType *ot) { /* identifiers */ - ot->name= "Remove Freestyle Module"; - ot->idname= "SCENE_OT_freestyle_module_remove"; - ot->description="Remove the style module from the stack"; - + ot->name = "Remove Freestyle Module"; + ot->idname = "SCENE_OT_freestyle_module_remove"; + ot->description = "Remove the style module from the stack"; + /* api callbacks */ - ot->exec= freestyle_module_remove_exec; + ot->exec = freestyle_module_remove_exec; /* flags */ - ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; } static int freestyle_module_move_exec(bContext *C, wmOperator *op) { - Scene *scene= CTX_data_scene(C); - SceneRenderLayer *srl = (SceneRenderLayer*) BLI_findlink(&scene->r.layers, scene->r.actlay); - PointerRNA ptr= CTX_data_pointer_get_type(C, "freestyle_module", &RNA_FreestyleModuleSettings); - FreestyleModuleConfig *module= ptr.data; - int dir= RNA_enum_get(op->ptr, "direction"); + Scene *scene = CTX_data_scene(C); + SceneRenderLayer *srl = BLI_findlink(&scene->r.layers, scene->r.actlay); + PointerRNA ptr = CTX_data_pointer_get_type(C, "freestyle_module", &RNA_FreestyleModuleSettings); + FreestyleModuleConfig *module = ptr.data; + int dir = RNA_enum_get(op->ptr, "direction"); if (dir == 1) { FRS_move_module_up(&srl->freestyleConfig, module); - } else { + } + else { FRS_move_module_down(&srl->freestyleConfig, module); } - WM_event_add_notifier(C, NC_SCENE|ND_RENDER_OPTIONS, scene); - + WM_event_add_notifier(C, NC_SCENE | ND_RENDER_OPTIONS, scene); + return OPERATOR_FINISHED; } @@ -655,15 +656,15 @@ void SCENE_OT_freestyle_module_move(wmOperatorType *ot) }; /* identifiers */ - ot->name= "Move Freestyle Module"; - ot->idname= "SCENE_OT_freestyle_module_move"; - ot->description="Change the position of the style module within in the list of style modules"; - + ot->name = "Move Freestyle Module"; + ot->idname = "SCENE_OT_freestyle_module_move"; + ot->description = "Change the position of the style module within in the list of style modules"; + /* api callbacks */ - ot->exec= freestyle_module_move_exec; + ot->exec = freestyle_module_move_exec; /* flags */ - ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; /* props */ RNA_def_enum(ot->srna, "direction", direction_items, 0, "Direction", "Direction to move, UP or DOWN"); @@ -671,132 +672,133 @@ void SCENE_OT_freestyle_module_move(wmOperatorType *ot) static int freestyle_lineset_add_exec(bContext *C, wmOperator *UNUSED(op)) { - Scene *scene= CTX_data_scene(C); - SceneRenderLayer *srl = (SceneRenderLayer*) BLI_findlink(&scene->r.layers, scene->r.actlay); + Scene *scene = CTX_data_scene(C); + SceneRenderLayer *srl = BLI_findlink(&scene->r.layers, scene->r.actlay); FRS_add_lineset(&srl->freestyleConfig); - WM_event_add_notifier(C, NC_SCENE|ND_RENDER_OPTIONS, scene); - + WM_event_add_notifier(C, NC_SCENE | ND_RENDER_OPTIONS, scene); + return OPERATOR_FINISHED; } void SCENE_OT_freestyle_lineset_add(wmOperatorType *ot) { /* identifiers */ - ot->name= "Add Line Set"; - ot->idname= "SCENE_OT_freestyle_lineset_add"; - ot->description="Add a line set into the list of line sets"; - + ot->name = "Add Line Set"; + ot->idname = "SCENE_OT_freestyle_lineset_add"; + ot->description = "Add a line set into the list of line sets"; + /* api callbacks */ - ot->exec= freestyle_lineset_add_exec; + ot->exec = freestyle_lineset_add_exec; /* flags */ - ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; } static int freestyle_active_lineset_poll(bContext *C) { - Scene *scene= CTX_data_scene(C); - SceneRenderLayer *srl = (SceneRenderLayer*) BLI_findlink(&scene->r.layers, scene->r.actlay); + Scene *scene = CTX_data_scene(C); + SceneRenderLayer *srl = BLI_findlink(&scene->r.layers, scene->r.actlay); return FRS_get_active_lineset(&srl->freestyleConfig) != NULL; } static int freestyle_lineset_copy_exec(bContext *C, wmOperator *UNUSED(op)) { - Scene *scene= CTX_data_scene(C); - SceneRenderLayer *srl = (SceneRenderLayer*) BLI_findlink(&scene->r.layers, scene->r.actlay); + Scene *scene = CTX_data_scene(C); + SceneRenderLayer *srl = BLI_findlink(&scene->r.layers, scene->r.actlay); FRS_copy_active_lineset(&srl->freestyleConfig); - WM_event_add_notifier(C, NC_SCENE|ND_RENDER_OPTIONS, scene); - + WM_event_add_notifier(C, NC_SCENE | ND_RENDER_OPTIONS, scene); + return OPERATOR_FINISHED; } void SCENE_OT_freestyle_lineset_copy(wmOperatorType *ot) { /* identifiers */ - ot->name= "Copy Line Set"; - ot->idname= "SCENE_OT_freestyle_lineset_copy"; - ot->description="Copy the active line set to a buffer"; - + ot->name = "Copy Line Set"; + ot->idname = "SCENE_OT_freestyle_lineset_copy"; + ot->description = "Copy the active line set to a buffer"; + /* api callbacks */ - ot->exec= freestyle_lineset_copy_exec; - ot->poll= freestyle_active_lineset_poll; + ot->exec = freestyle_lineset_copy_exec; + ot->poll = freestyle_active_lineset_poll; /* flags */ - ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; } static int freestyle_lineset_paste_exec(bContext *C, wmOperator *UNUSED(op)) { - Scene *scene= CTX_data_scene(C); - SceneRenderLayer *srl = (SceneRenderLayer*) BLI_findlink(&scene->r.layers, scene->r.actlay); + Scene *scene = CTX_data_scene(C); + SceneRenderLayer *srl = BLI_findlink(&scene->r.layers, scene->r.actlay); FRS_paste_active_lineset(&srl->freestyleConfig); - WM_event_add_notifier(C, NC_SCENE|ND_RENDER_OPTIONS, scene); - + WM_event_add_notifier(C, NC_SCENE | ND_RENDER_OPTIONS, scene); + return OPERATOR_FINISHED; } void SCENE_OT_freestyle_lineset_paste(wmOperatorType *ot) { /* identifiers */ - ot->name= "Paste Line Set"; - ot->idname= "SCENE_OT_freestyle_lineset_paste"; - ot->description="Paste the buffer content to the active line set"; - + ot->name = "Paste Line Set"; + ot->idname = "SCENE_OT_freestyle_lineset_paste"; + ot->description = "Paste the buffer content to the active line set"; + /* api callbacks */ - ot->exec= freestyle_lineset_paste_exec; - ot->poll= freestyle_active_lineset_poll; + ot->exec = freestyle_lineset_paste_exec; + ot->poll = freestyle_active_lineset_poll; /* flags */ - ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; } static int freestyle_lineset_remove_exec(bContext *C, wmOperator *UNUSED(op)) { - Scene *scene= CTX_data_scene(C); - SceneRenderLayer *srl = (SceneRenderLayer*) BLI_findlink(&scene->r.layers, scene->r.actlay); + Scene *scene = CTX_data_scene(C); + SceneRenderLayer *srl = BLI_findlink(&scene->r.layers, scene->r.actlay); FRS_delete_active_lineset(&srl->freestyleConfig); - WM_event_add_notifier(C, NC_SCENE|ND_RENDER_OPTIONS, scene); - + WM_event_add_notifier(C, NC_SCENE | ND_RENDER_OPTIONS, scene); + return OPERATOR_FINISHED; } void SCENE_OT_freestyle_lineset_remove(wmOperatorType *ot) { /* identifiers */ - ot->name= "Remove Line Set"; - ot->idname= "SCENE_OT_freestyle_lineset_remove"; - ot->description="Remove the active line set from the list of line sets"; - + ot->name = "Remove Line Set"; + ot->idname = "SCENE_OT_freestyle_lineset_remove"; + ot->description = "Remove the active line set from the list of line sets"; + /* api callbacks */ - ot->exec= freestyle_lineset_remove_exec; - ot->poll= freestyle_active_lineset_poll; + ot->exec = freestyle_lineset_remove_exec; + ot->poll = freestyle_active_lineset_poll; /* flags */ - ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; } static int freestyle_lineset_move_exec(bContext *C, wmOperator *op) { - Scene *scene= CTX_data_scene(C); - SceneRenderLayer *srl = (SceneRenderLayer*) BLI_findlink(&scene->r.layers, scene->r.actlay); - int dir= RNA_enum_get(op->ptr, "direction"); + Scene *scene = CTX_data_scene(C); + SceneRenderLayer *srl = BLI_findlink(&scene->r.layers, scene->r.actlay); + int dir = RNA_enum_get(op->ptr, "direction"); if (dir == 1) { FRS_move_active_lineset_up(&srl->freestyleConfig); - } else { + } + else { FRS_move_active_lineset_down(&srl->freestyleConfig); } - WM_event_add_notifier(C, NC_SCENE|ND_RENDER_OPTIONS, scene); - + WM_event_add_notifier(C, NC_SCENE | ND_RENDER_OPTIONS, scene); + return OPERATOR_FINISHED; } @@ -809,16 +811,16 @@ void SCENE_OT_freestyle_lineset_move(wmOperatorType *ot) }; /* identifiers */ - ot->name= "Move Line Set"; - ot->idname= "SCENE_OT_freestyle_lineset_move"; - ot->description="Change the position of the active line set within the list of line sets"; - + ot->name = "Move Line Set"; + ot->idname = "SCENE_OT_freestyle_lineset_move"; + ot->description = "Change the position of the active line set within the list of line sets"; + /* api callbacks */ - ot->exec= freestyle_lineset_move_exec; - ot->poll= freestyle_active_lineset_poll; + ot->exec = freestyle_lineset_move_exec; + ot->poll = freestyle_active_lineset_poll; /* flags */ - ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; /* props */ RNA_def_enum(ot->srna, "direction", direction_items, 0, "Direction", "Direction to move, UP or DOWN"); @@ -826,191 +828,191 @@ void SCENE_OT_freestyle_lineset_move(wmOperatorType *ot) static int freestyle_linestyle_new_exec(bContext *C, wmOperator *op) { - Scene *scene= CTX_data_scene(C); - SceneRenderLayer *srl = (SceneRenderLayer*) BLI_findlink(&scene->r.layers, scene->r.actlay); + Scene *scene = CTX_data_scene(C); + SceneRenderLayer *srl = BLI_findlink(&scene->r.layers, scene->r.actlay); FreestyleLineSet *lineset = FRS_get_active_lineset(&srl->freestyleConfig); if (!lineset) { - BKE_report(op->reports, RPT_ERROR, "No active lineset to add a new line style to."); + BKE_report(op->reports, RPT_ERROR, "No active lineset to add a new line style to"); return OPERATOR_CANCELLED; } lineset->linestyle->id.us--; lineset->linestyle = FRS_copy_linestyle(lineset->linestyle); - WM_event_add_notifier(C, NC_SCENE|ND_RENDER_OPTIONS, scene); - + WM_event_add_notifier(C, NC_SCENE | ND_RENDER_OPTIONS, scene); + return OPERATOR_FINISHED; } void SCENE_OT_freestyle_linestyle_new(wmOperatorType *ot) { /* identifiers */ - ot->name= "New Line Style"; - ot->idname= "SCENE_OT_freestyle_linestyle_new"; - ot->description="Create a new line style, reusable by multiple line sets"; - + ot->name = "New Line Style"; + ot->idname = "SCENE_OT_freestyle_linestyle_new"; + ot->description = "Create a new line style, reusable by multiple line sets"; + /* api callbacks */ - ot->exec= freestyle_linestyle_new_exec; - ot->poll= freestyle_active_lineset_poll; + ot->exec = freestyle_linestyle_new_exec; + ot->poll = freestyle_active_lineset_poll; /* flags */ - ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; } static int freestyle_color_modifier_add_exec(bContext *C, wmOperator *op) { - Scene *scene= CTX_data_scene(C); - SceneRenderLayer *srl = (SceneRenderLayer*) BLI_findlink(&scene->r.layers, scene->r.actlay); + Scene *scene = CTX_data_scene(C); + SceneRenderLayer *srl = BLI_findlink(&scene->r.layers, scene->r.actlay); FreestyleLineSet *lineset = FRS_get_active_lineset(&srl->freestyleConfig); - int type= RNA_enum_get(op->ptr, "type"); + int type = RNA_enum_get(op->ptr, "type"); if (!lineset) { - BKE_report(op->reports, RPT_ERROR, "No active lineset and associated line style to add the modifier to."); + BKE_report(op->reports, RPT_ERROR, "No active lineset and associated line style to add the modifier to"); return OPERATOR_CANCELLED; } if (FRS_add_linestyle_color_modifier(lineset->linestyle, type) < 0) { BKE_report(op->reports, RPT_ERROR, "Unknown line color modifier type."); return OPERATOR_CANCELLED; } - WM_event_add_notifier(C, NC_SCENE|ND_RENDER_OPTIONS, scene); - + WM_event_add_notifier(C, NC_SCENE | ND_RENDER_OPTIONS, scene); + return OPERATOR_FINISHED; } void SCENE_OT_freestyle_color_modifier_add(wmOperatorType *ot) { /* identifiers */ - ot->name= "Add Line Color Modifier"; - ot->idname= "SCENE_OT_freestyle_color_modifier_add"; + ot->name = "Add Line Color Modifier"; + ot->idname = "SCENE_OT_freestyle_color_modifier_add"; ot->description = "Add a line color modifier to the line style associated with the active lineset"; - + /* api callbacks */ - ot->invoke= WM_menu_invoke; - ot->exec= freestyle_color_modifier_add_exec; - ot->poll= freestyle_active_lineset_poll; - + ot->invoke = WM_menu_invoke; + ot->exec = freestyle_color_modifier_add_exec; + ot->poll = freestyle_active_lineset_poll; + /* flags */ - ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; - + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; + /* properties */ - ot->prop= RNA_def_enum(ot->srna, "type", linestyle_color_modifier_type_items, 0, "Type", ""); + ot->prop = RNA_def_enum(ot->srna, "type", linestyle_color_modifier_type_items, 0, "Type", ""); } static int freestyle_alpha_modifier_add_exec(bContext *C, wmOperator *op) { - Scene *scene= CTX_data_scene(C); - SceneRenderLayer *srl = (SceneRenderLayer*) BLI_findlink(&scene->r.layers, scene->r.actlay); + Scene *scene = CTX_data_scene(C); + SceneRenderLayer *srl = BLI_findlink(&scene->r.layers, scene->r.actlay); FreestyleLineSet *lineset = FRS_get_active_lineset(&srl->freestyleConfig); - int type= RNA_enum_get(op->ptr, "type"); + int type = RNA_enum_get(op->ptr, "type"); if (!lineset) { - BKE_report(op->reports, RPT_ERROR, "No active lineset and associated line style to add the modifier to."); + BKE_report(op->reports, RPT_ERROR, "No active lineset and associated line style to add the modifier to"); return OPERATOR_CANCELLED; } if (FRS_add_linestyle_alpha_modifier(lineset->linestyle, type) < 0) { - BKE_report(op->reports, RPT_ERROR, "Unknown alpha transparency modifier type."); + BKE_report(op->reports, RPT_ERROR, "Unknown alpha transparency modifier type"); return OPERATOR_CANCELLED; } - WM_event_add_notifier(C, NC_SCENE|ND_RENDER_OPTIONS, scene); - + WM_event_add_notifier(C, NC_SCENE | ND_RENDER_OPTIONS, scene); + return OPERATOR_FINISHED; } void SCENE_OT_freestyle_alpha_modifier_add(wmOperatorType *ot) { /* identifiers */ - ot->name= "Add Alpha Transparency Modifier"; - ot->idname= "SCENE_OT_freestyle_alpha_modifier_add"; + ot->name = "Add Alpha Transparency Modifier"; + ot->idname = "SCENE_OT_freestyle_alpha_modifier_add"; ot->description = "Add an alpha transparency modifier to the line style associated with the active lineset"; - + /* api callbacks */ - ot->invoke= WM_menu_invoke; - ot->exec= freestyle_alpha_modifier_add_exec; - ot->poll= freestyle_active_lineset_poll; - + ot->invoke = WM_menu_invoke; + ot->exec = freestyle_alpha_modifier_add_exec; + ot->poll = freestyle_active_lineset_poll; + /* flags */ - ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; - + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; + /* properties */ - ot->prop= RNA_def_enum(ot->srna, "type", linestyle_alpha_modifier_type_items, 0, "Type", ""); + ot->prop = RNA_def_enum(ot->srna, "type", linestyle_alpha_modifier_type_items, 0, "Type", ""); } static int freestyle_thickness_modifier_add_exec(bContext *C, wmOperator *op) { - Scene *scene= CTX_data_scene(C); - SceneRenderLayer *srl = (SceneRenderLayer*) BLI_findlink(&scene->r.layers, scene->r.actlay); + Scene *scene = CTX_data_scene(C); + SceneRenderLayer *srl = BLI_findlink(&scene->r.layers, scene->r.actlay); FreestyleLineSet *lineset = FRS_get_active_lineset(&srl->freestyleConfig); - int type= RNA_enum_get(op->ptr, "type"); + int type = RNA_enum_get(op->ptr, "type"); if (!lineset) { - BKE_report(op->reports, RPT_ERROR, "No active lineset and associated line style to add the modifier to."); + BKE_report(op->reports, RPT_ERROR, "No active lineset and associated line style to add the modifier to"); return OPERATOR_CANCELLED; } if (FRS_add_linestyle_thickness_modifier(lineset->linestyle, type) < 0) { - BKE_report(op->reports, RPT_ERROR, "Unknown line thickness modifier type."); + BKE_report(op->reports, RPT_ERROR, "Unknown line thickness modifier type"); return OPERATOR_CANCELLED; } - WM_event_add_notifier(C, NC_SCENE|ND_RENDER_OPTIONS, scene); - + WM_event_add_notifier(C, NC_SCENE | ND_RENDER_OPTIONS, scene); + return OPERATOR_FINISHED; } void SCENE_OT_freestyle_thickness_modifier_add(wmOperatorType *ot) { /* identifiers */ - ot->name= "Add Line Thickness Modifier"; - ot->idname= "SCENE_OT_freestyle_thickness_modifier_add"; + ot->name = "Add Line Thickness Modifier"; + ot->idname = "SCENE_OT_freestyle_thickness_modifier_add"; ot->description = "Add a line thickness modifier to the line style associated with the active lineset"; - + /* api callbacks */ - ot->invoke= WM_menu_invoke; - ot->exec= freestyle_thickness_modifier_add_exec; - ot->poll= freestyle_active_lineset_poll; - + ot->invoke = WM_menu_invoke; + ot->exec = freestyle_thickness_modifier_add_exec; + ot->poll = freestyle_active_lineset_poll; + /* flags */ - ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; - + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; + /* properties */ - ot->prop= RNA_def_enum(ot->srna, "type", linestyle_thickness_modifier_type_items, 0, "Type", ""); + ot->prop = RNA_def_enum(ot->srna, "type", linestyle_thickness_modifier_type_items, 0, "Type", ""); } static int freestyle_geometry_modifier_add_exec(bContext *C, wmOperator *op) { - Scene *scene= CTX_data_scene(C); - SceneRenderLayer *srl = (SceneRenderLayer*) BLI_findlink(&scene->r.layers, scene->r.actlay); + Scene *scene = CTX_data_scene(C); + SceneRenderLayer *srl = BLI_findlink(&scene->r.layers, scene->r.actlay); FreestyleLineSet *lineset = FRS_get_active_lineset(&srl->freestyleConfig); - int type= RNA_enum_get(op->ptr, "type"); + int type = RNA_enum_get(op->ptr, "type"); if (!lineset) { - BKE_report(op->reports, RPT_ERROR, "No active lineset and associated line style to add the modifier to."); + BKE_report(op->reports, RPT_ERROR, "No active lineset and associated line style to add the modifier to"); return OPERATOR_CANCELLED; } if (FRS_add_linestyle_geometry_modifier(lineset->linestyle, type) < 0) { - BKE_report(op->reports, RPT_ERROR, "Unknown stroke geometry modifier type."); + BKE_report(op->reports, RPT_ERROR, "Unknown stroke geometry modifier type"); return OPERATOR_CANCELLED; } - WM_event_add_notifier(C, NC_SCENE|ND_RENDER_OPTIONS, scene); - + WM_event_add_notifier(C, NC_SCENE | ND_RENDER_OPTIONS, scene); + return OPERATOR_FINISHED; } void SCENE_OT_freestyle_geometry_modifier_add(wmOperatorType *ot) { /* identifiers */ - ot->name= "Add Stroke Geometry Modifier"; - ot->idname= "SCENE_OT_freestyle_geometry_modifier_add"; + ot->name = "Add Stroke Geometry Modifier"; + ot->idname = "SCENE_OT_freestyle_geometry_modifier_add"; ot->description = "Add a stroke geometry modifier to the line style associated with the active lineset"; - + /* api callbacks */ - ot->invoke= WM_menu_invoke; - ot->exec= freestyle_geometry_modifier_add_exec; - ot->poll= freestyle_active_lineset_poll; - + ot->invoke = WM_menu_invoke; + ot->exec = freestyle_geometry_modifier_add_exec; + ot->poll = freestyle_active_lineset_poll; + /* flags */ - ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; - + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; + /* properties */ - ot->prop= RNA_def_enum(ot->srna, "type", linestyle_geometry_modifier_type_items, 0, "Type", ""); + ot->prop = RNA_def_enum(ot->srna, "type", linestyle_geometry_modifier_type_items, 0, "Type", ""); } static int freestyle_get_modifier_type(PointerRNA *ptr) @@ -1028,16 +1030,17 @@ static int freestyle_get_modifier_type(PointerRNA *ptr) static int freestyle_modifier_remove_exec(bContext *C, wmOperator *op) { - Scene *scene= CTX_data_scene(C); - SceneRenderLayer *srl = (SceneRenderLayer*) BLI_findlink(&scene->r.layers, scene->r.actlay); + Scene *scene = CTX_data_scene(C); + SceneRenderLayer *srl = BLI_findlink(&scene->r.layers, scene->r.actlay); FreestyleLineSet *lineset = FRS_get_active_lineset(&srl->freestyleConfig); - PointerRNA ptr= CTX_data_pointer_get_type(C, "modifier", &RNA_LineStyleModifier); - LineStyleModifier *modifier= ptr.data; + PointerRNA ptr = CTX_data_pointer_get_type(C, "modifier", &RNA_LineStyleModifier); + LineStyleModifier *modifier = ptr.data; if (!lineset) { - BKE_report(op->reports, RPT_ERROR, "No active lineset and associated line style the modifier belongs to."); + BKE_report(op->reports, RPT_ERROR, "No active lineset and associated line style the modifier belongs to"); return OPERATOR_CANCELLED; } + switch (freestyle_get_modifier_type(&ptr)) { case LS_MODIFIER_TYPE_COLOR: FRS_remove_linestyle_color_modifier(lineset->linestyle, modifier); @@ -1052,93 +1055,93 @@ static int freestyle_modifier_remove_exec(bContext *C, wmOperator *op) FRS_remove_linestyle_geometry_modifier(lineset->linestyle, modifier); break; default: - BKE_report(op->reports, RPT_ERROR, "The object the data pointer refers to is not a valid modifier."); + BKE_report(op->reports, RPT_ERROR, "The object the data pointer refers to is not a valid modifier"); return OPERATOR_CANCELLED; } - WM_event_add_notifier(C, NC_SCENE|ND_RENDER_OPTIONS, scene); - + WM_event_add_notifier(C, NC_SCENE | ND_RENDER_OPTIONS, scene); + return OPERATOR_FINISHED; } void SCENE_OT_freestyle_modifier_remove(wmOperatorType *ot) { /* identifiers */ - ot->name= "Remove Modifier"; - ot->idname= "SCENE_OT_freestyle_modifier_remove"; - ot->description="Remove the modifier from the list of modifiers"; - + ot->name = "Remove Modifier"; + ot->idname = "SCENE_OT_freestyle_modifier_remove"; + ot->description = "Remove the modifier from the list of modifiers"; + /* api callbacks */ - ot->exec= freestyle_modifier_remove_exec; - ot->poll= freestyle_active_lineset_poll; + ot->exec = freestyle_modifier_remove_exec; + ot->poll = freestyle_active_lineset_poll; /* flags */ - ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; } static int freestyle_modifier_copy_exec(bContext *C, wmOperator *op) { - Scene *scene= CTX_data_scene(C); - SceneRenderLayer *srl = (SceneRenderLayer*) BLI_findlink(&scene->r.layers, scene->r.actlay); - FreestyleLineSet *lineset = FRS_get_active_lineset(&srl->freestyleConfig); - PointerRNA ptr= CTX_data_pointer_get_type(C, "modifier", &RNA_LineStyleModifier); - LineStyleModifier *modifier= ptr.data; - - if (!lineset) { - BKE_report(op->reports, RPT_ERROR, "No active lineset and associated line style the modifier belongs to."); - return OPERATOR_CANCELLED; - } - - switch (freestyle_get_modifier_type(&ptr)) { - case LS_MODIFIER_TYPE_COLOR: - FRS_copy_linestyle_color_modifier(lineset->linestyle, modifier); - break; - case LS_MODIFIER_TYPE_ALPHA: - FRS_copy_linestyle_alpha_modifier(lineset->linestyle, modifier); - break; - case LS_MODIFIER_TYPE_THICKNESS: - FRS_copy_linestyle_thickness_modifier(lineset->linestyle, modifier); - break; - case LS_MODIFIER_TYPE_GEOMETRY: - FRS_copy_linestyle_geometry_modifier(lineset->linestyle, modifier); - break; - default: - BKE_report(op->reports, RPT_ERROR, "The object the data pointer refers to is not a valid modifier."); - return OPERATOR_CANCELLED; - } - WM_event_add_notifier(C, NC_SCENE|ND_RENDER_OPTIONS, scene); - - return OPERATOR_FINISHED; + Scene *scene = CTX_data_scene(C); + SceneRenderLayer *srl = BLI_findlink(&scene->r.layers, scene->r.actlay); + FreestyleLineSet *lineset = FRS_get_active_lineset(&srl->freestyleConfig); + PointerRNA ptr = CTX_data_pointer_get_type(C, "modifier", &RNA_LineStyleModifier); + LineStyleModifier *modifier = ptr.data; + + if (!lineset) { + BKE_report(op->reports, RPT_ERROR, "No active lineset and associated line style the modifier belongs to"); + return OPERATOR_CANCELLED; + } + + switch (freestyle_get_modifier_type(&ptr)) { + case LS_MODIFIER_TYPE_COLOR: + FRS_copy_linestyle_color_modifier(lineset->linestyle, modifier); + break; + case LS_MODIFIER_TYPE_ALPHA: + FRS_copy_linestyle_alpha_modifier(lineset->linestyle, modifier); + break; + case LS_MODIFIER_TYPE_THICKNESS: + FRS_copy_linestyle_thickness_modifier(lineset->linestyle, modifier); + break; + case LS_MODIFIER_TYPE_GEOMETRY: + FRS_copy_linestyle_geometry_modifier(lineset->linestyle, modifier); + break; + default: + BKE_report(op->reports, RPT_ERROR, "The object the data pointer refers to is not a valid modifier"); + return OPERATOR_CANCELLED; + } + WM_event_add_notifier(C, NC_SCENE | ND_RENDER_OPTIONS, scene); + return OPERATOR_FINISHED; } void SCENE_OT_freestyle_modifier_copy(wmOperatorType *ot) { - /* identifiers */ - ot->name= "Copy Modifier"; - ot->idname= "SCENE_OT_freestyle_modifier_copy"; - ot->description="Duplicate the modifier within the list of modifiers"; + /* identifiers */ + ot->name = "Copy Modifier"; + ot->idname = "SCENE_OT_freestyle_modifier_copy"; + ot->description = "Duplicate the modifier within the list of modifiers"; - /* api callbacks */ - ot->exec= freestyle_modifier_copy_exec; - ot->poll= freestyle_active_lineset_poll; + /* api callbacks */ + ot->exec = freestyle_modifier_copy_exec; + ot->poll = freestyle_active_lineset_poll; - /* flags */ - ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; + /* flags */ + ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO; } static int freestyle_modifier_move_exec(bContext *C, wmOperator *op) { - Scene *scene= CTX_data_scene(C); - SceneRenderLayer *srl = (SceneRenderLayer*) BLI_findlink(&scene->r.layers, scene->r.actlay); + Scene *scene = CTX_data_scene(C); + SceneRenderLayer *srl = BLI_findlink(&scene->r.layers, scene->r.actlay); FreestyleLineSet *lineset = FRS_get_active_lineset(&srl->freestyleConfig); - PointerRNA ptr= CTX_data_pointer_get_type(C, "modifier", &RNA_LineStyleModifier); - LineStyleModifier *modifier= ptr.data; - int dir= RNA_enum_get(op->ptr, "direction"); + PointerRNA ptr = CTX_data_pointer_get_type(C, "modifier", &RNA_LineStyleModifier); + LineStyleModifier *modifier = ptr.data; + int dir = RNA_enum_get(op->ptr, "direction"); if (!lineset) { - BKE_report(op->reports, RPT_ERROR, "No active lineset and associated line style the modifier belongs to."); + BKE_report(op->reports, RPT_ERROR, "No active lineset and associated line style the modifier belongs to"); return OPERATOR_CANCELLED; } + switch (freestyle_get_modifier_type(&ptr)) { case LS_MODIFIER_TYPE_COLOR: FRS_move_linestyle_color_modifier(lineset->linestyle, modifier, dir); @@ -1153,11 +1156,11 @@ static int freestyle_modifier_move_exec(bContext *C, wmOperator *op) FRS_move_linestyle_geometry_modifier(lineset->linestyle, modifier, dir); break; default: - BKE_report(op->reports, RPT_ERROR, "The object the data pointer refers to is not a valid modifier."); + BKE_report(op->reports, RPT_ERROR, "The object the data pointer refers to is not a valid modifier"); return OPERATOR_CANCELLED; } - WM_event_add_notifier(C, NC_SCENE|ND_RENDER_OPTIONS, scene); - + WM_event_add_notifier(C, NC_SCENE | ND_RENDER_OPTIONS, scene); + return OPERATOR_FINISHED; } @@ -1170,16 +1173,16 @@ void SCENE_OT_freestyle_modifier_move(wmOperatorType *ot) }; /* identifiers */ - ot->name= "Move Modifier"; - ot->idname= "SCENE_OT_freestyle_modifier_move"; - ot->description="Move the modifier within the list of modifiers"; - + ot->name = "Move Modifier"; + ot->idname = "SCENE_OT_freestyle_modifier_move"; + ot->description = "Move the modifier within the list of modifiers"; + /* api callbacks */ - ot->exec= freestyle_modifier_move_exec; - ot->poll= freestyle_active_lineset_poll; + ot->exec = freestyle_modifier_move_exec; + ot->poll = freestyle_active_lineset_poll; /* flags */ - ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; /* props */ RNA_def_enum(ot->srna, "direction", direction_items, 0, "Direction", "Direction to move, UP or DOWN"); diff --git a/source/blender/editors/space_buttons/space_buttons.c b/source/blender/editors/space_buttons/space_buttons.c index 95a5bbdf5c8..698139e90bf 100644 --- a/source/blender/editors/space_buttons/space_buttons.c +++ b/source/blender/editors/space_buttons/space_buttons.c @@ -380,7 +380,7 @@ static void buttons_area_listener(ScrArea *sa, wmNotifier *wmn) break; case NC_LINESTYLE: ED_area_tag_redraw(sa); - sbuts->preview= 1; + sbuts->preview = 1; break; } diff --git a/source/blender/editors/space_file/filelist.c b/source/blender/editors/space_file/filelist.c index 2fc312b6205..5b21ebf1742 100644 --- a/source/blender/editors/space_file/filelist.c +++ b/source/blender/editors/space_file/filelist.c @@ -1193,7 +1193,7 @@ void filelist_from_main(struct FileList *filelist) filelist->filelist[21].relname = BLI_strdup("Action"); filelist->filelist[22].relname = BLI_strdup("NodeTree"); filelist->filelist[23].relname = BLI_strdup("Speaker"); - filelist->filelist[24].relname= BLI_strdup("FreestyleLineStyle"); + filelist->filelist[24].relname = BLI_strdup("FreestyleLineStyle"); filelist_sort(filelist, FILE_SORT_ALPHA); } else { diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c index f93cfa25120..6145fec7e51 100644 --- a/source/blender/editors/transform/transform.c +++ b/source/blender/editors/transform/transform.c @@ -836,6 +836,9 @@ int transformEvent(TransInfo *t, wmEvent *event) t->redraw |= handleMouseInput(t, &t->mouse, event); if (event->type == MOUSEMOVE) { + if (t->modifiers & MOD_CONSTRAINT_SELECT) + t->con.mode |= CON_SELECT; + copy_v2_v2_int(t->mval, event->mval); // t->redraw |= TREDRAW_SOFT; /* Use this for soft redraw. Might cause flicker in object mode */ @@ -2037,9 +2040,6 @@ void transformApply(bContext *C, TransInfo *t) t->context = C; if ((t->redraw & TREDRAW_HARD) || (t->draw_handle_apply == NULL && (t->redraw & TREDRAW_SOFT))) { - if (t->modifiers & MOD_CONSTRAINT_SELECT) - t->con.mode |= CON_SELECT; - selectConstraint(t); if (t->transform) { t->transform(t, t->mval); // calls recalcData() |