Skip to content

Commit fd506e7

Browse files
committed
Merge branch 'main' into robot_visuals_blender
2 parents b220276 + fc3f646 commit fd506e7

File tree

3 files changed

+32
-0
lines changed

3 files changed

+32
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1010
### Added
1111

1212
* Added `RobotModel.remove_link`, `RobotModel.remove_joint`, `RobotModel.to_urdf_string`, and `RobotModel.ensure_geometry`.
13+
* Added `compas_blender.unload_modules`.
1314

1415
### Changed
1516

src/compas_blender/utilities/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@
6565
from .objects import * # noqa: F401 F403
6666
from .collections import * # noqa: F401 F403
6767
from .drawing import * # noqa: F401 F403
68+
from .misc import * # noqa: F401 F403
6869

6970

7071
__all__ = [name for name in dir() if not name.startswith('_')]
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import sys
2+
3+
4+
__all__ = [
5+
'unload_modules',
6+
]
7+
8+
9+
def unload_modules(top_level_module_name):
10+
"""Unloads all modules named starting with the specified string.
11+
12+
This function eases the development workflow when editing a library that is
13+
used from Blender.
14+
15+
Parameters
16+
----------
17+
top_level_module_name : :obj:`str`
18+
Name of the top-level module to unload.
19+
20+
Returns
21+
-------
22+
list
23+
List of unloaded module names.
24+
"""
25+
modules = list(filter(lambda m: m.startswith(top_level_module_name), sys.modules))
26+
27+
for module in modules:
28+
sys.modules.pop(module)
29+
30+
return modules

0 commit comments

Comments
 (0)