コード例 #1
0
    def loadHandler(self, human, values, strict):
        if values[0] == 'status':
            return

        if values[0] == 'skinMaterial':
            path = values[1]
            if os.path.isfile(path):
                mat = material.fromFile(path)
                human.material = mat
                return
            else:
                absP = getpath.thoroughFindFile(path)
                if not os.path.isfile(absP):
                    if strict:
                        raise RuntimeError(
                            'Could not find material %s for skinMaterial parameter.'
                            % values[1])
                    log.warning(
                        'Could not find material %s for skinMaterial parameter.',
                        values[1])
                    return
                mat = material.fromFile(absP)
                human.material = mat
                return
        elif values[0] == 'material':
            if len(values) == 3:
                uuid = values[1]
                filepath = values[2]
                name = ""
            else:
                name = values[1]
                uuid = values[2]
                filepath = values[3]

            if human.hairProxy and human.hairProxy.getUuid() == uuid:
                proxy = human.hairProxy
                filepath = self.getMaterialPath(filepath, proxy.file)
                proxy.object.material = material.fromFile(filepath)
                return
            elif human.eyesProxy and human.eyesProxy.getUuid() == uuid:
                proxy = human.eyesProxy
                filepath = self.getMaterialPath(filepath, proxy.file)
                proxy.object.material = material.fromFile(filepath)
                return
            elif not uuid in human.clothesProxies.keys():
                if strict:
                    raise RuntimeError(
                        "Could not load material for proxy with uuid %s (%s)! No such proxy."
                        % (uuid, name))
                log.error(
                    "Could not load material for proxy with uuid %s (%s)! No such proxy.",
                    uuid, name)
                return

            proxy = human.clothesProxies[uuid]
            proxy = human.clothesProxies[uuid]
            filepath = self.getMaterialPath(filepath, proxy.file)
            self.applyClothesMaterial(uuid, filepath)
            return
コード例 #2
0
    def loadHandler(self, human, values):
        if values[0] == 'status':
            return

        if values[0] == 'skinMaterial':
            path = values[1]
            if os.path.isfile(path):
                mat = material.fromFile(path)
                human.material = mat
                return
            else:
                absP = getpath.findFile(
                    path, [mh.getPath('data'),
                           mh.getSysDataPath()])
                if not os.path.isfile(absP):
                    log.warning(
                        'Could not find material %s for skinMaterial parameter.',
                        values[1])
                    return
                mat = material.fromFile(absP)
                human.material = mat
                return
        elif values[0] == 'material':
            if len(values) == 3:
                uuid = values[1]
                filepath = values[2]
                name = ""
            else:
                name = values[1]
                uuid = values[2]
                filepath = values[3]

            if human.hairProxy and human.hairProxy.getUuid() == uuid:
                proxy = human.hairProxy
                filepath = self.getMaterialPath(filepath, proxy.file)
                human.hairObj.material = material.fromFile(filepath)
                return
            elif human.eyesProxy and human.eyesProxy.getUuid() == uuid:
                proxy = human.eyesProxy
                filepath = self.getMaterialPath(filepath, proxy.file)
                human.eyesObj.material = material.fromFile(filepath)
                return
            elif human.genitalsProxy and human.genitalsProxy.getUuid() == uuid:
                proxy = human.genitalsProxy
                filepath = self.getMaterialPath(filepath, proxy.file)
                human.genitalsObj.material = material.fromFile(filepath)
                return
            elif not uuid in human.clothesProxies.keys():
                log.error(
                    "Could not load material for proxy with uuid %s (%s)! No such proxy."
                    % (uuid, name))
                return

            proxy = human.clothesProxies[uuid]
            proxy = human.clothesProxies[uuid]
            filepath = self.getMaterialPath(filepath, proxy.file)
            self.applyClothesMaterial(uuid, filepath)
            return
コード例 #3
0
    def loadHandler(self, human, values):
        if values[0] == 'status':
            return

        if values[0] == 'skinMaterial':
            path = values[1]
            if os.path.isfile(path):
                mat = material.fromFile(path)
                human.material = mat
                return
            else:
                absP = getpath.findFile(path, [mh.getPath('data'), mh.getSysDataPath()])
                if not os.path.isfile(absP):
                    log.warning('Could not find material %s for skinMaterial parameter.', values[1])
                    return
                mat = material.fromFile(absP)
                human.material = mat
                return
        elif values[0] == 'material':
            if len(values) == 3:
                uuid = values[1]
                filepath = values[2]
                name = ""
            else:
                name = values[1]
                uuid = values[2]
                filepath = values[3]

            if human.hairProxy and human.hairProxy.getUuid() == uuid:
                proxy = human.hairProxy
                filepath = self.getMaterialPath(filepath, proxy.file)
                proxy.object.material = material.fromFile(filepath)
                return
            elif human.eyesProxy and human.eyesProxy.getUuid() == uuid:
                proxy = human.eyesProxy
                filepath = self.getMaterialPath(filepath, proxy.file)
                proxy.object.material = material.fromFile(filepath)
                return
            elif human.genitalsProxy and human.genitalsProxy.getUuid() == uuid:
                proxy = human.genitalsProxy
                filepath = self.getMaterialPath(filepath, proxy.file)
                proxy.object.material = material.fromFile(filepath)
                return
            elif not uuid in human.clothesProxies.keys():
                log.error("Could not load material for proxy with uuid %s (%s)! No such proxy." % (uuid, name))
                return

            proxy = human.clothesProxies[uuid]
            proxy = human.clothesProxies[uuid]
            filepath = self.getMaterialPath(filepath, proxy.file)
            self.applyClothesMaterial(uuid, filepath)
            return
コード例 #4
0
ファイル: skeletonlibrary.py プロジェクト: kingomyths/mhx_os
    def onShow(self, event):
        gui3d.TaskView.onShow(self, event)
        if gui3d.app.settings.get('cameraAutoZoom', True):
            gui3d.app.setGlobalCamera()

        # Disable smoothing in skeleton library
        self.oldSmoothValue = self.human.isSubdivided()
        self.human.setSubdivided(False)

        self.oldHumanMat = self.human.material.clone()
        self.oldPxyMats = dict()
        xray_mat = material.fromFile(mh.getSysDataPath('materials/xray.mhmat'))
        self.human.material = xray_mat
        for pxy in self.human.getProxies(includeHumanProxy=False):
            obj = pxy.object
            self.oldPxyMats[pxy.uuid] = obj.material.clone()
            obj.material = xray_mat

        if self.skelObj:
            self.skelObj.show()

        #if not self.jointsObj:
        #    self.drawJointHelpers()

        #self.filechooser.refresh()

        # Make sure skeleton is updated when human has changed
        self.human.getSkeleton()

        # Re-draw joints positions if human has changed
        if self.humanChanged:
            #self.drawJointHelpers()
            self.humanChanged = False
        mh.redraw()
コード例 #5
0
        def onFileSelected(filename):
            mat = material.fromFile(filename)
            human = self.human

            obj = self.humanObjSelector.getSelectedObject()
            if obj:
                gui3d.app.do(MaterialAction(obj, mat))
コード例 #6
0
        def onFileSelected(filename):
            mat = material.fromFile(filename)
            human = self.human

            obj = self.humanObjSelector.getSelectedObject()
            if obj:
                gui3d.app.do(MaterialAction(obj, mat))
コード例 #7
0
    def __init__(self, mesh, hairObj=None, eyesObj=None, genitalsObj=None):

        guicommon.Object.__init__(self, mesh)

        self.hasWarpTargets = False

        self.MIN_AGE = 1.0
        self.MAX_AGE = 90.0
        self.MID_AGE = 25.0

        self.mesh.setCameraProjection(0)
        self.mesh.setPickable(True)
        self.mesh.setShadeless(0)
        self.mesh.setCull(1)
        self.meshData = self.mesh

        self._staticFaceMask = None
        self.maskFaces()

        self._hairObj = hairObj
        self._hairProxy = None
        self._eyesObj = eyesObj
        self._eyesProxy = None
        self._genitalsObj = genitalsObj
        self._genitalsProxy = None
        self.eyebrowsObj = None
        self.eyebrowsProxy = None
        self.eyelashesObj = None
        self.eyelashesProxy = None
        self.teethObj = None
        self.teethProxy = None
        self.tongueObj = None
        self.tongueProxy = None

        self.clothesObjs = {}
        self.clothesProxies = {}

        self.targetsDetailStack = {
        }  # All details targets applied, with their values
        self.symmetryModeEnabled = False

        self.setDefaultValues()

        self.bodyZones = [
            'l-eye', 'r-eye', 'jaw', 'nose', 'mouth', 'head', 'neck', 'torso',
            'hip', 'pelvis', 'r-upperarm', 'l-upperarm', 'r-lowerarm',
            'l-lowerarm', 'l-hand', 'r-hand', 'r-upperleg', 'l-upperleg',
            'r-lowerleg', 'l-lowerleg', 'l-foot', 'r-foot', 'ear'
        ]

        self.material = material.fromFile(
            getSysDataPath('skins/default.mhmat'))
        self._defaultMaterial = material.Material().copyFrom(self.material)

        self._modifiers = dict()
        self._modifier_varMapping = dict(
        )  # Maps macro variable to the modifier group that modifies it
        self._modifier_dependencyMapping = dict(
        )  # Maps a macro variable to all the modifiers that depend on it
        self._modifier_groups = dict()
コード例 #8
0
    def onShow(self, event):
        gui3d.TaskView.onShow(self, event)
        if gui3d.app.settings.get('cameraAutoZoom', True):
            gui3d.app.setGlobalCamera()

        # Disable smoothing in skeleton library
        self.oldSmoothValue = self.human.isSubdivided()
        self.human.setSubdivided(False)

        self.oldHumanMat = self.human.material.clone()
        self.oldPxyMats = dict()
        xray_mat = material.fromFile(mh.getSysDataPath('materials/xray.mhmat'))
        self.human.material = xray_mat
        for pxy, obj in self.human.getProxiesAndObjects():
            self.oldPxyMats[pxy.uuid] = obj.material.clone()
            obj.material = xray_mat

        if self.skelObj:
            self.skelObj.show()

        #if not self.jointsObj:
        #    self.drawJointHelpers()

        #self.filechooser.refresh()

        # Make sure skeleton is updated when human has changed
        self.human.getSkeleton()

        # Re-draw joints positions if human has changed
        if self.humanChanged:
            #self.drawJointHelpers()
            self.humanChanged = False
        mh.redraw()
コード例 #9
0
 def applyClothesMaterial(self, uuid, filename):
     human = self.human
     if uuid not in list(human.clothesProxies.keys()):
         log.warning("Cannot set material for clothes with UUID %s, no such item", uuid)
         return False
     clo = human.clothesProxies[uuid].object
     clo.material = material.fromFile(filename)
     return True
コード例 #10
0
 def applyClothesMaterial(self, uuid, filename):
     human = self.human
     if uuid not in human.clothesProxies.keys():
         log.warning("Cannot set material for clothes with UUID %s, no such item", uuid)
         return False
     clo = human.clothesProxies[uuid].object
     clo.material = material.fromFile(filename)
     return True
コード例 #11
0
 def applyClothesMaterial(self, uuid, filename):
     human = gui3d.app.selectedHuman
     if uuid not in list(human.clothesObjs.keys()):
         log.warning("Cannot set material for clothes with UUID %s, no such item", uuid)
         return False
     clo = human.clothesObjs[uuid]
     clo.mesh.material = material.fromFile(filename)
     return True
コード例 #12
0
    def loadHandler(self, human, values):

        if values[0] == 'skinMaterial':
            path = values[1]
            if os.path.isfile(path):
                mat = material.fromFile(path)
                self.human.material = mat
                return
            else:
                for d in [self.systemSkins, self.userSkins]:
                    absP = os.path.join(d, path)
                    if os.path.isfile(absP):
                        mat = material.fromFile(path)
                        self.human.material = mat
                        return
            log.warning('Could not find material %s for skinMaterial parameter.', values[1])
        elif values[0] == 'materials':
            uuid = values[1]
            filepath = values[2]

            if human.hairProxy and human.hairProxy.getUuid() == uuid:
                if not os.path.dirname(filepath):
                    proxy = human.hairProxy
                    hairPath = os.path.dirname(proxy.file)
                    filepath = os.path.join(hairPath, filepath)
                human.hairObj.material = material.fromFile(filepath)
                return
            elif human.eyesProxy and human.eyesProxy.getUuid() == uuid:
                if not os.path.dirname(filepath):
                    proxy = human.eyesProxy
                    eyesPath = os.path.dirname(proxy.file)
                    filepath = os.path.join(eyesPath, filepath)
                human.eyesObj.material = material.fromFile(filepath)
                return
            elif not uuid in list(human.clothesProxies.keys()):
                log.error("Could not load material for object with uuid %s!" % uuid)
                return

            proxy = human.clothesProxies[uuid]
            if not os.path.dirname(filepath):
                proxy = human.clothesProxies[uuid]
                clothesPath = os.path.dirname(proxy.file)
                filepath = os.path.join(clothesPath, filepath)
            self.applyClothesMaterial(uuid, filepath)
            return
コード例 #13
0
ファイル: filechooser.py プロジェクト: ihavenick/MakeHuman
 def getPreview(self, filename):
     thumb = super(MhmatFileLoader, self).getPreview(filename)
     print(("%s == %s" % (os.path.abspath(thumb), os.path.abspath(self.fileChooser.notFoundImage))))
     if os.path.abspath(thumb) == os.path.abspath(self.fileChooser.notFoundImage):
         import material
         mat = material.fromFile(filename)
         if mat.diffuseTexture:
             return mat.diffuseTexture
     return thumb
コード例 #14
0
ファイル: filechooser.py プロジェクト: TeoTwawki/makehuman
 def getPreview(self, filename):
     # TODO this makes filechooser loading quite slow for materials without a thumbnail, but it does provide a preview
     thumb = super(MhmatFileLoader, self).getPreview(filename)
     if getpath.canonicalPath(thumb) == getpath.canonicalPath(self.fileChooser.notFoundImage):
         import material
         mat = material.fromFile(filename)
         if mat.diffuseTexture:
             return mat.diffuseTexture
     return thumb
コード例 #15
0
 def getPreview(self, filename):
     # TODO this makes filechooser loading quite slow for materials without a thumbnail, but it does provide a preview
     thumb = super(MhmatFileLoader, self).getPreview(filename)
     if getpath.canonicalPath(thumb) == getpath.canonicalPath(self.fileChooser.notFoundImage):
         import material
         mat = material.fromFile(filename)
         if mat.diffuseTexture:
             return mat.diffuseTexture
     return thumb
コード例 #16
0
 def applyClothesMaterial(self, uuid, filename):
     human = self.human
     if uuid not in human.clothesObjs.keys():
         log.warning(
             "Cannot set material for clothes with UUID %s, no such item",
             uuid)
         return False
     clo = human.clothesObjs[uuid]
     clo.mesh.material = material.fromFile(filename)
     return True
コード例 #17
0
def applyMaterial(matFile, obj):
    if not os.path.isfile(matFile):
        matFile = getpath.findFile(matFile, 
                                   searchPaths = [getpath.getDataPath(), 
                                                  getpath.getSysDataPath(),
                                                  getpath.getPath(),
                                                  getpath.getSysPath()])
    if not os.path.isfile(matFile):
        raise RuntimeError('Material file "%s" does not exist.', matFile)
    else:
        import material
        obj.material = material.fromFile( matFile )
コード例 #18
0
 def visualizeFaceMasks(self, enabled):
     import material
     import getpath
     if enabled:
         self.oldPxyMats = dict()
         xray_mat = material.fromFile(getpath.getSysDataPath('materials/xray.mhmat'))
         for pxy in self.human.getProxies(includeHumanProxy=False):
             self.oldPxyMats[pxy.uuid] = pxy.object.material.clone()
             pxy.object.material = xray_mat
     else:
         for pxy in self.human.getProxies(includeHumanProxy=False):
             if pxy.uuid in self.oldPxyMats:
                 pxy.object.material = self.oldPxyMats[pxy.uuid]
コード例 #19
0
def mh_skin(request):
    human = G.app.selectedHuman
    import material
    import os
    skin = 'data/skins/default.mhmat'
    for root, dirs, files in os.walk("data/skins"):
        for file_ in files:
            if (file_ == request+'.mhmat'):
                skin = os.path.join(root, file_)
                print skin
    try:
        human.setMaterial(material.fromFile(skin))
    except KeyError:
        return str(human.getMaterial())
コード例 #20
0
def applyMaterial(matFile, obj):
    if not os.path.isfile(matFile):
        matFile = getpath.findFile(matFile,
                                   searchPaths=[
                                       getpath.getDataPath(),
                                       getpath.getSysDataPath(),
                                       getpath.getPath(),
                                       getpath.getSysPath()
                                   ])
    if not os.path.isfile(matFile):
        raise RuntimeError('Material file "%s" does not exist.', matFile)
    else:
        import material
        obj.material = material.fromFile(matFile)
コード例 #21
0
 def visualizeFaceMasks(self, enabled):
     import material
     import getpath
     if enabled:
         self.oldPxyMats = dict()
         xray_mat = material.fromFile(
             getpath.getSysDataPath('materials/xray.mhmat'))
         for pxy in self.human.getProxies(includeHumanProxy=False):
             self.oldPxyMats[pxy.uuid] = pxy.object.material.clone()
             pxy.object.material = xray_mat
     else:
         for pxy in self.human.getProxies(includeHumanProxy=False):
             if pxy.uuid in self.oldPxyMats:
                 pxy.object.material = self.oldPxyMats[pxy.uuid]
コード例 #22
0
    def onShow(self, event):
        self.filechooser.refresh()
        self.filechooser.selectItem(self.currentPose)
        self.drawSkeleton(self.human.getSkeleton())
        self.human.refreshPose()

        # Set X-ray material
        self.oldHumanMat = self.human.material.clone()
        self.oldPxyMats = dict()
        xray_mat = material.fromFile(mh.getSysDataPath('materials/xray.mhmat'))
        self.human.material = xray_mat
        for pxy in self.human.getProxies(includeHumanProxy=False):
            obj = pxy.object
            self.oldPxyMats[pxy.uuid] = obj.material.clone()
            obj.material = xray_mat
        mh.redraw()
コード例 #23
0
    def _findSkinForEthnicityAndGender(self, ethnicity, gender):

        skinHash = None
        if gender == "female":
            category = "allowedFemaleSkins"
        else:
            category = "allowedMaleSkins"

        matchingSkins = []
        for name in self.settings.getNames(category):
            skin = self.settings.getValueHash(category, name)
            if skin[ethnicity]:
                matchingSkins.append(skin["fullPath"])

        pick = random.randrange(len(matchingSkins))
        self.skin = material.fromFile(matchingSkins[pick])
コード例 #24
0
    def onShow(self, event):
        self.filechooser.refresh()
        self.filechooser.selectItem(self.currentPose)
        self.drawSkeleton(self.human.getSkeleton())
        self.human.refreshPose()

        # Set X-ray material
        self.oldHumanMat = self.human.material.clone()
        self.oldPxyMats = dict()
        xray_mat = material.fromFile(mh.getSysDataPath('materials/xray.mhmat'))
        self.human.material = xray_mat
        for pxy in self.human.getProxies(includeHumanProxy=False):
            obj = pxy.object
            self.oldPxyMats[pxy.uuid] = obj.material.clone()
            obj.material = xray_mat
        mh.redraw()
コード例 #25
0
 def onFileSelected(filename):
     mat = material.fromFile(filename)
     human = gui3d.app.selectedHuman
     if self.skinRadio.selected:
         gui3d.app.do(MaterialAction(human,
             mat))
     elif self.hairRadio.selected:
         gui3d.app.do(MaterialAction(human.hairObj,
             mat))
     elif self.eyesRadio.selected:
         gui3d.app.do(MaterialAction(human.eyesObj,
             mat))
     else: # Clothes
         if self.activeClothing:
             uuid = self.activeClothing
             gui3d.app.do(MaterialAction(human.clothesObjs[uuid],
                 mat))
 def visualizeFaceMasks(self, enabled):
     import material
     import getpath
     if enabled:
         self.oldPxyMats = dict()
         xray_mat = material.fromFile(getpath.getSysDataPath('materials/xray.mhmat'))
         for pxy in self.human.getProxies(includeHumanProxy=False):
             print pxy.type
             if pxy.type == 'Eyes':
                 # Don't X-ray the eyes, it looks weird
                 continue
             self.oldPxyMats[pxy.uuid] = pxy.object.material.clone()
             pxy.object.material = xray_mat
     else:
         for pxy in self.human.getProxies(includeHumanProxy=False):
             if pxy.uuid in self.oldPxyMats:
                 pxy.object.material = self.oldPxyMats[pxy.uuid]
コード例 #27
0
ファイル: debugtab.py プロジェクト: yazici/3D-human-Keras
    def onShow(self, event):
        gui3d.TaskView.onShow(self, event)

        self.drawSkeleton()

        # Set X-ray material
        if self.xray_mat is None:
            self.xray_mat = material.fromFile(mh.getSysDataPath('materials/xray.mhmat'))
            self.xray_mat.setShaderParameter('edgefalloff', 5)
            self.xray_mat.configureShading(vertexColors=True)
        self.oldHumanMat = self.human.material.clone()
        self.oldPxyMats = dict()
        self.human.material = self.xray_mat
        for pxy in self.human.getProxies(includeHumanProxy=False):
            obj = pxy.object
            self.oldPxyMats[pxy.uuid] = obj.material.clone()
            obj.material = self.xray_mat
コード例 #28
0
 def visualizeFaceMasks(self, enabled):
     import material
     import getpath
     if enabled:
         self.oldPxyMats = dict()
         xray_mat = material.fromFile(getpath.getSysDataPath('materials/xray.mhmat'))
         for pxy in self.human.getProxies(includeHumanProxy=False):
             print(pxy.type)
             if pxy.type == 'Eyes':
                 # Don't X-ray the eyes, it looks weird
                 continue
             self.oldPxyMats[pxy.uuid] = pxy.object.material.clone()
             pxy.object.material = xray_mat
     else:
         for pxy in self.human.getProxies(includeHumanProxy=False):
             if pxy.uuid in self.oldPxyMats:
                 pxy.object.material = self.oldPxyMats[pxy.uuid]
コード例 #29
0
    def onShow(self, event):
        gui3d.TaskView.onShow(self, event)

        self.drawSkeleton()

        # Set X-ray material
        if self.xray_mat is None:
            self.xray_mat = material.fromFile(mh.getSysDataPath('materials/xray.mhmat'))
            self.xray_mat.setShaderParameter('edgefalloff', 5)
            self.xray_mat.configureShading(vertexColors=True)
        self.oldHumanMat = self.human.material.clone()
        self.oldPxyMats = dict()
        self.human.material = self.xray_mat
        for pxy in self.human.getProxies(includeHumanProxy=False):
            obj = pxy.object
            self.oldPxyMats[pxy.uuid] = obj.material.clone()
            obj.material = self.xray_mat
コード例 #30
0
ファイル: human.py プロジェクト: kingomyths/mhx_os
    def __init__(self, mesh):

        guicommon.Object.__init__(self, mesh)

        self.hasWarpTargets = False

        self.MIN_AGE = 1.0
        self.MAX_AGE = 90.0
        self.MID_AGE = 25.0

        self.mesh.setCameraProjection(0)
        self.mesh.setPickable(True)
        self.setShadeless(0)
        self.setCull(1)
        self.meshData = self.mesh

        self.maskFaces()

        self._hairProxy = None
        self._eyesProxy = None
        self._genitalsProxy = None
        self.eyebrowsProxy = None
        self.eyelashesProxy = None
        self.teethProxy = None
        self.tongueProxy = None

        self.clothesProxies = {}

        self.targetsDetailStack = {}  # All details targets applied, with their values
        self.symmetryModeEnabled = False

        self.setDefaultValues()

        self.bodyZones = ['l-eye','r-eye', 'jaw', 'nose', 'mouth', 'head', 'neck', 'torso', 'hip', 'pelvis', 'r-upperarm', 'l-upperarm', 'r-lowerarm', 'l-lowerarm', 'l-hand',
                          'r-hand', 'r-upperleg', 'l-upperleg', 'r-lowerleg', 'l-lowerleg', 'l-foot', 'r-foot', 'ear']

        self.material = material.fromFile(getSysDataPath('skins/default.mhmat'))
        self._defaultMaterial = material.Material().copyFrom(self.material)

        self._modifiers = dict()
        self._modifier_varMapping = dict()              # Maps macro variable to the modifier group that modifies it
        self._modifier_dependencyMapping = dict()       # Maps a macro variable to all the modifiers that depend on it
        self._modifier_groups = dict()
        self._modifier_type_cache = dict()

        self.blockEthnicUpdates = False                 # When set to True, changes to race are not normalized automatically
コード例 #31
0
ファイル: human.py プロジェクト: solsane/unnaturalcode
    def __init__(self, mesh):
        guicommon.Object.__init__(self, mesh)

        self.hasWarpTargets = False

        self.MIN_AGE = 1.0
        self.MAX_AGE = 90.0
        self.MID_AGE = 25.0

        self.mesh.setCameraProjection(0)
        self.mesh.setPickable(True)
        self.setShadeless(0)
        self.setCull(1)
        self.meshData = self.mesh

        self.maskFaces()

        self._resetProxies()

        self.targetsDetailStack = {}  # All details targets applied, with their values
        self.symmetryModeEnabled = False

        self.setDefaultValues()

        self.bodyZones = ['l-eye','r-eye', 'jaw', 'nose', 'mouth', 'head', 'neck', 'torso', 'hip', 'pelvis', 'r-upperarm', 'l-upperarm', 'r-lowerarm', 'l-lowerarm', 'l-hand',
                          'r-hand', 'r-upperleg', 'l-upperleg', 'r-lowerleg', 'l-lowerleg', 'l-foot', 'r-foot', 'ear']

        self.material = material.fromFile(getSysDataPath('skins/default.mhmat'))
        self._defaultMaterial = material.Material().copyFrom(self.material)

        self._modifiers = dict()
        self._modifier_varMapping = dict()              # Maps macro variable to the modifier group that modifies it
        self._modifier_dependencyMapping = dict()       # Maps a macro variable to all the modifiers that depend on it
        self._modifier_groups = dict()
        self._modifier_type_cache = dict()

        self.blockEthnicUpdates = False                 # When set to True, changes to race are not normalized automatically

        animation.AnimatedMesh.__init__(self, skel=None, mesh=self.meshData, vertexToBoneMapping=None)
        # Make sure that shadow vertices are copied
        self.refreshStaticMeshes()
コード例 #32
0
ファイル: human.py プロジェクト: ihavenick/MakeHuman
    def __init__(self, mesh, hairObj=None, eyesObj=None):

        gui3d.Object.__init__(self, [0, 0, 0], mesh, True)

        self.MIN_AGE = 1.0
        self.MAX_AGE = 90.0
        self.MID_AGE = 25.0

        self.mesh.setCameraProjection(0)
        self.mesh.setShadeless(0)
        self.mesh.setCull(1)
        self.meshData = self.mesh

        self.maskFaces()

        self.hairModelling = False #temporary variable for easier integration of makehair, will be cleaned later.
        self.hairObj = hairObj
        self.hairProxy = None
        self.eyesObj = eyesObj
        self.eyesProxy = None
        self.clothesObjs = {}
        self.clothesProxies = {}
        self.activeClothing = None
        self.targetsDetailStack = {}  # All details targets applied, with their values
        self.symmetryModeEnabled = False

        self.enableUVInterpolation = 0
        self.targetUVBuffer = {}

        self.uvset = None

        self.meshStored = []
        self.meshStoredNormals = []

        self.setDefaultValues()

        self.bodyZones = ['l-eye','r-eye', 'jaw', 'nose', 'mouth', 'head', 'neck', 'torso', 'hip', 'pelvis', 'r-upperarm', 'l-upperarm', 'r-lowerarm', 'l-lowerarm', 'l-hand',
                          'r-hand', 'r-upperleg', 'l-upperleg', 'r-lowerleg', 'l-lowerleg', 'l-foot', 'r-foot', 'ear']

        self.material = material.fromFile(mh.getSysDataPath('skins/default.mhmat'))
        self._defaultMaterial = material.Material().copyFrom(self.material)
コード例 #33
0
    def onShow(self, event):
        gui3d.TaskView.onShow(self, event)
        if gui3d.app.settings.get('cameraAutoZoom', True):
            gui3d.app.setGlobalCamera()

        # Set X-ray material
        if self.xray_mat is None:
            self.xray_mat = material.fromFile(mh.getSysDataPath('materials/xray.mhmat'))
        self.oldHumanMat = self.human.material.clone()
        self.oldPxyMats = dict()
        self.human.material = self.xray_mat
        for pxy in self.human.getProxies(includeHumanProxy=False):
            obj = pxy.object
            self.oldPxyMats[pxy.uuid] = obj.material.clone()
            obj.material = self.xray_mat

        # Make sure skeleton is updated if human has changed
        if self.human.getSkeleton():
            self.drawSkeleton(self.human.getSkeleton())
            self.human.refreshPose()
            mh.redraw()
コード例 #34
0
    def onShow(self, event):
        gui3d.TaskView.onShow(self, event)
        if gui3d.app.settings.get('cameraAutoZoom', True):
            gui3d.app.setGlobalCamera()

        # Set X-ray material
        if self.xray_mat is None:
            self.xray_mat = material.fromFile(mh.getSysDataPath('materials/xray.mhmat'))
        self.oldHumanMat = self.human.material.clone()
        self.oldPxyMats = dict()
        self.human.material = self.xray_mat
        for pxy in self.human.getProxies(includeHumanProxy=False):
            obj = pxy.object
            self.oldPxyMats[pxy.uuid] = obj.material.clone()
            obj.material = self.xray_mat

        # Make sure skeleton is updated if human has changed
        if self.human.getSkeleton():
            self.drawSkeleton(self.human.getSkeleton())
            self.human.refreshPose()
            mh.redraw()
コード例 #35
0
    def onShow(self, event):
        gui3d.TaskView.onShow(self, event)
        if gui3d.app.getSetting('cameraAutoZoom'):
            gui3d.app.setGlobalCamera()

        # Set X-ray material
        if self.xray_mat is None:
            self.xray_mat = material.fromFile(
                mh.getSysDataPath('materials/xray.mhmat'))
        self.human._backUpMaterial = self.human.material.clone()
        self.human.material = self.xray_mat
        for pxy in self.human.getProxies(includeHumanProxy=False):
            pxy._backUpMaterial = pxy.object.material.clone()
            pxy.object.material = self.xray_mat

        # Make sure skeleton is updated if human has changed
        if self.human.skeleton:
            self.drawSkeleton()

        self.filechooser.refresh()
        self.filechooser.selectItem(self.selectedRig)
コード例 #36
0
 def setMaterial(self, mhmat_filename):
     log.message("SCRIPT: setMaterial(" + mhmat_filename + ")")
     # The file must be realtive to the App Resources directory,
     # e.g.: 'data/skins/young_caucasian_female/young_caucasian_female.mhmat'
     mat = material.fromFile(mhmat_filename)
     self.human.material = mat
コード例 #37
0
 def loadMaterial(self, path):
     self.getSelectedObject().material = material.fromFile(path)
     self.reloadMaterial()
コード例 #38
0
 def loadMaterial(self, path):
     self.getSelectedObject().material = material.fromFile(path)
     self.reloadMaterial()
コード例 #39
0
ファイル: 7_scripting.py プロジェクト: TeoTwawki/makehuman
 def setMaterial(self, mhmat_filename):
     log.message("SCRIPT: setMaterial(" + mhmat_filename + ")")
     # The file must be realtive to the App Resources directory,
     # e.g.: 'data/skins/young_caucasian_female/young_caucasian_female.mhmat'
     mat = material.fromFile(mhmat_filename)
     self.human.material = mat