Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Inspector when renaming a file via File System Dock #97348

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

pafuent
Copy link
Contributor

@pafuent pafuent commented Sep 23, 2024

Fixes #56803

Adding a new signal file_renamed to FileSystemDock and then connecting it to InspectorDock to update the path of the file on object_selector.

2024-09-23.00-55-14.mov

@pafuent pafuent requested review from a team as code owners September 23, 2024 04:07
@AThousandShips AThousandShips added bug topic:editor cherrypick:4.2 Considered for cherry-picking into a future 4.2.x release cherrypick:4.3 Considered for cherry-picking into a future 4.3.x release labels Sep 23, 2024
@AThousandShips AThousandShips added this to the 4.4 milestone Sep 23, 2024
@pafuent pafuent force-pushed the updating_inspector_dock_when_rename_on_filesystem_dock branch from 5233d83 to b570cc2 Compare October 18, 2024 20:09
@AThousandShips AThousandShips changed the title Update Inspector when rename a file via File System Dock Update Inspector when renaming a file via File System Dock Oct 19, 2024
Fixes godotengine#56803

Adding a new signal `file_renamed` to `FileSystemDock` and then
connecting it to `InspectorDock` to update the path of the file
on `object_selector`.
@pafuent pafuent force-pushed the updating_inspector_dock_when_rename_on_filesystem_dock branch from b570cc2 to 0f033f5 Compare November 13, 2024 02:53
@pafuent
Copy link
Contributor Author

pafuent commented Nov 13, 2024

Updated to the latest master version.
Can I get a review?

@KoBeWi
Copy link
Member

KoBeWi commented Nov 13, 2024

Does not work when you rename a script.

@pafuent
Copy link
Contributor Author

pafuent commented Nov 17, 2024

Seems it's worst than not updating a script. When I implemented this fix I test it with an empty project (as it can be viewed on the video attached on the description) and it worked for the Godot icon (my bad that doesn't work with scripts 🤦🏼‍♂️ )
Now, I tested it within a project with a scene and a node, and after renaming the Godot icon, the first (or last selected) node of the scene is shown in the inspector node, instead of the Godot icon. That behavior is already present on 4.3, so it seems is an existing bug.
I'll try to come with a solution for both things as soon as I can.

Here is a GIF with the bug on 4.3
NewBug

@Mickeon
Copy link
Contributor

Mickeon commented Nov 17, 2024

To me it looks like the new signal added in this PR is emitted every time a single file's path changes, so file_renamed and its purpose would be misleading.

But why adding a new signal when files_moved already exists?

@pafuent
Copy link
Contributor Author

pafuent commented Nov 17, 2024

To me it looks like the new signal added in this PR is emitted every time a single file's path changes, so file_renamed and its purpose would be misleading.
But why adding a new signal when files_moved already exists?

I decided to add a new signal because a moved file doesn't imply the name of the file changed, and the inspector requires being updated only when the name of the file changed.
TBH, I think that I need to revisit the whole implementation that I did. After some PRs I know some things that I didn't know at that time.

@Mickeon
Copy link
Contributor

Mickeon commented Nov 17, 2024

The signal being called file_moved is admittedly a bit misleading, but it is a general Filesystem standard to call it as such (Git also considers "renamed" files as "moved"). Ideally it should be documented to be clearer.
Adding file_renamed would also imply that file_moved is not called when renaming, which is misleading too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug cherrypick:4.2 Considered for cherry-picking into a future 4.2.x release cherrypick:4.3 Considered for cherry-picking into a future 4.3.x release topic:editor
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Renaming a script file, doesn't auto update the name everywhere
4 participants