Skip to main content

Timeline for Blender Python: Detect New Scene?

Current License: CC BY-SA 4.0

12 events
when toggle format what by license comment
Sep 7, 2019 at 16:42 comment added brockmann When it comes to addon development, I'd suggest start here: How to create a custom UI? - There you also can find a pretty sweet template to start with, easy... @Robert
Sep 7, 2019 at 16:34 comment added brockmann Many thanks helping out here @rjg! I appreciate it, really. Cheers.
Sep 6, 2019 at 23:41 comment added Robert Gützkow @Robert the @persistent is a decorator that marks callbacks which are kept even when a new project is loaded (docs.blender.org/api/current/bpy.app.handlers.html)
Sep 6, 2019 at 23:39 comment added Robert Sorry, yes, I was referring to the creation of a new file or project. Not sure why I want to keep calling it the scene. As a game asset developer, the scene is just a place to sit my models. I would never need more than one, unless it was to export a different way. I assume this is why I have a hard time separating the two concepts in my head. Thank you for the help!
Sep 6, 2019 at 23:14 comment added Robert Gützkow @Robert BTW what you're describing is the creation of a new project. Scenes are a different concept, you can have multiple scenes in a project.
Sep 6, 2019 at 23:03 comment added Robert While I have you guys cornered, can you help me understand what the @ operator is doing here (with @persistent)? Is that similar to a pre-processor operator in C? Also, I'm currently using classes = (...) register, unregister = bpy.utils.register_classes_factory(classes). Although I barely understand what is going on in it. I'm a little lost with the registering aspects of add-on dev.
Sep 6, 2019 at 22:51 comment added Robert There are states in the add-on that change based on the current scene, but they are saved into the add-on preferences (so they are global). So if the user went to file -> new, and created a new scene, I would need to reset some of these states. It's a strange situation that probably doesn't arise very often (because states related to the scene can be stored inside the scene).
Sep 6, 2019 at 22:47 vote accept Robert
Sep 6, 2019 at 21:12 comment added Robert Gützkow No problem :D You're probably right with OP's intention.
Sep 6, 2019 at 21:06 comment added brockmann Right, thanks @rjg! I think the OP wants to load a 'file' rather. We will see, I keep you posted :D Otherwise just add an answer, I would appreciate it (at least).
Sep 6, 2019 at 20:41 comment added Robert Gützkow This wouldn't be triggered when a new scene is created though. I think that would only work with the depsgraph_update_post handler and a check whether the number of scenes have changed.
Sep 6, 2019 at 20:03 history answered brockmann CC BY-SA 4.0