[Bf-blender-cvs] [ad5d6448f2c] soc-2021-adaptive-cloth: adaptive_cloth: ui: add remesh option within shape

ishbosamiya noreply at git.blender.org
Mon Jun 14 14:31:58 CEST 2021


Commit: ad5d6448f2cbec3753fcac577024f8b6fc4eced2
Author: ishbosamiya
Date:   Fri Jun 11 19:42:55 2021 +0530
Branches: soc-2021-adaptive-cloth
https://developer.blender.org/rBad5d6448f2cbec3753fcac577024f8b6fc4eced2

adaptive_cloth: ui: add remesh option within shape

===================================================================

M	release/scripts/startup/bl_ui/properties_physics_cloth.py
M	source/blender/makesdna/DNA_cloth_types.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 3a5ca1e04f5..d985f62ba56 100644
--- a/release/scripts/startup/bl_ui/properties_physics_cloth.py
+++ b/release/scripts/startup/bl_ui/properties_physics_cloth.py
@@ -307,6 +307,30 @@ class PHYSICS_PT_cloth_shape(PhysicButtonsPanel, Panel):
             col.prop_search(cloth, "rest_shape_key", key, "key_blocks", text="Rest Shape Key")
 
 
+class PHYSICS_PT_cloth_remesh(PhysicButtonsPanel, Panel):
+    bl_label = "Remesh"
+    bl_parent_id = 'PHYSICS_PT_cloth_shape'
+    COMPAT_ENGINES = {'BLENDER_RENDER', 'BLENDER_EEVEE', 'BLENDER_WORKBENCH'}
+
+    def draw_header(self, context):
+        cloth = context.cloth.settings
+
+        self.layout.active = cloth_panel_enabled(context.cloth)
+        self.layout.prop(cloth, "use_remesh", text="")
+
+    def draw(self, context):
+        layout = self.layout
+        layout.use_property_split = True
+
+        cloth = context.cloth.settings
+        md = context.cloth
+        ob = context.object
+
+        layout.active = cloth.use_remesh and cloth_panel_enabled(md)
+
+        flow = layout.grid_flow(row_major=False, columns=0, even_columns=True, even_rows=False, align=True)
+
+
 class PHYSICS_PT_cloth_collision(PhysicButtonsPanel, Panel):
     bl_label = "Collisions"
     bl_parent_id = 'PHYSICS_PT_cloth'
@@ -475,6 +499,7 @@ classes = (
     PHYSICS_PT_cloth_pressure,
     PHYSICS_PT_cloth_cache,
     PHYSICS_PT_cloth_shape,
+    PHYSICS_PT_cloth_remesh,
     PHYSICS_PT_cloth_collision,
     PHYSICS_PT_cloth_object_collision,
     PHYSICS_PT_cloth_self_collision,
diff --git a/source/blender/makesdna/DNA_cloth_types.h b/source/blender/makesdna/DNA_cloth_types.h
index aae29e5fddc..2d446f3d224 100644
--- a/source/blender/makesdna/DNA_cloth_types.h
+++ b/source/blender/makesdna/DNA_cloth_types.h
@@ -211,6 +211,8 @@ typedef enum {
   CLOTH_SIMSETTINGS_FLAG_SEW = (1 << 14),
   /** Make simulation respect deformations in the base object. */
   CLOTH_SIMSETTINGS_FLAG_DYNAMIC_BASEMESH = (1 << 15),
+  /** True if remeshing is enabled */
+  CLOTH_SIMSETTINGS_FLAG_REMESH = (1 << 16),
 } CLOTH_SIMSETTINGS_FLAGS;
 
 /* ClothSimSettings.bending_model. */
diff --git a/source/blender/makesrna/intern/rna_cloth.c b/source/blender/makesrna/intern/rna_cloth.c
index 9e57368f8f9..becbae6bd13 100644
--- a/source/blender/makesrna/intern/rna_cloth.c
+++ b/source/blender/makesrna/intern/rna_cloth.c
@@ -1053,6 +1053,13 @@ static void rna_def_cloth_sim_settings(BlenderRNA *brna)
       "that has zero weight will be excluded from the volume calculation");
   RNA_def_property_update(prop, 0, "rna_cloth_update");
 
+  prop = RNA_def_property(srna, "use_remesh", PROP_BOOLEAN, PROP_NONE);
+  RNA_def_property_boolean_sdna(prop, NULL, "flags", CLOTH_SIMSETTINGS_FLAG_REMESH);
+  RNA_def_property_ui_text(
+      prop, "Remesh", "Remesh the cloth's mesh based on user defined parameters");
+  RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+  RNA_def_property_update(prop, 0, "rna_cloth_update");
+
   /* unused */
 
   /* unused still */



More information about the Bf-blender-cvs mailing list