diff options
author | Hans Goudey <h.goudey@me.com> | 2020-11-16 20:03:01 +0300 |
---|---|---|
committer | Hans Goudey <h.goudey@me.com> | 2020-11-16 20:03:01 +0300 |
commit | b26cbb5d53ccfa2f0f434040de4a20831128aed1 (patch) | |
tree | 821b775e5785b62060d2cd4589f5cc6f2f0ae277 | |
parent | 52e3608fe9b6c72739570ac6abe1473953c10f1d (diff) | |
parent | 328aad8c98c931c3d1850c838c5cb58953ee49cf (diff) |
Merge branch 'master' into geometry-nodes
-rw-r--r-- | source/blender/blenkernel/intern/collection.c | 14 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/movieclip.c | 1 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/object.c | 4 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/pointcache.c | 91 | ||||
-rw-r--r-- | source/blender/blenlib/intern/fileops.c | 7 | ||||
-rw-r--r-- | source/blender/blenlib/intern/mesh_intersect.cc | 2 | ||||
-rw-r--r-- | source/blender/editors/gpencil/gpencil_select.c | 9 | ||||
-rw-r--r-- | source/blender/editors/gpencil/gpencil_utils.c | 2 | ||||
-rw-r--r-- | source/blender/editors/interface/interface_panel.c | 6 | ||||
-rw-r--r-- | source/blender/imbuf/intern/colormanagement.c | 2 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_fcurve.c | 1 | ||||
-rw-r--r-- | source/blender/windowmanager/intern/wm_splash_screen.c | 7 |
12 files changed, 90 insertions, 56 deletions
diff --git a/source/blender/blenkernel/intern/collection.c b/source/blender/blenkernel/intern/collection.c index 7ab63810719..ab92480cce2 100644 --- a/source/blender/blenkernel/intern/collection.c +++ b/source/blender/blenkernel/intern/collection.c @@ -1864,15 +1864,23 @@ bool BKE_collection_move(Main *bmain, } /* Make sure we store the flag of the layer collections before we remove and re-create them. - * Otherwise they will get lost and everything will be copied from the new parent collection. */ + * Otherwise they will get lost and everything will be copied from the new parent collection. + * Don't use flag syncing when moving a collection to a different scene, as it no longer exists + * in the same view layers anyway. */ + const bool do_flag_sync = BKE_scene_find_from_collection(bmain, to_parent) == + BKE_scene_find_from_collection(bmain, collection); ListBase layer_flags; - layer_collection_flags_store(bmain, collection, &layer_flags); + if (do_flag_sync) { + layer_collection_flags_store(bmain, collection, &layer_flags); + } /* Create and remove layer collections. */ BKE_main_collection_sync(bmain); /* Restore the original layer collection flags. */ - layer_collection_flags_restore(&layer_flags, collection); + if (do_flag_sync) { + layer_collection_flags_restore(&layer_flags, collection); + } /* We need to sync it again to pass the correct flags to the collections objects. */ BKE_main_collection_sync(bmain); diff --git a/source/blender/blenkernel/intern/movieclip.c b/source/blender/blenkernel/intern/movieclip.c index 564496744df..b872c91cc29 100644 --- a/source/blender/blenkernel/intern/movieclip.c +++ b/source/blender/blenkernel/intern/movieclip.c @@ -274,6 +274,7 @@ static void movieclip_blend_read_data(BlendDataReader *reader, ID *id) MovieTracking *tracking = &clip->tracking; BLO_read_data_address(reader, &clip->adt); + BKE_animdata_blend_read_data(reader, clip->adt); direct_link_movieTracks(reader, &tracking->tracks); direct_link_moviePlaneTracks(reader, &tracking->plane_tracks); diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c index 6c0110fc35f..bc1e8b264d9 100644 --- a/source/blender/blenkernel/intern/object.c +++ b/source/blender/blenkernel/intern/object.c @@ -4323,6 +4323,10 @@ static int pc_cmp(const void *a, const void *b) return 0; } +/* TODO: Review the usages of this function, currently with COW it will be called for orig object + * and then again for COW copies of it, think this is bad since there is no guarantee that we get + * the same stack index in both cases? Order is important since this index is used for filenames on + * disk. */ int BKE_object_insert_ptcache(Object *ob) { LinkData *link = NULL; diff --git a/source/blender/blenkernel/intern/pointcache.c b/source/blender/blenkernel/intern/pointcache.c index 069251e7e41..37eeee57475 100644 --- a/source/blender/blenkernel/intern/pointcache.c +++ b/source/blender/blenkernel/intern/pointcache.c @@ -1363,6 +1363,58 @@ static int ptcache_path(PTCacheID *pid, char *filename) return BLI_path_slash_ensure(filename); /* new strlen() */ } +static size_t ptcache_filename_ext_append(PTCacheID *pid, + char *filename, + const size_t filename_len, + const bool use_frame_number, + const int cfra) +{ + size_t len = filename_len; + char *filename_ext; + filename_ext = filename + filename_len; + *filename_ext = '\0'; + + /* PointCaches are inserted in object's list on demand, we need a valid index now. */ + if (pid->cache->index < 0) { + BLI_assert(GS(pid->owner_id->name) == ID_OB); + pid->cache->index = pid->stack_index = BKE_object_insert_ptcache((Object *)pid->owner_id); + } + + const char *ext = ptcache_file_extension(pid); + if (use_frame_number) { + if (pid->cache->flag & PTCACHE_EXTERNAL) { + if (pid->cache->index >= 0) { + len += BLI_snprintf_rlen( + filename_ext, MAX_PTCACHE_FILE - len, "_%06d_%02u%s", cfra, pid->stack_index, ext); + } + else { + len += BLI_snprintf_rlen(filename_ext, MAX_PTCACHE_FILE - len, "_%06d%s", cfra, ext); + } + } + else { + len += BLI_snprintf_rlen( + filename_ext, MAX_PTCACHE_FILE - len, "_%06d_%02u%s", cfra, pid->stack_index, ext); + } + } + else { + if (pid->cache->flag & PTCACHE_EXTERNAL) { + if (pid->cache->index >= 0) { + len += BLI_snprintf_rlen( + filename_ext, MAX_PTCACHE_FILE - len, "_%02u%s", pid->stack_index, ext); + } + else { + len += BLI_snprintf_rlen(filename_ext, MAX_PTCACHE_FILE - len, "%s", ext); + } + } + else { + len += BLI_snprintf_rlen( + filename_ext, MAX_PTCACHE_FILE - len, "_%02u%s", pid->stack_index, ext); + } + } + + return len; +} + static int ptcache_filename(PTCacheID *pid, char *filename, int cfra, short do_path, short do_ext) { int len = 0; @@ -1384,7 +1436,7 @@ static int ptcache_filename(PTCacheID *pid, char *filename, int cfra, short do_p idname = (pid->owner_id->name + 2); /* convert chars to hex so they are always a valid filename */ while ('\0' != *idname) { - BLI_snprintf(newname, MAX_PTCACHE_FILE, "%02X", (unsigned int)(*idname++)); + BLI_snprintf(newname, MAX_PTCACHE_FILE - len, "%02X", (unsigned int)(*idname++)); newname += 2; len += 2; } @@ -1397,28 +1449,7 @@ static int ptcache_filename(PTCacheID *pid, char *filename, int cfra, short do_p } if (do_ext) { - if (pid->cache->index < 0) { - BLI_assert(GS(pid->owner_id->name) == ID_OB); - pid->cache->index = pid->stack_index = BKE_object_insert_ptcache((Object *)pid->owner_id); - } - - const char *ext = ptcache_file_extension(pid); - - if (pid->cache->flag & PTCACHE_EXTERNAL) { - if (pid->cache->index >= 0) { - /* Always 6 chars. */ - BLI_snprintf(newname, MAX_PTCACHE_FILE, "_%06d_%02u%s", cfra, pid->stack_index, ext); - } - else { - /* Always 6 chars. */ - BLI_snprintf(newname, MAX_PTCACHE_FILE, "_%06d%s", cfra, ext); - } - } - else { - /* Always 6 chars. */ - BLI_snprintf(newname, MAX_PTCACHE_FILE, "_%06d_%02u%s", cfra, pid->stack_index, ext); - } - len += 16; + len += ptcache_filename_ext_append(pid, filename, (size_t)len, true, cfra); } return len; /* make sure the above string is always 16 chars */ @@ -1431,7 +1462,7 @@ static PTCacheFile *ptcache_file_open(PTCacheID *pid, int mode, int cfra) { PTCacheFile *pf; FILE *fp = NULL; - char filename[FILE_MAX * 2]; + char filename[MAX_PTCACHE_FILE]; #ifndef DURIAN_POINTCACHE_LIB_OK /* don't allow writing for linked objects */ @@ -2588,8 +2619,6 @@ void BKE_ptcache_id_clear(PTCacheID *pid, int mode, unsigned int cfra) /*if (!G.relbase_valid) return; */ /* save blend file before using pointcache */ - const char *fext = ptcache_file_extension(pid); - /* clear all files in the temp dir with the prefix of the ID and the ".bphys" suffix */ switch (mode) { case PTCACHE_CLEAR_ALL: @@ -2612,7 +2641,7 @@ void BKE_ptcache_id_clear(PTCacheID *pid, int mode, unsigned int cfra) len += 1; } - BLI_snprintf(ext, sizeof(ext), "_%02u%s", pid->stack_index, fext); + ptcache_filename_ext_append(pid, ext, 0, false, 0); while ((de = readdir(dir)) != NULL) { if (strstr(de->d_name, ext)) { /* do we have the right extension?*/ @@ -2809,9 +2838,7 @@ void BKE_ptcache_id_time( return; } - const char *fext = ptcache_file_extension(pid); - - BLI_snprintf(ext, sizeof(ext), "_%02u%s", pid->stack_index, fext); + ptcache_filename_ext_append(pid, ext, 0, false, 0); while ((de = readdir(dir)) != NULL) { if (strstr(de->d_name, ext)) { /* do we have the right extension?*/ @@ -3523,9 +3550,7 @@ void BKE_ptcache_disk_cache_rename(PTCacheID *pid, const char *name_src, const c return; } - const char *fext = ptcache_file_extension(pid); - - BLI_snprintf(ext, sizeof(ext), "_%02u%s", pid->stack_index, fext); + ptcache_filename_ext_append(pid, ext, 0, false, 0); /* put new name into cache */ BLI_strncpy(pid->cache->name, name_dst, sizeof(pid->cache->name)); diff --git a/source/blender/blenlib/intern/fileops.c b/source/blender/blenlib/intern/fileops.c index 413c2007b1b..bb218995c83 100644 --- a/source/blender/blenlib/intern/fileops.c +++ b/source/blender/blenlib/intern/fileops.c @@ -357,7 +357,12 @@ void *BLI_gzopen(const char *filename, const char *mode) /* xxx Creates file before transcribing the path */ if (mode[0] == 'w') { - fclose(ufopen(filename, "a")); + FILE *file = ufopen(filename, "a"); + if (file == NULL) { + /* File couldn't be opened, e.g. due to permission error. */ + return NULL; + } + fclose(file); } /* temporary #if until we update all libraries to 1.2.7 diff --git a/source/blender/blenlib/intern/mesh_intersect.cc b/source/blender/blenlib/intern/mesh_intersect.cc index 3929cc12198..4eff3c52e63 100644 --- a/source/blender/blenlib/intern/mesh_intersect.cc +++ b/source/blender/blenlib/intern/mesh_intersect.cc @@ -696,7 +696,7 @@ void IMesh::remove_null_faces() { int64_t nullcount = 0; for (Face *f : this->face_) { - if (f == NULL) { + if (f == nullptr) { ++nullcount; } } diff --git a/source/blender/editors/gpencil/gpencil_select.c b/source/blender/editors/gpencil/gpencil_select.c index ddd8a11d9b5..2c0b9534141 100644 --- a/source/blender/editors/gpencil/gpencil_select.c +++ b/source/blender/editors/gpencil/gpencil_select.c @@ -2279,12 +2279,15 @@ static int gpencil_select_exec(bContext *C, wmOperator *op) if (toggle) { if (hit_curve_point != NULL) { BezTriple *bezt = &hit_curve_point->bezt; - if (bezt->f1 & SELECT && hit_curve_handle == 0) + if ((bezt->f1 & SELECT) && (hit_curve_handle == 0)) { deselect = true; - if (bezt->f2 & SELECT && hit_curve_handle == 1) + } + if ((bezt->f2 & SELECT) && (hit_curve_handle == 1)) { deselect = true; - if (bezt->f3 & SELECT && hit_curve_handle == 2) + } + if ((bezt->f3 & SELECT) && (hit_curve_handle == 2)) { deselect = true; + } } else { deselect = (hit_point->flag & GP_SPOINT_SELECT) != 0; diff --git a/source/blender/editors/gpencil/gpencil_utils.c b/source/blender/editors/gpencil/gpencil_utils.c index 19aa3b69bbb..76a584fcac1 100644 --- a/source/blender/editors/gpencil/gpencil_utils.c +++ b/source/blender/editors/gpencil/gpencil_utils.c @@ -2250,7 +2250,7 @@ static void gpencil_insert_point(bGPdata *gpd, bGPDspoint *a_pt, bGPDspoint *b_pt, const float co_a[3], - float co_b[3]) + const float co_b[3]) { bGPDspoint *temp_points; int totnewpoints, oldtotpoints; diff --git a/source/blender/editors/interface/interface_panel.c b/source/blender/editors/interface/interface_panel.c index ecc22656366..aafc1c53a3b 100644 --- a/source/blender/editors/interface/interface_panel.c +++ b/source/blender/editors/interface/interface_panel.c @@ -1927,20 +1927,16 @@ static void ui_do_drag(const bContext *C, const wmEvent *event, Panel *panel) ARegion *region = CTX_wm_region(C); /* Keep the drag position in the region with a small pad to keep the panel visible. */ - const int x = clamp_i(event->x, region->winrct.xmin, region->winrct.xmax + DRAG_REGION_PAD); const int y = clamp_i(event->y, region->winrct.ymin, region->winrct.ymax + DRAG_REGION_PAD); - float dx = (float)(x - data->startx); float dy = (float)(y - data->starty); /* Adjust for region zoom. */ - dx *= BLI_rctf_size_x(®ion->v2d.cur) / (float)BLI_rcti_size_x(®ion->winrct); dy *= BLI_rctf_size_y(®ion->v2d.cur) / (float)BLI_rcti_size_y(®ion->winrct); /* Add the movement of the view due to edge scrolling while dragging. */ - dx += ((float)region->v2d.cur.xmin - data->start_cur_xmin); dy += ((float)region->v2d.cur.ymin - data->start_cur_ymin); - panel->ofsx = data->startofsx + round_fl_to_int(dx); + panel->ofsy = data->startofsy + round_fl_to_int(dy); uiAlignPanelStep(region, 0.2f, true); diff --git a/source/blender/imbuf/intern/colormanagement.c b/source/blender/imbuf/intern/colormanagement.c index 9dced926dcc..2c95d49612f 100644 --- a/source/blender/imbuf/intern/colormanagement.c +++ b/source/blender/imbuf/intern/colormanagement.c @@ -4038,7 +4038,7 @@ static void curve_mapping_to_ocio_settings(CurveMapping *curve_mapping, copy_v3_v3(curve_mapping_settings->black, curve_mapping->black); copy_v3_v3(curve_mapping_settings->bwmul, curve_mapping->bwmul); - curve_mapping_settings->cache_id = (size_t)curve_mapping; + curve_mapping_settings->cache_id = (size_t)curve_mapping + curve_mapping->changed_timestamp; } static void update_glsl_display_processor(const ColorManagedViewSettings *view_settings, diff --git a/source/blender/makesrna/intern/rna_fcurve.c b/source/blender/makesrna/intern/rna_fcurve.c index 38328628f11..8734984d4e1 100644 --- a/source/blender/makesrna/intern/rna_fcurve.c +++ b/source/blender/makesrna/intern/rna_fcurve.c @@ -267,7 +267,6 @@ static void rna_DriverTarget_update_data(Main *bmain, Scene *scene, PointerRNA * /*BLI_findindex(&driver->targets, ptr->data) != -1) */ RNA_pointer_create(ptr->owner_id, &RNA_Driver, driver, &driverptr); rna_ChannelDriver_update_data(bmain, scene, &driverptr); - return; } } } diff --git a/source/blender/windowmanager/intern/wm_splash_screen.c b/source/blender/windowmanager/intern/wm_splash_screen.c index ec1c4440474..d732393b631 100644 --- a/source/blender/windowmanager/intern/wm_splash_screen.c +++ b/source/blender/windowmanager/intern/wm_splash_screen.c @@ -72,12 +72,6 @@ static void wm_block_close(bContext *C, void *arg_block, void *UNUSED(arg)) UI_popup_block_close(C, win, arg_block); } -static void wm_block_splash_refreshmenu(bContext *C, void *UNUSED(arg_block), void *UNUSED(arg)) -{ - ARegion *region_menu = CTX_wm_menu(C); - ED_region_tag_refresh_ui(region_menu); -} - static void wm_block_splash_add_label(uiBlock *block, const char *label, int x, int y) { if (!(label && label[0])) { @@ -217,7 +211,6 @@ static uiBlock *wm_block_create_splash(bContext *C, ARegion *region, void *UNUSE block, ibuf, 0, 0.5f * U.widget_unit, splash_width, splash_height, NULL); UI_but_func_set(but, wm_block_close, block, NULL); - UI_block_func_set(block, wm_block_splash_refreshmenu, block, NULL); wm_block_splash_add_label( block, BKE_blender_version_string(), splash_width, splash_height - 13.0 * U.dpi_fac); |