GithubHelp home page GithubHelp logo

Comments (15)

ndepaola avatar ndepaola commented on June 27, 2024

I think I forgot to rename the template on the google drive to normal.psd - if you do that and move it into the templates folder, that should fix your file path issues

With regards to the python script, what bash command are you using to execute it & have it work properly? Is it different to the command defined in the proxy.jsx file?

from mtg-photoshop-automation.

duxprime avatar duxprime commented on June 27, 2024

It seems like each there are a number of template names that proxyNormal() can take as an argument ("normal", "transform-front", "transform-back"). Should those all point to the template from Google Drive?

As far the Python script, if I run it using the same command proxy.jsx does (e.g.,python get_card_info.py "Force of Will") it works just fine and generates a new card.json. But when ran from the script, one isn't generated and it only continues if I previously manually created one.

I'm wondering if maybe Photoshop CS6 doesn't support the app.system() call. No exceptions are being thrown, though.

from mtg-photoshop-automation.

duxprime avatar duxprime commented on June 27, 2024

Okay, so I figured some things out.

The Python script wasn't executing because the location where proxy.jsx was searching was the directory of the program executing the script ("C:\Program Files\Adobe\Adobe Photoshop CS6 (64 Bit)"). I changed the call to use an absolute path:

// proxy.jsx
app.system("python " + filePath + "\\scripts\\get_card_info.py \"" + cardName + "\"");

I had a similar issue with the location the Python script would create card.json, so I made that an absolute path as well:

# get_card_info.py
path = os.path.dirname(sys.argv[0]) 
print("Dumping to: " +  path);
with open(path + "\card.json", 'w') as f:
   json.dump(json_dump, f)

However, I'm still seeing some issues in the final output of the cards:

  • The mana symbols are very large
  • The background isn't transparent in the upper left corner
  • The art is getting cropped/zoomed strangely

Force of Will

Wasteland

from mtg-photoshop-automation.

ndepaola avatar ndepaola commented on June 27, 2024

Hey again,
Glad to see things are working a little better now.

Regarding the mana costs being left justified, I can't recreate that on my end but I may have found where the issue is originating from. Try updating your formatText.jsx file and see if the new version fixes it.

For the sizes of mana costs and artworks, you can adjust the scaling of them in the text. Search for the number 160 in proxy.jsx and try replacing those instances with 80, and see if that fixes the mana cost. For the artwork, you can replace the number 100 on line 44 of frame.jsx with 50, and see if that fixes the artwork scaling issue.

These scaling issues seem to crop up differently on everyone's PC's and I can't seem to recreate them, so this is the best I can do for now :/

(The lack of transparency in the top corners is due to the art scaling incorrectly, so this should fix it. However, in practice that issue doesn't matter anyway, because when adding the print bleed edge, it'll cover up the non-transparent corners.)

There are a number of templates that the code references that I haven't made public - these are still in development, but I use this git for source control in the interim. Adding references to them doesn't break anything, since the main template can't support those card types anyway, so it's not worth adding another branch imo.

I've also made an adjustment to the set symbol gradient function, so that should fix that issue too.

from mtg-photoshop-automation.

duxprime avatar duxprime commented on June 27, 2024

Okay. I pulled your latest changes and made the modifications you suggested. The art seems to be better, but the mana symbols are still offset (even after getting them to a better size).

Any suggestions?

Force of Will

from mtg-photoshop-automation.

brd55 avatar brd55 commented on June 27, 2024

@ndepaola I've been following the steps here (except for the change to get_card_info.py, as that made things worse). I'm still getting an error on line 43 of proxy.jsx when it hits var jsonParsed = JSON.parse(JSON.parse(cardJSON));. Any idea what the issue might be?

from mtg-photoshop-automation.

ndepaola avatar ndepaola commented on June 27, 2024

hey - is get_card_info generating a card.json file? It might be that it's trying to parse an empty json file or something similar. Which card are you trying to run the script for?

from mtg-photoshop-automation.

tcasparro avatar tcasparro commented on June 27, 2024

Here is the code to fix the mana cost positioning. It should go after the formatText() line in the "Mana Cost" section.

    var leftShift = ((cardManaCost.length/3)*70);
    var idmove = charIDToTypeID( "move" );
    var desc2 = new ActionDescriptor();
    var idnull = charIDToTypeID( "null" );
        var ref2 = new ActionReference();
        var idLyr = charIDToTypeID( "Lyr " );
        var idOrdn = charIDToTypeID( "Ordn" );
        var idTrgt = charIDToTypeID( "Trgt" );
        ref2.putEnumerated( idLyr, idOrdn, idTrgt );
    desc2.putReference( idnull, ref2 );
    var idT = charIDToTypeID( "T   " );
        var desc3 = new ActionDescriptor();
        var idHrzn = charIDToTypeID( "Hrzn" );
        var idRlt = charIDToTypeID( "#Rlt" );
        desc3.putUnitDouble( idHrzn, idRlt, -leftShift );
        var idVrtc = charIDToTypeID( "Vrtc" );
        var idRlt = charIDToTypeID( "#Rlt" );
        desc3.putUnitDouble( idVrtc, idRlt, 0.000000 );
    var idOfst = charIDToTypeID( "Ofst" );
    desc2.putObject( idT, idOfst, desc3 );
    executeAction( idmove, desc2, DialogModes.NO );

from mtg-photoshop-automation.

brd55 avatar brd55 commented on June 27, 2024

I'm certainly not seeing any card.json. I've tried with Wasteland and Purphoros. I've tried a few different things with the path, thinking maybe that would work. No luck so far.

from mtg-photoshop-automation.

ndepaola avatar ndepaola commented on June 27, 2024

The issue might be in your python installation then. Try running the get_card_info script from the command line - change directory into the scripts folder, then try the command python get_card_info.py "Purphoros, God of the Forge", and see what the result is. If everything's set up correctly, that should generate a card.json in the scripts folder.

from mtg-photoshop-automation.

brd55 avatar brd55 commented on June 27, 2024

Thanks for the response. That worked just fine from the terminal. And then if I try and run proxyAll, it works fine. So I'm guessing maybe it's not saving card.json in the right directory? Either that or something is wrong with how I'm inputting the card name? For the former, I've tried a few variations, including
# get_card_info.py path = os.path.dirname(sys.argv[0]) print("Dumping to: " + path); with open(path + "\card.json", 'w') as f: json.dump(json_dump, f)

My art name is Purphoros, God of the Forge (Eric Deschamps).jpg

from mtg-photoshop-automation.

ndepaola avatar ndepaola commented on June 27, 2024

Are you on a Windows computer or a Mac? It seems like the script can run into permissions issues when trying to save card.json on macOS when run through Photoshop, while working from the terminal. On Windows it appears to work fine both ways (at least on my system).

from mtg-photoshop-automation.

brd55 avatar brd55 commented on June 27, 2024

I'm running Windows 10, Photoshop CS6. I've even tried running PS as an admin.

from mtg-photoshop-automation.

ndepaola avatar ndepaola commented on June 27, 2024

Floris Warmenhoven nailed down the source of this issue on macOS a bit earlier today, and I've included the fix in the latest commit. I'm hoping the same issue is occurring on your system so it can be solved in the same way. Could you try downloading the latest version of get_card_info.py and see if anything changes?

from mtg-photoshop-automation.

duxprime avatar duxprime commented on June 27, 2024

@redsunsoft's code worked for me with the latest changes in the repo to correctly reposition the mana symbols. That solves all of my issues I had when I first opened this, so I'm going to close out this bug.

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.