Merge branch 'blender-v2.93-release'

This commit is contained in:
Campbell Barton 2021-04-22 16:33:37 +10:00
commit 33d9a0c951
Notes: blender-bot 2023-02-14 03:13:26 +01:00
Referenced by issue #87701, Failed assert when generating scene preview
Referenced by issue #87703, Failed assert when dragging object data-block into 3D View
6 changed files with 39 additions and 3 deletions

View File

@ -51,7 +51,7 @@ Mesh *BKE_mesh_mirror_bisect_on_mirror_plane_for_modifier(MirrorModifierData *mm
(axis == 1 && mmd->flag & MOD_MIR_BISECT_FLIP_AXIS_Y) ||
(axis == 2 && mmd->flag & MOD_MIR_BISECT_FLIP_AXIS_Z));
const float bisect_distance = 0.001f;
const float bisect_distance = mmd->bisect_threshold;
Mesh *result;
BMesh *bm;

View File

@ -20,6 +20,12 @@
/* allow readfile to use deprecated functionality */
#define DNA_DEPRECATED_ALLOW
#include "BLI_listbase.h"
#include "BLI_utildefines.h"
#include "DNA_genfile.h"
#include "DNA_modifier_types.h"
#include "BKE_main.h"
#include "BLO_readfile.h"
@ -27,7 +33,6 @@
void do_versions_after_linking_300(Main *UNUSED(bmain), ReportList *UNUSED(reports))
{
/**
* Versioning code until next subversion bump goes here.
*
@ -44,7 +49,7 @@ void do_versions_after_linking_300(Main *UNUSED(bmain), ReportList *UNUSED(repor
}
/* NOLINTNEXTLINE: readability-function-size */
void blo_do_versions_300(FileData *fd, Library *UNUSED(lib), Main *UNUSED(bmain))
void blo_do_versions_300(FileData *fd, Library *UNUSED(lib), Main *bmain)
{
UNUSED_VARS(fd);
@ -59,5 +64,18 @@ void blo_do_versions_300(FileData *fd, Library *UNUSED(lib), Main *UNUSED(bmain)
*/
{
/* Keep this block, even when empty. */
/* Set default value for the new bisect_threshold parameter in the mirror modifier. */
if (!DNA_struct_elem_find(fd->filesdna, "MirrorModifierData", "float", "bisect_threshold")) {
LISTBASE_FOREACH (Object *, ob, &bmain->objects) {
LISTBASE_FOREACH (ModifierData *, md, &ob->modifiers) {
if (md->type == eModifierType_Mirror) {
MirrorModifierData *mmd = (MirrorModifierData *)md;
/* This was the previous hard-coded value. */
mmd->bisect_threshold = 0.001f;
}
}
}
}
}
}

View File

@ -429,6 +429,7 @@
{ \
.flag = MOD_MIR_AXIS_X | MOD_MIR_VGROUP, \
.tolerance = 0.001f, \
.bisect_threshold = 0.001f, \
.uv_offset = {0.0f, 0.0f}, \
.uv_offset_copy = {0.0f, 0.0f}, \
.mirror_ob = NULL, \

View File

@ -368,6 +368,8 @@ typedef struct MirrorModifierData {
short axis DNA_DEPRECATED;
short flag;
float tolerance;
float bisect_threshold;
char _pad[4];
float uv_offset[2];
float uv_offset_copy[2];
struct Object *mirror_ob;

View File

@ -2226,6 +2226,14 @@ static void rna_def_modifier_mirror(BlenderRNA *brna)
prop, "Merge Distance", "Distance within which mirrored vertices are merged");
RNA_def_property_update(prop, 0, "rna_Modifier_update");
prop = RNA_def_property(srna, "bisect_threshold", PROP_FLOAT, PROP_DISTANCE);
RNA_def_property_float_sdna(prop, NULL, "bisect_threshold");
RNA_def_property_range(prop, 0, FLT_MAX);
RNA_def_property_ui_range(prop, 0, 1, 0.01, 6);
RNA_def_property_ui_text(
prop, "Bisect Distance", "Distance from the bisect plane within which vertices are removed");
RNA_def_property_update(prop, 0, "rna_Modifier_update");
prop = RNA_def_property(srna, "mirror_object", PROP_POINTER, PROP_NONE);
RNA_def_property_pointer_sdna(prop, NULL, "mirror_ob");
RNA_def_property_ui_text(prop, "Mirror Object", "Object to use as mirror");

View File

@ -165,6 +165,13 @@ static void panel_draw(const bContext *UNUSED(C), Panel *panel)
uiLayoutSetActive(sub, RNA_boolean_get(ptr, "use_mirror_merge"));
uiItemR(sub, ptr, "merge_threshold", 0, "", ICON_NONE);
bool is_bisect_set[3];
RNA_boolean_get_array(ptr, "use_bisect_axis", is_bisect_set);
sub = uiLayoutRow(col, true);
uiLayoutSetActive(sub, is_bisect_set[0] || is_bisect_set[1] || is_bisect_set[2]);
uiItemR(sub, ptr, "bisect_threshold", 0, IFACE_("Bisect Distance"), ICON_NONE);
modifier_panel_end(layout, ptr);
}