| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338 | 
							- import bpy
 
- from bpy.types import Node
 
- from .base_definitions import MantisUINode, get_signature_from_edited_tree
 
- from .misc_nodes_socket_templates import *
 
- from .utilities import (prRed, prGreen, prPurple, prWhite,
 
-                               prOrange,
 
-                               wrapRed, wrapGreen, wrapPurple, wrapWhite,
 
-                               wrapOrange,)
 
- def TellClasses():
 
-     return [ InputFloatNode,
 
-              InputIntNode,
 
-              InputVectorNode,
 
-              InputBooleanNode,
 
-              InputBooleanThreeTupleNode,
 
-              InputRotationOrderNode,
 
-              InputTransformSpaceNode,
 
-              InputStringNode,
 
-              InputMatrixNode,
 
-              # InputGeometryNode,
 
-              InputWidget,
 
-              InputExistingGeometryObjectNode,
 
-              InputExistingGeometryDataNode,
 
-              InputThemeBoneColorSets,
 
-              InputColorSetPallete,
 
-              UtilityDeclareCollections,
 
-              UtilityCollectionJoin,
 
-              UtilityCollectionHierarchy,
 
-              UtilityGeometryOfXForm,
 
-              UtilityNameOfXForm,
 
-             #  ComposeMatrixNode,
 
-              MetaRigMatrixNode,
 
-              UtilityPointFromCurve,
 
-              UtilityMatrixFromCurve,
 
-              UtilityMatricesFromCurve,
 
-              UtilityNumberOfCurveSegments,
 
-              UtilityNumberOfSplines,
 
-              UtilityMatrixFromCurveSegment,
 
-              UtilityGetCurvePoint,
 
-              UtilityGetNearestFactorOnCurve,
 
-              UtilityKDChoosePoint,
 
-              UtilityKDChooseXForm,
 
-             #  ScaleBoneLengthNode,
 
-              UtilityMetaRigNode,
 
-              UtilityBonePropertiesNode,
 
-              UtilityDriverVariableNode,
 
-              UtilityFCurveNode,
 
-              UtilityDriverNode,
 
-              UtilitySwitchNode,
 
-              UtilityKeyframe,
 
-              UtilityCombineThreeBoolNode,
 
-              UtilityCombineVectorNode,
 
-              UtilitySeparateVector,
 
-              UtilityCatStringsNode,
 
-              UtilityGetBoneLength,
 
-              UtilityPointFromBoneMatrix,
 
-              UtilitySetBoneLength,
 
-              UtilityMatrixSetLocation,
 
-              UtilityMatrixGetLocation,
 
-              UtilityMatrixFromXForm,
 
-              UtilityAxesFromMatrix,
 
-              UtilityBoneMatrixHeadTailFlip,
 
-              UtilityMatrixTransform,
 
-              UtilityMatrixInvert,
 
-              UtilityMatrixCompose,
 
-              UtilityMatrixAlignRoll,
 
-              UtilityTransformationMatrix,
 
-              UtilitySetBoneMatrixTail,
 
-              UtilityIntToString,
 
-              UtilityArrayGet,
 
-              UtilityArrayLength,
 
-              #
 
-              UtilityCompare,
 
-              UtilityChoose,
 
-              # for testing
 
-              UtilityPrint,
 
-             ]
 
- def default_traverse(self,socket):
 
-     return None
 
- class InputFloatNode(Node, MantisUINode):
 
-     '''A node representing inheritance'''
 
-     bl_idname = 'InputFloatNode'
 
-     bl_label = "Float"
 
-     bl_icon = 'NODE'
 
-     initialized : bpy.props.BoolProperty(default = False)
 
-     mantis_node_class_name=bl_idname[:-4]
 
-     def init(self, context):
 
-         self.outputs.new('FloatSocket', "Float Input").input = True
 
-         self.initialized = True
 
- class InputIntNode(Node, MantisUINode):
 
-     '''A node representing inheritance'''
 
-     bl_idname = 'InputIntNode'
 
-     bl_label = "Integer"
 
-     bl_icon = 'NODE'
 
-     initialized : bpy.props.BoolProperty(default = False)
 
-     mantis_node_class_name=bl_idname
 
-     def init(self, context):
 
-         self.outputs.new('IntSocket', "Integer").input = True
 
-         self.initialized = True
 
-     
 
- class InputVectorNode(Node, MantisUINode):
 
-     '''A node representing inheritance'''
 
-     bl_idname = 'InputVectorNode'
 
-     bl_label = "Vector"
 
-     bl_icon = 'NODE'
 
-     initialized : bpy.props.BoolProperty(default = False)
 
-     mantis_node_class_name=bl_idname[:-4]
 
-     def init(self, context):
 
-         self.outputs.new('VectorSocket', "").input = True
 
-         self.initialized = True
 
- class InputBooleanNode(Node, MantisUINode):
 
-     '''A node representing inheritance'''
 
-     bl_idname = 'InputBooleanNode'
 
-     bl_label = "Boolean"
 
-     bl_icon = 'NODE'
 
-     initialized : bpy.props.BoolProperty(default = False)
 
-     mantis_node_class_name=bl_idname[:-4]
 
-     def init(self, context):
 
-         self.outputs.new('BooleanSocket', "").input = True
 
-         self.initialized = True
 
- class InputBooleanThreeTupleNode(Node, MantisUINode):
 
-     '''A node representing inheritance'''
 
-     bl_idname = 'InputBooleanThreeTupleNode'
 
-     bl_label = "Boolean Vector"
 
-     bl_icon = 'NODE'
 
-     initialized : bpy.props.BoolProperty(default = False)
 
-     mantis_node_class_name=bl_idname[:-4]
 
-     def init(self, context):
 
-         o = self.outputs.new('BooleanThreeTupleSocket', "")
 
-         o.input = True
 
-         self.initialized = True
 
- class InputRotationOrderNode(Node, MantisUINode):
 
-     '''A node representing inheritance'''
 
-     bl_idname = 'InputRotationOrderNode'
 
-     bl_label = "Rotation Order"
 
-     bl_icon = 'NODE'
 
-     initialized : bpy.props.BoolProperty(default = False)
 
-     mantis_node_class_name=bl_idname[:-4]
 
-     def init(self, context):
 
-         self.outputs.new('RotationOrderSocket', "").input = True
 
-         self.initialized = True
 
- class InputTransformSpaceNode(Node, MantisUINode):
 
-     '''A node representing inheritance'''
 
-     bl_idname = 'InputTransformSpaceNode'
 
-     bl_label = "Transform Space"
 
-     bl_icon = 'NODE'
 
-     initialized : bpy.props.BoolProperty(default = False)
 
-     mantis_node_class_name=bl_idname[:-4]
 
-     def init(self, context):
 
-         self.outputs.new('TransformSpaceSocket', "").input = True
 
-         self.initialized = True
 
- class InputStringNode(Node, MantisUINode):
 
-     '''A node representing inheritance'''
 
-     bl_idname = 'InputStringNode'
 
-     bl_label = "String"
 
-     bl_icon = 'NODE'
 
-     initialized : bpy.props.BoolProperty(default = False)
 
-     mantis_node_class_name=bl_idname[:-4]
 
-     def init(self, context):
 
-         self.outputs.new('StringSocket', "").input = True
 
-         self.initialized = True
 
- class InputMatrixNode(Node, MantisUINode):
 
-     '''A node representing inheritance'''
 
-     bl_idname = 'InputMatrixNode'
 
-     bl_label = "Matrix"
 
-     bl_icon = 'NODE'
 
-     first_row  : bpy.props.FloatVectorProperty(name="", size=4, default = (1.0, 0.0, 0.0, 0.0,))
 
-     second_row : bpy.props.FloatVectorProperty(name="", size=4, default = (0.0, 1.0, 0.0, 0.0,))
 
-     third_row  : bpy.props.FloatVectorProperty(name="", size=4, default = (0.0, 0.0, 1.0, 0.0,))
 
-     fourth_row : bpy.props.FloatVectorProperty(name="", size=4, default = (0.0, 0.0, 0.0, 1.0,))
 
-     initialized : bpy.props.BoolProperty(default = False)
 
-     mantis_node_class_name=bl_idname[:-4]
 
-     def set_matrix(self):
 
-         return (self.first_row[ 0], self.first_row[ 1], self.first_row[ 2], self.first_row[ 3],
 
-                 self.second_row[0], self.second_row[1], self.second_row[2], self.second_row[3],
 
-                 self.third_row[ 0], self.third_row[ 1], self.third_row[ 2], self.third_row[ 3],
 
-                 self.fourth_row[0], self.fourth_row[1], self.fourth_row[2], self.fourth_row[3],)
 
-     def init(self, context):
 
-         self.outputs.new('MatrixSocket', "Matrix")
 
-         self.initialized = True
 
-     def draw_buttons(self, context, layout):
 
-         # return
 
-         layout.prop(self, "first_row")
 
-         layout.prop(self, "second_row")
 
-         layout.prop(self, "third_row")
 
-         layout.prop(self, "fourth_row")
 
-     def update(self):
 
-         mat_sock = self.outputs[0]
 
-         mat_sock.default_value = self.set_matrix()
 
- class ScaleBoneLengthNode(Node, MantisUINode):
 
-     '''Scale Bone Length'''
 
-     bl_idname = 'ScaleBoneLength'
 
-     bl_label = "Scale Bone Length"
 
-     bl_icon = 'NODE'
 
-     initialized : bpy.props.BoolProperty(default = False)
 
-     # === Optional Functions ===
 
-     def init(self, context):
 
-         self.inputs.new('MatrixSocket', "In Matrix")
 
-         self.inputs.new('FloatSocket', "Factor")
 
-         self.outputs.new('MatrixSocket', "Out Matrix")
 
-         self.initialized = True
 
- class MetaRigMatrixNode(Node, MantisUINode):
 
-     # Identical to the above, except
 
-     '''A node representing a bone's matrix'''
 
-     bl_idname = 'MetaRigMatrixNode'
 
-     bl_label = "Matrix"
 
-     bl_icon = 'NODE'
 
-     first_row  : bpy.props.FloatVectorProperty(name="", size=4, default = (1.0, 0.0, 0.0, 0.0,))
 
-     second_row : bpy.props.FloatVectorProperty(name="", size=4, default = (0.0, 1.0, 0.0, 0.0,))
 
-     third_row  : bpy.props.FloatVectorProperty(name="", size=4, default = (0.0, 0.0, 1.0, 0.0,))
 
-     fourth_row : bpy.props.FloatVectorProperty(name="", size=4, default = (0.0, 0.0, 0.0, 1.0,))
 
-     initialized : bpy.props.BoolProperty(default = False)
 
-     mantis_node_class_name="UtilityMetaRig"
 
-     def set_matrix(self):
 
-         return (self.first_row[ 0], self.first_row[ 1], self.first_row[ 2], self.first_row[ 3],
 
-                 self.second_row[0], self.second_row[1], self.second_row[2], self.second_row[3],
 
-                 self.third_row[ 0], self.third_row[ 1], self.third_row[ 2], self.third_row[ 3],
 
-                 self.fourth_row[0], self.fourth_row[1], self.fourth_row[2], self.fourth_row[3],)
 
-     def init(self, context):
 
-         self.outputs.new('MatrixSocket', "Matrix")
 
-         self.initialized = True
 
-     
 
-     def update(self):
 
-         mat_sock = self.outputs[0]
 
-         mat_sock.default_value = self.set_matrix()
 
- class UtilityMatrixFromCurve(Node, MantisUINode):
 
-     """Gets a matrix from a curve."""
 
-     bl_idname = "UtilityMatrixFromCurve"
 
-     bl_label = "Matrix from Curve"
 
-     bl_icon = "NODE"
 
-     
 
-     initialized : bpy.props.BoolProperty(default = False)
 
-     mantis_node_class_name=bl_idname
 
-     
 
-     def init(self, context):
 
-         self.init_sockets(MatrixFromCurveSockets)
 
-         self.initialized = True
 
- class UtilityPointFromCurve(Node, MantisUINode):
 
-     """Gets a point from a curve."""
 
-     bl_idname = "UtilityPointFromCurve"
 
-     bl_label = "Point from Curve"
 
-     bl_icon = "NODE"
 
-     
 
-     initialized : bpy.props.BoolProperty(default = False)
 
-     mantis_node_class_name=bl_idname
 
-     
 
-     def init(self, context):
 
-         self.init_sockets(PointFromCurveSockets)
 
-         self.initialized = True
 
- class UtilityNumberOfCurveSegments(Node, MantisUINode):
 
-     """Tells the number of segments in a curve."""
 
-     bl_idname = "UtilityNumberOfCurveSegments"
 
-     bl_label = "Number of Curve Segments"
 
-     bl_icon = "NODE"
 
-     
 
-     initialized : bpy.props.BoolProperty(default = False)
 
-     mantis_node_class_name=bl_idname
 
-     
 
-     def init(self, context):
 
-         self.inputs.new("EnumCurveSocket", "Curve")
 
-         self.inputs.new('UnsignedIntSocket', 'Spline Index')
 
-         self.outputs.new("UnsignedIntSocket", "Number of Segments")
 
-         self.initialized = True
 
-     
 
- class UtilityNumberOfSplines(Node, MantisUINode):
 
-     """Tells the number of splines in a curve."""
 
-     bl_idname = "UtilityNumberOfSplines"
 
-     bl_label = "Number of Splines"
 
-     bl_icon = "NODE"
 
-     
 
-     initialized : bpy.props.BoolProperty(default = False)
 
-     mantis_node_class_name=bl_idname
 
-     
 
-     def init(self, context):
 
-         self.init_sockets(NumberOfSplinesSockets)
 
-         self.initialized = True
 
- class UtilityMatrixFromCurveSegment(Node, MantisUINode):
 
-     """Gets a matrix from a curve segment."""
 
-     bl_idname = "UtilityMatrixFromCurveSegment"
 
-     bl_label = "Matrix from Curve Segment"
 
-     bl_icon = "NODE"
 
-     
 
-     initialized : bpy.props.BoolProperty(default = False)
 
-     mantis_node_class_name=bl_idname
 
-     
 
-     def init(self, context):
 
-         self.init_sockets(MatrixFromCurveSegmentSockets)
 
-         self.initialized = True
 
- class UtilityGetCurvePoint(Node, MantisUINode):
 
-     bl_idname = 'UtilityGetCurvePoint'
 
-     bl_label = "Control Point from Curve"
 
-     bl_icon = 'NODE'
 
-     initialized : bpy.props.BoolProperty(default = False)
 
-     mantis_node_class_name=bl_idname
 
-     def init(self, context):
 
-         self.init_sockets(GetCurvePointSockets)
 
-         self.initialized = True
 
-     def display_update(self, parsed_tree, context):
 
-         self.outputs["Point"].hide=False
 
-         self.outputs["Left Handle"].hide=True
 
-         self.outputs["Right Handle"].hide=True
 
-         spline_index = self.inputs['Spline Index'].default_value
 
-         index = self.inputs['Index'].default_value
 
-         curve = self.inputs['Curve'].default_value
 
-         if self.inputs['Spline Index'].is_linked or self.inputs['Index'].is_linked \
 
-             or self.inputs['Curve'].is_linked:
 
-             mantis_node = parsed_tree.get(get_signature_from_edited_tree(self, context))
 
-             spline_index = mantis_node.evaluate_input("Spline Index")
 
-             index = mantis_node.evaluate_input("Index")
 
-             curve = mantis_node.evaluate_input("Curve")
 
-         if curve := bpy.data.objects.get(curve):
 
-             if curve.type != "CURVE":
 
-                 self.outputs["Point"].hide=True
 
-             spline = curve.data.splines[spline_index]
 
-             if spline.type == 'BEZIER':
 
-                 self.outputs["Left Handle"].hide=False
 
-                 self.outputs["Right Handle"].hide=False
 
-     
 
- class UtilityMatricesFromCurve(Node, MantisUINode):
 
-     """Gets a matrix from a curve."""
 
-     bl_idname = "UtilityMatricesFromCurve"
 
-     bl_label = "Matrices from Curve"
 
-     bl_icon = "NODE"
 
-     
 
-     initialized : bpy.props.BoolProperty(default = False)
 
-     mantis_node_class_name=bl_idname
 
-     
 
-     def init(self, context):
 
-         self.init_sockets(MatricesFromCurveSockets)
 
-         self.initialized = True
 
- def display_update_choose_nearest(self, parsed_tree, context):
 
-     number_of_points = self.inputs['Number to Find'].default_value
 
-     if self.inputs["Number to Find"].is_linked:
 
-         mantis_node = parsed_tree.get(get_signature_from_edited_tree(self, context))
 
-         number_of_points = mantis_node.evaluate_input("Number to Find")
 
-     elif number_of_points == 0:
 
-         self.inputs['Number to Find'].default_value=1
 
-     if number_of_points > 1:
 
-         # then we need to make it an array out
 
-         self.outputs.display_shape = 'SQUARE_DOT'
 
-     else:
 
-         self.outputs.display_shape = 'CIRCLE'
 
- class UtilityGetNearestFactorOnCurve(Node, MantisUINode):
 
-     bl_idname = 'UtilityGetNearestFactorOnCurve'
 
-     bl_label = "Get Factor on Curve at Point"
 
-     bl_icon = 'NODE'
 
-     initialized : bpy.props.BoolProperty(default = False)
 
-     mantis_node_class_name=bl_idname
 
-     def init(self, context):
 
-         self.init_sockets(GetNearestFactorOnCurveSockets)
 
-         self.initialized = True
 
- class UtilityKDChoosePoint(Node, MantisUINode):
 
-     """Chooses the nearest point with a KD Tree."""
 
-     bl_idname = "UtilityKDChoosePoint"
 
-     bl_label = "Choose Nearest Point"
 
-     bl_icon = "NODE"
 
-     
 
-     initialized : bpy.props.BoolProperty(default = False)
 
-     mantis_node_class_name=bl_idname
 
-     
 
-     def init(self, context):
 
-         self.inputs.new("VectorSocket", "Reference Point")
 
-         a = self.inputs.new('VectorSocket', 'Points', use_multi_input=True)
 
-         a.display_shape='SQUARE_DOT'
 
-         s = self.inputs.new("UnsignedIntSocket", "Number to Find")
 
-         s.default_value=1
 
-         self.outputs.new("VectorSocket", "Result Point")
 
-         self.outputs.new("UnsignedIntSocket", "Result Index")
 
-         self.outputs.new("FloatSocket", "Result Distance")
 
-         self.initialized = True
 
-     
 
-     def display_update(self, parsed_tree, context):
 
-         display_update_choose_nearest(self, parsed_tree, context)
 
- class UtilityKDChooseXForm(Node, MantisUINode):
 
-     """Chooses the nearest xForm with a KD Tree."""
 
-     bl_idname = "UtilityKDChooseXForm"
 
-     bl_label = "Choose Nearest xForm"
 
-     bl_icon = "NODE"
 
-     
 
-     initialized : bpy.props.BoolProperty(default = False)
 
-     mantis_node_class_name=bl_idname
 
-     
 
-     def init(self, context):
 
-         self.inputs.new("VectorSocket", "Reference Point")
 
-         self.inputs.new('xFormSocket', 'xForm Nodes', use_multi_input=True)
 
-         self.inputs.new("FloatFactorSocket", "Get Point Head/Tail")
 
-         s = self.inputs.new("UnsignedIntSocket", "Number to Find")
 
-         s.default_value=1
 
-         self.outputs.new("xFormSocket", "Result xForm")
 
-         self.outputs.new("UnsignedIntSocket", "Result Index")
 
-         self.outputs.new("FloatSocket", "Result Distance")
 
-         self.initialized = True
 
-     
 
-     def display_update(self, parsed_tree, context):
 
-         display_update_choose_nearest(self, parsed_tree, context)
 
- class UtilityMetaRigNode(Node, MantisUINode):
 
-     """Gets a matrix from a meta-rig bone."""
 
-     bl_idname = "UtilityMetaRig"
 
-     bl_label = "Meta-Rig"
 
-     bl_icon = "NODE"
 
-     
 
-     armature:bpy.props.StringProperty()
 
-     pose_bone:bpy.props.StringProperty()
 
-     initialized : bpy.props.BoolProperty(default = False)
 
-     mantis_node_class_name=bl_idname
 
-     
 
-     def init(self, context):
 
-         armt = self.inputs.new("EnumMetaRigSocket", "Meta-Armature")
 
-         bone = self.inputs.new("EnumMetaBoneSocket", "Meta-Bone")
 
-         bone.hide=True
 
-         self.outputs.new("MatrixSocket", "Matrix")
 
-         self.initialized = True
 
-     
 
-     def display_update(self, parsed_tree, context):
 
-         nc = parsed_tree.get(get_signature_from_edited_tree(self, context))
 
-         if nc:
 
-             self.armature= nc.evaluate_input("Meta-Armature")
 
-             self.pose_bone= nc.evaluate_input("Meta-Bone")
 
-         if not self.armature:
 
-             self.inputs["Meta-Bone"].hide=True
 
-         else:
 
-             self.inputs["Meta-Bone"].hide=False
 
-         if self.inputs["Meta-Armature"].is_linked:
 
-             self.inputs["Meta-Armature"].search_prop = None
 
-         if self.inputs["Meta-Bone"].is_linked:
 
-             self.inputs["Meta-Bone"].search_prop = None
 
- class UtilityBonePropertiesNode(Node, MantisUINode):
 
-     """Provides as sockets strings identifying bone transform properties."""
 
-     bl_idname = "UtilityBoneProperties"
 
-     bl_label = "Bone Properties"
 
-     bl_icon = "NODE"
 
-     #bl_width_default = 250
 
-     initialized : bpy.props.BoolProperty(default = False)
 
-     mantis_node_class_name=bl_idname
 
-     
 
-     def init(self, context):
 
-         self.outputs.new("StringSocket", "matrix")
 
-         self.outputs.new("StringSocket", "matrix_local")
 
-         self.outputs.new("StringSocket", "matrix_basis")
 
-         self.outputs.new("StringSocket", "head")
 
-         self.outputs.new("StringSocket", "tail")
 
-         self.outputs.new("StringSocket", "length")
 
-         self.outputs.new("StringSocket", "rotation")
 
-         self.outputs.new("StringSocket", "location")
 
-         self.outputs.new("StringSocket", "scale")
 
-         self.initialized = True
 
-         
 
- class UtilityDriverVariableNode(Node, MantisUINode):
 
-     """Creates a variable for use in a driver."""
 
-     bl_idname = "UtilityDriverVariable"
 
-     bl_label = "Driver Variable"
 
-     bl_icon = "NODE"
 
-     initialized : bpy.props.BoolProperty(default = False)
 
-     mantis_node_class_name=bl_idname
 
-     
 
-     
 
-     def init(self, context):
 
-         self.inputs.new("EnumDriverVariableType", "Variable Type")                 # 0
 
-         self.inputs.new("ParameterStringSocket", "Property")                       # 1
 
-         self.inputs.new("IntSocket", "Property Index")                             # 2
 
-         self.inputs.new("EnumDriverVariableEvaluationSpace", "Evaluation Space")   # 3
 
-         self.inputs.new("EnumDriverRotationMode", "Rotation Mode")                 # 4
 
-         self.inputs.new("xFormSocket", "xForm 1")                                  # 5
 
-         self.inputs.new("xFormSocket", "xForm 2")                                  # 6
 
-         self.outputs.new("DriverVariableSocket", "Driver Variable")
 
-         self.inputs[3].hide = True
 
-         self.initialized = True
 
-     
 
-     def display_update(self, parsed_tree, context):
 
-         if self.inputs["Variable Type"].is_linked:
 
-             if context.space_data:
 
-                 node_tree = context.space_data.path[0].node_tree
 
-                 nc = parsed_tree.get(get_signature_from_edited_tree(self, context))
 
-                 if nc:
 
-                     driver_type = nc.evaluate_input("Variable Type")
 
-         else:
 
-             driver_type = self.inputs[0].default_value
 
-         if driver_type == 'SINGLE_PROP':
 
-             self.inputs[1].hide = False
 
-             self.inputs[2].hide = False
 
-             self.inputs[3].hide = False
 
-             self.inputs[4].hide = False
 
-             self.inputs[5].hide = False
 
-             self.inputs[6].hide = True
 
-         elif driver_type == 'LOC_DIFF':
 
-             self.inputs[1].hide = True
 
-             self.inputs[2].hide = True
 
-             self.inputs[3].hide = True
 
-             self.inputs[4].hide = True
 
-             self.inputs[5].hide = False
 
-             self.inputs[6].hide = False
 
-         elif driver_type == 'ROTATION_DIFF':
 
-             self.inputs[1].hide = True
 
-             self.inputs[2].hide = True
 
-             self.inputs[3].hide = True
 
-             self.inputs[4].hide = False
 
-             self.inputs[5].hide = False
 
-             self.inputs[6].hide = False
 
-         elif driver_type == 'TRANSFORMS':
 
-             self.inputs[1].hide = True
 
-             self.inputs[2].hide = True
 
-             self.inputs[3].hide = False
 
-             self.inputs[4].hide = False
 
-             self.inputs[5].hide = False
 
-             self.inputs[6].hide = True
 
-     
 
- # TODO: make a way to edit the fCurve directly.
 
- # I had a working version of this in the past, but it required doing sinful things like
 
- # keeping track of the RAM address of the window.
 
- class UtilityFCurveNode(Node, MantisUINode):
 
-     """Creates an fCurve for use with a driver."""
 
-     bl_idname = "UtilityFCurve"
 
-     bl_label = "fCurve"
 
-     bl_icon = "NODE"
 
-     
 
-     use_kf_nodes   : bpy.props.BoolProperty(default=True)
 
-     initialized : bpy.props.BoolProperty(default = False)
 
-     mantis_node_class_name=bl_idname
 
-     
 
-     def init(self, context):
 
-         self.inputs.new("eFCrvExtrapolationMode", "Extrapolation Mode")
 
-         self.outputs.new("FCurveSocket", "fCurve")
 
-         self.initialized = True
 
-             
 
-     def draw_buttons(self, context, layout):
 
-         layout.operator( 'mantis.fcurve_node_add_kf' )
 
-         if (len(self.inputs) > 1):
 
-             layout.operator( 'mantis.fcurve_node_remove_kf' )
 
- class UtilityDriverNode(Node, MantisUINode):
 
-     """Represents a Driver relationship"""
 
-     bl_idname = "UtilityDriver"
 
-     bl_label = "Driver"
 
-     bl_icon = "NODE"
 
-     initialized : bpy.props.BoolProperty(default = False)
 
-     mantis_node_class_name=bl_idname
 
-     
 
-     def init(self, context):
 
-         self.inputs.new("EnumDriverType", "Driver Type")
 
-         self.inputs.new("FCurveSocket", "fCurve")
 
-         self.inputs.new("StringSocket", "Expression")
 
-         self.outputs.new("DriverSocket", "Driver")
 
-         self.initialized = True
 
-         
 
-     def display_update(self, parsed_tree, context):
 
-         if not self.inputs["Driver Type"].is_linked:
 
-             dType = self.inputs["Driver Type"].default_value
 
-         nc = parsed_tree.get(get_signature_from_edited_tree(self, context))
 
-         if nc:
 
-             dType = nc.evaluate_input("Driver Type")
 
-         if dType == 'SCRIPTED':
 
-             self.inputs["Expression"].hide = False
 
-         else:
 
-             self.inputs["Expression"].hide = True
 
-     
 
-     def draw_buttons(self, context, layout):
 
-         # return
 
-         layout.operator( 'mantis.driver_node_add_variable' )
 
-         if (len(self.inputs) > 3):
 
-             layout.operator( 'mantis.driver_node_remove_variable' )
 
- class UtilitySwitchNode(Node, MantisUINode):
 
-     """Represents a switch relationship between one driver property and one or more driven properties."""
 
-     bl_idname = "UtilitySwitch"
 
-     bl_label = "Switch"
 
-     bl_icon = "NODE"
 
-     initialized : bpy.props.BoolProperty(default = False)
 
-     mantis_node_class_name=bl_idname
 
-     
 
-     def init(self, context):
 
-         # self.inputs.new("xFormSocket", "xForm")
 
-         self.inputs.new("ParameterStringSocket", "Parameter")
 
-         self.inputs.new("IntSocket", "Parameter Index")
 
-         self.inputs.new("BooleanSocket", "Invert Switch")
 
-         self.outputs.new("DriverSocket", "Driver")
 
-         self.initialized = True
 
- class UtilityCombineThreeBoolNode(Node, MantisUINode):
 
-     """Combines three booleans into a three-bool."""
 
-     bl_idname = "UtilityCombineThreeBool"
 
-     bl_label = "CombineThreeBool"
 
-     bl_icon = "NODE"
 
-     initialized : bpy.props.BoolProperty(default = False)
 
-     mantis_node_class_name=bl_idname
 
-     
 
-     def init(self, context):
 
-         self.inputs.new("BooleanSocket", "X")
 
-         self.inputs.new("BooleanSocket", "Y")
 
-         self.inputs.new("BooleanSocket", "Z")
 
-         self.outputs.new("BooleanThreeTupleSocket", "Three-Bool")
 
-         self.initialized = True
 
- class UtilityCombineVectorNode(Node, MantisUINode):
 
-     """Combines three floats into a vector."""
 
-     bl_idname = "UtilityCombineVector"
 
-     bl_label = "CombineVector"
 
-     bl_icon = "NODE"
 
-     initialized : bpy.props.BoolProperty(default = False)
 
-     mantis_node_class_name=bl_idname
 
-     
 
-     def init(self, context):
 
-         self.inputs.new("FloatSocket", "X")
 
-         self.inputs.new("FloatSocket", "Y")
 
-         self.inputs.new("FloatSocket", "Z")
 
-         self.outputs.new("VectorSocket", "Vector")
 
-         self.initialized = True
 
-         
 
- class UtilitySeparateVector(Node, MantisUINode):
 
-     """Separates a vector into three floats"""
 
-     bl_idname = "UtilitySeparateVector"
 
-     bl_label = "Separate Vector"
 
-     bl_icon = "NODE"
 
-     initialized : bpy.props.BoolProperty(default = False)
 
-     mantis_node_class_name=bl_idname
 
-     
 
-     def init(self, context):
 
-         self.inputs.new("VectorSocket", "Vector")
 
-         self.outputs.new("FloatSocket", "X")
 
-         self.outputs.new("FloatSocket", "Y")
 
-         self.outputs.new("FloatSocket", "Z")
 
-         self.initialized = True
 
-         
 
- class UtilityCatStringsNode(Node, MantisUINode):
 
-     """Adds a suffix to a string"""
 
-     bl_idname = "UtilityCatStrings"
 
-     bl_label = "Concatenate Strings"
 
-     bl_icon = "NODE"
 
-     initialized : bpy.props.BoolProperty(default = False)
 
-     mantis_node_class_name=bl_idname
 
-     
 
-     def init(self, context):
 
-         self.inputs.new("StringSocket", "String_1")
 
-         self.inputs.new("StringSocket", "String_2")
 
-         self.outputs.new("StringSocket", "OutputString")
 
-         self.initialized = True
 
-     def draw_label(self): # this will prefer a user-set label, or return the evaluated name
 
-         if self.label:
 
-             return self.label
 
-         if self.outputs['OutputString'].display_text:
 
-             return self.outputs['OutputString'].display_text
 
-         return self.name
 
-         
 
-     def display_update(self, parsed_tree, context):
 
-         if context.space_data:
 
-             nc = parsed_tree.get(get_signature_from_edited_tree(self, context))
 
-             self.inputs['String_1'].display_text = ""
 
-             self.inputs['String_2'].display_text = ""
 
-             self.outputs['OutputString'].display_text = ""
 
-             if nc:
 
-                 try:
 
-                     self.inputs['String_1'].display_text = a = nc.evaluate_input("String_1")
 
-                     self.inputs['String_2'].display_text = b = nc.evaluate_input("String_2")
 
-                     # cat the strings here, since the node may not have run yet.
 
-                     self.outputs['OutputString'].display_text = a+b
 
-                 except KeyError:
 
-                     return # the tree isn't ready yet.
 
-                 
 
-     
 
- class InputLayerMaskNode(Node, MantisUINode):
 
-     """Represents a layer mask for a bone."""
 
-     bl_idname = "InputLayerMaskNode"
 
-     bl_label = "Layer Mask"
 
-     bl_icon = "NODE"
 
-     initialized : bpy.props.BoolProperty(default = False)
 
-     mantis_node_class_name=bl_idname
 
-     
 
-     def init(self, context):
 
-         self.outputs.new("LayerMaskInputSocket", "Layer Mask")
 
-         self.initialized = True
 
- class InputWidget(Node, MantisUINode):
 
-     """Fetches a Widget from the Widget Library."""
 
-     bl_idname = "InputWidget"
 
-     bl_label = "Widget"
 
-     bl_icon = "NODE"
 
-     initialized : bpy.props.BoolProperty(default = False)
 
-     mantis_node_class_name=bl_idname
 
-     
 
-     def init(self, context):
 
-         self.init_sockets(InputWidgetSockets)
 
-         self.initialized = True
 
-     
 
- class InputExistingGeometryObjectNode(Node, MantisUINode):
 
-     """Represents an existing geometry object from within the scene."""
 
-     bl_idname = "InputExistingGeometryObject"
 
-     bl_label = "Existing Object"
 
-     bl_icon = "NODE"
 
-     initialized : bpy.props.BoolProperty(default = False)
 
-     mantis_node_class_name=bl_idname
 
-     # We want Mantis to import widgets and stuff, so we hold a reference to the object
 
-     object_reference : bpy.props.PointerProperty(type=bpy.types.Object,) 
 
-     
 
-     def init(self, context):
 
-         self.inputs.new("StringSocket", "Name")
 
-         self.outputs.new("xFormSocket", "Object")
 
-         self.initialized = True
 
-     
 
-     def display_update(self, parsed_tree, context):
 
-         nc = parsed_tree.get(get_signature_from_edited_tree(self, context))
 
-         if nc: # this is done here so I don't have to define yet another custom socket.
 
-             self.object_reference = bpy.data.objects.get(nc.evaluate_input("Name"))
 
-     
 
- # TODO: maybe I should hold a data reference here, too.
 
- #       but it is complicated by the fact that Mantis does not distinguish b/tw geo types
 
- class InputExistingGeometryDataNode(Node, MantisUINode):
 
-     """Represents a mesh or curve datablock from the scene."""
 
-     bl_idname = "InputExistingGeometryData"
 
-     bl_label = "Existing Geometry"
 
-     bl_icon = "NODE"
 
-     initialized : bpy.props.BoolProperty(default = False)
 
-     mantis_node_class_name=bl_idname
 
-     
 
-     def init(self, context):
 
-         self.inputs.new("StringSocket", "Name")
 
-         self.outputs.new("GeometrySocket", "Geometry")
 
-         self.initialized = True
 
- class InputThemeBoneColorSets(Node, MantisUINode):
 
-     """Displays the theme's colors."""
 
-     bl_idname = "InputThemeBoneColorSets"
 
-     bl_label = "Theme Colors"
 
-     bl_icon = "NODE"
 
-     bl_width_min=280
 
-     initialized : bpy.props.BoolProperty(default = False)
 
-     mantis_node_class_name=bl_idname
 
-     
 
-     def init(self, context):
 
-         for i in range(20):
 
-             s = self.outputs.new("ColorSetDisplaySocket", f"Color {str(i).zfill(2)}")
 
-             s.color_index=i
 
-         self.initialized = True
 
- class InputColorSetPallete(Node, MantisUINode):
 
-     """Displays the theme's colors."""
 
-     bl_idname = "InputColorSetPallete"
 
-     bl_label = "Color Pallete"
 
-     bl_icon = "NODE"
 
-     bl_width_min=280
 
-     initialized : bpy.props.BoolProperty(default = False)
 
-     mantis_node_class_name=bl_idname
 
-     
 
-     def init(self, context):
 
-         self.initialized = True
 
-     
 
-     def draw_buttons(self, context, layout):
 
-         ops_props = layout.operator('mantis.color_pallete_socket_add')
 
-         ops_props.tree_invoked = self.id_data.name
 
-         ops_props.node_invoked = self.name
 
- def socket_data_from_collection_paths(root_data, root_name, path, socket_data):
 
-     # so we need to 'push' the socket names and their paths in order
 
-     # socket_data is a list of tuples of ( name, path, )
 
-     for key, value in root_data.items():
 
-         path.append(key)
 
-         socket_data.append( (key, path))
 
-         if hasattr(value , 'items'):
 
-             socket_data = socket_data_from_collection_paths(value, key, path.copy(), socket_data)
 
-         path.pop()
 
-     return socket_data
 
- class UtilityDeclareCollections(Node, MantisUINode):
 
-     """A utility used to declare bone collections."""
 
-     bl_idname = "UtilityDeclareCollections"
 
-     bl_label  = "Collections"
 
-     bl_icon   = "NODE"
 
-     bl_width_min = 320
 
-     initialized : bpy.props.BoolProperty(default = False)
 
-     mantis_node_class_name=bl_idname
 
-     # Here is the layout of the data:
 
-     # nested dicts of key:dict ( key = name, dict = children)
 
-     # the 'leaf nodes' are empty dicts
 
-     # we'll store it as a JSON string in order to make it a bpy.props 
 
-     # and still have the ability to use it as a dict and save it
 
-     # TODO: check and see if these strings have a character limit
 
-     collection_declarations : bpy.props.StringProperty(default="")
 
-     def update_interface(self):
 
-         from .utilities import get_socket_maps, do_relink
 
-         # we need to do dynamic stuff here like with interfaces
 
-         socket_map_out = get_socket_maps(self)[1]
 
-         self.outputs.clear()
 
-         current_data = self.read_declarations_from_json()
 
-         socket_data = socket_data_from_collection_paths(current_data, self.name, [], [])
 
-         for item in socket_data:
 
-             full_path_name = '>'.join(item[1]+[item[0]])
 
-             s = self.outputs.new('CollectionDeclarationSocket', name=item[0],identifier=full_path_name )
 
-             s.collection_path = full_path_name
 
-         for s in self.outputs:
 
-             if s.identifier in socket_map_out.keys():
 
-                 do_relink(self, s, socket_map_out, 'OUTPUT')
 
-         
 
-     def init(self, context):
 
-         self.initialized = True
 
-         if self.collection_declarations == "":
 
-             self.push_declarations_to_json({})
 
-     
 
-     def push_declarations_to_json(self, dict):
 
-         import json
 
-         j_str = json.dumps(dict)
 
-         self.collection_declarations = j_str
 
-     def read_declarations_from_json(self):
 
-         import json
 
-         j_data = json.loads(self.collection_declarations)
 
-         return j_data
 
-     
 
-     def draw_buttons(self, context, layout):
 
-         op_props = layout.operator('mantis.collection_add_new')
 
-         op_props.socket_invoked = '' # this isn't reset between invocations
 
-         # so we have to make sure to unset it when running it from the node
 
- class UtilityCollectionJoin(Node, MantisUINode):
 
-     """A utility used to join bone collection declarations."""
 
-     bl_idname = "UtilityCollectionJoin"
 
-     bl_label  = "Join Collection Declarations"
 
-     bl_icon   = "NODE"
 
-     initialized : bpy.props.BoolProperty(default = False)
 
-     mantis_node_class_name=bl_idname
 
-     def init(self, context):
 
-         self.init_sockets(CollectionJoinSockets)
 
-         self.initialized = True
 
- class UtilityCollectionHierarchy(Node, MantisUINode):
 
-     """A utility used to declare bone collection hierarchies."""
 
-     bl_idname = "UtilityCollectionHierarchy"
 
-     bl_label  = "Collection Child Declaration"
 
-     bl_icon   = "NODE"
 
-     initialized : bpy.props.BoolProperty(default = False)
 
-     mantis_node_class_name=bl_idname
 
-     def init(self, context):
 
-         self.init_sockets(CollectionHierarchySockets)
 
-         self.initialized = True
 
-         
 
- class UtilityGeometryOfXForm(Node, MantisUINode):
 
-     """Retrieves a mesh or curve datablock from an xForm."""
 
-     bl_idname = "UtilityGeometryOfXForm"
 
-     bl_label = "Geometry of xForm"
 
-     bl_icon = "NODE"
 
-     initialized : bpy.props.BoolProperty(default = False)
 
-     mantis_node_class_name=bl_idname
 
-     
 
-     def init(self, context):
 
-         self.inputs.new("xFormSocket", "xForm")
 
-         self.outputs.new("GeometrySocket", "Geometry")
 
-         self.initialized = True
 
- class UtilityNameOfXForm(Node, MantisUINode):
 
-     """Retrieves the name of a xForm."""
 
-     bl_idname = "UtilityNameOfXForm"
 
-     bl_label = "Name of xForm"
 
-     bl_icon = "NODE"
 
-     initialized : bpy.props.BoolProperty(default = False)
 
-     mantis_node_class_name=bl_idname
 
-     
 
-     def init(self, context):
 
-         self.inputs.new("xFormSocket", "xForm")
 
-         self.outputs.new("StringSocket", "Name")
 
-         self.initialized = True
 
- class UtilityGetBoneLength(Node, MantisUINode):
 
-     """Returns the length of the bone from its matrix."""
 
-     bl_idname = "UtilityGetBoneLength"
 
-     bl_label = "Get Bone Length"
 
-     bl_icon = "NODE"
 
-     initialized : bpy.props.BoolProperty(default = False)
 
-     mantis_node_class_name=bl_idname
 
-     
 
-     def init(self, context):
 
-         self.inputs.new("MatrixSocket", "Bone Matrix")
 
-         self.outputs.new("FloatSocket", "Bone Length")
 
-         self.initialized = True
 
- # TODO: make it work with BBones!
 
- class UtilityPointFromBoneMatrix(Node, MantisUINode):
 
-     """Returns a point representing the location along a bone, given a matrix representing that bone's shape."""
 
-     bl_idname = "UtilityPointFromBoneMatrix"
 
-     bl_label = "Point from Bone Matrix"
 
-     bl_icon = "NODE"
 
-     initialized : bpy.props.BoolProperty(default = False)
 
-     mantis_node_class_name=bl_idname
 
-     
 
-     def init(self, context):
 
-         self.inputs.new("MatrixSocket", "Bone Matrix")
 
-         self.inputs.new("FloatFactorSocket", "Head/Tail")
 
-         self.outputs.new("VectorSocket", "Point")
 
-         self.initialized = True
 
- class UtilitySetBoneLength(Node, MantisUINode):
 
-     """Sets the length of a bone matrix."""
 
-     bl_idname = "UtilitySetBoneLength"
 
-     bl_label = "Set Bone Matrix Length"
 
-     bl_icon = "NODE"
 
-     initialized : bpy.props.BoolProperty(default = False)
 
-     mantis_node_class_name=bl_idname
 
-     
 
-     def init(self, context):
 
-         self.inputs.new("MatrixSocket", "Bone Matrix")
 
-         self.inputs.new("FloatSocket", "Length")
 
-         self.outputs.new("MatrixSocket", "Bone Matrix")
 
-         self.initialized = True
 
- # TODO: more keyframe types should be supported in the future.
 
- # Some of the code that can do this is commented out here until I can implement it properly.
 
- class UtilityKeyframe(Node, MantisUINode):
 
-     """A keyframe for a FCurve"""
 
-     bl_idname = "UtilityKeyframe"
 
-     bl_label = "KeyFrame"
 
-     bl_icon = "NODE"
 
-     initialized : bpy.props.BoolProperty(default = False)
 
-     mantis_node_class_name=bl_idname
 
-     
 
-     def init(self, context):
 
-         # x and y
 
-         # output is keyframe
 
-         # self.inputs.new("EnumKeyframeInterpolationTypeSocket", "Interpolation")
 
-         # self.inputs.new("EnumKeyframeBezierHandleType", "Left Handle Type")
 
-         # self.inputs.new("EnumKeyframeBezierHandleType", "Right Handle Type")
 
-         # self.inputs.new("FloatSocket", "Left Handle Distance")
 
-         # self.inputs.new("FloatSocket", "Left Handle Value")
 
-         # self.inputs.new("FloatSocket", "Right Handle Frame")
 
-         # self.inputs.new("FloatSocket", "Right Handle Value")
 
-         self.inputs.new("FloatSocket", "Frame")
 
-         self.inputs.new("FloatSocket", "Value")
 
-         self.outputs.new("KeyframeSocket", "Keyframe")
 
-         # there will eventually be inputs for e.g. key type, key handles, etc.
 
-         # right now I am gonna hardcode LINEAR keyframes so I don't have to deal with anything else
 
-         # TODO TODO TODO
 
-     # def display_update(self, parsed_tree, context):
 
-     #     if context.space_data:
 
-     #         nc = parsed_tree.get(get_signature_from_edited_tree(self, context))
 
-     #         if nc.evaluate_input("Interpolation") in ["CONSTANT", "LINEAR"]:
 
-     #             for inp in self.inputs[1:6]:
 
-     #                 inp.hide = True
 
-     #         else:
 
-     #             if nc.evaluate_input("Left Handle Type") in ["FREE", "ALIGNED"]:
 
-     #             for inp in self.inputs[1:6]:
 
-     #                 inp.hide = False
 
-         self.initialized = True
 
- class UtilityBoneMatrixHeadTailFlip(Node, MantisUINode):
 
-     """Flips a bone matrix so that the head is where the tail was and visa versa."""
 
-     bl_idname = "UtilityBoneMatrixHeadTailFlip"
 
-     bl_label = "Flip Head/Tail"
 
-     bl_icon = "NODE"
 
-     initialized : bpy.props.BoolProperty(default = False)
 
-     mantis_node_class_name=bl_idname
 
-     
 
-     def init(self, context):
 
-         self.inputs.new("MatrixSocket", "Bone Matrix")
 
-         self.outputs.new("MatrixSocket", "Bone Matrix")
 
-         self.initialized = True
 
- class UtilityMatrixTransform(Node, MantisUINode):
 
-     """Transforms a matrix by another."""
 
-     bl_idname = "UtilityMatrixTransform"
 
-     bl_label = "Multiply Matrices"
 
-     bl_icon = "NODE"
 
-     initialized : bpy.props.BoolProperty(default = False)
 
-     mantis_node_class_name=bl_idname
 
-     
 
-     def init(self, context):
 
-         self.inputs.new("MatrixSocket", "Matrix 1")
 
-         self.inputs.new("MatrixSocket", "Matrix 2")
 
-         self.outputs.new("MatrixSocket", "Out Matrix")
 
-         self.initialized = True
 
- class UtilityMatrixInvert(Node, MantisUINode):
 
-     """Inverts an invertable matrix, otherwise throws an error."""
 
-     bl_idname = "UtilityMatrixInvert"
 
-     bl_label = "Invert Matrix"
 
-     bl_icon = "NODE"
 
-     initialized : bpy.props.BoolProperty(default = False)
 
-     mantis_node_class_name=bl_idname
 
-     
 
-     def init(self, context):
 
-         self.init_sockets(MatrixInvertSockets)
 
-         self.initialized = True
 
- class UtilityMatrixCompose(Node, MantisUINode):
 
-     """Inverts an invertable matrix, otherwise throws an error."""
 
-     bl_idname = "UtilityMatrixCompose"
 
-     bl_label = "Compose Matrix"
 
-     bl_icon = "NODE"
 
-     initialized : bpy.props.BoolProperty(default = False)
 
-     mantis_node_class_name=bl_idname
 
-     
 
-     def init(self, context):
 
-         self.init_sockets(MatrixComposeSockets)
 
-         self.initialized = True
 
- class UtilityMatrixAlignRoll(Node, MantisUINode):
 
-     """Aligns the Z axis of a matrix to point in a direction."""
 
-     bl_idname = "UtilityMatrixAlignRoll"
 
-     bl_label = "Align Matrix Roll"
 
-     bl_icon = "NODE"
 
-     initialized : bpy.props.BoolProperty(default = False)
 
-     mantis_node_class_name=bl_idname
 
-     
 
-     def init(self, context):
 
-         self.init_sockets(MatrixAlignRollSockets)
 
-         self.initialized = True
 
- class UtilityMatrixSetLocation(Node, MantisUINode):
 
-     """Sets a matrix's location."""
 
-     bl_idname = "UtilityMatrixSetLocation"
 
-     bl_label = "Set Matrix Location"
 
-     bl_icon = "NODE"
 
-     initialized : bpy.props.BoolProperty(default = False)
 
-     mantis_node_class_name=bl_idname
 
-     
 
-     def init(self, context):
 
-         self.inputs.new("MatrixSocket", "Matrix")
 
-         self.inputs.new("VectorSocket", "Location")
 
-         self.outputs.new("MatrixSocket", "Matrix")
 
-         self.initialized = True
 
- class UtilityMatrixGetLocation(Node, MantisUINode):
 
-     """Gets a matrix's location."""
 
-     bl_idname = "UtilityMatrixGetLocation"
 
-     bl_label = "Get Matrix Location"
 
-     bl_icon = "NODE"
 
-     initialized : bpy.props.BoolProperty(default = False)
 
-     mantis_node_class_name=bl_idname
 
-     
 
-     def init(self, context):
 
-         self.inputs.new("MatrixSocket", "Matrix")
 
-         self.outputs.new("VectorSocket", "Location")
 
-         self.initialized = True
 
- class UtilityTransformationMatrix(Node, MantisUINode):
 
-     """Constructs a matrix representing a transformation"""
 
-     bl_idname = "UtilityTransformationMatrix"
 
-     bl_label = "Transformation Matrix"
 
-     bl_icon = "NODE"
 
-     initialized : bpy.props.BoolProperty(default = False)
 
-     mantis_node_class_name=bl_idname
 
-     
 
-     def init(self, context):
 
-         # first input is a transformation type - translation, rotation, or scale
 
-         #                         rotation is an especially annoying feature because it can take multiple types
 
-         #   so Euler, axis/angle, quaternion, matrix...
 
-         #   for now I am only going to implement axis-angle
 
-         # it should get an axis and a magnitude
 
-         # self.inputs.new("MatrixSocket", "Bone Matrix")
 
-         
 
-         self.inputs.new("MatrixTransformOperation", "Operation")
 
-         self.inputs.new("VectorSocket", "Vector")
 
-         self.inputs.new("FloatSocket", "W")
 
-         self.outputs.new("MatrixSocket", "Matrix")
 
-         self.initialized = True
 
-     def display_update(self, parsed_tree, context):
 
-         operation = self.inputs['Operation'].default_value
 
-         if self.inputs['Operation'].is_linked:
 
-             if context.space_data:
 
-                 nc = parsed_tree.get(get_signature_from_edited_tree(self, context))
 
-                 operation = nc.evaluate_input("Operation")
 
-         if operation in ["ROTATE_AXIS_ANGLE", "SCALE"]:
 
-             self.inputs["Vector"].hide = False
 
-             self.inputs["W"].hide = False
 
-         if operation in ["TRANSLATE"]:
 
-             self.inputs["Vector"].hide = False
 
-             self.inputs["W"].hide = True
 
-             
 
- # Blender calculates bone roll this way...
 
- # https://projects.blender.org/blender/blender/src/commit/dd209221675ac7b62ce47b7ea42f15cbe34a6035/source/blender/editors/armature/armature_edit.cc#L281
 
- # but this looks like it will be harder to re-implement than to re-use. Unfortunately, it doesn't apply directly to a matrix so I have to call a method
 
- # in the edit bone.
 
- # So instead, we need to avoid calculating the roll for now.
 
- # but I want to make that its own node and add roll-recalc to this node, too.
 
- class UtilitySetBoneMatrixTail(Node, MantisUINode):
 
-     """Constructs a matrix representing a transformation"""
 
-     bl_idname = "UtilitySetBoneMatrixTail"
 
-     bl_label = "Set Bone Matrix Tail"
 
-     bl_icon = "NODE"
 
-     initialized : bpy.props.BoolProperty(default = False)
 
-     mantis_node_class_name=bl_idname
 
-     
 
-     def init(self, context):
 
-         self.inputs.new("MatrixSocket", "Matrix")
 
-         self.inputs.new("VectorSocket", "Tail Location")
 
-         self.outputs.new("MatrixSocket", "Result")
 
-         self.initialized = True
 
- class UtilityMatrixFromXForm(Node, MantisUINode):
 
-     """Returns the matrix of the given xForm node."""
 
-     bl_idname = "UtilityMatrixFromXForm"
 
-     bl_label = "Matrix of xForm"
 
-     bl_icon = "NODE"
 
-     initialized : bpy.props.BoolProperty(default = False)
 
-     mantis_node_class_name=bl_idname
 
-     
 
-     def init(self, context):
 
-         self.inputs.new("xFormSocket", "xForm")
 
-         self.outputs.new("MatrixSocket", "Matrix")
 
-         self.initialized = True
 
- class UtilityAxesFromMatrix(Node, MantisUINode):
 
-     """Returns the axes of the matrix."""
 
-     bl_idname = "UtilityAxesFromMatrix"
 
-     bl_label = "Axes of Matrix"
 
-     bl_icon = "NODE"
 
-     initialized : bpy.props.BoolProperty(default = False)
 
-     mantis_node_class_name=bl_idname
 
-     
 
-     def init(self, context):
 
-         self.inputs.new("MatrixSocket", "Matrix")
 
-         self.outputs.new("VectorSocket", "X Axis")
 
-         self.outputs.new("VectorSocket", "Y Axis")
 
-         self.outputs.new("VectorSocket", "Z Axis")
 
-         self.initialized = True
 
- class UtilityIntToString(Node, MantisUINode):
 
-     """Converts a number to a string"""
 
-     bl_idname = "UtilityIntToString"
 
-     bl_label = "Number String"
 
-     bl_icon = "NODE"
 
-     initialized : bpy.props.BoolProperty(default = False)
 
-     mantis_node_class_name=bl_idname
 
-     
 
-     def init(self, context):
 
-         
 
-         self.inputs.new("IntSocket", "Number")
 
-         self.inputs.new("IntSocket", "Zero Padding")
 
-         self.outputs.new("StringSocket", "String")
 
-         self.initialized = True
 
- class UtilityArrayGet(Node, MantisUINode):
 
-     """Gets a value from an array at a specified index."""
 
-     bl_idname = "UtilityArrayGet"
 
-     bl_label  = "Array Get"
 
-     bl_icon   = "NODE"
 
-     initialized : bpy.props.BoolProperty(default = False)
 
-     mantis_node_class_name=bl_idname
 
-     
 
-     def init(self, context):
 
-         self.inputs.new('EnumArrayGetOptions', 'OoB Behaviour')
 
-         self.inputs.new("IntSocket", "Index")
 
-         s = self.inputs.new("WildcardSocket", "Array", use_multi_input=True)
 
-         s.display_shape = 'SQUARE_DOT'
 
-         self.outputs.new("WildcardSocket", "Output")
 
-         self.initialized = True
 
-     
 
-     def update(self):
 
-         wildcard_color = (0.0,0.0,0.0,0.0)
 
-         if self.inputs['Array'].is_linked == False:
 
-             self.inputs['Array'].color = wildcard_color
 
-             self.outputs['Output'].color = wildcard_color
 
-     def insert_link(self, link):
 
-         super().insert_link(link)
 
-         if link.to_socket.identifier == self.inputs['Array'].identifier:
 
-             from_socket = link.from_socket
 
-             if hasattr(from_socket, "color"):
 
-                 self.inputs['Array'].color = from_socket.color
 
-                 self.outputs['Output'].color = from_socket.color
 
- class UtilityArrayLength(Node, MantisUINode):
 
-     """Gets The length of an array."""
 
-     bl_idname = "UtilityArrayLength"
 
-     bl_label  = "Array Length"
 
-     bl_icon   = "NODE"
 
-     initialized : bpy.props.BoolProperty(default = False)
 
-     mantis_node_class_name=bl_idname
 
-     
 
-     def init(self, context):
 
-         s = self.inputs.new("WildcardSocket", "Array", use_multi_input=True)
 
-         s.display_shape = 'SQUARE_DOT'
 
-         self.outputs.new("UnsignedIntSocket", "Length")
 
-         self.initialized = True
 
-     
 
-     def update(self):
 
-         wildcard_color = (0.0,0.0,0.0,0.0)
 
-         if self.inputs['Array'].is_linked == False:
 
-             self.inputs['Array'].color = wildcard_color
 
-     def insert_link(self, link):
 
-         super().insert_link(link)
 
-         if link.to_socket.identifier == self.inputs['Array'].identifier:
 
-             from_socket = link.from_socket
 
-             if hasattr(from_socket, "color"):
 
-                 self.inputs['Array'].color = from_socket.color
 
- class UtilityCompare(Node, MantisUINode):
 
-     """Compares two inputs and produces a boolean output"""
 
-     bl_idname = "UtilityCompare"
 
-     bl_label = "Compare"
 
-     bl_icon = "NODE"
 
-     initialized : bpy.props.BoolProperty(default = False)
 
-     mantis_node_class_name=bl_idname
 
-     
 
-     def init(self, context):
 
-         self.init_sockets(CompareSockets)
 
-         self.initialized = True
 
-     
 
-     def update(self):
 
-         wildcard_color = (0.0,0.0,0.0,0.0)
 
-         if self.inputs['A'].is_linked == False:
 
-             self.inputs['A'].color = wildcard_color
 
-         if self.inputs['B'].is_linked == False:
 
-             self.inputs['B'].color = wildcard_color
 
-     def insert_link(self, link):
 
-         super().insert_link(link)
 
-         if link.to_socket.identifier == self.inputs['A'].identifier:
 
-             self.inputs['A'].color = link.from_socket.color_simple
 
-             if hasattr(link.from_socket, "color"):
 
-                 self.inputs['A'].color = link.from_socket.color
 
-         if link.to_socket.identifier == self.inputs['B'].identifier:
 
-             self.inputs['B'].color = link.from_socket.color_simple
 
-             if hasattr(link.from_socket, "color"):
 
-                 self.inputs['B'].color = link.from_socket.color
 
- class UtilityChoose(Node, MantisUINode):
 
-     """Chooses an output"""
 
-     bl_idname = "UtilityChoose"
 
-     bl_label = "Choose"
 
-     bl_icon = "NODE"
 
-     initialized : bpy.props.BoolProperty(default = False)
 
-     mantis_node_class_name=bl_idname
 
-     
 
-     def init(self, context):
 
-         
 
-         self.inputs.new("BooleanSocket", "Condition")
 
-         self.inputs.new("WildcardSocket", "A")
 
-         self.inputs.new("WildcardSocket", "B")
 
-         self.outputs.new("WildcardSocket", "Result")
 
-         self.initialized = True
 
-     
 
-     def display_update(self, parsed_tree, context):
 
-         wildcard_color = (0.0,0.0,0.0,0.0)
 
-         if not self.inputs['A'].is_linked:
 
-             self.inputs['A'].color = wildcard_color
 
-         if not self.inputs['B'].is_linked:
 
-             self.inputs['B'].color = wildcard_color
 
-         self.outputs['Result'].color = wildcard_color
 
-         # if both inputs are the same color, then use that color for the result
 
-         if self.inputs['Condition'].is_linked:
 
-             from .base_definitions import get_signature_from_edited_tree
 
-             nc = parsed_tree.get(get_signature_from_edited_tree(self, context))
 
-             if nc:
 
-                 condition = nc.evaluate_input('Condition')
 
-         else:
 
-             condition = self.inputs['Condition'].default_value
 
-         if condition == True:
 
-             self.outputs['Result'].color = self.inputs['B'].color
 
-         else:
 
-             self.outputs['Result'].color = self.inputs['A'].color
 
-     def insert_link(self, link):
 
-         super().insert_link(link)
 
-         if link.to_socket.identifier == self.inputs['A'].identifier:
 
-             self.inputs['A'].color = link.from_socket.color_simple
 
-             if hasattr(link.from_socket, "color"):
 
-                 self.inputs['A'].color = link.from_socket.color
 
-         if link.to_socket.identifier == self.inputs['B'].identifier:
 
-             self.inputs['B'].color = link.from_socket.color_simple
 
-             if hasattr(link.from_socket, "color"):
 
-                 self.inputs['B'].color = link.from_socket.color
 
- class UtilityPrint(Node, MantisUINode):
 
-     """A utility used to print arbitrary values."""
 
-     bl_idname = "UtilityPrint"
 
-     bl_label  = "Print"
 
-     bl_icon   = "NODE"
 
-     initialized : bpy.props.BoolProperty(default = False)
 
-     mantis_node_class_name=bl_idname
 
-     
 
-     def init(self, context):
 
-         self.inputs.new("WildcardSocket", "Input")
 
-         self.initialized = True
 
- # Set up the class property that ties the UI classes to the Mantis classes.
 
- for cls in TellClasses():
 
-     cls.mantis_node_library='.misc_nodes'
 
-     cls.set_mantis_class()
 
 
  |