Skip to content

Commit 0832cd3

Browse files
Merge pull request #4058 from OpenShot/effect-parenting
Effect parenting
2 parents 11e045d + beb522e commit 0832cd3

File tree

9 files changed

+954
-547
lines changed

9 files changed

+954
-547
lines changed

src/classes/effect_init.py

+5-4
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@
2525
You should have received a copy of the GNU General Public License
2626
along with OpenShot Library. If not, see <http://www.gnu.org/licenses/>.
2727
"""
28-
28+
from classes.info import YOLO_PATH
29+
import os
2930
# Not all Effects support pre-processing, so for now, this is a hard-coded
3031
# solution to providing the pre-processing params needed for these special effects.
3132

@@ -150,19 +151,19 @@
150151

151152
"Object Detector": [
152153
{
153-
"value": "../yolo/yolov3.weights",
154+
"value": os.path.join(YOLO_PATH,"yolov3.weights"),
154155
"title": "Model Weights",
155156
"type": "text",
156157
"setting": "model-weights"
157158
},
158159
{
159-
"value": "../yolo/yolov3.cfg",
160+
"value": os.path.join(YOLO_PATH,"yolov3.cfg"),
160161
"title": "Model Config",
161162
"type": "text",
162163
"setting": "model-config"
163164
},
164165
{
165-
"value": "../yolo/obj.names",
166+
"value": os.path.join(YOLO_PATH,"obj.names"),
166167
"title": "Class names",
167168
"type": "text",
168169
"setting": "class-names"

src/classes/info.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@
6262
USER_PRESETS_PATH = os.path.join(USER_PATH, "presets")
6363
USER_TITLES_PATH = os.path.join(USER_PATH, "title_templates")
6464
PROTOBUF_DATA_PATH = os.path.join(USER_PATH, "protobuf_data")
65+
YOLO_PATH = os.path.join(USER_PATH, "yolo")
6566
# User files
6667
BACKUP_FILE = os.path.join(BACKUP_PATH, "backup.osp")
6768
USER_DEFAULT_PROJECT = os.path.join(USER_PATH, "default.project")
@@ -72,7 +73,7 @@
7273
USER_PATH, BACKUP_PATH, RECOVERY_PATH, THUMBNAIL_PATH, CACHE_PATH,
7374
BLENDER_PATH, TITLE_PATH, TRANSITIONS_PATH, PREVIEW_CACHE_PATH,
7475
USER_PROFILES_PATH, USER_PRESETS_PATH, USER_TITLES_PATH, EMOJIS_PATH,
75-
PROTOBUF_DATA_PATH ]:
76+
PROTOBUF_DATA_PATH, YOLO_PATH ]:
7677
if not os.path.exists(os.fsencode(folder)):
7778
os.makedirs(folder, exist_ok=True)
7879

src/windows/main_window.py

+10-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
from classes.importers.final_cut_pro import import_xml
5757
from classes.logger import log
5858
from classes.metrics import track_metric_session, track_metric_screen
59-
from classes.query import Clip, Transition, Marker, Track
59+
from classes.query import Clip, Transition, Marker, Track, Effect
6060
from classes.thumbnail import httpThumbnailServerThread
6161
from classes.time_parts import secondsToTimecode
6262
from classes.timeline import TimelineSync
@@ -99,6 +99,7 @@ class MainWindow(updates.UpdateWatcher, QMainWindow):
9999
FoundVersionSignal = pyqtSignal(str)
100100
WaveformReady = pyqtSignal(str, list)
101101
TransformSignal = pyqtSignal(str)
102+
KeyFrameTransformSignal = pyqtSignal(str, str)
102103
SelectRegionSignal = pyqtSignal(str)
103104
MaxSizeChanged = pyqtSignal(object)
104105
InsertKeyframe = pyqtSignal(object)
@@ -2287,6 +2288,14 @@ def addSelection(self, item_id, item_type, clear_existing=False):
22872288
elif item_type == "effect" and item_id not in self.selected_effects:
22882289
self.selected_effects.append(item_id)
22892290

2291+
effect = Effect.get(id=item_id)
2292+
if effect:
2293+
if effect.data.get("has_tracked_object"):
2294+
# Show bounding boxes transform on preview
2295+
clip_id = effect.parent['id']
2296+
self.KeyFrameTransformSignal.emit(item_id, clip_id)
2297+
2298+
22902299
# Change selected item in properties view
22912300
self.show_property_id = item_id
22922301
self.show_property_type = item_type

0 commit comments

Comments
 (0)