Jump to content
You must now use your email address to sign in [click for more info] ×

Are tags supported from Design to Spine?


Recommended Posts

Hi all,

I was wondering if Tags are supported in Design the same way they are in Photoshop? I thought they were as it was adding the tags in the json file. But then I realized, the names were carrying over exactly the same. Meaning, the tags aren't removed. PS removes the brackets and tags and only the name remains on the images. I'm also noticing that groups are not supported. When creating slices from the group, the images fail to load in Spine. 

Tags

Tags in square brackets can be used in layer and group names to customize the output. The tags can be anywhere in the name, for example head [slot] or [slot] head. If :name is omitted, the layer or group name is used.

Group and layer names:

  • [bone] or [bone:name] Layers, slots, and bones are placed under a bone. The bone is created at the center of a visible layer. Bone groups can be nested.
  • [slot] or [slot:name] Layers are placed in a slot.
  • [skin] or [skin:name] Layers are placed in a skin. Skin layer images are output in a subfolder for the skin.
  • [folder] or [folder:name] Layers images are output in a subfolder. Folder groups can be nested.
  • [ignore] Layers, groups, and any child groups will not be output.

Group names:

  • [merge] Layers in the group are merged and a single image is output.

Layer names:

  • [path:name] Specifies the image file name, which can be different from the attachment name. Whitespace trimming is required. Can be used on a group with [merge].
Link to comment
Share on other sites

On 6/7/2020 at 1:37 AM, amcmahon said:

...PS removes the brackets and tags and only the name remains on the images...

PS itself as default doesn't do that, instead this longer custom PhotoshopToSpine.jsx spine-script does all the bloody work here (see at github)! - Here just the brackets replace stuff via regular expressions, aka ...

...
for (var i = 0; i < layersCount; i++) {
		if (cancel) return;
		var layer = layers[i];
		if (layer.kind != LayerKind.NORMAL && !isGroup(layer)) continue;

		var name = stripTags(layer.name).replace(/.png$/, "");
		name = name.replace(/[\\\/:"*?<>|]/g, "").replace(/^\.+$/, "").replace(/^__drag$/, ""); // Illegal.
		name = name.replace(/^(con|prn|aux|nul|com[0-9]|lpt[0-9])(\..*)?$/i, ""); // Windows.
		if (!name || name.length > 255) {
			error("Layer name is not a valid attachment name:\n\n" + layer.name);
			continue;
		}
...

Since ADesigner doesn't support any way of fine grade scripting, or scripting in general, all you can do here is just to rework the JSON files it generates afterwards. You can write some own Python script (or the like ), which then addresses those TAGS inside of JSON files afterwards, by removing the brackets and tags etc. out of the generated JSON file.

 

☛ 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

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.