Page Menu
Home
Search
Configure Global Search
Log In
Files
F19091
sequencer_select_all_by_type.py
Public
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Authored By
Turi Scandurra (turi)
Nov 13 2013, 4:14 PM
Size
4 KB
Subscribers
None
sequencer_select_all_by_type.py
View Options
#----------------------------------------------------------
# File sequencer_select_all_by_type.py
#----------------------------------------------------------
# ##### BEGIN GPL LICENSE BLOCK #####
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# ##### END GPL LICENSE BLOCK #####
bl_info
=
{
'name'
:
'Select All by Type'
,
'author'
:
'Turi Scandurra'
,
'version'
:
(
0
,
1
),
'blender'
:
(
2
,
6
,
2
,
0
),
'api'
:
44469
,
'category'
:
'Sequencer'
,
'location'
:
'Sequencer > Select > All by Type'
,
'description'
:
'Select all the strips of the same type'
,
'warning'
:
''
,
'wiki_url'
:
''
,
'tracker_url'
:
''
,}
'''
Usage:
- Install the Extension by copying its .py file to your Blender addons
folder.
- Enable the Extension in User Preferences > Addons > Sequencer.
- The functionality can then be accessed on Sequencer Menu via Select >
All by Type.
- The script performs a selection according to a specified strip type,
or to the same type as active strip.
'''
import
bpy
from
bpy.props
import
EnumProperty
def
act_strip
(
context
):
try
:
return
context
.
scene
.
sequence_editor
.
active_strip
except
AttributeError
:
return
None
class
SEQUENCER_OT_SelectAllByType
(
bpy
.
types
.
Operator
):
bl_label
=
'All by Type'
bl_idname
=
'sequencer.select_all_by_type'
bl_description
=
'Select all the strips of the same type'
type
=
EnumProperty
(
name
=
"Strip Type"
,
items
=
(
(
'ACTIVE'
,
"Same as Active Strip"
,
""
),
(
'IMAGE'
,
"Image"
,
""
),
(
'META'
,
"Meta"
,
""
),
(
'SCENE'
,
"Scene"
,
""
),
(
'MOVIE'
,
"Movie"
,
""
),
(
'SOUND'
,
"Sound"
,
""
),
(
'TRANSFORM'
,
"Transform"
,
""
),
(
'COLOR'
,
"Color"
,
""
)),
default
=
'ACTIVE'
,
)
bl_options
=
{
'REGISTER'
,
'UNDO'
}
def
invoke
(
self
,
context
,
event
):
strip_type
=
self
.
type
scn
=
bpy
.
context
.
scene
seq
=
scn
.
sequence_editor
meta_level
=
len
(
seq
.
meta_stack
)
if
meta_level
>
0
:
seq
=
seq
.
meta_stack
[
meta_level
-
1
]
active_strip
=
act_strip
(
context
)
if
strip_type
==
'ACTIVE'
:
if
active_strip
==
None
:
self
.
report
({
'ERROR_INVALID_INPUT'
},
'No active strip'
)
return
{
'CANCELLED'
}
strip_type
=
active_strip
.
type
striplist
=
[]
for
i
in
seq
.
sequences
:
try
:
if
i
.
type
==
strip_type
:
striplist
.
append
(
i
)
except
AttributeError
:
pass
# TWO PASSES REQUIRED FOR ACCURACY
for
i
in
range
(
len
(
striplist
)):
strip
=
striplist
[
i
]
try
:
strip
.
select
=
True
except
AttributeError
:
pass
bpy
.
ops
.
sequencer
.
reload
()
return
{
'FINISHED'
}
# REGISTRATION
def
menu_func
(
self
,
context
):
self
.
layout
.
operator_menu_enum
(
"sequencer.select_all_by_type"
,
"type"
,
text
=
"All by Type"
,
icon
=
'PLUGIN'
)
self
.
layout
.
separator
()
def
register
():
bpy
.
utils
.
register_class
(
SEQUENCER_OT_SelectAllByType
)
bpy
.
types
.
SEQUENCER_MT_select
.
prepend
(
menu_func
)
def
unregister
():
bpy
.
utils
.
unregister_class
(
SEQUENCER_OT_SelectAllByType
)
bpy
.
types
.
SEQUENCER_MT_select
.
remove
(
menu_func
)
if
__name__
==
'__main__'
:
register
()
File Metadata
Details
Mime Type
text/x-python
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
9c/f7/e02c0ae770ec59174303bff3b6dc
Event Timeline
Log In to Comment