Custom drag import is a blender addon that allow you to custom your drag import handle You can add your custom drag config, and set your custom scripts to do something after import
- click the add button
- add name
- add file extensions
- save config
Config will be save to CustomDragImport\asset\config\default.json
, make sure to copy it when update addon
You are allow to use Ctrl Alt Left-Drag
/ Ctrl Shift V
to import file from clipboard
Config Struct
{
"obj cutom": {
"bl_import_operator": "wm.obj_import",
"bl_file_extensions": ".obj;.OBJ",
"poll_area": "VIEW_3D",
"operator_context": "EXEC_DEFAULT",
"foreach_post_script": "alignAxisX.py"
},
...
}
You are allow to use built-in script to modifier your object after import a file
before import all file, execute it
After Import All Files, execute it
Before Import Each File, execute it
After Import Each File, execute it
Post Script
- dropOnSurface.py: place import file on where your mouse click the import menu
- importFileAsNodes.py: allow to import more that one image as nodes in 4.1(4.2 is supported by default)
- setupPBRTextures.py: allow to setup pbr textures for drag images(select a bsdf prin node first)
For each post Script
- addCollection.py: add collection for the import file which name with filename
- alignAxisX.py: align objects on x axis
- drop2floor.py: drop every object to floor basic
Example
- printArgs.py: see [Script Example](# Custom Script Example)
- viewSelect.py: view select after import
You can use args which provided by this addon
import bpy
from cdi_tool.debugLog import DebugLog
event = globals().get('event')
# each
filepath = globals().get('filepath')
index = globals().get('index')
selected_objects = globals().get('selected_objects')
selected_nodes = globals().get('selected_nodes')
# all
directory = globals().get('directory')
files = globals().get('files')
logger = DebugLog()
logger.debug(f'event:{event}\n'
f'filepath:{filepath}\n'
f'index:{index}\n'
f'selected_objects:{selected_objects}\n'
f'selected_nodes:{selected_nodes}\n'
f'directory:{directory}\n'
f'files:{files}\n')