mango.models.base module¶
-
class
mango.models.base.
Model
(*args, **kwargs)¶ Bases:
object
The model is a node which can contain meta data that is attached to the model using fields and relations. A model can be created or initialized using a variety of constructors.
- Constructors:
# create a new model Model(**keyword_arguments) # initialize an existing node Model(str) Model(OpenMaya.MObject) Model(OpenMaya.MFnDependencyNode)
When creating a new model the keyword arguments ‘name’ and ‘parent’ are always present and can be used. Any other arguments are dependant on the fields and relations added to the model class.
-
add_attribute
(attribute)¶ Parameters: attribute (OpenMaya.MObject) –
-
clear
()¶ Remove any meta data and meta data tags from the node. This will allow the node to be re-initialized using a different class.
-
create_callback
(callback, *args, **kwargs)¶ Parameters: callback – Returns: Callback ID Return type: int
-
delete
()¶ Remove the node. The node is unlocked to make sure that it is allowed to be deleted. Any callbacks will automatically be triggered.
-
delete_attribute
(name)¶ Delete the provided attribute from the node. If the attribute doesn’t exist no warning is presented as the attribute is not there which is the goal of the function. When deleting attributes the get attribute cache is cleared to make sure that plugs can be retrieved correctly.
Parameters: name (str) –
-
delete_cache
()¶ Delete the cache from any functions that have a memoize decorator attached to them.
-
delete_callbacks
()¶ Remove the callbacks from the node. This can come in handy when clearing a cache and or when the node gets deleted to make sure there are no unnecessary callbacks floating around.
-
dependency
¶ Returns: Dependency Return type: OpenMaya.MFnDependency
-
exists
()¶ Returns: Node exists Return type: bool
-
fields
= {}¶
-
full_path
¶ Returns: Full path Return type: str
-
get_attribute
(*args, **kwargs)¶ Parameters: name (str) – Returns: Attribute Return type: OpenMaya.MObject
-
get_plug
(*args, **kwargs)¶ Parameters: name (str) – Returns: Plug Return type: OpenMaya.MPlug Raises: RuntimeError – When the attribute doesn’t exist on the node.
-
has_attribute
(name)¶ Parameters: name (str) – Returns: If node has the attribute Raise: bool
-
hx
¶ Returns: Hex Return type: str
-
is_referenced
()¶ Returns: Node referenced Return type: bool
-
leaf_name
¶ Returns: Name Return type: str
-
name
¶ Returns: Name Return type: str
-
namespace
¶ Returns: Namespace Return type: str/None
-
node_type
= 'network'¶
-
object
¶ Returns: Object Return type: OpenMaya.MObject
-
path
¶ Returns: Partial path Return type: str
-
pop_cache
(item)¶ Pop an attribute name from the cache list. This function will remove the attribute from both the attribute and plug list to keep them both up to date.
Parameters: item (str) –
-
relations
= {}¶
-
rename
(name)¶ Parameters: name (str) –
-
type
¶ Returns: Type Return type: str
-
uuid
¶ Returns: UUID Return type: str