API Access to Symbol name

Provide API access to symbol name. In my plugin I would like to be able to show what symbol the selected object on the artboard is an instance of.

Something like this:

function showTypesHandlerFunction(selection) {
let node = selection.items[0];

console.log("The selected node is a: " + node.constructor.name);
if (node.constructor.name == “SymbolInstance”) {
console.log("Yes! This is a symbol instance of: " + node.instanceOf());
} else {
console.log(“No, this is not a symbol instance.”);

// Print out types of all child nodes (if any)
node.children.forEach(function (childNode, i) {
console.log("Child " + i + " is a " + childNode.constructor.name);

@drcwj you should be able to get the name of a node by logging node.name. Reference: https://adobexdplatform.com/plugin-docs/reference/scenegraph.html#scenenode

Nice to meet you, Steve! node.name gives you the instance name (the layer name). I’m looking for the parent symbol name (i.e., the name of the symbol that the layer is an instance of). So, for example, the layer might be something like
“submit-button’ which is an instance of the symbol “button”. Is there anyway to access that with the current API object model?

As far as I know, every symbol is an instance of SymbolInstance, which you are already checking in your code snippet above. The layer name is one way of determining if the selected node is an instance of a certain symbol. Another way would be using pluginData (https://adobexdplatform.com/plugin-docs/reference/scenegraph.html#scenenodeplugindata--). Please, others, chime in if anyone has a better answer for this!

You can get the “symbolId” from any symbol instance, and use that to find all instances in the document that belong to the same symbol master.

In the UI, all Symbol masters are listed in the Assets section, and they can be renamed there. However the plugin API does not seem to expose a way to get the list of symbol masters (https://adobexdplatform.com/plugin-docs/reference/assets.html). I think this is a feature request for @stevekwak

Yes, exactly. That is the feature request. To provide access to the symbol master name.

Yeap. this would be a feature request. You mentioned, “In my plugin I would like to be able to show what symbol the selected object on the artboard is an instance of.”, could you provide more details around this use case? Having more detailed use case will help us prioritize your feature request

Sure. Here you go:

Typically symbol creation starts by drawing on the artboard and working in the Layers panel. Editing layer and object names as you work helps you to keep track of what each object and layer in the panel represents. Once layers are converted
to symbols, however, it is not easy, over in the Assets panel, to identify and rename each “Symbol XX” asset to something meaningful. This is particularly true when you are working with tens or hundreds of symbols on an artboard and the thumbnails might all
look very similar. The purpose of this plugin is to make it easy to know which symbol in the Assets panel is the master symbol for the symbol instance you select in the artboard. When you select the symbol and press CTRL + ALT + K it will display:

Symbol Name: <this is what I can’t get right now, it’s the name of the symbol in the Assets panel>

Symbol Instance:

For example:

Symbol Name: button

Symbol Instance: save-button


Symbol Name: button

Symbol Instance: cancel-button

Does that make sense?