Moved the SlotTypes enum from MMNode to MMNodeUniversalProperty.

This commit is contained in:
Relintai 2021-10-06 09:15:48 +02:00
parent 8ef1215bf4
commit 1611efc9d1
5 changed files with 22 additions and 22 deletions

View File

@ -84,7 +84,7 @@ func add_slot_int_universal(input_property : MMNodeUniversalProperty, output_typ
sb.max_value = prange.y sb.max_value = prange.y
bc.add_child(sb) bc.add_child(sb)
var slot_idx : int = add_slot(MMNode.SlotTypes.SLOT_TYPE_UNIVERSAL, output_type, "", "", bc) var slot_idx : int = add_slot(MMNodeUniversalProperty.SlotTypes.SLOT_TYPE_UNIVERSAL, output_type, "", "", bc)
sb.value = input_property.get_default_value() sb.value = input_property.get_default_value()
@ -125,7 +125,7 @@ func add_slot_float_universal(input_property : MMNodeUniversalProperty, output_t
var sb : SpinBox = SpinBox.new() var sb : SpinBox = SpinBox.new()
bc.add_child(sb) bc.add_child(sb)
var slot_idx : int = add_slot(MMNode.SlotTypes.SLOT_TYPE_UNIVERSAL, output_type, "", "", bc) var slot_idx : int = add_slot(MMNodeUniversalProperty.SlotTypes.SLOT_TYPE_UNIVERSAL, output_type, "", "", bc)
sb.rounded = false sb.rounded = false
sb.step = step sb.step = step
sb.min_value = prange.x sb.min_value = prange.x
@ -184,7 +184,7 @@ func add_slot_vector2_universal(input_property : MMNodeUniversalProperty, output
var sby : SpinBox = SpinBox.new() var sby : SpinBox = SpinBox.new()
bc.add_child(sby) bc.add_child(sby)
var slot_idx : int = add_slot(MMNode.SlotTypes.SLOT_TYPE_UNIVERSAL, output_type, "", "", bc) var slot_idx : int = add_slot(MMNodeUniversalProperty.SlotTypes.SLOT_TYPE_UNIVERSAL, output_type, "", "", bc)
sbx.rounded = false sbx.rounded = false
sby.rounded = false sby.rounded = false
sbx.step = step sbx.step = step

View File

@ -2,16 +2,6 @@ tool
class_name MMNode class_name MMNode
extends Resource extends Resource
enum SlotTypes {
SLOT_TYPE_NONE = -1,
SLOT_TYPE_IMAGE = 0,
SLOT_TYPE_INT = 1,
SLOT_TYPE_FLOAT = 2,
SLOT_TYPE_VECTOR2 = 3,
SLOT_TYPE_VECTOR3 = 4,
SLOT_TYPE_UNIVERSAL = 5,
}
export(Vector2) var graph_position : Vector2 = Vector2() export(Vector2) var graph_position : Vector2 = Vector2()
func recalculate_image(material, slot_idx : int) -> ImageTexture: func recalculate_image(material, slot_idx : int) -> ImageTexture:

View File

@ -2,6 +2,16 @@ tool
class_name MMNodeUniversalProperty class_name MMNodeUniversalProperty
extends Resource extends Resource
enum SlotTypes {
SLOT_TYPE_NONE = -1,
SLOT_TYPE_IMAGE = 0,
SLOT_TYPE_INT = 1,
SLOT_TYPE_FLOAT = 2,
SLOT_TYPE_VECTOR2 = 3,
SLOT_TYPE_VECTOR3 = 4,
SLOT_TYPE_UNIVERSAL = 5,
}
enum MMNodeUniversalPropertyDefaultType { enum MMNodeUniversalPropertyDefaultType {
DEFAULT_TYPE_INT = 0, DEFAULT_TYPE_INT = 0,
DEFAULT_TYPE_FLOAT = 1, DEFAULT_TYPE_FLOAT = 1,

View File

@ -14,10 +14,10 @@ func get_value_for(uv : Vector2, slot_idx : int, pseed : int) -> Color:
return NoisePerlin.perlinc(uv, scale, iterations, persistence, pseed) return NoisePerlin.perlinc(uv, scale, iterations, persistence, pseed)
func register_methods(mm_graph_node) -> void: 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_texture(MMNodeUniversalProperty.SlotTypes.SLOT_TYPE_NONE, MMNodeUniversalProperty.SlotTypes.SLOT_TYPE_IMAGE, "recalculate_image", "")
mm_graph_node.add_slot_int(SlotTypes.SLOT_TYPE_NONE, SlotTypes.SLOT_TYPE_NONE, "get_iterations", "set_iterations", "iterations")#, Vector2(1, 10)) mm_graph_node.add_slot_int(MMNodeUniversalProperty.SlotTypes.SLOT_TYPE_NONE, MMNodeUniversalProperty.SlotTypes.SLOT_TYPE_NONE, "get_iterations", "set_iterations", "iterations")#, 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_float(MMNodeUniversalProperty.SlotTypes.SLOT_TYPE_NONE, MMNodeUniversalProperty.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_vector2(MMNodeUniversalProperty.SlotTypes.SLOT_TYPE_NONE, MMNodeUniversalProperty.SlotTypes.SLOT_TYPE_NONE, "get_scale", "set_scale", "scale", 1)#, Vector2(1, 32))
func get_iterations() -> int: func get_iterations() -> int:
return iterations return iterations

View File

@ -54,11 +54,11 @@ func get_value_for(uv : Vector2, slot_idx : int, pseed : int) -> Color:
return Color(c, c, c, 1) return Color(c, c, c, 1)
func register_methods(mm_graph_node) -> void: 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_texture(MMNodeUniversalProperty.SlotTypes.SLOT_TYPE_NONE, MMNodeUniversalProperty.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_enum(MMNodeUniversalProperty.SlotTypes.SLOT_TYPE_NONE, MMNodeUniversalProperty.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_int(MMNodeUniversalProperty.SlotTypes.SLOT_TYPE_NONE, MMNodeUniversalProperty.SlotTypes.SLOT_TYPE_NONE, "get_sides", "set_sides", "sides")#, Vector2(1, 10))
mm_graph_node.add_slot_float_universal(radius, SlotTypes.SLOT_TYPE_NONE, "radius", 0.05) mm_graph_node.add_slot_float_universal(radius, MMNodeUniversalProperty.SlotTypes.SLOT_TYPE_NONE, "radius", 0.05)
mm_graph_node.add_slot_float_universal(edge, SlotTypes.SLOT_TYPE_NONE, "edge", 0.05) mm_graph_node.add_slot_float_universal(edge, MMNodeUniversalProperty.SlotTypes.SLOT_TYPE_NONE, "edge", 0.05)
func get_shape_typoe() -> int: func get_shape_typoe() -> int:
return shape_type return shape_type