socket_definitions.py 84 KB

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