[Bf-python] Fwd: Re: 'obj.data' returns NMesh data object even when made with Mesh class.
Dietrich Bollmann
diresu at web.de
Wed Aug 8 11:52:15 CEST 2007
On Wed, 2007-08-08 at 18:49 +1000, Campbell Barton wrote:
> > Is everything in the current API already working in the new
> > development API? Would it be wiser to continue working with the
> > latter one?
> Nope, though Id say its somewhere between 40 and 70% done, but not ready
> for using.
Ok - I'll wait.
> > How about also implementing a widgets library so that Blender
> > could be used not only as the GUI based 3D/animation editing tool
> > it is now but also as a 3D/animation python extension with GUI
> > and everything :) But I think I read this already somewhere
> > in a document about Blenders future?
>
> leaving this open right now since a user interface and event system
> update is planned for blender, once thats done were in a better position
> to plan a new UI module.
Interesting. By the way - as I found your name beside my "Blender
Command Port" patch (which is rather huge and probably with a lot of
unwanted stuff in it also): In this patch I added some code to the
blender queue to make it thread save.
I remember reading somewhere that this is not very much appreciated -
but after looking at Blenders event loop I decided that this would make
things a lot clearer than they are for the moment. And as I wrote
everything for myself in the beginning I didn't mind too much...
> > Another thing I would like to have is a method to dump
> > Objects / datablocks into some textual form which could be
> > saved in files or a data bank or used to send objects over
> > a socket. But probably something like this exist already
> > and I just don't know about it?
> Your really better off writing this as a python function, and hiding it
> away in a module you can import, theres so much data you COULD write and
> you useually dont want to write it all, especially as a text file.
That's what I actually did :)
I initially tried to do this as "Mix-in" - a method to add
functionality to a class at runtime. But this doesn't work for
the moment. Do you know if "Mix-ins" will work for the
new API?
Example:
>>> class A: amember = 111
>>> class B: pass
>>> b = B()
The following currently can't work:
>>> b.amember
Traceback (most recent call last):
File "<stdin>", line 1, in ?
AttributeError: B instance has no attribute 'amember'
...but in (the current version of) Python works after "mixing"
class A into the base classes of B:
>>> B.__bases__ += (A,)
>>> b.amember
111
Here a posting where I explained my problems with mix-ins
a little better:
http://www.blender.org/forum/viewtopic.php?p=62066#62066
See also "Using Mix-ins with Python" by Chuck Esterbrook at
http://www.linuxjournal.com/article/4540
> However having a function to write a datablock out to an external blend
> file would be really nice.
Yes :) --- My personal code is very experimental and probably
only usable by me. But who knows... may be this could be good for
something??
Here an example for a camera setting written to a file:
['scene', 'Scene',
['objects', ['list',
['object', 'Empty.001',
['LocX', 0.0],
['LocY', 0.0],
['LocZ', 0.270000040531],
['RotX', 0.0],
['RotY', -0.0],
['RotZ', 0.0],
['SizeX', 0.300000011921],
['SizeY', 0.300000011921],
['SizeZ', 0.300000011921],
['type', 'Empty'],
['layers', ['list',
16]],
['datablock', None],
['parent', 'scene']],
['object', 'Camera.001',
['LocX', -0.983299195766],
['LocY', -0.983299195766],
['LocZ', 0.786232173443],
['RotX', 0.0],
['RotY', -0.0],
['RotZ', 0.0],
['SizeX', 0.19290651381],
['SizeY', 0.192906484008],
['SizeZ', 0.192906469107],
['type', 'Camera'],
['track', 'Empty.001'],
['layers', ['list',
16]],
['datablock', 'Camera.001'],
['parent', 'scene']]]],
['datablocks', ['list',
['camera', 'Camera.001',
['scale', 6.0],
['lens', 35.0],
['dofDist', 0.0],
['type', 'persp'],
['clipStart', 0.10000000149],
['clipEnd', 100.0],
['drawLimits', False],
['drawMist', False],
['drawName', False],
['drawTileSafe', True],
['drawPassepartout', True],
['alpha', 0.20000000298],
['drawSize', 0.5]]]],
['currentCamera', 'Camera.001']]
...most other files are _much_ longer of course.
> as far as network sockets stuff goes, have a look into verse, you can
> compule blender with verse enabled and edit models over the net with
> others, tried it and it work ;) though I dont think its production ready.
Thank you, I will have a look :)
Sorry for writing such a long mail - but it is sooo nice to chat from
time to time :)
Thanks, Dietrich
More information about the Bf-python
mailing list