예제 #1
0
 def loaderPhaseChecker(self, path, loaderOptions):
     if 'audio/' in path:
         return 1
     file = Filename(path)
     if not file.getExtension():
         file.setExtension('bam')
     mp = getModelPath()
     path = mp.findFile(file).cStr()
     if not path:
         return
     match = re.match('.*phase_([^/]+)/', path)
     if not match:
         if 'dmodels' in path:
             return
         else:
             self.errorAccumulatorBuffer += 'file not in phase (%s, %s)\n' % (
                 file, path)
             return
     basePhase = float(match.groups()[0])
     if not launcher.getPhaseComplete(basePhase):
         self.errorAccumulatorBuffer += 'phase is not loaded for this model %s\n' % path
     model = loader.loader.loadSync(Filename(path), loaderOptions)
     if model:
         model = NodePath(model)
         for tex in model.findAllTextures():
             texPath = tex.getFullpath().cStr()
             match = re.match('.*phase_([^/]+)/', texPath)
             if match:
                 texPhase = float(match.groups()[0])
                 if texPhase > basePhase:
                     self.errorAccumulatorBuffer += 'texture phase is higher than the models (%s, %s)\n' % (
                         path, texPath)
예제 #2
0
 def loaderPhaseChecker(self, path, loaderOptions):
     if 'audio/' in path:
         return 1
     file = Filename(path)
     if not file.getExtension():
         file.setExtension('bam')
     mp = getModelPath()
     path = mp.findFile(file).cStr()
     if not path:
         return
     match = re.match('.*phase_([^/]+)/', path)
     if not match:
         if 'dmodels' in path:
             return
         else:
             self.errorAccumulatorBuffer += 'file not in phase (%s, %s)\n' % (file, path)
             return
     basePhase = float(match.groups()[0])
     if not launcher.getPhaseComplete(basePhase):
         self.errorAccumulatorBuffer += 'phase is not loaded for this model %s\n' % path
     model = loader.loader.loadSync(Filename(path), loaderOptions)
     if model:
         model = NodePath(model)
         for tex in model.findAllTextures():
             texPath = tex.getFullpath().cStr()
             match = re.match('.*phase_([^/]+)/', texPath)
             if match:
                 texPhase = float(match.groups()[0])
                 if texPhase > basePhase:
                     self.errorAccumulatorBuffer += 'texture phase is higher than the models (%s, %s)\n' % (path, texPath)
예제 #3
0
    def loaderPhaseChecker(self, path, loaderOptions):
        # See if this path is in the phase system
        # It should look something like "phase_5/models/char/joe"

        # HACK: let's try .bam if it has no extension
        # Other way to do this: after we load the model, call model.node().getFullpath()
        if ("audio/" in path):
            return 1
        file = Filename(path)
        if not file.getExtension():
            file.setExtension('bam')
        mp = getModelPath()
        path = mp.findFile(file).cStr()
        if not path:
            return

        match = re.match(".*phase_([^/]+)/", path)
        if (not match):
            if ('dmodels' in path):
                return
            else:
                self.errorAccumulatorBuffer += "file not in phase (%s, %s)\n" % (
                    file, path)
                return

        basePhase = float(match.groups()[0])
        if (not launcher.getPhaseComplete(basePhase)):
            self.errorAccumulatorBuffer += "phase is not loaded for this model %s\n" % (
                path)
        #grab the model
        model = loader.loader.loadSync(Filename(path), loaderOptions)

        if (model):
            model = NodePath(model)
            for tex in model.findAllTextures():
                texPath = tex.getFullpath().cStr()
                match = re.match(".*phase_([^/]+)/", texPath)
                if (match):
                    texPhase = float(match.groups()[0])
                    if (texPhase > basePhase):
                        self.errorAccumulatorBuffer += "texture phase is higher than the models (%s, %s)\n" % (
                            path, texPath)