Pie Menu Editor 1.18.7

Please try to install Blender from this page.

No good, another error

Edit: Iā€™m only installing the 2.79 version by the way, have yet to attempt 2.80

Hello,

Iā€™m trying to call a script that will automatically add connected nodes to the current node tree. It looks like this

import bpy

for i in range(1):
     #specifcy node tree
     myTree = bpy.data.node_groups['Pop ups']
     
     #location offset
     offsetX = i *400
     
     #add Time Info Node
     mytime = bpy.data.node_groups['Pop ups'].nodes.new("an_TimeInfoNode")
     mytime.location=offsetX, 0
     
     #add Delay Time Node
     mydelay = bpy.data.node_groups['Pop ups'].nodes.new("an_DelayTimeNode")
     mydelay.location=offsetX+200,0

     #Connect Frame, Time
     nodetree=bpy.data.node_groups['Pop ups']
     nodetree.links.new(mytime.outputs['Frame'],mydelay.inputs['Time'])
     
    

Iā€™m wondering how set the nodetree contextually. That is, when I call the external script, the active node tree is passed into the script, and the nodes are added/connected to the current node tree.

You can use context.material.node_tree if youā€™re running the script from the node editor.

Could you provide an example of how I would do that in PME?

I donā€™t have AN installed, but judging from your external script you can replace:

myTree = C.material.node_tree

Then on the rest of the code omit bpy.data.node_groups['Pop ups'] and use:

my_node = myTree.nodes.new('SomeNode')

Edit:
Quick example that adds an image node to the active material:

from bpy import context

ntree = context.material.node_tree

image_node = ntree.nodes.new('ShaderNodeTexImage')
image_node.location.y = 400
1 Like

Is the functionality from shortcuts inside of PME a little different than when doing it directly inside of blenders keymap?

For example if I map ctrl-rmb to select edge ring then Lasso select still works as well with ctrl-rmb.
If I do the same mapping inside of PME weird random selection stuff is going on.
And if I deactivate Lasso select inside of the keymap and create both, edge ring select and lasso select inside of PME with the same hotkey, only 1 works.
Is there some way to act it the same as if I do it directly inside of the keymap?

Blender uses Tweak (Click Drag) hotkey mode for lasso select tool. You can select it in PME here.
Note that the keymap for both hotkeys should be the same.

Ah, thanks ā€¦ the keymap was the problem.
I set the edge select stuff to ā€œmeshā€ but the Lasso select to 3d since I wanted to use it for objects as well.
But then i will create a second one for objects :slight_smile:

Hi roaroao, as far I know itā€™s not possible to add mesh transform parameters to a button. But maybe you know some trick? thks

38

may I see how the code for the trackball toggle (the regular toggle you had to simply switch between modes) looks since my toggle sometimes works, and sometimes not.

Iā€™m using this code:

vrm = C.preferences.inputs.view_rotate_method; C.preferences.inputs.view_rotate_method = 'TRACKBALL'

C.preferences.inputs.view_rotate_method = vrm

No, transform panel is hardcoded because it uses some internal Blender data which is not available for add-ons.

Is there a way to create a hotkey that A: confirms the cut done with the knife tool and B: activates the ā€œselect and moveā€ tool?

I set up a stack key with these two entries. I like the stack key since it displays text for which one is activeā€¦

C.user_preferences.inputs.view_rotate_method = ā€˜TURNTABLEā€™
C.user_preferences.inputs.view_rotate_method = ā€˜TRACKBALLā€™

1 Like

A macro operator can do that. But Iā€™m not sure what the ā€˜select and moveā€™ tool is - you mean like tweak mode? they probably changed the name for 280. I think its: bpy.ops.wm.tool_set_by_id(name='builtin.select')

So If you add a knife operator to the first slot in a macro, then transform.translate in the second (or another transform operator like slide or shrink/fatten), the cut remains active after the knife operator and can be moved immediately.

Thanks, I will give that a try :slight_smile:

Hm ā€¦ I think what I need is the code to apply the knife tool
Do you or anyone else know the code for ā€œconfirmā€?

I donā€™t think that this is possible.

Thanks, roaoao.
If you donā€™t think that it is possible, it probably isnā€™t.

In 2.7 after confirming it would automatically switch back to select mode but in 2.8 the knife tool stays active for some reason.

Is it possible to execute a hotkey with a macro, like it is with a stack key?
Then the first Macro action would be ā€œspacebarā€ and the second ā€œswitch to select modeā€

Have you tried to use K hotkey? In this case 2.8 stays in select mode (or other active tool).
Or use this code if you want to use it in a pie:

bpy.ops.mesh.knife_tool()