Skip to content

Commit

Permalink
Sync to DNEG internal
Browse files Browse the repository at this point in the history
  • Loading branch information
tedwaine committed Jan 14, 2025
1 parent 4ddc9df commit 457b232
Show file tree
Hide file tree
Showing 23 changed files with 172 additions and 43 deletions.
4 changes: 4 additions & 0 deletions include/xstudio/media_reader/image_buffer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,10 @@ namespace media_reader {
return false;
}

if (bookmarks_ != o.bookmarks_) {
return false;
}

return true;
}

Expand Down
17 changes: 17 additions & 0 deletions share/preference/core_playhead.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,23 @@
{
"core": {
"playhead":{
"remote_desktop_optimisation": {
"path": "/core/playhead/remote_desktop_optimisation",
"default_value": false,
"description": "Reduce UI updates whilst playing.",
"value": false,
"datatype": "bool",
"category": "Playback",
"context": ["APPLICATION"]
},
"remote_desktop_optimisation_delay": {
"path": "/core/playhead/remote_desktop_optimisation_delay",
"default_value": 250,
"description": "UI refresh delay.",
"value": 500,
"datatype": "int",
"context": ["APPLICATION"]
},
"read_ahead": {
"path": "/core/playhead/read_ahead",
"default_value": 128,
Expand Down
21 changes: 11 additions & 10 deletions src/launch/xstudio/src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,30 +1,31 @@
project(xstudio VERSION ${XSTUDIO_GLOBAL_VERSION} LANGUAGES CXX)


find_package(OpenGL REQUIRED)
find_package(GLEW REQUIRED)
find_package(Qt5 COMPONENTS Core Quick Gui Widgets OpenGL QuickCompiler REQUIRED)
find_package(OpenSSL)
find_package(ZLIB)
find_package(fmt REQUIRED)

qtquick_compiler_add_resources(QML_RESOURCES ../../../../ui/qml/xstudio/qml.qrc)
set(SOURCES
xstudio.cpp
../../../../ui/qml/xstudio/qml.qrc
)
${QML_RESOURCES}
)

if(WIN32)
# Add the /bigobj option for xstudio.cpp
set_source_files_properties(xstudio.cpp PROPERTIES COMPILE_FLAGS "/bigobj")
endif()

find_package(OpenGL REQUIRED)
find_package(GLEW REQUIRED)
find_package(Qt5 COMPONENTS Core Quick Gui Widgets OpenGL REQUIRED)
find_package(OpenSSL)
find_package(ZLIB)
find_package(fmt REQUIRED)

if(NOT ${OTIO_SUBMODULE})
find_package(OpenTime REQUIRED)
find_package(OpenTimelineIO REQUIRED)
endif()

set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)

add_executable(${PROJECT_NAME} ${SOURCES})

Expand Down
2 changes: 1 addition & 1 deletion src/playhead/src/playhead_actor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3357,7 +3357,7 @@ void PlayheadActor::step_to_next_media(const bool forwards) {

auto playlist_selection = caf::actor_cast<caf::actor>(playlist_selection_addr_);
if (playlist_selection) {
anon_send(playlist_selection, playhead::select_next_media_atom_v, 1);
anon_send(playlist_selection, playhead::select_next_media_atom_v, forwards ? 1 : -1);
}

} else {
Expand Down
1 change: 1 addition & 0 deletions src/plugin/data_source/dneg/shotbrowser/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ target_link_libraries(${PROJECT_NAME}
PUBLIC
xstudio::module
xstudio::plugin_manager
xstudio::playlist
xstudio::ui::qml::helper
xstudio::shotgun_client
Qt5::Widgets
Expand Down
10 changes: 0 additions & 10 deletions src/plugin/data_source/dneg/shotbrowser/src/preset_model_ui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -873,16 +873,6 @@ QFuture<QString> ShotBrowserPresetModel::restorePresetsFuture(const QUrl &qpath)
});
}

nlohmann::json JSONTreeModel::modelData() const {
// build json from tree..
return tree_to_json(data_, children_);
}

nlohmann::json JSONTreeModel::indexToFullData(const QModelIndex &index, const int depth) const {
return tree_to_json(*indexToTree(index), children_, depth);
}


void ShotBrowserPresetFilterModel::setShowHidden(const bool value) {
if (value != show_hidden_) {
show_hidden_ = value;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,12 @@ function revealMediaInIvy(indexes=[]) {
for(let i = 0; i< indexes.length; i++) {
let mindex = indexes[i]
Future.promise(
mindex.model.getJSONFuture(mindex, "/metadata/shotgun/version/attributes/sg_ivy_dnuuid")
).then(function(json_string) {
json_string = json_string.replace(/^"|"$/g, '')
helpers.startDetachedProcess("dnenv-do", [helpers.getEnv("SHOW"), helpers.getEnv("SHOT"), "--", "ivybrowser", json_string])
mindex.model.getJSONObjectFuture(mindex, "/metadata/shotgun/version")
).then(function(json_obj) {
let uuid = json_obj.attributes.sg_ivy_dnuuid
let job = json_obj.relationships.project.data.name
let shot = json_obj.relationships.entity.data.name
helpers.startDetachedProcess("dnenv-do", [job, shot, "--", "ivybrowser", "--no-prefs", uuid])
})
}
}
Expand All @@ -126,7 +128,7 @@ function revealInIvy(indexes=[]) {
}
}
if(uuids.length)
helpers.startDetachedProcess("dnenv-do", [project, shot, "--", "ivybrowser"].concat(uuids))
helpers.startDetachedProcess("dnenv-do", [project, shot, "--", "ivybrowser", "--no-prefs"].concat(uuids))
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ XsWindow{

onPresetIndexChanged: {
if(presetIndex.valid) {
presetTermModel.model = null
presetTermModel.model = ShotBrowserEngine.presetsModel
presetTermModel.rootIndex = presetIndex
presetList.model.newTermParent = presetIndex
}
Expand Down
1 change: 1 addition & 0 deletions src/plugin/media_hook/dneg/dnhook/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ find_package(OpenColorIO CONFIG)
SET(LINK_DEPS
xstudio::media_hook
xstudio::utility
xstudio::module
OpenColorIO::OpenColorIO
)

Expand Down
2 changes: 1 addition & 1 deletion src/plugin/media_hook/dneg/dnhook/src/dneg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,7 @@ class DNegMediaHook : public MediaHook {
static const std::regex review_regex(".+\\.review[0-9]\\.mov$");
static const std::regex internal_regex(".+\\.dneg.mov$");

const std::string ext = utility::to_lower(fs::path(path).extension());
const std::string ext = utility::to_lower(fs::path(path).extension().string());
static const std::set<std::string> linear_ext{".exr", ".sxr", ".mxr", ".movieproc"};
static const std::set<std::string> log_ext{".cin", ".dpx"};
static const std::set<std::string> stills_ext{
Expand Down
5 changes: 3 additions & 2 deletions src/timeline/src/timeline_actor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,9 @@ namespace {

auto __sysclock_now() {
#ifdef _MSC_VER
auto tp = sysclock::now();
return std::chrono::duration_cast<std::chrono::microseconds>(tp.time_since_epoch()).count();
/*auto tp = sysclock::now();
return std::chrono::duration_cast<std::chrono::microseconds>(tp.time_since_epoch()).count();*/
return sysclock::now();
#else
return sysclock::now();
#endif
Expand Down
32 changes: 32 additions & 0 deletions ui/qml/xstudio/helpers/XsBufferedProperty.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// SPDX-License-Identifier: Apache-2.0
import QtQuick 2.15

Item {
property bool enableBuffering: false
property var source: null
property var value: null

property int delay: 0

property var updateTimer: Timer {
interval: delay
running: false
repeat: false
onTriggered: {
value = source
}
}

onSourceChanged: {
if(enableBuffering && delay) {
if(!updateTimer.running)
updateTimer.start()
}
else
value = source
}

Component.onCompleted: {
value = source
}
}
27 changes: 27 additions & 0 deletions ui/qml/xstudio/helpers/XsBufferedUIProperty.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// SPDX-License-Identifier: Apache-2.0
import QtQuick 2.15
import xStudio 1.0

XsBufferedProperty {
property bool playing: false
delay: updateDelay.value
updateTimer: appWindow.bufferedUITimer

enableBuffering: playing && enableDelay.value

Connections{
target: updateTimer
function onTriggered() {
value = source
}
}

XsPreference {
id: updateDelay
path: "/core/playhead/remote_desktop_optimisation_delay"
}
XsPreference {
id: enableDelay
path: "/core/playhead/remote_desktop_optimisation"
}
}
2 changes: 2 additions & 0 deletions ui/qml/xstudio/qml.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,8 @@
<qresource prefix="/">
<file>helpers/XsDialogHelpers.qml</file>
<file>helpers/XsTimer.qml</file>
<file>helpers/XsBufferedProperty.qml</file>
<file>helpers/XsBufferedUIProperty.qml</file>
</qresource>

<qresource prefix="/feather_icons">
Expand Down
5 changes: 4 additions & 1 deletion ui/qml/xstudio/session_data/XsPreference.qml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ XsPreferenceMap {
id: control
property string path: ""

onPathChanged: index = helpers.makePersistent(globalStoreModel.searchRecursive(path, "pathRole"))
onPathChanged: {
if(globalStoreModel)
index = helpers.makePersistent(globalStoreModel.searchRecursive(path, "pathRole"))
}
}

10 changes: 9 additions & 1 deletion ui/qml/xstudio/views/timeline/XsTimeline.qml
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,14 @@ Rectangle {
signal jumpToEnd()
signal jumpToFrame(int frame, bool center)

XsBufferedUIProperty {
id: bufferedPlayheadFrame
source: timelinePlayhead.logicalFrame ? timelinePlayhead.logicalFrame : 0
playing: timelinePlayhead.playing != undefined ? timelinePlayhead.playing : false
}

property alias playheadFrame: bufferedPlayheadFrame.value

onScaleYChanged: verticalScale = scaleY

onScalingModeActiveChanged: {
Expand Down Expand Up @@ -1867,7 +1875,7 @@ Rectangle {
property real trackHeaderWidth: timeline.trackHeaderWidth
property var setTrackHeaderWidth: timeline.setTrackHeaderWidth
property var timelineSelection: timeline.timelineSelection
property int playheadFrame: timelinePlayhead.logicalFrame ? timelinePlayhead.logicalFrame : 0
property int playheadFrame: timeline.playheadFrame
property string itemFlag: defaultClip

property var draggingStarted: ma.draggingStarted
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@ Rectangle {
frameRate: timelineDetail.fps
totalFrames: playheadActive ? currentFrame : lastFrame

property int currentFrame: timelinePlayhead.logicalFrame + timelineDetail.start
property int currentFrame: control.playheadFrame + timelineDetail.start
property int lastFrame: 0
property bool playheadActive: timelinePlayhead.pinnedSourceMode ? currentPlayhead.uuid == timelinePlayhead.uuid : false

Expand Down
4 changes: 0 additions & 4 deletions ui/qml/xstudio/views/timeline/widgets/XsTimelineCursor.qml
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,10 @@ Item {

property bool showBobble: true

// layer.enabled: true
// layer.samples: 4

Rectangle {
id: line
width: 1
color: control.color

x: cursorX
height: parent.height
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,5 +69,11 @@ XsViewerTextDisplay
return result
}

text: selected == 0 ? frame : selected == 1 ? seconds : selected == 2 ? timecode : timecodeFrame
XsBufferedUIProperty {
id: bufferedPlayheadFrame
source: selected == 0 ? frame : selected == 1 ? seconds : selected == 2 ? timecode : timecodeFrame
playing: viewportPlayhead.playing
}

text: bufferedPlayheadFrame.value
}
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,14 @@ XsViewerTextDisplay
}


text: selected == 0 ? duration : selected == 1 ? remaining : fps
text: bufferedPlayheadFrame.value

XsBufferedUIProperty {
id: bufferedPlayheadFrame
source: selected == 0 ? duration : selected == 1 ? remaining : fps
playing: viewportPlayhead.playing
}


function timeStr(tt) {
let result = "--:--:--"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,14 +115,20 @@ Item {
}

// Draws the image cache indicator bar(s)
XsBufferedUIProperty {
id: bufferedCachedFrames
source: viewportPlayhead.cachedFrames
playing: viewportPlayhead.playing
}

Item {
Repeater {
model: viewportPlayhead.cachedFrames ? viewportPlayhead.cachedFrames.length/2 : []
Rectangle {
model: bufferedCachedFrames.value ? bufferedCachedFrames.value.length/2 : 0
Rectangle {
color: "green"
opacity: 0.5
x: scaleFactor*viewportPlayhead.cachedFrames[index*2]
width: scaleFactor*(viewportPlayhead.cachedFrames[index*2+1])
x: scaleFactor*bufferedCachedFrames.value[index*2]
width: scaleFactor*(bufferedCachedFrames.value[index*2+1])
height: 5
y: 10
}
Expand All @@ -134,9 +140,16 @@ Item {

// This is the playhead widget - a vertical line with a little upside-down
// house shape at the top

XsBufferedUIProperty {
id: bufferedX
source: scaleFactor*viewportPlayhead.logicalFrame
playing: viewportPlayhead.playing
}

Item {

x: scaleFactor*viewportPlayhead.logicalFrame - width/2
x: bufferedX.value - width/2
width: control.handleWidth
property alias handleColour: control.handleColour

Expand Down
14 changes: 14 additions & 0 deletions ui/qml/xstudio/windows/XsSessionWindow.qml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,20 @@ ApplicationWindow {

}


XsPreference {
id: bufferedUIDelay
path: globalStoreModel ? "/core/playhead/remote_desktop_optimisation_delay" : ""
}
Timer {
id: bufferedUITimer
interval: bufferedUIDelay.value != undefined ? bufferedUIDelay.value : 0
running: false
repeat: false

}
property alias bufferedUITimer: bufferedUITimer

XsPreference {
id: __tabsVisibility
index: globalStoreModel.searchRecursive("/ui/qml/tabs_visibility", "pathRole")
Expand Down
Loading

0 comments on commit 457b232

Please sign in to comment.