# How to know the name of the an active preset dropdown?

Hello i created a custom operator preset system.

i'd like to know how to have acces to the name of an active preset. i think an example from any preset in blender could help me in my research.

Here is my set up

This is the code i was able to collect so far

#this is the correct code mut within blender ! no with my addon
bpy.data.window_managers["WinMan"].preset_name = "New Preset"
bpy.ops.wm.call_panel(name="CYCLES_PT_sampling_presets")

#execute a preset from my addon


i need to find the bpy.data.window_managers["WinMan"].preset_name = "New Preset" for my addon menu. i don't know how this is possible ?

• You mean this bpy.context.workspace.name and [ws.name for ws in bpy.data.workspaces]? – lemon Sep 7 '19 at 6:27
• @lemon sorry for being unclear. i was referencing drop down presets. – DB3D Sep 7 '19 at 11:09
• @lemon i updated the question/descritption – DB3D Sep 7 '19 at 12:05
• I'm not skilled at that. But why don't you store the preset identification/name/whatever as an operator property? (not sure there is some Blender mechanism that does it automatically, except maybe by preset path). – lemon Sep 7 '19 at 12:53
• It’s the bl_label of the preset menu. – AFWS Oct 11 '19 at 21:11

Thanks to @AFWS

print(bpy.types.CYCLES_PT_integrator_presets.bl_label)


active preset is in fact the name of the bl_label

Assuming that panel for the preset uses preset_operator = "script.execute_preset" the selected preset is indeed stored in bl_label. This can be seen in class ExecutePreset(Operator) in the presets.py where the label is changed to the most recent selection when the operator is executed.
    # change the menu title to the most recently chosen option