Extending python handlers #48601
Labels
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
4 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#48601
Loading…
Reference in New Issue
No description provided.
Delete Branch "%!s(<nil>)"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
A large part of Blender logic is implemented through operators' calls. And sometime it is necessary to handle such events.
For Blend4Web this feature is important more for user usability now. For example adding new custom node tree for Logic Editor in Blend4Web needs some handle (set this tree as default). And we also have some custom properties that could be set automatically after some event.
I've made an attempt to solve this issue here D2052. Hooks are implemented for all Blender operators, and such freedom can bring bad consequences, first of all in performance.
I see the following ways for improvements:
Changed status to: 'Open'
Added subscriber: @ideasman42
@AlexanderRomanov, could you describe some use cases for this feature?
What you've described in your description is a bit vague and doesn't help so much in finding a general solution.
For example - if you need to set a tree as default after adding, could this be added as an option into Blender? (or is this a setting you maintain).
Regarding having callbacks on each operator (as with the patch, but filter by operator identifier).
If we add this kind of feature, its going to be used (and abused) for all sorts of cases.
So I like to see 4-6 examples where this feature is a good solution to some problem, not just some hack which allows to insert Python-calls into any tools to solve some corner cases.
Actually I think that this is a general solution. Because you can handle any event.
For custom node trees, actually it is preferred to have generalized UI for linking it to any datablock (Linking Custom Node Tree to DataBlock ).
Partially this issue could be solved with D113, and I'm working on this patch now.
We can agree on a set of useful operators and hardcode them. But this will be a strict limit on generalization
My point:
"Make another handler system for operators only (where callbacks are stored in the list inside the concrete operator type)"
So callbacks will be invoked only for specific operators. This is better for performance.
I find it difficult to show so many examples. And yes, all this cases are corner cases.
Added subscriber: @brecht
I don't have clear ideas on how to solve this, but since this came up in D2137 I'll give my opinion. I'm not sure if it will help you right now since it's a complicated topic..
There two systems for detecting changes in Blender:
In general, it's difficult to exactly describe a change. You might want to find out when a datablock is added. But should that be triggered on copying, on replacement, on appending, on joining, ..? It depends what you need to do exactly.
When the addon should act is also tricky. Right after the datablock is added or before it is deleted while the operator is still running seems very fragile and potentially a big performance problem. After the operators has finished running seems like the more reliable, but at that point it is difficult to precisely describe how the datablock was modified, or it might have already been deleted, copied, etc.
This is very rough, but imagine we remove the notifier system.
DAG_id_tag_update
could get extra flags:Datablock "UI state" changed (selection/hiding/mode). Datablock was newly added.
** Maybe a few more, but keep it as limited as possible.
Added subscriber: @ckohl_art