cgl.plugins.blender package

Subpackages

Submodules

cgl.plugins.blender.alchemy module

cgl.plugins.blender.alchemy_legacy module

cgl.plugins.blender.cgl_browser_widget module

cgl.plugins.blender.custom_menu module

class cgl.plugins.blender.custom_menu.Menu(software='blender', type_='menus')[source]

Bases: CustomMenu

add_button(menu_label, label='', annotation='', command='', icon='', image_overlay_label='', hot_key='')[source]

add a button to a menu

Parameters:
  • menu_label (str) – name of the menu to add the button to (must already exist)

  • label (str) – label of the button

  • annotation (str) – annotation of the button

  • command (str) – command to run when button is clicked

  • icon (str) – icon to display on the button

  • image_overlay_label (str) – image_plane overlay label to display on the button

  • hot_key (str) – hot key to assign to the button

create_menu(name, menu_type='panel')[source]

creates a menu with title of ‘name’

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

  • menu_type (str) – type of menu to create. Options are ‘panel’ or ‘menu’

delete_menu(menu_name)[source]

deletes menu by “menu_name”

Parameters:

menu_name (str) – name of the menu to delete

find_menu_by_name(menu_name)[source]

finds menu in software package given its string name

Parameters:

menu_name (str) – name of the menu to find

cgl.plugins.blender.custom_menu.add_operator_buttons_to_panel(panel_file='', prefix='alchemy')[source]

This function is used to add buttons to the panel in blender

cgl.plugins.blender.custom_menu.create_blender_menu_file(cookbook_root, recipe_type, recipe_name, recipe_label)[source]

This function creates the blender menu file :param cookbook_root: :param recipe_type: :param recipe_name: name of the recipe :param recipe_label: GUI friendly label of the recipe

cgl.plugins.blender.custom_menu.get_blender_button_template(cookbook_root, recipe_type)[source]

This function gets the blender menu file template :param recipe_type: :param recipe_name:

Returns:

cgl.plugins.blender.custom_menu.get_blender_menu_file(cookbook_root, recipe_type, recipe_name)[source]

This function gets the blender menu file

cgl.plugins.blender.custom_menu.get_blender_menu_template(cookbook_root)[source]

This function gets the blender menu file template :param cookbook_root:

Returns:

cgl.plugins.blender.gui module

cgl.plugins.blender.lumbermill module

cgl.plugins.blender.magic_scene_description module

cgl.plugins.blender.main_window module

cgl.plugins.blender.msd module

cgl.plugins.blender.name_tests module

cgl.plugins.blender.utils module

cgl.plugins.blender.utils.add_buttons_to_menu(menu_name, cfg=None)[source]

adds buttons from a cgl menu config file to a blender menu

Parameters:
  • menu_name (str) – name of the menu to add buttons to

  • cfg

cgl.plugins.blender.utils.add_hdri_root(filepath)[source]
cgl.plugins.blender.utils.add_modifier(obj, mod_name, name)[source]
cgl.plugins.blender.utils.basic_playblast(path_object=None, appearance='smoothShaded', cam=None, audio=False)[source]

Creates a playblast of the scene.

Parameters:
  • path_object

  • appearance

  • cam

  • audio

Returns:

None

cgl.plugins.blender.utils.build_default_structure(group, default_list=['FG', 'CAM', 'RIG'], namespace=None)[source]
cgl.plugins.blender.utils.check_child_naming(selected=None, children=None)[source]

checks the naming of children of a selected node

Parameters:
  • selected – the selected node

  • children – the children of the selected node

Returns:

True if the naming is correct, False otherwise

Return type:

bool

cgl.plugins.blender.utils.clean_name(grp)[source]
cgl.plugins.blender.utils.clean_tt(task=None)[source]

Cleans up the turntable by deleting the camera and group node.

Parameters:

task

Returns:

None

cgl.plugins.blender.utils.cleanup_file(task='mdl')[source]

finds the given task group and deletes everythin ecept for that locator

Parameters:
  • task – task to keep in scene

  • keep_task

  • asset

cgl.plugins.blender.utils.cleanup_scene_data(data_type)[source]

Deletes data that’s not currently linked to any object in scene , takes in bpy.data.type ie bpy.data.materials

Parameters:

data_type – bpy.data.type ie bpy.data.materials

cgl.plugins.blender.utils.clear_parent(objects=None)[source]
cgl.plugins.blender.utils.collections_in_scene(string=False)[source]
cgl.plugins.blender.utils.confirm_prompt(title='title', message='message', button='Ok')[source]

standard confirm prompt, this is an easy wrapper that allows us to do confirm prompts in the native language of the application while keeping conventions

Parameters:
  • title

  • message

  • button – single button is created with a string, multiple buttons created with array

cgl.plugins.blender.utils.create_button_file(class_name, label, menu_name, cfg)[source]

Creates a Blender Button File on Disk.

Parameters:
  • class_name (str) – name of the class

  • label (str) – label to appear on the button

  • menu_name (str) – name of the parent menu (CamelCase)

  • cfg

cgl.plugins.blender.utils.create_collection(collection_name, parent=None)[source]

Creates a collection in current scene

Parameters:
  • collection_name (str) – name of the collection to create

  • parent (str) – name of the parent collection

cgl.plugins.blender.utils.create_env_light(tex_name)[source]

Creates an environment light with the specified texture.

Parameters:

tex_name

Returns:

None

cgl.plugins.blender.utils.create_folders(path_object)[source]

Creates the folders for the given path object

Parameters:

path_object – path object to create folders for

cgl.plugins.blender.utils.create_menu_file(class_name, cfg)[source]

Creates a Menu File on Disk

Parameters:

class_name (str) – name of the class

cgl.plugins.blender.utils.create_object(name, type=None, parent=None, collection=None, namespace=None)[source]
cgl.plugins.blender.utils.create_shot_mask_info()[source]
cgl.plugins.blender.utils.create_task_on_asset(task, path_object=None, version_up=False)[source]

Creates a task on disk based on path object

Parameters:
  • task

  • path_object

  • type – type of task, mdl, shdr, rig, etc

cgl.plugins.blender.utils.create_thumb(path_object, camera=None)[source]

Creates a thumbnail of the scene.

Parameters:
  • path_object

  • camera

Returns:

None

cgl.plugins.blender.utils.create_tt(length, tt_object)[source]

Creates a turntable with frame range of 0-length, around the selected object.

Parameters:
  • length

  • tt_object

Returns:

None

cgl.plugins.blender.utils.current_selection(single=False)[source]
cgl.plugins.blender.utils.default_matrix()[source]
cgl.plugins.blender.utils.delete_object(object_to_delete)[source]
cgl.plugins.blender.utils.format_list(list)[source]
cgl.plugins.blender.utils.get_button_path(software, menu_name, button_name, menu_type='menus', cfg=None)[source]
Parameters:
  • software (str) – software as it appears in cookbook designer.

  • menu_name (str) – CamelCase menu name

  • button_name (str) – CamelCase button name

  • menu_type (str) – menus, publish, shelves, context-menus

  • cfg

cgl.plugins.blender.utils.get_collection(name, namespace=None)[source]
cgl.plugins.blender.utils.get_collection_from_path_object(path_object)[source]
cgl.plugins.blender.utils.get_current_camera()[source]

Returns the name of the current camera in the scene.

Returns:

The name of the current camera.

Return type:

str

cgl.plugins.blender.utils.get_formatted_list(elements, first_item)[source]

Formats list for blender search mode

cgl.plugins.blender.utils.get_frame_end()[source]

gets end frame from render frame range

Returns:

end frame

Return type:

int

cgl.plugins.blender.utils.get_frame_range()[source]

gets the frame range of the scene

Returns:

dictionary of frame range values

Return type:

dict

cgl.plugins.blender.utils.get_frame_start()[source]

gets starting frame from render frame range

Returns:

start frame

Return type:

int

cgl.plugins.blender.utils.get_framerange()[source]
cgl.plugins.blender.utils.get_handle_end()[source]

gets the handle after the animation ends.

Returns:

handle end

Return type:

int

cgl.plugins.blender.utils.get_handle_start()[source]

gets the handle before the animation starts

Returns:

handle start

Return type:

int

cgl.plugins.blender.utils.get_hdri_config()[source]
cgl.plugins.blender.utils.get_hdri_root()[source]
cgl.plugins.blender.utils.get_hdri_yaml_path()[source]
cgl.plugins.blender.utils.get_items(type='assets')[source]
cgl.plugins.blender.utils.get_last_button_number(menu_dict, software, menu)[source]
cgl.plugins.blender.utils.get_layer(name, namespace=None, set_default_namespace=True)[source]
cgl.plugins.blender.utils.get_lib_from_object(object)[source]
cgl.plugins.blender.utils.get_materials_dictionary()[source]

creates a dictionary of the objects and the faces associated with that object

Returns:

dictionary of the objects and the faces associated with that object

Return type:

materials (dict)

cgl.plugins.blender.utils.get_materials_from_object(object)[source]
cgl.plugins.blender.utils.get_matrix(obj, query=False)[source]

Returns a matrix of values relating to translate, scale, rotate.

Parameters:
  • obj

  • query

cgl.plugins.blender.utils.get_menu_at(menu_dict, software, menu, i)[source]
cgl.plugins.blender.utils.get_menu_path(cookbook_folder, software, menu_name, menu_file=False, menu_type='menus', cfg=None)[source]

returns the menu path for a menu with the given name

Parameters:
  • software (str) – software as it appears in cookbook designer

  • menu_name (str) – CamelCase menu name

  • menu_file (bool) – if True returns a menu path with a menu_name.py file

  • menu_type (str) – menus, publish, shelves, context-menus

  • cfg

cgl.plugins.blender.utils.get_mesh_nodes_recursive(root_node)[source]
cgl.plugins.blender.utils.get_namespace(filepath)[source]

gets the namespace when creating a namespace

Parameters:
  • filepath

  • current

Returns:

namespace

cgl.plugins.blender.utils.get_next_namespace(ns, sel=None, type='lay', levels=3)[source]
cgl.plugins.blender.utils.get_object(name, namespace=None)[source]
cgl.plugins.blender.utils.get_objects_in_hirarchy(obj, levels=10)[source]
cgl.plugins.blender.utils.get_playblast_path(path_object)[source]
cgl.plugins.blender.utils.get_preview_from_texture(inputs, node_tree)[source]
cgl.plugins.blender.utils.get_ref_node(object_name)[source]
cgl.plugins.blender.utils.get_reference_meshes()[source]
Returns:

a list of all top nodes of references in the scene

cgl.plugins.blender.utils.get_scene_collection(task=None, path_object=None)[source]
cgl.plugins.blender.utils.get_scene_name()[source]
cgl.plugins.blender.utils.get_scene_object(task=None)[source]
cgl.plugins.blender.utils.get_search_selection_task()[source]
cgl.plugins.blender.utils.get_selected_namespace()[source]
Returns:

namespace of selected object.

cgl.plugins.blender.utils.get_selected_reference() list[source]

This function returns a list of reference nodes based on the currently selected objects in the scene.

Returns:

a list of reference nodes that correspond to the selected objects in the scene. If no objects are selected, it returns None. If the selected objects do not belong to any references, it logs an error message and returns an empty list.

Return type:

list

cgl.plugins.blender.utils.get_selection(selection=None)[source]
cgl.plugins.blender.utils.get_shape_name(geo)[source]
cgl.plugins.blender.utils.get_top_nodes()[source]

Get the top nodes in blender that are not defaults

cgl.plugins.blender.utils.get_valid_meshes_list(objects)[source]
cgl.plugins.blender.utils.get_valid_objects_in_scene_hirarchy()[source]
cgl.plugins.blender.utils.hdri_widget()[source]

Creates a widget for selecting an HDRI map.

Returns:

None

cgl.plugins.blender.utils.keep_single_collections(obj, collection_name)[source]

Unlink object from all collections except the one specified

Parameters:
  • obj – object to adjust

  • collection_name – name of the collection to keep

cgl.plugins.blender.utils.keep_single_user_collection(obj, assetName=None)[source]
cgl.plugins.blender.utils.load_library(path_object, collection_name=None, replace=True)[source]
cgl.plugins.blender.utils.load_plugin(plugin_name)[source]

Loads a plugin by name.

Parameters:

plugin_name – The name of the plugin to load.

Returns:

None

cgl.plugins.blender.utils.move_linked_libraries_to_project(project=None)[source]
cgl.plugins.blender.utils.move_to_project(project, path_object=None)[source]
cgl.plugins.blender.utils.objects_in_scene(string=False)[source]
cgl.plugins.blender.utils.parent_object(child, parent, keep_transform=True)[source]
cgl.plugins.blender.utils.parent_to_collection(obj, collection_name, replace=False)[source]

Parents object to collection

Parameters:
  • obj – blender object

  • collection_name – name of the collection to parent to

  • replace – if True, replaces the object in the collection

cgl.plugins.blender.utils.playblast_exists(path_object)[source]
cgl.plugins.blender.utils.preview_inputs_from_node_tree(node_tree)[source]
cgl.plugins.blender.utils.purge_unused_data()[source]

Deletes all the uneused data, ie data that’s not currently linked to any scene

cgl.plugins.blender.utils.read_layout(outFile=None, linked=False, append=False)[source]

Reads layout from json file

Parameters:
  • outFile (str) – path to json file

  • linked (bool) – if True, links the assets

  • append (bool) – if True, appends the assets

cgl.plugins.blender.utils.read_materials(path_object=None)[source]

Reads the materials on the shdr task from defined from a json file

cgl.plugins.blender.utils.read_matrix(obj, transform_data)[source]
cgl.plugins.blender.utils.remove_instancers()[source]
cgl.plugins.blender.utils.remove_linked_environment_dependencies(library)[source]
cgl.plugins.blender.utils.remove_unused_libraries()[source]
cgl.plugins.blender.utils.rename_collection(current_scene=None)[source]
cgl.plugins.blender.utils.rename_materials(selection=None, material_name=None)[source]

Sequentially renames materials from given object name if empty , renamed from selected object

Parameters:
  • selection (list) – list of objects to rename materials from

  • material_name (str) – name of the material to rename to

cgl.plugins.blender.utils.render(preview=False, audio=False)[source]

Renders the current scene.

Based on the task we can derive what kind of render and specific render settings.

Parameters:
  • preview – determines if exr is used or not

  • audio – if True renders an mov and setups the audio settings

cgl.plugins.blender.utils.reorder_list(items, arg='')[source]

Reorders list in order of importance, putting rig

Parameters:
  • items – list of items to reorder

  • arg – item to put at the top of the list

cgl.plugins.blender.utils.reparent_collections(view_layer)[source]
cgl.plugins.blender.utils.reparent_linked_environemnt_assets(library)[source]
cgl.plugins.blender.utils.return_asset_name(obj)[source]
cgl.plugins.blender.utils.return_lib_path(library)[source]
cgl.plugins.blender.utils.return_linked_library(collection)[source]

retrieves the linked libraries manually

cgl.plugins.blender.utils.return_object_list(task)[source]
cgl.plugins.blender.utils.review_exists(path_object)[source]
cgl.plugins.blender.utils.save_to_task(task)[source]

Saves a copy of the current file into a new version of the given task

Parameters:

task

cgl.plugins.blender.utils.scene_elem(elem)[source]
cgl.plugins.blender.utils.search_dialog(list, command, flags=None)[source]
cgl.plugins.blender.utils.select_objects(list)[source]
cgl.plugins.blender.utils.select_reference(collection_name)[source]

Selects all objects in the specified collection.

Parameters: collection_name (str): The name of the collection to select objects from.

cgl.plugins.blender.utils.selected_library(selected=None)[source]
cgl.plugins.blender.utils.selection(object=None, clear=False)[source]
cgl.plugins.blender.utils.set_all_paths_relative(default=True)[source]
cgl.plugins.blender.utils.set_collection_name(obj=None)[source]
cgl.plugins.blender.utils.set_context_view_3d()[source]
cgl.plugins.blender.utils.set_default_scene_settings()[source]
cgl.plugins.blender.utils.set_framerange(start, end)[source]
cgl.plugins.blender.utils.set_object_names_from_library(objects=None)[source]
cgl.plugins.blender.utils.set_subdivs(iterations=1, type_=1)[source]
Parameters:
  • iterations – default is 1

  • type – 1: catclark, 0: None

Returns:

cgl.plugins.blender.utils.setup_preview_viewport_display(object)[source]

set up the default viewport display color diffuse_color on materials

Parameters:
  • color – Value of the color of the parent menu FloatProperty 4

  • selection

cgl.plugins.blender.utils.switch_item_on_library(object, item, value)[source]
cgl.plugins.blender.utils.switch_library(library, path_object)[source]
cgl.plugins.blender.utils.switch_overlays(visible=False)[source]
cgl.plugins.blender.utils.tag_scene(tag, value=None)[source]
cgl.plugins.blender.utils.update_libraries_project(project=None)[source]
cgl.plugins.blender.utils.valid_task_exists(task)[source]

Looks in a scene to see if a group node with name task exists and has children.

Parameters:

task – name of the group node to look for in the scene

cgl.plugins.blender.utils.write_layout(outFile=None)[source]

Writes layout to json file

Parameters:

outFile (str) – path to json file

Module contents