[Bf-python] Remote bpy for Blender2.5

Stuart Axon stuaxo2 at yahoo.com
Sat Jul 31 00:56:20 CEST 2010


Is it worth chucking this on google code or somewhere, maybe ?

 S++


>
>From: Goat Man <goatman.py at gmail.com>
>To: Blender Foundation Python list <bf-python at blender.org>
>Sent: Fri, July 30, 2010 3:11:32 AM
>Subject: [Bf-python] Remote bpy for Blender2.5
>
>http://pastebin.com/B8PmuDrv
>
>Allows access to bpy.ops and bpy.data from a remote python2 or PyPy  
>interpreter.  Implementation uses a pipe, but this can be replaced by a  socket 
>for truly remote access. The binding generator works by RNA  introspection, and 
>outputs RPython compatible code.  Optionally you can  write RPython code that 
>will compile to C.  This proxy is also useful if  you need a python2 interpreter 
>to talk to a python3 interpreter outside  of Blender.
>
>Currently a hack is used to make Blender listen on the pipe, using  playback and 
>the on_redraw event, hopefully Blender will provide an  interface soon for 
>talking on pipes/sockets and forced redraw events
>
>Example:
>
>def pypy_entry_point_test_bpy():
>    ## init wrapper ##
>    bpy_ops = bpy_ops_wrapped()
>    bpy_ops_mesh = bpy_ops.mesh()
>    bpy_data = bpy_data_wrapped()
>    bpy_data_objects = bpy_data.objects()
>    ######################
>
>    objs = bpy_data_objects.values()
>    for ob in objs:
>        debug(str(ob))
>        debug( str( ob.location()) )
>
>    names = bpy_data_objects.keys()
>    camera = None
>    for n in names:
>        ob = bpy_data_objects.get( n )
>        if n == 'Camera':
>            camera = ob
>            scale = camera.GET_scale()
>            debug( 'camera scale: %s' %scale )
>            scale[0] = 10.0
>            camera.scale( scale )
>            break
>
>    i = 0
>    while True:
>        x = math.sin( radians(i) ) * 1.0
>        y = math.cos( radians(i) ) * 1.0
>        bpy_ops_mesh.primitive_plane_add( location=(x,y,.0) )
>        for ob in objs: ob.location( [x,y,.0] )
>        i += 1
>        if i == 360: break
>
>
>
>


      
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.blender.org/pipermail/bf-python/attachments/20100730/33107950/attachment.html>


More information about the Bf-python mailing list