[Bf-python] Bug and Fix in tracker for Armature.NLA

Gilbert, Joseph T. jgilbert at tigr.ORG
Thu May 4 19:56:29 CEST 2006


>From a python standpoint, if there is a problem with having objects with
the same name it would be better to throw an exception which can be
caught rather than silently rename the object without the users
knowledge. If it's not a problem you would let it die silently.

Unfortunately the behavior or renaming objects on creation is part of
the blender source and it is used extensively in the API to date :(
Users probably expect your data to get automagically renamed as data.001
if you're too lazy to rename it yourself. Personally I don't see what's
wrong with having 2 Objects with the same name but different data, but
blender seems to think that this behavior should be auto-corrected for
some reason :/

-----Original Message-----
From: bf-python-bounces at projects.blender.org
[mailto:bf-python-bounces at projects.blender.org] On Behalf Of Ken Hughes
Sent: Thursday, May 04, 2006 1:34 PM
To: Blender Foundation Python list
Subject: Re: [Bf-python] Bug and Fix in tracker for Armature.NLA

Stephen Swaney wrote:
> On Thu, May 04, 2006 at 08:59:15AM -0700, Ken Hughes wrote:
> 
>>Stephen Swaney wrote:
>>
>>>I have a problem with this in that if there is a name collision, it
>>>changes the name from what was asked for but does not inform the
>>>caller in any way.  The script now has no idea what the new name is
or
>>>that there is one.
>>
>>But it's not hard to find out the resulting name:
>>
>>  arm.name = 'this'
>>  name = arm.name
>>
>>We proabably just need to document this "behavior".
> 
> 
> The part that bothers me is that it happens with no indication that
> the result was not what you asked for.  That does not seem good.
> 
> Normally, when unusual things happen, we throw an exception.  In
> the "don't care what happens case", this simply devolves into
> 
>   try: arm.name = 'foo'
>   except: pass
> 
> That does not seem too painful!

Looking thru blenkernel/intern/library.c, it looks like we'd need to add

our own routine to test for an existing name.  In any case, I think we 
need to handle this in the "rip the API apart" rewrite?

Ken
_______________________________________________
Bf-python mailing list
Bf-python at projects.blender.org
http://projects.blender.org/mailman/listinfo/bf-python



More information about the Bf-python mailing list