Пример #1
0
    def loadProjectConfig(self, name):
        schemaPath = self._varMgr.expandPath('[UnityProjectsDir]/{0}/{1}'.format(name, ProjectConfigFileName))
        schemaPathUser = self._varMgr.expandPath('[UnityProjectsDir]/{0}/{1}'.format(name, ProjectUserConfigFileName))
        schemaPathGlobal = self._varMgr.expandPath('[UnityProjectsDir]/{0}'.format(ProjectConfigFileName))
        schemaPathUserGlobal = self._varMgr.expandPath('[UnityProjectsDir]/{0}'.format(ProjectUserConfigFileName))

        self._log.debug('Loading schema at path "{0}"'.format(schemaPath))
        yamlConfig = Config(loadYamlFilesThatExist(schemaPath, schemaPathUser, schemaPathGlobal, schemaPathUserGlobal))

        config = ProjectConfig()

        config.pluginsFolder = yamlConfig.tryGetList([], 'PluginsFolder')
        config.assetsFolder = yamlConfig.tryGetList([], 'AssetsFolder')
        config.solutionProjects = yamlConfig.tryGetList([], 'SolutionProjects')
        config.targetPlatforms = yamlConfig.tryGetList([Platforms.Windows], 'TargetPlatforms')
        config.solutionFolders = yamlConfig.tryGetOrderedDictionary(OrderedDict(), 'SolutionFolders')
        config.packageFolders = yamlConfig.getList('PackageFolders')
        config.projectSettingsPath = yamlConfig.getString('ProjectSettingsPath')

        # Remove duplicates
        config.assetsFolder = list(set(config.assetsFolder))
        config.pluginsFolder = list(set(config.pluginsFolder))

        for packageName in config.pluginsFolder:
            assertThat(not packageName in config.assetsFolder, "Found package '{0}' in both scripts and plugins.  Must be in only one or the other".format(packageName))

        return config
Пример #2
0
    def loadProjectConfig(self, name):
        schemaPath = self._varMgr.expandPath('[UnityProjectsDir]/{0}/{1}'.format(name, ProjectConfigFileName))
        schemaPathUser = self._varMgr.expandPath('[UnityProjectsDir]/{0}/{1}'.format(name, ProjectUserConfigFileName))
        schemaPathGlobal = self._varMgr.expandPath('[UnityProjectsDir]/{0}'.format(ProjectConfigFileName))
        schemaPathUserGlobal = self._varMgr.expandPath('[UnityProjectsDir]/{0}'.format(ProjectUserConfigFileName))

        self._log.debug('Loading schema at path "{0}"'.format(schemaPath))
        yamlConfig = Config(loadYamlFilesThatExist(schemaPath, schemaPathUser, schemaPathGlobal, schemaPathUserGlobal))

        config = ProjectConfig()

        config.pluginsFolder = yamlConfig.tryGetList([], 'PluginsFolder')
        config.assetsFolder = yamlConfig.tryGetList([], 'AssetsFolder')
        config.solutionProjects = yamlConfig.tryGetList([], 'SolutionProjects')
        config.targetPlatforms = yamlConfig.tryGetList([Platforms.Windows], 'TargetPlatforms')
        config.solutionFolders = yamlConfig.tryGetOrderedDictionary(OrderedDict(), 'SolutionFolders')
        config.packageFolders = yamlConfig.getList('PackageFolders')
        config.projectSettingsPath = yamlConfig.getString('ProjectSettingsPath')

        # Remove duplicates
        config.assetsFolder = list(set(config.assetsFolder))
        config.pluginsFolder = list(set(config.pluginsFolder))

        for packageName in config.pluginsFolder:
            assertThat(not packageName in config.assetsFolder, "Found package '{0}' in both scripts and plugins.  Must be in only one or the other".format(packageName))

        return config
Пример #3
0
    def loadProjectConfig(self, name):
        schemaPath = self._varMgr.expandPath(
            '[UnityProjectsDir]/{0}/{1}'.format(name, ProjectConfigFileName))
        schemaPathUser = self._varMgr.expandPath(
            '[UnityProjectsDir]/{0}/{1}'.format(name,
                                                ProjectUserConfigFileName))
        schemaPathGlobal = self._varMgr.expandPath(
            '[UnityProjectsDir]/{0}'.format(ProjectConfigFileName))
        schemaPathUserGlobal = self._varMgr.expandPath(
            '[UnityProjectsDir]/{0}'.format(ProjectUserConfigFileName))

        self._log.debug('Loading schema at path "{0}"'.format(schemaPath))
        yamlConfig = Config(
            loadYamlFilesThatExist(schemaPath, schemaPathUser,
                                   schemaPathGlobal, schemaPathUserGlobal))

        config = ProjectConfig()

        config.pluginsFolder = yamlConfig.tryGetList([], 'PluginsFolder')
        config.assetsFolder = yamlConfig.tryGetList([], 'AssetsFolder')
        config.solutionProjects = yamlConfig.tryGetList([], 'SolutionProjects')
        config.targetPlatforms = yamlConfig.tryGetList([Platforms.Windows],
                                                       'TargetPlatforms')
        config.solutionFolders = yamlConfig.tryGetOrderedDictionary(
            OrderedDict(), 'SolutionFolders')
        config.packageFolders = yamlConfig.getList('PackageFolders')
        config.projectSettingsPath = yamlConfig.getString(
            'ProjectSettingsPath')
        config.customDirectories = yamlConfig.tryGetDictionary(
            {}, 'CustomPackageDirectories')

        customDirectories = config.customDirectories
        for key, value in customDirectories.items():
            self._varMgr.set(key, value)

        # Remove duplicates
        # config.assetsFolderDict = dict(set(config.assetsFolder))
        tmpList = []
        for x in config.assetsFolder:
            if type(x) is dict:
                tmpList.append(x["name"])
            else:
                tmpList.append(x)

        duplicates = [
            item for item, count in Counter(tmpList).items() if count > 1
        ]
        self._log.debug("duplicates {0}".format(duplicates))
        for d in duplicates:
            self._log.debug("removing {0}".format(d))
            tmpList.remove(d)

        config.pluginsFolder = list(set(config.pluginsFolder))

        for packageName in config.pluginsFolder:
            assertThat(
                not packageName in config.assetsFolder,
                "Found package '{0}' in both scripts and plugins.  Must be in only one or the other"
                .format(packageName))

        return config