def _create_rotomask_editor(filt, editable_properties): property_editor_widgets_create_func = lambda: _create_rotomask_property_editor_widgets(editable_properties) kf_json_prop = filter(lambda ep: ep.name == "spline", editable_properties)[0] kf_editor = keyframeeditor.RotoMaskKeyFrameEditor(kf_json_prop, propertyparse.rotomask_json_value_string_to_kf_array) kfs_value_label = Gtk.Label(str(len(kf_editor.clip_editor.keyframes))) kf_row = guiutils.get_left_justified_box([guiutils.pad_label(12, 12), guiutils.bold_label(_("Keyframes") + ": "), kfs_value_label]) kf, curve_points = kf_editor.clip_editor.keyframes[0] curve_points_value_label = Gtk.Label(str(len(curve_points))) cps_row = guiutils.get_left_justified_box([guiutils.pad_label(12, 12), guiutils.bold_label(_("Curve Points") + ": "), curve_points_value_label]) value_labels = [kfs_value_label, curve_points_value_label] lauch_button = Gtk.Button(_("Lauch RotoMask editor")) lauch_button.connect("clicked", lambda b:_roto_lauch_pressed(filt, editable_properties, property_editor_widgets_create_func, value_labels)) vbox = Gtk.VBox(False, 4) vbox.pack_start(guiutils.bold_label(_("RotoMask info")), False, False, 0) vbox.pack_start(kf_row, False, False, 0) vbox.pack_start(cps_row, False, False, 0) vbox.pack_start(guiutils.pad_label(12, 12), False, False, 0) vbox.pack_start(lauch_button, False, False, 0) vbox.pack_start(Gtk.Label(), True, True, 0) vbox.no_separator = True return vbox
def show_rotomask(mlt_filter, editable_properties, property_editor_widgets_create_func, value_labels): # Create custom keyframe editor for spline kf_json_prop = [ep for ep in editable_properties if ep.name == "spline"][0] kf_editor = keyframeeditor.RotoMaskKeyFrameEditor(kf_json_prop, propertyparse.rotomask_json_value_string_to_kf_array) # Use lambda to monkeypatch other editable properties to update rotomask on value write invert_prop = [ep for ep in editable_properties if ep.name == "invert"][0] invert_prop.write_val_func = invert_prop.write_value invert_prop.write_value = lambda value_str: _write_val_and_update_editor(invert_prop, value_str) feather_prop = [ep for ep in editable_properties if ep.name == "feather"][0] feather_prop.write_val_func = feather_prop.write_value feather_prop.write_value = lambda value_str: _write_val_and_update_editor(feather_prop, value_str) feather_passes_prop = [ep for ep in editable_properties if ep.name == "feather_passes"][0] feather_passes_prop.write_val_func = feather_passes_prop.write_value feather_passes_prop.write_value = lambda value_str: _write_val_and_update_editor(feather_passes_prop, value_str) alpha_operation_prop = [ep for ep in editable_properties if ep.name == "alpha_operation"][0] alpha_operation_prop.write_val_func = alpha_operation_prop.write_value alpha_operation_prop.write_value = lambda value_str: _write_val_and_update_editor(alpha_operation_prop, value_str) mode_prop = [ep for ep in editable_properties if ep.name == "mode"][0] mode_prop.write_val_func = mode_prop.write_value mode_prop.write_value = lambda value_str: _write_val_and_update_editor(mode_prop, value_str) # Create editor window global _rotomask _rotomask = RotoMaskEditor(kf_editor, property_editor_widgets_create_func, value_labels) _rotomask.show_current_frame()
def show_rotomask(mlt_filter, editable_properties): kf_json_prop = filter(lambda ep: ep.name == "spline", editable_properties)[0] kf_editor = keyframeeditor.RotoMaskKeyFrameEditor( kf_json_prop, propertyparse.rotomask_json_value_string_to_kf_array) global _rotomask _rotomask = RotoMaskEditor(kf_editor) _rotomask.show_current_frame()