How to access the BaseContainer of an Command-Dialog
-
Hi,
when the script is called it should call the command in the timeline "Bake Object" and set the parameters in the BaseContainer and then automatically call the Button "Bake"
I do not now how to access this, the ID's, of the command dialog.
script:
from typing import Optional import c4d doc: c4d.documents.BaseDocument # The active document op: Optional[c4d.BaseObject] # The active object, None if unselected def main() -> None: c4d.CallCommand(465001219) # bake objects dialog tool = c4d.plugins.FindPlugin(465001219, c4d.PLUGINTYPE_COMMAND) # Here I want to access and set the dialogs parameters, set some checkboxes and press then the button # this is probably the wrong way :-) bc = tool.GetDescription(0) for ide in bc: print(tool.GetParameter(ide[1][0].id, 0), tool.GetParameter(ide[2][0].id, 0)) if __name__ == '__main__': main()
-
Hello @ThomasB,
Thank you for reaching out to us. Maxon never exposes UIs, e.g., dialogs, in its APIs and a dialog also does not have data container which you could get or set.
You can get and set the data containers for tools, but the main characteristic of a tool is that its UI lives inside the Attribute Manager instead of having its own dialog. That does not apply to the Bake Objects dialog, it is not a tool but a command (a distinction which admittedly might seem very subtle for beginners). But as always, we expose the functionalities, the logic, behind things, in this case in the form of the functions c4d.utils.InitBakeTexture and c4d.utils.BakeTexture.
The py-texture_baker_r18.pyp example demonstrates the usage of these functions.
Cheers,
Ferdinand -
@ferdinand
Thanks Ferdinand, but I meant the command bake objects in the timeline where you can bake the animations. For the upcoming dialog I wanted to automate the process so I need to access the dialog parameters to set it, as the user needs to set the parameters and click the button and then delete some keys, I wanted to automate this with just one click.But thank you, I will have a look at the py-texture_baker_r18.pyp.
-
Hey @ThomasB,
my apologies, you were quite clear in your first posting that you meant the timeline, I simply overlooked that information. You are talking about this dialog here, right?
My answer from above applies here in general too. This is a command, and you can
c4d.CallCommand
it, but that is all the control you have. And other than for texture baking, the underlying functionality is unfortunately not exposed. If you wanted something like this, you would have to write it yourself (which would probably be too much work unless one REALLY, REALLY needs this).Cheers,
Ferdinand -
This is a command, and you can c4d.CallCommand it, but that is all the control you have.
thank you Ferdiand,