[Bf-funboard] [Bf-python] Py Drivers - Possible feature enhancement.

Campbell Barton ideasman42 at gmail.com
Sun Nov 25 10:38:40 CET 2007


I think the point is being missed here,
@Joe, pyconstraints do have multiple target support, but drivers and
constraints cant be used in the same way - for instance, corrective
shape keys need to use drivers as I understand it.

@Martin, The problem is that even simple operations become very long
winded when you type them into drivers, because the syntax is so
verbose to reference the data you want to operate on, before any
python code happens.
The alternative is to have a pydriver.py that has some nice function
to do the lookup, like obBone('obnane', 'bonename') but that means
everyone who wants to do a simple operation with 2 bones for instance,
needs to go away and come up with their own set of macro's for
functions that blender could probably make easier.

An example is the distance between 2 bones, this was added as a hard
coded driver option, but could be a pydriver too.

this is how it would look now as a PyDriver

 (ob['someObject'].getPose().bones['someBone1'].loc -
ob['someObject'].getPose().bones['someBone2'].loc).length

If there was some way to use blenders interface to reference
objects/bones, it could look like this.
(var1.loc-var2.loc).length

This would also be faster, since
ob['someObject'].getPose().bones['someBone1'] creates 2 PyObjects we
dont need, and does 2 list searches every time, whereas blender would
store a pointer to the object.

On Nov 25, 2007 3:29 AM, Joe Eagar <joeedh at gmail.com> wrote:
> Why not just add support for pyconstraints to make use of multiple targets?
>
> Joe
>
>
> Campbell Barton wrote:
> > Cessen and I were talking about possible PyDriver enhancements, One
> > problem at the moment is the difficulty in referencing a bone or even
> > an object.
> > To reference a posebone for instance...
> >
> >  ob['someObject']
> >
> > Since cessen also does lots of rigging related stuff, to get a posebone...
> >
> >  ob['someObject'].getPose().bones['someBone']
> >
> > If you want 2 posebones, this gets really long to type in.
> >
> > One possible solution would be to have the driver object and bone
> > options (that are normally there) - also there with pydrivers. this
> > could be given a name like var1 for the pydrivers, this would need to
> > be clear from the interface.
> >
> > An issue is that you might want any number of objects/bones
> > references, at the moment the interface only allows for 1, maybe for
> > this we could have 2 object and bone inputs.
> >
> > Of course this would not change how existing scripts work, and you
> > could always refer to a 3rd item the existing way, this would just
> > allow referring to objects/bones much more easily, and using the
> > existing bone selection method.
> >
> > It also has the advantage that renaming an object wont mess up the
> > pyDriver since blender references the object (not its name)
> >
> > Any opinions on this?, Id like to try adding it.
>
> > _______________________________________________
> > Bf-python mailing list
> > Bf-python at blender.org
> > http://lists.blender.org/mailman/listinfo/bf-python
> >
> >
>
> _______________________________________________
> Bf-python mailing list
> Bf-python at blender.org
> http://lists.blender.org/mailman/listinfo/bf-python
>


More information about the Bf-funboard mailing list