def drawJointHelpers(self): """ Draw the joint helpers from the basemesh that define the default or reference rig. """ if self.jointsObj: self.removeObject(self.jointsObj) self.jointsObj = None self.jointsMesh = None self.selectedJoint = None jointPositions = [] # TODO maybe define a getter for this list in the skeleton module jointGroupNames = [group.name for group in self.human.meshData.faceGroups if group.name.startswith("joint-")] if self.human.getSkeleton(): jointGroupNames += self.human.getSkeleton().joint_pos_idxs.keys() for groupName in jointGroupNames: jointPositions.append(self.human.getSkeleton().getJointPosition(groupName, self.human)) else: for groupName in jointGroupNames: jointPositions.append(skeleton._getHumanJointPosition(self.human, groupName)) self.jointsMesh = skeleton_drawing.meshFromJoints(jointPositions, jointGroupNames) self.jointsMesh.priority = 100 self.jointsMesh.setPickable(False) self.jointsObj = self.addObject( gui3d.Object(self.jointsMesh, self.human.getPosition()) ) self.jointsObj.setRotation(self.human.getRotation()) color = np.asarray([255, 255, 0, 255], dtype=np.uint8) self.jointsMesh.color[:] = color[None,:] self.jointsMesh.markCoords(colr=True) self.jointsMesh.sync_color() mh.redraw()
def getJointPosition(self, jointName, rest_coord=True): """ Get the position of a joint from the human mesh. This position is determined by the center of the joint helper with the specified name. """ if self.getSkeleton(): return self.getSkeleton().getJointPosition(jointName, self, rest_coord) else: import skeleton return skeleton._getHumanJointPosition(self, jointName, rest_coord)