Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bypass GPU drawing functions when running blender in background mode #42

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 11 additions & 6 deletions import_bsp/QuakeSky.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,9 @@
}
'''

if bpy.app.version < (3, 5, 0):
if bpy.app.background:
pass
elif bpy.app.version < (3, 5, 0):
shader = gpu.types.GPUShader(
vertex_header+vertex_shader,
fragment_header+fragment_shader)
Expand All @@ -172,8 +174,9 @@
shader_sky_info.fragment_source(fragment_shader)

shader = gpu.shader.create_from_info(shader_sky_info)

batch = batch_for_shader(shader, 'TRIS', {"vertex_id": (0, 1, 2)})

if not bpy.app.background:
batch = batch_for_shader(shader, 'TRIS', {"vertex_id": (0, 1, 2)})


def make_equirectangular_from_sky(VFS, sky_name):
Expand Down Expand Up @@ -372,8 +375,9 @@ def add_sun(shader, function, sun_parms, i):
FragColor = textureLod(equirect, tex, 0);
}
'''

if bpy.app.version < (3, 5, 0):
if bpy.app.background:
pass
elif bpy.app.version < (3, 5, 0):
ets_shader = gpu.types.GPUShader(
ets_vertex_header+ets_vertex_shader,
ets_fragment_header+ets_fragment_shader)
Expand All @@ -393,7 +397,8 @@ def add_sun(shader, function, sun_parms, i):

ets_shader = gpu.shader.create_from_info(ets_info)

ets_batch = batch_for_shader(ets_shader, 'TRIS', {"vertex_id": (0, 1, 2)})
if not bpy.app.background:
ets_batch = batch_for_shader(ets_shader, 'TRIS', {"vertex_id": (0, 1, 2)})

def make_sky_from_equirect(image):
if image is None:
Expand Down