Prevent error when running Blender in background mode
We shouldn't call any `gpu` functions in background mode. Since the texture browser will never run when Blender is in background mode anyway, we can simply assign `None` instead.
This commit is contained in:
parent
bc864737ae
commit
0caf761863
@ -11,8 +11,12 @@ import bpy
|
|||||||
import gpu
|
import gpu
|
||||||
from gpu_extras.batch import batch_for_shader
|
from gpu_extras.batch import batch_for_shader
|
||||||
|
|
||||||
shader = gpu.shader.from_builtin('2D_UNIFORM_COLOR')
|
if bpy.app.background:
|
||||||
texture_shader = gpu.shader.from_builtin('2D_IMAGE')
|
shader = None
|
||||||
|
texture_shader = None
|
||||||
|
else:
|
||||||
|
shader = gpu.shader.from_builtin('2D_UNIFORM_COLOR')
|
||||||
|
texture_shader = gpu.shader.from_builtin('2D_IMAGE')
|
||||||
|
|
||||||
Float2 = typing.Tuple[float, float]
|
Float2 = typing.Tuple[float, float]
|
||||||
Float3 = typing.Tuple[float, float, float]
|
Float3 = typing.Tuple[float, float, float]
|
||||||
|
Reference in New Issue
Block a user