mirror of
https://github.com/Orama-Interactive/Pixelorama.git
synced 2025-01-19 01:29:49 +00:00
Add a get_class_name() method in the cel classes
I wish Godot had a method for this already
This commit is contained in:
parent
280fb748e9
commit
860370bd4e
|
@ -303,14 +303,5 @@ class ProjectAPI:
|
||||||
# then the old extension would have no idea how to identify the types they use
|
# then the old extension would have no idea how to identify the types they use
|
||||||
# E.g the extension may try to use a GroupCel as a PixelCel (if it doesn't know the difference)
|
# E.g the extension may try to use a GroupCel as a PixelCel (if it doesn't know the difference)
|
||||||
# So it's encouraged to use this function to access cels
|
# So it's encouraged to use this function to access cels
|
||||||
var project = get_current_project()
|
var cel := get_current_project().get_current_cel()
|
||||||
var cel = project.get_current_cel()
|
return {"cel": cel, "type": cel.get_class_name()}
|
||||||
# Add cel types as we have more and more cels
|
|
||||||
if cel is PixelCel:
|
|
||||||
return {"cel": cel, "type": "PixelCel"}
|
|
||||||
elif cel is GroupCel:
|
|
||||||
return {"cel": cel, "type": "GroupCel"}
|
|
||||||
elif cel is Cel3D:
|
|
||||||
return {"cel": cel, "type": "Cel3D"}
|
|
||||||
else:
|
|
||||||
return {"cel": cel, "type": "BaseCel"}
|
|
||||||
|
|
|
@ -73,3 +73,7 @@ func on_remove() -> void:
|
||||||
|
|
||||||
func instantiate_cel_button() -> Node:
|
func instantiate_cel_button() -> Node:
|
||||||
return null
|
return null
|
||||||
|
|
||||||
|
|
||||||
|
func get_class_name() -> String:
|
||||||
|
return "BaseCel"
|
||||||
|
|
|
@ -210,3 +210,7 @@ func load_image_data_from_pxo(file: File, project_size: Vector2) -> void:
|
||||||
|
|
||||||
func instantiate_cel_button() -> Node:
|
func instantiate_cel_button() -> Node:
|
||||||
return Global.pixel_cel_button_node.instance()
|
return Global.pixel_cel_button_node.instance()
|
||||||
|
|
||||||
|
|
||||||
|
func get_class_name() -> String:
|
||||||
|
return "Cel3D"
|
||||||
|
|
|
@ -19,3 +19,7 @@ func get_image() -> Image:
|
||||||
|
|
||||||
func instantiate_cel_button() -> Node:
|
func instantiate_cel_button() -> Node:
|
||||||
return Global.group_cel_button_node.instance()
|
return Global.group_cel_button_node.instance()
|
||||||
|
|
||||||
|
|
||||||
|
func get_class_name() -> String:
|
||||||
|
return "GroupCel"
|
||||||
|
|
|
@ -71,3 +71,7 @@ func load_image_data_from_pxo(file: File, project_size: Vector2) -> void:
|
||||||
|
|
||||||
func instantiate_cel_button() -> Node:
|
func instantiate_cel_button() -> Node:
|
||||||
return Global.pixel_cel_button_node.instance()
|
return Global.pixel_cel_button_node.instance()
|
||||||
|
|
||||||
|
|
||||||
|
func get_class_name() -> String:
|
||||||
|
return "PixelCel"
|
||||||
|
|
Loading…
Reference in a new issue