[Bf-python] A few notes

Willian Padovani Germano wgermano at ig.com.br
Fri Sep 19 15:23:57 CEST 2003


Hi,

This is again about those changes to make NMesh more consistent.  Sorry for
another long post.

Let's see what we want:

1 - a way to pass a ptr to the parent obj, so that the vgrouping methods
(and maybe other additions, later) can work.

2 - to avoid creating mesh datablocks that won't be used.

3 - to make the interface to link meshes and objects simpler.

4 - not to break compatibility at all.

I just woke up, this was my first thought today (well, I guess I'm totally
awaken, but ...): it may be better to only define the nmesh->object pointer
in two clear situations:

- the nmesh came from nmesh = object.getData()
- the existing nmesh was just linked to an object (PutRaw or
object.link(nmesh).

Don't take any of this as a decision, it's just another idea for the
discussion.  My reasoning is that it's not necessary to make users guess
(and use a nmesh.isLinked() method) to know their GetRaw'ed nmesh was or
wasn't linked.  If we clearly define what is a 'linked' nmesh, then the
right code for each situation will be clear.

Like this:

if you get the nmesh with GetRaw() or GetRawFromObject, you're getting only
a mesh datablock, no links until you make one.

if you create a new nmesh, no link until you make one.

if you use nmesh = Object.getData() you get a linked nmesh, since you're
getting it from the object directly.

I understand, Joseph, the need to get the ptr for your methods to work, and
that you'd like to define this pointer transparently in all possible ways.
But this can bring unneeded 'complexity' (is this nmesh linked? is that
GetRaw'ed one single user (so linked)?).

It's important that we get out of these changes with a clear interface for
NMesh.  For example, this should start to work nicely:

ob = Object.New("Mesh")
me = NMesh.New("meshname")
ob.link(me)

just like with other modules.  And for vgrouping, for example, there would
be two clear code paths:

# 1) new mesh:
me = NMesh.New("meshname")
ob = Object.New("Mesh")
# [create the mesh data here, then]
ob.link(me) # can be done with PutRaw, of course
# now we have a pointer to an object, so from here we can play with vgroups

# 2) existing mesh:
ob = Object.Get("obname")
me = ob.getData()
# already linked, we're ready to work with vgroups

Again, we're still discussing, feel free to reply.

--
Willian, wgermano at ig.com.br




More information about the Bf-python mailing list