constructors (Re: [Bf-python] More Proposed API changes.)

Ken Hughes khughes at pacific.edu
Tue Mar 13 17:51:06 CET 2007


Willian Padovani Germano wrote:
> Hi guys,
> 
> Again, let's remember what this development is. We are not right now 
> developing a new API. For months we waited and discussed and so on and 
> finally saw, a few months ago, that it was not time to redo BPy and that 
> we actually didn't even have a clue about when the time would come. This 
> came from discussions in Sunday meetings, etc., based on plans for 
> Blender itself.
> 
> So we are updating the current API with nicer, simpler, safer ways to do 
> things.

I'm OK with calling this an "API update" as opposed to a "API redesign". 
  But we should probably decide where to draw the line between the two. 
  And I can understand Cam's impatience with moving forward, as we've 
been talking about these things for at least two years, but I still feel 
better if we decide on *what* to implement before implementing it.

BTW, who are our benevolent dictator(s)?  Hope I'm not one of them, 
otherwise I've missed some meetings in Aruba I'm sure.  If we don't 
really have any, and this discussion isn't making any headway, we should 
select some.  Again, I'm not in any hurry, but I also don't see a point 
in dragging out a discussion needlessly.

> Joseph Gilbert wrote:
> (...)
>> Why not:
>> o = Object(bpy.scenes.active)
>> instead of
>> bpy.scenes.active.objects.new() ?
> 
> The problem here is that BPy uses Object, Mesh, Lamp, etc. etc. as 
> module names. Making them become constructors would break everything. 
> And using Object.Object(), Mesh.Mesh(), etc. is not that friendly at all 
> and it's just adding aliases (Mesh() vs. New()) to our old way of doing 
> things.
> 
> We could then put the constructors in the new bpy module: bpy.object(), 
> bpy.mesh(), etc. 

I like (or don't dislike) a constructor such as bpy.object() or 
bpy.Object(), etc.... in fact, I'm OK with bpy.objects.new() as well.

> But "object", "mesh" and so on are very common var 
> names used in lots of scripts out there. Upper case wouldn't work 
> either, because of the problem with module names, again.

I don't follow this.  I can see how "from bpy import *" could cause 
confusion if used in conjunction with "from Blender import *" since 
Object is in both name spaces, but isn't that the case with any module? 
     Same for "object".

There are going to be trade-offs no matter what we pick.  The question 
is will scripting be easier and more stable as a result?

Ken



More information about the Bf-python mailing list