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

New Addon: Asset Conflict Resolution Dialog #7232

Open
wants to merge 54 commits into
base: master
Choose a base branch
from

Conversation

Joeclinton1
Copy link
Contributor

@Joeclinton1 Joeclinton1 commented Feb 25, 2024

Resolves #7177

Changes

asset-conflict-dialog.mp4

image

Reason for changes

For projects with assets created via external editors, it is often neccessary to replace the existing costumes with updated versions. Currently you need to delete the old ones, then import the new ones. This is tedious, so this accelerates that process.

Tests

I have tested:

  • Importing a single costume and renaming/replacing/skipping
  • Importing multiple costumes and renaming/replacing WITHOUT "do this for all conflicts"
  • Importing multiple costumes and renaming/replacing/skipping WITH "do this for all conflicts"
  • Importing a single/multiple sounds(s) and renaming/replacing (with for all conflicts if multiple)
  • Closing the modal for costume/sounds (desired behaviour is to skip all)
  • It's compatible with 'file-drag-and-drop' and'dark-mode' and 'folders' addons
  • works with dynamic enable/disable
  • works with dragging an asset from one sprite to another
  • when an asset is replaced it gets selected
  • works when dragging costume/sound from backpack

@Samq64 Samq64 added type: enhancement New feature for the project new addon Related to new addons to this extension. `scope: addons` should still be added. scope: addon Related to one or multiple addons labels Feb 26, 2024
addons-l10n/en/asset-conflict-dialog.json Outdated Show resolved Hide resolved
addons/asset-conflict-dialog/addon.json Outdated Show resolved Hide resolved
addons/asset-conflict-dialog/addon.json Outdated Show resolved Hide resolved
addons/asset-conflict-dialog/userscript.js Outdated Show resolved Hide resolved
addons/asset-conflict-dialog/style.css Outdated Show resolved Hide resolved
addons/asset-conflict-dialog/userscript.js Outdated Show resolved Hide resolved
@medlans
Copy link

medlans commented Feb 26, 2024

Related thing that used to exist in 2.0 (basically you could just clear and then import into the costume): #5083

@Joeclinton1
Copy link
Contributor Author

Related thing that used to exist in 2.0 (basically you could just clear and then import into the costume): #5083

Does this possibly also resolve that issue? It's not the desired design but it solves the same issue and potentially better as long as the names are the same.

@medlans
Copy link

medlans commented Feb 26, 2024

Related thing that used to exist in 2.0 (basically you could just clear and then import into the costume): #5083

Does this possibly also resolve that issue? It's not the desired design but it solves the same issue and potentially better as long as the names are the same.

The import button in 2.0 would add the uploaded thing to the costume instead of replacing, but you had to clear it first to do this, so they're a bit different. There was also the add button in 2.0, which was similar but you would select costumes/backdrops from the library instead.
Edit: Also the poster said the initial description was outdated.

addons/asset-conflict-dialog/style.css Outdated Show resolved Hide resolved
addons/asset-conflict-dialog/style.css Outdated Show resolved Hide resolved
addons/asset-conflict-dialog/userscript.js Outdated Show resolved Hide resolved
@Joeclinton1 Joeclinton1 marked this pull request as draft February 26, 2024 20:40
@GarboMuffin
Copy link
Member

GarboMuffin commented Mar 9, 2024

I haven't looked at the objects but a simple solution that should work most of the time would be checking if asset.name is addon.tab.redux.state.locales.messages['gui.sharedMessages.costume'].replace('{index}', '1') (and also check gui.sharedMessages.backdrop) or "recording1" (always English) before the folders addon compatibility runs. obviously that's not ideal - but if there's nothing better

@Joeclinton1
Copy link
Contributor Author

Joeclinton1 commented Mar 9, 2024

I haven't looked at the objects but a simple solution that should work most of the time would be checking if asset.name is addon.tab.redux.state.locales.messages['gui.sharedMessages.costume'].replace('{index}', '1') (and also check gui.sharedMessages.backdrop) or "recording1" (always English) before the folders addon compatibility runs. obviously that's not ideal - but if there's nothing better

The assetObj has a very tell tale signature when it's a new costume, just checking if it's the same for sounds right now. Don't want to use the name for sure.

@Joeclinton1
Copy link
Contributor Author

Joeclinton1 commented Mar 12, 2024

I tested this more extensively and found no bugs when using the sprite folders addon. As far as I am aware this works as expected.

@GarboMuffin
Copy link
Member

GarboMuffin commented Mar 17, 2024

No dialog if I drag in a conflicting costume from the backpack

edit: Pretty sure that worked before so think it's related to the check for if someone pressed the new costume button (did not look)

@WorldLanguages
Copy link
Member

No dialog if I drag in a conflicting costume from the backpack

Oof... nice catch
RIP when this addon was less than 200 lines long

@Joeclinton1
Copy link
Contributor Author

No dialog if I drag in a conflicting costume from the backpack

Oof... nice catch RIP when this addon was less than 200 lines long

As Garbo hinted at this is probably a side effect of the previous fix. I tested quite a few ways of adding the costume and thought the signature was specific to the new costume, but it's possible dragging from backpack has the same signature.

@Samq64
Copy link
Member

Samq64 commented Apr 17, 2024

Dropping files onto the backdrop pane or uploading them outside the costume editor doesn't trigger the dialog.

@Joeclinton1
Copy link
Contributor Author

Dropping files onto the backdrop pane or uploading them outside the costume editor doesn't trigger the dialog.

Will fix when I have some free time

@Joeclinton1
Copy link
Contributor Author

Joeclinton1 commented May 10, 2024

Dropping files onto the backdrop pane or uploading them outside the costume editor doesn't trigger the dialog.

I can reproduce the first thing, but I don't understand what you mean by the second. Could you please clarify this?

Edit: Was able to replicate the second part

@Joeclinton1
Copy link
Contributor Author

Making it work for the backdrop was quite easy. It is unfortunate Scratch chose to have a separate add backdrop function.

Copy link
Member

@Samq64 Samq64 left a comment

Choose a reason for hiding this comment

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

I haven't taken a full look at all the code but drag and drop, sounds, backdrop and HD uploads all work fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new addon Related to new addons to this extension. `scope: addons` should still be added. scope: addon Related to one or multiple addons type: enhancement New feature for the project
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Prompt when importing conflicting asset names
6 participants