Example #1
0
def defaultTargetLicense():
    """
    Default license for targets, shared for all targets that do not specify
    their own custom license, which is useful for saving storage space as this
    license is globally referenced by and applies to the majority of targets.
    """
    import makehuman
    return makehuman.getAssetLicense( {"license": "AGPL3",
                                       "author": "MakeHuman",
                                       "copyright": "2016 Data Collection AB, Joel Palmius, Jonas Hauquier"} )
Example #2
0
def defaultTargetLicense():
    """
    Default license for targets, shared for all targets that do not specify
    their own custom license, which is useful for saving storage space as this
    license is globally referenced by and applies to the majority of targets.
    """
    import makehuman
    return makehuman.getAssetLicense( {"license": "AGPL3 (http://www.makehuman.org/doc/node/makehuman_mesh_license.html)",
                                       "author": "Manuel Bastioni",
                                       "copyright": "2014 Manuel Bastioni ([email protected])"} )
Example #3
0
    def __init__(self, file, type, human):
        log.debug("Loading proxy file: %s.", file)
        import makehuman

        name = os.path.splitext(os.path.basename(file))[0]
        self.name = name.capitalize().replace(" ", "_")
        self.license = makehuman.getAssetLicense()
        self.description = ""
        self.type = type
        self.object = None
        self.human = human
        if not human:
            raise RuntimeError(
                "Proxy constructor expects a valid human object.")
        self.file = file
        if file:
            self.mtime = os.path.getmtime(file)
        else:
            self.mtime = None
        self.uuid = None
        self.basemesh = makehuman.getBasemeshVersion()
        self.tags = []
        self.version = 110

        self.ref_vIdxs = None  # (Vidx1,Vidx2,Vidx3) list with references to human vertex indices, indexed by proxy vert
        self.weights = None  # (w1,w2,w3) list, with weights per human vertex (mapped by ref_vIdxs), indexed by proxy vert
        self.vertWeights = {
        }  # (proxy-vert, weight) list for each parent vert (reverse mapping of self.weights, indexed by human vertex)
        self.offsets = None  # (x,y,z) list of vertex offsets, indexed by proxy vert

        self.vertexBoneWeights = None  # Explicitly defined custom vertex-to-bone weights, connecting the proxy mesh to the reference skeleton (optional)
        # Not to be confused with the vertex weights assigned for mapping the proxy mesh geometry to the base mesh

        self.tmatrix = TMatrix(
        )  # Offset transformation matrix. Replaces scale

        self.z_depth = -1  # Render order depth for the proxy object. Also used to determine which proxy object should mask others (delete faces)
        self.max_pole = None  # Signifies the maximum number of faces per vertex on the mesh topology. Set to none for default.

        self.special_pose = {
        }  # Special poses that should be set on the human when this proxy is active to make it look good

        self.uvLayers = {}  # TODO what is this used for?

        self.material = material.Material(self.name)
        self._backUpMaterial = None

        self._obj_file = None
        self._vertexBoneWeights_file = None
        self._material_file = None

        self.deleteVerts = np.zeros(human.meshData.getVertexCount(), bool)

        self.weightsCache = None
        self.cacheSkel = None
Example #4
0
def defaultTargetLicense():
    """
    Default license for targets, shared for all targets that do not specify
    their own custom license, which is useful for saving storage space as this
    license is globally referenced by and applies to the majority of targets.
    """
    import makehuman
    return makehuman.getAssetLicense({
        "license":
        "AGPL3 (http://www.makehuman.org/doc/node/makehuman_mesh_license.html)",
        "author":
        "Manuel Bastioni",
        "copyright":
        "2014 Manuel Bastioni ([email protected])"
    })
Example #5
0
    def __init__(self, file, type, human):
        log.debug("Loading proxy file: %s.", file)
        import makehuman

        name = os.path.splitext(os.path.basename(file))[0]
        self.name = name.capitalize().replace(" ", "_")
        self.license = makehuman.getAssetLicense()
        self.description = ""
        self.type = type
        self.object = None
        self.human = human
        if not human:
            raise RuntimeError(
                "Proxy constructor expects a valid human object.")
        self.file = file
        if file:
            self.mtime = os.path.getmtime(file)
        else:
            self.mtime = None
        self.uuid = None
        self.basemesh = makehuman.getBasemeshVersion()
        self.tags = []
        self.version = 101

        self.ref_vIdxs = None  # (Vidx1,Vidx2,Vidx3) list with references to human vertex indices, indexed by proxy vert
        self.weights = None  # (w1,w2,w3) list, with weights per human vertex (mapped by ref_vIdxs), indexed by proxy vert
        self.vertWeights = {
        }  # (proxy-vert, weight) list for each parent vert (reverse mapping of self.weights, indexed by human vertex)
        self.offsets = None  # (x,y,z) list of vertex offsets, indexed by proxy vert

        self.vertexBoneWeights = None  # Explicitly defined custom vertex-to-bone weights, connecting the proxy mesh to the reference skeleton (optional)
        # Not to be confused with the vertex weights assigned for mapping the proxy mesh geometry to the base mesh

        self.tmatrix = TMatrix(
        )  # Offset transformation matrix. Replaces scale

        self.z_depth = -1  # Render order depth for the proxy object. Also used to determine which proxy object should mask others (delete faces)
        self.max_pole = None  # Signifies the maximum number of faces per vertex on the mesh topology. Set to none for default.

        self.uvLayers = {}  # TODO what is this used for?

        self.material = material.Material(self.name)

        self._obj_file = None
        self._vertexBoneWeights_file = None
        self._material_file = None

        self.deleteVerts = np.zeros(human.meshData.getVertexCount(), bool)
Example #6
0
        foundFiles.append(os.path.join(root, filename))
    return foundFiles


if __name__ == '__main__':
    obj = algos3d.Target(None, None)
    allFiles = getAllFiles('data', ['*.target', '*.png'])
    npzPath = 'data/targets.npz'
    with zipfile.ZipFile(npzPath, mode='w',
                         compression=zipfile.ZIP_DEFLATED) as zip:
        npzdir = os.path.dirname(npzPath)
        allTargets = allFiles[0]

        # License for all official MH targets
        lpath = 'data/targets/targets.license.npy'
        np.save(lpath, makehuman.getAssetLicense().toNumpyString())
        zip.write(lpath, os.path.relpath(lpath, npzdir))
        os.remove(lpath)

        for (i, path) in enumerate(allTargets):
            try:
                obj._load_text(path)
                iname, vname, lname = obj._save_binary(path)
                zip.write(iname, os.path.relpath(iname, npzdir))
                zip.write(vname, os.path.relpath(vname, npzdir))
                if lname:
                    zip.write(lname, os.path.relpath(lname, npzdir))
                    os.remove(lname)
                os.remove(iname)
                os.remove(vname)
                print "[%.0f%% done] converted target %s" % (
    for filename in fnmatch.filter(filenames, filterStr):
        foundFiles.append(os.path.join(root, filename))
    return foundFiles


if __name__ == '__main__':
    obj = algos3d.Target(None, None)
    allFiles = getAllFiles('data', ['*.target', '*.png'])
    npzPath = 'data/targets.npz'
    with zipfile.ZipFile(npzPath, mode='w', compression=zipfile.ZIP_DEFLATED) as zip:
        npzdir = os.path.dirname(npzPath)
        allTargets = allFiles[0]

        # License for all official MH targets
        lpath = 'data/targets/targets.license.npy'
        np.save(lpath, makehuman.getAssetLicense().toNumpyString())
        zip.write(lpath, os.path.relpath(lpath, npzdir))
        os.remove(lpath)

        for (i, path) in enumerate(allTargets):
            try:
                obj._load_text(path)
                iname, vname, lname = obj._save_binary(path)
                zip.write(iname, os.path.relpath(iname, npzdir))
                zip.write(vname, os.path.relpath(vname, npzdir))
                if lname:
                    zip.write(lname, os.path.relpath(lname, npzdir))
                    os.remove(lname)
                os.remove(iname)
                os.remove(vname)
                print "[%.0f%% done] converted target %s" % (100*(float(i)/float(len(allTargets))), path)