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>2011-08-09 14:25:05 +0400
committerCampbell Barton <ideasman42@gmail.com>2011-08-09 14:25:05 +0400
commit6cd3355bebe1b55fb49ec658faa01c7c33ea3fc3 (patch)
tree3b8ad4b984dbc797b98402da9a0f9a9a8b0d2882 /object_grease_scatter.py
parentfe8cbeaed3f68462f720e3fa6c052b853ee9e0db (diff)
fix for applying scatter to objects with transformation
Diffstat (limited to 'object_grease_scatter.py')
-rw-r--r--object_grease_scatter.py11
1 files changed, 8 insertions, 3 deletions
diff --git a/object_grease_scatter.py b/object_grease_scatter.py
index 867d68d6..4d6aeddb 100644
--- a/object_grease_scatter.py
+++ b/object_grease_scatter.py
@@ -112,10 +112,15 @@ def _main(self,
ray = obj.ray_cast
closest_point_on_mesh = obj.closest_point_on_mesh
+ obj_mat = obj.matrix_world.copy()
+ obj_mat_inv = obj_mat.inverted()
+ # obj_quat = obj_mat.to_quaternion()
+ # obj_quat_inv = obj_mat_inv.to_quaternion()
+
DEBUG = False
def fix_point(p):
- hit, no, ind = closest_point_on_mesh(p)
+ hit, no, ind = closest_point_on_mesh(obj_mat_inv * p)
if ind != -1:
if DEBUG:
return [p, no, None]
@@ -294,8 +299,8 @@ def _main(self,
inst_ob.location = 0.0, 0.0, 0.0
inst_ob.parent = obj_new
- # important to set last
- obj_new.matrix_world = obj.matrix_world
+ # align the object with worldspace
+ obj_new.matrix_world = obj_mat
# BGE settings for testiing
'''