def getVertexWeights(self, referenceWeights=None): """ Get the vertex weights of this skeleton. If this is called for the first time, and referenceWeights is specified (weight of the mh reference rig), and the weights for this skeleton were not explicitly defined, the weights will be initialized as a remapping of the reference weights through specified reference bones. Returns the vertex weights for this skeleton. """ from collections import OrderedDict if referenceWeights is None: return self.vertexWeights # Remap vertex weights from reference bones weights = OrderedDict() for bone in self.getBones(): b_weights = [] if len(bone.weight_reference_bones) > 0: for rbname in bone.weight_reference_bones: if rbname in referenceWeights.data: vrts,wghs = referenceWeights.data[rbname] b_weights.extend( zip(vrts,wghs) ) else: if not makehuman.isRelease(): log.warning("Reference bone %s is not present in reference weights", rbname) else: # Try to map by bone name if bone.name in referenceWeights.data: # Implicitly map bone by name to reference skeleton weights vrts,wghs = referenceWeights.data[bone.name] b_weights = zip(vrts,wghs) else: if not makehuman.isRelease(): log.warning("No explicit reference bone mapping for bone %s, and cannot implicitly map by name", bone.name) if len(b_weights) > 0: weights[bone.name] = b_weights vertWeights = referenceWeights.create(weights, vertexCount=referenceWeights.vertexCount, rootBone=self.roots[0].name) if self.vertexWeights is None: self.vertexWeights = vertWeights return vertWeights
def __init__(self): self.currentShortCommit = "UNKNOWN" self.currentLongCommit = "UNKNOWN" self.currentBranch = "UNKNOWN" self.title = "MakeHuman Community" self.version = makehuman.getVersionDigitsStr() self.isRelease = makehuman.isRelease() self.fullTitle = None self._checkForGitInfo() self._checkForVersionFile() if self.fullTitle is None: if self.isRelease: self.fullTitle = self.title + " " + self.version else: self.fullTitle = self.title + " (" + self.currentBranch + ":" + self.currentShortCommit + ")"
def skinMesh(self, meshCoords, vertBoneMapping): """ Update (pose) assigned mesh using linear blend skinning. """ nVerts = len(meshCoords) coords = np.zeros((nVerts,3), float) if meshCoords.shape[1] != 4: meshCoords_ = np.ones((nVerts, 4), dtype=np.float32) # TODO also allow skinning vectors (normals)? -- in this case you need to renormalize normals, unless you only multiply each normal with the transformation with largest weight meshCoords_[:,:3] = meshCoords meshCoords = meshCoords_ log.debug("Unoptimized data structure passed to skinMesh, this will incur performance penalty when used for animation.") for bname, mapping in vertBoneMapping.items(): try: verts,weights = mapping bone = self.getBone(bname) vec = np.dot(bone.matPoseVerts, meshCoords[verts].transpose()) vec *= weights coords[verts] += vec.transpose()[:,:3] except KeyError as e: if not makehuman.isRelease(): log.warning("Could not skin bone %s: no such bone in skeleton (%s)" % (bname, e)) return coords
def isRelease(self): if self.IS_RELEASE is not None: return self.IS_RELEASE import makehuman return makehuman.isRelease()
exit(1) if not os.path.exists(rsync): print "Rsync is not installed." exit(1) debdir = os.path.dirname(os.path.abspath(__file__)) scriptdir = os.path.abspath( os.path.join(debdir,'..') ) print "Makehuman directory: " + scriptdir print "Destination directory: " + destdir sys.path = sys.path + [scriptdir, os.path.join(scriptdir, 'lib')] import makehuman if not makehuman.isRelease(): package_name = package_name + 'svn' target = os.path.join(destdir,"debroot") if not os.path.exists(target): os.mkdir(target) controldir = os.path.join(target,"DEBIAN") if not os.path.exists(controldir): os.mkdir(controldir) print "Control directory: " + controldir srccontrol = os.path.join(debdir,"debian"); if not os.path.exists(srccontrol):