Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorThomas Dinges <blender@dingto.org>2022-02-14 19:48:52 +0300
committerThomas Dinges <blender@dingto.org>2022-02-14 19:48:52 +0300
commit19403fc852224b2c29df3e5f1f2106ba91f105a2 (patch)
tree59818c3cf9e14fbfa2e54ee8817bf1d8b78ea07c /source
parentd8e2f612ec52ce0272cbc8a5e9ff0c6b89ce16a6 (diff)
parenta5edff4b73ba74155dcad93103e2fef2c59df67f (diff)
Merge branch 'blender-v3.1-release'
Diffstat (limited to 'source')
-rw-r--r--source/blender/blenkernel/intern/mesh_convert.cc8
-rw-r--r--source/blender/editors/interface/interface_templates.c16
-rw-r--r--source/blender/makesrna/intern/rna_object.c19
-rw-r--r--source/blender/modifiers/intern/MOD_meshsequencecache.c16
4 files changed, 40 insertions, 19 deletions
diff --git a/source/blender/blenkernel/intern/mesh_convert.cc b/source/blender/blenkernel/intern/mesh_convert.cc
index 7de2841dc9f..c3d819bf46e 100644
--- a/source/blender/blenkernel/intern/mesh_convert.cc
+++ b/source/blender/blenkernel/intern/mesh_convert.cc
@@ -1037,7 +1037,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);
@@ -1074,6 +1079,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/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c
index 9c9759aea71..2b7ca1f8b71 100644
--- a/source/blender/editors/interface/interface_templates.c
+++ b/source/blender/editors/interface/interface_templates.c
@@ -6329,6 +6329,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);
@@ -6338,6 +6342,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);
@@ -6384,6 +6392,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);
@@ -6434,6 +6446,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/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c
index 83a0672bece..fd39ff893f1 100644
--- a/source/blender/makesrna/intern/rna_object.c
+++ b/source/blender/makesrna/intern/rna_object.c
@@ -331,6 +331,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"
@@ -510,6 +511,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;
@@ -3041,8 +3053,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");
diff --git a/source/blender/modifiers/intern/MOD_meshsequencecache.c b/source/blender/modifiers/intern/MOD_meshsequencecache.c
index 9f38f941e72..2126b4fe8b2 100644
--- a/source/blender/modifiers/intern/MOD_meshsequencecache.c
+++ b/source/blender/modifiers/intern/MOD_meshsequencecache.c
@@ -329,10 +329,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);
@@ -350,10 +346,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);
}
@@ -370,10 +362,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);
}
@@ -390,10 +378,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);
}