#python
#Autor: Bernd Möller

#create outputs for comp stack

import traceback
import bm_ROM_funcs as funcs

try:
    saveSel = funcs.saveSel()
    romID = funcs.ccGroup('ROM')
    romCompID = funcs.ccGroup('ROMcomp')
    lx.eval('select.item %s set'%romCompID)
    lx.eval('texture.parent %s -1'%romID)
    ROs = ('shade.diffuse','shade.transparency','shade.reflection','shade.specular','shade.subsurface','shade.luminosity')
    for output in ROs:
        if not funcs.checkRoInGroup(romCompID, output):
            funcs.createRoInGroup(romCompID, output)
    
    funcs.restoreSel(saveSel)
except:
    lx.out(traceback.format_exc())
#python
#Autor: Bernd Möller

#create outputs for comp stack

import traceback
import bm_ROM_funcs as funcs

try:
    saveSel = funcs.saveSel()
    romID = funcs.ccGroup('ROM')
    romCompID = funcs.ccGroup('ROMutils')
    lx.eval('select.item %s set'%romCompID)
    lx.eval('texture.parent %s -1'%romID)
    ROs = ('shade.normal','depth','occl.ambient')
    for output in ROs:
        if not funcs.checkRoInGroup(romCompID, output):
            funcs.createRoInGroup(romCompID, output)
    
    funcs.restoreSel(saveSel)
except:
    lx.out(traceback.format_exc())
#python
#Autor: Bernd Möller

#create alpha outputs for selected masks

import traceback
import bm_ROM_funcs as funcs

try:
    selMasks = lx.evalN('query sceneservice selection ? mask')
    saveSel = funcs.saveSel()
    funcs.ccGroup('ROM')
    for mask in selMasks:
        #create mask in ROM group
        maskInRom = funcs.checkMaskInRom(mask)
        if not (maskInRom):
            maskInRom = funcs.createMaskInRom(mask)
        alphaInGroup = funcs.checkRoInGroup(maskInRom, 'shade.alpha')
        if not (alphaInGroup):
            funcs.createRoInGroup(maskInRom, 'shade.alpha')
    funcs.restoreSel(saveSel)
except:
    lx.out(traceback.format_exc())