• How to SetKeyframeSelection for Subfield

    Cinema 4D SDK 2024 python
    5
    1
    0 Votes
    5 Posts
    953 Views
    F
    Thanks again.@i_mazlov I haven't studied C++ yet, but I'm glad to know that it's achievable with C++.
  • 0 Votes
    3 Posts
    626 Views
    DunhouD
    Hey @ferdinand , oops, I have an impression of this topic and tried to recall it, but I couldn't find any keywords in my mind at the time. I must have gone crazy. And the key is the GetData(), I have no concept of file composition and did not realize that what is returned here is the data required for an image file. Thank you very much. Cheers~ DunHou
  • GetChildren into an InExcludeData

    Cinema 4D SDK 2024 python
    3
    0 Votes
    3 Posts
    633 Views
    H
    Thank you so much @i_mazlov . I'm still new to this and your reply is extremely helpful. Thanks again! Apologies for the double post. I wanted to completely remove the old post since I kinda spammed too many replies on it while I was figuring out what was wrong. Appreciate the help. Have a good day!
  • Python Api: Document Events

    Cinema 4D SDK python
    8
    0 Votes
    8 Posts
    2k Views
    ferdinandF
    Hey @paulgolter, yes, this is okay. What you should not do, is traverse the whole scene graph, i.e., every object, shader, material, scene hook, track, curve, key etc that are to be found in a scene; just to get hold of all cube objects for example. For performance critical operations, we should always only traverse what we really need . But you just traverse the objects which is totally fine. I personally would avoid recursion, passing around a list, and not using an iterator, as this all makes things slower. Especially recursion/function calls are not cheap in Python. For the next major release we added some premade scene traversal functions in Python. I have attached one of the functions which will be exposed below. But your function is probably fine too, this is all very nitpicky. You do not use full recursion which is the most important thing. Everything else is probably nerd-talk. Cheers, Ferdinand def IterateTree(node: c4d.GeListNode | None, yieldSiblings: bool = False, rewindToFirstSibling: bool = False, rewindToRoot: bool = False) -> typing.Iterator[c4d.GeListNode]: """Yields nodes that are hierarchically related to `node`. .. note:: This function walks a node tree in a purely iterative manner, which makes it fast and robust for medium to large trees. For small trees (<= 100 nodes) `RecurseTree` is slightly faster. This function is usually the faster and safer choice compared to `RecurseTree` as the performance gain for large trees is significant while the loss for small trees is negligible. .. note:: To also yield non-hierarchical relationships, use `RecurseGraph` instead. :param node: The root node to start iterating from. :type node: c4d.GeListNode or None :param yieldSiblings: Whether to yield the next siblings of the current node, defaults to `False`. :type yieldSiblings: bool, optional :param rewindToFirstSibling: Whether to rewind the node to its first sibling before the iteration is carried out, defaults to `False`. :type rewindToFirstSibling: bool, optional :param rewindToRoot: Whether to rewind the node to its root before the iteration is carried out, defaults to `False`. :type rewindToRoot: bool, optional :return: An iterator that yields the descendants of the passed `node`. :rtype: typing.Iterator[c4d.GeListNode] :raises RuntimeError: If the UUID of a node could not be retrieved. :Example: .. code-block:: python import c4d from mxutils import CheckType, IterateTree # For the object tree: # # A # |___B # | |___C # | |___D # | | |___E # | |___F # G # Find the object named "D" in the scene. d: c4d.BaseObject = CheckType(doc.FindObject("D")) # Will yield D and E. for node in IterateTree(d): print (node) # Will yield D, E, and F. But not C as we start out at D and #yieldSiblings only looks # downwards, at next siblings and not previous ones. for node in IterateTree(d, yieldSiblings=True): print (node) # Will yield C, D, E, and F. Because we rewind to the first sibling of D - which is C. for node in IterateTree(d, yieldSiblings=True, rewindToFirstSibling=True): print (node) # Will yield A, B, C, D, E, and F. But not G, as we do not yield siblings. for node in IterNodeTree(d, rewindToRoot=True): print (node) # Will always yield the whole tree, no matter where we start. for node in IterateTree(d, True, True, True): print (node) """ def iter(node: c4d.GeListNode) -> typing.Iterator[c4d.GeListNode]: """Iterates over the descendants of the passed `node`. """ # The visited nodes and the node to stop iteration at. visited: dict[bytes, c4d.GeListNode] = {} terminal: c4d.GeListNode = node # Walking a tree iteratively is faster for medium to large trees than a recursive or # semi-recursive traversal. See: https://developers.maxon.net/forum/topic/13684 while node: # We could use GeListNode.__hash__ here, but it turns out that it is much slower than # doing it manually with MAXON_CREATOR_ID (sic!). Probably because of the overhead of # __hash__ hashing the UUID into an integer? nodeUuid: bytes = bytes(node.FindUniqueID(c4d.MAXON_CREATOR_ID)) if nodeUuid is None: raise RuntimeError(f"Could not retrieve UUID for {node}.") # Yield the node when it has not been encountered before. if visited.get(nodeUuid) is None: yield node visited[nodeUuid] = True # Walk the graph in a depth first fashion. getDown: c4d.GeListNode | None = node.GetDown() getNext: c4d.GeListNode | None = node.GetNext() getDownUuid: bytes | None = getDown.FindUniqueID(c4d.MAXON_CREATOR_ID) if getDown else None if getDown and getDownUuid is None: raise RuntimeError(f"Could not retrieve UUID for {getDown}.") if getDown and visited.get(bytes(getDownUuid)) is None: node = getDown elif node == terminal: break elif getNext: node = getNext else: node = node.GetUp() # --- End of iter() ---------------------------------------------------------------------------- if not isinstance(node, c4d.GeListNode): return # Set the starting node. # if rewindToRoot: # node = GetRootNode(node) # if rewindToFirstSibling: # node = GetFirstSiblingNode(node) # Traverse the hierarchy. while node: yield from iter(node) if not yieldSiblings: return node = node.GetNext()
  • How to change the value here using python

    Cinema 4D SDK 2024 python
    8
    1
    0 Votes
    8 Posts
    2k Views
    F
    @ferdinand Thanks so much for such a detailed response. Learned a lot. My problem is solved. Thank you very much.
  • 0 Votes
    3 Posts
    619 Views
    kangddanK
    @ferdinand Thank you !
  • 0 Votes
    11 Posts
    3k Views
    E
    @ferdinand Wow, thanks a ton for that! Our workflow was working just fine without c4dpy, so I didn't get to check the forum again, but this is very nice. Happy new year!
  • How do I create a Plugin Identifier?

    Cinema 4D SDK windows python 2024
    14
    0 Votes
    14 Posts
    2k Views
    ferdinandF
    Hey @shir, good to hear that you solved the issue. Maybe NodeBB has an issue with the specific (top level) domain your mail handle was under? I just checked the logs and this is the event for the second registration mail that has been sent out (I edited your mail handle for privacy reasons). I.e., this is the one I manually invoked. There is another event for your actual registration. As far as NodeBB is concerned, it seems to be convinced that it successfully sent these mails. { "confirm_code": "dbcc0d6c-8646-4191-9975-badc1c7035f2", "email": "[email protected]", "subject": "Welcome to PluginCafé", "template": "welcome", "timestamp": 1751883962965 } NodeBB can be a bit buggy from time to time but that it fails to send a mail and then creates an event for successfully sending it, would be a bit odd. I will have an eye on this. Cheers, Ferdinand
  • 0 Votes
    8 Posts
    1k Views
    i_mazlovI
    Hi @hoffwerr , Please check our Support Procedures about consolidating consequent answers in a single posting. Please also do not duplicate your threads! I assume this question was answered in your second thread: GetChildren into an InExcludeData. Cheers, Ilia
  • 0 Votes
    3 Posts
    905 Views
    E
    @ferdinand Thanks a ton again! Yeah that dynamic UI is indeed something that fits perfectly with my current case, and possibly some other features I want to implement. Tho, I will revisit it later once I get to creating an MVP for my plugin. So I will use FreeChildren() for now.
  • Importing pythonapi from ctypes freezes C4D

    Cinema 4D SDK s24 macos python
    7
    0 Votes
    7 Posts
    2k Views
    ferdinandF
    Hey @lasselauch, We are not able to reproduce this crash on an Intel, M1, or M3 MacBook with 2024.4.0. Please provide and submit a crash report when this is still a problem for you. I would also recommend reinstalling Cinema 4D to rule out that your installation was damaged. Cheers, Ferdinand
  • Adding image to GeDialog - Python Plugin/Script

    Cinema 4D SDK python
    8
    0 Votes
    8 Posts
    2k Views
    DunhouD
    @ferdinand fine for that, like I think, this is not perfect solution for this, thanks for your confirm! Cheers~ DunHou
  • 0 Votes
    4 Posts
    822 Views
    i_mazlovI
    Hi @ezeuz, Great to hear you've figured it out and thanks for sharing the solution with the community! Cheers, Ilia
  • 2024.5.0 SDK Release

    News & Information cinema 4d news c++ python sdk
    1
    0 Votes
    1 Posts
    9k Views
    No one has replied
  • Correct Tangent Values

    Cinema 4D SDK python
    5
    0 Votes
    5 Posts
    893 Views
    T
    Hallo Mazlov, lot of thanks for your explanation. I think I don't will get deeper in the math of generic Bezier and Cubic Hermite spline. But this is good to know how Ae and C4D interpret these tangent values. Meanwhile I finished my script that push every selected Ae-Shape direct to C4D. Works fine so far. Thanks for your help! Tudor
  • Tool Tabs and foldable groups

    Cinema 4D SDK python
    2
    0 Votes
    2 Posts
    620 Views
    ferdinandF
    Hello @BretBays, Thank you for reaching out to us. Please provide code and a clear problem description as statements like `How do you create the tabs ... I tried X but it only creates tabs' are a bit confusing for us. There are two ways to create tab interfaces, one is via groups and the method GeDialog.TabGroupBegin and the other one is via CUSTOMGUI_QUICKTAB. We have a code example for it in Python here. The "tab-look" of descriptions, i.e., what you usually see in the Attribute Manager, is achieved with CUSTOMGUI_QUICKTAB. There is no group folding in dialogs anymore, this feature has been deprecated (we probably should update the docs). There is a difference between dialogs and descriptions. They use similar UI elements but they are not the same. Folding in descriptions is still supported, in dialogs not (but you can implement it yourself when you really need it). You should also be aware that there are ToolData and DescriptionToolData plugins. The former tool type uses dialogs to display its UI in the Attribute Manager, and the latter uses descriptions. Most tools these days in Cinema 4D are implemented as DescriptionToolData which leads to a distinctive look and set of features which are not trivial to emulate with a plain ToolData. ToolData is exposed in Python and C++, DescriptionToolData is only exposed in C++. My colleague @m_adam likes to point out whenever this subject comes up that the type SculptBrushToolData is exposed in Python (which is derived from DescriptionToolData) and that you can (ab)use it to implement a DescriptionToolData in Python. I never tried doing that and what consequences that would have (and neither did Maxime AFAIK). For my taste that would be way too hacky, and I would rather just live with the minor restrictions of ToolData plugin and its dialog based UI. Cheers, Ferdinand
  • 0 Votes
    5 Posts
    1k Views
    i_mazlovI
    Hi @mikeudin , To me it sounds pretty much like this issue here: issue with inserting fieldlayers in r2024, particularly after I couldn't reproduce this issue with the internally available next version of cinema. Cheers, Ilia
  • 0 Votes
    5 Posts
    1k Views
    M
    Hi sorry for not answering this topic earlier, I finally found some time to investigate and sadly there is nothing you can do in your side, this memory leak is coming from the Illustrator Importer and can be big, since all the points and tangents of the file are leaking. A fix will be available in the next update. Thanks for the report ! Cheers, Maxime.
  • 0 Votes
    6 Posts
    1k Views
    O
    Thanks a LOT @ferdinand and @mikeudin , for sharing your insights and suggestions! They are definitely valuable and am sure will come in handy in the future!!!
  • BitmapButton not work

    Cinema 4D SDK 2024 python
    5
    1
    0 Votes
    5 Posts
    1k Views
    chuanzhenC
    @ferdinand Thanks