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
    • Login

    Force refresh Xpresso

    Cinema 4D SDK
    python r21
    3
    13
    2.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.
    • SwinnS
      Swinn
      last edited by Manuel

      Is there a way to force Xpresso to refresh? I have an Xpresso tag that is used to position to points on a two point spline so that one point follows a cloner and the other attaches to a wall in the z direction. I find that I have to either advance a frame or have a mouse event happen so that that spline end point snaps to the wall. Please see the attached picture for the setup. The Python node only has one line of code in it:

      import c4d

      def main():
      global Output1
      Output1 = Input1.GetCache()

      Screen Shot 2020-03-05 at 3.57.42 PM.png

      Any help would be greatly appreciated. Thanks.

      1 Reply Last reply Reply Quote 0
      • Passion3DP
        Passion3D
        last edited by

        Hi
        I'll need that job too. To be able to refresh xpresso without having to provoke it with a mouse click.

        1 Reply Last reply Reply Quote 0
        • ManuelM
          Manuel
          last edited by

          hi,

          Sounds like a priority issue to me. Would it be possible to share a simple example scene or send it to use using [email protected] if it's confidential ?
          This kind of priority issue are often solved by moving the object in the hierarchy so every object update properly or by changing the priority of the xpresso tag.

          The Calculate menu could help sometimes and the autoredraw
          The "A" key works (or viewport menu, view->redraw)

          Using python to refresh xpresso, will than refresh the python that will refresh the xpresso creating an endless loop.

          Cheers,
          Manuel

          MAXON SDK Specialist

          MAXON Registered Developer

          1 Reply Last reply Reply Quote 0
          • SwinnS
            Swinn
            last edited by

            Hi Manuel, thanks for responding. I will send the file via email as it is confidential. I have spent much time reprioritizing, to no avail. Maybe after looking at the file you can help. Thanks.

            1 Reply Last reply Reply Quote 0
            • SwinnS
              Swinn
              last edited by

              The file and some screen captures has been sent.

              1 Reply Last reply Reply Quote 0
              • SwinnS
                Swinn
                last edited by

                Auto Redraw is set to 1000ms.

                1 Reply Last reply Reply Quote 0
                • ManuelM
                  Manuel
                  last edited by

                  hi,

                  sorry for the late reply, I've dive a bit in your scene.

                  A better approche would be to create a 1 unit long spline in your scene and use a python effector to scale those spline to the right length.
                  Modifying the cloner's cache is not the best to do things. That's exactly the way to go if you want to have a scene that refresh one frame later (or having to press the mouse button) (even if sometimes, i understand, it can work and is very usefull)

                  That said, you can refresh an xpresso with python, you have just to retrieve the GVNodeMaster and use the Execute function. (that will call the Calculate function from c++)

                  The problem is that it's seems buggy for the moment. I need to check it a bit further.

                  I'll be back with more information πŸ™‚

                  Cheers,
                  Manuel

                  MAXON SDK Specialist

                  MAXON Registered Developer

                  1 Reply Last reply Reply Quote 0
                  • SwinnS
                    Swinn
                    last edited by

                    Thanks for looking into this, Manuel. Much appreciated. I will wait to hear back from you.

                    1 Reply Last reply Reply Quote 0
                    • ManuelM
                      Manuel
                      last edited by Manuel

                      hi,

                      i can confirm that the right command is Execute and i can confirm that currently it's useless and not working. We will update this function as soon as possible.

                      so based on this script

                      If you want to execute the xpresso again the code could be:

                      import c4d
                      
                      
                      def main():
                          # Checks if selected object is valid
                          if op is None:
                              raise ValueError("op is none, please select one object.")
                      
                          # Retrieves the xpresso Tag
                          xpressoTag = op.GetTag(c4d.Texpresso)
                          if xpressoTag is None:
                              raise ValueError("Make sure the selected object get an Xpresso Tag.")
                      
                          # Retrieves the node master
                          gvNodeMaster = xpressoTag.GetNodeMaster()
                          if gvNodeMaster is None:
                              raise RuntimeError("Failed to retrieve the Node Master.")
                          # Make the node master to be executed again.
                          gvNodeMaster.Execute()
                      

                      I will update this thread when the code will be fixed. I've moved this thread to c4d section and added some tags.

                      But in your case, updating the object in the cache, and executing twice the xpresso would not solve your problem. Because if you change the cache, the viewport have to be updated.

                      Cheers,
                      Manuel.

                      MAXON SDK Specialist

                      MAXON Registered Developer

                      1 Reply Last reply Reply Quote 0
                      • SwinnS
                        Swinn
                        last edited by

                        This post is deleted!
                        1 Reply Last reply Reply Quote 0
                        • SwinnS
                          Swinn
                          last edited by

                          How would I implement the workaround with the Python effector?

                          1 Reply Last reply Reply Quote 0
                          • ManuelM
                            Manuel
                            last edited by

                            hi,

                            i've answer this question by email, can we consider this thread as solve ?

                            Cheers,
                            Manuel.

                            MAXON SDK Specialist

                            MAXON Registered Developer

                            1 Reply Last reply Reply Quote 0
                            • SwinnS
                              Swinn
                              last edited by

                              Yes, Thanks. πŸ™‚

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