1
0
Fork 0
mirror of https://github.com/Orama-Interactive/Pixelorama.git synced 2025-01-18 17:19:50 +00:00

Compare commits

...

4 commits

11 changed files with 15 additions and 19 deletions

View file

@ -236,8 +236,8 @@ func display_effects(cel: BaseCel, image_override: Image = null) -> Image:
continue continue
var params := effect.params var params := effect.params
params["PXO_time"] = cel.get_frame(project).position_in_seconds(project) params["PXO_time"] = cel.get_frame(project).position_in_seconds(project)
params["PXO_frame"] = project.frames.find(cel.get_frame(project)) params["PXO_frame_index"] = project.frames.find(cel.get_frame(project))
params["PXO_layer"] = index params["PXO_layer_index"] = index
var shader_image_effect := ShaderImageEffect.new() var shader_image_effect := ShaderImageEffect.new()
shader_image_effect.generate_image(image, effect.shader, params, image_size) shader_image_effect.generate_image(image, effect.shader, params, image_size)
# Inherit effects from the parents, if their blend mode is set to pass through # Inherit effects from the parents, if their blend mode is set to pass through

View file

@ -63,7 +63,7 @@ static func create_ui_for_shader_uniforms(
var u_init := u_left_side[0].split(" ") var u_init := u_left_side[0].split(" ")
var u_type := u_init[1] var u_type := u_init[1]
var u_name := u_init[2] var u_name := u_init[2]
if u_name in ["PXO_time", "PXO_frame", "PXO_layer"]: if u_name in ["PXO_time", "PXO_frame_index", "PXO_layer_index"]:
continue continue
# Find custom data of the uniform, if any exists # Find custom data of the uniform, if any exists
# Right now it only checks if a uniform should have another type of node # Right now it only checks if a uniform should have another type of node

View file

@ -148,6 +148,7 @@ func draw_end(pos: Vector2i) -> void:
_start = Vector2i.ZERO _start = Vector2i.ZERO
_dest = Vector2i.ZERO _dest = Vector2i.ZERO
_drawing = false _drawing = false
Global.canvas.previews_sprite.texture = null
_displace_origin = false _displace_origin = false
cursor_text = "" cursor_text = ""
super.draw_end(pos) super.draw_end(pos)
@ -174,8 +175,6 @@ func draw_preview() -> void:
image.set_pixelv(point, Color.WHITE) image.set_pixelv(point, Color.WHITE)
var texture := ImageTexture.create_from_image(image) var texture := ImageTexture.create_from_image(image)
canvas.texture = texture canvas.texture = texture
else:
canvas.texture = null
func _draw_shape(origin: Vector2i, dest: Vector2i) -> void: func _draw_shape(origin: Vector2i, dest: Vector2i) -> void:

View file

@ -128,7 +128,6 @@ func draw_end(pos: Vector2i) -> void:
func draw_preview() -> void: func draw_preview() -> void:
var previews := Global.canvas.previews_sprite var previews := Global.canvas.previews_sprite
if not _drawing: if not _drawing:
previews.texture = null
return return
var points := _bezier() var points := _bezier()
var image := Image.create( var image := Image.create(
@ -207,6 +206,7 @@ func _clear() -> void:
_curve.clear_points() _curve.clear_points()
_fill_inside_rect = Rect2i() _fill_inside_rect = Rect2i()
_drawing = false _drawing = false
Global.canvas.previews_sprite.texture = null
_editing_out_control_point = false _editing_out_control_point = false
Global.canvas.previews.queue_redraw() Global.canvas.previews.queue_redraw()

View file

@ -142,6 +142,7 @@ func draw_end(pos: Vector2i) -> void:
_start = Vector2.ZERO _start = Vector2.ZERO
_dest = Vector2.ZERO _dest = Vector2.ZERO
_drawing = false _drawing = false
Global.canvas.previews_sprite.texture = null
_displace_origin = false _displace_origin = false
cursor_text = "" cursor_text = ""
super.draw_end(pos) super.draw_end(pos)
@ -163,8 +164,6 @@ func draw_preview() -> void:
image.set_pixelv(point, Color.WHITE) image.set_pixelv(point, Color.WHITE)
var texture := ImageTexture.create_from_image(image) var texture := ImageTexture.create_from_image(image)
canvas.texture = texture canvas.texture = texture
else:
canvas.texture = null
func _draw_shape() -> void: func _draw_shape() -> void:

View file

@ -68,8 +68,6 @@ func draw_preview() -> void:
image.set_pixelv(point, Color.WHITE) image.set_pixelv(point, Color.WHITE)
var texture := ImageTexture.create_from_image(image) var texture := ImageTexture.create_from_image(image)
canvas.texture = texture canvas.texture = texture
else:
canvas.texture = null
func apply_selection(_position: Vector2i) -> void: func apply_selection(_position: Vector2i) -> void:
@ -111,6 +109,7 @@ func apply_selection(_position: Vector2i) -> void:
Global.canvas.selection.big_bounding_rectangle = project.selection_map.get_used_rect() Global.canvas.selection.big_bounding_rectangle = project.selection_map.get_used_rect()
Global.canvas.selection.commit_undo("Select", undo_data) Global.canvas.selection.commit_undo("Select", undo_data)
Global.canvas.previews_sprite.texture = null
func set_ellipse(selection_map: SelectionMap, pos: Vector2i) -> void: func set_ellipse(selection_map: SelectionMap, pos: Vector2i) -> void:

View file

@ -54,8 +54,6 @@ func draw_preview() -> void:
image.set_pixelv(draw_point, Color.WHITE) image.set_pixelv(draw_point, Color.WHITE)
var texture := ImageTexture.create_from_image(image) var texture := ImageTexture.create_from_image(image)
canvas.texture = texture canvas.texture = texture
else:
canvas.texture = null
func apply_selection(_position) -> void: func apply_selection(_position) -> void:
@ -82,6 +80,7 @@ func apply_selection(_position) -> void:
Global.canvas.selection.commit_undo("Select", undo_data) Global.canvas.selection.commit_undo("Select", undo_data)
_draw_points.clear() _draw_points.clear()
_last_position = Vector2.INF _last_position = Vector2.INF
Global.canvas.previews_sprite.texture = null
func lasso_selection( func lasso_selection(

View file

@ -82,8 +82,6 @@ func draw_preview() -> void:
image.set_pixelv(draw_point, Color.WHITE) image.set_pixelv(draw_point, Color.WHITE)
var texture := ImageTexture.create_from_image(image) var texture := ImageTexture.create_from_image(image)
canvas.texture = texture canvas.texture = texture
else:
canvas.texture = null
func apply_selection(pos: Vector2i) -> void: func apply_selection(pos: Vector2i) -> void:
@ -111,6 +109,7 @@ func apply_selection(pos: Vector2i) -> void:
Global.canvas.selection.commit_undo("Select", undo_data) Global.canvas.selection.commit_undo("Select", undo_data)
_draw_points.clear() _draw_points.clear()
_last_position = Vector2.INF _last_position = Vector2.INF
Global.canvas.previews_sprite.texture = null
func paint_selection( func paint_selection(

View file

@ -89,8 +89,6 @@ func draw_preview() -> void:
image.set_pixelv(draw_point, Color.WHITE) image.set_pixelv(draw_point, Color.WHITE)
var texture := ImageTexture.create_from_image(image) var texture := ImageTexture.create_from_image(image)
previews.texture = texture previews.texture = texture
else:
previews.texture = null
func apply_selection(pos: Vector2i) -> void: func apply_selection(pos: Vector2i) -> void:
@ -122,6 +120,7 @@ func apply_selection(pos: Vector2i) -> void:
func _clear() -> void: func _clear() -> void:
_ongoing_selection = false _ongoing_selection = false
Global.canvas.previews_sprite.texture = null
_draw_points.clear() _draw_points.clear()
_ready_to_apply = false _ready_to_apply = false
Global.canvas.previews.queue_redraw() Global.canvas.previews.queue_redraw()

View file

@ -83,7 +83,9 @@ func _set_node_values() -> void:
elif node is CheckBox: elif node is CheckBox:
node.button_pressed = value node.button_pressed = value
elif node is GradientEditNode: elif node is GradientEditNode:
node.gradient = value var gradient_tex := GradientTexture2D.new()
gradient_tex.gradient = value
node.set_gradient_texture(gradient_tex)
func _set_value_from_node(value, prop: String) -> void: func _set_value_from_node(value, prop: String) -> void:

View file

@ -180,8 +180,8 @@ func _apply_effect(layer: BaseLayer, effect: LayerEffect) -> void:
var image_size := cel_image.get_size() var image_size := cel_image.get_size()
var params := effect.params var params := effect.params
params["PXO_time"] = frame.position_in_seconds(project) params["PXO_time"] = frame.position_in_seconds(project)
params["PXO_frame"] = i params["PXO_frame_index"] = i
params["PXO_layer"] = layer.index params["PXO_layer_index"] = layer.index
var shader_image_effect := ShaderImageEffect.new() var shader_image_effect := ShaderImageEffect.new()
shader_image_effect.generate_image(cel_image, effect.shader, params, image_size) shader_image_effect.generate_image(cel_image, effect.shader, params, image_size)