function tprint (tbl, indent) if not indent then indent = 0 end for k, v in pairs(tbl) do formatting = string.rep(" ", indent) .. k .. ": " if type(v) == "table" then print(formatting) tprint(v, indent+1) elseif type(v) == 'boolean' then print(formatting .. tostring(v)) else print(formatting .. tostring(v)) end end end function try_Connect (node, pinNumber,outputNode) if (node:getConnectedNodeIx(pinNumber)) == nil then node:connectToIx(pinNumber,outputNode) end end function try_Disconnect (node, pinNumber) if (node:getConnectedNodeIx(pinNumber)) ~= nil then node:disconnectIx(pinNumber) end end function isConnected(node, pinNumber) if (node:getConnectedNodeIx(pinNumber)) ~= nil then return true else return false end end function setAllControls() if isConnected(lightRigLightAndAim[selectedLightIdx],2) == true then propertyTable["Aim"] = true else propertyTable["Aim"] = false end local xyzValues = lightRigCenterAndOrbit[selectedLightIdx]:getAttribute(octane.A_TRANSLATION) propertyTable["AimX"] = xyzValues[1] propertyTable["AimY"] = xyzValues[2] propertyTable["AimZ"] = xyzValues[3] xyzValues = lightRigDistAndSize[selectedLightIdx]:getAttribute(octane.A_TRANSLATION) propertyTable["Dist"] = xyzValues[3] xyzValues = lightRigCenterAndOrbit[selectedLightIdx]:getAttribute(octane.A_ROTATION) propertyTable["Dir"] = xyzValues[2] propertyTable["DirUD"] = xyzValues[1] xyzValues = lightRigDistAndSize[selectedLightIdx]:getAttribute(octane.A_SCALE) local deform = 0 if xyzValues[2] > xyzValues[1] then deform = xyzValues[2] / xyzValues[1] elseif xyzValues[1] > xyzValues[2] then deform = xyzValues[1] / xyzValues[2] * -1 else deform = 0 end propertyTable["Size"] = xyzValues[3] propertyTable["Deform"] = deform local power = lightRigPower[selectedLightIdx]:getAttribute(octane.A_VALUE) propertyTable["Power"] = power[1] local connNode = lightRigLightItems[selectedLightIdx]:getConnectedNodeIx(1) if connNode ~= nil then local connName = string.sub(connNode.name,1,string.len(connNode.name)-1) if connName == "__scw__LightBox" then propertyTable["Type"] = 1 elseif connName == "__scw__LightCircular" then propertyTable["Type"] = 2 elseif connName == "__scw__LightBulb" then propertyTable["Type"] = 3 elseif connName == "__scw__LightRinglight" then propertyTable["Type"] = 4 else print("Could not match Type for "..connName) end end connNode = lightRigLightItems[selectedLightIdx]:getConnectedNodeIx(2) if connNode ~= nil then local connName = string.sub(connNode.name,1,string.len(connNode.name)-1) if connName == "__scw__SoftboxGridB" then propertyTable["Grid"] = 2 elseif connName == "__scw__SoftboxGridC" then propertyTable["Grid"] = 3 else print("Could not match Type for "..connName) end else propertyTable["Grid"] = 1 end xyzValues = lightRigGridDepth[selectedLightIdx]:getAttribute(octane.A_SCALE) propertyTable["SoftBoxDepthC"] = xyzValues[3] connNode = lightRigLightItems[selectedLightIdx]:getConnectedNodeIx(3) if connNode ~= nil then local connName = string.sub(connNode.name,1,string.len(connNode.name)-1) if connName == "__scw__SoftboxTubeB" then propertyTable["Tube"] = 2 elseif connName == "__scw__SoftboxTubeC" then propertyTable["Tube"] = 3 elseif connName == "__scw__RinglightTube" then propertyTable["Tube"] = 4 else print("Could not match Type for "..connName) end else propertyTable["Tube"] = 1 end xyzValues = lightRigTubeDepth[selectedLightIdx]:getAttribute(octane.A_SCALE) propertyTable["SoftBoxTubeDepthC"] = xyzValues[3] connNode = lightRigLightItems[selectedLightIdx]:getConnectedNodeIx(4) if connNode ~= nil then propertyTable["Reflector"] = true else propertyTable["Reflector"] = false end connNode = lightRigBarndoors[selectedLightIdx]:getConnectedNodeIx(1) if connNode ~= nil then propertyTable["Door1"] = true else propertyTable["Door1"] = false end connNode = lightRigBarndoors[selectedLightIdx]:getConnectedNodeIx(2) if connNode ~= nil then propertyTable["Door2"] = true else propertyTable["Door2"] = false end connNode = lightRigBarndoors[selectedLightIdx]:getConnectedNodeIx(3) if connNode ~= nil then propertyTable["Door3"] = true else propertyTable["Door3"] = false end connNode = lightRigBarndoors[selectedLightIdx]:getConnectedNodeIx(4) if connNode ~= nil then propertyTable["Door4"] = true else propertyTable["Door4"] = false end xyzValues = lightRigBarndoorsTransformL[selectedLightIdx]:getAttribute(octane.A_SCALE) propertyTable["DoorWidth"] = xyzValues[2] xyzValues = lightRigBarndoorsTransformL[selectedLightIdx]:getAttribute(octane.A_SCALE) propertyTable["DoorLength"] = xyzValues[3] xyzValues = lightRigBarndoorsTransformL[selectedLightIdx]:getAttribute(octane.A_ROTATION) propertyTable["CloseLeft"] = xyzValues[2] xyzValues = lightRigBarndoorsTransformR[selectedLightIdx]:getAttribute(octane.A_ROTATION) propertyTable["CloseRight"] = xyzValues[2] * -1 xyzValues = lightRigBarndoorsTransformU[selectedLightIdx]:getAttribute(octane.A_ROTATION) propertyTable["CloseUpper"] = xyzValues[2] xyzValues = lightRigBarndoorsTransformD[selectedLightIdx]:getAttribute(octane.A_ROTATION) propertyTable["CloseLower"] = xyzValues[2] * -1 end --******************************************************* EVENT ******************************************************* function event_Reset (component,event) --Reset Aim try_Disconnect (lightRigLightAndAim[selectedLightIdx], 2) -- Reset main values lightRigCenterAndOrbit[selectedLightIdx]:setAttribute(octane.A_TRANSLATION,{0,0,0},true) lightRigDistAndSize[selectedLightIdx]:setAttribute(octane.A_TRANSLATION,{0,0,0},true) lightRigCenterAndOrbit[selectedLightIdx]:setAttribute(octane.A_ROTATION,{0,0,0},true) lightRigDistAndSize[selectedLightIdx]:setAttribute(octane.A_SCALE,{1,1,1},true) lightRigPower[selectedLightIdx]:setAttribute(octane.A_VALUE,100,true) --Reset type of light try_Disconnect (lightRigLightItems[selectedLightIdx], 1) try_Connect (lightRigLightItems[selectedLightIdx], 1,lightRigSoftboxB[selectedLightIdx]) --Reset Grid try_Disconnect (lightRigLightItems[selectedLightIdx], 2) lightRigGridDepth[selectedLightIdx]:setAttribute(octane.A_SCALE,{1,1,1},true) --Reset Tube try_Disconnect (lightRigLightItems[selectedLightIdx], 3) lightRigTubeDepth[selectedLightIdx]:setAttribute(octane.A_SCALE,{1,1,1},true) --Reset Reflector try_Disconnect (lightRigLightItems[selectedLightIdx], 4) --Reset Barndoors try_Disconnect (lightRigBarndoors[selectedLightIdx], 1) try_Disconnect (lightRigBarndoors[selectedLightIdx], 2) try_Disconnect (lightRigBarndoors[selectedLightIdx], 3) try_Disconnect (lightRigBarndoors[selectedLightIdx], 4) lightRigBarndoorsTransformL[selectedLightIdx]:setAttribute(octane.A_SCALE,{1,1,1},true) lightRigBarndoorsTransformR[selectedLightIdx]:setAttribute(octane.A_SCALE,{1,1,1},true) lightRigBarndoorsTransformU[selectedLightIdx]:setAttribute(octane.A_SCALE,{1,1,1},true) lightRigBarndoorsTransformD[selectedLightIdx]:setAttribute(octane.A_SCALE,{1,1,1},true) lightRigBarndoorsTransformL[selectedLightIdx]:setAttribute(octane.A_ROTATION,{0,0,0},true) lightRigBarndoorsTransformR[selectedLightIdx]:setAttribute(octane.A_ROTATION,{0,0,0},true) lightRigBarndoorsTransformU[selectedLightIdx]:setAttribute(octane.A_ROTATION,{0,0,90},true) lightRigBarndoorsTransformD[selectedLightIdx]:setAttribute(octane.A_ROTATION,{0,0,90},true) setAllControls() octane.changemanager.update() end function event_Window (component,event) if event == octane.gui.eventType.WINDOW_SHOW then --Setup GUI to reflect lightrig for i=1,maxRigs,1 do local connectedNode = lightRigs:getConnectedNodeIx(i) if connectedNode ~= nil then propertyTable["LightOnOff"..tostring(i)] = true else propertyTable["LightOnOff"..tostring(i)] = false end end setAllControls() setupDone = true octane.changemanager.update() elseif event == octane.gui.eventType.WINDOW_CLOSE then octane.render.callbackStop() octane.render.continue() end end function event_LightOnOff (component,event) if setupDone then local idx = tonumber(string.sub(component,-1,-1)) local outputNodes = lightRigArray[idx]:getOutputNodes() if (event == true) then try_Connect(lightRigs,idx,outputNodes[1]) --gui_LightOnOffChanged(idx,true) else try_Disconnect(lightRigs,idx) --gui_LightOnOffChanged(idx,false) end octane.changemanager.update() end end function event_EditDropdown(component,event) selectedLightIdx = component.selectedIx if selectedLightIdx > 0 then setAllControls() end end function event_AimOnOff (component,event) if setupDone then local idx = selectedLightIdx if (event == true) then try_Connect(lightRigLightAndAim[idx],2,lightRigAim[idx]) else try_Disconnect(lightRigLightAndAim[idx],2) end octane.changemanager.update() end end function event_AimXYZ (component,event) if setupDone then local idx = selectedLightIdx local xyz = string.sub(component.name,-1,-1) local xyzValues = lightRigCenterAndOrbit[idx]:getAttribute(octane.A_TRANSLATION) if xyz == "X" then xyzValues[1] = component.value elseif xyz == "Y" then xyzValues[2] = component.value elseif xyz == "Z" then xyzValues[3] = component.value end lightRigCenterAndOrbit[idx]:setAttribute(octane.A_TRANSLATION,xyzValues,true) octane.changemanager.update() end end function event_Distance (component,event) if setupDone then local idx = selectedLightIdx local xyzValues = lightRigDistAndSize[idx]:getAttribute(octane.A_TRANSLATION) xyzValues[3] = component.value lightRigDistAndSize[idx]:setAttribute(octane.A_TRANSLATION,xyzValues,true) octane.changemanager.update() end end function event_OrbitLR (component,event) if setupDone then local idx = selectedLightIdx local xyzValues = lightRigCenterAndOrbit[idx]:getAttribute(octane.A_ROTATION) xyzValues[2] = component.value lightRigCenterAndOrbit[idx]:setAttribute(octane.A_ROTATION,xyzValues,true) octane.changemanager.update() end end function event_OrbitUD (component,event) if setupDone then local idx = selectedLightIdx local xyzValues = lightRigCenterAndOrbit[idx]:getAttribute(octane.A_ROTATION) xyzValues[1] = component.value * -1 lightRigCenterAndOrbit[idx]:setAttribute(octane.A_ROTATION,xyzValues,true) octane.changemanager.update() end end function event_Size (component,event) if setupDone then local idx = selectedLightIdx local scale = propertyTable["Size"] local deform = propertyTable["Deform"] local xyzValues = lightRigDistAndSize[idx]:getAttribute(octane.A_SCALE) if deform == 0 then xyzValues[1] = scale xyzValues[2] = scale xyzValues[3] = scale lightRigDistAndSize[idx]:setAttribute(octane.A_SCALE,xyzValues,true) elseif deform > 0 then xyzValues[1] = scale * (1 + deform) xyzValues[2] = scale xyzValues[3] = scale lightRigDistAndSize[idx]:setAttribute(octane.A_SCALE,xyzValues,true) else xyzValues[1] = scale xyzValues[2] = scale * (1 + (deform * -1)) xyzValues[3] = scale lightRigDistAndSize[idx]:setAttribute(octane.A_SCALE,xyzValues,true) end octane.changemanager.update() end end function event_GridDropdown (component,event) if setupDone then local idxType = tonumber(component.selectedIx) local idx = selectedLightIdx try_Disconnect(lightRigLightItems[idx],2) if idxType == 3 then try_Connect(lightRigLightItems[idx],2,lightRigGridC[idx]) elseif idxType == 2 then try_Connect(lightRigLightItems[idx],2,lightRigGridB[idx]) else try_Disconnect(lightRigLightItems[idx],2) end octane.changemanager.update() end end function event_GridDepth (component,event) if setupDone then local idx = selectedLightIdx local xyzValues = lightRigGridDepth[idx]:getAttribute(octane.A_SCALE) xyzValues[3] = component.value lightRigGridDepth[idx]:setAttribute(octane.A_SCALE,xyzValues,true) octane.changemanager.update() end end function event_TubeDropdown (component,event) if setupDone then local idxType = tonumber(component.selectedIx) local idx = selectedLightIdx try_Disconnect(lightRigLightItems[idx],3) if idxType == 2 then try_Connect(lightRigLightItems[idx],3,lightRigTubeB[idx]) elseif idxType == 3 then try_Connect(lightRigLightItems[idx],3,lightRigTubeC[idx]) elseif idxType == 4 then try_Connect(lightRigLightItems[idx],3,lightRigTubeRing[idx]) else try_Disconnect(lightRigLightItems[idx],3) end octane.changemanager.update() end end function event_TubeDepth (component,event) if setupDone then local idx = selectedLightIdx local xyzValues = lightRigTubeDepth[idx]:getAttribute(octane.A_SCALE) xyzValues[3] = component.value lightRigTubeDepth[idx]:setAttribute(octane.A_SCALE,xyzValues,true) octane.changemanager.update() end end function event_TypeDropdown (component,event) if setupDone then local idxType = tonumber(component.selectedIx) local idx = selectedLightIdx try_Disconnect(lightRigLightItems[idx],1) if idxType == 1 then try_Connect(lightRigLightItems[idx],1,lightRigSoftboxB[idx]) elseif idxType == 2 then try_Connect(lightRigLightItems[idx],1,lightRigSoftboxC[idx]) elseif idxType == 3 then try_Connect(lightRigLightItems[idx],1,lightRigBulb[idx]) else try_Connect(lightRigLightItems[idx],1,lightRigRinglight[idx]) end octane.changemanager.update() end end function event_Reflector (component,event) if setupDone then local idx = selectedLightIdx try_Disconnect(lightRigLightItems[idx],4) if event == true then try_Connect(lightRigLightItems[idx],4,lightRigReflector[idx]) end octane.changemanager.update() end end function event_DoorL (component,event) if setupDone then local idx = selectedLightIdx try_Disconnect(lightRigBarndoors[idx],1) if event == true then try_Connect(lightRigBarndoors[idx],1,lightRigBarndoorsL[idx]) end octane.changemanager.update() end end function event_DoorR (component,event) if setupDone then local idx = selectedLightIdx try_Disconnect(lightRigBarndoors[idx],2) if event == true then try_Connect(lightRigBarndoors[idx],2,lightRigBarndoorsR[idx]) end octane.changemanager.update() end end function event_DoorU (component,event) if setupDone then local idx = selectedLightIdx try_Disconnect(lightRigBarndoors[idx],3) if event == true then try_Connect(lightRigBarndoors[idx],3,lightRigBarndoorsU[idx]) end octane.changemanager.update() end end function event_DoorD (component,event) if setupDone then local idx = selectedLightIdx try_Disconnect(lightRigBarndoors[idx],4) if event == true then try_Connect(lightRigBarndoors[idx],4,lightRigBarndoorsD[idx]) end octane.changemanager.update() end end function event_DoorWidth (component,event) if setupDone then local idx = selectedLightIdx local xyz = string.sub(component.name,-2,-2) local xyzValuesL = lightRigBarndoorsTransformL[idx]:getAttribute(octane.A_SCALE) local xyzValuesR = lightRigBarndoorsTransformR[idx]:getAttribute(octane.A_SCALE) local xyzValuesU = lightRigBarndoorsTransformU[idx]:getAttribute(octane.A_SCALE) local xyzValuesD = lightRigBarndoorsTransformD[idx]:getAttribute(octane.A_SCALE) xyzValuesL[2] = component.value xyzValuesR[2] = component.value xyzValuesU[2] = component.value xyzValuesD[2] = component.value lightRigBarndoorsTransformL[idx]:setAttribute(octane.A_SCALE,xyzValuesL,true) lightRigBarndoorsTransformR[idx]:setAttribute(octane.A_SCALE,xyzValuesR,true) lightRigBarndoorsTransformU[idx]:setAttribute(octane.A_SCALE,xyzValuesU,true) lightRigBarndoorsTransformD[idx]:setAttribute(octane.A_SCALE,xyzValuesD,true) octane.changemanager.update() end end function event_DoorLength (component,event) if setupDone then local idx = selectedLightIdx local xyz = string.sub(component.name,-2,-2) local xyzValuesL = lightRigBarndoorsTransformL[idx]:getAttribute(octane.A_SCALE) local xyzValuesR = lightRigBarndoorsTransformR[idx]:getAttribute(octane.A_SCALE) local xyzValuesU = lightRigBarndoorsTransformU[idx]:getAttribute(octane.A_SCALE) local xyzValuesD = lightRigBarndoorsTransformD[idx]:getAttribute(octane.A_SCALE) xyzValuesL[3] = component.value xyzValuesR[3] = component.value xyzValuesU[3] = component.value xyzValuesD[3] = component.value lightRigBarndoorsTransformL[idx]:setAttribute(octane.A_SCALE,xyzValuesL,true) lightRigBarndoorsTransformR[idx]:setAttribute(octane.A_SCALE,xyzValuesR,true) lightRigBarndoorsTransformU[idx]:setAttribute(octane.A_SCALE,xyzValuesU,true) lightRigBarndoorsTransformD[idx]:setAttribute(octane.A_SCALE,xyzValuesD,true) octane.changemanager.update() end end function event_DoorCloseL (component,event) if setupDone then local idx = selectedLightIdx local xyz = string.sub(component.name,-2,-2) local xyzValues = lightRigBarndoorsTransformL[idx]:getAttribute(octane.A_ROTATION) xyzValues[2] = component.value lightRigBarndoorsTransformL[idx]:setAttribute(octane.A_ROTATION,xyzValues,true) octane.changemanager.update() end end function event_DoorCloseR (component,event) if setupDone then local idx = selectedLightIdx local xyz = string.sub(component.name,-2,-2) local xyzValues = lightRigBarndoorsTransformR[idx]:getAttribute(octane.A_ROTATION) xyzValues[2] = component.value * -1 lightRigBarndoorsTransformR[idx]:setAttribute(octane.A_ROTATION,xyzValues,true) octane.changemanager.update() end end function event_DoorCloseU (component,event) if setupDone then local idx = selectedLightIdx local xyz = string.sub(component.name,-2,-2) local xyzValues = lightRigBarndoorsTransformU[idx]:getAttribute(octane.A_ROTATION) xyzValues[1] = component.value lightRigBarndoorsTransformU[idx]:setAttribute(octane.A_ROTATION,xyzValues,true) octane.changemanager.update() end end function event_DoorCloseD (component,event) if setupDone then local idx = selectedLightIdx local xyz = string.sub(component.name,-2,-2) local xyzValues = lightRigBarndoorsTransformD[idx]:getAttribute(octane.A_ROTATION) xyzValues[1] = component.value * -1 lightRigBarndoorsTransformD[idx]:setAttribute(octane.A_ROTATION,xyzValues,true) octane.changemanager.update() end end function event_RenderTarget (component,event) if setupDone then selected = octane.project.getSelection() for i=1,#selected do octane.project.deselect(selected[i]) end octane.project.select(renderTargets[component.selectedIx]) octane.render.callbackStop() octane.render.start({renderTargetNode=renderTargets[component.selectedIx]}) octane.render.continue() octane.changemanager.update() end end function event_Power (component,event) if setupDone then local idx = selectedLightIdx lightRigPower[idx]:setAttribute(octane.A_VALUE,component.value,true) octane.changemanager.update() end end --******************************************************* DATABASE ******************************************************* selectedLightIdx = 1 setupDone = false local rigRoot = "__scw__LightRig" maxRigs = 9 lightRigBoomArray = {} lightRigCenterAndOrbit = {} lightRigLightAndAim = {} lightRigAim = {} lightRigDistAndSize = {} lightRigPower = {} lightRigLightItems = {} lightRigSoftboxC = {} lightRigSoftboxB = {} lightRigRinglight = {} lightRigBulb = {} lightRigGridC = {} lightRigGridB = {} lightRigGridDepth = {} lightRigTubeC = {} lightRigTubeB = {} lightRigTubeRing = {} lightRigTubeDepth = {} lightRigReflector = {} lightRigBarndoors = {} lightRigBarndoorsL = {} lightRigBarndoorsR = {} lightRigBarndoorsU = {} lightRigBarndoorsD = {} lightRigBarndoorsTransformL = {} lightRigBarndoorsTransformR = {} lightRigBarndoorsTransformU = {} lightRigBarndoorsTransformD = {} --******************************************************* CODE ******************************************************* local sceneGraph = octane.project.getSceneGraph() --local g = sceneGraph:findItemsByName("__scw__LightRigs", false) local items = sceneGraph:findItemsByName("__scw__GraphLightRig", true) local lightRigGraphContent = nil if items ~= nil then lightRigGraphContent = items[1]:getOwnedItems() else error("Could not find a __scw__LightRigGraph!") end --collect renderTargets renderTargets = sceneGraph:findNodes(octane.NT_RENDERTARGET, false) renderTargetNames = {} selectedRendernode = 0 for i=1,#renderTargets do table.insert(renderTargetNames,renderTargets[i].name) if octane.render.getRenderTargetNode() ~= nil then if octane.render.getRenderTargetNode().name == renderTargets[i].name then selectedRendernode = i end end end --Start collecting rigs and the lightRigs group lightRigs = nil lightRigArray = {} for i=1,11,1 do if lightRigGraphContent[i].name =="__scw__LightRigs" then lightRigs = lightRigGraphContent[i] elseif ( string.sub(lightRigGraphContent[i].name,1,15))=="__scw__LightRig" then local idx = tonumber(string.sub(lightRigGraphContent[i].name,-1,-1)) lightRigArray[idx] = lightRigGraphContent[i] end end --Collect the control nodes for i=1,maxRigs,1 do currentRigItems = lightRigArray[i]:getOwnedItems() for idx = 1,#currentRigItems,1 do if currentRigItems[idx].name == "__scw__Boom"..tostring(i) then lightRigBoomArray[i] = currentRigItems[idx] elseif currentRigItems[idx].name == "__scw__CenterAndOrbit"..tostring(i) then lightRigCenterAndOrbit[i] = currentRigItems[idx] elseif currentRigItems[idx].name == "__scw__LightAndAim"..tostring(i) then lightRigLightAndAim[i] = currentRigItems[idx] elseif currentRigItems[idx].name == "__scw__Aim"..tostring(i) then lightRigAim[i] = currentRigItems[idx] elseif currentRigItems[idx].name == "__scw__DistanceAndSize"..tostring(i) then lightRigDistAndSize[i] = currentRigItems[idx] elseif currentRigItems[idx].name == "__scw__Power"..tostring(i) then lightRigPower[i] = currentRigItems[idx] elseif currentRigItems[idx].name == "__scw__LightItems"..tostring(i) then lightRigLightItems[i] = currentRigItems[idx] elseif currentRigItems[idx].name == "__scw__LightCircular"..tostring(i) then lightRigSoftboxC[i] = currentRigItems[idx] elseif currentRigItems[idx].name == "__scw__LightBox"..tostring(i) then lightRigSoftboxB[i] = currentRigItems[idx] elseif currentRigItems[idx].name == "__scw__LightRinglight"..tostring(i) then lightRigRinglight[i] = currentRigItems[idx] elseif currentRigItems[idx].name == "__scw__LightBulb"..tostring(i) then lightRigBulb[i] = currentRigItems[idx] elseif currentRigItems[idx].name == "__scw__SoftboxGridC"..tostring(i) then lightRigGridC[i] = currentRigItems[idx] elseif currentRigItems[idx].name == "__scw__SoftboxGridB"..tostring(i) then lightRigGridB[i] = currentRigItems[idx] elseif currentRigItems[idx].name == "__scw__SoftboxGridDepth"..tostring(i) then lightRigGridDepth[i] = currentRigItems[idx] elseif currentRigItems[idx].name == "__scw__SoftboxTubeC"..tostring(i) then lightRigTubeC[i] = currentRigItems[idx] elseif currentRigItems[idx].name == "__scw__SoftboxTubeB"..tostring(i) then lightRigTubeB[i] = currentRigItems[idx] elseif currentRigItems[idx].name == "__scw__RinglightTube"..tostring(i) then lightRigTubeRing[i] = currentRigItems[idx] elseif currentRigItems[idx].name == "__scw__SoftboxTubeDepth"..tostring(i) then lightRigTubeDepth[i] = currentRigItems[idx] elseif currentRigItems[idx].name == "__scw__BulbReflector"..tostring(i) then lightRigReflector[i] = currentRigItems[idx] elseif currentRigItems[idx].name == "__scw__Barndoors"..tostring(i) then lightRigBarndoors[i] = currentRigItems[idx] elseif currentRigItems[idx].name == "__scw__BarndoorL"..tostring(i) then lightRigBarndoorsL[i] = currentRigItems[idx] elseif currentRigItems[idx].name == "__scw__BarndoorR"..tostring(i) then lightRigBarndoorsR[i] = currentRigItems[idx] elseif currentRigItems[idx].name == "__scw__BarndoorU"..tostring(i) then lightRigBarndoorsU[i] = currentRigItems[idx] elseif currentRigItems[idx].name == "__scw__BarndoorD"..tostring(i) then lightRigBarndoorsD[i] = currentRigItems[idx] elseif currentRigItems[idx].name == "__scw__TransformDoorL"..tostring(i) then lightRigBarndoorsTransformL[i] = currentRigItems[idx] elseif currentRigItems[idx].name == "__scw__TransformDoorR"..tostring(i) then lightRigBarndoorsTransformR[i] = currentRigItems[idx] elseif currentRigItems[idx].name == "__scw__TransformDoorU"..tostring(i) then lightRigBarndoorsTransformU[i] = currentRigItems[idx] elseif currentRigItems[idx].name == "__scw__TransformDoorD"..tostring(i) then lightRigBarndoorsTransformD[i] = currentRigItems[idx] end end end --PropertyTable to bind to GUI propertyTable = octane.gui.createPropertyTable() --Build GUI -------------------------------------------------------- local windowHeight = 230 windowWidth = 1300 local posLightLabel = 3 posLightCheck = 58 posEditLabel = 81 posEditCheck = 108 posAimLabel = 149 posAimCheck = 175 local posRigSlider = 215 posGrids = 590 posDoors = 980 local ypos_Row1 = 5 ypos_Row2 = 30 ypos_Row3 = 55 ypos_Row4 = 80 ypos_Row5 = 105 ypos_Row6 = 130 ypos_Row7 = 155 ypos_Row8 = 180 ypos_Row9 = 205 local ypos_Row10 = 230 ypos_Row11 = 255 ypos_Row12 = 280 ypos_Row13 = 305 local maxXYZ = 6 minXYZ = -6 stepXYZ = 0.01 local maxDist = 10 minDist = 0 stepDist = 0.01 local maxDir = 180 minDir = -180 stepDir = 0.1 local maxUD = 90 minUD = -90 stepUD = 0.1 local maxScale = 10 minScale = 0.05 stepScale = 0.1 local maxDeform = 10 minDeform = -10 stepDeform = 0.1 local maxPower = 10000 minPower = 1 stepPower = 1 local maxMod = 20 minMod = 0.3 stepMod = 0.1 local maxDoor = 90 minDoor = -45 stepDoor = 1 local maxDoorSize = 3 minDoorSize = 0.1 stepDoorSize = 0.1 local SliderWidth = 300 --Light On/Off Labels local lbl_LightOnOff1 = octane.gui.createLabel({text="LightOn 1",x=posLightLabel,y=ypos_Row1}) local lbl_LightOnOff2 = octane.gui.createLabel({text="LightOn 2",x=posLightLabel,y=ypos_Row2}) local lbl_LightOnOff3 = octane.gui.createLabel({text="LightOn 3",x=posLightLabel,y=ypos_Row3}) local lbl_LightOnOff4 = octane.gui.createLabel({text="LightOn 4",x=posLightLabel,y=ypos_Row4}) local lbl_LightOnOff5 = octane.gui.createLabel({text="LightOn 5",x=posLightLabel,y=ypos_Row5}) local lbl_LightOnOff6 = octane.gui.createLabel({text="LightOn 6",x=posLightLabel,y=ypos_Row6}) local lbl_LightOnOff7 = octane.gui.createLabel({text="LightOn 7",x=posLightLabel,y=ypos_Row7}) local lbl_LightOnOff8 = octane.gui.createLabel({text="LightOn 8",x=posLightLabel,y=ypos_Row8}) local lbl_LightOnOff9 = octane.gui.createLabel({text="LightOn 9",x=posLightLabel,y=ypos_Row9}) local chk_LightOn1 = octane.gui.createCheckBox({name="chk_LightOn1", x=posLightCheck,y=ypos_Row1,width=20,height=20,checked=false}) local chk_LightOn2 = octane.gui.createCheckBox({name="chk_LightOn2",x=posLightCheck,y=ypos_Row2,width=20,height=20,checked=false}) local chk_LightOn3 = octane.gui.createCheckBox({name="chk_LightOn3", x=posLightCheck,y=ypos_Row3,width=20,height=20,checked=false}) local chk_LightOn4 = octane.gui.createCheckBox({name="chk_LightOn4",x=posLightCheck,y=ypos_Row4,width=20,height=20,checked=false}) local chk_LightOn5 = octane.gui.createCheckBox({name="chk_LightOn5", x=posLightCheck,y=ypos_Row5,width=20,height=20,checked=false}) local chk_LightOn6 = octane.gui.createCheckBox({name="chk_LightOn6",x=posLightCheck,y=ypos_Row6,width=20,height=20,checked=false}) local chk_LightOn7 = octane.gui.createCheckBox({name="chk_LightOn7", x=posLightCheck,y=ypos_Row7,width=20,height=20,checked=false}) local chk_LightOn8 = octane.gui.createCheckBox({name="chk_LightOn8",x=posLightCheck,y=ypos_Row8,width=20,height=20,checked=false}) local chk_LightOn9 = octane.gui.createCheckBox({name="chk_LightOn9",x=posLightCheck,y=ypos_Row9,width=20,height=20,checked=false}) octane.gui.bind(chk_LightOn1, "checked", propertyTable, "LightOnOff1", event_LightOnOff) octane.gui.bind(chk_LightOn2, "checked", propertyTable, "LightOnOff2", event_LightOnOff) octane.gui.bind(chk_LightOn3, "checked", propertyTable, "LightOnOff3", event_LightOnOff) octane.gui.bind(chk_LightOn4, "checked", propertyTable, "LightOnOff4", event_LightOnOff) octane.gui.bind(chk_LightOn5, "checked", propertyTable, "LightOnOff5", event_LightOnOff) octane.gui.bind(chk_LightOn6, "checked", propertyTable, "LightOnOff6", event_LightOnOff) octane.gui.bind(chk_LightOn7, "checked", propertyTable, "LightOnOff7", event_LightOnOff) octane.gui.bind(chk_LightOn8, "checked", propertyTable, "LightOnOff8", event_LightOnOff) octane.gui.bind(chk_LightOn9, "checked", propertyTable, "LightOnOff9", event_LightOnOff) --Edit selected local lbl_Edit = octane.gui.createLabel({text="Edit ",x=posEditLabel,y=ypos_Row1}) local cmb_Edit = octane.gui.createComboBox({name="cnb_Edit",items={"1","2","3","4","5","6","7","8","9"},selectedIx = 1,x=posEditCheck,y=ypos_Row1,width=40,height=20,checked=false,callback=event_EditDropdown}) octane.gui.bind(cmb_Edit, "selectedIx", propertyTable, "Edit") --Aim ON / Off local lbl_AimOnOff = octane.gui.createLabel({text="Aim",x=posAimLabel,y=ypos_Row1}) local chk_AimOnOff = octane.gui.createCheckBox({name="chk_AimOnOff", x=posAimCheck,y=ypos_Row1,width=20,height=20,checked=false}) octane.gui.bind(chk_AimOnOff, "checked", propertyTable, "Aim", event_AimOnOff) --Aim X local lbl_AimX = octane.gui.createLabel({text="X",x=posRigSlider-15,y=ypos_Row1}) local sld_AimX = octane.gui.createSlider({name="AimX", x=posRigSlider,y=ypos_Row1,value=0,step=stepXYZ,maxValue=maxXYZ,minValue=minXYZ,width=SliderWidth,height=20,checked=false,callback=event_AimXYZ}) octane.gui.bind(sld_AimX, "value", propertyTable, "AimX") --Aim Y local lbl_AimY = octane.gui.createLabel({text="Y",x=posRigSlider-15,y=ypos_Row2}) local sld_AimY = octane.gui.createSlider({name="AimY", x=posRigSlider,y=ypos_Row2,value=0,step=stepXYZ,maxValue=maxXYZ,minValue=minXYZ,width=SliderWidth,height=20,checked=false,callback=event_AimXYZ}) octane.gui.bind(sld_AimY, "value", propertyTable, "AimY") --Aim Z local lbl_AimZ = octane.gui.createLabel({text="Z",x=posRigSlider-15,y=ypos_Row3}) local sld_AimZ = octane.gui.createSlider({name="AimZ", x=posRigSlider,y=ypos_Row3,value=0,step=stepXYZ,maxValue=maxXYZ,minValue=minXYZ,width=SliderWidth,height=20,checked=false,callback=event_AimXYZ}) octane.gui.bind(sld_AimZ, "value", propertyTable, "AimZ") --Distance local lbl_Dist = octane.gui.createLabel({text="Dist",x=posRigSlider-27,y=ypos_Row4}) local sld_Dist = octane.gui.createSlider({name="Dist", x=posRigSlider,y=ypos_Row4,value=0,step=stepDist,maxValue=maxDist,minValue=minDist,width=SliderWidth,height=20,checked=false,callback=event_Distance}) octane.gui.bind(sld_Dist, "value", propertyTable, "Dist") --Orbit L / R local lbl_Dir = octane.gui.createLabel({text="Orbit L/R",x=posRigSlider-52,y=ypos_Row5}) local sld_Dir = octane.gui.createSlider({name="Dir", x=posRigSlider,y=ypos_Row5,value=0,step=stepDir,maxValue=maxDir,minValue=minDir,width=SliderWidth,height=20,checked=false,callback=event_OrbitLR}) octane.gui.bind(sld_Dir, "value", propertyTable, "Dir") --Orbit upp / down local lbl_UpDown = octane.gui.createLabel({text="Orbit U/D",x=posRigSlider-55,y=ypos_Row6}) local sld_UpDownt = octane.gui.createSlider({name="DirUD", x=posRigSlider,y=ypos_Row6,value=0,step=stepUD,maxValue=maxUD,minValue=minUD,width=SliderWidth,height=20,checked=false,callback=event_OrbitUD}) octane.gui.bind(sld_UpDownt, "value", propertyTable, "DirUD") --Scale local lbl_Scale = octane.gui.createLabel({text="Size",x=posRigSlider-30,y=ypos_Row7}) local sld_Scale = octane.gui.createSlider({name="Size", x=posRigSlider,y=ypos_Row7,value=0,step=stepScale,maxValue=maxScale,minValue=minScale,width=SliderWidth,height=20,checked=false,callback=event_Size}) octane.gui.bind(sld_Scale, "value", propertyTable, "Size") --Deform local lbl_Deform = octane.gui.createLabel({text="Deform",x=posRigSlider-45,y=ypos_Row8}) local sld_Deform = octane.gui.createSlider({name="Deform", x=posRigSlider,y=ypos_Row8,value=0,step=stepDeform,maxValue=maxDeform,minValue=minDeform,width=SliderWidth,height=20,checked=false,callback=event_Size}) octane.gui.bind(sld_Deform, "value", propertyTable, "Deform") --Light Power local lbl_Power = octane.gui.createLabel({text="Power",x=posRigSlider-40,y=ypos_Row9}) local sld_Power = octane.gui.createSlider({name="Power", x=posRigSlider,y=ypos_Row9,value=0,step=stepPower,maxValue=maxPower,minValue=minPower,width=SliderWidth,height=20,checked=false,callback=event_Power}) octane.gui.bind(sld_Power, "value", propertyTable, "Power") --Light Type local lbl_Type = octane.gui.createLabel({text="Light Type",x=posGrids-60,y=ypos_Row1}) local cmb_Type = octane.gui.createComboBox({name="cnb_Type",items={"Softbox Rectangular","Softbox Circular","Omnilight","Ringlight"},selectedIx = 0,x=posGrids,y=ypos_Row1,width=200,height=20,checked=false,callback=event_TypeDropdown}) octane.gui.bind(cmb_Type, "selectedIx", propertyTable, "Type") --Grid Type local lbl_Grid = octane.gui.createLabel({text="Grid Type",x=posGrids-60,y=ypos_Row3}) local cmb_Grid = octane.gui.createComboBox({name="cnb_Grid",items={"None","Rectangular","Circular"},selectedIx = 1,x=posGrids,y=ypos_Row3,width=200,height=20,checked=false,callback=event_GridDropdown}) octane.gui.bind(cmb_Grid, "selectedIx", propertyTable, "Grid") --Grid Depth local lbl_LightGridDepthC = octane.gui.createLabel({text="Grid Depth",x=posGrids-65,y=ypos_Row4}) local sld_LightGridDepthC = octane.gui.createSlider({name="SoftBoxDepthC", x=posGrids,y=ypos_Row4,value=0,step=stepMod,maxValue=maxMod,minValue=minMod,width=SliderWidth,height=20,checked=false,callback=event_GridDepth}) octane.gui.bind(sld_LightGridDepthC, "value", propertyTable, "SoftBoxDepthC") --Tube Type local lbl_Tube = octane.gui.createLabel({text="Tube Type",x=posGrids-60,y=ypos_Row6}) local cmb_Tube = octane.gui.createComboBox({name="cnb_Tube",items={"None","Rectangular","Circular","Ringlight"},selectedIx = 1,x=posGrids,y=ypos_Row6,width=200,height=20,checked=false,callback=event_TubeDropdown}) octane.gui.bind(cmb_Tube, "selectedIx", propertyTable, "Tube") --Tube Depth local lbl_LightTubeDepthC = octane.gui.createLabel({text="Tube Length",x=posGrids-65,y=ypos_Row7}) local sld_LightTubeDepthC = octane.gui.createSlider({name="SoftBoxTubeDepthC", x=posGrids,y=ypos_Row7,value=0,step=stepMod,maxValue=maxMod,minValue=minMod,width=SliderWidth,height=20,checked=false,callback=event_TubeDepth}) octane.gui.bind(sld_LightTubeDepthC, "value", propertyTable, "SoftBoxTubeDepthC") --Reflector local lbl_LightReflector = octane.gui.createLabel({text="Omni Reflector",x=posGrids-60,y=ypos_Row9}) local chk_LightReflector = octane.gui.createCheckBox({name="chk_Reflector",x=posGrids+20,y=ypos_Row9,width=20,height=20,checked=false}) octane.gui.bind(chk_LightReflector, "checked", propertyTable, "Reflector",event_Reflector) --Barndoors local lbl_Barndoor1 = octane.gui.createLabel({text="Barnd Door Left",x=posDoors-70,y=ypos_Row1}) local lbl_Barndoor2 = octane.gui.createLabel({text="Right",x=posDoors+65,y=ypos_Row1}) local lbl_Barndoor3 = octane.gui.createLabel({text="Upper",x=posDoors+150,y=ypos_Row1}) local lbl_Barndoor4 = octane.gui.createLabel({text="Lower",x=posDoors+232,y=ypos_Row1}) local chk_Barndoor1 = octane.gui.createCheckBox({name="chk_Door1",x=posDoors+18,y=ypos_Row1,width=20,height=20,checked=false}) local chk_Barndoor2 = octane.gui.createCheckBox({name="chk_Door2",x=posDoors+100,y=ypos_Row1,width=20,height=20,checked=false}) local chk_Barndoor3 = octane.gui.createCheckBox({name="chk_Door3",x=posDoors+190,y=ypos_Row1,width=20,height=20,checked=false}) local chk_Barndoor4 = octane.gui.createCheckBox({name="chk_Door4",x=posDoors+270,y=ypos_Row1,width=20,height=20,checked=false}) octane.gui.bind(chk_Barndoor1, "checked", propertyTable, "Door1",event_DoorL) octane.gui.bind(chk_Barndoor2, "checked", propertyTable, "Door2",event_DoorR) octane.gui.bind(chk_Barndoor3, "checked", propertyTable, "Door3",event_DoorU) octane.gui.bind(chk_Barndoor4, "checked", propertyTable, "Door4",event_DoorD) --Barndoor Width local lbl_LightBarndoorWidth = octane.gui.createLabel({text="Door Width",x=posDoors-70,y=ypos_Row2}) local sld_LightBarndoorWidth = octane.gui.createSlider({name="DoorWidth", x=posDoors,y=ypos_Row2,value=0,step=stepDoorSize,maxValue=maxDoorSize,minValue=minDoorSize,width=SliderWidth,height=20,checked=false,callback=event_DoorWidth}) octane.gui.bind(sld_LightBarndoorWidth, "value", propertyTable, "DoorWidth") --Barndoor Length local lbl_LightBarndoorLength = octane.gui.createLabel({text="Door Length",x=posDoors-70,y=ypos_Row3}) local sld_LightBarndoorLength = octane.gui.createSlider({name="DoorLength", x=posDoors,y=ypos_Row3,value=0,step=stepDoorSize,maxValue=maxDoorSize,minValue=minDoorSize,width=SliderWidth,height=20,checked=false,callback=event_DoorLength}) octane.gui.bind(sld_LightBarndoorLength, "value", propertyTable, "DoorLength") --Barndoor Open L local lbl_LightBarndoorOpenL = octane.gui.createLabel({text="Close Left",x=posDoors-65,y=ypos_Row4}) local sld_LightBarndoorOpenL = octane.gui.createSlider({name="CloseLeft", x=posDoors,y=ypos_Row4,value=0,step=stepDoor,maxValue=maxDoor,minValue=minDoor,width=SliderWidth,height=20,checked=false,callback=event_DoorCloseL}) octane.gui.bind(sld_LightBarndoorOpenL, "value", propertyTable, "CloseLeft") --Barndoor Open R local lbl_LightBarndoorOpenR = octane.gui.createLabel({text="Close Right",x=posDoors-68,y=ypos_Row5}) local sld_LightBarndoorOpenR = octane.gui.createSlider({name="CloseRight", x=posDoors,y=ypos_Row5,value=0,step=stepDoor,maxValue=maxDoor,minValue=minDoor,width=SliderWidth,height=20,checked=false,callback=event_DoorCloseR}) octane.gui.bind(sld_LightBarndoorOpenR, "value", propertyTable, "CloseRight") --Barndoor Open U local lbl_LightBarndoorOpenU = octane.gui.createLabel({text="Close Upper",x=posDoors-68,y=ypos_Row6}) local sld_LightBarndoorOpenU = octane.gui.createSlider({name="CloseUpper", x=posDoors,y=ypos_Row6,value=0,step=stepDoor,maxValue=maxDoor,minValue=minDoor,width=SliderWidth,height=20,checked=false,callback=event_DoorCloseU}) octane.gui.bind(sld_LightBarndoorOpenU, "value", propertyTable, "CloseUpper") --Barndoor Open D local lbl_LightBarndoorOpenD = octane.gui.createLabel({text="Close Lower",x=posDoors-68,y=ypos_Row7}) local sld_LightBarndoorOpenD = octane.gui.createSlider({name="CloseLower", x=posDoors,y=ypos_Row7,value=0,step=stepDoor,maxValue=maxDoor,minValue=minDoor,width=SliderWidth,height=20,checked=false,callback=event_DoorCloseD}) octane.gui.bind(sld_LightBarndoorOpenD, "value", propertyTable, "CloseLower") --Render Target local lbl_Target = octane.gui.createLabel({text="Render Target",x=posGrids+170,y=ypos_Row9}) local cmb_Target = octane.gui.createComboBox({name="cnb_RenderTarget",items=renderTargetNames,selectedIx = selectedRendernode,x=posGrids+250,y=ypos_Row9,width=200,height=20,checked=false,callback=event_RenderTarget}) --Reset Button local button = octane.gui.createButton({name="Reset",text="Reset", x=posDoors +200,y=ypos_Row9,value=0,step=stepDoor,maxValue=maxDoor,minValue=minDoor,width=100,height=20,checked=false,callback=event_Reset}) window = octane.gui.createWindow({text="Easy Light Rig",width=windowWidth,height=windowHeight,callback=event_Window,children={ lbl_LightOnOff1,lbl_LightOnOff2,lbl_LightOnOff3,lbl_LightOnOff4,lbl_LightOnOff5,lbl_LightOnOff6,lbl_LightOnOff7,lbl_LightOnOff8,lbl_LightOnOff9, chk_LightOn1,chk_LightOn2,chk_LightOn3,chk_LightOn4,chk_LightOn5,chk_LightOn6,chk_LightOn7,chk_LightOn8,chk_LightOn9, lbl_Edit,cmb_Edit, lbl_AimOnOff,chk_AimOnOff, lbl_AimX,sld_AimX, lbl_AimY,sld_AimY, lbl_AimZ,sld_AimZ, lbl_Dist,sld_Dist, lbl_Dir,sld_Dir, lbl_UpDown,sld_UpDownt, lbl_Scale,sld_Scale, lbl_Deform,sld_Deform, lbl_Power,sld_Power, lbl_Type,cmb_Type, lbl_Grid,cmb_Grid, lbl_LightGridDepthC,sld_LightGridDepthC, lbl_Tube,cmb_Tube, lbl_LightTubeDepthC,sld_LightTubeDepthC, lbl_LightReflector,chk_LightReflector, lbl_Barndoor1,lbl_Barndoor2,lbl_Barndoor3,lbl_Barndoor4, chk_Barndoor1,chk_Barndoor2,chk_Barndoor3,chk_Barndoor4, lbl_LightBarndoorWidth,sld_LightBarndoorWidth, lbl_LightBarndoorLength,sld_LightBarndoorLength, lbl_LightBarndoorOpenL,sld_LightBarndoorOpenL, lbl_LightBarndoorOpenR,sld_LightBarndoorOpenR, lbl_LightBarndoorOpenU,sld_LightBarndoorOpenU, lbl_LightBarndoorOpenD,sld_LightBarndoorOpenD, lbl_Target,cmb_Target, button }}) octane.gui.showWindow(window)