Notifications
Clear all

[Closed] Why don't user properties save when rendering over a network?

This is exhibited in VRay when changing the vrayproperties of an xref and then rendering over a network:

To replicate:

  1. create a new scene and xref a box in
  2. Script traversing the xrefs in the file and modifying the userproperties of

execute this script


fn setXRefScenesToMatte = (
    if (local xrefCount = xrefs.getXRefFileCount()) != 0 then (
        for i = 1 to xrefCount do (     -- get each xref scene in the file
            local xrscene = xrefs.getXRefFile i    -- xrscene equals the xref scene in which is loaded
            
            for x in (xrscene.tree.children) do (    -- for each object in the xref scene
                try (
                    setUserProp x "VRay_Matte_Enable" true    -- sets the object to a matte object
                    setUserProp x "VRay_Matte_Alpha" -1    -- sets the alpha contribution to -1, consider using 0 as well
                ) catch ()
            )    -- end each object in scene
        )    -- end all xrefs done
        true
    ) else false
)

fn resetXRefScenes = (
    if (local xrefCount = xrefs.getXRefFileCount()) != 0 then (
        for i = 1 to xrefCount do (     -- get each xref scene in the file
            local xrscene = xrefs.getXRefFile i    -- xrscene equals the xref scene in which is loaded
            
            for x in (xrscene.tree.children) do (    -- for each object in the xref scene
                try (
                    setUserProp x "VRay_Matte_Enable" false    -- sets the object NOT to a matte object
                    setUserProp x "VRay_Matte_Alpha" 1    -- sets the alpha contribution to 1
                ) catch ()
            )    -- end each object in scene
        )    -- end all xrefs done    
        true
    ) else false
)

  1. execute this in the listener
setXRefScenesToMatte()
  1. Do a test render, the object is correctly matted !!!
    (I am setting all xref objects to matte by traversing the xref files and navigating xrefScene.tree.children and setting the vrayproperty “VRay_Matte_Enable” to “on”)

  2. Network submit this render and your render will be completely unmatted.

I am going to try registering a callback to matte them at #preRenderFrame but I haven’t tested it thoroughly. Any ideas why this information isn’t saved over the network?

Thank you,
Colin

4 Replies

Also, registering a callback at #preRender and #preRenderFrame and calling the function does absolutely nothing as well. I’m out of ideas.

It doesn’t even save with the file, if you run your script then re-open your file your settings will be lost unfortunetly. I think Kramsurfer is the one who uses this technique, he uses a pre-render script to make it work over the network.

seems a few of us are working on similar things at the moment. I too am using callbacks to modifiy xrefs at render time over backburner. I’m using the #filePostOpen callback as Kramsurfer suggested in another thread. (search for filePostOpen and filter by Kramsurfer). You have to remember to make it persistant though.
ie:

callbacks.removeScripts id:#myID
   callbacks.addScript #filePostOpen <string / function> id:#myID [b]persistent:true[/b]

For my callbacks I am currently either specifying a file on our network or building a string and parsing that. If you’re having problems, I remember someone saying that they created a script string and stored it on a dummy as a custom attribute and the actual callback script was something simple like “execute $CallbackDummy.<custom attribute name>”

thanks guys, I’ll pursue this Gravey. Thanks to you too DaveWortley