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
9bc7dad4
Commit
9bc7dad4
authored
5 years ago
by
Campbell Barton
Browse files
Options
Downloads
Patches
Plain Diff
fracture_cell_setup: get particles from evaluated object
From patch by @Gappy1 (T61901)
parent
d269e6b9
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
object_fracture_cell/fracture_cell_setup.py
+6
-5
6 additions, 5 deletions
object_fracture_cell/fracture_cell_setup.py
with
6 additions
and
5 deletions
object_fracture_cell/fracture_cell_setup.py
+
6
−
5
View file @
9bc7dad4
...
@@ -30,7 +30,7 @@ _redraw_yasiamevil.opr = bpy.ops.wm.redraw_timer
...
@@ -30,7 +30,7 @@ _redraw_yasiamevil.opr = bpy.ops.wm.redraw_timer
_redraw_yasiamevil
.
arg
=
dict
(
type
=
'
DRAW_WIN_SWAP
'
,
iterations
=
1
)
_redraw_yasiamevil
.
arg
=
dict
(
type
=
'
DRAW_WIN_SWAP
'
,
iterations
=
1
)
def
_points_from_object
(
scene
,
obj
,
source
):
def
_points_from_object
(
depsgraph
,
scene
,
obj
,
source
):
_source_all
=
{
_source_all
=
{
'
PARTICLE_OWN
'
,
'
PARTICLE_CHILD
'
,
'
PARTICLE_OWN
'
,
'
PARTICLE_CHILD
'
,
...
@@ -65,7 +65,6 @@ def _points_from_object(scene, obj, source):
...
@@ -65,7 +65,6 @@ def _points_from_object(scene, obj, source):
matrix
=
obj
.
matrix_world
.
copy
()
matrix
=
obj
.
matrix_world
.
copy
()
points
.
extend
([
matrix
@
v
.
co
for
v
in
mesh
.
vertices
])
points
.
extend
([
matrix
@
v
.
co
for
v
in
mesh
.
vertices
])
else
:
else
:
depsgraph
=
bpy
.
context
.
evaluated_depsgraph_get
()
ob_eval
=
ob
.
evaluated_get
(
depsgraph
)
ob_eval
=
ob
.
evaluated_get
(
depsgraph
)
try
:
try
:
mesh
=
ob_eval
.
to_mesh
()
mesh
=
ob_eval
.
to_mesh
()
...
@@ -78,8 +77,9 @@ def _points_from_object(scene, obj, source):
...
@@ -78,8 +77,9 @@ def _points_from_object(scene, obj, source):
ob_eval
.
to_mesh_clear
()
ob_eval
.
to_mesh_clear
()
def
points_from_particles
(
obj
):
def
points_from_particles
(
obj
):
obj_eval
=
obj
.
evaluated_get
(
depsgraph
)
points
.
extend
([
p
.
location
.
copy
()
points
.
extend
([
p
.
location
.
copy
()
for
psys
in
obj
.
particle_systems
for
psys
in
obj
_eval
.
particle_systems
for
p
in
psys
.
particles
])
for
p
in
psys
.
particles
])
# geom own
# geom own
...
@@ -138,6 +138,7 @@ def cell_fracture_objects(context, obj,
...
@@ -138,6 +138,7 @@ def cell_fracture_objects(context, obj,
):
):
from
.
import
fracture_cell_calc
from
.
import
fracture_cell_calc
depsgraph
=
context
.
evaluated_depsgraph_get
()
scene
=
context
.
scene
scene
=
context
.
scene
collection
=
context
.
collection
collection
=
context
.
collection
view_layer
=
context
.
view_layer
view_layer
=
context
.
view_layer
...
@@ -145,11 +146,11 @@ def cell_fracture_objects(context, obj,
...
@@ -145,11 +146,11 @@ def cell_fracture_objects(context, obj,
# -------------------------------------------------------------------------
# -------------------------------------------------------------------------
# GET POINTS
# GET POINTS
points
=
_points_from_object
(
scene
,
obj
,
source
)
points
=
_points_from_object
(
depsgraph
,
scene
,
obj
,
source
)
if
not
points
:
if
not
points
:
# print using fallback
# print using fallback
points
=
_points_from_object
(
scene
,
obj
,
{
'
VERT_OWN
'
})
points
=
_points_from_object
(
depsgraph
,
scene
,
obj
,
{
'
VERT_OWN
'
})
if
not
points
:
if
not
points
:
print
(
"
no points found
"
)
print
(
"
no points found
"
)
...
...
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