Customize Menu Editor

no i mean , our own properties like bool prop, enum prop,
so in a use case scenario,

if bool1 == True , then only show buttons in the menu,
else show some other buttons ,

in this case we will need a bool prop,
there can be a lot of use of this functions ,
what do you think

1 Like

I understood.
Certainly it seems convenient.
I consider the implementation method and implement it if possible.

I wrote documentation page.
The site is written in Japanese, but automatic translation is available.

Customize Menu Editor【Documents】 – 忘却まとめ
https://bookyakuno.com/doc/customize-menu-editor/

2 Likes

The addon Scatter Objects has no button (only search bar accessible). I want to create a button with Customize Menu Editor. Unfortunately it does not work as expected (not even with macro recorder). Any tips ?.

I made a video to register the “Scatter Object” add-on menu.
If you register as “Operator” type, it should work properly.
Also, if you want to use an operator who enters a special operation mode with the “Command” type or macro,‘INVOKE_DEFAULT’ is required.

(The video add-on menu is the latest version, so it’s a little different, but don’t worry)

The Operator, who enters a special operation mode,Requires ‘INVOKE_DEFAULT’

1 Like

Wow, that was a quick and well done answer. Now it works. I have waited a long time for such an addon. Thank you so much. :+1:

1 Like

ver1.2.0 update

User property, Add menu display location, Avoid macro error

Advanced features have been added to create more flexible menus.

  • Add use_property_split to layout options
  • Direct input of layout code is possible
  • Change the display location of panel menu
  • Add “Avoid error” option to macro
  • Add user property
  • Bug fix for “Export as add-on”
  • Added option to automatically convert’bpy.data.xxx[xxx]’ to’bpy.context.xxx’ in history or macro

Link

【Customize Menu Editor ver1.2.0 アップデート】メニュー表示場所の追加・マクロのエラー回避・ユーザープロパティ【Blenderアドオン】 – 忘却まとめ

Edit menu

The display of the edit menu has been improved to make it easier to identify the difference between display switching and type switching.

  • You can now choose the type of menu item to add
    • “+” button at the upper left corner
  • Changed the duplication position of menu items to be below the active item

add use_property_split

Added use_property_split to layout options.
The property label and button are displayed separately.
This is useful when using FloatProperty or when you want to display many properties side by side.

  • With use_property_split option, you can set use_property_decorate
    • Show the add keyframe button next to the property

Direct layout input

You can directly enter the layout script in the “layout element only” type.

  • It should be shaped like layout.xxx
  • If you enter multiple lines with “;”, they will be side by side.
    • If you want to align vertically, you need to enter the column manually
  • For advanced users

Ability to change the display location of the panel menu

Editor type that displays the panel menu- Limited display mode in 3D view You can set the display location in the property editor.
This setting is also reflected when “Export as Add-on” is executed.

Editor type

  • 3D View
  • Image Editor
  • Node Editor
  • Dopesheet Editor
  • Graph Editor
  • Nla Editor
  • Clip Editor
  • Sequence Editor
  • Properties
  • Text Editor

Limited type of display mode in 3D view

In 3D view, you can limit the display mode.

  • None
  • Mesh Edit
  • Curve Edit
  • Surface Edit
  • Text Edit
  • Armature Edit
  • Metaball Edit
  • Lattice Edit
  • Pose Mode
  • Sculpt Mode
  • Weight paint
  • Vertex paint
  • Image paint
  • Particle Mode
  • Object Mode

Where the tab is displayed in the Property Editor

In Property Editor, you can set the display location of the tab.

  • tool
  • render
  • output
  • view_layer
  • scene
  • world
  • object
  • modifier
  • particles
  • physics
  • constraint
  • data
  • material
  • texture

macro

Added “Avoid errors” option

I tried to avoid the error.

  • The line that executed and had an error is displayed in red
  • If the command encounters an error, slew that line and continue
  • If you want to see the error log and debug, turn off this option
  • When making an add-on, the lines that are in red due to an error are passed through

Register the macro edit list as a menu

I made a function to add a macro edit list to the menu so that the macro can be easily accessed.

  • Register a list of macros as a menu
  • Register a list of macro lines as a menu
  • This menu cannot be exported by “Export as add-on”.

User property

Users can create properties.
You can perform advanced processing using properties.
For advanced users.

  • When exported as an add-on, they are exported together
  • User property list can be written to and read from a file

Types available

type Explanation
bool Truth
string String
int integer
float Floating point

The above property types are available.

Other configurable data

type Explanation
var_name Variable name of the property used internally
Unique name
Space cannot be used
default Set the initial value of the property
Used when exported as an add-on
name The name of the property
description Property description
subtype You can set the data type of int/float/string
unit Unit of int/float data can be set
min You can set the minimum value of int/float
max You can set the maximum value of int/float

Usage within add-on

uprop ( "var_name" )

You can use the above code as a property.

  • “Command” type, “Layout” type macro
    • Returns the value of the user property item for the variable name in var_name
  • “Property”
    • Display the user property item with the variable name of var_name as a menu

bpy.context.preferences.addons['customize_menu_editor'].preferences.customizemenu_colle_uprop['var_name'].bool

To access from outside the addon, you need to write as above.

  • “customize_menu_editor” is the folder name of Customize Menu Editor
  • ‘var_name’ is the variable name of the data you want to get
  • ‘bool’ is the property type

Export as add-on

You can now export as an add-on from the user settings.

The settings are saved as add-on settings, and you can save input when exporting again.
You can also export and change settings from add-on settings.

  • The following settings can now be exported as add-ons
    • User property
    • Panel menu category
    • Panel menu editor type
    • Limited display mode in 3D view of panel menu
    • Display location in the property editor of the panel menu
  • Not only the menu but also many data can be added on, so the name of the function has been changed
    • old " Export menu as add-on "
    • new " Export as add-on "

Bug fix

  • Fixed an issue where add-on export could not be performed on Linux or Mac

Get previous history

  • Fixed a problem that the history cannot be acquired normally when there is a space in the object name etc. in the “property” type
  • Improved so that the automatically generated button name will be shorter if possible if it has more than 30 characters.

Automatically convert’bpy.data.xxx[xxx]’ to’bpy.context.xxx’

When retrieving history, rewrite the history so that the code always works on active data.

Currently only the following data is supported.

  • various objects
  • shape_keys
  • materials
  • particles

The details

  • bpy.data.xxx[xxx]~ is specific data in Blender
  • bpy.context.xxx~ is the currently active data, and it always changes depending on the user operation.
  • If you want your code to always work for certain data, turn this setting off
  • You can use this option with “command” type, “property” type macros

Example: Changing material node properties

Even if you register the history of the property change of the material node as it is, it always works only with a specific material.
The options can be rewritten as below to work with the active material.

Original code

“Material.001” “Principled BSDF” node properties menu

bpy.data.materials["Material.001"].node_tree.nodes["Principled BSDF"].inputs[4].default_value

Code modified with option enabled

“Principled BSDF” node properties menu for active material

bpy.context.object.active_material.node_tree.nodes["Principled BSDF"].inputs[4].default_value

Other bug fixes

  • Fixed the problem that only the first tab could be deleted with the tab deletion function.
4 Likes

Hi there, I’m excited to be able to make some tools with this one, especially since I don’t know any python. My first “addon” is made by recording some macros and setting them to clickable buttons, like the video tutorial. I’m running into some issues and am hoping someone can help me out.

This video clip shows what the addon does, but here’s a short description. The first button adds an Empty, orients them to the cursor, and renames them to “Null”. The second button searches for all “Nulls” in the scene by name, and places them in a collection. The third button simply parents the nulls to that object. This clip shows the prototype working correctly.

So, the prototype works fine, but when I export and try to import it as an addon, I get this error. Since I don’t know python, I’ve got no idea how to fix it.

This is a screenshot of on of the recorded macros. If something wrong is happening here, please let me know of the illegal operation.

Lastly, and this is a bit of a side from the exported addon not loading correctly-- The final part of functionality that I’d like to add to this addon is to create a button that calls or links to an export function, specifically this one. I’ve tried copied/pasted the python code listed, and also tried to use it as the input of the button with the “last action in history” thing, but I’m not having any luck here again, since I don’t know what python is requiring. Is there a way in this addon to set a button to call another python script, since operation requires the mouse to do some clicking?

This little widget would really streamline blender to AE workflow in a nice way if we can get it to work, I’ll share to make it available for anyone to use. Help with either of these issues would be really appreciated.

1 Like

AENulls_addon_07.py (5.7 KB)

this is the “addon export” if anyone wanted to look at it

1 Like

Thank you for using the add-on.

Error when trying to enable an add-on

The cause of the error is the problem caused by using " " in the command line.
Because it is duplicated with " " that encloses all commands when exporting
Use ’ ’ in each line.

AENulls_addon_07_edit.py (5.7 KB)

How to copy the operator

  • Preference> Interface> “Developer Extras” enable
  • Right-click the menu button you want to copy > Copy Python Command

You can also access it from the menu on the top right of the add-on

Other

I tried to use the add-on, but there doesn’t seem to be an operator called “view3d.selectsmartsimilar”.

Thank you for the reply. Changing the “” to single quotes solved that error! :grinning: So, I’d already had the developer extras enabled, but copying the exporter python command link still isn’t working, so I’m gonna have to do some more work to figure it out. Any thoughts are appreciated.
-also thanks for alerting me about the “view3d.selectsmartsimilar”. It’s calling part of ‘machine tools’, so I’ll need to adjust that bit.
really love all your addons, thanks for the help and keep them coming :slight_smile:

The surest way is to look directly at the source code and get it from bl_idname.

class AAAA_OT_xxxx (Operator):
    bl_idname = "xxxx.xxxx"

Unfortunately,
Property → Uncopyable menus such as modifier menus,
The copied command is an operator that works only under certain circumstances,
There are some cases where the information editor command is not in the correct history :weary:.
You need to know more about Blender’s Python or its operator structure.

1 Like

thanks for the tip. I think I’m close to getting it working!

ver1.3.0 updated

Convert macros as operators-Other minor improvements

Improvement of add-on

Macros are now converted as operator classes when exported as add-ons.
The source code will be more correct, and it will be easier to check and correct errors.

This eliminates the problem of getting an error when “” is in a command.

Macro

  • Fixed a bug in the automatic conversion option from’bpy.data.xxx [xxx]‘to’bpy.context.xxx’
    • Fixed an issue that would replace the text “sub”
  • Fixed an issue where the active item would change after moving the list

Add options

ver1-3-0_02

Added options to macro items.
Information can be added when the macro is operated.
It’s not required, but it gives you better source code.

  • Operator description
  • Operator ID name
    • Uppercase letters and special characters cannot be used

Other

  • Changed to hide the header edit menu in the panel menu when the “Hide panel menu edit menu” option in the add-on settings is enabled.
    • Menu results are now displayed in panel menus even if the View tab is a macro user property
  • Add-on settings → In the case of Macro tab, the macro list is
  • When making an add-on, the current year is added

ver1.3.1 Bug fixed Updated

  • Fixed an issue where menu results disappeared when in edit mode.

    • (It was caused by adjusting the display status in ver1.3.0)
  • Removed the “Minimize Edit Menu” icon at the bottom right.

    • To completely hide the edit menu in the panel menu, use the Add-on Settings> Editor> “Hide edit menu in panel menu” option.
  • Changed to copy all source code in clipboard mode, which is exported as an add-on.

Hi @Bookyakuno, Great addon!

do you think it would be possible to add a feature that let me execute the tab like a floating window?
I would love to work in full screen and calling the necessary menu over the position of the mouse, much faster,

I do it in other applications and calling up the window with a hotkey and that the windows appearing under the mouse is much faster than looking for the menus and maximizes the workspace
to have the ability to call the outliner or any other window under the mouse and a clean window to work, it would be great

Does anyone know if there is something like this?

1 Like

ver1.3.2 Added pop-up menu

Added the pop-up display function of the user created menu.

  • Shift + Alt + C

When exporting as an add-on


You can also add a pop-up menu with the “Export as add-on” function.

  • User Preferences > Export Add-ons > Add Pop-up Menu

When the menu width is narrow

If your PC has a large display size and the pop-up menu is narrow, you can adjust the menu width from the add-on settings.

1 Like

Sorry if this has been answered but search didn’t provide any clues. Is it possible to add operations from other installed addons? Ie. If I have a bunch of addons that are filling up the N panel, and I’m using only some features of each addon, can I combine the features I need from those various addons into one menu as opposed to opening each addon I need for specific command I would use from it?

It is possible to add operators and properties for external add-ons.
After executing the external add-on function, you can register it in the menu using the history.
Please note that actions that do not leave a history cannot be menued.

Register the “Scatter Objects” Add-on menu [Customize Menu Editor / Blender Add-on] --YouTube

1 Like

ver1.3.22 Updated

In the “Export as add-on” function, the character code of the exported file is specified to utf-8.
Addressed an issue where Japanese characters in text files were garbled and difficult to read.