velocity mode
This commit is contained in:
parent
d11d1e0435
commit
0d8ab41c57
@ -89,7 +89,6 @@ class GP_OT_interpolate_stroke_velocity(GP_OT_interpolate_stroke_base):
|
||||
|
||||
scn = bpy.context.scene
|
||||
settings = context.scene.gp_interpo_settings
|
||||
col = settings.target_collection
|
||||
|
||||
## Prepare context manager
|
||||
attrs = [
|
||||
@ -107,7 +106,8 @@ class GP_OT_interpolate_stroke_velocity(GP_OT_interpolate_stroke_base):
|
||||
instance_col_mod = velocity_ob.modifiers.new('IngestCollection', 'NODES')
|
||||
ingest_node_group = load_datablock(RESOURCES_DIR/'nodes.blend', 'Ingest Collection', type='node_groups', link=False)
|
||||
instance_col_mod.node_group = ingest_node_group
|
||||
instance_col_mod["Socket_2"] = col
|
||||
instance_col_mod["Socket_3"] = settings.target_object
|
||||
instance_col_mod["Socket_2"] = settings.target_collection
|
||||
|
||||
scn.collection.objects.link(velocity_ob)
|
||||
|
||||
@ -159,32 +159,25 @@ class GP_OT_interpolate_stroke_velocity(GP_OT_interpolate_stroke_base):
|
||||
scn = context.scene
|
||||
cam = scn.camera
|
||||
#dg = bpy.context.evaluated_depsgraph_get()
|
||||
col = self.settings.target_collection
|
||||
target_object = self.settings.target_object
|
||||
target_col = self.settings.target_collection
|
||||
smooth_level = self.settings.smooth_level
|
||||
|
||||
origin = scn.camera.matrix_world.to_translation()
|
||||
plane_co, plane_no = get_gp_draw_plane(self.gp)
|
||||
|
||||
#print("interpolate_frame")
|
||||
|
||||
print(self.gp_matrix)
|
||||
print(self.gp.matrix_world)
|
||||
|
||||
velocity_ob = self.velocity_ob
|
||||
|
||||
velocity_ob.hide_set(True)
|
||||
|
||||
|
||||
grid_velocity_mod = velocity_ob.modifiers.new('VelocityGrid', 'NODES')
|
||||
grid_velocity_mod.node_group = self.velocity_node_group
|
||||
grid_velocity_mod["Socket_2"] = col
|
||||
grid_velocity_mod["Socket_8"] = target_object
|
||||
grid_velocity_mod["Socket_2"] = target_col
|
||||
grid_velocity_mod["Socket_4"] = self.camera
|
||||
grid_velocity_mod["Socket_5"] = self.camera.data.angle
|
||||
grid_velocity_mod["Socket_6"] = self.camera.data.shift_x
|
||||
grid_velocity_mod["Socket_7"] = self.camera.data.shift_y
|
||||
|
||||
#raise Exception()
|
||||
|
||||
# Apply velocity grid modifier
|
||||
dg = bpy.context.evaluated_depsgraph_get()
|
||||
eval_ob = velocity_ob.evaluated_get(dg)
|
||||
@ -195,8 +188,6 @@ class GP_OT_interpolate_stroke_velocity(GP_OT_interpolate_stroke_base):
|
||||
#scn.collection.objects.link(copy_ob)
|
||||
|
||||
velocity_ob.modifiers.remove(grid_velocity_mod)
|
||||
#velocity_ob.data = eval_data
|
||||
|
||||
|
||||
#Create kd tree for finding nearest points
|
||||
kd = KDTree(len(grid_ob.data.vertices))
|
||||
@ -209,12 +200,10 @@ class GP_OT_interpolate_stroke_velocity(GP_OT_interpolate_stroke_base):
|
||||
|
||||
kd.balance()
|
||||
|
||||
#nb_strokes = len(self.gp.data.layers.active.active_frame.strokes)
|
||||
bpy.ops.gpencil.paste(type='LAYER')
|
||||
|
||||
## List of newly pasted strokes (using range)
|
||||
new_strokes = [s for l in self.layers for s in l.active_frame.strokes if s.select]
|
||||
#new_strokes = self.gp.data.layers.active.active_frame.strokes[-nb_strokes:]
|
||||
|
||||
velocity_attr = grid_ob.data.attributes["velocity"].data
|
||||
|
||||
@ -247,8 +236,6 @@ class GP_OT_interpolate_stroke_velocity(GP_OT_interpolate_stroke_base):
|
||||
#stroke.points.foreach_set('co', [v for p in points_2d for v in self.gp.matrix_world.inverted() @p])
|
||||
stroke.points.update()
|
||||
|
||||
#velocity_ob.modifiers.remove(grid_velocity_mod)
|
||||
|
||||
bpy.data.meshes.remove(grid_ob.data)
|
||||
|
||||
def exit(self, context, status='INFO', text=None, cancelled=False):
|
||||
|
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user