sverchok
sverchok copied to clipboard
Tooltips of Add node operator in Blender 3.3
Problem statement
Blender 3.3 silently added description
class method for AddNodeOperator
- https://developer.blender.org/D14963 https://developer.blender.org/T101657
Now it overrides our approach of adding tooltips. It's a coincidence that we did not loos tooltips completely because their approach is similar, it also uses node doc strings.
Our current approach is a class factory of AddNodeOperator
subclasses for each node item in the menu.
https://github.com/nortikin/sverchok/blob/b5a8ebcf59d7fb667754523d1e28c9671884f56a/menu.py#L256-L264
With the new feature we have opportunity to simplify our solution and replace the factory wit single Add operator. The question is about backward compatibility. I see 3 ways to go:
- Add
description
method to our current approach. It's simplest solution and backward compatible but it want make our approach simpler. - Rewrite our current approach. It's more complicated, backward incompatible but it will simplify the menu code. And probably it's not a big deal to drop the feature in 3.2 3.1. 3.0 and 2.93 Blender versions.
- Add separate solution for Blender 3.3 and higer. It's most complicated but backward compatible.
By the way it seems this code does not work at all, at least commenting it does not break nothing.
https://github.com/nortikin/sverchok/blob/b5a8ebcf59d7fb667754523d1e28c9671884f56a/menu.py#L273-L282
Can we preserve backward compatibility for a while, and plan a rewrite when, for example, 3.2 goes end-of-support?
Also, I like the solution with separate Operator for each node, because with it you can easily search for nodes with standard Blender's F3 menu...
@portnov what advantage does the F3 menu have?
That everything is in one menu? You just type what you want and that's all. Also, this is the standard way of invoking commands in Blender, so you do not have to remember another shortcut.
I guess GN uses single operator for adding all nodes and it's still possible to add separate nodes. Maby the same is possible to implement in Sverchok somehow.
bpy.ops.node.add_node(type="GeometryNodeAttributeStatistic", use_transform=True)