socket_definitions.py 84 KB

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