blob: 4c0e75ca3f9598ad84f0849a3ee79746748d2edf (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
#
# Copyright (C) 2016-2020 by Nathan Lovato, Daniel Oakey, Razvan Radulescu, and contributors
#
# This file is part of Power Sequencer.
#
# Power Sequencer is free software: you can redistribute it and/or modify it under the terms of the
# GNU General Public License as published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# Power Sequencer is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
# without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along with Power Sequencer. If
# not, see <https://www.gnu.org/licenses/>.
#
import importlib
import os
def get_tool_classes():
"""Returns the list of tools in the add-on"""
this_file = os.path.dirname(__file__)
module_files = [
f for f in os.listdir(this_file) if f.endswith(".py") and not f.startswith("__init__")
]
module_paths = ["." + os.path.splitext(f)[0] for f in module_files]
classes = []
for path in module_paths:
module = importlib.import_module(path, package="blender_power_sequencer.tools")
tool_names = [entry for entry in dir(module) if entry.startswith("POWER_SEQUENCER_TOOL")]
classes.extend([getattr(module, name) for name in tool_names])
return classes
|