• 0 Votes
    3 Posts
    880 Views
    V
    Great, this is exactly what I needed. Thanks @ferdinand !
  • Calling system command on animation frame change

    Cinema 4D SDK c++ python
    6
    0 Votes
    6 Posts
    1k Views
    yesbirdY
    Hi, Manuel. Thank you for description of both approaches, now I can compare them and choose the best. Regards, Sergey (Yesbird).
  • PointObject.CalcVertexMap(self, modifier)

    Cinema 4D SDK python r25
    5
    0 Votes
    5 Posts
    905 Views
    A
    @m_adam hi Maxime, thank you for your availability. Bacca's answer immediately cleared my mind on the subject, just as I was reading the other thread. I usually use the traditional method of calculating vertexmaps in the presence of obstacles. I thought CalcVertexMap did just that (the restriction tag is not mentioned in the SDK, so I couldn't figure out how to use it) but my curiosity is just didactic. Ciao Gianluca
  • 0 Votes
    6 Posts
    631 Views
    ferdinandF
    Hello @dunhou, ah that was the critical bit of information for me, that is you plugin at work there Well, as always without code it is hard to say what is going wrong there. the main code about this function is like : SetBit() doc.InsertMaterial() c4d.CallCommand(12252) # Render Materials doc.GetActiveMaterial() textag.SetMaterial() and some undo and call the Node Editor for certain renderer or rules for the function ... Out of this selection, I would put my money on CallCommand and undo handling. Setting bits and calling the mentioned methods are far less likely candidates. But that is pure guess work. actually, I checked the c4d.IsCommandChecked(id) The first thing I would do, is search for the command ID of the Material Manager (12159) in your code and add a print statement to each place where either this command ID is invoked with CallCommand or places where an ID determined at runtime is invoked (silly example : CallCommand(random.randint(1000, 1000000))) Then run your plugin again. When you see 12159 being printed when the undesired behaviour happens, you know it must be your plugin which misfiring. When not, it might be a bug in Cinama 4D or one of its APIs. Cheers, Ferdinand
  • Setting Material Preview for 1 material

    Cinema 4D SDK 2023 python
    3
    0 Votes
    3 Posts
    541 Views
    P
    Thank you.
  • 0 Votes
    13 Posts
    2k Views
    ferdinandF
    Hey @thomasb, no worries, don't be too concerned about it. And you should not be ashamed, that was certainly not what I wanted to convey. "Every person his or her book", the second so called law of library science, is something I truly believe in. Everyone has valid information needs and we are trying to help users on their individual journey. You should not feel discouraged, we are and were all once in your place. But at the same time, I sometimes have to regulate a bit forum conduct as we, the Maxon SDK group, and other users are human too. And people tend to get confused, when they are being hit with a stream-of-conscious like threads were a user comments diary-style-like on his or her development state. It is not that I would not understand people are doing that. When one is in that situation, one is overwhelmed by the possible routes one can take, the amount of information to traverse. And verbalizing that does indeed help. But for someone who tries to help you or for people who later search for similar information, this "stream-of-conscious/diary" is then an obstacle rather than a help. So, sometimes I try to regulate both interests a bit. But as I said, please do not feel discouraged. Cheers, Ferdinand
  • 0 Votes
    4 Posts
    898 Views
    A
    @manuel Wow! Manuel thank you so much I'm new in code development so that's why its fo easy for me to have those kind of mistakes. Thank you so much for your support.
  • 0 Votes
    4 Posts
    928 Views
    ThomasBT
    @ferdinand Yes you are right, in relation to this the self.spline etc is unnecessary that could also be a normal local variable. Is correct. But basically if I load a profile spline in my init method, for example, I can already save it in such a variable. I need to be able to access it from anywhere in the class. But here it is totally superfluous....sorry
  • 0 Votes
    5 Posts
    868 Views
    B
    Thanks for the update @m_adam
  • 0 Votes
    2 Posts
    426 Views
    ManuelM
    hi, well you cannot inherit from the Hair Object as you could from a class. What you can do is to load the description of the hair object or include it in your description, create the hair object internally and link your description parameters to the internal hair object. Probably add your own parameter in your description. Than inside GVO you could generate the hair object with those parameter and return the result of it. While this seems to be possible, there are probably a lot of issue you are going to face, be ready ^^ Cheers, Manuel
  • 1 Votes
    1 Posts
    500 Views
    No one has replied
  • Unsolo a Node?

    Cinema 4D SDK python 2023
    5
    0 Votes
    5 Posts
    879 Views
    B
    @m_adam Thanks. Works as expected!
  • 0 Votes
    7 Posts
    1k Views
    M
    Thanks, @ferdinand Yes seems intended but could be troublesome if you use mograph / redshift object color to drive something ? C4D Version : 2023.1.2 A solution to guide the user could be to disable the object color when set to "Render Instance" , but from a UX standpoint I am not a fan of taking away control from the user. thanks for taking it to CS kind regards mogh
  • SDK typo/discrepancy ? bitmap.Init() regarding bitdepth

    Moved Bugs python sdk
    7
    0 Votes
    7 Posts
    2k Views
    M
    Thank you Ferdinand for your time, and also providing a high / low level solution. As far as I can tell it works all as intended - my code now results in clean colors "measured". (in lowlvl R20 and highlvl 2023) I found a small discrepancy with render instances but that's another topic. Cheers, mogh
  • How to "permanently" store data?

    Cinema 4D SDK
    4
    0 Votes
    4 Posts
    616 Views
    ferdinandF
    Hello @herrmay, Yes, it can be a bit cumbersome to write a whole abstraction layer, but most of the time it is avoidable to do that in the first place. In your case it should be pretty simple. Iterate over all layers you want to save to disk. Get the MAXON_CREATOR_ID UUID of each layer and its data container. Write the UUID and the data container to disk using JSON or HyperFile, I would recommend the latter as it will be less work. You only must convert the UUID bytes to a string, put the string into the file, then the data container and you are done. If you want to, you could also store all layer data in one file per document, or just have one giant file for all documents. Later load these hyper file fragments back and do what you want with the data. When you need the original node, traverse the layers in the active document for a node with the stored UUID. You could also make things fancier and search in all open documents or even store the document path in your serialized data and load that document. Saving things in the document container is a possibility too, you should make sure though to use a plugin ID for that. Cheers, Ferdinand
  • 0 Votes
    11 Posts
    2k Views
    ThomasBT
    @manuel Thank you very much!
  • 0 Votes
    4 Posts
    772 Views
    ManuelM
    hi, well, if it works. Cheers, Manuel
  • 0 Votes
    9 Posts
    1k Views
    gheyretG
    Hi @ferdinand , I get it ! Thanks again to your reply!
  • Websockets / Threading

    Cinema 4D SDK python
    3
    0 Votes
    3 Posts
    779 Views
    ferdinandF
    Hello @gilleskontrol, welcome to the forum and thank you for reaching out to us. Websocket client in C4D - best practice for this? You must use a third party library, e.g., the popular websockets as our NetworkWebSocketConnectionInterface has not been ported to Python and CPython does not support the WebSocket protocol out of the box. Plugin_ID - why do I need to do this, how do I properly do this? You can get them here in the forum with the little plug icon at the top. See How to get Plugin IDs[URL-REMOVED] for details. If it won't work in the scriptmanager, (because scriptmanager will freeze up even with threading) how do I do it without the scriptmanager? The script manager is blocking by nature. It is not your thread which is blocking, but the fact that you have likely put some code into your script which wait for the spawned thread to end. Which will then run as all Script Manager scripts on the main thread therefore block it. You could technically omit waiting for your threads to end and therefore have a non-blocking script, but that would result in dangling and never ended threads which is a bad thing. When you launch your thread in a plugin, this problem can either persist or go away, depending on what you do. There is no general answer to that. Let's assume you have the method MyPlugin.Foo. When you spawn the thread T in Foo, you wait for T to end before you exit Foo, and Foo runs on the main thread, as for example CommandData.Execute, you will experience the same problem. What you can do is: Wait for a thread T to end from a function f which runs on the non-main thread S. Doing this makes rarely sense in Python but you would not block the main thread doing this. You check for being on the main thread c4d.threading.GeIsMainThread. The more common and sensible approach is to defer reacting to your thread having ended to other places. In a dialog or MessageData plugin this could be a timer to parodically check in Message for your threads having ended. For nodes you could simply make the thread send the node a message once it has ended. Your documentation could really benefit from some step by step examples as searching for things you don't know the names of or why you even need them is next to impossible. Hm, I agree that our documentation lacks an abstract subject-matter access which can make traversing its content over subjects something in between laborious and impossible. However, the solution to that would be subject indexing and not having a perfectly matching tutorial for every possible information need of users (although that is of course what all users want). In which area did you find step-by-step information to be lacking in your case? Cheers, Ferdinand [URL-REMOVED] @maxon: This section contained a non-resolving link which has been removed.
  • Debugging Cinema 4D in code editor

    Cinema 4D SDK python
    2
    0 Votes
    2 Posts
    431 Views
    M
    Hi @StefanGMBG debugging python plugin is not possible in Cinema 4D R25 since debugpy previously known as ptvsd hardcoded the type of the files so you can debug only .py file. However since S26 we released a Visual Studio Code Extension that work with a Cinema 4D Plugin. And this extension once correctly configured as shown in Cinema 4D Connector - Documentation let you loads, runs, and debugs Cinema 4D scripts and plugins from VS Code. Cheers, Maxime.