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

File corruption: Copy-paste layers with exported values from one file to another #1393

Closed
morevnaproject opened this issue Apr 30, 2020 · 22 comments · Fixed by #2086
Closed
Assignees
Labels
Milestone

Comments

@morevnaproject
Copy link
Member

There is a very common situation when user can get his file corrupted by simply copy-pasting layers from one file to another. This happens if layer contains exported values (note that bones are exported values too!).

Steps to reproduce this situation:

  1. Launch Synfig and create new file.
  2. Create a simple Circle Layer.
  3. Select Circle Layer, right-click its Radius parameter and select "Export".
  4. Enter name for exported value, i.e. "test". Click Export.
  5. Save file as "file1.sifz"
  6. Hit Ctl+C to copy circle layer to clipboard.
  7. Create a new file in other tab.
  8. Hit Ctrl+V to paste circle from clipboard. Circle will appear on workspace. Notice, that layer is copied, but it is still references exported value from "file1.sifz"
  9. Save file as "file2.sifz"
  10. Quit Synfig.
  11. Now remove (or rename) "file1.sifz".
  12. Launch Synfig and try to open "file2.sifz".
  13. Error:
    screenshot_001

@rodolforg @ice0 @FirasH I think this is a top-priority issue to solve for next stable release (1.4.1 or 1.6.0).

What should be done here:

  1. Change how Synfig deal with pasting layers when layer has exported values.
  2. Change how Synfig handles situations with broken links to exported values in external documents.
@morevnaproject
Copy link
Member Author

Broken files reported by users regularly.
Examples: #786, #1387

@morevnaproject
Copy link
Member Author

  1. Change how Synfig deal with pasting layers when layer has exported values.
  2. Change how Synfig handles situations with broken links to exported values in external documents.

I think (1) should be a scope of this issue. (2) should be submitted a separate issue.

morevnaproject added a commit to synfig/synfig-docs-dev that referenced this issue Apr 30, 2020
@morevnaproject
Copy link
Member Author

  1. Change how Synfig deal with pasting layers when layer has exported values.

Here is my proposal for solving this - https://synfig-docs-dev.readthedocs.io/en/latest/projects/copy-paste-exported-values.html

@morevnaproject morevnaproject added this to the v1.6.0 milestone Apr 30, 2020
@morevnaproject morevnaproject pinned this issue Apr 30, 2020
@Gilraiser
Copy link

Hello, I would like to show you an error that has to do with the topic. Here I present a video and two example files of how bones made are corrupted when copied to another file.

Original file:
example-01.sif.zip

Copied file:
example-02.sifz.zip

Video with the demonstration:
https://www.youtube.com/watch?v=aTBuhxQpS1c&feature=youtu.be

I hope the information is useful. Thank you

@rodolforg
Copy link
Contributor

@Gilraiser Sadly a long-time known issue #453
I'm trying to investigate it, but I'm confuse how skeletons work in Synfig ;)

@Gilraiser
Copy link

I wish I could help more. I know it must be very complex. Thank you.

@morevnaproject
Copy link
Member Author

I suggest to split this issue into multiple easy steps.

  1. When "paste" command is invoked - check if pasted data references any exported elements. If yes - then display warning message in console.
  2. Replace warning in console with a dialog box, which shows a message: "The pasted data contains layers, which still reference exported values from original files. That means your current file will depend on original file and might become unreadable if you delete original file. Do you still want to paste? [Yes] [No]"
  3. Improve warning dialog - display a list of exported values, which are referenced by pasted layers.

I think those 3 steps are easy enough to start on gradually solving this issue. I can provide further steps later, if needed. ^__^

@rodolforg
Copy link
Contributor

rodolforg commented Mar 28, 2021

I started to work on this issue today, and then it raised me a doubt:
What if an exported value node has links for other exported valuenodes.
I just list the 'top' valuenode?

Example: I have a skeleton layer and one of its bones is exported. The origin of this exported bone is exported too.
When I copy'n paste this layer, I warn about the bone export only, or both valuenodes?

@morevnaproject

@rodolforg
Copy link
Contributor

The conflict is when there are two different types of valuenode, right? Like "Add" vs. "Scale"

@ice0
Copy link
Collaborator

ice0 commented Mar 30, 2021

@rodolforg Hi!
@morevnaproject got sick, he will answer as soon as he gets better.

@rodolforg
Copy link
Contributor

Oh, I wish he gets better soon.

rodolforg added a commit to rodolforg/synfig that referenced this issue Mar 30, 2021
@rodolforg
Copy link
Contributor

I think we need a small icon to a value node is from an external canvas.
The following icon is used to indicate a layer parameter is a value node (in Parameter panel):
valuenode_icon
How to change it for indicate this difference?
Or doesn't it worth?

rodolforg added a commit to rodolforg/synfig that referenced this issue Mar 31, 2021
@ice0
Copy link
Collaborator

ice0 commented Apr 2, 2021

I think we need a small icon to a value node is from an external canvas.

I agree. A visual difference is required.

@morevnaproject
Copy link
Member Author

What if an exported value node has links for other exported valuenodes.
I just list the 'top' valuenode?

Example: I have a skeleton layer and one of its bones is exported. The origin of this exported bone is exported too.
When I copy'n paste this layer, I warn about the bone export only, or both valuenodes?

I think we should list both valuenodes. Can we achieve that?

Let's think about the following situation:

  1. We have a skeleton layer and one of its bones is exported (valueA)
  2. The origin of this exported bone is exported too (valueB)
  3. User copies skeleton layer to other document
  4. The dialog displays both values "valueA" and "valueB".
  5. User chooses NOT to copy "ValueA" (bone). So, it will be linked instead.
  6. ...but that means we cannot copy "ValueB"! Because it belongs to "ValueA", which cannot be changed (as it is linked, not copied).

How can we solve this?

rodolforg added a commit to rodolforg/synfig that referenced this issue May 3, 2021
@morevnaproject
Copy link
Member Author

How can we solve this?

Okay, I figured what we should do.

In the situation described in my previous comment user chooses NOT to copy "ValueA" (bone).
So, ValueA is linked from source file AND it depend on ValueB from source file too (because ValueA in source file is depends on ValueB).

So, in this exact situation it is really doesn't matter if user chooses to copy ValueB or not (because if ValueA is not copiedthen ValueB not directly included into any parameter of copied layer(s)).

But! There could be the following situation: ValueB is linked to some other parameter of the copied layer. For example:

  • We have a skeleton layer and one of its bones (Bone1) is exported (valueA)
  • The origin of this exported bone is exported too (valueB)
  • The Opacity Parameter of this Skeleton Layer is linked to valueB too.

So, when user copy Skeleton Layer to another file and chooses NOT to copy "ValueA" AND copy "ValueB", then we will get the following result:

  • Bone1 is linked to ValueA from source file (this ValueA is depends on ValueB from the same source file)
  • Opacity Parameter is linked to ValueB, which is COPIED to destination file.

So, as result we will get following:

  • In source file: Bone1 depends on Opacity parameter of the same Skeleton Layer
  • In destination file: Bone1 depends on Opacity parameter of Skeleton Layer from source file

I think this is logical behavior.

@rodolforg
Copy link
Contributor

rodolforg commented May 8, 2021

So, in this case, the original link between Bone1 Opacity and Bone1 Origin will be lost on destination file.
Is it okay?

Forget it. I misread it.

@rodolforg
Copy link
Contributor

rodolforg commented May 8, 2021

I think we should list both valuenodes. Can we achieve that?

Yes, we can.
Edit: In fact, it already does :)

@morevnaproject
Copy link
Member Author

I think we need a small icon to a value node is from an external canvas.
The following icon is used to indicate a layer parameter is a value node (in Parameter panel):
valuenode_icon
How to change it for indicate this difference?

We have path in "Source file" column, maybe this is enough to indicate that the value node is from an external canvas?

screenshot_015

@rodolforg
Copy link
Contributor

rodolforg commented May 29, 2021

@morevnaproject The link icon there says that value node will be copied and linked to existent valuenode in target file.

It is somehow confusing :P

@rodolforg
Copy link
Contributor

Hm… I think I know how to differentiate it:

  • When it will be linked to external file, use the Link icon
  • When it will be copied, but 'linked' to an existent exported valuenode, we use (deprecated) Connect/Plug icon: this is the way we represent the action to link to an exported value anyway

What do you think?


Regarding the copying about external nested value nodes, I think I'll change your proposal. Repeating your example:

  • We have a skeleton layer and one of its bones (Bone1) is exported (valueA)
    
  • The origin of this exported bone is exported too (valueB)
    
  • The Opacity Parameter of this Skeleton Layer is linked to valueB too.
    

Case 1: User chooses to copy the external "valueA". So user can still freely decides about copying or not the external "valueB".

Case 2: User chooses to link to the external "valueA". As external "valueA" depends on external "valueB", user can't choose anything about the action for "valueB" – it should be automatically linked too.

rodolforg added a commit to rodolforg/synfig that referenced this issue Jun 12, 2021
@morevnaproject
Copy link
Member Author

Regarding the copying about external nested value nodes, I think I'll change your proposal.

I have tested how your proposal works in current implementation and it looks like good solution to me!

@morevnaproject
Copy link
Member Author

@morevnaproject The link icon there says that value node will be copied and linked to existent valuenode in target file.

It is somehow confusing :P

I agree, this is confusing ^__^"

Hm… I think I know how to differentiate it:

* When it will be linked to external file, use the Link icon

* When it will be copied, but 'linked' to an existent exported valuenode, we use (deprecated) Connect/Plug icon: this is the way we represent the action to link to an exported value anyway

I like this solution!

rodolforg added a commit to rodolforg/synfig that referenced this issue Aug 14, 2021
rodolforg added a commit to rodolforg/synfig that referenced this issue Nov 16, 2021
rodolforg added a commit to rodolforg/synfig that referenced this issue Nov 16, 2021
rodolforg added a commit to rodolforg/synfig that referenced this issue Dec 23, 2021
Now user can see, via File > View Dependencies, what files current
canvas depends on.

PS: This PR is another (indirect) step to help fixing synfig#1393 that is
being handled in synfig#2086
rodolforg added a commit to rodolforg/synfig that referenced this issue Dec 24, 2021
Now user can see, via File > View Dependencies, what files current
canvas depends on.

PS: This PR is another (indirect) step to help fixing synfig#1393 that is
being handled in synfig#2086
rodolforg added a commit to rodolforg/synfig that referenced this issue Mar 6, 2022
Now user can see, via File > View Dependencies, what files current
canvas depends on.

PS: This PR is another (indirect) step to help fixing synfig#1393 that is
being handled in synfig#2086
rodolforg added a commit to rodolforg/synfig that referenced this issue Mar 6, 2022
Now user can see, via File > Show Dependencies, what files current
canvas depends on.

PS: This PR is another (indirect) step to help fixing synfig#1393 that is
being handled in synfig#2086
rodolforg added a commit to rodolforg/synfig that referenced this issue Aug 13, 2022
Now user can see, via File > Show Dependencies, what files current
canvas depends on.

PS: This PR is another (indirect) step to help fixing synfig#1393 that is
being handled in synfig#2086
rodolforg added a commit to rodolforg/synfig that referenced this issue Aug 13, 2022
Now user can see, via File > Show Dependencies, what files current
canvas depends on.

PS: This PR is another (indirect) step to help fixing synfig#1393 that is
being handled in synfig#2086
morevnaproject pushed a commit to rodolforg/synfig that referenced this issue Nov 22, 2022
Now user can see, via File > Show Dependencies, what files current
canvas depends on.

PS: This PR is another (indirect) step to help fixing synfig#1393 that is
being handled in synfig#2086
morevnaproject pushed a commit that referenced this issue Nov 22, 2022
Now user can see, via File > Show Dependencies, what files current
canvas depends on.

PS: This PR is another (indirect) step to help fixing #1393 that is
being handled in #2086
rodolforg added a commit to rodolforg/synfig that referenced this issue Dec 20, 2022
rodolforg added a commit to rodolforg/synfig that referenced this issue Apr 17, 2023
rodolforg added a commit to rodolforg/synfig that referenced this issue Apr 20, 2023
rodolforg added a commit to rodolforg/synfig that referenced this issue Apr 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants