Skip to content

Commit

Permalink
Merge pull request GafferHQ#5162 from ericmehl/add-inkscape-version
Browse files Browse the repository at this point in the history
Support newer Inkscape versions
  • Loading branch information
johnhaddon authored Feb 24, 2023
2 parents 3a2408a + 34fedff commit 84733df
Show file tree
Hide file tree
Showing 5 changed files with 214 additions and 168 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ jobs:
- name: Install toolchain (Windows)
run: |
python -m pip install scons
Invoke-WebRequest -Uri "https://inkscape.org/gallery/item/18067/inkscape-0.92.5-x64.exe" -OutFile "inkscape.exe"
Invoke-WebRequest -Uri "https://inkscape.org/gallery/item/37363/inkscape-1.2.2_2022-12-09_732a01da63-x64.exe" -OutFile "inkscape.exe"
Start-Process .\inkscape.exe /S -NoNewWindow -Wait
shell: pwsh
if: runner.os == 'Windows'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/main/sconsOptions
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ if sys.platform == "win32" :
LOCATE_DEPENDENCY_LIBPATH=os.path.join(os.environ["GAFFER_BUILD_DIR"], "lib")
LOCATE_DEPENDENCY_PYTHONPATH=os.path.join(os.environ["GAFFER_BUILD_DIR"], "python")
GLEW_LIB_SUFFIX = "32"
INKSCAPE = "C:\\Program Files\\Inkscape\\inkscape.com"
INKSCAPE = "C:\\Program Files\\Inkscape\\bin\\inkscape.exe"
WARNINGS_AS_ERRORS = False
APPLESEED_ROOT = None
SPHINX = "noSphinxYet"
5 changes: 5 additions & 0 deletions Changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ Documentation

- Added more Python examples to the Scripting Reference "Common Operations" article.

Build
-----

- Added support for Inkscape versions greater than 1.0.

1.2.0.2 (relative to 1.2.0.1)
=======

Expand Down
19 changes: 15 additions & 4 deletions SConstruct
Original file line number Diff line number Diff line change
Expand Up @@ -677,6 +677,9 @@ if not haveInkscape and env["INKSCAPE"] != "disableGraphics" :
sys.stderr.write( "ERROR : Inkscape not found. Check INKSCAPE build variable.\n" )
Exit( 1 )

inkscapeHelp = subprocess.check_output( [ env["INKSCAPE"], "--help" ], universal_newlines=True )
env["INKSCAPE_USE_EXPORT_FILENAME"] = True if "--export-filename" in inkscapeHelp else False

haveSphinx = conf.checkSphinx()

if not conf.checkQtVersion() :
Expand Down Expand Up @@ -1739,14 +1742,22 @@ def buildImageCommand( source, target, env ) :
os.makedirs( outputDirectory )

args = [
"--export-png={}".format( os.path.abspath( filename ) ),
env["INKSCAPE"],
"--export-id={}".format( substitutions["id"] ),
"--export-width={:d}".format( substitutions["width"] ),
"--export-height={:d}".format( substitutions["height"] ),
"--export-background-opacity=0",
os.path.abspath( svgFilename )
"--export-background-opacity=0"
]
subprocess.check_call( [ env["INKSCAPE"] ] + args )
if env["INKSCAPE_USE_EXPORT_FILENAME"] :
args += [
"--export-filename={}".format( os.path.abspath( filename ) ),
"--export-overwrite",
]
else :
args.append( "--export-png={}".format( os.path.abspath( filename ) ) )
args.append( os.path.abspath( svgFilename ) )

subprocess.check_call( args )

def validateAndFlattenImageOptions( imageOptions, svg ) :

Expand Down
Loading

0 comments on commit 84733df

Please sign in to comment.