Skip to content

Commit

Permalink
Merge pull request #4058 from OpenShot/effect-parenting
Browse files Browse the repository at this point in the history
Effect parenting
  • Loading branch information
BrennoCaldato authored Jun 1, 2021
2 parents 11e045d + beb522e commit 0832cd3
Show file tree
Hide file tree
Showing 9 changed files with 954 additions and 547 deletions.
9 changes: 5 additions & 4 deletions src/classes/effect_init.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
You should have received a copy of the GNU General Public License
along with OpenShot Library. If not, see <http://www.gnu.org/licenses/>.
"""

from classes.info import YOLO_PATH
import os
# Not all Effects support pre-processing, so for now, this is a hard-coded
# solution to providing the pre-processing params needed for these special effects.

Expand Down Expand Up @@ -150,19 +151,19 @@

"Object Detector": [
{
"value": "../yolo/yolov3.weights",
"value": os.path.join(YOLO_PATH,"yolov3.weights"),
"title": "Model Weights",
"type": "text",
"setting": "model-weights"
},
{
"value": "../yolo/yolov3.cfg",
"value": os.path.join(YOLO_PATH,"yolov3.cfg"),
"title": "Model Config",
"type": "text",
"setting": "model-config"
},
{
"value": "../yolo/obj.names",
"value": os.path.join(YOLO_PATH,"obj.names"),
"title": "Class names",
"type": "text",
"setting": "class-names"
Expand Down
3 changes: 2 additions & 1 deletion src/classes/info.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
USER_PRESETS_PATH = os.path.join(USER_PATH, "presets")
USER_TITLES_PATH = os.path.join(USER_PATH, "title_templates")
PROTOBUF_DATA_PATH = os.path.join(USER_PATH, "protobuf_data")
YOLO_PATH = os.path.join(USER_PATH, "yolo")
# User files
BACKUP_FILE = os.path.join(BACKUP_PATH, "backup.osp")
USER_DEFAULT_PROJECT = os.path.join(USER_PATH, "default.project")
Expand All @@ -72,7 +73,7 @@
USER_PATH, BACKUP_PATH, RECOVERY_PATH, THUMBNAIL_PATH, CACHE_PATH,
BLENDER_PATH, TITLE_PATH, TRANSITIONS_PATH, PREVIEW_CACHE_PATH,
USER_PROFILES_PATH, USER_PRESETS_PATH, USER_TITLES_PATH, EMOJIS_PATH,
PROTOBUF_DATA_PATH ]:
PROTOBUF_DATA_PATH, YOLO_PATH ]:
if not os.path.exists(os.fsencode(folder)):
os.makedirs(folder, exist_ok=True)

Expand Down
11 changes: 10 additions & 1 deletion src/windows/main_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
from classes.importers.final_cut_pro import import_xml
from classes.logger import log
from classes.metrics import track_metric_session, track_metric_screen
from classes.query import Clip, Transition, Marker, Track
from classes.query import Clip, Transition, Marker, Track, Effect
from classes.thumbnail import httpThumbnailServerThread
from classes.time_parts import secondsToTimecode
from classes.timeline import TimelineSync
Expand Down Expand Up @@ -99,6 +99,7 @@ class MainWindow(updates.UpdateWatcher, QMainWindow):
FoundVersionSignal = pyqtSignal(str)
WaveformReady = pyqtSignal(str, list)
TransformSignal = pyqtSignal(str)
KeyFrameTransformSignal = pyqtSignal(str, str)
SelectRegionSignal = pyqtSignal(str)
MaxSizeChanged = pyqtSignal(object)
InsertKeyframe = pyqtSignal(object)
Expand Down Expand Up @@ -2287,6 +2288,14 @@ def addSelection(self, item_id, item_type, clear_existing=False):
elif item_type == "effect" and item_id not in self.selected_effects:
self.selected_effects.append(item_id)

effect = Effect.get(id=item_id)
if effect:
if effect.data.get("has_tracked_object"):
# Show bounding boxes transform on preview
clip_id = effect.parent['id']
self.KeyFrameTransformSignal.emit(item_id, clip_id)


# Change selected item in properties view
self.show_property_id = item_id
self.show_property_type = item_type
Expand Down
Loading

0 comments on commit 0832cd3

Please sign in to comment.