mirror of
https://github.com/blender/blender
synced 2026-09-29 04:37:17 +03:00
PyAPI: minor optimization using iterators for contains checks
Avoid building a list to perform a __contains__ check. Ref !138346
This commit is contained in:
parent
ae2c601a0c
commit
24dc0482ac
1 changed files with 4 additions and 4 deletions
|
|
@ -142,9 +142,9 @@ class Texture(_types.ID):
|
|||
"""Materials that use this texture"""
|
||||
import bpy
|
||||
return tuple(mat for mat in bpy.data.materials
|
||||
if self in [slot.texture
|
||||
if self in (slot.texture
|
||||
for slot in mat.texture_slots
|
||||
if slot]
|
||||
if slot)
|
||||
)
|
||||
|
||||
@property
|
||||
|
|
@ -153,10 +153,10 @@ class Texture(_types.ID):
|
|||
import bpy
|
||||
return tuple(
|
||||
obj for obj in bpy.data.objects if
|
||||
self in [
|
||||
self in (
|
||||
mod.texture
|
||||
for mod in obj.modifiers
|
||||
if mod.type == 'DISPLACE']
|
||||
if mod.type == 'DISPLACE')
|
||||
)
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue