Python script help

oziphantom

New Member
Not looking for a plugin per se, just help on working out how the python code is suppose to work...

High level. I want to trap an Source being hidden/shown in a Scene
Upon this happening, I need to determine the scene is the one I'm interested in ( name would make the most sense, but I can't see any get scene name API call, just one to get all names? )
Then go through each item on said scene, determine if they are visible
if so, count the number and make a list of the ones that are
then I will run some code to position them.
I could do this in C, but downloading and setting up building the entire obs for this seems like using an Elephant gun for something that should take about 20mins to make in python..

So where I'm up to/stuck..
I found an example that shows obs.signal_handler_connect(sh, "source_activate", source_activated) is how one sets up a callback, and then the function is of the form def source_activated(cd): where cd is a calldata param, seems this needs to be transformed into a source by calling obs.calldata_source(cd, "source")
from there I can get the scene with scene = obs.obs_scene_from_source(source)
from there I can get the list of items on the scene with items = obs.obs_scene_enum_items(scene) which gives me an array of objects that are SwigPyObject and I have no idea how to get SwigPyObjects into anything useful..

Any ideas?
 
Top