Best way to store a list of nodes?

I’m developing an add-on that aims to replace the material node workflow with a layer based workflow.

I have a layers PropertyGroup which defines properties for each layer.

Ideally I would like to store a list of nodes for each layer, but there is no property for storing a list I’m aware of in the Blender API.

Currently I’m storing the list of nodes in a string property and parsing the string to a list as required.

        node_string = layers[layer_stack.layer_index].nodes
        node_string += rgb_node.name + ","
        node_string += math_node.name + ","
        node_string += mix_node.name + ","

Is there a better way to store a list of nodes?

There is, it’s called a CollectionProperty.

I believe you mean I should make a subCollectionProperty for nodes inside of the layer CollectionProperty to store I guess a PointerProperty to store a reference to nodes stored there.

It seams easier to store the node names in a StringProperty and use .split(’,’) to create a list from them when needed, as this avoid having to create a second CollectionProperty.

Thanks for the suggestion though.