Pawl Posted November 24, 2018 Share Posted November 24, 2018 I'm using Affinity Designer for Windows and exporting SVGs with gradients for use with Unity. Unfortunately, Unity's SVG importer seems to have issues with the gradients. Here is what the Unity developer said: Quote What happens is that Affinity Designer exported the gradient definition *after* the path that uses it. Although this seems to be conformant with the SVG spec, we do not currently support this and we require the <def> section to be defined before the elements that reference it.We will try to improve on this in future versions of the SVG importer. In the meantime, maybe there's an option to force Affinity Designer to export the gradient definitions ealier in the file? For your example, I manually moved the <def> section before the <path> to fix it. For reference, here is the exported circle w/ gradient: <?xml version="1.0" encoding="UTF-8" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg width="54px" height="54px" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" xmlns:serif="http://www.serif.com/" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:1.41421;"><path id="GradientHill" d="M0.012,26.717c0,-14.743 11.97,-26.713 26.714,-26.713c14.743,0 26.713,11.97 26.713,26.713c0,14.743 -11.97,26.713 -26.713,26.713c-14.744,0 -26.714,-11.97 -26.714,-26.713Z" style="fill:url(#_Linear1);"/><defs><linearGradient id="_Linear1" x1="0" y1="0" x2="1" y2="0" gradientUnits="userSpaceOnUse" gradientTransform="matrix(3.2714e-15,-53.4261,53.4261,3.2714e-15,26.7255,53.43)"><stop offset="0" style="stop-color:#9d9d9d;stop-opacity:1"/><stop offset="0.47" style="stop-color:#e9e9e9;stop-opacity:1"/><stop offset="1" style="stop-color:#fff;stop-opacity:1"/></linearGradient></defs></svg> Does anyone know if what he says is possible? An AD export option to force gradients to be defined earlier in the file? Thanks! Quote Link to comment Share on other sites More sharing options...
v_kyr Posted November 24, 2018 Share Posted November 24, 2018 Of course that would be possible too. Just take a look at certain SVG format and tutorial sites in order to see that it´s usually common practise: https://developer.mozilla.org/en-US/docs/Web/SVG/Element/defs http://tutorials.jenkov.com/svg/defs-element.html http://svg.tutorial.aptico.de/start3.php?knr=7&kname=Dokumentstruktur II&uknr=7.2&ukname=Das defs-Element und das use-Element Quote ☛ Affinity Designer 1.10.8 ◆ Affinity Photo 1.10.8 ◆ Affinity Publisher 1.10.8 ◆ OSX El Capitan ☛ Affinity V2.3 apps ◆ MacOS Sonoma 14.2 ◆ iPad OS 17.2 Link to comment Share on other sites More sharing options...
Pawl Posted November 24, 2018 Author Share Posted November 24, 2018 I mean is there an existing export option within AD to modify the format of the generated SVG upon export? The Unity engineers will work on a better SVG importer, but for now I am unable to work around this limitation (without manually editing the generated SVG of course). Quote Link to comment Share on other sites More sharing options...
v_kyr Posted November 25, 2018 Share Posted November 25, 2018 No AFAIK there isn't actually any Affinity SVG option/setting which would affect this, so you will probably have to rearrange the generated SVG code manually. Quote ☛ Affinity Designer 1.10.8 ◆ Affinity Photo 1.10.8 ◆ Affinity Publisher 1.10.8 ◆ OSX El Capitan ☛ Affinity V2.3 apps ◆ MacOS Sonoma 14.2 ◆ iPad OS 17.2 Link to comment Share on other sites More sharing options...
John Rostron Posted November 25, 2018 Share Posted November 25, 2018 You should post an explicit Feature Request in the Suggestions for Affinity Designer sub-forum. John jamesholden 1 Quote Windows 10, Affinity Photo 1.10.5 Designer 1.10.5 and Publisher 1.10.5 (mainly Photo), now ex-Adobe CC CPU: AMD A6-3670. RAM: 16 GB DDR3 @ 666MHz, Graphics: 2047MB NVIDIA GeForce GT 630 Link to comment Share on other sites More sharing options...
Staff Dan C Posted November 25, 2018 Staff Share Posted November 25, 2018 Hi Pawl As other members have confirmed, there's no way to change this from within Affinity currently and any changes will need to be done manually. I've moved this thread to our Feature Requests section of the forums! Quote Please note - I am currently out of the office for a short while whilst recovering from surgery (nothing serious!), therefore will not be available on the Forums during this time. Should you require a response from the team in a thread I have previously replied in - please Create a New Thread and our team will be sure to reply as soon as possible. Many thanks! Link to comment Share on other sites More sharing options...
Pawl Posted November 25, 2018 Author Share Posted November 25, 2018 Thanks guys! I can workaround for now but will follow up with the Unity devs. Ideally, their parser would account for this export format, considering it's a standard part of the SVG spec. Dan C and jamesholden 2 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.