socket_definitions.py 83 KB

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