nxt.nxt_node module
- class INTERNAL_ATTRS[source]
Bases:
objectClass uses for easy access to internal attr constants and various lists of them used for composition. Only modify if you are sure of the ramifications to the comp engine. The _prefix constant should be added to every attr name to match our convention. When an internal attr is saved the prefix is stripped.
- CHILD_ORDER = '_child_order'
- COMMENT = '_comment'
- COMPUTE = '_code'
- ENABLED = '_enabled'
- EXECUTE_IN = '_execute_in'
- INSTANCE_PATH = '_instance'
- NODE_PATH = '_node_path'
- NAME = '_name'
- PARENT_PATH = '_parent_path'
- PROXY = '_proxy'
- SOURCE_LAYER = '_source_layer'
- START_POINT = '_start_point'
- CACHED_CODE = '_cached_code'
- BUILTINS = ('__class__', '__delattr__', '__dict__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__module__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__')
- TRACKED = ('_code', '_execute_in', '_comment', '_start_point', '_enabled', '_instance')
- UNTRACKED = ('_child_order', '_name', '_source_layer', '_proxy', '_parent_path', '_node_path')
- NO_COMP = ('_cached_code',)
- PROTECTED = ('__class__', '__delattr__', '__dict__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__module__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__', '_code', '_execute_in', '_comment', '_start_point', '_enabled', '_instance', '_child_order', '_name', '_source_layer', '_proxy', '_parent_path', '_node_path', '_cached_code')
- ALL = ('_code', '_execute_in', '_comment', '_start_point', '_enabled', '_instance', '_child_order', '_name', '_source_layer', '_proxy', '_parent_path', '_node_path')
- SAVED = ('_start_point', '_instance', '_execute_in', '_child_order', '_enabled', '_comment', '_code')
- WORLD_NODE_SAVED = ('_comment', '_code')
- ALLOW_NO_OPINION = ('_enabled',)
- DEFAULTS = {'_code': functools.partial(<class 'list'>, ()), '_parent_path': '/'}
- REQUIRES_RECOMP = ('_start_point', '_node_path', '_comment', '_parent_path', '_name', '_proxy', '_source_layer', '_execute_in')
- class META_ATTRS[source]
Bases:
object- COMMENT = '_comment__nxt'
- TYPE = '_type__nxt'
- SOURCE = '_source__nxt'
- VALUE = 'value'
- ALL = ('_comment__nxt', '_type__nxt', '_source__nxt')
- get_opinion(node, attr)[source]
Check if the node attr has an opinion. Returns a tuple: (attr_value, bool_has_opinion) :param node: NxtNode :param attr: String of attr name :return: (attr_value, bool_has_opinion)
- get_node_enabled(node)[source]
Get the enabled state of the given node. If the enabled state is not set it (None) the default return is True. :param node: Node object :return: Bool of enabled state
- has_stronger_opinion(comp_node, attr, target_layer)[source]
Check if the given attr on the given node has a stronger opinion than the opinion on the target layer (if any). We check the source layers of each base class. We are looping strong to weak so if there was no opinion before hitting the target layer there isn’t a stronger opinion. :param comp_node: NxtCompNode :param attr: String of attr name :param target_layer: NxtSpecLayer :return: bool (True if comp node has opinion that would overload the target layer’s opinion)
- get_node_as_dict(spec_node)[source]
Get a spec node as an ordered dictionary. The return data is strcutred as it would be in a saved graph file. :param spec_node: SpecNode object :return: OrderedDict
- get_node_path(node)[source]
Only to be used for inferred nodes who do not belong to a layer. :param node: Node object :return: string of node path
- list_merger(base_list, overlay_list)[source]
It is important to note we expect both arg lists to be non-repeating. Merges lists such that the base_list is preserved and the overlay_list is overlaid onto it. Example: source = [‘Node’, ‘Node1’] target = [‘Node’, ‘Jack’] returns = [‘Node’, ‘Jack’, ‘Node1’] :param base_list: Source list of object we want to overlay. :param overlay_list: Target list of object we want overlay onto. :return: Non-repeating list of object.