Is it possible to create an Alembic Layer export using Python?

108 views
Skip to first unread message

paul hormis

unread,
Aug 12, 2022, 5:19:06 PM8/12/22
to alembic-discussion
I have an issue where I am given a large VrayProxies that  is loading an Alembic.

I created a tool that checks which objects are within the camera frustum of the shot and I want to animate the visibility of them using an Alembic Layer in the VrayProxy.

This is in 3ds Max.  I am using Python and not C++ for this work.

Is it possible?

Lucas Miller

unread,
Aug 12, 2022, 5:31:03 PM8/12/22
to alembic-d...@googlegroups.com
Yes, I think all you need to do is sparsely create the hierarchy as OObjects, and then use alembic.AbcGeom.CreateVisibilityProperty  on the OObject where you want to create the property that will be animated.

Lucas

--
You received this message because you are subscribed to the Google Groups "alembic-discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to alembic-discuss...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/alembic-discussion/04a4be3b-a4a7-4f65-8373-2dce32f6d6a6n%40googlegroups.com.

paul hormis

unread,
Aug 12, 2022, 5:49:32 PM8/12/22
to alembic-discussion
Could you possibly point me into the direction of documentation or examples of this?  I am new to the Alembic API.

paul hormis

unread,
Aug 12, 2022, 5:49:56 PM8/12/22
to alembic-discussion
Thank you for the very quick reply.

Lucas Miller

unread,
Aug 12, 2022, 6:27:52 PM8/12/22
to alembic-d...@googlegroups.com
I couldnt find a relevant test in the python binding, so instead I whipped up this example:

import alembic arch = alembic.Abc.OArchive('/tmp/vislayer.abc')

# lets sparsely set visibility on /foo/bar/baz 
fooObj = alembic.Abc.OObject(arch.getTop(), 'foo')
barObj = alembic.Abc.OObject(fooObj, 'bar')
bazObj = alembic.Abc.OObject(barObj, 'baz')

# assuming 24 fps, have a sample for every frame that starts at frame 101 
ts = alembic.AbcCoreAbstract.TimeSampling(1.0/24.0, 101.0/24.0) 
visProp = alembic.AbcGeom.CreateVisibilityProperty(bazObj, ts) 

 # -1 means deferred visibility, which is implicitly visible unless an ancestor marks it as invisible.
 # 0 means invisible 
visProp.setValue(-1) # frame 101 
visProp.setValue(0)  # frame 102 
visProp.setValue(0)  # frame 103 
visProp.setValue(-1) # frame 104 
visProp.setValue(0)  # frame 105

Lucas

Reply all
Reply to author
Forward
0 new messages