For custom nodes, check this thread here: http://www.plugincafe.com/forum/forum_posts.asp?TID=9631
For using GeListNodes, etc. I currently don't have a minimal example. But let me try to bump you in the right direction.
The TreeViewCustomGui uses a root object. This root is so to say a "container" that holds your list structure. This can be anything - you are then responsible to handle all the actions within the TreeViewFunctions, like GetNext(), GetDown() and so on. It is entirely up to you what you deliver to these functions. This level of abstraction comes with great flexibility.
If you want to go for GeListNode, the following may work for you:
Create a GeListHead - this is your root.
Fill this root with GeListNodes as you desire.
Then, hand the root over to your TreeViewCustomGui via SetRoot()
And now, in the TreeViewFunctions, all you have to do is handle the nodes.
So, if you can go a bit into detail, we should be able to pinpoint a solution.
If you have any questions, I'll be happy to help.
edit: By the way, you may want to start with BaseList2D instead of GeListNode since it already has SetName() / GetName() implemented and also supports selection bits. This is a bit easier to start off if you want to experiment.
Hi, you have to write an own routine for that. I was writing this one a while ago:
* @brief Moves all children of srcObj to tgtObj. Adds Undos.
* @param srcObj The source object
* @param tgtObj The target object
inline void g_MoveChildren(BaseObject* srcObj, BaseObject* tgtObj)
auto doc = srcObj->GetDocument();
auto child = srcObj->GetDown();
const auto temp = child->GetNext();
child = temp;
For further information about hierarchy manipulation, see https://developers.maxon.net/docs/Cinema4DCPPSDK/html/page_manual_gelistnode.html#page_manual_gelistnode_lists_edit
You may also want to take a look at the official Cinema 4D SDK for an example of a circle object: https://github.com/PluginCafe/cinema4d_cpp_sdk_extended/blob/master/plugins/cinema4dsdk/source/object/circle.cpp
Though it's C++, the algorithm should be easily adaptable.
You can simply implement AskClose(): https://developers.maxon.net/docs/Cinema4DPythonSDK/html/modules/c4d.gui/GeDialog/index.html?highlight=askclose#GeDialog.AskClose
Or even DestroyWindow() etc.
In Python, it's actually more convenient. You simply access them like this:
Example is a cube, we want its X-size:
You can simply drag an object's parameter into the command line of the console or the console itself. It then shows you the parameter names.
That is the most simple and easiest way.
However, that might not always work depending on what you want to read, so you have to use BaseContainer or GetParameter() as well.
Oh and may I kindly ask you for tagging this thread correctly? It makes it easier to search the forums, so other users can benefit from your question.
SelectionsTags return BaseSelects.
You can then iterate over all polygons of your object and select those, that are contained in a BaseSelect.
In addition to @m_adam's answer, you can use GetWorldPluginData() to save variables. Those even do exist after restarting Cinema 4D. You can clear them on application exit.
'open' or any other pure python function needs to be decoded as utf8.
See hint here: https://developers.maxon.net/docs/Cinema4DPythonSDK/html/modules/c4d.storage/index.html?highlight=loaddialog#c4d.storage.LoadDialog
Edit: a little late.
The delay may be caused by the fact, that c4dpy is actually some kind of a headless Cinema 4D installation.
So, everything that is core part of C4D is loaded, that may take some time.
Also, PyCharm tends be slower launching all debugging subsystems compared to VS Code.
You may want to try ExecutePasses() - that command will animate the current frame of the document and therefore works like scrubbing the timeline.
Hello @r_gigante , thanks for the answer. And yes, thought so.
By the way, on my company's calibrated display, the red looks way less saturated. Guess, it's time to calibrate my displays again.
But for those interested, there are browser extensions to override styles and thus colors. (https://chrome.google.com/webstore/detail/stylish-custom-themes-for/fjnbnpbmkenffdnngjfgmeleoegfcffe?hl=en)
Still using it for display the topic titles in original case instead of all uppercase.
Thank you for finally adding a dark theme to the forum. Just a minor note though: The red used across this site is a bit too agressive. I know that the colors comes from the new CI, bit it really hurts eyes on my display. I know that every display is different, but may it be possible to adjust the value/saturation of the accent color?
Thanks & best,
And I'm still convinced that I had the same problem a while ago and managed to draw a custom preview via Draw() method. (There should be a BL entry)
But still, I don't know if I remember right.
Here you go: https://github.com/NiklasRosenstein/py-localimport
That helper is also available as a minified version.
You have to update the document each frame with ExecutePasses()
In your for loop, simply add doc.ExecutePasses(None, True, True, False, c4d.BUILDFLAGS_NONE) as the first method call. (Adjust parameters to your needs.)
doc.ExecutePasses(None, True, True, False, c4d.BUILDFLAGS_NONE)
As far as I remember, Viewport drawing is handled in Draw() method.
Did you try my proposed fix?
This happens because tools that will be called twice in short succession gain focus in the C4D layout. Therefore your Dialog loses focus as the Move tool is bound toE.
I don't kbnow exactly how to prevent that behavior, but there should be some message that can be processed. SDK team will be more of help here.
edit: Easy fix: return c4d.NOTOK after your print statement. That consumes the message and does not call the base function, so Cinema simply does not get notified of the event.
Are both header files or is the upper one a cpp file?
Also, do the errors com from Intellisense or is it a style check/compilation error?
If the LLVM convention is used, the error is correct. LLVM namespace formatting conventions don't use any intentaion. You might be a able to fix this by ignoring this error explicitly.
It also might be caused by a bug in XCode.
Sure, your statement was correct. That's why I mentioned the possible misunderstanding here. That's on my side (as usual :)).
You posts are invavuable for all of us, so I'd be damned if I'm going to accuse you of being wrong.