socket_definitions.py 104 KB

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