def _getExtensionsDirList(self):
     if getattr(BigWorld, 'getExtensionsDirList', None):
         return BigWorld.getExtensionsDirList()
     else:
         import os
         extDir = '../wot_ext'
         return [
             '{}/{}'.format(extDir, item)
             for item in os.listdir(ResMgr.resolveToAbsolutePath(extDir))
             if os.path.isdir(
                 ResMgr.resolveToAbsolutePath(os.path.join(extDir, item)))
         ]
Exemplo n.º 2
0
def startPyDevD(ide,
                host='127.0.0.1',
                port=5678,
                suspend=False,
                traceOnlyCurrentThread=False):
    global bwPyDevDStarted
    if not bwPyDevDStarted:
        bwPyDevDStarted = True
        pydevDir = ResMgr.resolveToAbsolutePath(
            'scripts/common/pydev/%s/pydev' % ide)
        if not os.path.isdir(pydevDir):
            bwdebug.ERROR_MSG(
                'Failed to start pydevd: Unable to find pydevd directory for IDE %s'
                % ide)
        sys.path.append(pydevDir)
        try:
            import pydevd
            bwdebug.INFO_MSG('PyDevD connecting to %s:%d' % (host, port))
            pydevd.settrace(host=host,
                            port=port,
                            suspend=suspend,
                            stdoutToServer=True,
                            stderrToServer=True,
                            trace_only_current_thread=traceOnlyCurrentThread)
            threading.currentThread().__pydevd_id__ = BigWorld.component
        except Exception as e:
            from traceback import print_exc
            print_exc()
            bwdebug.ERROR_MSG('Failed to load pydevd: %s' % repr(e))
Exemplo n.º 3
0
def processMember(memberFileName, skinName):
    skinDir = modelsDir.replace(curCV + '/', '') + skinName + '/'
    texDir = skinDir.replace('models', 'textures')
    newPath = ResMgr.resolveToAbsolutePath('./' + skinDir + memberFileName)
    oldSection = ResMgr.openSection(memberFileName)
    if '.vt' in memberFileName:
        if not os.path.isdir(
                os.path.dirname(newPath)
        ):  # because .vts are not always first and makedirs is dumb
            os.makedirs(
                os.path.dirname(newPath)
            )  # because .vts are sometimes first and dirs need to be there
        with open(newPath, 'wb') as newFile:
            newFile.write(oldSection.asBinary)
        return
    newSection = ResMgr.openSection(newPath, True)
    newSection.copy(oldSection)
    sections = [newSection]
    if 'Chassis' in memberFileName:
        dynSection = ResMgr.openSection(
            newPath.replace('Chassis', 'Chassis_dynamic'), True)
        dynSection.copy(oldSection)
        sections.append(dynSection)
    for idx, section in enumerate(sections):
        if '.model' in memberFileName:
            if section.has_key('parent'):
                parent = skinDir + section['parent'].asString
                if idx:
                    parent = parent.replace('Chassis', 'Chassis_dynamic')
                section.writeString('parent', parent.replace('\\', '/'))
            visualPath = skinDir + section['nodefullVisual'].asString
            if idx:
                visualPath = visualPath.replace('Chassis', 'Chassis_dynamic')
            section.writeString('nodefullVisual',
                                visualPath.replace('\\', '/'))
        elif '.visual' in memberFileName:
            for sub in (sub for name, sect in section.items()
                        if name == 'renderSet'
                        for s_name, sub in sect['geometry'].items()
                        if s_name == 'primitiveGroup'):
                hasTracks = False
                for prop in (p for name, p in sub['material'].items()
                             if name == 'property' and p.has_key('Texture')):
                    newTexture = texDir + prop['Texture'].asString
                    if idx and 'tracks' in newTexture and prop.asString == 'diffuseMap':
                        newTexture = 'vehicles/skins/tracks/track_AM.dds'
                        hasTracks = True
                    if ResMgr.isFile(newTexture):
                        prop.writeString('Texture',
                                         newTexture.replace('\\', '/'))
                if hasTracks:
                    for prop in (p for name, p in sub['material'].items()
                                 if name == 'property'
                                 and p.asString == 'g_useNormalPackDXT1'):
                        prop.writeString('Bool', 'true')
            if section['primitivesName'] is None:
                section.writeString('primitivesName',
                                    os.path.splitext(memberFileName)[0])
        section.save()
Exemplo n.º 4
0
def bwResRelativeOpen(name, *args):
    try:
        absname = ResMgr.resolveToAbsolutePath(name)
    except:
        raise IOError(2, 'No such file or directory')

    absname = unicode(absname)
    return orig_open(absname, *args)
Exemplo n.º 5
0
def bwResRelativeOpen(name, *args):
    try:
        absname = ResMgr.resolveToAbsolutePath(name)
    except Exception as e:
        raise IOError(2, str(e))

    absname = unicode(absname)
    return _open_accessor.original(absname, *args)
Exemplo n.º 6
0
def bwResRelativeOpen(name, *args):
    """
    This method has been decorated with 'partial' to avoid using a function as 
    a bound method when stored as a class attribute (see WOWP-638). """
    try:
        absname = ResMgr.resolveToAbsolutePath(name)
    except Exception as e:
        raise IOError(2, str(e))

    absname = unicode(absname)
    return orig_open(absname, *args)
Exemplo n.º 7
0
def bwResRelativeOpen(name, *args):
    """
    This method has been decorated with 'partial' to avoid using a function as 
    a bound method when stored as a class attribute (see WOWP-638). """
    try:
        absname = ResMgr.resolveToAbsolutePath(name)
    except Exception as e:
        raise IOError(2, str(e))

    absname = unicode(absname)
    return orig_open(absname, *args)
Exemplo n.º 8
0
def initDebug(configSection):
    global profiler
    if not configSection:
        return
    else:
        import importlib
        import db.DBLogic
        import ResMgr
        if configSection.readBool('dbCache'):
            db.DBLogic.CACHED_DB_FILE = ResMgr.resolveToAbsolutePath(
                db.DBLogic.CACHED_DB_FILE)
            db.DBLogic.initDB(loadFromCache=True)
            if BigWorld.component == 'service' and not os.path.exists(
                    db.DBLogic.CACHED_DB_FILE):
                db.DBLogic.tryPicleDB(db.DBLogic.g_instance)
        if configSection['pythonpath']:
            for name, pathSection in configSection['pythonpath'].items():
                path = pathSection.asString
                if path in sys.path:
                    sys.path.remove(path)
                if name == 'insert':
                    sys.path.insert(0, path)
                else:
                    sys.path.append(path)

        if BigWorld.component == 'service':
            return
        if configSection['bwreactor'] is not None or configSection['ipc']:
            if 'twisted.internet.reactor' in sys.modules:
                logger.warn('removing already installed reactor: %s' %
                            sys.modules['twisted.internet.reactor'])
                del sys.modules['twisted.internet.reactor']
            from testcore import bwreactor
            bwreactor.install()
        if configSection['ipc']:
            try:
                from testcore.ipc import peers
                peerData = {
                    k: v.asString
                    for k, v in configSection['ipc'].items()
                }
                peerName = peerData.pop('peer')
                peer = importlib.import_module('.' + peerName,
                                               'testcore.ipc.peers')
            except (ImportError, AttributeError) as e:
                logger.error("Can't load ipc peer: %s" % e)
            else:
                peer.init(BigWorld.component, **peerData)

        if configSection.readBool('tickProfile'):
            profiler = Profiler('~/profiles')
            profiler.start(0.1)
        return
Exemplo n.º 9
0
def formatException(excType, excValue, excTraceback):
    extracted = traceback.extract_tb(excTraceback)
    converted = []
    for filename, lineno, name, line in extracted:
        if filename.endswith('.py'):
            converted.append(
                (ResMgr.resolveToAbsolutePath(filename), lineno, name, line))
        converted.append((filename, lineno, name, line))

    converted = traceback.format_list(converted)
    converted += traceback.format_exception(excType, excValue, None)
    return ''.join(converted)
Exemplo n.º 10
0
 def triggerEffect(self):
     browserID = self._effect.getTargetID()
     if self.browserCtrl.getBrowser(browserID) is None:
         pageDir = urllib.quote(
             ResMgr.resolveToAbsolutePath('gui/html/video_tutorial/'))
         self.browserCtrl.load(
             url='file:///{0}'.format('{pageDir}/index_{lang}.html'.format(
                 pageDir=pageDir, lang=_ms('#settings:LANGUAGE_CODE'))),
             title=_ms('#miniclient:tutorial/video/title'),
             showCloseBtn=True,
             showActionBtn=False,
             browserSize=(780, 470),
             browserID=browserID)(lambda success: True)
     return True
Exemplo n.º 11
0
def formatException(excType, excValue, excTraceback):
    """This function is same as traceback.format_exception,
    but has on distinction - relative path of py files to absolute."""
    extracted = traceback.extract_tb(excTraceback)
    converted = []
    for filename, lineno, name, line in extracted:
        if filename.endswith('.py'):
            converted.append(
                (ResMgr.resolveToAbsolutePath(filename), lineno, name, line))
        else:
            converted.append((filename, lineno, name, line))

    converted = traceback.format_list(converted)
    converted += traceback.format_exception(excType, excValue, None)
    return ''.join(converted)
Exemplo n.º 12
0
 def triggerEffect(self):
     browserID = self._effect.getTargetID()
     if getBrowserCtrl().getBrowser(browserID) is None:
         pageDir = urllib.quote(ResMgr.resolveToAbsolutePath("gui/html/video_tutorial/"))
         getBrowserCtrl().load(
             url="file:///{0}".format(
                 "{pageDir}/index_{lang}.html".format(pageDir=pageDir, lang=_ms("#settings:LANGUAGE_CODE"))
             ),
             title=_ms("#miniclient:tutorial/video/title"),
             showCloseBtn=True,
             showActionBtn=False,
             browserSize=(780, 470),
             browserID=browserID,
         )(lambda success: True)
     return
Exemplo n.º 13
0
def addpackage(sitedir, name, known_paths):
    if known_paths is None:
        _init_pathinfo()
        reset = 1
    else:
        reset = 0
    fullname = os.path.join(sitedir, name)
    try:
        f = open(fullname, 'rU')
    except IOError as e:
        print >> sys.stderr, 'ioerror', e, fullname
        return

    with f:
        resolveToAbs = False
        for n, line in enumerate(f):
            if line.startswith('#'):
                continue
            if line.startswith('@'):
                resolveToAbs = True
                continue
            try:
                if line.startswith(('import ', 'import\t')):
                    exec line
                    continue
                line = line.rstrip()
                relativeDir = os.path.join(sitedir, line)
                if resolveToAbs:
                    dir = ResMgr.resolveToAbsolutePath(relativeDir)
                else:
                    dir = relativeDir
                if dir not in known_paths and resMgrDirExists(relativeDir):
                    sys.path.append(dir)
                    known_paths.add(dir)
            except Exception as err:
                print >> sys.stderr, 'Error processing line {:d} of {}:\n'.format(n + 1, fullname)
                for record in traceback.format_exception(*sys.exc_info()):
                    for line in record.splitlines():
                        print >> sys.stderr, '  ' + line

                print >> sys.stderr, '\nRemainder of file ignored'
                break

    if reset:
        known_paths = None
    return known_paths
Exemplo n.º 14
0
def startPyDevD(ide, host = '127.0.0.1', port = 5678, suspend = False, traceOnlyCurrentThread = False):
    global bwPyDevDStarted
    if not bwPyDevDStarted:
        bwPyDevDStarted = True
        pydevDir = ResMgr.resolveToAbsolutePath('scripts/common/pydev/%s/pydev' % ide)
        if not os.path.isdir(pydevDir):
            bwdebug.ERROR_MSG('Failed to start pydevd: Unable to find pydevd directory for IDE %s' % ide)
        sys.path.append(pydevDir)
        try:
            import pydevd
            bwdebug.INFO_MSG('PyDevD connecting to %s:%d' % (host, port))
            pydevd.settrace(host=host, port=port, suspend=suspend, stdoutToServer=True, stderrToServer=True, trace_only_current_thread=traceOnlyCurrentThread)
            threading.currentThread().__pydevd_id__ = BigWorld.component
        except Exception as e:
            from traceback import print_exc
            print_exc()
            bwdebug.ERROR_MSG('Failed to load pydevd: %s' % repr(e))
Exemplo n.º 15
0
import BigWorld
import threading
import urllib
from gui.prb_control.events_dispatcher import EventDispatcher

if True:
    try:
        import yaml
        import ResMgr

        configPath = ResMgr.resolveToAbsolutePath(
            'scripts/client/gui/mods/mod_battle_assistant.txt').decode('utf-8')
        with open(configPath, 'rt') as configFile:
            BigWorld._ba_config = yaml.load(configFile.read())
    except:
        print "Can't read Battle Assistant config, using defaults"
        import sys, traceback
        traceback.print_exception(*sys.exc_info())
        BigWorld._ba_config = {
            'spg': {
                'enabled': True,
                'keys': "[Keys.KEY_MOUSE2, Keys.KEY_G]",
                'ignoreObstacles': False,
                'zoomSpeed': 3.0,
                'alwaysFollowProjectile': False,
                'followProjectileKey': 'Keys.KEY_LALT',
                'activateCommandersCamera': False,
            },
            'expert': {
                'enabled': True
            },
Exemplo n.º 16
0
def resolveResMgrPath(path):
    if os.path.isabs(path):
        raise TypeError('relative path expected, got absolute')
    return os.path.relpath(ResMgr.resolveToAbsolutePath(path)).replace(
        os.sep, '/')
Exemplo n.º 17
0
import BigWorld
import threading
import urllib
from gui.prb_control.events_dispatcher import EventDispatcher

if True:
    try:
        import gui.mods.yaml as yaml
        import ResMgr

        configPath = ResMgr.resolveToAbsolutePath('scripts/client/gui/mods/mod_battle_assistant.txt').decode('utf-8')
        with open(configPath, 'rt') as configFile:
            BigWorld._ba_config = yaml.load(configFile.read())
    except:
        print "Can't read Battle Assistant config, using defaults"
        import sys, traceback
        traceback.print_exception(*sys.exc_info())
        BigWorld._ba_config = {'spg':{'enabled':True, 'keys':"[Keys.KEY_MOUSE2, Keys.KEY_G]", 'ignoreObstacles':False, 'zoomSpeed':3.0, 'alwaysFollowProjectile':False, 'followProjectileKey': 'Keys.KEY_LALT'}, 'expert':{'enabled':True}, 'gunner':{'enabled':True}}
    finally:
        BigWorld._ba_config['version'] = '1.3.4'
        BigWorld._ba_config['analyticsEventSent'] = False

print 'Battle Assistant: v{}'.format(BigWorld._ba_config['version'])

def sendAnalyticsEvent():
    if BigWorld._ba_config['analyticsEventSent']:
        return

    try:
        dbID = BigWorld.player( ).databaseID
Exemplo n.º 18
0
 def triggerEffect(self):
     browserID = self._effect.getTargetID()
     if getBrowserCtrl().getBrowser(browserID) is None:
         getBrowserCtrl().load(url='file:///{0}'.format(ResMgr.resolveToAbsolutePath('gui/html/video_tutorial/index_{0}.html'.format(_ms('#settings:LANGUAGE_CODE')))), title=_ms('#miniclient:tutorial/video/title'), showCloseBtn=True, showActionBtn=False, browserSize=(780, 470), browserID=browserID)(lambda success: True)
     return
Exemplo n.º 19
0
def processMember(memberFileName, skinName):
    skinDir = modelsDir.replace(BigWorld.curCV + '/', '') + skinName + '/'
    texDir = skinDir.replace('models', 'textures')
    skinsSign = 'vehicles/skins/'
    newPath = ResMgr.resolveToAbsolutePath('./' + skinDir + memberFileName)
    oldSection = ResMgr.openSection(memberFileName)
    if '.vt' in memberFileName:
        if not os.path.isdir(
                os.path.dirname(newPath)
        ):  # because .vts are not always first and makedirs is dumb
            os.makedirs(
                os.path.dirname(newPath)
            )  # because .vts are sometimes first and dirs need to be there
        with open(newPath, 'wb') as newFile:
            newFile.write(oldSection.asBinary)
        return
    newSection = ResMgr.openSection(newPath, True)
    newSection.copy(oldSection)
    sections = [newSection]
    if 'Chassis' in memberFileName:
        dynSection = ResMgr.openSection(
            newPath.replace('Chassis', 'Chassis_dynamic'), True)
        dynSection.copy(oldSection)
        sections.append(dynSection)
    if '.model' in memberFileName:
        for idx, modelSect in enumerate(sections):
            if modelSect is None:
                print skinDir + memberFileName
            if modelSect.has_key('parent') and skinsSign not in modelSect[
                    'parent'].asString:
                curParent = skinDir + modelSect['parent'].asString
                if idx:
                    curParent = curParent.replace('Chassis', 'Chassis_dynamic')
                modelSect.writeString('parent', curParent.replace('\\', '/'))
            if skinsSign not in modelSect['nodefullVisual'].asString:
                curVisualPath = skinDir + modelSect['nodefullVisual'].asString
                if idx:
                    curVisualPath = curVisualPath.replace(
                        'Chassis', 'Chassis_dynamic')
                modelSect.writeString('nodefullVisual',
                                      curVisualPath.replace('\\', '/'))
            modelSect.save()
    elif '.visual' in memberFileName:
        for idx, visualSect in enumerate(sections):
            for (curName, curSect), oldSect in zip(visualSect.items(),
                                                   oldSection.values()):
                if curName != 'renderSet':
                    continue
                for (curSubName,
                     curSSect), oldSSect in zip(curSect['geometry'].items(),
                                                oldSect['geometry'].values()):
                    if curSubName != 'primitiveGroup':
                        continue
                    hasTracks = False
                    for (curPName, curProp), oldProp in zip(
                            curSSect['material'].items(),
                            oldSSect['material'].values()):
                        if curPName != 'property' or not curProp.has_key(
                                'Texture'):
                            continue
                        curTexture = curProp['Texture'].asString
                        oldTexture = oldProp['Texture'].asString
                        if skinsSign not in curTexture:
                            newTexture = texDir + curTexture
                            if idx and 'tracks' in curTexture and curProp.asString == 'diffuseMap':
                                newTexture = skinsSign + 'tracks/track_AM.dds'
                                hasTracks = True
                            if ResMgr.isFile(newTexture):
                                curProp.writeString(
                                    'Texture', newTexture.replace('\\', '/'))
                        elif skinsSign in curTexture and not ResMgr.isFile(
                                curTexture):
                            curProp.writeString('Texture',
                                                oldTexture.replace('\\', '/'))
                    if hasTracks:
                        curSSect['material'].writeString(
                            'fx', 'shaders/std_effects/lightonly_alpha.fx')

            if visualSect['primitivesName'] is None:
                visualSect.writeString('primitivesName',
                                       os.path.splitext(memberFileName)[0])
            visualSect.save()
Exemplo n.º 20
0
import BigWorld

if True:
    try:
        import mods.yaml as yaml
        import ResMgr

        configPath = ResMgr.resolveToAbsolutePath(
            'scripts/client/mods/battle_assistant.txt')
        with open(configPath, 'rt') as configFile:
            BigWorld._ba_config = yaml.load(configFile.read())
    except:
        BigWorld._ba_config = {
            'spg': {
                'enabled': True,
                'keys': "[Keys.KEY_MOUSE2, Keys.KEY_G]",
                'zoomSpeed': 3.0
            },
            'expert': {
                'enabled': True
            },
            'gunner': {
                'enabled': True
            }
        }

print 'Battle Assistant: v1.2.3'
Exemplo n.º 21
0
 def triggerEffect(self):
     browserID = self._effect.getTargetID()
     if getBrowserCtrl().getBrowser(browserID) is None:
         getBrowserCtrl().load(url='file:///{0}'.format(ResMgr.resolveToAbsolutePath('gui/html/video_tutorial/index_{0}.html'.format(_ms('#settings:LANGUAGE_CODE')))), title=_ms('#miniclient:tutorial/video/title'), showCloseBtn=True, showActionBtn=False, browserSize=(780, 470), browserID=browserID)(lambda success: True)
Exemplo n.º 22
0
    def apply(self):
        mod = self.mod
        self._onFinishCallbacks = []
        try:
            modname = mod.__name__
            modns = mod.__dict__
            i = modname.rfind('.')
            if i >= 0:
                pkgname, modname = modname[:i], modname[i + 1:]
            else:
                pkgname = None
            if pkgname:
                pkg = sys.modules[pkgname]
                path = pkg.__path__
            else:
                pkg = None
                path = None
            import os.path
            import ResMgr
            reloadFileName = os.path.dirname(mod.__file__)
            path = ResMgr.resolveToAbsolutePath(reloadFileName)
            paths = [path.replace(OUTPUT_DIR, srcDir) for srcDir in SRC_DIRS]
            stream, filename, (suffix, mode,
                               kind) = imp.find_module(modname, paths)
            try:
                if kind not in (imp.PY_COMPILED, imp.PY_SOURCE):
                    notifyError('Could not find source to reload (mod: %s)' %
                                (modname, ))
                    return
                if kind == imp.PY_SOURCE:
                    source = stream.read()
                    code = compile(source, filename, 'exec')
                else:
                    import marshal
                    code = marshal.load(stream)
            finally:
                if stream:
                    stream.close()

            newNamespace = modns.copy()
            newNamespace.clear()
            newNamespace['__name__'] = modns['__name__']

            def _exec(exp, globalVars, localVars=None):
                if localVars is not None:
                    exec exp in globalVars, localVars
                else:
                    exec exp in globalVars
                return

            _exec(code, newNamespace)
            oldnames = set(modns)
            newnames = set(newNamespace)
            for name in newnames - oldnames:
                notifyInfo0('Added:', name, 'to namespace')
                self.foundChange = True
                modns[name] = newNamespace[name]

            for name in oldnames & newnames:
                self._update(modns, name, modns[name], newNamespace[name])

            self._handleNamespace(modns)
            for c in self._onFinishCallbacks:
                c()

            del self._onFinishCallbacks[:]
        except:
            traceback.print_exc()

        return
Exemplo n.º 23
0
	def resolve_path(path):
		path = os.path.relpath(ResMgr.resolveToAbsolutePath(path)).replace(os.sep, '/')
		return path + ('/' if os.path.isdir(path) else '')
Exemplo n.º 24
0
def processMember(memberFileName, skinName):
    skinDir = modelsDir.replace(BigWorld.curCV + '/', '') + skinName + '/'
    texDir = skinDir.replace('models', 'textures')
    skinsSign = 'vehicles/skins/'
    if '.model' in memberFileName:
        oldModel = ResMgr.openSection(memberFileName)
        newModelPath = './' + skinDir + memberFileName
        curModel = ResMgr.openSection(
            ResMgr.resolveToAbsolutePath(newModelPath), True)
        curModel.copy(oldModel)
        models = [curModel]
        if 'Chassis' in memberFileName:
            dynModelPath = newModelPath.replace('Chassis', 'Chassis_dynamic')
            dynModel = ResMgr.openSection(
                ResMgr.resolveToAbsolutePath(dynModelPath), True)
            dynModel.copy(oldModel)
            models.append(dynModel)
        for idx, modelSect in enumerate(models):
            if modelSect is None:
                print skinDir + memberFileName
            if modelSect.has_key('parent') and skinsSign not in modelSect[
                    'parent'].asString:
                curParent = skinDir + modelSect['parent'].asString
                if idx:
                    curParent = curParent.replace('Chassis', 'Chassis_dynamic')
                modelSect.writeString('parent', curParent.replace('\\', '/'))
            if skinsSign not in modelSect['nodefullVisual'].asString:
                curVisual = skinDir + modelSect['nodefullVisual'].asString
                if idx:
                    curVisual = curVisual.replace('Chassis', 'Chassis_dynamic')
                modelSect.writeString('nodefullVisual',
                                      curVisual.replace('\\', '/'))
            modelSect.save()
    elif '.visual' in memberFileName:
        oldVisual = ResMgr.openSection(memberFileName)
        newVisualPath = './' + skinDir + memberFileName
        curVisual = ResMgr.openSection(
            ResMgr.resolveToAbsolutePath(newVisualPath), True)
        curVisual.copy(oldVisual)
        visuals = [curVisual]
        if 'Chassis' in memberFileName:
            dynVisualPath = newVisualPath.replace('Chassis', 'Chassis_dynamic')
            dynVisual = ResMgr.openSection(
                ResMgr.resolveToAbsolutePath(dynVisualPath), True)
            dynVisual.copy(oldVisual)
            visuals.append(dynVisual)
        for idx, visualSect in enumerate(visuals):
            for (curName, curSect), oldSect in zip(visualSect.items(),
                                                   oldVisual.values()):
                if curName != 'renderSet':
                    continue
                for (curSubName,
                     curSSect), oldSSect in zip(curSect['geometry'].items(),
                                                oldSect['geometry'].values()):
                    if curSubName != 'primitiveGroup':
                        continue
                    hasTracks = False
                    for (curPName, curProp), oldProp in zip(
                            curSSect['material'].items(),
                            oldSSect['material'].values()):
                        if curPName != 'property' or not curProp.has_key(
                                'Texture'):
                            continue
                        curTexture = curProp['Texture'].asString
                        oldTexture = oldProp['Texture'].asString
                        if skinsSign not in curTexture:
                            newTexture = texDir + curTexture
                            if idx and 'tracks' in curTexture and curProp.asString == 'diffuseMap':
                                newTexture = skinsSign + 'tracks/track_AM.dds'
                                hasTracks = True
                            if ResMgr.isFile(newTexture):
                                curProp.writeString(
                                    'Texture', newTexture.replace('\\', '/'))
                        elif skinsSign in curTexture and not ResMgr.isFile(
                                curTexture):
                            curProp.writeString('Texture',
                                                oldTexture.replace('\\', '/'))
                    if hasTracks:
                        curSSect['material'].writeString(
                            'fx', 'shaders/std_effects/lightonly_alpha.fx')

            visualSect.writeString('primitivesName',
                                   os.path.splitext(memberFileName)[0])
            visualSect.save()