# dedicated executable in a /bin directory.
sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
-import PyOpenColorIO as OCIO
+import PyOpenColorIO as ocio
import aces_ocio.create_arri_colorspaces as arri
import aces_ocio.create_canon_colorspaces as canon
"""
if color_picking:
- config.setRole(OCIO.Constants.ROLE_COLOR_PICKING, color_picking)
+ config.setRole(ocio.Constants.ROLE_COLOR_PICKING, color_picking)
if color_timing:
- config.setRole(OCIO.Constants.ROLE_COLOR_TIMING, color_timing)
+ config.setRole(ocio.Constants.ROLE_COLOR_TIMING, color_timing)
if compositing_log:
- config.setRole(OCIO.Constants.ROLE_COMPOSITING_LOG, compositing_log)
+ config.setRole(ocio.Constants.ROLE_COMPOSITING_LOG, compositing_log)
if data:
- config.setRole(OCIO.Constants.ROLE_DATA, data)
+ config.setRole(ocio.Constants.ROLE_DATA, data)
if default:
- config.setRole(OCIO.Constants.ROLE_DEFAULT, default)
+ config.setRole(ocio.Constants.ROLE_DEFAULT, default)
if matte_paint:
- config.setRole(OCIO.Constants.ROLE_MATTE_PAINT, matte_paint)
+ config.setRole(ocio.Constants.ROLE_MATTE_PAINT, matte_paint)
if reference:
- config.setRole(OCIO.Constants.ROLE_REFERENCE, reference)
+ config.setRole(ocio.Constants.ROLE_REFERENCE, reference)
if scene_linear:
- config.setRole(OCIO.Constants.ROLE_SCENE_LINEAR, scene_linear)
+ config.setRole(ocio.Constants.ROLE_SCENE_LINEAR, scene_linear)
if texture_paint:
- config.setRole(OCIO.Constants.ROLE_TEXTURE_PAINT, texture_paint)
+ config.setRole(ocio.Constants.ROLE_TEXTURE_PAINT, texture_paint)
return True
# print('Generating transforms')
interpolation_options = {
- 'linear': OCIO.Constants.INTERP_LINEAR,
- 'nearest': OCIO.Constants.INTERP_NEAREST,
- 'tetrahedral': OCIO.Constants.INTERP_TETRAHEDRAL
+ 'linear': ocio.Constants.INTERP_LINEAR,
+ 'nearest': ocio.Constants.INTERP_NEAREST,
+ 'tetrahedral': ocio.Constants.INTERP_TETRAHEDRAL
}
direction_options = {
- 'forward': OCIO.Constants.TRANSFORM_DIR_FORWARD,
- 'inverse': OCIO.Constants.TRANSFORM_DIR_INVERSE
+ 'forward': ocio.Constants.TRANSFORM_DIR_FORWARD,
+ 'inverse': ocio.Constants.TRANSFORM_DIR_INVERSE
}
ocio_transforms = []
for transform in transforms:
if transform['type'] == 'lutFile':
- ocio_transform = OCIO.FileTransform(
+ ocio_transform = ocio.FileTransform(
src=transform['path'],
interpolation=interpolation_options[
transform['interpolation']],
direction=direction_options[transform['direction']])
ocio_transforms.append(ocio_transform)
elif transform['type'] == 'matrix':
- ocio_transform = OCIO.MatrixTransform()
+ ocio_transform = ocio.MatrixTransform()
# MatrixTransform member variables can't be initialized directly.
# Each must be set individually.
ocio_transform.setMatrix(transform['matrix'])
ocio_transforms.append(ocio_transform)
elif transform['type'] == 'exponent':
- ocio_transform = OCIO.ExponentTransform()
+ ocio_transform = ocio.ExponentTransform()
ocio_transform.setValue(transform['value'])
ocio_transforms.append(ocio_transform)
elif transform['type'] == 'log':
- ocio_transform = OCIO.LogTransform(
+ ocio_transform = ocio.LogTransform(
base=transform['base'],
direction=direction_options[transform['direction']])
# Build a group transform if necessary
if len(ocio_transforms) > 1:
- transform_G = OCIO.GroupTransform()
+ transform_G = ocio.GroupTransform()
for transform in ocio_transforms:
transform_G.push_back(transform)
transform = transform_G
"""
# Create the config
- config = OCIO.Config()
+ config = ocio.Config()
#
# Set config wide values
print('Adding the reference color space : %s' % reference_data.name)
# Create a color space
- reference = OCIO.ColorSpace(
+ reference = ocio.ColorSpace(
name=reference_data.name,
bitDepth=reference_data.bit_depth,
description=reference_data.description,
for colorspace in sorted(config_data['colorSpaces']):
print('Creating new color space : %s' % colorspace.name)
- ocio_colorspace = OCIO.ColorSpace(
+ ocio_colorspace = ocio.ColorSpace(
name=colorspace.name,
bitDepth=colorspace.bit_depth,
description=colorspace.description,
colorspace.to_reference_transforms)
ocio_colorspace.setTransform(
ocio_transform,
- OCIO.Constants.COLORSPACE_DIR_TO_REFERENCE)
+ ocio.Constants.COLORSPACE_DIR_TO_REFERENCE)
if colorspace.from_reference_transforms != []:
print('Generating From-Reference transforms')
colorspace.from_reference_transforms)
ocio_colorspace.setTransform(
ocio_transform,
- OCIO.Constants.COLORSPACE_DIR_FROM_REFERENCE)
+ ocio.Constants.COLORSPACE_DIR_FROM_REFERENCE)
config.addColorSpace(ocio_colorspace)
ACES.equality_group = ''
ACES.family = 'ACES'
ACES.is_data = False
- ACES.allocation_type = OCIO.Constants.ALLOCATION_LG2
+ ACES.allocation_type = ocio.Constants.ALLOCATION_LG2
ACES.allocation_vars = [-15, 6]
config_data['referenceColorSpace'] = ACES
lut = lut.replace(' ', '_').replace(')', '_').replace('(', '_')
generate_1d_LUT_from_CTL(
- lut_directory + '/' + lut,
+ os.path.join(lut_directory, lut),
ctls,
lut_resolution_1d,
'float',
lut = lut.replace(' ', '_').replace(')', '_').replace('(', '_')
generate_1d_LUT_from_CTL(
- lut_directory + '/' + lut,
+ os.path.join(lut_directory, lut),
ctls,
lut_resolution_1d,
'uint16',
cs.is_data = False
if bit_depth == 10:
- cs.bit_depth = bit_depth = OCIO.Constants.BIT_DEPTH_UINT10
+ cs.bit_depth = bit_depth = ocio.Constants.BIT_DEPTH_UINT10
adx_to_cdd = [1023.0 / 500.0, 0.0, 0.0, 0.0,
0.0, 1023.0 / 500.0, 0.0, 0.0,
0.0, 0.0, 1023.0 / 500.0, 0.0,
0.0, 0.0, 0.0, 1.0]
offset = [-95.0 / 500.0, -95.0 / 500.0, -95.0 / 500.0, 0.0]
elif bit_depth == 16:
- cs.bit_depth = bit_depth = OCIO.Constants.BIT_DEPTH_UINT16
+ cs.bit_depth = bit_depth = ocio.Constants.BIT_DEPTH_UINT16
adx_to_cdd = [65535.0 / 8000.0, 0.0, 0.0, 0.0,
0.0, 65535.0 / 8000.0, 0.0, 0.0,
0.0, 0.0, 65535.0 / 8000.0, 0.0,
data.append(cid_to_rle(x))
lut = 'ADX_CID_to_RLE.spi1d'
- write_SPI_1d(lut_directory + '/' + lut, RANGE[0], RANGE[1],
+ write_SPI_1d(os.path.join(lut_directory, lut),
+ RANGE[0],
+ RANGE[1],
data,
NUM_SAMPLES, 1)
lut = lut.replace(' ', '_').replace(')', '_').replace('(', '_')
generate_1d_LUT_from_CTL(
- lut_directory + '/' + lut,
+ os.path.join(lut_directory, lut),
ctls,
lut_resolution_1d,
'float',
shaper_params) = shaper_info
shaper_lut = '%s_to_aces.spi1d' % shaper_name
- if (not os.path.exists(lut_directory + '/' + shaper_lut)):
+ if (not os.path.exists(os.path.join(lut_directory, shaper_lut))):
ctls = [shaper_to_ACES_CTL % aces_CTL_directory]
# Remove spaces and parentheses
' ', '_').replace(')', '_').replace('(', '_')
generate_1d_LUT_from_CTL(
- lut_directory + '/' + shaper_lut,
+ os.path.join(lut_directory, shaper_lut),
ctls,
lut_resolution_1d,
'float',
lut = lut.replace(' ', '_').replace(')', '_').replace('(', '_')
generate_3d_LUT_from_CTL(
- lut_directory + '/' + lut,
+ os.path.join(lut_directory, lut),
ctls,
lut_resolution_3d,
'float',
lut = lut.replace(' ', '_').replace(')', '_').replace('(', '_')
generate_3d_LUT_from_CTL(
- lut_directory + '/' + lut,
+ os.path.join(lut_directory, lut),
ctls,
lut_resolution_3d,
'half',
shaper_params['legalRange'] = 0
shaper_lut = '%s_to_aces.spi1d' % shaper_name
- if (not os.path.exists(lut_directory + '/' + shaper_lut)):
+ if (not os.path.exists(os.path.join(lut_directory, shaper_lut))):
ctls = [shaper_to_ACES_CTL % aces_CTL_directory]
# Remove spaces and parentheses
' ', '_').replace(')', '_').replace('(', '_')
generate_1d_LUT_from_CTL(
- lut_directory + '/' + shaper_lut,
+ os.path.join(lut_directory, shaper_lut),
ctls,
lut_resolution_1d,
'float',
# Copy into the lut dir
transform_LUT_file_name = os.path.basename(
odt_values['transformLUT'])
- lut = lut_directory + '/' + transform_LUT_file_name
+ lut = os.path.join(lut_directory, transform_LUT_file_name)
shutil.copy(odt_values['transformLUT'], lut)
cs.from_reference_transforms.append(shaper_OCIO_transform)
# Remove spaces and parentheses
lut = lut.replace(' ', '_').replace(')', '_').replace('(', '_')
- generate_3d_LUT_from_CTL(lut_directory + '/' + lut,
- # shaperLUT,
- ctls,
- lut_resolution_3d,
- 'float',
- 1.0 / shaper_input_scale,
- 1.0,
- shaper_params,
- cleanup,
- aces_CTL_directory)
+ generate_3d_LUT_from_CTL(
+ os.path.join(lut_directory, lut),
+ # shaperLUT,
+ ctls,
+ lut_resolution_3d,
+ 'float',
+ 1.0 / shaper_input_scale,
+ 1.0,
+ shaper_params,
+ cleanup,
+ aces_CTL_directory)
cs.from_reference_transforms.append(shaper_OCIO_transform)
cs.from_reference_transforms.append({
# Copy into the lut dir
transform_LUT_inverse_file_name = os.path.basename(
odt_values['transformLUTInverse'])
- lut = lut_directory + '/' + transform_LUT_inverse_file_name
+ lut = os.path.join(lut_directory, transform_LUT_inverse_file_name)
shutil.copy(odt_values['transformLUTInverse'], lut)
cs.to_reference_transforms.append({
lut = lut.replace(' ', '_').replace(')', '_').replace('(', '_')
generate_3d_LUT_from_CTL(
- lut_directory + '/' + lut,
+ os.path.join(lut_directory, lut),
# None,
ctls,
lut_resolution_3d,