• Categories
    • Overview
    • News & Information
    • Cinema 4D SDK Support
    • Cineware SDK Support
    • ZBrush 4D SDK Support
    • Bugs
    • General Talk
  • Unread
  • Recent
  • Tags
  • Users
  • Register
  • Login
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

Force refresh Xpresso

Cinema 4D SDK
python r21
3
13
2.2k
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.
  • S
    Swinn
    last edited by Manuel Mar 9, 2020, 5:32 PM Mar 5, 2020, 9:02 PM

    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
    • P
      Passion3D
      last edited by Mar 5, 2020, 9:55 PM

      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
      • M
        Manuel
        last edited by Mar 6, 2020, 1:55 PM

        hi,

        Sounds like a priority issue to me. Would it be possible to share a simple example scene or send it to use using sdk_support@maxon.net 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
        • S
          Swinn
          last edited by Mar 6, 2020, 2:21 PM

          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
          • S
            Swinn
            last edited by Mar 6, 2020, 2:34 PM

            The file and some screen captures has been sent.

            1 Reply Last reply Reply Quote 0
            • S
              Swinn
              last edited by Mar 7, 2020, 11:56 AM

              Auto Redraw is set to 1000ms.

              1 Reply Last reply Reply Quote 0
              • M
                Manuel
                last edited by Mar 9, 2020, 1:30 PM

                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
                • S
                  Swinn
                  last edited by Mar 9, 2020, 2:23 PM

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

                  1 Reply Last reply Reply Quote 0
                  • M
                    Manuel
                    last edited by Manuel Mar 9, 2020, 5:35 PM Mar 9, 2020, 5:31 PM

                    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
                    • S
                      Swinn
                      last edited by Mar 9, 2020, 5:43 PM

                      This post is deleted!
                      1 Reply Last reply Reply Quote 0
                      • S
                        Swinn
                        last edited by Mar 9, 2020, 5:56 PM

                        How would I implement the workaround with the Python effector?

                        1 Reply Last reply Reply Quote 0
                        • M
                          Manuel
                          last edited by Mar 17, 2020, 8:04 AM

                          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
                          • S
                            Swinn
                            last edited by Mar 17, 2020, 12:00 PM

                            Yes, Thanks. 🙂

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