Added image universal property to shape.gd. Not yet used.

This commit is contained in:
Relintai 2021-10-07 15:48:38 +02:00
parent 6f5c7395ba
commit 51dfad5018

View File

@ -11,19 +11,22 @@ enum ShapeType {
SHAPE_TYPE_RAYS = 4, SHAPE_TYPE_RAYS = 4,
} }
export(Resource) var image : Resource
export(int, "Circle,Polygon,Star,Curved Star,Rays") var shape_type : int = 0 export(int, "Circle,Polygon,Star,Curved Star,Rays") var shape_type : int = 0
export(int) var sides : int = 6 export(int) var sides : int = 6
export(Resource) var radius : Resource export(Resource) var radius : Resource
export(Resource) var edge : Resource export(Resource) var edge : Resource
func _init_properties(): func _init_properties():
var changed : bool = false if !image:
image = MMNodeUniversalProperty.new()
image.default_type = MMNodeUniversalProperty.MMNodeUniversalPropertyDefaultType.DEFAULT_TYPE_IMAGE
image.output_slot_type = MMNodeUniversalProperty.SlotTypes.SLOT_TYPE_IMAGE
if !radius: if !radius:
radius = MMNodeUniversalProperty.new() radius = MMNodeUniversalProperty.new()
radius.default_type = MMNodeUniversalProperty.MMNodeUniversalPropertyDefaultType.DEFAULT_TYPE_FLOAT radius.default_type = MMNodeUniversalProperty.MMNodeUniversalPropertyDefaultType.DEFAULT_TYPE_FLOAT
radius.set_default_value(0.34375) radius.set_default_value(0.34375)
changed = true
radius.input_slot_type = MMNodeUniversalProperty.SlotTypes.SLOT_TYPE_UNIVERSAL radius.input_slot_type = MMNodeUniversalProperty.SlotTypes.SLOT_TYPE_UNIVERSAL
radius.slot_name = "radius" radius.slot_name = "radius"
@ -33,14 +36,10 @@ func _init_properties():
edge = MMNodeUniversalProperty.new() edge = MMNodeUniversalProperty.new()
edge.default_type = MMNodeUniversalProperty.MMNodeUniversalPropertyDefaultType.DEFAULT_TYPE_FLOAT edge.default_type = MMNodeUniversalProperty.MMNodeUniversalPropertyDefaultType.DEFAULT_TYPE_FLOAT
edge.set_default_value(0.2) edge.set_default_value(0.2)
changed = true
edge.input_slot_type = MMNodeUniversalProperty.SlotTypes.SLOT_TYPE_UNIVERSAL edge.input_slot_type = MMNodeUniversalProperty.SlotTypes.SLOT_TYPE_UNIVERSAL
edge.slot_name = "edge" edge.slot_name = "edge"
edge.value_step = 0.05 edge.value_step = 0.05
if changed:
emit_changed()
func _register_methods(mm_graph_node) -> void: func _register_methods(mm_graph_node) -> void:
mm_graph_node.add_slot_texture(MMNodeUniversalProperty.SlotTypes.SLOT_TYPE_NONE, MMNodeUniversalProperty.SlotTypes.SLOT_TYPE_IMAGE, "recalculate_image", "") mm_graph_node.add_slot_texture(MMNodeUniversalProperty.SlotTypes.SLOT_TYPE_NONE, MMNodeUniversalProperty.SlotTypes.SLOT_TYPE_IMAGE, "recalculate_image", "")