def effect_selection_changed(): global keyframe_editor_widgets # Check we have clip if clip == None: keyframe_editor_widgets = [] return # Check we actually have filters so we can display one. # If not, clear previous filters from view. if len(clip.filters) == 0: vbox = Gtk.VBox(False, 0) vbox.pack_start(Gtk.Label(), False, False, 0) widgets.value_edit_frame.remove(widgets.value_edit_box) widgets.value_edit_frame.add(vbox) vbox.show_all() widgets.value_edit_box = vbox keyframe_editor_widgets = [] return # "changed" get's called twice when adding filter and selecting last # so we use this do this only once if block_changed_update == True: return keyframe_editor_widgets = [] # Get selected row which is also index of filter in clip.filters treeselection = widgets.effect_stack_view.treeview.get_selection() (model, rows) = treeselection.get_selected_rows() # If we don't get legal selection select first filter try: row = rows[0] filter_index = max(row) except: filter_index = 0 filter_object = clip.filters[filter_index] global current_filter_index current_filter_index = filter_index # Create EditableProperty wrappers for properties editable_properties = propertyedit.get_filter_editable_properties( clip, filter_object, filter_index, track, clip_index) # Get editors and set them displayed vbox = Gtk.VBox(False, 0) try: filter_name = translations.filter_names[filter_object.info.name] except KeyError: filter_name = filter_object.info.name filter_name_label = Gtk.Label(label="<b>" + filter_name + "</b>") filter_name_label.set_use_markup(True) vbox.pack_start(filter_name_label, False, False, 0) vbox.pack_start(guicomponents.EditorSeparator().widget, False, False, 0) if len(editable_properties) > 0: # Create editor row for each editable property for ep in editable_properties: editor_row = propertyeditorbuilder.get_editor_row(ep) if editor_row == None: continue # Set keyframe editor widget to be updated for frame changes if such is created try: editor_type = ep.args[propertyeditorbuilder.EDITOR] except KeyError: editor_type = propertyeditorbuilder.SLIDER # this is the default value if ((editor_type == propertyeditorbuilder.KEYFRAME_EDITOR) or (editor_type == propertyeditorbuilder.KEYFRAME_EDITOR_RELEASE) or (editor_type == propertyeditorbuilder.KEYFRAME_EDITOR_CLIP)): keyframe_editor_widgets.append(editor_row) # if slider property is being dedited as keyrame property if hasattr(editor_row, "is_kf_editor"): keyframe_editor_widgets.append(editor_row) vbox.pack_start(editor_row, False, False, 0) if not hasattr(editor_row, "no_separator"): vbox.pack_start(guicomponents.EditorSeparator().widget, False, False, 0) # Create NonMltEditableProperty wrappers for properties non_mlteditable_properties = propertyedit.get_non_mlt_editable_properties( clip, filter_object, filter_index) # Extra editors. Editable properties may have already been created # with "editor=no_editor" and now extra editors may be created to edit those # Non mlt properties are added as these are only need with extraeditors editable_properties.extend(non_mlteditable_properties) editor_rows = propertyeditorbuilder.get_filter_extra_editor_rows( filter_object, editable_properties) for editor_row in editor_rows: vbox.pack_start(editor_row, False, False, 0) if not hasattr(editor_row, "no_separator"): vbox.pack_start(guicomponents.EditorSeparator().widget, False, False, 0) vbox.pack_start(guiutils.pad_label(12, 12), False, False, 0) hamburger_launcher_surface = cairo.ImageSurface.create_from_png( respaths.IMAGE_PATH + "hamburger_big.png") hamburger_launcher = guicomponents.PressLaunch( _hamburger_launch_pressed, hamburger_launcher_surface, 24, 24) sl_row = guiutils.get_left_justified_box([hamburger_launcher.widget]) vbox.pack_start(sl_row, False, False, 0) vbox.pack_start(Gtk.Label(), True, True, 0) else: vbox.pack_start(Gtk.Label(label=_("No editable parameters")), True, True, 0) vbox.show_all() scroll_window = Gtk.ScrolledWindow() scroll_window.add_with_viewport(vbox) scroll_window.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC) scroll_window.show_all() widgets.value_edit_frame.remove(widgets.value_edit_box) widgets.value_edit_frame.add(scroll_window) widgets.value_edit_box = scroll_window
def _display_compositor_edit_box(): # This gets called on startup before edit_frame is filled try: widgets.value_edit_frame.remove(widgets.value_edit_box) except: pass global keyframe_editor_widgets keyframe_editor_widgets = [] vbox = Gtk.VBox() # Case: Empty edit frame global compositor if compositor == None: widgets.empty_label = Gtk.Label(label=_("No Compositor")) vbox.pack_start(widgets.empty_label, True, True, 0) vbox.pack_start(Gtk.Label(), True, True, 0) vbox.show_all() widgets.value_edit_box = vbox widgets.value_edit_frame.add(vbox) return # Case: Filled frame compositor_name_label = Gtk.Label(label="<b>" + compositor.name + "</b>") compositor_name_label.set_use_markup(True) vbox.pack_start(compositor_name_label, False, False, 0) vbox.pack_start(guicomponents.EditorSeparator().widget, False, False, 0) # Track editor target_combo = guicomponents.get_compositor_track_select_combo( current_sequence().tracks[compositor.transition.b_track], current_sequence().tracks[compositor.transition.a_track], _target_track_changed) target_row = Gtk.HBox() target_row.pack_start(guiutils.get_pad_label(5, 3), False, False, 0) target_row.pack_start(Gtk.Label(label=_("Destination Track:")), False, False, 0) target_row.pack_start(guiutils.get_pad_label(5, 3), False, False, 0) target_row.pack_start(target_combo, False, False, 0) target_row.pack_start(Gtk.Label(), True, True, 0) vbox.pack_start(target_row, False, False, 0) vbox.pack_start(guicomponents.EditorSeparator().widget, False, False, 0) # Transition editors t_editable_properties = propertyedit.get_transition_editable_properties( compositor) for ep in t_editable_properties: editor_row = propertyeditorbuilder.get_editor_row(ep) if editor_row != None: # Some properties don't have editors vbox.pack_start(editor_row, False, False, 0) vbox.pack_start(guicomponents.EditorSeparator().widget, False, False, 0) # Add keyframe editor widget to be updated for frame changes if such is created. try: editor_type = ep.args[propertyeditorbuilder.EDITOR] except KeyError: editor_type = propertyeditorbuilder.SLIDER # this is the default value if ((editor_type == propertyeditorbuilder.KEYFRAME_EDITOR) or (editor_type == propertyeditorbuilder.KEYFRAME_EDITOR_RELEASE) or (editor_type == propertyeditorbuilder.KEYFRAME_EDITOR_CLIP) or (editor_type == propertyeditorbuilder.FADE_LENGTH) or (editor_type == propertyeditorbuilder.GEOMETRY_EDITOR)): keyframe_editor_widgets.append(editor_row) # Extra editors. Editable properties have already been created with "editor=no_editor" # and will be looked up by editors from clip editor_rows = propertyeditorbuilder.get_transition_extra_editor_rows( compositor, t_editable_properties) for editor_row in editor_rows: # These are added to keyframe editor based on editor type, not based on EditableProperty type as above # because one editor sets values for multiple EditableProperty objects if editor_row.__class__ == keyframeeditor.RotatingGeometryEditor: keyframe_editor_widgets.append(editor_row) vbox.pack_start(editor_row, False, False, 0) vbox.pack_start(guicomponents.EditorSeparator().widget, False, False, 0) hamburger_launcher_surface = cairo.ImageSurface.create_from_png( respaths.IMAGE_PATH + "hamburger_big.png") hamburger_launcher = guicomponents.PressLaunch(_hamburger_launch_pressed, hamburger_launcher_surface, 24, 24) sl_row = guiutils.get_right_justified_box([hamburger_launcher.widget]) vbox.pack_start(sl_row, False, False, 0) vbox.pack_start(Gtk.Label(), True, True, 0) vbox.show_all() scroll_window = Gtk.ScrolledWindow() scroll_window.add_with_viewport(vbox) scroll_window.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC) scroll_window.show_all() widgets.value_edit_box = scroll_window widgets.value_edit_frame.add(scroll_window)
def change_animation(self): # global _animation_instance has been set elsewhere self.animation_label.set_text(_animation_instance.info.name) # We are using existing property edit code to create value editors. # We will need present a lot of dummy data and monkeypatch objects to make that # pipeline do our bidding for natron animations value editing. clip = None filter_index = -1 track = None clip_index = -1 editable_properties = propertyedit.get_filter_editable_properties( clip, _animation_instance, filter_index, track, clip_index, compositor_filter=False) self.editable_properties = editable_properties edit_panel = Gtk.VBox(False, 2) edit_panel.set_size_request(EDIT_PANEL_WIDTH, EDIT_PANEL_HEIGHT) guiutils.set_margins(edit_panel, 4, 4, 4, 4) if len(editable_properties) > 0: # Create editor row for each editable property for ep in editable_properties: # We are not interfacing with mlt objects or clip's filter arrays # and we need make functions accessing those no-ops. # We are only interested in saving value as string and then later interpreting # it somehow to use as input when modifying natron project. self.modify_editable_properties(ep) editor_row = propertyeditorbuilder.get_editor_row(ep) if editor_row == None: continue # Set keyframe editor widget to be updated for frame changes if such is created try: editor_type = ep.args[propertyeditorbuilder.EDITOR] except KeyError: editor_type = propertyeditorbuilder.SLIDER # this is the default value edit_panel.pack_start(editor_row, False, False, 0) if not hasattr(editor_row, "no_separator"): edit_panel.pack_start( guicomponents.EditorSeparator().widget, False, False, 0) edit_panel.pack_start(Gtk.Label(), True, True, 0) edit_panel.show_all() scroll_window = Gtk.ScrolledWindow() scroll_window.add_with_viewport(edit_panel) scroll_window.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC) scroll_window.show_all() if self.value_edit_box != None: self.value_edit_frame.remove(self.value_edit_box) self.value_edit_frame.add(scroll_window) self.value_edit_box = scroll_window
def _display_compositor_edit_box(): # This gets called on startup before edit_frame is filled try: widgets.value_edit_frame.remove(widgets.value_edit_box) except: pass global keyframe_editor_widgets keyframe_editor_widgets = [] vbox = Gtk.VBox() # Case: Empty edit frame global compositor if compositor == None: #widgets.empty_label = Gtk.Label(label=_("No Compositor")) filler = Gtk.EventBox() filler.add(Gtk.Label()) vbox.pack_start(filler, True, True, 0) info = Gtk.Label(label=_("No Compositor")) info.set_sensitive(False) filler = Gtk.EventBox() filler.add(info) vbox.pack_start(filler, False, False, 0) filler = Gtk.EventBox() filler.add(Gtk.Label()) vbox.pack_start(filler, True, True, 0) vbox.show_all() scroll_window = Gtk.ScrolledWindow() scroll_window.add_with_viewport(vbox) scroll_window.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC) scroll_window.show_all() widgets.value_edit_box = scroll_window widgets.value_edit_frame.add(scroll_window) return # Case: Filled frame compositor_name_label = Gtk.Label(label="<b>" + compositor.name + "</b>") compositor_name_label.set_use_markup(True) vbox.pack_start(compositor_name_label, False, False, 0) vbox.pack_start(guicomponents.EditorSeparator().widget, False, False, 0) # Track editor target_combo = guicomponents.get_compositor_track_select_combo( current_sequence().tracks[compositor.transition.b_track], current_sequence().tracks[compositor.transition.a_track], _target_track_changed) target_row = Gtk.HBox() target_row.pack_start(guiutils.get_pad_label(5, 3), False, False, 0) target_row.pack_start(Gtk.Label(label=_("Destination Track:")), False, False, 0) target_row.pack_start(guiutils.get_pad_label(5, 3), False, False, 0) target_row.pack_start(target_combo, False, False, 0) target_row.pack_start(Gtk.Label(), True, True, 0) vbox.pack_start(target_row, False, False, 0) vbox.pack_start(guicomponents.EditorSeparator().widget, False, False, 0) # Fade buttons compositor_info = guicomponents.CompositorInfoPanel() fade_in_b = Gtk.Button(_("Add Fade In")) fade_in_b.connect("clicked", lambda w, e: _add_fade_in_pressed(), None) fade_out_b = Gtk.Button(_("Add Fade Out")) fade_out_b.connect("clicked", lambda w, e: _add_fade_out_pressed(), None) widgets.fade_in_spin = Gtk.SpinButton.new_with_range(0, 150, 1) widgets.fade_in_spin.set_value(10) widgets.fade_out_spin = Gtk.SpinButton.new_with_range(0, 150, 1) widgets.fade_out_spin.set_value(10) fades_row = Gtk.HBox() fades_row.pack_start(guiutils.get_pad_label(5, 3), False, False, 0) fades_row.pack_start(fade_in_b, False, False, 0) fades_row.pack_start(widgets.fade_in_spin, False, False, 0) fades_row.pack_start(fade_out_b, False, False, 0) fades_row.pack_start(widgets.fade_out_spin, False, False, 0) fades_row.pack_start(Gtk.Label(), True, True, 0) if _compositor_uses_fade_buttons(compositor) == True: vbox.pack_start(fades_row, False, False, 0) vbox.pack_start(guicomponents.EditorSeparator().widget, False, False, 0) # Transition editors t_editable_properties = propertyedit.get_transition_editable_properties( compositor) for ep in t_editable_properties: editor_row = propertyeditorbuilder.get_editor_row(ep) if editor_row != None: # Some properties don't have editors vbox.pack_start(editor_row, False, False, 0) vbox.pack_start(guicomponents.EditorSeparator().widget, False, False, 0) # Add keyframe editor widget to be updated for frame changes if such is created. try: editor_type = ep.args[propertyeditorbuilder.EDITOR] except KeyError: editor_type = propertyeditorbuilder.SLIDER # this is the default value if ((editor_type == propertyeditorbuilder.KEYFRAME_EDITOR) or (editor_type == propertyeditorbuilder.KEYFRAME_EDITOR_RELEASE) or (editor_type == propertyeditorbuilder.KEYFRAME_EDITOR_CLIP) or (editor_type == propertyeditorbuilder.FADE_LENGTH) or (editor_type == propertyeditorbuilder.GEOMETRY_EDITOR)): keyframe_editor_widgets.append(editor_row) # Extra editors. Editable properties have already been created with "editor=no_editor" # and will be looked up by editors from clip editor_rows = propertyeditorbuilder.get_transition_extra_editor_rows( compositor, t_editable_properties) for editor_row in editor_rows: # These are added to keyframe editor based on editor type, not based on EditableProperty type as above # because one editor sets values for multiple EditableProperty objects if editor_row.__class__ == keyframeeditor.RotatingGeometryEditor: keyframe_editor_widgets.append(editor_row) vbox.pack_start(editor_row, False, False, 0) vbox.pack_start(guicomponents.EditorSeparator().widget, False, False, 0) vbox.pack_start(Gtk.Label(), True, True, 0) vbox.show_all() scroll_window = Gtk.ScrolledWindow() scroll_window.add_with_viewport(vbox) scroll_window.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC) scroll_window.show_all() widgets.value_edit_box = scroll_window widgets.value_edit_frame.add(scroll_window)
def _display_compositor_edit_box(): # This gets called on startup before edit_frame is filled try: widgets.value_edit_frame.remove(widgets.value_edit_box) except: pass global keyframe_editor_widgets keyframe_editor_widgets = [] vbox = Gtk.VBox() # case: Empty edit frame global compositor if compositor == None: widgets.empty_label = Gtk.Label(label=_("No Compositor")) vbox.pack_start(widgets.empty_label, True, True, 0) vbox.pack_start(Gtk.Label(), True, True, 0) vbox.show_all() widgets.value_edit_box = vbox widgets.value_edit_frame.add(vbox) return compositor_name_label = Gtk.Label(label="<b>" + compositor.name + "</b>") compositor_name_label.set_use_markup(True) vbox.pack_start(compositor_name_label, False, False, 0) vbox.pack_start(guicomponents.EditorSeparator().widget, False, False, 0) # Track editor target_combo = guicomponents.get_compositor_track_select_combo( current_sequence().tracks[compositor.transition.b_track], current_sequence().tracks[compositor.transition.a_track], _target_track_changed) target_row = Gtk.HBox() target_row.pack_start(guiutils.get_pad_label(5, 3), False, False, 0) target_row.pack_start(Gtk.Label(label=_("Destination Track:")), False, False, 0) target_row.pack_start(guiutils.get_pad_label(5, 3), False, False, 0) target_row.pack_start(target_combo, False, False, 0) target_row.pack_start(Gtk.Label(), True, True, 0) vbox.pack_start(target_row, False, False, 0) vbox.pack_start(guicomponents.EditorSeparator().widget, False, False, 0) # Transition editors t_editable_properties = propertyedit.get_transition_editable_properties( compositor) for ep in t_editable_properties: editor_row = propertyeditorbuilder.get_editor_row(ep) if editor_row != None: # Some properties don't have editors vbox.pack_start(editor_row, False, False, 0) vbox.pack_start(guicomponents.EditorSeparator().widget, False, False, 0) # Add keyframe editor widget to be updated for frame changes if such is created. try: editor_type = ep.args[propertyeditorbuilder.EDITOR] except KeyError: editor_type = propertyeditorbuilder.SLIDER # this is the default value if ((editor_type == propertyeditorbuilder.KEYFRAME_EDITOR) or (editor_type == propertyeditorbuilder.KEYFRAME_EDITOR_RELEASE) or (editor_type == propertyeditorbuilder.KEYFRAME_EDITOR_CLIP) or (editor_type == propertyeditorbuilder.GEOMETRY_EDITOR)): keyframe_editor_widgets.append(editor_row) # Extra editors. Editable properties have already been created with "editor=no_editor" # and will be looked up by editors from clip editor_rows = propertyeditorbuilder.get_transition_extra_editor_rows( compositor, t_editable_properties) for editor_row in editor_rows: vbox.pack_start(editor_row, False, False, 0) vbox.pack_start(guicomponents.EditorSeparator().widget, False, False, 0) vbox.pack_start(Gtk.Label(), True, True, 0) vbox.show_all() scroll_window = Gtk.ScrolledWindow() scroll_window.add_with_viewport(vbox) scroll_window.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC) scroll_window.show_all() widgets.value_edit_box = scroll_window widgets.value_edit_frame.add(scroll_window)
def effect_selection_changed(use_current_filter_index=False): global keyframe_editor_widgets, current_filter_index # Check we have clip if clip == None: keyframe_editor_widgets = [] show_text_in_edit_area(_("No Clip")) return # Check we actually have filters so we can display one. # If not, clear previous filters from view. if len(clip.filters) == 0: show_text_in_edit_area(_("Clip Has No Filters")) keyframe_editor_widgets = [] return # "changed" get's called twice when adding filter and selecting last # so we use this do this only once if block_changed_update == True: return # We need this update on clip load into editor if _clip_has_filter_mask_filter() == True: widgets.add_filter_mask.set_sensitive(False) else: widgets.add_filter_mask.set_sensitive(True) keyframe_editor_widgets = [] # Get selected row which is also index of filter in clip.filters treeselection = widgets.effect_stack_view.treeview.get_selection() (model, rows) = treeselection.get_selected_rows() # If we don't get legal selection select first filter try: row = rows[0] filter_index = max(row) except: filter_index = 0 # use_current_filter_index == False is used when user changes edited filter or clip. if use_current_filter_index == True: filter_index = current_filter_index filter_object = clip.filters[filter_index] current_filter_index = filter_index # Create EditableProperty wrappers for properties editable_properties = propertyedit.get_filter_editable_properties( clip, filter_object, filter_index, track, clip_index) # Get editors and set them displayed vbox = Gtk.VBox(False, 0) try: filter_name = translations.filter_names[filter_object.info.name] except KeyError: filter_name = filter_object.info.name filter_name_label = Gtk.Label(label="<b>" + filter_name + "</b>") filter_name_label.set_use_markup(True) vbox.pack_start(filter_name_label, False, False, 0) vbox.pack_start(guicomponents.EditorSeparator().widget, False, False, 0) if len(editable_properties) > 0: # Create editor row for each editable property for ep in editable_properties: editor_row = propertyeditorbuilder.get_editor_row(ep) if editor_row == None: continue # Set keyframe editor widget to be updated for frame changes if such is created try: editor_type = ep.args[propertyeditorbuilder.EDITOR] except KeyError: editor_type = propertyeditorbuilder.SLIDER # this is the default value if ((editor_type == propertyeditorbuilder.KEYFRAME_EDITOR) or (editor_type == propertyeditorbuilder.KEYFRAME_EDITOR_RELEASE) or (editor_type == propertyeditorbuilder.KEYFRAME_EDITOR_CLIP) or (editor_type == propertyeditorbuilder.FILTER_RECT_GEOM_EDITOR)): keyframe_editor_widgets.append(editor_row) # if slider property is being dedited as keyrame property if hasattr(editor_row, "is_kf_editor"): keyframe_editor_widgets.append(editor_row) vbox.pack_start(editor_row, False, False, 0) if not hasattr(editor_row, "no_separator"): vbox.pack_start(guicomponents.EditorSeparator().widget, False, False, 0) # Create NonMltEditableProperty wrappers for properties non_mlteditable_properties = propertyedit.get_non_mlt_editable_properties( clip, filter_object, filter_index) # Extra editors. Editable properties may have already been created # with "editor=no_editor" and now extra editors may be created to edit those # Non mlt properties are added as these are only need with extraeditors editable_properties.extend(non_mlteditable_properties) editor_rows = propertyeditorbuilder.get_filter_extra_editor_rows( filter_object, editable_properties) for editor_row in editor_rows: vbox.pack_start(editor_row, False, False, 0) if not hasattr(editor_row, "no_separator"): vbox.pack_start(guicomponents.EditorSeparator().widget, False, False, 0) vbox.pack_start(guiutils.pad_label(12, 12), False, False, 0) vbox.pack_start(Gtk.Label(), True, True, 0) else: vbox.pack_start(Gtk.Label(label=_("No editable parameters")), True, True, 0) vbox.show_all() scroll_window = Gtk.ScrolledWindow() scroll_window.add_with_viewport(vbox) scroll_window.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC) scroll_window.show_all() widgets.value_edit_frame.remove(widgets.value_edit_box) widgets.value_edit_frame.add(scroll_window) widgets.value_edit_box = scroll_window
def _display_compositor_edit_box(): # This gets called on startup before edit_frame is filled try: widgets.value_edit_frame.remove(widgets.value_edit_box) except: pass global keyframe_editor_widgets keyframe_editor_widgets = [] vbox = Gtk.VBox() # Case: Empty edit frame global compositor if compositor == None: filler = Gtk.EventBox() filler.add(Gtk.Label()) vbox.pack_start(filler, True, True, 0) if current_sequence().compositing_mode != appconsts.COMPOSITING_MODE_STANDARD_FULL_TRACK: info = Gtk.Label(label=_("No Compositor")) info.set_sensitive(False) else: info = Gtk.Label(label=_("This panel not used in\n Compositing Mode Standard Full Track.")) info.set_justify(Gtk.Justification.CENTER) info.set_sensitive(False) filler = Gtk.EventBox() filler.add(info) vbox.pack_start(filler, False, False, 0) filler = Gtk.EventBox() filler.add(Gtk.Label()) vbox.pack_start(filler, True, True, 0) vbox.show_all() scroll_window = Gtk.ScrolledWindow() scroll_window.add_with_viewport(vbox) scroll_window.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC) scroll_window.show_all() widgets.value_edit_box = scroll_window widgets.value_edit_frame.add(scroll_window) return # Case: Filled frame compositor_name_label = Gtk.Label(label= "<b>" + compositor.name + "</b>") compositor_name_label.set_use_markup(True) vbox.pack_start(compositor_name_label, False, False, 0) vbox.pack_start(guicomponents.EditorSeparator().widget, False, False, 0) # Track editor if editorstate.get_compositing_mode() != appconsts.COMPOSITING_MODE_STANDARD_AUTO_FOLLOW: target_combo = guicomponents.get_compositor_track_select_combo( current_sequence().tracks[compositor.transition.b_track], current_sequence().tracks[compositor.transition.a_track], _target_track_changed) target_row = Gtk.HBox() target_row.pack_start(guiutils.get_pad_label(5, 3), False, False, 0) target_row.pack_start(Gtk.Label(label=_("Destination Track:")), False, False, 0) target_row.pack_start(guiutils.get_pad_label(5, 3), False, False, 0) target_row.pack_start(target_combo, False, False, 0) target_row.pack_start(Gtk.Label(), True, True, 0) vbox.pack_start(target_row, False, False, 0) vbox.pack_start(guicomponents.EditorSeparator().widget, False, False, 0) # Transition editors t_editable_properties = propertyedit.get_transition_editable_properties(compositor) for ep in t_editable_properties: editor_row = propertyeditorbuilder.get_editor_row(ep) if editor_row != None: # Some properties don't have editors vbox.pack_start(editor_row, False, False, 0) vbox.pack_start(guicomponents.EditorSeparator().widget, False, False, 0) # Add keyframe editor widget to be updated for frame changes if such is created. try: editor_type = ep.args[propertyeditorbuilder.EDITOR] except KeyError: editor_type = propertyeditorbuilder.SLIDER # this is the default value if ((editor_type == propertyeditorbuilder.KEYFRAME_EDITOR) or (editor_type == propertyeditorbuilder.KEYFRAME_EDITOR_RELEASE) or (editor_type == propertyeditorbuilder.KEYFRAME_EDITOR_CLIP) or (editor_type == propertyeditorbuilder.KEYFRAME_EDITOR_CLIP_FADE) or (editor_type == propertyeditorbuilder.FADE_LENGTH) or (editor_type == propertyeditorbuilder.GEOMETRY_EDITOR)): keyframe_editor_widgets.append(editor_row) # Extra editors. Editable properties have already been created with "editor=no_editor" # and will be looked up by editors from clip editor_rows = propertyeditorbuilder.get_transition_extra_editor_rows(compositor, t_editable_properties) for editor_row in editor_rows: # These are added to keyframe editors list based on editor type, not based on EditableProperty type as above # because one editor sets values for multiple EditableProperty objects if editor_row.__class__ == keyframeeditor.RotatingGeometryEditor: keyframe_editor_widgets.append(editor_row) vbox.pack_start(editor_row, False, False, 0) vbox.pack_start(guicomponents.EditorSeparator().widget, False, False, 0) vbox.pack_start(Gtk.Label(), True, True, 0) vbox.show_all() scroll_window = Gtk.ScrolledWindow() scroll_window.add_with_viewport(vbox) scroll_window.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC) scroll_window.show_all() widgets.value_edit_box = scroll_window widgets.value_edit_frame.add(scroll_window)
def _get_filter_panel(clip, filter_object, filter_index, track, clip_index): # Create EditableProperty wrappers for properties editable_properties = propertyedit.get_filter_editable_properties( clip, filter_object, filter_index, track, clip_index) # Get editors and set them displayed vbox = Gtk.VBox(False, 0) try: filter_name = translations.filter_names[filter_object.info.name] except KeyError: filter_name = filter_object.info.name filter_keyframe_editor_widgets = [] vbox.pack_start(guicomponents.EditorSeparator().widget, False, False, 0) if len(editable_properties) > 0: # Create editor row for each editable property for ep in editable_properties: editor_row = propertyeditorbuilder.get_editor_row(ep) if editor_row == None: continue # Set keyframe editor widget to be updated for frame changes if such is created try: editor_type = ep.args[propertyeditorbuilder.EDITOR] except KeyError: editor_type = propertyeditorbuilder.SLIDER # this is the default value if ((editor_type == propertyeditorbuilder.KEYFRAME_EDITOR) or (editor_type == propertyeditorbuilder.KEYFRAME_EDITOR_RELEASE) or (editor_type == propertyeditorbuilder.KEYFRAME_EDITOR_CLIP) or (editor_type == propertyeditorbuilder.FILTER_RECT_GEOM_EDITOR) or (editor_type == propertyeditorbuilder.KEYFRAME_EDITOR_CLIP_FADE_FILTER)): keyframe_editor_widgets.append(editor_row) filter_keyframe_editor_widgets.append(editor_row) # if slider property is being edited as keyrame property if hasattr(editor_row, "is_kf_editor"): keyframe_editor_widgets.append(editor_row) filter_keyframe_editor_widgets.append(editor_row) vbox.pack_start(editor_row, False, False, 0) if not hasattr(editor_row, "no_separator"): vbox.pack_start(guicomponents.EditorSeparator().widget, False, False, 0) # Create NonMltEditableProperty wrappers for properties non_mlteditable_properties = propertyedit.get_non_mlt_editable_properties( clip, filter_object, filter_index) # Extra editors. Editable properties may have already been created # with "editor=no_editor" and now extra editors may be created to edit those # Non mlt properties are added as these are only needed with extraeditors editable_properties.extend(non_mlteditable_properties) editor_rows = propertyeditorbuilder.get_filter_extra_editor_rows( filter_object, editable_properties) for editor_row in editor_rows: vbox.pack_start(editor_row, False, False, 0) if not hasattr(editor_row, "no_separator"): vbox.pack_start(guicomponents.EditorSeparator().widget, False, False, 0) else: vbox.pack_start(Gtk.Label(label=_("No editable parameters")), True, True, 0) vbox.show_all() return (vbox, filter_keyframe_editor_widgets)
def __init__(self, editable_properties): self.widget = Gtk.VBox() # Get MLT properties self.lift_r = filter(lambda ep: ep.name == "lift_r", editable_properties)[0] self.lift_g = filter(lambda ep: ep.name == "lift_g", editable_properties)[0] self.lift_b = filter(lambda ep: ep.name == "lift_b", editable_properties)[0] self.gamma_r = filter(lambda ep: ep.name == "gamma_r", editable_properties)[0] self.gamma_g = filter(lambda ep: ep.name == "gamma_g", editable_properties)[0] self.gamma_b = filter(lambda ep: ep.name == "gamma_b", editable_properties)[0] self.gain_r = filter(lambda ep: ep.name == "gain_r", editable_properties)[0] self.gain_g = filter(lambda ep: ep.name == "gain_g", editable_properties)[0] self.gain_b = filter(lambda ep: ep.name == "gain_b", editable_properties)[0] # Get Non-MLT properties self.lift_hue = filter(lambda ep: ep.name == "lift_hue", editable_properties)[0] self.lift_value = filter(lambda ep: ep.name == "lift_value", editable_properties)[0] self.gamma_hue = filter(lambda ep: ep.name == "gamma_hue", editable_properties)[0] self.gamma_value = filter(lambda ep: ep.name == "gamma_value", editable_properties)[0] self.gain_hue = filter(lambda ep: ep.name == "gain_hue", editable_properties)[0] self.gain_value = filter(lambda ep: ep.name == "gain_value", editable_properties)[0] # Lift editor self.lift_hue_selector = self.get_hue_selector(self.lift_hue_edited) self.lift_hue_value_label = Gtk.Label() self.lift_hue_row = self.get_hue_row(self.lift_hue_selector.widget, self.lift_hue_value_label) self.lift_adjustment = self.lift_value.get_input_range_adjustment() self.lift_adjustment.connect("value-changed", self.lift_value_changed) self.lift_slider_row = self.get_slider_row(self.lift_adjustment) self.update_lift_display(self.lift_hue.get_float_value(), self.lift_value.get_current_in_value()) # Gamma editor self.gamma_hue_selector = self.get_hue_selector(self.gamma_hue_edited) self.gamma_hue_value_label = Gtk.Label() self.gamma_hue_row = self.get_hue_row(self.gamma_hue_selector.widget, self.gamma_hue_value_label) self.gamma_adjustment = self.gamma_value.get_input_range_adjustment() self.gamma_adjustment.connect("value-changed", self.gamma_value_changed) self.gamma_slider_row = self.get_slider_row(self.gamma_adjustment) self.update_gamma_display(self.gamma_hue.get_float_value(), self.gamma_value.get_current_in_value()) # Gain editor self.gain_hue_selector = self.get_hue_selector(self.gain_hue_edited) self.gain_hue_value_label = Gtk.Label() self.gain_hue_row = self.get_hue_row(self.gain_hue_selector.widget, self.gain_hue_value_label) self.gain_adjustment = self.gain_value.get_input_range_adjustment() self.gain_adjustment.connect("value-changed", self.gain_value_changed) self.gain_slider_row = self.get_slider_row(self.gain_adjustment) self.update_gain_display(self.gain_hue.get_float_value(), self.gain_value.get_current_in_value()) # Pack self.widget.pack_start(self.get_name_row("Lift"), True, True, 0) self.widget.pack_start(self.lift_hue_row, True, True, 0) self.widget.pack_start(self.lift_slider_row, True, True, 0) self.widget.pack_start(guicomponents.EditorSeparator().widget, True, True, 0) self.widget.pack_start(self.get_name_row("Gamma"), True, True, 0) self.widget.pack_start(self.gamma_hue_row , True, True, 0) self.widget.pack_start(self.gamma_slider_row , True, True, 0) self.widget.pack_start(guicomponents.EditorSeparator().widget, True, True, 0) self.widget.pack_start(self.get_name_row("Gain"), True, True, 0) self.widget.pack_start(self.gain_hue_row , True, True, 0) self.widget.pack_start(self.gain_slider_row , True, True, 0) self.widget.pack_start(Gtk.Label(), True, True, 0)