GithubHelp home page GithubHelp logo

Comments (7)

Investigamer avatar Investigamer commented on August 29, 2024 1

Yeah neither Kefnet nor Lich's Mastery were crashing on my end either, but that is an interesting find regarding the text box size!

EDIT: Got another card crashing - Eater of Virtue
I'll continue to edit this post with each card I find that has this issue so we can get more test cases

from mtg-photoshop-automation.

Investigamer avatar Investigamer commented on August 29, 2024

I was getting this same issue with rendering Toxrill but only with certain templates?

from mtg-photoshop-automation.

Investigamer avatar Investigamer commented on August 29, 2024

2 more cards that crash photoshop when you try to render them:
Ao, the Dawn Sky
Reckoner Bankbuster

In keeping with the trend these both have a lot of text. I'm really not sure what could be causing it, would love to hear ideas if anyone might know?

from mtg-photoshop-automation.

Investigamer avatar Investigamer commented on August 29, 2024

I'm doing some testing with Ao, the Dawn Sky, this problem does indeed have to do with the text contents, specifically it seems for CreatureFormattedTextArea. I have yet to find a noncreature with long text that crashes the app. I took these lines:

new CreatureFormattedTextArea(
                    layer = rules_text,
                    text_contents = this.layout.oracle_text,
                    text_colour = get_text_layer_colour(rules_text),
                    flavour_text = this.layout.flavour_text,
                    is_centred = is_centred,
                    reference_layer = text_and_icons.layers.getByName(LayerNames.TEXTBOX_REFERENCE),
                    pt_reference_layer = text_and_icons.layers.getByName(LayerNames.PT_REFERENCE),
                    pt_top_reference_layer = text_and_icons.layers.getByName(LayerNames.PT_TOP_REFERENCE),
                ),

And I changed text_contents to a random small string like "eedfwefwefg" and the card renders perfectly with that text. So something about Ao, the Dawn Sky's text is causing the crash

Then I also tried manually changing the json for this creature and removed one line from the Oracle text "Look at the top seven cards of your library." and it ran fine, so the length does appear to be the issue specifically.

ALSO worth noting this very same card renders just fine in NormalClassicTemplate, but crashes for NormalTemplate. The difference between these is that the rules text is always passed through a FormattedTextArea object for the classic template, where it goes through CreatureFormattedTextArea in the NormalTemplate. I suspected the crash is being caused by the script that checks that the text isn't colliding with the power/toughness box since that's the major difference: Classic template doesn't have power/toughness inside the text box. HOWEVER, I changed the NormalTemplate to use the regular formattedtext instead of creature to test this theory... no dice, still crashes. Going to continue digging around.

Another difference between the NormalTemplate and NormalClassic is that the font size of on the PSD are different one is 8.9, one is 8.7. So I tried changing NormalTemplate to 8.7.... still crash :/

from mtg-photoshop-automation.

ndepaola avatar ndepaola commented on August 29, 2024

turns out that photoshop crashes when you try to insert text into a textbox that's not large enough to contain it (specifically, format_text is what breaks, right at the end when all the changes are committed to the layer):

image

increasing the height of the rules text areas will solve this. in the meantime i'll have a think about how to circumvent this issue without resorting to template updates. curious that i couldn't recreate this issue with kefnet but i could with ao

edit: kefnet's rules text also exceeds the rules text layer area but doesn't crash on my machine - increasing the height of the rules text area did solve the issue for ao on my machine though - need to investigate further

image

from mtg-photoshop-automation.

ndepaola avatar ndepaola commented on August 29, 2024

greater morphling works fine so it's not a character limit

image

from mtg-photoshop-automation.

Investigamer avatar Investigamer commented on August 29, 2024

So I think I have a better way to fix this issue than the ideas I brainstormed in the past, here's what I did for proxyshop that seems to work reliably:

  • if FormattedTextArea contents has over 280 characters, insert the contents and the flavor text, then:
  • scale_text_to_fit_height() -- New function similar to scale to fit reference, feed it the height of the reference increased by 1%
  • everything else in the text_layers class runs as normal afterwards (insert text, format it, scale it, add divider, etc)

I realized the crash happens during format_text(), not when the text is initially inserted. It must have something to do with action descriptors being unable to assign text properties when the text is far outside the bounds or something? So, here we do a pre-format resize of the text till its low enough to almost fit.

The reason I chose to use the height of the reference + 1% is because this scaling is being done before the text is formatted. The reason we scale after formatting is to account for any size loss caused by formatting the symbols and such. I wanted to leave just enough headroom to keep outside the bounds and the final scale_text_to_fit_reference will make the last reduction if needed :)

from mtg-photoshop-automation.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.