Author Topic: example: reading bip into memory  (Read 877 times)

0 Members and 1 Guest are viewing this topic.

Offline jbeau

example: reading bip into memory
« on: July 29, 2019, 12:49:48 am »
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.

Code: [Select]
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')
« Last Edit: July 29, 2019, 12:57:09 am by jbeau »