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
02036843
Commit
02036843
authored
9 years ago
by
Ines Almeida
Browse files
Options
Downloads
Patches
Plain Diff
[Selection Sets] Standard naming convention for new sets
parent
39e7885a
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
+17
-8
17 additions, 8 deletions
bone_selection_sets.py
with
17 additions
and
8 deletions
bone_selection_sets.py
+
17
−
8
View file @
02036843
...
@@ -164,7 +164,6 @@ class POSE_OT_selection_set_add(PluginOperator):
...
@@ -164,7 +164,6 @@ class POSE_OT_selection_set_add(PluginOperator):
bl_description
=
"
Creates a new empty Selection Set
"
bl_description
=
"
Creates a new empty Selection Set
"
bl_options
=
{
'
UNDO
'
,
'
REGISTER
'
}
bl_options
=
{
'
UNDO
'
,
'
REGISTER
'
}
created_counter
=
0
def
execute
(
self
,
context
):
def
execute
(
self
,
context
):
arm
=
context
.
object
arm
=
context
.
object
...
@@ -172,10 +171,23 @@ class POSE_OT_selection_set_add(PluginOperator):
...
@@ -172,10 +171,23 @@ class POSE_OT_selection_set_add(PluginOperator):
new_sel_set
=
arm
.
selection_sets
.
add
()
new_sel_set
=
arm
.
selection_sets
.
add
()
# naming
# naming
new_sel_set
.
name
=
"
SelectionSet
"
if
"
SelectionSet
"
not
in
arm
.
selection_sets
:
if
POSE_OT_selection_set_add
.
created_counter
>
0
:
new_sel_set
.
name
=
"
SelectionSet
"
new_sel_set
.
name
+=
"
.{:03d}
"
.
format
(
POSE_OT_selection_set_add
.
created_counter
)
else
:
POSE_OT_selection_set_add
.
created_counter
+=
1
sorted_sets
=
[]
for
selset
in
arm
.
selection_sets
:
if
selset
.
name
.
startswith
(
"
SelectionSet.
"
):
index
=
selset
.
name
[
13
:]
if
index
.
isdigit
():
sorted_sets
.
append
(
index
)
sorted_sets
=
sorted
(
sorted_sets
)
min_index
=
1
for
num
in
sorted_sets
:
num
=
int
(
num
)
if
min_index
<
num
:
break
min_index
=
num
+
1
new_sel_set
.
name
=
"
SelectionSet.{:03d}
"
.
format
(
min_index
)
# select newly created set
# select newly created set
arm
.
active_selection_set
=
len
(
arm
.
selection_sets
)
-
1
arm
.
active_selection_set
=
len
(
arm
.
selection_sets
)
-
1
...
@@ -215,12 +227,10 @@ class POSE_OT_selection_set_assign(PluginOperator):
...
@@ -215,12 +227,10 @@ class POSE_OT_selection_set_assign(PluginOperator):
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
"
)
print
(
"
finished invoke
"
)
return
{
'
FINISHED
'
}
return
{
'
FINISHED
'
}
def
execute
(
self
,
context
):
def
execute
(
self
,
context
):
print
(
"
execute
"
)
arm
=
context
.
object
arm
=
context
.
object
act_sel_set
=
arm
.
selection_sets
[
arm
.
active_selection_set
]
act_sel_set
=
arm
.
selection_sets
[
arm
.
active_selection_set
]
...
@@ -295,7 +305,6 @@ class POSE_OT_selection_set_add_and_assign(PluginOperator):
...
@@ -295,7 +305,6 @@ class POSE_OT_selection_set_add_and_assign(PluginOperator):
def
execute
(
self
,
context
):
def
execute
(
self
,
context
):
bpy
.
ops
.
pose
.
selection_set_add
(
'
EXEC_DEFAULT
'
)
bpy
.
ops
.
pose
.
selection_set_add
(
'
EXEC_DEFAULT
'
)
bpy
.
ops
.
pose
.
selection_set_assign
(
'
EXEC_DEFAULT
'
)
bpy
.
ops
.
pose
.
selection_set_assign
(
'
EXEC_DEFAULT
'
)
print
(
"
finished special
"
)
return
{
'
FINISHED
'
}
return
{
'
FINISHED
'
}
# Registry ####################################################################
# Registry ####################################################################
...
...
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