Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoshua Leung <aligorith@gmail.com>2007-10-22 03:00:29 +0400
committerJoshua Leung <aligorith@gmail.com>2007-10-22 03:00:29 +0400
commit6422a740c25d33c7e7dcc008d215ae983be00a30 (patch)
treedddeca774208da69659dfbc6f75616dcc6deadd7 /release/scripts/scripttemplate_pyconstraint.py
parenta4e8e87983829e05d33b2c5aa39f88ca24d48cdd (diff)
== Constraints System - Recode 2 ==
Once again, I've recoded the constraints system. This time, the goals were: * To make it more future-proof by 'modernising' the coding style. The long functions filled with switch statements, have given way to function-pointers with smaller functions for specific purposes. * To make it support constraints which use multiple targets more readily that it did. In the past, it was assumed that constraints could only have at most one target. As a result, a lot of code has been shuffled around, and modified. Also, the subversion number has been bumped up. Known issues: * PyConstraints, which were the main motivation for supporting multiple-targets, are currently broken. There are some bimport() error that keeps causing problems. I've also temporarily removed the doDriver support, although it may return in another form soon. * Constraints BPy-API is currently has a few features which currently don't work yet * Outliner currently only displays the names of the constraints instead of the fancy subtarget/target/constraint-name display it used to do. What gets displayed here needs further investigation, as the old way was certainly not that great (and is not compatible with the new system too)
Diffstat (limited to 'release/scripts/scripttemplate_pyconstraint.py')
-rw-r--r--release/scripts/scripttemplate_pyconstraint.py20
1 files changed, 12 insertions, 8 deletions
diff --git a/release/scripts/scripttemplate_pyconstraint.py b/release/scripts/scripttemplate_pyconstraint.py
index 8dcc04360d0..68aa9194435 100644
--- a/release/scripts/scripttemplate_pyconstraint.py
+++ b/release/scripts/scripttemplate_pyconstraint.py
@@ -21,17 +21,21 @@ from Blender import Draw
from Blender import Mathutils
import math
-USE_TARGET = True
+'''
+ This variable specifies the number of targets
+ that this constraint can use
+'''
+NUM_TARGETS = 1
'''
This function is called to evaluate the constraint
- obmatrix: (Matrix) copy of owner's worldspace matrix
- targetmatrix: (Matrix) copy of target's worldspace matrix (where applicable)
+ obmatrix: (Matrix) copy of owner's 'ownerspace' matrix
+ targetmatrices: (List) list of copies of the 'targetspace' matrices of the targets (where applicable)
idprop: (IDProperties) wrapped data referring to this
constraint instance's idproperties
'''
-def doConstraint(obmatrix, targetmatrix, idprop):
+def doConstraint(obmatrix, targetmatrices, idprop):
# Separate out the tranformation components for easy access.
obloc = obmatrix.translationPart() # Translation
obrot = obmatrix.toEuler() # Rotation
@@ -60,9 +64,9 @@ def doConstraint(obmatrix, targetmatrix, idprop):
'''
- This function manipulates the target matrix prior to sending it to doConstraint()
+ This function manipulates the matrix of a target prior to sending it to doConstraint()
target_object: wrapped data, representing the target object
- subtarget_bone: wrapped data, representing the subtarget pose-bone (where applicable)
+ subtarget_bone: wrapped data, representing the subtarget pose-bone/vertex-group (where applicable)
target_matrix: (Matrix) the transformation matrix of the target
id_properties_of_constraint: (IDProperties) wrapped idproperties
'''
@@ -72,8 +76,8 @@ def doTarget(target_object, subtarget_bone, target_matrix, id_properties_of_cons
'''
This function draws a pupblock that lets the user set
- the values of custom settings the constraint defines.
- This function is called when the user presses the settings button.
+ the values of custom settings the constraint defines.
+ This function is called when the user presses the settings button.
idprop: (IDProperties) wrapped data referring to this
constraint instance's idproperties
'''