<html><body><div style="color:#000; background-color:#fff; font-family:arial, helvetica, sans-serif;font-size:12pt"><div><span>Why using an operator is a problem ? looking into the recommended source code. <br></span></div><br><div style="font-family: arial, helvetica, sans-serif; font-size: 12pt;"><div style="font-family: times new roman, new york, times, serif; font-size: 12pt;"><br>------------------------------<br><br>Message: 3<br>Date: Tue, 25 Oct 2011 07:28:22 -0600<br>From: "Daniel Salazar - 3Developer.com" &lt;<a ymailto="mailto:zanqdo@gmail.com" href="mailto:zanqdo@gmail.com">zanqdo@gmail.com</a>&gt;<br>Subject: Re: [Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions<br>&nbsp;&nbsp;&nbsp; [2520] contrib/py/scripts/addons/ object_drop_to_ground.py: ok i got<br>&nbsp;&nbsp;&nbsp; it to work, it seems object. location was creating the problem so i<br>&nbsp;&nbsp;&nbsp; used the operator translate and it works now .<br>To: <a
 ymailto="mailto:bf-extensions-cvs@blender.org" href="mailto:bf-extensions-cvs@blender.org">bf-extensions-cvs@blender.org</a><br>Message-ID:<br>&nbsp;&nbsp;&nbsp; &lt;<a ymailto="mailto:CABdDwP_AoAhMfwgky7F3R4uUsMFM0G4vuBwvrcRbRxOwbop6UQ@mail.gmail.com" href="mailto:CABdDwP_AoAhMfwgky7F3R4uUsMFM0G4vuBwvrcRbRxOwbop6UQ@mail.gmail.com">CABdDwP_AoAhMfwgky7F3R4uUsMFM0G4vuBwvrcRbRxOwbop6UQ@mail.gmail.com</a>&gt;<br>Content-Type: text/plain; charset=UTF-8<br><br>I'd suggest looking into randomize transform operator that does this<br>without using operators<br><br>Daniel Salazar<br>3Developer.com<br><br><br><br>On Tue, Oct 25, 2011 at 7:26 AM, james bond &lt;<a ymailto="mailto:thekilon@yahoo.co.uk" href="mailto:thekilon@yahoo.co.uk">thekilon@yahoo.co.uk</a>&gt; wrote:<br>&gt; Revision: 2520<br>&gt; ? ? ? ? ?<a href="http://projects.blender.org/scm/viewvc.php?view=rev&amp;root=bf-extensions&amp;revision=2520"
 target="_blank">http://projects.blender.org/scm/viewvc.php?view=rev&amp;root=bf-extensions&amp;revision=2520</a><br>&gt; Author: ? kilon<br>&gt; Date: ? ? 2011-10-25 13:26:33 +0000 (Tue, 25 Oct 2011)<br>&gt; Log Message:<br>&gt; -----------<br>&gt; ok i got it to work, it seems object.location was creating the problem so i used the operator translate and it works now. I also implemented a gui with min max , for ?x,y,z axis to make randomisation more precise. Well keep testing, if randomisation exceeds boundaries of ground then the object will not drop on the ground which i think its normal behaviour, will also put a warning at the wiki<br>&gt;<br>&gt; Modified Paths:<br>&gt; --------------<br>&gt; ? ?contrib/py/scripts/addons/object_drop_to_ground.py<br>&gt;<br>&gt; Modified: contrib/py/scripts/addons/object_drop_to_ground.py<br>&gt; ===================================================================<br>&gt; ---
 contrib/py/scripts/addons/object_drop_to_ground.py ?2011-10-25 12:15:06 UTC (rev 2519)<br>&gt; +++ contrib/py/scripts/addons/object_drop_to_ground.py ?2011-10-25 13:26:33 UTC (rev 2520)<br>&gt; @@ -122,12 +122,14 @@<br>&gt; ? ? for ob in obs:<br>&gt; ? ? ? ? bpy.ops.object.select_all(action='DESELECT')<br>&gt; ? ? ? ? ob.select = True<br>&gt; +<br>&gt; + ? ? ? ?#randomise location it its enabled<br>&gt; ? ? ? ? if sc.random_loc :<br>&gt; ? ? ? ? ? ? print("randomising the location of object : ", ob.name)<br>&gt; ? ? ? ? ? ? print("current location :" + str(ob.location))<br>&gt; - ? ? ? ? ? ?ob.location = (compute_percentage(0,100,ob.location[0],10),<br>&gt; - ? ? ? ? ? ? ? ? ? ? ? ? ? compute_percentage(0,100,ob.location[1],10),<br>&gt; - ? ? ? ? ? ? ? ? ? ? ? ? ? compute_percentage(0,100,ob.location[2],10))<br>&gt; + ? ? ? ? ? ?bpy.ops.transform.translate(value=(compute_percentage(sc.rl_min_x,sc.rl_max_x,0,100),<br>&gt; + ? ? ? ? ? ? ? ? ? ? ? ? ?
 compute_percentage(sc.rl_min_y,sc.rl_max_y,0,100),<br>&gt; + ? ? ? ? ? ? ? ? ? ? ? ? ? compute_percentage(sc.rl_min_z,sc.rl_max_z,0,100)))<br>&gt; ? ? ? ? ? ? print("randomised location : ", str(ob.location))<br>&gt; ? ? ? ? do_drop(context, tmpObj, ob)<br>&gt;<br>&gt; @@ -153,8 +155,26 @@<br>&gt; ? ? ? ? col.operator("object.drop_to_ground", text="Drop")<br>&gt; ? ? ? ? col.prop(context.scene, "align_object")<br>&gt; ? ? ? ? col.prop(context.scene, "use_center")<br>&gt; - ? ? ? # col.prop(context.scene, "random_loc")<br>&gt; + ? ? ? ?box= layout.box()<br>&gt; + ? ? ? ?box.prop(context.scene, "random_loc")<br>&gt;<br>&gt; + ? ? ? ?# random location gui appears only if its enabled<br>&gt; + ? ? ? ?if bpy.context.scene.random_loc:<br>&gt; +<br>&gt; + ? ? ? ? ? ?row = box.row()<br>&gt; + ? ? ? ? ? ?row.label(text="(X,Y,Z) [min/max]")<br>&gt; + ? ? ? ? ? ?row = box.row()<br>&gt; + ? ? ? ? ? ?a = row.split(percentage = 0.5, align = True)<br>&gt; + ? ? ? ? ?
 ?a.prop(context.scene, "rl_min_x")<br>&gt; + ? ? ? ? ? ?a.prop(context.scene, "rl_max_x")<br>&gt; + ? ? ? ? ? ?row = box.row()<br>&gt; + ? ? ? ? ? ?b = row.split(percentage = 0.5, align = True)<br>&gt; + ? ? ? ? ? ?b.prop(context.scene, "rl_min_y")<br>&gt; + ? ? ? ? ? ?b.prop(context.scene, "rl_max_y")<br>&gt; + ? ? ? ? ? ?row = box.row()<br>&gt; + ? ? ? ? ? ?b = row.split(percentage = 0.5, align = True)<br>&gt; + ? ? ? ? ? ?b.prop(context.scene, "rl_min_z")<br>&gt; + ? ? ? ? ? ?b.prop(context.scene, "rl_max_z")<br>&gt;<br>&gt; ?class OBJECT_OT_drop_to_ground(bpy.types.Operator):<br>&gt; ? ? """Drop to ground"""<br>&gt; @@ -181,15 +201,30 @@<br>&gt; ? ? ? ? name="Use the center to drop",<br>&gt; ? ? ? ? description="When dropping the object will be relocated on the basis of its senter",<br>&gt; ? ? ? ? default=False)<br>&gt; +<br>&gt; + ? ? #random location props<br>&gt; ? ? ?bpy.types.Scene.random_loc = BoolProperty(<br>&gt; ? ? ? ? name="Random
 Location",<br>&gt; ? ? ? ? description="When dropping the object will be relocated randomly ",<br>&gt; ? ? ? ? default=False)<br>&gt; -<br>&gt; + ? ? bpy.types.Scene.rl_min_x = ?IntProperty(name="min", description = " Minimum of location randomisation while droped to the ground for the x axis", default = 0)<br>&gt; + ? ? bpy.types.Scene.rl_max_x = ?IntProperty(name="max", description = " Maximum of location randomisation while droped to the ground for the x axis", default = 0)<br>&gt; + ? ? bpy.types.Scene.rl_min_y = ?IntProperty(name="min", description = " Minimum of location randomisation while droped to the ground for the y axis", default = 0)<br>&gt; + ? ? bpy.types.Scene.rl_max_y = ?IntProperty(name="max", description = " Maximum of location randomisation while droped to the ground for the y axis", default = 0)<br>&gt; + ? ? bpy.types.Scene.rl_min_z = ?IntProperty(name="min", description = " Minimum of location randomisation while droped to the
 ground for the z axis", default = 0)<br>&gt; + ? ? bpy.types.Scene.rl_max_z = ?IntProperty(name="max", description = " Maximum of location randomisation while droped to the ground for the z axis", default = 0)<br>&gt; +<br>&gt; ?def unregister():<br>&gt; ? ? bpy.utils.unregister_module(__name__)<br>&gt; ? ? del bpy.types.Scene.align_object<br>&gt; ? ? del bpy.types.Scene.use_center<br>&gt; ? ? del bpy.types.Scene.random_loc<br>&gt; + ? ?del bpy.types.Scene.rl_min_x<br>&gt; + ? ?del bpy.types.Scene.rl_max_x<br>&gt; + ? ?del bpy.types.Scene.rl_min_y<br>&gt; + ? ?del bpy.types.Scene.rl_max_y<br>&gt; + ? ?del bpy.types.Scene.rl_min_z<br>&gt; + ? ?del bpy.types.Scene.rl_max_z<br>&gt; +<br>&gt; ?if __name__ == '__main__':<br>&gt; ? ? register()<br>&gt;<br>&gt; _______________________________________________<br>&gt; Bf-extensions-cvs mailing list<br>&gt; <a ymailto="mailto:Bf-extensions-cvs@blender.org"
 href="mailto:Bf-extensions-cvs@blender.org">Bf-extensions-cvs@blender.org</a><br>&gt; <a href="http://lists.blender.org/mailman/listinfo/bf-extensions-cvs" target="_blank">http://lists.blender.org/mailman/listinfo/bf-extensions-cvs</a><br>&gt;<br><br><br>------------------------------<br><br>_______________________________________________<br>Bf-extensions-cvs mailing list<br><a ymailto="mailto:Bf-extensions-cvs@blender.org" href="mailto:Bf-extensions-cvs@blender.org">Bf-extensions-cvs@blender.org</a><br><a href="http://lists.blender.org/mailman/listinfo/bf-extensions-cvs" target="_blank">http://lists.blender.org/mailman/listinfo/bf-extensions-cvs</a><br><br><br>End of Bf-extensions-cvs Digest, Vol 85, Issue 6<br>************************************************<br><br><br></div></div></div></body></html>