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
ab058bc4
Commit
ab058bc4
authored
9 years ago
by
Ines Almeida
Browse files
Options
Downloads
Patches
Plain Diff
[Selection Sets] Fix broken Assign operator, add functionality to move sets up/down the list
parent
c24359d9
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
bone_selection_sets.py
+48
-6
48 additions, 6 deletions
bone_selection_sets.py
with
48 additions
and
6 deletions
bone_selection_sets.py
+
48
−
6
View file @
ab058bc4
...
@@ -40,13 +40,9 @@ from bpy.types import (
...
@@ -40,13 +40,9 @@ from bpy.types import (
from
bpy.props
import
(
from
bpy.props
import
(
StringProperty
,
StringProperty
,
BoolProperty
,
IntProperty
,
IntProperty
,
FloatProperty
,
EnumProperty
,
EnumProperty
,
CollectionProperty
,
CollectionProperty
,
BoolVectorProperty
,
FloatVectorProperty
,
)
)
# Data Structure ##############################################################
# Data Structure ##############################################################
...
@@ -111,7 +107,11 @@ class POSE_PT_selection_sets(Panel):
...
@@ -111,7 +107,11 @@ class POSE_PT_selection_sets(Panel):
# TODO specials like sorting
# TODO specials like sorting
#col.menu("POSE_MT_selection_sets_specials", icon='DOWNARROW_HLT', text="")
#col.menu("POSE_MT_selection_sets_specials", icon='DOWNARROW_HLT', text="")
# TODO move up/down arrows
# move up/down arrows
if
len
(
arm
.
selection_sets
)
>
0
:
col
.
separator
()
col
.
operator
(
"
pose.selection_set_move
"
,
icon
=
'
TRIA_UP
'
,
text
=
""
).
direction
=
'
UP
'
col
.
operator
(
"
pose.selection_set_move
"
,
icon
=
'
TRIA_DOWN
'
,
text
=
""
).
direction
=
'
DOWN
'
# buttons
# buttons
row
=
layout
.
row
()
row
=
layout
.
row
()
...
@@ -154,10 +154,49 @@ class NeedSelSetPluginOperator(PluginOperator):
...
@@ -154,10 +154,49 @@ class NeedSelSetPluginOperator(PluginOperator):
def
poll
(
self
,
context
):
def
poll
(
self
,
context
):
if
super
().
poll
(
context
):
if
super
().
poll
(
context
):
arm
=
context
.
object
arm
=
context
.
object
return
(
arm
.
active_selection_set
<
len
(
arm
.
selection_sets
))
return
(
arm
.
active_selection_set
<
len
(
arm
.
selection_sets
)
and
arm
.
active_selection_set
>=
0
)
return
False
return
False
class
POSE_OT_selection_set_move
(
NeedSelSetPluginOperator
):
bl_idname
=
"
pose.selection_set_move
"
bl_label
=
"
Move Selection Set in List
"
bl_description
=
"
Move the active Selection Set up/down the list of sets
"
bl_options
=
{
'
UNDO
'
,
'
REGISTER
'
}
direction
=
EnumProperty
(
name
=
"
Move Direction
"
,
description
=
"
Direction to move the active Selection Set: UP (default) or DOWN
"
,
items
=
[
(
'
UP
'
,
"
Up
"
,
""
,
-
1
),
(
'
DOWN
'
,
"
Down
"
,
""
,
1
),
],
default
=
'
UP
'
)
@classmethod
def
poll
(
self
,
context
):
if
super
().
poll
(
context
):
arm
=
context
.
object
return
len
(
arm
.
selection_sets
)
>
1
return
False
def
execute
(
self
,
context
):
arm
=
context
.
object
active_idx
=
arm
.
active_selection_set
new_idx
=
active_idx
+
(
-
1
if
self
.
direction
==
'
UP
'
else
1
)
if
new_idx
<
0
or
new_idx
>=
len
(
arm
.
selection_sets
):
return
{
'
FINISHED
'
}
arm
.
selection_sets
.
move
(
active_idx
,
new_idx
)
arm
.
active_selection_set
=
new_idx
return
{
'
FINISHED
'
}
class
POSE_OT_selection_set_add
(
PluginOperator
):
class
POSE_OT_selection_set_add
(
PluginOperator
):
bl_idname
=
"
pose.selection_set_add
"
bl_idname
=
"
pose.selection_set_add
"
bl_label
=
"
Create Selection Set
"
bl_label
=
"
Create Selection Set
"
...
@@ -226,6 +265,8 @@ class POSE_OT_selection_set_assign(PluginOperator):
...
@@ -226,6 +265,8 @@ class POSE_OT_selection_set_assign(PluginOperator):
if
not
(
arm
.
active_selection_set
<
len
(
arm
.
selection_sets
)):
if
not
(
arm
.
active_selection_set
<
len
(
arm
.
selection_sets
)):
bpy
.
ops
.
wm
.
call_menu
(
"
INVOKE_DEFAULT
"
,
bpy
.
ops
.
wm
.
call_menu
(
"
INVOKE_DEFAULT
"
,
name
=
"
pose.selection_set_create_new_popup
"
)
name
=
"
pose.selection_set_create_new_popup
"
)
else
:
bpy
.
ops
.
pose
.
selection_set_assign
(
'
EXEC_DEFAULT
'
)
return
{
'
FINISHED
'
}
return
{
'
FINISHED
'
}
...
@@ -316,6 +357,7 @@ classes = (
...
@@ -316,6 +357,7 @@ classes = (
POSE_UL_selection_set
,
POSE_UL_selection_set
,
SelectionEntry
,
SelectionEntry
,
SelectionSet
,
SelectionSet
,
POSE_OT_selection_set_move
,
POSE_OT_selection_set_add
,
POSE_OT_selection_set_add
,
POSE_OT_selection_set_remove
,
POSE_OT_selection_set_remove
,
POSE_OT_selection_set_assign
,
POSE_OT_selection_set_assign
,
...
...
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