Group Details Private

administrators

  • RE: Docked Dialog Problem with width of CUSTOMGUI_FILENAME

    Hi Sebastian,

    Thanks for your patience. TLDR; it's a bug but you still need to set minimal width.

    The issue is twofold:

    1. For this UI element to work as intended you need to specify the minimal width argument minw, for example using the c4d.gui.SizeChr() function:
      self.AddCustomGui(self.ID_TEXT_1, c4d.CUSTOMGUI_FILENAME, '', c4d.BFH_SCALEFIT, c4d.gui.SizeChr(80), 0, bc)
    2. There's currently a bug, which prevents this from working properly. The fix is going to be included in one of further Cinema 4D releases.

    After the fix is released, given you're using the minw argument, the issue wouldn't be there anymore. Thanks for drawing our attention to this issue!

    Cheers,
    Ilia

    posted in Cinema 4D SDK
  • RE: KDTree or OcTree with C4D Python

    Hey @gheyret,

    you can project a world space coordinate into screen space with BaseView. But ViewportSelect is more meant for user interactions as its name implies.

    We had this morning a quick talk about your subject, and my stance was mostly that it does not make too much sense to port something like KDTree to Python. Because while porting itself is entirely technically possible and the result is then performant (enough), it implies a technical complexity which is not. So, you are then basically able to process point neighbour hood blazingly fast in Python, but that implies processing a lot of points (at which Python sucks). Which is why I recommended ViewportSelect as a workaround for cases where you only have to lookup the neighbor of a handful of points. But for your case, you will not get very far with ViewportSelect.

    Because in the end remains the fact that the popular computational geometry algorithms which could use something like a KDTree: differential growth, shortest path on a mesh, heat maps, optimal coverage (e.g., space colonization), etc., tend to be very complex computationally and therefore not very sensible to be implemented in Python. Going over ViewportSelect would make things even slower (and also imprecise).

    Maxime has this still on his agenda and you might get lucky. I am of course aware that there is a wide range of what people would consider "acceptable" computation times. Technical artists are sometimes fine with a script running for 5, 10, 20 minutes; i.e., just brute forcing something. And in the end you can also write yourself at least an octree relatively easily in Python (with a then to be expected performance).

    Cheers,
    Ferdinand

    posted in General Talk
  • RE: KDTree or OcTree with C4D Python

    Hey @gheyret this is on my bucket list of things I want to port it since a long time, but to be honest it's rather low-priority.

    But I will keep it in mind.With that's said depending on what you want to do you may find ViewportSelect Interesting.

    Cheers,
    Maxime.

    posted in General Talk
  • RE: Tree view boolean column bug

    Hi @Gregor-M please make sure that your script is executable before sending it to us. Since in it's current state it does raise

    Traceback (most recent call last):
      File "scriptmanager", line 53, in GetDown
      File "scriptmanager", line 33, in GetChildren
    AttributeError: 'Entity' object has no attribute 'children'. Did you mean: 'GetChildren'?
    

    I added self.children = [] within the __init__ of Entity and it fixed the issue but this indicate that you are working on a different version than us. But even with it I'm not able to reproduce any issue and everything is working as expected.

    With that's said your else statement within the SetCheck looks very suspicious and I won't be surprised that the behavior you are experiencing is coming from this else statement.

    Finally note that you can call the function TreeViewCustomGui.SetRoot to define a root. Then the root argument that is available in all functions will be pointing to it.

    Cheers,
    Maxime.

    posted in Cinema 4D SDK
  • RE: Docked Dialog Problem with width of CUSTOMGUI_FILENAME

    Hi @datamilch,

    Although I highly suspect this to be a bug, I'll need more time to double check it. I'll update you further, once have a more clear vision on this.

    Cheers,
    Ilia

    posted in Cinema 4D SDK
  • RE: Change Icon Color parameter

    Hi @chuanzhen,

    The "Display Color" value of the "Icon Color" attribute is a dynamic value (comparing to "None" and "Custom" being static values), this was explained in the related thread: Python Documentation - Icon Color. This is the reason why it requires special handling, namely (as Manuel explained in the related thread: Simple Organisational Structure Generation Script), one needs to send a c4d.MSG_GETCUSTOMICON_SETTINGS message to the object to properly set this attribute. Please check the example code snippet that shows its usage.

    Cheers,
    Ilia

    Example code, showing the usage of the c4d.MSG_GETCUSTOMICON_SETTINGS message:

    import c4d
    
    doc: c4d.documents.BaseDocument  # The currently active document.
    op: c4d.BaseObject | None  # The primary selected object in `doc`. Can be `None`.
    
    def main() -> None:
        obj = c4d.BaseObject(c4d.Ojoint)
        
        # Configure object display color attribute
        obj[c4d.ID_BASEOBJECT_USECOLOR] = c4d.ID_BASEOBJECT_USECOLOR_ALWAYS
        obj[c4d.ID_BASEOBJECT_COLOR] = c4d.Vector(1, 0, 1)
    
        # Configure object icon color attribute
        settings = c4d.CustomIconSettings()
        settings._colorMode = 2
        obj.Message(c4d.MSG_GETCUSTOMICON_SETTINGS, {'setting': settings})
        obj[c4d.ID_BASELIST_ICON_COLORIZE_MODE] = c4d.ID_BASELIST_ICON_COLORIZE_MODE_CUSTOM + 1
    
        obj.SetName("Magenta Joint")
        doc.InsertObject(obj)
    
    
    if __name__ == '__main__':
        main()
        c4d.EventAdd()
    
    posted in Cinema 4D SDK
  • RE: Issue: CommandData Plugin Compilation Errors in Cinema 4D 2025.1.0 SDK

    Hey @skibinvitaliy,

    Welcome to the Maxon developers forum and its community, it is great to have you with us!

    Getting Started

    Before creating your next postings, we would recommend making yourself accustomed with our forum and support procedures. You did not do anything wrong, we point all new users to these rules.

    • Forum Overview: Provides a broad overview of the fundamental structure and rules of this forum, such as the purpose of the different sub-forums or the fact that we will ban users who engage in hate speech or harassment.
    • Support Procedures: Provides a more in detail overview of how we provide technical support for APIs here. This topic will tell you how to ask good questions and limits of our technical support.
    • Forum Features: Provides an overview of the technical features of this forum, such as Markdown markup or file uploads.

    It is strongly recommended to read the first two topics carefully, especially the section Support Procedures: How to Ask Questions.

    About your First Question

    No one is judging you here, problems are part of the game and what we are here for to help with 🙂 . But please familiarize yourself with our forum rules, such question should be accompanied by example code and the version you are migrating from, as we otherwise mostly have to guess what is going wrong.

    I am assuming you are migrating from a pre-2025 SDK, that is at least what your errors imply. With 2025 we introduced our cinema namespace. Please follow our Migrating Plugins to the 2025.0 API guide. You are likely just missing a couple of using namespace cinema; at the top of your files.

    Cheers,
    Ferdinand

    posted in Cinema 4D SDK
  • RE: Python Tag plugin : Is it possible to disable(ghost) the host object's parameters?

    Hey @ymoon,

    thank you for reaching out to us. While you can access the description of a scene element at any time via c4d.C4DAtom.GetDesccription, it will always be static, i.e., read only there. Only in the context of NodeData.GetDEnabling and NodeData.GetDDescription, the description of a node will be dynamic (that is what the 'D' stands for in these methods), i.e., writeable.

    It is therefore only possible to runtime modify the description of nodes you do implement yourself. Otherwise the system would inevitably produce race conditions. Where a parameter X of an object O being shown or not, would depend on how two objects A (wants to show O.X) and B (wants to hide O.X) are placed in relation to O in the object manager; and which of (A, B) is therefore executed first and which last.

    There is one exception to that rule, and this is user data, accessible via GetUserDataContainer (Python) and C4DAtom::GetDynamicDescription(Writeable) (C++), here you can always modify the description. There is however no direct flag in the description to disable an element, the closest thing you can do, is hide an element with DESC_HIDE.

    Cheers,
    Ferdinand

    posted in Cinema 4D SDK
  • RE: Hiding Node Previews for all Redshift Nodes in Redshift Materials

    Hey,

    there is no NOT in the query syntax, if that is what you are asking for, although that could be a cool idea. What you would have to do, is apply two partial descriptions in one ApplyDescription call, one that first selects all nodes with an enabled preview and disables it, and then one which selects the end node and disables its preview. Or just carry out two successive ApplyDescription calls.

    Cheers,
    Ferdinand

    PS: You can of course do whatever you want with your module attributes, and things like __author__, __license__, __email__, etc are not formally standardized, but the quasi standard module attribute is called __author__, there is no __authors__. When you have multiple authors, you usually put them semicolon separated into the __author__ field. When you use __authors__, tools which support that quasi standard won't find your attribute and the whole purpose of these module attributes is being machine readable, as you could otherwise also just write things into the doc string of the module.

    See:
    The original Python Enhancement Proposal by Guido van Rossum (the now famous pep8) which introduced the concept of module dunder attributes and one of the many guides of how people interpret this, what this has evolved into.

    posted in Cinema 4D SDK
  • RE: Hiding Node Previews for all Redshift Nodes in Redshift Materials

    Hey @d_keith,

    Thank you for your question. Please remember our forum rules, which prohibit diary style postings. I understand that you did this under the banner of being documentative, but too much noise in a posting can confuse future readers.

    From Support Procedures: How to Ask Questions:

    Singular Posting: Users often discover additional information or even a solution before we can answer. Please consolidate your questions into a singular posting by editing your last posting. It is otherwise not only for us but also for future readers hard to follow the topic. Once we replied to a topic you are of course then free to reply in a new posting. But when you have follow-up questions, all information should again be consolidated in the most recent posting until we answer.

    The preview of a material graph node is just an attribute with the ID net.maxon.node.base.preview. You would have to iterate over all nodes in a graph and set it to False (just as in @Dunhou's maxon example, but you could condense there some code using maxon.GraphDescription.GetMaterialGraphs). You can use @Dunhou's Nodes API wrapper which provides some nice abstractions for users who do not want to go too deep into the Nodes API, but at the same time stay within the domain of it.

    An alternative would be Graph Descriptions, specifically their graph query feature which is more aimed at the technical complexity artists are usually more comfortable with. I have provided an example below.

    Cheers,
    Ferdinand

    PS: I just realized that there is a typo in one of the graph query code examples in the manual, it should be of course QUERY_FLAGS.MATCH_MAYBE and not QUERY_FLAGS.MATCH_MATCH_MAYBE, will fix that 🙂

    Result

    The state of a document with three very simple Redshift materials after the graph description has been bulk applied, all nodes have a collapsed preview:
    b4b54b82-ab97-400a-85ff-0e3fc0031912-image.png

    Code

    """Provides a simple example for a graph description query to modify all nodes in all Redshift 
    material graphs in a document which have a set of specific properties, here at the example of 
    the "Show Preview" property.
    """
    
    import c4d
    import maxon
    
    doc: c4d.documents.BaseDocument # The currently active document.
    
    def main() -> None:
        """
        """
        # For each material in the document which has a Redshift material node space, get its graph and ...
        for graph in maxon.GraphDescription.GetMaterialGraphs(doc, maxon.NodeSpaceIdentifiers.RedshiftMaterial):
            # ... apply a graph description to the graph, that ...
            maxon.GraphDescription.ApplyDescription(
                graph, {
                    # ... defines a query for the passed graph that can match many to none nodes ...
                    "$query": {
                        "$qmode": (maxon.GraphDescription.QUERY_FLAGS.MATCH_ALL | 
                                   maxon.GraphDescription.QUERY_FLAGS.MATCH_MAYBE),
                        # ... where each matched node has the following properties (we could add here
                        # more properties) ...
                        "Basic/Show Preview": True # Node has its preview enabled.
                    },
                    # ... so that we can then write into each node new properties, here we simply disable
                    # the preview for all matched nodes.
                    "Basic/Show Preview": False
                }
            )
        
        # Push an update event (not really necessary in this case, but good practice at the end of scripts)
        c4d.EventAdd()
            
    if __name__=='__main__':
        main()
    
    posted in Cinema 4D SDK