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!
Posts made by gheyret
-
RE: Set Tangnet of Spline
-
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~ -
Get information about BasePlugin
Hi Everyone!
Currently I'm recreating the Command Manager Dialog in Cinema4D, because I need to drag and drop these commands to other plase in my plugin.
And I have some questions:-
Is there a shortway to get all the commands in Command Mnager directly? because the
plugins.FilterPluginList(PLUGINTYPE_ANY)
give everything in cinema , it have some folders, and some commands are repeated, the plugin id is same but diffrent plugin type and diffrent info, some commands do not have names, I'm a little confused in this situation. -
if there are no shortway to get all commands in Command Manager, How do I get the information in the plugin column in Command Manager?
-
-
RE: Is that possible to get current active subwindow of C4D?
Thanks for your explanation @m_adam , Yes it's a CommandData plguin but no GeDialog.
Because of some limitations, I had to use PySide to create my plugin's special user interface. -
RE: Can I get the plugin(Command) help string in other C4DThread?
Thank you @m_adam , I will try it later today!
Cheers! -
Is that possible to get current active subwindow of C4D?
Hi everyone!
I want my plugin to do different things on different Windows, similar to Commander in Cinema 4D.
So I try to get the current active window, such as; Object Manager, Material Manager, Node Editor, etc.
But I didn't find anything about this in the SDK documentation.
So is that possible to do that? -
Can I get the plugin(Command) help string in other C4DThread?
Hi everyone!
I saw in SDK documenation thatc4d.GetCommandHelp
can only be called in the main thread.
Is there a way to get help string in other threads? -
RE: Is that possibe to Hide Object in Active BaseDraw?
Hi @ferdinand,
Thanks for your reply.
I just want to make sure if it's possible.
And I'll try theBaseDraw.DrawObject
later. -
Is that possibe to Hide Object in Active BaseDraw?
Hi everyone,
I'm trying to Hide the selected Objects in Active(selected) viewport, but still show in other viewport, is that possible?
I know theNBIT_EHIDE
, but it seems to be global , the object is hidden in all viewports.
I just want to hide it in active viewport. -
RE: Cinema 4D plugin market and tons of free plugins!
Thanks so much for @Dunhou and other Boghma member to do this amazing things!
-
RE: How to store BaseShader to HyperFile
Hi @ferdinand ,
Yeah! I'm actually considering saving the shader to
.c4d
file as well.
But it would be great if posible to store BaseList2D in Hyperfile.Thank you!
Cheers! -
RE: How to store BaseShader to HyperFile
it's okay, It's not a big rush for me.
Hope you enjoy your holiday.
Cheers~ -
RE: How to store BaseShader to HyperFile
Hi @ferdinand
Thank you for your reply.
I try to useHyperFile.WriteData
to store my shader and save it on my local path.
And when I try to read the hyperfile to get that shader, that return None for me.
This is my test code:import c4d key = 12345 path = "..." def store_shader(data): hf = c4d.storage.HyperFile() if hf.Open(ident=key, filename=path, mode=c4d.FILEOPEN_WRITE, error_dialog=c4d.FILEDIALOG_NONE): hf.WriteData(data) hf.Close() return True return False def read_shader(): hf = c4d.storage.HyperFile() if hf.Open(ident=key, filename=path, mode=c4d.FILEOPEN_READ, error_dialog=c4d.FILEDIALOG_NONE): data = hf.ReadData() hf.Close() return data return None def main() -> None: shader = doc.GetActiveMaterial()[c4d.MATERIAL_COLOR_SHADER] # this will print True print(store_shader(shader)) # this will print None, the shader is missing? print(read_shader()) if __name__ == '__main__': main()
-
How to store BaseShader to HyperFile
I'm trying to store the Shaders created in my plugin into Hyperfile for next use.
I can store the GetDataInstance() of the shader, but when I encounter layer shader, the internal shaders can't be stored.
So I'm wondering if I can store the shader directly to the hyperfile. -
RE: Nothing happen when runing generate_solution_win.bat
Yeah, it's a little bit anoying, but the problem's solve!
Ready for rocking with C++! wohoo~