Ejemplo n.º 1
0
    def __init__(self, file, type):
        log.debug("Loading proxy file: %s.", file)
        import makehuman

        name = os.path.splitext(os.path.basename(file))[0]
        self.name = name.capitalize().replace(" ","_")
        self.type = type
        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.vertWeights = {}       # (proxy-vert, weight) list for each parent vert
        self.refVerts = []

        self.scaleData = [None, None, None]
        self.scale = np.array((1.0,1.0,1.0), float)
        self.uniformScale = False
        self.scaleCorrect = 1.0

        self.z_depth = 50
        self.max_pole = None    # Signifies the maximum number of faces per vertex on the mesh topology. Set to none for default.
        self.cull = False

        self.uvLayers = {}

        self.useBaseMaterials = False
        self.rig = None
        self.mask = None

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

        self.obj_file = None
        self.vertexgroup_file = None
        self.vertexGroups = None
        self.material_file = None
        self.mhxMaterial_file = None
        self.maskLayer = -1
        self.textureLayer = 0
        self.objFileLayer = 0   # TODO what is this used for?
        self.texVertsLayers = {}
        self.texFacesLayers = {}

        self.deleteGroups = []
        self.deleteVerts = None

        self.wire = False
        self.cage = False
        self.modifiers = []
        self.shapekeys = []
        self.weights = None
        self.clothings = []
        self.transparencies = dict()
        return
Ejemplo n.º 2
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
Ejemplo n.º 3
0
 def getConverter(self):
     import makehuman
     if self.basemesh in ["alpha_7", "alpha7"]:
         global _A7converter
         if _A7converter is None:
             _A7converter = readProxyFile(G.app.selectedHuman.meshData, getpath.getSysDataPath("3dobjs/a7_converter.proxy"), type="Converter")
         log.debug("Converting %s with %s", self.name, _A7converter)
         return _A7converter
     elif self.basemesh == makehuman.getBasemeshVersion():
         return None
     else:
         raise NameError("Unknown basemesh for mhclo file: %s" % self.basemesh)
Ejemplo n.º 4
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)
Ejemplo n.º 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.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.num_refverts = None

        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.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 = {}

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

        self._obj_file = None
        self._vertexgroup_file = None    # TODO document, is this still used?
        self.vertexGroups = None
        self._material_file = None

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

        # TODO are these still used?
        self.wire = False
        self.cage = False
        self.modifiers = []
        self.shapekeys = []
Ejemplo n.º 6
0
    def __init__(self, name, options):
        self.name = name
        self.options = options
        self.parser = None
        self.origin = None
        self.roots = []
        self.bones = OrderedDict()
        self.hierarchy = []
        self.locale = None
        self._tposes = None

        self.objectProps = [
            ("MhVersion", '"%s"' % makehuman.getVersionStr().replace(" ","_")),
            ("MhBaseMesh", '"%s"' % makehuman.getBasemeshVersion().replace(" ","_")),
            ]
        self.armatureProps = [('MhxScale', options.scale)]

        self.done = False

        self.vertexWeights = OrderedDict([])
        self.isNormalized = False