Page MenuHome

blenderbug.py

# Run script, go to scene properties tab and scroll. Then comment out L19 and try again, lag disappears.
import bpy
import time
class FOO_BAR(bpy.types.Panel):
bl_label = "Foobar"
bl_idname = "FOO_BAR"
bl_space_type = "PROPERTIES"
bl_region_type = "WINDOW"
bl_context = "scene"
def draw(self, context):
self.layout.template_list("FOO_BAZ", "", context.scene.foo, "bar", context.scene.foo, "bar_index")
for p in context.scene.foo.baz:
row = self.layout.row(align=True)
row.prop(p, "name")
# If you comment out the next line, the lag goes away
row.prop(p, "baze")
class FOO_BAZ(bpy.types.UIList):
def draw_item(self, context, layout, data, item, icon, active_data, active_propname):
if item:
row = layout.row(align=True)
row.prop(item, "bar", text="", emboss=False)
class Bar(bpy.types.PropertyGroup):
bar: bpy.props.StringProperty()
class Baz(bpy.types.PropertyGroup):
def baz_call(self, context):
return
name: bpy.props.StringProperty(update=baz_call)
baze: bpy.props.BoolProperty(default=True)
class Foo(bpy.types.PropertyGroup):
def foo_call(self, context):
return
bar: bpy.props.CollectionProperty(type=Bar)
bar_index: bpy.props.IntProperty()
baz: bpy.props.CollectionProperty(type=Baz)
def register():
bpy.utils.register_class(Bar)
bpy.utils.register_class(Baz)
bpy.utils.register_class(Foo)
bpy.utils.register_class(FOO_BAR)
bpy.utils.register_class(FOO_BAZ)
bpy.types.Scene.foo = bpy.props.PointerProperty(type=Foo)
start = time.time()
for i in range(1, 4000):
new = bpy.context.scene.foo.bar.add()
new.bar = 'blah'
for i in range(1, 15):
new = bpy.context.scene.foo.baz.add()
new.name = 'asdf'
print(time.time()-start)
if __name__=="__main__": register()

File Metadata

Mime Type
text/x-python
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
bc/a3/7b79f1cfa40579c30f62f453316d

Event Timeline