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
1da60d32
Commit
1da60d32
authored
5 years ago
by
Campbell Barton
Browse files
Options
Downloads
Patches
Plain Diff
Cleanup: object_fracture_cell indentation
parent
2d8edd6d
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
object_fracture_cell/__init__.py
+167
-149
167 additions, 149 deletions
object_fracture_cell/__init__.py
with
167 additions
and
149 deletions
object_fracture_cell/__init__.py
+
167
−
149
View file @
1da60d32
...
...
@@ -35,13 +35,13 @@ bl_info = {
import
bpy
from
bpy.props
import
(
StringProperty
,
BoolProperty
,
IntProperty
,
FloatProperty
,
FloatVectorProperty
,
EnumProperty
,
)
StringProperty
,
BoolProperty
,
IntProperty
,
FloatProperty
,
FloatVectorProperty
,
EnumProperty
,
)
from
bpy.types
import
Operator
...
...
@@ -80,18 +80,22 @@ def main_object(context, obj, level, **kw):
obj
.
display_type
=
'
WIRE
'
objects
=
fracture_cell_setup
.
cell_fracture_objects
(
context
,
obj
,
**
kw_copy
)
objects
=
fracture_cell_setup
.
cell_fracture_boolean
(
context
,
obj
,
objects
,
use_island_split
=
use_island_split
,
use_interior_hide
=
(
use_interior_vgroup
or
use_sharp_edges
),
use_debug_bool
=
use_debug_bool
,
use_debug_redraw
=
kw_copy
[
"
use_debug_redraw
"
],
level
=
level
,
)
objects
=
fracture_cell_setup
.
cell_fracture_boolean
(
context
,
obj
,
objects
,
use_island_split
=
use_island_split
,
use_interior_hide
=
(
use_interior_vgroup
or
use_sharp_edges
),
use_debug_bool
=
use_debug_bool
,
use_debug_redraw
=
kw_copy
[
"
use_debug_redraw
"
],
level
=
level
,
)
# must apply after boolean.
if
use_recenter
:
bpy
.
ops
.
object
.
origin_set
({
"
selected_editable_objects
"
:
objects
},
type
=
'
ORIGIN_GEOMETRY
'
,
center
=
'
MEDIAN
'
)
bpy
.
ops
.
object
.
origin_set
(
{
"
selected_editable_objects
"
:
objects
},
type
=
'
ORIGIN_GEOMETRY
'
,
center
=
'
MEDIAN
'
,
)
#----------
# Recursion
...
...
@@ -105,9 +109,10 @@ def main_object(context, obj, level, **kw):
if
recursion_chance_select
==
'
RANDOM
'
:
random
.
shuffle
(
objects_recurse_input
)
elif
recursion_chance_select
in
{
'
SIZE_MIN
'
,
'
SIZE_MAX
'
}:
objects_recurse_input
.
sort
(
key
=
lambda
ob_pair
:
(
Vector
(
ob_pair
[
1
].
bound_box
[
0
])
-
Vector
(
ob_pair
[
1
].
bound_box
[
6
])).
length_squared
)
objects_recurse_input
.
sort
(
key
=
lambda
ob_pair
:
(
Vector
(
ob_pair
[
1
].
bound_box
[
0
])
-
Vector
(
ob_pair
[
1
].
bound_box
[
6
])
).
length_squared
)
if
recursion_chance_select
==
'
SIZE_MAX
'
:
objects_recurse_input
.
reverse
()
elif
recursion_chance_select
in
{
'
CURSOR_MIN
'
,
'
CURSOR_MAX
'
}:
...
...
@@ -142,11 +147,12 @@ def main_object(context, obj, level, **kw):
if
level
==
0
:
# import pdb; pdb.set_trace()
if
use_interior_vgroup
or
use_sharp_edges
:
fracture_cell_setup
.
cell_fracture_interior_handle
(
objects
,
use_interior_vgroup
=
use_interior_vgroup
,
use_sharp_edges
=
use_sharp_edges
,
use_sharp_edges_apply
=
use_sharp_edges_apply
,
)
fracture_cell_setup
.
cell_fracture_interior_handle
(
objects
,
use_interior_vgroup
=
use_interior_vgroup
,
use_sharp_edges
=
use_sharp_edges
,
use_sharp_edges_apply
=
use_sharp_edges_apply
,
)
#--------------
# Scene Options
...
...
@@ -247,168 +253,178 @@ class FractureCell(Operator):
# -------------------------------------------------------------------------
# Source Options
source
:
EnumProperty
(
name
=
"
Source
"
,
items
=
((
'
VERT_OWN
'
,
"
Own Verts
"
,
"
Use own vertices
"
),
(
'
VERT_CHILD
'
,
"
Child Verts
"
,
"
Use child object vertices
"
),
(
'
PARTICLE_OWN
'
,
"
Own Particles
"
,
(
"
All particle systems of the
"
"
source object
"
)),
(
'
PARTICLE_CHILD
'
,
"
Child Particles
"
,
(
"
All particle systems of the
"
"
child objects
"
)),
(
'
PENCIL
'
,
"
Annotation Pencil
"
,
"
Annotation Grease Pencil.
"
),
),
options
=
{
'
ENUM_FLAG
'
},
default
=
{
'
PARTICLE_OWN
'
},
)
name
=
"
Source
"
,
items
=
(
(
'
VERT_OWN
'
,
"
Own Verts
"
,
"
Use own vertices
"
),
(
'
VERT_CHILD
'
,
"
Child Verts
"
,
"
Use child object vertices
"
),
(
'
PARTICLE_OWN
'
,
"
Own Particles
"
,
(
"
All particle systems of the
"
"
source object
"
)),
(
'
PARTICLE_CHILD
'
,
"
Child Particles
"
,
(
"
All particle systems of the
"
"
child objects
"
)),
(
'
PENCIL
'
,
"
Annotation Pencil
"
,
"
Annotation Grease Pencil.
"
),
),
options
=
{
'
ENUM_FLAG
'
},
default
=
{
'
PARTICLE_OWN
'
},
)
source_limit
:
IntProperty
(
name
=
"
Source Limit
"
,
description
=
"
Limit the number of input points, 0 for unlimited
"
,
min
=
0
,
max
=
5000
,
default
=
100
,
)
name
=
"
Source Limit
"
,
description
=
"
Limit the number of input points, 0 for unlimited
"
,
min
=
0
,
max
=
5000
,
default
=
100
,
)
source_noise
:
FloatProperty
(
name
=
"
Noise
"
,
description
=
"
Randomize point distribution
"
,
min
=
0.0
,
max
=
1.0
,
default
=
0.0
,
)
name
=
"
Noise
"
,
description
=
"
Randomize point distribution
"
,
min
=
0.0
,
max
=
1.0
,
default
=
0.0
,
)
cell_scale
:
FloatVectorProperty
(
name
=
"
Scale
"
,
description
=
"
Scale Cell Shape
"
,
size
=
3
,
min
=
0.0
,
max
=
1.0
,
default
=
(
1.0
,
1.0
,
1.0
),
)
name
=
"
Scale
"
,
description
=
"
Scale Cell Shape
"
,
size
=
3
,
min
=
0.0
,
max
=
1.0
,
default
=
(
1.0
,
1.0
,
1.0
),
)
# -------------------------------------------------------------------------
# Recursion
recursion
:
IntProperty
(
name
=
"
Recursion
"
,
description
=
"
Break shards recursively
"
,
min
=
0
,
max
=
5000
,
default
=
0
,
)
name
=
"
Recursion
"
,
description
=
"
Break shards recursively
"
,
min
=
0
,
max
=
5000
,
default
=
0
,
)
recursion_source_limit
:
IntProperty
(
name
=
"
Source Limit
"
,
description
=
"
Limit the number of input points, 0 for unlimited (applies to recursion only)
"
,
min
=
0
,
max
=
5000
,
default
=
8
,
)
name
=
"
Source Limit
"
,
description
=
"
Limit the number of input points, 0 for unlimited (applies to recursion only)
"
,
min
=
0
,
max
=
5000
,
default
=
8
,
)
recursion_clamp
:
IntProperty
(
name
=
"
Clamp Recursion
"
,
description
=
"
Finish recursion when this number of objects is reached (prevents recursing for extended periods of time), zero disables
"
,
min
=
0
,
max
=
10000
,
default
=
250
,
)
name
=
"
Clamp Recursion
"
,
description
=
(
"
Finish recursion when this number of objects is reached
"
"
(prevents recursing for extended periods of time), zero disables
"
),
min
=
0
,
max
=
10000
,
default
=
250
,
)
recursion_chance
:
FloatProperty
(
name
=
"
Random Factor
"
,
description
=
"
Likelihood of recursion
"
,
min
=
0.0
,
max
=
1.0
,
default
=
0.25
,
)
name
=
"
Random Factor
"
,
description
=
"
Likelihood of recursion
"
,
min
=
0.0
,
max
=
1.0
,
default
=
0.25
,
)
recursion_chance_select
:
EnumProperty
(
name
=
"
Recurse Over
"
,
items
=
((
'
RANDOM
'
,
"
Random
"
,
""
),
(
'
SIZE_MIN
'
,
"
Small
"
,
"
Recursively subdivide smaller objects
"
),
(
'
SIZE_MAX
'
,
"
Big
"
,
"
Recursively subdivide bigger objects
"
),
(
'
CURSOR_MIN
'
,
"
Cursor Close
"
,
"
Recursively subdivide objects closer to the cursor
"
),
(
'
CURSOR_MAX
'
,
"
Cursor Far
"
,
"
Recursively subdivide objects farther from the cursor
"
),
),
default
=
'
SIZE_MIN
'
,
)
name
=
"
Recurse Over
"
,
items
=
(
(
'
RANDOM
'
,
"
Random
"
,
""
),
(
'
SIZE_MIN
'
,
"
Small
"
,
"
Recursively subdivide smaller objects
"
),
(
'
SIZE_MAX
'
,
"
Big
"
,
"
Recursively subdivide bigger objects
"
),
(
'
CURSOR_MIN
'
,
"
Cursor Close
"
,
"
Recursively subdivide objects closer to the cursor
"
),
(
'
CURSOR_MAX
'
,
"
Cursor Far
"
,
"
Recursively subdivide objects farther from the cursor
"
),
),
default
=
'
SIZE_MIN
'
,
)
# -------------------------------------------------------------------------
# Mesh Data Options
use_smooth_faces
:
BoolProperty
(
name
=
"
Smooth Interior
"
,
description
=
"
Smooth Faces of inner side
"
,
default
=
False
,
)
name
=
"
Smooth Interior
"
,
description
=
"
Smooth Faces of inner side
"
,
default
=
False
,
)
use_sharp_edges
:
BoolProperty
(
name
=
"
Sharp Edges
"
,
description
=
"
Set sharp edges when disabled
"
,
default
=
True
,
)
name
=
"
Sharp Edges
"
,
description
=
"
Set sharp edges when disabled
"
,
default
=
True
,
)
use_sharp_edges_apply
:
BoolProperty
(
name
=
"
Apply Split Edge
"
,
description
=
"
Split sharp hard edges
"
,
default
=
True
,
)
name
=
"
Apply Split Edge
"
,
description
=
"
Split sharp hard edges
"
,
default
=
True
,
)
use_data_match
:
BoolProperty
(
name
=
"
Match Data
"
,
description
=
"
Match original mesh materials and data layers
"
,
default
=
True
,
)
name
=
"
Match Data
"
,
description
=
"
Match original mesh materials and data layers
"
,
default
=
True
,
)
use_island_split
:
BoolProperty
(
name
=
"
Split Islands
"
,
description
=
"
Split disconnected meshes
"
,
default
=
True
,
)
name
=
"
Split Islands
"
,
description
=
"
Split disconnected meshes
"
,
default
=
True
,
)
margin
:
FloatProperty
(
name
=
"
Margin
"
,
description
=
"
Gaps for the fracture (gives more stable physics)
"
,
min
=
0.0
,
max
=
1.0
,
default
=
0.001
,
)
name
=
"
Margin
"
,
description
=
"
Gaps for the fracture (gives more stable physics)
"
,
min
=
0.0
,
max
=
1.0
,
default
=
0.001
,
)
material_index
:
IntProperty
(
name
=
"
Material
"
,
description
=
"
Material index for interior faces
"
,
default
=
0
,
)
name
=
"
Material
"
,
description
=
"
Material index for interior faces
"
,
default
=
0
,
)
use_interior_vgroup
:
BoolProperty
(
name
=
"
Interior VGroup
"
,
description
=
"
Create a vertex group for interior verts
"
,
default
=
False
,
)
name
=
"
Interior VGroup
"
,
description
=
"
Create a vertex group for interior verts
"
,
default
=
False
,
)
# -------------------------------------------------------------------------
# Physics Options
mass_mode
:
EnumProperty
(
name
=
"
Mass Mode
"
,
items
=
((
'
VOLUME
'
,
"
Volume
"
,
"
Objects get part of specified mass based on their volume
"
),
(
'
UNIFORM
'
,
"
Uniform
"
,
"
All objects get the specified mass
"
),
),
default
=
'
VOLUME
'
,
)
name
=
"
Mass Mode
"
,
items
=
(
(
'
VOLUME
'
,
"
Volume
"
,
"
Objects get part of specified mass based on their volume
"
),
(
'
UNIFORM
'
,
"
Uniform
"
,
"
All objects get the specified mass
"
),
),
default
=
'
VOLUME
'
,
)
mass
:
FloatProperty
(
name
=
"
Mass
"
,
description
=
"
Mass to give created objects
"
,
min
=
0.001
,
max
=
1000.0
,
default
=
1.0
,
)
name
=
"
Mass
"
,
description
=
"
Mass to give created objects
"
,
min
=
0.001
,
max
=
1000.0
,
default
=
1.0
,
)
# -------------------------------------------------------------------------
# Object Options
use_recenter
:
BoolProperty
(
name
=
"
Recenter
"
,
description
=
"
Recalculate the center points after splitting
"
,
default
=
True
,
)
name
=
"
Recenter
"
,
description
=
"
Recalculate the center points after splitting
"
,
default
=
True
,
)
use_remove_original
:
BoolProperty
(
name
=
"
Remove Original
"
,
description
=
"
Removes the parents used to create the shatter
"
,
default
=
True
,
)
name
=
"
Remove Original
"
,
description
=
"
Removes the parents used to create the shatter
"
,
default
=
True
,
)
# -------------------------------------------------------------------------
# Scene Options
...
...
@@ -417,30 +433,32 @@ class FractureCell(Operator):
# are setup in the scene.
collection_name
:
StringProperty
(
name
=
"
Collection
"
,
description
=
"
Create objects in a collection
"
"
(use existing or create new)
"
,
)
name
=
"
Collection
"
,
description
=
(
"
Create objects in a collection
"
"
(use existing or create new)
"
),
)
# -------------------------------------------------------------------------
# Debug
use_debug_points
:
BoolProperty
(
name
=
"
Debug Points
"
,
description
=
"
Create mesh data showing the points used for fracture
"
,
default
=
False
,
)
name
=
"
Debug Points
"
,
description
=
"
Create mesh data showing the points used for fracture
"
,
default
=
False
,
)
use_debug_redraw
:
BoolProperty
(
name
=
"
Show Progress Realtime
"
,
description
=
"
Redraw as fracture is done
"
,
default
=
True
,
)
name
=
"
Show Progress Realtime
"
,
description
=
"
Redraw as fracture is done
"
,
default
=
True
,
)
use_debug_bool
:
BoolProperty
(
name
=
"
Debug Boolean
"
,
description
=
"
Skip applying the boolean modifier
"
,
default
=
False
,
)
name
=
"
Debug Boolean
"
,
description
=
"
Skip applying the boolean modifier
"
,
default
=
False
,
)
def
execute
(
self
,
context
):
keywords
=
self
.
as_keywords
()
# ignore=("blah",)
...
...
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