socket_definitions.py 84 KB

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