Author Topic: Changing the source of an artwork  (Read 286 times)

zpaolo11x

  • Hero Member
  • *****
  • Posts: 582
    • View Profile
    • My deviantart page
Changing the source of an artwork
« on: May 24, 2019, 05:14:13 AM »
Let's say I have something like

testobject = fe.add_artwork("snap",0,0,200,200)

is it possible to change the "source" of the artwork data, for example from snap to flyer, on the fly?

keilmillerjr

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 980
    • View Profile
Re: Changing the source of an artwork
« Reply #1 on: May 24, 2019, 05:25:57 AM »
file_name - [image & artwork only] Get/set the name of the image/video file being shown. Note that if you set this on an artwork or a dynamic image object it will get reset the next time the user changes the game selection. If file_name is contained in an archive, this string should be formatted: "<archive_name>|"

rand0m

  • Sr. Member
  • ****
  • Posts: 242
    • View Profile
Re: Changing the source of an artwork
« Reply #2 on: May 24, 2019, 05:42:11 AM »
Magic token and if statement should work but I think it would require a reload. perhaps use it with signal?

zpaolo11x

  • Hero Member
  • *****
  • Posts: 582
    • View Profile
    • My deviantart page
Re: Changing the source of an artwork
« Reply #3 on: May 24, 2019, 05:50:05 AM »
file_name - [image & artwork only] Get/set the name of the image/video file being shown. Note that if you set this on an artwork or a dynamic image object it will get reset the next time the user changes the game selection. If file_name is contained in an archive, this string should be formatted: "<archive_name>|"

This is what I'm trying to do right now. My theme relies on .index_offset and .rawset_index_offset to work smoothly and file_name doesn't work with that (it works but each time the index_offset is changed it reverts to the old artwork). It seems that force-loading artwork with file_name=fe.get_art() etc. works smoothly enough, so it's a good workaround.

zpaolo11x

  • Hero Member
  • *****
  • Posts: 582
    • View Profile
    • My deviantart page
Re: Changing the source of an artwork
« Reply #4 on: May 24, 2019, 06:32:18 AM »
file_name - [image & artwork only] Get/set the name of the image/video file being shown. Note that if you set this on an artwork or a dynamic image object it will get reset the next time the user changes the game selection. If file_name is contained in an archive, this string should be formatted: "<archive_name>|"

There are some issues with this solution: if the same artwork (say "snap") contains both audio and video, by default it loads video. The instructions says to use the "Art.ImageOnly" parameter, but that throws an error, and using "Art.ImagesOnly" (with an "s") doesn't seem to change either, still it tries to load videos.

zpaolo11x

  • Hero Member
  • *****
  • Posts: 582
    • View Profile
    • My deviantart page
Re: Changing the source of an artwork
« Reply #5 on: May 24, 2019, 08:24:49 AM »
My bad, I forgot one parameter in the function call :/ Now it seems to work perfectly