Hello! I am curious if there are any gotchas to be aware of with using c4d.threading with thinking particles in Python.
Specifically, if I have two particle groups (let's say groupA
and groupB
), will each thread performing calculations on groupA
that depend on groupB
and making changes to either of these groups be able to see the results recorded simultaneously as stored in the document as the threads run through their set of assigned particles to calculate?
Let me break it down even further.
Let's say I have 100k particles in groupA
that I am going to break up into 10k chunks across 10 threads. At some point in the animation, each particle is instructed to find a match with a particle in groupB
to act as a unique target (think of the particle in groupA
acting as a homing missile trying to land on a particle in groupB
). When the groupA
particle gets matched with the groupB
particle, a bool switch stored in a TP data channel (matched
) is set on the groupB
particle to remove it as a potential match for other groupA
particles. This way, there are no groupA
particle overlaps when all the particles have reached their targets.
So essentially what I'm asking is... is this difficult to implement with threading? As each 10k particle count thread calculates, will they be able to see matches made via accessing groupB
TP channel data from other threads as things are calculating? Will the TP channel data touched mid-process by one thread be seen by another thread? If not, is there some way to achieve this goal?