Reputation: 461
I am trying to find a way of listing all the Material objects defined in a scene. Is this even possible, or do I have to traverse the node hierarchy?
Thanks
Upvotes: 1
Views: 556
Reputation: 56625
If the scene is loaded from a file, you can create a scene source (SCNSceneSource
) for that file and get all the identifiers for all materials using:
NSArray *allMaterialIdentifiers = [yourSceneSource identifiersOfEntriesWithClass:[SCNMaterial class]];
From there you can either enumerate the identifiers and get the entry with that identifier or filter all entries to only fetch the ones who's identifier is in the list of material identifiers.
Upvotes: 1