State:New|TargetRelease:No Target|icon_bug|icon_nuke|database:public|Resolution:Fixed|BugID:387512|
nuke.nodePaste() to create Nodes from dropped Gizmos or Nuke scripts.nukescripts.dropData() call.
def importGizmo(Type, text): # Split text variable to get the filename and extension file = os.path.basename(text) filename = file.split('.')[0] extension = file.split('.')[1] # If the file is a .gizmo, create the Gizmo if extension == 'gizmo': newNode = nuke.nodePaste(text) newNode.setName(filename) return True return Falsenukescripts.addDropDataCallback(importGizmo)if __name__ == "__main__": nukescripts.dropData('text/plain', "C:/path/to/custom/TestGizmo.gizmo") nukescripts.dropData() with your custom Gizmo path ( Last line in the snippet )PySide2.QtCore.QTimer.singleShot() delay.nuke.nodePaste() function:
import PySide2from PySide2 import QtCorefrom PySide2.QtCore import QTimerdef pasteDropNode(filename, text): newNode = nuke.nodePaste(text) newNode.setName(filename)def importGizmo(Type, text): # Split text variable to get the filename and extension file = os.path.basename(text) filename = file.split('.')[0] extension = file.split('.')[1] # If the file is a .gizmo, if extension == 'gizmo': QTimer.singleShot(0, lambda: pasteDropNode(filename, text)) return True return Falsenukescripts.addDropDataCallback(importGizmo) We're sorry to hear that
Please tell us why