Removed obj, getter and params from MMNodeUniversalProperty, now instead it will have an another MMNodeUniversalProperty ref as input_property. Also smaller simplifications.

This commit is contained in:
Relintai 2021-10-06 09:27:22 +02:00
parent 1611efc9d1
commit f1afa03c66

View File

@ -28,29 +28,14 @@ export(Vector2) var default_vector2 : Vector2
export(Vector3) var default_vector3 : Vector3 export(Vector3) var default_vector3 : Vector3
export(Color) var default_color : Color export(Color) var default_color : Color
export(Resource) var obj : Resource #Should be a MMNodeUniversalProperty, but can't set it up like that
export(String) var getter : String export(Resource) var input_property : Resource
export(Array) var params : Array
func get_value(uv : Vector2): func get_value(uv : Vector2):
if !obj: if !input_property:
if default_type == MMNodeUniversalPropertyDefaultType.DEFAULT_TYPE_INT: return get_default_value()
return default_int
elif default_type == MMNodeUniversalPropertyDefaultType.DEFAULT_TYPE_FLOAT:
return default_float
elif default_type == MMNodeUniversalPropertyDefaultType.DEFAULT_TYPE_VECTOR2:
return default_vector2
elif default_type == MMNodeUniversalPropertyDefaultType.DEFAULT_TYPE_VECTOR3:
return default_vector3
elif default_type == MMNodeUniversalPropertyDefaultType.DEFAULT_TYPE_COLOR:
return default_color
return null
if params.size() == 0: return input_property.get_value(uv)
return obj.call(getter, uv)
else:
return obj.call(getter, uv, params)
func get_default_value(): func get_default_value():
if default_type == MMNodeUniversalPropertyDefaultType.DEFAULT_TYPE_INT: if default_type == MMNodeUniversalPropertyDefaultType.DEFAULT_TYPE_INT:
@ -63,6 +48,8 @@ func get_default_value():
return default_vector3 return default_vector3
elif default_type == MMNodeUniversalPropertyDefaultType.DEFAULT_TYPE_COLOR: elif default_type == MMNodeUniversalPropertyDefaultType.DEFAULT_TYPE_COLOR:
return default_color return default_color
return null
func set_default_value(val): func set_default_value(val):
if default_type == MMNodeUniversalPropertyDefaultType.DEFAULT_TYPE_INT: if default_type == MMNodeUniversalPropertyDefaultType.DEFAULT_TYPE_INT: