Global Moderators

Forum wide moderators

Private

Posts

  • RE: Adjust spline layers settings in Field Force Objects with Python?

    Hey @Simon-Lucas,

    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

    Do you really mean you are on R25? Or do you mean you are on 2025? Anyway, please share an example scene and the code you have so far. Otherwise we won't be able to help you.

    Cheers,
    Ferdinand

  • RE: Educational Licenses

    FYI, I have not overlooked this question here. Will post an answer soon(ish).

  • RE: RenderDocument produces different color

    Hey @moghurt,

    this is on our radar, but I cannot give an ETA when this will be auotmated.

    Cheers,
    Ferdinand

  • RE: VertexMap Display (Behavior Equivalent to Double-Click)

    Hey @ymoon,

    Thank you for your question. First of all, your code is more complicated than it has to be. You can just call BaseObject.GetTag to get the first tag of a specific type on an object. Also, your code already does what you are asking for, it selects the tag and therefore causes Cinema 4D to draw the vertex map in the viewport (equivalent to single clicking the tag).

    To have the Paint Tool enabled (i.e., what happens when you double click a vertex map), you could either activate the tool yourself, or just send MSG_EDIT to the tag, the message which is sent to scene elements when they are double clicked.

    Cheers,
    Ferdinand

    Code

    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:
        """Called by Cinema 4D when the script is being executed.
        """
        if not op:
            return c4d.gui.MessageDialog("Please select an object.")
        
        tag: c4d.BaseTag | None = op.GetTag(c4d.Tvertexmap)
        if not tag:
            return c4d.gui.MessageDialog("The selected object has no Vertex Map tag.")
        
        doc.SetActiveTag(tag, c4d.SELECTION_NEW)
        tag.Message(c4d.MSG_EDIT)
        
        c4d.EventAdd()
    
    if __name__ == '__main__':
        main()
    
  • RE: BaseLink across documents

    Hey @WickedP,

    Thank you for your question. A BaseLink always requires a document within which it shall be resolved, when you do not provide one, it just takes the active document.

    5a0f8cfd-a94b-4c0f-b3ef-449841104a35-image.png

    So, your question is a bit ambivalent. Internally, a BaseLink is based on GeMarker which identifies a scene element (C4DAtom) over the mac address of the creating machine, the time of creation, and a random UUID. The value is a constant attached to the scene element expressed as 16 bytes of data.

    So, this value is persistent over reload boundaries and does not care for the document it is in - although copying a scene element will usually cause it to get a new marker, unless you tell Cinema 4D explicitly to also copy the marker. You can easily query multiple documents for containing a given C4DAtom via a BaseLink. But unless you deliberately forced markers to be copied, it is not possible that multiple documents contain the same C4DAtom.

    Cheers,
    Ferdinand

  • RE: How do I return a list of names and ids for a drop down menu?

    Hey @lionlion44,

    yes, that is the correct answer. The subject comes up from time to time, here is an answer of mine which is about the very case of yours - discovering substance channels.

    Cheers,
    Ferdinand

  • RE: Viewport depth of field affects the content drawn using drawtexture()

    Yes, it is intentional that the handle draw pass is only being drawn when the object is selected. You can try the box pass, I think it is also drawn when the object is not selected and might not be subject to viewport effects. The highlight pass is also only drawn when an object is selected. The X-Ray pass should be drawn when an object is not selected, but should also be subject to viewport effects. But the box pass is also subject to camera transforms, just as the object pass, which makes it not a very good choice to draw HUD information.

    All statements above are from my recollection and could be wrong, you just have to check yourself.

    But what you are trying to do is also a bit unusual. Typically, objects should not draw persistent HUDs (what I assume you are trying to do) into the viewport. That would be the job of a SceneHookData plugin. But that hook has never been exposed to Python, mostly out of performance concerns.

    Your code is also missing the OCIO handling the C++ example showcases. You will be drawing with incorrect colors (unless the bitmap(s) you draw happen to have the color profile of the render space of the document - which is very unlikely).

  • RE: Viewport depth of field affects the content drawn using drawtexture()

    Hey @chuanzhen,

    Thank you for reaching out to us. Please remember our support procedures. It is very difficult to help you without seeing the relevant code.

    My guess would be that you are drawing into a draw pass which intentionally is affected by viewport effects such as depth of field, e.g., DRAWPASS:OBJECTS. The C++ code examples contain the Drawing with OCIO Colors in a Viewport example; which is likely very close to what you want to do. The example draws textures in both the object and handle pass, where the object pass will be affected by DOF while the handle pass will not.

    4cba6810-c75f-4622-bacf-8186b19ea3ed-image.png

    Cheers,
    Ferdinand

  • RE: How to measure Viewport performance? -> Troubleshooting and optimization.

    Hey @mogh,

    I agree that the tool is not so greatly documented but I told you that the options at the bottom (i.e. also 'saving') all only concern animation tests 😉

    I guess your grievance is this one: Live readout 97ms, 11 FPS; Workstation: RTX 3090, i9-10980XE? As far as I understand, you are dealing with this outside of any plugins you have developed? Which would make this an end user issue, I really cannot help you there.

    What you can do, is disable all drawing operations (Anim Without View, No Ui Update), to see how fast your scene is then. I.e., you then mostly only pay the price for Cinema 4D building the scene for each update event (caches, expressions, animations, etc.). Because it could very well be that you just created there a scene which is very inefficient or are using there plugins which are. So, the slow viewport is just an effect of scene evaluation being so expensive. Which is often the cause when scenes are slow or very slow.

    edit: Okay, now I see it. 10,000 objects and 120 million polygons. Yeah, Cinema 4D won't like that. Just combine all objects into one, and your numbers should go up. What makes the scene likely slow, is the sheer number of objects. 12 million polygons (10% of 120 million) is something Cinema 4D can handle with such GPU. But it makes really a difference if all these polygons are in one object, or as in your case, scattered over 10,000 objects.

    edit 2: okay, now I saw also your comment about the 'old' laptop compared to a (presumably new) workstation. I would not rule out that you have here multiple issues. That 10k + 12kk scene very likely performs not so great on many machines. In addition, you might have a defective GPU or outdated drivers. Did you update your drivers an ran a GPU stress test to ensure that your GPU pulls the numbers it should be able to pull? You could also use Cinebench.

    Cheers,
    Ferdinand

  • RE: How to measure Viewport performance? -> Troubleshooting and optimization.

    Hey,

    The opposite is true, Calculate Fps and the systems below it are very old. This is a developer tool, so you could say it naturally is not documented 😉 . Here is a rough explanation:

    • Start/Stop: Runs a procedural camera animation of the scene. I think mostly the viewport team uses it. Just outputs FPS and a timing.
    • Anim Test: The actual tool, this just runs your active document.
    • Run JSON: I have no idea, never used it.
    • Active View: No idea, I think its is broken. You have always to enable it.
    • Reverse: If to play the scene in reverse.
    • Texture View: Never used it, no idea.
    • Without View: Disable viewport redraws while profiling.
    • Without UI: Disable UI redraws while profiling.
    • Profile Animation/Spinlocks/Save Profile Summary: They all concern animation tests and what is put into the report.

    The summary will automatically be opened once the animation test finished (you must have an app associated with txt files but it is almost impossible to not have at least one app associated with that file format). The data in a report is fairly technical and likely not that useful for normal users. The main public purpose of the tool is to provide accurate FPS numbers in the dialog itself. There are also command line arguments with with you can run animation tests automatically, but they are just as most command line arguments for Cinema 4D not public as they are intended to be developer tools only.

    8ea84b48-339b-4b57-8052-6def2381a9b8-image.png

    Cheers,
    Ferdinand