• using python Layerset - Generate Alpha option?

    python sdk
    5
    2
    0 Votes
    5 Posts
    906 Views
    P
    @ferdinand Thanks for the advice. i'm going to try Have a nice day today
  • 0 Votes
    4 Posts
    902 Views
    i_mazlovI
    Hi @ymoon, Thanks for reaching out to us. Glad your problem is solved! Here are some pointers to the docs with related toolset: c4d.Vector, c4d.Matrix, c4d.utils. Please note, there's Matrix Manual, although math questions are generally out of scope of the support on this forum. Cheers, Ilia
  • MessageDialog in NodeData plugin

    python r23 r20 2023
    2
    0 Votes
    2 Posts
    749 Views
    ferdinandF
    Hey @mikeudin, Thank you for reaching out to us. In short, there is no good answer to your question. There is no guarantee that anything will ever run on the main thread. You must always check yourself with c4d.threading.GeIsMainThread. Scene computations, e.g., ObjectData.GetContour is run in parallel off-main-thread and is therefore subject to access restriction to avoid access violations, i.e., crashes. There is no "hack" for this. The essence is that you cannot have both the benefits of sequentialism (can use shared resources) and parallelism (is fast). There are of course data structures which allow you to handle a singular resource from multiple threads, but doing this always entails lining up multiple users in a line, each waiting for users ahead in the line to be done, i.e., hidden sequentialism. In Python this might be hard to grasp because Python itself mostly ignores the concept of parallelism and we only experience here the side effects of the parallelism of the underlying C++ Cinema 4D API. There is also the problem that your request does not make too much sense for me on a practical level. Imagine having a plugin MySpline which opens an error dialog once its GetContour method strays from the right path. A user now edits one hundred instances of MySpline at once and triggers the error. Cinema 4D sometimes executes passes two or three times in a row to resolve dependency problems. This would then mean that you would open three hundred error dialogs for one user interaction (if that would be technically possible in the first place). In general, no node should open any form of dialogs on its own. Opening a dialog after a button press in the description of a node via NodeData.Message is okay. When you are hell-bent on doing this, you could do this: Add a field to your plugin, e.g., self._error: str = "". When you are in your GetContour and an error happens, instead of raising it, simply write it to _error. Implement any NodeData method which often runs on the main thread. NodeData.Message is a good candidate. On each execution of it, check if _error has content and if you are on the main thread. If so, display the message and then null _error. You will still need some kind of throttling so that the user is not spammed with the same error over and over again. I.e., you need an "only-new-errors" mechanism. It is up to you to implement that. An alternative approach could go via core messages. But that is also non-ideal because setting off a c4d.SpecialEventAdd will work from a non main thread but will cause the global core message lock to engage, which is of course a bad thing to happen and exactly the "no-hack" problem I described under (4). You could also try using c4d.StatusSetText and the other status functions. While not officially supported, they will work from non-main-thread environments. But there is no guarantee and we do not officially support this. Cheers, Ferdinand
  • How to use external libraries inside of a plugin

    python
    4
    0 Votes
    4 Posts
    925 Views
    G
    Thankyou! Noted!
  • Use the tab name and open the that window?

    python
    3
    1
    0 Votes
    3 Posts
    960 Views
    ymoonY
    @ferdinand There is no command to invoke the viewport window, so I was looking for an alternative. I will tagging the version in the next post. (R2023) Thank You.
  • Using recent VS to make older builds

    5
    0 Votes
    5 Posts
    904 Views
    WickedPW
    Thanks Maxime. And apologies for the delay - I didn't see the response. WP.
  • Python-Generated Splines are not recognized by Cloner Object

    python 2023
    3
    0 Votes
    3 Posts
    716 Views
    K
    hi @i_mazlov , I understand that it is not supported, so I will use Scene Nodes to generate the spline this time. No other questions, thank you very much.
  • Python Xpresso node detect Userdata button press message

    r20 python project tool
    5
    0 Votes
    5 Posts
    1k Views
    D
    @ferdinand Thanks for your comprehensive explanation. I really appreciate that. Cheers
  • Why are my port definitions duplicated in the Attribute Manager?

    Moved c++ 2023
    7
    4
    0 Votes
    7 Posts
    2k Views
    S
    Hi @ferdinand, No problem, I got there in the end and it's actually not too tricky once you know how it's supposed to work. I'll have a go now at a material node, there are more examples of those so hopefully it'll be straightforward. I'll be sure to be back if it isn't! In the meantime I've uploaded a detailed explanation of all the steps needed to build this kind of node to my site at https://www.microbion.co.uk/html/create_nodes_corenode1.htm so if anyone wants to see how it was done, it's all there. Hopefully it's fairly accurate; all I can say is that this is what I did and it worked for me Thanks again for your help, Cheers, Steve
  • 0 Votes
    4 Posts
    1k Views
    T
    Hi @ferdinand, your links really helped me a lot, and I managed to write a script that starts a render and sends the rendered image to a web service. Can the SDK grab the live preview image from the redshift IPR? I assume not looking at the documentation: https://developers.maxon.net/docs/py/2023_2/search.html?q=redshift&check_keywords=yes&area=default
  • DrawView update ISSUE

    python
    7
    0 Votes
    7 Posts
    1k Views
    i_mazlovI
    Hi @mdk7b2, Glad to hear and thank you for sharing your solution! Good luck and let me know if you have any further questions. Cheers, Ilia
  • Active Controls

    sdk r20 c++
    5
    1
    0 Votes
    5 Posts
    1k Views
    J
    Thanks for the response. That's what I figured would be the case.
  • How to access Volume Data?

    3
    0 Votes
    3 Posts
    1k Views
    C
    Hello @ferdinand , First of all thanks a lot for your answer, it does exactly what I was trying to achieve, print the names of the volume grids stored on a Volume Loader with Python, I just added the GetName() on the last loop for that. Sorry about the rule violation, I thought it was a good idea to have the C++ and the Python code equivalent at the same place because of the same reason that you mentioned, if someone was looking for doing this they could find both versions at the same place, also as you mentioned, sometimes it can be tricky to decide when something is on-topic or not. Here is the updated code with the grid name: """Demonstrates accessing volume caches. Volumes are composed differently based on part of application using them but this script demonstrates how most of them can be accessed. """ import c4d doc: c4d.documents.BaseDocument # The active document op: c4d.BaseObject | None # The active object, None if unselected def main() -> None: """ """ if not op: return # Volume output is contained in the caches of objects. In this case an Ovolume is directly # the cache content of some tangible scene object. cache: c4d.BaseObject = op.GetCache() if cache.CheckType(c4d.Ovolume): print (f"{cache = }") # Sometimes, e.g., Pyro, volumes are loaded from VDB files on disk, in that case the loading # tangible scene object usually holds a Ovolumeloader as the first child of its cache. if cache.CheckType(c4d.Ovolumeloader): cache = cache.GetCache() # Many things contain not only a singular volume but sets of them. Which then hold their content # as children. Stuff can get more complex as always the case with caches in Cinema 4D, but the # cache structure of a Pyro Output object loading data from disk could look like this: # # PyroOutput # Cache: Ovolumeloader # Cache: Ovolumeset # Child: Ovolume (Color) # Child: Ovolume (Density) # ... if cache.CheckType(c4d.Ovolumeset): cache = cache.GetCache() for item in cache.GetChildren(): print (f"{item = }") print ("grid name = " + item.GetName()) if __name__ == '__main__': main()
  • Annotation tag without bubble

    sdk
    5
    0 Votes
    5 Posts
    1k Views
    S
    @ferdinand many thanks, I think that the topic is closed! You're amazing!
  • access the layers in the shader layer

    python
    10
    0 Votes
    10 Posts
    2k Views
    JH23J
    Hi @i_mazlov , This solves my problem, for now I don't think I have another question, and I could consider my problem solved, thanks. cheers, James H.
  • ToolData.MouseInput() how to get right mouse click?

    python
    3
    0 Votes
    3 Posts
    750 Views
    J
    @i_mazlov Hi, thanks for letting me know that. cheers~
  • Creating object in CommandData does not update Object Manager

    c++
    2
    2
    0 Votes
    2 Posts
    592 Views
    M
    Hi sadly this is a known issue, see EventAdd is not working. Cheers, Maxime.
  • python script, is "add to hud" possible to add to my python script?

    r21 python
    3
    0 Votes
    3 Posts
    852 Views
    T
    would love to see that being added. the HUD is amazing for internal tooling
  • Not working FieldLists Keyframes and Tracks

    python r23
    3
    1
    0 Votes
    3 Posts
    668 Views
    mikeudinM
    @ferdinand Thank you! That was TranslateDescID issue!
  • How to understand GraphModelInterface.AddChild().

    2023 maxon api windows python
    11
    2
    0 Votes
    11 Posts
    2k Views
    DunhouD
    Hi @m_adam , I have ask what are main functions in redshift do in redshift forum, but get no reply for week. and the help(redshift) also give me an ambiguous result. But anyway, I have something here, I will update it and publish when I have free times.