socket_definitions.py 83 KB

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