diff options
author | Sergey Sharybin <sergey@blender.org> | 2021-11-16 19:25:48 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey@blender.org> | 2021-11-16 19:25:48 +0300 |
commit | ba6427adfaec0d405386f14fef5728f0114f7589 (patch) | |
tree | 303a245fa7e2474febf1a1b4d42bdb89a8ef3e69 | |
parent | bee7a56687283cc3642d625357d8d2b1847b67a1 (diff) | |
parent | b3529ecf0eb5e942267eb168fc078188de193400 (diff) |
Merge branch 'blender-v3.0-release'
-rw-r--r-- | intern/cycles/integrator/path_trace.cpp | 8 | ||||
-rw-r--r-- | release/scripts/startup/bl_ui/space_filebrowser.py | 7 | ||||
-rw-r--r-- | release/scripts/startup/bl_ui/space_userpref.py | 1 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/particle.c | 22 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_userdef_types.h | 3 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_userdef.c | 6 |
6 files changed, 38 insertions, 9 deletions
diff --git a/intern/cycles/integrator/path_trace.cpp b/intern/cycles/integrator/path_trace.cpp index dcbdf07ee67..81e9341af26 100644 --- a/intern/cycles/integrator/path_trace.cpp +++ b/intern/cycles/integrator/path_trace.cpp @@ -296,13 +296,13 @@ static BufferParams scale_buffer_params(const BufferParams ¶ms, int resoluti scaled_params.window_x = params.window_x / resolution_divider; scaled_params.window_y = params.window_y / resolution_divider; - scaled_params.window_width = params.window_width / resolution_divider; - scaled_params.window_height = params.window_height / resolution_divider; + scaled_params.window_width = max(1, params.window_width / resolution_divider); + scaled_params.window_height = max(1, params.window_height / resolution_divider); scaled_params.full_x = params.full_x / resolution_divider; scaled_params.full_y = params.full_y / resolution_divider; - scaled_params.full_width = params.full_width / resolution_divider; - scaled_params.full_height = params.full_height / resolution_divider; + scaled_params.full_width = max(1, params.full_width / resolution_divider); + scaled_params.full_height = max(1, params.full_height / resolution_divider); scaled_params.update_offset_stride(); diff --git a/release/scripts/startup/bl_ui/space_filebrowser.py b/release/scripts/startup/bl_ui/space_filebrowser.py index 05f505c518d..f601c795660 100644 --- a/release/scripts/startup/bl_ui/space_filebrowser.py +++ b/release/scripts/startup/bl_ui/space_filebrowser.py @@ -707,7 +707,8 @@ class ASSETBROWSER_PT_metadata(asset_utils.AssetBrowserPanel, Panel): asset_library_ref = context.asset_library_ref asset_lib_path = bpy.types.AssetHandle.get_full_library_path(asset_file_handle, asset_library_ref) - show_developer_ui = context.preferences.view.show_developer_ui + prefs = context.preferences + show_asset_debug_info = prefs.view.show_developer_ui and prefs.experimental.show_asset_debug_info layout.use_property_split = True layout.use_property_decorate = False # No animation. @@ -716,7 +717,7 @@ class ASSETBROWSER_PT_metadata(asset_utils.AssetBrowserPanel, Panel): # If the active file is an ID, use its name directly so renaming is possible from right here. layout.prop(asset_file_handle.local_id, "name") - if show_developer_ui: + if show_asset_debug_info: col = layout.column(align=True) col.label(text="Asset Catalog:") col.prop(asset_file_handle.local_id.asset_data, "catalog_id", text="UUID") @@ -724,7 +725,7 @@ class ASSETBROWSER_PT_metadata(asset_utils.AssetBrowserPanel, Panel): else: layout.prop(asset_file_handle, "name") - if show_developer_ui: + if show_asset_debug_info: col = layout.column(align=True) col.enabled = False col.label(text="Asset Catalog:") diff --git a/release/scripts/startup/bl_ui/space_userpref.py b/release/scripts/startup/bl_ui/space_userpref.py index 8c15e10d4ff..5032256e4d1 100644 --- a/release/scripts/startup/bl_ui/space_userpref.py +++ b/release/scripts/startup/bl_ui/space_userpref.py @@ -2326,6 +2326,7 @@ class USERPREF_PT_experimental_debugging(ExperimentalPanel, Panel): ({"property": "proxy_to_override_auto_conversion"}, "T91671"), ({"property": "use_cycles_debug"}, None), ({"property": "use_geometry_nodes_legacy"}, "T91274"), + ({"property": "show_asset_debug_info"}, None), ), ) diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c index 5b62761bd91..b158633294e 100644 --- a/source/blender/blenkernel/intern/particle.c +++ b/source/blender/blenkernel/intern/particle.c @@ -1149,7 +1149,27 @@ void psys_copy_particles(ParticleSystem *psys_dst, ParticleSystem *psys_src) /* Copy particles and children. */ psys_dst->particles = MEM_dupallocN(psys_src->particles); psys_dst->child = MEM_dupallocN(psys_src->child); - if (psys_dst->part->type == PART_HAIR) { + + /* Ideally this should only be performed if `(psys_dst->part->type == PART_HAIR)`. + * + * But #ParticleData (`psys_dst`) is some sub-data of the #Object ID, while #ParticleSettings + * (`psys_dst->part`) is another ID. In case the particle settings is a linked ID that gets + * missing, it will be replaced (in readfile code) by a place-holder, which defaults to a + * `PART_EMITTER` type of particle settings. + * + * This leads to a situation where each particle of `psys_dst` still has a valid allocated `hair` + * data, which should still be preserved in case the missing particle settings ID becomes valid + * again. + * + * Furthermore, #free_hair() always frees `pa->hair` if it's not NULL, regardless of the + * particle type. So *not* copying here would cause a double free (or more), e.g. freeing the + * copy-on-write copy and the original data will crash Blender. + * In any case, sharing pointers between `psys_src` and `psys_dst` should be forbidden. + * + * So while we could in theory 'sanitize' the situation by setting `pa->hair` to NULL in the new + * copy (in case of non-`PART_HAIR` type), it is probably safer for now to systematically + * duplicate the `hair` data if available. */ + { ParticleData *pa; int p; for (p = 0, pa = psys_dst->particles; p < psys_dst->totpart; p++, pa++) { diff --git a/source/blender/makesdna/DNA_userdef_types.h b/source/blender/makesdna/DNA_userdef_types.h index aad84482f07..c8fdac19b61 100644 --- a/source/blender/makesdna/DNA_userdef_types.h +++ b/source/blender/makesdna/DNA_userdef_types.h @@ -652,6 +652,7 @@ typedef struct UserDef_Experimental { char no_proxy_to_override_conversion; char use_cycles_debug; char use_geometry_nodes_legacy; + char show_asset_debug_info; char SANITIZE_AFTER_HERE; /* The following options are automatically sanitized (set to 0) * when the release cycle is not alpha. */ @@ -662,7 +663,7 @@ typedef struct UserDef_Experimental { char use_sculpt_tools_tilt; char use_extended_asset_browser; char use_override_templates; - char _pad[3]; + char _pad[2]; /** `makesdna` does not allow empty structs. */ } UserDef_Experimental; diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c index 9ce1fca164c..0e90372cd7b 100644 --- a/source/blender/makesrna/intern/rna_userdef.c +++ b/source/blender/makesrna/intern/rna_userdef.c @@ -6399,6 +6399,12 @@ static void rna_def_userdef_experimental(BlenderRNA *brna) "data-blocks as assets, not just poses"); RNA_def_property_update(prop, 0, "rna_userdef_ui_update"); + prop = RNA_def_property(srna, "show_asset_debug_info", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_ui_text(prop, + "Asset Debug Info", + "Enable some extra fields in the Asset Browser to aid in debugging"); + RNA_def_property_update(prop, 0, "rna_userdef_ui_update"); + prop = RNA_def_property(srna, "use_override_templates", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "use_override_templates", 1); RNA_def_property_ui_text( |