Fixed branch for Blender 3.6 release #104626
@ -506,7 +506,7 @@ class ExportGLTF2_Base(ConvertGLTF2_Base):
|
||||
export_bake_animation: BoolProperty(
|
||||
name='Bake All Objects Animations',
|
||||
description=(
|
||||
"Force exporting animation on every objects. "
|
||||
"Force exporting animation on every object. "
|
||||
"Can be useful when using constraints or driver. "
|
||||
"Also useful when exporting only selection"
|
||||
),
|
||||
@ -535,7 +535,7 @@ class ExportGLTF2_Base(ConvertGLTF2_Base):
|
||||
name='Use Current Frame as Object Rest Transformations',
|
||||
description=(
|
||||
'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
|
||||
)
|
||||
@ -543,7 +543,7 @@ class ExportGLTF2_Base(ConvertGLTF2_Base):
|
||||
export_rest_position_armature: BoolProperty(
|
||||
name='Use Rest Position Armature',
|
||||
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"
|
||||
),
|
||||
default=True
|
||||
|
@ -16,7 +16,7 @@
|
||||
bl_info = {
|
||||
"name": "Sun Position",
|
||||
"author": "Michael Martin, Damien Picard",
|
||||
"version": (3, 5, 0),
|
||||
"version": (3, 5, 2),
|
||||
"blender": (3, 2, 0),
|
||||
"location": "World > Sun Position",
|
||||
"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
|
||||
|
||||
|
||||
vertex_shader = '''
|
||||
uniform mat4 ModelViewProjectionMatrix;
|
||||
|
||||
/* 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)
|
||||
image_shader = gpu.shader.from_builtin('2D_IMAGE_COLOR')
|
||||
line_shader = gpu.shader.from_builtin('2D_FLAT_COLOR')
|
||||
|
||||
|
||||
def draw_callback_px(self, context):
|
||||
@ -49,9 +23,6 @@ def draw_callback_px(self, context):
|
||||
if self.area != context.area:
|
||||
return
|
||||
|
||||
if image.gl_load():
|
||||
raise Exception()
|
||||
|
||||
bottom = 0
|
||||
top = context.area.height
|
||||
right = context.area.width
|
||||
@ -59,39 +30,36 @@ def draw_callback_px(self, context):
|
||||
position = Vector((right, top)) / 2 + self.offset
|
||||
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))
|
||||
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})
|
||||
|
||||
with gpu.matrix.push_pop():
|
||||
gpu.matrix.translate(position)
|
||||
gpu.matrix.scale(scale)
|
||||
|
||||
shader.bind()
|
||||
shader.uniform_sampler("image", texture)
|
||||
shader.uniform_float("exposure", self.exposure)
|
||||
batch.draw(shader)
|
||||
image_shader.bind()
|
||||
image_shader.uniform_sampler("image", texture)
|
||||
image_shader.uniform_float("color", (self.exposure, self.exposure, self.exposure, 1.0))
|
||||
batch.draw(image_shader)
|
||||
|
||||
# Crosshair
|
||||
# vertical
|
||||
coords = ((self.mouse_position[0], bottom), (self.mouse_position[0], top))
|
||||
colors = ((1,) * 4,) * 2
|
||||
shader = gpu.shader.from_builtin('2D_FLAT_COLOR')
|
||||
batch = batch_for_shader(shader, 'LINES',
|
||||
batch = batch_for_shader(line_shader, 'LINES',
|
||||
{"pos": coords, "color": colors})
|
||||
shader.bind()
|
||||
batch.draw(shader)
|
||||
line_shader.bind()
|
||||
batch.draw(line_shader)
|
||||
|
||||
# horizontal
|
||||
if bottom <= self.mouse_position[1] <= top:
|
||||
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})
|
||||
shader.bind()
|
||||
batch.draw(shader)
|
||||
line_shader.bind()
|
||||
batch.draw(line_shader)
|
||||
|
||||
|
||||
class SUNPOS_OT_ShowHdr(bpy.types.Operator):
|
||||
|
@ -311,7 +311,7 @@ class SunPosAddonPreferences(AddonPreferences):
|
||||
box = layout.box()
|
||||
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.prop(self, "show_refraction")
|
||||
flow.prop(self, "show_overlays")
|
||||
|
@ -432,10 +432,10 @@ translations_tuple = (
|
||||
("fr_FR", "Projection inconnue",
|
||||
(False, ())),
|
||||
),
|
||||
(("*", "Show options or labels:"),
|
||||
(("*", "Show options and info:"),
|
||||
(("scripts/addons/sun_position/properties.py:297",),
|
||||
()),
|
||||
("fr_FR", "Afficher les options et étiquettes :",
|
||||
("fr_FR", "Afficher les options et infos :",
|
||||
(False, ())),
|
||||
),
|
||||
(("*", "ERROR: Could not parse coordinates"),
|
||||
|
Loading…
Reference in New Issue
Block a user