Fixed branch for Blender 3.6 release #104626
@ -506,7 +506,7 @@ class ExportGLTF2_Base(ConvertGLTF2_Base):
|
|||||||
export_bake_animation: BoolProperty(
|
export_bake_animation: BoolProperty(
|
||||||
name='Bake All Objects Animations',
|
name='Bake All Objects Animations',
|
||||||
description=(
|
description=(
|
||||||
"Force exporting animation on every objects. "
|
"Force exporting animation on every object. "
|
||||||
"Can be useful when using constraints or driver. "
|
"Can be useful when using constraints or driver. "
|
||||||
"Also useful when exporting only selection"
|
"Also useful when exporting only selection"
|
||||||
),
|
),
|
||||||
@ -535,7 +535,7 @@ class ExportGLTF2_Base(ConvertGLTF2_Base):
|
|||||||
name='Use Current Frame as Object Rest Transformations',
|
name='Use Current Frame as Object Rest Transformations',
|
||||||
description=(
|
description=(
|
||||||
'Export the scene in the current animation frame. '
|
'Export the scene in the current animation frame. '
|
||||||
'When off, frame O is used as rest transformations for objects'
|
'When off, frame 0 is used as rest transformations for objects'
|
||||||
),
|
),
|
||||||
default=False
|
default=False
|
||||||
)
|
)
|
||||||
@ -543,7 +543,7 @@ class ExportGLTF2_Base(ConvertGLTF2_Base):
|
|||||||
export_rest_position_armature: BoolProperty(
|
export_rest_position_armature: BoolProperty(
|
||||||
name='Use Rest Position Armature',
|
name='Use Rest Position Armature',
|
||||||
description=(
|
description=(
|
||||||
"Export armatures using rest position as joins rest pose. "
|
"Export armatures using rest position as joints' rest pose. "
|
||||||
"When off, current frame pose is used as rest pose"
|
"When off, current frame pose is used as rest pose"
|
||||||
),
|
),
|
||||||
default=True
|
default=True
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
bl_info = {
|
bl_info = {
|
||||||
"name": "Sun Position",
|
"name": "Sun Position",
|
||||||
"author": "Michael Martin, Damien Picard",
|
"author": "Michael Martin, Damien Picard",
|
||||||
"version": (3, 5, 0),
|
"version": (3, 5, 2),
|
||||||
"blender": (3, 2, 0),
|
"blender": (3, 2, 0),
|
||||||
"location": "World > Sun Position",
|
"location": "World > Sun Position",
|
||||||
"description": "Show sun position with objects and/or sky texture",
|
"description": "Show sun position with objects and/or sky texture",
|
||||||
|
@ -10,34 +10,8 @@ from mathutils import Vector
|
|||||||
from math import sqrt, pi, atan2, asin
|
from math import sqrt, pi, atan2, asin
|
||||||
|
|
||||||
|
|
||||||
vertex_shader = '''
|
image_shader = gpu.shader.from_builtin('2D_IMAGE_COLOR')
|
||||||
uniform mat4 ModelViewProjectionMatrix;
|
line_shader = gpu.shader.from_builtin('2D_FLAT_COLOR')
|
||||||
|
|
||||||
/* Keep in sync with intern/opencolorio/gpu_shader_display_transform_vertex.glsl */
|
|
||||||
in vec2 texCoord;
|
|
||||||
in vec2 pos;
|
|
||||||
out vec2 texCoord_interp;
|
|
||||||
|
|
||||||
void main()
|
|
||||||
{
|
|
||||||
gl_Position = ModelViewProjectionMatrix * vec4(pos.xy, 0.0f, 1.0f);
|
|
||||||
gl_Position.z = 1.0f;
|
|
||||||
texCoord_interp = texCoord;
|
|
||||||
}'''
|
|
||||||
|
|
||||||
fragment_shader = '''
|
|
||||||
in vec2 texCoord_interp;
|
|
||||||
out vec4 fragColor;
|
|
||||||
|
|
||||||
uniform sampler2D image;
|
|
||||||
uniform float exposure;
|
|
||||||
|
|
||||||
void main()
|
|
||||||
{
|
|
||||||
fragColor = texture(image, texCoord_interp) * vec4(exposure, exposure, exposure, 1.0f);
|
|
||||||
}'''
|
|
||||||
|
|
||||||
# shader = gpu.types.GPUShader(vertex_shader, fragment_shader)
|
|
||||||
|
|
||||||
|
|
||||||
def draw_callback_px(self, context):
|
def draw_callback_px(self, context):
|
||||||
@ -49,9 +23,6 @@ def draw_callback_px(self, context):
|
|||||||
if self.area != context.area:
|
if self.area != context.area:
|
||||||
return
|
return
|
||||||
|
|
||||||
if image.gl_load():
|
|
||||||
raise Exception()
|
|
||||||
|
|
||||||
bottom = 0
|
bottom = 0
|
||||||
top = context.area.height
|
top = context.area.height
|
||||||
right = context.area.width
|
right = context.area.width
|
||||||
@ -59,39 +30,36 @@ def draw_callback_px(self, context):
|
|||||||
position = Vector((right, top)) / 2 + self.offset
|
position = Vector((right, top)) / 2 + self.offset
|
||||||
scale = Vector((context.area.width, context.area.width / 2)) * self.scale
|
scale = Vector((context.area.width, context.area.width / 2)) * self.scale
|
||||||
|
|
||||||
shader = gpu.types.GPUShader(vertex_shader, fragment_shader)
|
|
||||||
|
|
||||||
coords = ((-0.5, -0.5), (0.5, -0.5), (0.5, 0.5), (-0.5, 0.5))
|
coords = ((-0.5, -0.5), (0.5, -0.5), (0.5, 0.5), (-0.5, 0.5))
|
||||||
uv_coords = ((0, 0), (1, 0), (1, 1), (0, 1))
|
uv_coords = ((0, 0), (1, 0), (1, 1), (0, 1))
|
||||||
batch = batch_for_shader(shader, 'TRI_FAN',
|
batch = batch_for_shader(image_shader, 'TRI_FAN',
|
||||||
{"pos": coords, "texCoord": uv_coords})
|
{"pos": coords, "texCoord": uv_coords})
|
||||||
|
|
||||||
with gpu.matrix.push_pop():
|
with gpu.matrix.push_pop():
|
||||||
gpu.matrix.translate(position)
|
gpu.matrix.translate(position)
|
||||||
gpu.matrix.scale(scale)
|
gpu.matrix.scale(scale)
|
||||||
|
|
||||||
shader.bind()
|
image_shader.bind()
|
||||||
shader.uniform_sampler("image", texture)
|
image_shader.uniform_sampler("image", texture)
|
||||||
shader.uniform_float("exposure", self.exposure)
|
image_shader.uniform_float("color", (self.exposure, self.exposure, self.exposure, 1.0))
|
||||||
batch.draw(shader)
|
batch.draw(image_shader)
|
||||||
|
|
||||||
# Crosshair
|
# Crosshair
|
||||||
# vertical
|
# vertical
|
||||||
coords = ((self.mouse_position[0], bottom), (self.mouse_position[0], top))
|
coords = ((self.mouse_position[0], bottom), (self.mouse_position[0], top))
|
||||||
colors = ((1,) * 4,) * 2
|
colors = ((1,) * 4,) * 2
|
||||||
shader = gpu.shader.from_builtin('2D_FLAT_COLOR')
|
batch = batch_for_shader(line_shader, 'LINES',
|
||||||
batch = batch_for_shader(shader, 'LINES',
|
|
||||||
{"pos": coords, "color": colors})
|
{"pos": coords, "color": colors})
|
||||||
shader.bind()
|
line_shader.bind()
|
||||||
batch.draw(shader)
|
batch.draw(line_shader)
|
||||||
|
|
||||||
# horizontal
|
# horizontal
|
||||||
if bottom <= self.mouse_position[1] <= top:
|
if bottom <= self.mouse_position[1] <= top:
|
||||||
coords = ((0, self.mouse_position[1]), (context.area.width, self.mouse_position[1]))
|
coords = ((0, self.mouse_position[1]), (context.area.width, self.mouse_position[1]))
|
||||||
batch = batch_for_shader(shader, 'LINES',
|
batch = batch_for_shader(line_shader, 'LINES',
|
||||||
{"pos": coords, "color": colors})
|
{"pos": coords, "color": colors})
|
||||||
shader.bind()
|
line_shader.bind()
|
||||||
batch.draw(shader)
|
batch.draw(line_shader)
|
||||||
|
|
||||||
|
|
||||||
class SUNPOS_OT_ShowHdr(bpy.types.Operator):
|
class SUNPOS_OT_ShowHdr(bpy.types.Operator):
|
||||||
|
@ -311,7 +311,7 @@ class SunPosAddonPreferences(AddonPreferences):
|
|||||||
box = layout.box()
|
box = layout.box()
|
||||||
col = box.column()
|
col = box.column()
|
||||||
|
|
||||||
col.label(text="Show options or labels:")
|
col.label(text="Show options and info:")
|
||||||
flow = col.grid_flow(columns=0, even_columns=True, even_rows=False, align=False)
|
flow = col.grid_flow(columns=0, even_columns=True, even_rows=False, align=False)
|
||||||
flow.prop(self, "show_refraction")
|
flow.prop(self, "show_refraction")
|
||||||
flow.prop(self, "show_overlays")
|
flow.prop(self, "show_overlays")
|
||||||
|
@ -432,10 +432,10 @@ translations_tuple = (
|
|||||||
("fr_FR", "Projection inconnue",
|
("fr_FR", "Projection inconnue",
|
||||||
(False, ())),
|
(False, ())),
|
||||||
),
|
),
|
||||||
(("*", "Show options or labels:"),
|
(("*", "Show options and info:"),
|
||||||
(("scripts/addons/sun_position/properties.py:297",),
|
(("scripts/addons/sun_position/properties.py:297",),
|
||||||
()),
|
()),
|
||||||
("fr_FR", "Afficher les options et étiquettes :",
|
("fr_FR", "Afficher les options et infos :",
|
||||||
(False, ())),
|
(False, ())),
|
||||||
),
|
),
|
||||||
(("*", "ERROR: Could not parse coordinates"),
|
(("*", "ERROR: Could not parse coordinates"),
|
||||||
|
Loading…
Reference in New Issue
Block a user