Class Boolean#

DataSocket Boolean

The Boolean initializer can take a python value as argument:

a = Boolean(True) # a is the output socket of the input node Boolean initialized at True

To get a Boolean value from the group input (see Input constructor):

a = Boolean.Input(True, "Option")

Python bool operators such as and, or or if ... else:  ... don’t work on Boolean sockets. Rather use use either a global function or a method of Boolean:

a = Boolean(False) # Two Boolean sockets
b = Boolean(True)

# Wrong:

c = a and b # a and b transtyped to bool with bool(). c is not a Boolean but a bool
print(type(c))  # returns <class 'bool'>

# Correct

c = a.b_and(b)
print(type(c)) # returns <class 'Boolean'W

Operator *, + and - can be used for respectively and, or and not:

a = Boolean(False)
b = Boolean(True)

_ = a + b  # a or b
_ = -a     # not a
_ = a * b  # a and b

# These operators also work with bool types

_ = a * True  # a and True. True can be replaced by a bool variables computed elsewhere

# Self change is also possible

a *= b

# a is now the output socket of the Boolean node math performing a and operation
# between a and b

Constructor#

Boolean(self, value = False, label = None)

Content#

Properties

Inherited

bl_idname | bnode | is_multi_input | is_output | is_plugged | links | name | node_chain_label | socket_index

Class and static methods

Boolean | Input | Random

Inherited

get_bl_idname | get_class_name | gives_bsocket | is_socket | is_vector | python_type_to_socket | value_data_type

Methods

b_and | b_not | b_or | imply | nand | nimply | nor | switch | xnor | xor

Inherited

connected_sockets | get_blender_socket | init_domains | init_socket | plug | reroute | reset_properties | stack | to_output

Class and static methods#

Boolean#

@classmethod
def Boolean(cls, boolean=False)

Args:#

  • boolean (bool): False

Returns:#

  • socket boolean

Go to top - main - nodes - nodes menus

Input#

@classmethod
def Input(cls, value = False, name = "Boolean", description = "")

Create a Boolean input socket in the Group Input Node

Args:#

  • value: The default value

  • name: The socket name

  • description: User tip

Returns:#

  • Boolean: The Boolean data socket

Go to top - main - nodes - nodes menus

Random#

@classmethod
def Random(cls, probability=None, ID=None, seed=None)

Args:#

  • probability: Float

  • ID: Integer

  • seed: Integer

Returns:#

  • socket value

Go to top - main - nodes - nodes menus

Methods#

b_and#

def b_and(self, boolean1=None)

Args:#

  • boolean1: Boolean

Returns:#

  • socket boolean

Go to top - main - nodes - nodes menus

b_not#

def b_not(self)

Returns:#

  • socket boolean

Go to top - main - nodes - nodes menus

b_or#

def b_or(self, boolean1=None)

Args:#

  • boolean1: Boolean

Returns:#

  • socket boolean

Go to top - main - nodes - nodes menus

imply#

def imply(self, boolean1=None)

Args:#

  • boolean1: Boolean

Returns:#

  • socket boolean

Go to top - main - nodes - nodes menus

nand#

def nand(self, boolean1=None)

Args:#

  • boolean1: Boolean

Returns:#

  • socket boolean

Go to top - main - nodes - nodes menus

nimply#

def nimply(self, boolean1=None)

Args:#

  • boolean1: Boolean

Returns:#

  • socket boolean

Go to top - main - nodes - nodes menus

nor#

def nor(self, boolean1=None)

Args:#

  • boolean1: Boolean

Returns:#

  • socket boolean

Go to top - main - nodes - nodes menus

switch#

def switch(self, switch=None, true=None)

Args:#

  • switch: Boolean

  • true: Boolean

Returns:#

  • socket output

Go to top - main - nodes - nodes menus

xnor#

def xnor(self, boolean1=None)

Args:#

  • boolean1: Boolean

Returns:#

  • socket boolean

Go to top - main - nodes - nodes menus

xor#

def xor(self, boolean1=None)

Args:#

  • boolean1: Boolean

Returns:#

  • socket boolean

Go to top - main - nodes - nodes menus