katana_io¶
-
katana_io.
build_asset_path_expression
(ast_stype, ast_code, file_path, category, context='', for_asset='', for_ast_sk='')¶ builds a path expressions that makes up the given file_path from recipe graph state variables, if the given path is versioned, the version number will also be set as an expression from the node’s version attr value.
Parameters: - ast_node – the node the file path expression is being built for.
- ast_stype –
- ast_code –
- file_path – the file path to be converted into an expression style
- category –
- build_graph_path – if True, the
- for_asset – the current asset_name (the value of the variables.asset - the sessions current asset)
- for_ast_sk – the search key of the current asset (sk of the session current task).
Returns: (suggested_node_name, load_at_location_expr, asset_file_path_expr)
-
katana_io.
build_load_location_path
(file_path, category, for_asset, assetNodeName, ast_stype=None, ast_code=None)¶ Builds a scenegraph location path where the given asset file should be evaluated
Parameters: - file_path –
- category –
- for_asset –
- assetNodeName –
Returns: path (ie, ‘/root/world/assets/category/assetName/assetName_context_ast’)
-
katana_io.
gen_dep_file
(asset_name, context, future_version, category, sk, dep_file, nreal_brain, additional_deps=None)¶ Writes json assets dependencies .dep file for the given asset root
Parameters: - asset_name – nice asset name
- context – current task context
- future_version – as int or %03d
- category – asset category
- sk – current asset sk
- dep_file – destination file path to be generated
- nreal_brain – an instance of nreal_brain of the current katana session
- additional_deps – a list of asset members dictionaries, where each dict should contain at least the keys: [‘ast’, ‘context’, ‘version’, ‘category’, ‘type’, ‘ast_sk’]
Returns: file path of the generated .dep file
-
katana_io.
get_asset_info
(node, nreal_brain=None, task_control=None)¶ Parameters: - node – NodegarphAPI node.
- nreal_brain – if no nreal_brain server instance passed, latest and current versions will not be queried and ‘– unknown –’
will be returned on them, while everything else will be returned as expected. :return: dict information about the given asset node as:
- {‘ast_root’: ast_root, ‘ast’: ast, ‘category’: category, ‘context’: context, ‘version’: version,
- ‘current_version’: current_version, ‘latest_version’: latest_version, ‘ast_sk’: ast_sk}
-
katana_io.
get_asset_location_parameter
(node)¶
-
katana_io.
get_asset_path_parameter
(node)¶ Tries until find the proper asset path parameter object and return it :param node: :return: the parameter object that has the asset file path
-
katana_io.
get_group_nodes
(group)¶ Recurse inside the given group node and return the list of all the nodes inside it directly or indirectly. :param group: group node :return: list of nodes
-
katana_io.
get_input_nodes
(node)¶ Traverse through the whole branch ends by the given node, and return all the nodes of it. :param node: :return: list of upstream nodes
-
katana_io.
get_nodes
(type=None, types=[])¶ Gets a list of all the nodes from the given type found in the recipe
Parameters: type – node type Returns: list of NodegraphAPI nodes
-
katana_io.
get_version
(node, nreal_brain)¶ Get the version of the given node :param nreal_brain: :param node: :return: float(version)
-
katana_io.
is_asset
(node, task_control=None)¶
-
katana_io.
load_asset
(self, depFile_data, method, for_asset, for_context, ignore_dup=True, database_data={}, load_as_expr=False, **kwargs)¶ Parameters: - self – Optionally, can be an instance of Katana Task Control class
- depFile_data –
- {
- ‘asset_name’: <asset_name>, ‘dep_context’: <context>, ‘dep_process’: <process>, ‘dep_file’: <file_path>, ‘dep_type’: <snapshot_type>, ‘checkout_method’: <method>, ‘dep_version’: <dep_version>, ‘dep_ast_sk’: <ast_sk>, ‘dep_category’: <category>, ‘for_ast_sk’: <parent_asset_sk>
} :param method: :param for_asset: :param for_context: :param ignore_dup: :param database_data:
Returns:
-
katana_io.
open_recipe
(self, asset_file, asset_type, database_data={}, **kwargs)¶
-
katana_io.
reference_asset
(self, depFile_data, method, for_asset, for_context, ignore_dup=True, database_data={}, **kwargs)¶
-
katana_io.
retarget_asset
(self, current_process, srcRetargetFiles, dst_refNode_patterns, for_asset='', for_context='', ignore_dup=True, database_data={}, deps_data=[], **kwargs)¶ Retarget wont be needed in Katana, you may think about deleting the following code in the future
-
katana_io.
setNodeColor
(node, color=[])¶
-
katana_io.
update_graph_state_variables
(variables=[], brain=None, exclude=[])¶ Create/Update the global graph state variables list from the given variables dictionaries list, and updates katana’s variable user interface to have them available to the user
Parameters: - variables – list of dictionary of [{‘name’: .., ‘values’: .., values_list(), ‘’}, …]
- nreal_brain – an instance of NReal nreal_brain stub
Returns:
-
katana_io.
update_nodes_version
(nreal_brain, nodes=None)¶ loop over the script nodes and set the internal node version to match the file version it references :param nodes: list of nuke nodes, if None, all nodes will be updated whenever this is possible :param nreal_brain: :return:
-
katana_io.
update_user_props
(node, asset_data=None, asset_name='', context='', category='', ast_type='', version=0, ast_sk='')¶ Create/update asset data information on astInfo parameter group on the given node
Parameters: - node – asset node (NodegraphAPI node)
- asset_data – this can be optionally a depFile_data dict as provided by nreal_brain, or a .dep json file path.
if asset_name is provided directly as arg, asset_data will be ignored and the following provided args will take plase :param asset_name: :param context: :param category: :param ast_type: :param version: :param ast_sk: :return: