[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [2238] trunk/py/scripts/addons/ object_grease_scatter.py: fix for applying scatter to objects with transformation
Campbell Barton
ideasman42 at gmail.com
Tue Aug 9 12:25:07 CEST 2011
Revision: 2238
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-extensions&revision=2238
Author: campbellbarton
Date: 2011-08-09 10:25:05 +0000 (Tue, 09 Aug 2011)
Log Message:
-----------
fix for applying scatter to objects with transformation
Modified Paths:
--------------
trunk/py/scripts/addons/object_grease_scatter.py
Modified: trunk/py/scripts/addons/object_grease_scatter.py
===================================================================
--- trunk/py/scripts/addons/object_grease_scatter.py 2011-08-09 08:58:15 UTC (rev 2237)
+++ trunk/py/scripts/addons/object_grease_scatter.py 2011-08-09 10:25:05 UTC (rev 2238)
@@ -112,10 +112,15 @@
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 @@
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
'''
More information about the Bf-extensions-cvs
mailing list