[Bf-python] Fwd: Re: 'obj.data' returns NMesh data object even when made with Mesh class.

Campbell Barton cbarton at metavr.com
Wed Aug 8 10:49:29 CEST 2007


Dietrich Bollmann wrote:
> On Tue, 2007-08-07 at 22:49 +1000, Campbell Barton wrote:
>> Toni Alatalo wrote:
>>>> Maybe an error message when trying to do something like
>>>>>>> object.data.materials = [ material ]
>>>> would be helpful.
>>> hm .. i wonder if it would make sense for NMesh to handle some errors so that 
>>> it suggests 'i am depracated, did you mean to use Mesh instead?. dunno if 
>>> some hints could be easily hacked there somewhere.
>> object.data.materials = [ material ]
>>
>> Theres no way to detect that the NMesh is being created, altered, then 
>> deallocated (with no change to blenders data)
>>
>> We cant fix in the current API but in the develoment python API NMesh 
>> has been removed and this works.
> 
> Ok - I am happy with the current method and just wrote my message 
> to help making the API easier to use for the next person with a similar
> problem.  But if there is no NMesh in the new version the problem
> vanishes soon anyway.
> 
> Even if not helpful I learnt something by reading the answers - 
> thank you :)
> 
> 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.

> 
>> Iv also subtyped lists, so the lists synchronize with blender's data
>>
>>   ls = object.data.materials
>>   ls.append(mat)
>>
>> - works also.
>>
>> http://wiki.blender.org/index.php/Rewriting_the_2.4x_BPython_API
> 
> That looks very promising :)
> 
> 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.

> 
> 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.

However having a function to write a datablock out to an external blend 
file would be really nice.

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.

> 
> Sorry for those two last paragraphs which are completely
> not connected to the topic of this message :)
> 
> Greetings, Dietrich


-- 
Campbell J Barton (ideasman42)



More information about the Bf-python mailing list