Giter Site home page Giter Site logo

poohcom1 / godot-animation-player-refactor Goto Github PK

View Code? Open in Web Editor NEW
87.0 4.0 2.0 305 KB

AnimationPlayer refactoring addon for Godot!

Home Page: https://godotengine.org/asset-library/asset/1777

License: MIT License

GDScript 100.00%
godot godot-engine godot4

godot-animation-player-refactor's Introduction

Animation Player Refactor

A Godot addon for refactoring animations for the AnimationPlayer.

Refactor dialogue

Edit property references, delete tracks, and even change the root node of the Animation Player without breaking all the path references. No need to manually update every single track everytime you move or rename a node and properties in the scene.

Features

Adds a "Refactor" menu option to the animation panel, with the following features:

  • Rename tracks and properties
  • Delete tracks and properties
  • Change the root node path
  • Marks invalid properties/nodes
  • Full undo/redo support

๐Ÿ“„ Note that this addon only refactor Animations, so deleting or renaming node does not affect the actual nodes. It is recommended to move/rename the actual nodes first, and then use the plugin to fix broken animations.

โš ๏ธ Please make sure to use proper version control with this addon to prevent losing changes.

Screenshots

Menu options:

New menu option

Changing root node:

Change root node


Logo icon created by Freepik - Flaticon

godot-animation-player-refactor's People

Contributors

poohcom1 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

boyquotes kcorac

godot-animation-player-refactor's Issues

Test and improve track types other than value and method

This addon currently supports value and method tracks, but value tracks should technically support most other types of tracks (this needs to be tested). What's missing are different icon types for each track, as only value (white) and method (green) icons are configured:

image

We can add icons to other tracks by editing the following files:

Currently, icons are drawn based on the value lookup from the node itself. The main purpose for EditInfo.type was to store value type when editing the value (i.e. know that we're editing a method even if the value is invalid), but we should be able to extend it to also apply correct icons.

Add node/property selection to the rename dialogue

Currently, the intended use case of the addon is for fixing broken references for nodes/properties already changed in the scene/scripts. As such, the inputs don't offer much validation currently, as it's expected that the developer already knows what they want.

However, it might be better UX for the addon to offer a list of valid options to select from and only allow arbitrary string input after the user toggles an "Advance" option or something similar. Even better, we can combine both into one, where we show a tree with a search bar on top and always have an extra option in the tree to match any arbitrary value currently in the search bar to allow users the freedom to set existing or new values.

Add undo/redo features

Currently, the addon automatically saves all changes directly to the scene or animation library resources, so it is no possible to undo changes:

for animation_name in lib.get_animation_list():
var animation := lib.get_animation(animation_name)
var count = callback.call(animation)
if count is int: # Possibly null
changed += count
try_save_resource(animation)
try_save_resource(lib)
return changed
static func try_save_resource(res: Resource):
if not res.resource_path.is_empty() and not "::" in res.resource_path:
ResourceSaver.save(res, res.resource_path)

The code is being handled by the static utility class anim_player_refactor.gd, which might not be ideal to add undo/redo features. The static methods can be converted to instance methods with references to EditorPlugin so it can access undo/redo, or all its functionality can be moved to plugin.gd. We can store a snapshot of all the animation resources in a stack before each change, and simply revert to old snapshots on each undo.

Add full-path method refactor

Issue

When refactoring a property, you can edit the full path and easily change the node of a single property. This is straightforward because each property track is tied to a single full path (node_path:property_name)
image

However, this is currently disabled for methods:
image

This is because a method isn't tied to a single track. A method track can contain multiple methods, and a single method could be used in multiple tracks, so this action is a bit more complicated than just changing the full path of a track. Here are the issues to consider:

  1. If the source node's method track only contains one method and that method is being removed, do we also remove the track?
  2. If the target node already contains a method track, do we put it there or create a new one?

On one hand, I prefer to be the least destructive in case something goes wrong, so not removing or reusing track will be the safest route. On the other hand, if one refactors a lot, you can end up with a lot of empty or single-use tracks which can be a bit messy.

Proposal

As such, the ideal solution would be to make both of these cases an editor setting, such as editors/animation/refactor/remove_empty_method_tracks and editors/animation/refactor/reuse_method_track. But because of this, this implementation will be rather complicated.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.