P.S.:
Note that I’m not a “coder”. This is an example of how I would do it.
The Reset PSR could be also seen as taken the Matrix from an object that is on “PSR zero with the scale to one”; Or in Matrix numbers—
“off: 0,0,0 v1: 1,0,0 v2: 0,1, 0 v3: 0,0,1”.
To make that more visible, I took the Global Matrix from the Cylinder. It will showcase the “zero”. (Yes, it is not actually zero in values in this example)
The reset in the example is given in this scene by placing the Disc on the Global Matrix of the Cylinder. I called all variables “varT” or so, and “zero”. These are not Python specifics.
The Torus is the object with the Interactive tag. If the Torus is high-lighted, the code is active.
To re-use the code I saved it as script and in this way it is available in the Commands. With a code that will be different on another machine, based on the individual “ID” I guess. So, for the example/demo, I’m just fine with that. It works also directly in the code, what out for the indentation-rule!
As mentioned above, a script should contain a fail-safe routine, if the searched content is not available, and perhaps a undo option.
The one minute clip, which might look better if downloaded. It is in UHD of course.
https://www.amazon.com/clouddrive/share/GRSGmOgy6Iz97eFMeGDljgPQZbnNrgS2jFnsEEdXTID?ref_=cd_ph_share_link_copy
As I mentioned, I’m not a coder, so if you like to get up to speed and the tutorials aren’t enough. In a full script the undo options should be included, and an option that uses an alternative information if an object is not found. Again, just an example! Perhaps consider a 1on1 session with someone who is fluent in code. ENJOY.
...............
import c4d
from c4d import gui
#Welcome to the world of Python
def main():
varG = doc.SearchObject(‘Cylinder’)
varT = doc.SearchObject(‘Disc’)
varM = varG.GetMg()
zero = varM
varT.SetMg(zero)
c4d.EventAdd()
if __name__==‘__main__’:
main()
For my example I have used a very simple and visual demo, and I’m aware (as mentioned hopefully enough times) that this is perhaps something for a real coder heart.
To dive deeper into this, please have a look here:
https://developers.maxon.net/docs/Cinema4DPythonSDK/html/modules/c4d/Matrix/index.html?highlight=relative matrix
You might notice that the Local Matrix might have to acknowledge the Freeze as well.
Since I’m not really clear, nor coder, I guess I have to leave it here.
So, I hope I could point into the right direction, and showed what is needed as well to have it safer.
ENJOY
P.S.2: I couldn’t leave it that way, here is one with “Undo” (from Rick Barrett’s tut) and a little line if the object is not found.
Use with caution ;o) If the Disc is named differently the alert will show. Entry in script and object name must be the same. Works with one object, so keep the name unique.
Screeen-shot:
https://www.amazon.com/clouddrive/share/1bEiad5sHXxNNM4021VsPdo4YPPD7w63DOO3GKsXalM?ref_=cd_ph_share_link_copy
Scene File Sketch:
[global]
https://www.amazon.com/clouddrive/share/FXeHavEhRH1rlbjb66xy7WAwa7uAFzemMTDhCRc3h65?ref_=cd_ph_share_link_copy
[local]
https://www.amazon.com/clouddrive/share/FkBSt5IZoFVUKdYzEsy3ayMMYuUH1b9mopgAx7GJJO6?ref_=cd_ph_share_link_copy
If I’m not mistaken SetMg() for global and SetMl() for local Matrix