On 24/04/2018 at 23:17, xxxxxxxx wrote:
Just a thought.
But you're the only one to know if this might work, as it depends on what you actually need.
Without knowing the whole context it's hard to evaluate if this "short-cut" is useful.
What if you could reduce the times you need to check for deleted/inserted materials, by looking at the material count in the scene, and the count in your BaseArray<BaseLink>. If the counts are equal, you know no material was added or removed, and no need to check further.
Is this a safe to assume?
Well, consider that when user removes or inserts materials there will always be an EVMSG_CHANGE sent out. But a user will not be able to AND remove AND insert a material without an EVMSG_CHANGE being sent between the remove and insert. Which then means you can detect the removal/insertion simply by looking at the count.
What will not be supported is when scripts or plugins are involved, which might perform remove and insert in a single step and perform a single EventAdd() afterwards, resulting in the same count of materials before as after.
But as said, this depends on the context you need.