View Issue Details

IDProjectCategoryView StatusLast Update
0004154DarkRadiantGUIpublic09.01.2020 19:25
Reportergrayman Assigned Togreebo  
Status closedResolutionfixed 
Product Version2.0.2 
Target Version2.6.0Fixed in Version2.6.0 
Summary0004154: DR doesn't show readable background image changes
DescriptionThe default behavior for a multi-page readable is to show the same background image for every page. This is how the standard multi-page gui is written.

It's possible, however, to upgrade the standard gui so that a different background image can be used for each page.

TDM understands how to read the upgraded gui, and does what it's supposed to do: show the background image the gui is defining per page.

However, DR's Readable Editor assumes the background image never changes. This makes it difficult for people who want to include images on their readable pages.

Please enhance the Readable Editor to account for a different background image per page. In other words, use the code in the gui definition to show the background instead of assuming the same background on each page.
TagsNo tags attached.




23.05.2015 20:52

viewer   ~0007528

In the custom gui for a readable that uses different images, the following routine handles the image changes as the pages turn. "ContentsFadeIn" gets called with each page turn, which is why I added the code here.

windowDef ContentsFadeIn
    notime 1
    onTime 0
        transition "leftTitle::forecolor" "0 0 0 0" "0 0 0 0.8" READABLE_FADE_TIME;
        transition "rightTitle::forecolor" "0 0 0 0" "0 0 0 0.8" READABLE_FADE_TIME;
        transition "leftBody::forecolor" "0 0 0 0" "0 0 0 0.8" READABLE_FADE_TIME;
        transition "rightBody::forecolor" "0 0 0 0" "0 0 0 0.8" READABLE_FADE_TIME;

    // Since "BackgroundFadeIn" isn't called each time a page turns (the background is
    // assumed to be constant by the standard readable gui code), we have to add
    // extra code here to handle per-page background images, since "ContentsFadeIn" IS
    // called with each page turn.
    // The following code handles the background image change as pages
    // are turned. As of DR 2.02, DR can't handle image changes, so you
    // have to refer to this section to make sure your text is appropriate
    // for the image on a particular page.

    // If you prepend pages, make sure the numbers checked here match the expected behavior.

    if ("gui::curPage" == 1)
        set "backgroundImage::background" "guis/assets/readables/books/image1";
    else if ("gui::curPage" == 2)
        set "backgroundImage::background" "guis/assets/readables/books/image2";
    else if ("gui::curPage" == 3)
        set "backgroundImage::background" "guis/assets/readables/books/image3";
    else if ("gui::curPage" == 4)
        set "backgroundImage::background" "guis/assets/readables/books/image4";
    else if ("gui::curPage" == 5)
        set "backgroundImage::background" "guis/assets/readables/books/image5";
    else if ("gui::curPage" == 6)
        set "backgroundImage::background" "guis/assets/readables/books/image6";


07.07.2015 07:05

administrator   ~0007621

Not as easy as it sounds, as GUI scripting support is only rudimentary existent in DR.


07.07.2015 13:01

administrator   ~0007629

This is especially tricky since the referred GUI variable gui::curPage is set by a D3 script (in tdm_readables.script).


07.07.2015 15:11

viewer   ~0007630

If it's too tricky, then leave it as is.


02.01.2018 05:37

administrator   ~0009955

Is it possible to point me to an example GUI where this is used? The mission name would be enough. Otherwise I'd need to construct my own GUI to investigate the problem again.


02.01.2018 12:18


journal.pk4 (2,404,793 bytes)


02.01.2018 12:21

viewer   ~0009956

Attached "journal.pk4".

Use the readable editor to edit the book on the desk, and scroll through the pages.

Note that the image on the right-hand page doesn't change.

Play the mission "Journal".

Frob the book and scroll through the pages. Note that the right-hand images change.

If an author is trying to provide an image background where text will float around images, rather than just having the image as a background, they won't be able to do it because the page-to-page gui doesn't change in the readable editor.


02.01.2018 13:41

administrator   ~0009957

Thanks for the PK4!


02.01.2018 17:52

administrator   ~0009963

After the recent GUI advancements needed to run the readme.txt/darkmod.txt GUI previews this turned out to be rather easy. Fixed in 5f88cde5.


02.01.2018 19:04

viewer   ~0009964

Great! Thank you.

Related Changesets

DarkRadiant: master 5f88cde5

2018-01-02 18:51:38


Details Diff
Resolve 0004154: DR doesn't show readable background image changes.
While DR is unlikely to support every possible case (especially stuff driven by a game script), this particular GUI as reported in the issue report can be supported by running the GUI script in ContentsFadeIn and setting the gui::curPage state variable as done by TDM's readable GUI code.
Affected Issues
mod - plugins/dm.gui/ReadableEditorDialog.cpp Diff File
mod - plugins/dm.gui/gui/GuiScript.cpp Diff File
mod - plugins/dm.gui/gui/GuiScript.h Diff File

Issue History

Date Modified Username Field Change
23.05.2015 20:06 grayman New Issue
23.05.2015 20:46 grayman Summary DR doesn't show readable background images changes => DR doesn't show readable background image changes
23.05.2015 20:52 grayman Note Added: 0007528
07.07.2015 07:05 greebo Note Added: 0007621
07.07.2015 07:05 greebo Status new => acknowledged
07.07.2015 13:01 greebo Note Added: 0007629
07.07.2015 15:11 grayman Note Added: 0007630
02.01.2018 05:37 greebo Note Added: 0009955
02.01.2018 12:18 grayman File Added: journal.pk4
02.01.2018 12:21 grayman Note Added: 0009956
02.01.2018 13:41 greebo Note Added: 0009957
02.01.2018 17:45 greebo Target Version => 2.6.0
02.01.2018 17:45 greebo Assigned To => greebo
02.01.2018 17:45 greebo Status acknowledged => assigned
02.01.2018 17:52 greebo Note Added: 0009963
02.01.2018 17:52 greebo Status assigned => resolved
02.01.2018 17:52 greebo Fixed in Version => 2.6.0
02.01.2018 17:52 greebo Resolution open => fixed
02.01.2018 19:04 grayman Note Added: 0009964
28.12.2019 11:00 greebo Status resolved => closed
09.01.2020 19:25 greebo Changeset attached => DarkRadiant master 5f88cde5