mirror of
https://github.com/Relintai/broken_seals.git
synced 2025-01-15 02:01:09 +01:00
sd_shape_arc and sd_shape_rhombus nodes.
This commit is contained in:
parent
2984eef392
commit
df1a1c59a2
@ -1,4 +1,4 @@
|
||||
[gd_resource type="Resource" load_steps=55 format=2]
|
||||
[gd_resource type="Resource" load_steps=61 format=2]
|
||||
|
||||
[ext_resource path="res://addons/mat_maker_gd/nodes/mm_material.gd" type="Script" id=1]
|
||||
[ext_resource path="res://addons/mat_maker_gd/nodes/noise/noise.gd" type="Script" id=2]
|
||||
@ -14,6 +14,7 @@
|
||||
[ext_resource path="res://addons/mat_maker_gd/nodes/pattern/bricks.gd" type="Script" id=12]
|
||||
[ext_resource path="res://addons/mat_maker_gd/nodes/sdf2d/sd_show.gd" type="Script" id=13]
|
||||
[ext_resource path="res://addons/mat_maker_gd/nodes/sdf2d/sd_shape_circle.gd" type="Script" id=14]
|
||||
[ext_resource path="res://addons/mat_maker_gd/nodes/sdf2d/sd_shape_box.gd" type="Script" id=15]
|
||||
|
||||
[sub_resource type="Resource" id=3]
|
||||
script = ExtResource( 5 )
|
||||
@ -370,7 +371,49 @@ output = SubResource( 53 )
|
||||
center = Vector2( 0, 0 )
|
||||
radius = 0.4
|
||||
|
||||
[sub_resource type="Resource" id=56]
|
||||
script = ExtResource( 5 )
|
||||
default_type = 5
|
||||
default_int = 0
|
||||
default_float = 0.0
|
||||
default_vector2 = Vector2( 0, 0 )
|
||||
default_vector3 = Vector3( 0, 0, 0 )
|
||||
default_color = Color( 0, 0, 0, 1 )
|
||||
|
||||
[sub_resource type="Resource" id=57]
|
||||
script = ExtResource( 5 )
|
||||
default_type = 1
|
||||
default_int = 0
|
||||
default_float = 0.0
|
||||
default_vector2 = Vector2( 0, 0 )
|
||||
default_vector3 = Vector3( 0, 0, 0 )
|
||||
default_color = Color( 0, 0, 0, 1 )
|
||||
|
||||
[sub_resource type="Resource" id=58]
|
||||
script = ExtResource( 13 )
|
||||
graph_position = Vector2( 380, -860 )
|
||||
image = SubResource( 56 )
|
||||
input = SubResource( 57 )
|
||||
bevel = 0.0
|
||||
base = 0.0
|
||||
|
||||
[sub_resource type="Resource" id=59]
|
||||
script = ExtResource( 5 )
|
||||
default_type = 1
|
||||
default_int = 0
|
||||
default_float = 0.0
|
||||
default_vector2 = Vector2( 0, 0 )
|
||||
default_vector3 = Vector3( 0, 0, 0 )
|
||||
default_color = Color( 0, 0, 0, 1 )
|
||||
|
||||
[sub_resource type="Resource" id=60]
|
||||
script = ExtResource( 15 )
|
||||
graph_position = Vector2( 740, -820 )
|
||||
output = SubResource( 59 )
|
||||
center = Vector2( 0, 0 )
|
||||
size = Vector2( 0.3, 0.2 )
|
||||
|
||||
[resource]
|
||||
script = ExtResource( 1 )
|
||||
image_size = Vector2( 128, 128 )
|
||||
nodes = [ SubResource( 5 ), SubResource( 6 ), SubResource( 12 ), SubResource( 15 ), SubResource( 18 ), SubResource( 21 ), SubResource( 24 ), SubResource( 27 ), SubResource( 39 ), SubResource( 42 ), SubResource( 45 ), SubResource( 49 ), SubResource( 54 ) ]
|
||||
nodes = [ SubResource( 5 ), SubResource( 6 ), SubResource( 12 ), SubResource( 15 ), SubResource( 18 ), SubResource( 21 ), SubResource( 24 ), SubResource( 27 ), SubResource( 39 ), SubResource( 42 ), SubResource( 45 ), SubResource( 49 ), SubResource( 54 ), SubResource( 58 ), SubResource( 60 ) ]
|
||||
|
58
game/addons/mat_maker_gd/nodes/sdf2d/sd_shape_arc.gd
Normal file
58
game/addons/mat_maker_gd/nodes/sdf2d/sd_shape_arc.gd
Normal file
@ -0,0 +1,58 @@
|
||||
tool
|
||||
extends MMNode
|
||||
|
||||
const Commons = preload("res://addons/mat_maker_gd/nodes/common/commons.gd")
|
||||
var SDF2D = preload("res://addons/mat_maker_gd/nodes/common/sdf2d.gd")
|
||||
|
||||
export(Resource) var output : Resource
|
||||
export(Vector2) var angle : Vector2 = Vector2(30, 150)
|
||||
export(float) var radius : float = 0.3
|
||||
export(float) var width : float = 0.1
|
||||
|
||||
func _init_properties():
|
||||
if !output:
|
||||
output = MMNodeUniversalProperty.new()
|
||||
output.default_type = MMNodeUniversalProperty.MMNodeUniversalPropertyDefaultType.DEFAULT_TYPE_FLOAT
|
||||
|
||||
output.output_slot_type = MMNodeUniversalProperty.SlotTypes.SLOT_TYPE_FLOAT
|
||||
output.slot_name = "Output"
|
||||
output.get_value_from_owner = true
|
||||
|
||||
register_output_property(output)
|
||||
|
||||
func _register_methods(mm_graph_node) -> void:
|
||||
mm_graph_node.add_slot_label_universal(output)
|
||||
|
||||
mm_graph_node.add_slot_vector2("get_angle", "set_angle", "Angle", 1)
|
||||
mm_graph_node.add_slot_float("get_radius", "set_radius", "Radius", 0.01)
|
||||
mm_graph_node.add_slot_float("get_width", "set_width", "Width", 0.01)
|
||||
|
||||
func get_property_value(uv : Vector2) -> float:
|
||||
return SDF2D.sdf_arc(uv, angle, Vector2(radius, width))
|
||||
|
||||
#angle
|
||||
func get_angle() -> Vector2:
|
||||
return angle
|
||||
|
||||
func set_angle(val : Vector2) -> void:
|
||||
angle = val
|
||||
|
||||
output.emit_changed()
|
||||
|
||||
#radius
|
||||
func get_radius() -> float:
|
||||
return radius
|
||||
|
||||
func set_radius(val : float) -> void:
|
||||
radius = val
|
||||
|
||||
output.emit_changed()
|
||||
|
||||
#width
|
||||
func get_width() -> float:
|
||||
return width
|
||||
|
||||
func set_width(val : float) -> void:
|
||||
width = val
|
||||
|
||||
output.emit_changed()
|
47
game/addons/mat_maker_gd/nodes/sdf2d/sd_shape_rhombus.gd
Normal file
47
game/addons/mat_maker_gd/nodes/sdf2d/sd_shape_rhombus.gd
Normal file
@ -0,0 +1,47 @@
|
||||
tool
|
||||
extends MMNode
|
||||
|
||||
const Commons = preload("res://addons/mat_maker_gd/nodes/common/commons.gd")
|
||||
var SDF2D = preload("res://addons/mat_maker_gd/nodes/common/sdf2d.gd")
|
||||
|
||||
export(Resource) var output : Resource
|
||||
export(Vector2) var center : Vector2 = Vector2(0, 0)
|
||||
export(Vector2) var size : Vector2 = Vector2(0.3, 0.2)
|
||||
|
||||
func _init_properties():
|
||||
if !output:
|
||||
output = MMNodeUniversalProperty.new()
|
||||
output.default_type = MMNodeUniversalProperty.MMNodeUniversalPropertyDefaultType.DEFAULT_TYPE_FLOAT
|
||||
|
||||
output.output_slot_type = MMNodeUniversalProperty.SlotTypes.SLOT_TYPE_FLOAT
|
||||
output.slot_name = ">>> Output >>>"
|
||||
output.get_value_from_owner = true
|
||||
|
||||
register_output_property(output)
|
||||
|
||||
func _register_methods(mm_graph_node) -> void:
|
||||
mm_graph_node.add_slot_label_universal(output)
|
||||
|
||||
mm_graph_node.add_slot_vector2("get_center", "set_center", "Center", 0.01)
|
||||
mm_graph_node.add_slot_vector2("get_size", "set_size", "Size", 0.01)
|
||||
|
||||
func get_property_value(uv : Vector2) -> float:
|
||||
return SDF2D.sdf_rhombus(uv, center, size)
|
||||
|
||||
#center
|
||||
func get_center() -> Vector2:
|
||||
return center
|
||||
|
||||
func set_center(val : Vector2) -> void:
|
||||
center = val
|
||||
|
||||
output.emit_changed()
|
||||
|
||||
#size
|
||||
func get_size() -> Vector2:
|
||||
return size
|
||||
|
||||
func set_size(val : Vector2) -> void:
|
||||
size = val
|
||||
|
||||
output.emit_changed()
|
Loading…
Reference in New Issue
Block a user