[Bf-python] Extra functionality proposals

Dima Glibitsky dima.glib at gmail.com
Sun Nov 20 10:19:41 CET 2011


> I think this could be added as a helper function, written in python in
> 'bpy_extras', see -
> http://www.blender.org/documentation/blender_python_api_2_60_4/bpy_extras.object_utils.html
>
> It can just do multiple ray casts and step forward each time, casting
> from a new point, this is all we would do if it was written in C.
> eg:
>  bpy_extras.object_utils.ray_cast_multi(..., limit=-1),  where -1 is
> unlimited intersections. returns a list of results from ray_cast()

That may be a viable option... But when proposing this, I was
concerned about accuracy -- stepping forward may skip some polygons,
if they intersect the ray almost (or exactly) at the same point.

It would be even better if raycast could accept a Python callback
function -- which can be used both for filtering and for collecting
the required intersection data :)



> As for a way to disable undo - calling operators from a script
> shouldn't be calling undo. at least calling operators within an
> operator wont undo.

That doesn't seem to be the case: I created a new .blend, loaded
Operator Simple from templates and changed main() function to this:
[CODE]
def main(context):
    mode_prev = context.active_object.mode
    bpy.ops.object.mode_set(mode='OBJECT')
    bpy.ops.object.mode_set(mode=mode_prev)
[/CODE]
When I run the operator in editmode, "Toggle Editmode" is recorded in
undo history (tested in 4950_bf_trunk_win32_r41956).
The same thing seems to happen when calling other operators too (e.g.
Join or Convert)



> As for what you are requesting - a way to fake an ID selector, I'm not
> sure about it, can see you might want it but think this adds too much
> functionality into the UI, perhaps this could be done as a new
> property type. bpy.props.* instead.

I vote for new property type :-)



More information about the Bf-python mailing list