socket_definitions.py 83 KB

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