Move component group to position based on boolean custom property

Hi there,

I'm trying to get a group of components to move to a new position once a custom property UVActuate is True, and then return to the original position when UVActuate becomes false.

The issue I'm having is that using the a group of components have no attribute propertyName. So this script is being called continuously for every event.

My work around is to use function decorator to run the translate function once.

I've tested my script and it executes once in a loop, but that doesn't make a difference in the runtime since it looks like the script is reinitialized each time an event happens.

There's probably a better implementation or method I should be using. Any suggestions or comments would be appreciated.

That event fired whenever any of the props on that component change. You need to check what property changed first

if event.propertyName == 'UVActuate':
   ....

For first init, use the componentRunning prop

if event.propertyName == 'componentRunning':
   ....

I get an error when I try to use event.source.propertyName for a group as mentioned above.

That's because you added .source. propertyName exists as part of the event object

2 Likes

ahhh. I'll give that a shot.

That did the trick, thank you!

1 Like