socket_definitions.py 85 KB

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