Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
blender-addons
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
blender
blender-addons
Commits
1e9fd8a5
Commit
1e9fd8a5
authored
12 years ago
by
Campbell Barton
Browse files
Options
Downloads
Patches
Plain Diff
use pep8 naming convention for parse_edl.py
parent
4fe9bb98
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
io_sequencer_edl/__init__.py
+3
-3
3 additions, 3 deletions
io_sequencer_edl/__init__.py
io_sequencer_edl/import_edl.py
+4
-4
4 additions, 4 deletions
io_sequencer_edl/import_edl.py
io_sequencer_edl/parse_edl.py
+25
-30
25 additions, 30 deletions
io_sequencer_edl/parse_edl.py
with
32 additions
and
37 deletions
io_sequencer_edl/__init__.py
+
3
−
3
View file @
1e9fd8a5
...
...
@@ -54,7 +54,7 @@ class ReloadEDL(Operator):
def
execute
(
self
,
context
):
import
os
from
.
import
import
_edl
from
.
import
parse
_edl
scene
=
context
.
scene
edl_import_info
=
scene
.
edl_import_info
...
...
@@ -66,7 +66,7 @@ class ReloadEDL(Operator):
self
.
report
({
'
ERROR
'
},
"
File Not Found %r
"
%
filepath
)
return
{
'
CANCELLED
'
}
elist
=
import
_edl
.
EditList
()
elist
=
parse
_edl
.
EditList
()
if
not
elist
.
parse
(
filepath
,
dummy_fps
):
self
.
report
({
'
ERROR
'
},
"
Failed to parse EDL %r
"
%
filepath
)
return
{
'
CANCELLED
'
}
...
...
@@ -79,7 +79,7 @@ class ReloadEDL(Operator):
data_prev
=
{
reel
.
name
:
(
reel
.
filepath
,
reel
.
frame_offset
)
for
reel
in
edl_import_info
.
reels
}
reels
=
elist
.
getReels
()
reels
=
elist
.
reels_as_dict
()
reels
=
[
k
for
k
in
reels
.
keys
()
if
k
!=
"
bw
"
]
# re-create reels collection, keeping old values
...
...
This diff is collapsed.
Click to expand it.
io_sequencer_edl/import_edl.py
+
4
−
4
View file @
1e9fd8a5
...
...
@@ -143,7 +143,7 @@ def load_edl(scene, filename, reel_files, reel_offsets):
unedited_start
=
rec_start
-
src_start
offset_start
=
src_start
-
int
(
src_start
*
scale
)
# works for scaling up AND down
if
edit
.
transition_type
==
parse_edl
.
TRANSITION_CUT
and
(
not
elist
.
testO
verlap
(
edit
)):
if
edit
.
transition_type
==
parse_edl
.
TRANSITION_CUT
and
(
not
elist
.
o
verlap
_test
(
edit
)):
track
=
1
strip
=
None
...
...
@@ -272,7 +272,7 @@ def load_edl(scene, filename, reel_files, reel_offsets):
if
final_strips
:
for
strip
in
final_strips
:
# strip.frame_duration = length
final_strip
.
name
=
edit
.
as
N
ame
()
final_strip
.
name
=
edit
.
as
_n
ame
()
edit
.
custom_data
[:]
=
final_strips
# track = not track
prev_edit
=
edit
...
...
@@ -293,7 +293,7 @@ def _test():
_fps
=
25
if
not
elist
.
parse
(
_filename
,
_fps
):
assert
(
0
)
reels
=
elist
.
getReels
()
reels
=
elist
.
reels_as_dict
()
print
(
list
(
reels
.
keys
()))
...
...
@@ -303,4 +303,4 @@ def _test():
{
'
tapec
'
:
"
/fe/edl/cinesoft/rush/rushes3.avi
"
},
{
'
tapec
'
:
0
})
# /tmp/test.edl
print
(
msg
)
_test
()
#
_test()
This diff is collapsed.
Click to expand it.
io_sequencer_edl/parse_edl.py
+
25
−
30
View file @
1e9fd8a5
...
...
@@ -39,22 +39,22 @@ class TimeCode:
def
__init__
(
self
,
data
,
fps
):
self
.
fps
=
fps
if
type
(
data
)
==
str
:
self
.
from
S
tring
(
data
)
frame
=
self
.
as
F
rame
()
self
.
from
F
rame
(
frame
)
self
.
from
_s
tring
(
data
)
frame
=
self
.
as
_f
rame
()
self
.
from
_f
rame
(
frame
)
else
:
self
.
from
F
rame
(
data
)
self
.
from
_f
rame
(
data
)
def
from
S
tring
(
self
,
text
):
def
from
_s
tring
(
self
,
text
):
# hh:mm:ss:ff
# No dropframe support yet
if
text
.
lower
().
endswith
(
"
mps
"
):
# 5.2mps
return
self
.
from
F
rame
(
int
(
float
(
text
[:
-
3
])
*
self
.
fps
))
return
self
.
from
_f
rame
(
int
(
float
(
text
[:
-
3
])
*
self
.
fps
))
elif
text
.
lower
().
endswith
(
"
s
"
):
# 5.2s
return
self
.
from
F
rame
(
int
(
float
(
text
[:
-
1
])
*
self
.
fps
))
return
self
.
from
_f
rame
(
int
(
float
(
text
[:
-
1
])
*
self
.
fps
))
elif
text
.
isdigit
():
# 1234
return
self
.
from
F
rame
(
int
(
text
))
return
self
.
from
_f
rame
(
int
(
text
))
elif
"
:
"
in
text
:
# hh:mm:ss:ff
text
=
text
.
replace
(
"
;
"
,
"
:
"
).
replace
(
"
,
"
,
"
:
"
).
replace
(
"
.
"
,
"
:
"
)
text
=
text
.
split
(
"
:
"
)
...
...
@@ -68,7 +68,7 @@ class TimeCode:
print
(
"
ERROR: could not convert this into timecode %r
"
%
text
)
return
self
def
from
F
rame
(
self
,
frame
):
def
from
_f
rame
(
self
,
frame
):
if
frame
<
0
:
frame
=
-
frame
...
...
@@ -107,7 +107,7 @@ class TimeCode:
return
self
def
as
F
rame
(
self
):
def
as
_f
rame
(
self
):
abs_frame
=
self
.
frame
abs_frame
+=
self
.
seconds
*
self
.
fps
abs_frame
+=
self
.
minutes
*
60
*
self
.
fps
...
...
@@ -115,19 +115,19 @@ class TimeCode:
return
abs_frame
def
as
S
tring
(
self
):
self
.
from
F
rame
(
int
(
self
))
def
as
_s
tring
(
self
):
self
.
from
_f
rame
(
int
(
self
))
return
"
%.2d:%.2d:%.2d:%.2d
"
%
(
self
.
hours
,
self
.
minutes
,
self
.
seconds
,
self
.
frame
)
def
__repr__
(
self
):
return
self
.
as
S
tring
()
return
self
.
as
_s
tring
()
# Numeric stuff, may as well have this
def
__neg__
(
self
):
return
TimeCode
(
-
int
(
self
),
self
.
fps
)
def
__int__
(
self
):
return
self
.
as
F
rame
()
return
self
.
as
_f
rame
()
def
__sub__
(
self
,
other
):
return
TimeCode
(
int
(
self
)
-
int
(
other
),
self
.
fps
)
...
...
@@ -145,13 +145,13 @@ class TimeCode:
return
TimeCode
(
abs
(
int
(
self
)),
self
.
fps
)
def
__iadd__
(
self
,
other
):
return
self
.
from
F
rame
(
int
(
self
)
+
int
(
other
))
return
self
.
from
_f
rame
(
int
(
self
)
+
int
(
other
))
def
__imul__
(
self
,
other
):
return
self
.
from
F
rame
(
int
(
self
)
*
int
(
other
))
return
self
.
from
_f
rame
(
int
(
self
)
*
int
(
other
))
def
__idiv__
(
self
,
other
):
return
self
.
from
F
rame
(
int
(
self
)
//
int
(
other
))
return
self
.
from
_f
rame
(
int
(
self
)
//
int
(
other
))
# end timecode
...
...
@@ -266,15 +266,6 @@ t /= 2
print t
"""
def
editFlagsToText
(
flag
):
items
=
[]
for
item
,
val
in
EDIT_DICT
.
items
():
if
val
&
flag
:
items
.
append
(
item
)
return
"
/
"
.
join
(
items
)
class
EditDecision
:
__slots__
=
(
"
number
"
,
...
...
@@ -294,6 +285,10 @@ class EditDecision:
"
custom_data
"
,
)
@staticmethod
def
edit_flags_to_text
(
flag
):
return
"
/
"
.
join
([
item
for
item
,
val
in
EDIT_DICT
.
items
()
if
val
&
flag
])
def
__init__
(
self
,
text
=
None
,
fps
=
25
):
# print text
self
.
number
=
-
1
...
...
@@ -320,7 +315,7 @@ class EditDecision:
txt
=
"
num: %d,
"
%
self
.
number
txt
+=
"
reel: %s,
"
%
self
.
reel
txt
+=
"
edit_type:
"
txt
+=
edit
F
lags
ToT
ext
(
self
.
edit_type
)
+
"
,
"
txt
+=
EditDecision
.
edit
_f
lags
_to_t
ext
(
self
.
edit_type
)
+
"
,
"
txt
+=
"
trans_type:
"
for
item
,
val
in
TRANSITION_DICT
.
items
():
...
...
@@ -424,7 +419,7 @@ class EditDecision:
self
.
renumber
()
# TODO
def
as
N
ame
(
self
):
def
as
_n
ame
(
self
):
cut_type
=
"
nil
"
for
k
,
v
in
TRANSITION_DICT
.
items
():
if
v
==
self
.
transition_type
:
...
...
@@ -547,7 +542,7 @@ class EditList:
file
.
close
()
return
True
def
testO
verlap
(
self
,
edit_test
):
def
o
verlap
_test
(
self
,
edit_test
):
recIn
=
int
(
edit_test
.
recIn
)
recOut
=
int
(
edit_test
.
recOut
)
...
...
@@ -570,7 +565,7 @@ class EditList:
return
False
def
getReels
(
self
):
def
reels_as_dict
(
self
):
reels
=
{}
for
edit
in
self
.
edits
:
reels
.
setdefault
(
edit
.
reel
,
[]).
append
(
edit
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment