Storyboard scenes: intercut places fold into one scene
This commit is contained in:
parent
41125f6fa2
commit
bdccfa9147
1 changed files with 18 additions and 4 deletions
22
trailer.html
22
trailer.html
|
|
@ -1424,12 +1424,26 @@
|
|||
// through seventy cards to find one.
|
||||
function hasScenes(shots) { return shots.length > 8 && shots.filter(function (x) { return x.scene; }).length > shots.length / 2; }
|
||||
function sceneKey(s) { return String(s.place || s.scene || s.setting || "").toLowerCase().replace(/^(int|ext)\.?\s*\/?\s*(int|ext)?\.?\s*/, "").replace(/\s*[-–—]\s*(day|night|dawn|dusk|morning|evening|afternoon|late afternoon|continuous|the storm|the tornado).*$/, "").replace(/[^a-z0-9]+/g, " ").trim(); }
|
||||
// Two keys name one place when one begins with the other ("farmyard",
|
||||
// "farmyard gravel drive"). And a scene that cuts between the kitchen and
|
||||
// the doorstep is ONE scene: a place that comes back within two groups
|
||||
// folds everything since into itself.
|
||||
function samePlace(a, b) { return a === b || (a && b && (a.indexOf(b) === 0 || b.indexOf(a) === 0)); }
|
||||
function sceneGroups(shots) {
|
||||
var groups = [], cur = null;
|
||||
var groups = [];
|
||||
shots.forEach(function (s) {
|
||||
var k = sceneKey(s);
|
||||
if (!cur || cur.key !== k) { cur = { key: k, name: s.scene || s.setting || k, shots: [] }; groups.push(cur); }
|
||||
cur.shots.push(s);
|
||||
var k = sceneKey(s), cur = groups[groups.length - 1];
|
||||
if (cur && samePlace(cur.key, k)) { cur.shots.push(s); return; }
|
||||
for (var back = 2; back <= 3; back++) {
|
||||
var g = groups[groups.length - back];
|
||||
if (g && samePlace(g.key, k)) {
|
||||
var merged = groups.splice(groups.length - back + 1);
|
||||
merged.forEach(function (m) { g.shots = g.shots.concat(m.shots); if (g.name.indexOf(m.name) < 0) g.name += " / " + m.name; });
|
||||
g.shots.push(s);
|
||||
return;
|
||||
}
|
||||
}
|
||||
groups.push({ key: k, name: s.scene || s.setting || k, shots: [s] });
|
||||
});
|
||||
return groups;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue