• 0 Votes
    7 Posts
    1k Views
    John_DoJ
    Hi Maxime, Thank you very much for looking at my issue. Did you try the new function ? I've added it in my code and unfortunately I get the same result as before. [image: 1703847634618-cinema_4d_3jwccopdud.gif]
  • 0 Votes
    2 Posts
    468 Views
    M
    Hi thanks for the report, python should never crash, so it's going to be fixed in the next release. In any case the port should be a valid a port, but an exception should be raised when None is passed. Cheers, Maxime
  • The cloner is calculated before the Python tag

    Cinema 4D SDK 2023 python
    2
    0 Votes
    2 Posts
    543 Views
    i_mazlovI
    Hi @ll2pakll , Please excuse the delay, your topic somehow slipped from my list. I can only speculate here, as you haven't attached a sample scene that highlights your issue. The way you describe the problem it looks like a priority issue of the python tag. Please have a look at how the priority works in our documentation: https://help.maxon.net/c4d/2023/en-us/Default.htm#html/TPYTHON-OBASELIST.html#EXPRESSION_PRIORITY Also note that it's forbidden to call c4d.EventAdd() (or in reality is just skipped) from the python tag due to multithreading restrictions (c4d.EventAdd() is executed on main thread whilst python tag is executed in a parallel thread): [image: 1704368550401-9ddbfeab-53dd-49e1-8ded-0a6c3dddba94-image.png] Cheers, Ilia
  • Python Effector with custom FieldList

    Cinema 4D SDK python 2024
    3
    0 Votes
    3 Posts
    702 Views
    M
    Hi @baca, this is unfortunately not possible there is some default CheckDirty in place to support the default FiledList, but since you can not override CheckDirty in an effector yourself you can't add another FieldList dependency check. Cheers Maxime.
  • Python: How to import files as modules?

    Cinema 4D SDK python 2024
    2
    0 Votes
    2 Posts
    559 Views
    i_mazlovI
    Hi @gaschka, In your next postings please provide more detailed description of your question. In this case you're lacking information about the file structure you're using, the code that performs the import, the information on how and what have you set the environment variable for. Regarding your question, when splitting python code into separate pieces one usually uses the concept of packages rather than raw files. Hence, your question relates to local modules you'd like to use in your script. Please, have a look at the Python Libraries Manual especially the last section about the Local Plugin Search Paths. Another point of interest for you would be a utility function LocalImportPath that simplifies the process of importing packages. If you have any further questions, please let me know and provide a code sketch that showcases your issue. Cheers, Ilia
  • Python: How to inject code into a Python tag?

    Cinema 4D SDK python 2024
    4
    0 Votes
    4 Posts
    876 Views
    gaschkaG
    Thanks to you both for your answers. @m_adam Regarning my issue with the file linking, I'll try to come up with a procedure for reproduction of my issue soon: It was quite random, but I was in the flow of writing my script, so I circumvented with the string solution, but I would prefer the file solution for sure.
  • Python: User Data Float Slider?

    Cinema 4D SDK python 2024
    4
    1
    0 Votes
    4 Posts
    959 Views
    gaschkaG
    @i_mazlov Thank you for the friendly introduction and the hint to CUSTOMGUI and REALSLIDER, exactly what I was looking for. @baca Thank you for the additional tip.
  • Python script to Python tag hand over?

    Cinema 4D SDK 2024 python
    3
    0 Votes
    3 Posts
    724 Views
    gaschkaG
    Thanks for your help and nudging me into the right direction, I think I can work with that
  • Python tag initalization?

    Cinema 4D SDK python 2024
    7
    0 Votes
    7 Posts
    1k Views
    gaschkaG
    @m_adam @m_adam said in Python tag initalization?: OM is not single threaded, Oh, that's an interesting insight for me. Perhaps I was misinformed, as Character Rigs had the tendency to get slow quite easily in C4D, and Animators look envy over to Maya, as they do have a parallel evaluation (and caching). Though I'm aware that there are changes/improvements to C4D performance lately. Thanks for the link. A lot of new information to learn an absorb
  • Call "Set Deformed Mesh" on Weight Tag

    Cinema 4D SDK 2024 python windows
    2
    0 Votes
    2 Posts
    501 Views
    M
    Hi you need to use call button def apply_deformed_mesh(meshes): """ Apply 'Set Deformed Mesh' on all meshes with weight tags. """ for obj in meshes: weight_tag = obj.GetTag(c4d.Tweights) if weight_tag: bc = weight_tag.GetDataInstance() # Set the button to 'Set Deformed Mesh' bc.SetInt32(c4d.ID_CA_WEIGHT_TAG_SET_BUTTON, c4d.ID_CA_WEIGHT_TAG_SET_DEFORMED_MESH) c4d.CallButton(weight_tag, c4d.ID_CA_WEIGHT_TAG_SET_BUTTON) # Update the scene c4d.EventAdd() Cheers, Maxime.
  • Python: GetTags() returning non-existent tags

    Cinema 4D SDK python
    9
    0 Votes
    9 Posts
    2k Views
    .
    thanks @i_mazlov
  • Get All Nodes inside an Xpresso Tag?

    Cinema 4D SDK 2023 python
    3
    0 Votes
    3 Posts
    745 Views
    M
    Hi yes, GvNode are BaseList2D and GeListNode, like material, object, tags. There is the same discussion going on, so you may find it interesting Issue collecting all the shaders in a material. Cheers, Maxime.
  • Arrange All Nodes Command/API in Xpresso?

    Cinema 4D SDK 2023 python
    3
    0 Votes
    3 Posts
    656 Views
    B
    Thanks for the confirmation. I guess I'll just let the users do some reordering the nodes themselves. lol The nodes are creating procedurally so the nodes are just stacked on top of each other. haha
  • 0 Votes
    5 Posts
    2k Views
    B
    Awesome, Thank you so much @m_adam ! Cheers and best regards Ben
  • c4d.gui.ShowPopupDialog Hide search entry

    Cinema 4D SDK python
    2
    0 Votes
    2 Posts
    410 Views
    i_mazlovI
    Hi @merkvilson, Please give more information about your setup and provide a code snippet that shows your issue. I'm not able to reproduce your issue using the code snippet below in C4D 2024.2 There's a c4d.POPUP_ALLOW_FILTERING flag that you can pass to the ShowPopupDialog() function to allow showing the filtering entry in your menu: c4d.gui.ShowPopupDialog(cd=None, bc=menu, x=300, y=300, flags=c4d.POPUP_ALLOW_FILTERING) Cheers, Ilia import c4d def main() -> None: menu = c4d.BaseContainer() for idx in range(5): menu.InsData(c4d.FIRST_POPUP_ID + idx, f"Item {idx}") c4d.gui.ShowPopupDialog(cd=None, bc=menu, x=300, y=300) # c4d.gui.ShowPopupDialog(cd=None, bc=menu, x=400, y=300, flags=c4d.POPUP_ALLOW_FILTERING) if __name__ == '__main__': main() [image: 1702636223773-03915845-5d04-4cf4-a79c-1cb342e2aa60-image.png]
  • 0 Votes
    3 Posts
    719 Views
    B
    @i_mazlov Ah yes, my pose morph names are standardized so there should be no duplicated/redundant names. And yea, thanks for mentioning the dictionary route. Totally overlooked that. That could indeed be an easier way to set/get some values. Thanks!
  • Material Tag: Fit to object

    Cinema 4D SDK python 2024
    3
    0 Votes
    3 Posts
    649 Views
    .
    Hi @m_adam - In this particular instance I'm calling it on objects that have children and I'm getting the prompt to include sub objects. If it were a modeling command or something like that it may include the ability to include or exclude the children programmatically. I'm creating 30 objects and each object has six flat projections that I want to set to the size of the object. That's 180 confirmation clicks.
  • Boundary Edges to Spline in Python

    Cinema 4D SDK s26 python 2024 2023
    3
    0 Votes
    3 Posts
    941 Views
    F
    Dear Ilia, I greatly appreciate your assistance; it was precisely what I needed. Thank you for your guidance and I wish you a wonderful day. Best regards, Tomasz
  • Issue collecting all the shaders in a material

    Cinema 4D SDK python 2024
    11
    2
    0 Votes
    11 Posts
    3k Views
    John_DoJ
    Hi, One last thing I've noticed. The last code shared by @HerrMay works great on all materials but the one I'm using to test my script, it's odd. On this particular material, the function consistently skip the shader which is in the Blend Channel of the Fusion shader. Even the Mask shader in the Mask channel is discovered and printed. [image: 1702592718593-db2bf693-59e6-4eb1-a42e-5c484b38f253-image.png] I've ran the debugger on the function : when the loop state is on the Color shader, the function is going up on the parent Fusion shader as expected but then the elif node.GetNext() condition isn't verified (?!) so it skips the last branch and go back to the material The thing is it doesn't happen with other materials nor other shaders : I've made this particular material's shader tree more complex and all the shaders are seen, even when a node has several children. A brand new material with the same shader setup is not a problem. There are two cases where the function scan the shader correctly and output the expected result : When using the recursive function written by @ferdinand Disconnecting and reconnecting the Filter shader from the Fusion shader. If I run the function again after doing that, the AO and Filter shaders are discovered and printed correctly. Do you have any idea of what it is happening here ? I'm planning to use this function for several commands and I don't like the possibility that it could fail in some cases, even if it is some niche ones.