diff options
author | Joshua Leung <aligorith@gmail.com> | 2007-08-18 10:17:50 +0400 |
---|---|---|
committer | Joshua Leung <aligorith@gmail.com> | 2007-08-18 10:17:50 +0400 |
commit | 982d45162b5bf02127b16a9ede693bca99431427 (patch) | |
tree | 958adbe216df049c92269b731f552f0617bcbea0 /release/scripts/scripttemplate_pyconstraint.py | |
parent | 373ac35c71337cb45e3aaefd333c599b80fcf91e (diff) |
== PyConstraints ==
I've added the ability for PyConstraints to define a function (doDriver) that is able to directly modify values of the owner/target, so that certain setups can be created reliably. Users should take note that this is against the basic concept of what a constraint does, and that under no circumstances may they set the values of any variables controlling the transforms. For more details, check out the information in the PyConstraint template script.
I've also updated PyConstraints to be aware of geometry targets. The script template has been updated with this information.
Diffstat (limited to 'release/scripts/scripttemplate_pyconstraint.py')
-rw-r--r-- | release/scripts/scripttemplate_pyconstraint.py | 36 |
1 files changed, 34 insertions, 2 deletions
diff --git a/release/scripts/scripttemplate_pyconstraint.py b/release/scripts/scripttemplate_pyconstraint.py index 12bd4bcb73d..9ea00a2a2b1 100644 --- a/release/scripts/scripttemplate_pyconstraint.py +++ b/release/scripts/scripttemplate_pyconstraint.py @@ -16,8 +16,8 @@ script_data = \ PyConstraints are text buffers that start with #BPYCONSTRAINT. They must define a doConstraint function. The doConstraint -function is called with the world-space matrix of the parent object/posebone -as the first argument, the world-space matrix of the target object/posebone as +function is called with the matrix of the parent object/posebone +as the first argument, the matrix of the target object/posebone as the second, and an ID property that's attached to the current constraint instance. The function then must return a 4x4 Mathutils.Matrix() object. @@ -30,6 +30,13 @@ When a constraint needs to have a Target Object/Bone, the USE_TARGET line below must be present. Also, if any special matrix creation needs to be performed for the target, a doTarget function must also be defined. +Optionally, a doDriver function may be defined. This function is used +to get and/or modify settings of the owner and target, and as such, should +be used with caution. Under no circumstances, should you modify the transforms +of either the owner or the target in this function, as they will either have +no effect, or will result in other things not being updated correctly. Therefore, +it should be used sparringly. + <------- End removable description section -----------> """ # Add a licence here if you wish to re-distribute, we recommend the GPL @@ -64,12 +71,37 @@ def getSettings(idproperty): # this optional function performs special actions that only require # access to the target data - calculation of special information +# targetobject: (Object) wrapped data referring to the target object +# subtarget: (String/PoseChannel) +# - If the target is a PoseChannel in an armature, then this +# is a wrapped copy of that PoseChannel. +# - Otherwise, this field will either be an empty string or the +# name of the vertex group +# targetmatrix: (Matrix) matrix that will be used as the target matrix +# idprop: (IDProperties) wrapped data referring to this +# constraint instance's idproperties """ def doTarget (targetobject, subtarget, targetmatix, idproperty): # return a 4x4 matrix (which acts as the matrix of the target) return targetmatrix; """ +# This optional function is used to modify/get values on the owner and the +# target for creating certain setups. It should be used sparingly +# ownerobject: (Object) wrapped data referring to the owning object +# subowner: (PoseChannel) wrapped data referring to the PoseChannel that +# owns the constraint (where applicable) +# target: (Object) wrapped data referring to the target +# subtarget: (String/PoseChannel) +# - If the target is a PoseChannel in an armature, then this +# is a wrapped copy of that PoseChannel. +# - Otherwise, this field will either be an empty string or the +# name of the vertex group +""" +def doDriver (ownerobject, subowner, targetobject, subtarget, idproperty): + pass; +""" + ''' new_text = bpy.data.texts.new('pyconstraint_template.py') |