diff options
author | Campbell Barton <ideasman42@gmail.com> | 2013-03-28 02:24:38 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2013-03-28 02:24:38 +0400 |
commit | f13829c7826e61c14d78f20bd347228f01367706 (patch) | |
tree | b4ccd417411dbbcef50187169a285ce5953578af /source/blender/editors | |
parent | 765a10a8cdaa09ba7ffb06139c05255948d41518 (diff) | |
parent | d15d78a33a8df76b02fa0d27dacd85c8a77ec109 (diff) |
svn merge ^/trunk/blender -r55594:55635
Diffstat (limited to 'source/blender/editors')
35 files changed, 334 insertions, 132 deletions
diff --git a/source/blender/editors/gpencil/gpencil_edit.c b/source/blender/editors/gpencil/gpencil_edit.c index e4c7a1edbcb..ad32c5fcccf 100644 --- a/source/blender/editors/gpencil/gpencil_edit.c +++ b/source/blender/editors/gpencil/gpencil_edit.c @@ -43,6 +43,8 @@ #include "BLI_rand.h" #include "BLI_utildefines.h" +#include "BLF_translation.h" + #include "DNA_anim_types.h" #include "DNA_curve_types.h" #include "DNA_object_types.h" @@ -229,7 +231,7 @@ static int gp_data_add_exec(bContext *C, wmOperator *op) bGPdata *gpd = (*gpd_ptr); id_us_min(&gpd->id); - *gpd_ptr = gpencil_data_addnew("GPencil"); + *gpd_ptr = gpencil_data_addnew(DATA_("GPencil")); } /* notifiers */ @@ -312,10 +314,10 @@ static int gp_layer_add_exec(bContext *C, wmOperator *op) return OPERATOR_CANCELLED; } if (*gpd_ptr == NULL) - *gpd_ptr = gpencil_data_addnew("GPencil"); - + *gpd_ptr = gpencil_data_addnew(DATA_("GPencil")); + /* add new layer now */ - gpencil_layer_addnew(*gpd_ptr, "GP_Layer", 1); + gpencil_layer_addnew(*gpd_ptr, DATA_("GP_Layer"), 1); /* notifiers */ WM_event_add_notifier(C, NC_GPENCIL | ND_DATA | NA_EDITED, NULL); diff --git a/source/blender/editors/render/CMakeLists.txt b/source/blender/editors/render/CMakeLists.txt index b858d715cfe..f628b2bb210 100644 --- a/source/blender/editors/render/CMakeLists.txt +++ b/source/blender/editors/render/CMakeLists.txt @@ -75,4 +75,8 @@ if(WITH_FREESTYLE) add_definitions(-DWITH_FREESTYLE) endif() +if(WITH_INTERNATIONAL) + add_definitions(-DWITH_INTERNATIONAL) +endif() + blender_add_lib(bf_editor_render "${SRC}" "${INC}" "${INC_SYS}") diff --git a/source/blender/editors/render/SConscript b/source/blender/editors/render/SConscript index 25af8080d51..4c5da4dc78a 100644 --- a/source/blender/editors/render/SConscript +++ b/source/blender/editors/render/SConscript @@ -35,6 +35,8 @@ incs += ' ../../gpu' incs += ' ../../makesrna ../../render/extern/include #/intern/elbeem/extern' incs += ' ../../blenloader ../../bmesh ../../blenfont' +defs = [] + if env['OURPLATFORM'] == 'linux': cflags='-pthread' incs += ' ../../../extern/binreloc/include' @@ -57,4 +59,7 @@ if env['OURPLATFORM'] == 'darwin': if env['WITH_BF_OPENMP']: env.Append(CFLAGS=['-DPARALLEL=1']) -env.BlenderLib ( 'bf_editors_render', sources, Split(incs), [], libtype=['core'], priority=[45]) +if env['WITH_BF_INTERNATIONAL']: + defs.append('WITH_INTERNATIONAL') + +env.BlenderLib('bf_editors_render', sources, Split(incs), defs, libtype=['core'], priority=[45]) diff --git a/source/blender/editors/render/render_shading.c b/source/blender/editors/render/render_shading.c index 87d83f820c9..5652d4c4b71 100644 --- a/source/blender/editors/render/render_shading.c +++ b/source/blender/editors/render/render_shading.c @@ -435,10 +435,12 @@ static int new_texture_exec(bContext *C, wmOperator *UNUSED(op)) PropertyRNA *prop; /* add or copy texture */ - if (tex) + if (tex) { tex = BKE_texture_copy(tex); - else + } + else { tex = add_texture(bmain, DATA_("Texture")); + } /* hook into UI */ uiIDContextProperty(C, &ptr, &prop); @@ -487,7 +489,7 @@ static int new_world_exec(bContext *C, wmOperator *UNUSED(op)) wo = BKE_world_copy(wo); } else { - wo = add_world(bmain, "World"); + wo = add_world(bmain, DATA_("World")); if (BKE_scene_use_new_shading_nodes(scene)) { ED_node_shader_default(C, &wo->id); diff --git a/source/blender/editors/sculpt_paint/paint_image_2d.c b/source/blender/editors/sculpt_paint/paint_image_2d.c index 9bc232c6a61..a45209de643 100644 --- a/source/blender/editors/sculpt_paint/paint_image_2d.c +++ b/source/blender/editors/sculpt_paint/paint_image_2d.c @@ -345,6 +345,7 @@ static void brush_painter_2d_refresh_cache(BrushPainter *painter, const float po const int diameter = 2 * BKE_brush_size_get(scene, brush); const float alpha = BKE_brush_alpha_get(scene, brush); const bool do_tiled = ELEM(brush->mtex.brush_map_mode, MTEX_MAP_MODE_TILED, MTEX_MAP_MODE_3D); + const bool do_random = brush->mtex.brush_map_mode == MTEX_MAP_MODE_RANDOM; float rotation = -mtex->rot; if (mtex->brush_map_mode == MTEX_MAP_MODE_VIEW) { @@ -354,7 +355,8 @@ static void brush_painter_2d_refresh_cache(BrushPainter *painter, const float po if (diameter != cache->lastsize || alpha != cache->lastalpha || brush->jitter != cache->lastjitter || - rotation != cache->last_rotation) + rotation != cache->last_rotation || + do_random) { if (cache->ibuf) { IMB_freeImBuf(cache->ibuf); diff --git a/source/blender/editors/sculpt_paint/paint_stroke.c b/source/blender/editors/sculpt_paint/paint_stroke.c index d7e2d010f03..ca48524096a 100644 --- a/source/blender/editors/sculpt_paint/paint_stroke.c +++ b/source/blender/editors/sculpt_paint/paint_stroke.c @@ -188,13 +188,10 @@ static void paint_brush_update(bContext *C, Brush *brush, PaintMode mode, ups->brush_rotation = 0.0f; } - if ((brush->mtex.brush_map_mode == MTEX_MAP_MODE_RANDOM)) { - ups->tex_mouse[0] = BLI_frand() * stroke->vc.ar->sizex; - ups->tex_mouse[1] = BLI_frand() * stroke->vc.ar->sizey;; - } - else { + if ((brush->mtex.brush_map_mode == MTEX_MAP_MODE_RANDOM)) + BKE_brush_randomize_texture_coordinates(ups); + else copy_v2_v2(ups->tex_mouse, mouse); - } } if (brush->flag & BRUSH_ANCHORED) { diff --git a/source/blender/editors/space_buttons/buttons_context.c b/source/blender/editors/space_buttons/buttons_context.c index 95d43fd334e..072ea504b9f 100644 --- a/source/blender/editors/space_buttons/buttons_context.c +++ b/source/blender/editors/space_buttons/buttons_context.c @@ -1073,6 +1073,7 @@ void buttons_context_register(ARegionType *art) pt = MEM_callocN(sizeof(PanelType), "spacetype buttons panel context"); strcpy(pt->idname, "BUTTONS_PT_context"); strcpy(pt->label, N_("Context")); /* XXX C panels are not available through RNA (bpy.types)! */ + strcpy(pt->translation_context, BLF_I18NCONTEXT_DEFAULT_BPYRNA); pt->draw = buttons_panel_context; pt->flag = PNL_NO_HEADER; BLI_addtail(&art->paneltypes, pt); diff --git a/source/blender/editors/space_clip/clip_buttons.c b/source/blender/editors/space_clip/clip_buttons.c index 9409ce42d3a..8d863193b76 100644 --- a/source/blender/editors/space_clip/clip_buttons.c +++ b/source/blender/editors/space_clip/clip_buttons.c @@ -79,7 +79,8 @@ void ED_clip_buttons_register(ARegionType *art) pt = MEM_callocN(sizeof(PanelType), "spacetype clip panel gpencil"); strcpy(pt->idname, "CLIP_PT_gpencil"); - strcpy(pt->label, "Grease Pencil"); + strcpy(pt->label, N_("Grease Pencil")); + strcpy(pt->translation_context, BLF_I18NCONTEXT_DEFAULT_BPYRNA); pt->draw_header = gpencil_panel_standard_header; pt->draw = gpencil_panel_standard; pt->flag |= PNL_DEFAULT_CLOSED; diff --git a/source/blender/editors/space_clip/clip_editor.c b/source/blender/editors/space_clip/clip_editor.c index 05e05b95967..b00cc564a99 100644 --- a/source/blender/editors/space_clip/clip_editor.c +++ b/source/blender/editors/space_clip/clip_editor.c @@ -1142,6 +1142,9 @@ static bool prefetch_check_early_out(const bContext *C) if ((user->render_flag & MCLIP_PROXY_RENDER_UNDISTORT) == 0) return true; } + else { + return true; + } } clip_len = BKE_movieclip_get_duration(clip); diff --git a/source/blender/editors/space_clip/clip_toolbar.c b/source/blender/editors/space_clip/clip_toolbar.c index 10175d07300..42300f88a4f 100644 --- a/source/blender/editors/space_clip/clip_toolbar.c +++ b/source/blender/editors/space_clip/clip_toolbar.c @@ -257,7 +257,8 @@ void ED_clip_tool_props_register(ARegionType *art) pt = MEM_callocN(sizeof(PanelType), "spacetype clip panel last operator"); strcpy(pt->idname, "CLIP_PT_last_operator"); - strcpy(pt->label, "Operator"); + strcpy(pt->label, N_("Operator")); + strcpy(pt->translation_context, BLF_I18NCONTEXT_DEFAULT_BPYRNA); pt->draw_header = clip_panel_operator_redo_header; pt->draw = clip_panel_operator_redo; BLI_addtail(&art->paneltypes, pt); diff --git a/source/blender/editors/space_file/file_panels.c b/source/blender/editors/space_file/file_panels.c index 9a7f528be78..35179511563 100644 --- a/source/blender/editors/space_file/file_panels.c +++ b/source/blender/editors/space_file/file_panels.c @@ -219,30 +219,35 @@ void file_panels_register(ARegionType *art) pt = MEM_callocN(sizeof(PanelType), "spacetype file system directories"); strcpy(pt->idname, "FILE_PT_system"); strcpy(pt->label, N_("System")); + strcpy(pt->translation_context, BLF_I18NCONTEXT_DEFAULT_BPYRNA); pt->draw = file_panel_system; BLI_addtail(&art->paneltypes, pt); pt = MEM_callocN(sizeof(PanelType), "spacetype file system bookmarks"); strcpy(pt->idname, "FILE_PT_system_bookmarks"); strcpy(pt->label, N_("System Bookmarks")); + strcpy(pt->translation_context, BLF_I18NCONTEXT_DEFAULT_BPYRNA); pt->draw = file_panel_system_bookmarks; BLI_addtail(&art->paneltypes, pt); pt = MEM_callocN(sizeof(PanelType), "spacetype file bookmarks"); strcpy(pt->idname, "FILE_PT_bookmarks"); strcpy(pt->label, N_("Bookmarks")); + strcpy(pt->translation_context, BLF_I18NCONTEXT_DEFAULT_BPYRNA); pt->draw = file_panel_bookmarks; BLI_addtail(&art->paneltypes, pt); pt = MEM_callocN(sizeof(PanelType), "spacetype file recent directories"); strcpy(pt->idname, "FILE_PT_recent"); strcpy(pt->label, N_("Recent")); + strcpy(pt->translation_context, BLF_I18NCONTEXT_DEFAULT_BPYRNA); pt->draw = file_panel_recent; BLI_addtail(&art->paneltypes, pt); pt = MEM_callocN(sizeof(PanelType), "spacetype file operator properties"); strcpy(pt->idname, "FILE_PT_operator"); strcpy(pt->label, N_("Operator")); + strcpy(pt->translation_context, BLF_I18NCONTEXT_DEFAULT_BPYRNA); pt->poll = file_panel_operator_poll; pt->draw_header = file_panel_operator_header; pt->draw = file_panel_operator; diff --git a/source/blender/editors/space_graph/graph_buttons.c b/source/blender/editors/space_graph/graph_buttons.c index f1501857b13..f7ec8e8682d 100644 --- a/source/blender/editors/space_graph/graph_buttons.c +++ b/source/blender/editors/space_graph/graph_buttons.c @@ -803,6 +803,7 @@ void graph_buttons_register(ARegionType *art) pt = MEM_callocN(sizeof(PanelType), "spacetype graph panel view"); strcpy(pt->idname, "GRAPH_PT_view"); strcpy(pt->label, N_("View Properties")); + strcpy(pt->translation_context, BLF_I18NCONTEXT_DEFAULT_BPYRNA); pt->draw = graph_panel_view; pt->flag |= PNL_DEFAULT_CLOSED; BLI_addtail(&art->paneltypes, pt); @@ -810,6 +811,7 @@ void graph_buttons_register(ARegionType *art) pt = MEM_callocN(sizeof(PanelType), "spacetype graph panel properties"); strcpy(pt->idname, "GRAPH_PT_properties"); strcpy(pt->label, N_("Active F-Curve")); + strcpy(pt->translation_context, BLF_I18NCONTEXT_DEFAULT_BPYRNA); pt->draw = graph_panel_properties; pt->poll = graph_panel_poll; BLI_addtail(&art->paneltypes, pt); @@ -817,6 +819,7 @@ void graph_buttons_register(ARegionType *art) pt = MEM_callocN(sizeof(PanelType), "spacetype graph panel properties"); strcpy(pt->idname, "GRAPH_PT_key_properties"); strcpy(pt->label, N_("Active Keyframe")); + strcpy(pt->translation_context, BLF_I18NCONTEXT_DEFAULT_BPYRNA); pt->draw = graph_panel_key_properties; pt->poll = graph_panel_poll; BLI_addtail(&art->paneltypes, pt); @@ -825,6 +828,7 @@ void graph_buttons_register(ARegionType *art) pt = MEM_callocN(sizeof(PanelType), "spacetype graph panel drivers"); strcpy(pt->idname, "GRAPH_PT_drivers"); strcpy(pt->label, N_("Drivers")); + strcpy(pt->translation_context, BLF_I18NCONTEXT_DEFAULT_BPYRNA); pt->draw = graph_panel_drivers; pt->poll = graph_panel_drivers_poll; BLI_addtail(&art->paneltypes, pt); @@ -832,6 +836,7 @@ void graph_buttons_register(ARegionType *art) pt = MEM_callocN(sizeof(PanelType), "spacetype graph panel modifiers"); strcpy(pt->idname, "GRAPH_PT_modifiers"); strcpy(pt->label, N_("Modifiers")); + strcpy(pt->translation_context, BLF_I18NCONTEXT_DEFAULT_BPYRNA); pt->draw = graph_panel_modifiers; pt->poll = graph_panel_poll; BLI_addtail(&art->paneltypes, pt); diff --git a/source/blender/editors/space_image/image_buttons.c b/source/blender/editors/space_image/image_buttons.c index 70001b59528..5398f886396 100644 --- a/source/blender/editors/space_image/image_buttons.c +++ b/source/blender/editors/space_image/image_buttons.c @@ -880,7 +880,8 @@ void image_buttons_register(ARegionType *art) pt = MEM_callocN(sizeof(PanelType), "spacetype image panel gpencil"); strcpy(pt->idname, "IMAGE_PT_gpencil"); - strcpy(pt->label, "Grease Pencil"); + strcpy(pt->label, N_("Grease Pencil")); + strcpy(pt->translation_context, BLF_I18NCONTEXT_DEFAULT_BPYRNA); pt->draw_header = gpencil_panel_standard_header; pt->draw = gpencil_panel_standard; BLI_addtail(&art->paneltypes, pt); diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c index 7e0767bfcfb..4a78c54e9c0 100644 --- a/source/blender/editors/space_image/image_ops.c +++ b/source/blender/editors/space_image/image_ops.c @@ -1707,6 +1707,7 @@ void IMAGE_OT_reload(wmOperatorType *ot) } /********************** new image operator *********************/ +#define IMA_DEF_NAME N_("Untitled") static int image_new_exec(bContext *C, wmOperator *op) { @@ -1717,7 +1718,8 @@ static int image_new_exec(bContext *C, wmOperator *op) Main *bmain; PointerRNA ptr, idptr; PropertyRNA *prop; - char name[MAX_ID_NAME - 2]; + char _name[MAX_ID_NAME - 2]; + char *name = _name; float color[4]; int width, height, floatbuf, gen_type, alpha; @@ -1727,7 +1729,12 @@ static int image_new_exec(bContext *C, wmOperator *op) obedit = CTX_data_edit_object(C); bmain = CTX_data_main(C); - RNA_string_get(op->ptr, "name", name); + prop = RNA_struct_find_property(op->ptr, "name"); + RNA_property_string_get(op->ptr, prop, name); + if (!RNA_property_is_set(op->ptr, prop)) { + /* Default value, we can translate! */ + name = (char *)DATA_(name); + } width = RNA_int_get(op->ptr, "width"); height = RNA_int_get(op->ptr, "height"); floatbuf = RNA_boolean_get(op->ptr, "float"); @@ -1775,8 +1782,9 @@ static int image_new_exec(bContext *C, wmOperator *op) /* XXX Note: the WM_operator_props_dialog_popup() doesn't work for uiIDContextProperty(), image is not being that way */ static int image_new_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(event)) { + /* Better for user feedback. */ + RNA_string_set(op->ptr, "name", DATA_(IMA_DEF_NAME)); return WM_operator_props_dialog_popup(C, op, 15 * UI_UNIT_X, 5 * UI_UNIT_Y); - } void IMAGE_OT_new(wmOperatorType *ot) @@ -1797,7 +1805,7 @@ void IMAGE_OT_new(wmOperatorType *ot) ot->flag = OPTYPE_UNDO; /* properties */ - RNA_def_string(ot->srna, "name", "untitled", MAX_ID_NAME - 2, "Name", "Image datablock name"); + RNA_def_string(ot->srna, "name", IMA_DEF_NAME, MAX_ID_NAME - 2, "Name", "Image datablock name"); RNA_def_int(ot->srna, "width", 1024, 1, INT_MAX, "Width", "Image width", 1, 16384); RNA_def_int(ot->srna, "height", 1024, 1, INT_MAX, "Height", "Image height", 1, 16384); prop = RNA_def_float_color(ot->srna, "color", 4, NULL, 0.0f, FLT_MAX, "Color", "Default fill color", 0.0f, 1.0f); @@ -1809,6 +1817,8 @@ void IMAGE_OT_new(wmOperatorType *ot) RNA_def_boolean(ot->srna, "float", 0, "32 bit Float", "Create image with 32 bit floating point bit depth"); } +#undef IMA_DEF_NAME + /********************* invert operators *********************/ static int image_invert_poll(bContext *C) diff --git a/source/blender/editors/space_info/space_info.c b/source/blender/editors/space_info/space_info.c index 1577ac338e7..a3eb7c06876 100644 --- a/source/blender/editors/space_info/space_info.c +++ b/source/blender/editors/space_info/space_info.c @@ -300,6 +300,7 @@ static void recent_files_menu_register(void) mt = MEM_callocN(sizeof(MenuType), "spacetype info menu recent files"); strcpy(mt->idname, "INFO_MT_file_open_recent"); strcpy(mt->label, N_("Open Recent...")); + strcpy(mt->translation_context, BLF_I18NCONTEXT_DEFAULT_BPYRNA); mt->draw = recent_files_menu_draw; WM_menutype_add(mt); } diff --git a/source/blender/editors/space_nla/nla_buttons.c b/source/blender/editors/space_nla/nla_buttons.c index b26d1662f6c..3a9336e7acc 100644 --- a/source/blender/editors/space_nla/nla_buttons.c +++ b/source/blender/editors/space_nla/nla_buttons.c @@ -502,7 +502,8 @@ void nla_buttons_register(ARegionType *art) pt = MEM_callocN(sizeof(PanelType), "spacetype nla panel animdata"); strcpy(pt->idname, "NLA_PT_animdata"); - strcpy(pt->label, "Animation Data"); + strcpy(pt->label, N_("Animation Data")); + strcpy(pt->translation_context, BLF_I18NCONTEXT_DEFAULT_BPYRNA); pt->draw = nla_panel_animdata; pt->poll = nla_animdata_panel_poll; pt->flag = PNL_DEFAULT_CLOSED; @@ -510,35 +511,40 @@ void nla_buttons_register(ARegionType *art) pt = MEM_callocN(sizeof(PanelType), "spacetype nla panel track"); strcpy(pt->idname, "NLA_PT_track"); - strcpy(pt->label, "Active Track"); + strcpy(pt->label, N_("Active Track")); + strcpy(pt->translation_context, BLF_I18NCONTEXT_DEFAULT_BPYRNA); pt->draw = nla_panel_track; pt->poll = nla_track_panel_poll; BLI_addtail(&art->paneltypes, pt); pt = MEM_callocN(sizeof(PanelType), "spacetype nla panel properties"); strcpy(pt->idname, "NLA_PT_properties"); - strcpy(pt->label, "Active Strip"); + strcpy(pt->label, N_("Active Strip")); + strcpy(pt->translation_context, BLF_I18NCONTEXT_DEFAULT_BPYRNA); pt->draw = nla_panel_properties; pt->poll = nla_strip_panel_poll; BLI_addtail(&art->paneltypes, pt); pt = MEM_callocN(sizeof(PanelType), "spacetype nla panel properties"); strcpy(pt->idname, "NLA_PT_actionclip"); - strcpy(pt->label, "Action Clip"); + strcpy(pt->label, N_("Action Clip")); + strcpy(pt->translation_context, BLF_I18NCONTEXT_DEFAULT_BPYRNA); pt->draw = nla_panel_actclip; pt->poll = nla_strip_actclip_panel_poll; BLI_addtail(&art->paneltypes, pt); pt = MEM_callocN(sizeof(PanelType), "spacetype nla panel evaluation"); strcpy(pt->idname, "NLA_PT_evaluation"); - strcpy(pt->label, "Evaluation"); + strcpy(pt->label, N_("Evaluation")); + strcpy(pt->translation_context, BLF_I18NCONTEXT_DEFAULT_BPYRNA); pt->draw = nla_panel_evaluation; pt->poll = nla_strip_eval_panel_poll; BLI_addtail(&art->paneltypes, pt); pt = MEM_callocN(sizeof(PanelType), "spacetype nla panel modifiers"); strcpy(pt->idname, "NLA_PT_modifiers"); - strcpy(pt->label, "Modifiers"); + strcpy(pt->label, N_("Modifiers")); + strcpy(pt->translation_context, BLF_I18NCONTEXT_DEFAULT_BPYRNA); pt->draw = nla_panel_modifiers; pt->poll = nla_strip_eval_panel_poll; BLI_addtail(&art->paneltypes, pt); diff --git a/source/blender/editors/space_node/node_add.c b/source/blender/editors/space_node/node_add.c index fb9e1221c38..0201071ada4 100644 --- a/source/blender/editors/space_node/node_add.c +++ b/source/blender/editors/space_node/node_add.c @@ -83,7 +83,7 @@ bNode *node_add_node(const bContext *C, const char *idname, int type, float locx /* generics */ node->locx = locx; - node->locy = locy + 60.0f; // arbitrary.. so its visible, (0,0) is top of node + node->locy = locy + 60.0f; /* arbitrary... so its visible, (0,0) is top of node */ nodeSetSelected(node, TRUE); /* node location is mapped */ @@ -436,7 +436,8 @@ static int new_node_tree_exec(bContext *C, wmOperator *op) PointerRNA ptr, idptr; PropertyRNA *prop; const char *idname; - char treename[MAX_ID_NAME - 2] = "NodeTree"; + char _treename[MAX_ID_NAME - 2]; + char *treename = _treename; if (RNA_struct_property_is_set(op->ptr, "type")) { prop = RNA_struct_find_property(op->ptr, "type"); @@ -445,8 +446,12 @@ static int new_node_tree_exec(bContext *C, wmOperator *op) else if (snode) idname = snode->tree_idname; - if (RNA_struct_property_is_set(op->ptr, "name")) + if (RNA_struct_property_is_set(op->ptr, "name")) { RNA_string_get(op->ptr, "name", treename); + } + else { + treename = (char *)DATA_("NodeTree"); + } if (!ntreeTypeFind(idname)) { BKE_reportf(op->reports, RPT_ERROR, "Node tree type %s undefined", idname); diff --git a/source/blender/editors/space_node/node_buttons.c b/source/blender/editors/space_node/node_buttons.c index efdb7c0d85d..d0a77e273f0 100644 --- a/source/blender/editors/space_node/node_buttons.c +++ b/source/blender/editors/space_node/node_buttons.c @@ -211,13 +211,13 @@ static void node_tree_interface_panel(const bContext *C, Panel *pa) split = uiLayoutRow(row, TRUE); col = uiLayoutColumn(split, TRUE); - uiItemL(col, "Inputs:", ICON_NONE); + uiItemL(col, IFACE_("Inputs:"), ICON_NONE); uiTemplateList(col, (bContext *)C, "NODE_UL_interface_sockets", "", &ptr, "inputs", &ptr, "active_input", 0, 0, 0); opptr = uiItemFullO(col, "NODE_OT_tree_socket_add", "", ICON_PLUS, NULL, WM_OP_EXEC_DEFAULT, UI_ITEM_O_RETURN_PROPS); RNA_enum_set(&opptr, "in_out", SOCK_IN); col = uiLayoutColumn(split, TRUE); - uiItemL(col, "Outputs:", ICON_NONE); + uiItemL(col, IFACE_("Outputs:"), ICON_NONE); uiTemplateList(col, (bContext *)C, "NODE_UL_interface_sockets", "", &ptr, "outputs", &ptr, "active_output", 0, 0, 0); opptr = uiItemFullO(col, "NODE_OT_tree_socket_add", "", ICON_PLUS, NULL, WM_OP_EXEC_DEFAULT, UI_ITEM_O_RETURN_PROPS); RNA_enum_set(&opptr, "in_out", SOCK_OUT); @@ -248,14 +248,16 @@ void node_buttons_register(ARegionType *art) pt = MEM_callocN(sizeof(PanelType), "spacetype node panel active node"); strcpy(pt->idname, "NODE_PT_item"); - strcpy(pt->label, IFACE_("Active Node")); + strcpy(pt->label, N_("Active Node")); + strcpy(pt->translation_context, BLF_I18NCONTEXT_DEFAULT_BPYRNA); pt->draw = active_node_panel; pt->poll = active_node_poll; BLI_addtail(&art->paneltypes, pt); pt = MEM_callocN(sizeof(PanelType), "spacetype node panel node sockets"); strcpy(pt->idname, "NODE_PT_sockets"); - strcpy(pt->label, "Sockets"); + strcpy(pt->label, N_("Sockets")); + strcpy(pt->translation_context, BLF_I18NCONTEXT_DEFAULT_BPYRNA); pt->draw = node_sockets_panel; pt->poll = node_sockets_poll; pt->flag |= PNL_DEFAULT_CLOSED; @@ -263,14 +265,16 @@ void node_buttons_register(ARegionType *art) pt = MEM_callocN(sizeof(PanelType), "spacetype node panel tree interface"); strcpy(pt->idname, "NODE_PT_node_tree_interface"); - strcpy(pt->label, "Interface"); + strcpy(pt->label, N_("Interface")); + strcpy(pt->translation_context, BLF_I18NCONTEXT_DEFAULT_BPYRNA); pt->draw = node_tree_interface_panel; pt->poll = node_tree_interface_poll; BLI_addtail(&art->paneltypes, pt); pt = MEM_callocN(sizeof(PanelType), "spacetype node panel gpencil"); strcpy(pt->idname, "NODE_PT_gpencil"); - strcpy(pt->label, "Grease Pencil"); + strcpy(pt->label, N_("Grease Pencil")); + strcpy(pt->translation_context, BLF_I18NCONTEXT_DEFAULT_BPYRNA); pt->draw_header = gpencil_panel_standard_header; pt->draw = gpencil_panel_standard; pt->poll = active_nodetree_poll; diff --git a/source/blender/editors/space_node/node_header.c b/source/blender/editors/space_node/node_header.c index 175bbce756e..8de2daf9e42 100644 --- a/source/blender/editors/space_node/node_header.c +++ b/source/blender/editors/space_node/node_header.c @@ -81,7 +81,8 @@ void node_menus_register(void) mt = MEM_callocN(sizeof(MenuType), "spacetype node menu add"); strcpy(mt->idname, "NODE_MT_add"); - strcpy(mt->label, "Add"); + strcpy(mt->label, N_("Add")); + strcpy(mt->translation_context, BLF_I18NCONTEXT_DEFAULT_BPYRNA); mt->draw = node_menu_add; WM_menutype_add(mt); } diff --git a/source/blender/editors/space_node/node_intern.h b/source/blender/editors/space_node/node_intern.h index 48051014c58..7e4397a6cb0 100644 --- a/source/blender/editors/space_node/node_intern.h +++ b/source/blender/editors/space_node/node_intern.h @@ -121,10 +121,11 @@ void NODE_OT_select_linked_from(struct wmOperatorType *ot); void NODE_OT_select_border(struct wmOperatorType *ot); void NODE_OT_select_lasso(struct wmOperatorType *ot); void NODE_OT_select_same_type(struct wmOperatorType *ot); -void NODE_OT_select_same_type_next(struct wmOperatorType *ot); -void NODE_OT_select_same_type_prev(struct wmOperatorType *ot); +void NODE_OT_select_same_type_step(struct wmOperatorType *ot); /* node_view.c */ +int space_node_view_flag(struct bContext *C, SpaceNode *snode, ARegion *ar, const int node_flag); + void NODE_OT_view_all(struct wmOperatorType *ot); void NODE_OT_view_selected(struct wmOperatorType *ot); diff --git a/source/blender/editors/space_node/node_ops.c b/source/blender/editors/space_node/node_ops.c index 1e4e02b6ae1..4d229c6fe18 100644 --- a/source/blender/editors/space_node/node_ops.c +++ b/source/blender/editors/space_node/node_ops.c @@ -58,9 +58,8 @@ void node_operatortypes(void) WM_operatortype_append(NODE_OT_select_border); WM_operatortype_append(NODE_OT_select_lasso); WM_operatortype_append(NODE_OT_select_same_type); - WM_operatortype_append(NODE_OT_select_same_type_next); - WM_operatortype_append(NODE_OT_select_same_type_prev); - + WM_operatortype_append(NODE_OT_select_same_type_step); + WM_operatortype_append(NODE_OT_view_all); WM_operatortype_append(NODE_OT_view_selected); @@ -318,9 +317,12 @@ void node_keymap(struct wmKeyConfig *keyconf) WM_keymap_add_item(keymap, "NODE_OT_select_linked_to", LKEY, KM_PRESS, KM_SHIFT, 0); WM_keymap_add_item(keymap, "NODE_OT_select_linked_from", LKEY, KM_PRESS, 0, 0); WM_keymap_add_item(keymap, "NODE_OT_select_same_type", GKEY, KM_PRESS, KM_SHIFT, 0); - WM_keymap_add_item(keymap, "NODE_OT_select_same_type_next", RIGHTBRACKETKEY, KM_PRESS, KM_SHIFT, 0); - WM_keymap_add_item(keymap, "NODE_OT_select_same_type_prev", LEFTBRACKETKEY, KM_PRESS, KM_SHIFT, 0); + kmi = WM_keymap_add_item(keymap, "NODE_OT_select_same_type_step", RIGHTBRACKETKEY, KM_PRESS, KM_SHIFT, 0); + RNA_boolean_set(kmi->ptr, "prev", FALSE); + kmi = WM_keymap_add_item(keymap, "NODE_OT_select_same_type_step", LEFTBRACKETKEY, KM_PRESS, KM_SHIFT, 0); + RNA_boolean_set(kmi->ptr, "prev", TRUE); + node_group_operators(keymap, "ShaderNodeGroup"); node_group_operators(keymap, "CompositorNodeGroup"); node_group_operators(keymap, "TextureNodeGroup"); diff --git a/source/blender/editors/space_node/node_select.c b/source/blender/editors/space_node/node_select.c index faebeabdbba..cdb89a66867 100644 --- a/source/blender/editors/space_node/node_select.c +++ b/source/blender/editors/space_node/node_select.c @@ -762,57 +762,93 @@ void NODE_OT_select_same_type(wmOperatorType *ot) /* ****** Select The Next/Prev Node Of The Same Type ****** */ -static int node_select_same_type_next_exec(bContext *C, wmOperator *UNUSED(op)) -{ - SpaceNode *snode = CTX_wm_space_node(C); - - node_select_same_type_np(snode, 0); +/* ************************** */ - ED_node_sort(snode->edittree); - - WM_event_add_notifier(C, NC_NODE | NA_SELECTED, NULL); - return OPERATOR_FINISHED; -} - -void NODE_OT_select_same_type_next(wmOperatorType *ot) +static int node_select_same_type_step_exec(bContext *C, wmOperator *op) { - /* identifiers */ - ot->name = "Select Same Type Next"; - ot->description = "Select the next node of the same type"; - ot->idname = "NODE_OT_select_same_type_next"; + SpaceNode *snode = CTX_wm_space_node(C); + ARegion *ar = CTX_wm_region(C); + bNode **node_array; + bNode *active = nodeGetActive(snode->edittree); + int totnodes; + int revert = RNA_boolean_get(op->ptr, "prev"); + int same_type = 1; - /* api callbacks */ - ot->exec = node_select_same_type_next_exec; - ot->poll = ED_operator_node_active; + ntreeGetDependencyList(snode->edittree, &node_array, &totnodes); - /* flags */ - ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; -} - -static int node_select_same_type_prev_exec(bContext *C, wmOperator *UNUSED(op)) -{ - SpaceNode *snode = CTX_wm_space_node(C); - - node_select_same_type_np(snode, 1); + if (totnodes > 1) { + int a; + + for (a = 0; a < totnodes; a++) { + if (node_array[a] == active) + break; + } + + if (same_type) { + bNode *node = NULL; + + while (node == NULL) { + if (revert) a--; + else a++; + + if (a < 0 || a >= totnodes) + break; + + node = node_array[a]; + + if (node->type == active->type) + break; + else node = NULL; + } + if (node) + active = node; + } + else { + if (revert) { + if (a == 0) + active = node_array[totnodes - 1]; + else + active = node_array[a - 1]; + } + else { + if (a == totnodes - 1) + active = node_array[0]; + else + active = node_array[a + 1]; + } + } + + node_select_single(C, active); - ED_node_sort(snode->edittree); + /* is note outside view? */ + if (active->totr.xmax < ar->v2d.cur.xmin || active->totr.xmin > ar->v2d.cur.xmax || + active->totr.ymax < ar->v2d.cur.ymin || active->totr.ymin > ar->v2d.cur.ymax) + space_node_view_flag(C, snode, CTX_wm_region(C), NODE_SELECT); - WM_event_add_notifier(C, NC_NODE | NA_SELECTED, NULL); + } + + if (node_array) + MEM_freeN(node_array); + return OPERATOR_FINISHED; } -void NODE_OT_select_same_type_prev(wmOperatorType *ot) +void NODE_OT_select_same_type_step(wmOperatorType *ot) { /* identifiers */ - ot->name = "Select Same Type Prev"; - ot->description = "Select the prev node of the same type"; - ot->idname = "NODE_OT_select_same_type_prev"; + ot->name = "Activate Same Type Next/Prev"; + ot->description = "Activate and view same node type, step by step"; + ot->idname = "NODE_OT_select_same_type_step"; /* api callbacks */ - ot->exec = node_select_same_type_prev_exec; + ot->exec = node_select_same_type_step_exec; ot->poll = ED_operator_node_active; /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; + + RNA_def_boolean(ot->srna, "prev", 0, "Previous", ""); + } + diff --git a/source/blender/editors/space_node/node_view.c b/source/blender/editors/space_node/node_view.c index 293913dff11..eed8a10a1db 100644 --- a/source/blender/editors/space_node/node_view.c +++ b/source/blender/editors/space_node/node_view.c @@ -66,7 +66,7 @@ /* **************** View All Operator ************** */ -static int space_node_view_flag(bContext *C, SpaceNode *snode, ARegion *ar, const int node_flag) +int space_node_view_flag(bContext *C, SpaceNode *snode, ARegion *ar, const int node_flag) { bNode *node; rctf cur_new; diff --git a/source/blender/editors/space_sequencer/sequencer_buttons.c b/source/blender/editors/space_sequencer/sequencer_buttons.c index 21128408a97..197cc64dea4 100644 --- a/source/blender/editors/space_sequencer/sequencer_buttons.c +++ b/source/blender/editors/space_sequencer/sequencer_buttons.c @@ -67,6 +67,7 @@ void sequencer_buttons_register(ARegionType *art) pt = MEM_callocN(sizeof(PanelType), "spacetype sequencer panel gpencil"); strcpy(pt->idname, "SEQUENCER_PT_gpencil"); strcpy(pt->label, N_("Grease Pencil")); + strcpy(pt->translation_context, BLF_I18NCONTEXT_DEFAULT_BPYRNA); pt->draw_header = gpencil_panel_standard_header; pt->draw = gpencil_panel_standard; pt->poll = sequencer_grease_pencil_panel_poll; diff --git a/source/blender/editors/space_sequencer/sequencer_draw.c b/source/blender/editors/space_sequencer/sequencer_draw.c index 7ebe04f666b..1a4d461c3c1 100644 --- a/source/blender/editors/space_sequencer/sequencer_draw.c +++ b/source/blender/editors/space_sequencer/sequencer_draw.c @@ -1061,9 +1061,12 @@ void draw_image_seq(const bContext *C, Scene *scene, ARegion *ar, SpaceSeq *sseq glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, ibuf->x, ibuf->y, 0, GL_RGBA, GL_UNSIGNED_BYTE, display_buffer); - if (sseq->flag & SEQ_USE_ALPHA) { - glEnable(GL_BLEND); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + /* only draw alpha for main buffer */ + if (sseq->mainb == SEQ_DRAW_IMG_IMBUF) { + if (sseq->flag & SEQ_USE_ALPHA) { + glEnable(GL_BLEND); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + } } glBegin(GL_QUADS); diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c b/source/blender/editors/space_sequencer/sequencer_edit.c index f0ed8d4107d..135fddfd348 100644 --- a/source/blender/editors/space_sequencer/sequencer_edit.c +++ b/source/blender/editors/space_sequencer/sequencer_edit.c @@ -866,11 +866,11 @@ static int cut_seq_list(Scene *scene, ListBase *slist, int cutframe, return (seq_first_new != NULL); } -static int insert_gap(Scene *scene, int gap, int cfra) +static bool insert_gap(Scene *scene, int gap, int cfra) { Sequence *seq; Editing *ed = BKE_sequencer_editing_get(scene, FALSE); - int done = FALSE; + bool done = false; /* all strips >= cfra are shifted */ @@ -881,7 +881,7 @@ static int insert_gap(Scene *scene, int gap, int cfra) if (seq->startdisp >= cfra) { seq->start += gap; BKE_sequence_calc(scene, seq); - done = TRUE; + done = true; } } SEQ_END @@ -988,30 +988,99 @@ static void UNUSED_FUNCTION(seq_remap_paths) (Scene *scene) } -static void UNUSED_FUNCTION(no_gaps) (Scene *scene) +static int sequencer_gap_remove_exec(bContext *C, wmOperator *op) { - Editing *ed = BKE_sequencer_editing_get(scene, FALSE); - int cfra, first = 0, done; - + Scene *scene = CTX_data_scene(C); + rctf rectf; + int cfra, efra, sfra; + bool first = false, done; + bool do_all = RNA_boolean_get(op->ptr, "all"); + + /* get first and last frame */ + boundbox_seq(scene, &rectf); + sfra = (int)rectf.xmin; + efra = (int)rectf.xmax; + + /* first check if the current frame has a gap already */ + for (cfra = CFRA; cfra >= sfra; cfra--) { + if (BKE_sequencer_evaluate_frame(scene, cfra)) { + first = true; + break; + } + } - if (ed == NULL) return; - - for (cfra = CFRA; cfra <= EFRA; cfra++) { - if (first == 0) { - if (BKE_sequencer_evaluate_frame(scene, cfra) ) first = 1; + for ( ; cfra < efra; cfra++) { + /* first == 0 means there's still no strip to remove a gap for */ + if (first == false) { + if (BKE_sequencer_evaluate_frame(scene, cfra) ) first = true; } - else { - done = TRUE; + else if (BKE_sequencer_evaluate_frame(scene, cfra) == 0) { + done = true; while (BKE_sequencer_evaluate_frame(scene, cfra) == 0) { done = insert_gap(scene, -1, cfra); - if (done == 0) break; + if (done == false) break; } - if (done == 0) break; + if (done == false || do_all == false) break; } } + WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene); + + return OPERATOR_FINISHED; + +} + + +void SEQUENCER_OT_gap_remove(struct wmOperatorType *ot) +{ + /* identifiers */ + ot->name = "Remove Gaps"; + ot->idname = "SEQUENCER_OT_gap_remove"; + ot->description = "Remove gap at current frame to first strip at the right, independent of selection or locked state of strips"; + + /* api callbacks */ +// ot->invoke = sequencer_snap_invoke; + ot->exec = sequencer_gap_remove_exec; + ot->poll = sequencer_edit_poll; + + /* flags */ + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; + + RNA_def_boolean(ot->srna, "all", 0, "All Gaps", "Do all gaps to right of current frame"); } +static int sequencer_gap_insert_exec(bContext *C, wmOperator *op) +{ + Scene *scene = CTX_data_scene(C); + int frames = RNA_int_get(op->ptr, "frames"); + + insert_gap(scene, frames, CFRA); + + WM_event_add_notifier(C, NC_SCENE | ND_SEQUENCER, scene); + + return OPERATOR_FINISHED; + +} + +void SEQUENCER_OT_gap_insert(struct wmOperatorType *ot) +{ + /* identifiers */ + ot->name = "Insert Gaps"; + ot->idname = "SEQUENCER_OT_gap_insert"; + ot->description = "Insert gap at current frame to first strips at the right, independent of selection or locked state of strips"; + + /* api callbacks */ + // ot->invoke = sequencer_snap_invoke; + ot->exec = sequencer_gap_insert_exec; + ot->poll = sequencer_edit_poll; + + /* flags */ + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; + + RNA_def_int(ot->srna, "frames", 10, 0, INT_MAX, "Frames", "Frames to insert after current strip", 0, 1000); +} + + #if 0 static int seq_get_snaplimit(View2D *v2d) { @@ -2259,6 +2328,7 @@ static int sequencer_view_selected_exec(bContext *C, wmOperator *UNUSED(op)) View2D *v2d = UI_view2d_fromcontext(C); ARegion *ar = CTX_wm_region(C); Editing *ed = BKE_sequencer_editing_get(scene, FALSE); + Sequence *last_seq = BKE_sequencer_active_get(scene); Sequence *seq; rctf cur_new = v2d->cur; @@ -2275,7 +2345,7 @@ static int sequencer_view_selected_exec(bContext *C, wmOperator *UNUSED(op)) return OPERATOR_CANCELLED; for (seq = ed->seqbasep->first; seq; seq = seq->next) { - if (seq->flag & SELECT) { + if ((seq->flag & SELECT) || (seq == last_seq)) { xmin = min_ii(xmin, seq->startdisp); xmax = max_ii(xmax, seq->enddisp); diff --git a/source/blender/editors/space_sequencer/sequencer_intern.h b/source/blender/editors/space_sequencer/sequencer_intern.h index cd79c43eac2..32a6c49da89 100644 --- a/source/blender/editors/space_sequencer/sequencer_intern.h +++ b/source/blender/editors/space_sequencer/sequencer_intern.h @@ -97,7 +97,11 @@ void SEQUENCER_OT_images_separate(struct wmOperatorType *ot); void SEQUENCER_OT_meta_toggle(struct wmOperatorType *ot); void SEQUENCER_OT_meta_make(struct wmOperatorType *ot); void SEQUENCER_OT_meta_separate(struct wmOperatorType *ot); + +void SEQUENCER_OT_gap_remove(struct wmOperatorType *ot); +void SEQUENCER_OT_gap_insert(struct wmOperatorType *ot); void SEQUENCER_OT_snap(struct wmOperatorType *ot); + void SEQUENCER_OT_strip_jump(struct wmOperatorType *ot); void SEQUENCER_OT_swap(struct wmOperatorType *ot); void SEQUENCER_OT_swap_data(struct wmOperatorType *ot); diff --git a/source/blender/editors/space_sequencer/sequencer_ops.c b/source/blender/editors/space_sequencer/sequencer_ops.c index 70b288a59e6..a236a97a803 100644 --- a/source/blender/editors/space_sequencer/sequencer_ops.c +++ b/source/blender/editors/space_sequencer/sequencer_ops.c @@ -72,6 +72,9 @@ void sequencer_operatortypes(void) WM_operatortype_append(SEQUENCER_OT_meta_toggle); WM_operatortype_append(SEQUENCER_OT_meta_make); WM_operatortype_append(SEQUENCER_OT_meta_separate); + + WM_operatortype_append(SEQUENCER_OT_gap_remove); + WM_operatortype_append(SEQUENCER_OT_gap_insert); WM_operatortype_append(SEQUENCER_OT_snap); WM_operatortype_append(SEQUENCER_OT_strip_jump); WM_operatortype_append(SEQUENCER_OT_swap); @@ -213,6 +216,10 @@ void sequencer_keymap(wmKeyConfig *keyconf) RNA_enum_set(WM_keymap_add_item(keymap, "SEQUENCER_OT_swap", LEFTARROWKEY, KM_PRESS, KM_ALT, 0)->ptr, "side", SEQ_SIDE_LEFT); RNA_enum_set(WM_keymap_add_item(keymap, "SEQUENCER_OT_swap", RIGHTARROWKEY, KM_PRESS, KM_ALT, 0)->ptr, "side", SEQ_SIDE_RIGHT); + RNA_boolean_set(WM_keymap_add_item(keymap, "SEQUENCER_OT_gap_remove", BACKSPACEKEY, KM_PRESS, 0, 0)->ptr, "all", FALSE); + RNA_boolean_set(WM_keymap_add_item(keymap, "SEQUENCER_OT_gap_remove", BACKSPACEKEY, KM_PRESS, KM_SHIFT, 0)->ptr, "all", TRUE); + WM_keymap_add_item(keymap, "SEQUENCER_OT_gap_insert", EQUALKEY, KM_PRESS, KM_SHIFT, 0); + WM_keymap_add_item(keymap, "SEQUENCER_OT_snap", SKEY, KM_PRESS, KM_SHIFT, 0); WM_keymap_add_item(keymap, "SEQUENCER_OT_swap_inputs", SKEY, KM_PRESS, KM_ALT, 0); diff --git a/source/blender/editors/space_sequencer/sequencer_scopes.c b/source/blender/editors/space_sequencer/sequencer_scopes.c index 6ed34a79510..c8b70c0ce4a 100644 --- a/source/blender/editors/space_sequencer/sequencer_scopes.c +++ b/source/blender/editors/space_sequencer/sequencer_scopes.c @@ -107,20 +107,20 @@ static void wform_put_border(unsigned char *tgt, int w, int h) for (x = 0; x < w; x++) { unsigned char *p = tgt + 4 * x; - p[1] = p[3] = 255.0; - p[4 * w + 1] = p[4 * w + 3] = 255.0; + p[1] = p[3] = 155; + p[4 * w + 1] = p[4 * w + 3] = 155; p = tgt + 4 * (w * (h - 1) + x); - p[1] = p[3] = 255.0; - p[-4 * w + 1] = p[-4 * w + 3] = 255.0; + p[1] = p[3] = 155; + p[-4 * w + 1] = p[-4 * w + 3] = 155; } for (y = 0; y < h; y++) { unsigned char *p = tgt + 4 * w * y; - p[1] = p[3] = 255.0; - p[4 + 1] = p[4 + 3] = 255.0; + p[1] = p[3] = 155; + p[4 + 1] = p[4 + 3] = 155; p = tgt + 4 * (w * y + w - 1); - p[1] = p[3] = 255.0; - p[-4 + 1] = p[-4 + 3] = 255.0; + p[1] = p[3] = 155; + p[-4 + 1] = p[-4 + 3] = 155; } } @@ -156,7 +156,8 @@ static ImBuf *make_waveform_view_from_ibuf_byte(ImBuf *ibuf) unsigned char wtable[256]; wform_put_grid(tgt, w, h); - + wform_put_border(tgt, w, h); + for (x = 0; x < 256; x++) { wtable[x] = (unsigned char) (pow(((float) x + 1) / 256, waveform_gamma) * 255); } @@ -181,8 +182,6 @@ static ImBuf *make_waveform_view_from_ibuf_byte(ImBuf *ibuf) } } - wform_put_border(tgt, w, h); - return rval; } @@ -454,8 +453,8 @@ static void draw_histogram_bar(ImBuf *ibuf, int x, float val, int col) static ImBuf *make_histogram_view_from_ibuf_byte(ImBuf *ibuf) { ImBuf *rval = IMB_allocImBuf(515, 128, 32, IB_rect); - int c, x, y; - unsigned int n; + int x, y; + unsigned int nr, ng, nb; unsigned char *src = (unsigned char *) ibuf->rect; unsigned int bins[3][HIS_STEPS]; @@ -487,19 +486,28 @@ static ImBuf *make_histogram_view_from_ibuf_byte(ImBuf *ibuf) } } - n = 0; - for (c = 0; c < 3; c++) { - for (x = 0; x < HIS_STEPS; x++) { - if (bins[c][x] > n) { - n = bins[c][x]; - } - } + nr = nb = ng = 0; + for (x = 0; x < HIS_STEPS; x++) { + if (bins[0][x] > nr) + nr = bins[0][x]; + if (bins[1][x] > ng) + ng = bins[1][x]; + if (bins[2][x] > nb) + nb = bins[2][x]; } - for (c = 0; c < 3; c++) { - for (x = 0; x < HIS_STEPS; x++) { - draw_histogram_bar(rval, x * 2 + 1, ((float) bins[c][x]) / n, c); - draw_histogram_bar(rval, x * 2 + 2, ((float) bins[c][x]) / n, c); + for (x = 0; x < HIS_STEPS; x++) { + if (nr) { + draw_histogram_bar(rval, x * 2 + 1, ((float) bins[0][x]) / nr, 0); + draw_histogram_bar(rval, x * 2 + 2, ((float) bins[0][x]) / nr, 0); + } + if (ng) { + draw_histogram_bar(rval, x * 2 + 1, ((float) bins[1][x]) / ng, 1); + draw_histogram_bar(rval, x * 2 + 2, ((float) bins[1][x]) / ng, 1); + } + if (nb) { + draw_histogram_bar(rval, x * 2 + 1, ((float) bins[2][x]) / nb, 2); + draw_histogram_bar(rval, x * 2 + 2, ((float) bins[2][x]) / nb, 2); } } diff --git a/source/blender/editors/space_view3d/view3d_buttons.c b/source/blender/editors/space_view3d/view3d_buttons.c index 533bb30d8d1..a439b5b5b87 100644 --- a/source/blender/editors/space_view3d/view3d_buttons.c +++ b/source/blender/editors/space_view3d/view3d_buttons.c @@ -1270,12 +1270,14 @@ void view3d_buttons_register(ARegionType *art) pt = MEM_callocN(sizeof(PanelType), "spacetype view3d panel object"); strcpy(pt->idname, "VIEW3D_PT_object"); strcpy(pt->label, N_("Transform")); /* XXX C panels not available through RNA (bpy.types)! */ + strcpy(pt->translation_context, BLF_I18NCONTEXT_DEFAULT_BPYRNA); pt->draw = view3d_panel_object; BLI_addtail(&art->paneltypes, pt); pt = MEM_callocN(sizeof(PanelType), "spacetype view3d panel gpencil"); strcpy(pt->idname, "VIEW3D_PT_gpencil"); strcpy(pt->label, N_("Grease Pencil")); /* XXX C panels are not available through RNA (bpy.types)! */ + strcpy(pt->translation_context, BLF_I18NCONTEXT_DEFAULT_BPYRNA); pt->draw_header = gpencil_panel_standard_header; pt->draw = gpencil_panel_standard; BLI_addtail(&art->paneltypes, pt); @@ -1283,6 +1285,7 @@ void view3d_buttons_register(ARegionType *art) pt = MEM_callocN(sizeof(PanelType), "spacetype view3d panel vgroup"); strcpy(pt->idname, "VIEW3D_PT_vgroup"); strcpy(pt->label, N_("Vertex Groups")); /* XXX C panels are not available through RNA (bpy.types)! */ + strcpy(pt->translation_context, BLF_I18NCONTEXT_DEFAULT_BPYRNA); pt->draw = view3d_panel_vgroup; pt->poll = view3d_panel_vgroup_poll; BLI_addtail(&art->paneltypes, pt); diff --git a/source/blender/editors/space_view3d/view3d_toolbar.c b/source/blender/editors/space_view3d/view3d_toolbar.c index d3bf8a30792..603d9a1595c 100644 --- a/source/blender/editors/space_view3d/view3d_toolbar.c +++ b/source/blender/editors/space_view3d/view3d_toolbar.c @@ -238,7 +238,8 @@ void view3d_toolshelf_register(ARegionType *art) pt = MEM_callocN(sizeof(PanelType), "spacetype view3d panel tools"); strcpy(pt->idname, "VIEW3D_PT_tool_shelf"); - strcpy(pt->label, "Tool Shelf"); + strcpy(pt->label, N_("Tool Shelf")); + strcpy(pt->translation_context, BLF_I18NCONTEXT_DEFAULT_BPYRNA); pt->draw = view3d_panel_tool_shelf; BLI_addtail(&art->paneltypes, pt); } @@ -249,7 +250,8 @@ void view3d_tool_props_register(ARegionType *art) pt = MEM_callocN(sizeof(PanelType), "spacetype view3d panel last operator"); strcpy(pt->idname, "VIEW3D_PT_last_operator"); - strcpy(pt->label, "Operator"); + strcpy(pt->label, N_("Operator")); + strcpy(pt->translation_context, BLF_I18NCONTEXT_DEFAULT_BPYRNA); pt->draw_header = view3d_panel_operator_redo_header; pt->draw = view3d_panel_operator_redo; BLI_addtail(&art->paneltypes, pt); diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c index cf960c953c3..f84c967711c 100644 --- a/source/blender/editors/transform/transform_conversions.c +++ b/source/blender/editors/transform/transform_conversions.c @@ -6469,7 +6469,7 @@ void createTransData(bContext *C, TransInfo *t) sort_trans_data_dist(t); } } - else { + else if (t->obedit) { createTransUVs(C, t); if (t->data && (t->flag & T_PROP_EDIT)) { sort_trans_data(t); // makes selected become first in array diff --git a/source/blender/editors/transform/transform_generics.c b/source/blender/editors/transform/transform_generics.c index 2a3b0bc8726..3d3b8009c99 100644 --- a/source/blender/editors/transform/transform_generics.c +++ b/source/blender/editors/transform/transform_generics.c @@ -1160,7 +1160,7 @@ int initTransInfo(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *even t->options |= CTX_MASK; } else { - BLI_assert(0); + /* image not in uv edit, nor in mask mode, can happen for some tools */ } } else if (t->spacetype == SPACE_NODE) { diff --git a/source/blender/editors/transform/transform_ops.c b/source/blender/editors/transform/transform_ops.c index 778795bb3a1..60b0c655691 100644 --- a/source/blender/editors/transform/transform_ops.c +++ b/source/blender/editors/transform/transform_ops.c @@ -721,7 +721,7 @@ static void TRANSFORM_OT_tosphere(struct wmOperatorType *ot) ot->exec = transform_exec; ot->modal = transform_modal; ot->cancel = transform_cancel; - ot->poll = ED_operator_view3d_active; + ot->poll = ED_operator_screenactive; RNA_def_float_factor(ot->srna, "value", 0, 0, 1, "Factor", "", 0, 1); diff --git a/source/blender/editors/uvedit/uvedit_unwrap_ops.c b/source/blender/editors/uvedit/uvedit_unwrap_ops.c index b80862d4db5..ba8b26c9083 100644 --- a/source/blender/editors/uvedit/uvedit_unwrap_ops.c +++ b/source/blender/editors/uvedit/uvedit_unwrap_ops.c @@ -1339,8 +1339,14 @@ static int uv_from_view_exec(bContext *C, wmOperator *op) } } else if (camera) { - struct ProjCameraInfo *uci = BLI_uvproject_camera_info(v3d->camera, obedit->obmat, scene->r.xsch, scene->r.ysch); + const bool camera_bounds = RNA_boolean_get(op->ptr, "camera_bounds"); + struct ProjCameraInfo *uci = BLI_uvproject_camera_info(v3d->camera, obedit->obmat, + camera_bounds ? (scene->r.xsch * scene->r.xasp) : 1.0f, + camera_bounds ? (scene->r.ysch * scene->r.yasp) : 1.0f); + + // BLI_uvproject_camera_info_scale + if (uci) { BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) { if (!BM_elem_flag_test(efa, BM_ELEM_SELECT)) @@ -1401,7 +1407,10 @@ void UV_OT_project_from_view(wmOperatorType *ot) ot->poll = uv_from_view_poll; /* properties */ - RNA_def_boolean(ot->srna, "orthographic", 0, "Orthographic", "Use orthographic projection"); + RNA_def_boolean(ot->srna, "orthographic", 0, "Orthographic", + "Use orthographic projection"); + RNA_def_boolean(ot->srna, "camera_bounds", 1, "Camera Bounds", + "Map UVs to the camera region taking resolution and aspect into account"); uv_map_clip_correct_properties(ot); } |