Skip to content
Snippets Groups Projects
Select Git revision
  • 01cc797d6b37626ccf36249cbc712a698f57e1fb
  • master default protected
  • blender-v3.5-release
  • main
  • blender-v3.4-release
  • blender-v3.3-release
  • blender-v3.2-release
  • blender-v3.1-release
  • blender-v3.0-release
  • studio-sprite-fright
  • blender-v2.93-release
  • blender-v2.92-release
  • blender-v2.91-release
  • temp-code-clean
  • blender-v2.90-release
  • c-style-check
  • blender-v2.83-release
  • blender-v2.82-release
  • blender-v2.81-release
  • blender-v2.80-release
  • blender2.8_covise4
  • v3.3.4
  • v2.93.15
  • v2.93.14
  • v3.3.3
  • v2.93.13
  • v2.93.12
  • v3.4.1
  • v3.3.2
  • v3.4.0
  • v3.3.1
  • v2.93.11
  • v3.3.0
  • v3.2.2
  • v2.93.10
  • v3.2.1
  • v3.2.0
  • v2.83.20
  • v2.93.9
  • v3.1.2
  • v3.1.1
41 results

blender_update_themes.py

Blame
  • user avatar
    Campbell Barton authored
    135f5550
    History
    blender_update_themes.py 1.68 KiB
    # ##### BEGIN GPL LICENSE BLOCK #####
    #
    #  This program 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 2
    #  of the License, or (at your option) any later version.
    #
    #  This program 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 this program; if not, write to the Free Software Foundation,
    #  Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
    #
    # ##### END GPL LICENSE BLOCK #####
    
    # <pep8 compliant>
    
    # this script updates XML themes once new settings are added
    #
    #  ./blender.bin --background --python source/tools/utils/blender_update_themes.py
    
    import bpy
    import os
    
    
    def update(filepath):
        import rna_xml
        context = bpy.context
    
        print("Updating theme: %r" % filepath)
        preset_xml_map = (
            ("user_preferences.themes[0]", "Theme"),
            ("user_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 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)
                    update(fn_full)
    
    
    if __name__ == "__main__":
        main()