socket_definitions.py 85 KB

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