Clarisse 5.0 SP10 SDK 5.0.5.10.0
Loading...
Searching...
No Matches
clarisse_helper Namespace Reference

This module defines to python Clarisse function helpers. More...

Classes

class  ApplicationSelection
 Clarisse global application selection class wrapper. More...
 

Functions

def load (filename, scene_mode=api.OfApp.MODE_DEFAULT)
 Load the specified Clarisse file. More...
 
def load_project (filename)
 Load the specified Clarisse project file. More...
 
def load_build (filename)
 Load the specified Clarisse build file. More...
 
def save (filename, scene_mode=api.OfApp.MODE_DEFAULT)
 Save the current build or project. More...
 
def save_project (filename)
 If the running license is iFX, it saves the current project in a project file. More...
 
def save_build (filename)
 If the running license is BUiLDER, it saves the current build in a build file. More...
 
def render_image (image)
 Render the specified image item and return the rendered image. More...
 
def save_image (image, filename, format, lut_name="", compression=1)
 Save the specified image at the specified filename with the specified format and return True if successful. More...
 
def save_exr16 (image, filename, lut_name="", compression=1)
 Save the specified image at the specified filename as a 16-bit (float) EXR. More...
 
def save_exr32 (image, filename, lut_name="", compression=1)
 Save the specified image at the specified filename as a 32-bit (float) EXR. More...
 
def save_jpg (image, filename, lut_name="")
 Save the specified image at the specified filename as a JPG. More...
 
def save_bmp (image, filename, lut_name="")
 Save the specified image at the specified filename as a BMP. More...
 
def save_tga (image, filename, lut_name="")
 Save the specified image at the specified filename as a TGA. More...
 
def save_png8 (image, filename, lut_name="")
 Save the specified image at the specified filename as a 8-bit PNG. More...
 
def save_png16 (image, filename, lut_name="")
 Save the specified image at the specified filename as a 16-bit PNG. More...
 
def save_tif8 (image, filename, lut_name="")
 Save the specified image at the specified filename as a 8-bit TIF. More...
 
def save_tif16 (image, filename, lut_name="")
 Save the specified image at the specified filename as a 16-bit TIF. More...
 
def save_tif32 (image, filename, lut_name="")
 Save the specified image at the specified filename as a 32-bit TIF. More...
 
def get_current_frame ()
 Return the current frame number.
 
def set_current_frame (frame_number)
 Set the current frame number to the specified frame. More...
 
def import_geometry (filename)
 Return a OfObject if the specified geometry has been successfully loaded. More...
 
def import_geometries (filenames)
 Return an array of OfObject if the specified geometry has been successfully loaded. More...
 
def import_image (filename)
 Return a OfObject if the specified image has been successfully loaded. More...
 
def import_images (filenames)
 Return an array of OfObject if the specified images has been successfully loaded. More...
 
def import_map_file (filename, class_name, suffix)
 Return a OfObject if the specified image has been successfully loaded. More...
 
def import_map_files (filenames, class_name, suffix)
 Return an array of OfObject if the specified images has been successfully loaded. More...
 
def import_volume (filename)
 Return a OfObject if the specified volume has been successfully loaded. More...
 
def import_volumes (filenames)
 Return an array of OfObject if the specified volumes has been successfully loaded. More...
 
def export_geometry (filename, geometry_object)
 Exports the geometry given as parameter. More...
 
def export_geometries (filename, geometry_objects)
 Exports the geometry given as parameter. More...
 
def reference_file (working_context, filename)
 When a single file is specified, return the OfContext that has been successfully referenced. More...
 
def reference_files (working_context, filenames)
 Return an array of OfContexts if the specified files have been successfully referenced. More...
 
def export_context_as_project (context, filename)
 Export a context to the specified project filename. More...
 
def export_context_as_project_with_dependencies (context, filename)
 Export a context to the specified project filename, including its dependencies. More...
 
def reference_export_context (context, filename)
 Export a context to the specified project filename, and convert the context to a reference context that references the exported project. More...
 
def reference_make_local (context)
 Make local object from the specified a reference. More...
 
def import_scene (filename)
 Return the created context containing the scene if the specified file has been successfully loaded. More...
 
def import_project (filename)
 Return the created context containing the project if the specified file has been successfully loaded. More...
 
def log_info (message)
 Output the specified info message. More...
 
def log_warning (message)
 Output the specified warning message. More...
 
def log_error (message)
 Output the specified error message. More...
 
def is_gui_application ()
 Return True if the application is running in GUI mode Use this method if you are doing specific GUI actions to check if the application is running in UI mode. More...
 
def is_process_application ()
 Return True if the application is running in process mode A process application, is an application which doesn't take input. More...
 
def is_interactive_application ()
 Return True if the application is running in interactive mode An interactive application, is an application that behaves like a command-line shell. More...
 
def set_current_context (context_path)
 Set the current working context (Global slot) More...
 
def get_current_context ()
 Return the current working context (OfContext)
 
def create_object (item_name, class_name, destination_context=None)
 Create an object named item_name of the specified class_name inside the current working context. More...
 
def delete_item (item)
 Delete the specified item (object or context) More...
 
def is_context_exists (context_name)
 Return True if the specified context exists. More...
 
def item_exists (item_name)
 Return the specified item (OfContext or OfObject) if it exists. More...
 
def get_item (item_name)
 Return the item (OfContext or OfObject or OfAttr) from the specified name. More...
 
def make_absolute_of_path (path)
 Return the specified path as an absolute Clarisse build path if the path is not yet an absolute path Note : An absolute path is a path beginning with "root:/", where "root" is the name of a hierarchy (example : project:/, build:/, etc ...))
 
def inspect (item)
 Display the attributes of the specified item.
 
def create_context (path)
 Create a new context.
 
def create_generic_object (object_name)
 Create and return a new generic object name after the specified name. More...
 
def add_attribute (obj, attr_name, attr_type, category="General")
 Add and return a custom attribute to the specified object. More...
 
def enable_command_history ()
 Enable command history.
 
def disable_command_history ()
 Disable command history.
 
def enable_echo_command ()
 Enable echo command.
 
def disable_echo_command ()
 Disable echo command.
 
def begin_command_batch (batch_name)
 Start new a command batch by pushing it in the batch stack (batches can be nested) More...
 
def end_command_batch ()
 End a command batch by poping it from the batch stack.
 
def check_need_save ()
 Check if the current project is modified and proposed to save it. More...
 

Variables

 selection = ApplicationSelection()
 Global application selection helper.
 

Detailed Description

This module defines to python Clarisse function helpers.

The file is automatically imported directly inside the ix module. To access to the functions just type for example: render_image('my_image').

Function Documentation

◆ add_attribute()

def clarisse_helper.add_attribute (   obj,
  attr_name,
  attr_type,
  category = "General" 
)

Add and return a custom attribute to the specified object.

Parameters
objObject that will get the new attribute
attr_nameNew attribute name
attr_typeString defining the type of the attribute. Following are the possible attribute type values:
  • 'bool' to define a boolean (True/False) value
  • 'long' to define a long value
  • 'double' to define a double floating point value
  • 'reference' to define a reference to an object
  • 'percentage' to define a percentage
  • 'distance' to define a distance
  • 'scale' to define a scale
  • 'angle' to define an angle
  • 'frame' to define a frame
  • 'subframe' to define a subframe
  • 'l' to define a luminance color
  • 'la' to define a luminance + alpha color
  • 'rgb' to define a RGB color
  • 'rgba' to define a RGBA color
  • 'filein' to define a filein value
  • 'fileout' to define a fileout value
  • 'pixel' to define a pixel value
  • 'subpixel' to define a subpixel value (allowing fractional values)
categoryUser category of the attribute.
Returns
The newly created attribute
Note
If the specified attribute name already exists, it will get automatically renamed. Attribute names support only identifier type string: 'my_attribute_name'

◆ begin_command_batch()

def clarisse_helper.begin_command_batch (   batch_name)

Start new a command batch by pushing it in the batch stack (batches can be nested)

Parameters
batch_nameThe name of the command batch that will be displayed in the History Editor

◆ check_need_save()

def clarisse_helper.check_need_save ( )

Check if the current project is modified and proposed to save it.

Returns
Return the response of file browser and the filename chosen (Can return a None value for the filename)

◆ create_generic_object()

def clarisse_helper.create_generic_object (   object_name)

Create and return a new generic object name after the specified name.

Note
A generic object doesn't declare any attribute. You can then use it add your custom attributes on it. For example, it's typical use is to create a temporary generic object, populate it with custom attributes. Then you would use inspect to display its attribute to get user input. Once the data as been retrieved the object can be freely deleted.

◆ create_object()

def clarisse_helper.create_object (   item_name,
  class_name,
  destination_context = None 
)

Create an object named item_name of the specified class_name inside the current working context.

Parameters
item_nameName of the newly created item
class_nameObject class name of the item to create
destination_contextDestination context in which the object is created. By default, objects are created in the current application context
Note
If the specified item_name already exists, the item will be automatically renamed.
Returns
Return the new item (OfObject) on success or None

◆ delete_item()

def clarisse_helper.delete_item (   item)

Delete the specified item (object or context)

Parameters
itemPath to the item to delete, for example: 'project://scene/light'
Note
You can't undo this action.

◆ export_context_as_project()

def clarisse_helper.export_context_as_project (   context,
  filename 
)

Export a context to the specified project filename.

Parameters
appApplication object
contextContext
filenameproject filename
Returns
True on success, False on failure

◆ export_context_as_project_with_dependencies()

def clarisse_helper.export_context_as_project_with_dependencies (   context,
  filename 
)

Export a context to the specified project filename, including its dependencies.

Parameters
appApplication object
contextContext
filenameproject filename
Returns
True on success, False on failure

◆ export_geometries()

def clarisse_helper.export_geometries (   filename,
  geometry_objects 
)

Exports the geometry given as parameter.

Parameters
filenameoutput Geometry filename
OfObjectVectorvector of Geometries to export
Note
A single geometry file can define multiple geometries.

◆ export_geometry()

def clarisse_helper.export_geometry (   filename,
  geometry_object 
)

Exports the geometry given as parameter.

Parameters
filenameoutput Geometry filename.
geometry_objectto export

◆ get_item()

def clarisse_helper.get_item (   item_name)

Return the item (OfContext or OfObject or OfAttr) from the specified name.

The item must exist.

Parameters
item_nameName of the item to get, for example: 'project://scene/light'.
Returns
Return The item if found, otherwise raises an error.
See also
item_exists

◆ import_geometries()

def clarisse_helper.import_geometries (   filenames)

Return an array of OfObject if the specified geometry has been successfully loaded.

Parameters
filenamesGeometry filenames.
Note
A single geometry file can define multiple geometries. This is why this function returns a array of OfObject

◆ import_geometry()

def clarisse_helper.import_geometry (   filename)

Return a OfObject if the specified geometry has been successfully loaded.

Parameters
filenameGeometry filename.
Note
A single geometry file can define multiple geometries. This is why this function returns an OfObject

◆ import_image()

def clarisse_helper.import_image (   filename)

Return a OfObject if the specified image has been successfully loaded.

Parameters
filenameImage filename.
Returns
The imported image object if it succeeded, None otherwise

◆ import_images()

def clarisse_helper.import_images (   filenames)

Return an array of OfObject if the specified images has been successfully loaded.

Parameters
filenamesImages filenames.

◆ import_map_file()

def clarisse_helper.import_map_file (   filename,
  class_name,
  suffix 
)

Return a OfObject if the specified image has been successfully loaded.

Parameters
filenameImage filename.
class_nameClass name.
suffixSuffix object created.
Returns
The imported map file object if it succeeded, None otherwise

◆ import_map_files()

def clarisse_helper.import_map_files (   filenames,
  class_name,
  suffix 
)

Return an array of OfObject if the specified images has been successfully loaded.

Parameters
filenamesImages filenames.
class_nameClass name.
suffixSuffix object created.

◆ import_project()

def clarisse_helper.import_project (   filename)

Return the created context containing the project if the specified file has been successfully loaded.

Parameters
filenameProject filename.

◆ import_scene()

def clarisse_helper.import_scene (   filename)

Return the created context containing the scene if the specified file has been successfully loaded.

Parameters
filenameScene filename to import.
Returns
The context containing the imported scene contents, or None on failure.

◆ import_volume()

def clarisse_helper.import_volume (   filename)

Return a OfObject if the specified volume has been successfully loaded.

Parameters
filenameVolume filename.
Note
A single volume file can define multiple volumes. This is why this function returns the created context containing the volume

◆ import_volumes()

def clarisse_helper.import_volumes (   filenames)

Return an array of OfObject if the specified volumes has been successfully loaded.

Parameters
filenamesVolume filenames.
Note
A single volume file can define multiple volumes. This is why this function returns the created context containing the volume

◆ is_context_exists()

def clarisse_helper.is_context_exists (   context_name)

Return True if the specified context exists.

Parameters
context_nameName of the context, for example: 'project://scene'

◆ is_gui_application()

def clarisse_helper.is_gui_application ( )

Return True if the application is running in GUI mode Use this method if you are doing specific GUI actions to check if the application is running in UI mode.

Typically Clarisse returns true, where CNode returns false.

◆ is_interactive_application()

def clarisse_helper.is_interactive_application ( )

Return True if the application is running in interactive mode An interactive application, is an application that behaves like a command-line shell.

Typically CNode returns true when it has been launched with the flag -interactive.

◆ is_process_application()

def clarisse_helper.is_process_application ( )

Return True if the application is running in process mode A process application, is an application which doesn't take input.

Typically CNode returns true when it running as a renderer and will return false if running in interactive mode.

◆ item_exists()

def clarisse_helper.item_exists (   item_name)

Return the specified item (OfContext or OfObject) if it exists.

Parameters
item_nameName of the item, for example: 'project://scene/light'
Returns
Return None if the item doesn't exists

◆ load()

def clarisse_helper.load (   filename,
  scene_mode = api.OfApp.MODE_DEFAULT 
)

Load the specified Clarisse file.

Parameters
filenameClarisse filename (.project or .build)
Returns
True on success, False otherwise. Loading a file will clear all the items that are in the current application.

◆ load_build()

def clarisse_helper.load_build (   filename)

Load the specified Clarisse build file.

Parameters
filenameClarisse build filename (.build)
Returns
True on success, False otherwise. Loading a build will clear all the items that are in the current build.

◆ load_project()

def clarisse_helper.load_project (   filename)

Load the specified Clarisse project file.

Parameters
filenameClarisse project filename (.project)
Returns
True on success, False otherwise. Loading a project will clear all the items that are in the current project.

◆ log_error()

def clarisse_helper.log_error (   message)

Output the specified error message.

Parameters
messageinput message

◆ log_info()

def clarisse_helper.log_info (   message)

Output the specified info message.

Parameters
messageinput message

◆ log_warning()

def clarisse_helper.log_warning (   message)

Output the specified warning message.

Parameters
messageinput message

◆ reference_export_context()

def clarisse_helper.reference_export_context (   context,
  filename 
)

Export a context to the specified project filename, and convert the context to a reference context that references the exported project.

Parameters
appApplication object
contextContext
filenamesproject filename
Returns
True on success, False on failure

◆ reference_file()

def clarisse_helper.reference_file (   working_context,
  filename 
)

When a single file is specified, return the OfContext that has been successfully referenced.

When an array of filenames is specified, returns True in case of success.

Parameters
working_contextContext that will contain the referenced asset
filenameAsset filename(s)

◆ reference_files()

def clarisse_helper.reference_files (   working_context,
  filenames 
)

Return an array of OfContexts if the specified files have been successfully referenced.

Parameters
working_contextContext that will contain the referenced assets
filenamesAsset filenames

◆ reference_make_local()

def clarisse_helper.reference_make_local (   context)

Make local object from the specified a reference.

Parameters
appApplication object
contextContext that will a local context

◆ render_image()

def clarisse_helper.render_image (   image)

Render the specified image item and return the rendered image.

Parameters
imageClarisse path to an image item that can be either a string or an OfObject
Returns
The rendered image is returned as an ImageHandle

◆ save()

def clarisse_helper.save (   filename,
  scene_mode = api.OfApp.MODE_DEFAULT 
)

Save the current build or project.

Parameters
filenameClarisse build or project filename.
scene_modeSpecifies whether we're saving a project or a build file.
Returns
True on success, False otherwise.
Note
If the running license is iFX, the only value allowed is api.OfApp.MODE_PROJECT. Otherwise, if the running license is BUiLDER, it is possible to specify whether we want to save the current build file (api.OfApp.MODE_BUILD), or the current context set as vizroot in a project file (api.OfApp.MODE_PROJECT).

◆ save_build()

def clarisse_helper.save_build (   filename)

If the running license is BUiLDER, it saves the current build in a build file.

Parameters
filenameClarisse build filename
Returns
True on success, False otherwise.

◆ save_project()

def clarisse_helper.save_project (   filename)

If the running license is iFX, it saves the current project in a project file.

Otherwise, if the running license is BUiLDER, it saves the current context set as vizroot in a project file. If there is no vizroot in the application, it raises an error.

Parameters
filenameClarisse project filename.
Returns
True on success, False otherwise.

◆ set_current_context()

def clarisse_helper.set_current_context (   context_path)

Set the current working context (Global slot)

Parameters
context_pathPath the the context that will be set as the current working context
Note
By default all new items are created in the current working context.

◆ set_current_frame()

def clarisse_helper.set_current_frame (   frame_number)

Set the current frame number to the specified frame.

Parameters
frame_numberFrame number.