Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Unread
    • Recent
    • Tags
    • Users
    • Register
    • Login

    Can't get a correct rendering in picture viewer of the current scene running my TAG plugin while it works in viewport

    Cinema 4D SDK
    2023 2024 macos python
    4
    9
    1.6k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • mocolocoM
      mocoloco
      last edited by

      Hi there,

      There is something that it is hard to understand at my level of knowledge. I have two plugin that are perfectly working in C4D, both of them are TAG plugins attached to the root of a hierarchy and somehow, what I see in the viewport can't be rendered in the Picture Viewer correctly. Some of the object retains other orientation or do not take into account the animation while they are by pressing play in the 3D environment.

      Here few pictures to illustrate the problem,

      1. Viewport capture of the object with the object in yellow that does not render correctly.
        Screenshot 2023-12-01 at 22.42.32.png
      2. The same frame in Render View mode and Interactive Render mode which are also correctly rendered
        Screenshot 2023-12-01 at 22.42.41.png
        Screenshot 2023-12-01 at 22.42.55.png
      3. The render of the same frame sent to the Picture Viewer, were the object is taking a bad orientation on XYZ axis.
        Screenshot 2023-12-01 at 22.43.27.png

      I'm guessing what could cause this kind of issue? Could that be a priority problem or a missing Matrix calculation that occurs in def Execute() of the plugin when rendered normally? Or could that be related to something else I completely missing or skipped?
      On the second plugin the Camera which is linked to the hierarchy seems locked to the current frame I'm in the timeline when I'm starting the render. Like if the animation applied to its parent object is not took into account and so the camera remains still.

      All your light and ideas are more than welcome, I'm completely stuck on this.
      Cheers,

      Christophe

      1 Reply Last reply Reply Quote 0
      • mocolocoM
        mocoloco
        last edited by mocoloco

        Hello there,

        Here few more visuals to explain what's going on. I honestly do not know how what I'm getting in the viewport does not render as it is... there is something I really do not understand.

        Screenshot 2023-12-04 at 09.23.33.png

        S 1 Reply Last reply Reply Quote 0
        • S
          spedler @mocoloco
          last edited by

          @mocoloco My immediate reaction to seeing something like that is that your tag is storing data which is not being copied when the scene renders. If you render to the picture viewer, the document is first cloned before being rendered. If you have class-level data in your tag it will need to be copied when the document is copied. You do that by implementing the CopyTo() function of the TagData object.

          When rendering to the editor the document is not copied so it works fine without CopyTo(), which may be why you are seeing a difference between editor and PV.

          (Disclaimer: I use C++ and not Python, but I expect the same principle applies in both cases.)

          1 Reply Last reply Reply Quote 0
          • mocolocoM
            mocoloco
            last edited by

            Hello @spedler, thanks for the lead, I'm going to check this and see if it change something or not.

            1 Reply Last reply Reply Quote 0
            • mocolocoM
              mocoloco
              last edited by

              Hi,

              @spedler, I had a look on my plugin and I do not find any CopyTo() function related to the TagData object, it's a RegisteredTagPlugin, and I use it to manipulate sibling objects of the root level which have the TAG plugin. From what I understood, all is saved in the BaseDocument() and reloaded when the scene is loaded - which is the case.
              So, I do not understand where the CopyTo() should take place and with which object? I do understand the principle - if that the one should applied here, but really do not know how to set that up here in a TAG Plugin.

              Thanks

              i_mazlovI 1 Reply Last reply Reply Quote 0
              • i_mazlovI
                i_mazlov @mocoloco
                last edited by

                Hi @mocoloco,

                Sorry for the delayed answer, the thread somehow slipped from my list.

                There's nothing specific to point out without knowing the details of what's happening in these tags. As @spedler correctly mentioned the document is cloned before rendering and this is likely causing your issue.

                One assumption could be that one of your tag plugins (or maybe both) adjust data on GetActiveDocument() while rendering is already using the cloned document. As I already said it's difficult to tell anything specific with not knowing what's going on inside your tag plugins.

                Cheers,
                Ilia

                MAXON SDK Specialist
                developers.maxon.net

                1 Reply Last reply Reply Quote 0
                • mocolocoM
                  mocoloco
                  last edited by mocoloco

                  Hi, thanks for your reply.

                  I can't disclose the whole plugin as it is our know how, but anyway I can clarify the goal of it and how it is done.

                  So both plugin have the same architecture and are TagData. Both TAG are only use to manipulate Tx, Ty, Tz and Rx, Ry, Rz of some of the objects hierarchy underneath the root node which hold the TagData plugin.

                  Those new values update the position or rotation of an objects through Message() when a slider is moved, and Execute() methods to update the whole hierarchy relaying on those sliders assigned to Tx, Ty, Tz, Rx, Ry, Rz.

                  The question here is: if I have to consolidate something somewhere to get the rendering as it is in the viewport, what do I have to implement and were? Does that need to be in the Message() method or in Execute()?

                  Could you please give me some insight on this, that would be really helpful.

                  Thanks!
                  Christophe

                  i_mazlovI 1 Reply Last reply Reply Quote 0
                  • M
                    mogh
                    last edited by

                    I do not understand your setup entirely but still ->
                    Just a hunch of an old bug/limitation

                    1. close the picture viewer
                    2. adjust the scene
                    3. re-render in picture viewer

                    before R20 this was a thing ...
                    that no xpresso and similar things did not update with picture viewer open/active ...

                    as said this is just a hunch ...

                    1 Reply Last reply Reply Quote 0
                    • i_mazlovI
                      i_mazlov @mocoloco
                      last edited by i_mazlov

                      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:

                      1. Determine which one of your 2 tag plugins causes the issue
                      2. Cut off unrelated functionality of your plugin that has nothing to do with the issue
                      3. Figure out the specific function or line that causes the issue
                      4. Search the forum if this issue was already discussed
                      5. If not, create an example code snippet that highlights your issue
                      6. Post your specific question and the example code snippet in a separate thread with a meaningful title

                      Cheers,
                      Ilia

                      MAXON SDK Specialist
                      developers.maxon.net

                      1 Reply Last reply Reply Quote 0
                      • First post
                        Last post