Rename modules in `./scripts/modules/` to use an underscore prefix to make it clear they aren't intended to be part of public API's. This also means there is no implication that these modules should be stable, allowing us to change them based on Blender's internal usage. The following modules have been marked as private: - `animsys_refactor` - `bl_console_utils` - `bl_i18n_utils` - `bl_previews_utils` - `bl_rna_utils` - `bl_text_utils` - `bl_ui_utils` - `bpy_restrict_state` - `console_python` - `console_shell` - `graphviz_export` - `keyingsets_utils` - `rna_info` - `rna_manual_reference` - `rna_xml` Note that we could further re-arrange these modules (under `_bpy_internal` in some cases), this change is mainly to mark them as private, further changes can be handed on a case-by-case basis. Ref !147773
63 lines
1.3 KiB
Python
63 lines
1.3 KiB
Python
# SPDX-FileCopyrightText: 2023 Blender Authors
|
|
#
|
|
# SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
# this script updates XML themes once new settings are added
|
|
#
|
|
# ./blender.bin --background --python ./tools/utils_maintenance/blender_update_themes.py
|
|
|
|
__all__ = (
|
|
"main",
|
|
)
|
|
|
|
import bpy
|
|
import os
|
|
|
|
|
|
def update(filepath):
|
|
import _rna_xml as rna_xml
|
|
context = bpy.context
|
|
|
|
print("Updating theme: {!r}".format(filepath))
|
|
preset_xml_map = (
|
|
("preferences.themes[0]", "Theme"),
|
|
("preferences.ui_styles[0]", "Theme"),
|
|
)
|
|
rna_xml.xml_file_run(
|
|
context,
|
|
filepath,
|
|
preset_xml_map,
|
|
)
|
|
|
|
rna_xml.xml_file_write(
|
|
context,
|
|
filepath,
|
|
preset_xml_map,
|
|
)
|
|
|
|
|
|
def update_default(filepath):
|
|
with open(filepath, 'w', encoding='utf-8') as fh:
|
|
fh.write("""<bpy>
|
|
<Theme>
|
|
</Theme>
|
|
<ThemeStyle>
|
|
</ThemeStyle>
|
|
</bpy>
|
|
""")
|
|
|
|
|
|
def main():
|
|
for path in bpy.utils.preset_paths("interface_theme"):
|
|
for fn in os.listdir(path):
|
|
if fn.endswith(".xml"):
|
|
fn_full = os.path.join(path, fn)
|
|
if fn == "blender_dark.xml":
|
|
update_default(fn_full)
|
|
else:
|
|
update(fn_full)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|