Jump to content

How to trigger “Calculate” cache button with Xpresso and User Data.


Recommended Posts

Hello everybody,

 

In the Jiggle Deformer, under Cache, there is a Calculate button.

 

I want to invoke that button with Xpresso. I dragged the deformer into the Xpresso window to make a node for it. I’ve attached an image that shows the input ports to the node under Cache.

 

My question is, how can I kick off the Caching of the Jiggle deformer? Which port (based on the attached image) should I use for the input. And what kind of User Data control can I use to set it off? Should I use a Boolean control?

 

Thank you so much!

 

Joe.

JiggleNodeCachePorts.png

Link to comment

(Since you asked the same question on CGSociety, I'm just going to repeat my answer)

 

I very much doubt that this is possible at all. The caching requires the system to go through all frames and evaluate the state of the jiggle to store it in the cache. XPresso, on the other hand, is dynamically evaluated per frame, so calling an evaluation like caching from the XPresso would create an endless loop. Also, threading.

 

If you look closely you will find that most of the settings on the Cache tab are not animatable. That is another bad sign for using it in XPresso (or dynamic Python tabs).

 

Should someone have a solution nevertheless, they are invited to correct me…

 

Adding info: In Python, you would trigger a button by calling c4d.CallButton(id) with the proper button's ID. However, the API information of the command already contains the warning

Must be called from the main thread only.

Forbidden to call in expressions (Python generator, tag, XPresso node, etc.). See Threading Information.

 

...so you can only do that from an independent script, not the Execute of a tag (which indirectly XPresso is, too).

Link to comment
×
×
  • Create New...

Copyright Core 4D © 2023 Powered by Invision Community