Lighting

Arnoldlights

createArnoldDirectionalLight(name='directionalLight', samples=3)

Creates a Maya directional light, Arnold uses this as a directional light type

Parameters:

name (str) – the name of the light

Return lightTransformName:

the name of the light (transform node)

Rtype lightTransformName:

str

Return shapeNodeName:

the name of the shape node

Rtype shapeNodeName:

str

createArnoldPhysicalLight(name='aiAreaLight', fixSamples=True)

Creates a aiAreaLight

Parameters:
  • name (str) – the name of the light

  • fixSamples (bool) – Set the Arnold light samples to 4 rather than the default of 1

Return lightTransformName:

the name of the light (transform node)

Rtype lightTransformName:

str

Return shapeNodeName:

the name of the shape node

Rtype shapeNodeName:

str

createArnoldSkydomeLight(name='aiSkyDomeLight', fixSamples=True)

Creates an IBL Skydome Light

Parameters:
  • name (str) – the name of the light

  • fixSamples (bool) – Set the Arnold light samples to 4 rather than the default of 1

Return lightTransformName:

the name of the light (transform node)

Rtype lightTransformName:

str

Return shapeNodeName:

the name of the shape node

Rtype shapeNodeName:

str

getAllLightShapesInScene()

Returns any lights in the scene that may be in the global list ALLLIGHTTYPES

Return allLightShapes:

all the area lights in the scene as shapeNode names

Rtype allLightShapes:

list

getAllLightTransformsInScene()

Returns all the transforms of lights from ALLLIGHTTYPES in the scene

Return lightsTransformList:

Rtype lightsTransformList:

filterAllAreaLightTypesFromSelection()

filters all the lights of types lightTypeList from the selected list

Return lightsTransformList:

Light Name List of Transforms

Rtype lightsTransformList:

list

deleteAllLights()

deletes all lights of types ALLLIGHTTYPES in the scene

Return deletedLights:

All the deleted light names

Rtype deletedLights:

list

LightPresets

Sets the Default Presets for the shaderpresets_ior.json

Lightconstants

Light constants

from zoo.libs.maya.cmds.lighting import lightconstants
lightconstants.DEFAULT_SKYDOME_PATH  # is the path to the default HDRI texture image

Author Andrew Silke

Lightingutils

General light code.

from zoo.libs.maya.cmds.lighting import lightingutils
lightingutils.convertExpAndIntToIntensity(1.0, 16.0)

Author: Andrew Silke

convertIntensityToExposure(intensity)
converts intensity in Arnold and Renderman to exposure

Intensity equals 2 to the power of exposure, so this is the

Parameters:

intensity (float) – the .intensity attr value

Return exposure:

the .exposure attr value if intensity were set to 1

Rtype exposure:

float

convertExposureToIntensity(exposure)

converts exposure in Arnold and Renderman to intensity Intensity equals 2 to the power of exposure

Parameters:

exposure (float) – the .exposure attribute value

Return intensity:

the .intensity attr value is exposure is set to 0

Rtype intensity:

float

convertExpAndIntToExposure(intensity, exposure)

Converts light settings to mixing both intensity and exposure, can do in Renderman and Arnold Result will be pure exposure and intensity of 1

Parameters:
  • intensity (float) – the .intensity attr value

  • exposure (float) – the .exposure attribute value

Return intensity:

the .intensity attr value is exposure is set to 0

Rtype intensity:

float

Return exposure:

the .exposure attr value if intensity were set to 1

Rtype exposure:

float

convertExpAndIntToIntensity(intensity, exposure)

Converts light settings to mixing both intensity and exposure, can do in Renderman and Arnold Result will be pure intensity and exposure of 0

Parameters:
  • intensity (float) – the .intensity attr value

  • exposure (float) – the .exposure attribute value

Return intensity:

the .intensity attr value is exposure is set to 0

Rtype intensity:

float

Return exposure:

the .exposure attr value if intensity were set to 1

Rtype exposure:

float

calculateCylinderLateralSurfaceArea(radiusX, heightY, radiusZ)

calculates the lateral surface area of a ellipsical cylinder h * 2 * pi * squareRoot ((1/2) * ((A * A) + (B * B)))

Parameters:
  • radiusX (float) – radius on x

  • heightY (float) – height

  • radiusZ (float) – radius on z

Return lateralSurfaceArea:

the lateral surface area, not including the circular top bottom caps

Rtype lateralSurfaceArea:

float

calculateEllipsoidArea(radiusX, radiusY, radiusZ)

calculates the surface area of a sphere with xyz scale

Parameters:
  • radiusX (float) – radius (half scale) of x

  • radiusY (float) – radius (half scale) of y

  • radiusZ (float) – radius (half scale) of z

Returns:

surface area of the scaled sphere in cms squared

Return type:

float

calculateAreaShape(scaleX, scaleY, scaleZ, shape='Rectangle')

Calculate the area of a rect, sphere, cylinder (uncapped) or sphere

Parameters:
  • scaleX (float) – scale on x

  • scaleY (float) – scale on y

  • scaleZ (float) – scale on z

  • shape (str) – the string shape of the 3d object, see SHAPE_ATTR_ENUM_LIST_NICE for values (“Rectangle”, “Disc” etc)

Return area:

the surface area in cm squared

Rtype area:

float

convertToNonNormalized(intensity, scaleX, scaleY, scaleZ, shape='Rectangle')

converts a normalized intensity to non normalized by calculating the size of the area light and multiplying it by intensity

Parameters:
  • intensity (float) – light intensity normalized

  • scaleX (float) – size of the light scaled on x

  • scaleY (float) – size of the light scaled on x

  • shape (str) – the string shape of the 3d object, see SHAPE_ATTR_ENUM_LIST_NICE for values (“Rectangle”, “Disc” etc)

Return intensity:

the intensity value no longer normalized

Rtype intensity:

float

convertToNormalized(intensity, scaleX, scaleY, scaleZ, shape='Rectangle')

converts a non normalized intensity to normalized by calculating the size of the area light and dividing intensity by that number

Parameters:
  • intensity (float) – light intensity normalized

  • scaleX (float) – size of the light scaled on x

  • scaleY (float) – size of the light scaled on x

  • scaleZ (float) – scale on z

  • shape (str) – the string shape of the 3d object, see SHAPE_ATTR_ENUM_LIST_NICE for values (“Rectangle”, “Disc” etc)

Return intensity:

the intensity value now normalized

Rtype intensity:

float

convertToNormalizedIntensity(intensity, exposure, scaleX, scaleY, scaleZ, shape='Rectangle')

Converts lights with no normalization to normalize. This function works for area lights of four shape types Returns pure intensity

Parameters:
  • intensity (float) – The intensity value of the light (Arnold, Renderman, Redshift units)

  • exposure (float) – The exposure value of the light (Arnold Renderman) zero if Redshift

  • scaleX (float) – The scale x of the rectangle light

  • scaleY (float) – The scale y of the rectangle light

  • scaleZ (float) – scale on z

  • shape (str) – the string shape of the 3d object, see SHAPE_ATTR_ENUM_LIST_NICE for values (“Rectangle”, “Disc” etc)

Return intensity:

the returned intensity value, now normalized

Rtype intensity:

float

Return exposure:

the returned exposure value, will be zero

Rtype exposure:

float

convertToNormalizedExposure(intensity, exposure, scaleX, scaleY, scaleZ, shape='Rectangle')

Converts lights with no normalization to normalize. This function works for area lights of four light shapes Returns pure exposure, intensity will be 1

Parameters:
  • intensity (float) – The intensity value of the light (Arnold, Renderman, Redshift units)

  • exposure (float) – The exposure value of the light (Arnold Renderman) zero if Redshift

  • scaleX (float) – The scale x of the rectangle light

  • scaleY (float) – The scale y of the rectangle light

  • scaleZ (float) – scale on z

  • shape (str) – the string shape of the 3d object, see SHAPE_ATTR_ENUM_LIST_NICE for values (“Rectangle”, “Disc” etc)

Return intensity:

the returned intensity value will be 1

Rtype intensity:

float

Return exposure:

the returned exposure value now normalized

Rtype exposure:

float

convertToNonNormalizedIntensity(intensity, exposure, scaleX, scaleY, scaleZ, shape='Rectangle')

Converts lights with normalized to no normalization. This function works for rectangular area lights Returns pure intensity, exposure will be 0

Parameters:
  • intensity (float) – The intensity value of the light (Arnold, Renderman, Redshift units)

  • exposure (float) – The exposure value of the light (Arnold Renderman) zero if Redshift

  • scaleX (float) – The scale x of the rectangle light

  • scaleY (float) – The scale y of the rectangle light

  • scaleZ (float) – scale on z

  • shape (str) – the string shape of the 3d object, see SHAPE_ATTR_ENUM_LIST_NICE for values (“Rectangle”, “Disc” etc)

Return intensity:

the returned intensity value now not normalized

Rtype intensity:

float

Return exposure:

the returned exposure value will be zero

Rtype exposure:

float

convertToNonNormalizedExposure(intensity, exposure, scaleX, scaleY, scaleZ, shape='Rectangle')

Converts normalized lights to no normalization. This function works for rectangular area lights Returns pure exposure, intensity will be 1

Parameters:
  • intensity (float) – The intensity value of the light (Arnold, Renderman, Redshift units)

  • exposure (float) – The exposure value of the light (Arnold Renderman) zero if Redshift

  • scaleX (float) – The scale x of the rectangle light

  • scaleY (float) – The scale y of the rectangle light

  • scaleZ (float) – scale on z

  • shape (str) – the string shape of the 3d object, see SHAPE_ATTR_ENUM_LIST_NICE for values (“Rectangle”, “Disc” etc)

Return intensity:

the returned intensity value will be 1

Rtype intensity:

float

Return exposure:

the returned exposure value now not normalized

Rtype exposure:

float

createLight(name, shapeNodeType)

Function that creates a shape node of type under an empty transform, useful for light creation

Parameters:
  • name (str) – Name of the light to be created, the transform

  • shapeNodeType (str) – the shape node to be created, eg “RedshiftPhysicalLight”, the node type

Return lightTransformName:

the name of the light (transform node)

Rtype lightTransformName:

str

Return shapeNodeName:

the name of the shape node

Rtype shapeNodeName:

str

rendererFromNodeType(lightType)

Returns the renderer of the given node type if it is supported by Zoo Tools.

Parameters:

lightType (str) – The node type of the light eg. “aiAreaLight”

Returns:

The name of the renderer “Redshift” “Arnold”, “VRay” etc. Returns “” if unknown.

Return type:

str

getAllLightShapesInScene(lightTypeList, checkRendererLoaded=False)

Returns any lights in the scene that may be in the global list lightTypeList

Parameters:
  • lightTypeList (list) – a list of node type names to search for

  • checkRendererLoaded (bool) – Check the renderer is loaded matching the light type if known. Avoids warning prints.

Return allLightShapes:

all the area lights in the scene as shapeNode names

Rtype allLightShapes:

list

getAllLightTransformsInScene(lightTypeList)

Returns all the transforms of lights from lightTypeList in the scene

Parameters:

lightTypeList (list) – a list of node type names to search for

Return lightsTransformList:

Light Name List of Transforms

Rtype lightsTransformList:

list

deleteAllLightTypes(lightTypeList)

deletes all lights of types lightTypeList in the scene

Parameters:

lightTypeList (list(str)) – a list of node type names to search for

Return lightsTransformList:

Light Name List of Transforms

Rtype lightsTransformList:

list(str)

filterAllLightTypesFromNodes(nodes, lightTypeList)

filters all the lights of types lightTypeList from the selected list

Parameters:
  • nodes (list(str)) – A list of maya node names (strings) to be filtered for lights of lightTypeList

  • lightTypeList (list(str)) – a list of node type names to search for

Return lightsTransformList:

Light Name List of Transforms

Rtype lightsTransformList:

list(str)

filterAllLightTypesFromSelection(lightTypeList)

filters all the lights of types lightTypeList from the selected list

Parameters:

lightTypeList (list(str)) – a list of node type names to search for

Return lightsTransformList:

Light Name List of Transforms

Rtype lightsTransformList:

list(str)

placeReflection()

placeReflection by braverabbit https://github.com/IngoClemens/placeReflection

class ZooLightsTrackerSingleton(*args, **kwargs)

Bases: object

Used by the lights marking menu possibly other, add light tracking data here such as copy/paste light data

Lightsmultihdri

The new class for creating and ingesting HDRI Skydome Lights with multiple renderer support.

Author: Andrew Silke

SKYDOME EXAMPLES

# Create Skydome (Arnold):

from zoo.libs.maya.cmds.lighting import lightsmultihdri
hdriInst = lightsmultihdri.createDefaultHdriRenderer("Arnold", hdriName="")

# Ingest Skydome:

from zoo.libs.maya.cmds.lighting import lightsmultihdri
hdriInst = lightsmultihdri.hdriInstanceFromHdri(hdriName="mySkydomeLight")

# Change Skydome Settings:

hdriInst.setName("myHdriSkydomeLight")  # sets name of the light
hdriInst.setIntensity(1.5)
hdriInst.setBackgroundVis(False)  # sets the background to be invisible in renders
hdriInst.setRotate([0.0, 95.3, 0.0])  # rotates the HDRI light 90 degrees
hdriInst.setImagePath(r"C:/myImage/path/image.hdr")  # Sets the image of the skydome

# Set values from a dictionary

# Default HDRI dictionary example from zoo.libs.maya.cmds.lighting.lightconstants
skydomeValues = {HDRI_NAME: "hdriSkydome",
                 HDRI_INTENSITY: 1.0,
                 HDRI_ROTATE: [0.0, 0.0, 0.0],
                 HDRI_TRANSLATE: [0.0, 0.0, 0.0],
                 HDRI_SCALE: [1.0, 1.0, 1.0],
                 HDRI_TEXTURE: "",
                 HDRI_INVERT: False,
                 HDRI_LIGHTVISIBILITY: True,
                 HDRI_TINT: [1.0, 1.0, 1.0]}
hdriInst.setFromDict(genAttrDict, setName=False, apply=True, noneIsDefault=True)
removeLightSuffix(lightName)
emptyInstance(hdriName='')

Creates an empty hdri instance for use when no light is selected

hdriInstancer(hdriType, hdriName='', create=False, ingest=True, suffixName=False, message=False)

Creates or ingests (loads) a hdri instance of a specific renderer.

Parameters:
  • hdriType (str) – The type of hdri to create eg “aiSkyDomeLight” see lgtcn.RENDERERHDRILIGHTS.

  • hdriName (str) – The transform name of the hdri to create.

  • create (bool) – True if creating a new hdri, False if using an existing hdri.

  • ingest (bool) – False if creating a new hdri, True if using an existing hdri.

Returns:

A zoo HDRI instance of the specified light.

Return type:

hdribase.HdriBase

hdriInstanceFromHdri(hdriShape)

Loads a hdri instance from an existing hdri skydome. Auto detects the node type.

Supports lgtcn.SKYDOME_RENDERER_SUPPORTED:

“Arnold” “Redshift”, “VRay”, “Renderman”

if no hdri exists then returns None

Parameters:

hdriShape (str) – The shape node name of a hdri light

Returns:

A zoo hdri instance of the specified hdri, None if the hdri does not exist

Return type:

hdribase.HdriBase

createHdriInstanceType(hdriType, hdriName='', imagePath='', suffixName=False, message=True)

Creates a new hdri of hdri type with a name and returns the hdri instance.

Parameters:
  • hdriType (str) – The type of hdri to create eg “aiSkyDomeLight” see lgtcn.RENDERERHDRILIGHTS.

  • hdriName (str) – The name of the HDRI light

  • imagePath (str) – Adds the image path to a HDRI texture image, if “auto” will use the default zoo lores HDRI

  • message (bool) – Report a message to the user

Returns:

A zoo hdri instance of the specified hdri type

Return type:

hdribase.HdriBase

createDefaultHdriRenderer(renderer, hdriName='', imagePath='', lightGroup=True, select=True, suffixName=False, message=True)

Creates a default hdri skydome of the current renderer

Parameters:
  • renderer (str) – The render nice name “Arnold” “Redshift” etc.

  • hdriName (str) – The name of the HDRI light, if “” will be a default light name

  • imagePath (str) – Adds the image path to a HDRI texture image, if “auto” will use the default zoo lores HDRI

  • lightGroup (bool) – Creates/parents the light inside the group ArnoldLights_grp or equivalent renderer

  • select (bool) – Selects the transform node of the light

  • message (bool) – Report a message to the user

Returns:

A zoo HDRI instance of the specified light

Return type:

hdribase.HdriBase

createDefaultHdriAutoRenderer(hdriName='', imagePath='', lightGroup=True, select=True, suffixName=False, message=True)

Creates a default hdri skydome from the renderer that’s currently loaded in Zoo Tools Pro.

multirenderersettings.currentRenderer()

Parameters:
  • hdriName (str) – The name of the HDRI light, if “” will be a default light name

  • imagePath (str) – Adds the image path to a HDRI texture image, if “auto” will use the default zoo lores HDRI

  • lightGroup (bool) – Creates/parents the light inside the group ArnoldLights_grp or equivalent renderer

  • select (bool) – Selects the transform node of the light

  • message (bool) – Report a message to the user

Returns:

A zoo HDRI instance of the specified light

Return type:

hdribase.HdriBase

hdriInstancesFromNodes(nodeTransforms, hdriTypes=['aiSkyDomeLight', 'RedshiftDomeLight', 'VRayLightDomeShape', 'PxrDomeLight'], message=True)

From the given nodes load HDRI instances

Parameters:
  • nodeTransforms (list(str)) – A list of objects, should be transforms

  • message (bool) – Report warnings to the user?

Returns:

A list of zoo hdri instances

Return type:

list(hdribase.HdriBase)

hdriInstancesFromSelected(hdriTypes=['aiSkyDomeLight', 'RedshiftDomeLight', 'VRayLightDomeShape', 'PxrDomeLight'], message=True)

From selected HDRI lights return a list of associated zoo HDRI instances

Parameters:
  • hdriTypes (list(str)) – A list of light types of the node type of the hdri light’s shape node

  • message (bool) – Report warnings to the user?

Returns:

A list of zoo hdri instances

Return type:

list(hdribase.HdriBase)

hdriInstancesFromScene(hdriTypes=['aiSkyDomeLight', 'RedshiftDomeLight', 'VRayLightDomeShape', 'PxrDomeLight'], message=True)

Returns all the HDRI lights in a scene as HDRI Instances.

Parameters:

message (bool) – Report warnings to the user?

Returns:

A list of zoo hdri instances

Return type:

list(hdribase.HdriBase)

hdriInstancesRenderer(renderer, message=True)

Return all the HDRIs in the scene from a particular renderer.

Renderer types:

lgtcn.MAYA
lgtcn.REDSHIFT
lgtcn.RENDERMAN
lgtcn.ARNOLD
lgtcn.VRAY
Parameters:
  • renderer (str) – The nice name of the renderer see lgtcn for renderer strings “Arnold”, “Renderman”, “VRay” etc

  • message (bool) – Report warnings to the user?

Returns:

A list of zoo hdri instances

Return type:

list(hdribase.HdriBase)

hdriInstanceRenderer(renderer, message=True)

Returns a single HDRI instance in the scene from a particular renderer.

Tries selection and then searches the scene for matching HDRIS. Usually only one HDRI in the scene per renderer.

Renderer types:

lgtcn.MAYA
lgtcn.REDSHIFT
lgtcn.RENDERMAN
lgtcn.ARNOLD
lgtcn.VRAY
Parameters:
  • renderer (str) – The nice name of the renderer see lgtcn for renderer strings “Arnold”, “Renderman”, “VRay” etc

  • message (bool) – Report warnings to the user?

Returns:

A zoo hdri instance or None if none found.

Return type:

hdribase.HdriBase

hdriDependencyPath(imageFilePath)

Returns the dependency folder of a HDRI Image and the extraDatafilePath.

Parameters:

imageFilePath (str) – The file path of a HDRI image to save the data inside the dependency folder

Return dependencyPath:

The full path to the dependency folder of the HDRI Image.

Returns:

Fullpath to dependency Folder and zooinfo file.

Return type:

tuple[str, str]

saveExtraDataJson(intensityMultiplier, rotationOffset, imageFilePath, message=True)

Saves a zooInfoFilePath JSON file with the intensity multiplier and rotation offset data given a HDRI image path.

Will create a dependency folder and file if none exists.

Parameters:
  • intensityMultiplier (float) – The value of the intensity multiplier to store in the JSON file.

  • rotationOffset (float) – The value of the intensity multiplier to store in the JSON file.

  • imageFilePath (str) – The file path of a HDRI image to save the data inside the dependency folder

  • message (str) – Report a message to the user?

Return hdriExtraDataDict:

The dictionary with the values HDRI_INTENSITY_MULTIPLIER and HDRI_ROTATE_OFFSET

Rtype hdriExtraDataDict:

dict

Return zooInfoFilePath:

The file path of the file saved

Rtype zooInfoFilePath:

str

loadExtraDataJson(imageFilePath)

Loads a JSON file given a HDRI image and attempts to return the intensity multiplier and rotation offset.

Will return None, None if no file named “HDRI_offsetData.json” exists.

Parameters:

imageFilePath (str) – The file path of a HDRI image to save the data inside the dependency folder

Return intensityMultiplier:

The value of the intensity multiplier in the JSON file. None if not found.

Rtype intensityMultiplier:

float

Return rotationOffset:

The value of the intensity multiplier in the JSON file. None if not found.

Rtype rotationOffset:

float

Presets

getLightPresetDict(filename='lightpresets.json')

Retrieves the preset dictionary from the .json file of the saved filepaths for the quick directory The preset dictionary only contains the file paths of the IBL and light preset

Parameters:

filename (str) – the name of the preset file

Return presetLightFilePathDict:

The preset shader dictionary

Rtype presetLightFilePathDict:

dict

writeLightPresetDict(presetLightFilePathDict)

Writes the preset shader dict to a .json file

Parameters:

presetLightsDict (dict) – The preset shader dictionary

listIblQuickDirImages()

Lists all the images inside of the “iblQuickDir”

Return iblList:

List of the IBL images inside of the iblQuickDir

Rtype iblList:

list

Return iblQuickDir:

The file path of the IBL directory

Rtype iblQuickDir:

str

listQuickDirPresets()

Lists all of the light presets inside of the “presetQuickDir” directory The light presets are files each with a single scene light setup

Return presetList:

A list of .json files each with a single scene light setup

Rtype presetList:

list

Return presetQuickDir:

The full file path of the light preset directory

Rtype presetQuickDir:

str

Redshiftlights

createRedshiftDirectionalLight(name='directionalLight')

Creates a Maya directional light, Redshift uses this as a directional light type

Parameters:

name (str) – the name of the light

Return lightTransformName:

the name of the light (transform node)

Rtype lightTransformName:

str

Return shapeNodeName:

the name of the shape node

Rtype shapeNodeName:

str

createRedshiftPhysicalLight(name='rsPhysicalLight')

Creates a RedshiftPhysicalLight

Parameters:

name (str) – the name of the light

Return lightTransformName:

the name of the light (transform node)

Rtype lightTransformName:

str

Return shapeNodeName:

the name of the shape node

Rtype shapeNodeName:

str

createRedshiftSkydomeLight(name='RedshiftDomeLight')

Creates an IBL Skydome Light

Parameters:

name (str) – the name of the light

Return lightTransformName:

the name of the light (transform node)

Rtype lightTransformName:

str

Return shapeNodeName:

the name of the shape node

Rtype shapeNodeName:

str

getAllLightShapesInScene()

Returns any lights in the scene that may be in the global list ALLLIGHTTYPES

Return allLightShapes:

all the area lights in the scene as shapeNode names

Rtype allLightShapes:

list

getAllTransformsInScene()

Returns all the transforms of lights from ALLLIGHTTYPES in the scene

Return lightsTransformList:

Rtype lightsTransformList:

filterAllAreaLightTypesFromSelection()

filters all the lights of types lightTypeList from the selected list

Return lightsTransformList:

Light Name List of Transforms

Rtype lightsTransformList:

list

deleteAllLights()

deletes all lights of types ALLLIGHTTYPES in the scene

Return deletedLights:

All the deleted light names

Rtype deletedLights:

list

Renderertransferlights

Creates and transfers lights settings between renderers.

This code is being upgraded and will become outdated soon.

Code examples for creating a lights without UIs.

Area Light Example:

from zoo.libs.maya.cmds.lighting import renderertransferlights
lightDictAttributes = dict()

# Main Settings ------------------
newName = "lightName"
addSuffix = True
renderer = "Redshift"  # "Arnold" or "Renderman"
position = "camera" # "world" world center, "selected" selected object pos/rot, "camera" drop at camera position

# Settings -------------------
lightDictAttributes['gExposure'] = 16.0
lightDictAttributes['gIntensity'] = 1.0
lightDictAttributes['gLightColor_srgb'] = [1.0, 1.0, 1.0]
lightDictAttributes["gTempOnOff"] = False
lightDictAttributes['gTemperature'] = 6500.0
lightDictAttributes['gShape_shape'] = 0 # "rectangle" 0 "disc" 1 "sphere" 2 "cylinder" 3
lightDictAttributes['gLightVisibility'] = False
lightDictAttributes['gNormalize'] = True
lightDictAttributes['gScale'] = [50.0, 50.0, 50.0]

# Build Area light ----------------
lightTransform = renderertransferlights.createAreaLightMatchPos("TempNameXXX", renderer, warningState=False, position=position)[0]
lightTransform, lightShape = renderertransferlights.renameLight(lightTransform, newName, addSuffix=addSuffix)
transformList, shapeList = renderertransferlights.cleanupLights(renderer, [lightTransform], selectLights=True)
renderertransferlights.setLightAttr(shapeList[0], lightDictAttributes)

Directional Light Example:

from zoo.libs.maya.cmds.lighting import renderertransferlights
lightDictAttributes = dict()

# Main Settings ------------------
newName = "directionalLight"
rendererNiceName = "Redshift"  # "Arnold" or "Renderman"
addSuffix = True

# Light Settings -------------------
lightDictAttributes["gIntensity"] = 1.0
lightDictAttributes["gTemperature"] = 6500.0
lightDictAttributes["gTempOnOff"] = False
lightDictAttributes['gRotate'] = (-45.0, -45.0, 0.0)
lightDictAttributes["gAngleSoft"] = 2.0

lightTransform, lightShape, warningState = renderertransferlights.createDirectionalDictRenderer(lightDictAttributes, newName, rendererNiceName,cleanup=False, suffix=addSuffix)
renderertransferlights.cleanupLights(rendererNiceName, [lightTransform], selectLights=True)  # group the light

Skydome Light Example:

from zoo.libs.maya.cmds.lighting import renderertransferlights
lightApplyAttrDict = dict()

# Main Settings ----------------
renderer = "Redshift"  # "Arnold" or "Renderman"
newName = "hdriSkydomeLight"
addSuffix = True

# Light Settings --------------
lightApplyAttrDict["gIntensity"] = 1.0
lightApplyAttrDict["gExposure"] = 0.0
lightApplyAttrDict["gTranslate"] = (0.0, 0.0, 0.0)
lightApplyAttrDict["gRotate"] = (0.0, 0.0, 0.0)
lightApplyAttrDict["gScale"] = (1.0, 1.0, 1.0)
lightApplyAttrDict['gIblTexture'] = r"C:/Users/Andrew Silke/Documents/zoo_preferences/assets/light_suite_ibl_skydomes/sky_clear/HDRI-SKIES_Sky215.hdr"
lightApplyAttrDict['gLightVisibility'] = True
invertScale = False

lightTransform, lightShape, warning = renderertransferlights.createSkydomeLightRenderer("tempIblNameXyy", renderer, warningState=False, cleanup=True)
lightTransform, lightShape = renderertransferlights.renameLight(lightTransform, newName, addSuffix=addSuffix, renderer=renderer)
renderertransferlights.setIblAttr(lightShape, lightApplyAttrDict, invertScaleZ=invertScale)
ARNOLDSKYDOMEATTRDICT = {'gExposure': 'exposure', 'gIblTexture': 'color', 'gIntensity': 'intensity', 'gLightColor_srgb': 'color', 'gLightVisibility': 'camera'}

MISC

rotateObjectSpaceXForm(obj, rotation)

Rotate object based on local position, ie rotate from current position, xform offset ignore gimbal

Used for Redshift cylinder which is rotated 90, needs to also account while pulling tht info too

Parameters:

rotation (tuple) – tuple in degrees (0, 0, 90)

getLightDictAttributes()
getDirectionalDictAttributes()
getSkydomeLightDictAttributes()
getRendererAttrDict(rendererNiceName)

Returns the correct attribute generic dict for the given renderer for area lights

Parameters:

rendererNiceName (str) – the renderer nice name “Redshift”, “Arnold”, “Renderman”

Return attrDict:

the attribute dictionary of the appropriate renderer

Rtype attrDict:

dict

getRendererDirectionalAttrDict(rendererNiceName)

Returns the correct attribute generic dict for the given renderer for area lights

Parameters:

rendererNiceName (str) – the renderer nice name “Redshift”, “Arnold”, “Renderman”

Return attrDict:

the attribute dictionary of the appropriate renderer

Rtype attrDict:

dict

getRendererAttrDictSkydome(rendererNiceName)

Returns the correct attribute dict for the given renderer for area lights

Parameters:

rendererNiceName (str) – the renderer nice name “Redshift”, “Arnold”, “Renderman”

Return attrDict:

the attribute dictionary of the appropriate renderer

Rtype attrDict:

dict

checkAreaShape(node)

Returns the name if it is a directional light node type (any renderer), returns None if not.

Parameters:

node (str) – any Maya node name

Return directionalShape:

will return a str if it’s a directional light shape node, None if not

Rtype directionalShape:

str

getLightShape(lightTransform, lightFamily='All')

Returns a single light shape, checks if it is a light from the type dict RENDERERAREALIGHTS and RENDERERDIRECTIONALLIGHTS

Parameters:

lightTransform (str) – the light transform name

Return shape:

The light shape name, None if not found

Rtype shape:

str

findFirstAreaLight(nodeList, lightFamily='areaLights')

Returns the first light found in a list, usually for GUI displays.

Light family can be AREALIGHTS, DIRECTIONALS, or “All”

Parameters:

nodeList (list) – list of Maya nodes, can be shapes or transforms, any nodes

Return directionalListFound:

the name of the first directional light found, None if none found

Rtype directionalListFound:

str

getLightShapeList(transformList)

takes a transform list and returns valid light shapes, Renderman Redshift Arnold etc

Parameters:

transformList (list) – list of Maya transforms

Return lightShapeList:

a list of light shapes

Rtype lightShapeList:

list

getIblShape(lightTransform)

Gets the light shape, checks if it is a light from the type dict

Parameters:

lightTransform (str) – the light transform name

Return shape:

The light shape name, None if not found

Rtype shape:

str

getIblShapeList(iblTransformList)
findFirstDirectionalLight(nodeList, rendererNiceName=None)

Returns the first directional light found in a list, for GUI displays.

Parameters:

nodeList (list) – list of Maya nodes, can be shapes or transforms, any nodes

Return directionalListFound:

the name of the first directional light found, None if none found

Rtype directionalListFound:

str

checkDirectionalShape(node, rendererNiceName=None)

Returns the name if it is a directional light node type (any renderer), returns None if not.

Parameters:

node (str) – any Maya node name

Return directionalShape:

will return a str if it’s a directional light shape node, None if not

Rtype directionalShape:

str

getDirectionalShape(lightTransform, rendererNiceName=None)

Gets the light shape, checks if it is a ldirectionlal ight from the type dict

Parameters:

lightTransform (str) – the light transform name

Return shape:

The light shape name, None if not found

Rtype shape:

str

getDirectionalShapeList(directionalTransformList)
getRendererNiceNameFromLightShape(shapeNode)

From a shape node, light shape return the nice name of the current renderer Directional lights are tricky because can be Redshift or Arnold. The light create UI adds a attribute on creation which tells what renderer it was created in, but easily possible for a directional light not to have this if created from the menus.

Parameters:

shapeNode (str) – light shape node name

Return rendererNiceName:

nice name of the renderer, “Redshift”, “Arnold” etc

Rtype rendererNiceName:

str

getRendererNiceNameFromLightTransfrom(transformNode)

From a transform node, return the nice name of the current renderer Directional lights are tricky because can be Redshift or Arnold. The light create UI adds a attribute on creation which tells what renderer it was created in, but easily possible for a directional light not to have this if created from the menus.

Parameters:

transformNode (str) – a light transform node

Return rendererNiceName:

nice name of the renderer, “Redshift”, “Arnold” etc

Rtype rendererNiceName:

str

setIntensityExposure(shapeNode, intensityVal, exposureVal)

Sets the intensity and exposure on an area light

Note: older versions of Redshift have no exposure so this accounts for auto detecting if exposure exists

Parameters:
  • shapeNode (str) – The light shape node

  • intensityVal (float) – The current intensity of the light

  • exposureVal (float) – The current exposre of the light

Return intensityVal:

the applied intensity value, generally unchanged

Rtype intensityVal:

float

Return exposureVal:

The applied exposure value, generally unchanged

Rtype exposureVal:

float

setIntensityExposureSelected(intensityVal, exposureVal)

Sets the intensity and exposure on selected lights Redshift only has intensity so this function converts so that the intensity is correctly applied with exposure

Parameters:
  • intensityVal (float) – The current intensity of the light

  • exposureVal (float) – The current exposre of the light

convertApplyExposure(shapeNode, intensityVal, exposureVal)

Converts the intensity of a light to exposure. Exposure is calulated as 2**exposure (2 to the power of exposure)

Note: Intensity will always be 1 except in old versions of Redshift where exposure did not exist

Parameters:
  • shapeNode (str) – The light shape node

  • intensityVal (float) – The current intensity of the light

  • exposureVal (float) – The current exposre of the light

Return intensityVal:

the intensity value will usually be 1 except if the renderer is redshift

Rtype intensityVal:

float

Return exposureVal:

The new exposure value

Rtype exposureVal:

float

convertApplyIntensity(shapeNode, intensityVal, exposureVal)

Converts the intensity of a light’s exposure and intensity attributes to be pure intensity with a value of 0 for Exposure. Exposure doesn’t exist on Redshift lights so will always apply as intensity. Exposure is calulated as 2**exposure (2 to the power of exposure) Exposure will always be 0

Parameters:
  • shapeNode (str) – The light shape node

  • intensityVal (float) – The current intensity of the light

  • exposureVal (float) – The current exposre of the light

Return intensityVal:

the applied intensity value, exposure is always set to zero

Rtype intensityVal:

convertApplyExposureSelected(intensityVal, exposureVal)

Converts the intensity of a light’s exposure and intensity attributes to be pure intensity with a value of 0 for Exposure. For selected lights

Exposure doesn’t exist on Redshift lights so will always apply as intensity. Exposure is calulated as 2**exposure (2 to the power of exposure) Exposure will always be 0

Parameters:
  • intensityVal (float) – The current intensity of the light

  • exposureVal (float) – The current exposre of the light

Return intensityVal:

the applied intensity value, exposure is always set to zero

Rtype intensityVal:

convertApplyIntensitySelected(intensityVal, exposureVal)

Converts the intensity/exposure of a light to be pure exposure with a value of 1 for intensity for selected lights. Exposure is set as zero except with Redshift which has no attribute for exposure

Parameters:
  • intensityVal (float) – The current intensity of the light

  • exposureVal (float) – The current exposre of the light

convertToExposureRenderer(rendererNiceName, shapeNode)

Converts exposure and intensity to be pure exposure (with intensity set to 1) Will not work on Redshift as it doesn’t have exposure right now

Parameters:
  • rendererNiceName (str) – the renderer nice name “Arnold”, “Renderman”

  • shapeNode (str) – the lights shape node name

convertToIntensityRenderer(rendererNiceName, shapeNode)

Converts exposure and intensity to be pure intensity (with intensity set to 0) Will not work on Redshift as it doesn’t have exposure right now

Parameters:
  • rendererNiceName (str) – the renderer nice name “Redshift”, “Arnold”, “Renderman”

  • shapeNode (str) – the lights shape node name

checkValidLightType(lightShape, filterDirectionalOnly=False)

Check to see if the light shape is a valid area light or directional or ibl Checks from three dicts RENDERERAREALIGHTS, RENDERERDIRECTIONALLIGHTS, RENDERERDIRECTIONALLIGHTS

Parameters:

lightShape (str) – The light shape node

Return validity:

True if the light is recognised, False if not

Return type:

bool

checkValidIblType(lightShape)

Check to see if the light shape is a valid skydome light Checks from dict RENDERERSKYDOMELIGHTS

Parameters:

lightShape (str) – The light shape node

Return validity:

True if the light is recognised, False if not

Return type:

bool

scaleAreaLightIntensity(lightShape, scalePercentage, calcExposure=False, applyExposure=False, applyPure=True)

Scales the intensity of the lightShape. Multiple modes. Scales by ‘scalePercentage’ 1. Only Intensity (ignores Exposure) 2. Only Exposure (ignores Intensity) 3. Calculate As Pure Intensity Apply As Intensity (Exposure becomes 0) 4. Calculate As Pure Intensity Apply As Exposure (Intensity becomes 1) 5. Calculate As Pure Exposure Apply As Intensity (Exposure becomes 0) 6. Calculate As Pure Exposure Apply As Exposure (Intensity becomes 1)

Parameters:
  • lightShape (str) – The light shape node

  • scalePercentage (float) – The percentage to be scaled

  • calcExposure (bool) – Calculate As Exposure? False is Intensity, and null if “applyPure” is True

  • applyExposure (bool) – Applies the new value as exposure if True, or intensity is False, also controls “applyPure”

  • applyPure (bool) – if True reads/applies only the value designated by “applyExposure” Exposure if True, Intense False

Return intensityVal:

the returned intensity value

Rtype intensityVal:

float

Return exposureVal:

the returned exposure value

Rtype exposureVal:

float

scaleAreaLightIntensitySelected(scalePercentage, calcExposure=False, applyExposure=False, applyPure=True)

Scales the intensity of selected area lights. Multiple modes. Scales by ‘scalePercentage’ 1. Only Intensity (ignores Exposure) 2. Only Exposure (ignores Intensity) 3. Calculate As Pure Intensity Apply As Intensity (Exposure becomes 0) 4. Calculate As Pure Intensity Apply As Exposure (Intensity becomes 1) 5. Calculate As Pure Exposure Apply As Intensity (Exposure becomes 0) 6. Calculate As Pure Exposure Apply As Exposure (Intensity becomes 1)

Parameters:
  • scalePercentage (float) – The percentage to be scaled

  • calcExposure (bool) – Calculate As Exposure? False is Intensity, and null if “applyPure” is True

  • applyExposure (bool) – Applies the new value as exposure if True, or intensity is False, also controls “applyPure”

  • applyPure (bool) – if True reads/applies only the value designated by “applyExposure” Exposure if True, Intense False

Return intensityVal:

the returned intensity value

Rtype intensityVal:

float

Return exposureVal:

the returned exposure value

Rtype exposureVal:

float

scaleDirectionalLightIntensity(lightShape, scalePercentage, rendererNiceName)

scales the light intensity of a directional light by the percentage given.

Parameters:
  • lightShape (str) – the Maya lightshape name

  • scalePercentage (float) – the percentage to be scaled by

scaleIblLightIntensity(lightShape, scalePercentage)

scales the light intensity of an ibl skydome light by the percentage given.

Parameters:
  • lightShape (str) – the Maya lightshape name

  • scalePercentage (float) – the percentage to be scaled by

scaleAllLightIntensitiesLightList(scalePercentage, areaLightShapeList, directionalLightShapeList, skydomeShapeList, rendererNiceName, calcExposure=False, applyExposure=False, applyPure=True)

Scales the light intensities off multiple light types given the shape list for - area shapes list - directional shapes - ibl shapes list

Parameters:
  • scalePercentage (float) – the percentage to scale by

  • areaLightShapeList (list) – list of area light shapes names

  • directionalLightShapeList (list) – list of directional light shapes names

  • skydomeShapeList (list) – list of directional light shapes names

  • rendererNiceName (list) – the nice name of the renderer Redshift, Arnold etc

  • calcExposure (bool) – calculate using the exposure of area lights? Should be false, should always be intensity

  • applyExposure (bool) – apply as exposure of area lights only

  • applyPure – area lights apply as pure, either intensity to 1 or exposure to zero depending on applyExposure

scaleAllLightsIntensitySelected(scalePercentage, rendererNiceName, calcExposure=False, applyExposure=False, applyPure=True)

Scales all the light intensities of lights by percentage. This function is filtered by selection

Area lights can be calculated with options:

  1. Only Intensity (ignores Exposure)

  2. Only Exposure (ignores Intensity)

  3. Calculate As Pure Intensity Apply As Intensity (Exposure becomes 0)

  4. Calculate As Pure Intensity Apply As Exposure (Intensity becomes 1)

  5. Calculate As Pure Exposure Apply As Intensity (Exposure becomes 0)

  6. Calculate As Pure Exposure Apply As Exposure (Intensity becomes 1)

Parameters:
  • scalePercentage (float) – the percentage to be scaled by

  • rendererNiceName (str) – the renderer name ie “Redshift” or “Arnold” etc

  • calcExposure (bool) – Calculate As Exposure? False is Intensity, and null if “applyPure” is True

  • applyExposure (bool) – Applies the new value as exposure if True, or intensity is False, also controls “applyPure”

  • applyPure (bool) – if True reads/applies only the value designated by “applyExposure” Exposure if True, Intense False

scaleAllLightIntensitiesScene(scalePercentage, rendererNiceName, calcExposure=False, applyExposure=False, applyPure=True)

Scales all the light intensities of lights by percentage. This function ignores selection and scales all lights of the renderer type in the scene.

Area lights can be calculated with options:

  1. Only Intensity (ignores Exposure)

  2. Only Exposure (ignores Intensity)

  3. Calculate As Pure Intensity Apply As Intensity (Exposure becomes 0)

  4. Calculate As Pure Intensity Apply As Exposure (Intensity becomes 1)

  5. Calculate As Pure Exposure Apply As Intensity (Exposure becomes 0)

  6. Calculate As Pure Exposure Apply As Exposure (Intensity becomes 1)

Parameters:
  • scalePercentage (float) – the percentage to be scaled by

  • rendererNiceName (str) – the renderer name ie “Redshift” or “Arnold” etc

  • calcExposure (bool) – Calculate As Exposure? False is Intensity, and null if “applyPure” is True

  • applyExposure (bool) – Applies the new value as exposure if True, or intensity is False, also controls “applyPure”

  • applyPure (bool) – if True reads/applies only the value designated by “applyExposure” Exposure if True, Intense False

scaleLightSize(lightTransform, scalePercentage)

Scales the physical size of a light by the percentage amount

Parameters:

scalePercentage (float) – The percentage to be scaled

Return scale:

The scale result as (1.5, 1.5, 1.5)

Rtype scale:

list

scaleLightSizeFloat(lightTransform, scaleFloat)

Scales the physical size of a light by the float amount

scaleLightSizeSelected(scalePercentage)

Scales physical size of the selected lights by the percentage amount Checks valid lights only

Parameters:

scalePercentage (float) – The percentage to be scaled

Return scale:

The scale result as (1.5, 1.5, 1.5)

Rtype scale:

list

scaleAreaLightSizeAll(scalePercentage, rendererNiceName)

Scales all area lights of a given renderer type, scales from each light center Will rename non unique lights

Parameters:
  • scalePercentage (float) – The percentage of the scale, eg 90.0 (is 90% or will scale by 1.9)

  • rendererNiceName (str) – the nice name of the renderer eg “Redshift”

scaleLightsList(scalePercentage, rendererNiceName, areaLightTransformList, areaLightShapeList, iblSkydomeTransformList, directionalTransformList, scalePivot=(0.0, 0.0, 0.0), ignoreNormalization=False, importUnitAdjust=False)

Scales The Light Lists from world 0, 0, 0 by a scale percentage eg 90.0 (is 90% or will scale by 1.9)

Will scale area lights by toggling normalization off (then back on) by default. The default keeps the lights correctly scaled relative to the scene and models.

Lights should have unique or long names.

Parameters:
  • scalePercentage (float) – The percentage of the scale, eg 90.0 (is 90% or will scale by 1.9)

  • rendererNiceName (str) – the nice name of the renderer eg “Redshift”

  • areaLightTransformList (list()) – the area light transform list

  • areaLightShapeList (list()) – the area light shape list

  • iblSkydomeTransformList (list()) – the ibl light transform list

  • directionalTransformList (list()) – the directional light transform list

  • scalePivot (tuple) – tuple of floats, the scale pivot in world space

  • ignoreNormalization (bool) – area lights can be normalized affecting the scale lighting, should you ignore this?

  • importUnitAdjust (bool) – Auto-accounts for possible scene unit changes ie scene is in inches but imported as cm

scaleAllLightsInScene(scalePercentage, rendererNiceName, scalePivot=(0.0, 0.0, 0.0), ignoreNormalization=False, ignoreIbl=False, ignoreDirectionals=False, importUnitAdjust=False, message=True, forceShortName=False)

Scales All The Lights in the scene from world 0, 0, 0 by a scale percentage eg 90.0 is 90% or will scale by 1.9

Will scale area lights by toggling normalization off (then back on) by default. The default keeps the lights correctly scaled relative to the scene and models.

Parameters:
  • scalePercentage (float) – the percentage of the scale offset

  • rendererNiceName (str) – the nice name of the renderer eg “Redshift”, “Arnold”, “Renderman”

  • scalePivot (tuple) – tuple of floats, the scale pivot in world space

  • ignoreNormalization (bool) – area lights can be normalized affecting the scale lighting, should you ignore this?

  • ignoreIbl (bool) – don’t scale the IBLs if True

  • message (bool) – don’t scale the IBLs if True

Return areaLightTransformList:

the area light transforms scaled (now renamed if not unique)

Rtype areaLightTransformList:

list

Return areaLightShapeList:

the area light shapes scaled (now renamed if not unique)

Rtype areaLightShapeList:

list

Return iblSkydomeTransformList:

the ibl light transforms scaled (now renamed if not unique)

Rtype iblSkydomeTransformList:

list

Return iblSkydomeShapeList:

the ibl light shapes scaled (now renamed if not unique)

Rtype iblSkydomeShapeList:

list

matchLights(rendererNiceName, matchObject, targetObject, locatorMode=False)

match object to object only 2017 plus should be modified

Parameters:
  • rendererNiceName (str) – the renderer name ie “Redshift” or “Arnold” etc

  • matchObject (str) – the transform to match (move)

  • targetObject (str) – the transform thats the target (doesn’t move)

  • locatorMode (bool) – if matching with locators then use this, as it overrides renderman scale

fixRendermanAttrs(genericValuesDict, warningState=False)

Renderman’s attribute related to changing the light shape doesn’t exist, instead it requires different shape nodes. There is no shape type for cylinder Also the scale values of renderman lights should be doubled to match Arnold and Redshift

Parameters:

genericValuesDict – values dict with Attrs as keys and values as values

Return genericValuesDict:

genericValuesDict now fixed with the gShape_shape set to string rather than an int

Rtype genericValuesDict:

fixGetRendermanIntensity(intensity)

Fixes the Renderman light intensity while getting attributes (getAttr)

Parameters:

intensity (float) – the incoming light intensity

Return intensity:

the outgoing fixed light intensity

Rtype intensity:

float

fixRendermanScale(transformNode, locatorMode=False)

doubles the scale of Renderman lights to match other renderers if in locator mode then it halves the scale

Parameters:
  • transformNode (str) – The Renderman light’s transform node

  • locatorMode (bool) – if passing in a locator then this should be True

fixRendermanShape(transformNodeOld, newShape, warningState=False, keepPosition=True, keepSelection=True)

Remakes the Renderman area light with a new shape Rectangle, Disk or Sphere.

Note: Cylinder is not available in Renderman

Parameters:
  • transformNodeOld (str) – The old transform node name

  • newShape (int) – Shape is an int that matches SHAPE_ATTR_ENUM_LIST_NICE

  • warningState (bool) – Carry through the warning state

  • keepPosition

  • keepSelection (bool) – Maintain selection?

Return transform:

The transform node of the new light

Rtype transform:

str

Return shape:

The shape node of the new light

Rtype shape:

str

Return warningState:

The warning state

Rtype warningState:

bool

fixRendermanGetLightShape(lightShape, warningState=False)

Records the light type of a renderman light and returns the shape as an int for the generic attribute type 0 = rect, 1 = disk, 2 = sphere

Parameters:

lightShape (str) – the name of the lightShape node

Return genericShape:

the shape as an int 0 = rect, 1 = disk, 2 = sphere

Rtype genericShape:

int

fixRendermanLightVisAttr(attrDict, lightShape)

Renderman’s light visibility attr has changed in v22, check it exists, if not use the old attr name

Parameters:
  • attrDict (dict) – the attribute dictionary of the Renderman renderer

  • lightShape (str) – a single redshift light shape node

Return attrDict:

The Renderman attr dict, now with the correct light visibility attribute name

Rtype attrDict:

dict

fixRendermanIBLScale(scale)

Fix for setAttr Renderman Scale In v21 and below invert scaleZ as Renderman’s IBLs are inverted, the scale should be multiplied by 2000 to match Arnold In v22 and above there’s no offset and multiply by 0.4 to match

Parameters:

scale (list) – the scale of the IBL three values

Return scale:

the scale of the IBL three values

Rtype scale:

list

fixGetRendermanIBLScale(scale)

Fix for getAttr Renderman Scale In v21 and below invert scaleZ as Renderman’s IBLs are inverted, the scale should be divided by 2000 to match Arnold In v22 and above there’s no offset and multiply by 0.4 to match

Parameters:

scale (list) – the scale of the IBL three values

Return scale:

the scale of the IBL three values

Rtype scale:

list

fixRendermanIBLRot(rotate)

fix rotation only if v21 or lower rotating -180, since the IBL is inverted

Parameters:

rotate (list[float] or None) – the IBLs rotation in 3 values

Returns:

the IBLs rotation in 3 values

Return type:

list

fixGetRendermanIBLRot(rotate)

fix rotation only if v21 or lower rotating +180, since the IBL is inverted

Parameters:

rotate (list) – the IBLs rotation in 3 values

Returns:

the IBLs rotation in 3 values

Return type:

list

fixRedshiftIblIntensity(attrValDict)

Redshift intensity is a color so set value is as rgb 0-1 range

Parameters:

attrValDict (dict) – attribute dictionary from the IBL light

Return attrValDict:

attribute dictionary from the IBL light

Rtype attrValDict:

dict

redshiftAreaExposureExists(lightShape, attrDict)

older versions of Redshift had no exposure on the area lights, return True if this attribute exists

Parameters:
  • lightShape (str) – a single redshift light shape node

  • attrDict (dict) – the attribute dictionary of the redshift renderer

Return exposureExists:

Does the exposure attr exist?

Rtype exposureExists:

bool

fixRedshiftAreaSetExposure(attrValDict, lightShape, attrDict)

Fixes potential issues with intensity/exposure in old versions of Redshift

If exposure does not exist then convert to pure intensity and remove the exposure attr from attrValDict If exposure does exist then leave the attrValDict as per normal

Parameters:
  • attrValDict (dict) – attribute dictionary of attr values for an area light

  • lightShape (str) – a single redshift light shape node

  • attrDict (dict) – the attribute dictionary of the redshift renderer

Return attrValDict:

attribute dictionary of attr values for an area light

Rtype attrValDict:

dict

fixRedshiftAreaCylinder(attrValDict, scale, lightShape)

if the shape for an area light is a cylinder then switch the scale and rotate to match

Parameters:
  • attrValDict (dict) – attribute dictionary of attr values for an area light

  • scale (tuple(float)) – the scale value x y z

  • lightShape (str) – a single redshift light shape node

Return scale:

the new generic area light scale

Rtype scale:

tuple(float)

fixRedshiftIblRot(rotate)

Redshift IBL skydome rotation is -90 degrees behind Arnold’s so we match to Arnold

Parameters:

rotate (list) – the 3 value rotation of the light, if not needed will be None

Return rotate:

the 3 value rotation of the light, if not needed will be None

Rtype rotate:

list

arnoldVisibilityExists(attrDict, lightShape)

Older versions of Arnold had no visbility (aiCamera) on area lights, return True if this attribute now exists

Parameters:
  • lightShape (str) – a single arnold light shape node

  • attrDict (dict) – the attribute dictionary of the arnold renderer

Return visibilityExists:

Does the visibility (aiCamera) attr exist?

Rtype visibilityExists:

bool

fixArnoldVisibility(attrDict, lightShape)

Older versions of Arnold had no visbility (aiCamera) on area lights, this fixes and converts the attribute

round the attr float value if new arnold and visibility (aiCamera) att exists. new value will be 1 or 0 if old Arnold then return the visibility as 0

Parameters:
  • lightShape (str) – a single arnold light shape node

  • attrDict (dict) – the attribute dictionary of the arnold renderer

Return exposureExists:

Does the visibility (aiCamera) attr exist?

Rtype exposureExists:

bool

fixArnoldAttrs(genericValuesDict, warningState=False)

Arnold’s attribute related to it’s shape is in string format not int and contains no sphere setting so must be converted. This function changes this attribute value in the generic dictionary. Should be modified as it’s about to be passed into the set method/s

Parameters:

genericValuesDict – values dict with Attrs as keys and values as values

Return genericValuesDict:

genericValuesDict now fixed with the gShape_shape set to string rather than an int

Rtype genericValuesDict:

fixGetArnoldIntensity(intensity)

Fixes the Arnold light intensity for directional lights while getting attributes (getAttr)

Parameters:

intensity (float) – the incoming light intensity

Return intensity:

the outgoing fixed light intensity

Rtype intensity:

float

fixArnoldGetLightShape(lightShape, warningState=False)

Fixes the arnold shape attribute which is in string format, changes it to int for pulling info

Parameters:
  • lightShape (str) – the light shape node name

  • warningState (bool) – the warning state, usually passed in and warning if the type not found

Return shapeValue:

the value of the shape attribute, now changed to int 0 = “quad”, 1 = “disk”, 3 = “cylinder”

Rtype shapeValue:

Return warningState:

the warning state, could be changed if type not found

Rtype warningState:

bool

fixArnoldIBLTexture(lightShape, attrValDict)

Fixes Arnolds IBL texture as building an extra texture map node as file node is required

Parameters:
  • lightShape (str) – the lightshape skydome name

  • attrValDict (dict) – the dictionary of the skyDome values

Return attrValDict:

the dictionary of the skyDome values

Rtype attrValDict:

dict

removeRendererSuffix(lightTransform)

Finds the suffix of a light’s transform node and checks if it matches a legitimate renderer suffix if so then remove it.

Parameters:

lightTransform (str) – A light’s transform node name

Return lightTransform:

Light Transform name now with Renderer suffix removed

Rtype lightTransform:

str

Return suffixRemoved:

bool True if the suffix was removed, False if it wasn’t

Rtype suffixRemoved:

bool

renameLight(lightTransform, newName, addSuffix=True, renderer=None, lightFamily='areaLights', forceUnique=False)

Renames a light and handles the renderer suffix, also checks for non unique names and applies with numeric padding

Parameters:
  • lightTransform (str) – A light’s transform node name best if longName

  • newName (str) – The incoming new name of the light

  • addSuffix (bool) – add a suffix? Will also remove/replace existing Renderer suffixes

  • renderer (str) – if the light is a directional light then the renderer name should be passed in, otherwise auto

  • lightTransform – A light’s transform new node name

  • forceUnique (str) – will auto rename the light with a number if it is not unique in the whole scene

Return lightShape:

A light’s shape new node name

Rtype lightShape:

str

renameIblLightSelected(newName, addSuffix, rendererNiceName, findIBLOutsideOfSelection=True)

Auto renames IBL lights given the renderer, will search the selection and if findIBLOutsideOfSelection=True then will find any IBLs in the scene. Must be one IBL found to rename, not multiple Will error if trying to rename itself with the same name and add _001

Parameters:
  • newName (str) – The incoming new name of the light

  • addSuffix (bool) – add a suffix? Will also remove/replace existing Renderer suffixes

  • rendererNiceName (str) – the renderer nice name “Arnold” etc

  • findIBLOutsideOfSelection – search IBLs in the scene if none found in the selection?

renameLightSelected(newName, addSuffix=True)

Renames selected lights, handles the renderer suffix, also checks for non unique names and applies with numeric padding. Auto figures out the renderer light suffix RendererNiceName is not needed unless looking to rename an IBL that is not selected (findIBLOutsideOfSelection)

Parameters:
  • newName (str) – The incoming new name of the light

  • addSuffix (bool) – add a suffix? Will also remove/replace existing Renderer suffixes

renameDirectionalSelected(newName, rendererNiceName, addSuffix=True, message=True)

Renames selected lights, handles the renderer suffix, also checks for non unique names and applies with numeric padding. Auto figures out the renderer light suffix RendererNiceName is not needed unless looking to rename an IBL that is not selected (findIBLOutsideOfSelection)

Parameters:
  • newName (str) – The incoming new name of the light

  • addSuffix (bool) – add a suffix? Will also remove/replace existing Renderer suffixes

getLightName(lightTransform, removeSuffix=True)

Returns the light name with the suffix potentially removed

Parameters:
  • lightTransform (str) – A light’s transform node name

  • removeSuffix (bool) – Removes the suffix as per the renderer suffixes

Return lightTransform:

A light’s transform node name with the suffix potentially removed

Rtype lightTransform:

str

Return suffixRemoved:

bool True if the suffix was removed, False if it wasn’t

Rtype suffixRemoved:

bool

getLightNameSelected(removeSuffix=True, lightFamily='areaLights', rendererNiceName=None, message=False)

Returns the first light name found. Suffix can be removed for GUIs.

Parameters:

removeSuffix (bool) – Removes the suffix as per the renderer suffixes

Return lightTransform:

the first selected light’s transform node name with the suffix potentially removed

Rtype lightTransform:

str

Return suffixRemoved:

bool True if the suffix was removed, False if it wasn’t

Rtype suffixRemoved:

bool

getLocatorAttr(locatorTransform)

Gets the current light values of the locator Returns as a dictionary with all the light values in generic format

getAllLocsInScene()

returns all the generic area light locators with the suffix RENDERER_SUFFIX[“Generic”] in the scene

Return allLightLocs:

All light-locator transforms in the scene by name

Rtype allLightLocs:

list

cleanupLightLocators(lightLocatorList)

Cleans up light-locators by creating a grp or parents them the grp already exists from the given lightLocatorList

Parameters:

lightLocatorList (list) – a list of lightLocator Names

getLightAttr(lightShape, getIntensity=True, getExposure=True, getColor=True, getTemperature=True, getTempOnOff=True, getShape=True, getNormalize=True, getLightVisible=True, getScale=True)

Gets the current value/s of the light as per the kwargs Returns as a dictionary with None as the attribute value if it hasn’t been requested The returned dict is in generic format

Parameters:
  • lightShape (str) – the light shape node name

  • getIntensity (bool) – return the intensity Value?

  • getExposure (bool) – return Exposure Value if it exists?

  • getColor (bool) – return the color as (0.1, 0.1, 1.0) 0-1 tuple or list?

  • getTemperature (float) – the temperature value in kelvin 6500.0 for example

  • getTempOnOff (bool) – Is the temperature value being used on this light?

  • getShape (return) – return the type of geometric shape, rectangle, sphere etc? Usually an int, see other functions

  • getNormalize (bool) – Is the light normalized? (size doesn’t affect intensity)

  • getLightVisible (bool) – Can the light be seen in the scene? Arnold doesn’t support this.

  • getScale (bool) – the physical scale of the light as a tuple/list

Return attrValDict:

The dictionary of light attribute values in generic format, not renderer

Rtype attrValDict:

dict

getLightAttrList(lightShapeList, getIntensity=True, getExposure=True, getColor=True, getTemperature=True, getTempOnOff=True, getShape=True, getNormalize=True, getLightVisible=True, getScale=True)

Returns a nested dictionary when each key is the are lightShape name. Each value is generic dictionaries of attribute values of the area lightShape

Parameters:
  • lightShapeList (list[str]) – the light shape node name

  • getIntensity (bool) – return the intensity Value?

  • getExposure (bool) – return Exposure Value if it exists?

  • getColor (bool) – return the color as (0.1, 0.1, 1.0) 0-1 tuple or list?

  • getTemperature (float) – the temperature value in kelvin 6500.0 for example

  • getTempOnOff (bool) – Is the temperature value being used on this light?

  • getShape (return) – return the type of geometric shape, rectangle, sphere etc? Usually an int, see other functions

  • getNormalize (bool) – Is the light normalized? (size doesn’t affect intensity)

  • getLightVisible (bool) – Can the light be seen in the scene? Arnold doesn’t support this.

  • getScale (bool) – the physical scale of the light as a tuple/list

Return lightDictGenericValues:

A nested dict of attribute value dictionaries, with lightShapes as keys

Rtype lightDictGenericValues:

dict

getLightAttrSelected(getIntensity=False, getExposure=False, getColor=False, getTemperature=False, getTempOnOff=False, getShape=False, getNormalize=False, getLightVisible=False, getScale=False, message=False)

Gets the first selected area light’s current attribute value/s as per the kwargs Returns as a dictionary with None as the attribute value if it hasn’t been requested The returned dict is in generic format

Parameters:
  • getIntensity (bool) – return the intensity Value?

  • getExposure (bool) – return Exposure Value if it exists?

  • getColor (bool) – return the color as (0.1, 0.1, 1.0) 0-1 tuple or list?

  • getTemperature (float) – the temperature value in kelvin 6500.0 for example

  • getTempOnOff (bool) – Is the temperature value being used on this light?

  • getShape (return) – return the type of geometric shape, rectangle, sphere etc? Usually an int, see other functions

  • getNormalize (bool) – Is the light normalized? (size doesn’t affect intensity)

  • getLightVisible (bool) – Can the light be seen in the scene? Arnold doesn’t support this.

  • getScale (bool) – the physical scale of the light as a tuple/list

  • getScale – the physical scale of the light as a tuple/list

  • message (bool) – report the messages to the user?

Return attrValDict:

The dictionary of light attribute values in generic format, not renderer

Rtype attrValDict:

dict

getDirectionalAttr(lightShape, getIntensity=True, getColor=True, getTemperature=True, getTempOnOff=True, getAngleSoft=True, getRotation=True)

Gets the current value/s of the directional light as per the kwargs Returns as a dictionary with None as the attribute value if it hasn’t been requested The returned dict is in generic format

Parameters:
  • lightShape (str) – the light shape node name

  • getIntensity (bool) – return the intensity Value?

  • getColor (bool) – return the color as (0.1, 0.1, 1.0) 0-1 tuple or list?

  • getTemperature (float) – the temperature value in kelvin 6500.0 for example

  • getTempOnOff (bool) – Is the temperature value being used on this light?

  • getAngleSoft (bool) – get the directional softness (angle) value

  • getRotation (bool) – the rotation of the directional light as a tuple/list

Return attrValDict:

The dictionary of light attribute values in generic format, not renderer

Rtype attrValDict:

dict

getDirectionalAttrList(lightShapeList, getIntensity=True, getColor=True, getTemperature=True, getTempOnOff=True, getAngleSoft=True, getRotation=True)

Returns a nested dictionary when each key is the is a directional lightShape name. Each value is generic dictionaries of attribute values of the directional lightShape

Parameters:
  • lightShapeList (list) – list of directional light shape node names

  • getIntensity (bool) – return the intensity Value?

  • getColor (bool) – return the color as (0.1, 0.1, 1.0) 0-1 tuple or list?

  • getTemperature (float) – the temperature value in kelvin 6500.0 for example

  • getTempOnOff (bool) – Is the temperature value being used on this light?

  • getAngleSoft (bool) – get the directional softness (angle) value

  • getRotation (bool) – the rotation of the directional light as a tuple/list

Return directionalDictGenericValues:

A nested dict of attribute value dictionaries, with lightShapes as keys

Return type:

dict

getDirectionalAttrSelected(rendererNiceName, getIntensity=True, getColor=True, getTemperature=True, getTempOnOff=True, getAngleSoft=True, getRotation=True, message=True, returnFirstLight=False)

From the slected directional lights, returns a nested dictionary when each key is the is a directional lightShape name. Each value is generic dictionaries of attribute values of the directional lightShape

Parameters:
  • getIntensity (bool) – return the intensity Value?

  • getColor (bool) – return the color as (0.1, 0.1, 1.0) 0-1 tuple or list?

  • getTemperature (float) – the temperature value in kelvin 6500.0 for example

  • getTempOnOff (bool) – Is the temperature value being used on this light?

  • getAngleSoft (bool) – get the directional softness (angle) value

  • getRotation (bool) – the rotation of the directional light as a tuple/list

  • message (bool) – return messages due to selection to the user?

  • returnFirstLight (bool) – returns only the attr dict from the first light selected

Return directionalDictGenericValues:

A nested dict of attribute value dictionaries, with lightShapes as keys

Return type:

dict

getLightAttrFromLocator(locatorTransform, rendererNiceName=None)

From the given locator retrieve a single generic light dict returned dict includes the custom light attributes with translation, scale and rotation attributes as well

Parameters:

locatorTransform (str) – a generic light locator name “_lgtLc” with the custom light attributes

Returns:

A dict with attributes and values for one light only

Return type:

dict

getLightAttrFromLocatorList(locatorTransformList, rendererNiceName=None)

retrieves the attributes of a list of “_lgtLc” locators and puts them in a nested dictionary multiLightDict keys are the locator names minus the suffix, multiLightDict values is a dictionary of attributes and with attrValues

Parameters:

locatorTransformList (list[str]) – list of generic light locator names “_lgtLc”

Returns:

a nested dictionary of locator names and then attributes and attrValues

Return type:

dict

getLightAttrFromLocatorSelected()

from selected light-locators in the scene retrieve their values and return as a nested dict multiLightDict keys are the locator names minus the suffix, multiLightDict values is a dictionary of attributes and with attrValues

Return multiLightDict:

a nested dictionary of locator names and then attributes and attrValues

Rtype multiLightDict:

dict

getLightAttrFromLocatorScene(rendererNiceName, message=True)

from all area lights in the scene of the given renderer self.renderer retrieve their values and return as a nested dict

multiLightDict keys are the locator names minus the suffix, multiLightDict values is a dictionary of attributes and with attrValues This function returns rotation and translate values in world coords

Parameters:

rendererNiceName (str) – the renderer nice name “Redshift”, “Arnold”, “Renderman”

Return multiLightDict:

a nested dictionary of locator names and then attributes and attrValues

Rtype multiLightDict:

dict

getLightAttrFromLightSelected(rendererNiceName, includeSelChildren=False, message=True)

from the selected area lights in the scene of the given renderer self.renderer retrieve their values and return as a nested dict multiLightDict keys are the locator names minus the suffix, multiLightDict values is a dictionary of attributes and with attrValues

Parameters:

rendererNiceName (str) – the renderer nice name “Redshift”, “Arnold”, “Renderman”

Return multiLightDict:

a nested dictionary of locator names and then attributes and attrValues

Rtype multiLightDict:

dict

setLightAttr(lightShape, attrValDict, ignoreIntensity=False)

Sets the lights attributes as passed in from the dict generic “attrValDict” for area lights This function does all the checking and converting to set the attributes correctly for the renderer is auto found from the light shape.

Note

This will pop dict values, so any reusable dicts should be duplicated before passing in data

Parameters:
  • lightShape (str) – The name of the light shape

  • attrValDict (dict) – the incoming generic dictionary, None values will be ignored

  • ignoreIntensity (bool) – Only for Redshift if setting as pure exposure, this needs to be set to convert Redshift

Returns:

Should warnings be displayed to the user? Ie have warnings occurred? could be multiple

Return type:

bool

setLightAttrSelected(attrValDict, ignoreIntensity=False)

Sets the lights attributes as passed in from the dict generic “attrValDict” on selected lights This function does all the checking and converting to set the attributes correctly for the renderer is auto found from the selection.

Note

This will pop dict values, so any reusable dicts should be duplicated before passing in data

Parameters:
  • attrValDict (dict) – the incoming generic dictionary, None values will be ignored

  • ignoreIntensity (bool) – Only for Redshift if setting as pure exposure, this needs to be set to convert Redshift

setDirectionalAttr(lightShape, rendererNiceName, attrValDict)

sets the attributes for directional lights. sets automatically from the attrValDict, in dict key values are None then skips the setting

Parameters:
  • lightShape (str) – the lightShape node name to be set

  • rendererNiceName (str) – the renderer nice name “Redshift”, “Arnold”, “Renderman”

  • attrValDict (dict) – the incoming generic dictionary with attribute values, None values will be ignored

setDirectionalAttrSelected(attrValDict, rendererNiceName, ignoreIntensity=False)

Sets the directional lights attributes as passed in from the dict generic “attrValDict” on selected lights This function does all the checking and converting to set the attributes correctly for the renderer is auto found from the selection.

Note

This will pop dict values, so any reusable dicts should be duplicated before passing in data

Parameters:
  • attrValDict (dict) – the incoming generic dictionary, None values will be ignored

  • ignoreIntensity (bool) – Only for Redshift if setting as pure exposure, this needs to be set to convert Redshift

getIblAttr(lightShape, getIntensity=True, getExposure=True, getColor=True, getLightVisible=True, getIblTexture=True, getTranslation=True, getRotation=True, getScale=True)

gets attributes in generic format from IBL Skydome lightshape, multi renderer compatible

Parameters:
  • lightShape (str) – name of the light’s shape node

  • getIntensity (bool) – get the intensity value and add to the returned dict?

  • getExposure (bool) – get exposure value and add to the returned dict?

  • getColor (bool) – get color and add to the returned dict rgb? (0.1, 1.0, 0.5)

  • getLightVisible (bool) – get light visibility and add to the returned dict?

  • getIblTexture (bool) – get the full file path of the IBL texture and add to the returned dict?

  • getTranslation (bool) – get translation and add to the returned dict?

  • getRotation (bool) – get rotation and add to the returned dict?

  • getScale (bool) – get rotation and add to the returned dict?

Return attrValDict:

dictionary with updated values, unused attributes will be None

Rtype attrValDict:

dict

getIblAttrSelected(rendererNiceName, getIntensity=True, getExposure=True, getColor=True, getLightVisible=True, getIblTexture=True, getTranslation=True, getRotation=True, getScale=True, message=True)

Gets the first selected IBL light’s attribute values and returns as a dict Unused values are stored as None

Parameters:
  • getIntensity (bool) – get the intensity value and add to the returned dict?

  • getExposure (bool) – get exposure value and add to the returned dict?

  • getColor (bool) – get color and add to the returned dict rgb? (0.1, 1.0, 0.5)

  • getLightVisible (bool) – get light visibility and add to the returned dict?

  • getIblTexture (bool) – get the full file path of the IBL texture and add to the returned dict?

  • getTranslation (bool) – get translation and add to the returned dict?

  • getRotation (bool) – get rotation and add to the returned dict?

  • getScale (bool) – get rotation and add to the returned dict?

  • message (bool) – report the message to the user?

Return attrValDict:

dictionary with updated values, unused attributes will be None

Rtype attrValDict:

dict

zooHdriPaths()

Returns all the HDRI paths that is being used by zoo tools.

Return hdriPaths:

A list of all the folder paths in the skydome zoo preferences

Rtype hdriPaths:

list(str)

checkIBLTextureFound(iblTexturePath)

Checks if the IBL path exists, if it doesn’t check to see if the file exists in the HDRI Zoo Prefs folders.

Parameters:

iblTexturePath (str) – the full path with the file to the ibl texture

Return iblTexturePath:

the ibl path if not found & in the prefs direct then will be a new path

Rtype iblTexturePath:

str

iblRotate(lightTransform, renderer='Arnold')

Gets the rotation of a IBL Skydome light

Parameters:

lightTransform (str) – The transform node of the IBL Skydome

Return rotate:

Absolute rotation value in degrees [x, y, z]

Rtype rotate:

list(float)

setIblRotate(lightTransform, rotate, renderer='Arnold')

Sets the rotation of a IBL Skydome light

Parameters:
  • lightTransform (str) – The transform node of the IBL Skydome

  • rotate (list(float)) – Absolute rotation value in degrees [x, y, z]

setIblAttr(lightShape, attrValDict, invertScaleZ=False)

Given a shape node, it will set the attributes of an IBL, HDRI Skydome light from the attrValDict dictionary Automatically detects the renderer from the light node

Parameters:
  • lightShape (str) – The light shape node of the IBL light

  • attrValDict (dict) – The generic attribute dictionary of the light

  • invertScaleZ (bool) – Will invert the scale of the light causing the texture to display backwards

setIBLAttrList(attrValDict, iblShapeList, invertScaleZ=False)

Sets the attributes to a list of IBLs

Parameters:
  • attrValDict (str) – The generic attribute dictionary of the light

  • invertScaleZ (bool) – Will invert the scale of the light causing the texture to display backwards

  • iblShapeList (list) – a list of valid IBL nodes

setIblAttrSelected(attrValDict, invertScaleZ=False)

Sets the attributes of an IBL, HDRI Skydome light from the attrValDict dictionary Works on the selected ibl light Automatically detects the renderer from the light node Automatically detects if the select contains a valid IBL dome light

Parameters:
  • attrValDict (str) – The generic attribute dictionary of the light

  • invertScaleZ (bool) – Will invert the scale of the light causing the texture to display backwards

setIblAttrAuto(attrValDict, rendererNiceName, invertScaleZ=False, findUnselected=True, autoCreate=True, createName='skydomeLight', prioritizeName='', addSuffix=True, returnFirstObj=False, message=True)

intelligently sets the attributes of ibl lights on the selected IBLs with the following options:

prioritizeName: will include this obj name even if it’s not selected (usually from a GUI) findUnselected: will return a light if none found and only one light exists in the scene returnFirstObj: will return the first obj found (usually for GUI) includeSelChildren: will search the children of the selected objs autoCreate: will automatically create a light if none found, be careful setting other kwargs if True

Note

getIblLightSelected() does something very similar to this function, it just doesn’t set the light attributes

Parameters:
  • attrValDict (str) – The generic attribute dictionary of the light

  • rendererNiceName (str) – the renderer nice name “Redshift”, “Arnold”, “Renderman”

  • invertScaleZ (bool) – Will invert the scale of the light causing the texture to display backwards

  • findUnselected (bool) – if nothing is selected will try to find the only light in the scene

  • autoCreate (bool) – will automatically create a light if none found, be careful setting other kwargs if True

  • createName (bool) – if autoCreate is True then this is the name of the light to be created

  • prioritizeName (bool) – tries to select this light as a priority from the GUI, will also include other lights

  • addSuffix (bool) – add the light suffix from the renderer _ARN etc

  • returnFirstObj (bool) – will return only the first obj found (usually for GUI)

  • message (bool) – report a message to the user in case of error

setLightTransformDict(lightTransform, attrDictGenericValues)

Sets the lights translate, rotation and scale from the attrDictGenericValues Also pops the values from the dict so they aren’t in the dict for the shape node setting

Parameters:
  • lightTransform (str) – the transform node name of a single light

  • attrDictGenericValues (dict) – generic light dictionary of attributes and values

Return attrDictGenericValues:

generic light dictionary of attributes and values, now missing trans rot scale

Rtype attrDictGenericValues:

dict

mergeLightShapesTransforms(areaLightTransformList, areaLightShapeList, directionalLightTransformList, directionalLightShapeList, skyDomeTransformList, skydomeShapeList)

Takes shapes and transforms and returns only the combined shape lists for each light type

Parameters:
  • areaLightTransformList (list) – list of area light transform node names

  • areaLightShapeList (list) – list of area light shape node names

  • directionalLightTransformList – list of directional light transform node names

  • directionalLightShapeList (list) – list of directional light shape node names

  • skyDomeTransformList (list) – list of skydome light transform node names

  • skydomeShapeList (list) – list of skydone light shape node names

Return directionalLightShapeList:

List of directional light shapes in the scene

Rtype directionalLightShapeList:

list

Return skyDomeTransformList:

List of skyDome light Transforms in the scene

Rtype skyDomeTransformList:

list

Return skydomeShapeList:

List of skyDome light Shapes in the scene

Rtype skydomeShapeList:

list

filterIblLightInList(nodeList)

Finds ibl light shapes in a list, returns empty list if None

Parameters:

nodeList (list) – maya node list

Return iblShapeList:

list of ibl shapes

Rtype iblShapeList:

list

filterIblLightInListRenderer(nodeList, rendererNiceName)

Finds ibl light shapes in a list and checks if they are a match with the rendererNiceName returns empty list if None

Parameters:
  • nodeList (list) – maya node list

  • rendererNiceName (str) – the renderer nice name “Redshift”, “Arnold”, “Renderman”

Return iblShapeList:

list of ibl shapes

Rtype iblShapeList:

list

getAreaLightShapesInScene(rendererNiceName, long=True)

gets all area lights in the scene from the given renderer returns a list of light shape nodes keeps long names if long=True

Parameters:

rendererNiceName (str) – nice name of the renderer “Redshift”, “Arnold” etc

Returns:

a list of area light shape nodes in the scene

Return type:

list

getAllAreaLightsInScene(rendererNiceName, long=True)

gets all the area light transforms and shapes in the scene for the current renderer returns lightsTransformList and lightsShapeList

Parameters:
  • rendererNiceName (str) – nice name of the renderer “Redshift”, “Arnold” etc

  • long (bool) – return long names

Return areaLightTransformList:

list of names of the light transform nodes

Rtype areaLightTransformList:

list

Return areaLightShapeList:

list of names of the light shape nodes

Rtype areaLightShapeList:

list

getSelectedAreaLights(rendererNiceName, message=True, prioritizeName='')

Returns only the selected area lights of the given renderer, also supports shape nodes

Parameters:
  • rendererNiceName (str) – nice name of the renderer “Redshift”, “Arnold” etc

  • message (bool) – Show the warning messages to the user

  • prioritizeName (bool) – tries to select this light as a priority from the GUI, will also include other lights

Return lightTransformList:

list of filtered light transforms given the renderer and selection

Rtype lightTransformList:

list

Return lightShapeList:

list of filtered light shape nodes given the renderer and selection

Rtype lightShapeList:

list

findFirstIblLight(nodeList, prioritizeName='')

Returns the first ibl light found in a list, for GUI displays.

Parameters:

nodeList (list) – list of Maya nodes, can be shapes or transforms, any nodes

Return obj:

will be one shape node that is an IBL light

Rtype obj:

str

getIblFromSelectedOrScene(rendererNiceName, includeSelChildren=False, returnFirstObj=False, prioritizeName='', findUnselected=True)

Finds an IBL Light from selected and if findUnselected=True then finds IBLs from the scene

TODO: note this function is depreciated and should use getIblLightSelected() see that function for docs

Only returns the shape list, not transforms

getIblLightSelected(rendererNiceName, includeSelChildren=False, prioritizeName='', returnFirstObj=True, findUnselected=True)

Smart function which intelligently returns an iblTransform list and iblShapes list from the selection with a number of options:

prioritizeName: will include this obj name even if it’s not selected (usually from a GUI) findUnselected: will return a light if none found and only one light exists in the scene returnFirstObj: will return the first obj found (usually for GUI) includeSelChildren: will search the children of the selected objs

Parameters:
  • rendererNiceName (str) – the renderer nicename “Arnold” etc

  • includeSelChildren (str) – will include all children in the hierarchy of the selected objs

  • prioritizeName (str) – tries to select this light as a priority from the GUI

  • returnFirstObj (bool) – will only return the first object found

  • findUnselected (bool) – will return the the only light in the scene if none found and only one light exists

Return iblTransformList:

list of IBL transform nodes

Rtype iblTransformList:

list

Return iblShapeList:

list of IBL shape nodes

Rtype iblShapeList:

list

getIBLLightsInScene(rendererNiceName, long=True)

returns all ibl lights as shape nodes in the scene given the renderer nice name

Parameters:

rendererNiceName (str) – the renderer nice name “Redshift”, “Arnold”, “Renderman”

Return iblShapeList:

list of ibl shapes for the renderer

Rtype iblShapeList:

list

getAllIblSkydomeLightsInScene(rendererNiceName, long=True)

Gets all IBL skydome lights in the scene from the given renderer Returns both shape and transform node lists

Parameters:

rendererNiceName (str) – nice name of the renderer “Redshift”, “Arnold” etc

Return iblSkydomeTransformList:

list of names of the IBL light transform nodes

Rtype iblSkydomeTransformList:

list

Return iblSkydomeShapeList:

list of names of the IBL light shape nodes

Rtype iblSkydomeShapeList:

list

getAllDirectionalShapesInScene(rendererNiceName, long=True)

gets all directional lights in the scene from the given renderer returns a list of light shape nodes keeps long names if not unique

Parameters:

rendererNiceName (str) – nice name of the renderer “Redshift”, “Arnold” etc

Return lightsShapeList:

a list of directional light shape nodes in the scene

Rtype lightsShapeList:

list

getAllDirectionalLightsInScene(rendererNiceName, forceUniqueNames=False)

gets all directional lights in the scene from the given renderer returns a list of light shape nodes force unique names, will rename lights to be unique otherwise keeps long names if not unique

Parameters:
  • rendererNiceName (str) – nice name of the renderer “Redshift”, “Arnold” etc

  • forceUniqueNames (bool) – names will be returned as long, if this is on, names will be renamed to unique

Return lightsShapeList:

a list of area light shape nodes in the scene

Rtype lightsShapeList:

list

getSelectedDirectionalLights(rendererNiceName, message=True, returnIfOneDirectional=True, includeSelChildren=False, prioritizeName='', returnFirstLight=False)

Returns only the selected directional lights of the given renderer, also supports shape nodes

Parameters:
  • rendererNiceName (str) – nice name of the renderer “Redshift”, “Arnold” etc

  • message (bool) – Show the warning messages to the user

  • returnIfOneDirectional (bool) – if None selected and only 1 directional light in the scene return it

  • includeSelChildren (bool) – if True will search the hierarchy of the selected objects too

  • prioritizeName (bool) – tries to select this light as a priority from the GUI, will also include other lights

  • returnFirstLight (bool) – returns only the attr dict from the first light selected

Return lightTransformList:

list of filtered light transforms given the renderer and selection

Rtype lightTransformList:

list

Return lightShapeList:

list of filtered light shape nodes given the renderer and selection

Rtype lightShapeList:

list

getAllLightsInScene(rendererNiceName)

Retrieves all lights of type:

area
directional
IBL skydome

Given the renderer in the current scene

Parameters:

rendererNiceName (str) – nice name of the renderer “Redshift”, “Arnold” etc

Return areaLightTransformList:

List of area light transforms in the scene

Rtype areaLightTransformList:

list

Return areaLightShapeList:

List of area light shapes in the scene

Rtype areaLightShapeList:

list

Return directionalLightTransformList:

List of directional light transforms in the scene

Rtype directionalLightTransformList:

list

Return directionalLightShapeList:

List of directional light shapes in the scene

Rtype directionalLightShapeList:

list

Return skyDomeTransformList:

List of skyDome light Transforms in the scene

Rtype skyDomeTransformList:

list

Return skydomeShapeList:

List of skyDome light Shapes in the scene

Rtype skydomeShapeList:

list

getAllLightShapesInScene(rendererNiceName, forceUniqueName=False)

Retrieves all lights of type given the renderer in the current scene:

Area Directional IBL Skydome

Will auto-rename non unique names returns light shapes only

Parameters:

rendererNiceName (str) – nice name of the renderer “Redshift”, “Arnold” etc

Return directionalLightShapeList:

List of directional light shapes in the scene

Rtype directionalLightShapeList:

list

Return skyDomeTransformList:

List of skyDome light Transforms in the scene

Rtype skyDomeTransformList:

list

Return skydomeShapeList:

List of skyDome light Shapes in the scene

Rtype skydomeShapeList:

list

filterAllLightTypesFromSelection(rendererNiceName, message=True)

From the current selection return all light types from the given renderer Will force rename of non unique names return shapes and transforms

Parameters:
  • rendererNiceName (str) – nice name of the renderer “Redshift”, “Arnold” etc

  • message (bool) – report the message to the user?

Return areaLightTransformList:

List of area light transforms filtered from selection

Rtype areaLightTransformList:

list

Return areaLightShapeList:

List of area light shapes filtered from selection

Rtype areaLightShapeList:

list

Return directionalLightTransformList:

List of directional light transforms filtered from selection

Rtype directionalLightTransformList:

list

Return directionalLightShapeList:

List of directional light shapes filtered from selection

Rtype directionalLightShapeList:

list

Return skyDomeTransformList:

List of skyDome light Transforms filtered from selection

Rtype skyDomeTransformList:

list

Return skydomeShapeList:

List of skyDome light Shapes filtered from selection

Rtype skydomeShapeList:

list

filterAllLightShapesFromSelection(rendererNiceName, message=True)

From the current selection return all light shapes from the given renderer

Parameters:
  • rendererNiceName (str) – nice name of the renderer “Redshift”, “Arnold” etc

  • message (bool) – report the message to the user?

Return areaLightShapeList:

List of area light shapes in the scene

Rtype areaLightShapeList:

list

Return directionalLightShapeList:

List of directional light shapes in the scene

Rtype directionalLightShapeList:

list

Return skydomeShapeList:

List of skyDome light Shapes in the scene

Rtype skydomeShapeList:

list

rotIblLight(iblShape, rotOffset)

Rotates an IBL light in the scene from it’s shape node

Parameters:
  • iblShape (str) – The single IBL light to rotate, must be the shape node name only

  • rotOffset (float) – The amount to rotate the IBL light by in degrees

rotIblLightSelectedScene(rendererNiceName, rotOffset)

Rotates selected IBL lights in the scene by the rotOffset

Parameters:
  • rendererNiceName (str) – The nice name of the renderer ie “Arnold” or “Redshift” etc

  • rotOffset (float) – the amount to rotate the IBL light by in degrees

rotLightGrp(rendererNiceName, rot, setExactRotation=False)

Rotates the light group, usually named “ArnoldLights_grp” or similar in the current scene

Looks for the name depending on the renderer, otherwise isn’t very intelligent

Parameters:
  • rendererNiceName (str) – The nice name of the renderer ie “Arnold” or “Redshift” etc

  • rot (float) – the amount to rotate offset from current value unless the setExactRotation flag is on

  • setExactRotation (float) – will not offset the rotation, will set rotation to the exact value

getLightNormalizeValue(lightShapeNode)
convertNormalizeRenderer(newNormalizeVal, intensity, exposure, shapeInt, scale, rendererNiceName, convertAsIntensity=False, account2xScale=True)

Function for calculating the convert normalization of lights by the renderer, usually for the UI values

uses generic light data returns the converted intensity and exposure values

Parameters:
  • newNormalizeVal (bool) – is normalize being changed to on or off?

  • intensity (float) – intensity value of the area light

  • exposure (float) – exposure value of the area light

  • shapeInt (int) – the shape of the area light as a generic value int

  • scale (tuple(float)) – the scale of the area light

  • rendererNiceName (str) – The nicename of the renderer “Arnold” or “Redshift” etc

  • convertAsIntensity (bool) – Converts the light value as intensity and not exposure

  • account2xScale (bool) – generic lights are scaled two times the area at a value of 1, True multiplies intensity by 2

Return intensity:

the returned intensity value will be 1

Rtype intensity:

float

Return exposure:

the returned exposure value now normalized

Rtype exposure:

float

convertNormalize(lightTransform, newNormalizeVal, applyAsIntensity=True, renderer='')

Converts the normalization of a single area light for multiple renderers.

Calculates the surface area of the current light shape and the raw light scale in the world (not local)

Scale is calculated by xform world space, lights should not be parented or reparented

Parameters:
  • lightTransform (str) – The light transform name

  • newNormalizeVal (bool) – is normalize being changed to on or off?

  • applyAsIntensity (bool) – Applies the light value as intensity and not exposure

  • renderer (str) – The renderer nice name, is optional and can be left out, matters for “Renderman” only

Return success:

Did the light get coverted?

Return type:

bool

convertNormalizeList(lightTransformList, newNormalizeVal, applyAsIntensity=True, renderer='')

Converts the normalization of an area light list for any renderers.

This is achieved by unparenting the light into world, and recording the scale values of the light before reparenting back under the original parent.

Parameters:
  • lightTransformList (list) – list of light transform node names

  • newNormalizeVal (bool) – is normalize being changed to on or off?

  • applyAsIntensity (bool) – Applies the light value as intensity and not exposure

  • renderer (str) – The renderer nice name, is optional and can be left out, matters for “Renderman” only

Return success:

Did the light get converted?

Return type:

bool

convertToNormalizeSelected(newNormalizeVal, applyAsIntensity=True, renderer='')

Converts the normalization of selected area light/s for multiple renderers.

Parameters:
  • newNormalizeVal (bool) – is normalize being changed to on or off?

  • applyAsIntensity (bool) – Applies the light value as intensity and not exposure

Return success:

Did the light get coverted?

Return type:

bool

loadRenderer(renderer)
createAreaLight(renderer='Auto', name='areaLight', exposure=16.0, intensity=1.0, addSuffix=True, position='selected', color=(1.0, 1.0, 1.0), tempBool=False, temp=6500.0, shape=0, visibility=False, normalize=True, scale=(20.0, 20.0, 20.0))

Creates a new area light with optional renderer and settings.

Checks renderer is loaded with a popup if not.

Parameters:
  • renderer (str) – “Auto” uses the Zoo primary renderer, “Redshift”, “Arnold” or “Renderman”

  • name (str) – The name of the light to be created

  • exposure (float) – The exposure value

  • intensity (float) – The intensity value

  • addSuffix (bool) – Add a suffix to the light name?

  • position (str) – “world” world center, “selected” selected object pos/rot, “camera” drop at camera position

  • color (tuple(float)) – The rgb color of the light if not in temperature mode

  • tempBool (bool) – Is the temperature mode active?

  • temp (float) – The temperature value in degrees kelvin

  • shape (int) – “rectangle” 0 “disc” 1 “sphere” 2 “cylinder” 3

  • visibility (bool) – Is the light visible or not?

  • scale (tuple(float)) – The scale values of the light in x y z

Returns:

The transform and shape names

Return type:

tuple(str)

createDirectionalLight(renderer='Auto', name='directionalLight', addSuffix=True, position='selected', intensity=1.0, tempBool=False, temp=6500.0, translate=(0.0, 0.0, 0.0), rotate=(-45.0, -45.0, 0.0), scale=(5.0, 5.0, 5.0), softAngle=2.0)

Creates a new directional light with optional renderer and settings.

Checks renderer is loaded with a popup if not.

Parameters:
  • renderer (str) – “Auto” uses the Zoo primary renderer, “Redshift”, “Arnold” or “Renderman”

  • name (str) – The name of the light to be created

  • intensity (float) – The intensity value

  • addSuffix (bool) – Add a suffix to the light name?

  • rotate (tuple(float)) – The orientation of the light in x y z

  • softAngle (float) – The soft angle (shadow blur) value of the light

Returns:

The transform and shape names

Return type:

tuple(str)

createHdriLight(renderer='Auto', name='hdriSkydomeLight', addSuffix=True, intensity=1.0, exposure=0.0, translate=(0.0, 0.0, 0.0), rotate=(0.0, 0.0, 0.0), scale=(1.0, 1.0, 1.0), path='', visible=False, invertScale=False)

Creates a new hdri skydome light with optional renderer and settings.

Checks renderer is loaded with a popup if not.

Parameters:
  • renderer (str) – “Auto” uses the Zoo primary renderer, “Redshift”, “Arnold” “VRay”, or “Renderman”.

  • name (str) – The name of the light to be created

  • intensity (float) – The intensity value

  • addSuffix (bool) – Add a suffix to the light name?

  • translate (tuple(float)) – The translation of the light in x y z

  • rotate (tuple(float)) – The orientation of the light in x y z

  • scale (tuple(float)) – The scale of the light in x y z

  • path (str) – The full path to the hdri image texture

  • visible (bool) – Is the image visible in the background?

  • invertScale (bool) – Invert the scale? reverse the image?

Returns:

The transform and shape names

Return type:

tuple(str)

createAreaLightFromDict(attrDictGenericValues, rendererNiceName, lightName='areaLight', replaceLight=False, cleanup=True)

builds an area light from a dictionary, makes the fixes given the renderer type

Parameters:
  • lightName (str) – the lights name to be created

  • attrDictGenericValues (dict) – generic light dictionary of attributes and values

Return lightTransform:

the light transform node

Rtype lightTransform:

str

Return lightShape:

the light shape node

Rtype lightShape:

str

createDirectionalLightRenderer(name, renderer, warningState=False, forceGimbalZXY=True)

Creates a directional light for the given renderer

Parameters:

renderer (str) – the renderer nice name “Redshift”, “Arnold”, “Renderman”

Return lightTransformName:

the name of the light (transform node)

Rtype lightTransformName:

str

Return shapeNodeName:

the name of the shape node

Rtype shapeNodeName:

str

createLightRenderer(name, renderer, warningState=False, addSuffix=False, replaceLight=False)

Creates a physical area light for the given renderer

Parameters:
  • name (str) – the name of the light that will be created

  • renderer (str) – the renderer nice name “Redshift”, “Arnold”, “Renderman”

  • warningState (str) – mark warning bool on if issues have already been encountered

  • addSuffix (bool) – add the suffix for the light usually as per the renderer

  • replaceLight (bool) – replace the light if one already exists with the same name

Return lightTransformName:

the name of the light (transform node)

Rtype lightTransformName:

str

Return shapeNodeName:

the name of the shape node

Rtype shapeNodeName:

str

Return warningState:

display a warning bool on if issues encountered

Rtype warningState:

bool

createAreaLightMatchPos(name, renderer, warningState=False, addSuffix=False, replaceLight=False, position='world')

Creates a physical area light for the given renderer and place it with options

Position can be:

“world” create at the world center “selected” create at the same position as the selected object “camera” drop from the camera position

Parameters:
  • name (str) – the name of the light that will be created

  • renderer (str) – the renderer nice name “Redshift”, “Arnold”, “Renderman”

  • warningState (str) – mark warning bool on if issues have already been encountered

  • addSuffix (bool) – add the suffix for the light usually as per the renderer

  • replaceLight (bool) – replace the light if one already exists with the same name

  • position (str) – “world” world center, “selected” selected object pos/rot, “camera” drop at camera position

Return lightTransformName:

the name of the light (transform node)

Rtype lightTransformName:

str

Return shapeNodeName:

the name of the shape node

Rtype shapeNodeName:

str

Return warningState:

display a warning bool on if issues encountered

Rtype warningState:

bool

createLightFromLoc(locator, rendererNiceName, replaceLight=True, cleanup=True)

Will build an area light in the renderer type from a given generic locator Locator must have the light information attributes

Parameters:
  • locator (str) – the generic locator name, locator must have with light information

  • rendererNiceName (str) – the renderer nice name “Redshift”, “Arnold”, “Renderman”

  • replaceLight (bool) – Replace existing lights if true, otherwise will build with a new name

  • cleanup (bool) – grp the lights into the renderer group?

Return lightTransform:

The lights transform node name

Rtype lightTransform:

str

Return lightShape:

The lights shape node name

Rtype lightShape:

str

createLightFromLocList(locatorList, rendererNiceName, replaceLight=True, cleanup=True)

Builds a list of area light in the renderer type from a given generic locator list Locators must have the light information attributes

Parameters:
  • locatorList (list) – the generic locator name, locator must have with light information

  • rendererNiceName (str) – the renderer nice name “Redshift”, “Arnold”, “Renderman”

  • replaceLight (bool) – Replace existing lights if true, otherwise will build with a new name

  • cleanup (bool) – grp the lights into the renderer group?

Return lightTransformList:

The lights transform node name

Rtype lightTransformList:

str

Return lightShapeList:

The lights shape node name

Rtype lightShapeList:

str

createAreaLightsFromAllLocs(rendererNiceName)

finds all the generic area light locators in the scene and builds lights with the current renderer type

Parameters:

rendererNiceName (str) – the renderer nice name “Redshift”, “Arnold”, “Renderman”

Return lightTransformList:

The lights transform node name

Rtype lightTransformList:

str

Return lightShapeList:

The lights shape node name

Rtype lightShapeList:

str

createDirectionalDictRenderer(attrGenericDict, lightName, rendererNiceName, warningState=False, cleanup=False, setZXY=True, suffix=True)

Creates a directional light for the given renderer from a attribute dict

Parameters:
  • warningState (bool) – if warnings have happened report them

  • cleanup (bool) – will put the lights into an appropriate group named by the renderer name

  • setZXY (bool) – will create the IBL with a default rotation order of ZXY which is generally better

Return lightTransformName:

the name of the light (transform node)

Rtype lightTransformName:

str

Return shapeNodeName:

the name of the shape node

Rtype shapeNodeName:

str

Return warningState:

has the warning state been activated?

Rtype warningState:

bool

createDirectionalLightMatchPos(attrGenericDict, lightName, rendererNiceName, warningState=False, cleanup=False, setZXY=True, suffix=True, position='world')

Creates a directional light for the given renderer and place it with options

Position can be:

“world” create at the world center “selected” create at the same position as the selected object “camera” drop from the camera position

Parameters:
  • rendererNiceName (str) – the renderer nice name “Redshift”, “Arnold”, “Renderman”

  • warningState (bool) – if warnings have happened report them

  • cleanup (bool) – will put the lights into an appropriate group named by the renderer name

  • setZXY (bool) – will create the IBL with a default rotation order of ZXY which is generally better

  • position (str) – “world” world center, “selected” selected object pos/rot, “camera” drop at camera position

Return lightTransformName:

the name of the light (transform node)

Rtype lightTransformName:

str

Return shapeNodeName:

the name of the shape node

Rtype shapeNodeName:

str

Return warningState:

has the warning state been activated?

Rtype warningState:

bool

createSkydomeLightRenderer(name, renderer, warningState=False, cleanup=False, setZXY=True)

Creates a skydome light for the given renderer

Parameters:
  • name (str) – the name of the light to be created

  • renderer (str) – the renderer nice name “Redshift”, “Arnold”, “Renderman”

  • warningState (bool) – if warnings have happened report them

  • cleanup (bool) – will put the lights into an appropriate group named by the renderer name

  • setZXY (bool) – will create the IBL with a default rotation order of ZXY which is generally better

Return lightTransformName:

the name of the light (transform node)

Rtype lightTransformName:

str

Return shapeNodeName:

the name of the shape node

Rtype shapeNodeName:

str

Return warningState:

has the warning state been activated?

Rtype warningState:

bool

createSkydomeLightDictRenderer(attrValDict, name, rendererNiceName, warningState=False, cleanup=True)

Creates a Skydome IBL HDR light for the given renderer

Parameters:
  • attrValDict (dict) – the attribute values to create the light with

  • name (str) – The name of the light to be created

  • rendererNiceName (str) – the nice name of the renderer the light will be created “Redshift”, “Arnold”, “Renderman”

  • warningState (bool) – Are there reported warnings?

  • cleanup (bool) – cleanup the lights into a tidy Maya group with the renderer name?

Return lightTransformName:

The name of the new transform node

Rtype lightTransformName:

str

Return shapeNodeName:

The name of the new shape node

Rtype shapeNodeName:

str

createAttributesLocator(locator)

creates attributes on a single locator, assumes none exist

Parameters:

locator (str) – name of a locator transform node

createMatchAttributesLocatorSingle(locator, lightTransform, rendererNiceName)

creates a single locator, adds the new attributes, sets the values of the attrs and matches trans rot scale

Parameters:

locator (str) – name of a locator transform node

uniqueLightNamesList(lightTransformList, rendererNiceName, renameDuplicates=True, message=True)

Convenience function that fixes non unique names for lights, usually used while creating light locators

Parameters:
  • lightTransformList (list(str)) – List of light transform names

  • rendererNiceName (str) – The nice name of the renderer

  • renameDuplicates (bool) – if True this function will rename

  • message (bool) – Report the message to the user

Return lightTransformList:

A list of light transforms now potentially renamed if not unique

Rtype lightTransformList:

list(str)

Return warning:

The warning type if there was one, “” if no warnings, can also be “noLights”, or “duplicate”

Rtype warning:

createLocatorForLight(lightTransform, rendererNiceName)

Creates a light-locator for a single area light given the renderer

Parameters:
  • lightTransform (str) – the lights transform node name

  • rendererNiceName (str) – the light’s shape node name

Return lightLocator:

the locator transform node name

Rtype lightLocator:

str

createLocatorForAreaLightList(lightTransformList, rendererNiceName)

Creates a light-locator for a single area light given the renderer

Parameters:
  • lightTransformList (list(str)) – a list of light transform node names

  • rendererNiceName (str) – the nice name of the renderer the light will be created “Redshift”, “Arnold”, “Renderman”

Return lightLocatorList:

a list of generic light locator transform node names

Rtype lightLocatorList:

str

createLocatorLightScene(rendererNiceName, message=True, renameDuplicates=True)

Creates a locator for each area light of a given renderer for the scene returns the locator list if it was made (None if not) and a warning Warnings are “noLights” = Couldn’t find any lights of this renderer “duplicate” = Found duplicate light names

Parameters:
  • rendererNiceName (str) – the nice name of the renderer the light will be created “Redshift”, “Arnold”, “Renderman”

  • message (bool) – report a warning message to the user

Return lightLocatorList:

a list of generic light locator transform node names

Rtype lightLocatorList:

list

Return warning:

A warning message if the operation was cancelled

Rtype warning:

str

deleteAllLightsInScene(renderer, message=True)

deletes all lights of the given renderer

Parameters:
  • renderer (str) – nice name of the renderer “Redshift”, “Arnold” etc

  • message (bool) – report the message?

Return lightsDeleted:

list of deleted light names

Rtype lightsDeleted:

list

deleteAllLightLocsInScene(message=False)

Delete all locators suffixed to “_LgtLc” Light Locators that match the lights to export light data will delete nameespace names too

Parameters:

message (bool) – report the message to the user?

Return lightLocList:

light locators deleted

Rtype lightLocList:

list

getDirectionalLightAttrDictList(directionalLightTransformList, directionalLightShapeList, rendererNiceName)

gets a ibl dict with attributes given a ibl transform and shape list for the current renderer

Parameters:
  • directionalLightTransformList (list) – list of directional light transform nodes

  • directionalLightShapeList (list) – list of directional shape nodes

  • rendererNiceName (str) – the renderer nice name “Arnold” etc

Return directionalLightAttrDict:

dictionary with the dir light transform names as keys with attribute data

Rtype directionalLightAttrDict:

dict

getDirectionalLightDictOfScene(rendererNiceName)

For all directional lights in a scene return a dictionary of generic attributes. The dictionary keys are the lightname (transform node) with the light suffix removed

Parameters:

rendererNiceName (str) – nice name of the renderer “Redshift”, “Arnold” etc

Return directionalLightAttrDict:

Dictionary of lights with their attributes in a generic dict

Rtype directionalLightAttrDict:

dict

getDirectionalDictSelected(rendererNiceName, includeSelChildren=False)

Gets a directional dictionary with attributes for the current renderer from selection.

Parameters:

rendererNiceName (str) – the renderer nicename “Arnold” etc

Returns:

The directional dictionary with lights as keys and attribute data

Return type:

dict

getIBLAttrDictList(iblTransformList, iblShapeList, rendererNiceName)

gets a ibl dict with attributes given a ibl transform and shape list for the current renderer

Parameters:
  • iblTransformList (list) – list of IBL transform nodes

  • iblShapeList (list) – list of IBL shape nodes

  • rendererNiceName (str) – the renderer nice name “Arnold” etc

Return iblSkyDomeAttributeDict:

dictionary with the ibl names as keys with attribute data

Rtype iblSkyDomeAttributeDict:

getIblDictSelected(rendererNiceName, includeSelChildren=False)

Gets a ibl dict with attributes for the current renderer from selection.

Parameters:

rendererNiceName (str) – the renderer nicename “Arnold” etc.

Returns:

the ibl dict with lights as keys and attribute data.

Return type:

dict

getIblSkydomeDictOfScene(rendererNiceName)

For all the IBL skydomes in a scene return a dictionary of generic attributes. The dictionary keys are the lightname (transform node) with the light suffix removed

Parameters:

rendererNiceName (str) – nice name of the renderer “Redshift”, “Arnold” etc

Returns:

Dictionary of lights with their attributes in a generic dict

Return type:

dict

cleanupLights(rendererNiceName, lightsTransformList, selectLights=False)

Given the list of lights group them, parent them into the appropriate group if it already exists Groups are called something like “RedshiftLights_grp”

Parameters:
  • rendererNiceName (str) – nice name of the renderer “Redshift”, “Arnold” etc

  • lightsTransformList (list) – the list of light names of the light transform nodes

  • selectLights (bool) – select the lights after grouping?

forceUniqueLightNamesScene(rendererNiceName)

Finds all lights in the scene of a Renderer and make sure they are all uniquely named for short names

If non unique names are found it will rename the lights automatically as per the settings in:

namehandling.forceUniqueShortNameList(nameList)

Parameters:

rendererNiceName (str) – The renderer nice name eg “Redshift”

getAllLightsGenericDict(rendererNiceName, getSelected=False, includeSelChildren=False)

Retrieves all the area and ibl lights in a scene, selected returns selected area lights

Note

IBLs are always on right now

Parameters:
  • rendererNiceName (str) – nice name of the renderer “Redshift”, “Arnold” etc

  • getSelected (bool) – get the selected lights (True) or all lights (False),

  • getSelected – when getSelected is True then include the hierarchy of objects selected too.

Return multiLightDict:

area lights and ibls {AREALIGHTS: areaAttrDict, IBLSKYDOMES: iblAttrList}

Rtype multiLightDict:

dict

saveJsonFile(dictionary, fullFilePath)

Saves a json file to disk

Parameters:
  • dictionary (dict) – the dictionary to save as .json

  • fullFilePath (str) – the full file path to save

saveLightsGenericJson(fullFilePath, rendererNiceName, saveSelect=False)

Saves as a .json file the selected or all lights in a scene from the given renderer Saves as the generic light dict

Note

This function should be depreciated by the exportAbcShaderLights module

Parameters:
  • fullFilePath (str) – the full file path to save

  • rendererNiceName (str) – nice name of the renderer “Redshift”, “Arnold” etc

  • saveSelect (bool) – save the selected lights (True) or all lights (False)

importLightsGenericDict(multiLightDict, rendererNiceName, selectLights=True, message=True, replaceLights=True)

imports (creates the lights) from a multiLightDict, a nested dict file that contains light data

currently supports directionals, area lights, and IBLs Will apply as in the format of the rendererNiceName

Parameters:
  • rendererNiceName (str) – nice name of the renderer “Redshift”, “Arnold” etc

  • selectLights (bool) – will select all the lights after import

Return allLightTransforms:

All the light transforms created

Rtype allLightTransforms:

list

Return allLightShapes:

All the light shape nodes created

Rtype allLightShapes:

list

convertLights(fromRenderer, toRenderer)

Converts all lights in a scene from the fromRenderer to the to renderer Currently supports area lights and IBLs only

Parameters:
  • fromRenderer (str) – the rendererNiceName to convert from

  • toRenderer (str) – the rendererNiceName to convert to

Rendermanlights

getRendermanVersion()

Returns the version number of renderman if 22 or above. Returns 21.0 if below v22 will not be accurate to the version. Possibly could use old .mel but it’s not important

Return rendermanVersionNumber:

The version number of Renderman, accurate above v22.0, otherwise is 21.0

Rtype rendermanVersionNumber:

float

createRendermanDirectionalLight(name='PxrDistantLight', normalize=True)

Creates a Renderman directional light

Parameters:
  • name (bool) – the name of the light

  • name – Rendermans light should be normalized by default in most cases for normalize

Return lightTransformName:

the name of the light (transform node)

Rtype lightTransformName:

str

Return shapeNodeName:

the name of the shape node

Rtype shapeNodeName:

str

createRendermanPxrRectLight(name='PxrRectLight')

Creates a PxrRectLight

Parameters:

name (str) – the name of the light

Return lightTransformName:

the name of the light (transform node)

Rtype lightTransformName:

str

Return shapeNodeName:

the name of the shape node

Rtype shapeNodeName:

str

createRendermanPxrSphereLight(name='PxrSphereLight')

Creates a PxrSphereLight

Parameters:

name (str) – the name of the light

Return lightTransformName:

the name of the light (transform node)

Rtype lightTransformName:

str

Return shapeNodeName:

the name of the shape node

Rtype shapeNodeName:

str

createRendermanPxrDiskLight(name='PxrDiskLight')

Creates a PxrDiskLight

Parameters:

name (str) – the name of the light

Return lightTransformName:

the name of the light (transform node)

Rtype lightTransformName:

str

Return shapeNodeName:

the name of the shape node

Rtype shapeNodeName:

str

createRendermanSkydomeLight(name='PxrDomeLight')

Creates an IBL Skydome Light

Parameters:

name (str) – the name of the light

Return lightTransformName:

the name of the light (transform node)

Rtype lightTransformName:

str

Return shapeNodeName:

the name of the shape node

Rtype shapeNodeName:

str

getAllRendermanAreaLightsInScene()

Returns any lights in the scene that may be in the global list AREALIGHTTYPES “PxrRectLight”, “PxrSphereLight”, “PxrDiskLight”

Return allLights:

all the area lights in the scene as shapeNode names

Rtype allLights:

list

getAllLightShapesInScene()

Returns any lights in the scene that may be in the global list ALLLIGHTTYPES

Return allLightShapes:

all the area lights in the scene as shapeNode names

Rtype allLightShapes:

list

getAllTransformsInScene()

Returns all the transforms of lights from ALLLIGHTTYPES in the scene

Return lightsTransformList:

Rtype lightsTransformList:

filterAllAreaLightTypesFromSelection()

filters all the lights of types lightTypeList from the selected list

Return lightsTransformList:

Light Name List of Transforms

Rtype lightsTransformList:

list

deleteAllLights()

deletes all lights of types ALLLIGHTTYPES in the scene

Return deletedLights:

All the deleted light names

Rtype deletedLights:

list

Viewportlights

disableLightsRenderer(lightShape)

Disables a light shape for Arnold, should do for other renderers too. Useful for viewport lights

Parameters:

lightShape (str) – A maya light shape, usually directional viewport light

sSurfaceMultiplier(surfaceStandardMatch)

Function that matches the standardSurface shaders, ie all lights are 1.7 more intense, only in 2020 and above.

Parameters:

surfaceStandardMatch (bool) – True if the user would like to adjust for standardSurface shaders in the viewport

Return intensityMultiplier:

The intensity to multiply whether adjusting for standardSurface renderer shaders.

Rtype intensityMultiplier:

float

deleteViewportLayers()

Deletes the viewport light layers, UI should check if no meta and delete if so

directionalCamLight(selectLight=False, intensity=1.0, specIntensity=0.0, shadowColor=(0.4, 0.4, 0.4), lightCount=1, softAngle=5.0, depthMap=1024, parent='', constrain='', surfaceStandardMatch=True)

Creates a directional light, intended for parenting to the camLightCamGrp() setup.

Parameters:
  • selectLight (bool) – select the light after building it

  • intensity (float) – The intensity of the light

  • shadowColor (list(float)) – Color of the shadow

  • lightCount (int) – The number of lights in the directional setup.

  • softAngle (float) – The amount of soft angle (blur)

  • depthMap (int) – The size of the depth map shadow in pixels

  • parent (str) – Parent the setup to something? If None then will be “”

Return lightTransformList:

The name of the created light transform nodes

Rtype lightTransformList:

list(str)

Return lightShapeList:

The name of the created light shape nodes

Rtype lightShapeList:

list(str)

Return specularTransform:

The name of the specular only directional light

Rtype specularTransform:

str

Return specularTransform:

The name of the specular only directional light

Rtype specularTransform:

str

Return lightGrp:

The name of the created light group node

Rtype lightGrp:

str

viewportInternalSkydome(name='skydomeViewport', intensity=1.0, path='E:\\code\\python\\personal\\zootoolspro\\install\\packages\\zoo_maya\\1.7.40\\preferences\\assets\\light_suite_ibl_skydomes\\potsdamerPlatz_g.hdr', rotate=0.0, scale=(10.0, 10.0, 10.0), renderer='Arnold', parent='', constrain='', surfaceStandardMatch=True)

Builds the viewport skydome and returns all nodes. Can set Intensity and path.

Parameters:
  • name (str) – The name of the skydome

  • intensity (float) – The brightness of the skydome

  • path (str) – The location of the skydome image, fullpath

  • renderer (str) – Usually “Arnold” as no other renderers work in the viewport

Return lightTransformName:

The light transform name

Rtype lightTransformName:

str

Return shapeNodeName:

The name of the light shape node

Rtype shapeNodeName:

str

Return textureNode:

The name of the texture file node if Arnold otherwise “”

Rtype textureNode:

str

Return placeTextureNode:

The name of the place2dTexture node if Arnold otherwise “”

Rtype placeTextureNode:

str

viewportMirrorBall()

Creates a geometry poly sphere with a reflective standardSurface shader.

Return mirrorBallGeo:

The name of the sphere transform node

Rtype mirrorBallGeo:

str

Return shader:

The name of the mirror ball shader

Rtype shader:

str

connectCamToFocalData(cameraShape, focalDataNode)

Connects the camera focal length attributes to the focalDataNode

Parameters:
  • cameraShape (str) – The camera shape node

  • focalDataNode (str) – Name of the focalDataNode, network node that connects to the focal length expressions

Returns:

Return type:

focalLengthExpression(camera)

Creates the expressions for the focal length scaler, that sizes the rig correctly depending on the focal length.

Parameters:

camera (str) – The camera to apply

Returns:

focalDataNode, expressions, cameraShape

Return type:

tuple(str, list(str), str)))

positionFocalScaleGrp(camera, viewportLightFocalAdjuster)

Positions the focal adjuster group. Used while switching and creating new cameras.

This group scales with the focal length of the camera.

Parameters:
  • camera (str) – The camera to position the focal adjuster to

  • viewportLightFocalAdjuster (str) – The group of the focal adjuster, scales with focal length

viewportCamGrpCtrls(camera, mirrorBall=True)

Creates a group and controls for the camera constrained viewport light.

Parameters:
  • camera (str) – The name of the camera to create the setup on.

  • createSphereGeo (str) – Creates a sphere with surfaceStandard if above 2020

Return lightGrp:

The name of the main group

Rtype lightGrp:

str

Return parentConstraint:

The name of the parentConstraint

Rtype parentConstraint:

str

Return controlList:

directionalCtrlGrp, directionalCtrl, hdriCtrlGrp, hdriCtrl, masterCtrlGrp, masterCtrl

Rtype controlList:

list(str)

setSoftAngle(softAngle, lightTransformList, lightCount)

Sets the angle soft spread of the directional viewport light

Parameters:
  • softAngle (float) – The amount of soft angle (blur)

  • lightTransformList (list(str)) – All the light transforms

  • lightCount (int) – Number of directional lights in the setup.

directionalControlSpread(lightTransformList, lightCount, cntrl, softAngle, attr='softAngle')

Controls the spread of a viewport directional light. Adds an expression node.

Parameters:
  • lightTransformList (list(str)) – All the light transforms

  • lightCount (int) – Number of directional lights in the setup.

  • cntrl (str) – The name of the directional control

  • softAngle (float) – The amount of soft angle (blur)

  • attr (str) – Attribute to create if not already built

Return softAngleExpr:

The expression node name that was created

Rtype softAngleExpr:

string

directionalDMapControls(directionalShapeList, cntrl, dMapValue=1024, dMapAttr='depthMap')
Parameters:
  • directionalShapeList (list(str)) – List of directional light shapes.

  • cntrl (str) – The name of the directional control

  • dMapValue

  • dMapAttr

Returns:

Return type:

directionalControlIntensity(directionalTsfrmsStr, directionalShapeList, specularTsfrmStr, specularShape, intensity, specularIntensity, lightCount, cntrl, surfaceStandardMatch=True, intensityAttr='dirIntensity', specAttr='specIntensity')
Parameters:
  • directionalTsfrmsStr

  • directionalShapeList

  • specularTsfrmStr

  • specularShape

  • intensity

  • specularIntensity

  • lightCount

  • cntrl

  • surfaceStandardMatch

  • intensityAttr

  • specAttr

Returns:

Return type:

hdriControlIntensity(hdriTsfrmStr, hdriShape, cntrl, intensityAttr='hdrIntensity')
Parameters:
  • hdriTsfrmStr

  • hdriShape

  • cntrl

  • intensityAttr

Returns:

Return type:

mirrorBallControlVis(hdriCntrl, mirrorBall)
Parameters:
  • hdriCntrl

  • mirrorBall

Returns:

Return type:

addDirectionalProxies(proxyCtrl, directionalCtrl)
Parameters:
  • proxyCtrl

  • directionalCtrl

Returns:

Return type:

addHdrProxies(proxyCtrl, hdrCtrl)
Parameters:
  • proxyCtrl

  • hdrCtrl

Returns:

Return type:

addProxyAttrs(masterCtrl, hdriCntrl, directionalCtrl)
Parameters:
  • masterCtrl

  • hdriCntrl

  • directionalCtrl

Returns:

Return type:

directionalSoftShadowLight(lightName='directionalVpLight1', intensity=1.0, softAngle=6.0, lightCount=2, dmapResolution=256, dmapFilterSize=5, emitSpecular=True, shadowColor=(0.0, 0.0, 0.0), depthMap=1024, scale=0.2, specularLight=True, specularIntensity=0.0, surfaceStandardMatch=True)
Parameters:
  • lightName

  • intensity

  • softAngle

  • lightCount

  • dmapResolution

  • dmapFilterSize

  • emitSpecular

  • shadowColor

  • depthMap

  • scale

  • specularLight

  • specularIntensity

  • surfaceStandardMatch

Returns:

Return type:

createControlGrouped(ctrlName, scale, designName='arrow_1_thinbev', rgbColor=(1.0, 0.0, 0.0), translateOffset=())

Creates an arrow control for the directionalLight.

Parameters:
  • ctrlName (str) – The name of the arrow control

  • scale (float) – The size of the control

  • designName (str) – The shape of the main control

  • rgbColor (tuple(float)) – The color

  • translateOffset (tuple(float)) – Translate the CVs of the control

Return grp:

The control group

Rtype grp:

str

Return control:

The control transform

Rtype control:

str