|
40 | 40 | from PyQt5.QtGui import QCursor, QKeySequence, QColor
|
41 | 41 | from PyQt5.QtWebEngineWidgets import QWebEngineView
|
42 | 42 | from PyQt5.QtWebChannel import QWebChannel
|
43 |
| -from PyQt5.QtWidgets import QMenu |
| 43 | +from PyQt5.QtWidgets import QMenu, QDialog |
44 | 44 |
|
45 | 45 | from classes import info, updates
|
46 | 46 | from classes import settings
|
@@ -2990,11 +2990,45 @@ def callback(self, effect_names, callback_data):
|
2990 | 2990 | log.info("Applying effect {} to clip ID {}".format(name, clip.id))
|
2991 | 2991 | log.debug(clip)
|
2992 | 2992 |
|
2993 |
| - # Create Effect |
2994 |
| - effect = openshot.EffectInfo().CreateEffect(name) |
| 2993 | + # Handle custom effect dialogs |
| 2994 | + if name in effect_options: |
2995 | 2995 |
|
2996 |
| - # Get Effect JSON |
2997 |
| - effect.Id(get_app().project.generate_id()) |
| 2996 | + # Get effect options |
| 2997 | + effect_params = effect_options.get(name) |
| 2998 | + |
| 2999 | + # Show effect pre-processing window |
| 3000 | + from windows.process_effect import ProcessEffect |
| 3001 | + |
| 3002 | + try: |
| 3003 | + win = ProcessEffect(clip.id, name, effect_params) |
| 3004 | + |
| 3005 | + except ModuleNotFoundError as e: |
| 3006 | + print("[ERROR]: " + str(e)) |
| 3007 | + return |
| 3008 | + |
| 3009 | + print("Effect %s" % name) |
| 3010 | + print("Effect options: %s" % effect_options) |
| 3011 | + |
| 3012 | + # Run the dialog event loop - blocking interaction on this window during this time |
| 3013 | + result = win.exec_() |
| 3014 | + |
| 3015 | + if result == QDialog.Accepted: |
| 3016 | + log.info('Start processing') |
| 3017 | + else: |
| 3018 | + log.info('Cancel processing') |
| 3019 | + return |
| 3020 | + |
| 3021 | + # Create Effect |
| 3022 | + effect = win.effect # effect.Id already set |
| 3023 | + |
| 3024 | + if effect is None: |
| 3025 | + break |
| 3026 | + else: |
| 3027 | + # Create Effect |
| 3028 | + effect = openshot.EffectInfo().CreateEffect(name) |
| 3029 | + |
| 3030 | + # Get Effect JSON |
| 3031 | + effect.Id(get_app().project.generate_id()) |
2998 | 3032 | effect_json = json.loads(effect.Json())
|
2999 | 3033 |
|
3000 | 3034 | # Append effect JSON to clip
|
|
0 commit comments