mirror of
https://github.com/Relintai/broken_seals.git
synced 2024-12-18 01:06:47 +01:00
Renamed output.gd to output_image.gd and implemented it's logic.
This commit is contained in:
parent
52858a6970
commit
8758111bf6
@ -40,7 +40,7 @@ default_color = Color( 0, 0, 0, 1 )
|
|||||||
|
|
||||||
[sub_resource type="Resource" id=5]
|
[sub_resource type="Resource" id=5]
|
||||||
script = ExtResource( 4 )
|
script = ExtResource( 4 )
|
||||||
graph_position = Vector2( -260, -340 )
|
graph_position = Vector2( -340, -360 )
|
||||||
shape_type = 1
|
shape_type = 1
|
||||||
sides = 4
|
sides = 4
|
||||||
radius = SubResource( 4 )
|
radius = SubResource( 4 )
|
||||||
|
@ -1,14 +0,0 @@
|
|||||||
tool
|
|
||||||
extends MMNode
|
|
||||||
|
|
||||||
var image : Resource
|
|
||||||
|
|
||||||
func _init_properties():
|
|
||||||
image = MMNodeUniversalProperty.new()
|
|
||||||
image.default_type = MMNodeUniversalProperty.MMNodeUniversalPropertyDefaultType.DEFAULT_TYPE_IMAGE
|
|
||||||
image.input_slot_type = MMNodeUniversalProperty.SlotTypes.SLOT_TYPE_UNIVERSAL
|
|
||||||
image.slot_name = "radius"
|
|
||||||
image.value_step = 0.05
|
|
||||||
|
|
||||||
func _register_methods(mm_graph_node) -> void:
|
|
||||||
mm_graph_node.add_slot_texture_universal(image)
|
|
42
game/addons/mat_maker_gd/nodes/other/output_image.gd
Normal file
42
game/addons/mat_maker_gd/nodes/other/output_image.gd
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
tool
|
||||||
|
extends MMNode
|
||||||
|
|
||||||
|
var image : Resource
|
||||||
|
|
||||||
|
var postfix : String = ""
|
||||||
|
|
||||||
|
func _init_properties():
|
||||||
|
image = MMNodeUniversalProperty.new()
|
||||||
|
image.default_type = MMNodeUniversalProperty.MMNodeUniversalPropertyDefaultType.DEFAULT_TYPE_IMAGE
|
||||||
|
image.input_slot_type = MMNodeUniversalProperty.SlotTypes.SLOT_TYPE_UNIVERSAL
|
||||||
|
image.slot_name = "image"
|
||||||
|
|
||||||
|
register_input_property(image)
|
||||||
|
|
||||||
|
func _register_methods(mm_graph_node) -> void:
|
||||||
|
mm_graph_node.add_slot_texture_universal(image)
|
||||||
|
mm_graph_node.add_slot_line_edit(MMNodeUniversalProperty.SlotTypes.SLOT_TYPE_NONE, MMNodeUniversalProperty.SlotTypes.SLOT_TYPE_NONE, "get_postfix", "set_postfix", "postfix")
|
||||||
|
|
||||||
|
func _render(material) -> void:
|
||||||
|
var img : Image = image.get_active_image()
|
||||||
|
|
||||||
|
if !img:
|
||||||
|
return
|
||||||
|
|
||||||
|
var matpath : String = material.get_path()
|
||||||
|
|
||||||
|
if matpath == "":
|
||||||
|
return
|
||||||
|
|
||||||
|
var matbn : String = matpath.get_basename()
|
||||||
|
var final_file_name : String = matbn + postfix + ".png"
|
||||||
|
|
||||||
|
img.save_png(final_file_name)
|
||||||
|
|
||||||
|
func get_postfix() -> String:
|
||||||
|
return postfix
|
||||||
|
|
||||||
|
func set_postfix(pf : String) -> void:
|
||||||
|
postfix = pf
|
||||||
|
|
||||||
|
set_dirty(true)
|
Loading…
Reference in New Issue
Block a user