Group Details Private

administrators

  • RE: Retrieve. c4d from folders and subfolders and update tree list

    Hi @Neekoe,

    That's great to hear you've managed to solve the issue!

    For your future postings please note that according to our Support Procedures:

    We cannot debug your code for you and instead provide answers to specific problems.

    This effectively means that you're welcome to ask your questions and attach the code snippet that demonstrates your question or issue you're struggling with. However, we cannot debug your entire codebase, so you have to isolate your specific question and the corresponding part of code yourself before asking the question.

    Cheers,
    Ilia

    posted in Cinema 4D SDK
  • RE: Image Viewer API

    Hi @kmhfygg,

    There's no such thing as "Image Viewer".

    If you mean rendered images that are available in the history list of the "Picture Viewer", @Dunhou
    is correct - there's no public API that allows you to access them.

    If instead you'd like to access the output frame settings in the "Render settings" (i.e. "Frame Range", "From", "To", "Frame Step", etc..), please have a look at related thread: Access renderer specific settings with python.

    Cheers,
    Ilia

    posted in Cinema 4D SDK
  • RE: How to receive the high definition / Interpolation version of a spline?

    @mogh said in How to receive the high definition / Interpolation version of a spline?:

    from the above helper I only get the points the spline is set to (eg. adaptive 5°) but I perhaps want more points in between.

    That is not correct. As I said, splines have theoretically infinite precision, you are only bound in practice by the floating point precision you use for your computations - double, i.e., 64 bit in Cinema 4D. You get in your code just the cache of your spline and iterate over its points. That is more or less the same as if you would have just called BaseObject.GetCache() on your SplineObject which I mentioned above.

    When you want to interpolate your spline manually, you must use the interpolation methods of SplineHelp, e.g., GetMatrix, which is sort of the most potent of all, as it gives you a full frame for each sample (i.e., not just a point but also an orientation).

    I have a hunch that the actual question is how to build the cache of a spline as if it would have higher interpolation settings. And for that you should copy your input (unless it is already a dangling, i.e., non-inserted node), change its settings, insert it into a dummy document, and then call ExecutePasses on that document. Then you can get the cache, and iterate over its points.

    Cheers,
    Ferdinand

    f91a1f2b-2eab-44ee-a689-a981e9d545f8-image.png

    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
        
        helper = c4d.utils.SplineHelp()
        if not helper.InitSplineWith(op, c4d.SPLINEHELPFLAGS_RETAINLINEOBJECT):
            raise RuntimeError("Could not initialize spline helper.")
        
        # Take exactly ten samples over the length of the spline, no matter how many vertices it has,
        # and how many points its current LineObject cache has.
        steps: int = 10
        for i in range(steps + 1):
            # Get a frame for the offset #t.
            t: float = i/float(steps)
            m: c4d.Matrix = helper.GetMatrix(t)
    
            # Print the #t, the point #p on the spline, its normal #n, tangent #t, and bi-tangent #bt.
            print(f"{t = }, p = {m.off}, n = {m.v3}, t = {m.v1}, bt = {m.v2}")
    
    if __name__ == '__main__':
        main()
    
    posted in Cinema 4D SDK
  • RE: TagData Plugin with Gui not using *.res

    Hey @mogh,

    that is not possible, nodes, i.e., NodeData, e.g., TagData, always need a description (and with that res file).

    Cheers,
    Ferdinand

    posted in Cinema 4D SDK
  • RE: How to receive the high definition / Interpolation version of a spline?

    Hey @mogh,

    Thank you for reaching out to us. What do you mean with "low" detail? Something like the sampling angle of a spline in "adaptive" mode? The interpolation settings of a spline only apply when you quantize it, i.e., the degree of precision with which a SplineObject is being quantized into its LineObject cache (i.e., what is returned for BaseObject.GetCache() for a spline).

    Splines themselves are just series of polynomials and therefore have no inherent precision. So, when you call for example SplineHelp.GetMatrix() to get all the metadata for an offset, you are not subject to the interpolation settings. That is within the limits of what computers can do regarding arithmetic of irrational numbers. You can quite quickly get subject to floating point precision problems when working with splines. If they are fixable and how to fix them, depends on the concrete case.

    Cheers,
    Ferdinand

    posted in Cinema 4D SDK
  • RE: How to handle AddDependence hh deprecation in 2024 onwards

    Hi @kbar sadly there is no way to suppress this warning, I removed the hh argument for the next version, thanks for the reminder.

    Cheers,
    Maxime.

    posted in Cinema 4D SDK
  • RE: Add icons to treeview

    Thanks @Neekoe to have shared your solution and thanks @Dunhou for helping.
    When you pass LV_TREE the Draw method is not called to have it called you need to pass either LV_USERTREE or LV_USER.

    Cheers,
    Maxime.

    posted in Cinema 4D SDK
  • RE: General Question: Which Plugin Type? -> Curvature Comb / Plot

    When this is what you want, a Python Programming Tag has also a draw function, i.e., the scripting element inside Cinema 4D. Scripting elements make great prototypes for their full grown plugin counter part (for the Python tag that would be TagData) but can also be very potent on their own while providing phenomenally rapid development speed.

    posted in Cinema 4D SDK
  • RE: General Question: Which Plugin Type? -> Curvature Comb / Plot

    Hey,

    A tag can draw into a viewport 🙂 My line of thinking was that you want some form of automatism/ streamlined product. E.g., an "enable/disable comb drawing" button (CommandData) and then a node (TagData/ObjectData) actually implementing it. When you just want to have the ability to manually enhance a spline with some drawing decorations, a tag would be a very good choice.

    Cheers,
    Ferdinand

    posted in Cinema 4D SDK
  • RE: Packaging and distributing python plugins via a launcher

    Hello @DayDreamer,

    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: Asking Questions.

    About your First Question

    This is your first posting and you did well, but I would point you to our 'singular question' rule, as lined out above in the 'Asking Questions' link. While we usually cut user some slack regrading that, the rule exists for a reason, as topics otherwise tend to become gigantic. There are way too many questions in this topic, please split your questions into multiple topics in the future.

    • There is no mechanism to package and ship plugins under Cinema 4D. You can just zip a plugin folder and the user unzips it then in a path where his or her Cinema 4D instance is looking for plugins.
    • xdl64 is the extension Cinema 4D uses for libraries under Windows, i.e., it is more or less an alias for dll (our library linking is kind of special and right between static and dynamic libraries, hence the custom name). So, no, Python plugins cannot be packaged as xdl64 because Python is not compiled into machine code but interpreted at run time.
    • You can mix C++ and Python plugins in the sense that Python plugins can depend/interact with C++ plugins with the means of the Cinema 4D API. E.g., a Python plugin can react to messages sent by a C++ plugin or data placed by a C++ plugin (or vice versa). That is how our Python API works under the hood. But C++ and Python code cannot interact directly of course, as they are vastly different languages. But you can run our Python VM from C++ and eval the results.
    • When you want to protect your intellectual property, you can use our Cinema 4D | Extensions > Tools > Source Code Protector which will encrypt a pyp Python module. But code must of course be decrypted at runtime to be sent to the Python VM, so, this will not really stop anyone who really wants your source code (a cracker for example). C++ is the by far safer option when intellectual property is important (but also C++ can be decompiled).

    Cheers,
    Ferdinand

    posted in Cinema 4D SDK