Skip to content

Commit 844f5f0

Browse files
committed
Added new Remesh preprocessing tool
This remeshes all selected objects by converting them to convex hulls. This can help clean up 'bad' geometry that can cause problems with tools like Discretize. Members of an object group 'bcb_noRemesh' will be skipped if present
1 parent 7f43aaf commit 844f5f0

File tree

7 files changed

+43
-16
lines changed

7 files changed

+43
-16
lines changed

kk_bullet_constraints_builder.zip

64 Bytes
Binary file not shown.

kk_bullet_constraints_builder/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,7 @@ def do(cmd, *arg):
235235
OBJECT_OT_bcb_preproc_tool_remesh,
236236
OBJECT_OT_bcb_preproc_tool_discretize,
237237
OBJECT_OT_bcb_preproc_tool_apply_all_modifiers_2,
238+
OBJECT_OT_bcb_preproc_tool_remesh_2,
238239
OBJECT_OT_bcb_preproc_tool_enable_rigid_bodies,
239240
OBJECT_OT_bcb_preproc_tool_remove_intersections,
240241
OBJECT_OT_bcb_preproc_tool_fix_foundation,

kk_bullet_constraints_builder/build_data.py

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -57,15 +57,15 @@ def storeConfigDataInScene(scene):
5757
scene["bcb_prop_preprocTools_grp_sep"] = props.preprocTools_grp_sep
5858
scene["bcb_prop_preprocTools_grp_occ"] = props.preprocTools_grp_occ
5959

60-
scene["bcb_prop_preprocTools_sep2"] = props.preprocTools_sep2
60+
scene["bcb_prop_preprocTools_sep"] = props.preprocTools_sep
6161

6262
scene["bcb_prop_preprocTools_mod"] = props.preprocTools_mod
6363

64-
scene["bcb_prop_preprocTools_ctr"] = props.preprocTools_ctr
64+
scene["bcb_prop_preprocTools_rem"] = props.preprocTools_rem
6565

66-
scene["bcb_prop_preprocTools_sep"] = props.preprocTools_sep
66+
scene["bcb_prop_preprocTools_ctr"] = props.preprocTools_ctr
6767

68-
scene["bcb_prop_preprocTools_rem"] = props.preprocTools_rem
68+
scene["bcb_prop_preprocTools_sep2"] = props.preprocTools_sep2
6969

7070
scene["bcb_prop_preprocTools_dis"] = props.preprocTools_dis
7171
scene["bcb_prop_preprocTools_dis_siz"] = props.preprocTools_dis_siz
@@ -74,6 +74,8 @@ def storeConfigDataInScene(scene):
7474
scene["bcb_prop_preprocTools_dis_jus"] = props.preprocTools_dis_jus
7575

7676
scene["bcb_prop_preprocTools_mod2"] = props.preprocTools_mod2
77+
78+
scene["bcb_prop_preprocTools_rem2"] = props.preprocTools_rem2
7779

7880
scene["bcb_prop_preprocTools_rbs"] = props.preprocTools_rbs
7981

@@ -216,20 +218,20 @@ def getConfigDataFromScene(scene):
216218
if "bcb_prop_preprocTools_grp_occ" in scene.keys():
217219
props.preprocTools_grp_occ = scene["bcb_prop_preprocTools_grp_occ"]
218220

219-
if "bcb_prop_preprocTools_sep2" in scene.keys():
220-
props.preprocTools_sep2 = scene["bcb_prop_preprocTools_sep2"]
221+
if "bcb_prop_preprocTools_sep" in scene.keys():
222+
props.preprocTools_sep = scene["bcb_prop_preprocTools_sep"]
221223

222224
if "bcb_prop_preprocTools_mod" in scene.keys():
223225
props.preprocTools_mod = scene["bcb_prop_preprocTools_mod"]
224226

227+
if "bcb_prop_preprocTools_rem" in scene.keys():
228+
props.preprocTools_rem = scene["bcb_prop_preprocTools_rem"]
229+
225230
if "bcb_prop_preprocTools_ctr" in scene.keys():
226231
props.preprocTools_ctr = scene["bcb_prop_preprocTools_ctr"]
227232

228-
if "bcb_prop_preprocTools_sep" in scene.keys():
229-
props.preprocTools_sep = scene["bcb_prop_preprocTools_sep"]
230-
231-
if "bcb_prop_preprocTools_rem" in scene.keys():
232-
props.preprocTools_rem = scene["bcb_prop_preprocTools_rem"]
233+
if "bcb_prop_preprocTools_sep2" in scene.keys():
234+
props.preprocTools_sep2 = scene["bcb_prop_preprocTools_sep2"]
233235

234236
if "bcb_prop_preprocTools_dis" in scene.keys():
235237
props.preprocTools_dis = scene["bcb_prop_preprocTools_dis"]
@@ -245,6 +247,9 @@ def getConfigDataFromScene(scene):
245247
if "bcb_prop_preprocTools_mod2" in scene.keys():
246248
props.preprocTools_mod2 = scene["bcb_prop_preprocTools_mod2"]
247249

250+
if "bcb_prop_preprocTools_rem2" in scene.keys():
251+
props.preprocTools_rem2 = scene["bcb_prop_preprocTools_rem2"]
252+
248253
if "bcb_prop_preprocTools_rbs" in scene.keys():
249254
props.preprocTools_rbs = scene["bcb_prop_preprocTools_rbs"]
250255

kk_bullet_constraints_builder/global_props.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,15 +86,15 @@ class bcb_props(bpy.types.PropertyGroup):
8686
preprocTools_grp_sep = string_(name="Separator", default=':', update=updGlob, description="Defines a key character or string to derive the group names from the object names in the scene. Example: An object name 'Columns:B4' with separator ':' will generate a group named 'Columns' containing all objects with this phrase in their names")
8787
preprocTools_grp_occ = bool_(name="First Occurrence", default=1, update=updGlob, description="Enables first occurrence search of the separator within an element name for cases when there are more than one separator included, if disabled the last occurrence is used")
8888

89-
preprocTools_sep2 = bool_(default=1)
89+
preprocTools_sep = bool_(default=1)
9090

9191
preprocTools_mod = bool_(default=1)
9292

93-
preprocTools_ctr = bool_(default=1)
93+
preprocTools_rem = bool_(default=0)
9494

95-
preprocTools_sep = bool_(default=1)
95+
preprocTools_ctr = bool_(default=1)
9696

97-
preprocTools_rem = bool_(default=0)
97+
preprocTools_sep2 = bool_(default=1)
9898

9999
preprocTools_dis = bool_(default=1)
100100
preprocTools_dis_siz = float_(name="Minimum Size Limit", default=2.9, min=0.0, max=1000, update=updGlob, description="Discretization size in m this tool tries to reach by discretization. To enforce regularity at all times, elements afterwards can deviate in size to some extent from the target size. For booleans (default method): The minimum dimension value serves as limit for an element still being considered for subdivision, at least two dimension axis must be above this size. After discretization no element will be larger than this value anymore, although they can be smaller up to 50%")
@@ -104,6 +104,8 @@ class bcb_props(bpy.types.PropertyGroup):
104104

105105
preprocTools_mod2 = bool_(default=0)
106106

107+
preprocTools_rem2 = bool_(default=0)
108+
107109
preprocTools_rbs = bool_(default=1)
108110

109111
preprocTools_int = bool_(default=1)

kk_bullet_constraints_builder/global_vars.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
################################################################################
3636

3737
### Vars:
38-
bcb_version = (3, 6, 0)
38+
bcb_version = (3, 6, 1)
3939

4040
### Customizable element group presets
4141
presets = [

kk_bullet_constraints_builder/gui.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,11 @@ def draw(self, context):
237237
box = split.box()
238238
box.operator("bcb.preproc_tool_apply_all_modifiers_2", icon="DOT")
239239

240+
row = col.row(align=1); split = row.split(percentage=.06, align=0)
241+
split.prop(props, "preprocTools_rem2", text="")
242+
box = split.box()
243+
box.operator("bcb.preproc_tool_remesh_2", icon="DOT")
244+
240245
row = col.row(align=1); split = row.split(percentage=.06, align=0)
241246
split.prop(props, "preprocTools_rbs", text="")
242247
box = split.box()

kk_bullet_constraints_builder/gui_buttons.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -599,6 +599,7 @@ def execute(self, context):
599599
if props.preprocTools_sep2: tool_separateLoose(scene); props.preprocTools_sep2 = 0
600600
if props.preprocTools_dis: tool_discretize(scene); props.preprocTools_dis = 0
601601
if props.preprocTools_mod2: tool_applyAllModifiers(scene); props.preprocTools_mod2 = 0
602+
if props.preprocTools_rem2: tool_remesh(scene); props.preprocTools_rem2 = 0
602603
if props.preprocTools_rbs: tool_enableRigidBodies(scene); props.preprocTools_rbs = 0
603604
if props.preprocTools_int: tool_removeIntersections(scene); props.preprocTools_int = 0
604605
if props.preprocTools_fix: tool_fixFoundation(scene); props.preprocTools_fix = 0
@@ -749,6 +750,19 @@ def execute(self, context):
749750

750751
########################################
751752

753+
class OBJECT_OT_bcb_preproc_tool_remesh_2(bpy.types.Operator):
754+
bl_idname = "bcb.preproc_tool_remesh_2"
755+
bl_label = "Remesh"
756+
bl_description = "Remeshes all selected objects by converting them to convex hulls. This can help clean up 'bad' geometry that can cause problems with tools like Discretize. Members of an object group 'bcb_noRemesh' will be skipped if present"
757+
def execute(self, context):
758+
props = context.window_manager.bcb
759+
scene = bpy.context.scene
760+
tool_remesh(scene)
761+
props.preprocTools_rem2 = 0
762+
return{'FINISHED'}
763+
764+
########################################
765+
752766
class OBJECT_OT_bcb_preproc_tool_discretize(bpy.types.Operator):
753767
bl_idname = "bcb.preproc_tool_discretize"
754768
bl_label = "Discretize"

0 commit comments

Comments
 (0)