here is my operator
class FIRSTOperator(bpy.types.Operator): # When an option in the operator menu is clicked, this is called
‘’‘Operator’’’
bl_idname = ‘view_3d.my_color1’
bl_idname = ‘FIRSTOperator’
bl_label = ‘Operator’
Define possible operations
colormenu1 = EnumProperty(items=(
(‘1’, ‘Woods’, ‘The first item’),
(‘2’, ‘Metals’, ‘The second item’),
(‘3’, ‘Plastics’, ‘The Third item’),
(‘4’, ‘Glass’, ‘The Fourth item’),
(‘5’, ‘Stones’, ‘The Fith item’),
(‘6’, ‘Car Paint’, ‘The Fith item’)
))
def execute(self, context):
global last_menu1 # Access global Var so we can later draw it in the panel
last_menu1 = self.properties.colormenu1 # Store the choosen operation / Selection
print (‘selection shade=’,self.properties.colormenu1[0])
print (’ $$$$$$$$$$$$$ in myoperatormenu1 Selection =’,last_menu1)
return {‘FINISHED’}
1 - your enum use prop
mine use local enum
is it important ?
2 - calling operator
col.operator_menu_enum(‘view_3d.wood1’, ‘woodmenu1’, ‘Menu Selection’)
print (’ selected Woods menu menu value =’,wood1_menu1)
layout.operator_menu_enum(SimpleOperator.bl_idname, “myprop”, text=SimpleOperator.bl_label)
wondering if my operator can be modified to get the text will test later on
3 - your are calling it with label name
i use the bl ID name
can mine be also be call with bl name?
4 - can you elaborate on the exe
self.class.bl_label = self.myprop
is it instanciated class var?
5 - self.properties.colormenu1[0])
i use a global var to pass the first item in enum list to identify the selection
but having problem with passing the value to panel
will work more on that bug
now is there a way to extract other item from enum list
i tried to print the name in
(‘1’, ‘Woods’, ‘The first item’)
but it did not work!
i can print self.properties.colormenu1[0]
but if i try self.properties.colormenu1[1]
it does not work
anyway to get other item in enum list ?
in your example you use a prop enum so i guess it might not need to be declare as global to get item inside may be!
thanks