Dima, are you still working on the multi-raycast idea?<br><br>I did some more digging.  Blender calls bullet to do the heavy duty work of ray-casting.<br>I recall from my days working with a game team, there was a fair bit of time spent reducing and optimizing the ray-casts cause it was slowing things down.<br>
<br>Bullet does a raycast in two steps:<br><br>1.  Broadphase culling<br>2.  Ray intersections<br><br>In the broadphase, the octree of game objects is culled according to axis aligned bounding boxes.  There are a lot of .cpp files involved and most of the functions are inlined (optimization)<br>
The end result is an array of likely candidates for intersection.  I'm not sure yet, but i think the object list is ordered by aabbs so the nearest candidate will get tested first.<br><br>In the second step, each object is tested for intersection.<br>
<br>Doing a multi-cast from python would inevitably require the broadphase culling at every step.  For under say 20 objects that's probably ok. but if you have, say, 100 objects, you really don't want to be doing the broadphase cull 100 times.  It would be fun to do some profiling to find out the ratio of step1/step2 as a function of n objects.<br>
<br>My guess is for most users, a python multicast would be fine.  But looking forward for a game-engine solution, what we really want is for bullet to give blender the object-kebab when the multi cast is called.<br><br>kesten<br>
<br><div class="gmail_quote">On Sun, Nov 20, 2011 at 3:19 AM, Dima Glibitsky <span dir="ltr"><<a href="mailto:dima.glib@gmail.com">dima.glib@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="im">> I think this could be added as a helper function, written in python in<br>
> 'bpy_extras', see -<br>
> <a href="http://www.blender.org/documentation/blender_python_api_2_60_4/bpy_extras.object_utils.html" target="_blank">http://www.blender.org/documentation/blender_python_api_2_60_4/bpy_extras.object_utils.html</a><br>

><br>
> It can just do multiple ray casts and step forward each time, casting<br>
> from a new point, this is all we would do if it was written in C.<br>
> eg:<br>
>  bpy_extras.object_utils.ray_cast_multi(..., limit=-1),  where -1 is<br>
> unlimited intersections. returns a list of results from ray_cast()<br>
<br>
</div>That may be a viable option... But when proposing this, I was<br>
concerned about accuracy -- stepping forward may skip some polygons,<br>
if they intersect the ray almost (or exactly) at the same point.<br>
<br>
It would be even better if raycast could accept a Python callback<br>
function -- which can be used both for filtering and for collecting<br>
the required intersection data :)<br>
<div class="im"><br>
<br>
<br>
> As for a way to disable undo - calling operators from a script<br>
> shouldn't be calling undo. at least calling operators within an<br>
> operator wont undo.<br>
<br>
</div>That doesn't seem to be the case: I created a new .blend, loaded<br>
Operator Simple from templates and changed main() function to this:<br>
[CODE]<br>
def main(context):<br>
    mode_prev = context.active_object.mode<br>
    bpy.ops.object.mode_set(mode='OBJECT')<br>
    bpy.ops.object.mode_set(mode=mode_prev)<br>
[/CODE]<br>
When I run the operator in editmode, "Toggle Editmode" is recorded in<br>
undo history (tested in 4950_bf_trunk_win32_r41956).<br>
The same thing seems to happen when calling other operators too (e.g.<br>
Join or Convert)<br>
<div class="im"><br>
<br>
<br>
> As for what you are requesting - a way to fake an ID selector, I'm not<br>
> sure about it, can see you might want it but think this adds too much<br>
> functionality into the UI, perhaps this could be done as a new<br>
> property type. bpy.props.* instead.<br>
<br>
</div>I vote for new property type :-)<br>
<div><div></div><div class="h5">_______________________________________________<br>
Bf-python mailing list<br>
<a href="mailto:Bf-python@blender.org">Bf-python@blender.org</a><br>
<a href="http://lists.blender.org/mailman/listinfo/bf-python" target="_blank">http://lists.blender.org/mailman/listinfo/bf-python</a><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br><br>Kesten Broughton<br>President and Technology Director, <br>Solar Mobile Trailers<br><a href="http://www.sunfarmkitchens.ca" target="_blank">kesten@solarmobiletrailers.com<br>
www.sunfarmkitchens.ca</a><br>512 701 4209<br><div style="display:inline"></div><br>