Esempio n. 1
0
    def doTex(self, word):
        """ Toggles texturing (with no parameters) or shows the named
        texture (with a parameter). """

        args = word.split()
        if len(args) <= 1:
            # No parameters: clean up the old texture viewer.
            if self.texViewer:
                self.texViewer.cleanup()
                self.texViewer = None
                return

            # No parameters, and now texture viewer: toggle texture.
            base.toggleTexture()
            return

        # At least one parameter: show the named texture.
        if self.texViewer:
            self.texViewer.cleanup()
            self.texViewer = None

        tex = TexturePool.findTexture(args[1])
        if not tex:
            # Try it with stars on both ends.
            tex = TexturePool.findTexture('*%s*' % (args[1]))

        if not tex:
            # Couldn't find that texture.
            self.setMagicWordResponse("Unknown texture: %s" % (args[1]))
            return

        self.texViewer = TexViewer(tex)
Esempio n. 2
0
 def doTex(self, word):
     args = word.split()
     if len(args) <= 1:
         if self.texViewer:
             self.texViewer.cleanup()
             self.texViewer = None
             return
         base.toggleTexture()
         return
     if self.texViewer:
         self.texViewer.cleanup()
         self.texViewer = None
     tex = TexturePool.findTexture(args[1])
     if not tex:
         tex = TexturePool.findTexture('*%s*' % args[1])
     if not tex:
         self.setMagicWordResponse('Unknown texture: %s' % args[1])
         return
     self.texViewer = TexViewer(tex)
     return