Skip to main content
Question

Getting list of component property combinations


shaina1

From an instance node, I’m trying to move up the tree up to the componentSetNode, then to each componentNode so I can grab every valid combination of component properties (sometimes components have unused combinations).
When I run . componentPropertyReferences on the componentNode, I’m getting an empty object back.

Is there another way to tackle this?

This topic has been closed for replies.

7 replies

tank666
  • 4873 replies
  • March 31, 2023

Here is how the componentPropertyReferences property is described in the documentation:

All component properties that are attached on this node. A node can only have componentPropertyReferences if it is a component sublayer or an instance sublayer. It will be null otherwise. The value in the key-value pair refers to the component property name as returned by componentPropertyDefinitions on the containing component, component set or main component (for instances).

Therefore, to get the componentPropertyReferences, you need to traverse the tree of children, its children’s children, etc.


shaina1
  • Author
  • 4 replies
  • March 31, 2023

Traversing the tree doesn’t show anything under componentPropertyReferences for components under a componentSet. And componentPropertyDefinitions isn’t what I’m looking for.


tank666
  • 4873 replies
  • March 31, 2023

Have you traversed the children tree inside the ComponentNode?


shaina1
  • Author
  • 4 replies
  • March 31, 2023

Yes I have, i went from instance → componentNode → componentSetNode → componentNode


tank666
  • 4873 replies
  • March 31, 2023
InstanceNode.mainComponent.parent.children[0].children[0] // etc.

shaina1
  • Author
  • 4 replies
  • March 31, 2023

Why would I go through each element inside a component node? Thats extremely inefficient.


tank666
  • 4873 replies
  • March 31, 2023

Only there you can get a non-null componentPropertyReferences. I wrote about this from the very beginning.


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings