Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
blender-addons
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
blender
blender-addons
Commits
021d259d
Commit
021d259d
authored
12 years ago
by
Campbell Barton
Browse files
Options
Downloads
Patches
Plain Diff
fracture
- add button in toolbar - fracture all meshes in selection - add option for layer to add into
parent
2a9bbe00
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
object_fracture_cell/__init__.py
+33
-13
33 additions, 13 deletions
object_fracture_cell/__init__.py
object_fracture_cell/fracture_cell_calc.py
+3
-0
3 additions, 0 deletions
object_fracture_cell/fracture_cell_calc.py
with
36 additions
and
13 deletions
object_fracture_cell/__init__.py
+
33
−
13
View file @
021d259d
...
...
@@ -56,6 +56,7 @@ def main_object(scene, obj, level, **kw):
recursion_chance
=
kw_copy
.
pop
(
"
recursion_chance
"
)
recursion_chance_select
=
kw_copy
.
pop
(
"
recursion_chance_select
"
)
use_layer_next
=
kw_copy
.
pop
(
"
use_layer_next
"
)
use_layer_index
=
kw_copy
.
pop
(
"
use_layer_index
"
)
group_name
=
kw_copy
.
pop
(
"
group_name
"
)
use_island_split
=
kw_copy
.
pop
(
"
use_island_split
"
)
use_debug_bool
=
kw_copy
.
pop
(
"
use_debug_bool
"
)
...
...
@@ -127,11 +128,18 @@ def main_object(scene, obj, level, **kw):
# Scene Options
# layer
if
use_layer_next
:
layers_new
=
None
if
use_layer_index
!=
0
:
layers_new
=
[
False
]
*
20
layers_new
[
use_layer_index
-
1
]
=
True
elif
use_layer_next
:
layers_new
=
[
False
]
*
20
layers_new
[(
obj
.
layers
[:].
index
(
True
)
+
1
)
%
20
]
=
True
if
layers_new
is
not
None
:
for
obj_cell
in
objects
:
obj_cell
.
layers
=
layers_new
# group
if
group_name
:
group
=
bpy
.
data
.
groups
.
get
(
group_name
)
...
...
@@ -152,8 +160,12 @@ def main(context, **kw):
import
time
t
=
time
.
time
()
scene
=
context
.
scene
obj
=
context
.
active_object
objects
=
main_object
(
scene
,
obj
,
0
,
**
kw
)
objects_context
=
context
.
selected_editable_objects
objects
=
[]
for
obj
in
objects_context
:
if
obj
.
type
==
'
MESH
'
:
objects
+=
main_object
(
scene
,
obj
,
0
,
**
kw
)
bpy
.
ops
.
object
.
select_all
(
action
=
'
DESELECT
'
)
for
obj_cell
in
objects
:
...
...
@@ -164,7 +176,7 @@ def main(context, **kw):
class
FractureCell
(
Operator
):
bl_idname
=
"
object.add_fracture_cell_objects
"
bl_label
=
"
Cell
F
racture
Mesh
"
bl_label
=
"
Cell
f
racture
selected mesh objects
"
bl_options
=
{
'
PRESET
'
}
# -------------------------------------------------------------------------
...
...
@@ -291,9 +303,16 @@ class FractureCell(Operator):
# .. dirreferent from object options in that this controls how the objects
# are setup in the scene.
use_layer_index
=
IntProperty
(
name
=
"
Layer Index
"
,
description
=
"
Layer to add the objects into or 0 for existing
"
,
default
=-
1
,
min
=
0
,
max
=
20
,
)
use_layer_next
=
BoolProperty
(
name
=
"
Next Layer
"
,
description
=
"
At the object into the next layer
"
,
description
=
"
At the object into the next layer
(layer index overrides)
"
,
default
=
True
,
)
...
...
@@ -382,6 +401,7 @@ class FractureCell(Operator):
col
=
box
.
column
()
col
.
label
(
"
Scene
"
)
rowsub
=
col
.
row
(
align
=
True
)
rowsub
.
prop
(
self
,
"
use_layer_index
"
)
rowsub
.
prop
(
self
,
"
use_layer_next
"
)
rowsub
.
prop
(
self
,
"
group_name
"
)
...
...
@@ -393,22 +413,22 @@ class FractureCell(Operator):
rowsub
.
prop
(
self
,
"
use_debug_points
"
)
rowsub
.
prop
(
self
,
"
use_debug_bool
"
)
#def menu_func(self, context):
# self.layout.menu("INFO_MT_add_fracture_objects", icon="PLUGIN")
def
menu_func
(
self
,
context
):
layout
=
self
.
layout
layout
.
label
(
"
Cell Fracture:
"
)
layout
.
operator
(
"
object.add_fracture_cell_objects
"
,
text
=
"
Cell Fracture
"
)
def
register
():
bpy
.
utils
.
register_class
(
FractureCell
)
# Add the "add fracture objects" menu to the "Add" menu
# bpy.types.INFO_MT_add.append(menu_func)
bpy
.
types
.
VIEW3D_PT_tools_objectmode
.
append
(
menu_func
)
def
unregister
():
bpy
.
utils
.
unregister_class
(
FractureCell
)
# Remove "add fracture objects" menu from the "Add" menu.
# bpy.types.INFO_MT_add.remove(menu_func)
bpy
.
types
.
VIEW3D_PT_tools_objectmode
.
remove
(
menu_func
)
if
__name__
==
"
__main__
"
:
...
...
This diff is collapsed.
Click to expand it.
object_fracture_cell/fracture_cell_calc.py
+
3
−
0
View file @
021d259d
...
...
@@ -44,6 +44,9 @@ def points_as_bmesh_cells(verts,
plane_indices
=
[]
vertices
=
[]
if
points_scale
==
(
1.0
,
1.0
,
1.0
):
points_scale
=
None
# there are many ways we could get planes - convex hull for eg
# but it ends up fastest if we just use bounding box
if
1
:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment