From 64aa6c68d5324f30338172316643b8a50b0971b9 Mon Sep 17 00:00:00 2001 From: Jacques Lucke Date: Mon, 16 Nov 2020 11:30:24 +0100 Subject: Fix T81817: use-after-free when trying to open file from splash screen The issues was that Blender was trying to refresh the splash screen region. However, opening the file browser closed the splash screen and freed the region. The fix is to simply not refresh the region. Has been approved in T81817. --- source/blender/windowmanager/intern/wm_splash_screen.c | 7 ------- 1 file changed, 7 deletions(-) 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); -- cgit v1.2.3 From af013ff76feef7e8b8ba642279c62a5dc275d59f Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 16 Nov 2020 21:54:28 +1100 Subject: Cleanup: clang-tidy --- source/blender/blenlib/intern/mesh_intersect.cc | 2 +- source/blender/editors/gpencil/gpencil_select.c | 9 ++++++--- source/blender/editors/gpencil/gpencil_utils.c | 2 +- 3 files changed, 8 insertions(+), 5 deletions(-) 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; -- cgit v1.2.3 From ada79b4707edc859a9616390f8dc319c1d2e35c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sybren=20A=2E=20St=C3=BCvel?= Date: Mon, 16 Nov 2020 12:11:09 +0100 Subject: Fix T82740: Drivers on movie clip datablock crash on file open Add call to `BKE_animdata_blend_read_data()` after remapping the MovieClip datablock address. --- source/blender/blenkernel/intern/movieclip.c | 1 + 1 file changed, 1 insertion(+) diff --git a/source/blender/blenkernel/intern/movieclip.c b/source/blender/blenkernel/intern/movieclip.c index 40b12d8a777..54131342489 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); -- cgit v1.2.3 From 7db42b8f2a8cdec5067f2fe73082bd5d806a5e42 Mon Sep 17 00:00:00 2001 From: Philipp Oeser Date: Fri, 13 Nov 2020 22:09:37 +0100 Subject: Fix T82460: Color Management Curves do not update when Image/UV Editor is present Caused by rB4212b6528afb. 'updateGLSLCurveMapping()' compares cacheIDs and in certain scenarios, these are the same when they should not. - whenever we had multiple viewports that are colormanaged with curvemappings this worked right (cacheIDs were different) - for example, this also worked right when the ImageEditor displays a Render Result or a Compositor Viewer - but it worked wrong when the Image Editor displays any other Image (or no Image at all) - it also worked right if there were multiple Image Editors [and one of them displays a Render Result e.g] Now why is this so? For comparison, the curve mapping's pointer/address is used. - update_glsl_display_processor frees the curve_mapping, see BKE_curvemapping_free(global_glsl_state.curve_mapping) - similar, update_glsl_display_processor creates a new curvemapping, see BKE_curvemapping_copy(view_settings->curve_mapping) - now for the situation that a viewport with curvemapping and a viewport without curvemapping is present and you make changes to the curvemapping the following happens: -- curve_mapping_settings->cache_id is set once [to the memory address of curvemapping before change] -- change happens -- viewport 1 frees curvemapping -- viewport 2 duplicates using BKE_curvemapping_copy, but this one gets the same address like before the change -- this means we have different data on the same address with the same cacheID... Solution: to really make the cache ID unique we can combine the pointer with its 'changed_timestamp' [which increases on every change]. Reviewers: jbakker Maniphest Tasks: T82460 Differential Revision: https://developer.blender.org/D9559 --- source/blender/imbuf/intern/colormanagement.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/blender/imbuf/intern/colormanagement.c b/source/blender/imbuf/intern/colormanagement.c index 8005049eab2..7847ae83c19 100644 --- a/source/blender/imbuf/intern/colormanagement.c +++ b/source/blender/imbuf/intern/colormanagement.c @@ -4044,7 +4044,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, -- cgit v1.2.3 From 8b815c7ce565b707fca9e9793bbec9784856f0f9 Mon Sep 17 00:00:00 2001 From: Robert Guetzkow Date: Mon, 16 Nov 2020 13:04:23 +0100 Subject: Fix T81271: Fix crash in BLI_gzopen on Windows Previously the return value of `ufopen` wasn't checked and if it failed, `NULL` was passed into `fclose()` which resulted in a crash. This patch avoids this by returning from `BLI_gzopen` when the file cannot be created. Reviewed By: sebbas, iss Differential Revision: https://developer.blender.org/D9576 --- source/blender/blenlib/intern/fileops.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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 -- cgit v1.2.3 From 75af3165ca6bf4cbb54a9f63e89cc10c90cd982c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabr=C3=ADcio=20Luis?= Date: Mon, 16 Nov 2020 13:55:17 +0100 Subject: Fix T82519: Adding 2nd driver doesn't recalculate Remove `return` from for-loop which blocked the recalculation of driven values when it found the first driver. Reviewed By: sybren, sergey Differential Revision: https://developer.blender.org/D9515 --- source/blender/makesrna/intern/rna_fcurve.c | 1 - 1 file changed, 1 deletion(-) 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; } } } -- cgit v1.2.3 From f39fbb3e604611b63c69661dd22ca987fb1d8791 Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Fri, 13 Nov 2020 15:25:17 +0100 Subject: RNA define: check and report invalid usages of ID pointers properties. Some RNA structs, like operators or keymaps, are not allowed to have ID pointer properties. now this check will ignore those, and report an error message in the console. Related to T82597. --- source/blender/makesrna/intern/rna_define.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/source/blender/makesrna/intern/rna_define.c b/source/blender/makesrna/intern/rna_define.c index 1b0a2fca0ce..b72afe88dda 100644 --- a/source/blender/makesrna/intern/rna_define.c +++ b/source/blender/makesrna/intern/rna_define.c @@ -1823,6 +1823,13 @@ void RNA_def_property_struct_runtime(PropertyRNA *prop, StructRNA *type) switch (prop->type) { case PROP_POINTER: { + if ((srna->flag & STRUCT_NO_DATABLOCK_IDPROPERTIES) != 0 && (type->flag & STRUCT_ID) != 0) { + CLOG_ERROR(&LOG, + "Struct \"%s\" (probably an operator or keymap) does not allow pointer " + "properties to ID datablocks.", + srna->identifier); + return; + } PointerPropertyRNA *pprop = (PointerPropertyRNA *)prop; pprop->type = type; -- cgit v1.2.3 From 97d52daf960f914e771c9732d13ee122fc6d13e7 Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Mon, 16 Nov 2020 11:16:03 +0100 Subject: Fix (unreported) potential buffer overflow in PointCache code. --- source/blender/blenkernel/intern/pointcache.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/source/blender/blenkernel/intern/pointcache.c b/source/blender/blenkernel/intern/pointcache.c index 5c60b39e9c8..4784df6e4c3 100644 --- a/source/blender/blenkernel/intern/pointcache.c +++ b/source/blender/blenkernel/intern/pointcache.c @@ -1387,7 +1387,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; } @@ -1410,16 +1410,16 @@ static int ptcache_filename(PTCacheID *pid, char *filename, int cfra, short do_p 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); + BLI_snprintf(newname, MAX_PTCACHE_FILE - len, "_%06d_%02u%s", cfra, pid->stack_index, ext); } else { /* Always 6 chars. */ - BLI_snprintf(newname, MAX_PTCACHE_FILE, "_%06d%s", cfra, ext); + BLI_snprintf(newname, MAX_PTCACHE_FILE - len, "_%06d%s", cfra, ext); } } else { /* Always 6 chars. */ - BLI_snprintf(newname, MAX_PTCACHE_FILE, "_%06d_%02u%s", cfra, pid->stack_index, ext); + BLI_snprintf(newname, MAX_PTCACHE_FILE - len, "_%06d_%02u%s", cfra, pid->stack_index, ext); } len += 16; } @@ -1434,7 +1434,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 */ -- cgit v1.2.3 From 13bcb000fa81effa3c8302b2faba853c93a6c573 Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Mon, 16 Nov 2020 12:29:21 +0100 Subject: Fix broken pointcache on disk in some cases. Root of the issue is that point caches are added to the object's list on-demand, which often ends up with them being added only during depsgraph evaluation, i.e. on COW objects. This could result in having 'orig' data caches with invalid/unset stack index at some points (e.g. when reading a file and applying liboverrides), leading to discarding valid existing disk cache files. Fact that one of those index is signed, and the other not, does not help... While this is very weak, fixing broken PointCache code is out of the scope of a bug fix, so this patch merely: * Simplifies and factorizes the code generating the 'extension' part of caches filenames; * Ensures `BKE_object_insert_ptcache` is called when needed so that we always have a valid stack index to generate that filename extension. This is only a bandaid, but it is simple and should be safe enough for now. Related to T82503. --- source/blender/blenkernel/intern/object.c | 4 ++ source/blender/blenkernel/intern/pointcache.c | 87 +++++++++++++++++---------- 2 files changed, 60 insertions(+), 31 deletions(-) diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c index 5b0b1f333f4..5f8406e7d37 100644 --- a/source/blender/blenkernel/intern/object.c +++ b/source/blender/blenkernel/intern/object.c @@ -4311,6 +4311,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 4784df6e4c3..be06d4c7348 100644 --- a/source/blender/blenkernel/intern/pointcache.c +++ b/source/blender/blenkernel/intern/pointcache.c @@ -1366,6 +1366,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; @@ -1400,28 +1452,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 - len, "_%06d_%02u%s", cfra, pid->stack_index, ext); - } - else { - /* Always 6 chars. */ - BLI_snprintf(newname, MAX_PTCACHE_FILE - len, "_%06d%s", cfra, ext); - } - } - else { - /* Always 6 chars. */ - BLI_snprintf(newname, MAX_PTCACHE_FILE - len, "_%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 */ @@ -2591,8 +2622,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: @@ -2615,7 +2644,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?*/ @@ -2812,9 +2841,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?*/ @@ -3526,9 +3553,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)); -- cgit v1.2.3 From c645da98d8727e636c14383f4c10706c6cc5ead2 Mon Sep 17 00:00:00 2001 From: Hans Goudey Date: Mon, 16 Nov 2020 10:59:49 -0500 Subject: Fix T82439: Crash moving collections between scenes The original code for viewlayer collection flag syncing across moves from D9158 didn't consider the case where the collection could no longer be found in its original view layer (moving a collections betwen scenes). The fix is to just check if the collection starts in the same scene as it will be moved to before trying to do the flag syncing. I thought about this for a while and tried a couple other solutions, but I couldn't come up with a proper way to support syncing the layer collection flags across scenes without making too many changes. Differential Revision: https://developer.blender.org/D9568 --- source/blender/blenkernel/intern/collection.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/source/blender/blenkernel/intern/collection.c b/source/blender/blenkernel/intern/collection.c index 0ed6f94ce79..e6620ea10dc 100644 --- a/source/blender/blenkernel/intern/collection.c +++ b/source/blender/blenkernel/intern/collection.c @@ -1689,15 +1689,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); -- cgit v1.2.3 From c1d8df47f60f590f0c945ca1ee61adcec226a1b0 Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Mon, 16 Nov 2020 17:11:48 +0100 Subject: Revert "RNA define: check and report invalid usages of ID pointers properties." This reverts commit f39fbb3e604611b63c69661dd22ca987fb1d8791. Code is not valid, `DefRNA.laststruct` does not always point to the proper struct when defined from Python, need to be done differently. --- source/blender/makesrna/intern/rna_define.c | 7 ------- 1 file changed, 7 deletions(-) diff --git a/source/blender/makesrna/intern/rna_define.c b/source/blender/makesrna/intern/rna_define.c index b72afe88dda..1b0a2fca0ce 100644 --- a/source/blender/makesrna/intern/rna_define.c +++ b/source/blender/makesrna/intern/rna_define.c @@ -1823,13 +1823,6 @@ void RNA_def_property_struct_runtime(PropertyRNA *prop, StructRNA *type) switch (prop->type) { case PROP_POINTER: { - if ((srna->flag & STRUCT_NO_DATABLOCK_IDPROPERTIES) != 0 && (type->flag & STRUCT_ID) != 0) { - CLOG_ERROR(&LOG, - "Struct \"%s\" (probably an operator or keymap) does not allow pointer " - "properties to ID datablocks.", - srna->identifier); - return; - } PointerPropertyRNA *pprop = (PointerPropertyRNA *)prop; pprop->type = type; -- cgit v1.2.3 From 328aad8c98c931c3d1850c838c5cb58953ee49cf Mon Sep 17 00:00:00 2001 From: Hans Goudey Date: Mon, 16 Nov 2020 11:47:11 -0500 Subject: UI: Remove X axis panel dragging X axis panel dragging traces back to Blender versions before 2.5, where panels could be aligned horizontally. But for many years now panels have been vertically aligned. Considering this, keeping the X axis dragging around is a bit odd. It makes interaction confusing, or at least more complicated. It also looks bad, since any part of the panel outside the region is cropped. Differential Revision: https://developer.blender.org/D9549 --- source/blender/editors/interface/interface_panel.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) 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); -- cgit v1.2.3