Bug 386515 - Nested file layer support
Summary: Nested file layer support
Status: RESOLVED FIXED
Alias: None
Product: krita
Classification: Applications
Component: General (show other bugs)
Version: 4.0 pre-alpha
Platform: Microsoft Windows Microsoft Windows
: NOR normal
Target Milestone: ---
Assignee: Krita Bugs
URL:
Keywords:
: 387354 (view as bug list)
Depends on:
Blocks:
 
Reported: 2017-11-04 04:43 UTC by reptillia39
Modified: 2019-02-01 10:40 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
Example Files (2.96 MB, application/x-zip-compressed)
2017-11-04 04:43 UTC, reptillia39
Details

Note You need to log in before you can comment on or make changes to this bug.
Description reptillia39 2017-11-04 04:43:11 UTC
Created attachment 108701 [details]
Example Files

I attempted to place a file layer that has a file layer within it, and it appears that it cannot work. It gets better, there's a strange message that appears.

The message will appear under Windows 10 x64: 

-
The file associated to a file layer with the name "Layer 3" is not found.

Expected path:
>C:/users/user/AppData/Local/Temp/Screenshot.kra

Do you want to locate it?

-

The expected behavior is that Krita should automatically locate it based on the file that was input of a file layer within that file. Something like that.

-

To replicate the issue I am having, download the URDC Content Creation Support. Ok, now make a new document, and insert Dock.kra as a file layer.

Other way to replicate this issue is to follow these step.

1. Make a new document, and insert any image into it except a file layer.
2. Save the document as Screenshot.kra 
3. Make a new document, and use that newly saved document as a file layer and click on scale to image size. 
4. Save the document as File Layer Document.kra
5. Make a new document with different image size,and insert the File Layer Document.kra
6. Proceed to read the strange message. 

Going ahead and locating it fix the issue, but it isn't the expected behavior.
Comment 1 reptillia39 2017-11-04 05:15:29 UTC
Also, I found there seem to be a offset bug after you get around and locating the original file.
Comment 2 wolthera 2017-11-04 14:53:24 UTC
This is because of the code in Kis_safe_document_loader.ccp line 187.

The file layer is copied to temp for some reason, but it probably ought to remember the original path so it can find file layers it is referencing. I don't know how this should be fixed as I don't quite understand why it is copied.
Comment 3 wolthera 2017-11-27 13:32:31 UTC
*** Bug 387354 has been marked as a duplicate of this bug. ***
Comment 4 Halla Rempt 2018-06-05 14:23:46 UTC

*** This bug has been marked as a duplicate of bug 394211 ***
Comment 5 Halla Rempt 2018-06-05 14:27:14 UTC
We load a copy of the file layer because of https://bugs.kde.org/show_bug.cgi?id=325686 -- it's not safe to be loading a file that can be changed to while we're loading it.
Comment 6 Halla Rempt 2018-06-05 14:33:35 UTC
Git commit 6828f33fe3e92fd4ca151bd44ce1886118d01ed6 by Boudewijn Rempt.
Committed on 05/06/2018 at 14:32.
Pushed by rempt into branch 'krita/4.0'.

Do not allow .kra files as file layers

Nesting .kra files is dangerous, since a .kra file can contain
file layers itself, which is not supported.
Related: bug 394211, bug 325686

M  +4    -1    libs/ui/dialogs/kis_dlg_file_layer.cpp

https://commits.kde.org/krita/6828f33fe3e92fd4ca151bd44ce1886118d01ed6
Comment 7 Halla Rempt 2018-06-05 14:33:40 UTC
Git commit 40a1a0c0999a20744ae08244df10b679f172b724 by Boudewijn Rempt.
Committed on 05/06/2018 at 14:33.
Pushed by rempt into branch 'master'.

Do not allow .kra files as file layers

Nesting .kra files is dangerous, since a .kra file can contain
file layers itself, which is not supported.
Related: bug 394211, bug 325686
(cherry picked from commit 6828f33fe3e92fd4ca151bd44ce1886118d01ed6)

M  +4    -1    libs/ui/dialogs/kis_dlg_file_layer.cpp

https://commits.kde.org/krita/40a1a0c0999a20744ae08244df10b679f172b724
Comment 8 Alex 2018-06-05 15:01:41 UTC
Oh why?... Example: painting background and actors on separate files to be able to reuse background is really great option... Maybe some way to discard nested layers is possible?
Comment 9 Halla Rempt 2018-06-05 15:23:20 UTC
No, because there's no way to know that the .kra file we're loading is a nested .kra file. But you can still use any other file format inside a .kra file. A good way to work would be to export the your separate files to .png, add them as file layers, but keep the original around. Only the projection is used anyway.
Comment 10 wolthera 2019-02-01 10:40:06 UTC
For future reference, this one got modified:

https://bugs.kde.org/show_bug.cgi?id=403816