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
7a871722
Commit
7a871722
authored
3 years ago
by
Vilem Duha
Browse files
Options
Downloads
Patches
Plain Diff
BlenderKit: close popup menu when it makes sense after running an operator
parent
ac92e71d
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
blenderkit/paths.py
+2
-0
2 additions, 0 deletions
blenderkit/paths.py
blenderkit/search.py
+8
-0
8 additions, 0 deletions
blenderkit/search.py
blenderkit/ui_panels.py
+2
-0
2 additions, 0 deletions
blenderkit/ui_panels.py
with
12 additions
and
0 deletions
blenderkit/paths.py
+
2
−
0
View file @
7a871722
...
@@ -97,6 +97,8 @@ def get_categories_filepath():
...
@@ -97,6 +97,8 @@ def get_categories_filepath():
return
os
.
path
.
join
(
tempdir
,
'
categories.json
'
)
return
os
.
path
.
join
(
tempdir
,
'
categories.json
'
)
dirs_exist_dict
=
{}
#cache these results since this is used very often
dirs_exist_dict
=
{}
#cache these results since this is used very often
# this causes the function to fail if user deletes the directory while blender is running,
# but comes back when blender is restarted.
def
get_temp_dir
(
subdir
=
None
):
def
get_temp_dir
(
subdir
=
None
):
user_preferences
=
bpy
.
context
.
preferences
.
addons
[
'
blenderkit
'
].
preferences
user_preferences
=
bpy
.
context
.
preferences
.
addons
[
'
blenderkit
'
].
preferences
...
...
This diff is collapsed.
Click to expand it.
blenderkit/search.py
+
8
−
0
View file @
7a871722
...
@@ -1458,6 +1458,12 @@ class SearchOperator(Operator):
...
@@ -1458,6 +1458,12 @@ class SearchOperator(Operator):
bl_description
=
"
Search online for assets
"
bl_description
=
"
Search online for assets
"
bl_options
=
{
'
REGISTER
'
,
'
UNDO
'
,
'
INTERNAL
'
}
bl_options
=
{
'
REGISTER
'
,
'
UNDO
'
,
'
INTERNAL
'
}
esc
:
BoolProperty
(
name
=
"
Escape window
"
,
description
=
"
Escape window right after start
"
,
default
=
False
,
options
=
{
'
SKIP_SAVE
'
}
)
own
:
BoolProperty
(
name
=
"
own assets only
"
,
own
:
BoolProperty
(
name
=
"
own assets only
"
,
description
=
"
Find all own assets
"
,
description
=
"
Find all own assets
"
,
default
=
False
)
default
=
False
)
...
@@ -1506,6 +1512,8 @@ class SearchOperator(Operator):
...
@@ -1506,6 +1512,8 @@ class SearchOperator(Operator):
def
execute
(
self
,
context
):
def
execute
(
self
,
context
):
# TODO ; this should all get transferred to properties of the search operator, so sprops don't have to be fetched here at all.
# TODO ; this should all get transferred to properties of the search operator, so sprops don't have to be fetched here at all.
if
self
.
esc
:
bpy
.
ops
.
view3d
.
close_popup_button
(
'
INVOKE_DEFAULT
'
)
sprops
=
utils
.
get_search_props
()
sprops
=
utils
.
get_search_props
()
if
self
.
author_id
!=
''
:
if
self
.
author_id
!=
''
:
sprops
.
search_keywords
=
''
sprops
.
search_keywords
=
''
...
...
This diff is collapsed.
Click to expand it.
blenderkit/ui_panels.py
+
2
−
0
View file @
7a871722
...
@@ -1206,6 +1206,7 @@ def draw_asset_context_menu(layout, context, asset_data, from_panel=False):
...
@@ -1206,6 +1206,7 @@ def draw_asset_context_menu(layout, context, asset_data, from_panel=False):
op
.
author_id
=
author_id
op
.
author_id
=
author_id
op
=
layout
.
operator
(
'
view3d.blenderkit_search
'
,
text
=
'
Search Similar
'
)
op
=
layout
.
operator
(
'
view3d.blenderkit_search
'
,
text
=
'
Search Similar
'
)
op
.
esc
=
True
op
.
tooltip
=
'
Search for similar assets in the library
'
op
.
tooltip
=
'
Search for similar assets in the library
'
# build search string from description and tags:
# build search string from description and tags:
op
.
keywords
=
asset_data
[
'
name
'
]
op
.
keywords
=
asset_data
[
'
name
'
]
...
@@ -1721,6 +1722,7 @@ class AssetPopupCard(bpy.types.Operator, ratings_utils.RatingsProperties):
...
@@ -1721,6 +1722,7 @@ class AssetPopupCard(bpy.types.Operator, ratings_utils.RatingsProperties):
op
.
url
=
url
op
.
url
=
url
op
=
button_row
.
operator
(
'
view3d.blenderkit_search
'
,
text
=
"
Find Assets By Author
"
)
op
=
button_row
.
operator
(
'
view3d.blenderkit_search
'
,
text
=
"
Find Assets By Author
"
)
op
.
esc
=
True
op
.
keywords
=
''
op
.
keywords
=
''
op
.
author_id
=
self
.
asset_data
[
'
author
'
][
'
id
'
]
op
.
author_id
=
self
.
asset_data
[
'
author
'
][
'
id
'
]
...
...
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