0
$\begingroup$

I have data stored in local file and want to sync them to my custom collection property once the blender was started. But my collection is registed to the Scene, it seems like only the parameter context in operator can access and change my collection, and this requires user's clicking to invoking the operator.

What I have tried:

  • Access my collection via the context in Panel's draw(self, context), got:
AttributeError: Writing to ID classes in this context is not allowed: Scene, Scene datablock, error setting HotNodeProps.<UNKNOWN>
  • Invoke my sync operator in the register(), got:
'_RestrictContext' object has no attribute 'view_layer'

Really don't have a way or a hack to do this?

$\endgroup$
2
  • 1
    $\begingroup$ Hello. maybe delay the execution a little bit after register with an application timer docs.blender.org/api/current/bpy.app.timers.html so the context can be initialized $\endgroup$
    – Gorgious
    Commented Jul 31 at 7:57
  • $\begingroup$ Works! I think you can leave this as an answer so i can click "accept" for you :) $\endgroup$
    – Trantor
    Commented Aug 1 at 13:43

0

You must log in to answer this question.

Browse other questions tagged .