Skip to content

Instantly share code, notes, and snippets.

@r4inm4ker
Created August 27, 2016 22:23
Show Gist options
  • Save r4inm4ker/69ff3c0313b6aff6cd7767061604c2dd to your computer and use it in GitHub Desktop.
Save r4inm4ker/69ff3c0313b6aff6cd7767061604c2dd to your computer and use it in GitHub Desktop.
callbackOnImport
'''
source : https://groups.google.com/forum/?utm_medium=email&utm_source=footer#!msg/python_inside_maya/rpO70NI1jc0/I10eDlxZCQAJ
'''
import maya.OpenMaya as om
def catchFileImport(ret, fileObj, *args):
print "Importing:", fileObj.resolvedFullName()
om.MScriptUtil.setBool(ret, True)
mid = om.MSceneMessage.addCheckFileCallback(om.MSceneMessage.kBeforeImportCheck, catchFileImport)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment