Skip to content

Commit

Permalink
Releases/0.4.1.1 (#486)
Browse files Browse the repository at this point in the history
* fix warmpup bug without asset

* new release with bug fixing

* pull asset anyway

* import asset loader

* fix bug

* update version

* pedestrian model preload
  • Loading branch information
QuanyiLi committed Aug 22, 2023
1 parent b39cbce commit 902186d
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 14 deletions.
12 changes: 0 additions & 12 deletions metadrive/engine/asset_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,6 @@ def init_loader(engine):
"""
Due to the feature of Panda3d, keep reference of loader in static variable
"""
msg = "Assets folder doesn't exist. Begin to download assets..."
if not os.path.exists(AssetLoader.asset_path):
AssetLoader.logger.warning(msg)
pull_asset(False)
else:
if asset_version() != VERSION:
AssetLoader.logger.warning(
"Assets version mismatch! Current: {}, Expected: {}. "
"Update the assets by `python -m metadrive.pull_asset --update'".format(asset_version(), VERSION)
)
else:
AssetLoader.logger.info("Assets version: {}".format(VERSION))
if engine.win is None:
AssetLoader.logger.debug("Physics world mode")
return
Expand Down
21 changes: 21 additions & 0 deletions metadrive/engine/base_engine.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
import logging

from metadrive.version import VERSION, asset_version
import os
from metadrive.pull_asset import pull_asset
from metadrive.constants import RENDER_MODE_NONE, RENDER_MODE_OFFSCREEN, RENDER_MODE_ONSCREEN
import pickle
import time
Expand Down Expand Up @@ -28,6 +32,7 @@ class BaseEngine(EngineCore, Randomizable):
global_random_seed = None

def __init__(self, global_config):
self.try_pull_asset()
EngineCore.__init__(self, global_config)
Randomizable.__init__(self, self.global_random_seed)
self.episode_step = 0
Expand Down Expand Up @@ -685,6 +690,22 @@ def warmup(self):
barrier = None
cone = None

@staticmethod
def try_pull_asset():
from metadrive.engine.asset_loader import AssetLoader
msg = "Assets folder doesn't exist. Begin to download assets..."
if not os.path.exists(AssetLoader.asset_path):
AssetLoader.logger.warning(msg)
pull_asset(False)
else:
if asset_version() != VERSION:
AssetLoader.logger.warning(
"Assets version mismatch! Current: {}, Expected: {}. "
"Update the assets by `python -m metadrive.pull_asset --update'".format(asset_version(), VERSION)
)
else:
AssetLoader.logger.info("Assets version: {}".format(VERSION))


if __name__ == "__main__":
from metadrive.envs.base_env import BASE_DEFAULT_CONFIG
Expand Down
2 changes: 1 addition & 1 deletion metadrive/version.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import os

VERSION = "0.4.0.3"
VERSION = "0.4.1.1"


def asset_version():
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ def is_win():
0. Checkout a new branch from main called releases/x.y.z
1. Rename VERSION in metadrive/version.py to x.y,z
1. Rename VERSION in metadrive/version.py to x.y.z
2. Revise the version in metadrive/assets/version.txt, and compress the folder into assets.zip
Expand Down

0 comments on commit 902186d

Please sign in to comment.