mirror of
https://github.com/Relintai/broken_seals.git
synced 2024-11-13 20:47:19 +01:00
sdf3d_op_morph node.
This commit is contained in:
parent
9252c7b21f
commit
182034fd82
@ -1,14 +1,12 @@
|
||||
[gd_resource type="Resource" load_steps=31 format=2]
|
||||
[gd_resource type="Resource" load_steps=23 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/sdf3d/sdf3d_shape_capsule.gd" type="Script" id=2]
|
||||
[ext_resource path="res://addons/mat_maker_gd/nodes/sdf3d/sdf3d_shape_sphere.gd" type="Script" id=2]
|
||||
[ext_resource path="res://addons/mat_maker_gd/nodes/sdf3d/sdf3d_render.gd" type="Script" id=3]
|
||||
[ext_resource path="res://addons/mat_maker_gd/nodes/sdf3d/sdf3d_tf_scale.gd" type="Script" id=4]
|
||||
[ext_resource path="res://addons/mat_maker_gd/nodes/sdf3d/sdf3d_op_morph.gd" type="Script" id=4]
|
||||
[ext_resource path="res://addons/mat_maker_gd/nodes/mm_node_universal_property.gd" type="Script" id=5]
|
||||
[ext_resource path="res://addons/mat_maker_gd/nodes/sdf3d/sdf3d_tf_translate.gd" type="Script" id=6]
|
||||
[ext_resource path="res://addons/mat_maker_gd/nodes/sdf3d/sdf3d_tf_rotate.gd" type="Script" id=7]
|
||||
[ext_resource path="res://addons/mat_maker_gd/nodes/sdf3d/sdf3d_color.gd" type="Script" id=9]
|
||||
[ext_resource path="res://addons/mat_maker_gd/nodes/simple/image.gd" type="Script" id=10]
|
||||
[ext_resource path="res://addons/mat_maker_gd/nodes/sdf3d/sdf3d_shape_box.gd" type="Script" id=11]
|
||||
|
||||
[sub_resource type="Resource" id=23]
|
||||
script = ExtResource( 5 )
|
||||
@ -25,7 +23,7 @@ graph_position = Vector2( 1020, 100 )
|
||||
image = SubResource( 23 )
|
||||
image_path = "/home/relintai/Projects/broken_seals/game/icon.png"
|
||||
|
||||
[sub_resource type="Resource" id=25]
|
||||
[sub_resource type="Resource" id=51]
|
||||
script = ExtResource( 5 )
|
||||
default_type = 2
|
||||
default_int = 0
|
||||
@ -42,7 +40,7 @@ default_float = 0.0
|
||||
default_vector2 = Vector2( 0, 0 )
|
||||
default_vector3 = Vector3( 0, 0, 0 )
|
||||
default_color = Color( 0, 0, 0, 1 )
|
||||
input_property = SubResource( 25 )
|
||||
input_property = SubResource( 51 )
|
||||
|
||||
[sub_resource type="Resource" id=27]
|
||||
script = ExtResource( 5 )
|
||||
@ -73,13 +71,13 @@ default_color = Color( 0, 0, 0, 1 )
|
||||
|
||||
[sub_resource type="Resource" id=30]
|
||||
script = ExtResource( 3 )
|
||||
graph_position = Vector2( 460, 0 )
|
||||
graph_position = Vector2( 340, 140 )
|
||||
input = SubResource( 26 )
|
||||
out_height_map = SubResource( 28 )
|
||||
out_normal_map = SubResource( 29 )
|
||||
out_color_map = SubResource( 27 )
|
||||
|
||||
[sub_resource type="Resource" id=42]
|
||||
[sub_resource type="Resource" id=47]
|
||||
script = ExtResource( 5 )
|
||||
default_type = 2
|
||||
default_int = 0
|
||||
@ -88,24 +86,14 @@ default_vector2 = Vector2( 0, 0 )
|
||||
default_vector3 = Vector3( 0, 0, 0 )
|
||||
default_color = Color( 0, 0, 0, 1 )
|
||||
|
||||
[sub_resource type="Resource" id=32]
|
||||
script = ExtResource( 5 )
|
||||
default_type = 0
|
||||
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 )
|
||||
input_property = SubResource( 42 )
|
||||
[sub_resource type="Resource" id=50]
|
||||
script = ExtResource( 11 )
|
||||
graph_position = Vector2( -260, 180 )
|
||||
output = SubResource( 47 )
|
||||
size = Vector3( 0.2, 0.2, 0.2 )
|
||||
radius = 0.01
|
||||
|
||||
[sub_resource type="Resource" id=33]
|
||||
script = ExtResource( 9 )
|
||||
graph_position = Vector2( 140, 0 )
|
||||
input = SubResource( 32 )
|
||||
output = SubResource( 25 )
|
||||
color = 0.6
|
||||
|
||||
[sub_resource type="Resource" id=35]
|
||||
[sub_resource type="Resource" id=52]
|
||||
script = ExtResource( 5 )
|
||||
default_type = 2
|
||||
default_int = 0
|
||||
@ -114,16 +102,13 @@ default_vector2 = Vector2( 0, 0 )
|
||||
default_vector3 = Vector3( 0, 0, 0 )
|
||||
default_color = Color( 0, 0, 0, 1 )
|
||||
|
||||
[sub_resource type="Resource" id=36]
|
||||
[sub_resource type="Resource" id=53]
|
||||
script = ExtResource( 2 )
|
||||
graph_position = Vector2( -120, 40 )
|
||||
points = [ 0.0, 1.0, 0.0, 0.0, 0.424679, 0.283912, 0.0, 4.15563, 1.0, 1.0, 0.0, 0.0 ]
|
||||
output = SubResource( 35 )
|
||||
axis = 0
|
||||
length = 0.28
|
||||
radius = 0.22
|
||||
graph_position = Vector2( -260, 460 )
|
||||
output = SubResource( 52 )
|
||||
radius = 0.5
|
||||
|
||||
[sub_resource type="Resource" id=37]
|
||||
[sub_resource type="Resource" id=54]
|
||||
script = ExtResource( 5 )
|
||||
default_type = 2
|
||||
default_int = 0
|
||||
@ -131,9 +116,9 @@ default_float = 0.0
|
||||
default_vector2 = Vector2( 0, 0 )
|
||||
default_vector3 = Vector3( 0, 0, 0 )
|
||||
default_color = Color( 0, 0, 0, 1 )
|
||||
input_property = SubResource( 35 )
|
||||
input_property = SubResource( 47 )
|
||||
|
||||
[sub_resource type="Resource" id=38]
|
||||
[sub_resource type="Resource" id=55]
|
||||
script = ExtResource( 5 )
|
||||
default_type = 2
|
||||
default_int = 0
|
||||
@ -141,58 +126,17 @@ default_float = 0.0
|
||||
default_vector2 = Vector2( 0, 0 )
|
||||
default_vector3 = Vector3( 0, 0, 0 )
|
||||
default_color = Color( 0, 0, 0, 1 )
|
||||
input_property = SubResource( 52 )
|
||||
|
||||
[sub_resource type="Resource" id=39]
|
||||
script = ExtResource( 6 )
|
||||
graph_position = Vector2( 140, 180 )
|
||||
input = SubResource( 37 )
|
||||
output = SubResource( 38 )
|
||||
translation = Vector3( 0.02, 0.02, 0.09 )
|
||||
|
||||
[sub_resource type="Resource" id=40]
|
||||
script = ExtResource( 5 )
|
||||
default_type = 2
|
||||
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 )
|
||||
input_property = SubResource( 38 )
|
||||
|
||||
[sub_resource type="Resource" id=34]
|
||||
script = ExtResource( 5 )
|
||||
default_type = 2
|
||||
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=41]
|
||||
[sub_resource type="Resource" id=56]
|
||||
script = ExtResource( 4 )
|
||||
graph_position = Vector2( 160, 400 )
|
||||
input = SubResource( 40 )
|
||||
output = SubResource( 34 )
|
||||
scale = 1.0
|
||||
|
||||
[sub_resource type="Resource" id=43]
|
||||
script = ExtResource( 5 )
|
||||
default_type = 2
|
||||
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 )
|
||||
input_property = SubResource( 34 )
|
||||
|
||||
[sub_resource type="Resource" id=44]
|
||||
script = ExtResource( 7 )
|
||||
graph_position = Vector2( -100, 380 )
|
||||
input = SubResource( 43 )
|
||||
output = SubResource( 42 )
|
||||
rotation = Vector3( 50, 50, 50 )
|
||||
graph_position = Vector2( 40, 300 )
|
||||
input1 = SubResource( 54 )
|
||||
input2 = SubResource( 55 )
|
||||
output = SubResource( 51 )
|
||||
amount = 0.6
|
||||
|
||||
[resource]
|
||||
script = ExtResource( 1 )
|
||||
image_size = Vector2( 128, 128 )
|
||||
nodes = [ SubResource( 24 ), SubResource( 30 ), SubResource( 33 ), SubResource( 36 ), SubResource( 39 ), SubResource( 41 ), SubResource( 44 ) ]
|
||||
nodes = [ SubResource( 24 ), SubResource( 30 ), SubResource( 50 ), SubResource( 53 ), SubResource( 56 ) ]
|
||||
|
74
game/addons/mat_maker_gd/nodes/sdf3d/sdf3d_op_morph.gd
Normal file
74
game/addons/mat_maker_gd/nodes/sdf3d/sdf3d_op_morph.gd
Normal file
@ -0,0 +1,74 @@
|
||||
tool
|
||||
extends MMNode
|
||||
|
||||
const Commons = preload("res://addons/mat_maker_gd/nodes/common/commons.gd")
|
||||
var SDF3D = preload("res://addons/mat_maker_gd/nodes/common/sdf3d.gd")
|
||||
|
||||
export(Resource) var input1 : Resource
|
||||
export(Resource) var input2 : Resource
|
||||
export(Resource) var output : Resource
|
||||
export(float) var amount : float = 0.5
|
||||
|
||||
func _init_properties():
|
||||
if !input1:
|
||||
input1 = MMNodeUniversalProperty.new()
|
||||
input1.default_type = MMNodeUniversalProperty.MMNodeUniversalPropertyDefaultType.DEFAULT_TYPE_VECTOR2
|
||||
|
||||
input1.input_slot_type = MMNodeUniversalProperty.SlotTypes.SLOT_TYPE_UNIVERSAL
|
||||
# input1.input_slot_type = MMNodeUniversalProperty.SlotTypes.SLOT_TYPE_VECTOR2
|
||||
input1.slot_name = ">>> Input 1 "
|
||||
|
||||
if !input1.is_connected("changed", self, "on_input_changed"):
|
||||
input1.connect("changed", self, "on_input_changed")
|
||||
|
||||
if !input2:
|
||||
input2 = MMNodeUniversalProperty.new()
|
||||
input2.default_type = MMNodeUniversalProperty.MMNodeUniversalPropertyDefaultType.DEFAULT_TYPE_VECTOR2
|
||||
|
||||
input2.input_slot_type = MMNodeUniversalProperty.SlotTypes.SLOT_TYPE_UNIVERSAL
|
||||
# input2.input_slot_type = MMNodeUniversalProperty.SlotTypes.SLOT_TYPE_VECTOR2
|
||||
input2.slot_name = ">>> Input 2 "
|
||||
|
||||
if !input2.is_connected("changed", self, "on_input_changed"):
|
||||
input2.connect("changed", self, "on_input_changed")
|
||||
|
||||
if !output:
|
||||
output = MMNodeUniversalProperty.new()
|
||||
output.default_type = MMNodeUniversalProperty.MMNodeUniversalPropertyDefaultType.DEFAULT_TYPE_VECTOR2
|
||||
|
||||
output.output_slot_type = MMNodeUniversalProperty.SlotTypes.SLOT_TYPE_FLOAT
|
||||
output.slot_name = ">>> Output >>>"
|
||||
output.get_value_from_owner = true
|
||||
|
||||
register_input_property(input1)
|
||||
register_input_property(input2)
|
||||
register_output_property(output)
|
||||
|
||||
func _register_methods(mm_graph_node) -> void:
|
||||
mm_graph_node.add_slot_label_universal(input1)
|
||||
mm_graph_node.add_slot_label_universal(input2)
|
||||
mm_graph_node.add_slot_label_universal(output)
|
||||
|
||||
mm_graph_node.add_slot_float("get_amount", "set_amount", "Amount", 0.01)
|
||||
|
||||
func get_property_value_sdf3d(uv3 : Vector3) -> Vector2:
|
||||
var s1 : Vector2 = input1.get_value_sdf3d(uv3)
|
||||
var s2 : Vector2 = input2.get_value_sdf3d(uv3)
|
||||
|
||||
#mix($in1($uv), $in2($uv), $amount)
|
||||
|
||||
return lerp(s1, s2, amount)
|
||||
|
||||
#amount
|
||||
func get_amount() -> float:
|
||||
return amount
|
||||
|
||||
func set_amount(val : float) -> void:
|
||||
amount = val
|
||||
|
||||
emit_changed()
|
||||
output.emit_changed()
|
||||
|
||||
func on_input_changed() -> void:
|
||||
emit_changed()
|
||||
output.emit_changed()
|
Loading…
Reference in New Issue
Block a user