diff options
author | Antonio Vazquez <blendergit@gmail.com> | 2019-08-26 16:46:00 +0300 |
---|---|---|
committer | Antonio Vazquez <blendergit@gmail.com> | 2019-08-26 16:49:16 +0300 |
commit | 51d9f56f874d2aeea0dc8bc256eb9e12d1726187 (patch) | |
tree | 698d20c0f3936a95f5e8973ad1b43f5125810b17 /source | |
parent | 742119bcb50a83b7f8bb6ceefb34861ac54d9cc8 (diff) |
GPencil: Invert Paste operator and make Paste to Active default
Before there were two options: Paste to original layer called "Paste" and Paste to active layer called "Paste & Merge"
Now, by default the paste is in active layer and the "Paste & Merge" has been renamed "Paste".
For old "Paste", now is called "Paste by Layer" and it's not the default value anymore.
Note: Minor edits to add icons not present in Differential revision.
Differential Revision: https://developer.blender.org/D5591
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenloader/intern/readfile.c | 52 | ||||
-rw-r--r-- | source/blender/draw/intern/draw_cache_impl_mesh.c | 20 | ||||
-rw-r--r-- | source/blender/editors/gpencil/gpencil_edit.c | 16 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_files.c | 2 |
4 files changed, 9 insertions, 81 deletions
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 140e67c86c9..2a036d7f4ea 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -7859,45 +7859,6 @@ static void lib_link_clipboard_restore(struct IDNameLib_Map *id_map) BKE_sequencer_base_recursive_apply(&seqbase_clipboard, lib_link_seq_clipboard_cb, id_map); } -static int lib_link_main_data_restore_cb(void *user_data, - ID *UNUSED(id_self), - ID **id_pointer, - int cb_flag) -{ - if (cb_flag & IDWALK_CB_PRIVATE || *id_pointer == NULL) { - return IDWALK_RET_NOP; - } - - /* Special ugly case here, thanks again for those non-IDs IDs... */ - /* We probably need to add more cases here (hint: nodetrees), - * but will wait for changes from D5559 to get in first. */ - if (GS((*id_pointer)->name) == ID_GR) { - Collection *collection = (Collection *)*id_pointer; - if (collection->flag & COLLECTION_IS_MASTER) { - return IDWALK_RET_NOP; - } - } - - struct IDNameLib_Map *id_map = user_data; - - /* Note: Handling of usercount here is really bad, defining its own system... - * Will have to be refactored at some point, but that is not top priority task for now. - * And all usercounts are properly recomputed at the end of the undo management code anyway. */ - *id_pointer = restore_pointer_by_name( - id_map, *id_pointer, (cb_flag & IDWALK_CB_USER_ONE) ? USER_REAL : USER_IGNORE); - - return IDWALK_RET_NOP; -} - -static void lib_link_main_data_restore(struct IDNameLib_Map *id_map, Main *newmain) -{ - ID *id; - FOREACH_MAIN_ID_BEGIN (newmain, id) { - BKE_library_foreach_ID_link(newmain, id, lib_link_main_data_restore_cb, id_map, IDWALK_NOP); - } - FOREACH_MAIN_ID_END; -} - static void lib_link_window_scene_data_restore(wmWindow *win, Scene *scene, ViewLayer *view_layer) { bScreen *screen = BKE_workspace_active_screen_get(win->workspace_hook); @@ -8217,24 +8178,11 @@ void blo_lib_link_restore(Main *oldmain, /* keep cursor location through undo */ memcpy(&win->scene->cursor, &oldscene->cursor, sizeof(win->scene->cursor)); - /* Note: even though that function seems to redo part of what is done by - * `lib_link_workspace_layout_restore()` above, it seems to have a slightly different scope: - * while the former updates the whole UI pointers from Main db (going over all layouts of - * all workspaces), that one only focuses one current active screen, takes care of - * potential local view, and needs window's scene pointer to be final... */ lib_link_window_scene_data_restore(win, win->scene, cur_view_layer); BLI_assert(win->screen == NULL); } - /* Restore all ID pointers in Main database itself - * (especially IDProperties might point to some worspace of other 'weirdly unchanged' ID - * pointers, see T69146). - * Note that this will re;ap again a few pointers in workspaces or so, - * but since we are remapping final ones already set above, - * that is just some minor harmless double-processing. */ - lib_link_main_data_restore(id_map, newmain); - /* update IDs stored in all possible clipboards */ lib_link_clipboard_restore(id_map); diff --git a/source/blender/draw/intern/draw_cache_impl_mesh.c b/source/blender/draw/intern/draw_cache_impl_mesh.c index 336f0a7528a..884d39343c6 100644 --- a/source/blender/draw/intern/draw_cache_impl_mesh.c +++ b/source/blender/draw/intern/draw_cache_impl_mesh.c @@ -999,26 +999,6 @@ void DRW_mesh_batch_cache_create_requested( } } - /* HACK: if MBC_SURF_PER_MAT is requested and ibo.tris is already available, it won't have it's - * index ranges initialized. So discard ibo.tris in order to recreate it. - * This needs to happen before saved_elem_ranges is populated. */ - if ((batch_requested & MBC_SURF_PER_MAT) != 0 && (cache->batch_ready & MBC_SURF_PER_MAT) == 0) { - FOREACH_MESH_BUFFER_CACHE(cache, mbuffercache) - { - GPU_INDEXBUF_DISCARD_SAFE(mbuffercache->ibo.tris); - } - /* Clear all batches that reference ibo.tris. */ - GPU_BATCH_CLEAR_SAFE(cache->batch.surface); - GPU_BATCH_CLEAR_SAFE(cache->batch.surface_weights); - GPU_BATCH_CLEAR_SAFE(cache->batch.edit_mesh_analysis); - GPU_BATCH_CLEAR_SAFE(cache->batch.edit_triangles); - GPU_BATCH_CLEAR_SAFE(cache->batch.edit_lnor); - GPU_BATCH_CLEAR_SAFE(cache->batch.edit_selection_faces); - - cache->batch_ready &= ~(MBC_SURFACE | MBC_SURFACE_WEIGHTS | MBC_EDIT_MESH_ANALYSIS | - MBC_EDIT_TRIANGLES | MBC_EDIT_LNOR | MBC_EDIT_SELECTION_FACES); - } - if (batch_requested & (MBC_SURFACE | MBC_SURF_PER_MAT | MBC_WIRE_LOOPS_UVS | MBC_EDITUV_FACES_STRECH_AREA | MBC_EDITUV_FACES_STRECH_ANGLE | MBC_EDITUV_FACES | MBC_EDITUV_EDGES | MBC_EDITUV_VERTS)) { diff --git a/source/blender/editors/gpencil/gpencil_edit.c b/source/blender/editors/gpencil/gpencil_edit.c index 9fd1d031bb1..50ee0066729 100644 --- a/source/blender/editors/gpencil/gpencil_edit.c +++ b/source/blender/editors/gpencil/gpencil_edit.c @@ -1241,8 +1241,8 @@ static bool gp_strokes_paste_poll(bContext *C) } typedef enum eGP_PasteMode { - GP_COPY_ONLY = -1, - GP_COPY_MERGE = 1, + GP_COPY_BY_LAYER = -1, + GP_COPY_TO_ACTIVE = 1, } eGP_PasteMode; static int gp_strokes_paste_exec(bContext *C, wmOperator *op) @@ -1275,7 +1275,7 @@ static int gp_strokes_paste_exec(bContext *C, wmOperator *op) /* no active layer - let's just create one */ gpl = BKE_gpencil_layer_addnew(gpd, DATA_("GP_Layer"), true); } - else if ((gpencil_layer_is_editable(gpl) == false) && (type == GP_COPY_MERGE)) { + else if ((gpencil_layer_is_editable(gpl) == false) && (type == GP_COPY_TO_ACTIVE)) { BKE_report( op->reports, RPT_ERROR, "Can not paste strokes when active layer is hidden or locked"); return OPERATOR_CANCELLED; @@ -1328,7 +1328,7 @@ static int gp_strokes_paste_exec(bContext *C, wmOperator *op) for (bGPDstroke *gps = gp_strokes_copypastebuf.first; gps; gps = gps->next) { if (ED_gpencil_stroke_can_use(C, gps)) { /* Need to verify if layer exists */ - if (type != GP_COPY_MERGE) { + if (type != GP_COPY_TO_ACTIVE) { gpl = BLI_findstring(&gpd->layers, gps->runtime.tmp_layerinfo, offsetof(bGPDlayer, info)); if (gpl == NULL) { /* no layer - use active (only if layer deleted before paste) */ @@ -1379,15 +1379,15 @@ static int gp_strokes_paste_exec(bContext *C, wmOperator *op) void GPENCIL_OT_paste(wmOperatorType *ot) { static const EnumPropertyItem copy_type[] = { - {GP_COPY_ONLY, "COPY", 0, "Copy", ""}, - {GP_COPY_MERGE, "MERGE", 0, "Merge", ""}, + {GP_COPY_TO_ACTIVE, "ACTIVE", 0, "Paste to Active", ""}, + {GP_COPY_BY_LAYER, "LAYER", 0, "Paste by Layer", ""}, {0, NULL, 0, NULL, NULL}, }; /* identifiers */ ot->name = "Paste Strokes"; ot->idname = "GPENCIL_OT_paste"; - ot->description = "Paste previously copied strokes or copy and merge in active layer"; + ot->description = "Paste previously copied strokes to active layer or to original layer"; /* callbacks */ ot->exec = gp_strokes_paste_exec; @@ -1397,7 +1397,7 @@ void GPENCIL_OT_paste(wmOperatorType *ot) ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; /* properties */ - ot->prop = RNA_def_enum(ot->srna, "type", copy_type, 0, "Type", ""); + ot->prop = RNA_def_enum(ot->srna, "type", copy_type, GP_COPY_TO_ACTIVE, "Type", ""); } /* ******************* Move To Layer ****************************** */ diff --git a/source/blender/windowmanager/intern/wm_files.c b/source/blender/windowmanager/intern/wm_files.c index 9cf14f6d1d6..8546290d281 100644 --- a/source/blender/windowmanager/intern/wm_files.c +++ b/source/blender/windowmanager/intern/wm_files.c @@ -3038,7 +3038,7 @@ static uiBlock *block_create__close_file_dialog(struct bContext *C, struct ARegi BLI_path_extension_replace(filename, sizeof(filename), ""); } else { - STRNCPY(filename, IFACE_("Untitled")); + BLI_snprintf(filename, sizeof(filename), IFACE_("Untitled")); } /* Title */ |