diff options
Diffstat (limited to 'source/blender/editors')
28 files changed, 201 insertions, 109 deletions
diff --git a/source/blender/editors/asset/intern/asset_ops.cc b/source/blender/editors/asset/intern/asset_ops.cc index 05d0b7d0af4..ba7b56db3ec 100644 --- a/source/blender/editors/asset/intern/asset_ops.cc +++ b/source/blender/editors/asset/intern/asset_ops.cc @@ -781,6 +781,7 @@ static const EnumPropertyItem *rna_asset_library_reference_itemf(bContext *UNUSE const EnumPropertyItem *items = ED_asset_library_reference_to_rna_enum_itemf(false); if (!items) { *r_free = false; + return nullptr; } *r_free = true; diff --git a/source/blender/editors/gpencil/gpencil_edit.c b/source/blender/editors/gpencil/gpencil_edit.c index 120c806c727..89ab9eda7f0 100644 --- a/source/blender/editors/gpencil/gpencil_edit.c +++ b/source/blender/editors/gpencil/gpencil_edit.c @@ -3791,6 +3791,101 @@ void GPENCIL_OT_stroke_flip(wmOperatorType *ot) /** \} */ /* -------------------------------------------------------------------- */ +/** \name Stroke Start Set Operator + * \{ */ + +static int gpencil_stroke_start_set_exec(bContext *C, wmOperator *op) +{ + Object *ob = CTX_data_active_object(C); + bGPdata *gpd = ob->data; + + /* sanity checks */ + if (ELEM(NULL, ob, gpd)) { + return OPERATOR_CANCELLED; + } + + const bool is_multiedit = (bool)GPENCIL_MULTIEDIT_SESSIONS_ON(gpd); + const bool is_curve_edit = (bool)GPENCIL_CURVE_EDIT_SESSIONS_ON(gpd); + if (is_curve_edit) { + BKE_report(op->reports, RPT_ERROR, "Curve Edit mode not supported"); + return OPERATOR_CANCELLED; + } + + bool changed = false; + /* Read all selected strokes. */ + CTX_DATA_BEGIN (C, bGPDlayer *, gpl, editable_gpencil_layers) { + bGPDframe *init_gpf = (is_multiedit) ? gpl->frames.first : gpl->actframe; + + for (bGPDframe *gpf = init_gpf; gpf; gpf = gpf->next) { + if ((gpf == gpl->actframe) || ((gpf->flag & GP_FRAME_SELECT) && (is_multiedit))) { + if (gpf == NULL) { + continue; + } + LISTBASE_FOREACH (bGPDstroke *, gps, &gpf->strokes) { + if (gps->flag & GP_STROKE_SELECT) { + /* skip strokes that are invalid for current view */ + if (ED_gpencil_stroke_can_use(C, gps) == false) { + continue; + } + /* check if the color is editable */ + if (ED_gpencil_stroke_material_editable(ob, gpl, gps) == false) { + continue; + } + + /* Only cyclic strokes. */ + if ((gps->flag & GP_STROKE_CYCLIC) == 0) { + continue; + } + + /* Find first selected point and set start. */ + bGPDspoint *pt; + for (int i = 0; i < gps->totpoints; i++) { + pt = &gps->points[i]; + if (pt->flag & GP_SPOINT_SELECT) { + BKE_gpencil_stroke_start_set(gps, i); + BKE_gpencil_stroke_geometry_update(gpd, gps); + changed = true; + break; + } + } + } + } + } + /* If not multi-edit, exit loop. */ + if (!is_multiedit) { + break; + } + } + } + CTX_DATA_END; + + if (changed) { + /* notifiers */ + DEG_id_tag_update(&gpd->id, ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY); + WM_event_add_notifier(C, NC_GPENCIL | ND_DATA | NA_EDITED, NULL); + } + + return OPERATOR_FINISHED; +} + +void GPENCIL_OT_stroke_start_set(wmOperatorType *ot) +{ + /* identifiers */ + ot->name = "Set Start Point"; + ot->idname = "GPENCIL_OT_stroke_start_set"; + ot->description = "Set start point for cyclic strokes"; + + /* api callbacks */ + ot->exec = gpencil_stroke_start_set_exec; + ot->poll = gpencil_active_layer_poll; + + /* flags */ + ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; +} + +/** \} */ + +/* -------------------------------------------------------------------- */ /** \name Stroke Re-project Operator * \{ */ diff --git a/source/blender/editors/gpencil/gpencil_intern.h b/source/blender/editors/gpencil/gpencil_intern.h index 3cb3a50e702..4d62f834d86 100644 --- a/source/blender/editors/gpencil/gpencil_intern.h +++ b/source/blender/editors/gpencil/gpencil_intern.h @@ -593,6 +593,7 @@ void GPENCIL_OT_stroke_cyclical_set(struct wmOperatorType *ot); */ void GPENCIL_OT_stroke_caps_set(struct wmOperatorType *ot); void GPENCIL_OT_stroke_join(struct wmOperatorType *ot); +void GPENCIL_OT_stroke_start_set(struct wmOperatorType *ot); void GPENCIL_OT_stroke_flip(struct wmOperatorType *ot); void GPENCIL_OT_stroke_subdivide(struct wmOperatorType *ot); void GPENCIL_OT_stroke_simplify(struct wmOperatorType *ot); diff --git a/source/blender/editors/gpencil/gpencil_ops.c b/source/blender/editors/gpencil/gpencil_ops.c index 3d92fbabfc4..85cc281ca90 100644 --- a/source/blender/editors/gpencil/gpencil_ops.c +++ b/source/blender/editors/gpencil/gpencil_ops.c @@ -621,6 +621,7 @@ void ED_operatortypes_gpencil(void) WM_operatortype_append(GPENCIL_OT_stroke_caps_set); WM_operatortype_append(GPENCIL_OT_stroke_join); WM_operatortype_append(GPENCIL_OT_stroke_flip); + WM_operatortype_append(GPENCIL_OT_stroke_start_set); WM_operatortype_append(GPENCIL_OT_stroke_subdivide); WM_operatortype_append(GPENCIL_OT_stroke_simplify); WM_operatortype_append(GPENCIL_OT_stroke_simplify_fixed); diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c index dfd724ca473..08565a86ee7 100644 --- a/source/blender/editors/screen/area.c +++ b/source/blender/editors/screen/area.c @@ -16,6 +16,7 @@ #include "BLI_linklist_stack.h" #include "BLI_math.h" #include "BLI_rand.h" +#include "BLI_string_utils.h" #include "BLI_utildefines.h" #include "BKE_context.h" @@ -2688,12 +2689,13 @@ static void ed_panel_draw(const bContext *C, const uiStyle *style = UI_style_get_dpi(); /* Draw panel. */ - char block_name[BKE_ST_MAXNAME + INSTANCED_PANEL_UNIQUE_STR_LEN]; - strncpy(block_name, pt->idname, BKE_ST_MAXNAME); - if (unique_panel_str != NULL) { + if (unique_panel_str) { /* Instanced panels should have already been added at this point. */ - strncat(block_name, unique_panel_str, INSTANCED_PANEL_UNIQUE_STR_LEN); + BLI_string_join(block_name, sizeof(block_name), pt->idname, unique_panel_str); + } + else { + STRNCPY(block_name, pt->idname); } uiBlock *block = UI_block_begin(C, region, block_name, UI_EMBOSS); diff --git a/source/blender/editors/space_action/space_action.c b/source/blender/editors/space_action/space_action.c index fc0588dbab5..98782ca15a8 100644 --- a/source/blender/editors/space_action/space_action.c +++ b/source/blender/editors/space_action/space_action.c @@ -840,7 +840,7 @@ void ED_spacetype_action(void) ARegionType *art; st->spaceid = SPACE_ACTION; - strncpy(st->name, "Action", BKE_ST_MAXNAME); + STRNCPY(st->name, "Action"); st->create = action_create; st->free = action_free; diff --git a/source/blender/editors/space_buttons/space_buttons.c b/source/blender/editors/space_buttons/space_buttons.c index 2bee60557b7..74b7fa3719a 100644 --- a/source/blender/editors/space_buttons/space_buttons.c +++ b/source/blender/editors/space_buttons/space_buttons.c @@ -917,7 +917,7 @@ void ED_spacetype_buttons(void) ARegionType *art; st->spaceid = SPACE_PROPERTIES; - strncpy(st->name, "Buttons", BKE_ST_MAXNAME); + STRNCPY(st->name, "Buttons"); st->create = buttons_create; st->free = buttons_free; diff --git a/source/blender/editors/space_clip/space_clip.c b/source/blender/editors/space_clip/space_clip.c index f8bf1893d89..ab952470757 100644 --- a/source/blender/editors/space_clip/space_clip.c +++ b/source/blender/editors/space_clip/space_clip.c @@ -1251,7 +1251,7 @@ void ED_spacetype_clip(void) ARegionType *art; st->spaceid = SPACE_CLIP; - strncpy(st->name, "Clip", BKE_ST_MAXNAME); + STRNCPY(st->name, "Clip"); st->create = clip_create; st->free = clip_free; diff --git a/source/blender/editors/space_console/space_console.c b/source/blender/editors/space_console/space_console.c index a7ab6bc5169..8af0c1fc6ab 100644 --- a/source/blender/editors/space_console/space_console.c +++ b/source/blender/editors/space_console/space_console.c @@ -289,7 +289,7 @@ void ED_spacetype_console(void) ARegionType *art; st->spaceid = SPACE_CONSOLE; - strncpy(st->name, "Console", BKE_ST_MAXNAME); + STRNCPY(st->name, "Console"); st->create = console_create; st->free = console_free; diff --git a/source/blender/editors/space_file/file_ops.c b/source/blender/editors/space_file/file_ops.c index 59d9a15fbab..721c58fc34e 100644 --- a/source/blender/editors/space_file/file_ops.c +++ b/source/blender/editors/space_file/file_ops.c @@ -367,6 +367,39 @@ static FileSelect file_select( /** \} */ /* -------------------------------------------------------------------- */ +/** \name Bookmark Utilities + * \{ */ + +/** + * Local utility to write #BLENDER_BOOKMARK_FILE, reporting an error on failure. + */ +static bool fsmenu_write_file_and_refresh_or_report_error(struct FSMenu *fsmenu, + ScrArea *area, + ReportList *reports) +{ + /* NOTE: use warning instead of error here, because the bookmark operation may be part of + * other actions which should not cause the operator to fail entirely. */ + const char *cfgdir = BKE_appdir_folder_id_create(BLENDER_USER_CONFIG, NULL); + if (UNLIKELY(!cfgdir)) { + BKE_report(reports, RPT_ERROR, "Unable to create configuration directory to write bookmarks"); + return false; + } + + char filepath[FILE_MAX]; + BLI_join_dirfile(filepath, sizeof(filepath), cfgdir, BLENDER_BOOKMARK_FILE); + if (UNLIKELY(!fsmenu_write_file(fsmenu, filepath))) { + BKE_reportf(reports, RPT_ERROR, "Unable to open or write bookmark file \"%s\"", filepath); + return false; + } + + ED_area_tag_refresh(area); + ED_area_tag_redraw(area); + return true; +} + +/** \} */ + +/* -------------------------------------------------------------------- */ /** \name Box Select Operator * \{ */ @@ -1053,19 +1086,17 @@ static int bookmark_select_exec(bContext *C, wmOperator *op) { Main *bmain = CTX_data_main(C); SpaceFile *sfile = CTX_wm_space_file(C); - PropertyRNA *prop; - if ((prop = RNA_struct_find_property(op->ptr, "dir"))) { - FileSelectParams *params = ED_fileselect_get_active_params(sfile); - char entry[256]; + PropertyRNA *prop = RNA_struct_find_property(op->ptr, "dir"); + FileSelectParams *params = ED_fileselect_get_active_params(sfile); + char entry[256]; - RNA_property_string_get(op->ptr, prop, entry); - BLI_strncpy(params->dir, entry, sizeof(params->dir)); - BLI_path_normalize_dir(BKE_main_blendfile_path(bmain), params->dir); - ED_file_change_dir(C); + RNA_property_string_get(op->ptr, prop, entry); + BLI_strncpy(params->dir, entry, sizeof(params->dir)); + BLI_path_normalize_dir(BKE_main_blendfile_path(bmain), params->dir); + ED_file_change_dir(C); - WM_event_add_notifier(C, NC_SPACE | ND_SPACE_FILE_LIST, NULL); - } + WM_event_add_notifier(C, NC_SPACE | ND_SPACE_FILE_LIST, NULL); return OPERATOR_FINISHED; } @@ -1095,7 +1126,7 @@ void FILE_OT_select_bookmark(wmOperatorType *ot) /** \name Add Bookmark Operator * \{ */ -static int bookmark_add_exec(bContext *C, wmOperator *UNUSED(op)) +static int bookmark_add_exec(bContext *C, wmOperator *op) { ScrArea *area = CTX_wm_area(C); SpaceFile *sfile = CTX_wm_space_file(C); @@ -1103,19 +1134,11 @@ static int bookmark_add_exec(bContext *C, wmOperator *UNUSED(op)) struct FileSelectParams *params = ED_fileselect_get_active_params(sfile); if (params->dir[0] != '\0') { - char name[FILE_MAX]; fsmenu_insert_entry( fsmenu, FS_CATEGORY_BOOKMARKS, params->dir, NULL, ICON_FILE_FOLDER, FS_INSERT_SAVE); - BLI_join_dirfile(name, - sizeof(name), - BKE_appdir_folder_id_create(BLENDER_USER_CONFIG, NULL), - BLENDER_BOOKMARK_FILE); - fsmenu_write_file(fsmenu, name); + fsmenu_write_file_and_refresh_or_report_error(fsmenu, area, op->reports); } - - ED_area_tag_refresh(area); - ED_area_tag_redraw(area); return OPERATOR_FINISHED; } @@ -1146,27 +1169,11 @@ static int bookmark_delete_exec(bContext *C, wmOperator *op) int nentries = ED_fsmenu_get_nentries(fsmenu, FS_CATEGORY_BOOKMARKS); PropertyRNA *prop = RNA_struct_find_property(op->ptr, "index"); - - if (prop) { - int index; - if (RNA_property_is_set(op->ptr, prop)) { - index = RNA_property_int_get(op->ptr, prop); - } - else { /* if index unset, use active bookmark... */ - index = sfile->bookmarknr; - } - if ((index > -1) && (index < nentries)) { - char name[FILE_MAX]; - - fsmenu_remove_entry(fsmenu, FS_CATEGORY_BOOKMARKS, index); - BLI_join_dirfile(name, - sizeof(name), - BKE_appdir_folder_id_create(BLENDER_USER_CONFIG, NULL), - BLENDER_BOOKMARK_FILE); - fsmenu_write_file(fsmenu, name); - ED_area_tag_refresh(area); - ED_area_tag_redraw(area); - } + const int index = RNA_property_is_set(op->ptr, prop) ? RNA_property_int_get(op->ptr, prop) : + sfile->bookmarknr; + if ((index > -1) && (index < nentries)) { + fsmenu_remove_entry(fsmenu, FS_CATEGORY_BOOKMARKS, index); + fsmenu_write_file_and_refresh_or_report_error(fsmenu, area, op->reports); } return OPERATOR_FINISHED; @@ -1197,7 +1204,7 @@ void FILE_OT_bookmark_delete(wmOperatorType *ot) /** \name Cleanup Bookmark Operator * \{ */ -static int bookmark_cleanup_exec(bContext *C, wmOperator *UNUSED(op)) +static int bookmark_cleanup_exec(bContext *C, wmOperator *op) { ScrArea *area = CTX_wm_area(C); struct FSMenu *fsmenu = ED_fsmenu_get(); @@ -1218,16 +1225,8 @@ static int bookmark_cleanup_exec(bContext *C, wmOperator *UNUSED(op)) } if (changed) { - char name[FILE_MAX]; - - BLI_join_dirfile(name, - sizeof(name), - BKE_appdir_folder_id_create(BLENDER_USER_CONFIG, NULL), - BLENDER_BOOKMARK_FILE); - fsmenu_write_file(fsmenu, name); + fsmenu_write_file_and_refresh_or_report_error(fsmenu, area, op->reports); fsmenu_refresh_bookmarks_status(CTX_wm_manager(C), fsmenu); - ED_area_tag_refresh(area); - ED_area_tag_redraw(area); } return OPERATOR_FINISHED; @@ -1269,8 +1268,6 @@ static int bookmark_move_exec(bContext *C, wmOperator *op) struct FSMenuEntry *fsmentry = ED_fsmenu_get_category(fsmenu, FS_CATEGORY_BOOKMARKS); const struct FSMenuEntry *fsmentry_org = fsmentry; - char fname[FILE_MAX]; - const int direction = RNA_enum_get(op->ptr, "direction"); const int totitems = ED_fsmenu_get_nentries(fsmenu, FS_CATEGORY_BOOKMARKS); const int act_index = sfile->bookmarknr; @@ -1306,13 +1303,8 @@ static int bookmark_move_exec(bContext *C, wmOperator *op) /* Need to update active bookmark number. */ sfile->bookmarknr = new_index; - BLI_join_dirfile(fname, - sizeof(fname), - BKE_appdir_folder_id_create(BLENDER_USER_CONFIG, NULL), - BLENDER_BOOKMARK_FILE); - fsmenu_write_file(fsmenu, fname); + fsmenu_write_file_and_refresh_or_report_error(fsmenu, area, op->reports); - ED_area_tag_redraw(area); return OPERATOR_FINISHED; } @@ -1352,21 +1344,16 @@ void FILE_OT_bookmark_move(wmOperatorType *ot) /** \name Reset Recent Blend Files Operator * \{ */ -static int reset_recent_exec(bContext *C, wmOperator *UNUSED(op)) +static int reset_recent_exec(bContext *C, wmOperator *op) { ScrArea *area = CTX_wm_area(C); - char name[FILE_MAX]; struct FSMenu *fsmenu = ED_fsmenu_get(); while (ED_fsmenu_get_entry(fsmenu, FS_CATEGORY_RECENT, 0) != NULL) { fsmenu_remove_entry(fsmenu, FS_CATEGORY_RECENT, 0); } - BLI_join_dirfile(name, - sizeof(name), - BKE_appdir_folder_id_create(BLENDER_USER_CONFIG, NULL), - BLENDER_BOOKMARK_FILE); - fsmenu_write_file(fsmenu, name); - ED_area_tag_redraw(area); + + fsmenu_write_file_and_refresh_or_report_error(fsmenu, area, op->reports); return OPERATOR_FINISHED; } @@ -1795,6 +1782,8 @@ static bool file_execute(bContext *C, SpaceFile *sfile) } /* Opening file, sends events now, so things get handled on window-queue level. */ else if (sfile->op) { + ScrArea *area = CTX_wm_area(C); + struct FSMenu *fsmenu = ED_fsmenu_get(); wmOperator *op = sfile->op; char filepath[FILE_MAX]; @@ -1803,7 +1792,7 @@ static bool file_execute(bContext *C, SpaceFile *sfile) file_sfile_to_operator_ex(bmain, op, sfile, filepath); if (BLI_exists(params->dir)) { - fsmenu_insert_entry(ED_fsmenu_get(), + fsmenu_insert_entry(fsmenu, FS_CATEGORY_RECENT, params->dir, NULL, @@ -1811,11 +1800,8 @@ static bool file_execute(bContext *C, SpaceFile *sfile) FS_INSERT_SAVE | FS_INSERT_FIRST); } - BLI_join_dirfile(filepath, - sizeof(filepath), - BKE_appdir_folder_id_create(BLENDER_USER_CONFIG, NULL), - BLENDER_BOOKMARK_FILE); - fsmenu_write_file(ED_fsmenu_get(), filepath); + fsmenu_write_file_and_refresh_or_report_error(fsmenu, area, op->reports); + WM_event_fileselect_event(CTX_wm_manager(C), op, EVT_FILESELECT_EXEC); } @@ -2327,7 +2313,6 @@ static int file_directory_new_exec(bContext *C, wmOperator *op) char name[FILE_MAXFILE]; char path[FILE_MAX]; bool generate_name = true; - PropertyRNA *prop; wmWindowManager *wm = CTX_wm_manager(C); SpaceFile *sfile = CTX_wm_space_file(C); @@ -2341,7 +2326,8 @@ static int file_directory_new_exec(bContext *C, wmOperator *op) path[0] = '\0'; - if ((prop = RNA_struct_find_property(op->ptr, "directory"))) { + { + PropertyRNA *prop = RNA_struct_find_property(op->ptr, "directory"); RNA_property_string_get(op->ptr, prop, path); if (path[0] != '\0') { generate_name = false; diff --git a/source/blender/editors/space_file/fsmenu.c b/source/blender/editors/space_file/fsmenu.c index 30e13235f45..35ce7ef364c 100644 --- a/source/blender/editors/space_file/fsmenu.c +++ b/source/blender/editors/space_file/fsmenu.c @@ -519,7 +519,7 @@ void fsmenu_remove_entry(struct FSMenu *fsmenu, FSMenuCategory category, int idx } } -void fsmenu_write_file(struct FSMenu *fsmenu, const char *filepath) +bool fsmenu_write_file(struct FSMenu *fsmenu, const char *filepath) { FSMenuEntry *fsm_iter = NULL; char fsm_name[FILE_MAX]; @@ -527,33 +527,36 @@ void fsmenu_write_file(struct FSMenu *fsmenu, const char *filepath) FILE *fp = BLI_fopen(filepath, "w"); if (!fp) { - return; + return false; } - fprintf(fp, "[Bookmarks]\n"); + bool has_error = false; + has_error |= (fprintf(fp, "[Bookmarks]\n") < 0); for (fsm_iter = ED_fsmenu_get_category(fsmenu, FS_CATEGORY_BOOKMARKS); fsm_iter; fsm_iter = fsm_iter->next) { if (fsm_iter->path && fsm_iter->save) { fsmenu_entry_generate_name(fsm_iter, fsm_name, sizeof(fsm_name)); if (fsm_iter->name[0] && !STREQ(fsm_iter->name, fsm_name)) { - fprintf(fp, "!%s\n", fsm_iter->name); + has_error |= (fprintf(fp, "!%s\n", fsm_iter->name) < 0); } - fprintf(fp, "%s\n", fsm_iter->path); + has_error |= (fprintf(fp, "%s\n", fsm_iter->path) < 0); } } - fprintf(fp, "[Recent]\n"); + has_error = (fprintf(fp, "[Recent]\n") < 0); for (fsm_iter = ED_fsmenu_get_category(fsmenu, FS_CATEGORY_RECENT); fsm_iter && (nwritten < FSMENU_RECENT_MAX); fsm_iter = fsm_iter->next, nwritten++) { if (fsm_iter->path && fsm_iter->save) { fsmenu_entry_generate_name(fsm_iter, fsm_name, sizeof(fsm_name)); if (fsm_iter->name[0] && !STREQ(fsm_iter->name, fsm_name)) { - fprintf(fp, "!%s\n", fsm_iter->name); + has_error |= (fprintf(fp, "!%s\n", fsm_iter->name) < 0); } - fprintf(fp, "%s\n", fsm_iter->path); + has_error |= (fprintf(fp, "%s\n", fsm_iter->path) < 0); } } fclose(fp); + + return !has_error; } void fsmenu_read_bookmarks(struct FSMenu *fsmenu, const char *filepath) diff --git a/source/blender/editors/space_file/fsmenu.h b/source/blender/editors/space_file/fsmenu.h index 6e980a326fc..f4f0dafbc73 100644 --- a/source/blender/editors/space_file/fsmenu.h +++ b/source/blender/editors/space_file/fsmenu.h @@ -37,8 +37,11 @@ short fsmenu_can_save(struct FSMenu *fsmenu, enum FSMenuCategory category, int i /** Removes the fsmenu entry at the given \a index. */ void fsmenu_remove_entry(struct FSMenu *fsmenu, enum FSMenuCategory category, int idx); -/** saves the 'bookmarks' to the specified file */ -void fsmenu_write_file(struct FSMenu *fsmenu, const char *filepath); +/** + * Saves the 'bookmarks' to the specified file. + * \return true on success. + */ +bool fsmenu_write_file(struct FSMenu *fsmenu, const char *filepath); /** reads the 'bookmarks' from the specified file */ void fsmenu_read_bookmarks(struct FSMenu *fsmenu, const char *filepath); diff --git a/source/blender/editors/space_file/space_file.c b/source/blender/editors/space_file/space_file.c index b5cad0f6ff8..bba0c27bb4d 100644 --- a/source/blender/editors/space_file/space_file.c +++ b/source/blender/editors/space_file/space_file.c @@ -992,7 +992,7 @@ void ED_spacetype_file(void) ARegionType *art; st->spaceid = SPACE_FILE; - strncpy(st->name, "File", BKE_ST_MAXNAME); + STRNCPY(st->name, "File"); st->create = file_create; st->free = file_free; diff --git a/source/blender/editors/space_graph/space_graph.c b/source/blender/editors/space_graph/space_graph.c index 3594c65c1cb..1434f204ee5 100644 --- a/source/blender/editors/space_graph/space_graph.c +++ b/source/blender/editors/space_graph/space_graph.c @@ -810,7 +810,7 @@ void ED_spacetype_ipo(void) ARegionType *art; st->spaceid = SPACE_GRAPH; - strncpy(st->name, "Graph", BKE_ST_MAXNAME); + STRNCPY(st->name, "Graph"); st->create = graph_create; st->free = graph_free; diff --git a/source/blender/editors/space_image/space_image.c b/source/blender/editors/space_image/space_image.c index 67bff9677dc..08b7897ec5a 100644 --- a/source/blender/editors/space_image/space_image.c +++ b/source/blender/editors/space_image/space_image.c @@ -1029,7 +1029,7 @@ void ED_spacetype_image(void) ARegionType *art; st->spaceid = SPACE_IMAGE; - strncpy(st->name, "Image", BKE_ST_MAXNAME); + STRNCPY(st->name, "Image"); st->create = image_create; st->free = image_free; diff --git a/source/blender/editors/space_info/space_info.c b/source/blender/editors/space_info/space_info.c index 1513ba5e892..63c8d74c684 100644 --- a/source/blender/editors/space_info/space_info.c +++ b/source/blender/editors/space_info/space_info.c @@ -254,7 +254,7 @@ void ED_spacetype_info(void) ARegionType *art; st->spaceid = SPACE_INFO; - strncpy(st->name, "Info", BKE_ST_MAXNAME); + STRNCPY(st->name, "Info"); st->create = info_create; st->free = info_free; diff --git a/source/blender/editors/space_nla/space_nla.c b/source/blender/editors/space_nla/space_nla.c index ba7e8987dd5..c71e63e9dcd 100644 --- a/source/blender/editors/space_nla/space_nla.c +++ b/source/blender/editors/space_nla/space_nla.c @@ -568,7 +568,7 @@ void ED_spacetype_nla(void) ARegionType *art; st->spaceid = SPACE_NLA; - strncpy(st->name, "NLA", BKE_ST_MAXNAME); + STRNCPY(st->name, "NLA"); st->create = nla_create; st->free = nla_free; diff --git a/source/blender/editors/space_node/space_node.cc b/source/blender/editors/space_node/space_node.cc index 17fc02e98a8..fae3eb1a143 100644 --- a/source/blender/editors/space_node/space_node.cc +++ b/source/blender/editors/space_node/space_node.cc @@ -1021,7 +1021,7 @@ void ED_spacetype_node() ARegionType *art; st->spaceid = SPACE_NODE; - strncpy(st->name, "Node", BKE_ST_MAXNAME); + STRNCPY(st->name, "Node"); st->create = node_create; st->free = node_free; diff --git a/source/blender/editors/space_outliner/space_outliner.cc b/source/blender/editors/space_outliner/space_outliner.cc index 76b7197b86a..365bcae3f5d 100644 --- a/source/blender/editors/space_outliner/space_outliner.cc +++ b/source/blender/editors/space_outliner/space_outliner.cc @@ -445,7 +445,7 @@ void ED_spacetype_outliner(void) ARegionType *art; st->spaceid = SPACE_OUTLINER; - strncpy(st->name, "Outliner", BKE_ST_MAXNAME); + STRNCPY(st->name, "Outliner"); st->create = outliner_create; st->free = outliner_free; diff --git a/source/blender/editors/space_script/space_script.c b/source/blender/editors/space_script/space_script.c index a623b98f1b1..c35b1e00184 100644 --- a/source/blender/editors/space_script/space_script.c +++ b/source/blender/editors/space_script/space_script.c @@ -152,7 +152,7 @@ void ED_spacetype_script(void) ARegionType *art; st->spaceid = SPACE_SCRIPT; - strncpy(st->name, "Script", BKE_ST_MAXNAME); + STRNCPY(st->name, "Script"); st->create = script_create; st->free = script_free; diff --git a/source/blender/editors/space_sequencer/space_sequencer.c b/source/blender/editors/space_sequencer/space_sequencer.c index 201f132052d..538cfad14f5 100644 --- a/source/blender/editors/space_sequencer/space_sequencer.c +++ b/source/blender/editors/space_sequencer/space_sequencer.c @@ -997,7 +997,7 @@ void ED_spacetype_sequencer(void) ARegionType *art; st->spaceid = SPACE_SEQ; - strncpy(st->name, "Sequencer", BKE_ST_MAXNAME); + STRNCPY(st->name, "Sequencer"); st->create = sequencer_create; st->free = sequencer_free; diff --git a/source/blender/editors/space_spreadsheet/space_spreadsheet.cc b/source/blender/editors/space_spreadsheet/space_spreadsheet.cc index 5c0f69905fa..435436611c5 100644 --- a/source/blender/editors/space_spreadsheet/space_spreadsheet.cc +++ b/source/blender/editors/space_spreadsheet/space_spreadsheet.cc @@ -619,7 +619,7 @@ void ED_spacetype_spreadsheet() ARegionType *art; st->spaceid = SPACE_SPREADSHEET; - strncpy(st->name, "Spreadsheet", BKE_ST_MAXNAME); + STRNCPY(st->name, "Spreadsheet"); st->create = spreadsheet_create; st->free = spreadsheet_free; diff --git a/source/blender/editors/space_statusbar/space_statusbar.c b/source/blender/editors/space_statusbar/space_statusbar.c index 9c64235870c..e99e8f21364 100644 --- a/source/blender/editors/space_statusbar/space_statusbar.c +++ b/source/blender/editors/space_statusbar/space_statusbar.c @@ -136,7 +136,7 @@ void ED_spacetype_statusbar(void) ARegionType *art; st->spaceid = SPACE_STATUSBAR; - strncpy(st->name, "Status Bar", BKE_ST_MAXNAME); + STRNCPY(st->name, "Status Bar"); st->create = statusbar_create; st->free = statusbar_free; diff --git a/source/blender/editors/space_text/space_text.c b/source/blender/editors/space_text/space_text.c index 45cf557c4b4..be9bbdf109e 100644 --- a/source/blender/editors/space_text/space_text.c +++ b/source/blender/editors/space_text/space_text.c @@ -403,7 +403,7 @@ void ED_spacetype_text(void) ARegionType *art; st->spaceid = SPACE_TEXT; - strncpy(st->name, "Text", BKE_ST_MAXNAME); + STRNCPY(st->name, "Text"); st->create = text_create; st->free = text_free; diff --git a/source/blender/editors/space_text/text_draw.c b/source/blender/editors/space_text/text_draw.c index 0f0ecb0e4bf..46c459dd0bc 100644 --- a/source/blender/editors/space_text/text_draw.c +++ b/source/blender/editors/space_text/text_draw.c @@ -706,7 +706,7 @@ static void text_update_drawcache(SpaceText *st, ARegion *region) drawcache->showlinenrs = st->showlinenrs; drawcache->tabnumber = st->tabnumber; - strncpy(drawcache->text_id, txt->id.name, MAX_ID_NAME); + STRNCPY(drawcache->text_id, txt->id.name); /* clear update flag */ drawcache->update_flag = 0; diff --git a/source/blender/editors/space_topbar/space_topbar.c b/source/blender/editors/space_topbar/space_topbar.c index ee0e0c3ef46..e4826ed5964 100644 --- a/source/blender/editors/space_topbar/space_topbar.c +++ b/source/blender/editors/space_topbar/space_topbar.c @@ -288,7 +288,7 @@ void ED_spacetype_topbar(void) ARegionType *art; st->spaceid = SPACE_TOPBAR; - strncpy(st->name, "Top Bar", BKE_ST_MAXNAME); + STRNCPY(st->name, "Top Bar"); st->create = topbar_create; st->free = topbar_free; diff --git a/source/blender/editors/space_userpref/space_userpref.c b/source/blender/editors/space_userpref/space_userpref.c index 1cda9cc0f0c..06a4c1d8702 100644 --- a/source/blender/editors/space_userpref/space_userpref.c +++ b/source/blender/editors/space_userpref/space_userpref.c @@ -189,7 +189,7 @@ void ED_spacetype_userpref(void) ARegionType *art; st->spaceid = SPACE_USERPREF; - strncpy(st->name, "Userpref", BKE_ST_MAXNAME); + STRNCPY(st->name, "Userpref"); st->create = userpref_create; st->free = userpref_free; diff --git a/source/blender/editors/space_view3d/space_view3d.c b/source/blender/editors/space_view3d/space_view3d.c index 73b009bc1e0..c1c7147b3b1 100644 --- a/source/blender/editors/space_view3d/space_view3d.c +++ b/source/blender/editors/space_view3d/space_view3d.c @@ -1972,7 +1972,7 @@ void ED_spacetype_view3d(void) ARegionType *art; st->spaceid = SPACE_VIEW3D; - strncpy(st->name, "View3D", BKE_ST_MAXNAME); + STRNCPY(st->name, "View3D"); st->create = view3d_create; st->free = view3d_free; |