As an exercise, I updated Tim Crowson’s Multi_ImporterPPG addon with a DragAndDrop event, so you can import multiple files with a single drag-and-drop. You can download the modified version here.
Here’s the DragAndDrop event handler. The doit() function is also used by the Import menu command; I just had to generalize it a bit to work in either case (menu or drag-and-drop).
def Multi_Importer_DragAndDrop_OnEvent( in_ctxt ): action = in_ctxt.GetAttribute( "DragAndDropAction" ) source = in_ctxt.GetAttribute( "DragSource" ) if action == constants.siSourceDragAction: if re.search( r"\obj$", source, re.I ): in_ctxt.SetAttribute( "DragSourceSupported", True ) elif re.search( r"fbx$", source, re.I ): in_ctxt.SetAttribute( "DragSourceSupported", True ) elif re.search( r"emdl$", source, re.I ): in_ctxt.SetAttribute( "DragSourceSupported", True ) elif re.search( r"lwo$", source, re.I ): in_ctxt.SetAttribute( "DragSourceSupported", True ) else: in_ctxt.SetAttribute( "DragSourceSupported", False ) if action == constants.siSourceDropAction: Application.SetValue('preferences.Interaction.autoinspect', False, '') if not Application.ActiveSceneRoot.Properties( 'Multi_Importer' ): vtcol = Application.AddProp('Multi_Importer','Scene_Root') p = Application.Dictionary.GetObject( vtcol.Value("Value") ) # Set the flag that hides certain parts of the PPG layout p.Parameters("bMenuCommand").Value = False # Inspect the PPG in modal mode Application.InspectObj( vtcol.Value("Value"), "", "", 4 ) p.Parameters("bMenuCommand").Value = True p = Application.ActiveSceneRoot.Properties('Multi_Importer') options = { 'OBJgrouping' : p.Parameters('importOBJgrouping').Value, 'OBJhrc' : p.Parameters('importOBJhrc').Value, 'importOBJnormals' : p.Parameters('importOBJNormals').Value, 'includeOBJmat' : p.Parameters('includeOBJMaterial').Value, 'includeOBJuv' : p.Parameters('includeOBJUV').Value, 'includeOBJwrap' : p.Parameters('includeOBJUVWrap').Value, 'fbxScale' : p.Parameters('fbxScale').Value, 'importEMDLasRef' : p.Parameters('importEMDLasRef').Value, 'lwoScaleFactor' : p.Parameters('lwoScaleFactor').Value } doit( source, options ) return True
Oh thanks, man! This is great!
Fantastic update, I use this tool daily.
Super, Fantastic o 🙂
Bravo! Thanks 🙂