Need
I would like to target an instance’s layer(s) associated with a boolean prop.
Analysis
The instance includes:
- A top node with the
componentPropertiesarray with boolean props each with a key with an appended{prop name}#{prop id}, such asHelp text#3807:17 - An associated layer that has an
idof{instance id}:{library component layer id}, such asI347:39718;3807:28801yet, as per the API docs, acomponentPropertyReferencesset tonull. This is the node I want to target.
The instance’s .mainComponent property is a reference to:
- A top component or set node with an
id, in this case119:2895 - A top node also has
componentPropertiesincludingHelp text#3807:17 - A corresponding layer associated with the prop with an
id, in this case119:3091, as well ascomponentPropertyReferencesarray includingvisible: Help text#3807:17
The actual variant resides in a separate library file, and includes:
- A top node with id
3807:27735andcomponentPropertyDefinitionsthat includesHelp text:3807:17 - A corresponding layer with
idof3807:28801andcomponentPropertyReferencesthat includesvisible: "Help text:3807:17".
Problem
- The instance’s
.mainComponentlayeriddoesn’t match the instance’s layerid., which means I can’t use information in the.mainComponentto target that instance’s layer. - The instance’s layer
idDOES match the actual variant via theirids (3807:28801), which can be mapped within the actual variant by matching the prop definition of3807:17.
However, I don’t know how to access the library file programmatically, so I can’t get to these matches. Using importComponentByKeyAsync loads the component locally (which I’d like to avoid) and results in different layer ids anyway, defeating the purpose.
Is there a different way other than mimicing the traversal (from the main component’s layer to the top, then down the same path in the instance) to more directly target a layer in an instance associated with a boolean property?
