for example in this pie menu below

import bpy

def draw(self, context):
layout = self.layout
pie.operator("mesh.primitive_cube_add", text = "Some Operator", icon = "BLENDER")
pie.operator("mesh.primitive_cube_add", text = "Some Operator", icon = "BLENDER")
pie.operator("mesh.primitive_cube_add", text = "Some Operator", icon = "BLENDER")
pie.operator("mesh.primitive_cube_add", text = "Some Operator", icon = "BLENDER")
pie.operator("mesh.primitive_cube_add", text = "Some Operator", icon = "BLENDER")
pie.operator("mesh.primitive_cube_add", text = "Some Operator", icon = "BLENDER")
pie.operator("mesh.primitive_cube_add", text = "Some Operator", icon = "BLENDER")
pie.separator()
pie.separator()
other = pie.column()
gap = other.column()
gap.separator()
gap.scale_y = 7

if len(bpy.context.selected_objects) == 0:
option = "option if nothing is selected"
else:
option="defaultoption"

def register():

def unregister():

#if __name__ == "__main__":
#register()



there is a button with different functionalities, name, icon, (here its just the name) depending on a condition.

it work fine if i register this addon from the script, by removing the three # at the end and Running the script, but as soon as i register this as an addon, its not working anymore. Why ?

also in this same idea, how can i put a vaiable like that not in a form of a button but a simple text ?

• it seems that we cannot put condition themself within the menu class SO if i wrote a custom proprety bpy.context.scene["Test"]="Adaptive Name" and them reffer this new name by bpy.context.scene["Test"]it can work ! – DB3D May 22 '19 at 14:48
• HI. If you have an answer, please place it in the answer box below, not in the comments. – Ray Mairlot May 22 '19 at 15:08
• yes i needed to wait a bit – DB3D May 22 '19 at 15:19

So i cannot write a condition directly on the pie menu BUT i can reffer the name,function and icon to an actual name inside of blender.

so i could create a custom properties just for the occasion

for example i can first add two custom properties with thoses codes:

bpy.context.scene["Name of my menu"]="Adaptive Name"


the only problem is that it need to be done BEFORE opening this pie menu. and you can do this with the followed technique:

class BackMeUpPie_OT_Operator(bpy.types.Operator):
bl_idname = "view3d.pie"
bl_label = "Back Me Up Pie Menu"
bl_description = " OPERATOR DESCRIPTION HEYYYY"
def execute(self, context):
try:
bpy.context.window_manager["Auto-Copy Icon?"]+=1 #if i can do this its not the first time i launche the pie
except:
bpy.context.window_manager["Auto-Copy Icon?"] =1 #if i can't it is, so the timer cannot be
bpy.context.scene["Auto-Copy"] = "OFF"
bpy.context.scene["Auto-Copy Ic"] = "FAKE_USER_OFF"