Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender-addons.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2012-07-09 13:17:41 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-07-09 13:17:41 +0400
commit019fcd6a500835736eb4548d5a0353c97dd00cc6 (patch)
tree470f2d52887e369bed77f287ff15a7374d8cb363 /object_fracture_cell
parent6569588716ed30da7c1a1b9bfa4d031d99c5d1a7 (diff)
add interior vertex group option.
Diffstat (limited to 'object_fracture_cell')
-rw-r--r--object_fracture_cell/__init__.py2
-rw-r--r--object_fracture_cell/fracture_cell_setup.py29
2 files changed, 30 insertions, 1 deletions
diff --git a/object_fracture_cell/__init__.py b/object_fracture_cell/__init__.py
index 71909b3e..4e85831d 100644
--- a/object_fracture_cell/__init__.py
+++ b/object_fracture_cell/__init__.py
@@ -392,7 +392,7 @@ class FractureCell(Operator):
rowsub.prop(self, "use_smooth_faces")
rowsub.prop(self, "use_smooth_edges")
rowsub.prop(self, "use_data_match")
- # rowsub.prop(self, "use_interior_vgroup")
+ rowsub.prop(self, "use_interior_vgroup")
rowsub.prop(self, "material_index")
rowsub = col.row()
# could be own section, control how we subdiv
diff --git a/object_fracture_cell/fracture_cell_setup.py b/object_fracture_cell/fracture_cell_setup.py
index b248021a..889f9135 100644
--- a/object_fracture_cell/fracture_cell_setup.py
+++ b/object_fracture_cell/fracture_cell_setup.py
@@ -324,6 +324,9 @@ def cell_fracture_boolean(scene, obj, objects,
):
objects_boolean = []
+
+ if use_interior_vgroup:
+ obj.data.polygons.foreach_set("hide", [False] * len(obj.data.polygons))
for obj_cell in objects:
mod = obj_cell.modifiers.new(name="Boolean", type='BOOLEAN')
@@ -331,6 +334,10 @@ def cell_fracture_boolean(scene, obj, objects,
mod.operation = 'INTERSECT'
if not use_debug_bool:
+
+ if use_interior_vgroup:
+ obj_cell.data.polygons.foreach_set("hide", [True] * len(obj_cell.data.polygons))
+
mesh_new = obj_cell.to_mesh(scene,
apply_modifiers=True,
settings='PREVIEW')
@@ -366,6 +373,28 @@ def cell_fracture_boolean(scene, obj, objects,
bm.to_mesh(mesh_new)
bm.free()
+ if use_interior_vgroup and mesh_new:
+ bm = bmesh.new()
+ bm.from_mesh(mesh_new)
+ for bm_vert in bm.verts:
+ bm_vert.tag = True
+ for bm_face in bm.faces:
+ if not bm_face.hide:
+ for bm_vert in bm_face.verts:
+ bm_vert.tag = False
+ # now add all vgroups
+ defvert_lay = bm.verts.layers.deform.verify()
+ for bm_vert in bm.verts:
+ if bm_vert.tag:
+ bm_vert[defvert_lay][0] = 1.0
+ for bm_face in bm.faces:
+ bm_face.hide = False
+ bm.to_mesh(mesh_new)
+ bm.free()
+
+ # add a vgroup
+ obj_cell.vertex_groups.new(name="Interior")
+
if obj_cell is not None:
objects_boolean.append(obj_cell)