nix-overlay/pkgs/development/python-modules/bpy/cg_environment.patch

45 lines
1.3 KiB
Diff

--- /dev/null 2023-08-11 22:07:27.012000310 +0300
+++ b/scripts/startup/cg_environment.py 2023-08-11 00:44:51.704718595 +0300
@@ -0,0 +1,42 @@
+#!/usr/bin/python3
+# -*- coding: utf-8 -*-
+# Copyright (C) 2023 Ilia Kurochkin <brothermechanic@gmail.com>
+#
+# 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 3 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.
+
+__doc__ = 'Environment for use CG Overlay'
+__version__ = '0.1'
+
+import bpy
+from bpy.app.handlers import persistent
+import addon_utils
+
+
+@persistent
+def cg_env(dummy):
+ '''Scripts environment'''
+ addon_utils.enable('cg_preferences', default_set=True)
+
+ print('CG Environment activated!')
+
+
+def register():
+ '''register blender module'''
+ bpy.app.handlers.load_post.append(cg_env)
+
+
+def unregister():
+ '''unregister blender module'''
+ bpy.app.handlers.load_post.remove(cg_env)
+
+
+if __name__ == '__main__':
+ register()