Skip to content

Instantly share code, notes, and snippets.

@AndrewHazelden
Last active December 9, 2015 11:39
Show Gist options
  • Save AndrewHazelden/494c27166ce740177248 to your computer and use it in GitHub Desktop.
Save AndrewHazelden/494c27166ce740177248 to your computer and use it in GitHub Desktop.
Use Maxwell Render's PyMaxwell tool to scan the camera's lens model
# Return the lens type name as a string
# Example: it = CmaxwellCameraIterator(); camera = it.first(scene); cameraLens = cameraParams.getLensType(); lens = mxa_lensTypeName(cameraLens)
def mxa_lensTypeName(cameraLens):
lensTypeName = ''
if cameraLens[0] == TYPE_CYLINDRICAL_LENS:
lensTypeName = 'cylindrical'
elif cameraLens[0] == TYPE_EXTENSION_LENS:
lensTypeName = 'extension lens'
elif cameraLens[0] == TYPE_FISHEYE_LENS:
lensTypeName = 'fisheye'
elif cameraLens[0] == TYPE_ORTHO_LENS:
lensTypeName = 'ortho'
elif cameraLens[0] == TYPE_PINHOLE_LENS:
lensTypeName = 'pinhole'
elif cameraLens[0] == TYPE_SPHERICAL_LENS:
lensTypeName = 'spherical'
elif cameraLens[0] == TYPE_THIN_LENS:
lensTypeName = 'thin'
return lensTypeName
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment