for example in this pie menu below
import bpy
from bpy.types import Menu
class Pie_menu(Menu):
bl_label = "Some Pie Menu"
def draw(self, context):
layout = self.layout
pie = layout.menu_pie()
pie.operator("wm.call_menu_pie", text = "Some Other Pie", icon = "RIGHTARROW_THIN").name="Pie_menu"
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
other_menu = other.box().column()
other_menu.scale_y=1.3
if len(bpy.context.selected_objects) == 0:
option = "option if nothing is selected"
else:
option="defaultoption"
other_menu.operator("mesh.primitive_cube_add", text = option ,icon = "BLENDER")
def register():
bpy.utils.register_class(Pie_menu)
def unregister():
bpy.utils.unregister_class(Pie_menu)
#if __name__ == "__main__":
#register()
#bpy.ops.wm.call_menu_pie(name="Pie_menu")
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 ?
bpy.context.scene["Test"]="Adaptive Name"
and them reffer this new name bybpy.context.scene["Test"]
it can work ! $\endgroup$