Force refresh Xpresso



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



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



  • 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



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



  • The file and some screen captures has been sent.



  • Auto Redraw is set to 1000ms.



  • 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



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



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



  • This post is deleted!


  • How would I implement the workaround with the Python effector?



  • hi,

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

    Cheers,
    Manuel.



  • Yes, Thanks. :)