Change focus from console window to node editor window

Scripting in Blender with Python, and working on the API

Moderators: jesterKing, stiv

Posts: 22
Joined: Thu Mar 29, 2012 6:26 am

Change focus from console window to node editor window

Postby wretch1958 » Tue Sep 25, 2012 12:52 am

If I am in a Python console window, and also have a node editor window open, and I try the command "bpy.ops.node.xxxxnodecommandxxx" for any node editor context sensitive commands, it gives me an incorrect context error because I am in the Python window, not the node editor window. How do I change the window focus from the Python console?

Posts: 894
Joined: Sun Apr 05, 2009 7:42 pm
Location: Germany

Postby CoDEmanX » Tue Sep 25, 2012 1:27 pm

put the bpy.ops call into the simple operator template, change it to be a node operator, remove the test call at the bottom, run script, go to node view and hit spacebar, type the name of your new operator and click/return

you can also override the context, see: ... ng-context
I'm sitting, waiting, wishing, building Blender in superstition...

Return to “Python”

Who is online

Users browsing this forum: No registered users and 3 guests