#BPYCONSTRAINT ''' tag bones with IDs for rigamarule ''' # -------------------------------------------------------------------------- # ***** BEGIN GPL LICENSE BLOCK ***** # # Script copyright (C) Bassam Kurdali # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software Foundation, # Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # # ***** END GPL LICENCE BLOCK ***** # -------------------------------------------------------------------------- # copyright 2009 Bassam Kurdali # thanks to Martin Poirier for code reviews, fixes and advice import Blender from Blender import Draw from Blender import Mathutils import math ''' This variable specifies the number of targets that this constraint can use ''' NUM_TARGETS = 0 ''' This function is called to evaluate the constraint 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, targetmatrices, idprop): # sorry, this one does nothing. return obmatrix ''' 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/vertex-group (where applicable) target_matrix: (Matrix) the transformation matrix of the target id_properties_of_constraint: (IDProperties) wrapped idproperties ''' def doTarget(target_object, subtarget_bone, target_matrix, id_properties_of_constraint): return target_matrix ''' 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. idprop: (IDProperties) wrapped data referring to this constraint instance's idproperties ''' def getSettings(idprop): # Define user-settable parameters. # Must also be defined in getSettings(). if not idprop.has_key('user_template'): idprop['user_template'] = "" if not idprop.has_key('user_uid'): idprop['user_uid'] = "" # create temporary vars for interface utemplate = Draw.Create(idprop['user_template']) uuid = Draw.Create(idprop['user_uid']) # define and draw pupblock block = [] block.append(("Template: ", utemplate, 2, 50, "Which template the bone belongs to")) block.append(("Bone ID: ", uuid, 2, 50, "Unique ID for each template bone")) retval = Draw.PupBlock("Constraint Template", block) # update id-property values after user changes settings if (retval): idprop['user_template']= utemplate.val idprop['user_uid']= uuid.val