Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
BlenderPhi
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
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
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
raas
BlenderPhi
Commits
c40e9a1a
Commit
c40e9a1a
authored
7 years ago
by
Campbell Barton
Browse files
Options
Downloads
Patches
Plain Diff
Docs: invoke_search_popup uses bl_property
Also add code example in docs.
parent
21f19224
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
doc/python_api/examples/bpy.types.Operator.6.py
+38
-0
38 additions, 0 deletions
doc/python_api/examples/bpy.types.Operator.6.py
source/blender/makesrna/intern/rna_wm_api.c
+5
-2
5 additions, 2 deletions
source/blender/makesrna/intern/rna_wm_api.c
with
43 additions
and
2 deletions
doc/python_api/examples/bpy.types.Operator.6.py
0 → 100644
+
38
−
0
View file @
c40e9a1a
"""
Enum Search Popup
+++++++++++++++++
You may want to have an operator prompt the user to select an item
from a search field, this can be done using :class:`bpy.types.Operator.invoke_search_popup`.
"""
import
bpy
from
bpy.props
import
EnumProperty
class
SearchEnumOperator
(
bpy
.
types
.
Operator
):
bl_idname
=
"
object.search_enum_operator
"
bl_label
=
"
Search Enum Operator
"
bl_property
=
"
my_search
"
my_search
=
EnumProperty
(
name
=
"
My Search
"
,
items
=
(
(
'
FOO
'
,
"
Foo
"
,
""
),
(
'
BAR
'
,
"
Bar
"
,
""
),
(
'
BAZ
'
,
"
Baz
"
,
""
),
),
)
def
execute
(
self
,
context
):
self
.
report
({
'
INFO
'
},
"
Selected:
"
+
self
.
my_search
)
return
{
'
FINISHED
'
}
def
invoke
(
self
,
context
,
event
):
context
.
window_manager
.
invoke_search_popup
(
self
)
return
{
'
RUNNING_MODAL
'
}
bpy
.
utils
.
register_class
(
SearchEnumOperator
)
# test call
bpy
.
ops
.
object
.
search_enum_operator
(
'
INVOKE_DEFAULT
'
)
This diff is collapsed.
Click to expand it.
source/blender/makesrna/intern/rna_wm_api.c
+
5
−
2
View file @
c40e9a1a
...
@@ -459,8 +459,11 @@ void RNA_api_wm(StructRNA *srna)
...
@@ -459,8 +459,11 @@ void RNA_api_wm(StructRNA *srna)
/* invoke enum */
/* invoke enum */
func
=
RNA_def_function
(
srna
,
"invoke_search_popup"
,
"rna_Operator_enum_search_invoke"
);
func
=
RNA_def_function
(
srna
,
"invoke_search_popup"
,
"rna_Operator_enum_search_invoke"
);
RNA_def_function_ui_description
(
func
,
"Operator search popup invoke (search in values of "
RNA_def_function_ui_description
(
"operator's type 'prop' EnumProperty, and execute it on confirmation)"
);
func
,
"Operator search popup invoke which "
"searches values of the operator's :class:`bpy.types.Operator.bl_property` "
"(which must be an EnumProperty), executing it on confirmation"
);
rna_generic_op_invoke
(
func
,
0
);
rna_generic_op_invoke
(
func
,
0
);
/* invoke functions, for use with python */
/* invoke functions, for use with python */
...
...
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