mirror of
https://github.com/Relintai/broken_seals.git
synced 2024-12-18 01:06:47 +01:00
Split the new gradient node into a gradient_base and gradient nodes.
This commit is contained in:
parent
4282cc8385
commit
6a241d3051
@ -1,4 +1,4 @@
|
||||
[gd_resource type="Resource" load_steps=19 format=2]
|
||||
[gd_resource type="Resource" load_steps=22 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]
|
||||
@ -6,6 +6,7 @@
|
||||
[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]
|
||||
[ext_resource path="res://addons/mat_maker_gd/nodes/other/output_image.gd" type="Script" id=6]
|
||||
[ext_resource path="res://addons/mat_maker_gd/nodes/gradient/gradient.gd" type="Script" id=7]
|
||||
|
||||
[sub_resource type="Resource" id=1]
|
||||
script = ExtResource( 2 )
|
||||
@ -109,7 +110,25 @@ sides = 6
|
||||
radius = SubResource( 11 )
|
||||
edge = SubResource( 9 )
|
||||
|
||||
[sub_resource type="Resource" id=14]
|
||||
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=15]
|
||||
script = ExtResource( 7 )
|
||||
graph_position = Vector2( -300, 120 )
|
||||
image = SubResource( 14 )
|
||||
repeat = 1.0
|
||||
rotate = 0.0
|
||||
interpolation_type = 1
|
||||
points = PoolRealArray( 0, 0.376471, 0.239216, 0.713726, 1, 0.330508, 0.484375, 0.198669, 0.198669, 1, 0.644068, 1, 1, 1, 1, 1, 0.263715, 0.585938, 0.100708, 1 )
|
||||
|
||||
[resource]
|
||||
script = ExtResource( 1 )
|
||||
image_size = Vector2( 128, 128 )
|
||||
nodes = [ SubResource( 1 ), SubResource( 2 ), SubResource( 5 ), SubResource( 6 ), SubResource( 12 ) ]
|
||||
nodes = [ SubResource( 1 ), SubResource( 2 ), SubResource( 5 ), SubResource( 6 ), SubResource( 12 ), SubResource( 15 ) ]
|
||||
|
64
game/addons/mat_maker_gd/nodes/bases/gradient_base.gd
Normal file
64
game/addons/mat_maker_gd/nodes/bases/gradient_base.gd
Normal file
@ -0,0 +1,64 @@
|
||||
tool
|
||||
extends MMNode
|
||||
|
||||
#var Gradients = preload("res://addons/mat_maker_gd/nodes/common/gradients.gd")
|
||||
|
||||
export(int) var interpolation_type : int = 1 setget set_interpolation_type, get_interpolation_type
|
||||
export(PoolRealArray) var points : PoolRealArray = PoolRealArray()
|
||||
|
||||
func get_gradient_color(x : float) -> Color:
|
||||
# if interpolation_type == 0:
|
||||
# return Gradients.gradient_type_1(x, points)
|
||||
# elif interpolation_type == 1:
|
||||
# return Gradients.gradient_type_2(x, points)
|
||||
# elif interpolation_type == 2:
|
||||
# return Gradients.gradient_type_3(x, points)
|
||||
# elif interpolation_type == 3:
|
||||
# return Gradients.gradient_type_4(x, points)
|
||||
|
||||
return Color(1, 1, 1, 1)
|
||||
|
||||
func get_interpolation_type() -> int:
|
||||
return interpolation_type
|
||||
|
||||
func set_interpolation_type(val : int) -> void:
|
||||
interpolation_type = val
|
||||
|
||||
set_dirty(true)
|
||||
|
||||
func get_points() -> PoolRealArray:
|
||||
return points
|
||||
|
||||
func set_points(val : PoolRealArray) -> void:
|
||||
points = val
|
||||
|
||||
set_dirty(true)
|
||||
|
||||
func get_point_value(index : int) -> float:
|
||||
return points[index * 5]
|
||||
|
||||
func get_point_color(index : int) -> Color:
|
||||
var indx : int = index * 5
|
||||
|
||||
return Color(points[indx + 1], points[indx + 2], points[indx + 3], points[indx + 4])
|
||||
|
||||
func add_point(val : float, color : Color) -> void:
|
||||
var s : int = points.size()
|
||||
points.resize(s + 5)
|
||||
|
||||
points[s] = val
|
||||
|
||||
points[s + 1] = color.r
|
||||
points[s + 2] = color.g
|
||||
points[s + 3] = color.b
|
||||
points[s + 4] = color.a
|
||||
|
||||
set_dirty(true)
|
||||
|
||||
func get_point_count() -> int:
|
||||
return points.size() / 5
|
||||
|
||||
func clear() -> void:
|
||||
points.resize(0)
|
||||
|
||||
set_dirty(true)
|
@ -1,5 +1,5 @@
|
||||
tool
|
||||
extends MMNode
|
||||
extends "res://addons/mat_maker_gd/nodes/bases/gradient_base.gd"
|
||||
|
||||
var Gradients = preload("res://addons/mat_maker_gd/nodes/common/gradients.gd")
|
||||
|
||||
@ -7,9 +7,6 @@ export(Resource) var image : Resource
|
||||
export(float) var repeat : float = 1
|
||||
export(float) var rotate : float = 0
|
||||
|
||||
export(int) var interpolation_type : int = 1 setget set_interpolation_type, get_interpolation_type
|
||||
export(PoolRealArray) var points : PoolRealArray = PoolRealArray()
|
||||
|
||||
func _init_properties():
|
||||
if !image:
|
||||
image = MMNodeUniversalProperty.new()
|
||||
@ -69,48 +66,3 @@ func set_rotate(val : float) -> void:
|
||||
rotate = val
|
||||
|
||||
set_dirty(true)
|
||||
|
||||
func get_interpolation_type() -> int:
|
||||
return interpolation_type
|
||||
|
||||
func set_interpolation_type(val : int) -> void:
|
||||
interpolation_type = val
|
||||
|
||||
set_dirty(true)
|
||||
|
||||
func get_points() -> PoolRealArray:
|
||||
return points
|
||||
|
||||
func set_points(val : PoolRealArray) -> void:
|
||||
points = val
|
||||
|
||||
set_dirty(true)
|
||||
|
||||
func get_point_value(index : int) -> float:
|
||||
return points[index * 5]
|
||||
|
||||
func get_point_color(index : int) -> Color:
|
||||
var indx : int = index * 5
|
||||
|
||||
return Color(points[indx + 1], points[indx + 2], points[indx + 3], points[indx + 4])
|
||||
|
||||
func add_point(val : float, color : Color) -> void:
|
||||
var s : int = points.size()
|
||||
points.resize(s + 5)
|
||||
|
||||
points[s] = val
|
||||
|
||||
points[s + 1] = color.r
|
||||
points[s + 2] = color.g
|
||||
points[s + 3] = color.b
|
||||
points[s + 4] = color.a
|
||||
|
||||
set_dirty(true)
|
||||
|
||||
func get_point_count() -> int:
|
||||
return points.size() / 5
|
||||
|
||||
func clear() -> void:
|
||||
points.resize(0)
|
||||
|
||||
set_dirty(true)
|
||||
|
Loading…
Reference in New Issue
Block a user