Skip to content

Commit

Permalink
Merge pull request #1254 from frankrousseau/master
Browse files Browse the repository at this point in the history
Various fixes
  • Loading branch information
frankrousseau authored Nov 27, 2023
2 parents d110e97 + 48eef75 commit 7a5af76
Show file tree
Hide file tree
Showing 18 changed files with 180 additions and 152 deletions.
2 changes: 0 additions & 2 deletions src/components/mixins/annotation.js
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,6 @@ export const annotationMixin = {
addToDeletions(obj) {
this.markLastAnnotationTime()
const currentTime = this.getCurrentTime()
console.log('removeFromDeletions', currentTime)
const deletion = this.deletions.find(d => d.time === currentTime)
if (deletion) {
deletion.objects.push(obj.id)
Expand Down Expand Up @@ -407,7 +406,6 @@ export const annotationMixin = {
* Later it will be interesting to represent time in as a frame number.
*/
getNewAnnotations(currentTime, annotation) {
console.log('getNewAnnotations', currentTime, annotation)
this.fabricCanvas.getObjects().forEach(obj => {
this.setObjectData(obj)
if (obj.type === 'path') {
Expand Down
6 changes: 6 additions & 0 deletions src/components/mixins/entity.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import {
parseDate,
parseSimpleDate
} from '@/lib/time'
import { mapActions } from 'vuex'

import moment from 'moment'

/*
Expand Down Expand Up @@ -177,6 +179,8 @@ export const entityMixin = {
},

methods: {
...mapActions(['addSelectedTask', 'clearSelectedTasks']),

changeTab(tab) {
this.selectedTab = tab
},
Expand All @@ -186,7 +190,9 @@ export const entityMixin = {
},

onTaskSelected(task) {
this.clearSelectedTasks()
if (!this.currentTask || this.currentTask.id !== task.id) {
this.addSelectedTask(task)
this.currentTask = task
} else {
this.currentTask = null
Expand Down
7 changes: 0 additions & 7 deletions src/components/mixins/player.js
Original file line number Diff line number Diff line change
Expand Up @@ -564,12 +564,6 @@ export const playerMixin = {
let previousFrameTime = this.fullPlayer.currentTime - this.frameDuration
const previousFrame = Math.round(previousFrameTime * this.fps)
const entityPosition = this.playlistShotPosition[previousFrame]
console.log(
'entityPosition',
this.fullPlayer.currentTime,
previousFrame,
previousFrameTime
)
if (!entityPosition) return

const entityIndex = entityPosition.index
Expand Down Expand Up @@ -980,7 +974,6 @@ export const playerMixin = {
if (duration) {
duration = floorToFrame(duration, this.fps)
this.maxDurationRaw = duration
console.log(duration)
this.maxDuration = this.formatTime(duration)
this.resetHandles()
} else {
Expand Down
24 changes: 21 additions & 3 deletions src/components/modals/BuildFilterModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -181,12 +181,16 @@
class="flexrow-item align-middle"
v-if="['assignedto', '-assignedto'].includes(assignation.value)"
>
on
{{ $t('main.on') }}
</span>

<combobox-task-type
class="flexrow-item"
:task-type-list="taskTypeList"
:task-type-list="
['assigned', 'unassigned'].includes(assignation.value)
? taskTypeList
: taskTypeListWithAll
"
v-model="assignation.taskTypeId"
v-if="
[
Expand Down Expand Up @@ -449,6 +453,16 @@ export default {
]
},
taskTypeListWithAll() {
return [
{
id: '',
color: '#999',
name: this.$t('main.all')
}
].concat(this.taskTypeList)
},
taskTypeList() {
return this[`${this.entityType}ValidationColumns`].map(taskTypeId =>
this.taskTypeMap.get(taskTypeId)
Expand Down Expand Up @@ -556,7 +570,11 @@ export default {
let value = this.assignation.person.name
const taskType = this.taskTypeMap.get(this.assignation.taskTypeId)
if (this.assignation.value === '-assignedto') value = `-${value}`
query += ` assignedto[${taskType.name}]=[${value}]`
if (taskType) {
query += ` assignedto[${taskType.name}]=[${value}]`
} else {
query += ` assignedto[]=[${value}]`
}
} else if (this.assignation.taskTypeId) {
const taskType = this.taskTypeMap.get(this.assignation.taskTypeId)
const value =
Expand Down
2 changes: 1 addition & 1 deletion src/components/pages/Asset.vue
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@
</div>

<div class="column side-column" v-if="currentTask">
<task-info :task="currentTask" />
<task-info :task="currentTask" entity-type="Asset" with-actions />
</div>

<edit-asset-modal
Expand Down
2 changes: 1 addition & 1 deletion src/components/pages/Episode.vue
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@
</div>

<div class="column side-column" v-if="currentTask">
<task-info :task="currentTask" />
<task-info :task="currentTask" entity-type="Episode" with-actions />
</div>

<edit-episode-modal
Expand Down
2 changes: 1 addition & 1 deletion src/components/pages/Sequence.vue
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@
</div>

<div class="column side-column" v-if="currentTask">
<task-info :task="currentTask" />
<task-info :task="currentTask" entity-type="Sequence" with-actions />
</div>

<edit-sequence-modal
Expand Down
2 changes: 1 addition & 1 deletion src/components/pages/Shot.vue
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@
</div>

<div class="column side-column" v-if="currentTask">
<task-info :task="currentTask" />
<task-info :task="currentTask" entity-type="Shot" with-actions />
</div>

<edit-shot-modal
Expand Down
16 changes: 13 additions & 3 deletions src/components/pages/playlists/PlaylistPlayer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,6 @@
}"
ref="video-container"
>
<span class="video-time">
{{ currentTimeRaw }}
</span>
<video
ref="full-playlist-player"
class="raw-player"
Expand Down Expand Up @@ -2042,6 +2039,19 @@ export default {
})
},
fullScreen() {
this.resetHeight()
console.log('fullscreen', this.fullScreen)
this.$nextTick().then(() => {
window.dispatchEvent(new Event('resize'))
setTimeout(() => {
window.dispatchEvent(new Event('resize'))
}, 300)
})
},
isComparing() {
if (this.isComparing) {
this.pause()
Expand Down
5 changes: 0 additions & 5 deletions src/components/pages/playlists/RawVideoPlayer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -438,14 +438,12 @@ export default {
},
setCurrentTimeRaw(currentTime) {
console.log(currentTime)
if (this.currentPlayer) {
this.currentPlayer.currentTime = currentTime
}
},
setCurrentFrame(frameNumber) {
console.log(frameNumber)
this._setCurrentTime(frameNumber * this.frameDuration)
},
Expand Down Expand Up @@ -475,9 +473,6 @@ export default {
this.currentPlayer.currentTime !== currentTime + change
) {
// tweaks needed because the html video player is messy with frames
let time = currentTime + change + 0.001
time = Number(time.toPrecision(4))
console.log(time)
this.currentPlayer.currentTime = currentTime + change + 0.001
this.onTimeUpdate()
}
Expand Down
82 changes: 30 additions & 52 deletions src/components/previews/PreviewPlayer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
<preview-viewer
ref="preview-viewer"
class="preview-viewer"
:current-frame="frameNumberRaw"
:default-height="defaultHeight"
:is-big="big"
:is-comparing="isComparing && isComparisonEnabled"
Expand All @@ -58,7 +59,7 @@
position: isComparisonOverlay ? 'absolute' : 'static'
}"
@duration-changed="changeMaxDuration"
@frame-update="updateFrame"
@frame-update="setVideoFrameContext"
@play-ended="pause"
@size-changed="fixCanvasSize"
@video-end="onVideoEnd"
Expand All @@ -68,6 +69,8 @@
<preview-viewer
ref="comparison-preview-viewer"
class="comparison-preview-viewer"
name="comparison-preview-viewer"
:current-frame="frameNumberRaw"
:default-height="defaultHeight"
:is-big="big"
:is-comparing="isComparing && isComparisonEnabled"
Expand Down Expand Up @@ -615,6 +618,7 @@ export default {
return {
annotations: [],
currentIndex: 1,
frameNumberRaw: 0,
fullScreen: false,
color: '#ff3860',
currentBackground: null,
Expand Down Expand Up @@ -766,11 +770,8 @@ export default {
},
currentFrame() {
const isChromium = !!window.chrome
let change = isChromium ? 2 : 1
if (this.frameNumber === 0) change = 1
const frame = Math.min(this.nbFrames, this.frameNumber + change)
return formatFrame(frame)
const frame = Math.min(this.nbFrames, this.frameNumberRaw)
return formatFrame(frame + 1)
},
currentPreview() {
Expand Down Expand Up @@ -992,20 +993,30 @@ export default {
)
},
updateFrame(frameNumber) {
const isChromium = !!window.chrome
const change = isChromium ? 1 : 0
const time = frameNumber * this.frameDuration
if (this.frameNumber !== frameNumber) {
this.progress.updateProgressBar(frameNumber + change)
setVideoFrameContext(frameNumber) {
if (this.frameNumberRaw !== frameNumber) {
this.frameNumberRaw = frameNumber
const time = frameNumber * this.frameDuration
this.currentTimeRaw = time
this.currentTime = this.formatTime(time + change * this.frameDuration)
this.$emit('time-updated', time)
this.currentTime = this.formatTime(time)
this.progress.updateProgressBar(frameNumber)
if (!this.isPlaying) {
this.syncComparisonViewer()
}
if (!this.isPlaying) this.loadAnnotation()
}
},
// Video progress
setCurrentFrame(frameNumber) {
if (frameNumber !== this.frameNumber) {
this.setVideoFrameContext(frameNumber)
this.previewViewer.setCurrentFrame(frameNumber)
}
},
initPreferences() {
const isRepeating = localPreferences.getBoolPreference('player:repeating')
const isMuted = localPreferences.getBoolPreference('player:muted')
Expand Down Expand Up @@ -1061,10 +1072,7 @@ export default {
},
getCurrentTime() {
const currentTimeRaw = this.previewViewer.getCurrentTimeRaw()
const isChromium = !!window.chrome
const change = isChromium ? this.frameDuration : 0
return roundToFrame(currentTimeRaw + change, this.fps) || 0
return this.currentTimeRaw
},
play() {
Expand Down Expand Up @@ -1108,25 +1116,13 @@ export default {
syncComparisonViewer() {
if (this.comparisonViewer && this.isComparing) {
// Dirty fix: add a missing frame to the comparison video
const isChromium = !!window.chrome
const change = isChromium ? this.frameDuration : 0
this.comparisonViewer.setCurrentTimeRaw(
this.previewViewer.getCurrentTimeRaw() + change
)
this.comparisonViewer.setCurrentFrameRaw(this.frameNumberRaw)
}
},
onProgressChanged(frameNumber) {
const isChromium = !!window.chrome
if (isChromium || frameNumber !== this.frameNumber) {
if (frameNumber !== this.frameNumberRaw) {
this.clearCanvas()
if (isChromium) {
// Chromium has a bug with the video duration
// https://bugs.chromium.org/p/chromium/issues/detail?id=642012
frameNumber -= 1
frameNumber = Math.max(0, frameNumber)
}
this.setCurrentFrame(frameNumber)
}
},
Expand Down Expand Up @@ -1491,15 +1487,10 @@ export default {
saveAnnotations() {
let currentTime = 0
if (this.isMovie) {
const isChromium = !!window.chrome
const change = isChromium ? this.frameDuration : 0
const currentTimeRaw = this.previewViewer.getCurrentTimeRaw()
currentTime = roundToFrame(currentTimeRaw, this.fps) + change
console.log(currentTimeRaw, currentTime)
currentTime = this.currentTimeRaw
}
const annotation = this.getAnnotation(currentTime)
const annotations = this.getNewAnnotations(currentTime, annotation)
console.log(annotation, annotations)
if (!this.readOnly) {
const preview = this.currentPreview
if (!this.notSaved) {
Expand All @@ -1516,7 +1507,6 @@ export default {
const change = isChromium ? this.frameDuration : 0
currentTime = roundToFrame(this.currentTimeRaw, this.fps) + change
}
console.log(currentTime, this.annotations)
annotation = this.getAnnotation(currentTime)
if (!annotation) {
if (!this.isMovie) {
Expand Down Expand Up @@ -1878,18 +1868,6 @@ export default {
return false
},
// Video progress
setCurrentFrame(frameNumber) {
if (frameNumber !== this.frameNumber) {
this.previewViewer.setCurrentFrame(frameNumber)
this.syncComparisonViewer()
setTimeout(() => {
this.syncComparisonViewer()
}, this.frameDuration)
}
},
// Revision previews
onRevisionPreviewSelected(index) {
Expand Down
Loading

0 comments on commit 7a5af76

Please sign in to comment.