Skip to main content
Tweeted twitter.com/StackBlender/status/854586706967883776
edited body
Source Link
ACopeLan
  • 390
  • 4
  • 15

The enum function allows a button to toggle between two states. Is there a way to do that in code with a normal single button whose state is momentary? For example, I am trying to select faces of a model, then deselect with a standard button, not a toggle button.

I've only gotten a theoretical function:

for f in bm.faces: 
    if bm.faces[f.index].select === True:
        bm.faces[f.index].select = False
    else:
        bm.faces[f.index].select = FalseTrue

This will test the first state, then the second which will make them both true. Is there a way to stop at the first state?

The enum function allows a button to toggle between two states. Is there a way to do that in code with a normal single button whose state is momentary? For example, I am trying to select faces of a model, then deselect with a standard button, not a toggle button.

I've only gotten a theoretical function:

for f in bm.faces: 
    if bm.faces[f.index].select = True:
        bm.faces[f.index].select = False
    else:
        bm.faces[f.index].select = False

This will test the first state, then the second which will make them both true. Is there a way to stop at the first state?

The enum function allows a button to toggle between two states. Is there a way to do that in code with a normal single button whose state is momentary? For example, I am trying to select faces of a model, then deselect with a standard button, not a toggle button.

I've only gotten a theoretical function:

for f in bm.faces: 
    if bm.faces[f.index].select == True:
        bm.faces[f.index].select = False
    else:
        bm.faces[f.index].select = True

This will test the first state, then the second which will make them both true. Is there a way to stop at the first state?

edited body; edited tags
Source Link
David
  • 49.7k
  • 40
  • 162
  • 318

The enum function allows a button to toggle between two states. Is there a way to do that in code with a normal single button whose state is momentary? For example, I am trying to select faces of a model, then deselect with a standard button-, not a toggle button.

I've only gotten a theoretical function:

for f in bm.faces: 
    if bm.faces[f.index].select = True:
        bm.faces[f.index].select = False
    else:
        bm.faces[f.index].select = False

This will test the first state, then the second which will make them both true. Is there a way to stop at the first state?

The enum function allows a button to toggle between two states. Is there a way to do that in code with a normal single button whose state is momentary? For example, I am trying to select faces of a model, then deselect with a standard button- not a toggle button.

I've only gotten a theoretical function:

for f in bm.faces: 
    if bm.faces[f.index].select = True:
        bm.faces[f.index].select = False
    else:
        bm.faces[f.index].select = False

This will test the first state, then the second which will make them both true. Is there a way to stop at the first state?

The enum function allows a button to toggle between two states. Is there a way to do that in code with a normal single button whose state is momentary? For example, I am trying to select faces of a model, then deselect with a standard button, not a toggle button.

I've only gotten a theoretical function:

for f in bm.faces: 
    if bm.faces[f.index].select = True:
        bm.faces[f.index].select = False
    else:
        bm.faces[f.index].select = False

This will test the first state, then the second which will make them both true. Is there a way to stop at the first state?

Source Link
ACopeLan
  • 390
  • 4
  • 15

Toggle between states with a single button

The enum function allows a button to toggle between two states. Is there a way to do that in code with a normal single button whose state is momentary? For example, I am trying to select faces of a model, then deselect with a standard button- not a toggle button.

I've only gotten a theoretical function:

for f in bm.faces: 
    if bm.faces[f.index].select = True:
        bm.faces[f.index].select = False
    else:
        bm.faces[f.index].select = False

This will test the first state, then the second which will make them both true. Is there a way to stop at the first state?