mgear.core.utils

Utilitie functions

mgear.core.utils.as_pynode(obj)

Check and convert a given string to Pynode

If the object is not str or unicode or PyNode will raise type error

Parameters:obj (str, unicode, PyNode) – Object to check and/or convert to PyNode
Returns:the pynode object
Return type:PyNode
mgear.core.utils.gatherCustomModuleDirectories(envvarkey, defaultModulePath, component=False)

returns component directory

Parameters:
  • envvarkey – The environment variable key name, that is searched
  • defaultModulePath – The default module path for search in.
Returns:

[]string}

Return type:

Dict{string

mgear.core.utils.getModuleBasePath(directories, moduleName)

search component path

mgear.core.utils.importFromStandardOrCustomDirectories(directories, defaultFormatter, customFormatter, moduleName)

Return imported module

Parameters:
  • directories – the directories for search in. this is got by gatherCustomModuleDirectories
  • defaultFormatter – this represents module structure for default module. for example “mgear.core.shifter.component.{}”
  • customFormatter – this represents module structure for custom module. for example “{0}.{1}”
Returns:

imported module

Return type:

module

mgear.core.utils.is_odd(num)

Check if the number is odd.

Arguments: num (int): the number

Returns:True or False
Return type:bool
mgear.core.utils.one_undo(func)

Decorator - guarantee close chunk.

type: (function) -> function

mgear.core.utils.timeFunc(func)

Use as a property to time any desired function

mgear.core.utils.viewport_off(func)

Decorator - Turn off Maya display while func is running.

if func will fail, the error will be raised after.

type: (function) -> function