haganbmj / MagicSetEditor2

Magic Set Editor is a program for designing trading cards
Other
15 stars 6 forks source link

Add some capability to export DFCs as individual images per face #32

Open haganbmj opened 1 year ago

haganbmj commented 1 year ago

Sounds like a number of people are using templates that have both faces in the same "card" and then have to post-process the image afterwards to split the result. Seems like it should be possible to add some kind of slicing based on style defined regions to do this automatically on export. Would probably have to consider some kind of UI to permit both merged and split exporting though and that sounds trickier? Maybe just a preference would be sufficient.

haganbmj commented 1 year ago

This appears to be easy enough just within image.cpp when generating the export file. There's going to be some complexity in the file naming I think, but otherwise it seems doable.

The other concern really is just how best to toggle this kind of export behavior on/off and when (if) any additional prompts become necessary when it occurs. image

G-e-n-e-v-e-n-s-i-S commented 5 months ago

I'm currently writing an update which, if merged, will define a function called faces_coordinates at the game level, and overridable by the styles, which defines where the "faces" of the card are. It returns a string which has the following structure:

face_1_left,face_1_top,face_1_width,face_1_height;face_2_left,face_2_top,face_2_width,face_2_height;etc...

So from there, if export scripts had access to a built-in function allowing them to create sub images, similar to the already existing write_image_file function but additionally taking as parameters the bounds of the face within the template, there would be no need for extra UI. The export scripts could just define an option field asking if the faces should be exported individually or together, and the script could then handle the rest by reading from the faces_coordinates function.

haganbmj commented 5 months ago

I added card_region with this update https://github.com/haganbmj/MagicSetEditor2/pull/34, which was a complex object instead of a delineated string. I don't think I ever got around to doing multi-image exports though because you need to handle some quirks around filenames.