mirror of
https://github.com/Relintai/GraphicsEditor.git
synced 2024-11-12 08:15:17 +01:00
fix load image, fixed layer sort, added lock layer, added show current pixel color
This commit is contained in:
parent
e51ae47bcf
commit
d1e58f7c55
@ -1,3 +1,3 @@
|
||||
source_md5="e0848eef5591cbefcdd580e2266df32a"
|
||||
dest_md5="b383e9e9635223c43c25b6c9c30e158d"
|
||||
dest_md5="b3df823cc5d041e30f8a45acd8b3f3ef"
|
||||
|
||||
|
Binary file not shown.
@ -1,3 +1,3 @@
|
||||
source_md5="ed7ea9ed6750cf2fbe5141c6745f1a80"
|
||||
dest_md5="b53ed83de9acfb64b40bb7e19266a861"
|
||||
dest_md5="3390da8e4ea6b4b38e0ba03ce8b0e3a7"
|
||||
|
||||
|
Binary file not shown.
@ -15,6 +15,7 @@ var mouse_on_top
|
||||
var layers : Array = [] # Key: layer_name, val: GELayer
|
||||
var active_layer: GELayer
|
||||
var preview_layer: GELayer
|
||||
var tool_layer: GELayer
|
||||
var canvas_layers: Control
|
||||
|
||||
var canvas
|
||||
@ -47,25 +48,23 @@ func _enter_tree():
|
||||
|
||||
active_layer = add_new_layer("Layer1")
|
||||
preview_layer = add_new_layer("Preview")
|
||||
tool_layer = add_new_layer("Tool")
|
||||
|
||||
set_process(true)
|
||||
|
||||
|
||||
func _process(delta):
|
||||
if not Engine.is_editor_hint():
|
||||
return
|
||||
var mouse_position = get_local_mouse_position()
|
||||
var rect = Rect2(Vector2(0, 0), rect_size)
|
||||
mouse_in_region = rect.has_point(mouse_position)
|
||||
|
||||
|
||||
func _draw():
|
||||
if not Engine.is_editor_hint():
|
||||
return
|
||||
for layer in layers:
|
||||
layer.update_texture()
|
||||
|
||||
preview_layer.update_texture()
|
||||
tool_layer.update_texture()
|
||||
|
||||
|
||||
func resize(width: int, height: int):
|
||||
@ -78,6 +77,7 @@ func resize(width: int, height: int):
|
||||
set_canvas_height(height)
|
||||
|
||||
preview_layer.resize(width, height)
|
||||
tool_layer.resize(width, height)
|
||||
for layer in layers:
|
||||
layer.resize(width, height)
|
||||
|
||||
@ -93,13 +93,6 @@ func set_pixel_size(size: int):
|
||||
set_big_grid_size(big_grid_size)
|
||||
set_canvas_width(canvas_width)
|
||||
set_canvas_height(canvas_height)
|
||||
|
||||
return
|
||||
if preview_layer == null:
|
||||
return
|
||||
preview_layer.resize(canvas_width, canvas_height)
|
||||
for layer in layers:
|
||||
layer.resize(canvas_width, canvas_height)
|
||||
|
||||
|
||||
func set_grid_size(size):
|
||||
@ -159,7 +152,7 @@ func remove_layer(layer_name: String):
|
||||
del_layer.clear()
|
||||
if del_layer == active_layer:
|
||||
for layer in layers:
|
||||
if layer == preview_layer or layer == active_layer:
|
||||
if layer == preview_layer or layer == active_layer or layer == tool_layer:
|
||||
continue
|
||||
active_layer = layer
|
||||
break
|
||||
@ -174,18 +167,23 @@ func add_new_layer(layer_name: String):
|
||||
var layer = GELayer.new()
|
||||
layer.name = layer_name
|
||||
|
||||
var texture_rect = TextureRect.new()
|
||||
canvas_layers.add_child(texture_rect)
|
||||
texture_rect.expand = true
|
||||
texture_rect.anchor_right = 1
|
||||
texture_rect.anchor_bottom = 1
|
||||
texture_rect.margin_right = 0
|
||||
texture_rect.margin_bottom = 0
|
||||
texture_rect.mouse_filter = Control.MOUSE_FILTER_IGNORE
|
||||
|
||||
layer.create(texture_rect, canvas_width, canvas_height)
|
||||
if layer_name != "Preview":
|
||||
if layer_name == "Preview":
|
||||
layer.create($PreviewLayer, canvas_width, canvas_height)
|
||||
elif layer_name == "Tool":
|
||||
layer.create($ToolPreviewLayer, canvas_width, canvas_height)
|
||||
else:
|
||||
var texture_rect = TextureRect.new()
|
||||
texture_rect.name = layer_name
|
||||
canvas_layers.add_child(texture_rect, true)
|
||||
texture_rect.expand = true
|
||||
texture_rect.anchor_right = 1
|
||||
texture_rect.anchor_bottom = 1
|
||||
texture_rect.margin_right = 0
|
||||
texture_rect.margin_bottom = 0
|
||||
texture_rect.mouse_filter = Control.MOUSE_FILTER_IGNORE
|
||||
layer.create(texture_rect, canvas_width, canvas_height)
|
||||
layers.append(layer)
|
||||
|
||||
return layer
|
||||
|
||||
|
||||
@ -219,32 +217,23 @@ func find_layer_by_name(layer_name: String):
|
||||
return null
|
||||
|
||||
|
||||
func toggle_lock_layer(layer_name: String):
|
||||
find_layer_by_name(layer_name).toggle_lock()
|
||||
|
||||
|
||||
func is_active_layer_locked() -> bool:
|
||||
return active_layer.locked
|
||||
|
||||
|
||||
func move_layer_forward(layer_name: String):
|
||||
var remove_pos = -1
|
||||
var layer
|
||||
for i in range(layers.size()):
|
||||
if layers[i].name == layer_name:
|
||||
remove_pos = i
|
||||
layer = layers[i]
|
||||
print("from: ", i)
|
||||
break
|
||||
layers.erase(layer)
|
||||
print("forw to: ", max(remove_pos - 1, 0))
|
||||
layers.insert(max(remove_pos - 1, 0), layer)
|
||||
var layer = find_layer_by_name(layer_name).texture_rect_ref
|
||||
var new_idx = max(layer.get_index() - 1, 0)
|
||||
canvas_layers.move_child(layer, new_idx)
|
||||
|
||||
|
||||
func move_layer_back(layer_name: String):
|
||||
var remove_pos = -1
|
||||
var layer
|
||||
for i in range(layers.size()):
|
||||
if layers[i].name == layer_name:
|
||||
remove_pos = i
|
||||
layer = layers[i]
|
||||
print("from: ", i)
|
||||
break
|
||||
layers.erase(layer)
|
||||
print("back to: ", min(remove_pos + 1, layers.size()))
|
||||
layers.insert(min(remove_pos + 1, layers.size()), layer)
|
||||
var layer = find_layer_by_name(layer_name).texture_rect_ref
|
||||
canvas_layers.move_child(layer, layer.get_index() + 1)
|
||||
|
||||
|
||||
func select_layer(layer_name: String):
|
||||
|
@ -87,8 +87,6 @@ func _ready():
|
||||
|
||||
|
||||
func _input(event):
|
||||
if not Engine.is_editor_hint():
|
||||
return
|
||||
if Rect2(Vector2(), paint_canvas_container_node.rect_size).has_point(
|
||||
paint_canvas_container_node.get_local_mouse_position()):
|
||||
mouse_in_region = true
|
||||
@ -105,7 +103,9 @@ func _input(event):
|
||||
|
||||
_handle_zoom(event)
|
||||
|
||||
if paint_canvas and (paint_canvas.mouse_in_region and paint_canvas.mouse_on_top):
|
||||
if paint_canvas and \
|
||||
not paint_canvas.is_active_layer_locked() and \
|
||||
(paint_canvas.mouse_in_region and paint_canvas.mouse_on_top):
|
||||
match brush_mode:
|
||||
Tools.BUCKET:
|
||||
if _current_action == null:
|
||||
@ -133,8 +133,6 @@ var last_cell_color = Color()
|
||||
|
||||
# warning-ignore:unused_argument
|
||||
func _process(delta):
|
||||
if not Engine.is_editor_hint():
|
||||
return
|
||||
if not mouse_on_top or not mouse_in_region:
|
||||
return
|
||||
update_text_info()
|
||||
@ -149,16 +147,29 @@ func _process(delta):
|
||||
if mouse_on_top and mouse_in_region:
|
||||
_handle_scroll()
|
||||
|
||||
#Update commonly used variables
|
||||
var grid_size = paint_canvas.pixel_size
|
||||
mouse_position = paint_canvas.get_local_mouse_position()
|
||||
canvas_position = paint_canvas_container_node.rect_position
|
||||
canvas_mouse_position = Vector2(mouse_position.x - canvas_position.x, mouse_position.y - canvas_position.y)
|
||||
cell_mouse_position = Vector2(floor(canvas_mouse_position.x / grid_size), floor(canvas_mouse_position.y / grid_size))
|
||||
cell_color = paint_canvas.get_pixel(cell_mouse_position.x, cell_mouse_position.y)
|
||||
#Update commonly used variables
|
||||
var grid_size = paint_canvas.pixel_size
|
||||
mouse_position = paint_canvas.get_local_mouse_position()
|
||||
canvas_position = paint_canvas_container_node.rect_position
|
||||
canvas_mouse_position = Vector2(mouse_position.x - canvas_position.x, mouse_position.y - canvas_position.y)
|
||||
cell_mouse_position = Vector2(floor(canvas_mouse_position.x / grid_size), floor(canvas_mouse_position.y / grid_size))
|
||||
if cell_mouse_position.x >= 0 and cell_mouse_position.y >= 0:
|
||||
cell_color = paint_canvas.get_pixel(cell_mouse_position.x, cell_mouse_position.y)
|
||||
|
||||
if (paint_canvas.mouse_in_region and paint_canvas.mouse_on_top):
|
||||
brush_process()
|
||||
if not paint_canvas.is_active_layer_locked():
|
||||
brush_process()
|
||||
|
||||
paint_canvas.tool_layer.clear()
|
||||
#TODO add here brush prefab drawing
|
||||
paint_canvas._set_pixel(paint_canvas.tool_layer,
|
||||
cell_mouse_position.x, cell_mouse_position.y, selected_color)
|
||||
paint_canvas.tool_layer.update_texture()
|
||||
else:
|
||||
paint_canvas.tool_layer.clear()
|
||||
paint_canvas.tool_layer.update_texture()
|
||||
|
||||
|
||||
|
||||
#Render the highlighting stuff
|
||||
|
||||
@ -237,7 +248,7 @@ func _handle_cut():
|
||||
for idx in range(_selection_cells.size()):
|
||||
var pixel = _selection_cells[idx]
|
||||
var color = _selection_colors[idx]
|
||||
pixel -= _cut_pos
|
||||
pixel -= _cut_pos + _cut_size / 2
|
||||
pixel += pixel_pos
|
||||
paint_canvas.set_pixel_v(pixel, color)
|
||||
else:
|
||||
@ -247,7 +258,7 @@ func _handle_cut():
|
||||
for idx in range(_selection_cells.size()):
|
||||
var pixel = _selection_cells[idx]
|
||||
var color = _selection_colors[idx]
|
||||
pixel -= _cut_pos
|
||||
pixel -= _cut_pos + _cut_size / 2
|
||||
pixel += cell_mouse_position
|
||||
paint_canvas.set_preview_pixel_v(pixel, color)
|
||||
_last_preview_draw_cell_pos = cell_mouse_position
|
||||
@ -256,13 +267,10 @@ func _handle_cut():
|
||||
func brush_process():
|
||||
if _just_cut:
|
||||
_handle_cut()
|
||||
update()
|
||||
paint_canvas.update()
|
||||
return
|
||||
|
||||
if Input.is_mouse_button_pressed(BUTTON_LEFT):
|
||||
update()
|
||||
paint_canvas.update()
|
||||
if _current_action == null:
|
||||
_current_action = get_action()
|
||||
|
||||
@ -285,6 +293,8 @@ func brush_process():
|
||||
do_action([cell_mouse_position, last_cell_mouse_position, selected_color])
|
||||
Tools.RAINBOW:
|
||||
do_action([cell_mouse_position, last_cell_mouse_position])
|
||||
update()
|
||||
paint_canvas.update()
|
||||
|
||||
elif Input.is_mouse_button_pressed(BUTTON_RIGHT):
|
||||
update()
|
||||
@ -509,21 +519,21 @@ func select_layer(layer_name: String):
|
||||
paint_canvas.select_layer(layer_name)
|
||||
|
||||
|
||||
func lock_layer(button, layer_name: String):
|
||||
paint_canvas.toggle_lock_layer(layer_name)
|
||||
|
||||
|
||||
func add_new_layer():
|
||||
var new_layer_button = layer_buttons.get_child(0).duplicate()
|
||||
layer_buttons.add_child_below_node(
|
||||
layer_buttons.get_child(layer_buttons.get_child_count() - 1), new_layer_button, true)
|
||||
_total_added_layers += 1
|
||||
new_layer_button.text = "Layer " + str(_total_added_layers)
|
||||
|
||||
var layer: GELayer = paint_canvas.add_new_layer(new_layer_button.name)
|
||||
|
||||
new_layer_button.find_node("Select").text = "Layer " + str(_total_added_layers)
|
||||
_layer_button_ref[new_layer_button.name] = new_layer_button
|
||||
|
||||
_connect_layer_buttons()
|
||||
|
||||
var layer: GELayer = paint_canvas.add_new_layer(new_layer_button.name)
|
||||
print("added layer: ", layer.name)
|
||||
|
||||
return layer
|
||||
|
||||
|
||||
@ -546,49 +556,53 @@ func duplicate_active_layer():
|
||||
layer_buttons.get_child(layer_buttons.get_child_count() - 1), new_layer_button, true)
|
||||
|
||||
_total_added_layers += 1 # for keeping track...
|
||||
new_layer_button.text = "Layer " + str(_total_added_layers)
|
||||
new_layer_button.find_node("Select").text = "Layer " + str(_total_added_layers)
|
||||
|
||||
var new_layer = paint_canvas.duplicate_layer(paint_canvas.active_layer.name, new_layer_button.name)
|
||||
|
||||
_layer_button_ref[new_layer.name] = new_layer_button
|
||||
|
||||
new_layer_button.disconnect("pressed", self, "select_layer")
|
||||
new_layer_button.find_node("Select").disconnect("pressed", self, "select_layer")
|
||||
new_layer_button.find_node("Visible").disconnect("pressed", self, "toggle_layer_visibility")
|
||||
new_layer_button.find_node("Up").disconnect("pressed", self, "move_down")
|
||||
new_layer_button.find_node("Down").disconnect("pressed", self, "move_up")
|
||||
new_layer_button.find_node("Lock").disconnect("pressed", self, "lock_layer")
|
||||
|
||||
new_layer_button.connect("pressed", self, "select_layer", [new_layer_button.name])
|
||||
new_layer_button.find_node("Select").connect("pressed", self, "select_layer", [new_layer_button.name])
|
||||
new_layer_button.find_node("Visible").connect("pressed", self, "toggle_layer_visibility",
|
||||
[new_layer_button.find_node("Visible"), new_layer_button.name])
|
||||
new_layer_button.find_node("Up").connect("pressed", self, "move_down", [new_layer_button])
|
||||
new_layer_button.find_node("Down").connect("pressed", self, "move_up", [new_layer_button])
|
||||
new_layer_button.find_node("Lock").connect("pressed", self, "lock_layer", [new_layer_button, new_layer_button.name])
|
||||
|
||||
print("added layer: ", new_layer.name, " (total:", layer_buttons.size(), ")")
|
||||
|
||||
|
||||
func move_up(layer_btn):
|
||||
var new_idx = min(layer_btn.get_index() + 1, layer_buttons.get_child_count())
|
||||
print("move_down: ", layer_btn.name, " from ", layer_btn.get_index(), " to ", new_idx)
|
||||
print("move_up: ", layer_btn.name, " from ", layer_btn.get_index(), " to ", new_idx)
|
||||
layer_buttons.move_child(layer_btn, new_idx)
|
||||
paint_canvas.move_layer_back(layer_btn.name)
|
||||
|
||||
|
||||
func move_down(layer_btn):
|
||||
var new_idx = max(layer_btn.get_index() - 1, 0)
|
||||
print("move_up: ", layer_btn.name, " from ", layer_btn.get_index(), " to ", new_idx)
|
||||
print("move_down: ", layer_btn.name, " from ", layer_btn.get_index(), " to ", new_idx)
|
||||
layer_buttons.move_child(layer_btn, new_idx)
|
||||
paint_canvas.move_layer_forward(layer_btn.name)
|
||||
|
||||
|
||||
func _connect_layer_buttons():
|
||||
for layer_btn in layer_buttons.get_children():
|
||||
if layer_btn.is_connected("pressed", self, "select_layer"):
|
||||
if layer_btn.find_node("Select").is_connected("pressed", self, "select_layer"):
|
||||
continue
|
||||
layer_btn.connect("pressed", self, "select_layer", [layer_btn.name])
|
||||
layer_btn.find_node("Select").connect("pressed", self, "select_layer", [layer_btn.name])
|
||||
layer_btn.find_node("Visible").connect("pressed", self, "toggle_layer_visibility",
|
||||
[layer_btn.find_node("Visible"), layer_btn.name])
|
||||
layer_btn.find_node("Up").connect("pressed", self, "move_down", [layer_btn])
|
||||
layer_btn.find_node("Down").connect("pressed", self, "move_up", [layer_btn])
|
||||
layer_btn.find_node("Lock").connect("pressed", self, "lock_layer",
|
||||
[layer_btn, layer_btn.name])
|
||||
|
||||
|
||||
func _on_Button_pressed():
|
||||
|
File diff suppressed because one or more lines are too long
@ -6,6 +6,7 @@ var name
|
||||
var pixels # array of pixels (colors), idx repressents x and y
|
||||
var layer_width
|
||||
var visible = true setget set_visible
|
||||
var locked = false
|
||||
|
||||
var texture: ImageTexture
|
||||
var image: Image
|
||||
@ -71,6 +72,9 @@ func clear():
|
||||
for idx in range(pixels.size()):
|
||||
if pixels[idx] != Color.transparent:
|
||||
pixels[idx] = Color.transparent
|
||||
var pos = GEUtils.to_2D(idx, layer_width)
|
||||
set_pixel(pos.x, pos.y, Color.transparent)
|
||||
|
||||
|
||||
func update_texture():
|
||||
texture.create_from_image(image, 0)
|
||||
@ -84,3 +88,5 @@ func set_visible(vis: bool):
|
||||
texture_rect_ref.visible = visible
|
||||
|
||||
|
||||
func toggle_lock():
|
||||
locked = not locked
|
||||
|
@ -1,42 +1,81 @@
|
||||
[gd_scene load_steps=6 format=2]
|
||||
[gd_scene load_steps=11 format=2]
|
||||
|
||||
[ext_resource path="res://addons/graphics_editor/assets/minidotta_invis.png" type="Texture" id=1]
|
||||
[ext_resource path="res://addons/graphics_editor/assets/minidotta.png" type="Texture" id=2]
|
||||
[ext_resource path="res://addons/graphics_editor/assets/arrow_down.png" type="Texture" id=3]
|
||||
[ext_resource path="res://addons/graphics_editor/assets/arrow_up.png" type="Texture" id=4]
|
||||
[ext_resource path="res://addons/graphics_editor/assets/lock_layer_1.png" type="Texture" id=5]
|
||||
[ext_resource path="res://addons/graphics_editor/assets/unlock_layer.png" type="Texture" id=6]
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id=4]
|
||||
bg_color = Color( 0.180392, 0.176471, 0.176471, 1 )
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id=1]
|
||||
bg_color = Color( 0.25098, 0.25098, 0.25098, 1 )
|
||||
bg_color = Color( 0.25098, 0.25098, 0.25098, 0 )
|
||||
|
||||
[node name="Layer1" type="Button" groups=[
|
||||
[sub_resource type="StyleBoxFlat" id=2]
|
||||
bg_color = Color( 0.6, 0.6, 0.6, 0 )
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id=3]
|
||||
bg_color = Color( 0.6, 0.6, 0.6, 0 )
|
||||
|
||||
[node name="Layer1" type="Panel"]
|
||||
show_behind_parent = true
|
||||
anchor_right = 0.113281
|
||||
anchor_bottom = 0.0416667
|
||||
margin_bottom = -1.90735e-06
|
||||
rect_min_size = Vector2( 0, 32 )
|
||||
mouse_filter = 2
|
||||
custom_styles/panel = SubResource( 4 )
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": true
|
||||
}
|
||||
|
||||
[node name="Select" type="Button" parent="." groups=[
|
||||
"layer_button",
|
||||
]]
|
||||
margin_right = 114.0
|
||||
margin_bottom = 20.0
|
||||
rect_min_size = Vector2( 0, 32 )
|
||||
anchor_right = 0.827586
|
||||
anchor_bottom = 1.0
|
||||
custom_styles/hover = SubResource( 1 )
|
||||
custom_styles/pressed = SubResource( 1 )
|
||||
custom_styles/focus = SubResource( 1 )
|
||||
custom_styles/disabled = SubResource( 1 )
|
||||
custom_styles/normal = SubResource( 1 )
|
||||
text = "Layer 1"
|
||||
align = 2
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
"_edit_use_anchors_": true
|
||||
}
|
||||
|
||||
[node name="Visible" type="CheckButton" parent="."]
|
||||
anchor_top = 0.5
|
||||
anchor_bottom = 0.5
|
||||
margin_top = -12.0
|
||||
margin_right = 28.0
|
||||
margin_bottom = 12.0
|
||||
margin_left = 3.0
|
||||
margin_top = -8.5
|
||||
margin_right = 19.0
|
||||
margin_bottom = 7.5
|
||||
custom_icons/off = ExtResource( 1 )
|
||||
custom_icons/on = ExtResource( 2 )
|
||||
custom_styles/normal = SubResource( 2 )
|
||||
pressed = true
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="Lock" type="CheckButton" parent="."]
|
||||
anchor_top = 0.5
|
||||
anchor_bottom = 0.5
|
||||
margin_left = 22.0
|
||||
margin_top = -11.0
|
||||
margin_right = 46.0
|
||||
margin_bottom = 11.0
|
||||
custom_icons/off = ExtResource( 6 )
|
||||
custom_icons/on = ExtResource( 5 )
|
||||
custom_styles/normal = SubResource( 3 )
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="."]
|
||||
anchor_left = 1.0
|
||||
anchor_right = 1.0
|
||||
|
BIN
addons/graphics_editor/assets/lock_layer.png
Normal file
BIN
addons/graphics_editor/assets/lock_layer.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 251 B |
34
addons/graphics_editor/assets/lock_layer.png.import
Normal file
34
addons/graphics_editor/assets/lock_layer.png.import
Normal file
@ -0,0 +1,34 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/lock_layer.png-33f1e8f880088be39b50ce41c8568529.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://addons/graphics_editor/assets/lock_layer.png"
|
||||
dest_files=[ "res://.import/lock_layer.png-33f1e8f880088be39b50ce41c8568529.stex" ]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_mode=0
|
||||
compress/bptc_ldr=0
|
||||
compress/normal_map=0
|
||||
flags/repeat=0
|
||||
flags/filter=false
|
||||
flags/mipmaps=false
|
||||
flags/anisotropic=false
|
||||
flags/srgb=2
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/HDR_as_SRGB=false
|
||||
process/invert_color=false
|
||||
stream=false
|
||||
size_limit=0
|
||||
detect_3d=true
|
||||
svg/scale=1.0
|
BIN
addons/graphics_editor/assets/lock_layer_1.png
Normal file
BIN
addons/graphics_editor/assets/lock_layer_1.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 242 B |
34
addons/graphics_editor/assets/lock_layer_1.png.import
Normal file
34
addons/graphics_editor/assets/lock_layer_1.png.import
Normal file
@ -0,0 +1,34 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/lock_layer_1.png-c7f56bc948259e1b922d48c7fca34e93.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://addons/graphics_editor/assets/lock_layer_1.png"
|
||||
dest_files=[ "res://.import/lock_layer_1.png-c7f56bc948259e1b922d48c7fca34e93.stex" ]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_mode=0
|
||||
compress/bptc_ldr=0
|
||||
compress/normal_map=0
|
||||
flags/repeat=0
|
||||
flags/filter=false
|
||||
flags/mipmaps=false
|
||||
flags/anisotropic=false
|
||||
flags/srgb=2
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/HDR_as_SRGB=false
|
||||
process/invert_color=false
|
||||
stream=false
|
||||
size_limit=0
|
||||
detect_3d=true
|
||||
svg/scale=1.0
|
@ -20,7 +20,7 @@ compress/hdr_mode=0
|
||||
compress/bptc_ldr=0
|
||||
compress/normal_map=0
|
||||
flags/repeat=0
|
||||
flags/filter=true
|
||||
flags/filter=false
|
||||
flags/mipmaps=false
|
||||
flags/anisotropic=false
|
||||
flags/srgb=2
|
||||
|
@ -20,7 +20,7 @@ compress/hdr_mode=0
|
||||
compress/bptc_ldr=0
|
||||
compress/normal_map=0
|
||||
flags/repeat=0
|
||||
flags/filter=true
|
||||
flags/filter=false
|
||||
flags/mipmaps=false
|
||||
flags/anisotropic=false
|
||||
flags/srgb=2
|
||||
|
BIN
addons/graphics_editor/assets/unlock_layer.png
Normal file
BIN
addons/graphics_editor/assets/unlock_layer.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 240 B |
34
addons/graphics_editor/assets/unlock_layer.png.import
Normal file
34
addons/graphics_editor/assets/unlock_layer.png.import
Normal file
@ -0,0 +1,34 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="StreamTexture"
|
||||
path="res://.import/unlock_layer.png-fc0ace243eb1581f930731b96b257e04.stex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://addons/graphics_editor/assets/unlock_layer.png"
|
||||
dest_files=[ "res://.import/unlock_layer.png-fc0ace243eb1581f930731b96b257e04.stex" ]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_mode=0
|
||||
compress/bptc_ldr=0
|
||||
compress/normal_map=0
|
||||
flags/repeat=0
|
||||
flags/filter=true
|
||||
flags/mipmaps=false
|
||||
flags/anisotropic=false
|
||||
flags/srgb=2
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/HDR_as_SRGB=false
|
||||
process/invert_color=false
|
||||
stream=false
|
||||
size_limit=0
|
||||
detect_3d=true
|
||||
svg/scale=1.0
|
@ -41,11 +41,13 @@ func load_img():
|
||||
var layer: GELayer = owner.add_new_layer()
|
||||
|
||||
for i in range(image_data.size() / 4):
|
||||
var color = Color(image_data[i*4], image_data[i*4+1], image_data[i*4+2], image_data[i*4+3])
|
||||
var color = Color(image_data[i*4] / 255.0, image_data[i*4+1] / 255.0, image_data[i*4+2] / 255.0, image_data[i*4+3] / 255.0)
|
||||
var pos = GEUtils.to_2D(i, image.get_width())
|
||||
if pos.x > layer.layer_width:
|
||||
continue
|
||||
|
||||
layer.set_pixel(pos.x, pos.y, color)
|
||||
layer.update_texture()
|
||||
|
||||
|
||||
|
||||
|
@ -98,7 +98,7 @@ _global_script_class_icons={
|
||||
|
||||
[application]
|
||||
|
||||
config/name="TestGDNative"
|
||||
config/name="Image Editor"
|
||||
config/icon="res://icon.png"
|
||||
|
||||
[editor_plugins]
|
||||
|
Loading…
Reference in New Issue
Block a user