Summary: | Updating fileLayer path from script result in invalid path | ||
---|---|---|---|
Product: | [Applications] krita | Reporter: | tkp <kde> |
Component: | Scripting | Assignee: | Krita Bugs <krita-bugs-null> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | dimula73 |
Priority: | NOR | ||
Version: | 4.1.1 | ||
Target Milestone: | --- | ||
Platform: | Debian testing | ||
OS: | Linux | ||
Latest Commit: | https://commits.kde.org/krita/a4ddedcce316c09e03a578f19018a0442c944af4 | Version Fixed In: | |
Sentry Crash Report: | |||
Attachments: | file layers setProperties test files |
Git commit 2b555ade3e2c84a177c590ab660bdfc1ff042584 by Dmitry Kazakov. Committed on 17/09/2018 at 07:25. Pushed by dkazakov into branch 'master'. Fix setting file path of the file layer through python API M +23 -11 libs/libkis/FileLayer.cpp M +1 -1 libs/libkis/FileLayer.h https://commits.kde.org/krita/2b555ade3e2c84a177c590ab660bdfc1ff042584 Hi, tkp! The bug should be fixed now! Please check if it is really fixed for you in tomorrow's nightly builds: https://binary-factory.kde.org/job/Krita_Nightly_Appimage_Build/ Answer to a bonus question: just calling fileLayer->setProperties(fileLayer->path(), fileLayer->scalinfMethod()) should work for you. Though I'll try to add a separate resetCache() API for that. Git commit 2617256482d43cb8c133281e434662279931ff8e by Dmitry Kazakov. Committed on 17/09/2018 at 08:03. Pushed by dkazakov into branch 'master'. Add resetCache() Python API to FileLayer That is a simple method to reload the image from disk M +6 -0 libs/libkis/FileLayer.cpp M +5 -0 libs/libkis/FileLayer.h M +1 -0 plugins/extensions/pykrita/sip/krita/FileLayer.sip https://commits.kde.org/krita/2617256482d43cb8c133281e434662279931ff8e Hi Dmitry, thanks a lot for your quick fix and advice, will check with the nightly build tomorrow ! It is fixed on my system too, and after using setProperties the file layer image is automatically reloaded. Awesome ! Thanks again Dmitry ! Git commit a4ddedcce316c09e03a578f19018a0442c944af4 by Boudewijn Rempt, on behalf of Dmitry Kazakov. Committed on 24/09/2018 at 06:57. Pushed by rempt into branch 'krita/4.1'. Fix setting file path of the file layer through python API M +23 -11 libs/libkis/FileLayer.cpp M +1 -1 libs/libkis/FileLayer.h https://commits.kde.org/krita/a4ddedcce316c09e03a578f19018a0442c944af4 Git commit 01e31f1be148d01c27b2082ff1a38c55c7d1131f by Boudewijn Rempt, on behalf of Dmitry Kazakov. Committed on 24/09/2018 at 06:57. Pushed by rempt into branch 'krita/4.1'. Add resetCache() Python API to FileLayer That is a simple method to reload the image from disk M +6 -0 libs/libkis/FileLayer.cpp M +5 -0 libs/libkis/FileLayer.h M +1 -0 plugins/extensions/pykrita/sip/krita/FileLayer.sip https://commits.kde.org/krita/01e31f1be148d01c27b2082ff1a38c55c7d1131f |
Created attachment 115026 [details] file layers setProperties test files Hi, 1. Original potential bug using 4.0.4 ------------------------------------- fileLayer.setProperties() seem to prepend the old filename without extension before the new path. # display nodes current path : print("node path : ",node.path()) # node path : /home/user/file-layers-setProperties/file-layers/file-layer-1.png # update file layer path : node.setProperties(node.path().replace("file-layer-1", "file-layer-2"), "None") print("node path : ",node.path()) # node path : file-layer-1/../file-layers-setProperties/file-layers/file-layer-2.png # Expected : file-layers/file-layer-2.png # or : /home/user/file-layers-setProperties/file-layers/file-layer-2.png 2. Evolution using krita 4.1.1 (error message) ---------------------------------------------- Was using a trick based on previous observations to update the path using 4.0.4 (see attached script/file), but Krita 4.1.1 now displays an additional error : Krita has encountered an internal error: SAFE ASSERT (krita): "QFile::exists(path())" in file /home/appimage/workspace/Krita_Stable_Appimage_Build/krita/libs/ui/kis_file_layer.cpp, line 80 Please report a bug to developers! Press Ignore to try to continue. Press Abort to see developers information (all unsaved data will be lost) In the attached zip, a test file, test script and dummy filelayers. Using 4.0.4, no error message is displayed. On both versions, the layer is updated after save/reload. To reproduce on my setup : 1. Open filelayer-setProperties-411.kra 2. Tools > Scripting > Scripter : run test.py 3. should print explanation about the trick and update the path 4. create-delete an empty layer if krita didn't detect the edit 5. save file : Krita displays an error message, click "Ignore" 6. close and re-open the file : the layer should be updated (red) - tested not using the trick under 4.1.1 but the setProperties behaviour is the same as in 4.0.4 - tested placing the fileLayer source files next to the .kra vs in a subfolder, but doesn't seem to help Am I misusing the method / arguments ? Anyone able to reproduce ? Bonus question : is there an function to force-reload a fileLayer source file from python ? For now it seem required to save/close/reopen to display the new one. Thanks for any clues, have a nice day !