mango.fields.generic module

class mango.fields.generic.IntField(*args, **kwargs)

Bases: mango.fields.base.Field

The IntField can be used to set and retrieve integer values. If the provided value is not a integer a TypeError will be raised.

default_value = 0
get_plug_value(plug)
Parameters:plug (OpenMaya.MPlug) –
Returns:int
mfn

Used by autodoc_mock_imports.

mfn_type

Used by autodoc_mock_imports.

set_plug_value(modifier, plug, value)
Parameters:
  • modifier (OpenMaya.MDGModifier) –
  • plug (OpenMaya.MPlug) –
  • value (int) –
validate_integer(value, instance)
Raises:TypeError – When the value is not a integer.
class mango.fields.generic.EnumField(*args, **kwargs)

Bases: mango.fields.base.Field

The EnumField can be used to set and retrieve choice values. These values can be of any type and are provided in the choices when initializing the field. On the node EnumFields will always be stored as integers. But it is possible to provide dictionaries or lists too as a choice. If a list is provided integer values will automatically be assigned to the return value. If a dictionary is provided the integer value is used as a mapper between the keys and the values.

create()
Returns:Attribute
Return type:OpenMaya.MObject
default(index=None)
Parameters:index (int/None) –
Returns:Default value
Return type:int/None
default_value = None
enum_keys
Returns:Enum keys
Return type:dict
enum_values
Returns:Enum values
Return type:dict
get_plug_value(plug)
Parameters:plug (OpenMaya.MPlug) –
Returns:
mfn

Used by autodoc_mock_imports.

set_plug_value(modifier, plug, value)
Parameters:
  • modifier (OpenMaya.MDGModifier) –
  • plug (OpenMaya.MPlug) –
  • value (int) –
validate_choices(value, instance)
Raises:RuntimeError – When the value is not part of the provided choices.
class mango.fields.generic.DoubleField(*args, **kwargs)

Bases: mango.fields.base.Field

The DoubleField can be used to set and retrieve double values. If the provided value is not a float or integer a TypeError will be raised.

default_value = 0.0
get_plug_value(plug)
Parameters:plug (OpenMaya.MPlug) –
Returns:float
mfn

Used by autodoc_mock_imports.

mfn_type

Used by autodoc_mock_imports.

set_plug_value(modifier, plug, value)
Parameters:
  • modifier (OpenMaya.MDGModifier) –
  • plug (OpenMaya.MPlug) –
  • value (float) –
validate_int_or_float(value, instance)
Raises:TypeError – When the value is not a float.
class mango.fields.generic.DegreeField(*args, **kwargs)

Bases: mango.fields.base.Field

The DegreesField can be used to set and retrieve degree values. If the provided value is not a float or integer a TypeError will be raised.

default_value = 0.0
get_plug_value(plug)
Parameters:plug (OpenMaya.MPlug) –
Returns:float
mfn

Used by autodoc_mock_imports.

mfn_type

Used by autodoc_mock_imports.

set_plug_value(modifier, plug, value)
Parameters:
  • modifier (OpenMaya.MDGModifier) –
  • plug (OpenMaya.MPlug) –
  • value (float) –
validate_int_or_float(value, instance)
Raises:TypeError – When the value is not a float.
class mango.fields.generic.BooleanField(*args, **kwargs)

Bases: mango.fields.base.Field

The BooleanField can be used to set and retrieve bool values. If the provided value is not a bool a TypeError will be raised. The boolean field will never be able to support a null value. A ValueError will be raised when its provided anyway.

default_value = True
get_plug_value(plug)
Parameters:plug (OpenMaya.MPlug) –
Returns:bool
mfn

Used by autodoc_mock_imports.

mfn_type

Used by autodoc_mock_imports.

set_plug_value(modifier, plug, value)
Parameters:
  • modifier (OpenMaya.MDGModifier) –
  • plug (OpenMaya.MPlug) –
  • value (bool) –
validate_bool(value, instance)
Raises:TypeError – When the value is not a boolean.
class mango.fields.generic.CharField(*args, **kwargs)

Bases: mango.fields.base.Field

The CharField can be used to set and retrieve string values. If the provided value is not a basestring a TypeError will be raised.

add_attribute_to_instance(instance)

Create the field attribute to the instance. This function will take the fields settings into account. It is possible to create arrays, compounds and all sorts of other attribute types. Because default attributes on string attributes do not stick. We set it after the attribute is added.

Parameters:instance (models.Model) –
default(index=None)

Default values of string attributes are not stored correctly. The default value will be ignored and set once the attribute is added to the instance.

default_value = ''
get_plug_value(plug)
Parameters:plug (OpenMaya.MPlug) –
Returns:str
mfn

Used by autodoc_mock_imports.

mfn_type

Used by autodoc_mock_imports.

set_plug_value(modifier, plug, value)
Parameters:
  • modifier (OpenMaya.MDGModifier) –
  • plug (OpenMaya.MPlug) –
  • value (str) –
validate_basestring(value, instance)
Raises:TypeError – When the value is not a basestring.