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
7d92fb16
Commit
7d92fb16
authored
6 years ago
by
Vilem Duha
Browse files
Options
Downloads
Patches
Plain Diff
BlenderKit: API hotfixes - to_mesh() and Image colourspace settings.
parent
b0027289
No related branches found
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
blenderkit/asset_inspector.py
+3
-3
3 additions, 3 deletions
blenderkit/asset_inspector.py
blenderkit/search.py
+4
-5
4 additions, 5 deletions
blenderkit/search.py
blenderkit/ui.py
+1
-1
1 addition, 1 deletion
blenderkit/ui.py
blenderkit/utils.py
+11
-7
11 additions, 7 deletions
blenderkit/utils.py
with
19 additions
and
16 deletions
blenderkit/asset_inspector.py
+
3
−
3
View file @
7d92fb16
...
...
@@ -206,9 +206,9 @@ def check_meshprops(props, obs):
if
ob
.
type
==
'
MESH
'
or
ob
.
type
==
'
CURVE
'
:
ob_eval
=
None
if
ob
.
type
==
'
CURVE
'
:
depsgraph
=
bpy
.
context
.
evaluated_depsgraph_get
()
ob
_eval
=
ob
.
evaluated_get
(
depsgraph
)
mesh
=
ob
_eval
.
to_mesh
()
#
depsgraph = bpy.context.evaluated_depsgraph_get()
# object
_eval = ob.evaluated_get(depsgraph)
mesh
=
ob
.
to_mesh
()
else
:
mesh
=
ob
.
data
fco
=
len
(
mesh
.
polygons
)
...
...
This diff is collapsed.
Click to expand it.
blenderkit/search.py
+
4
−
5
View file @
7d92fb16
...
...
@@ -292,7 +292,7 @@ def load_previews():
img
.
unpack
(
method
=
'
USE_ORIGINAL
'
)
img
.
filepath
=
tpath
img
.
reload
()
img
.
colorspace_settings
.
name
=
'
Linear
'
i
+=
1
# print('previews loaded')
...
...
@@ -571,7 +571,7 @@ def write_profile(adata):
utils
.
p
(
'
writing profile
'
)
user
=
adata
[
'
user
'
]
# we have to convert to MB here, numbers too big for python int type
if
user
.
get
(
'
sumAssetFileSize
'
)
is
not
None
:
if
user
.
get
(
'
sumAssetFile
s
Size
'
)
is
not
None
:
user
[
'
sumAssetFilesSize
'
]
/=
(
1024
*
1024
)
user
[
'
sumPrivateAssetFilesSize
'
]
/=
(
1024
*
1024
)
user
[
'
remainingPrivateQuota
'
]
/=
(
1024
*
1024
)
...
...
@@ -604,9 +604,8 @@ def fetch_profile(api_key):
def
get_profile
():
preferences
=
bpy
.
context
.
preferences
.
addons
[
'
blenderkit
'
].
preferences
a
=
bpy
.
context
.
window_manager
.
get
(
'
bkit profile
'
)
if
a
is
None
:
thread
=
threading
.
Thread
(
target
=
fetch_profile
,
args
=
(
preferences
.
api_key
,),
daemon
=
True
)
thread
.
start
()
thread
=
threading
.
Thread
(
target
=
fetch_profile
,
args
=
(
preferences
.
api_key
,),
daemon
=
True
)
thread
.
start
()
return
a
...
...
This diff is collapsed.
Click to expand it.
blenderkit/ui.py
+
1
−
1
View file @
7d92fb16
...
...
@@ -724,7 +724,7 @@ def draw_callback_2d_search(self, context):
else
:
iname
=
utils
.
previmg_name
(
ui_props
.
active_index
)
img
=
bpy
.
data
.
images
.
get
(
iname
)
img
.
colorspace_settings
.
name
=
'
Linear
'
draw_tooltip
(
ui_props
.
mouse_x
,
ui_props
.
mouse_y
,
text
=
ui_props
.
tooltip
,
img
=
img
)
if
ui_props
.
dragging
and
(
...
...
This diff is collapsed.
Click to expand it.
blenderkit/utils.py
+
11
−
7
View file @
7d92fb16
...
...
@@ -230,6 +230,7 @@ def get_hidden_image(tpath, bdata_name, force_reload=False):
if
img
.
packed_file
is
not
None
:
img
.
unpack
(
method
=
'
USE_ORIGINAL
'
)
img
.
reload
()
img
.
colorspace_settings
.
name
=
'
Linear
'
return
img
...
...
@@ -239,6 +240,7 @@ def get_thumbnail(name):
img
=
bpy
.
data
.
images
.
get
(
name
)
if
img
==
None
:
img
=
bpy
.
data
.
images
.
load
(
p
)
img
.
colorspace_settings
.
name
=
'
Linear
'
img
.
name
=
name
img
.
name
=
name
...
...
@@ -297,13 +299,14 @@ def get_bounds_snappable(obs, use_modifiers=False):
# If to_mesh() works we can use it on curves and any other ob type almost.
# disabled to_mesh for 2.8 by now, not wanting to use dependency graph yet.
depsgraph
=
bpy
.
context
.
evaluated_depsgraph_get
()
object_eval
=
ob
.
evaluated_get
(
depsgraph
)
mesh
=
object_eval
.
to_mesh
()
if
ob
.
type
==
'
CURVE
'
:
mesh
=
object_eval
.
to_mesh
()
else
:
mesh
=
object_eval
.
data
# if self.applyModifiers:
# evaluated_get(depsgraph).to_mesh()
# else:
# to_mesh()
# to_mesh(context.depsgraph, apply_modifiers=self.applyModifiers, calc_undeformed=False)
obcount
+=
1
for
c
in
mesh
.
vertices
:
coord
=
c
.
co
...
...
@@ -315,8 +318,9 @@ def get_bounds_snappable(obs, use_modifiers=False):
maxx
=
max
(
maxx
,
parent_coord
.
x
)
maxy
=
max
(
maxy
,
parent_coord
.
y
)
maxz
=
max
(
maxz
,
parent_coord
.
z
)
object_eval
.
to_mesh_clear
()
# bpy.data.meshes.remove(mesh)
if
ob
.
type
==
'
CURVE
'
:
object_eval
.
to_mesh_clear
()
if
obcount
==
0
:
minx
,
miny
,
minz
,
maxx
,
maxy
,
maxz
=
0
,
0
,
0
,
0
,
0
,
0
...
...
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