vtool.util¶
Class Summary
|
Simple base class for variables on a node. |
|
|
Utility to check how long a command takes to run. |
|
Initialize and reset this instance. |
Function Summary
|
Meant to have vtool look at a different path to load |
Removed currently sourced modules. |
|
|
Remove specified custom builtins from the global builtins module. |
|
Set up custom builtins for the current Python environment. |
|
Get a value from __custom__ module if it exists, otherwise return default. |
|
Initialize a new environment variable. |
|
Get the value of an environment variable. |
|
Set the value of an environment variable. |
|
|
|
|
|
Add a path to the python path, only if it isn't present in the python path. |
|
|
|
|
Activating the profiler will give extremely detailed information about what functions are running and in what order. |
|
|
|
|
|
|
|
|
Try a function and if it fails pass. Used as a decorator. Usage: @try_pass def myFunction(): do_something. |
|
|
|
|
Check if the shotgun api is available. |
|
Check if the shotgun tank api is available. |
|
Get where maya is currently running from. |
|
Check to see if scope is in Nuke |
|
|
Check to see if running in linux |
Check to see if running in windows |
|
Get the version of maya that the scope is running in. |
|
Check to see if Vetala break was signalled. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Easily convert to a sequence. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Get the number at the end of a string. |
|
Get the number at the very end of a string. |
|
|
|
Get the last number in a string. |
|
Get the last letter in a string. |
|
Replace the last number with something. |
|
|
|
Up the value of the last number by 1. |
|
|
|
unix style matching that also matches Maya's name search. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
This will split a line, ignoring anything inside quotes #re.split(';(?=(?:[^"]*"[^"]*")*[^"]*$) |
|
|
|
|
|
given a side name like: Left,left,L,lf,l this will return L given a side name like: Right,right,R,rt,r this will return R given a side name like: Center,center,C,ct,c this will return C |
Get a quick and dirty unique name. |
|
|
|
|
|
|
|
|
|
|
|
|
data_list and number_list need to be the same length |
|
|
|
|
|
|
|
- class Variable(name='empty')¶
Simple base class for variables on a node.
- Parameters
name (str) – The name of the variable.
- set_node(node_name)¶
Set the node to work on.
- Parameters
node_name (str) –
- set_name(name)¶
Set the name of the variable.
- Parameters
name (str) – The name to give the variable.
- set_value(value)¶
Set the value that the variable holds.
- Parameters
value –
- create(node)¶
- delete(node)¶
- class ControlName¶
- CONTROL_ALIAS = 'Control Alias'¶
- DESCRIPTION = 'Description'¶
- NUMBER = 'Number'¶
- SIDE = 'Side'¶
- set_control_alias(alias)¶
- set_left_alias(alias)¶
- set_right_alias(alias)¶
- set_center_alias(alias)¶
- set_use_side_alias(bool_value)¶
- set_uppercase(bool_value)¶
- set_control_order(list_value)¶
- set_number_in_control_name(bool_value)¶
- get_name(description, side=None)¶
- class StopWatch¶
Utility to check how long a command takes to run.
- running = 0¶
- watch_list = []¶
- start(description='', feedback=True)¶
- end(show_elapsed_time=True)¶
- stop()¶
- class VetalaHTMLParser¶
Initialize and reset this instance.
If convert_charrefs is True (the default), all character references are automatically converted to the corresponding Unicode characters.
- handle_starttag(tag, attrs)¶
- handle_endtag(tag)¶
- handle_data(data)¶
- get_body_data()¶
- CDATA_CONTENT_ELEMENTS = ('script', 'style')¶
- RCDATA_CONTENT_ELEMENTS = ('textarea', 'title')¶
- check_for_whole_start_tag(i)¶
- clear_cdata_mode()¶
- close()¶
Handle any buffered data.
- feed(data)¶
Feed data to the parser.
Call this as often as you want, with as little or as much text as you want (may include ‘n’).
- get_starttag_text()¶
Return full source of start tag: ‘<…>’.
- getpos()¶
Return current line number and offset.
- goahead(end)¶
- handle_charref(name)¶
- handle_comment(data)¶
- handle_decl(decl)¶
- handle_entityref(name)¶
- handle_pi(data)¶
- handle_startendtag(tag, attrs)¶
- parse_bogus_comment(i, report=1)¶
- parse_comment(i, report=True)¶
- parse_declaration(i)¶
- parse_endtag(i)¶
- parse_html_declaration(i)¶
- parse_marked_section(i, report=1)¶
- parse_pi(i)¶
- parse_starttag(i)¶
- reset()¶
Reset this instance. Loses all unprocessed data.
- set_cdata_mode(elem, *, escapable=False)¶
- unknown_decl(data)¶
- updatepos(i, j)¶
- replace_vtool(path_to_vtool)¶
Meant to have vtool look at a different path to load
- unload_vtool()¶
Removed currently sourced modules. This allows you to insert a custom path at the start of the sys.path and load vetala from there.
- get_code_builtins()¶
- reset_code_builtins(builtins=None)¶
Remove specified custom builtins from the global builtins module.
- Parameters
builtins (list or set) – Names of builtins to remove. Defaults to get_code_builtins().keys().
- setup_code_builtins(builtin=None)¶
Set up custom builtins for the current Python environment.
- Parameters
builtin (dict) – A dictionary of builtins to set. Defaults to get_code_builtins().
- get_custom(name, default='')¶
Get a value from __custom__ module if it exists, otherwise return default.
- initialize_env(name)¶
Initialize a new environment variable. If the variable already exists, does nothing, no environment variable is initialized.
- Parameters
name (str) – Name of the new environment variable.
- get_env(name)¶
Get the value of an environment variable.
- Parameters
name (str) – Name of an environment variable.
- Returns
str:
- set_env(name, value)¶
Set the value of an environment variable.
- Parameters
name (str) – Name of the environment variable to set.
value (str) – If a number is supplied it will automatically be converted to str.
- suggest_env(name, value)¶
- start_temp_log()¶
- record_temp_log(value)¶
- end_temp_log()¶
- get_last_temp_log()¶
- add_to_PYTHONPATH(path)¶
Add a path to the python path, only if it isn’t present in the python path.
- Parameters
path (str) – The path to add to the python path.
- try_import(module_name)¶
- profiler_event(frame, event, arg, indent=None)¶
- activate_profiler()¶
Activating the profiler will give extremely detailed information about what functions are running and in what order.
- stack_trace()¶
- print_python_dir_nicely(python_object)¶
- scale_dpi(float_value)¶
- stop_watch_wrapper(function)¶
- try_pass(function)¶
Try a function and if it fails pass. Used as a decorator. Usage: @try_pass def myFunction():
do_something
- is_str(value)¶
- is_iterable(obj)¶
- is_stopped()¶
- is_in_maya()¶
- is_in_unreal()¶
- is_in_houdini()¶
- has_shotgun_api()¶
Check if the shotgun api is available.
- Return type
bool
- has_shotgun_tank()¶
Check if the shotgun tank api is available.
- Return type
bool
- get_current_maya_location()¶
Get where maya is currently running from.
- is_in_nuke()¶
Check to see if scope is in Nuke
- Return type
bool
- is_linux()¶
Check to see if running in linux
- Return type
bool
- is_windows()¶
Check to see if running in windows
- Return type
bool
- get_maya_version()¶
Get the version of maya that the scope is running in.
- Returns
The date of the Maya version.
- Return type
int
- get_unreal_version()¶
- break_signaled()¶
Check to see if Vetala break was signalled.
- Return type
bool
- get_class_methods(class_object)¶
- get_tabs()¶
- get_log_tabs()¶
- show_list_to_string(*args)¶
- show(*args)¶
- warning(*args)¶
- error(*args)¶
- convert_to_sequence(variable, sequence_type=<class 'list'>)¶
Easily convert to a sequence. If variable is already of sequence_type, pass it through. If variable is a list and sequence_type is tuple, convert to tuple. If variable is a tuple and sequence_type is list, convert to list. If variable is not a list or tuple, then create a sequence of sequence type.
Basically insures that a variable is a list or a tuple.
- Parameters
variable – Any variable.
sequence_type – Can either be python list or python tuple. Needs to be the type object, which means pass it list or tuple not as a string.
- Returns
Returns list or tuple depending on the sequence_type.
- Return type
list, tuple
- convert_str_to_list(str_value)¶
- uv_to_udim(u, v)¶
- convert_number_to_month(month_int)¶
- get_current_time(date_and_time=True)¶
- get_current_date()¶
- get_numbers(input_string)¶
- get_float_numbers(input_string)¶
- get_split_string_and_numbers(input_string)¶
- get_first_number(input_string, as_string=False)¶
- get_last_number(input_string)¶
- get_last_letter(input_string)¶
- get_end_number(input_string, as_string=False)¶
Get the number at the end of a string.
- Parameters
input_string (str) – The string to search for a number.
as_string (bool) – TODO: Fill in description.
- Returns
The number at the end of the string.
- Return type
int
- get_trailing_number(input_string, as_string=False, number_count=- 1)¶
Get the number at the very end of a string. If number not at the end of the string return None.
- search_first_number(input_string)¶
- search_last_number(input_string)¶
Get the last number in a string.
- Parameters
input_string (str) – The string to search for a number.
- Returns
The last number in the string.
- Return type
int
- search_last_letter(input_string)¶
Get the last letter in a string.
- Parameters
input_string (str) – The string to search for a number.
- Returns
The last number in the string.
- Return type
int
- replace_last_number(input_string, replace_string)¶
Replace the last number with something.
- Parameters
input_string (str) – A string to search for the last number.
replace_string (str) – The string to replace the last number with.
- Returns
The new string after replacing.
- Return type
str
- increment_first_number(input_string)¶
- increment_last_number(input_string, padding=1)¶
Up the value of the last number by 1.
- Parameters
input_string (str) – The string to search for the last number.
padding (int) – TODO: Fill description.
- Returns
The new string after the last number is incremented.
- Return type
str
- find_special(pattern, string_value, position_string)¶
- Parameters
pattern (str) – A regular expression pattern to search for.
string_value (str) – The string to search in.
position_string (str) – ‘start’,’end’,’first’,’last’,’inside’ Where the pattern should search.
- Returns
(start_int, end_int) The start and end index of the found pattern. Returns (None,None) if nothing found.
- Return type
tuple
- unix_match(pattern, name_list)¶
unix style matching that also matches Maya’s name search.
- replace_string(string_value, replace_string, start, end)¶
- replace_string_at_end(line, string_to_replace, replace_string)¶
- replace_string_at_start(line, string_to_replace, replace_string)¶
- clean_file_string(string)¶
- clean_name_string(string_value, clean_chars='_', remove_char='_')¶
- camel_to_underscore(name)¶
- remove_side(name)¶
- split_line(line, splitter=';', quote_symbol='"')¶
This will split a line, ignoring anything inside quotes #re.split(‘;(?=(?:[^”]*”[^”]*”)*[^”]*$)
- convert_text_for_sorting(text)¶
- get_square_bracket_numbers(input_string)¶
- get_side_code(side_name)¶
given a side name like: Left,left,L,lf,l this will return L given a side name like: Right,right,R,rt,r this will return R given a side name like: Center,center,C,ct,c this will return C
- get_unique_name()¶
Get a quick and dirty unique name.
- truncate_string(text, max_length)¶
- is_left(side)¶
- is_right(side)¶
- is_center(side)¶
- split_side_negative_number(name)¶
- find_possible_combos(names, sort=False, one_increment=False)¶
- sort_data_by_numbers(data_list, number_list)¶
data_list and number_list need to be the same length
- sort_string_integer(list_of_strings)¶
- sort_function_number(item)¶
- compare_dict(dict1, dict2)¶
- copy_to_clipboard(text)¶