mirror of
https://github.com/Relintai/broken_seals.git
synced 2024-12-21 13:16:49 +01:00
Now shape's radius and edge is using universal property.
This commit is contained in:
parent
cca43432f3
commit
9f24edd50f
@ -1,9 +1,10 @@
|
||||
[gd_resource type="Resource" load_steps=8 format=2]
|
||||
[gd_resource type="Resource" load_steps=11 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/perlin.gd" type="Script" id=2]
|
||||
[ext_resource path="res://addons/mat_maker_gd/nodes/noise/noise.gd" type="Script" id=3]
|
||||
[ext_resource path="res://addons/mat_maker_gd/nodes/simple/shape.gd" type="Script" id=4]
|
||||
[ext_resource path="res://addons/mat_maker_gd/nodes/mm_node_universal_property.gd" type="Script" id=5]
|
||||
|
||||
[sub_resource type="Resource" id=1]
|
||||
script = ExtResource( 2 )
|
||||
@ -20,14 +21,36 @@ bmax = Vector2( 1, 1 )
|
||||
refresh = false
|
||||
|
||||
[sub_resource type="Resource" id=3]
|
||||
script = ExtResource( 5 )
|
||||
default_type = 1
|
||||
default_int = 0
|
||||
default_float = 0.2
|
||||
default_vector2 = Vector2( 0, 0 )
|
||||
default_vector3 = Vector3( 0, 0, 0 )
|
||||
default_color = Color( 0, 0, 0, 1 )
|
||||
getter = ""
|
||||
params = [ ]
|
||||
|
||||
[sub_resource type="Resource" id=4]
|
||||
script = ExtResource( 5 )
|
||||
default_type = 1
|
||||
default_int = 0
|
||||
default_float = 0.35
|
||||
default_vector2 = Vector2( 0, 0 )
|
||||
default_vector3 = Vector3( 0, 0, 0 )
|
||||
default_color = Color( 0, 0, 0, 1 )
|
||||
getter = ""
|
||||
params = [ ]
|
||||
|
||||
[sub_resource type="Resource" id=5]
|
||||
script = ExtResource( 4 )
|
||||
graph_position = Vector2( -280, -220 )
|
||||
shape_type = 0
|
||||
graph_position = Vector2( -260, -200 )
|
||||
shape_type = 2
|
||||
sides = 6
|
||||
radius = 0.845361
|
||||
edge = 0.051546
|
||||
radius = SubResource( 4 )
|
||||
edge = SubResource( 3 )
|
||||
|
||||
[resource]
|
||||
script = ExtResource( 1 )
|
||||
image_size = Vector2( 128, 128 )
|
||||
nodes = [ SubResource( 1 ), SubResource( 2 ), SubResource( 3 ) ]
|
||||
nodes = [ SubResource( 1 ), SubResource( 2 ), SubResource( 5 ) ]
|
||||
|
@ -13,22 +13,43 @@ enum ShapeType {
|
||||
|
||||
export(int, "Circle,Polygon,Star,Curved Star,Rays") var shape_type : int = 0
|
||||
export(int) var sides : int = 6
|
||||
export(float) var radius : float = 0.845361000; #univ input todo
|
||||
export(float) var edge : float = 0.051546000; #univ input todo
|
||||
export(Resource) var radius : Resource
|
||||
export(Resource) var edge : Resource
|
||||
|
||||
#export(float) var radius : float = 0.845361000; #univ input todo
|
||||
#export(float) var edge : float = 0.051546000; #univ input todo
|
||||
|
||||
func _init():
|
||||
var changed : bool = false
|
||||
|
||||
if !radius:
|
||||
radius = MMNodeUniversalProperty.new()
|
||||
radius.default_type = MMNodeUniversalProperty.MMNodeUniversalPropertyDefaultType.DEFAULT_TYPE_FLOAT
|
||||
radius.set_default_value(0.34375)
|
||||
changed = true
|
||||
|
||||
if !edge:
|
||||
edge = MMNodeUniversalProperty.new()
|
||||
edge.default_type = MMNodeUniversalProperty.MMNodeUniversalPropertyDefaultType.DEFAULT_TYPE_FLOAT
|
||||
edge.set_default_value(0.2)
|
||||
changed = true
|
||||
|
||||
if changed:
|
||||
emit_changed()
|
||||
|
||||
func get_value_for(uv : Vector2, slot_idx : int, pseed : int) -> Color:
|
||||
var c : float = 0
|
||||
|
||||
if shape_type == ShapeType.SHAPE_TYPE_CIRCLE:
|
||||
c = Shapes.shape_circle(uv, sides, radius * 1.0, edge * 1.0)
|
||||
c = Shapes.shape_circle(uv, sides, radius.get_value(uv) * 1.0, edge.get_value(uv) * 1.0)
|
||||
elif shape_type == ShapeType.SHAPE_TYPE_POLYGON:
|
||||
c = Shapes.shape_polygon(uv, sides, radius * 1.0, edge * 1.0)
|
||||
c = Shapes.shape_polygon(uv, sides, radius.get_value(uv) * 1.0, edge.get_value(uv) * 1.0)
|
||||
elif shape_type == ShapeType.SHAPE_TYPE_STAR:
|
||||
c = Shapes.shape_star(uv, sides, radius * 1.0, edge * 1.0)
|
||||
c = Shapes.shape_star(uv, sides, radius.get_value(uv) * 1.0, edge.get_value(uv) * 1.0)
|
||||
elif shape_type == ShapeType.SHAPE_TYPE_CURVED_STAR:
|
||||
c = Shapes.shape_curved_star(uv, sides, radius * 1.0, edge * 1.0)
|
||||
c = Shapes.shape_curved_star(uv, sides, radius.get_value(uv) * 1.0, edge.get_value(uv) * 1.0)
|
||||
elif shape_type == ShapeType.SHAPE_TYPE_RAYS:
|
||||
c = Shapes.shape_rays(uv, sides, radius * 1.0, edge * 1.0)
|
||||
c = Shapes.shape_rays(uv, sides, radius.get_value(uv) * 1.0, edge.get_value(uv) * 1.0)
|
||||
|
||||
return Color(c, c, c, 1)
|
||||
|
||||
@ -36,8 +57,8 @@ func register_methods(mm_graph_node) -> void:
|
||||
mm_graph_node.add_slot_texture(SlotTypes.SLOT_TYPE_NONE, SlotTypes.SLOT_TYPE_IMAGE, "recalculate_image", "")
|
||||
mm_graph_node.add_slot_enum(SlotTypes.SLOT_TYPE_NONE, SlotTypes.SLOT_TYPE_NONE, "get_shape_typoe", "set_shape_typoe", "shape_type", [ "Circle", "Polygon", "Star", "Curved Star", "Rays" ])
|
||||
mm_graph_node.add_slot_int(SlotTypes.SLOT_TYPE_NONE, SlotTypes.SLOT_TYPE_NONE, "get_sides", "set_sides", "sides")#, Vector2(1, 10))
|
||||
#mm_graph_node.add_slot_float(SlotTypes.SLOT_TYPE_NONE, SlotTypes.SLOT_TYPE_NONE, "get_persistence", "set_persistence", "persistence", 0.05)#, Vector2(0, 1))
|
||||
#mm_graph_node.add_slot_vector2(SlotTypes.SLOT_TYPE_NONE, SlotTypes.SLOT_TYPE_NONE, "get_scale", "set_scale", "scale", 1)#, Vector2(1, 32))
|
||||
mm_graph_node.add_slot_float_universal(radius, SlotTypes.SLOT_TYPE_NONE, "radius", 0.05)
|
||||
mm_graph_node.add_slot_float_universal(edge, SlotTypes.SLOT_TYPE_NONE, "edge", 0.05)
|
||||
|
||||
func get_shape_typoe() -> int:
|
||||
return shape_type
|
||||
|
Loading…
Reference in New Issue
Block a user