[Bf-blender-cvs] [1549da96782] soc-2021-adaptive-cloth: adaptive_cloth: Add UI for size_min of static_remesh
ishbosamiya
noreply at git.blender.org
Mon Jul 26 08:17:40 CEST 2021
Commit: 1549da9678267aa9d5533519d137314293ee7ce5
Author: ishbosamiya
Date: Mon Jul 19 22:25:09 2021 +0530
Branches: soc-2021-adaptive-cloth
https://developer.blender.org/rB1549da9678267aa9d5533519d137314293ee7ce5
adaptive_cloth: Add UI for size_min of static_remesh
===================================================================
M release/scripts/startup/bl_ui/properties_physics_cloth.py
M source/blender/blenkernel/intern/cloth_remesh.cc
M source/blender/makesdna/DNA_cloth_types.h
M source/blender/makesdna/DNA_modifier_defaults.h
M source/blender/makesrna/intern/rna_cloth.c
===================================================================
diff --git a/release/scripts/startup/bl_ui/properties_physics_cloth.py b/release/scripts/startup/bl_ui/properties_physics_cloth.py
index d985f62ba56..b0d22294e73 100644
--- a/release/scripts/startup/bl_ui/properties_physics_cloth.py
+++ b/release/scripts/startup/bl_ui/properties_physics_cloth.py
@@ -330,6 +330,10 @@ class PHYSICS_PT_cloth_remesh(PhysicButtonsPanel, Panel):
flow = layout.grid_flow(row_major=False, columns=0, even_columns=True, even_rows=False, align=True)
+ # TODO(ish): setup better ui
+ col = flow.column(align=True)
+ col.prop(cloth, "remeshing_size_min", text="Remeshing Sizing Min")
+
class PHYSICS_PT_cloth_collision(PhysicButtonsPanel, Panel):
bl_label = "Collisions"
diff --git a/source/blender/blenkernel/intern/cloth_remesh.cc b/source/blender/blenkernel/intern/cloth_remesh.cc
index 68ae65a1de8..31a0cf9210e 100644
--- a/source/blender/blenkernel/intern/cloth_remesh.cc
+++ b/source/blender/blenkernel/intern/cloth_remesh.cc
@@ -403,7 +403,7 @@ Mesh *BKE_cloth_remesh(Object *ob, ClothModifierData *clmd, Mesh *mesh)
/* Actual remeshing part */
{
- float size_min = 0.1;
+ float size_min = clmd->sim_parms->remeshing_size_min;
auto m = float2x2::identity();
m = m * (1.0 / size_min);
internal::Sizing vert_sizing(std::move(m));
diff --git a/source/blender/makesdna/DNA_cloth_types.h b/source/blender/makesdna/DNA_cloth_types.h
index 2d446f3d224..f28fd176330 100644
--- a/source/blender/makesdna/DNA_cloth_types.h
+++ b/source/blender/makesdna/DNA_cloth_types.h
@@ -180,7 +180,10 @@ typedef struct ClothSimSettings {
float internal_compression;
float max_internal_tension;
float max_internal_compression;
- char _pad0[4];
+
+ /* Remeshing parameters */
+ /* TODO(ish): need to write docs for this */
+ float remeshing_size_min;
} ClothSimSettings;
diff --git a/source/blender/makesdna/DNA_modifier_defaults.h b/source/blender/makesdna/DNA_modifier_defaults.h
index 859a51e7511..adc68bcdb7d 100644
--- a/source/blender/makesdna/DNA_modifier_defaults.h
+++ b/source/blender/makesdna/DNA_modifier_defaults.h
@@ -172,6 +172,8 @@
.internal_compression = 15.0f, \
.max_internal_tension = 15.0f, \
.max_internal_compression = 15.0f, \
+ /* TODO(ish): setup better remeshing defaults */ \
+ .remeshing_size_min = 0.01f, \
}
#define _DNA_DEFAULT_ClothCollSettings \
diff --git a/source/blender/makesrna/intern/rna_cloth.c b/source/blender/makesrna/intern/rna_cloth.c
index becbae6bd13..fc92de9b1e2 100644
--- a/source/blender/makesrna/intern/rna_cloth.c
+++ b/source/blender/makesrna/intern/rna_cloth.c
@@ -1060,6 +1060,13 @@ static void rna_def_cloth_sim_settings(BlenderRNA *brna)
RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
RNA_def_property_update(prop, 0, "rna_cloth_update");
+ /* TODO(ish): remeshing paramters need proper text and doc */
+ prop = RNA_def_property(srna, "remeshing_size_min", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "remeshing_size_min");
+ RNA_def_property_ui_range(prop, 0.0f, 2.0f, 0.005f, 4);
+ RNA_def_property_ui_text(prop, "Remeshing Size Min", "");
+ RNA_def_property_update(prop, 0, "rna_cloth_update");
+
/* unused */
/* unused still */
More information about the Bf-blender-cvs
mailing list