example: reading bip into memory

Started by jbeau, July 29, 2019, 12:49:48 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

jbeau

Looks like you can loop through the current bip file and evaluate all the lines. You have to save your file first to load everything in memory.
Here's a quick setup to find if a single camera is orthographic. One could potentially write back to the file and change values using this method.

nfo = lux.getSceneInfo()
scenepath = nfo.get('file')
print(scenepath)
camera = lux.getCamera()
print(camera)
bipFile = open(scenepath, encoding='utf8', errors='ignore').readlines()
for num, line in enumerate(bipFile):
    if camera in line:
        if num >1000:
            #print('Camera Found:',num,line)
            #print(bipFile[num+1])
            if 'ortho' in bipFile[num+1]:
                print('I found an Orthographic Camera')