So detailed example as always, this is really helpfull!

Posts made by gheyret
-
RE: How to implement an image control that can receive and generate image data drag events
-
RE: KDTree or OcTree with C4D Python
tend to be very complex computationally and therefore not very sensible to be implemented in Python.
yeah, I forgot the BaseView, but whatever, I agree whit you.
And this is just the beginning, I'm still in the research and testing phase.
My final goal is to write a procedural tree generator, so maybe combine L-System to improve some performance, I'll also try to write an Octree.
Thank you for your suggestion and reply.Cheers!
Gheyret -
RE: KDTree or OcTree with C4D Python
Hi @m_adam , It's nice to hear that! And hope we can use it in future version in some day.
I just looked at the GetNearestPoint method of ViewportSelect, it seems to only work in Viewport coordinates? I wonder if it is possible to work in 3D space, I haven't tried it yet.
In terms of what I want to do, I want to implement Space Colonization Algorithm in Cinema 4D.
I have already implemented an inefficient version with brute force search, but its performance is too low.
I'm not sure ViewportSelect.GetNearestPoint () whether can do it.
By the way, should I start a new post on this topic? -
KDTree or OcTree with C4D Python
Hi everyone~
In my recent research in C4D python, I needed to do some algorithms to find nearest points.
During my research, I noticed that while the C++ SDK provides native KDTree implementation , but not in python SDK.
It would require me to build similar algorithms manually, but that's not something I'm good at, and python's performance also is a limitation. Although there are some third-party libraries available, which I think makes things more complicated.
So I'd like to ask the SDK Team if it's possible to add KDTree to python, or something like that?
Cheers!
Gheyret. -
RE: Show or Hide Object in Viewport
Hi @chuanzhen ,
This is a Bug and it's already reported, you can find more info in this thread. -
RE: Transparency of GeDialog?
Hi @JH23
If you are using Python, you might consider trying PySide6 for creating your UI.
As far as I know, starting with Cinema 4D 2024.2, they have resolved some import issues related to third-party libraries, making it possible to import PySide6 in Cinema 4D Python.However, it should be noted that the Maxon SDK team does not recommend using other third-party UI libraries and will not provide support for any issues arising from their use. Therefore, you will need to resolve any problems encountered on your own.
Cheers!
Gheyret -
RE: Get command information from command palette
I get it, thanks for your reply and keeping the idea.
If there are any workarounds or alternative solutions in the meantime, please let me know.
I look forward to any updates regarding this feature in the future.
Cheers~ -
RE: Get command information from command palette
Hi @m_adam , how's it going!
Thank you for forwarding the message to the developers.
If you have any updates or information, please let me know at any time.Cheers!
-
Get command information from command palette
Hi everyone!
There is an idea for get command information from command palette by right mouse click.For example: make a script and add it to right click menu, and then I can click on any command through this button to get information like command name, ID e.t.c.
Is this possible with python?
-
RE: Get and Set any parameter with Tag
Hi @i_mazlov
I can't use C++ at the moment, so I thought I'd tryMultilineEditText
for my purposes.
I looked for This post in the forum and now I have some ideas.
Thank you for your reply!Cheers~
-
RE: Objects are still not displayed after ChangeNBit is works
Thank you for your reply and solution!
Cheers~ -
Get and Set any parameter with Tag
Hi, everyone!
I'm looking for a way to get and set parameters from anywhere by dragging and dropping, just like GSG's Signal tag plugin does.
I checked a lot of forum posts and saw that python doesn't support to do that.
I came up with GeUserArea, but GeUserArea can only be used in GeDialog.
I also wondered if I could use CustomDataType to create a drag-and-drop operation that accepts parameters, but it doesn't seem possible to create CustomDataType in python.I don't know if there's another or similar way to do that.
-
Objects are still not displayed after ChangeNBit is works
Hi Everyone!
I'm Trying to use
GeListNode.ChangeNBit(c4d.NBIT_EHIDE, c4d.NBITCONTROL_SET)
to hide some objects and save the project file and close it.
And I open the project file again and try to usingGeListNode.ChangeNBit(c4d.NBIT_EHIDE, c4d.NBITCONTROL_CLEAR)
, I find that although the code works, but the hidden objects are still not displayed in viewport.Is this a bug or something special thing happend?
This is the project file I tested, and it's already hide the 4 objects top of the OM:
show-hide_test.c4dAnd this the simple testing code for displayed them:
import c4d doc: c4d.documents.BaseDocument # The currently active document. op: c4d.BaseObject | None # The primary selected object in `doc`. Can be `None`. def main() -> None: objs = doc.GetObjects() for obj in objs: if obj.GetNBit(c4d.NBIT_EHIDE): print(obj.ChangeNBit(c4d.NBIT_EHIDE, c4d.NBITCONTROL_CLEAR)) print(obj.GetNBit(c4d.NBIT_EHIDE)) c4d.EventAdd() if __name__ == '__main__': main()
P.S: I also found that after running the test code in the above project file and saving the project, closing it and then opening it again, those hidden objects came back.
-
RE: Easy Way to Set and Get parameter Values
Hi ! @Gemini ,
You can simply drag and drop the parameter you want to Script Manager to get or set it.
Just like this:
-
RE: Set Tangnet of Spline
Hi @ferdinand !
Sorry for late reply, and thank you very much for your detailed and thorough explanation, and for taking the time to explain the relationship between linear algebra and trigonometry in the context of computer graphics and transformations.
As a beginner, all I want to do here is to practice as much as I can with the knowledge I've learned, and I apologize if I didn't explain clearly.
Yes, in the code I want to implement is placing two tangent handle relative to the two input objects a and c.
Compared to calculating with trigonometric functions, your suggestion seems more straightforward and clear, and I never would have thought to use vectors to achieve this, I need to keep practicing.
I will take the time to review the thread you mentioned.
Thank you again for your support and guidance. Thank you very much for your insights! -
Set Tangnet of Spline
Hi everyone!
I have recently been learning some basics of linear algebra.
In order to verify my learning results, I created a Bezier spline Generator with Python Generator.
But when I set the tangents of the spline, something confused me.
When I moved the point of the spline, the left and right handles of the tangent would switch positions, or would they flip 180 degrees? I don't quite understand what's going on here.And there is my test code and Scene file:
import c4d import math def main() -> c4d.BaseObject: null = c4d.BaseObject(c4d.Onull) a = op.GetDown() b = a.GetNext() c = b.GetNext() obj = b.GetClone(0) obj[c4d.NULLOBJECT_RADIUS] = 5 obj[c4d.ID_BASEOBJECT_USECOLOR] = 2 obj[c4d.ID_BASEOBJECT_COLOR] = c4d.Vector(1,0,0) obj2 = obj.GetClone(0) obj2[c4d.ID_BASEOBJECT_COLOR] = c4d.Vector(0,1,0) a_pos_local = ~b.GetMg() * a.GetMg().off a_polar_angle = math.atan2(a_pos_local.y, a_pos_local.x) a_length = a_pos_local.GetLength() b_pos_local = ~b.GetMg() * c.GetMg().off b_polar_angle = math.atan2(b_pos_local.y, b_pos_local.x) b_length = b_pos_local.GetLength() polar = (a_polar_angle + b_polar_angle)/2 + (math.pi / 2) leng = (a_length + b_length)/2 x = leng * math.cos(polar) y = leng * math.sin(polar) vec = c4d.Vector(x,y) move_vec1 = vec.GetNormalized() * op[c4d.ID_USERDATA,1] m1 = ~op.GetMg() * b.GetMg() * c4d.utils.MatrixMove(move_vec1) m2 = ~op.GetMg() * b.GetMg() * c4d.utils.MatrixMove(-move_vec1) obj.SetMg(m1) obj2.SetMg(m2) obj.InsertUnder(null) obj2.InsertUnder(null) spline = c4d.SplineObject(3, c4d.SPLINETYPE_BEZIER) spline.SetPoint(0, a.GetMg().off) spline.SetPoint(1, b.GetMg().off) spline.SetPoint(2, c.GetMg().off) vl = ~b.GetMg() * obj.GetMg().off vr = ~b.GetMg() * obj2.GetMg().off spline.SetTangent(1, vl, vr) spline.InsertUnder(null) return null
-
RE: Get information about BasePlugin
Thanks for your explaination @ferdinand
Now I understand what's going on here.Cheers!
-
RE: Get information about BasePlugin
This is my plugin , I promise I'm not reuse plugin id, and I can't use it, it will show that the plugin ID has been registered
But I get this: (It's a TagData Plugin, but I can get another Command-Type here.)
So many Object, Tool and Tag type plugins have a command type.
-
RE: Get information about BasePlugin
Hey @ferdinand ,
Thank you for your clarification.
What I meant by the difference is what will happen when users execute commands with the same ID but different types.
How do they differ in terms of their functionality?
For instance, if executes a Tool-type Cloud Tool and Command-type Cloud Tool, what would happen in each case?
and if they perform the same function, can I then avoid manually screening them? -
RE: Get information about BasePlugin
Hi @ferdinand
I'm sorry I wasn't clear. Currently I'm using PySide to create my plugin, And my final goal is fully recreate the Command Manager Dialog, and Drag and Drop the Commands to my other UI widgets just for better experience.I have created a user interface similar to a command manager, but I've noticed that some commands retrieved using the
plugins.FilterPluginList()
method are duplicated.
In my understanding, Plugin IDs are meant to be unique in Cinema 4D, but encountering duplicate command IDs has confused me.For example, I get three "Cloud Tool" with same ID using
plugins.FilterPluginList()
but diffrent type (tool, command, node).
While I can manually filter them, but I think this complicates the workflow unnecessarily.
So I would like to know why commands with the same ID have different types, and what their differences are.
An my second question: How do I get the information in the plugin column in Command Manager?
In Cinema 4D, many commands share the same icon and name. I believe when users search for a command by its name, encountering multiple identical commands can be confusing. Therefore, additional information about the commands is needed to help users filter them effectively. In now , I can get the icon, name, shortcut key, help string of command, but I don't know how to get "the information in the plugin column in Command Manager" or the owner like you said.
Thanks for your reply
Cheers~