Pie Menu Editor 1.18.7

Hi Roaoao
i wan to create a double press shortcut when the fears press open a modal a menu or a pop up
bot this situations stop the second press to be register
for example pres " E " to extrud, second e press close the modal and open a menu
how can i solve it ?
a work around cold be to create a custom modal
is there away to add a shortcut inside of and existing modall with out creating it from scratch ?

Hi @cgstudent,
No, unfortunately we can’t do this afaik.

1 Like

Thanks for that!! :smile:
I’m trying to use this with Dynamic Paint modifier. It works for each object separately but, do you think is possible to use one command to assign the modifier at both objects, the selected one as Canvas and the active one as Brush?

Yes, try something like this:

ao = C.active_object; sos = C.selected_objects; so = len(sos) > 1 and (sos[0] if ao is sos[1] else sos[1]); bpy.ops.object.modifier_add(dict(object=so), type='DYNAMIC_PAINT'); bpy.ops.object.modifier_add(dict(object=ao), type='DYNAMIC_PAINT'); bpy.ops.dpaint.type_toggle(dict(object=so), type='CANVAS'); ao.modifiers[-1].ui_type = 'BRUSH'; bpy.ops.dpaint.type_toggle(dict(object=ao), type='BRUSH')
2 Likes

roaoao
When create modal operator for extrude and inset, the on invoke tab does not show properties like move x,y,z or flip normals just show invoke default and undo flag.
Also when confirm or cancel the modifier do not exit form the modal and have to cancel or confirm twice to exit, how to solve it ?
this is the pie menue my_pie_menus.json (607 Bytes)

Cold you please provide sample of a coma that cancel the modal (like when press esc)
Thanks ! :slight_smile:

ok this works but I can’t seem to find how to assign settings like the one below to the Canvas object. Adding this command to your script has no effect, it still adds the canvas with surface type as “Paint”.

bpy.context.object.modifiers[“Dynamic Paint”].canvas_settings.canvas_surfaces[“Surface”].surface_type = ‘WEIGHT’

Also, to extend this function, I made another macro operator which
a)adds Dynamic Paint modifier as canvas to the selected object and
b)adds a cube, assigns it a Dynamic Paint modifier to use as Brush
but this assigns the Dynamic paint modifier as Brush to the selected object and adds the cube without any modifiers.
Any ideas?
Thank you in advance for your huge patience :blush:

You use bpy.ops.view3d.edit_mesh_extrude_move_normal() operator which doesn’t have any properties. Try to use bpy.ops.mesh.extrude_region_move() instead.

Inset operator shows properties for me. What code do you use for it?

Did you try to call operator without interactive mode? Eg for inset modifier:

bpy.ops.mesh.inset('EXEC_DEFAULT', True)

Add a new Command slot with comma hotkey and this code:

cancel()
2 Likes

Here is an example for to the previous code:

ao = C.active_object; sos = C.selected_objects; so = len(sos) > 1 and (sos[0] if ao is sos[1] else sos[1]); bpy.ops.object.modifier_add(dict(object=so), type='DYNAMIC_PAINT'); bpy.ops.object.modifier_add(dict(object=ao), type='DYNAMIC_PAINT'); bpy.ops.dpaint.type_toggle(dict(object=so), type='CANVAS'); so.modifiers[-1].canvas_settings.canvas_surfaces[0].surface_type = 'WEIGHT'; ao.modifiers[-1].ui_type = 'BRUSH'; bpy.ops.dpaint.type_toggle(dict(object=ao), type='BRUSH')
1 Like

Please export and pm me the macro.

1 Like

that helps a lot thanks

the problem now is that using the extrude modal Modal Ex.json (1.0 KB)
when try

C.active_operator.TRANSFORM_OT_translate.value

give an error relative to sum entire to a vector

then add z. No error an show the property, but doesn’t modify the mesh

C.active_operator.TRANSFORM_OT_translate.value.z

happens the same whit the inset modal Modal In.json (725 Bytes)
(the sample modal from the tuto works)

i add an On cancel command that launch a menu. This work whit blender menus but when try to launch a Modal does not work

can you please provide sample code for toggle a boolean property
and sample code for a drop down property like transform orientation proportional falloff

thanks !

For Modal Ex try this instead:

C.active_operator.macros['TRANSFORM_OT_translate'].properties.value.z

Modal In works for me. Try to set custom Step in Thickness slot.

Which one Modal doesn’t work and what code do you use? Move modal tool works for me.

Where you want to toggle them? In modal operators?

2 Likes

@roaoao, is it possible to set current Active Tool as Context/ Poll method?

Hi @roaoao
There are a bunch of objects with two channels. Is it possible to switch between these channels for several objects at once?

Try this code:

tool = C.workspace.tools.from_space_view3d_mode(C.mode); return tool.idname == "builtin.select_lasso"
3 Likes

Please post a screenshot with channels and objects.

1 Like

All objects have 2 UV cards. When you select all the objects and click on the map, the last object will have UVmap2 and the rest will have UVmap1. Is it possible to use PME to create a macro to select the last active UV map if all objects have the same number.
How can I work with the “if, else, then and or” commands inside the PME.
I apologize, but coding is not given at all.

You can try the ReTiCo addon. It can set active UV channel on multiple objects (2 channels max though)

1 Like

Add a new Regular Menu with 1 slot and use this code in Custom tab (or import this file):

uvs = sorted({k for obj in C.selected_objects if hasattr(obj.data, "uv_layers") for k in obj.data.uv_layers.keys()}); [operator(L, "pme.exec", text=uv, icon='UV', cmd="[setattr(obj.data.uv_layers, 'active', obj.data.uv_layers['%s']) for obj in C.selected_objects if hasattr(obj.data, 'uv_layers')]" % uv) for uv in uvs]

It generates a list of UVMap buttons which apply selected uvmap on selected objects

If-else:

[True-execution] if [condition] [else] [False-execution]

If:

[True-execution] if [condition] [else] None

Also check this post

3 Likes

Thank you very much, this is very cool. :star_struck:
Gone to smoke manuals.

Is it possible to use sub panels in a panel group? https://docs.blender.org/api/current/bpy.types.Panel.html#bpy.types.Panel.bl_parent_id

I’m having trouble even putting a sub panel right now from a different addon. Though it could be an issue with that addon perhaps. The first sub panel comes over fine but the second just shows up empty in the panel group. This is how the sub panels look in an addon.
image

This si how i’ve set up my panel group: image

This is it not showing up in the panel group:

Also is there a way to hide/resize the panel headers? They can take up quite some room.