Bug 451654 - Basename not updating when doing: Krita.instance().writeSetting('','ExportConfiguration-ANIMATION_EXPORT',str_xml)
Summary: Basename not updating when doing: Krita.instance().writeSetting('','ExportCon...
Status: RESOLVED FIXED
Alias: None
Product: krita
Classification: Applications
Component: Scripting (show other bugs)
Version: nightly build (please specify the git hash!)
Platform: Microsoft Windows Other
: NOR normal
Target Milestone: ---
Assignee: Eoin O'Neill
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-03-18 12:48 UTC by Hannah
Modified: 2022-04-12 05:33 UTC (History)
1 user (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Hannah 2022-03-18 12:48:14 UTC
RX480 8G
32GB Ram
i5 6400

Basename not updating when doing: Krita.instance().writeSetting('','ExportConfiguration-ANIMATION_EXPORT',str_xml) 
***
NOTE: If you are reporting a crash, please try to attach a backtrace with debug symbols.
See https://community.kde.org/Guidelines_and_HOWTOs/Debugging/How_to_create_useful_crash_reports
***


STEPS TO REPRODUCE
1.  Create a .kra file with _001 at the end of it.
2. Run Plugin in link below:
https://github.com/Koterminion/Trucendoos/tree/master/Krita_Plugins/Berenvoedsel

OBSERVED RESULT
Basename not updated.


EXPECTED RESULT
Basename updated based on string when going to rendered animation

krita-nightly-x64-5.1.0-prealpha-e75d194a75 
Windows:  10


ADDITIONAL INFORMATION
Comment 1 Hannah 2022-03-18 16:41:09 UTC
Workaround found so far:
Basename won't update when doing the action
Krita.instance().action('render_animation').trigger()

it will update if you do
Krita.instance().action('render_animation_again').trigger()

Is it because the latter catches the XML instead of the QT string? correct me if I am wrong.
Comment 2 Halla Rempt 2022-04-06 13:28:11 UTC
Yes, renderAnimation doesn't get the export configuration. This is the relevant code:

void KisMainWindow::renderAnimation()
{
    if (!activeView()) return;

    KisImageSP image = viewManager()->image();

    if (!image) return;
    if (!image->animationInterface()->hasAnimation()) return;

    KisDocument *doc = viewManager()->document();

    KisDlgAnimationRenderer dlgAnimationRenderer(doc, viewManager()->mainWindow());
    dlgAnimationRenderer.setCaption(i18n("Render Animation"));
    if (dlgAnimationRenderer.exec() == QDialog::Accepted) {
        KisAnimationRenderingOptions encoderOptions = dlgAnimationRenderer.getEncoderOptions();
        KisAnimationRender::render(doc, viewManager(), encoderOptions);
    }
}

void KisMainWindow::renderAnimationAgain()
{
    KisImageSP image = viewManager()->image();

    if (!image) return;
    if (!image->animationInterface()->hasAnimation()) return;

    KisDocument *doc = viewManager()->document();

    KisConfig cfg(true);

    KisPropertiesConfigurationSP settings = cfg.exportConfiguration("ANIMATION_EXPORT");

    KisAnimationRenderingOptions encoderOptions;
    encoderOptions.fromProperties(settings);

    KisAnimationRender::render(doc, viewManager(), encoderOptions);
}

Eoin, can you check whether this was intentional?
Comment 3 Halla Rempt 2022-04-06 13:28:58 UTC
Also, renderAnimationAgain doesn't check whether there's an active view?
Comment 4 Eoin O'Neill 2022-04-08 04:21:16 UTC
Git commit ea220aae2415eb324351ab8e41b92679848311b6 by Eoin O'Neill.
Committed on 08/04/2022 at 04:16.
Pushed by eoinoneill into branch 'master'.

Fix incorrect basename for animation when kra filepath or filename changes.

This should be a middle ground between keeping the users prefered animation name
(which people want when exporting the same animation multiple times to different
formats) and reseting the basename to match krita doc filename (which allows users
to copy a kra file for modifications / backup and render with a separate name,
if they desire.)

If this results in users requesting to keep the last basename used regardless of
file path, we might need to be creative with solutions here. There's a good argument
both ways here.

M  +3    -2    libs/ui/animation/KisDlgAnimationRenderer.cpp

https://invent.kde.org/graphics/krita/commit/ea220aae2415eb324351ab8e41b92679848311b6
Comment 5 Eoin O'Neill 2022-04-12 05:33:05 UTC
Git commit 0cd6e798253d3cdabb5e68590f2dc86be06f64dd by Eoin O'Neill.
Committed on 12/04/2022 at 04:52.
Pushed by eoinoneill into branch 'krita/5.0'.

Fix incorrect basename for animation when kra filepath or filename changes.

This should be a middle ground between keeping the users prefered animation name
(which people want when exporting the same animation multiple times to different
formats) and reseting the basename to match krita doc filename (which allows users
to copy a kra file for modifications / backup and render with a separate name,
if they desire.)

If this results in users requesting to keep the last basename used regardless of
file path, we might need to be creative with solutions here. There's a good argument
both ways here.
(cherry picked from commit ea220aae2415eb324351ab8e41b92679848311b6)

M  +3    -2    libs/ui/animation/KisDlgAnimationRenderer.cpp

https://invent.kde.org/graphics/krita/commit/0cd6e798253d3cdabb5e68590f2dc86be06f64dd