Skip to content

Implement method lookup for method tracks#106524

Merged
Repiteo merged 1 commit into
godotengine:masterfrom
chocola-mint:animation-player-method-lookup
May 26, 2025
Merged

Implement method lookup for method tracks#106524
Repiteo merged 1 commit into
godotengine:masterfrom
chocola-mint:animation-player-method-lookup

Conversation

@chocola-mint
Copy link
Copy Markdown
Contributor

Closes godotengine/godot-proposals#12436

This PR allows users to lookup method definitions by holding down Ctrl (or Command) and clicking keys in method tracks.

  • The cursor is changed into a pointing hand when Ctrl (or Command) is held and hovering over a method key.
  • If the method is found on the track target's script, (or base scripts) the script editor is made to jump to where the method is defined.
  • If the method is a native (C++) method, the built-in help page is shown instead.
  • If the method is not found, (like the bad_method example below) an editor warning is shown.
  • The "Go to Definition" menu item is also added when right-clicking a method key, so this feature can also be used without knowing the shortcut.
godot-animation-player-method-lookup.mp4

@chocola-mint chocola-mint force-pushed the animation-player-method-lookup branch from ac66245 to 9357536 Compare May 20, 2025 12:22
Copy link
Copy Markdown
Member

@TokageItLab TokageItLab left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested and it basically works. Somehow the selected line is off by one line after, so that should be fixed but you can send a follow up PR later.

@TokageItLab TokageItLab modified the milestones: 4.x, 4.5 May 24, 2025
@TokageItLab TokageItLab moved this from Ready for review to Approved, Waiting for Production in Animation Team Issue Triage May 24, 2025
@chocola-mint
Copy link
Copy Markdown
Contributor Author

Somehow the selected line is off by one line after, so that should be fixed but you can send a follow up PR later.

This is a quirk with ScriptEditor::script_goto_method, also used by ConnectionsDialog here:

if (scr.is_valid() && ScriptEditor::get_singleton()->script_goto_method(scr, cd.method)) {

You can find the same behavior when using the Node dock to jump to methods connected to a signal. Making a separate issue about this is probably a good idea.

@Repiteo Repiteo merged commit 60c66c0 into godotengine:master May 26, 2025
20 checks passed
@github-project-automation github-project-automation Bot moved this from Approved, Waiting for Production to Done in Animation Team Issue Triage May 26, 2025
@Repiteo
Copy link
Copy Markdown
Contributor

Repiteo commented May 26, 2025

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Go to function definition on Ctrl+Click in AnimationPlayer editor

3 participants