Commit: 7e26b28e2bad21cf9d7c9f0fd5238128cec6578f
Author: ishbosamiya
Date:   Thu Aug 1 13:06:08 2019 +0530
Branches: soc-2019-adaptive-cloth
https://developer.blender.org/rB7e26b28e2bad21cf9d7c9f0fd5238128cec6578f

Cloth: added refine obstacle metric parameter

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

M       release/scripts/startup/bl_ui/properties_physics_cloth.py
M       source/blender/blenkernel/intern/cloth.c
M       source/blender/blenkernel/intern/cloth_remeshing.cpp
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 658df38c6c7..14a8e1d7e5f 100644
--- a/release/scripts/startup/bl_ui/properties_physics_cloth.py
+++ b/release/scripts/startup/bl_ui/properties_physics_cloth.py
@@ -333,6 +333,8 @@ class PHYSICS_PT_cloth_remeshing(PhysicButtonsPanel, Panel):
         col = flow.column()
         col.prop(cloth, "refine_velocity", text="Refine Velocity")
         col = flow.column()
+        col.prop(cloth, "refine_obstacle", text="Refine Obstacle")
+        col = flow.column()
         col.prop(cloth, "size_min", text="Size Minimum")
         col = flow.column()
         col.prop(cloth, "size_max", text="Size Maximum")
diff --git a/source/blender/blenkernel/intern/cloth.c 
b/source/blender/blenkernel/intern/cloth.c
index 430887e1c0e..c624d286da8 100644
--- a/source/blender/blenkernel/intern/cloth.c
+++ b/source/blender/blenkernel/intern/cloth.c
@@ -159,6 +159,7 @@ void cloth_init(ClothModifierData *clmd)
   clmd->sim_parms->refine_angle = 0.3f;
   clmd->sim_parms->refine_compression = 0.005f;
   clmd->sim_parms->refine_velocity = 0.5f;
+  clmd->sim_parms->refine_obstacle = 1.0f;
   clmd->sim_parms->size_min = 100e-3f;
   clmd->sim_parms->size_max = 200e-3f;
   clmd->sim_parms->aspect_min = 1.0f;
diff --git a/source/blender/blenkernel/intern/cloth_remeshing.cpp 
b/source/blender/blenkernel/intern/cloth_remeshing.cpp
index caaa6be4b37..b2bb760a6c9 100644
--- a/source/blender/blenkernel/intern/cloth_remeshing.cpp
+++ b/source/blender/blenkernel/intern/cloth_remeshing.cpp
@@ -2335,6 +2335,7 @@ static ClothSizing 
cloth_remeshing_compute_face_sizing(ClothModifierData *clmd,
   float curv_temp[2][2];
   float comp_temp[2][2];
   float dvel_temp[2][2];
+  float obs_temp[2][2];
   copy_m2_m2(curv_temp, curv);
   mul_m2_fl(curv_temp, 1.0f / (clmd->sim_parms->refine_angle * 
clmd->sim_parms->refine_angle));
   copy_m2_m2(comp_temp, comp);
@@ -2343,16 +2344,17 @@ static ClothSizing 
cloth_remeshing_compute_face_sizing(ClothModifierData *clmd,
   copy_m2_m2(dvel_temp, dvel);
   mul_m2_fl(dvel_temp,
             1.0f / (clmd->sim_parms->refine_velocity * 
clmd->sim_parms->refine_velocity));
+  copy_m2_m2(obs_temp, obs);
+  mul_m2_fl(obs_temp, 1.0f / sqr_fl(clmd->sim_parms->refine_obstacle));
 
   /* Adding curv_temp, comp_temp, dvel_temp, obs */
 
 #if SKIP_COMP_METRIC
   zero_m2(comp_temp);
-  mul_m2_fl(obs, 1.0f / sqr_fl(clmd->sim_parms->refine_compression));
 #endif
   add_m2_m2m2(m, curv_temp, comp_temp);
   add_m2_m2m2(m, m, dvel_temp);
-  add_m2_m2m2(m, m, obs);
+  add_m2_m2m2(m, m, obs_temp);
 
 #if FACE_SIZING_DEBUG
   printf("curv_temp: ");
@@ -2361,8 +2363,8 @@ static ClothSizing 
cloth_remeshing_compute_face_sizing(ClothModifierData *clmd,
   print_m2(comp_temp);
   printf("dvel_temp: ");
   print_m2(dvel_temp);
-  printf("obs: ");
-  print_m2(obs);
+  printf("obs_temp: ");
+  print_m2(obs_temp);
   printf("m: ");
   print_m2(m);
 #endif
@@ -2372,6 +2374,8 @@ static ClothSizing 
cloth_remeshing_compute_face_sizing(ClothModifierData *clmd,
 #  else
   printf("obs: ");
   print_m2(obs);
+  printf("obs_temp: ");
+  print_m2(obs_temp);
   printf("\n");
 #  endif
 #endif
diff --git a/source/blender/makesdna/DNA_cloth_types.h 
b/source/blender/makesdna/DNA_cloth_types.h
index 0437bc24308..e7af83005f6 100644
--- a/source/blender/makesdna/DNA_cloth_types.h
+++ b/source/blender/makesdna/DNA_cloth_types.h
@@ -153,9 +153,11 @@ typedef struct ClothSimSettings {
   float refine_angle;
   float refine_compression;
   float refine_velocity;
+  float refine_obstacle;
   float size_min;
   float size_max;
   float aspect_min;
+  char _pad1[4];
 } ClothSimSettings;
 
 typedef struct ClothCollSettings {
diff --git a/source/blender/makesrna/intern/rna_cloth.c 
b/source/blender/makesrna/intern/rna_cloth.c
index 755b8fc6574..05425010f3f 100644
--- a/source/blender/makesrna/intern/rna_cloth.c
+++ b/source/blender/makesrna/intern/rna_cloth.c
@@ -799,6 +799,12 @@ static void rna_def_cloth_sim_settings(BlenderRNA *brna)
   RNA_def_property_ui_text(prop, "Remeshing Refine Velocity", "Remeshing 
refine velocity");
   RNA_def_property_update(prop, 0, "rna_cloth_update");
 
+  prop = RNA_def_property(srna, "refine_obstacle", PROP_FLOAT, PROP_NONE);
+  RNA_def_property_float_sdna(prop, NULL, "refine_obstacle");
+  RNA_def_property_range(prop, 0.0f, 10.0f);
+  RNA_def_property_ui_text(prop, "Remeshing Refine Obstacle", "Remeshing 
refine obstacle");
+  RNA_def_property_update(prop, 0, "rna_cloth_update");
+
   prop = RNA_def_property(srna, "size_min", PROP_FLOAT, PROP_NONE);
   RNA_def_property_float_sdna(prop, NULL, "size_min");
   RNA_def_property_range(prop, 0.0f, 10.0f);

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to