1 # SPDX-FileCopyrightText: 2022-2023 Blender Foundation
3 # SPDX-License-Identifier: GPL-2.0-or-later
6 from bpy
.props
import (
11 evaluatedDepsgraph
= None
13 class tissuePreferences(bpy
.types
.AddonPreferences
):
14 bl_idname
= __package__
16 print_stats
: IntProperty(
18 description
="Print in the console all details about the computing time.",
24 use_numba_tess
: BoolProperty(
25 name
="Numba Tessellate",
26 description
="Boost the Tessellation using Numba module. It will be slower during the first execution",
30 def draw(self
, context
):
32 from .utils_pip
import Pip
33 Pip
._ensure
_user
_site
_package
()
35 layout
.prop(self
, "print_stats")
37 numba_spec
= importlib
.util
.find_spec('numba')
38 found
= numba_spec
is not None
42 layout
.label(text
='Numba module installed correctly!', icon
='INFO')
43 layout
.prop(self
, "use_numba_tess")
47 layout
.label(text
='Numba module not installed!', icon
='ERROR')
48 layout
.label(text
='Installing Numba will make Tissue faster', icon
='INFO')
50 row
.operator('scene.tissue_install_numba')
51 layout
.label(text
='Internet connection required. It may take few minutes', icon
='URL')
53 class tissue_install_numba(bpy
.types
.Operator
):
54 bl_idname
= "scene.tissue_install_numba"
55 bl_label
= "Install Numba"
56 bl_description
= ("Install Numba python module")
57 bl_options
= {'REGISTER'}
59 def execute(self
, context
):
61 from .utils_pip
import Pip
63 Pip
.uninstall('llvmlite')
64 Pip
.uninstall('numba')
65 Pip
.install('llvmlite')
67 from numba
import jit
, njit
, guvectorize
, float64
, int32
, prange
69 print('Tissue: Numba successfully installed!')
70 self
.report({'INFO'}, 'Tissue: Numba successfully installed!')
72 print('Tissue: Numba not loaded correctly. Try restarting Blender')