deformer_containers.py 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548
  1. from .node_container_common import *
  2. from .xForm_containers import xFormGeometryObject, xFormObjectInstance
  3. from .misc_nodes import InputExistingGeometryObject
  4. from .base_definitions import MantisNode, MantisSocketTemplate
  5. from .utilities import (prRed, prGreen, prPurple, prWhite, prOrange,
  6. wrapRed, wrapGreen, wrapPurple, wrapWhite,
  7. wrapOrange,)
  8. from .deformer_socket_templates import *
  9. from bpy.types import NodeTree
  10. def TellClasses():
  11. return [
  12. DeformerArmature,
  13. DeformerHook,
  14. DeformerMorphTarget,
  15. DeformerMorphTargetDeform,
  16. ]
  17. # object instance probably can't use the deformer but it doesn't hurt to try.
  18. deformable_types= (xFormGeometryObject, InputExistingGeometryObject, xFormObjectInstance)
  19. def trace_xForm_back(nc, socket):
  20. if (trace := trace_single_line(nc, socket)[0] ) :
  21. for i in range(len(trace)): # have to look in reverse, actually
  22. if ( isinstance(trace[ i ], deformable_types ) ):
  23. return trace[ i ].bGetObject()
  24. raise GraphError(wrapRed(f"No other object found for {nc}."))
  25. class MantisDeformerNode(MantisNode):
  26. def __init__(self, signature : tuple,
  27. base_tree : NodeTree,
  28. socket_templates : list[MantisSocketTemplate]=[]):
  29. super().__init__(signature, base_tree, socket_templates)
  30. self.node_type = 'LINK'
  31. self.prepared = True
  32. self.bObject=[]
  33. # we need evaluate_input to have the same behaviour as links.
  34. def evaluate_input(self, input_name, index=0):
  35. if ('Target' in input_name):
  36. socket = self.inputs.get(input_name)
  37. if socket.is_linked:
  38. return socket.links[0].from_node
  39. return None
  40. else:
  41. return super().evaluate_input(input_name, index)
  42. def GetxForm(nc, output_name="Deformer"):
  43. break_condition= lambda node : node.__class__ in deformable_types
  44. xforms = trace_line_up_branching(nc, output_name, break_condition)
  45. return_me=[]
  46. for xf in xforms:
  47. if xf.node_type != 'XFORM':
  48. continue
  49. return_me.append(xf)
  50. return return_me
  51. class DeformerArmature(MantisDeformerNode):
  52. '''A node representing an armature deformer'''
  53. def __init__(self, signature, base_tree):
  54. super().__init__(signature, base_tree)
  55. inputs = [
  56. "Input Relationship",
  57. "Armature Object",
  58. "Blend Vertex Group",
  59. "Invert Vertex Group",
  60. "Preserve Volume",
  61. "Use Multi Modifier",
  62. "Use Envelopes",
  63. "Use Vertex Groups",
  64. "Skinning Method",
  65. "Deformer",
  66. "Copy Skin Weights From"
  67. ]
  68. outputs = [
  69. "Deformer"
  70. ]
  71. self.outputs.init_sockets(outputs)
  72. self.inputs.init_sockets(inputs)
  73. self.init_parameters(additional_parameters={"Name":None})
  74. self.set_traverse([("Deformer", "Deformer")])
  75. self.node_type = "LINK"
  76. self.prepared = True
  77. def GetxForm(self, socket="Deformer"):
  78. if socket == "Deformer":
  79. return super().GetxForm()
  80. else:
  81. trace_xForm_back(self, socket)
  82. # DUPLICATED FROM xForm_containers::xFormBone
  83. # DEDUP HACK HACK HACK HACK HACK
  84. def bGetParentArmature(self):
  85. from .xForm_containers import xFormArmature
  86. from .misc_nodes import InputExistingGeometryObject
  87. from bpy.types import Object
  88. if (trace := trace_single_line(self, "Armature Object")[0] ) :
  89. for i in range(len(trace)):
  90. # have to look in reverse, actually
  91. if ( isinstance(trace[ i ], xFormArmature ) ):
  92. return trace[ i ].bGetObject()
  93. elif ( isinstance(trace[i], InputExistingGeometryObject)):
  94. if (ob := trace[i].bGetObject()).type == "ARMATURE":
  95. return ob
  96. raise RuntimeError(f"Cannot find armature for node {self}")
  97. return None
  98. #should do the trick...
  99. def bExecute(self, bContext = None,):
  100. self.executed = True
  101. def initialize_vgroups(self, xf):
  102. ob = xf.bGetObject()
  103. armOb = self.bGetParentArmature()
  104. for b in armOb.data.bones:
  105. if b.use_deform == False:
  106. continue
  107. vg = ob.vertex_groups.get(b.name)
  108. if not vg:
  109. vg = ob.vertex_groups.new(name=b.name)
  110. num_verts = len(ob.data.vertices)
  111. vg.add(range(num_verts), 0, 'REPLACE')
  112. def copy_weights(self, xf):
  113. # we'll use modifiers for this, maybe use GN for it in the future tho
  114. import bpy
  115. ob = xf.bGetObject()
  116. try:
  117. copy_from = self.GetxForm(socket="Copy Skin Weights From")
  118. except GraphError:
  119. copy_from = None
  120. prRed(f"No object found for copying weights in {self}, continuing anyway.")
  121. m = ob.modifiers.new(type="DATA_TRANSFER", name="Mantis_temp_data_transfer")
  122. m.object = None; m.use_vert_data = True
  123. m.data_types_verts = {'VGROUP_WEIGHTS'}
  124. m.vert_mapping = 'POLYINTERP_NEAREST'
  125. m.layers_vgroup_select_src = 'ALL'
  126. m.layers_vgroup_select_dst = 'NAME'
  127. m.object = copy_from
  128. # m.use_object_transform = False # testing reveals that this is undesirable - since the objects may not have their transforms applied.
  129. ob.modifiers.move(len(ob.modifiers)-1, 0)
  130. # ob.data = ob.data.copy()
  131. if False: #MAYBE the mouse needs to be in the 3D viewport, no idea how to set this in an override
  132. # TODO: figure out how to apply this, context is incorrect because armature is still in pose mode
  133. original_active = bpy.context.active_object
  134. original_mode = original_active.mode
  135. bpy.ops.object.mode_set(mode='OBJECT')
  136. with bpy.context.temp_override(**{'active_object':ob, 'selected_objects':[ob, copy_from]}):
  137. # bpy.ops.object.datalayout_transfer(modifier=m.name) # note: this operator is used by the modifier or stand-alone in the UI
  138. # the poll for this operator is defined in blender/source/blender/editors/object/object_data_transfer.cc
  139. # and blender/source/blender/editors/object/object_modifier.cc
  140. # bpy.ops.object.modifier_apply(modifier=m.name, single_user=True)
  141. bpy.ops.object.datalayout_transfer(data_type='VGROUP_WEIGHTS')
  142. bpy.ops.object.data_transfer(data_type='VGROUP_WEIGHTS')
  143. bpy.ops.object.mode_set(mode=original_mode)
  144. def bFinalize(self, bContext=None):
  145. prGreen("Executing Armature Deform Node")
  146. mod_name = self.evaluate_input("Name")
  147. for xf in self.GetxForm():
  148. ob = xf.bGetObject()
  149. d = ob.modifiers.new(mod_name, type='ARMATURE')
  150. if d is None:
  151. raise RuntimeError(f"Modifier was not created in node {self} -- the object is invalid.")
  152. self.bObject.append(d)
  153. d.object = self.bGetParentArmature()
  154. props_sockets = {
  155. 'vertex_group' : ("Blend Vertex Group", ""),
  156. 'invert_vertex_group' : ("Invert Vertex Group", ""),
  157. 'use_deform_preserve_volume' : ("Preserve Volume", False),
  158. 'use_multi_modifier' : ("Use Multi Modifier", False),
  159. 'use_bone_envelopes' : ("Use Envelopes", False),
  160. 'use_vertex_groups' : ("Use Vertex Groups", False),
  161. }
  162. evaluate_sockets(self, d, props_sockets)
  163. #
  164. if (skin_method := self.evaluate_input("Skinning Method")) == "AUTOMATIC_HEAT":
  165. # This is bad and leads to somewhat unpredictable
  166. # behaviour, e.g. what object will be selected? What mode?
  167. # also bpy.ops is ugly and prone to error when used in
  168. # scripts. I don't intend to use bpy.ops when I can avoid it.
  169. import bpy
  170. self.initialize_vgroups(xf)
  171. bContext.view_layer.depsgraph.update()
  172. armOb = self.bGetParentArmature()
  173. deform_bones = []
  174. for pb in armOb.pose.bones:
  175. if pb.bone.use_deform == True:
  176. deform_bones.append(pb)
  177. context_override = {
  178. 'active_object':ob,
  179. 'selected_objects':[ob, armOb],
  180. 'active_pose_bone':deform_bones[0],
  181. 'selected_pose_bones':deform_bones,}
  182. for b in armOb.data.bones:
  183. b.select = True
  184. with bContext.temp_override(**context_override):
  185. bpy.ops.paint.weight_paint_toggle()
  186. bpy.ops.paint.weight_from_bones(type='AUTOMATIC')
  187. bpy.ops.paint.weight_paint_toggle()
  188. for b in armOb.data.bones:
  189. b.select = False
  190. # TODO: modify Blender to make this available as a Python API function.
  191. elif skin_method == "COPY_FROM_OBJECT":
  192. self.initialize_vgroups(xf)
  193. self.copy_weights(xf)
  194. # elif skin_method == "EXISTING_GROUPS":
  195. # pass
  196. class DeformerHook(MantisDeformerNode):
  197. '''A node representing a hook deformer'''
  198. def __init__(self, signature, base_tree):
  199. super().__init__(signature, base_tree, HookSockets)
  200. # now set up the traverse target...
  201. self.init_parameters(additional_parameters={"Name":None})
  202. self.set_traverse([("Deformer", "Deformer")])
  203. self.prepared = True
  204. def driver_for_radius(self, object, hook, index, influence, bezier=True):
  205. """ Creates a driver to control the radius of a curve point with the hook."""
  206. from bpy.types import Bone, PoseBone
  207. var_template = {"owner":hook,
  208. "name":"a",
  209. "type":"TRANSFORMS",
  210. "space":'WORLD_SPACE',
  211. "channel":'SCALE_X',}
  212. var1_template = {"owner":hook.id_data,
  213. "name":"b",
  214. "type":"TRANSFORMS",
  215. "space":'WORLD_SPACE',
  216. "channel":'SCALE_X',}
  217. keys_template = [{"co":(0,0),
  218. "interpolation": "LINEAR",
  219. "type":"KEYFRAME",},
  220. {"co":(1,influence),
  221. "interpolation": "LINEAR",
  222. "type":"KEYFRAME",},]
  223. if bezier:
  224. owner=object.data.splines[0].bezier_points
  225. else:
  226. owner=object.data.splines[0].points
  227. driver = {
  228. "owner":owner[index],
  229. "prop":"radius",
  230. "ind":-1,
  231. "extrapolation":"LINEAR",
  232. "type":"AVERAGE",
  233. "vars":[],
  234. "keys":keys_template,
  235. }
  236. if isinstance(hook, (Bone, PoseBone)):
  237. driver['type']='SCRIPTED'
  238. driver['expression']="(((1/b)*a)+((1/b_001)*a_001)+((1/b_002)*a_002))/3"
  239. from .drivers import CreateDrivers
  240. axes='XYZ'
  241. for i in range(3):
  242. var = var_template.copy()
  243. var["channel"]="SCALE_"+axes[i]
  244. driver["vars"].append(var)
  245. if isinstance(hook, (Bone, PoseBone)):
  246. var1=var1_template.copy()
  247. var1['channel']="SCALE_"+axes[i]
  248. driver['vars'].append(var1)
  249. CreateDrivers([driver])
  250. def bExecute(self, bContext = None,):
  251. self.executed = True
  252. def bFinalize(self, bContext=None):
  253. from bpy.types import Bone, PoseBone, Object
  254. prGreen(f"Executing Hook Deform Node: {self}")
  255. mod_name = self.evaluate_input("Name")
  256. affect_radius = self.evaluate_input("Affect Curve Radius")
  257. auto_bezier = self.evaluate_input("Auto-Bezier")
  258. target_node = self.evaluate_input('Hook Target')
  259. target = target_node.bGetObject(); subtarget = ""
  260. props_sockets = self.gen_property_socket_map()
  261. if isinstance(target, Bone) or isinstance(target, PoseBone):
  262. subtarget = target.name; target = target.id_data
  263. for xf in self.GetxForm():
  264. ob=xf.bGetObject()
  265. if ob.type == 'CURVE':
  266. spline_index = self.evaluate_input("Spline Index")
  267. from .utilities import get_extracted_spline_object
  268. ob = get_extracted_spline_object(ob, spline_index, self.mContext)
  269. reuse = False
  270. for m in ob.modifiers:
  271. if m.type == 'HOOK' and m.object == target and m.subtarget == subtarget:
  272. if self.evaluate_input("Influence") != m.strength:
  273. continue # make a new modifier so they can have different strengths
  274. if ob.animation_data: # this can be None
  275. drivers = ob.animation_data.drivers
  276. for k in props_sockets.keys():
  277. if driver := drivers.find(k):
  278. # TODO: I should check to see if the drivers are the same...
  279. break # continue searching for an equivalent modifier
  280. else: # There was no driver - use this one.
  281. d = m; reuse = True; break
  282. else: # use this one, there can't be drivers without animation_data.
  283. d = m; reuse = True; break
  284. else:
  285. d = ob.modifiers.new(mod_name, type='HOOK')
  286. if d is None:
  287. raise RuntimeError(f"Modifier was not created in node {self} -- the object is invalid.")
  288. self.bObject.append(d)
  289. self.get_target_and_subtarget(d, input_name="Hook Target")
  290. vertices_used=[]
  291. if reuse: # Get the verts in the list... filter out all the unneeded 0's
  292. vertices_used = list(d.vertex_indices)
  293. include_0 = 0 in vertices_used
  294. vertices_used = list(filter(lambda a : a != 0, vertices_used))
  295. if include_0: vertices_used.append(0)
  296. # now we add the selected vertex to the list, too
  297. vertex = self.evaluate_input("Point Index")
  298. if ob.type == 'CURVE' and ob.data.splines[0].type == 'BEZIER' and auto_bezier:
  299. if affect_radius:
  300. self.driver_for_radius(ob, target_node.bGetObject(), vertex, d.strength)
  301. vertex*=3
  302. vertices_used.extend([vertex, vertex+1, vertex+2])
  303. else:
  304. vertices_used.append(vertex)
  305. # if we have a curve and it is NOT using auto-bezier for the verts..
  306. if ob.type == 'CURVE' and ob.data.splines[0].type == 'BEZIER' and affect_radius and not auto_bezier:
  307. print (f"WARN: {self}: \"Affect Radius\" may not behave as expected"
  308. " when used on Bezier curves without Auto-Bezier")
  309. #bezier point starts at 1, and then every third vert, so 4, 7, 10...
  310. if vertex%3==1:
  311. self.driver_for_radius(ob, target_node.bGetObject(), vertex, d.strength)
  312. if ob.type == 'CURVE' and ob.data.splines[0].type != 'BEZIER' and \
  313. affect_radius:
  314. self.driver_for_radius(ob, target_node.bGetObject(), vertex, d.strength, bezier=False)
  315. d.vertex_indices_set(vertices_used)
  316. evaluate_sockets(self, d, props_sockets)
  317. finish_drivers(self)
  318. # todo: this node should be able to take many indices in the future.
  319. # Also: I have a Geometry Nodes implementation of this I can use... maybe...
  320. class DeformerMorphTarget(MantisDeformerNode):
  321. '''A node representing an armature deformer'''
  322. def __init__(self, signature, base_tree):
  323. super().__init__(signature, base_tree)
  324. inputs = [
  325. "Relative to",
  326. "Object",
  327. "Deformer",
  328. "Vertex Group",
  329. ]
  330. outputs = [
  331. "Deformer",
  332. "Morph Target",
  333. ]
  334. # now set up the traverse target...
  335. self.outputs.init_sockets(outputs)
  336. self.inputs.init_sockets(inputs)
  337. self.init_parameters(additional_parameters={"Name":None})
  338. self.set_traverse([("Deformer", "Deformer")])
  339. self.node_type = "LINK"
  340. self.prepared = True
  341. def GetxForm(self, trace_input="Object"):
  342. trace = trace_single_line(self, trace_input)
  343. for node in trace[0]:
  344. if (isinstance(node, deformable_types)):
  345. return node
  346. raise GraphError("%s is not connected to an upstream xForm" % self)
  347. def bExecute(self, bContext = None,):
  348. prGreen("Executing Morph Target Node")
  349. ob = None; relative = None
  350. # do NOT check if the object exists here. Just let the next node deal with that.
  351. try:
  352. ob = self.GetxForm().bGetObject().name
  353. except Exception as e: # this will and should throw an error if it fails
  354. ob = self.GetxForm().evaluate_input("Name")
  355. if self.inputs["Relative to"].is_linked:
  356. try:
  357. relative = self.GetxForm("Relative to").bGetObject().name
  358. except Exception as e: # same here
  359. prRed(f"Execution failed at {self}: no relative object found for morph target, despite link existing.")
  360. raise e
  361. vg = self.evaluate_input("Vertex Group") if self.evaluate_input("Vertex Group") else "" # just make sure it is a string
  362. mt={"object":ob, "vertex_group":vg, "relative_shape":relative}
  363. self.parameters["Morph Target"] = mt
  364. self.parameters["Name"] = ob # this is redundant but it's OK since accessing the mt is tedious
  365. self.executed = True
  366. class DeformerMorphTargetDeform(MantisDeformerNode):
  367. '''A node representing an armature deformer'''
  368. def __init__(self, signature, base_tree):
  369. super().__init__(signature, base_tree)
  370. inputs = [
  371. "Deformer",
  372. "Use Shape Key",
  373. "Use Offset",
  374. ]
  375. outputs = [
  376. "Deformer",
  377. ]
  378. self.outputs.init_sockets(outputs)
  379. self.inputs.init_sockets(inputs)
  380. self.init_parameters(additional_parameters={"Name":None})
  381. self.set_traverse([("Deformer", "Deformer")])
  382. self.node_type = "LINK"
  383. self.prepared = True
  384. self.executed = True
  385. setup_custom_props(self)
  386. # bpy.data.node_groups["Morph Deform.045"].nodes["Named Attribute.020"].data_type = 'FLOAT_VECTOR'
  387. # bpy.context.object.add_rest_position_attribute = True
  388. def gen_morph_target_modifier(self, xf, context):
  389. # first let's see if this is a no-op
  390. targets = []
  391. for k,v in self.inputs.items():
  392. if "Target" in k:
  393. targets.append(v)
  394. if not targets:
  395. return # nothing to do here.
  396. # at this point we make the node tree
  397. from .geometry_node_graphgen import gen_morph_target_nodes
  398. m, props_sockets = gen_morph_target_nodes(
  399. self.evaluate_input("Name"),
  400. xf.bGetObject(),
  401. targets,
  402. context,
  403. use_offset=self.evaluate_input("Use Offset"))
  404. self.bObject.append(m)
  405. evaluate_sockets(self, m, props_sockets)
  406. finish_drivers(self)
  407. def gen_shape_key(self, xf, context): # TODO: make this a feature of the node definition that appears only when there are no prior deformers - and shows a warning!
  408. # TODO: the below works well, but it is quite slow. It does not seem to have better performence. Its only advantage is export to FBX.
  409. # there are a number of things I need to fix here
  410. # - reuse shape keys if possible
  411. # - figure out how to make this a lot faster
  412. # - edit the xForm stuff to delete drivers from shape key ID's, since they belong to the Key, not the Object.
  413. # first check if we need to do anythign
  414. targets = []
  415. for k,v in self.inputs.items():
  416. if "Target" in k:
  417. targets.append(v)
  418. if not targets:
  419. return # nothing to do here
  420. from time import time
  421. start_time = time()
  422. from bpy import data
  423. ob = xf.bGetObject()
  424. dg = context.view_layer.depsgraph
  425. dg.update()
  426. if xf.has_shape_keys == False:
  427. m = data.meshes.new_from_object(ob, preserve_all_data_layers=True, depsgraph=dg)
  428. ob.data = m
  429. ob.add_rest_position_attribute = True
  430. ob.shape_key_clear()
  431. ob.shape_key_add(name='Basis', from_mix=False)
  432. else:
  433. m = ob.data
  434. xf.has_shape_keys = True
  435. # using the built-in shapekey feature is actually a lot harder in terms of programming because I need...
  436. # min/max, as it is just not a feature of the GN version
  437. # to carry info from the morph target node regarding relative shapes and vertex groups and all that
  438. # the drivers may be more difficult to apply, too.
  439. # hafta make new geometry for the object and add shape keys and all that
  440. # the benefit to all this being exporting to game engines via .fbx
  441. # first make a basis shape key
  442. keys={}
  443. props_sockets={}
  444. for i, t in enumerate(targets):
  445. mt_node = t.links[0].from_node; sk_ob = mt_node.GetxForm().bGetObject()
  446. if sk_ob is None:
  447. sk_ob = data.objects.new(mt_node.evaluate_input("Name"), data.meshes.new_from_object(ob))
  448. context.collection.objects.link(sk_ob)
  449. prOrange(f"WARN: no object found for f{mt_node}; creating duplicate of current object ")
  450. sk_ob = dg.id_eval_get(sk_ob)
  451. mt_name = sk_ob.name
  452. vg = mt_node.parameters["Morph Target"]["vertex_group"]
  453. if vg: mt_name = mt_name+"."+vg
  454. sk = ob.shape_key_add(name=mt_name, from_mix=False)
  455. # the shapekey data is absolute point data for each vertex, in order, very simple
  456. # SERIOUSLY IMPORTANT:
  457. # use the current position of the vertex AFTER SHAPE KEYS AND DEFORMERS
  458. # easiest way to do it is to eval the depsgraph
  459. # TODO: try and get it without depsgraph update, since that may be (very) slow
  460. sk_m = sk_ob.data#data.meshes.new_from_object(sk_ob, preserve_all_data_layers=True, depsgraph=dg)
  461. for j in range(len(m.vertices)):
  462. sk.data[j].co = sk_m.vertices[j].co # assume they match
  463. # data.meshes.remove(sk_m)
  464. sk.vertex_group = vg
  465. sk.slider_min = -10
  466. sk.slider_max = 10
  467. keys[mt_name]=sk
  468. props_sockets[mt_name]= ("Value."+str(i).zfill(3), 1.0)
  469. for i, t in enumerate(targets):
  470. mt_node = t.links[0].from_node; sk_ob = mt_node.GetxForm().bGetObject()
  471. if sk_ob is None: continue
  472. if rel := mt_node.parameters["Morph Target"]["relative_shape"]:
  473. sk = keys.get(mt_name)
  474. sk.relative_key = keys.get(rel)
  475. self.bObject.append(sk.id_data)
  476. evaluate_sockets(self, sk.id_data, props_sockets)
  477. finish_drivers(self)
  478. prWhite(f"Initializing morph target took {time() -start_time} seconds")
  479. def bFinalize(self, bContext=None):
  480. prGreen(f"Executing Morph Deform node {self}")
  481. use_shape_keys = self.evaluate_input("Use Shape Key")
  482. # if there is a not a prior deformer then there should be an option to use plain 'ol shape keys
  483. # GN is always desirable as an option though because it can be baked & many other reasons
  484. if use_shape_keys: # check and see if we can.
  485. if self.inputs.get("Deformer"): # I guess this isn't available in some node group contexts... bad. FIXME
  486. if (links := self.inputs["Deformer"].links):
  487. if not links[0].from_node.parameters.get("Use Shape Key"):
  488. use_shape_keys = False
  489. elif links[0].from_node.parameters.get("Use Shape Key") == False:
  490. use_shape_keys = False
  491. self.parameters["Use Shape Key"] = use_shape_keys
  492. for xf in self.GetxForm():
  493. if use_shape_keys:
  494. self.gen_shape_key(xf, bContext)
  495. else:
  496. self.gen_morph_target_modifier(xf, bContext)