socket_definitions.py 85 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372
  1. import bpy
  2. from bpy.types import NodeSocket, NodeSocketStandard
  3. # Classes which do not have default_value
  4. # needed to detect when there is an error updating dynamic nodes
  5. no_default_value= [
  6. 'MantisSocket',
  7. 'RelationshipSocket',
  8. 'DeformerSocket',
  9. 'xFormSocket',
  10. 'GeometrySocket',
  11. 'GenericRotationSocket',
  12. 'FCurveSocket',
  13. 'DriverSocket',
  14. 'DriverVariableSocket',
  15. 'xFormParameterSocket',
  16. 'MorphTargetSocket',
  17. 'KeyframeSocket',
  18. 'WildcardSocket',
  19. ]
  20. # the sockets that do not have this field do not transfer data.
  21. # instead, it is the link itself which is meaningful.
  22. class MantisSocket(NodeSocket):
  23. is_valid_interface_type=False
  24. from .utilities import (prRed, prGreen, prPurple, prWhite,
  25. prOrange,
  26. wrapRed, wrapGreen, wrapPurple, wrapWhite,
  27. wrapOrange,)
  28. transform_spaces_bone_to = (('WORLD', "World", "World Space"),
  29. ('LOCAL', "Local", "Local Space"),
  30. ('POSE', "Pose", "Pose Space"),
  31. ('CUSTOM', "Custom", "Custom Space"),
  32. ('LOCAL_WITH_PARENT', "Local (With Parent)", "Local Space"),
  33. ('LOCAL_OWNER_ORIENT', "Local (Owner Orientation)", "Local Space"),)
  34. transform_spaces_bone_from = (('WORLD', "World", "World Space"),
  35. ('LOCAL', "Local", "Local Space"),
  36. ('POSE', "Pose", "Pose Space"),
  37. ('CUSTOM', "Custom", "Custom Space"),
  38. ('LOCAL_WITH_PARENT', "Local (With Parent)", "Local Space"),)
  39. transform_spaces_bone_object = (('WORLD', "World", "World Space"),
  40. ('LOCAL', "Local", "Local Space"),
  41. ('POSE', "Pose", "Pose Space"),
  42. ('CUSTOM', "Custom", "Custom Space"),)
  43. transform_spaces_object = (('WORLD', "World", "World Space"),
  44. ('LOCAL', "Local", "Local Space"),
  45. ('CUSTOM', "Custom", "Custom Space"),)
  46. enumRotationOrder =(('AUTO', 'Auto', 'Auto'),
  47. ('XYZ', "XYZ", "XYZ"),
  48. ('XZY', "XZY", "XZY"),
  49. ('ZXY', "ZXY", "ZXY"),
  50. ('ZYX', "ZYX", "ZYX"),
  51. ('YXZ', "YXZ", "YXZ"),
  52. ('YZX', "YZX", "YZX"),
  53. ('QUATERNION', "Quaternion", "Quaternion"),
  54. ('AXIS_ANGLE', "Axis Angle", "Axis Angle"),)
  55. # node socket colors:
  56. cFloat = (0.631373, 0.631373, 0.631373, 1.000000)
  57. cColor = (0.780392, 0.780392, 0.160784, 1.000000)
  58. cVector = (0.388235, 0.388235, 0.780392, 1.000000)
  59. cShader = (0.388235, 0.780392, 0.388235, 1.000000)
  60. cInt = (0.058824, 0.521569, 0.149020, 1.000000)
  61. cString = (0.388235, 0.388235, 0.388235, 1.000000)
  62. # cBool = (0.698039, 0.650980, 0.188235, 1.000000)
  63. cParameter = (0.48, 0.24, 0.24, 1.0)
  64. cDriver = (0.88, 0.11, 0.88, 1.0)
  65. cDriverVariable = (0.66, 0.33, 0.04, 1.0)
  66. cFCurve = (0.77, 0.77, 0.11, 1.0)
  67. cKeyframe = (0.06, 0.22, 0.88, 1.0)
  68. cEnable = (0.92, 0.92, 0.92, 1.0)
  69. cBoneCollection = (0.82, 0.82, 0.82, 1.0)
  70. cDeformer = (0.05, 0.08, 0.45, 1.0)
  71. cShapeKey = (0.95, 0.32, 0.05, 1.0)
  72. # custom colors:
  73. cIK = (0.596078, 0.596078, 0.364706, 1.000000) #because it's yellow in Blender
  74. cRelationship = (0.352941, 0.584314, 0.431373, 1.000000) #constraint color
  75. cMatrix = (0.0, 1.0, 0.75, 1)
  76. cxForm = (0.843137, 0.592157, 0.388235, 1.000000) #could even fetch the theme colors...
  77. cTransformSpace = (1.0, 0.4, 0.216, 1.0)
  78. cBool = (0.1, 0.1, 0.1, 1.0)
  79. cBool3 = (0.35, 0.25, 0.18, 1.0)
  80. cRotationOrder = (0.0, 0.8, 0.0, 1.0)
  81. cQuaternion = (0.85, 0.25, 0.18, 1.0)
  82. #
  83. cGeometry = (0.000000, 0.672443, 0.366253, 1.000000)
  84. # think about making colors that are representative of the data's purpose:
  85. # location
  86. # rotation
  87. # scale
  88. # OR make all of it a reference to the type of data within?
  89. # Hybrid approach: Make same-data, similar purpose have similar colors.
  90. from typing import List
  91. def TellClasses() -> List[MantisSocket]:
  92. return [ #MantisSocket,
  93. #DefaultSocket,
  94. #InputSocket,
  95. MatrixSocket,
  96. xFormSocket,
  97. RelationshipSocket,
  98. DeformerSocket,
  99. GeometrySocket,
  100. GenericRotationSocket,
  101. EnableSocket,
  102. HideSocket,
  103. # InverseKinematicsSocket,
  104. DriverSocket,
  105. DriverVariableSocket,
  106. FCurveSocket,
  107. # LayerMaskSocket,
  108. # LayerMaskInputSocket,
  109. BoneCollectionSocket,
  110. EnumArrayGetOptions,
  111. xFormParameterSocket,
  112. ParameterBoolSocket,
  113. ParameterIntSocket,
  114. ParameterFloatSocket,
  115. ParameterVectorSocket,
  116. ParameterStringSocket,
  117. TransformSpaceSocket,
  118. BooleanSocket,
  119. BooleanThreeTupleSocket,
  120. RotationOrderSocket,
  121. QuaternionSocket,
  122. QuaternionSocketAA,
  123. IntSocket,
  124. StringSocket,
  125. EnumMetaRigSocket,
  126. EnumMetaBoneSocket,
  127. EnumCurveSocket,
  128. BoolUpdateParentNode,
  129. # LabelSocket,
  130. IKChainLengthSocket,
  131. EnumInheritScale,
  132. EnumRotationMix,
  133. EnumRotationMixCopyTransforms,
  134. EnumMaintainVolumeStretchTo,
  135. EnumRotationStretchTo,
  136. EnumTrackAxis,
  137. EnumUpAxis,
  138. EnumLockAxis,
  139. EnumLimitMode,
  140. EnumYScaleMode,
  141. EnumXZScaleMode,
  142. EnumTransformationMap,
  143. EnumTransformationRotationMode,
  144. EnumTransformationRotationOrder,
  145. EnumTransformationTranslationMixMode,
  146. EnumTransformationRotationMixMode,
  147. EnumTransformationScaleMixMode,
  148. EnumTransformationAxes,
  149. EnumBBoneHandleType,
  150. # Deformers
  151. EnumSkinning,
  152. MorphTargetSocket,
  153. #
  154. FloatSocket,
  155. FloatPositiveSocket,
  156. FloatFactorSocket,
  157. FloatAngleSocket,
  158. VectorSocket,
  159. VectorEulerSocket,
  160. VectorTranslationSocket,
  161. VectorScaleSocket,
  162. # Drivers
  163. EnumDriverVariableType,
  164. EnumDriverVariableEvaluationSpace,
  165. EnumDriverVariableTransformChannel,
  166. EnumDriverRotationMode,
  167. EnumDriverType,
  168. KeyframeSocket,
  169. EnumKeyframeInterpolationTypeSocket,
  170. EnumKeyframeBezierHandleTypeSocket,
  171. eFCrvExtrapolationMode,
  172. # Math
  173. MathFloatOperation,
  174. MathVectorOperation,
  175. MatrixTransformOperation,
  176. # Schema
  177. WildcardSocket,
  178. # xFormArraySocket,
  179. # RelationshipArraySocket,
  180. # BooleanArraySocket,
  181. # IntArraySocket,
  182. # FloatArraySocket,
  183. # BooleanThreeTupleArraySocket,
  184. # VectorArraySocket,
  185. # QuaternionArraySocket,
  186. # MatrixArraySocket,
  187. # StringArraySocket,
  188. ]
  189. def Tell_bl_idnames(): # reroute nodes
  190. return [cls.bl_idname for cls in TellClasses()]#+["NodeSocketColor"]
  191. def tell_valid_bl_idnames():
  192. valid_classes = filter(lambda cls : cls.is_valid_interface_type, [cls for cls in TellClasses()])
  193. return (cls.bl_idname for cls in valid_classes)
  194. # Was setting color like this:
  195. # color : bpy.props.FloatVectorProperty(size = 4, default = cFCurve,)
  196. # but this didn't work when Blender automatically generated interface classes?
  197. # so changed it to color = cVariable
  198. # but for color-changing sockets, if I make them, this won' work? Maybe?
  199. #
  200. # I actually think I was wrong about all of that lol
  201. # TODO change it back, dingus
  202. ########################################################################
  203. # Update Callbacks
  204. ########################################################################
  205. def default_update(socket, context, do_execute=True):
  206. # return
  207. context = bpy.context
  208. if not context.space_data:
  209. return
  210. if not hasattr(context.space_data, "path"):
  211. return
  212. try:
  213. node_tree = context.space_data.path[0].node_tree
  214. except IndexError: # not in the UI, for example, in a script instead.
  215. node_tree = None
  216. return
  217. if hasattr(socket.node, "initialized"):
  218. if not socket.node.initialized: return
  219. else: return
  220. if node_tree.do_live_update and not (node_tree.is_executing or node_tree.is_exporting):
  221. # I don't know how the tree can be valid at 0 nodes but doesn't hurt
  222. # to force it if this somehow happens.
  223. if ((node_tree.tree_valid == False or len(node_tree.parsed_tree) == 0)
  224. or socket.node.bl_idname in ["MantisNodeGroup"]):
  225. # prGreen("Forcing Update From Socket Change.")
  226. node_tree.update_tree(context)
  227. elif (node_tree.tree_valid == True):
  228. # prGreen("Partial Update From Socket Change.")
  229. # We don't have to update the whole thing, just the socket
  230. from .utilities import tree_from_nc
  231. for nc in node_tree.parsed_tree.values():
  232. try:
  233. if (tree_from_nc(nc.signature, nc.base_tree) == socket.node.id_data):
  234. if socket.node.name in nc.signature:
  235. getstring = socket.name
  236. if (getstring not in nc.parameters.keys()):
  237. prRed("Socket update failed for %s" % socket.name)
  238. else:
  239. nc.parameters[getstring] = socket.default_value
  240. except AttributeError as e:
  241. prWhite(nc)
  242. prWhite(nc.inputs)
  243. raise e
  244. # Now update the tree display:
  245. node_tree.display_update(context)
  246. try:
  247. prPurple("calling Execute Tree from socket update")
  248. node_tree.execute_tree(context)
  249. except Exception as e:
  250. prRed("Automatic Tree Execution failed because of %s" % e)
  251. # I don't want to deal with this right now TODO
  252. # e.__traceback__.print_last() this isn't the same kind of traceback object as the traceback module
  253. # socket.node.is_triggering_execute = True
  254. def update_socket(self, context,):
  255. default_update(self,context)
  256. def update_mute_socket(self, context):
  257. self.node.mute = not self.default_value
  258. default_update(self,context)
  259. def update_hide_socket(self, context):
  260. self.node.mute = self.default_value
  261. default_update(self,context)
  262. def update_parent_node(self, context):
  263. default_update(self,context)
  264. if hasattr(self.node, "display_update"):
  265. self.node.display_update(context)
  266. def ik_chain_length_update_socket(self, context):
  267. default_update(self,context)
  268. # self.node.update_chain_length(context)
  269. # TODO: this is stupid. I don't know what I was trying to do when i made this
  270. # Driver Variable:
  271. def driver_variable_socket_update(self, context):
  272. default_update(self,context)
  273. # self.node.update_on_socket_change(context) # why?
  274. def driver_socket_update(self, context):
  275. default_update(self,context)
  276. # self.node.update_on_socket_change(context) # same here, no idea
  277. def update_metarig_armature(self, context,):
  278. if self.search_prop:
  279. self.node.armature = self.search_prop.name
  280. self.node.inputs["Meta-Bone"].search_prop = self.search_prop
  281. default_update(self,context)
  282. def update_metarig_posebone(self, context,):
  283. self.node.pose_bone = self.default_value
  284. default_update(self,context)
  285. ########################################################################
  286. # Sockets
  287. ########################################################################
  288. def ChooseDraw(self, context, layout, node, text, icon = "NONE", use_enum=True, nice_bool=True, icon_only=False):
  289. # return
  290. # TEXT ONLY
  291. if self.node.bl_idname in ["NodeGroupInput", "NodeGroupOutput"]:
  292. layout.label(text=text)
  293. elif hasattr(self, "display_text") and self.display_text and self.is_linked:
  294. layout.label(text=self.display_text)
  295. else:
  296. # ENUM VALUES (this is a HACK, fix it later)
  297. if ('Enum' in self.bl_idname) and (use_enum):
  298. if not (self.is_output or self.is_linked):
  299. layout.prop_tabs_enum(self, "default_value",)
  300. else:
  301. layout.label(text=text)
  302. # for OUTPUT sockets that take INPUT (confusing name!)
  303. elif ((hasattr(self, "default_value")) and hasattr(self, "input") and getattr(self, "input")):
  304. # for simple input nodes
  305. layout.prop(self, "default_value", text=text, toggle=nice_bool, slider=True)
  306. # for INPUTS that are NOT CONNECTED
  307. elif (hasattr(self, "default_value")) and not (self.is_output or self.is_linked):
  308. # DO: expose these values as parameters for this function
  309. # and set them for each socket.
  310. if icon == 'NONE': icon_only = False
  311. elif icon_only == True : text = "" # "real" icon-only looks bad for strings, need to check other props types.
  312. layout.prop(self, "default_value", text=text, toggle=nice_bool, slider=True, icon=icon,)
  313. # CONNECTED sockets and outputs without input fields
  314. else:
  315. layout.label(text=text)
  316. class RelationshipSocket(MantisSocket):
  317. # Description string
  318. '''Relationship'''
  319. # Optional identifier string. If not explicitly defined, the python class name is used.
  320. bl_idname = 'RelationshipSocket'
  321. bl_label = "Relationship"
  322. color_simple = cRelationship
  323. color : bpy.props.FloatVectorProperty(default=cRelationship, size=4)
  324. input : bpy.props.BoolProperty(default =False,)
  325. is_valid_interface_type=True
  326. def draw(self, context, layout, node, text):
  327. ChooseDraw(self, context, layout, node, text)
  328. def draw_color(self, context, node):
  329. return self.color
  330. @classmethod
  331. def draw_color_simple(self):
  332. return self.color_simple
  333. class DeformerSocket(MantisSocket):
  334. # Description string
  335. '''Deformer'''
  336. # Optional identifier string. If not explicitly defined, the python class name is used.
  337. bl_idname = 'DeformerSocket'
  338. bl_label = "Deformer"
  339. is_valid_interface_type=True
  340. color_simple = cDeformer
  341. color : bpy.props.FloatVectorProperty(default=cDeformer, size=4)
  342. input : bpy.props.BoolProperty(default =False,)
  343. def draw(self, context, layout, node, text):
  344. ChooseDraw(self, context, layout, node, text)
  345. def draw_color(self, context, node):
  346. return self.color
  347. @classmethod
  348. def draw_color_simple(self):
  349. return self.color_simple
  350. class MatrixSocket(MantisSocket):
  351. '''Matrix Input Output'''
  352. bl_idname = 'MatrixSocket'
  353. bl_label = "Matrix"
  354. default_value : bpy.props.FloatVectorProperty(
  355. default = (1.0, 0.0, 0.0, 0.0,
  356. 0.0, 1.0, 0.0, 0.0,
  357. 0.0, 0.0, 1.0, 0.0,
  358. 0.0, 0.0, 0.0, 1.0),
  359. size=16,
  360. update = update_socket,)
  361. color_simple = cMatrix
  362. color : bpy.props.FloatVectorProperty(default=cMatrix, size=4)
  363. input : bpy.props.BoolProperty(default =False,)
  364. is_valid_interface_type=True
  365. # Optional function for drawing the socket input value
  366. def draw(self, context, layout, node, text):
  367. layout.label(text=text)
  368. def draw_color(self, context, node):
  369. return self.color
  370. @classmethod
  371. def draw_color_simple(self):
  372. return self.color_simple
  373. # Utility functions to make handling the 16 numbers more bearable
  374. def SetValue(self, mat):
  375. self.default_value = ( mat[0][0], mat[0][1], mat[0][2], mat[0][3],
  376. mat[1][0], mat[1][1], mat[1][2], mat[1][3],
  377. mat[2][0], mat[2][1], mat[2][2], mat[2][3],
  378. mat[3][0], mat[3][1], mat[3][2], mat[3][3], )
  379. def TellValue(self):
  380. from mathutils import Matrix
  381. v = self.default_value
  382. return Matrix( ( ( v[ 0], v[ 1], v[ 2], v[ 3],),
  383. ( v[ 4], v[ 5], v[ 6], v[ 7],),
  384. ( v[ 8], v[ 9], v[10], v[11],),
  385. ( v[12], v[13], v[14], v[15]), ) )
  386. #NOTE, we're not using the last row
  387. # so we're gonna use it to store data
  388. # unused, unused, unused, bone_length
  389. # but we're not going to make it
  390. # available except by accessor functions
  391. # would like to make this stuff easier to deal with tho
  392. def TellBoneLength(self):
  393. return self.default_value[15]
  394. class xFormSocket(MantisSocket):
  395. '''xFrom Input Output'''
  396. bl_idname = 'xFormSocket'
  397. bl_label = "xForm"
  398. color_simple = cxForm
  399. color : bpy.props.FloatVectorProperty(default=cxForm, size=4)
  400. input : bpy.props.BoolProperty(default =False,)
  401. is_valid_interface_type=True
  402. def draw(self, context, layout, node, text):
  403. ChooseDraw(self, context, layout, node, text)
  404. def draw_color(self, context, node):
  405. return self.color
  406. @classmethod
  407. def draw_color_simple(self):
  408. return self.color_simple
  409. class GeometrySocket(MantisSocket):
  410. '''Geometry Input Output'''
  411. bl_idname = 'GeometrySocket'
  412. bl_label = "Geometry"
  413. color_simple = cGeometry
  414. color : bpy.props.FloatVectorProperty(default=cGeometry, size=4)
  415. input : bpy.props.BoolProperty(default =False,)
  416. is_valid_interface_type=True
  417. def draw(self, context, layout, node, text):
  418. ChooseDraw(self, context, layout, node, text)
  419. def draw_color(self, context, node):
  420. return self.color
  421. @classmethod
  422. def draw_color_simple(self):
  423. return self.color_simple
  424. class GenericRotationSocket(MantisSocket):
  425. '''Custom node socket type'''
  426. bl_idname = 'GenericRotationSocket'
  427. bl_label = "Rotation"
  428. color = (0.0,0.0,0.0,0.0)
  429. input : bpy.props.BoolProperty(default =False,)
  430. def draw(self, context, layout, node, text):
  431. ChooseDraw(self, context, layout, node, text)
  432. def draw_color(self, context, node):
  433. return self.color
  434. @classmethod
  435. def draw_color_simple(self):
  436. return self.color_simple
  437. ###############################
  438. class EnableSocket(MantisSocket):
  439. '''Custom node socket type'''
  440. bl_idname = 'EnableSocket'
  441. bl_label = "Enable"
  442. default_value: bpy.props.BoolProperty(default=True, update = update_mute_socket,)
  443. color_simple = cEnable
  444. color : bpy.props.FloatVectorProperty(default=cEnable, size=4)
  445. input : bpy.props.BoolProperty(default =False,)
  446. def draw(self, context, layout, node, text):
  447. ChooseDraw(self, context, layout, node, text, nice_bool=False)
  448. def draw_color(self, context, node):
  449. return self.color
  450. @classmethod
  451. def draw_color_simple(self):
  452. return self.color_simple
  453. class HideSocket(MantisSocket):
  454. '''Custom node socket type'''
  455. bl_idname = 'HideSocket'
  456. bl_label = "Hide"
  457. default_value: bpy.props.BoolProperty(default=False, update = update_hide_socket,)
  458. color_simple = cEnable
  459. color : bpy.props.FloatVectorProperty(default=cEnable, size=4)
  460. input : bpy.props.BoolProperty(default =False,)
  461. def draw(self, context, layout, node, text):
  462. ChooseDraw(self, context, layout, node, text, nice_bool=False)
  463. def draw_color(self, context, node):
  464. return self.color
  465. @classmethod
  466. def draw_color_simple(self):
  467. return self.color_simple
  468. class FCurveSocket(MantisSocket):
  469. '''fCurve'''
  470. bl_idname = 'FCurveSocket'
  471. bl_label = "fCurve"
  472. color_simple = cFCurve
  473. color : bpy.props.FloatVectorProperty(default=cFCurve, size=4)
  474. input : bpy.props.BoolProperty(default =False, update = update_socket)
  475. is_valid_interface_type=True
  476. def init(self):
  477. self.display_shape = 'CIRCLE_DOT'
  478. def draw(self, context, layout, node, text):
  479. ChooseDraw(self, context, layout, node, text)
  480. def draw_color(self, context, node):
  481. return self.color
  482. @classmethod
  483. def draw_color_simple(self):
  484. return self.color_simple
  485. class DriverSocket(MantisSocket):
  486. '''Driver'''
  487. bl_idname = 'DriverSocket'
  488. bl_label = "Driver"
  489. color_simple = cDriver
  490. color : bpy.props.FloatVectorProperty(default=cDriver, size=4)
  491. input : bpy.props.BoolProperty(default =False, update = update_socket)
  492. is_valid_interface_type=True
  493. def init(self):
  494. self.display_shape = 'CIRCLE_DOT'
  495. def draw(self, context, layout, node, text):
  496. ChooseDraw(self, context, layout, node, text)
  497. def draw_color(self, context, node):
  498. return self.color
  499. @classmethod
  500. def draw_color_simple(self):
  501. return self.color_simple
  502. class DriverVariableSocket(MantisSocket):
  503. '''Driver'''
  504. bl_idname = 'DriverVariableSocket'
  505. bl_label = "Driver Variable"
  506. color_simple = cDriverVariable
  507. color : bpy.props.FloatVectorProperty(default=cDriverVariable, size=4)
  508. input : bpy.props.BoolProperty(default =False, update = update_socket)
  509. is_valid_interface_type=True
  510. def init(self):
  511. self.display_shape = 'CIRCLE_DOT'
  512. def draw(self, context, layout, node, text):
  513. ChooseDraw(self, context, layout, node, text)
  514. def draw_color(self, context, node):
  515. return self.color
  516. @classmethod
  517. def draw_color_simple(self):
  518. return self.color_simple
  519. # transform_spaces
  520. # transform_spaces_bone_object
  521. # transform_spaces_object
  522. # def get_transform_space_enum(self, context):
  523. # pass
  524. def get_transform_space(self, context):
  525. if "Owner" in self.name:
  526. return transform_spaces_bone_from
  527. else:
  528. return transform_spaces_bone_to
  529. class TransformSpaceSocket(MantisSocket):
  530. '''Custom node socket type'''
  531. bl_idname = 'TransformSpaceSocket'
  532. bl_label = "Transform Space"
  533. default_value: bpy.props.EnumProperty(
  534. name="Space Transform",
  535. description="Space Transform",
  536. items=get_transform_space,
  537. default=0,
  538. update = update_socket,)
  539. color_simple = cTransformSpace
  540. color : bpy.props.FloatVectorProperty(default=cTransformSpace, size=4)
  541. input : bpy.props.BoolProperty(default =False,)
  542. def draw(self, context, layout, node, text):
  543. ChooseDraw(self, context, layout, node, text)
  544. def draw_color(self, context, node):
  545. return self.color
  546. @classmethod
  547. def draw_color_simple(self):
  548. return self.color_simple
  549. class BooleanSocket(MantisSocket):
  550. '''Custom node socket type'''
  551. bl_idname = 'BooleanSocket'
  552. bl_label = "Boolean"
  553. default_value: bpy.props.BoolProperty(update = update_socket,)
  554. color_simple = cBool
  555. color : bpy.props.FloatVectorProperty(default=cBool, size=4)
  556. input : bpy.props.BoolProperty(default =False,)
  557. is_valid_interface_type=True
  558. def draw(self, context, layout, node, text):
  559. ChooseDraw(self, context, layout, node, text)
  560. def draw_color(self, context, node):
  561. return self.color
  562. @classmethod
  563. def draw_color_simple(self):
  564. return self.color_simple
  565. class BooleanThreeTupleSocket(MantisSocket):
  566. # Description string
  567. '''Custom node socket type'''
  568. # Optional identifier string. If not explicitly defined, the python class name is used.
  569. bl_idname = 'BooleanThreeTupleSocket'
  570. bl_label = "Boolean Vector"
  571. default_value: bpy.props.BoolVectorProperty(subtype = "XYZ",update = update_socket,)
  572. color_simple = cBool3
  573. color : bpy.props.FloatVectorProperty(default=cBool3, size=4)
  574. input : bpy.props.BoolProperty(default =False,)
  575. is_valid_interface_type=True
  576. def draw(self, context, layout, node, text):
  577. ChooseDraw(self, context, layout, node, text)
  578. def draw_color(self, context, node):
  579. return self.color
  580. @classmethod
  581. def draw_color_simple(self):
  582. return self.color_simple
  583. def TellValue(self):
  584. return (self.default_value[0], self.default_value[1], self.default_value[2])
  585. class RotationOrderSocket(MantisSocket):
  586. '''Custom node socket type'''
  587. bl_idname = 'RotationOrderSocket'
  588. bl_label = "Rotation Order"
  589. default_value: bpy.props.EnumProperty(
  590. name="Rotation Order",
  591. description="Rotation Order",
  592. items=enumRotationOrder,
  593. default='AUTO',
  594. update = update_socket,)
  595. color_simple = cRotationOrder
  596. color : bpy.props.FloatVectorProperty(default=cRotationOrder, size=4)
  597. input : bpy.props.BoolProperty(default =False,)
  598. def draw(self, context, layout, node, text):
  599. ChooseDraw(self, context, layout, node, text)
  600. def draw_color(self, context, node):
  601. return self.color
  602. @classmethod
  603. def draw_color_simple(self):
  604. return self.color_simple
  605. class QuaternionSocket(MantisSocket):
  606. '''Custom node socket type'''
  607. bl_idname = 'QuaternionSocket'
  608. bl_label = "Quaternion"
  609. default_value: bpy.props.FloatVectorProperty(
  610. subtype = "QUATERNION",
  611. size = 4,
  612. default = (1.0, 0.0, 0.0, 0.0,),
  613. update = update_socket,)
  614. color_simple = cQuaternion
  615. color : bpy.props.FloatVectorProperty(default=cQuaternion, size=4)
  616. input : bpy.props.BoolProperty(default =False,)
  617. def draw(self, context, layout, node, text):
  618. ChooseDraw(self, context, layout, node, text)
  619. def draw_color(self, context, node):
  620. return self.color
  621. @classmethod
  622. def draw_color_simple(self):
  623. return self.color_simple
  624. class QuaternionSocketAA(MantisSocket):
  625. '''Custom node socket type'''
  626. bl_idname = 'QuaternionSocketAA'
  627. bl_label = "Axis Angle Quaternion"
  628. color_simple = cQuaternion
  629. color : bpy.props.FloatVectorProperty(default=cQuaternion, size=4)
  630. input : bpy.props.BoolProperty(default =False,)
  631. default_value: bpy.props.FloatVectorProperty(
  632. subtype = "AXISANGLE",
  633. size = 4,
  634. default = (1.0, 0.0, 0.0, 0.0,),
  635. update = update_socket,)
  636. def draw(self, context, layout, node, text):
  637. ChooseDraw(self, context, layout, node, text)
  638. def draw_color(self, context, node):
  639. return self.color
  640. @classmethod
  641. def draw_color_simple(self):
  642. return self.color_simple
  643. class IntSocket(MantisSocket):
  644. '''Custom node socket type'''
  645. bl_idname = 'IntSocket'
  646. bl_label = "Integer"
  647. default_value: bpy.props.IntProperty(default=0, update = update_socket,)
  648. color_simple = cInt
  649. color : bpy.props.FloatVectorProperty(default=cInt, size=4)
  650. input : bpy.props.BoolProperty(default =False,)
  651. is_valid_interface_type=True
  652. def draw(self, context, layout, node, text):
  653. ChooseDraw(self, context, layout, node, text)
  654. def draw_color(self, context, node):
  655. return self.color
  656. @classmethod
  657. def draw_color_simple(self):
  658. return self.color_simple
  659. class StringSocket(bpy.types.NodeSocketString, MantisSocket):
  660. """Float Input socket"""
  661. bl_idname = 'StringSocket'
  662. bl_label = "String"
  663. default_value : bpy.props.StringProperty(default = "", update = update_socket,)
  664. color_simple = cString
  665. color : bpy.props.FloatVectorProperty(default=cString, size=4)
  666. icon : bpy.props.StringProperty(default = "NONE",)
  667. input : bpy.props.BoolProperty(default =False,)
  668. display_text : bpy.props.StringProperty(default="")
  669. is_valid_interface_type=True
  670. # def init(self):
  671. # if self.node.bl_idname == 'UtilityBoneProperties':
  672. # self.display_shape='CIRCLE_DOT'
  673. def draw(self, context, layout, node, text):
  674. ChooseDraw(self, context, layout, node, text, icon=self.icon, icon_only=True,)
  675. def draw_color(self, context, node):
  676. return self.color
  677. @classmethod
  678. def draw_color_simple(self):
  679. return self.color_simple
  680. class BoneCollectionSocket(MantisSocket):
  681. """Bone Collection socket"""
  682. bl_idname = 'BoneCollectionSocket'
  683. bl_label = "Bone Collection"
  684. default_value: bpy.props.StringProperty(default = "Collection", update = update_socket,)
  685. input : bpy.props.BoolProperty(default =False,)
  686. color_simple = cBoneCollection
  687. color : bpy.props.FloatVectorProperty(default=cBoneCollection, size=4)
  688. def draw(self, context, layout, node, text):
  689. ChooseDraw(self, context, layout, node, text)
  690. def draw_color(self, context, node):
  691. return self.color
  692. @classmethod
  693. def draw_color_simple(self):
  694. return self.color_simple
  695. eArrayGetOptions =(
  696. ('CAP', "Cap", "Fail if the index is out of bounds."),
  697. ('WRAP', "Wrap", "Wrap around to the beginning of the array once the idex goes out of bounds."),
  698. ('HOLD', "Hold", "Reuse the last element of the array if the index is out of bounds."),)
  699. class EnumArrayGetOptions(MantisSocket):
  700. '''Custom node socket type'''
  701. bl_idname = 'EnumArrayGetOptions'
  702. bl_label = "OoB Behaviour"
  703. default_value: bpy.props.EnumProperty(
  704. items=eArrayGetOptions,
  705. name="OoB Behaviour",
  706. description="Out-of-bounds behaviour.",
  707. default = 'HOLD',
  708. update = update_socket,)
  709. color_simple = cString
  710. color : bpy.props.FloatVectorProperty(default=cString, size=4)
  711. input : bpy.props.BoolProperty(default =False,)
  712. def draw(self, context, layout, node, text):
  713. ChooseDraw(self, context, layout, node, text)
  714. def draw_color(self, context, node):
  715. return self.color
  716. @classmethod
  717. def draw_color_simple(self):
  718. return self.color_simple
  719. #####################################################################################
  720. # Parameters
  721. #####################################################################################
  722. class xFormParameterSocket(MantisSocket):
  723. '''xFrom Parameter'''
  724. bl_idname = 'xFormParameterSocket'
  725. bl_label = "sForm Parameter"
  726. color_simple = cxForm
  727. color : bpy.props.FloatVectorProperty(default=cxForm, size=4)
  728. input : bpy.props.BoolProperty(default =False,)
  729. def init(self):
  730. self.display_shape = 'CIRCLE_DOT'
  731. def draw(self, context, layout, node, text):
  732. ChooseDraw(self, context, layout, node, text)
  733. def draw_color(self, context, node):
  734. return self.color
  735. @classmethod
  736. def draw_color_simple(self):
  737. return self.color_simple
  738. # what is this one again?
  739. class ParameterBoolSocket(MantisSocket):
  740. """Boolean Parameter Socket"""
  741. bl_idname = 'ParameterBoolSocket'
  742. bl_label = "Boolean Parameter"
  743. color_simple = cBool
  744. color : bpy.props.FloatVectorProperty(default=cBool, size=4)
  745. input : bpy.props.BoolProperty(default =False,)
  746. #custom properties:
  747. min:bpy.props.FloatProperty(default = 0)
  748. max:bpy.props.FloatProperty(default = 1)
  749. soft_min:bpy.props.FloatProperty(default = 0)
  750. soft_max:bpy.props.FloatProperty(default = 1)
  751. description:bpy.props.StringProperty(default = "")
  752. default_value : bpy.props.BoolProperty(default = False, update = update_socket,)
  753. def init(self):
  754. self.display_shape = 'CIRCLE_DOT'
  755. # if True:
  756. # print (self.is_property_set("default_value"))
  757. # ui_data = self.id_properties_ui("default_value")
  758. # ui_data.update(
  759. # description=self.description,
  760. # default=0,) # for now
  761. # ui_data.update(
  762. # min = self.min,
  763. # max = self.max,
  764. # soft_min = self.soft_min,
  765. # soft_max = self.soft_max,)
  766. def draw(self, context, layout, node, text):
  767. ChooseDraw(self, context, layout, node, text)
  768. def draw_color(self, context, node):
  769. return self.color
  770. @classmethod
  771. def draw_color_simple(self):
  772. return self.color_simple
  773. class ParameterIntSocket(MantisSocket):
  774. """Integer Parameter socket"""
  775. bl_idname = 'ParameterIntSocket'
  776. bl_label = "Integer Parameter"
  777. default_value : bpy.props.IntProperty(default = 0, update = update_socket,)
  778. color_simple = cInt
  779. color : bpy.props.FloatVectorProperty(default=cInt, size=4)
  780. input : bpy.props.BoolProperty(default =False,)
  781. #custom properties:
  782. min:bpy.props.FloatProperty(default = 0)
  783. max:bpy.props.FloatProperty(default = 1)
  784. soft_min:bpy.props.FloatProperty(default = 0)
  785. soft_max:bpy.props.FloatProperty(default = 1)
  786. description:bpy.props.StringProperty(default = "")
  787. def init(self):
  788. self.display_shape = 'CIRCLE_DOT'
  789. def draw(self, context, layout, node, text):
  790. ChooseDraw(self, context, layout, node, text)
  791. def draw_color(self, context, node):
  792. return self.color
  793. @classmethod
  794. def draw_color_simple(self):
  795. return self.color_simple
  796. class ParameterFloatSocket(MantisSocket):
  797. """Float Parameter socket"""
  798. bl_idname = 'ParameterFloatSocket'
  799. bl_label = "Float Parameter"
  800. default_value : bpy.props.FloatProperty(default = 0.0, update = update_socket,)
  801. color_simple = cFloat
  802. color : bpy.props.FloatVectorProperty(default=cFloat, size=4)
  803. input : bpy.props.BoolProperty(default =False,)
  804. #custom properties:
  805. min:bpy.props.FloatProperty(default = 0)
  806. max:bpy.props.FloatProperty(default = 1)
  807. soft_min:bpy.props.FloatProperty(default = 0)
  808. soft_max:bpy.props.FloatProperty(default = 1)
  809. description:bpy.props.StringProperty(default = "")
  810. def init(self):
  811. self.display_shape = 'CIRCLE_DOT'
  812. def draw(self, context, layout, node, text):
  813. ChooseDraw(self, context, layout, node, text)
  814. def draw_color(self, context, node):
  815. return self.color
  816. @classmethod
  817. def draw_color_simple(self):
  818. return self.color_simple
  819. class ParameterVectorSocket(MantisSocket):
  820. """Vector Parameter socket"""
  821. bl_idname = 'ParameterVectorSocket'
  822. bl_label = "Vector Parameter"
  823. default_value : bpy.props.FloatVectorProperty(
  824. default = (0.0, 0.0, 0.0),
  825. update = update_socket,)
  826. color_simple = cVector
  827. color : bpy.props.FloatVectorProperty(default=cVector, size=4)
  828. input : bpy.props.BoolProperty(default =False,)
  829. #custom properties:
  830. description:bpy.props.StringProperty(default = "")
  831. def init(self):
  832. self.display_shape = 'CIRCLE_DOT'
  833. def draw(self, context, layout, node, text):
  834. ChooseDraw(self, context, layout, node, text)
  835. def draw_color(self, context, node):
  836. return self.color
  837. @classmethod
  838. def draw_color_simple(self):
  839. return self.color_simple
  840. class ParameterStringSocket(MantisSocket):
  841. """String Parameter socket"""
  842. bl_idname = 'ParameterStringSocket'
  843. bl_label = "String Parameter"
  844. default_value : bpy.props.StringProperty(default = "", update = update_socket,)
  845. color_simple = cString
  846. color : bpy.props.FloatVectorProperty(default=cString, size=4)
  847. input : bpy.props.BoolProperty(default =False,)
  848. #custom properties:
  849. description:bpy.props.StringProperty(default = "")
  850. def init(self):
  851. self.display_shape = 'CIRCLE_DOT'
  852. def draw(self, context, layout, node, text):
  853. ChooseDraw(self, context, layout, node, text)
  854. def draw_color(self, context, node):
  855. return self.color
  856. @classmethod
  857. def draw_color_simple(self):
  858. return self.color_simple
  859. #####################################################################################
  860. # Additional socket types, for special cases
  861. #####################################################################################
  862. from bpy.props import PointerProperty, StringProperty
  863. def poll_is_armature(self, obj):
  864. return obj.type == "ARMATURE"
  865. # def poll_is_armature(self, obj):
  866. # return obj.type == "ARMATURE"
  867. class EnumMetaRigSocket(MantisSocket):
  868. '''Custom node socket type'''
  869. bl_idname = 'EnumMetaRigSocket'
  870. bl_label = "Meta Rig"
  871. search_prop:PointerProperty(type=bpy.types.Object, poll=poll_is_armature, update=update_metarig_armature)
  872. def get_default_value(self):
  873. if self.search_prop:
  874. return self.search_prop.name
  875. return ""
  876. def set_default_value(self, value):
  877. if ob:= bpy.data.objects.get(value):
  878. if ob.type == 'ARMATURE':
  879. self.search_prop=ob
  880. default_value : StringProperty(name = "", get=get_default_value, set=set_default_value)
  881. color_simple = cString
  882. color : bpy.props.FloatVectorProperty(default=cString, size=4)
  883. def draw(self, context, layout, node, text):
  884. if self.is_output:
  885. layout.label(text=self.name)
  886. elif not (self.is_linked):
  887. layout.prop_search(data=self, property="search_prop", search_data=bpy.data, search_property="objects", text="", icon="OUTLINER_OB_ARMATURE", results_are_suggestions=True)
  888. elif hasattr(self.node, "armature"):
  889. layout.label(text=self.node.armature)
  890. # TODO: we should actually use the parsed tree to query this info directly, since this socket may belong to a node group in/out
  891. # which doesn't have this parameter. whatever.
  892. else:
  893. layout.label(text=self.name)
  894. def draw_color(self, context, node):
  895. return self.color
  896. @classmethod
  897. def draw_color_simple(self):
  898. return self.color_simple
  899. def poll_is_curve(self, obj):
  900. return obj.type == "CURVE"
  901. class EnumCurveSocket(MantisSocket):
  902. '''Choose a curve'''
  903. bl_idname = 'EnumCurveSocket'
  904. bl_label = "Curve"
  905. is_valid_interface_type=True
  906. search_prop:PointerProperty(type=bpy.types.Object, poll=poll_is_curve, update=update_socket)
  907. def get_default_value(self):
  908. if self.search_prop:
  909. return self.search_prop.name
  910. return ""
  911. def set_default_value(self, value):
  912. if ob:= bpy.data.objects.get(value):
  913. if ob.type == 'CURVE':
  914. self.search_prop=ob
  915. default_value : StringProperty(name = "", get=get_default_value, set=set_default_value)
  916. color_simple = cString
  917. color : bpy.props.FloatVectorProperty(default=cString, size=4)
  918. def draw(self, context, layout, node, text):
  919. if not (self.is_linked):
  920. layout.prop_search(data=self, property="search_prop", search_data=bpy.data, search_property="objects", text="", icon="CURVE_DATA", results_are_suggestions=True)
  921. else:
  922. try:
  923. layout.label(text=self.search_prop.name)
  924. except AttributeError: # TODO make this show the graph's result
  925. layout.label(text=self.name)
  926. def draw_color(self, context, node):
  927. return self.color
  928. @classmethod
  929. def draw_color_simple(self):
  930. return self.color_simple
  931. def SearchPBDraw(self, context, layout, node, text, icon = "NONE", use_enum=True, nice_bool=True, icon_only=False):
  932. layout.prop_search(data=self, property="default_value", search_data=self.search_prop.data, search_property="bones", text=text, icon=icon, results_are_suggestions=True)
  933. class EnumMetaBoneSocket(MantisSocket):
  934. '''Custom node socket type'''
  935. bl_idname = 'EnumMetaBoneSocket'
  936. bl_label = "Meta Bone"
  937. search_prop:PointerProperty(type=bpy.types.Object)
  938. bone:StringProperty()
  939. def populate_bones_list(self, context):
  940. # just gonna hardcode the value
  941. if (meta_rig := self.search_prop):
  942. retList = []
  943. armatures = []
  944. i = -1
  945. retList.append( ('NONE', '', '', 'NONE', i:=i+1 ) )
  946. for b in meta_rig.data.bones:
  947. retList.append( (b.name, b.name, "Bone to copy matrix from", "BONE_DATA", i:=i+1 ) )
  948. return(retList)
  949. return None
  950. # default_value : bpy.props.EnumProperty(
  951. # items = populate_bones_list,
  952. # name = "Meta Rig")
  953. # def get_default_value(self):
  954. # return self.search_prop.name
  955. default_value : StringProperty(name = "", update=update_metarig_posebone)
  956. color_simple = cString
  957. color : bpy.props.FloatVectorProperty(default=cString, size=4)
  958. def draw(self, context, layout, node, text):
  959. if not (self.is_linked):
  960. if self.search_prop is None:
  961. layout.prop(self, "default_value", text="", icon="BONE_DATA",)
  962. else:
  963. SearchPBDraw(self, context, layout, node, text="")
  964. else:
  965. layout.label(text=self.node.pose_bone)
  966. def draw_color(self, context, node):
  967. return self.color
  968. @classmethod
  969. def draw_color_simple(self):
  970. return self.color_simple
  971. class BoolUpdateParentNode(MantisSocket):
  972. '''Custom node socket type'''
  973. bl_idname = 'BoolUpdateParentNode'
  974. bl_label = "Boolean"
  975. default_value: bpy.props.BoolProperty(default=False, update = update_parent_node)
  976. color_simple = cBool
  977. color : bpy.props.FloatVectorProperty(default=cBool, size=4)
  978. input : bpy.props.BoolProperty(default =False,)
  979. def draw(self, context, layout, node, text):
  980. ChooseDraw(self, context, layout, node, text)
  981. def draw_color(self, context, node):
  982. return self.color
  983. @classmethod
  984. def draw_color_simple(self):
  985. return self.color_simple
  986. class IKChainLengthSocket(MantisSocket):
  987. '''Custom node socket type'''
  988. bl_idname = 'IKChainLengthSocket'
  989. bl_label = "IK Chain Length"
  990. default_value: bpy.props.IntProperty(default=0, update = ik_chain_length_update_socket, min = 0, max = 255)
  991. color_simple = cInt
  992. color : bpy.props.FloatVectorProperty(default=cInt, size=4)
  993. input : bpy.props.BoolProperty(default =False,)
  994. def draw(self, context, layout, node, text):
  995. ChooseDraw(self, context, layout, node, text)
  996. def draw_color(self, context, node):
  997. return self.color
  998. @classmethod
  999. def draw_color_simple(self):
  1000. return self.color_simple
  1001. # Inherit
  1002. eInheritScale = (
  1003. ('FULL', "Full", "Fully inherit scale", 1),
  1004. ('AVERAGE', "Average", "todo", 2),
  1005. ('ALIGNED', "Aligned", "todo", 3),
  1006. ('FIX_SHEAR', "Fix Shear", "todo", 4),
  1007. ('NONE', "None", "todo", 5),
  1008. )
  1009. class EnumInheritScale(MantisSocket):
  1010. '''Custom node socket type'''
  1011. bl_idname = 'EnumInheritScale'
  1012. bl_label = "Inherit Scale"
  1013. default_value: bpy.props.EnumProperty(
  1014. items=eInheritScale,
  1015. name="Inherit Scale",
  1016. description="Inherit Scale",
  1017. default = 'FULL',
  1018. #options = set(),
  1019. update = update_socket,)
  1020. color_simple = cString
  1021. color : bpy.props.FloatVectorProperty(default=cString, size=4)
  1022. input : bpy.props.BoolProperty(default =False,)
  1023. def draw(self, context, layout, node, text):
  1024. ChooseDraw(self, context, layout, node, text)
  1025. def draw_color(self, context, node):
  1026. return self.color
  1027. @classmethod
  1028. def draw_color_simple(self):
  1029. return self.color_simple
  1030. # Copy Rotation
  1031. eRotationMix =(
  1032. ('REPLACE', "Replace", "Fully inherit scale", 0),
  1033. ('BEFORE', "Before", "Fully inherit scale", 1),
  1034. ('AFTER', "After", "Fully inherit scale", 2),
  1035. ('ADD', "Add", "Fully inherit scale", 3),
  1036. #todo, but i don't care much
  1037. )
  1038. # TODO HACK
  1039. # I am trying to figure out how to do enum_flag as
  1040. # mutually exclusive options
  1041. # but! I don't think it's possible
  1042. # I just like the UI for it :P
  1043. class EnumRotationMix(MantisSocket):
  1044. '''Custom node socket type'''
  1045. bl_idname = 'EnumRotationMix'
  1046. bl_label = "Rotation Mix"
  1047. default_value: bpy.props.EnumProperty(
  1048. items=eRotationMix,
  1049. name="Rotation Mix",
  1050. description="Rotation Mix",
  1051. default = 'REPLACE',#{'REPLACE'},
  1052. options = set(), # this has to be a set lol
  1053. update = update_socket,)
  1054. color_simple = cString
  1055. color : bpy.props.FloatVectorProperty(default=cString, size=4)
  1056. input : bpy.props.BoolProperty(default =False,)
  1057. def draw(self, context, layout, node, text):
  1058. ChooseDraw(self, context, layout, node, text)
  1059. def draw_color(self, context, node):
  1060. return self.color
  1061. @classmethod
  1062. def draw_color_simple(self):
  1063. return self.color_simple
  1064. eRotationMix_copytransforms =(
  1065. ('REPLACE', "Replace (Aligned)", "Fully inherit scale"),
  1066. ('BEFORE', "Before (Aligned)", "Fully inherit scale"),
  1067. ('AFTER', "After (Aligned)", "Fully inherit scale"),
  1068. ('REPLACE_SPLIT', "Replace (Split Channels)", "Fully inherit scale"),
  1069. ('BEFORE_SPLIT', "Before (Split Channels)", "Fully inherit scale"),
  1070. ('AFTER_SPLIT', "After (Split Channels)", "Fully inherit scale"),
  1071. ('REPLACE_FULL', "Replace (Full)", "Fully inherit scale"),
  1072. ('BEFORE_FULL', "Before (Full)", "Fully inherit scale"),
  1073. ('AFTER_FULL', "After (Full)", "Fully inherit scale"),)
  1074. class EnumRotationMixCopyTransforms(MantisSocket):
  1075. '''Custom node socket type'''
  1076. bl_idname = 'EnumRotationMixCopyTransforms'
  1077. bl_label = "Rotation Mix"
  1078. default_value: bpy.props.EnumProperty(
  1079. items=eRotationMix_copytransforms,
  1080. name="Rotation Mix",
  1081. description="Rotation Mix",
  1082. default = 'REPLACE', #{'REPLACE'},
  1083. #options = {'ENUM_FLAG'}, # this sux
  1084. update = update_socket,)
  1085. color_simple = cString
  1086. color : bpy.props.FloatVectorProperty(default=cString, size=4)
  1087. input : bpy.props.BoolProperty(default =False,)
  1088. def draw(self, context, layout, node, text):
  1089. ChooseDraw(self, context, layout, node, text)
  1090. def draw_color(self, context, node):
  1091. return self.color
  1092. @classmethod
  1093. def draw_color_simple(self):
  1094. return self.color_simple
  1095. # STRETCH TO
  1096. eMaintainVolumeStretchTo = (('VOLUME_XZX', "XZ", "XZ", 1),
  1097. ('VOLUME_X', "X", "X", 2),
  1098. ('VOLUME_Z', "Z", "Z", 4),
  1099. ('NO_VOLUME', "None", "None", 8),)
  1100. class EnumMaintainVolumeStretchTo(MantisSocket):
  1101. '''Custom node socket type'''
  1102. bl_idname = 'EnumMaintainVolumeStretchToSocket'
  1103. bl_label = "Maintain Volume"
  1104. default_value: bpy.props.EnumProperty(
  1105. items=eMaintainVolumeStretchTo,
  1106. name="Maintain Volume",
  1107. description="Maintain Volume",
  1108. default = 'VOLUME_XZX',
  1109. #options = {'ENUM_FLAG'},
  1110. update = update_socket,)
  1111. color_simple = cString
  1112. color : bpy.props.FloatVectorProperty(default=cString, size=4)
  1113. input : bpy.props.BoolProperty(default =False,)
  1114. def draw(self, context, layout, node, text):
  1115. ChooseDraw(self, context, layout, node, text)
  1116. def draw_color(self, context, node):
  1117. return self.color
  1118. @classmethod
  1119. def draw_color_simple(self):
  1120. return self.color_simple
  1121. eRotationStretchTo = (('PLANE_X', "XZ", "XZ", 1),
  1122. ('PLANE_Z', "ZX", "ZX", 2),
  1123. ('SWING_Y', "Swing", "Swing", 4),)
  1124. class EnumRotationStretchTo(MantisSocket):
  1125. '''Custom node socket type'''
  1126. bl_idname = 'EnumRotationStretchTo'
  1127. bl_label = "Rotation"
  1128. default_value: bpy.props.EnumProperty(
  1129. items=eRotationStretchTo,
  1130. name="Rotation",
  1131. description="Rotation",
  1132. default = 'PLANE_X',
  1133. #options = {'ENUM_FLAG'},
  1134. update = update_socket,)
  1135. color_simple = cString
  1136. color : bpy.props.FloatVectorProperty(default=cString, size=4)
  1137. input : bpy.props.BoolProperty(default =False,)
  1138. def draw(self, context, layout, node, text):
  1139. ChooseDraw(self, context, layout, node, text)
  1140. def draw_color(self, context, node):
  1141. return self.color
  1142. @classmethod
  1143. def draw_color_simple(self):
  1144. return self.color_simple
  1145. # Track-To
  1146. eTrackAxis = (('TRACK_X', "X", "X", 1),
  1147. ('TRACK_Y', "Y", "Y", 2),
  1148. ('TRACK_Z', "Z", "Z", 4),
  1149. ('TRACK_NEGATIVE_X', "-X", "-X", 8),
  1150. ('TRACK_NEGATIVE_Y', "-Y", "-Y", 16),
  1151. ('TRACK_NEGATIVE_Z', "-Z", "-Z", 32,))
  1152. eUpAxis = (('UP_X', "X", "X", 1),
  1153. ('UP_Y', "Y", "Y", 2),
  1154. ('UP_Z', "Z", "Z", 4),)
  1155. # ugly but I can't change it easily without messing up versioning
  1156. class EnumTrackAxis(MantisSocket):
  1157. '''Custom node socket type'''
  1158. bl_idname = 'EnumTrackAxis'
  1159. bl_label = "Track Axis"
  1160. default_value: bpy.props.EnumProperty(
  1161. items=eTrackAxis,
  1162. name="Track Axis",
  1163. description="Track Axis",
  1164. default = 'TRACK_X',
  1165. #options = {'ENUM_FLAG'},
  1166. update = update_socket,)
  1167. color_simple = cString
  1168. color : bpy.props.FloatVectorProperty(default=cString, size=4)
  1169. input : bpy.props.BoolProperty(default =False,)
  1170. def draw(self, context, layout, node, text):
  1171. ChooseDraw(self, context, layout, node, text)
  1172. def draw_color(self, context, node):
  1173. return self.color
  1174. @classmethod
  1175. def draw_color_simple(self):
  1176. return self.color_simple
  1177. class EnumUpAxis(MantisSocket):
  1178. '''Custom node socket type'''
  1179. bl_idname = 'EnumUpAxis'
  1180. bl_label = "Up Axis"
  1181. default_value: bpy.props.EnumProperty(
  1182. items=eUpAxis,
  1183. name="Up Axis",
  1184. description="Up Axis",
  1185. default = 'UP_X',
  1186. #options = {'ENUM_FLAG'},
  1187. update = update_socket,)
  1188. color_simple = cString
  1189. color : bpy.props.FloatVectorProperty(default=cString, size=4)
  1190. input : bpy.props.BoolProperty(default =False,)
  1191. def draw(self, context, layout, node, text):
  1192. ChooseDraw(self, context, layout, node, text)
  1193. def draw_color(self, context, node):
  1194. return self.color
  1195. @classmethod
  1196. def draw_color_simple(self):
  1197. return self.color_simple
  1198. # Locked Track
  1199. eLockAxis = (('LOCK_X', "X", "X", 1),
  1200. ('LOCK_Y', "Y", "Y", 2),
  1201. ('LOCK_Z', "Z", "Z", 4),)
  1202. class EnumLockAxis(MantisSocket):
  1203. '''Custom node socket type'''
  1204. bl_idname = 'EnumLockAxis'
  1205. bl_label = "Lock Axis"
  1206. default_value: bpy.props.EnumProperty(
  1207. items=eLockAxis,
  1208. name="Lock Axis",
  1209. description="Lock Axis",
  1210. default = 'LOCK_X',
  1211. #options = {'ENUM_FLAG'},
  1212. update = update_socket,)
  1213. color_simple = cString
  1214. color : bpy.props.FloatVectorProperty(default=cString, size=4)
  1215. input : bpy.props.BoolProperty(default =False,)
  1216. def draw(self, context, layout, node, text):
  1217. ChooseDraw(self, context, layout, node, text)
  1218. def draw_color(self, context, node):
  1219. return self.color
  1220. @classmethod
  1221. def draw_color_simple(self):
  1222. return self.color_simple
  1223. # Limit Distance:
  1224. eLimitMode = (('LIMITDIST_INSIDE', "Inside", "Inside",),
  1225. ('LIMITDIST_OUTSIDE', "Outside", "Outside",),
  1226. ('LIMITDIST_ONSURFACE', "On Surface", "On Surface",),)
  1227. class EnumLimitMode(MantisSocket):
  1228. '''Custom node socket type'''
  1229. bl_idname = 'EnumLimitMode'
  1230. bl_label = "Clamp Region"
  1231. default_value: bpy.props.EnumProperty(
  1232. items=eLimitMode,
  1233. name="Clamp Region",
  1234. description="Clamp Region",
  1235. default = 'LIMITDIST_INSIDE',
  1236. update = update_socket,)
  1237. color_simple = cString
  1238. color : bpy.props.FloatVectorProperty(default=cString, size=4)
  1239. input : bpy.props.BoolProperty(default =False,)
  1240. def draw(self, context, layout, node, text):
  1241. ChooseDraw(self, context, layout, node, text)
  1242. def draw_color(self, context, node):
  1243. return self.color
  1244. @classmethod
  1245. def draw_color_simple(self):
  1246. return self.color_simple
  1247. # Spline IK
  1248. eYScaleMode = (('NONE', "None", "Don’t scale the X and Z axes.",),
  1249. ('FIT_CURVE', "Fit Curve", "Scale the bones to fit the entire length of the curve.",),
  1250. ('BONE_ORIGINAL', "Bone Original", "Use the original scaling of the bones.",),)
  1251. eXZScaleMode = (('NONE', "None", "Don’t scale the X and Z axes.",),
  1252. ('BONE_ORIGINAL', "Bone Original", "Use the original scaling of the bones.",),
  1253. ('INVERSE_PRESERVE', "Inverse Scale", "Scale of the X and Z axes is the inverse of the Y-Scale.",),
  1254. ('VOLUME_PRESERVE', "Volume Preservation", "Scale of the X and Z axes are adjusted to preserve the volume of the bones.",),)
  1255. class EnumYScaleMode(MantisSocket):
  1256. '''Custom node socket type'''
  1257. bl_idname = 'EnumYScaleMode'
  1258. bl_label = "Y Scale Mode"
  1259. default_value: bpy.props.EnumProperty(
  1260. items=eYScaleMode,
  1261. name="Y Scale Mode",
  1262. description="Y Scale Mode",
  1263. default = 'FIT_CURVE',
  1264. update = update_socket,)
  1265. color_simple = cString
  1266. color : bpy.props.FloatVectorProperty(default=cString, size=4)
  1267. input : bpy.props.BoolProperty(default =False,)
  1268. def draw(self, context, layout, node, text):
  1269. ChooseDraw(self, context, layout, node, text)
  1270. def draw_color(self, context, node):
  1271. return self.color
  1272. @classmethod
  1273. def draw_color_simple(self):
  1274. return self.color_simple
  1275. class EnumXZScaleMode(MantisSocket):
  1276. '''Custom node socket type'''
  1277. bl_idname = 'EnumXZScaleMode'
  1278. bl_label = "XZ Scale Mode"
  1279. default_value: bpy.props.EnumProperty(
  1280. items=eXZScaleMode,
  1281. name="XZ Scale Mode",
  1282. description="XZ Scale Mode",
  1283. default = 'NONE',
  1284. update = update_socket,)
  1285. color_simple = cString
  1286. color : bpy.props.FloatVectorProperty(default=cString, size=4)
  1287. input : bpy.props.BoolProperty(default =False,)
  1288. def draw(self, context, layout, node, text):
  1289. ChooseDraw(self, context, layout, node, text)
  1290. def draw_color(self, context, node):
  1291. return self.color
  1292. @classmethod
  1293. def draw_color_simple(self):
  1294. return self.color_simple
  1295. eMapxForm = (('LOCATION', "Location", "Location",),
  1296. ('ROTATION', "Rotation", "Rotation",),
  1297. ('SCALE', "Scale", "Scale",),)
  1298. eRotationMode = (('AUTO', 'Auto', 'Automattically Selected.', 0),
  1299. ('XYZ', "XYZ", "Euler using the XYZ rotation order", 1),
  1300. ('XZY', "XZY", "Euler using the XZY rotation order", 2),
  1301. ('ZXY', "ZXY", "Euler using the ZXY rotation order", 3),
  1302. ('ZYX', "ZYX", "Euler using the ZYX rotation order", 4),
  1303. ('YXZ', "YXZ", "Euler using the YXZ rotation order", 5),
  1304. ('YZX', "YZX", "Euler using the YZX rotation order", 6),
  1305. ('QUATERNION', "Quaternion", "Quaternion", 7),
  1306. ('SWING_TWIST_X', 'Swing and X Twist.', 'Decompose into a swing rotation to aim the X axis, followed by twist around it.', 8),
  1307. ('SWING_TWIST_Y', 'Swing and Y Twist.', 'Decompose into a swing rotation to aim the Y axis, followed by twist around it.', 9),
  1308. ('SWING_TWIST_Z', 'Swing and Z Twist.', 'Decompose into a swing rotation to aim the Z axis, followed by twist around it.', 10),)
  1309. enumTransformationRotationOrder = enumRotationOrder[:6]
  1310. eTranslationMix =(
  1311. ('ADD', "Add", "", 0),
  1312. ('REPLACE', "Replace", "", 1),
  1313. )
  1314. eScaleMix =(
  1315. ('MULTIPLY', "Multiply", "", 0),
  1316. ('REPLACE', "Replace", "", 1),
  1317. )
  1318. class EnumTransformationMap(MantisSocket):
  1319. '''Custom node socket type'''
  1320. bl_idname = 'EnumTransformationMap'
  1321. bl_label = "Map To/From"
  1322. default_value: bpy.props.EnumProperty(
  1323. items=eMapxForm,
  1324. name="Map To/From",
  1325. description="Map To/From",
  1326. default = 'LOCATION',
  1327. update = update_socket,)
  1328. color_simple = cString
  1329. color : bpy.props.FloatVectorProperty(default=cString, size=4)
  1330. input : bpy.props.BoolProperty(default =False,)
  1331. def draw(self, context, layout, node, text):
  1332. ChooseDraw(self, context, layout, node, text)
  1333. def draw_color(self, context, node):
  1334. return self.color
  1335. @classmethod
  1336. def draw_color_simple(self):
  1337. return self.color_simple
  1338. class EnumTransformationRotationMode(MantisSocket):
  1339. '''Custom node socket type'''
  1340. bl_idname = 'EnumTransformationRotationMode'
  1341. bl_label = "Map To/From"
  1342. default_value: bpy.props.EnumProperty(
  1343. items=eRotationMode,
  1344. name="Rotation Mode",
  1345. description="Rotation Mode",
  1346. default = 'AUTO',
  1347. update = update_socket,)
  1348. color_simple = cString
  1349. color : bpy.props.FloatVectorProperty(default=cString, size=4)
  1350. input : bpy.props.BoolProperty(default =False,)
  1351. def draw(self, context, layout, node, text):
  1352. ChooseDraw(self, context, layout, node, text, use_enum=False)
  1353. def draw_color(self, context, node):
  1354. return self.color
  1355. @classmethod
  1356. def draw_color_simple(self):
  1357. return self.color_simple
  1358. class EnumTransformationRotationOrder(MantisSocket):
  1359. '''Custom node socket type'''
  1360. bl_idname = 'EnumTransformationRotationOrder'
  1361. bl_label = "Map To/From"
  1362. default_value: bpy.props.EnumProperty(
  1363. items=enumTransformationRotationOrder,
  1364. name="Rotation Order",
  1365. description="Rotation Order",
  1366. default = 'AUTO',
  1367. update = update_socket,)
  1368. color_simple = cString
  1369. color : bpy.props.FloatVectorProperty(default=cString, size=4)
  1370. input : bpy.props.BoolProperty(default =False,)
  1371. def draw(self, context, layout, node, text):
  1372. ChooseDraw(self, context, layout, node, text, use_enum=False)
  1373. def draw_color(self, context, node):
  1374. return self.color
  1375. @classmethod
  1376. def draw_color_simple(self):
  1377. return self.color_simple
  1378. class EnumTransformationTranslationMixMode(MantisSocket):
  1379. '''Custom node socket type'''
  1380. bl_idname = 'EnumTransformationTranslationMixMode'
  1381. bl_label = "Mix Mode"
  1382. default_value: bpy.props.EnumProperty(
  1383. items=eTranslationMix,
  1384. name="Mix Translation",
  1385. description="Mix Translation",
  1386. default = 'ADD',
  1387. update = update_socket,)
  1388. color_simple = cString
  1389. color : bpy.props.FloatVectorProperty(default=cString, size=4)
  1390. input : bpy.props.BoolProperty(default =False,)
  1391. def draw(self, context, layout, node, text):
  1392. ChooseDraw(self, context, layout, node, text, use_enum=False)
  1393. def draw_color(self, context, node):
  1394. return self.color
  1395. @classmethod
  1396. def draw_color_simple(self):
  1397. return self.color_simple
  1398. class EnumTransformationRotationMixMode(MantisSocket):
  1399. '''Custom node socket type'''
  1400. bl_idname = 'EnumTransformationRotationMixMode'
  1401. bl_label = "Mix Mode"
  1402. default_value: bpy.props.EnumProperty(
  1403. items=eRotationMix,
  1404. name="Mix Rotation",
  1405. description="Mix Rotation",
  1406. default = 'ADD',
  1407. update = update_socket,)
  1408. color_simple = cString
  1409. color : bpy.props.FloatVectorProperty(default=cString, size=4)
  1410. input : bpy.props.BoolProperty(default =False,)
  1411. def draw(self, context, layout, node, text):
  1412. ChooseDraw(self, context, layout, node, text, use_enum=False)
  1413. def draw_color(self, context, node):
  1414. return self.color
  1415. @classmethod
  1416. def draw_color_simple(self):
  1417. return self.color_simple
  1418. class EnumTransformationScaleMixMode(MantisSocket):
  1419. '''Custom node socket type'''
  1420. bl_idname = 'EnumTransformationScaleMixMode'
  1421. bl_label = "Mix Mode"
  1422. default_value: bpy.props.EnumProperty(
  1423. items=eScaleMix,
  1424. name="Mix Scale",
  1425. description="Mix Scale",
  1426. default = 'REPLACE',
  1427. update = update_socket,)
  1428. color_simple = cString
  1429. color : bpy.props.FloatVectorProperty(default=cString, size=4)
  1430. input : bpy.props.BoolProperty(default =False,)
  1431. def draw(self, context, layout, node, text):
  1432. ChooseDraw(self, context, layout, node, text, use_enum=False)
  1433. def draw_color(self, context, node):
  1434. return self.color
  1435. @classmethod
  1436. def draw_color_simple(self):
  1437. return self.color_simple
  1438. eAxes = (
  1439. ('X', "X", "X", 0),
  1440. ('Y', "Y", "Y", 1),
  1441. ('Z', "Z", "Z", 2),
  1442. )
  1443. class EnumTransformationAxes(MantisSocket):
  1444. '''Custom node socket type'''
  1445. bl_idname = 'EnumTransformationAxes'
  1446. bl_label = "Axes"
  1447. default_value: bpy.props.EnumProperty(
  1448. items=eAxes,
  1449. # name="",
  1450. # description="",
  1451. default = 'X',
  1452. update = update_socket,)
  1453. color_simple = cString
  1454. color : bpy.props.FloatVectorProperty(default=cString, size=4)
  1455. input : bpy.props.BoolProperty(default =False,)
  1456. def draw(self, context, layout, node, text):
  1457. ChooseDraw(self, context, layout, node, text, use_enum=False)
  1458. def draw_color(self, context, node):
  1459. return self.color
  1460. @classmethod
  1461. def draw_color_simple(self):
  1462. return self.color_simple
  1463. #
  1464. eBBoneHandleType = (
  1465. ('AUTO', "Automatic", "", 0),
  1466. ('ABSOLUTE', "Absolute", "", 1),
  1467. ('RELATIVE', "Relative", "", 2),
  1468. ('TANGENT', "Tangent", "", 3),
  1469. )
  1470. class EnumBBoneHandleType(MantisSocket):
  1471. '''Custom node socket type'''
  1472. bl_idname = 'EnumBBoneHandleType'
  1473. bl_label = "Axes"
  1474. default_value: bpy.props.EnumProperty(
  1475. items=eBBoneHandleType,
  1476. # name="",
  1477. # description="",
  1478. default = 'AUTO',
  1479. update = update_socket,)
  1480. color_simple = cString
  1481. color : bpy.props.FloatVectorProperty(default=cString, size=4)
  1482. input : bpy.props.BoolProperty(default =False,)
  1483. def draw(self, context, layout, node, text):
  1484. ChooseDraw(self, context, layout, node, text, use_enum=False)
  1485. def draw_color(self, context, node):
  1486. return self.color
  1487. @classmethod
  1488. def draw_color_simple(self):
  1489. return self.color_simple
  1490. eSkinningMethod = (('EXISTING_GROUPS', "Use Existing Groups", "Use the existing vertex groups, or create empty groups if not found.",),
  1491. ('AUTOMATIC_HEAT', "Automatic (Heat)", "Use Blender's heatmap automatic skinning",),
  1492. ('COPY_FROM_OBJECT', "Copy from object", "Copy skin weights from the selected object"),)
  1493. class EnumSkinning(MantisSocket):
  1494. '''Custom node socket type'''
  1495. bl_idname = 'EnumSkinning'
  1496. bl_label = "Skinning Method"
  1497. default_value: bpy.props.EnumProperty(
  1498. items=eSkinningMethod,
  1499. name="Skinning Method",
  1500. description="Skinning Method",
  1501. default = 'AUTOMATIC_HEAT',
  1502. update = update_socket,)
  1503. color_simple = cString
  1504. color : bpy.props.FloatVectorProperty(default=cString, size=4)
  1505. input : bpy.props.BoolProperty(default =False,)
  1506. def draw(self, context, layout, node, text):
  1507. ChooseDraw(self, context, layout, node, text)
  1508. def draw_color(self, context, node):
  1509. return self.color
  1510. @classmethod
  1511. def draw_color_simple(self):
  1512. return self.color_simple
  1513. class MorphTargetSocket(MantisSocket):
  1514. """Morph Target"""
  1515. bl_idname = 'MorphTargetSocket'
  1516. bl_label = "Morph Target"
  1517. color_simple = cShapeKey
  1518. color : bpy.props.FloatVectorProperty(default=cShapeKey, size=4)
  1519. input : bpy.props.BoolProperty(default =False,)
  1520. is_valid_interface_type=True
  1521. def draw(self, context, layout, node, text):
  1522. ChooseDraw(self, context, layout, node, text)
  1523. def draw_color(self, context, node):
  1524. return self.color
  1525. @classmethod
  1526. def draw_color_simple(self):
  1527. return self.color_simple
  1528. eDriverVariableType = (
  1529. ( 'SINGLE_PROP',
  1530. "Property",
  1531. "Property",
  1532. 1),
  1533. ( 'LOC_DIFF',
  1534. "Distance",
  1535. "Distance",
  1536. 2),
  1537. ( 'ROTATION_DIFF',
  1538. "Rotational Difference",
  1539. "Rotational Difference",
  1540. 3),
  1541. # ( 'TRANSFORMS',
  1542. # "Transform Channel",
  1543. # "Transform Channel",
  1544. # 4),
  1545. )
  1546. class EnumDriverVariableType(MantisSocket):
  1547. '''Custom node socket type'''
  1548. bl_idname = 'EnumDriverVariableType'
  1549. bl_label = "Variable Type"
  1550. default_value: bpy.props.EnumProperty(
  1551. items = eDriverVariableType,
  1552. name = "Variable Type",
  1553. description = "Variable Type",
  1554. default = 'SINGLE_PROP',
  1555. update = driver_variable_socket_update,)
  1556. color_simple = cString
  1557. color : bpy.props.FloatVectorProperty(default=cString, size=4)
  1558. input : bpy.props.BoolProperty(default =False,)
  1559. def draw(self, context, layout, node, text):
  1560. ChooseDraw(self, context, layout, node, text, use_enum=False)
  1561. def draw_color(self, context, node):
  1562. return self.color
  1563. @classmethod
  1564. def draw_color_simple(self):
  1565. return self.color_simple
  1566. eDriverVariableEvaluationSpace = (
  1567. ( 'WORLD_SPACE',
  1568. "World",
  1569. "World",
  1570. 1),
  1571. ( 'TRANSFORM_SPACE',
  1572. "Transform",
  1573. "Transform",
  1574. 2),
  1575. ( 'LOCAL_SPACE',
  1576. "Local",
  1577. "Local",
  1578. 3),
  1579. )
  1580. class EnumDriverVariableEvaluationSpace(MantisSocket):
  1581. '''Custom node socket type'''
  1582. bl_idname = 'EnumDriverVariableEvaluationSpace'
  1583. bl_label = "Evaluation Space"
  1584. default_value: bpy.props.EnumProperty(
  1585. items = eDriverVariableEvaluationSpace,
  1586. name = "Evaluation Space",
  1587. description = "Evaluation Space",
  1588. default = 'WORLD_SPACE',
  1589. update = driver_variable_socket_update,)
  1590. color_simple = cString
  1591. color : bpy.props.FloatVectorProperty(default=cString, size=4)
  1592. input : bpy.props.BoolProperty(default =False,)
  1593. def draw(self, context, layout, node, text):
  1594. ChooseDraw(self, context, layout, node, text, use_enum=False)
  1595. def draw_color(self, context, node):
  1596. return self.color
  1597. @classmethod
  1598. def draw_color_simple(self):
  1599. return self.color_simple
  1600. eDriverVariableTransformChannel = (
  1601. ("LOC_X", "X Location", "The X-coordinate of an object's location.", 1),
  1602. ("LOC_Y", "Y Location", "The Y-coordinate of an object's location.", 2),
  1603. ("LOC_Z", "Z Location", "The Z-coordinate of an object's location.", 3),
  1604. ("ROT_X", "X Rotation", "Rotation X-axis.", 4),
  1605. ("ROT_Y", "Y Rotation", "Rotation Y-axis.", 5),
  1606. ("ROT_Z", "Z Rotation", "Rotation Z-axis.", 6),
  1607. ("ROT_W", "W Rotation", "Rotation W-axis.", 7),
  1608. ("SCALE_X", "X Scale", "The X-scale of an object's scale.", 8),
  1609. ("SCALE_Y", "Y Scale", "The Y-scale of an object's scale.", 9),
  1610. ("SCALE_Z", "Z Scale", "The Z-scale of an object's scale.", 10),
  1611. ("SCALE_AVG", "Average Scale", "The scale factor of an object's scale.", 11),
  1612. )
  1613. class EnumDriverVariableTransformChannel(MantisSocket):
  1614. '''Custom node socket type'''
  1615. bl_idname = 'EnumDriverVariableTransformChannel'
  1616. bl_label = "Transform Channel"
  1617. default_value: bpy.props.EnumProperty(
  1618. items = eDriverVariableTransformChannel,
  1619. name = "Transform Channel",
  1620. description = "Transform Channel",
  1621. default = 'LOC_X',
  1622. update = driver_variable_socket_update,)
  1623. color_simple = cString
  1624. color : bpy.props.FloatVectorProperty(default=cString, size=4)
  1625. input : bpy.props.BoolProperty(default =False,)
  1626. def draw(self, context, layout, node, text):
  1627. ChooseDraw(self, context, layout, node, text, use_enum=False)
  1628. def draw_color(self, context, node):
  1629. return self.color
  1630. @classmethod
  1631. def draw_color_simple(self):
  1632. return self.color_simple
  1633. class EnumDriverRotationMode(MantisSocket):
  1634. '''Custom node socket type'''
  1635. bl_idname = 'EnumDriverRotationMode'
  1636. bl_label = "Rotaton Mode"
  1637. default_value: bpy.props.EnumProperty(
  1638. items = eRotationMode,
  1639. name = "Rotation Mode",
  1640. description = "Rotation Mode",
  1641. default = 'AUTO',
  1642. update = driver_variable_socket_update,)
  1643. color_simple = cString
  1644. color : bpy.props.FloatVectorProperty(default=cString, size=4)
  1645. input : bpy.props.BoolProperty(default =False,)
  1646. def draw(self, context, layout, node, text):
  1647. ChooseDraw(self, context, layout, node, text, use_enum=False)
  1648. def draw_color(self, context, node):
  1649. return self.color
  1650. @classmethod
  1651. def draw_color_simple(self):
  1652. return self.color_simple
  1653. #
  1654. eDriverType = (('AVERAGE', 'Average', 'Average', 0),
  1655. ('SUM', "Sum", "Sum", 1),
  1656. ('SCRIPTED', "Scripted", "Scripted Expression", 2),
  1657. ('MIN', "Min", "Minimum", 3),
  1658. ('MAX', "Max", "Maximum", 4),)
  1659. class EnumDriverType(MantisSocket):
  1660. '''Custom node socket type'''
  1661. bl_idname = 'EnumDriverType'
  1662. bl_label = "Driver Type"
  1663. default_value: bpy.props.EnumProperty(
  1664. items = eDriverType,
  1665. name = "Driver Type",
  1666. description = "Driver Type",
  1667. default = 'AVERAGE',
  1668. update = driver_socket_update,)
  1669. color_simple = cString
  1670. color : bpy.props.FloatVectorProperty(default=cString, size=4)
  1671. input : bpy.props.BoolProperty(default =False,)
  1672. def draw(self, context, layout, node, text):
  1673. ChooseDraw(self, context, layout, node, text, use_enum=False)
  1674. def draw_color(self, context, node):
  1675. return self.color
  1676. @classmethod
  1677. def draw_color_simple(self):
  1678. return self.color_simple
  1679. # Keyframe
  1680. # Enum for kf handle type
  1681. # enum for interpolation type
  1682. # eventually gonna make it to the fancy stuff
  1683. class FloatSocket(bpy.types.NodeSocketFloat, MantisSocket):
  1684. """Float Input socket"""
  1685. bl_idname = 'FloatSocket'
  1686. bl_label = "Float"
  1687. is_valid_interface_type=True
  1688. default_value : bpy.props.FloatProperty(default = 0.0, update = update_socket,)
  1689. color_simple = cFloat
  1690. color : bpy.props.FloatVectorProperty(default=cFloat, size=4)
  1691. input : bpy.props.BoolProperty(default =False,)
  1692. def draw(self, context, layout, node, text):
  1693. ChooseDraw(self, context, layout, node, text)
  1694. def draw_color(self, context, node):
  1695. return self.color
  1696. @classmethod
  1697. def draw_color_simple(self):
  1698. return self.color_simple
  1699. class FloatPositiveSocket(bpy.types.NodeSocketFloat, MantisSocket):
  1700. """Float Input socket"""
  1701. bl_idname = 'FloatPositiveSocket'
  1702. bl_label = "Float (Positive)"
  1703. is_valid_interface_type=True
  1704. default_value : bpy.props.FloatProperty(default = 0.0, min=0, update = update_socket,)
  1705. color_simple = cFloat
  1706. color : bpy.props.FloatVectorProperty(default=cFloat, size=4)
  1707. input : bpy.props.BoolProperty(default =False,)
  1708. def draw(self, context, layout, node, text):
  1709. ChooseDraw(self, context, layout, node, text)
  1710. def draw_color(self, context, node):
  1711. return self.color
  1712. @classmethod
  1713. def draw_color_simple(self):
  1714. return self.color_simple
  1715. class FloatFactorSocket(bpy.types.NodeSocketFloatFactor, MantisSocket):
  1716. '''xFrom Input Output'''
  1717. bl_idname = 'FloatFactorSocket'
  1718. bl_label = "Float (Factor)"
  1719. is_valid_interface_type=True
  1720. default_value : bpy.props.FloatProperty(
  1721. default = 0.0,
  1722. min = 0.0,
  1723. max=1.0,
  1724. update = update_socket,
  1725. subtype='FACTOR',)
  1726. color_simple = cFloat
  1727. color : bpy.props.FloatVectorProperty(default=cFloat, size=4)
  1728. input : bpy.props.BoolProperty(default =False,)
  1729. def draw(self, context, layout, node, text):
  1730. ChooseDraw(self, context, layout, node, text)
  1731. def draw_color(self, context, node):
  1732. return self.color
  1733. @classmethod
  1734. def draw_color_simple(self):
  1735. return self.color_simple
  1736. class FloatAngleSocket(bpy.types.NodeSocketFloatAngle, MantisSocket):
  1737. '''xFrom Input Output'''
  1738. bl_idname = 'FloatAngleSocket'
  1739. bl_label = "Float (Angle)"
  1740. is_valid_interface_type=True
  1741. default_value : bpy.props.FloatProperty(
  1742. default = 0.0,
  1743. min = -180,
  1744. max=180,
  1745. update = update_socket,
  1746. subtype='ANGLE',)
  1747. color_simple = cFloat
  1748. color : bpy.props.FloatVectorProperty(default=cFloat, size=4)
  1749. input : bpy.props.BoolProperty(default =False,)
  1750. def draw(self, context, layout, node, text):
  1751. ChooseDraw(self, context, layout, node, text)
  1752. def draw_color(self, context, node):
  1753. return self.color
  1754. @classmethod
  1755. def draw_color_simple(self):
  1756. return self.color_simple
  1757. class VectorSocket(bpy.types.NodeSocketVectorEuler, MantisSocket):
  1758. """Vector Input socket"""
  1759. bl_idname = 'VectorSocket'
  1760. bl_label = "Vector"
  1761. is_valid_interface_type=True
  1762. default_value : bpy.props.FloatVectorProperty(
  1763. default = (0.0, 0.0, 0.0),
  1764. update = update_socket,)
  1765. color_simple = cVector
  1766. color : bpy.props.FloatVectorProperty(default=cVector, size=4)
  1767. input : bpy.props.BoolProperty(default =False,)
  1768. def draw(self, context, layout, node, text):
  1769. ChooseDraw(self, context, layout, node, text)
  1770. def draw_color(self, context, node):
  1771. return self.color
  1772. @classmethod
  1773. def draw_color_simple(self):
  1774. return self.color_simple
  1775. class VectorEulerSocket(bpy.types.NodeSocketVectorEuler, MantisSocket):
  1776. """Vector Input socket"""
  1777. bl_idname = 'VectorEulerSocket'
  1778. bl_label = "Euler"
  1779. is_valid_interface_type=True
  1780. default_value : bpy.props.FloatVectorProperty(
  1781. default = (0.0, 0.0, 0.0),
  1782. update = update_socket,
  1783. subtype='EULER',)
  1784. color_simple = cVector
  1785. color : bpy.props.FloatVectorProperty(default=cVector, size=4)
  1786. input : bpy.props.BoolProperty(default =False,)
  1787. def draw(self, context, layout, node, text):
  1788. ChooseDraw(self, context, layout, node, text)
  1789. def draw_color(self, context, node):
  1790. return self.color
  1791. @classmethod
  1792. def draw_color_simple(self):
  1793. return self.color_simple
  1794. class VectorTranslationSocket(bpy.types.NodeSocketVectorTranslation, MantisSocket):
  1795. """Vector Input socket"""
  1796. bl_idname = 'VectorTranslationSocket'
  1797. bl_label = "Vector (Translation)"
  1798. default_value : bpy.props.FloatVectorProperty(
  1799. default = (0.0, 0.0, 0.0),
  1800. update = update_socket,
  1801. subtype='TRANSLATION',)
  1802. color_simple = cVector
  1803. color : bpy.props.FloatVectorProperty(default=cVector, size=4)
  1804. input : bpy.props.BoolProperty(default =False,)
  1805. def draw(self, context, layout, node, text):
  1806. ChooseDraw(self, context, layout, node, text)
  1807. def draw_color(self, context, node):
  1808. return self.color
  1809. @classmethod
  1810. def draw_color_simple(self):
  1811. return self.color_simple
  1812. class VectorScaleSocket(bpy.types.NodeSocketVectorXYZ, MantisSocket):
  1813. """Vector Input socket"""
  1814. bl_idname = 'VectorScaleSocket'
  1815. bl_label = "Vector (Scale)"
  1816. default_value : bpy.props.FloatVectorProperty(
  1817. default = (1.0, 1.0, 1.0),
  1818. update = update_socket,
  1819. subtype='XYZ',)
  1820. color_simple = cVector
  1821. color : bpy.props.FloatVectorProperty(default=cVector, size=4)
  1822. input : bpy.props.BoolProperty(default =False,)
  1823. def draw(self, context, layout, node, text):
  1824. ChooseDraw(self, context, layout, node, text)
  1825. def draw_color(self, context, node):
  1826. return self.color
  1827. @classmethod
  1828. def draw_color_simple(self):
  1829. return self.color_simple
  1830. class KeyframeSocket(MantisSocket):
  1831. '''Keyframe'''
  1832. bl_idname = 'KeyframeSocket'
  1833. bl_label = "Keyframe"
  1834. is_valid_interface_type=True
  1835. color_simple = cKeyframe
  1836. color : bpy.props.FloatVectorProperty(default=cKeyframe, size=4)
  1837. input : bpy.props.BoolProperty(default =False, update = update_socket)
  1838. def init(self):
  1839. self.display_shape = 'CIRCLE_DOT'
  1840. def draw(self, context, layout, node, text):
  1841. ChooseDraw(self, context, layout, node, text)
  1842. def draw_color(self, context, node):
  1843. return self.color
  1844. @classmethod
  1845. def draw_color_simple(self):
  1846. return self.color_simple
  1847. EnumKeyframeInterpolationType = (('CONSTANT', 'Stepped', 'Stepped'),
  1848. ('LINEAR', "Linear", "Linear"),
  1849. ('BEZIER', "Bezier", "Bezier"),)
  1850. class EnumKeyframeInterpolationTypeSocket(MantisSocket):
  1851. '''Keyframe Interpolation Type'''
  1852. bl_idname = 'EnumKeyframeInterpolationTypeSocket'
  1853. bl_label = "Keyframe Interpolation Type"
  1854. default_value :bpy.props.EnumProperty(
  1855. name="",
  1856. description="Interpolation",
  1857. items=EnumKeyframeInterpolationType,
  1858. default='LINEAR',
  1859. update = update_socket,)
  1860. color_simple = cString
  1861. color : bpy.props.FloatVectorProperty(default=cString, size=4)
  1862. input : bpy.props.BoolProperty(default =False, update = update_socket)
  1863. def draw(self, context, layout, node, text):
  1864. ChooseDraw(self, context, layout, node, text)
  1865. def draw_color(self, context, node):
  1866. return self.color
  1867. @classmethod
  1868. def draw_color_simple(self):
  1869. return self.color_simple
  1870. EnumKeyframeBezierHandleType = (('FREE', 'Free', 'Completely independent manually set handle.'),
  1871. ('ALIGNED', "Aligned", "Manually set handle with rotation locked together with its pair."),
  1872. ('VECTOR', "Vector", "Automatic handles that create straight lines."),
  1873. ('AUTO', "Automatic", "Automatic handles that create smooth curves."),
  1874. ('AUTO_CLAMPED', "Auto Clamped", "Automatic handles that create smooth curves which only change direction at keyframes."),)
  1875. class EnumKeyframeBezierHandleTypeSocket(MantisSocket):
  1876. '''Keyframe Bezier Handle Type'''
  1877. bl_idname = 'EnumKeyframeBezierHandleTypeSocket'
  1878. bl_label = "Keyframe Bezier Handle Type"
  1879. default_value :bpy.props.EnumProperty(
  1880. name="",
  1881. description="Handle Type",
  1882. items=EnumKeyframeBezierHandleType,
  1883. default='AUTO_CLAMPED',
  1884. update = update_socket,)
  1885. color_simple = cString
  1886. color : bpy.props.FloatVectorProperty(default=cString, size=4)
  1887. input : bpy.props.BoolProperty(default =False, update = update_socket)
  1888. def draw(self, context, layout, node, text):
  1889. ChooseDraw(self, context, layout, node, text)
  1890. def draw_color(self, context, node):
  1891. return self.color
  1892. @classmethod
  1893. def draw_color_simple(self):
  1894. return self.color_simple
  1895. enumExtrapolationMode = (('CONSTANT', 'Constant', 'Constant'),
  1896. ('LINEAR', "Linear", "Linear"),)
  1897. class eFCrvExtrapolationMode(MantisSocket):
  1898. '''FCurve Extrapolation Mode'''
  1899. bl_idname = 'eFCrvExtrapolationMode'
  1900. bl_label = "Extrapolation Mode"
  1901. default_value :bpy.props.EnumProperty(
  1902. name="",
  1903. description="Handle Type",
  1904. items=enumExtrapolationMode,
  1905. default='CONSTANT',
  1906. update = update_socket,)
  1907. color_simple = cString
  1908. color : bpy.props.FloatVectorProperty(default=cString, size=4)
  1909. input : bpy.props.BoolProperty(default =False, update = update_socket)
  1910. def draw(self, context, layout, node, text):
  1911. ChooseDraw(self, context, layout, node, text)
  1912. def draw_color(self, context, node):
  1913. return self.color
  1914. @classmethod
  1915. def draw_color_simple(self):
  1916. return self.color_simple
  1917. enumFloatOperations = (('ADD', 'Add', 'Add'),
  1918. ('SUBTRACT', "Subtract", "Subtract"),
  1919. ('MULTIPLY', "Multiply", "Multiply"),
  1920. ('DIVIDE', "Divide", "Divide"),
  1921. ('POWER', "Power", "Power"),
  1922. ('FLOOR_DIVIDE', "Floor Divide", "Floor Divide"),
  1923. ('MODULUS', "Modulus", "Modulus"),
  1924. ('ABSOLUTE', "Absolute", "Absolute Value"),
  1925. ('MAXIMUM', "Maximum", "Maximum"),
  1926. ('MINIMUM', "Minimum", "Minimum"),
  1927. ('GREATER THAN', "Greater Than", "Greater Than"),
  1928. ('LESS THAN', "Less Than", "Less Than"),
  1929. ('ARCTAN2', "atan2", "2-argument arctan function"),)
  1930. class MathFloatOperation(MantisSocket):
  1931. """Float Math Operation"""
  1932. bl_idname = 'MathFloatOperation'
  1933. bl_label = "Operation"
  1934. default_value :bpy.props.EnumProperty(
  1935. name="",
  1936. description="Operation",
  1937. items=enumFloatOperations,
  1938. default='MULTIPLY',
  1939. update = update_socket,)
  1940. color_simple = cString
  1941. color : bpy.props.FloatVectorProperty(default=cString, size=4)
  1942. input : bpy.props.BoolProperty(default =False,)
  1943. def draw(self, context, layout, node, text):
  1944. ChooseDraw(self, context, layout, node, text)
  1945. def draw_color(self, context, node):
  1946. return self.color
  1947. @classmethod
  1948. def draw_color_simple(self):
  1949. return self.color_simple
  1950. enumVectorOperations = (('ADD', 'Add', 'Add (Component-wise)'),
  1951. ('SUBTRACT', "Subtract", "Subtract (Component-wise)"),
  1952. ('MULTIPLY', "Multiply", "Multiply (Component-wise)"),
  1953. ('SCALE', "Scale", "Scales vector by input float or average magnitude of input vector's components."),
  1954. ('DIVIDE', "Divide", "Divide (Component-wise)"),
  1955. ('POWER', "Power", "Power (Component-wise)"),
  1956. ('LENGTH', "Length", "Length"),
  1957. ('CROSS', "Cross Product", "Cross product of A X B"),
  1958. ('NORMALIZE', "Normalize", "Returns a normalized vector."),
  1959. ('DOT', "Dot Product", "Dot product of A . B"),
  1960. ('LINEAR_INTERP', "Linear Interpolation", "Linear Interpolation between vectors A and B by factor"))
  1961. class MathVectorOperation(MantisSocket):
  1962. """Vector Math Operation"""
  1963. bl_idname = 'MathVectorOperation'
  1964. bl_label = "Operation"
  1965. default_value :bpy.props.EnumProperty(
  1966. name="",
  1967. description="Operation",
  1968. items=enumVectorOperations,
  1969. default='MULTIPLY',
  1970. update = update_socket,)
  1971. color_simple = cString
  1972. color : bpy.props.FloatVectorProperty(default=cString, size=4)
  1973. input : bpy.props.BoolProperty(default =False,)
  1974. def draw(self, context, layout, node, text):
  1975. ChooseDraw(self, context, layout, node, text)
  1976. def draw_color(self, context, node):
  1977. return self.color
  1978. @classmethod
  1979. def draw_color_simple(self):
  1980. return self.color_simple
  1981. enumMatrixTransform = (('TRANSLATE', 'Translate', 'Translate'),
  1982. ('ROTATE_AXIS_ANGLE', "Rotate (Axis-angle)", "Rotates a number of radians around an axis"),
  1983. # ('ROTATE_EULER', "Rotate (Euler)", "Euler Rotation"),
  1984. # ('ROTATE_QUATERNION', "Rotate (Quaternion)", "Quaternion Rotation"),
  1985. ('SCALE', "Scale", "Scale"),)
  1986. class MatrixTransformOperation(MantisSocket):
  1987. """Matrix Transform Operation"""
  1988. bl_idname = 'MatrixTransformOperation'
  1989. bl_label = "Operation"
  1990. default_value :bpy.props.EnumProperty(
  1991. name="",
  1992. description="Operation",
  1993. items=enumMatrixTransform,
  1994. default='TRANSLATE',
  1995. update = update_socket,)
  1996. color_simple = cString
  1997. color : bpy.props.FloatVectorProperty(default=cString, size=4)
  1998. input : bpy.props.BoolProperty(default =False,)
  1999. def draw(self, context, layout, node, text):
  2000. ChooseDraw(self, context, layout, node, text)
  2001. def draw_color(self, context, node):
  2002. return self.color
  2003. @classmethod
  2004. def draw_color_simple(self):
  2005. return self.color_simple
  2006. enumIntOperations = (('ADD', 'Add', 'Add'),
  2007. ('SUBTRACT', "Subtract", "Subtract"),
  2008. ('MULTIPLY', "Multiply", "Multiply"),
  2009. ('FLOOR_DIVIDE', "Floor Divide", "Floor Divide"),
  2010. ('POWER', "Power", "Power"),
  2011. ('MODULUS', "Modulus", "Modulus"),
  2012. ('ABSOLUTE', "Absolute", "Absolute Value"),
  2013. ('MAXIMUM', "Maximum", "Maximum"),
  2014. ('MINIMUM', "Minimum", "Minimum"),
  2015. ('GREATER THAN', "Greater Than", "Greater Than"),
  2016. ('LESS THAN', "Less Than", "Less Than"),)
  2017. class MathIntOperation(MantisSocket):
  2018. """Int Math Operation"""
  2019. bl_idname = 'MathIntOperation'
  2020. bl_label = "Operation"
  2021. default_value :bpy.props.EnumProperty(
  2022. name="",
  2023. description="Operation",
  2024. items=enumIntOperations,
  2025. default='MULTIPLY',
  2026. update = update_socket,)
  2027. color_simple = cString
  2028. color : bpy.props.FloatVectorProperty(default=cString, size=4)
  2029. input : bpy.props.BoolProperty(default =False,)
  2030. def draw(self, context, layout, node, text):
  2031. ChooseDraw(self, context, layout, node, text)
  2032. def draw_color(self, context, node):
  2033. return self.color
  2034. @classmethod
  2035. def draw_color_simple(self):
  2036. return self.color_simple
  2037. class WildcardSocket(MantisSocket):
  2038. """Some kind of node socket lol I donno"""
  2039. bl_idname = 'WildcardSocket'
  2040. bl_label = ""
  2041. color_simple = (0.0,0.0,0.0,0.0)
  2042. color : bpy.props.FloatVectorProperty(default=(0.0,0.0,0.0,0.0), size=4)
  2043. input : bpy.props.BoolProperty(default =False,)
  2044. def draw(self, context, layout, node, text):
  2045. ChooseDraw(self, context, layout, node, text)
  2046. def draw_color(self, context, node):
  2047. return self.color
  2048. @classmethod
  2049. def draw_color_simple(self):
  2050. return self.color_simple