Search - User list
Full Version: Difference between Inline USD and SdfLayer ImportFromString?
Root » Solaris and Karma » Difference between Inline USD and SdfLayer ImportFromString?
calving
Hey Mark,

It has been a long time since the last time we got in touch. I'm working on building the bridge between Houdini and UE these days, and we found Solaris would be a great help for transferring data from one to the other.

To synchronize data rapidly, we're trying to set up a live stream instead of dumping everything to disk. In other words, we expect to import a stage with some python calls like this:
node = hou.pwd()
stage = node.editableStage()
stage.GetRootLayer().ImportFromString(
"""#usda 1.0

def \"sandbox\"
{
    def Mesh \"box\"
    {
        int[] faceVertexCounts = [4, 4, 4, 4, 4, 4]
        int[] faceVertexIndices = [1, 5, 4, 0, 2, 6, 5, 1, 3, 7, 6, 2, 0, 4, 7, 3, 2, 1, 0, 3, 5, 6, 7, 4]
        point3f[] points = [(-0.5, -0.5, -0.5), (0.5, -0.5, -0.5), (0.5, -0.5, 0.5), (-0.5, -0.5, 0.5), (-0.5, 0.5, -0.5), (0.5, 0.5, -0.5), (0.5, 0.5, 0.5), (-0.5, 0.5, 0.5)]
    }
}""")

Unfortunately, the above snippet is not effective, at least in my tests. There's a workaround for this is to procedurally editing an Inline USD node. However, I'm interested in the magic of the implementation of the Inline USD node, as the flattened stage of this is the same as the python one…

Cheers,
Calvin
mtucker
Hey Calvin, that is close, but definitely won't work as written.
You are not allowed to modify the stage's root layer directly, or the whole LOP cooking mechanism will break down.
Instead, do:
node = hou.pwd()
layer = node.editableLayer()
layer.ImportFromString(...)
calving
Ahh… Thanks, Mark! It works and everything goes right now.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Powered by DjangoBB