• 0 Votes
    7 Posts
    2k Views
    DunhouD
    Hi @i_mazlov , Thanks for your time, sorry for my bad that I use a confusing word for "id", I should say "asset id", but as you said, I can use ID to check this, for some reason, I overlooked this for a moment. And the GetParent(), I found out that the culprit is GetSelectedNodes(), I use this to get a selected node(abs bode) but the return is "group", so what ever I try the return is 'Root'. Thanks for all your works! Cheers~ DunHou
  • 0 Votes
    9 Posts
    4k Views
    i_mazlovI
    Hi Christophe, Please note our Support Procedures, namely: We cannot provide support for third party libraries "It doesn't work" is not a support request and we cannot debug your code for you, but instead provide answers to specific problems. From my personal point of view, you need to reduce your setup as far as possible while still being able to reproduce the bug: Determine which one of your 2 tag plugins causes the issue Cut off unrelated functionality of your plugin that has nothing to do with the issue Figure out the specific function or line that causes the issue Search the forum if this issue was already discussed If not, create an example code snippet that highlights your issue Post your specific question and the example code snippet in a separate thread with a meaningful title Cheers, Ilia
  • 0 Votes
    8 Posts
    4k Views
    M
    Hi correct I made a typo in the string representation of a Vec3, this is going to be fixed in an upcoming release. Cheers, Maxime.
  • Cinema 4D SDK Overview

    Pinned News & Information information sdk cinema 4d c++ python
    3
    0 Votes
    3 Posts
    15k Views
    maxonM
    Cinema 4D C++ SDK The Cinema 4D C++ SDK offers the full tool set of the public Cinema 4D API. It is an excellent choice for experienced developers who want to implement computationally demanding plugins or plugin types such as custom render engines or material systems that are exclusive to the C++ API. Quickstart Online C++ Documentation: The most recent Cinema 4D C++ online documentation. To bookmark a link to the most recent version of the documentation, bookmark developers.maxon.net/docs/cpp/ (when you bookmark a link you followed, you will bookmark a specific version). C++ Code Examples: The C++ SDK code examples. You will need the frameworks provided in an sdk.zip to run these. Project Tool: A tool to generate Visual Studio and XCode solutions for Cinema 4D C++ API projects. SDK Database: The SDK Asset API database, containing assets used by code examples. To be able to compile the code examples, one requires t+the frameworks provided in the sdk.zip of a Cinema 4D installation. See Getting Started for details. Development Environment To build plugins for a specific SDK, one must meet the development environments listed below. And while it might be possible to deviate from these requirements from time to time, doing so will be out of scope of support; when you run into technical problems and ask for support, we will ask you to match the required environment. The Application Binary Interface (ABI) marks the range of compatibility of SDKs and plugins compiled for them. All versions that are binary compatible with each other can run your plugin, if the SDK version is equal to or lower than the Cinema 4D version. So, a plugin compiled for R21.0 will also run in R21.1, S22.0, and S22.1 because they all share one ABI. But you cannot run a plugin compiled for S22.0 (using S22.0 features) in R21.0. For the greatest range of compatibility, it is therefore often best to compile for the earliest version within an ABI one can use for the feature one requires. Release ABI Windows macOS Linux 2024 2023904 VS 2019/22 Xcode 13 GCC 9.3.1.12, glibc 2.17, Python 3, Scon 3.1.2 2023 2022901 VS 2019 Xcode 13 GCC 9.3.1.12, glibc 2.17, Python 3, Scon 3.1.2 S26 25004 VS 2019 Xcode 12 GCC 9.3.1.12, glibc 2.17, Python 3, Scon 3.1.2 R25 25004 VS 2019 Xcode 12 GCC 9.3.1.12, glibc 2.17, Python 3, Scon 3.1.2 S24 23004 VS 2019 Xcode 12 GCC 9.3.1.12, glibc 2.17, Python 3, Scon 3.1.2 R23 23004 VS 2019 Xcode 11 GCC 9.3.1.12, glibc 2.17, Python 3, Scon 3.1.2 S22 21014 VS 2019 Xcode 11 GCC 9.3.1.12, glibc 2.17, Python 3, Scon 3.1.2 R21 21014 VS 2017 Xcode 10 GCC 9.3.1.12, glibc 2.17, Python 3, Scon 3.1.2
  • 0 Votes
    2 Posts
    645 Views
    ferdinandF
    Hello @Christian-0, Thank you for reaching out to us. I am a bit confused by your question. A soft body simulation is characterized by the fact that it gives up the idea of a geometry transform with governs a geometry as usually applied in computer graphics. In the end this means that the transform of the object (BaseObject.GetMg) will not change but the points will and with it the bounding box of an object. Below you see a soft body cylinder falling. Its transform, the axis, never changes, but the bound box does. Animated are here the points, not the object, hence the term soft body. bbox.mp4 In the API you can get the bounding box values with BaseObject.GetMp and BaseObject.GetRad. When you want a transform, a matrix for that, you would have to compute that yourself. The matrix manual dissects how to construct matrices. Cheers, Ferdinand
  • After undo, point object SetAllPoints not update

    Cinema 4D SDK 2024 python
    3
    1 Votes
    3 Posts
    790 Views
    chuanzhenC
    @ferdinand Thanks for your help!
  • Simple plugin to dynamically list python scripts

    Cinema 4D SDK python
    2
    1
    0 Votes
    2 Posts
    524 Views
    ferdinandF
    Hello @Dave , Welcome to the Plugin Café forum and the Cinema 4D development 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 Guidelines, as they line out details about the Maxon SDK Group support procedures. Of special importance are: Support Procedures: Scope of Support: Lines out the things we will do and what we will not do. Support Procedures: Confidential Data: Most questions should be accompanied by code but code cannot always be shared publicly. This section explains how to share code confidentially with Maxon. Forum Structure and Features: Lines out how the forum works. Structure of a Question: Lines out how to ask a good technical question. It is not mandatory to follow this exactly, but you should follow the idea of keeping things short and mentioning your primary question in a clear manner. About your First Question Your question is effectively out of scope of support because we do not debug code for users as lined out in our support guidelines. So, you cannot just post your code and then ask us to fix it, this especially applies when things like Chat GPT are involved. With that being said, there are two (three) major problems with your code: show_script_list_dialog: This is pure nonsense regarding creating and running a dialog. Dialogs must be implemented, see here for our dialog examples. run_script: This does not set the runtime environment, the globals, of the script to run. Which will cause many scripts to fail, as script manager scripts are prepopulated with doc and op. Plugin ID: The plugin ID 1009792 you are using does not seem to be a valid ID, the current plugin ID counter is at 1062027. You can do whatever you want to do locally, but you cannot ship any plugins with such made up IDs. You also do not really need a full-blown dialog here, you could just get away with ShowPopupDialog. Find a simple version below. Please understand that we cannot support ChatGPT nonsense output in future postings of yours. Cheers, Ferdinand Result: Running the twice hello_doc.py script with the wrapper script run_scripts.py. And then for the lulz run the wrapper with the wrapper to run the hello_doc script. metalol.mp4 Code: """Demonstrates how to run Script Manager scripts from a Script Manager script. Must be run as a Script Manager script while setting #SCRIPT_DIRECTORY to a path where your scripts do lie. Note: This code has been written for Cinema 4D 2023.2 or higher, it uses the pipe operator in type hints supported only by Python 3.10 or higher. To run this code in older versions, simply remove the pipe operator and its second argument: def foo() -> str | None: # 3.10 code def foo() -> str: # legacy code """ import c4d import os import runpy # Make sure to use a raw string or to escape it when defining a windows path. SCRIPT_DIRECTORY: str = r"C:\Users\f_hoppe\AppData\Roaming\MAXON\2024.1.0_7142A741\library\scripts" doc: c4d.documents.BaseDocument # The active document op: c4d.BaseObject # The active object, can be `None`. def SelectScript(path: str) -> str | None: """Opens popup selection dialog to let a user select a Python file in the given #path. """ # Sort out that #path is indeed an existing directory path and get all Python files in it. if not os.path.exists(path) or not os.path.isdir(path): raise OSError(f"'{path}' is not a valid directory path.") files: list[str] = [os.path.join(path, f) for f in os.listdir(path) if os.path.splitext(f)[1] == ".py"] if len(files) == 0: c4d.gui.MessageDialog(f"There are no Python scripts in the path: '{path}'.") # Build a popup menu for #files and display it under the cursor. menu: c4d.BaseContainer = c4d.BaseContainer() for i, item in enumerate(files): menu.InsData(c4d.FIRST_POPUP_ID + i, os.path.split(item)[1]) index: int = c4d.gui.ShowPopupDialog( cd=None, bc=menu, x=c4d.MOUSEPOS, y=c4d.MOUSEPOS) - c4d.FIRST_POPUP_ID # ShowPopupDialog returns the index of the selected item, which we let start at #FIRST_POPUP_ID # and the later subtracted that value again. So, index should now either be below 0 because # user aborted the dialog or an index for #files. if index < 0: print ("User aborted selection.") return if index > len(files): raise IndexError("Unexpected invalid index.") # Get the file path and be extra paranoid in checking if the file actually does exist (it # should since we retrieved only existing files above). file: str = files[index] print (file) if not os.path.exists(file): raise OSError(f"The file '{file}' does not exist.") return file def main() -> None: """Runs the example. """ # Let the user select a Python script at #SCRIPT_DIRECTORY and run the script in an environment # that matches that of a Script Manager script - which primarily means defining #doc and #op. # Script Manager scripts also do some other stuff, but that is irrelevant for us here. If you # wanted to be ultra-precise, you could also pass #globals() as the second argument to # #run_path(). One should then however make sure that the globals are indeed clean, so we should # not expose #SCRIPT_DIRECTORY as a global then. file: str | None = SelectScript(SCRIPT_DIRECTORY) if isinstance(file, str): runpy.run_path(file, {"doc": doc, "op": op}, "__main__") if __name__ == "__main__": main()
  • "Vector Curl" on Volume Builder?

    Cinema 4D SDK python 2024
    3
    0 Votes
    3 Posts
    739 Views
    justinleducJ
    Hey @i_mazlov, thank you so much for your incredibly helpful and thorough reply. This is exactly what I was looking for. Thanks again! I really appreciate it!
  • Setting Mograph Tracer Properties

    Cinema 4D SDK python 2024
    3
    0 Votes
    3 Posts
    676 Views
    D
    Dear Ferdinand, Thank you so much. I've found it tricky to navigate the API reference. Being able to get a pointer to the object parameter through drag and drop is a game changer for me!!
  • Send/Receive Messages in TagData/ObjectData plugins

    Cinema 4D SDK python
    5
    0 Votes
    5 Posts
    912 Views
    bacaB
    @ferdinand Thanks again I'll have time to check it later today. But it seems clear.
  • VC_FLAGS

    Cinema 4D SDK 2024 python 2023
    2
    0 Votes
    2 Posts
    480 Views
    M
    Hi @baca VC_SAFETY has been removed in 2023.1, you do not need it anymore, since the message can't fail anymore. You should keep it for old code but for new code, just leave the vc_flags empty will be enough. Cheers, Maxime.
  • Access to the coordinate manager.

    Cinema 4D SDK 2023 python windows
    3
    1
    0 Votes
    3 Posts
    869 Views
    S
    @ferdinand Thank you very much for the expanded object.
  • HtmlViewerCustomGui issue

    Cinema 4D SDK 2023 python
    3
    0 Votes
    3 Posts
    655 Views
    PoliigonP
    Bummer. But thanks, Maxime, for the quick reply.
  • 0 Votes
    3 Posts
    1k Views
    H
    Hi @ferdinand, thanks for taking the time to clarify that Okay, I see. So one can view this "behavoiur" as intended since it is the result of the math behind how the circle spline is calculated? Still I wonder why the circle spline primitive with 1 intermediate point, i.e. with four control points doesn't appear like the n-side spline with 8 sides? Wouldn't it be "cleaner" that way? Regading the true values - I am well aware that the repr of c4d.Vector rounds in the GUI. It was only that those values were quite off compared to the values of the points of the n-side spline. That's why my initial question arose. Interesting and good to know that rotating points via sine and cosine is slow and no good option. Thank you for that insight. May I ask why that is? I mean why is c4d.utils.MatrixRotZ better? What does that function do differently in terms of performance? In the end it has to do the math as well, does it not? Sorry for constantly asking all this stupid questions. It is only that I want to understand these things thoroughly. Thanks for your time, Sebastian
  • 0 Votes
    4 Posts
    985 Views
    K
    I found the AddPorts() Method,Sorry I missed it before. from typing import Optional import c4d import maxon doc: c4d.documents.BaseDocument # The active document op: Optional[c4d.BaseObject] # The active object, None if unselected def main() -> None: material = doc.GetActiveMaterial() nodeMaterial = material.GetNodeMaterialReference() graph: maxon.GraphModelInterface = nodeMaterial.GetGraph(c4d.GetActiveNodeSpaceId()) with graph.BeginTransaction() as transaction: layered_node = graph.AddChild(maxon.Id(),"com.chaos.vray_node.texlayeredmax") layers = layered_node.GetInputs().FindChild("com.chaos.vray_node.texlayeredmax.texture_layers") #The Layers portbundle layers.AddPorts(2, 1) #Add layers transaction.Commit() #Layer in Layers portbundle layers_list = [] layers.GetChildren(layers_list,maxon.NODE_KIND.INPORT) #Textureports and BlendMode_ports in Layers portbundle layers_texport_list = [tport for port in layers_list if (tport := port.FindChild("com.chaos.vray.portbundle.texture_layer.texture"))] layers_mode_list = [mport for port in layers_list if (mport := port.FindChild("com.chaos.vray.portbundle.texture_layer.blend_mode"))] print(layered_node) print(layers) print(layers_list) print(layers_texport_list) print(layers_mode_list) if __name__ == '__main__': main()
  • 0 Votes
    2 Posts
    784 Views
    ferdinandF
    Hey @LingZA, Thank you for reaching out to us. There are multiple questions in this topic, which always makes things tricky to answer. Is there any way to stop MMB wheel to zoom the camera? I need to scroll the MMB wheel in the viewport to change my tool's params? Is there any way to get MMB wheel scrolling in viewport? In general, Cinema 4D has no input device control & emulation layer, so you cannot intercept an input device from sending (stop the mouse wheel to zoom) or emulate inputs (get the mouse wheel scrolling). You can get the state of an input device. For MMB that would be the GUI message BFM_INPUT with BFM_INPUT_DEVICE being BFM_INPUT_MOUSE and BFM_INPUT_CHANNEL being BFM_INPUT_MOUSEMIDDLE. When you fail to read BFM_INPUT_MOUSEMIDDLE in your plugin, please share executable code, so that we can reproduce the problem. When necessary, you can send code confidentially to us via sdk_support(at)maxon(dot)net. Cheers, Ferdinand
  • use existing Catmull Clark algorithm

    Cinema 4D SDK python c++ 2024
    14
    0 Votes
    14 Posts
    3k Views
    ferdinandF
    Hey @CJtheTiger, yes, we disabled Ask as question because it was a lot of extra work for us to maintain because 60%-80% of users set their topics never as solved. Cheers, Ferdinand
  • Get & Set Active Camera for a specific viewport

    Cinema 4D SDK python
    4
    0 Votes
    4 Posts
    1k Views
    ferdinandF
    Hey @Thodos, without the console output of your browser, I cannot say much. I suspect that a DNS is failing. In the meantime, here are the offline docs. Cheers, Ferdinand
  • Which DisplayFilter affects ToolData.draw

    Cinema 4D SDK 2023 2024 s26 python
    3
    0 Votes
    3 Posts
    734 Views
    gheyretG
    Hi @ferdinand , I'm sorry that my title and description may be a little confused, maybe I misunderstood something and thought a little complicated. And thank you very much for your answer, you always help me when my thinking is confused. Cheers! Gheyret
  • 0 Votes
    3 Posts
    1k Views
    G
    This is an excellent explanation , thank you.