socket_definitions.py 103 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805
  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. def get_widget_library_items(self, context):
  1206. from bpy import context
  1207. try_these_first = ['bl_ext.repos.mantis', 'bl_ext.blender_modules_enabled.mantis']
  1208. for mantis_key in try_these_first:
  1209. bl_mantis_addon = context.preferences.addons.get(mantis_key)
  1210. if bl_mantis_addon: break
  1211. return_value = [('NONE', 'None', 'None', 'ERROR', 0)]
  1212. widget_names={}
  1213. if bl_mantis_addon:
  1214. widgets_path = bl_mantis_addon.preferences.WidgetsLibraryFolder
  1215. import os
  1216. for path_root, dirs, files, in os.walk(widgets_path):
  1217. # TODO handle .blend files
  1218. # for file in files: # check .blend files first, objs should take precedence
  1219. # if file.endswith('.blend'):
  1220. # widget_names[file[:-6]] = os.path.join(path_root, file)
  1221. for file in files:
  1222. if file.endswith('.obj'):
  1223. widget_names[file[:-4]] = os.path.join(path_root, file)
  1224. else:
  1225. prRed("Mantis Preferences not found. This is a bug. Please report it on gitlab.")
  1226. prRed("I will need to know your OS and info about how you installed Mantis.")
  1227. if widget_names.keys():
  1228. return_value=[]
  1229. for i, (name, path) in enumerate(widget_names.items()):
  1230. return_value.append( (path, name, path, 'GIZMO', i) )
  1231. return return_value
  1232. # THIS is a special socket type that finds the widgets in your widgets library (set in preferences)
  1233. class EnumWidgetLibrarySocket(MantisSocket):
  1234. '''Choose a Wdiget'''
  1235. bl_idname = 'EnumWidgetLibrarySocket'
  1236. bl_label = "Widget"
  1237. is_valid_interface_type=False
  1238. default_value : bpy.props.EnumProperty(
  1239. items=get_widget_library_items,
  1240. name="Widget",
  1241. description="Which widget to use",
  1242. default = 0,
  1243. update = update_socket,)
  1244. color_simple = cString
  1245. color : bpy.props.FloatVectorProperty(default=cString, size=4)
  1246. def draw(self, context, layout, node, text):
  1247. ChooseDraw(self, context, layout, node, text, use_enum=False)
  1248. def draw_color(self, context, node):
  1249. return self.color
  1250. @classmethod
  1251. def draw_color_simple(self):
  1252. return self.color_simple
  1253. class BoolUpdateParentNode(MantisSocket):
  1254. '''Custom node socket type'''
  1255. bl_idname = 'BoolUpdateParentNode'
  1256. bl_label = "Boolean"
  1257. default_value: bpy.props.BoolProperty(default=False, update = update_parent_node)
  1258. color_simple = cBool
  1259. color : bpy.props.FloatVectorProperty(default=cBool, size=4)
  1260. input : bpy.props.BoolProperty(default =False,)
  1261. def draw(self, context, layout, node, text):
  1262. ChooseDraw(self, context, layout, node, text)
  1263. def draw_color(self, context, node):
  1264. return self.color
  1265. @classmethod
  1266. def draw_color_simple(self):
  1267. return self.color_simple
  1268. class IKChainLengthSocket(MantisSocket):
  1269. '''Custom node socket type'''
  1270. bl_idname = 'IKChainLengthSocket'
  1271. bl_label = "IK Chain Length"
  1272. default_value: bpy.props.IntProperty(default=0, update = ik_chain_length_update_socket, min = 0, max = 255)
  1273. color_simple = cInt
  1274. color : bpy.props.FloatVectorProperty(default=cInt, size=4)
  1275. input : bpy.props.BoolProperty(default =False,)
  1276. def draw(self, context, layout, node, text):
  1277. ChooseDraw(self, context, layout, node, text)
  1278. def draw_color(self, context, node):
  1279. return self.color
  1280. @classmethod
  1281. def draw_color_simple(self):
  1282. return self.color_simple
  1283. # Inherit
  1284. eInheritScale = (
  1285. ('FULL', "Full", "Fully inherit scale", 1),
  1286. ('AVERAGE', "Average", "todo", 2),
  1287. ('ALIGNED', "Aligned", "todo", 3),
  1288. ('FIX_SHEAR', "Fix Shear", "todo", 4),
  1289. ('NONE', "None", "todo", 5),
  1290. )
  1291. class EnumInheritScale(MantisSocket):
  1292. '''Custom node socket type'''
  1293. bl_idname = 'EnumInheritScale'
  1294. bl_label = "Inherit Scale"
  1295. default_value: bpy.props.EnumProperty(
  1296. items=eInheritScale,
  1297. name="Inherit Scale",
  1298. description="Inherit Scale",
  1299. default = 'FULL',
  1300. #options = set(),
  1301. update = update_socket,)
  1302. color_simple = cString
  1303. color : bpy.props.FloatVectorProperty(default=cString, size=4)
  1304. input : bpy.props.BoolProperty(default =False,)
  1305. def draw(self, context, layout, node, text):
  1306. ChooseDraw(self, context, layout, node, text)
  1307. def draw_color(self, context, node):
  1308. return self.color
  1309. @classmethod
  1310. def draw_color_simple(self):
  1311. return self.color_simple
  1312. # Copy Rotation
  1313. eRotationMix =(
  1314. ('REPLACE', "Replace", "Fully inherit scale", 0),
  1315. ('BEFORE', "Before", "Fully inherit scale", 1),
  1316. ('AFTER', "After", "Fully inherit scale", 2),
  1317. ('ADD', "Add", "Fully inherit scale", 3),
  1318. #todo, but i don't care much
  1319. )
  1320. # TODO HACK
  1321. # I am trying to figure out how to do enum_flag as
  1322. # mutually exclusive options
  1323. # but! I don't think it's possible
  1324. # I just like the UI for it :P
  1325. class EnumRotationMix(MantisSocket):
  1326. '''Custom node socket type'''
  1327. bl_idname = 'EnumRotationMix'
  1328. bl_label = "Rotation Mix"
  1329. default_value: bpy.props.EnumProperty(
  1330. items=eRotationMix,
  1331. name="Rotation Mix",
  1332. description="Rotation Mix",
  1333. default = 'REPLACE',#{'REPLACE'},
  1334. options = set(), # this has to be a set lol
  1335. update = update_socket,)
  1336. color_simple = cString
  1337. color : bpy.props.FloatVectorProperty(default=cString, size=4)
  1338. input : bpy.props.BoolProperty(default =False,)
  1339. def draw(self, context, layout, node, text):
  1340. ChooseDraw(self, context, layout, node, text)
  1341. def draw_color(self, context, node):
  1342. return self.color
  1343. @classmethod
  1344. def draw_color_simple(self):
  1345. return self.color_simple
  1346. eRotationMix_copytransforms =(
  1347. ('REPLACE', "Replace (Aligned)", "Fully inherit scale"),
  1348. ('BEFORE', "Before (Aligned)", "Fully inherit scale"),
  1349. ('AFTER', "After (Aligned)", "Fully inherit scale"),
  1350. ('REPLACE_SPLIT', "Replace (Split Channels)", "Fully inherit scale"),
  1351. ('BEFORE_SPLIT', "Before (Split Channels)", "Fully inherit scale"),
  1352. ('AFTER_SPLIT', "After (Split Channels)", "Fully inherit scale"),
  1353. ('REPLACE_FULL', "Replace (Full)", "Fully inherit scale"),
  1354. ('BEFORE_FULL', "Before (Full)", "Fully inherit scale"),
  1355. ('AFTER_FULL', "After (Full)", "Fully inherit scale"),)
  1356. class EnumRotationMixCopyTransforms(MantisSocket):
  1357. '''Custom node socket type'''
  1358. bl_idname = 'EnumRotationMixCopyTransforms'
  1359. bl_label = "Rotation Mix"
  1360. default_value: bpy.props.EnumProperty(
  1361. items=eRotationMix_copytransforms,
  1362. name="Rotation Mix",
  1363. description="Rotation Mix",
  1364. default = 'REPLACE', #{'REPLACE'},
  1365. #options = {'ENUM_FLAG'}, # this sux
  1366. update = update_socket,)
  1367. color_simple = cString
  1368. color : bpy.props.FloatVectorProperty(default=cString, size=4)
  1369. input : bpy.props.BoolProperty(default =False,)
  1370. def draw(self, context, layout, node, text):
  1371. ChooseDraw(self, context, layout, node, text)
  1372. def draw_color(self, context, node):
  1373. return self.color
  1374. @classmethod
  1375. def draw_color_simple(self):
  1376. return self.color_simple
  1377. # STRETCH TO
  1378. eMaintainVolumeStretchTo = (('VOLUME_XZX', "XZ", "XZ", 1),
  1379. ('VOLUME_X', "X", "X", 2),
  1380. ('VOLUME_Z', "Z", "Z", 4),
  1381. ('NO_VOLUME', "None", "None", 8),)
  1382. class EnumMaintainVolumeStretchTo(MantisSocket):
  1383. '''Custom node socket type'''
  1384. bl_idname = 'EnumMaintainVolumeStretchToSocket'
  1385. bl_label = "Maintain Volume"
  1386. default_value: bpy.props.EnumProperty(
  1387. items=eMaintainVolumeStretchTo,
  1388. name="Maintain Volume",
  1389. description="Maintain Volume",
  1390. default = 'VOLUME_XZX',
  1391. #options = {'ENUM_FLAG'},
  1392. update = update_socket,)
  1393. color_simple = cString
  1394. color : bpy.props.FloatVectorProperty(default=cString, size=4)
  1395. input : bpy.props.BoolProperty(default =False,)
  1396. def draw(self, context, layout, node, text):
  1397. ChooseDraw(self, context, layout, node, text)
  1398. def draw_color(self, context, node):
  1399. return self.color
  1400. @classmethod
  1401. def draw_color_simple(self):
  1402. return self.color_simple
  1403. eRotationStretchTo = (('PLANE_X', "XZ", "XZ", 1),
  1404. ('PLANE_Z', "ZX", "ZX", 2),
  1405. ('SWING_Y', "Swing", "Swing", 4),)
  1406. class EnumRotationStretchTo(MantisSocket):
  1407. '''Custom node socket type'''
  1408. bl_idname = 'EnumRotationStretchTo'
  1409. bl_label = "Rotation"
  1410. default_value: bpy.props.EnumProperty(
  1411. items=eRotationStretchTo,
  1412. name="Rotation",
  1413. description="Rotation",
  1414. default = 'PLANE_X',
  1415. #options = {'ENUM_FLAG'},
  1416. update = update_socket,)
  1417. color_simple = cString
  1418. color : bpy.props.FloatVectorProperty(default=cString, size=4)
  1419. input : bpy.props.BoolProperty(default =False,)
  1420. def draw(self, context, layout, node, text):
  1421. ChooseDraw(self, context, layout, node, text)
  1422. def draw_color(self, context, node):
  1423. return self.color
  1424. @classmethod
  1425. def draw_color_simple(self):
  1426. return self.color_simple
  1427. # Track-To
  1428. eTrackAxis = (('TRACK_X', "X", "X", 1),
  1429. ('TRACK_Y', "Y", "Y", 2),
  1430. ('TRACK_Z', "Z", "Z", 4),
  1431. ('TRACK_NEGATIVE_X', "-X", "-X", 8),
  1432. ('TRACK_NEGATIVE_Y', "-Y", "-Y", 16),
  1433. ('TRACK_NEGATIVE_Z', "-Z", "-Z", 32,))
  1434. eUpAxis = (('UP_X', "X", "X", 1),
  1435. ('UP_Y', "Y", "Y", 2),
  1436. ('UP_Z', "Z", "Z", 4),)
  1437. # ugly but I can't change it easily without messing up versioning
  1438. class EnumTrackAxis(MantisSocket):
  1439. '''Custom node socket type'''
  1440. bl_idname = 'EnumTrackAxis'
  1441. bl_label = "Track Axis"
  1442. default_value: bpy.props.EnumProperty(
  1443. items=eTrackAxis,
  1444. name="Track Axis",
  1445. description="Track Axis",
  1446. default = 'TRACK_X',
  1447. #options = {'ENUM_FLAG'},
  1448. update = update_socket,)
  1449. color_simple = cString
  1450. color : bpy.props.FloatVectorProperty(default=cString, size=4)
  1451. input : bpy.props.BoolProperty(default =False,)
  1452. def draw(self, context, layout, node, text):
  1453. ChooseDraw(self, context, layout, node, text)
  1454. def draw_color(self, context, node):
  1455. return self.color
  1456. @classmethod
  1457. def draw_color_simple(self):
  1458. return self.color_simple
  1459. class EnumUpAxis(MantisSocket):
  1460. '''Custom node socket type'''
  1461. bl_idname = 'EnumUpAxis'
  1462. bl_label = "Up Axis"
  1463. default_value: bpy.props.EnumProperty(
  1464. items=eUpAxis,
  1465. name="Up Axis",
  1466. description="Up Axis",
  1467. default = 'UP_X',
  1468. #options = {'ENUM_FLAG'},
  1469. update = update_socket,)
  1470. color_simple = cString
  1471. color : bpy.props.FloatVectorProperty(default=cString, size=4)
  1472. input : bpy.props.BoolProperty(default =False,)
  1473. def draw(self, context, layout, node, text):
  1474. ChooseDraw(self, context, layout, node, text)
  1475. def draw_color(self, context, node):
  1476. return self.color
  1477. @classmethod
  1478. def draw_color_simple(self):
  1479. return self.color_simple
  1480. # Follow Track Forward axis
  1481. eForwardAxis = (('FORWARD_X', "X", "X", 0),
  1482. ('FORWARD_Y', "Y", "Y", 1),
  1483. ('FORWARD_Z', "Z", "Z", 2),
  1484. ('TRACK_NEGATIVE_X', "-X", "-X", 3),
  1485. ('TRACK_NEGATIVE_Y', "-Y", "-Y", 4),
  1486. ('TRACK_NEGATIVE_Z', "-Z", "-Z", 5),)
  1487. class EnumFollowPathForwardAxis(MantisSocket):
  1488. '''Custom node socket type'''
  1489. bl_idname = 'EnumFollowPathForwardAxis'
  1490. bl_label = "Forward Axis"
  1491. default_value: bpy.props.EnumProperty(
  1492. items=eForwardAxis,
  1493. name="Forward Axis",
  1494. description="Forward Axis",
  1495. default = 'FORWARD_X',
  1496. update = update_socket,)
  1497. color_simple = cString
  1498. color : bpy.props.FloatVectorProperty(default=cString, size=4)
  1499. input : bpy.props.BoolProperty(default =False,)
  1500. def draw(self, context, layout, node, text):
  1501. ChooseDraw(self, context, layout, node, text)
  1502. def draw_color(self, context, node):
  1503. return self.color
  1504. @classmethod
  1505. def draw_color_simple(self):
  1506. return self.color_simple
  1507. # Follow Track Forward axis
  1508. eFloorAxis = (('FLOOR_X', "X", "X", 0),
  1509. ('FLOOR_Y', "Y", "Y", 1),
  1510. ('FLOOR_Z', "Z", "Z", 2),
  1511. ('FLOOR_NEGATIVE_X', "-X", "-X", 3),
  1512. ('FLOOR_NEGATIVE_Y', "-Y", "-Y", 4),
  1513. ('FLOOR_NEGATIVE_Z', "-Z", "-Z", 5),)
  1514. class EnumFloorAxis(MantisSocket):
  1515. '''Floor Constraint Axis'''
  1516. bl_idname = 'EnumFloorAxis'
  1517. bl_label = "Floor Axis"
  1518. default_value: bpy.props.EnumProperty(
  1519. items=eFloorAxis,
  1520. name="Floor Axis",
  1521. description="Floor Axis",
  1522. default = 'FLOOR_X',
  1523. update = update_socket,)
  1524. color_simple = cString
  1525. color : bpy.props.FloatVectorProperty(default=cString, size=4)
  1526. input : bpy.props.BoolProperty(default =False,)
  1527. def draw(self, context, layout, node, text):
  1528. ChooseDraw(self, context, layout, node, text)
  1529. def draw_color(self, context, node):
  1530. return self.color
  1531. @classmethod
  1532. def draw_color_simple(self):
  1533. return self.color_simple
  1534. # Locked Track
  1535. eLockAxis = (('LOCK_X', "X", "X", 1),
  1536. ('LOCK_Y', "Y", "Y", 2),
  1537. ('LOCK_Z', "Z", "Z", 4),)
  1538. class EnumLockAxis(MantisSocket):
  1539. '''Custom node socket type'''
  1540. bl_idname = 'EnumLockAxis'
  1541. bl_label = "Lock Axis"
  1542. default_value: bpy.props.EnumProperty(
  1543. items=eLockAxis,
  1544. name="Lock Axis",
  1545. description="Lock Axis",
  1546. default = 'LOCK_X',
  1547. #options = {'ENUM_FLAG'},
  1548. update = update_socket,)
  1549. color_simple = cString
  1550. color : bpy.props.FloatVectorProperty(default=cString, size=4)
  1551. input : bpy.props.BoolProperty(default =False,)
  1552. def draw(self, context, layout, node, text):
  1553. ChooseDraw(self, context, layout, node, text)
  1554. def draw_color(self, context, node):
  1555. return self.color
  1556. @classmethod
  1557. def draw_color_simple(self):
  1558. return self.color_simple
  1559. # Limit Distance:
  1560. eLimitMode = (('LIMITDIST_INSIDE', "Inside", "Inside",),
  1561. ('LIMITDIST_OUTSIDE', "Outside", "Outside",),
  1562. ('LIMITDIST_ONSURFACE', "On Surface", "On Surface",),)
  1563. class EnumLimitMode(MantisSocket):
  1564. '''Custom node socket type'''
  1565. bl_idname = 'EnumLimitMode'
  1566. bl_label = "Clamp Region"
  1567. default_value: bpy.props.EnumProperty(
  1568. items=eLimitMode,
  1569. name="Clamp Region",
  1570. description="Clamp Region",
  1571. default = 'LIMITDIST_INSIDE',
  1572. update = update_socket,)
  1573. color_simple = cString
  1574. color : bpy.props.FloatVectorProperty(default=cString, size=4)
  1575. input : bpy.props.BoolProperty(default =False,)
  1576. def draw(self, context, layout, node, text):
  1577. ChooseDraw(self, context, layout, node, text)
  1578. def draw_color(self, context, node):
  1579. return self.color
  1580. @classmethod
  1581. def draw_color_simple(self):
  1582. return self.color_simple
  1583. # Spline IK
  1584. eYScaleMode = (('NONE', "None", "Don’t scale the X and Z axes.",),
  1585. ('FIT_CURVE', "Fit Curve", "Scale the bones to fit the entire length of the curve.",),
  1586. ('BONE_ORIGINAL', "Bone Original", "Use the original scaling of the bones.",),)
  1587. eXZScaleMode = (('NONE', "None", "Don’t scale the X and Z axes.",),
  1588. ('BONE_ORIGINAL', "Bone Original", "Use the original scaling of the bones.",),
  1589. ('INVERSE_PRESERVE', "Inverse Scale", "Scale of the X and Z axes is the inverse of the Y-Scale.",),
  1590. ('VOLUME_PRESERVE', "Volume Preservation", "Scale of the X and Z axes are adjusted to preserve the volume of the bones.",),)
  1591. class EnumYScaleMode(MantisSocket):
  1592. '''Custom node socket type'''
  1593. bl_idname = 'EnumYScaleMode'
  1594. bl_label = "Y Scale Mode"
  1595. default_value: bpy.props.EnumProperty(
  1596. items=eYScaleMode,
  1597. name="Y Scale Mode",
  1598. description="Y Scale Mode",
  1599. default = 'FIT_CURVE',
  1600. update = update_socket,)
  1601. color_simple = cString
  1602. color : bpy.props.FloatVectorProperty(default=cString, size=4)
  1603. input : bpy.props.BoolProperty(default =False,)
  1604. def draw(self, context, layout, node, text):
  1605. ChooseDraw(self, context, layout, node, text)
  1606. def draw_color(self, context, node):
  1607. return self.color
  1608. @classmethod
  1609. def draw_color_simple(self):
  1610. return self.color_simple
  1611. class EnumXZScaleMode(MantisSocket):
  1612. '''Custom node socket type'''
  1613. bl_idname = 'EnumXZScaleMode'
  1614. bl_label = "XZ Scale Mode"
  1615. default_value: bpy.props.EnumProperty(
  1616. items=eXZScaleMode,
  1617. name="XZ Scale Mode",
  1618. description="XZ Scale Mode",
  1619. default = 'NONE',
  1620. update = update_socket,)
  1621. color_simple = cString
  1622. color : bpy.props.FloatVectorProperty(default=cString, size=4)
  1623. input : bpy.props.BoolProperty(default =False,)
  1624. def draw(self, context, layout, node, text):
  1625. ChooseDraw(self, context, layout, node, text)
  1626. def draw_color(self, context, node):
  1627. return self.color
  1628. @classmethod
  1629. def draw_color_simple(self):
  1630. return self.color_simple
  1631. eMapxForm = (('LOCATION', "Location", "Location",),
  1632. ('ROTATION', "Rotation", "Rotation",),
  1633. ('SCALE', "Scale", "Scale",),)
  1634. eRotationMode = (('AUTO', 'Auto', 'Automattically Selected.', 0),
  1635. ('XYZ', "XYZ", "Euler using the XYZ rotation order", 1),
  1636. ('XZY', "XZY", "Euler using the XZY rotation order", 2),
  1637. ('ZXY', "ZXY", "Euler using the ZXY rotation order", 3),
  1638. ('ZYX', "ZYX", "Euler using the ZYX rotation order", 4),
  1639. ('YXZ', "YXZ", "Euler using the YXZ rotation order", 5),
  1640. ('YZX', "YZX", "Euler using the YZX rotation order", 6),
  1641. ('QUATERNION', "Quaternion", "Quaternion", 7),
  1642. ('SWING_TWIST_X', 'Swing and X Twist.', 'Decompose into a swing rotation to aim the X axis, followed by twist around it.', 8),
  1643. ('SWING_TWIST_Y', 'Swing and Y Twist.', 'Decompose into a swing rotation to aim the Y axis, followed by twist around it.', 9),
  1644. ('SWING_TWIST_Z', 'Swing and Z Twist.', 'Decompose into a swing rotation to aim the Z axis, followed by twist around it.', 10),)
  1645. enumTransformationRotationOrder = enumRotationOrder[:6]
  1646. eTranslationMix =(
  1647. ('ADD', "Add", "", 0),
  1648. ('REPLACE', "Replace", "", 1),
  1649. )
  1650. eScaleMix =(
  1651. ('MULTIPLY', "Multiply", "", 0),
  1652. ('REPLACE', "Replace", "", 1),
  1653. )
  1654. class EnumTransformationMap(MantisSocket):
  1655. '''Custom node socket type'''
  1656. bl_idname = 'EnumTransformationMap'
  1657. bl_label = "Map To/From"
  1658. default_value: bpy.props.EnumProperty(
  1659. items=eMapxForm,
  1660. name="Map To/From",
  1661. description="Map To/From",
  1662. default = 'LOCATION',
  1663. update = update_socket,)
  1664. color_simple = cString
  1665. color : bpy.props.FloatVectorProperty(default=cString, size=4)
  1666. input : bpy.props.BoolProperty(default =False,)
  1667. def draw(self, context, layout, node, text):
  1668. ChooseDraw(self, context, layout, node, text)
  1669. def draw_color(self, context, node):
  1670. return self.color
  1671. @classmethod
  1672. def draw_color_simple(self):
  1673. return self.color_simple
  1674. class EnumTransformationRotationMode(MantisSocket):
  1675. '''Custom node socket type'''
  1676. bl_idname = 'EnumTransformationRotationMode'
  1677. bl_label = "Map To/From"
  1678. default_value: bpy.props.EnumProperty(
  1679. items=eRotationMode,
  1680. name="Rotation Mode",
  1681. description="Rotation Mode",
  1682. default = 'AUTO',
  1683. update = update_socket,)
  1684. color_simple = cString
  1685. color : bpy.props.FloatVectorProperty(default=cString, size=4)
  1686. input : bpy.props.BoolProperty(default =False,)
  1687. def draw(self, context, layout, node, text):
  1688. ChooseDraw(self, context, layout, node, text, use_enum=False)
  1689. def draw_color(self, context, node):
  1690. return self.color
  1691. @classmethod
  1692. def draw_color_simple(self):
  1693. return self.color_simple
  1694. class EnumTransformationRotationOrder(MantisSocket):
  1695. '''Custom node socket type'''
  1696. bl_idname = 'EnumTransformationRotationOrder'
  1697. bl_label = "Map To/From"
  1698. default_value: bpy.props.EnumProperty(
  1699. items=enumTransformationRotationOrder,
  1700. name="Rotation Order",
  1701. description="Rotation Order",
  1702. default = 'AUTO',
  1703. update = update_socket,)
  1704. color_simple = cString
  1705. color : bpy.props.FloatVectorProperty(default=cString, size=4)
  1706. input : bpy.props.BoolProperty(default =False,)
  1707. def draw(self, context, layout, node, text):
  1708. ChooseDraw(self, context, layout, node, text, use_enum=False)
  1709. def draw_color(self, context, node):
  1710. return self.color
  1711. @classmethod
  1712. def draw_color_simple(self):
  1713. return self.color_simple
  1714. class EnumTransformationTranslationMixMode(MantisSocket):
  1715. '''Custom node socket type'''
  1716. bl_idname = 'EnumTransformationTranslationMixMode'
  1717. bl_label = "Mix Mode"
  1718. default_value: bpy.props.EnumProperty(
  1719. items=eTranslationMix,
  1720. name="Mix Translation",
  1721. description="Mix Translation",
  1722. default = 'ADD',
  1723. update = update_socket,)
  1724. color_simple = cString
  1725. color : bpy.props.FloatVectorProperty(default=cString, size=4)
  1726. input : bpy.props.BoolProperty(default =False,)
  1727. def draw(self, context, layout, node, text):
  1728. ChooseDraw(self, context, layout, node, text, use_enum=False)
  1729. def draw_color(self, context, node):
  1730. return self.color
  1731. @classmethod
  1732. def draw_color_simple(self):
  1733. return self.color_simple
  1734. class EnumTransformationRotationMixMode(MantisSocket):
  1735. '''Custom node socket type'''
  1736. bl_idname = 'EnumTransformationRotationMixMode'
  1737. bl_label = "Mix Mode"
  1738. default_value: bpy.props.EnumProperty(
  1739. items=eRotationMix,
  1740. name="Mix Rotation",
  1741. description="Mix Rotation",
  1742. default = 'ADD',
  1743. update = update_socket,)
  1744. color_simple = cString
  1745. color : bpy.props.FloatVectorProperty(default=cString, size=4)
  1746. input : bpy.props.BoolProperty(default =False,)
  1747. def draw(self, context, layout, node, text):
  1748. ChooseDraw(self, context, layout, node, text, use_enum=False)
  1749. def draw_color(self, context, node):
  1750. return self.color
  1751. @classmethod
  1752. def draw_color_simple(self):
  1753. return self.color_simple
  1754. class EnumTransformationScaleMixMode(MantisSocket):
  1755. '''Custom node socket type'''
  1756. bl_idname = 'EnumTransformationScaleMixMode'
  1757. bl_label = "Mix Mode"
  1758. default_value: bpy.props.EnumProperty(
  1759. items=eScaleMix,
  1760. name="Mix Scale",
  1761. description="Mix Scale",
  1762. default = 'REPLACE',
  1763. update = update_socket,)
  1764. color_simple = cString
  1765. color : bpy.props.FloatVectorProperty(default=cString, size=4)
  1766. input : bpy.props.BoolProperty(default =False,)
  1767. def draw(self, context, layout, node, text):
  1768. ChooseDraw(self, context, layout, node, text, use_enum=False)
  1769. def draw_color(self, context, node):
  1770. return self.color
  1771. @classmethod
  1772. def draw_color_simple(self):
  1773. return self.color_simple
  1774. eAxes = (
  1775. ('X', "X", "X", 0),
  1776. ('Y', "Y", "Y", 1),
  1777. ('Z', "Z", "Z", 2),
  1778. )
  1779. class EnumTransformationAxes(MantisSocket):
  1780. '''Custom node socket type'''
  1781. bl_idname = 'EnumTransformationAxes'
  1782. bl_label = "Axes"
  1783. default_value: bpy.props.EnumProperty(
  1784. items=eAxes,
  1785. # name="",
  1786. # description="",
  1787. default = 'X',
  1788. update = update_socket,)
  1789. color_simple = cString
  1790. color : bpy.props.FloatVectorProperty(default=cString, size=4)
  1791. input : bpy.props.BoolProperty(default =False,)
  1792. def draw(self, context, layout, node, text):
  1793. ChooseDraw(self, context, layout, node, text, use_enum=False)
  1794. def draw_color(self, context, node):
  1795. return self.color
  1796. @classmethod
  1797. def draw_color_simple(self):
  1798. return self.color_simple
  1799. #
  1800. eBBoneHandleType = (
  1801. ('AUTO', "Automatic", "", 0),
  1802. ('ABSOLUTE', "Absolute", "", 1),
  1803. ('RELATIVE', "Relative", "", 2),
  1804. ('TANGENT', "Tangent", "", 3),
  1805. )
  1806. class EnumBBoneHandleType(MantisSocket):
  1807. '''Custom node socket type'''
  1808. bl_idname = 'EnumBBoneHandleType'
  1809. bl_label = "Axes"
  1810. default_value: bpy.props.EnumProperty(
  1811. items=eBBoneHandleType,
  1812. # name="",
  1813. # description="",
  1814. default = 'AUTO',
  1815. update = update_socket,)
  1816. color_simple = cString
  1817. color : bpy.props.FloatVectorProperty(default=cString, size=4)
  1818. input : bpy.props.BoolProperty(default =False,)
  1819. def draw(self, context, layout, node, text):
  1820. ChooseDraw(self, context, layout, node, text, use_enum=False)
  1821. def draw_color(self, context, node):
  1822. return self.color
  1823. @classmethod
  1824. def draw_color_simple(self):
  1825. return self.color_simple
  1826. eSkinningMethod = (('EXISTING_GROUPS', "Use Existing Groups", "Use the existing vertex groups, or create empty groups if not found.",),
  1827. ('AUTOMATIC_HEAT', "Automatic (Heat)", "Use Blender's heatmap automatic skinning",),
  1828. ('COPY_FROM_OBJECT', "Copy from object", "Copy skin weights from the selected object"),)
  1829. class EnumSkinning(MantisSocket):
  1830. '''Custom node socket type'''
  1831. bl_idname = 'EnumSkinning'
  1832. bl_label = "Skinning Method"
  1833. default_value: bpy.props.EnumProperty(
  1834. items=eSkinningMethod,
  1835. name="Skinning Method",
  1836. description="Skinning Method",
  1837. default = 'AUTOMATIC_HEAT',
  1838. update = update_socket,)
  1839. color_simple = cString
  1840. color : bpy.props.FloatVectorProperty(default=cString, size=4)
  1841. input : bpy.props.BoolProperty(default =False,)
  1842. def draw(self, context, layout, node, text):
  1843. ChooseDraw(self, context, layout, node, text)
  1844. def draw_color(self, context, node):
  1845. return self.color
  1846. @classmethod
  1847. def draw_color_simple(self):
  1848. return self.color_simple
  1849. class MorphTargetSocket(MantisSocket):
  1850. """Morph Target"""
  1851. bl_idname = 'MorphTargetSocket'
  1852. bl_label = "Morph Target"
  1853. color_simple = cShapeKey
  1854. color : bpy.props.FloatVectorProperty(default=cShapeKey, size=4)
  1855. input : bpy.props.BoolProperty(default =False,)
  1856. is_valid_interface_type=True
  1857. def draw(self, context, layout, node, text):
  1858. ChooseDraw(self, context, layout, node, text)
  1859. def draw_color(self, context, node):
  1860. return self.color
  1861. @classmethod
  1862. def draw_color_simple(self):
  1863. return self.color_simple
  1864. eDriverVariableType = (
  1865. ( 'SINGLE_PROP',
  1866. "Property",
  1867. "Property",
  1868. 1),
  1869. ( 'LOC_DIFF',
  1870. "Distance",
  1871. "Distance",
  1872. 2),
  1873. ( 'ROTATION_DIFF',
  1874. "Rotational Difference",
  1875. "Rotational Difference",
  1876. 3),
  1877. # ( 'TRANSFORMS',
  1878. # "Transform Channel",
  1879. # "Transform Channel",
  1880. # 4),
  1881. )
  1882. class EnumDriverVariableType(MantisSocket):
  1883. '''Custom node socket type'''
  1884. bl_idname = 'EnumDriverVariableType'
  1885. bl_label = "Variable Type"
  1886. default_value: bpy.props.EnumProperty(
  1887. items = eDriverVariableType,
  1888. name = "Variable Type",
  1889. description = "Variable Type",
  1890. default = 'SINGLE_PROP',
  1891. update = driver_variable_socket_update,)
  1892. color_simple = cString
  1893. color : bpy.props.FloatVectorProperty(default=cString, size=4)
  1894. input : bpy.props.BoolProperty(default =False,)
  1895. def draw(self, context, layout, node, text):
  1896. ChooseDraw(self, context, layout, node, text, use_enum=False)
  1897. def draw_color(self, context, node):
  1898. return self.color
  1899. @classmethod
  1900. def draw_color_simple(self):
  1901. return self.color_simple
  1902. eDriverVariableEvaluationSpace = (
  1903. ( 'WORLD_SPACE',
  1904. "World",
  1905. "World",
  1906. 1),
  1907. ( 'TRANSFORM_SPACE',
  1908. "Transform",
  1909. "Transform",
  1910. 2),
  1911. ( 'LOCAL_SPACE',
  1912. "Local",
  1913. "Local",
  1914. 3),
  1915. )
  1916. class EnumDriverVariableEvaluationSpace(MantisSocket):
  1917. '''Custom node socket type'''
  1918. bl_idname = 'EnumDriverVariableEvaluationSpace'
  1919. bl_label = "Evaluation Space"
  1920. default_value: bpy.props.EnumProperty(
  1921. items = eDriverVariableEvaluationSpace,
  1922. name = "Evaluation Space",
  1923. description = "Evaluation Space",
  1924. default = 'WORLD_SPACE',
  1925. update = driver_variable_socket_update,)
  1926. color_simple = cString
  1927. color : bpy.props.FloatVectorProperty(default=cString, size=4)
  1928. input : bpy.props.BoolProperty(default =False,)
  1929. def draw(self, context, layout, node, text):
  1930. ChooseDraw(self, context, layout, node, text, use_enum=False)
  1931. def draw_color(self, context, node):
  1932. return self.color
  1933. @classmethod
  1934. def draw_color_simple(self):
  1935. return self.color_simple
  1936. eDriverVariableTransformChannel = (
  1937. ("LOC_X", "X Location", "The X-coordinate of an object's location.", 1),
  1938. ("LOC_Y", "Y Location", "The Y-coordinate of an object's location.", 2),
  1939. ("LOC_Z", "Z Location", "The Z-coordinate of an object's location.", 3),
  1940. ("ROT_X", "X Rotation", "Rotation X-axis.", 4),
  1941. ("ROT_Y", "Y Rotation", "Rotation Y-axis.", 5),
  1942. ("ROT_Z", "Z Rotation", "Rotation Z-axis.", 6),
  1943. ("ROT_W", "W Rotation", "Rotation W-axis.", 7),
  1944. ("SCALE_X", "X Scale", "The X-scale of an object's scale.", 8),
  1945. ("SCALE_Y", "Y Scale", "The Y-scale of an object's scale.", 9),
  1946. ("SCALE_Z", "Z Scale", "The Z-scale of an object's scale.", 10),
  1947. ("SCALE_AVG", "Average Scale", "The scale factor of an object's scale.", 11),
  1948. )
  1949. class EnumDriverVariableTransformChannel(MantisSocket):
  1950. '''Custom node socket type'''
  1951. bl_idname = 'EnumDriverVariableTransformChannel'
  1952. bl_label = "Transform Channel"
  1953. default_value: bpy.props.EnumProperty(
  1954. items = eDriverVariableTransformChannel,
  1955. name = "Transform Channel",
  1956. description = "Transform Channel",
  1957. default = 'LOC_X',
  1958. update = driver_variable_socket_update,)
  1959. color_simple = cString
  1960. color : bpy.props.FloatVectorProperty(default=cString, size=4)
  1961. input : bpy.props.BoolProperty(default =False,)
  1962. def draw(self, context, layout, node, text):
  1963. ChooseDraw(self, context, layout, node, text, use_enum=False)
  1964. def draw_color(self, context, node):
  1965. return self.color
  1966. @classmethod
  1967. def draw_color_simple(self):
  1968. return self.color_simple
  1969. class EnumDriverRotationMode(MantisSocket):
  1970. '''Custom node socket type'''
  1971. bl_idname = 'EnumDriverRotationMode'
  1972. bl_label = "Rotaton Mode"
  1973. default_value: bpy.props.EnumProperty(
  1974. items = eRotationMode,
  1975. name = "Rotation Mode",
  1976. description = "Rotation Mode",
  1977. default = 'AUTO',
  1978. update = driver_variable_socket_update,)
  1979. color_simple = cString
  1980. color : bpy.props.FloatVectorProperty(default=cString, size=4)
  1981. input : bpy.props.BoolProperty(default =False,)
  1982. def draw(self, context, layout, node, text):
  1983. ChooseDraw(self, context, layout, node, text, use_enum=False)
  1984. def draw_color(self, context, node):
  1985. return self.color
  1986. @classmethod
  1987. def draw_color_simple(self):
  1988. return self.color_simple
  1989. #
  1990. eDriverType = (('AVERAGE', 'Average', 'Average', 0),
  1991. ('SUM', "Sum", "Sum", 1),
  1992. ('SCRIPTED', "Scripted", "Scripted Expression", 2),
  1993. ('MIN', "Min", "Minimum", 3),
  1994. ('MAX', "Max", "Maximum", 4),)
  1995. class EnumDriverType(MantisSocket):
  1996. '''Custom node socket type'''
  1997. bl_idname = 'EnumDriverType'
  1998. bl_label = "Driver Type"
  1999. default_value: bpy.props.EnumProperty(
  2000. items = eDriverType,
  2001. name = "Driver Type",
  2002. description = "Driver Type",
  2003. default = 'AVERAGE',
  2004. update = driver_socket_update,)
  2005. color_simple = cString
  2006. color : bpy.props.FloatVectorProperty(default=cString, size=4)
  2007. input : bpy.props.BoolProperty(default =False,)
  2008. def draw(self, context, layout, node, text):
  2009. ChooseDraw(self, context, layout, node, text, use_enum=False)
  2010. def draw_color(self, context, node):
  2011. return self.color
  2012. @classmethod
  2013. def draw_color_simple(self):
  2014. return self.color_simple
  2015. # Keyframe
  2016. # Enum for kf handle type
  2017. # enum for interpolation type
  2018. # eventually gonna make it to the fancy stuff
  2019. class FloatSocket(MantisSocket):
  2020. """Float Input socket"""
  2021. bl_idname = 'FloatSocket'
  2022. bl_label = "Float"
  2023. is_valid_interface_type=True
  2024. default_value : bpy.props.FloatProperty(default = 0.0, update = update_socket,)
  2025. color_simple = cFloat
  2026. color : bpy.props.FloatVectorProperty(default=cFloat, size=4)
  2027. input : bpy.props.BoolProperty(default =False,)
  2028. def draw(self, context, layout, node, text):
  2029. ChooseDraw(self, context, layout, node, text)
  2030. def draw_color(self, context, node):
  2031. return self.color
  2032. @classmethod
  2033. def draw_color_simple(self):
  2034. return self.color_simple
  2035. class FloatPositiveSocket(MantisSocket):
  2036. """Float Input socket"""
  2037. bl_idname = 'FloatPositiveSocket'
  2038. bl_label = "Float (Positive)"
  2039. is_valid_interface_type=True
  2040. default_value : bpy.props.FloatProperty(default = 0.0, min=0, update = update_socket,)
  2041. color_simple = cFloat
  2042. color : bpy.props.FloatVectorProperty(default=cFloat, size=4)
  2043. input : bpy.props.BoolProperty(default =False,)
  2044. def draw(self, context, layout, node, text):
  2045. ChooseDraw(self, context, layout, node, text)
  2046. def draw_color(self, context, node):
  2047. return self.color
  2048. @classmethod
  2049. def draw_color_simple(self):
  2050. return self.color_simple
  2051. class FloatFactorSocket(MantisSocket):
  2052. '''xFrom Input Output'''
  2053. bl_idname = 'FloatFactorSocket'
  2054. bl_label = "Float (Factor)"
  2055. is_valid_interface_type=True
  2056. default_value : bpy.props.FloatProperty(
  2057. default = 0.0,
  2058. min = 0.0,
  2059. max=1.0,
  2060. update = update_socket,
  2061. subtype='FACTOR',)
  2062. color_simple = cFloat
  2063. color : bpy.props.FloatVectorProperty(default=cFloat, size=4)
  2064. input : bpy.props.BoolProperty(default =False,)
  2065. def draw(self, context, layout, node, text):
  2066. ChooseDraw(self, context, layout, node, text)
  2067. def draw_color(self, context, node):
  2068. return self.color
  2069. @classmethod
  2070. def draw_color_simple(self):
  2071. return self.color_simple
  2072. class FloatAngleSocket(MantisSocket):
  2073. '''xFrom Input Output'''
  2074. bl_idname = 'FloatAngleSocket'
  2075. bl_label = "Float (Angle)"
  2076. is_valid_interface_type=True
  2077. default_value : bpy.props.FloatProperty(
  2078. default = 0.0,
  2079. min = -180,
  2080. max=180,
  2081. update = update_socket,
  2082. subtype='ANGLE',)
  2083. color_simple = cFloat
  2084. color : bpy.props.FloatVectorProperty(default=cFloat, size=4)
  2085. input : bpy.props.BoolProperty(default =False,)
  2086. def draw(self, context, layout, node, text):
  2087. ChooseDraw(self, context, layout, node, text)
  2088. def draw_color(self, context, node):
  2089. return self.color
  2090. @classmethod
  2091. def draw_color_simple(self):
  2092. return self.color_simple
  2093. class VectorSocket(MantisSocket):
  2094. """Vector Input socket"""
  2095. bl_idname = 'VectorSocket'
  2096. bl_label = "Vector"
  2097. is_valid_interface_type=True
  2098. default_value : bpy.props.FloatVectorProperty(
  2099. default = (0.0, 0.0, 0.0),
  2100. update = update_socket,)
  2101. color_simple = cVector
  2102. color : bpy.props.FloatVectorProperty(default=cVector, size=4)
  2103. input : bpy.props.BoolProperty(default =False,)
  2104. def draw(self, context, layout, node, text):
  2105. ChooseDraw(self, context, layout, node, text)
  2106. def draw_color(self, context, node):
  2107. return self.color
  2108. @classmethod
  2109. def draw_color_simple(self):
  2110. return self.color_simple
  2111. class VectorEulerSocket(MantisSocket):
  2112. """Vector Input socket"""
  2113. bl_idname = 'VectorEulerSocket'
  2114. bl_label = "Euler"
  2115. is_valid_interface_type=True
  2116. default_value : bpy.props.FloatVectorProperty(
  2117. default = (0.0, 0.0, 0.0),
  2118. update = update_socket,
  2119. subtype='EULER',)
  2120. color_simple = cVector
  2121. color : bpy.props.FloatVectorProperty(default=cVector, size=4)
  2122. input : bpy.props.BoolProperty(default =False,)
  2123. def draw(self, context, layout, node, text):
  2124. ChooseDraw(self, context, layout, node, text)
  2125. def draw_color(self, context, node):
  2126. return self.color
  2127. @classmethod
  2128. def draw_color_simple(self):
  2129. return self.color_simple
  2130. class VectorTranslationSocket(MantisSocket):
  2131. """Vector Input socket"""
  2132. bl_idname = 'VectorTranslationSocket'
  2133. bl_label = "Vector (Translation)"
  2134. default_value : bpy.props.FloatVectorProperty(
  2135. default = (0.0, 0.0, 0.0),
  2136. update = update_socket,
  2137. subtype='TRANSLATION',)
  2138. color_simple = cVector
  2139. color : bpy.props.FloatVectorProperty(default=cVector, size=4)
  2140. input : bpy.props.BoolProperty(default =False,)
  2141. def draw(self, context, layout, node, text):
  2142. ChooseDraw(self, context, layout, node, text)
  2143. def draw_color(self, context, node):
  2144. return self.color
  2145. @classmethod
  2146. def draw_color_simple(self):
  2147. return self.color_simple
  2148. class VectorScaleSocket(MantisSocket):
  2149. """Vector Input socket"""
  2150. bl_idname = 'VectorScaleSocket'
  2151. bl_label = "Vector (Scale)"
  2152. default_value : bpy.props.FloatVectorProperty(
  2153. default = (1.0, 1.0, 1.0),
  2154. update = update_socket,
  2155. subtype='XYZ',)
  2156. color_simple = cVector
  2157. color : bpy.props.FloatVectorProperty(default=cVector, size=4)
  2158. input : bpy.props.BoolProperty(default =False,)
  2159. def draw(self, context, layout, node, text):
  2160. ChooseDraw(self, context, layout, node, text)
  2161. def draw_color(self, context, node):
  2162. return self.color
  2163. @classmethod
  2164. def draw_color_simple(self):
  2165. return self.color_simple
  2166. class KeyframeSocket(MantisSocket):
  2167. '''Keyframe'''
  2168. bl_idname = 'KeyframeSocket'
  2169. bl_label = "Keyframe"
  2170. is_valid_interface_type=True
  2171. color_simple = cKeyframe
  2172. color : bpy.props.FloatVectorProperty(default=cKeyframe, size=4)
  2173. input : bpy.props.BoolProperty(default =False, update = update_socket)
  2174. def init(self):
  2175. self.display_shape = 'CIRCLE_DOT'
  2176. def draw(self, context, layout, node, text):
  2177. ChooseDraw(self, context, layout, node, text)
  2178. def draw_color(self, context, node):
  2179. return self.color
  2180. @classmethod
  2181. def draw_color_simple(self):
  2182. return self.color_simple
  2183. EnumKeyframeInterpolationType = (('CONSTANT', 'Stepped', 'Stepped'),
  2184. ('LINEAR', "Linear", "Linear"),
  2185. ('BEZIER', "Bezier", "Bezier"),)
  2186. class EnumKeyframeInterpolationTypeSocket(MantisSocket):
  2187. '''Keyframe Interpolation Type'''
  2188. bl_idname = 'EnumKeyframeInterpolationTypeSocket'
  2189. bl_label = "Keyframe Interpolation Type"
  2190. default_value :bpy.props.EnumProperty(
  2191. name="",
  2192. description="Interpolation",
  2193. items=EnumKeyframeInterpolationType,
  2194. default='LINEAR',
  2195. update = update_socket,)
  2196. color_simple = cString
  2197. color : bpy.props.FloatVectorProperty(default=cString, size=4)
  2198. input : bpy.props.BoolProperty(default =False, update = update_socket)
  2199. def draw(self, context, layout, node, text):
  2200. ChooseDraw(self, context, layout, node, text)
  2201. def draw_color(self, context, node):
  2202. return self.color
  2203. @classmethod
  2204. def draw_color_simple(self):
  2205. return self.color_simple
  2206. EnumKeyframeBezierHandleType = (('FREE', 'Free', 'Completely independent manually set handle.'),
  2207. ('ALIGNED', "Aligned", "Manually set handle with rotation locked together with its pair."),
  2208. ('VECTOR', "Vector", "Automatic handles that create straight lines."),
  2209. ('AUTO', "Automatic", "Automatic handles that create smooth curves."),
  2210. ('AUTO_CLAMPED', "Auto Clamped", "Automatic handles that create smooth curves which only change direction at keyframes."),)
  2211. class EnumKeyframeBezierHandleTypeSocket(MantisSocket):
  2212. '''Keyframe Bezier Handle Type'''
  2213. bl_idname = 'EnumKeyframeBezierHandleTypeSocket'
  2214. bl_label = "Keyframe Bezier Handle Type"
  2215. default_value :bpy.props.EnumProperty(
  2216. name="",
  2217. description="Handle Type",
  2218. items=EnumKeyframeBezierHandleType,
  2219. default='AUTO_CLAMPED',
  2220. update = update_socket,)
  2221. color_simple = cString
  2222. color : bpy.props.FloatVectorProperty(default=cString, size=4)
  2223. input : bpy.props.BoolProperty(default =False, update = update_socket)
  2224. def draw(self, context, layout, node, text):
  2225. ChooseDraw(self, context, layout, node, text)
  2226. def draw_color(self, context, node):
  2227. return self.color
  2228. @classmethod
  2229. def draw_color_simple(self):
  2230. return self.color_simple
  2231. enumExtrapolationMode = (('CONSTANT', 'Constant', 'Constant'),
  2232. ('LINEAR', "Linear", "Linear"),)
  2233. class eFCrvExtrapolationMode(MantisSocket):
  2234. '''FCurve Extrapolation Mode'''
  2235. bl_idname = 'eFCrvExtrapolationMode'
  2236. bl_label = "Extrapolation Mode"
  2237. default_value :bpy.props.EnumProperty(
  2238. name="",
  2239. description="Handle Type",
  2240. items=enumExtrapolationMode,
  2241. default='CONSTANT',
  2242. update = update_socket,)
  2243. color_simple = cString
  2244. color : bpy.props.FloatVectorProperty(default=cString, size=4)
  2245. input : bpy.props.BoolProperty(default =False, update = update_socket)
  2246. def draw(self, context, layout, node, text):
  2247. ChooseDraw(self, context, layout, node, text)
  2248. def draw_color(self, context, node):
  2249. return self.color
  2250. @classmethod
  2251. def draw_color_simple(self):
  2252. return self.color_simple
  2253. EnumLatticeInterpolationType = (('KEY_LINEAR', 'Linear', 'Linear Interpolation.'),
  2254. ('KEY_CARDINAL', "Cardinal", "Cardinal Interpolation."),
  2255. ('KEY_CATMULL_ROM', "Catmull Rom", "Catmull Rom Interpolation."),
  2256. ('KEY_BSPLINE', "B-Spline", "B Spline Interpolation."),)
  2257. class EnumLatticeInterpolationTypeSocket(MantisSocket):
  2258. '''Lattice Interpolation Type'''
  2259. bl_idname = 'EnumLatticeInterpolationTypeSocket'
  2260. bl_label = "Lattice Interpolation Type"
  2261. default_value :bpy.props.EnumProperty(
  2262. name="",
  2263. description="Interpolation Type",
  2264. items=EnumLatticeInterpolationType,
  2265. default='KEY_BSPLINE',
  2266. update = update_socket,)
  2267. color_simple = cString
  2268. color : bpy.props.FloatVectorProperty(default=cString, size=4)
  2269. input : bpy.props.BoolProperty(default =False, update = update_socket)
  2270. def draw(self, context, layout, node, text):
  2271. ChooseDraw(self, context, layout, node, text)
  2272. def draw_color(self, context, node):
  2273. return self.color
  2274. @classmethod
  2275. def draw_color_simple(self):
  2276. return self.color_simple
  2277. EnumCorrectiveSmoothType = (('SIMPLE', 'Simple', 'Use the average of adjacent edge-vertices.'),
  2278. ('LENGTH_WEIGHTED', "Length Weight", "Use the average of adjacent"
  2279. "edge-vertices weighted by their length."),)
  2280. class EnumCorrectiveSmoothTypeSocket(MantisSocket):
  2281. '''Lattice Interpolation Type'''
  2282. bl_idname = 'EnumCorrectiveSmoothTypeSocket'
  2283. bl_label = "Lattice Interpolation Type"
  2284. default_value :bpy.props.EnumProperty(
  2285. name="",
  2286. description="Interpolation Type",
  2287. items=EnumCorrectiveSmoothType,
  2288. default='SIMPLE',
  2289. update = update_socket,)
  2290. color_simple = cString
  2291. color : bpy.props.FloatVectorProperty(default=cString, size=4)
  2292. input : bpy.props.BoolProperty(default =False, update = update_socket)
  2293. def draw(self, context, layout, node, text):
  2294. ChooseDraw(self, context, layout, node, text)
  2295. def draw_color(self, context, node):
  2296. return self.color
  2297. @classmethod
  2298. def draw_color_simple(self):
  2299. return self.color_simple
  2300. enumFloatOperations = (('ADD', 'Add', 'Add'),
  2301. ('SUBTRACT', "Subtract", "Subtract"),
  2302. ('MULTIPLY', "Multiply", "Multiply"),
  2303. ('DIVIDE', "Divide", "Divide"),
  2304. ('POWER', "Power", "Power"),
  2305. ('FLOOR_DIVIDE', "Floor Divide", "Floor Divide"),
  2306. ('MODULUS', "Modulus", "Modulus"),
  2307. ('ABSOLUTE', "Absolute", "Absolute Value"),
  2308. ('MAXIMUM', "Maximum", "Maximum"),
  2309. ('MINIMUM', "Minimum", "Minimum"),
  2310. ('GREATER THAN', "Greater Than", "Greater Than"),
  2311. ('LESS THAN', "Less Than", "Less Than"),
  2312. ('ARCTAN2', "atan2", "2-argument arctan function"),
  2313. ('FLOOR', "Floor", "the nearest integer lower than input A"),
  2314. ('CEIL', "Ceiling", "the next integer higher than input A"),
  2315. ('ROUND', "Round", "Round to the nearest integer"),)
  2316. class MathFloatOperation(MantisSocket):
  2317. """Float Math Operation"""
  2318. bl_idname = 'MathFloatOperation'
  2319. bl_label = "Operation"
  2320. default_value :bpy.props.EnumProperty(
  2321. name="",
  2322. description="Operation",
  2323. items=enumFloatOperations,
  2324. default='MULTIPLY',
  2325. update = update_socket,)
  2326. color_simple = cString
  2327. color : bpy.props.FloatVectorProperty(default=cString, size=4)
  2328. input : bpy.props.BoolProperty(default =False,)
  2329. def draw(self, context, layout, node, text):
  2330. ChooseDraw(self, context, layout, node, text)
  2331. def draw_color(self, context, node):
  2332. return self.color
  2333. @classmethod
  2334. def draw_color_simple(self):
  2335. return self.color_simple
  2336. enumVectorOperations = (('ADD', 'Add', 'Add (Component-wise)'),
  2337. ('SUBTRACT', "Subtract", "Subtract (Component-wise)"),
  2338. ('MULTIPLY', "Multiply", "Multiply (Component-wise)"),
  2339. ('SCALE', "Scale", "Scales vector by input float or average magnitude of input vector's components."),
  2340. ('DIVIDE', "Divide", "Divide (Component-wise)"),
  2341. ('POWER', "Power", "Power (Component-wise)"),
  2342. ('LENGTH', "Length", "Length"),
  2343. ('CROSS', "Cross Product", "Cross product of A X B"),
  2344. ('NORMALIZE', "Normalize", "Returns a normalized vector."),
  2345. ('DOT', "Dot Product", "Dot product of A . B"),
  2346. ('LINEAR_INTERP', "Linear Interpolation", "Linear Interpolation between vectors A and B by factor"))
  2347. class MathVectorOperation(MantisSocket):
  2348. """Vector Math Operation"""
  2349. bl_idname = 'MathVectorOperation'
  2350. bl_label = "Operation"
  2351. default_value :bpy.props.EnumProperty(
  2352. name="",
  2353. description="Operation",
  2354. items=enumVectorOperations,
  2355. default='MULTIPLY',
  2356. update = update_socket,)
  2357. color_simple = cString
  2358. color : bpy.props.FloatVectorProperty(default=cString, size=4)
  2359. input : bpy.props.BoolProperty(default =False,)
  2360. def draw(self, context, layout, node, text):
  2361. ChooseDraw(self, context, layout, node, text)
  2362. def draw_color(self, context, node):
  2363. return self.color
  2364. @classmethod
  2365. def draw_color_simple(self):
  2366. return self.color_simple
  2367. enumMatrixTransform = (('TRANSLATE', 'Translate', 'Translate'),
  2368. ('ROTATE_AXIS_ANGLE', "Rotate (Axis-angle)", "Rotates a number of radians around an axis"),
  2369. # ('ROTATE_EULER', "Rotate (Euler)", "Euler Rotation"),
  2370. # ('ROTATE_QUATERNION', "Rotate (Quaternion)", "Quaternion Rotation"),
  2371. ('SCALE', "Scale", "Scale"),)
  2372. class MatrixTransformOperation(MantisSocket):
  2373. """Matrix Transform Operation"""
  2374. bl_idname = 'MatrixTransformOperation'
  2375. bl_label = "Operation"
  2376. default_value :bpy.props.EnumProperty(
  2377. name="",
  2378. description="Operation",
  2379. items=enumMatrixTransform,
  2380. default='TRANSLATE',
  2381. update = update_socket,)
  2382. color_simple = cString
  2383. color : bpy.props.FloatVectorProperty(default=cString, size=4)
  2384. input : bpy.props.BoolProperty(default =False,)
  2385. def draw(self, context, layout, node, text):
  2386. ChooseDraw(self, context, layout, node, text)
  2387. def draw_color(self, context, node):
  2388. return self.color
  2389. @classmethod
  2390. def draw_color_simple(self):
  2391. return self.color_simple
  2392. enumIntOperations = (('ADD', 'Add', 'Add'),
  2393. ('SUBTRACT', "Subtract", "Subtract"),
  2394. ('MULTIPLY', "Multiply", "Multiply"),
  2395. ('FLOOR_DIVIDE', "Floor Divide", "Floor Divide"),
  2396. ('POWER', "Power", "Power"),
  2397. ('MODULUS', "Modulus", "Modulus"),
  2398. ('ABSOLUTE', "Absolute", "Absolute Value"),
  2399. ('MAXIMUM', "Maximum", "Maximum"),
  2400. ('MINIMUM', "Minimum", "Minimum"),
  2401. ('GREATER THAN', "Greater Than", "Greater Than"),
  2402. ('LESS THAN', "Less Than", "Less Than"),)
  2403. class MathIntOperation(MantisSocket):
  2404. """Int Math Operation"""
  2405. bl_idname = 'MathIntOperation'
  2406. bl_label = "Operation"
  2407. default_value :bpy.props.EnumProperty(
  2408. name="",
  2409. description="Operation",
  2410. items=enumIntOperations,
  2411. default='MULTIPLY',
  2412. update = update_socket,)
  2413. color_simple = cString
  2414. color : bpy.props.FloatVectorProperty(default=cString, size=4)
  2415. input : bpy.props.BoolProperty(default =False,)
  2416. def draw(self, context, layout, node, text):
  2417. ChooseDraw(self, context, layout, node, text)
  2418. def draw_color(self, context, node):
  2419. return self.color
  2420. @classmethod
  2421. def draw_color_simple(self):
  2422. return self.color_simple
  2423. enumCompareOperations = (('EQUAL', "Equal", "Equal"),
  2424. ('NOT_EQUAL', "Not Equal", "Not Equal"),
  2425. ('GREATER_THAN', "Greater Than", "Greater Than"),
  2426. ('GREATER_THAN_EQUAL', "Greater Than or Equal", "Greater Than or Equal"),
  2427. ('LESS_THAN', "Less Than", "Less Than"),
  2428. ('LESS_THAN_EQUAL', "Equal or Less Than", "Equal or Less Than"),)
  2429. class EnumCompareOperation(MantisSocket):
  2430. """Compare Operation"""
  2431. bl_idname = 'EnumCompareOperation'
  2432. bl_label = "Comparison"
  2433. default_value :bpy.props.EnumProperty(
  2434. name="",
  2435. description="Comparison",
  2436. items=enumCompareOperations,
  2437. default='EQUAL',
  2438. update = update_socket,)
  2439. color_simple = cString
  2440. color : bpy.props.FloatVectorProperty(default=cString, size=4)
  2441. input : bpy.props.BoolProperty(default =False,)
  2442. def draw(self, context, layout, node, text):
  2443. ChooseDraw(self, context, layout, node, text)
  2444. def draw_color(self, context, node):
  2445. return self.color
  2446. @classmethod
  2447. def draw_color_simple(self):
  2448. return self.color_simple
  2449. class WildcardSocket(MantisSocket):
  2450. """Some kind of node socket lol I donno"""
  2451. bl_idname = 'WildcardSocket'
  2452. bl_label = ""
  2453. color_simple = (0.0,0.0,0.0,0.0)
  2454. color : bpy.props.FloatVectorProperty(default=(0.0,0.0,0.0,0.0), size=4)
  2455. input : bpy.props.BoolProperty(default =False,)
  2456. def draw(self, context, layout, node, text):
  2457. ChooseDraw(self, context, layout, node, text)
  2458. def draw_color(self, context, node):
  2459. return self.color
  2460. @classmethod
  2461. def draw_color_simple(self):
  2462. return self.color_simple