mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-01 11:15:33 +00:00
46 lines
1.2 KiB
GDScript
46 lines
1.2 KiB
GDScript
@tool
|
|
extends EditorInspectorPlugin
|
|
|
|
var _plugin: EditorPlugin
|
|
|
|
func setup(plugin: EditorPlugin) -> void:
|
|
_plugin = plugin
|
|
|
|
func _can_handle(object: Object) -> bool:
|
|
return object is Resource and _is_supported_resource(object)
|
|
|
|
func _parse_begin(object: Object) -> void:
|
|
if not (object is Resource):
|
|
return
|
|
|
|
var button := Button.new()
|
|
button.text = "Open In Bullet Graph Editor"
|
|
button.pressed.connect(_on_open_pressed.bind(object))
|
|
add_custom_control(button)
|
|
|
|
func _on_open_pressed(resource: Resource) -> void:
|
|
if _plugin == null:
|
|
return
|
|
_plugin.call("open_resource_in_graph", resource)
|
|
|
|
func _is_supported_resource(resource: Resource) -> bool:
|
|
var script: Script = resource.get_script()
|
|
if script == null:
|
|
return false
|
|
|
|
var path := script.resource_path
|
|
if path.contains("/Scripts/AttackPatterns/"):
|
|
return true
|
|
if path.contains("/Scripts/Resources/") and path.contains("Pattern"):
|
|
return true
|
|
|
|
if path.ends_with("BossScript.cs") \
|
|
or path.ends_with("BossPhase.cs") \
|
|
or path.ends_with("BulletScript3D.cs") \
|
|
or path.ends_with("BulletScript.cs") \
|
|
or path.ends_with("AttackPattern.cs") \
|
|
or path.ends_with("PatternGroup.cs") \
|
|
or path.ends_with("ParallelPatternGroup.cs"):
|
|
return true
|
|
|
|
return resource.get("WaitForCompletion") != null
|