Frame All command on Spline User Data
-
I have a python tag where I can manipulate the knots of a Spline User Data. However the spline and knots often go out of range when editing. How can I call the 'Frame All' command with python to keep the spline nicely framed while using? Thank you for any help.
-
I'm assuming this menu specific to the SPLINEDATA user-data is not accessible via python tag. Anyone have another idea to be able to automatically frame your spline in the window?
-
Ok, I have found the command in C++. Is there any way to implement this C++ command via python tag? I am getting a change in the Spline User-Data when calling this in the python tag:
container[c4d.DESC_CUSTOMGUI] = c4d.IDC_SPLINE_FRAME_ALL
However this line of code just kills my user data gui.
I must be close to being able to call this command from a python tag, is there anything I am missing or could try? -
Hi @gsmetzer ,
In your next postings please consider accompanying your questions with a code snippet showcasing the problem in the context you have. Otherwise creating the context code from scratch on our side does nothing else than leading to reduced efficiency and bigger delays in answers.
Regarding your question. The general answer is no, it's not actually possible to do so from the Python Generator, because the SplineCustomGui is sealed inside the code.
Regarding the IDC_SPLINE_FRAME_ALL, one's supposed to use it as a separate basecontainer in the Command() function, which is not exposed to python. Setting this id in your userdata container results in nothing (good).
Cheers,
Ilia -
Thank you @i_mazlov for your reply. I have made a project here for download with the Spline User Data as simple as I could make the file.
I wonder if there is a way to externally call a separate C++ script command from python? I cannot find anything online. Would this be possible as a plugin? Thank you for any thoughts here.
Also, here is my python tag code:
import c4d def main(): bc = c4d.BaseContainer() bc[c4d.DESC_NAME] = 'Motion Design' bc[c4d.DESC_CUSTOMGUI] = c4d.CUSTOMGUI_SPLINE #c4d.IDC_SPLINE_FRAME_ALL This is the C++ command I want to call to frame my spline print(c4d.IDC_SPLINE_FRAME_ALL) op.SetUserDataContainer([c4d.ID_USERDATA, 1], bc) #The intention is to always frame the spline knots when they are positioned outside the frame they always stay in view for the user. #I cant write any c++ So I am looking for a way to externally call this C++ command. (Or an alternative) #Additionally, the twirl down menu also frames the spline, if I had a way to twirl this down from python that could also work.
-
Hi @gsmetzer ,
Thank you for providing a visual and descriptive sample scene.
Generally speaking, you cannot use functions that are not exposed into python. There can be a slight chance of having a workaround depending on each specific scenario. Unfortunately, in the case of SplineCustomGui you cannot call Command() unless you're using C++ API.
In case you like to pursue the C++ way, the possible workaround could be to move away some functionality from your python plugin to a c++ plugin and create an interaction between them. For example, you could have a very simple CommandData plugin that only covers your framing all functionality, and all the rest resides in your python plugin that interacts with the command data plugin when necessary.
Cheers,
Ilia -
Thank you @i_mazlov
An external C++ command will have to wait until my skills develop.
Last question on this topic and then I'm done.
Is there any way to allow this triangle next to the 'Spline' User-Data can unfold. i.e. I want to be able to unfold from python. How can I access? Thank you
Gabriel -
Hi Gabriel,
Sorry for the delay in this thread.
Unfortunately you cannot control this folding GUI functionality as it is sealed to the non-public GUI implementation. That would not be the case when using custom GUI implementations.
Cheers,
Ilia