From 1ec5edcc9669f46b1f0fd29c765a326ea525e7f3 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Tue, 29 Nov 2016 11:39:14 +0100 Subject: Fix T50094: Crash when viewport rendering point density texture The idea is simple: cache PD resolution from cache_point_density() RNA function because that one is supposed to be called while database is locked for original synchronization. Ideally we would also pass array size to the sampling function, but it turned out to be quite problematic because API only accepts int type and passing size_t might cause some weird behavior. --- source/blender/makesdna/DNA_node_types.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'source/blender/makesdna') diff --git a/source/blender/makesdna/DNA_node_types.h b/source/blender/makesdna/DNA_node_types.h index 46b30f41f5b..3a7e2b6f7f8 100644 --- a/source/blender/makesdna/DNA_node_types.h +++ b/source/blender/makesdna/DNA_node_types.h @@ -811,7 +811,10 @@ typedef struct NodeShaderTexPointDensity { short color_source; short ob_color_source; char vertex_attribute_name[64]; /* vertex attribute layer for color source, MAX_CUSTOMDATA_LAYER_NAME */ + /* Used at runtime only by sampling RNA API. */ PointDensity pd; + int cached_resolution; + int pad2; } NodeShaderTexPointDensity; /* TEX_output */ -- cgit v1.2.3 From df63195d2a7bc374398b0b6dfa389db3b40f5a70 Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Wed, 30 Nov 2016 15:25:54 +0100 Subject: Cleanup id->newid usage, initial work. This aims at always ensuring that ID.newid (and relevant LIB_TAG_NEW) stay in clean (i.e. cleared) state by default. To achieve this, instead of clearing after all id copy call (would be horribly noisy, and bad for performances), we try to completely remove the setting of id->newid by default when copying a new ID. This implies that areas actually needing that info (mainly, object editing area (make single user...) and make local area) have to ensure they set it themselves as needed. This is far from simple change, many complex code paths to consider, so will need some serious testing. :/ --- source/blender/makesdna/DNA_ID.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'source/blender/makesdna') diff --git a/source/blender/makesdna/DNA_ID.h b/source/blender/makesdna/DNA_ID.h index feeb2d5e4d7..59fd0c7832c 100644 --- a/source/blender/makesdna/DNA_ID.h +++ b/source/blender/makesdna/DNA_ID.h @@ -290,9 +290,9 @@ typedef enum ID_Type { #endif #define GS(a) (CHECK_TYPE_ANY(a, char *, const char *, char [66], const char[66]), (*((const short *)(a)))) -#define ID_NEW(a) if ( (a) && (a)->id.newid ) (a) = (void *)(a)->id.newid -#define ID_NEW_US(a) if ( (a)->id.newid) { (a) = (void *)(a)->id.newid; (a)->id.us++; } -#define ID_NEW_US2(a) if (((ID *)a)->newid) { (a) = ((ID *)a)->newid; ((ID *)a)->us++; } +#define ID_NEW_SET(_id, _idn) \ + (((ID *)(_id))->newid = (ID *)(_idn), ((ID *)(_id))->newid->tag |= LIB_TAG_NEW, (void *)((ID *)(_id))->newid) +#define ID_NEW_REMAP(a) if ((a) && (a)->id.newid) (a) = (void *)(a)->id.newid /* id->flag (persitent). */ enum { -- cgit v1.2.3