socket_definitions.py 103 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802
  1. import bpy
  2. from bpy.types import NodeSocket, NodeSocketStandard
  3. # Classes which do not have default_value
  4. # needed to detect when there is an error updating dynamic nodes
  5. no_default_value= [
  6. 'MantisSocket',
  7. 'RelationshipSocket',
  8. 'DeformerSocket',
  9. 'xFormSocket',
  10. 'GeometrySocket',
  11. 'GenericRotationSocket',
  12. 'FCurveSocket',
  13. 'DriverSocket',
  14. 'DriverVariableSocket',
  15. 'xFormParameterSocket',
  16. 'MorphTargetSocket',
  17. 'KeyframeSocket',
  18. 'WildcardSocket',
  19. ]
  20. # the sockets that do not have this field do not transfer data.
  21. # instead, it is the link itself which is meaningful.
  22. from bpy.app import version as bpy_version
  23. if bpy_version == (4,5,0): # THere is a bug that requires the socket type to inherit from a Blender class
  24. from bpy.types import NodeSocketGeometry # so we will just inherit from NodeSocketGeometry
  25. class MantisSocket(NodeSocketGeometry, NodeSocket): # even though that is kinda silly
  26. is_valid_interface_type=False
  27. else:
  28. class MantisSocket(NodeSocket):
  29. is_valid_interface_type=False
  30. from .utilities import (prRed, prGreen, prPurple, prWhite,
  31. prOrange,
  32. wrapRed, wrapGreen, wrapPurple, wrapWhite,
  33. wrapOrange,)
  34. transform_spaces_bone_to = (('WORLD', "World", "World Space"),
  35. ('LOCAL', "Local", "Local Space"),
  36. ('POSE', "Pose", "Pose Space"),
  37. ('CUSTOM', "Custom", "Custom Space"),
  38. ('LOCAL_WITH_PARENT', "Local (With Parent)", "Local Space"),
  39. ('LOCAL_OWNER_ORIENT', "Local (Owner Orientation)", "Local Space"),)
  40. transform_spaces_bone_from = (('WORLD', "World", "World Space"),
  41. ('LOCAL', "Local", "Local Space"),
  42. ('POSE', "Pose", "Pose Space"),
  43. ('CUSTOM', "Custom", "Custom Space"),
  44. ('LOCAL_WITH_PARENT', "Local (With Parent)", "Local Space"),)
  45. transform_spaces_bone_object = (('WORLD', "World", "World Space"),
  46. ('LOCAL', "Local", "Local Space"),
  47. ('POSE', "Pose", "Pose Space"),
  48. ('CUSTOM', "Custom", "Custom Space"),)
  49. transform_spaces_object = (('WORLD', "World", "World Space"),
  50. ('LOCAL', "Local", "Local Space"),
  51. ('CUSTOM', "Custom", "Custom Space"),)
  52. enumRotationOrder =(('AUTO', 'Auto', 'Auto'),
  53. ('XYZ', "XYZ", "XYZ"),
  54. ('XZY', "XZY", "XZY"),
  55. ('ZXY', "ZXY", "ZXY"),
  56. ('ZYX', "ZYX", "ZYX"),
  57. ('YXZ', "YXZ", "YXZ"),
  58. ('YZX', "YZX", "YZX"),
  59. ('QUATERNION', "Quaternion", "Quaternion"),
  60. ('AXIS_ANGLE', "Axis Angle", "Axis Angle"),)
  61. # node socket colors:
  62. cFloat = (0.631373, 0.631373, 0.631373, 1.000000)
  63. cColor = (0.780392, 0.780392, 0.160784, 1.000000)
  64. cVector = (0.388235, 0.388235, 0.780392, 1.000000)
  65. cShader = (0.388235, 0.780392, 0.388235, 1.000000)
  66. cInt = (0.058824, 0.521569, 0.149020, 1.000000)
  67. cString = (0.388235, 0.388235, 0.388235, 1.000000)
  68. # cBool = (0.698039, 0.650980, 0.188235, 1.000000)
  69. cParameter = (0.48, 0.24, 0.24, 1.0)
  70. cDriver = (0.88, 0.11, 0.88, 1.0)
  71. cDriverVariable = (0.66, 0.33, 0.04, 1.0)
  72. cFCurve = (0.77, 0.77, 0.11, 1.0)
  73. cKeyframe = (0.06, 0.22, 0.88, 1.0)
  74. cEnable = (0.92, 0.92, 0.92, 1.0)
  75. cBoneCollection = (0.82, 0.82, 0.82, 1.0)
  76. cDeformer = (0.05, 0.08, 0.45, 1.0)
  77. cShapeKey = (0.95, 0.32, 0.05, 1.0)
  78. # custom colors:
  79. cIK = (0.596078, 0.596078, 0.364706, 1.000000) #because it's yellow in Blender
  80. cRelationship = (0.352941, 0.584314, 0.431373, 1.000000) #constraint color
  81. cMatrix = (0.0, 1.0, 0.75, 1)
  82. cxForm = (0.843137, 0.592157, 0.388235, 1.000000) #could even fetch the theme colors...
  83. cTransformSpace = (1.0, 0.4, 0.216, 1.0)
  84. cBool = (0.1, 0.1, 0.1, 1.0)
  85. cBool3 = (0.35, 0.25, 0.18, 1.0)
  86. cRotationOrder = (0.0, 0.8, 0.0, 1.0)
  87. cQuaternion = (0.85, 0.25, 0.18, 1.0)
  88. #
  89. cGeometry = (0.000000, 0.672443, 0.366253, 1.000000)
  90. # think about making colors that are representative of the data's purpose:
  91. # location
  92. # rotation
  93. # scale
  94. # OR make all of it a reference to the type of data within?
  95. # Hybrid approach: Make same-data, similar purpose have similar colors.
  96. from typing import List
  97. def TellClasses() -> List[MantisSocket]:
  98. return [ #MantisSocket,
  99. #DefaultSocket,
  100. #InputSocket,
  101. MatrixSocket,
  102. xFormSocket,
  103. RelationshipSocket,
  104. DeformerSocket,
  105. GeometrySocket,
  106. GenericRotationSocket,
  107. EnableSocket,
  108. HideSocket,
  109. # InverseKinematicsSocket,
  110. DriverSocket,
  111. DriverVariableSocket,
  112. FCurveSocket,
  113. # LayerMaskSocket,
  114. # LayerMaskInputSocket,
  115. BoneCollectionSocket,
  116. EnumArrayGetOptions,
  117. xFormParameterSocket,
  118. ParameterBoolSocket,
  119. ParameterIntSocket,
  120. ParameterFloatSocket,
  121. ParameterVectorSocket,
  122. ParameterStringSocket,
  123. TransformSpaceSocket,
  124. BooleanSocket,
  125. InvertedBooleanSocket,
  126. BooleanThreeTupleSocket,
  127. RotationOrderSocket,
  128. QuaternionSocket,
  129. QuaternionSocketAA,
  130. UnsignedIntSocket,
  131. IntSocket,
  132. StringSocket,
  133. CollectionDeclarationSocket,
  134. ColorSetDisplaySocket,
  135. ColorSetSocket,
  136. EnumMetaRigSocket,
  137. EnumMetaBoneSocket,
  138. EnumCurveSocket,
  139. EnumWidgetLibrarySocket,
  140. BoolUpdateParentNode,
  141. # LabelSocket,
  142. IKChainLengthSocket,
  143. EnumInheritScale,
  144. EnumRotationMix,
  145. EnumRotationMixCopyTransforms,
  146. EnumMaintainVolumeStretchTo,
  147. EnumRotationStretchTo,
  148. EnumTrackAxis,
  149. EnumUpAxis,
  150. EnumFollowPathForwardAxis,
  151. EnumFloorAxis,
  152. EnumLockAxis,
  153. EnumLimitMode,
  154. EnumYScaleMode,
  155. EnumXZScaleMode,
  156. EnumTransformationMap,
  157. EnumTransformationRotationMode,
  158. EnumTransformationRotationOrder,
  159. EnumTransformationTranslationMixMode,
  160. EnumTransformationRotationMixMode,
  161. EnumTransformationScaleMixMode,
  162. EnumTransformationAxes,
  163. EnumBBoneHandleType,
  164. # Deformers
  165. EnumSkinning,
  166. MorphTargetSocket,
  167. #
  168. FloatSocket,
  169. FloatPositiveSocket,
  170. FloatFactorSocket,
  171. FloatAngleSocket,
  172. VectorSocket,
  173. VectorEulerSocket,
  174. VectorTranslationSocket,
  175. VectorScaleSocket,
  176. # Drivers
  177. EnumDriverVariableType,
  178. EnumDriverVariableEvaluationSpace,
  179. EnumDriverVariableTransformChannel,
  180. EnumDriverRotationMode,
  181. EnumDriverType,
  182. KeyframeSocket,
  183. EnumKeyframeInterpolationTypeSocket,
  184. EnumKeyframeBezierHandleTypeSocket,
  185. EnumLatticeInterpolationTypeSocket,
  186. EnumCorrectiveSmoothTypeSocket,
  187. eFCrvExtrapolationMode,
  188. # Math
  189. MathFloatOperation,
  190. MathVectorOperation,
  191. MatrixTransformOperation,
  192. #conditions
  193. EnumCompareOperation,
  194. # Schema
  195. WildcardSocket,
  196. # xFormArraySocket,
  197. # RelationshipArraySocket,
  198. # BooleanArraySocket,
  199. # IntArraySocket,
  200. # FloatArraySocket,
  201. # BooleanThreeTupleArraySocket,
  202. # VectorArraySocket,
  203. # QuaternionArraySocket,
  204. # MatrixArraySocket,
  205. # StringArraySocket,
  206. ]
  207. def Tell_bl_idnames(): # reroute nodes
  208. return [cls.bl_idname for cls in TellClasses()]#+["NodeSocketColor"]
  209. def tell_valid_bl_idnames():
  210. valid_classes = filter(lambda cls : cls.is_valid_interface_type, [cls for cls in TellClasses()])
  211. return (cls.bl_idname for cls in valid_classes)
  212. # Was setting color like this:
  213. # color : bpy.props.FloatVectorProperty(size = 4, default = cFCurve,)
  214. # but this didn't work when Blender automatically generated interface classes?
  215. # so changed it to color = cVariable
  216. # but for color-changing sockets, if I make them, this won' work? Maybe?
  217. #
  218. # I actually think I was wrong about all of that lol
  219. # TODO change it back, dingus
  220. ########################################################################
  221. # Update Callbacks
  222. ########################################################################
  223. def socket_update(mantis_node, ui_socket, socket_name=None):
  224. node_updated = mantis_node.ui_modify_socket(ui_socket, socket_name)
  225. if not node_updated: # so that we can tag its dependencies
  226. mantis_node.reset_execution_recursive()
  227. return node_updated
  228. def default_update(ui_socket, context, do_execute=True):
  229. context = bpy.context
  230. if not context.space_data:
  231. return
  232. if not hasattr(context.space_data, "path"):
  233. return
  234. try:
  235. node_tree = context.space_data.path[0].node_tree
  236. except IndexError: # not in the UI, for example, in a script instead.
  237. return
  238. if node_tree.is_executing or node_tree.is_exporting or not node_tree.do_live_update:
  239. return
  240. # if it is a Schema Node, it will fail the checks below -- but we need it to update the tree.
  241. from .base_definitions import SchemaUINode
  242. if isinstance(ui_socket.node, SchemaUINode):
  243. node_tree.update_tree(context, force = True)
  244. prPurple(f"Executing tree after socket change: {ui_socket.node.name}:{ui_socket.name}")
  245. node_tree.execute_tree(context)
  246. return
  247. if hasattr(ui_socket.node, "initialized"):
  248. if not ui_socket.node.initialized: return
  249. elif hasattr(ui_socket.node, 'is_updating'):
  250. if ui_socket.node.is_updating: return
  251. else: return
  252. # if the socket has survived THAT ordeal, then the context is OK.
  253. # first, we try to update the Mantis tree in-situ.
  254. # Some nodes can update their b-objects, others will have to force-update the tree
  255. # because we just modified the data without modifying the topology of the graph.
  256. # finally, try and execute it if mantis couldn't update the b_objects itself.
  257. from .base_definitions import array_output_types
  258. mantis_updated=True
  259. if (ui_socket.node.bl_idname in ["MantisNodeGroup", "MantisSchemaGroup"]):
  260. mantis_updated=False # this kind of socket can't be updated here (yet)
  261. node_tree.update_tree(context, force=True)
  262. elif ui_socket.node.bl_idname in array_output_types:
  263. mantis_updated=False
  264. node_tree.update_tree(context, force=True)
  265. elif hasattr(ui_socket, 'default_value'):
  266. # we may not have to regenerate the tree; try and update the socket
  267. from .utilities import tree_from_nc
  268. for mantis_node in node_tree.parsed_tree.values():
  269. # check to see if the mantis node is in the same ui-tree as this ui_socket
  270. if mantis_node.ui_signature is None: continue # autogenerated nodes
  271. if mantis_node.ui_signature[-1] == ui_socket.node.name and \
  272. tree_from_nc(mantis_node.ui_signature, node_tree) == ui_socket.node.id_data:
  273. node_updated = True
  274. from .misc_nodes import SimpleInputNode
  275. if isinstance(mantis_node, SimpleInputNode):
  276. node_updated = socket_update(mantis_node, ui_socket)
  277. for l in mantis_node.outputs[ui_socket.name].links:
  278. node_updated = node_updated and socket_update(l.to_node, ui_socket, l.to_socket)
  279. else:
  280. node_updated = socket_update(mantis_node, ui_socket)
  281. # execute the tree if even one node didn't update
  282. mantis_updated = node_updated and mantis_updated
  283. # we want to force it if we have made an unhandled change inside of a schema.
  284. node_tree.update_tree(context, force = (mantis_updated == False))
  285. node_tree.display_update(context)
  286. if mantis_updated==False:
  287. try:
  288. prPurple(f"Executing tree after socket change: {ui_socket.node.name}:{ui_socket.name}")
  289. node_tree.execute_tree(context)
  290. except Exception as e:
  291. prRed("Automatic Tree Execution failed because of %s" % e)
  292. def update_socket(self, context,):
  293. default_update(self,context)
  294. def driver_variable_socket_update(self, context):
  295. default_update(self,context)
  296. def driver_socket_update(self, context):
  297. default_update(self,context)
  298. def update_mute_socket(self, context):
  299. self.node.mute = not self.default_value
  300. default_update(self,context)
  301. def update_hide_socket(self, context):
  302. self.node.mute = self.default_value
  303. default_update(self,context)
  304. def ik_chain_length_update_socket(self, context):
  305. default_update(self,context)
  306. # self.node.update_chain_length(context)
  307. def update_parent_node(self, context):
  308. default_update(self,context)
  309. if hasattr(self.node, "display_update"):
  310. self.node.display_update(context)
  311. def update_metarig_armature(self, context,):
  312. if self.search_prop:
  313. self.node.armature = self.search_prop.name
  314. self.node.inputs["Meta-Bone"].search_prop = self.search_prop
  315. default_update(self,context)
  316. def update_metarig_posebone(self, context,):
  317. self.node.pose_bone = self.default_value
  318. default_update(self,context)
  319. ########################################################################
  320. # Sockets
  321. ########################################################################
  322. text_only_output_types = ["NodeGroupInput", "NodeGroupOutput", "SchemaArrayInput",
  323. "SchemaArrayInputGet", "SchemaArrayInputAll", "SchemaConstInput",
  324. "SchemaIncomingConnection"]
  325. def ChooseDraw(self, context, layout, node, text, icon = "NONE", use_enum=True, nice_bool=True, icon_only=False):
  326. invert_checkbox = False
  327. if hasattr(self, "invert") and self.invert == True:
  328. invert_checkbox=True
  329. # TEXT ONLY
  330. if self.node.bl_idname in text_only_output_types:
  331. layout.label(text=text)
  332. elif hasattr(self, "display_text") and self.display_text and self.is_linked:
  333. layout.label(text=self.display_text)
  334. else:
  335. # ENUM VALUES (this is a HACK, fix it later)
  336. if ('Enum' in self.bl_idname) and (use_enum):
  337. if not (self.is_output or self.is_linked):
  338. layout.prop_tabs_enum(self, "default_value",)
  339. else:
  340. layout.label(text=text)
  341. # for OUTPUT sockets that take INPUT (confusing name!)
  342. elif ((hasattr(self, "default_value")) and hasattr(self, "input") and getattr(self, "input")):
  343. # for simple input nodes
  344. layout.prop(self, "default_value", text=text, toggle=nice_bool, slider=True)
  345. # for INPUTS that are NOT CONNECTED
  346. elif (hasattr(self, "default_value")) and not (self.is_output or self.is_linked):
  347. # DO: expose these values as parameters for this function
  348. # and set them for each socket.
  349. if icon == 'NONE': icon_only = False
  350. elif icon_only == True : text = "" # "real" icon-only looks bad for strings, need to check other props types.
  351. layout.prop(self, "default_value", text=text, toggle=nice_bool, slider=True, icon=icon,
  352. invert_checkbox=invert_checkbox)
  353. # CONNECTED sockets and outputs without input fields
  354. else:
  355. layout.label(text=text)
  356. def CollectionSocketDraw(socket, context, layout, node, text):
  357. # create the UI objects
  358. indent_length = len(socket.collection_path.split('>'))
  359. layout.alignment = 'EXPAND'
  360. # label_col = layout.row()
  361. label_col = layout.split(factor=0.20)
  362. label_col.alignment = 'LEFT' # seems backwards?
  363. label_col.scale_x = 9.0
  364. x_split = label_col.split(factor=0.35)
  365. x_split.scale_x=2.0
  366. x_split.alignment = 'RIGHT'
  367. operator_col = layout.row()
  368. # operator_col = layout
  369. operator_col.alignment = 'RIGHT' # seems backwards?
  370. operator_col.scale_x = 1.0
  371. # x_split = operator_col.split(factor=0.5)
  372. # x_split.scale_x = 0.5
  373. # x_split.alignment = 'RIGHT'
  374. # Now fill in the text and operators and such
  375. label_text = socket.collection_path.split('>')[-1]
  376. if indent_length > 1:
  377. label_text = '└'+label_text #┈ use this character to extend
  378. for indent in range(indent_length):
  379. if indent <= 1: continue
  380. indent_text = ' ▹ '
  381. label_text=indent_text+label_text
  382. op_props = x_split.operator('mantis.collection_remove')
  383. op_props.socket_invoked = socket.identifier
  384. label_col.label(text=label_text)
  385. op_props = operator_col.operator('mantis.collection_add_new')
  386. op_props.socket_invoked = socket.identifier
  387. # this works well enough!
  388. class RelationshipSocket(MantisSocket):
  389. # Description string
  390. '''Relationship'''
  391. # Optional identifier string. If not explicitly defined, the python class name is used.
  392. bl_idname = 'RelationshipSocket'
  393. bl_label = "Relationship"
  394. color_simple = cRelationship
  395. color : bpy.props.FloatVectorProperty(default=cRelationship, size=4)
  396. input : bpy.props.BoolProperty(default =False,)
  397. is_valid_interface_type=True
  398. def draw(self, context, layout, node, text):
  399. ChooseDraw(self, context, layout, node, text)
  400. def draw_color(self, context, node):
  401. return self.color
  402. @classmethod
  403. def draw_color_simple(self):
  404. return self.color_simple
  405. class DeformerSocket(MantisSocket):
  406. # Description string
  407. '''Deformer'''
  408. # Optional identifier string. If not explicitly defined, the python class name is used.
  409. bl_idname = 'DeformerSocket'
  410. bl_label = "Deformer"
  411. is_valid_interface_type=True
  412. color_simple = cDeformer
  413. color : bpy.props.FloatVectorProperty(default=cDeformer, size=4)
  414. input : bpy.props.BoolProperty(default =False,)
  415. def draw(self, context, layout, node, text):
  416. ChooseDraw(self, context, layout, node, text)
  417. def draw_color(self, context, node):
  418. return self.color
  419. @classmethod
  420. def draw_color_simple(self):
  421. return self.color_simple
  422. class MatrixSocket(MantisSocket):
  423. '''Matrix Input Output'''
  424. bl_idname = 'MatrixSocket'
  425. bl_label = "Matrix"
  426. default_value : bpy.props.FloatVectorProperty(
  427. default = (1.0, 0.0, 0.0, 0.0,
  428. 0.0, 1.0, 0.0, 0.0,
  429. 0.0, 0.0, 1.0, 0.0,
  430. 0.0, 0.0, 0.0, 1.0),
  431. size=16,
  432. update = update_socket,)
  433. color_simple = cMatrix
  434. color : bpy.props.FloatVectorProperty(default=cMatrix, size=4)
  435. input : bpy.props.BoolProperty(default =False,)
  436. is_valid_interface_type=True
  437. # Optional function for drawing the socket input value
  438. def draw(self, context, layout, node, text):
  439. layout.label(text=text)
  440. def draw_color(self, context, node):
  441. return self.color
  442. @classmethod
  443. def draw_color_simple(self):
  444. return self.color_simple
  445. # Utility functions to make handling the 16 numbers more bearable
  446. def SetValue(self, mat):
  447. self.default_value = ( mat[0][0], mat[0][1], mat[0][2], mat[0][3],
  448. mat[1][0], mat[1][1], mat[1][2], mat[1][3],
  449. mat[2][0], mat[2][1], mat[2][2], mat[2][3],
  450. mat[3][0], mat[3][1], mat[3][2], mat[3][3], )
  451. def TellValue(self):
  452. from mathutils import Matrix
  453. v = self.default_value
  454. return Matrix( ( ( v[ 0], v[ 1], v[ 2], v[ 3],),
  455. ( v[ 4], v[ 5], v[ 6], v[ 7],),
  456. ( v[ 8], v[ 9], v[10], v[11],),
  457. ( v[12], v[13], v[14], v[15]), ) )
  458. #NOTE, we're not using the last row
  459. # so we're gonna use it to store data
  460. # unused, unused, unused, bone_length
  461. # but we're not going to make it
  462. # available except by accessor functions
  463. # would like to make this stuff easier to deal with tho
  464. def TellBoneLength(self):
  465. return self.default_value[15]
  466. class xFormSocket(MantisSocket):
  467. '''xFrom Input Output'''
  468. bl_idname = 'xFormSocket'
  469. bl_label = "xForm"
  470. color_simple = cxForm
  471. color : bpy.props.FloatVectorProperty(default=cxForm, size=4)
  472. input : bpy.props.BoolProperty(default =False,)
  473. is_valid_interface_type=True
  474. def draw(self, context, layout, node, text):
  475. ChooseDraw(self, context, layout, node, text)
  476. def draw_color(self, context, node):
  477. return self.color
  478. @classmethod
  479. def draw_color_simple(self):
  480. return self.color_simple
  481. class GeometrySocket(MantisSocket):
  482. '''Geometry Input Output'''
  483. bl_idname = 'GeometrySocket'
  484. bl_label = "Geometry"
  485. color_simple = cGeometry
  486. color : bpy.props.FloatVectorProperty(default=cGeometry, size=4)
  487. input : bpy.props.BoolProperty(default =False,)
  488. is_valid_interface_type=True
  489. def draw(self, context, layout, node, text):
  490. ChooseDraw(self, context, layout, node, text)
  491. def draw_color(self, context, node):
  492. return self.color
  493. @classmethod
  494. def draw_color_simple(self):
  495. return self.color_simple
  496. class GenericRotationSocket(MantisSocket):
  497. '''Custom node socket type'''
  498. bl_idname = 'GenericRotationSocket'
  499. bl_label = "Rotation"
  500. color = (0.0,0.0,0.0,0.0)
  501. input : bpy.props.BoolProperty(default =False,)
  502. def draw(self, context, layout, node, text):
  503. ChooseDraw(self, context, layout, node, text)
  504. def draw_color(self, context, node):
  505. return self.color
  506. @classmethod
  507. def draw_color_simple(self):
  508. return self.color_simple
  509. ###############################
  510. class EnableSocket(MantisSocket):
  511. '''Custom node socket type'''
  512. bl_idname = 'EnableSocket'
  513. bl_label = "Enable"
  514. default_value: bpy.props.BoolProperty(default=True, update = update_mute_socket,)
  515. color_simple = cEnable
  516. color : bpy.props.FloatVectorProperty(default=cEnable, size=4)
  517. input : bpy.props.BoolProperty(default =False,)
  518. def draw(self, context, layout, node, text):
  519. ChooseDraw(self, context, layout, node, text, nice_bool=False)
  520. def draw_color(self, context, node):
  521. return self.color
  522. @classmethod
  523. def draw_color_simple(self):
  524. return self.color_simple
  525. class HideSocket(MantisSocket):
  526. '''Custom node socket type'''
  527. bl_idname = 'HideSocket'
  528. bl_label = "Hide"
  529. default_value: bpy.props.BoolProperty(default=False, update = update_hide_socket,)
  530. color_simple = cEnable
  531. color : bpy.props.FloatVectorProperty(default=cEnable, size=4)
  532. input : bpy.props.BoolProperty(default =False,)
  533. def draw(self, context, layout, node, text):
  534. ChooseDraw(self, context, layout, node, text, nice_bool=False)
  535. def draw_color(self, context, node):
  536. return self.color
  537. @classmethod
  538. def draw_color_simple(self):
  539. return self.color_simple
  540. class FCurveSocket(MantisSocket):
  541. '''fCurve'''
  542. bl_idname = 'FCurveSocket'
  543. bl_label = "fCurve"
  544. color_simple = cFCurve
  545. color : bpy.props.FloatVectorProperty(default=cFCurve, size=4)
  546. input : bpy.props.BoolProperty(default =False, update = update_socket)
  547. is_valid_interface_type=True
  548. def init(self):
  549. self.display_shape = 'CIRCLE_DOT'
  550. def draw(self, context, layout, node, text):
  551. ChooseDraw(self, context, layout, node, text)
  552. def draw_color(self, context, node):
  553. return self.color
  554. @classmethod
  555. def draw_color_simple(self):
  556. return self.color_simple
  557. class DriverSocket(MantisSocket):
  558. '''Driver'''
  559. bl_idname = 'DriverSocket'
  560. bl_label = "Driver"
  561. color_simple = cDriver
  562. color : bpy.props.FloatVectorProperty(default=cDriver, size=4)
  563. input : bpy.props.BoolProperty(default =False, update = update_socket)
  564. is_valid_interface_type=True
  565. def init(self):
  566. self.display_shape = 'CIRCLE_DOT'
  567. def draw(self, context, layout, node, text):
  568. ChooseDraw(self, context, layout, node, text)
  569. def draw_color(self, context, node):
  570. return self.color
  571. @classmethod
  572. def draw_color_simple(self):
  573. return self.color_simple
  574. class DriverVariableSocket(MantisSocket):
  575. '''Driver'''
  576. bl_idname = 'DriverVariableSocket'
  577. bl_label = "Driver Variable"
  578. color_simple = cDriverVariable
  579. color : bpy.props.FloatVectorProperty(default=cDriverVariable, size=4)
  580. input : bpy.props.BoolProperty(default =False, update = update_socket)
  581. is_valid_interface_type=True
  582. def init(self):
  583. self.display_shape = 'CIRCLE_DOT'
  584. def draw(self, context, layout, node, text):
  585. ChooseDraw(self, context, layout, node, text)
  586. def draw_color(self, context, node):
  587. return self.color
  588. @classmethod
  589. def draw_color_simple(self):
  590. return self.color_simple
  591. # transform_spaces
  592. # transform_spaces_bone_object
  593. # transform_spaces_object
  594. # def get_transform_space_enum(self, context):
  595. # pass
  596. def get_transform_space(self, context):
  597. if "Owner" in self.name:
  598. return transform_spaces_bone_from
  599. else:
  600. return transform_spaces_bone_to
  601. class TransformSpaceSocket(MantisSocket):
  602. '''Custom node socket type'''
  603. bl_idname = 'TransformSpaceSocket'
  604. bl_label = "Transform Space"
  605. default_value: bpy.props.EnumProperty(
  606. name="Space Transform",
  607. description="Space Transform",
  608. items=get_transform_space,
  609. default=0,
  610. update = update_socket,)
  611. color_simple = cTransformSpace
  612. color : bpy.props.FloatVectorProperty(default=cTransformSpace, size=4)
  613. input : bpy.props.BoolProperty(default =False,)
  614. def draw(self, context, layout, node, text):
  615. ChooseDraw(self, context, layout, node, text)
  616. def draw_color(self, context, node):
  617. return self.color
  618. @classmethod
  619. def draw_color_simple(self):
  620. return self.color_simple
  621. class BooleanSocket(MantisSocket):
  622. '''Custom node socket type'''
  623. bl_idname = 'BooleanSocket'
  624. bl_label = "Boolean"
  625. default_value: bpy.props.BoolProperty(update = update_socket,)
  626. color_simple = cBool
  627. color : bpy.props.FloatVectorProperty(default=cBool, size=4)
  628. input : bpy.props.BoolProperty(default =False,)
  629. is_valid_interface_type=True
  630. def draw(self, context, layout, node, text):
  631. ChooseDraw(self, context, layout, node, text)
  632. def draw_color(self, context, node):
  633. return self.color
  634. @classmethod
  635. def draw_color_simple(self):
  636. return self.color_simple
  637. class InvertedBooleanSocket(MantisSocket):
  638. '''Custom node socket type'''
  639. bl_idname = 'InvertedBooleanSocket'
  640. bl_label = "Inverted Boolean"
  641. default_value: bpy.props.BoolProperty(update = update_socket,)
  642. color_simple = cBool
  643. color : bpy.props.FloatVectorProperty(default=cBool, size=4)
  644. input : bpy.props.BoolProperty(default =False,)
  645. invert : bpy.props.BoolProperty(default=True,)
  646. is_valid_interface_type=False
  647. def draw(self, context, layout, node, text):
  648. ChooseDraw(self, context, layout, node, text)
  649. def draw_color(self, context, node):
  650. return self.color
  651. @classmethod
  652. def draw_color_simple(self):
  653. return self.color_simple
  654. class BooleanThreeTupleSocket(MantisSocket):
  655. # Description string
  656. '''Custom node socket type'''
  657. # Optional identifier string. If not explicitly defined, the python class name is used.
  658. bl_idname = 'BooleanThreeTupleSocket'
  659. bl_label = "Boolean Vector"
  660. default_value: bpy.props.BoolVectorProperty(subtype = "XYZ",update = update_socket,)
  661. color_simple = cBool3
  662. color : bpy.props.FloatVectorProperty(default=cBool3, size=4)
  663. input : bpy.props.BoolProperty(default =False,)
  664. is_valid_interface_type=True
  665. def draw(self, context, layout, node, text):
  666. ChooseDraw(self, context, layout, node, text)
  667. def draw_color(self, context, node):
  668. return self.color
  669. @classmethod
  670. def draw_color_simple(self):
  671. return self.color_simple
  672. def TellValue(self):
  673. return (self.default_value[0], self.default_value[1], self.default_value[2])
  674. class RotationOrderSocket(MantisSocket):
  675. '''Custom node socket type'''
  676. bl_idname = 'RotationOrderSocket'
  677. bl_label = "Rotation Order"
  678. default_value: bpy.props.EnumProperty(
  679. name="Rotation Order",
  680. description="Rotation Order",
  681. items=enumRotationOrder,
  682. default='AUTO',
  683. update = update_socket,)
  684. color_simple = cRotationOrder
  685. color : bpy.props.FloatVectorProperty(default=cRotationOrder, size=4)
  686. input : bpy.props.BoolProperty(default =False,)
  687. def draw(self, context, layout, node, text):
  688. ChooseDraw(self, context, layout, node, text)
  689. def draw_color(self, context, node):
  690. return self.color
  691. @classmethod
  692. def draw_color_simple(self):
  693. return self.color_simple
  694. class QuaternionSocket(MantisSocket):
  695. '''Custom node socket type'''
  696. bl_idname = 'QuaternionSocket'
  697. bl_label = "Quaternion"
  698. default_value: bpy.props.FloatVectorProperty(
  699. subtype = "QUATERNION",
  700. size = 4,
  701. default = (1.0, 0.0, 0.0, 0.0,),
  702. update = update_socket,)
  703. color_simple = cQuaternion
  704. color : bpy.props.FloatVectorProperty(default=cQuaternion, size=4)
  705. input : bpy.props.BoolProperty(default =False,)
  706. def draw(self, context, layout, node, text):
  707. ChooseDraw(self, context, layout, node, text)
  708. def draw_color(self, context, node):
  709. return self.color
  710. @classmethod
  711. def draw_color_simple(self):
  712. return self.color_simple
  713. class QuaternionSocketAA(MantisSocket):
  714. '''Custom node socket type'''
  715. bl_idname = 'QuaternionSocketAA'
  716. bl_label = "Axis Angle Quaternion"
  717. color_simple = cQuaternion
  718. color : bpy.props.FloatVectorProperty(default=cQuaternion, size=4)
  719. input : bpy.props.BoolProperty(default =False,)
  720. default_value: bpy.props.FloatVectorProperty(
  721. subtype = "AXISANGLE",
  722. size = 4,
  723. default = (1.0, 0.0, 0.0, 0.0,),
  724. update = update_socket,)
  725. def draw(self, context, layout, node, text):
  726. ChooseDraw(self, context, layout, node, text)
  727. def draw_color(self, context, node):
  728. return self.color
  729. @classmethod
  730. def draw_color_simple(self):
  731. return self.color_simple
  732. class IntSocket(MantisSocket):
  733. '''Custom node socket type'''
  734. bl_idname = 'IntSocket'
  735. bl_label = "Integer"
  736. default_value: bpy.props.IntProperty(default=0, update = update_socket, soft_min=-256, soft_max=256)
  737. color_simple = cInt
  738. color : bpy.props.FloatVectorProperty(default=cInt, size=4)
  739. input : bpy.props.BoolProperty(default =False,)
  740. is_valid_interface_type=True
  741. def draw(self, context, layout, node, text):
  742. ChooseDraw(self, context, layout, node, text)
  743. def draw_color(self, context, node):
  744. return self.color
  745. @classmethod
  746. def draw_color_simple(self):
  747. return self.color_simple
  748. class UnsignedIntSocket(MantisSocket):
  749. '''Unsigned Integer Socket'''
  750. bl_idname = 'UnsignedIntSocket'
  751. bl_label = "Unsigned Integer"
  752. default_value: bpy.props.IntProperty(default=0, update = update_socket, min=0, soft_max=256, max=2**13)
  753. color_simple = cInt
  754. color : bpy.props.FloatVectorProperty(default=cInt, size=4)
  755. input : bpy.props.BoolProperty(default =False,)
  756. is_valid_interface_type=True
  757. def draw(self, context, layout, node, text):
  758. ChooseDraw(self, context, layout, node, text)
  759. def draw_color(self, context, node):
  760. return self.color
  761. @classmethod
  762. def draw_color_simple(self):
  763. return self.color_simple
  764. class StringSocket(MantisSocket):
  765. """Float Input socket"""
  766. bl_idname = 'StringSocket'
  767. bl_label = "String"
  768. default_value : bpy.props.StringProperty(default = "", update = update_socket,)
  769. color_simple = cString
  770. color : bpy.props.FloatVectorProperty(default=cString, size=4)
  771. icon : bpy.props.StringProperty(default = "NONE",)
  772. input : bpy.props.BoolProperty(default =False,)
  773. display_text : bpy.props.StringProperty(default="")
  774. is_valid_interface_type=True
  775. # def init(self):
  776. # if self.node.bl_idname == 'UtilityBoneProperties':
  777. # self.display_shape='CIRCLE_DOT'
  778. def draw(self, context, layout, node, text):
  779. ChooseDraw(self, context, layout, node, text, icon=self.icon, icon_only=True,)
  780. def draw_color(self, context, node):
  781. return self.color
  782. @classmethod
  783. def draw_color_simple(self):
  784. return self.color_simple
  785. def collection_declaration_get_default_value(self):
  786. return self.collection_path
  787. class CollectionDeclarationSocket(MantisSocket):
  788. """Socket for declaring a collection"""
  789. bl_idname = 'CollectionDeclarationSocket'
  790. bl_label = "Collection"
  791. default_value : bpy.props.StringProperty(get=collection_declaration_get_default_value)
  792. collection_path : bpy.props.StringProperty(default="")
  793. color_simple = cBoneCollection
  794. color : bpy.props.FloatVectorProperty(default=cBoneCollection, size=4)
  795. icon : bpy.props.StringProperty(default = "NONE",)
  796. input : bpy.props.BoolProperty(default =True,)
  797. display_text : bpy.props.StringProperty(default="")
  798. is_valid_interface_type=False
  799. def draw(self, context, layout, node, text):
  800. CollectionSocketDraw(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 BoneCollectionSocket(MantisSocket):
  807. """Bone Collection socket"""
  808. bl_idname = 'BoneCollectionSocket'
  809. bl_label = "Bone Collection"
  810. default_value: bpy.props.StringProperty(default = "Collection", update = update_socket,)
  811. input : bpy.props.BoolProperty(default =False,)
  812. color_simple = cBoneCollection
  813. color : bpy.props.FloatVectorProperty(default=cBoneCollection, size=4)
  814. def draw(self, context, layout, node, text):
  815. ChooseDraw(self, context, layout, node, text)
  816. def draw_color(self, context, node):
  817. return self.color
  818. @classmethod
  819. def draw_color_simple(self):
  820. return self.color_simple
  821. def get_bone_theme_color(socket, prop,):
  822. from bpy import context
  823. color_index=socket.color_index
  824. color_set = context.preferences.themes[0].bone_color_sets[color_index]
  825. return getattr(color_set, prop )
  826. def get_active_color(socket):
  827. if socket is None:
  828. from bpy import context
  829. return context.preferences.themes[0].view_3d.bone_pose_active
  830. return get_bone_theme_color(socket, 'active')
  831. def get_normal_color(socket):
  832. if socket is None:
  833. from bpy import context
  834. return context.preferences.themes[0].view_3d.bone_solid
  835. return get_bone_theme_color(socket, 'normal')
  836. def get_select_color(socket):
  837. if socket is None:
  838. from bpy import context
  839. return context.preferences.themes[0].view_3d.bone_pose
  840. return get_bone_theme_color(socket, 'select')
  841. def get_color_set_value(socket,):
  842. return [ socket.active_color[0],
  843. socket.active_color[1],
  844. socket.active_color[2],
  845. socket.normal_color[0],
  846. socket.normal_color[1],
  847. socket.normal_color[2],
  848. socket.selected_color[0],
  849. socket.selected_color[1],
  850. socket.selected_color[2],]
  851. class ColorSetDisplaySocket(MantisSocket):
  852. """Socket for displaying a bone color theme"""
  853. bl_idname = 'ColorSetDisplaySocket'
  854. bl_label = "Color Set"
  855. default_value : bpy.props.FloatVectorProperty(get=get_color_set_value, size=9)
  856. color_simple = cColor
  857. color : bpy.props.FloatVectorProperty(default=cColor, size=4)
  858. icon : bpy.props.StringProperty(default = "NONE",)
  859. input : bpy.props.BoolProperty(default =False,)
  860. display_text : bpy.props.StringProperty(default="")
  861. color_index : bpy.props.IntProperty(default=0)
  862. active_color : bpy.props.FloatVectorProperty(
  863. name='Active Color', size=3, subtype='COLOR_GAMMA',
  864. get=get_active_color )
  865. normal_color : bpy.props.FloatVectorProperty(
  866. name='Normal Color', size=3, subtype='COLOR_GAMMA',
  867. get=get_normal_color )
  868. selected_color : bpy.props.FloatVectorProperty(
  869. name='Selected Color', size=3, subtype='COLOR_GAMMA',
  870. get=get_select_color )
  871. is_valid_interface_type=False
  872. def draw(self, context, layout, node, text):
  873. layout.prop( text='', data=self,
  874. property='active_color', )
  875. layout.prop( text='', data=self,
  876. property='normal_color',)
  877. layout.prop( text='', data=self,
  878. property='selected_color',)
  879. def draw_color(self, context, node):
  880. return self.color
  881. @classmethod
  882. def draw_color_simple(self):
  883. return self.color_simple
  884. class ColorSetSocket(MantisSocket):
  885. """Socket for setting a bone color"""
  886. bl_idname = 'ColorSetSocket'
  887. bl_label = "Custom Color Set"
  888. default_value : bpy.props.FloatVectorProperty(get=get_color_set_value, size=9)
  889. color_simple = cColor
  890. color : bpy.props.FloatVectorProperty(default=cColor, size=4)
  891. icon : bpy.props.StringProperty(default = "NONE",)
  892. input : bpy.props.BoolProperty(default = True,)
  893. display_text : bpy.props.StringProperty(default="")
  894. active_color : bpy.props.FloatVectorProperty(
  895. name='Active Color', size=3, subtype='COLOR_GAMMA',
  896. default=get_active_color(None),)
  897. normal_color : bpy.props.FloatVectorProperty(
  898. name='Normal Color', size=3, subtype='COLOR_GAMMA',
  899. default=get_normal_color(None),)
  900. selected_color : bpy.props.FloatVectorProperty(
  901. name='Selected Color', size=3, subtype='COLOR_GAMMA',
  902. default=get_select_color(None),)
  903. is_valid_interface_type=False
  904. def draw(self, context, layout, node, text):
  905. inherit_color_socket = self.node.inputs.get("Inherit Color")
  906. if (self.is_output == False) and (self.is_linked == True):
  907. layout.label(text=self.name)
  908. elif self.node.bl_idname in text_only_output_types:
  909. layout.label(text=self.name)
  910. elif inherit_color_socket and inherit_color_socket.default_value == True:
  911. layout.label(text='Using Inherit Color.')
  912. else:
  913. layout.prop( text='Color Set', data=self,
  914. property='active_color', )
  915. layout.prop( text='', data=self,
  916. property='normal_color',)
  917. layout.prop( text='', data=self,
  918. property='selected_color',)
  919. if self.node.bl_idname == 'InputColorSetPallete':
  920. ops_props = layout.operator('mantis.color_pallete_socket_remove')
  921. ops_props.tree_invoked = self.node.id_data.name
  922. ops_props.node_invoked = self.node.name
  923. ops_props.socket_invoked = self.identifier
  924. def draw_color(self, context, node):
  925. return self.color
  926. @classmethod
  927. def draw_color_simple(self):
  928. return self.color_simple
  929. eArrayGetOptions =(
  930. ('CAP', "Cap", "Fail if the index is out of bounds."),
  931. ('WRAP', "Wrap", "Wrap around to the beginning of the array once the idex goes out of bounds."),
  932. ('HOLD', "Hold", "Reuse the last element of the array if the index is out of bounds."),)
  933. class EnumArrayGetOptions(MantisSocket):
  934. '''Custom node socket type'''
  935. bl_idname = 'EnumArrayGetOptions'
  936. bl_label = "OoB Behaviour"
  937. default_value: bpy.props.EnumProperty(
  938. items=eArrayGetOptions,
  939. name="OoB Behaviour",
  940. description="Out-of-bounds behaviour.",
  941. default = 'HOLD',
  942. update = update_socket,)
  943. color_simple = cString
  944. color : bpy.props.FloatVectorProperty(default=cString, size=4)
  945. input : bpy.props.BoolProperty(default =False,)
  946. def draw(self, context, layout, node, text):
  947. ChooseDraw(self, context, layout, node, text)
  948. def draw_color(self, context, node):
  949. return self.color
  950. @classmethod
  951. def draw_color_simple(self):
  952. return self.color_simple
  953. #####################################################################################
  954. # Parameters
  955. #####################################################################################
  956. class xFormParameterSocket(MantisSocket):
  957. '''xFrom Parameter'''
  958. bl_idname = 'xFormParameterSocket'
  959. bl_label = "sForm Parameter"
  960. color_simple = cxForm
  961. color : bpy.props.FloatVectorProperty(default=cxForm, size=4)
  962. input : bpy.props.BoolProperty(default =False,)
  963. def init(self):
  964. self.display_shape = 'CIRCLE_DOT'
  965. def draw(self, context, layout, node, text):
  966. ChooseDraw(self, context, layout, node, text)
  967. def draw_color(self, context, node):
  968. return self.color
  969. @classmethod
  970. def draw_color_simple(self):
  971. return self.color_simple
  972. # what is this one again?
  973. class ParameterBoolSocket(MantisSocket):
  974. """Boolean Parameter Socket"""
  975. bl_idname = 'ParameterBoolSocket'
  976. bl_label = "Boolean Parameter"
  977. color_simple = cBool
  978. color : bpy.props.FloatVectorProperty(default=cBool, size=4)
  979. input : bpy.props.BoolProperty(default =False,)
  980. #custom properties:
  981. min:bpy.props.FloatProperty(default = 0)
  982. max:bpy.props.FloatProperty(default = 1)
  983. soft_min:bpy.props.FloatProperty(default = 0)
  984. soft_max:bpy.props.FloatProperty(default = 1)
  985. description:bpy.props.StringProperty(default = "")
  986. default_value : bpy.props.BoolProperty(default = False, update = update_socket,)
  987. def init(self):
  988. self.display_shape = 'CIRCLE_DOT'
  989. # if True:
  990. # print (self.is_property_set("default_value"))
  991. # ui_data = self.id_properties_ui("default_value")
  992. # ui_data.update(
  993. # description=self.description,
  994. # default=0,) # for now
  995. # ui_data.update(
  996. # min = self.min,
  997. # max = self.max,
  998. # soft_min = self.soft_min,
  999. # soft_max = self.soft_max,)
  1000. def draw(self, context, layout, node, text):
  1001. ChooseDraw(self, context, layout, node, text)
  1002. def draw_color(self, context, node):
  1003. return self.color
  1004. @classmethod
  1005. def draw_color_simple(self):
  1006. return self.color_simple
  1007. class ParameterIntSocket(MantisSocket):
  1008. """Integer Parameter socket"""
  1009. bl_idname = 'ParameterIntSocket'
  1010. bl_label = "Integer Parameter"
  1011. default_value : bpy.props.IntProperty(default = 0, update = update_socket,)
  1012. color_simple = cInt
  1013. color : bpy.props.FloatVectorProperty(default=cInt, size=4)
  1014. input : bpy.props.BoolProperty(default =False,)
  1015. #custom properties:
  1016. min:bpy.props.FloatProperty(default = 0)
  1017. max:bpy.props.FloatProperty(default = 1)
  1018. soft_min:bpy.props.FloatProperty(default = 0)
  1019. soft_max:bpy.props.FloatProperty(default = 1)
  1020. description:bpy.props.StringProperty(default = "")
  1021. def init(self):
  1022. self.display_shape = 'CIRCLE_DOT'
  1023. def draw(self, context, layout, node, text):
  1024. ChooseDraw(self, context, layout, node, text)
  1025. def draw_color(self, context, node):
  1026. return self.color
  1027. @classmethod
  1028. def draw_color_simple(self):
  1029. return self.color_simple
  1030. class ParameterFloatSocket(MantisSocket):
  1031. """Float Parameter socket"""
  1032. bl_idname = 'ParameterFloatSocket'
  1033. bl_label = "Float Parameter"
  1034. default_value : bpy.props.FloatProperty(default = 0.0, update = update_socket,)
  1035. color_simple = cFloat
  1036. color : bpy.props.FloatVectorProperty(default=cFloat, size=4)
  1037. input : bpy.props.BoolProperty(default =False,)
  1038. #custom properties:
  1039. min:bpy.props.FloatProperty(default = 0)
  1040. max:bpy.props.FloatProperty(default = 1)
  1041. soft_min:bpy.props.FloatProperty(default = 0)
  1042. soft_max:bpy.props.FloatProperty(default = 1)
  1043. description:bpy.props.StringProperty(default = "")
  1044. def init(self):
  1045. self.display_shape = 'CIRCLE_DOT'
  1046. def draw(self, context, layout, node, text):
  1047. ChooseDraw(self, context, layout, node, text)
  1048. def draw_color(self, context, node):
  1049. return self.color
  1050. @classmethod
  1051. def draw_color_simple(self):
  1052. return self.color_simple
  1053. class ParameterVectorSocket(MantisSocket):
  1054. """Vector Parameter socket"""
  1055. bl_idname = 'ParameterVectorSocket'
  1056. bl_label = "Vector Parameter"
  1057. default_value : bpy.props.FloatVectorProperty(
  1058. default = (0.0, 0.0, 0.0),
  1059. update = update_socket,)
  1060. color_simple = cVector
  1061. color : bpy.props.FloatVectorProperty(default=cVector, size=4)
  1062. input : bpy.props.BoolProperty(default =False,)
  1063. #custom properties:
  1064. description:bpy.props.StringProperty(default = "")
  1065. def init(self):
  1066. self.display_shape = 'CIRCLE_DOT'
  1067. def draw(self, context, layout, node, text):
  1068. ChooseDraw(self, context, layout, node, text)
  1069. def draw_color(self, context, node):
  1070. return self.color
  1071. @classmethod
  1072. def draw_color_simple(self):
  1073. return self.color_simple
  1074. class ParameterStringSocket(MantisSocket):
  1075. """String Parameter socket"""
  1076. bl_idname = 'ParameterStringSocket'
  1077. bl_label = "String Parameter"
  1078. default_value : bpy.props.StringProperty(default = "", update = update_socket,)
  1079. color_simple = cString
  1080. color : bpy.props.FloatVectorProperty(default=cString, size=4)
  1081. input : bpy.props.BoolProperty(default =False,)
  1082. #custom properties:
  1083. description:bpy.props.StringProperty(default = "")
  1084. def init(self):
  1085. self.display_shape = 'CIRCLE_DOT'
  1086. def draw(self, context, layout, node, text):
  1087. ChooseDraw(self, context, layout, node, text)
  1088. def draw_color(self, context, node):
  1089. return self.color
  1090. @classmethod
  1091. def draw_color_simple(self):
  1092. return self.color_simple
  1093. #####################################################################################
  1094. # Additional socket types, for special cases
  1095. #####################################################################################
  1096. from bpy.props import PointerProperty, StringProperty
  1097. def poll_is_armature(self, obj):
  1098. return obj.type == "ARMATURE"
  1099. # def poll_is_armature(self, obj):
  1100. # return obj.type == "ARMATURE"
  1101. class EnumMetaRigSocket(MantisSocket):
  1102. '''Custom node socket type'''
  1103. bl_idname = 'EnumMetaRigSocket'
  1104. bl_label = "Meta Rig"
  1105. search_prop:PointerProperty(type=bpy.types.Object, poll=poll_is_armature, update=update_metarig_armature)
  1106. def get_default_value(self):
  1107. if self.search_prop:
  1108. return self.search_prop.name
  1109. return ""
  1110. def set_default_value(self, value):
  1111. if ob:= bpy.data.objects.get(value):
  1112. if ob.type == 'ARMATURE':
  1113. self.search_prop=ob
  1114. default_value : StringProperty(name = "", get=get_default_value, set=set_default_value)
  1115. color_simple = cString
  1116. color : bpy.props.FloatVectorProperty(default=cString, size=4)
  1117. def draw(self, context, layout, node, text):
  1118. if self.is_output:
  1119. layout.label(text=self.name)
  1120. elif not (self.is_linked):
  1121. layout.prop_search(data=self, property="search_prop", search_data=bpy.data, search_property="objects", text="", icon="OUTLINER_OB_ARMATURE", results_are_suggestions=True)
  1122. elif hasattr(self.node, "armature"):
  1123. layout.label(text=self.node.armature)
  1124. # TODO: we should actually use the parsed tree to query this info directly, since this socket may belong to a node group in/out
  1125. # which doesn't have this parameter. whatever.
  1126. else:
  1127. layout.label(text=self.name)
  1128. def draw_color(self, context, node):
  1129. return self.color
  1130. @classmethod
  1131. def draw_color_simple(self):
  1132. return self.color_simple
  1133. def poll_is_curve(self, obj):
  1134. return obj.type == "CURVE"
  1135. class EnumCurveSocket(MantisSocket):
  1136. '''Choose a curve'''
  1137. bl_idname = 'EnumCurveSocket'
  1138. bl_label = "Curve"
  1139. is_valid_interface_type=True
  1140. search_prop:PointerProperty(type=bpy.types.Object, poll=poll_is_curve, update=update_socket)
  1141. def get_default_value(self):
  1142. if self.search_prop:
  1143. return self.search_prop.name
  1144. return ""
  1145. def set_default_value(self, value):
  1146. if ob:= bpy.data.objects.get(value):
  1147. if ob.type == 'CURVE':
  1148. self.search_prop=ob
  1149. default_value : StringProperty(name = "", get=get_default_value, set=set_default_value)
  1150. color_simple = cString
  1151. color : bpy.props.FloatVectorProperty(default=cString, size=4)
  1152. def draw(self, context, layout, node, text):
  1153. if not (self.is_linked) and not self.is_output:
  1154. layout.prop_search(data=self, property="search_prop", search_data=bpy.data, search_property="objects", text="", icon="CURVE_DATA", results_are_suggestions=True)
  1155. else:
  1156. try:
  1157. layout.label(text=self.search_prop.name)
  1158. except AttributeError: # TODO make this show the graph's result
  1159. layout.label(text=self.name)
  1160. def draw_color(self, context, node):
  1161. return self.color
  1162. @classmethod
  1163. def draw_color_simple(self):
  1164. return self.color_simple
  1165. def SearchPBDraw(self, context, layout, node, text, icon = "NONE", use_enum=True, nice_bool=True, icon_only=False):
  1166. 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)
  1167. class EnumMetaBoneSocket(MantisSocket):
  1168. '''Custom node socket type'''
  1169. bl_idname = 'EnumMetaBoneSocket'
  1170. bl_label = "Meta Bone"
  1171. search_prop:PointerProperty(type=bpy.types.Object)
  1172. bone:StringProperty()
  1173. def populate_bones_list(self, context):
  1174. # just gonna hardcode the value
  1175. if (meta_rig := self.search_prop):
  1176. retList = []
  1177. armatures = []
  1178. i = -1
  1179. retList.append( ('NONE', '', '', 'NONE', i:=i+1 ) )
  1180. for b in meta_rig.data.bones:
  1181. retList.append( (b.name, b.name, "Bone to copy matrix from", "BONE_DATA", i:=i+1 ) )
  1182. return(retList)
  1183. return None
  1184. # default_value : bpy.props.EnumProperty(
  1185. # items = populate_bones_list,
  1186. # name = "Meta Rig")
  1187. # def get_default_value(self):
  1188. # return self.search_prop.name
  1189. default_value : StringProperty(name = "", update=update_metarig_posebone)
  1190. color_simple = cString
  1191. color : bpy.props.FloatVectorProperty(default=cString, size=4)
  1192. def draw(self, context, layout, node, text):
  1193. if not (self.is_linked):
  1194. if self.search_prop is None:
  1195. layout.prop(self, "default_value", text="", icon="BONE_DATA",)
  1196. else:
  1197. SearchPBDraw(self, context, layout, node, text="")
  1198. else:
  1199. layout.label(text=self.node.pose_bone)
  1200. def draw_color(self, context, node):
  1201. return self.color
  1202. @classmethod
  1203. def draw_color_simple(self):
  1204. return self.color_simple
  1205. # TODO: make it so that this makes an item for "missing" widgets
  1206. # for when a widget is moved or deleted
  1207. # Make it read .blend
  1208. # make it read the current directory, too?
  1209. def get_widget_library_items(self, context):
  1210. from .preferences import get_bl_addon_object
  1211. bl_mantis_addon = get_bl_addon_object()
  1212. return_value = [('NONE', 'None', 'None', 'ERROR', 0)]
  1213. widget_names={}
  1214. if bl_mantis_addon:
  1215. widgets_path = bl_mantis_addon.preferences.WidgetsLibraryFolder
  1216. import os
  1217. for path_root, dirs, files, in os.walk(widgets_path):
  1218. # TODO handle .blend files
  1219. # for file in files: # check .blend files first, objs should take precedence
  1220. # if file.endswith('.blend'):
  1221. # widget_names[file[:-6]] = os.path.join(path_root, file)
  1222. for file in files:
  1223. if file.endswith('.obj'):
  1224. widget_names[file[:-4]] = os.path.join(path_root, file)
  1225. if widget_names.keys():
  1226. return_value=[]
  1227. for i, (name, path) in enumerate(widget_names.items()):
  1228. return_value.append( (path, name, path, 'GIZMO', i) )
  1229. return return_value
  1230. # THIS is a special socket type that finds the widgets in your widgets library (set in preferences)
  1231. class EnumWidgetLibrarySocket(MantisSocket):
  1232. '''Choose a Wdiget'''
  1233. bl_idname = 'EnumWidgetLibrarySocket'
  1234. bl_label = "Widget"
  1235. is_valid_interface_type=False
  1236. default_value : bpy.props.EnumProperty(
  1237. items=get_widget_library_items,
  1238. name="Widget",
  1239. description="Which widget to use",
  1240. default = 0,
  1241. update = update_socket,)
  1242. color_simple = cString
  1243. color : bpy.props.FloatVectorProperty(default=cString, size=4)
  1244. def draw(self, context, layout, node, text):
  1245. ChooseDraw(self, context, layout, node, text, use_enum=False)
  1246. def draw_color(self, context, node):
  1247. return self.color
  1248. @classmethod
  1249. def draw_color_simple(self):
  1250. return self.color_simple
  1251. class BoolUpdateParentNode(MantisSocket):
  1252. '''Custom node socket type'''
  1253. bl_idname = 'BoolUpdateParentNode'
  1254. bl_label = "Boolean"
  1255. default_value: bpy.props.BoolProperty(default=False, update = update_parent_node)
  1256. color_simple = cBool
  1257. color : bpy.props.FloatVectorProperty(default=cBool, size=4)
  1258. input : bpy.props.BoolProperty(default =False,)
  1259. def draw(self, context, layout, node, text):
  1260. ChooseDraw(self, context, layout, node, text)
  1261. def draw_color(self, context, node):
  1262. return self.color
  1263. @classmethod
  1264. def draw_color_simple(self):
  1265. return self.color_simple
  1266. class IKChainLengthSocket(MantisSocket):
  1267. '''Custom node socket type'''
  1268. bl_idname = 'IKChainLengthSocket'
  1269. bl_label = "IK Chain Length"
  1270. default_value: bpy.props.IntProperty(default=0, update = ik_chain_length_update_socket, min = 0, max = 255)
  1271. color_simple = cInt
  1272. color : bpy.props.FloatVectorProperty(default=cInt, size=4)
  1273. input : bpy.props.BoolProperty(default =False,)
  1274. def draw(self, context, layout, node, text):
  1275. ChooseDraw(self, context, layout, node, text)
  1276. def draw_color(self, context, node):
  1277. return self.color
  1278. @classmethod
  1279. def draw_color_simple(self):
  1280. return self.color_simple
  1281. # Inherit
  1282. eInheritScale = (
  1283. ('FULL', "Full", "Fully inherit scale", 1),
  1284. ('AVERAGE', "Average", "todo", 2),
  1285. ('ALIGNED', "Aligned", "todo", 3),
  1286. ('FIX_SHEAR', "Fix Shear", "todo", 4),
  1287. ('NONE', "None", "todo", 5),
  1288. )
  1289. class EnumInheritScale(MantisSocket):
  1290. '''Custom node socket type'''
  1291. bl_idname = 'EnumInheritScale'
  1292. bl_label = "Inherit Scale"
  1293. default_value: bpy.props.EnumProperty(
  1294. items=eInheritScale,
  1295. name="Inherit Scale",
  1296. description="Inherit Scale",
  1297. default = 'FULL',
  1298. #options = set(),
  1299. update = update_socket,)
  1300. color_simple = cString
  1301. color : bpy.props.FloatVectorProperty(default=cString, size=4)
  1302. input : bpy.props.BoolProperty(default =False,)
  1303. def draw(self, context, layout, node, text):
  1304. ChooseDraw(self, context, layout, node, text)
  1305. def draw_color(self, context, node):
  1306. return self.color
  1307. @classmethod
  1308. def draw_color_simple(self):
  1309. return self.color_simple
  1310. # Copy Rotation
  1311. eRotationMix =(
  1312. ('REPLACE', "Replace", "Fully inherit scale", 0),
  1313. ('BEFORE', "Before", "Fully inherit scale", 1),
  1314. ('AFTER', "After", "Fully inherit scale", 2),
  1315. ('ADD', "Add", "Fully inherit scale", 3),
  1316. #todo, but i don't care much
  1317. )
  1318. # TODO HACK
  1319. # I am trying to figure out how to do enum_flag as
  1320. # mutually exclusive options
  1321. # but! I don't think it's possible
  1322. # I just like the UI for it :P
  1323. class EnumRotationMix(MantisSocket):
  1324. '''Custom node socket type'''
  1325. bl_idname = 'EnumRotationMix'
  1326. bl_label = "Rotation Mix"
  1327. default_value: bpy.props.EnumProperty(
  1328. items=eRotationMix,
  1329. name="Rotation Mix",
  1330. description="Rotation Mix",
  1331. default = 'REPLACE',#{'REPLACE'},
  1332. options = set(), # this has to be a set lol
  1333. update = update_socket,)
  1334. color_simple = cString
  1335. color : bpy.props.FloatVectorProperty(default=cString, size=4)
  1336. input : bpy.props.BoolProperty(default =False,)
  1337. def draw(self, context, layout, node, text):
  1338. ChooseDraw(self, context, layout, node, text)
  1339. def draw_color(self, context, node):
  1340. return self.color
  1341. @classmethod
  1342. def draw_color_simple(self):
  1343. return self.color_simple
  1344. eRotationMix_copytransforms =(
  1345. ('REPLACE', "Replace (Aligned)", "Fully inherit scale"),
  1346. ('BEFORE', "Before (Aligned)", "Fully inherit scale"),
  1347. ('AFTER', "After (Aligned)", "Fully inherit scale"),
  1348. ('REPLACE_SPLIT', "Replace (Split Channels)", "Fully inherit scale"),
  1349. ('BEFORE_SPLIT', "Before (Split Channels)", "Fully inherit scale"),
  1350. ('AFTER_SPLIT', "After (Split Channels)", "Fully inherit scale"),
  1351. ('REPLACE_FULL', "Replace (Full)", "Fully inherit scale"),
  1352. ('BEFORE_FULL', "Before (Full)", "Fully inherit scale"),
  1353. ('AFTER_FULL', "After (Full)", "Fully inherit scale"),)
  1354. class EnumRotationMixCopyTransforms(MantisSocket):
  1355. '''Custom node socket type'''
  1356. bl_idname = 'EnumRotationMixCopyTransforms'
  1357. bl_label = "Rotation Mix"
  1358. default_value: bpy.props.EnumProperty(
  1359. items=eRotationMix_copytransforms,
  1360. name="Rotation Mix",
  1361. description="Rotation Mix",
  1362. default = 'REPLACE', #{'REPLACE'},
  1363. #options = {'ENUM_FLAG'}, # this sux
  1364. update = update_socket,)
  1365. color_simple = cString
  1366. color : bpy.props.FloatVectorProperty(default=cString, size=4)
  1367. input : bpy.props.BoolProperty(default =False,)
  1368. def draw(self, context, layout, node, text):
  1369. ChooseDraw(self, context, layout, node, text)
  1370. def draw_color(self, context, node):
  1371. return self.color
  1372. @classmethod
  1373. def draw_color_simple(self):
  1374. return self.color_simple
  1375. # STRETCH TO
  1376. eMaintainVolumeStretchTo = (('VOLUME_XZX', "XZ", "XZ", 1),
  1377. ('VOLUME_X', "X", "X", 2),
  1378. ('VOLUME_Z', "Z", "Z", 4),
  1379. ('NO_VOLUME', "None", "None", 8),)
  1380. class EnumMaintainVolumeStretchTo(MantisSocket):
  1381. '''Custom node socket type'''
  1382. bl_idname = 'EnumMaintainVolumeStretchToSocket'
  1383. bl_label = "Maintain Volume"
  1384. default_value: bpy.props.EnumProperty(
  1385. items=eMaintainVolumeStretchTo,
  1386. name="Maintain Volume",
  1387. description="Maintain Volume",
  1388. default = 'VOLUME_XZX',
  1389. #options = {'ENUM_FLAG'},
  1390. update = update_socket,)
  1391. color_simple = cString
  1392. color : bpy.props.FloatVectorProperty(default=cString, size=4)
  1393. input : bpy.props.BoolProperty(default =False,)
  1394. def draw(self, context, layout, node, text):
  1395. ChooseDraw(self, context, layout, node, text)
  1396. def draw_color(self, context, node):
  1397. return self.color
  1398. @classmethod
  1399. def draw_color_simple(self):
  1400. return self.color_simple
  1401. eRotationStretchTo = (('PLANE_X', "XZ", "XZ", 1),
  1402. ('PLANE_Z', "ZX", "ZX", 2),
  1403. ('SWING_Y', "Swing", "Swing", 4),)
  1404. class EnumRotationStretchTo(MantisSocket):
  1405. '''Custom node socket type'''
  1406. bl_idname = 'EnumRotationStretchTo'
  1407. bl_label = "Rotation"
  1408. default_value: bpy.props.EnumProperty(
  1409. items=eRotationStretchTo,
  1410. name="Rotation",
  1411. description="Rotation",
  1412. default = 'PLANE_X',
  1413. #options = {'ENUM_FLAG'},
  1414. update = update_socket,)
  1415. color_simple = cString
  1416. color : bpy.props.FloatVectorProperty(default=cString, size=4)
  1417. input : bpy.props.BoolProperty(default =False,)
  1418. def draw(self, context, layout, node, text):
  1419. ChooseDraw(self, context, layout, node, text)
  1420. def draw_color(self, context, node):
  1421. return self.color
  1422. @classmethod
  1423. def draw_color_simple(self):
  1424. return self.color_simple
  1425. # Track-To
  1426. eTrackAxis = (('TRACK_X', "X", "X", 1),
  1427. ('TRACK_Y', "Y", "Y", 2),
  1428. ('TRACK_Z', "Z", "Z", 4),
  1429. ('TRACK_NEGATIVE_X', "-X", "-X", 8),
  1430. ('TRACK_NEGATIVE_Y', "-Y", "-Y", 16),
  1431. ('TRACK_NEGATIVE_Z', "-Z", "-Z", 32,))
  1432. eUpAxis = (('UP_X', "X", "X", 1),
  1433. ('UP_Y', "Y", "Y", 2),
  1434. ('UP_Z', "Z", "Z", 4),)
  1435. # ugly but I can't change it easily without messing up versioning
  1436. class EnumTrackAxis(MantisSocket):
  1437. '''Custom node socket type'''
  1438. bl_idname = 'EnumTrackAxis'
  1439. bl_label = "Track Axis"
  1440. default_value: bpy.props.EnumProperty(
  1441. items=eTrackAxis,
  1442. name="Track Axis",
  1443. description="Track Axis",
  1444. default = 'TRACK_X',
  1445. #options = {'ENUM_FLAG'},
  1446. update = update_socket,)
  1447. color_simple = cString
  1448. color : bpy.props.FloatVectorProperty(default=cString, size=4)
  1449. input : bpy.props.BoolProperty(default =False,)
  1450. def draw(self, context, layout, node, text):
  1451. ChooseDraw(self, context, layout, node, text)
  1452. def draw_color(self, context, node):
  1453. return self.color
  1454. @classmethod
  1455. def draw_color_simple(self):
  1456. return self.color_simple
  1457. class EnumUpAxis(MantisSocket):
  1458. '''Custom node socket type'''
  1459. bl_idname = 'EnumUpAxis'
  1460. bl_label = "Up Axis"
  1461. default_value: bpy.props.EnumProperty(
  1462. items=eUpAxis,
  1463. name="Up Axis",
  1464. description="Up Axis",
  1465. default = 'UP_X',
  1466. #options = {'ENUM_FLAG'},
  1467. update = update_socket,)
  1468. color_simple = cString
  1469. color : bpy.props.FloatVectorProperty(default=cString, size=4)
  1470. input : bpy.props.BoolProperty(default =False,)
  1471. def draw(self, context, layout, node, text):
  1472. ChooseDraw(self, context, layout, node, text)
  1473. def draw_color(self, context, node):
  1474. return self.color
  1475. @classmethod
  1476. def draw_color_simple(self):
  1477. return self.color_simple
  1478. # Follow Track Forward axis
  1479. eForwardAxis = (('FORWARD_X', "X", "X", 0),
  1480. ('FORWARD_Y', "Y", "Y", 1),
  1481. ('FORWARD_Z', "Z", "Z", 2),
  1482. ('TRACK_NEGATIVE_X', "-X", "-X", 3),
  1483. ('TRACK_NEGATIVE_Y', "-Y", "-Y", 4),
  1484. ('TRACK_NEGATIVE_Z', "-Z", "-Z", 5),)
  1485. class EnumFollowPathForwardAxis(MantisSocket):
  1486. '''Custom node socket type'''
  1487. bl_idname = 'EnumFollowPathForwardAxis'
  1488. bl_label = "Forward Axis"
  1489. default_value: bpy.props.EnumProperty(
  1490. items=eForwardAxis,
  1491. name="Forward Axis",
  1492. description="Forward Axis",
  1493. default = 'FORWARD_X',
  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. # Follow Track Forward axis
  1506. eFloorAxis = (('FLOOR_X', "X", "X", 0),
  1507. ('FLOOR_Y', "Y", "Y", 1),
  1508. ('FLOOR_Z', "Z", "Z", 2),
  1509. ('FLOOR_NEGATIVE_X', "-X", "-X", 3),
  1510. ('FLOOR_NEGATIVE_Y', "-Y", "-Y", 4),
  1511. ('FLOOR_NEGATIVE_Z', "-Z", "-Z", 5),)
  1512. class EnumFloorAxis(MantisSocket):
  1513. '''Floor Constraint Axis'''
  1514. bl_idname = 'EnumFloorAxis'
  1515. bl_label = "Floor Axis"
  1516. default_value: bpy.props.EnumProperty(
  1517. items=eFloorAxis,
  1518. name="Floor Axis",
  1519. description="Floor Axis",
  1520. default = 'FLOOR_X',
  1521. update = update_socket,)
  1522. color_simple = cString
  1523. color : bpy.props.FloatVectorProperty(default=cString, size=4)
  1524. input : bpy.props.BoolProperty(default =False,)
  1525. def draw(self, context, layout, node, text):
  1526. ChooseDraw(self, context, layout, node, text)
  1527. def draw_color(self, context, node):
  1528. return self.color
  1529. @classmethod
  1530. def draw_color_simple(self):
  1531. return self.color_simple
  1532. # Locked Track
  1533. eLockAxis = (('LOCK_X', "X", "X", 1),
  1534. ('LOCK_Y', "Y", "Y", 2),
  1535. ('LOCK_Z', "Z", "Z", 4),)
  1536. class EnumLockAxis(MantisSocket):
  1537. '''Custom node socket type'''
  1538. bl_idname = 'EnumLockAxis'
  1539. bl_label = "Lock Axis"
  1540. default_value: bpy.props.EnumProperty(
  1541. items=eLockAxis,
  1542. name="Lock Axis",
  1543. description="Lock Axis",
  1544. default = 'LOCK_X',
  1545. #options = {'ENUM_FLAG'},
  1546. update = update_socket,)
  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)
  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. # Limit Distance:
  1558. eLimitMode = (('LIMITDIST_INSIDE', "Inside", "Inside",),
  1559. ('LIMITDIST_OUTSIDE', "Outside", "Outside",),
  1560. ('LIMITDIST_ONSURFACE', "On Surface", "On Surface",),)
  1561. class EnumLimitMode(MantisSocket):
  1562. '''Custom node socket type'''
  1563. bl_idname = 'EnumLimitMode'
  1564. bl_label = "Clamp Region"
  1565. default_value: bpy.props.EnumProperty(
  1566. items=eLimitMode,
  1567. name="Clamp Region",
  1568. description="Clamp Region",
  1569. default = 'LIMITDIST_INSIDE',
  1570. update = update_socket,)
  1571. color_simple = cString
  1572. color : bpy.props.FloatVectorProperty(default=cString, size=4)
  1573. input : bpy.props.BoolProperty(default =False,)
  1574. def draw(self, context, layout, node, text):
  1575. ChooseDraw(self, context, layout, node, text)
  1576. def draw_color(self, context, node):
  1577. return self.color
  1578. @classmethod
  1579. def draw_color_simple(self):
  1580. return self.color_simple
  1581. # Spline IK
  1582. eYScaleMode = (('NONE', "None", "Don’t scale the X and Z axes.",),
  1583. ('FIT_CURVE', "Fit Curve", "Scale the bones to fit the entire length of the curve.",),
  1584. ('BONE_ORIGINAL', "Bone Original", "Use the original scaling of the bones.",),)
  1585. eXZScaleMode = (('NONE', "None", "Don’t scale the X and Z axes.",),
  1586. ('BONE_ORIGINAL', "Bone Original", "Use the original scaling of the bones.",),
  1587. ('INVERSE_PRESERVE', "Inverse Scale", "Scale of the X and Z axes is the inverse of the Y-Scale.",),
  1588. ('VOLUME_PRESERVE', "Volume Preservation", "Scale of the X and Z axes are adjusted to preserve the volume of the bones.",),)
  1589. class EnumYScaleMode(MantisSocket):
  1590. '''Custom node socket type'''
  1591. bl_idname = 'EnumYScaleMode'
  1592. bl_label = "Y Scale Mode"
  1593. default_value: bpy.props.EnumProperty(
  1594. items=eYScaleMode,
  1595. name="Y Scale Mode",
  1596. description="Y Scale Mode",
  1597. default = 'FIT_CURVE',
  1598. update = update_socket,)
  1599. color_simple = cString
  1600. color : bpy.props.FloatVectorProperty(default=cString, size=4)
  1601. input : bpy.props.BoolProperty(default =False,)
  1602. def draw(self, context, layout, node, text):
  1603. ChooseDraw(self, context, layout, node, text)
  1604. def draw_color(self, context, node):
  1605. return self.color
  1606. @classmethod
  1607. def draw_color_simple(self):
  1608. return self.color_simple
  1609. class EnumXZScaleMode(MantisSocket):
  1610. '''Custom node socket type'''
  1611. bl_idname = 'EnumXZScaleMode'
  1612. bl_label = "XZ Scale Mode"
  1613. default_value: bpy.props.EnumProperty(
  1614. items=eXZScaleMode,
  1615. name="XZ Scale Mode",
  1616. description="XZ Scale Mode",
  1617. default = 'NONE',
  1618. update = update_socket,)
  1619. color_simple = cString
  1620. color : bpy.props.FloatVectorProperty(default=cString, size=4)
  1621. input : bpy.props.BoolProperty(default =False,)
  1622. def draw(self, context, layout, node, text):
  1623. ChooseDraw(self, context, layout, node, text)
  1624. def draw_color(self, context, node):
  1625. return self.color
  1626. @classmethod
  1627. def draw_color_simple(self):
  1628. return self.color_simple
  1629. eMapxForm = (('LOCATION', "Location", "Location",),
  1630. ('ROTATION', "Rotation", "Rotation",),
  1631. ('SCALE', "Scale", "Scale",),)
  1632. eRotationMode = (('AUTO', 'Auto', 'Automattically Selected.', 0),
  1633. ('XYZ', "XYZ", "Euler using the XYZ rotation order", 1),
  1634. ('XZY', "XZY", "Euler using the XZY rotation order", 2),
  1635. ('ZXY', "ZXY", "Euler using the ZXY rotation order", 3),
  1636. ('ZYX', "ZYX", "Euler using the ZYX rotation order", 4),
  1637. ('YXZ', "YXZ", "Euler using the YXZ rotation order", 5),
  1638. ('YZX', "YZX", "Euler using the YZX rotation order", 6),
  1639. ('QUATERNION', "Quaternion", "Quaternion", 7),
  1640. ('SWING_TWIST_X', 'Swing and X Twist.', 'Decompose into a swing rotation to aim the X axis, followed by twist around it.', 8),
  1641. ('SWING_TWIST_Y', 'Swing and Y Twist.', 'Decompose into a swing rotation to aim the Y axis, followed by twist around it.', 9),
  1642. ('SWING_TWIST_Z', 'Swing and Z Twist.', 'Decompose into a swing rotation to aim the Z axis, followed by twist around it.', 10),)
  1643. enumTransformationRotationOrder = enumRotationOrder[:6]
  1644. eTranslationMix =(
  1645. ('ADD', "Add", "", 0),
  1646. ('REPLACE', "Replace", "", 1),
  1647. )
  1648. eScaleMix =(
  1649. ('MULTIPLY', "Multiply", "", 0),
  1650. ('REPLACE', "Replace", "", 1),
  1651. )
  1652. class EnumTransformationMap(MantisSocket):
  1653. '''Custom node socket type'''
  1654. bl_idname = 'EnumTransformationMap'
  1655. bl_label = "Map To/From"
  1656. default_value: bpy.props.EnumProperty(
  1657. items=eMapxForm,
  1658. name="Map To/From",
  1659. description="Map To/From",
  1660. default = 'LOCATION',
  1661. update = update_socket,)
  1662. color_simple = cString
  1663. color : bpy.props.FloatVectorProperty(default=cString, size=4)
  1664. input : bpy.props.BoolProperty(default =False,)
  1665. def draw(self, context, layout, node, text):
  1666. ChooseDraw(self, context, layout, node, text)
  1667. def draw_color(self, context, node):
  1668. return self.color
  1669. @classmethod
  1670. def draw_color_simple(self):
  1671. return self.color_simple
  1672. class EnumTransformationRotationMode(MantisSocket):
  1673. '''Custom node socket type'''
  1674. bl_idname = 'EnumTransformationRotationMode'
  1675. bl_label = "Map To/From"
  1676. default_value: bpy.props.EnumProperty(
  1677. items=eRotationMode,
  1678. name="Rotation Mode",
  1679. description="Rotation Mode",
  1680. default = 'AUTO',
  1681. update = update_socket,)
  1682. color_simple = cString
  1683. color : bpy.props.FloatVectorProperty(default=cString, size=4)
  1684. input : bpy.props.BoolProperty(default =False,)
  1685. def draw(self, context, layout, node, text):
  1686. ChooseDraw(self, context, layout, node, text, use_enum=False)
  1687. def draw_color(self, context, node):
  1688. return self.color
  1689. @classmethod
  1690. def draw_color_simple(self):
  1691. return self.color_simple
  1692. class EnumTransformationRotationOrder(MantisSocket):
  1693. '''Custom node socket type'''
  1694. bl_idname = 'EnumTransformationRotationOrder'
  1695. bl_label = "Map To/From"
  1696. default_value: bpy.props.EnumProperty(
  1697. items=enumTransformationRotationOrder,
  1698. name="Rotation Order",
  1699. description="Rotation Order",
  1700. default = 'AUTO',
  1701. update = update_socket,)
  1702. color_simple = cString
  1703. color : bpy.props.FloatVectorProperty(default=cString, size=4)
  1704. input : bpy.props.BoolProperty(default =False,)
  1705. def draw(self, context, layout, node, text):
  1706. ChooseDraw(self, context, layout, node, text, use_enum=False)
  1707. def draw_color(self, context, node):
  1708. return self.color
  1709. @classmethod
  1710. def draw_color_simple(self):
  1711. return self.color_simple
  1712. class EnumTransformationTranslationMixMode(MantisSocket):
  1713. '''Custom node socket type'''
  1714. bl_idname = 'EnumTransformationTranslationMixMode'
  1715. bl_label = "Mix Mode"
  1716. default_value: bpy.props.EnumProperty(
  1717. items=eTranslationMix,
  1718. name="Mix Translation",
  1719. description="Mix Translation",
  1720. default = 'ADD',
  1721. update = update_socket,)
  1722. color_simple = cString
  1723. color : bpy.props.FloatVectorProperty(default=cString, size=4)
  1724. input : bpy.props.BoolProperty(default =False,)
  1725. def draw(self, context, layout, node, text):
  1726. ChooseDraw(self, context, layout, node, text, use_enum=False)
  1727. def draw_color(self, context, node):
  1728. return self.color
  1729. @classmethod
  1730. def draw_color_simple(self):
  1731. return self.color_simple
  1732. class EnumTransformationRotationMixMode(MantisSocket):
  1733. '''Custom node socket type'''
  1734. bl_idname = 'EnumTransformationRotationMixMode'
  1735. bl_label = "Mix Mode"
  1736. default_value: bpy.props.EnumProperty(
  1737. items=eRotationMix,
  1738. name="Mix Rotation",
  1739. description="Mix Rotation",
  1740. default = 'ADD',
  1741. update = update_socket,)
  1742. color_simple = cString
  1743. color : bpy.props.FloatVectorProperty(default=cString, size=4)
  1744. input : bpy.props.BoolProperty(default =False,)
  1745. def draw(self, context, layout, node, text):
  1746. ChooseDraw(self, context, layout, node, text, use_enum=False)
  1747. def draw_color(self, context, node):
  1748. return self.color
  1749. @classmethod
  1750. def draw_color_simple(self):
  1751. return self.color_simple
  1752. class EnumTransformationScaleMixMode(MantisSocket):
  1753. '''Custom node socket type'''
  1754. bl_idname = 'EnumTransformationScaleMixMode'
  1755. bl_label = "Mix Mode"
  1756. default_value: bpy.props.EnumProperty(
  1757. items=eScaleMix,
  1758. name="Mix Scale",
  1759. description="Mix Scale",
  1760. default = 'REPLACE',
  1761. update = update_socket,)
  1762. color_simple = cString
  1763. color : bpy.props.FloatVectorProperty(default=cString, size=4)
  1764. input : bpy.props.BoolProperty(default =False,)
  1765. def draw(self, context, layout, node, text):
  1766. ChooseDraw(self, context, layout, node, text, use_enum=False)
  1767. def draw_color(self, context, node):
  1768. return self.color
  1769. @classmethod
  1770. def draw_color_simple(self):
  1771. return self.color_simple
  1772. eAxes = (
  1773. ('X', "X", "X", 0),
  1774. ('Y', "Y", "Y", 1),
  1775. ('Z', "Z", "Z", 2),
  1776. )
  1777. class EnumTransformationAxes(MantisSocket):
  1778. '''Custom node socket type'''
  1779. bl_idname = 'EnumTransformationAxes'
  1780. bl_label = "Axes"
  1781. default_value: bpy.props.EnumProperty(
  1782. items=eAxes,
  1783. # name="",
  1784. # description="",
  1785. default = 'X',
  1786. update = update_socket,)
  1787. color_simple = cString
  1788. color : bpy.props.FloatVectorProperty(default=cString, size=4)
  1789. input : bpy.props.BoolProperty(default =False,)
  1790. def draw(self, context, layout, node, text):
  1791. ChooseDraw(self, context, layout, node, text, use_enum=False)
  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. #
  1798. eBBoneHandleType = (
  1799. ('AUTO', "Automatic", "", 0),
  1800. ('ABSOLUTE', "Absolute", "", 1),
  1801. ('RELATIVE', "Relative", "", 2),
  1802. ('TANGENT', "Tangent", "", 3),
  1803. )
  1804. class EnumBBoneHandleType(MantisSocket):
  1805. '''Custom node socket type'''
  1806. bl_idname = 'EnumBBoneHandleType'
  1807. bl_label = "Axes"
  1808. default_value: bpy.props.EnumProperty(
  1809. items=eBBoneHandleType,
  1810. # name="",
  1811. # description="",
  1812. default = 'AUTO',
  1813. update = update_socket,)
  1814. color_simple = cString
  1815. color : bpy.props.FloatVectorProperty(default=cString, size=4)
  1816. input : bpy.props.BoolProperty(default =False,)
  1817. def draw(self, context, layout, node, text):
  1818. ChooseDraw(self, context, layout, node, text, use_enum=False)
  1819. def draw_color(self, context, node):
  1820. return self.color
  1821. @classmethod
  1822. def draw_color_simple(self):
  1823. return self.color_simple
  1824. eSkinningMethod = (('EXISTING_GROUPS', "Use Existing Groups", "Use the existing vertex groups, or create empty groups if not found.",),
  1825. ('AUTOMATIC_HEAT', "Automatic (Heat)", "Use Blender's heatmap automatic skinning",),
  1826. ('COPY_FROM_OBJECT', "Copy from object", "Copy skin weights from the selected object"),)
  1827. class EnumSkinning(MantisSocket):
  1828. '''Custom node socket type'''
  1829. bl_idname = 'EnumSkinning'
  1830. bl_label = "Skinning Method"
  1831. default_value: bpy.props.EnumProperty(
  1832. items=eSkinningMethod,
  1833. name="Skinning Method",
  1834. description="Skinning Method",
  1835. default = 'AUTOMATIC_HEAT',
  1836. update = update_socket,)
  1837. color_simple = cString
  1838. color : bpy.props.FloatVectorProperty(default=cString, size=4)
  1839. input : bpy.props.BoolProperty(default =False,)
  1840. def draw(self, context, layout, node, text):
  1841. ChooseDraw(self, context, layout, node, text)
  1842. def draw_color(self, context, node):
  1843. return self.color
  1844. @classmethod
  1845. def draw_color_simple(self):
  1846. return self.color_simple
  1847. class MorphTargetSocket(MantisSocket):
  1848. """Morph Target"""
  1849. bl_idname = 'MorphTargetSocket'
  1850. bl_label = "Morph Target"
  1851. color_simple = cShapeKey
  1852. color : bpy.props.FloatVectorProperty(default=cShapeKey, size=4)
  1853. input : bpy.props.BoolProperty(default =False,)
  1854. is_valid_interface_type=True
  1855. def draw(self, context, layout, node, text):
  1856. ChooseDraw(self, context, layout, node, text)
  1857. def draw_color(self, context, node):
  1858. return self.color
  1859. @classmethod
  1860. def draw_color_simple(self):
  1861. return self.color_simple
  1862. eDriverVariableType = (
  1863. ( 'SINGLE_PROP',
  1864. "Property",
  1865. "Property",
  1866. 1),
  1867. ( 'LOC_DIFF',
  1868. "Distance",
  1869. "Distance",
  1870. 2),
  1871. ( 'ROTATION_DIFF',
  1872. "Rotational Difference",
  1873. "Rotational Difference",
  1874. 3),
  1875. # ( 'TRANSFORMS',
  1876. # "Transform Channel",
  1877. # "Transform Channel",
  1878. # 4),
  1879. )
  1880. class EnumDriverVariableType(MantisSocket):
  1881. '''Custom node socket type'''
  1882. bl_idname = 'EnumDriverVariableType'
  1883. bl_label = "Variable Type"
  1884. default_value: bpy.props.EnumProperty(
  1885. items = eDriverVariableType,
  1886. name = "Variable Type",
  1887. description = "Variable Type",
  1888. default = 'SINGLE_PROP',
  1889. update = driver_variable_socket_update,)
  1890. color_simple = cString
  1891. color : bpy.props.FloatVectorProperty(default=cString, size=4)
  1892. input : bpy.props.BoolProperty(default =False,)
  1893. def draw(self, context, layout, node, text):
  1894. ChooseDraw(self, context, layout, node, text, use_enum=False)
  1895. def draw_color(self, context, node):
  1896. return self.color
  1897. @classmethod
  1898. def draw_color_simple(self):
  1899. return self.color_simple
  1900. eDriverVariableEvaluationSpace = (
  1901. ( 'WORLD_SPACE',
  1902. "World",
  1903. "World",
  1904. 1),
  1905. ( 'TRANSFORM_SPACE',
  1906. "Transform",
  1907. "Transform",
  1908. 2),
  1909. ( 'LOCAL_SPACE',
  1910. "Local",
  1911. "Local",
  1912. 3),
  1913. )
  1914. class EnumDriverVariableEvaluationSpace(MantisSocket):
  1915. '''Custom node socket type'''
  1916. bl_idname = 'EnumDriverVariableEvaluationSpace'
  1917. bl_label = "Evaluation Space"
  1918. default_value: bpy.props.EnumProperty(
  1919. items = eDriverVariableEvaluationSpace,
  1920. name = "Evaluation Space",
  1921. description = "Evaluation Space",
  1922. default = 'WORLD_SPACE',
  1923. update = driver_variable_socket_update,)
  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, use_enum=False)
  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. eDriverVariableTransformChannel = (
  1935. ("LOC_X", "X Location", "The X-coordinate of an object's location.", 1),
  1936. ("LOC_Y", "Y Location", "The Y-coordinate of an object's location.", 2),
  1937. ("LOC_Z", "Z Location", "The Z-coordinate of an object's location.", 3),
  1938. ("ROT_X", "X Rotation", "Rotation X-axis.", 4),
  1939. ("ROT_Y", "Y Rotation", "Rotation Y-axis.", 5),
  1940. ("ROT_Z", "Z Rotation", "Rotation Z-axis.", 6),
  1941. ("ROT_W", "W Rotation", "Rotation W-axis.", 7),
  1942. ("SCALE_X", "X Scale", "The X-scale of an object's scale.", 8),
  1943. ("SCALE_Y", "Y Scale", "The Y-scale of an object's scale.", 9),
  1944. ("SCALE_Z", "Z Scale", "The Z-scale of an object's scale.", 10),
  1945. ("SCALE_AVG", "Average Scale", "The scale factor of an object's scale.", 11),
  1946. )
  1947. class EnumDriverVariableTransformChannel(MantisSocket):
  1948. '''Custom node socket type'''
  1949. bl_idname = 'EnumDriverVariableTransformChannel'
  1950. bl_label = "Transform Channel"
  1951. default_value: bpy.props.EnumProperty(
  1952. items = eDriverVariableTransformChannel,
  1953. name = "Transform Channel",
  1954. description = "Transform Channel",
  1955. default = 'LOC_X',
  1956. update = driver_variable_socket_update,)
  1957. color_simple = cString
  1958. color : bpy.props.FloatVectorProperty(default=cString, size=4)
  1959. input : bpy.props.BoolProperty(default =False,)
  1960. def draw(self, context, layout, node, text):
  1961. ChooseDraw(self, context, layout, node, text, use_enum=False)
  1962. def draw_color(self, context, node):
  1963. return self.color
  1964. @classmethod
  1965. def draw_color_simple(self):
  1966. return self.color_simple
  1967. class EnumDriverRotationMode(MantisSocket):
  1968. '''Custom node socket type'''
  1969. bl_idname = 'EnumDriverRotationMode'
  1970. bl_label = "Rotaton Mode"
  1971. default_value: bpy.props.EnumProperty(
  1972. items = eRotationMode,
  1973. name = "Rotation Mode",
  1974. description = "Rotation Mode",
  1975. default = 'AUTO',
  1976. update = driver_variable_socket_update,)
  1977. color_simple = cString
  1978. color : bpy.props.FloatVectorProperty(default=cString, size=4)
  1979. input : bpy.props.BoolProperty(default =False,)
  1980. def draw(self, context, layout, node, text):
  1981. ChooseDraw(self, context, layout, node, text, use_enum=False)
  1982. def draw_color(self, context, node):
  1983. return self.color
  1984. @classmethod
  1985. def draw_color_simple(self):
  1986. return self.color_simple
  1987. #
  1988. eDriverType = (('AVERAGE', 'Average', 'Average', 0),
  1989. ('SUM', "Sum", "Sum", 1),
  1990. ('SCRIPTED', "Scripted", "Scripted Expression", 2),
  1991. ('MIN', "Min", "Minimum", 3),
  1992. ('MAX', "Max", "Maximum", 4),)
  1993. class EnumDriverType(MantisSocket):
  1994. '''Custom node socket type'''
  1995. bl_idname = 'EnumDriverType'
  1996. bl_label = "Driver Type"
  1997. default_value: bpy.props.EnumProperty(
  1998. items = eDriverType,
  1999. name = "Driver Type",
  2000. description = "Driver Type",
  2001. default = 'AVERAGE',
  2002. update = driver_socket_update,)
  2003. color_simple = cString
  2004. color : bpy.props.FloatVectorProperty(default=cString, size=4)
  2005. input : bpy.props.BoolProperty(default =False,)
  2006. def draw(self, context, layout, node, text):
  2007. ChooseDraw(self, context, layout, node, text, use_enum=False)
  2008. def draw_color(self, context, node):
  2009. return self.color
  2010. @classmethod
  2011. def draw_color_simple(self):
  2012. return self.color_simple
  2013. # Keyframe
  2014. # Enum for kf handle type
  2015. # enum for interpolation type
  2016. # eventually gonna make it to the fancy stuff
  2017. class FloatSocket(MantisSocket):
  2018. """Float Input socket"""
  2019. bl_idname = 'FloatSocket'
  2020. bl_label = "Float"
  2021. is_valid_interface_type=True
  2022. default_value : bpy.props.FloatProperty(default = 0.0, update = update_socket,)
  2023. color_simple = cFloat
  2024. color : bpy.props.FloatVectorProperty(default=cFloat, size=4)
  2025. input : bpy.props.BoolProperty(default =False,)
  2026. def draw(self, context, layout, node, text):
  2027. ChooseDraw(self, context, layout, node, text)
  2028. def draw_color(self, context, node):
  2029. return self.color
  2030. @classmethod
  2031. def draw_color_simple(self):
  2032. return self.color_simple
  2033. class FloatPositiveSocket(MantisSocket):
  2034. """Float Input socket"""
  2035. bl_idname = 'FloatPositiveSocket'
  2036. bl_label = "Float (Positive)"
  2037. is_valid_interface_type=True
  2038. default_value : bpy.props.FloatProperty(default = 0.0, min=0, update = update_socket,)
  2039. color_simple = cFloat
  2040. color : bpy.props.FloatVectorProperty(default=cFloat, size=4)
  2041. input : bpy.props.BoolProperty(default =False,)
  2042. def draw(self, context, layout, node, text):
  2043. ChooseDraw(self, context, layout, node, text)
  2044. def draw_color(self, context, node):
  2045. return self.color
  2046. @classmethod
  2047. def draw_color_simple(self):
  2048. return self.color_simple
  2049. class FloatFactorSocket(MantisSocket):
  2050. '''xFrom Input Output'''
  2051. bl_idname = 'FloatFactorSocket'
  2052. bl_label = "Float (Factor)"
  2053. is_valid_interface_type=True
  2054. default_value : bpy.props.FloatProperty(
  2055. default = 0.0,
  2056. min = 0.0,
  2057. max=1.0,
  2058. update = update_socket,
  2059. subtype='FACTOR',)
  2060. color_simple = cFloat
  2061. color : bpy.props.FloatVectorProperty(default=cFloat, size=4)
  2062. input : bpy.props.BoolProperty(default =False,)
  2063. def draw(self, context, layout, node, text):
  2064. ChooseDraw(self, context, layout, node, text)
  2065. def draw_color(self, context, node):
  2066. return self.color
  2067. @classmethod
  2068. def draw_color_simple(self):
  2069. return self.color_simple
  2070. class FloatAngleSocket(MantisSocket):
  2071. '''xFrom Input Output'''
  2072. bl_idname = 'FloatAngleSocket'
  2073. bl_label = "Float (Angle)"
  2074. is_valid_interface_type=True
  2075. default_value : bpy.props.FloatProperty(
  2076. default = 0.0,
  2077. min = -180,
  2078. max=180,
  2079. update = update_socket,
  2080. subtype='ANGLE',)
  2081. color_simple = cFloat
  2082. color : bpy.props.FloatVectorProperty(default=cFloat, size=4)
  2083. input : bpy.props.BoolProperty(default =False,)
  2084. def draw(self, context, layout, node, text):
  2085. ChooseDraw(self, context, layout, node, text)
  2086. def draw_color(self, context, node):
  2087. return self.color
  2088. @classmethod
  2089. def draw_color_simple(self):
  2090. return self.color_simple
  2091. class VectorSocket(MantisSocket):
  2092. """Vector Input socket"""
  2093. bl_idname = 'VectorSocket'
  2094. bl_label = "Vector"
  2095. is_valid_interface_type=True
  2096. default_value : bpy.props.FloatVectorProperty(
  2097. default = (0.0, 0.0, 0.0),
  2098. update = update_socket,)
  2099. color_simple = cVector
  2100. color : bpy.props.FloatVectorProperty(default=cVector, size=4)
  2101. input : bpy.props.BoolProperty(default =False,)
  2102. def draw(self, context, layout, node, text):
  2103. ChooseDraw(self, context, layout, node, text)
  2104. def draw_color(self, context, node):
  2105. return self.color
  2106. @classmethod
  2107. def draw_color_simple(self):
  2108. return self.color_simple
  2109. class VectorEulerSocket(MantisSocket):
  2110. """Vector Input socket"""
  2111. bl_idname = 'VectorEulerSocket'
  2112. bl_label = "Euler"
  2113. is_valid_interface_type=True
  2114. default_value : bpy.props.FloatVectorProperty(
  2115. default = (0.0, 0.0, 0.0),
  2116. update = update_socket,
  2117. subtype='EULER',)
  2118. color_simple = cVector
  2119. color : bpy.props.FloatVectorProperty(default=cVector, size=4)
  2120. input : bpy.props.BoolProperty(default =False,)
  2121. def draw(self, context, layout, node, text):
  2122. ChooseDraw(self, context, layout, node, text)
  2123. def draw_color(self, context, node):
  2124. return self.color
  2125. @classmethod
  2126. def draw_color_simple(self):
  2127. return self.color_simple
  2128. class VectorTranslationSocket(MantisSocket):
  2129. """Vector Input socket"""
  2130. bl_idname = 'VectorTranslationSocket'
  2131. bl_label = "Vector (Translation)"
  2132. default_value : bpy.props.FloatVectorProperty(
  2133. default = (0.0, 0.0, 0.0),
  2134. update = update_socket,
  2135. subtype='TRANSLATION',)
  2136. color_simple = cVector
  2137. color : bpy.props.FloatVectorProperty(default=cVector, size=4)
  2138. input : bpy.props.BoolProperty(default =False,)
  2139. def draw(self, context, layout, node, text):
  2140. ChooseDraw(self, context, layout, node, text)
  2141. def draw_color(self, context, node):
  2142. return self.color
  2143. @classmethod
  2144. def draw_color_simple(self):
  2145. return self.color_simple
  2146. class VectorScaleSocket(MantisSocket):
  2147. """Vector Input socket"""
  2148. bl_idname = 'VectorScaleSocket'
  2149. bl_label = "Vector (Scale)"
  2150. default_value : bpy.props.FloatVectorProperty(
  2151. default = (1.0, 1.0, 1.0),
  2152. update = update_socket,
  2153. subtype='XYZ',)
  2154. color_simple = cVector
  2155. color : bpy.props.FloatVectorProperty(default=cVector, size=4)
  2156. input : bpy.props.BoolProperty(default =False,)
  2157. def draw(self, context, layout, node, text):
  2158. ChooseDraw(self, context, layout, node, text)
  2159. def draw_color(self, context, node):
  2160. return self.color
  2161. @classmethod
  2162. def draw_color_simple(self):
  2163. return self.color_simple
  2164. class KeyframeSocket(MantisSocket):
  2165. '''Keyframe'''
  2166. bl_idname = 'KeyframeSocket'
  2167. bl_label = "Keyframe"
  2168. is_valid_interface_type=True
  2169. color_simple = cKeyframe
  2170. color : bpy.props.FloatVectorProperty(default=cKeyframe, size=4)
  2171. input : bpy.props.BoolProperty(default =False, update = update_socket)
  2172. def init(self):
  2173. self.display_shape = 'CIRCLE_DOT'
  2174. def draw(self, context, layout, node, text):
  2175. ChooseDraw(self, context, layout, node, text)
  2176. def draw_color(self, context, node):
  2177. return self.color
  2178. @classmethod
  2179. def draw_color_simple(self):
  2180. return self.color_simple
  2181. EnumKeyframeInterpolationType = (('CONSTANT', 'Stepped', 'Stepped'),
  2182. ('LINEAR', "Linear", "Linear"),
  2183. ('BEZIER', "Bezier", "Bezier"),)
  2184. class EnumKeyframeInterpolationTypeSocket(MantisSocket):
  2185. '''Keyframe Interpolation Type'''
  2186. bl_idname = 'EnumKeyframeInterpolationTypeSocket'
  2187. bl_label = "Keyframe Interpolation Type"
  2188. default_value :bpy.props.EnumProperty(
  2189. name="",
  2190. description="Interpolation",
  2191. items=EnumKeyframeInterpolationType,
  2192. default='LINEAR',
  2193. update = update_socket,)
  2194. color_simple = cString
  2195. color : bpy.props.FloatVectorProperty(default=cString, size=4)
  2196. input : bpy.props.BoolProperty(default =False, update = update_socket)
  2197. def draw(self, context, layout, node, text):
  2198. ChooseDraw(self, context, layout, node, text)
  2199. def draw_color(self, context, node):
  2200. return self.color
  2201. @classmethod
  2202. def draw_color_simple(self):
  2203. return self.color_simple
  2204. EnumKeyframeBezierHandleType = (('FREE', 'Free', 'Completely independent manually set handle.'),
  2205. ('ALIGNED', "Aligned", "Manually set handle with rotation locked together with its pair."),
  2206. ('VECTOR', "Vector", "Automatic handles that create straight lines."),
  2207. ('AUTO', "Automatic", "Automatic handles that create smooth curves."),
  2208. ('AUTO_CLAMPED', "Auto Clamped", "Automatic handles that create smooth curves which only change direction at keyframes."),)
  2209. class EnumKeyframeBezierHandleTypeSocket(MantisSocket):
  2210. '''Keyframe Bezier Handle Type'''
  2211. bl_idname = 'EnumKeyframeBezierHandleTypeSocket'
  2212. bl_label = "Keyframe Bezier Handle Type"
  2213. default_value :bpy.props.EnumProperty(
  2214. name="",
  2215. description="Handle Type",
  2216. items=EnumKeyframeBezierHandleType,
  2217. default='AUTO_CLAMPED',
  2218. update = update_socket,)
  2219. color_simple = cString
  2220. color : bpy.props.FloatVectorProperty(default=cString, size=4)
  2221. input : bpy.props.BoolProperty(default =False, update = update_socket)
  2222. def draw(self, context, layout, node, text):
  2223. ChooseDraw(self, context, layout, node, text)
  2224. def draw_color(self, context, node):
  2225. return self.color
  2226. @classmethod
  2227. def draw_color_simple(self):
  2228. return self.color_simple
  2229. enumExtrapolationMode = (('CONSTANT', 'Constant', 'Constant'),
  2230. ('LINEAR', "Linear", "Linear"),)
  2231. class eFCrvExtrapolationMode(MantisSocket):
  2232. '''FCurve Extrapolation Mode'''
  2233. bl_idname = 'eFCrvExtrapolationMode'
  2234. bl_label = "Extrapolation Mode"
  2235. default_value :bpy.props.EnumProperty(
  2236. name="",
  2237. description="Handle Type",
  2238. items=enumExtrapolationMode,
  2239. default='CONSTANT',
  2240. update = update_socket,)
  2241. color_simple = cString
  2242. color : bpy.props.FloatVectorProperty(default=cString, size=4)
  2243. input : bpy.props.BoolProperty(default =False, update = update_socket)
  2244. def draw(self, context, layout, node, text):
  2245. ChooseDraw(self, context, layout, node, text)
  2246. def draw_color(self, context, node):
  2247. return self.color
  2248. @classmethod
  2249. def draw_color_simple(self):
  2250. return self.color_simple
  2251. EnumLatticeInterpolationType = (('KEY_LINEAR', 'Linear', 'Linear Interpolation.'),
  2252. ('KEY_CARDINAL', "Cardinal", "Cardinal Interpolation."),
  2253. ('KEY_CATMULL_ROM', "Catmull Rom", "Catmull Rom Interpolation."),
  2254. ('KEY_BSPLINE', "B-Spline", "B Spline Interpolation."),)
  2255. class EnumLatticeInterpolationTypeSocket(MantisSocket):
  2256. '''Lattice Interpolation Type'''
  2257. bl_idname = 'EnumLatticeInterpolationTypeSocket'
  2258. bl_label = "Lattice Interpolation Type"
  2259. default_value :bpy.props.EnumProperty(
  2260. name="",
  2261. description="Interpolation Type",
  2262. items=EnumLatticeInterpolationType,
  2263. default='KEY_BSPLINE',
  2264. update = update_socket,)
  2265. color_simple = cString
  2266. color : bpy.props.FloatVectorProperty(default=cString, size=4)
  2267. input : bpy.props.BoolProperty(default =False, update = update_socket)
  2268. def draw(self, context, layout, node, text):
  2269. ChooseDraw(self, context, layout, node, text)
  2270. def draw_color(self, context, node):
  2271. return self.color
  2272. @classmethod
  2273. def draw_color_simple(self):
  2274. return self.color_simple
  2275. EnumCorrectiveSmoothType = (('SIMPLE', 'Simple', 'Use the average of adjacent edge-vertices.'),
  2276. ('LENGTH_WEIGHTED', "Length Weight", "Use the average of adjacent"
  2277. "edge-vertices weighted by their length."),)
  2278. class EnumCorrectiveSmoothTypeSocket(MantisSocket):
  2279. '''Lattice Interpolation Type'''
  2280. bl_idname = 'EnumCorrectiveSmoothTypeSocket'
  2281. bl_label = "Lattice Interpolation Type"
  2282. default_value :bpy.props.EnumProperty(
  2283. name="",
  2284. description="Interpolation Type",
  2285. items=EnumCorrectiveSmoothType,
  2286. default='SIMPLE',
  2287. update = update_socket,)
  2288. color_simple = cString
  2289. color : bpy.props.FloatVectorProperty(default=cString, size=4)
  2290. input : bpy.props.BoolProperty(default =False, update = update_socket)
  2291. def draw(self, context, layout, node, text):
  2292. ChooseDraw(self, context, layout, node, text)
  2293. def draw_color(self, context, node):
  2294. return self.color
  2295. @classmethod
  2296. def draw_color_simple(self):
  2297. return self.color_simple
  2298. enumFloatOperations = (('ADD', 'Add', 'Add'),
  2299. ('SUBTRACT', "Subtract", "Subtract"),
  2300. ('MULTIPLY', "Multiply", "Multiply"),
  2301. ('DIVIDE', "Divide", "Divide"),
  2302. ('POWER', "Power", "Power"),
  2303. ('FLOOR_DIVIDE', "Floor Divide", "Floor Divide"),
  2304. ('MODULUS', "Modulus", "Modulus"),
  2305. ('ABSOLUTE', "Absolute", "Absolute Value"),
  2306. ('MAXIMUM', "Maximum", "Maximum"),
  2307. ('MINIMUM', "Minimum", "Minimum"),
  2308. ('GREATER THAN', "Greater Than", "Greater Than"),
  2309. ('LESS THAN', "Less Than", "Less Than"),
  2310. ('ARCTAN2', "atan2", "2-argument arctan function"),
  2311. ('FLOOR', "Floor", "the nearest integer lower than input A"),
  2312. ('CEIL', "Ceiling", "the next integer higher than input A"),
  2313. ('ROUND', "Round", "Round to the nearest integer"),)
  2314. class MathFloatOperation(MantisSocket):
  2315. """Float Math Operation"""
  2316. bl_idname = 'MathFloatOperation'
  2317. bl_label = "Operation"
  2318. default_value :bpy.props.EnumProperty(
  2319. name="",
  2320. description="Operation",
  2321. items=enumFloatOperations,
  2322. default='MULTIPLY',
  2323. update = update_socket,)
  2324. color_simple = cString
  2325. color : bpy.props.FloatVectorProperty(default=cString, size=4)
  2326. input : bpy.props.BoolProperty(default =False,)
  2327. def draw(self, context, layout, node, text):
  2328. ChooseDraw(self, context, layout, node, text)
  2329. def draw_color(self, context, node):
  2330. return self.color
  2331. @classmethod
  2332. def draw_color_simple(self):
  2333. return self.color_simple
  2334. enumVectorOperations = (('ADD', 'Add', 'Add (Component-wise)'),
  2335. ('SUBTRACT', "Subtract", "Subtract (Component-wise)"),
  2336. ('MULTIPLY', "Multiply", "Multiply (Component-wise)"),
  2337. ('SCALE', "Scale", "Scales vector by input float or average magnitude of input vector's components."),
  2338. ('DIVIDE', "Divide", "Divide (Component-wise)"),
  2339. ('POWER', "Power", "Power (Component-wise)"),
  2340. ('LENGTH', "Length", "Length"),
  2341. ('CROSS', "Cross Product", "Cross product of A X B"),
  2342. ('NORMALIZE', "Normalize", "Returns a normalized vector."),
  2343. ('DOT', "Dot Product", "Dot product of A . B"),
  2344. ('LINEAR_INTERP', "Linear Interpolation", "Linear Interpolation between vectors A and B by factor"))
  2345. class MathVectorOperation(MantisSocket):
  2346. """Vector Math Operation"""
  2347. bl_idname = 'MathVectorOperation'
  2348. bl_label = "Operation"
  2349. default_value :bpy.props.EnumProperty(
  2350. name="",
  2351. description="Operation",
  2352. items=enumVectorOperations,
  2353. default='MULTIPLY',
  2354. update = update_socket,)
  2355. color_simple = cString
  2356. color : bpy.props.FloatVectorProperty(default=cString, size=4)
  2357. input : bpy.props.BoolProperty(default =False,)
  2358. def draw(self, context, layout, node, text):
  2359. ChooseDraw(self, context, layout, node, text)
  2360. def draw_color(self, context, node):
  2361. return self.color
  2362. @classmethod
  2363. def draw_color_simple(self):
  2364. return self.color_simple
  2365. enumMatrixTransform = (('TRANSLATE', 'Translate', 'Translate'),
  2366. ('ROTATE_AXIS_ANGLE', "Rotate (Axis-angle)", "Rotates a number of radians around an axis"),
  2367. # ('ROTATE_EULER', "Rotate (Euler)", "Euler Rotation"),
  2368. # ('ROTATE_QUATERNION', "Rotate (Quaternion)", "Quaternion Rotation"),
  2369. ('SCALE', "Scale", "Scale"),)
  2370. class MatrixTransformOperation(MantisSocket):
  2371. """Matrix Transform Operation"""
  2372. bl_idname = 'MatrixTransformOperation'
  2373. bl_label = "Operation"
  2374. default_value :bpy.props.EnumProperty(
  2375. name="",
  2376. description="Operation",
  2377. items=enumMatrixTransform,
  2378. default='TRANSLATE',
  2379. update = update_socket,)
  2380. color_simple = cString
  2381. color : bpy.props.FloatVectorProperty(default=cString, size=4)
  2382. input : bpy.props.BoolProperty(default =False,)
  2383. def draw(self, context, layout, node, text):
  2384. ChooseDraw(self, context, layout, node, text)
  2385. def draw_color(self, context, node):
  2386. return self.color
  2387. @classmethod
  2388. def draw_color_simple(self):
  2389. return self.color_simple
  2390. enumIntOperations = (('ADD', 'Add', 'Add'),
  2391. ('SUBTRACT', "Subtract", "Subtract"),
  2392. ('MULTIPLY', "Multiply", "Multiply"),
  2393. ('FLOOR_DIVIDE', "Floor Divide", "Floor Divide"),
  2394. ('POWER', "Power", "Power"),
  2395. ('MODULUS', "Modulus", "Modulus"),
  2396. ('ABSOLUTE', "Absolute", "Absolute Value"),
  2397. ('MAXIMUM', "Maximum", "Maximum"),
  2398. ('MINIMUM', "Minimum", "Minimum"),
  2399. ('GREATER THAN', "Greater Than", "Greater Than"),
  2400. ('LESS THAN', "Less Than", "Less Than"),)
  2401. class MathIntOperation(MantisSocket):
  2402. """Int Math Operation"""
  2403. bl_idname = 'MathIntOperation'
  2404. bl_label = "Operation"
  2405. default_value :bpy.props.EnumProperty(
  2406. name="",
  2407. description="Operation",
  2408. items=enumIntOperations,
  2409. default='MULTIPLY',
  2410. update = update_socket,)
  2411. color_simple = cString
  2412. color : bpy.props.FloatVectorProperty(default=cString, size=4)
  2413. input : bpy.props.BoolProperty(default =False,)
  2414. def draw(self, context, layout, node, text):
  2415. ChooseDraw(self, context, layout, node, text)
  2416. def draw_color(self, context, node):
  2417. return self.color
  2418. @classmethod
  2419. def draw_color_simple(self):
  2420. return self.color_simple
  2421. enumCompareOperations = (('EQUAL', "Equal", "Equal"),
  2422. ('NOT_EQUAL', "Not Equal", "Not Equal"),
  2423. ('GREATER_THAN', "Greater Than", "Greater Than"),
  2424. ('GREATER_THAN_EQUAL', "Greater Than or Equal", "Greater Than or Equal"),
  2425. ('LESS_THAN', "Less Than", "Less Than"),
  2426. ('LESS_THAN_EQUAL', "Equal or Less Than", "Equal or Less Than"),)
  2427. class EnumCompareOperation(MantisSocket):
  2428. """Compare Operation"""
  2429. bl_idname = 'EnumCompareOperation'
  2430. bl_label = "Comparison"
  2431. default_value :bpy.props.EnumProperty(
  2432. name="",
  2433. description="Comparison",
  2434. items=enumCompareOperations,
  2435. default='EQUAL',
  2436. update = update_socket,)
  2437. color_simple = cString
  2438. color : bpy.props.FloatVectorProperty(default=cString, size=4)
  2439. input : bpy.props.BoolProperty(default =False,)
  2440. def draw(self, context, layout, node, text):
  2441. ChooseDraw(self, context, layout, node, text)
  2442. def draw_color(self, context, node):
  2443. return self.color
  2444. @classmethod
  2445. def draw_color_simple(self):
  2446. return self.color_simple
  2447. class WildcardSocket(MantisSocket):
  2448. """Some kind of node socket lol I donno"""
  2449. bl_idname = 'WildcardSocket'
  2450. bl_label = ""
  2451. color_simple = (0.0,0.0,0.0,0.0)
  2452. color : bpy.props.FloatVectorProperty(default=(0.0,0.0,0.0,0.0), size=4)
  2453. input : bpy.props.BoolProperty(default =False,)
  2454. def draw(self, context, layout, node, text):
  2455. ChooseDraw(self, context, layout, node, text)
  2456. def draw_color(self, context, node):
  2457. return self.color
  2458. @classmethod
  2459. def draw_color_simple(self):
  2460. return self.color_simple