0
$\begingroup$

I have an addon with several operators. There is one operator that needs to be pressed first before other operators are displayed. This is the general idea of what I have:

context.types.Scene.my_bool = bpy.props.BoolProperty(
     default = False
)

class FirstButtonOperator(bpy.types.Operator):
     def execute(self, context):
          context.scene.my_bool = True
          #do other random stuff here

class SecondButtonOperator(bpy.types.Operator):
     def execute(self, context):
          #do random stuff here

class MyPanel(bpy.types.Panel):
     def draw(self, context):
          layout = self.layout
          if not context.scene.my_Bool:
               #draw first operator
          else:
               #draw second operator

Every time blender is opened, I want the second button to be displayed only after the first button is pressed. The code works the first time I run it. However, when I save the blender file, my_bool is saved as True. Hence, the next time I open blender, the second operator displays instead of the first one.

Is there a way I can reset my_bool to False every time blender is opened? If not, are there other ways I can accomplish my goal? I'm new to blender, so I'm not sure if I'm doing things in the optimal way.

$\endgroup$
2

0

You must log in to answer this question.

Browse other questions tagged .