socket_definitions.py 84 KB

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