From 65d4c58060eae4f544e4e483a38ca2b8d30bd707 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Mon, 14 Feb 2022 15:33:47 +0100 Subject: Fix Cycles assert in debug mode after recent changes We sometimes call start() on already started renders, just do nothing then. Ref D14086 --- intern/cycles/session/session.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/intern/cycles/session/session.cpp b/intern/cycles/session/session.cpp index f6e06f20aba..8fcb5c9ac96 100644 --- a/intern/cycles/session/session.cpp +++ b/intern/cycles/session/session.cpp @@ -110,7 +110,10 @@ void Session::start() { /* Signal session thread to start rendering. */ thread_scoped_lock session_thread_lock(session_thread_mutex_); - assert(session_thread_state_ == SESSION_THREAD_WAIT); + if (session_thread_state_ == SESSION_THREAD_RENDER) { + /* Already rendering, nothing to do. */ + return; + } session_thread_state_ = SESSION_THREAD_RENDER; } -- cgit v1.2.3 From 0999a01b03d4ee727ff73661ec35c8c169926689 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Dietrich?= Date: Mon, 14 Feb 2022 16:13:25 +0100 Subject: Fix T95320: CacheFile templates crash when used through Python The crash is caused as we did not check that the RNA pointer is null before trying to use it. This moves the existing checks from the modifier panels into the template functions so the logic is a bit centralized. --- source/blender/editors/interface/interface_templates.c | 16 ++++++++++++++++ source/blender/modifiers/intern/MOD_meshsequencecache.c | 16 ---------------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c index 8330f8c0db7..6a5d8d17af7 100644 --- a/source/blender/editors/interface/interface_templates.c +++ b/source/blender/editors/interface/interface_templates.c @@ -6397,6 +6397,10 @@ void uiTemplateNodeSocket(uiLayout *layout, bContext *UNUSED(C), float color[4]) void uiTemplateCacheFileVelocity(uiLayout *layout, PointerRNA *fileptr) { + if (RNA_pointer_is_null(fileptr)) { + return; + } + /* Ensure that the context has a CacheFile as this may not be set inside of modifiers panels. */ uiLayoutSetContextPointer(layout, "edit_cachefile", fileptr); @@ -6406,6 +6410,10 @@ void uiTemplateCacheFileVelocity(uiLayout *layout, PointerRNA *fileptr) void uiTemplateCacheFileProcedural(uiLayout *layout, const bContext *C, PointerRNA *fileptr) { + if (RNA_pointer_is_null(fileptr)) { + return; + } + /* Ensure that the context has a CacheFile as this may not be set inside of modifiers panels. */ uiLayoutSetContextPointer(layout, "edit_cachefile", fileptr); @@ -6452,6 +6460,10 @@ void uiTemplateCacheFileProcedural(uiLayout *layout, const bContext *C, PointerR void uiTemplateCacheFileTimeSettings(uiLayout *layout, PointerRNA *fileptr) { + if (RNA_pointer_is_null(fileptr)) { + return; + } + /* Ensure that the context has a CacheFile as this may not be set inside of modifiers panels. */ uiLayoutSetContextPointer(layout, "edit_cachefile", fileptr); @@ -6502,6 +6514,10 @@ uiListType *UI_UL_cache_file_layers() void uiTemplateCacheFileLayers(uiLayout *layout, const bContext *C, PointerRNA *fileptr) { + if (RNA_pointer_is_null(fileptr)) { + return; + } + /* Ensure that the context has a CacheFile as this may not be set inside of modifiers panels. */ uiLayoutSetContextPointer(layout, "edit_cachefile", fileptr); diff --git a/source/blender/modifiers/intern/MOD_meshsequencecache.c b/source/blender/modifiers/intern/MOD_meshsequencecache.c index b5dd0566215..1d3699e41ec 100644 --- a/source/blender/modifiers/intern/MOD_meshsequencecache.c +++ b/source/blender/modifiers/intern/MOD_meshsequencecache.c @@ -343,10 +343,6 @@ static void velocity_panel_draw(const bContext *UNUSED(C), Panel *panel) return; } - if (RNA_pointer_is_null(&fileptr)) { - return; - } - uiLayoutSetPropSep(layout, true); uiTemplateCacheFileVelocity(layout, &fileptr); uiItemR(layout, ptr, "velocity_scale", 0, NULL, ICON_NONE); @@ -364,10 +360,6 @@ static void time_panel_draw(const bContext *UNUSED(C), Panel *panel) return; } - if (RNA_pointer_is_null(&fileptr)) { - return; - } - uiLayoutSetPropSep(layout, true); uiTemplateCacheFileTimeSettings(layout, &fileptr); } @@ -384,10 +376,6 @@ static void render_procedural_panel_draw(const bContext *C, Panel *panel) return; } - if (RNA_pointer_is_null(&fileptr)) { - return; - } - uiLayoutSetPropSep(layout, true); uiTemplateCacheFileProcedural(layout, C, &fileptr); } @@ -404,10 +392,6 @@ static void override_layers_panel_draw(const bContext *C, Panel *panel) return; } - if (RNA_pointer_is_null(&fileptr)) { - return; - } - uiLayoutSetPropSep(layout, true); uiTemplateCacheFileLayers(layout, C, &fileptr); } -- cgit v1.2.3 From 56407432a6aae92dc272f7c8b37fc664e8d2108d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Dietrich?= Date: Mon, 14 Feb 2022 16:35:25 +0100 Subject: Fix T94479: GPU Subdivision surface modifier does not apply to Cycles renders Since now we delegate the evaluation of the last subsurf modifier in the stack to the draw code, Cycles does not get a subdivided mesh anymore. This is because the subdivision wrapper for generating a CPU side subdivision is never created as it is only ever created via `BKE_object_get_evaluated_mesh` which Cycles does not call (rather, it accesses the Mesh either via `object.data()`, or via `object.to_mesh()`). This ensures that a subdivision wrapper is created when accessing the object data or converting an Object to a Mesh via the RNA/Python API. Reviewed by: brecht Differential Revision: https://developer.blender.org/D14048 --- source/blender/blenkernel/intern/mesh_convert.cc | 8 +++++++- source/blender/makesrna/intern/rna_object.c | 19 +++++++++++++++++-- 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/source/blender/blenkernel/intern/mesh_convert.cc b/source/blender/blenkernel/intern/mesh_convert.cc index 7d5f156040d..f8deb4e6807 100644 --- a/source/blender/blenkernel/intern/mesh_convert.cc +++ b/source/blender/blenkernel/intern/mesh_convert.cc @@ -1051,7 +1051,12 @@ static Mesh *mesh_new_from_mesh(Object *object, Mesh *mesh) { /* While we could copy this into the new mesh, * add the data to 'mesh' so future calls to this function don't need to re-convert the data. */ - BKE_mesh_wrapper_ensure_mdata(mesh); + if (mesh->runtime.wrapper_type == ME_WRAPPER_TYPE_BMESH) { + BKE_mesh_wrapper_ensure_mdata(mesh); + } + else { + BKE_mesh_wrapper_ensure_subdivision(object, mesh); + } Mesh *mesh_result = (Mesh *)BKE_id_copy_ex( nullptr, &mesh->id, nullptr, LIB_ID_CREATE_NO_MAIN | LIB_ID_CREATE_NO_USER_REFCOUNT); @@ -1088,6 +1093,7 @@ static Mesh *mesh_new_from_mesh_object_with_layers(Depsgraph *depsgraph, mask.pmask |= CD_MASK_ORIGINDEX; } Mesh *result = mesh_create_eval_final(depsgraph, scene, &object_for_eval, &mask); + BKE_mesh_wrapper_ensure_subdivision(object, result); return result; } diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c index a098693459b..207cde4b866 100644 --- a/source/blender/makesrna/intern/rna_object.c +++ b/source/blender/makesrna/intern/rna_object.c @@ -345,6 +345,7 @@ const EnumPropertyItem rna_enum_object_axis_items[] = { # include "BKE_key.h" # include "BKE_material.h" # include "BKE_mesh.h" +# include "BKE_mesh_wrapper.h" # include "BKE_modifier.h" # include "BKE_object.h" # include "BKE_particle.h" @@ -524,6 +525,17 @@ void rna_Object_data_update(Main *bmain, Scene *scene, PointerRNA *ptr) rna_Object_internal_update_data_dependency(bmain, scene, ptr); } +static PointerRNA rna_Object_data_get(PointerRNA *ptr) +{ + Object *ob = (Object *)ptr->data; + if (ob->type == OB_MESH) { + Mesh *me = (Mesh *)ob->data; + me = BKE_mesh_wrapper_ensure_subdivision(ob, me); + return rna_pointer_inherit_refine(ptr, &RNA_Mesh, me); + } + return rna_pointer_inherit_refine(ptr, &RNA_ID, ob->data); +} + static void rna_Object_data_set(PointerRNA *ptr, PointerRNA value, struct ReportList *reports) { Object *ob = (Object *)ptr->data; @@ -3055,8 +3067,11 @@ static void rna_def_object(BlenderRNA *brna) prop = RNA_def_property(srna, "data", PROP_POINTER, PROP_NONE); RNA_def_property_struct_type(prop, "ID"); - RNA_def_property_pointer_funcs( - prop, NULL, "rna_Object_data_set", "rna_Object_data_typef", "rna_Object_data_poll"); + RNA_def_property_pointer_funcs(prop, + "rna_Object_data_get", + "rna_Object_data_set", + "rna_Object_data_typef", + "rna_Object_data_poll"); RNA_def_property_flag(prop, PROP_EDITABLE | PROP_NEVER_UNLINK); RNA_def_property_ui_text(prop, "Data", "Object data"); RNA_def_property_update(prop, 0, "rna_Object_data_update"); -- cgit v1.2.3 From a5edff4b73ba74155dcad93103e2fef2c59df67f Mon Sep 17 00:00:00 2001 From: Thomas Dinges Date: Mon, 14 Feb 2022 17:47:35 +0100 Subject: Fix T95778, the macOS minimum versions have been increased for Metal. --- intern/cycles/blender/addon/properties.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/intern/cycles/blender/addon/properties.py b/intern/cycles/blender/addon/properties.py index 01e73d7ed03..ef686fc0c70 100644 --- a/intern/cycles/blender/addon/properties.py +++ b/intern/cycles/blender/addon/properties.py @@ -1498,7 +1498,8 @@ class CyclesPreferences(bpy.types.AddonPreferences): if sys.platform[:3] == "win": col.label(text="and AMD Radeon Pro 21.Q4 driver or newer", icon='BLANK1') elif device_type == 'METAL': - col.label(text="Requires Apple Silicon and macOS 12.0 or newer", icon='BLANK1') + col.label(text="Requires Apple Silicon with macOS 12.2 or newer", icon='BLANK1') + col.label(text="or AMD with macOS 12.3 or newer", icon='BLANK1') return for device in devices: -- cgit v1.2.3