I’ve been hacking away at a custom node editor, based on the custom nodes template in blender, and i’m having some minor questions.
- How to deal with versioning?
It’s great for a prototype sofar, however, however there are times where i expand an existing node (one of my nodes, not an existing blender one), and add an output socket or rename it with a better name. Now for any new instances i add to the graph it’ll get all the latest outputs and names, however any nodes already existing in a .blend will not be updated. I’m perfectly happy, deleting the node and re-creating it, however for any end users this is hardly a great UI experience. How do i go about updating those automatically?
- Previews on the node
I tried to use layout.template_preview
but couldn’t get it to work, when i did get it to show all nodes were displaying the same image or flickering like it was having a seizure or something. I’m pretty sure i’m doing something wrong, but an example or some insight here would be appreciated.
- Node wranger.
I’m so used to ctrl-shift clicking to get a preview of a node in the shader editor, nodewrangler naturally doesn’t know about my tree or know how to make a preview are there any hooks i can hook into or am i just doomed having to duplicate that functionality completely?
- Color ramp, and curves UI.
I can’t seem to easily re-use the color ramp and curves UI, I can by making a dummy shader graph, instance a shader node that has the UI in it and then draw it in the drawbuttons of my UI but that seems like a rather terrible hack.
- Background image for the node tree?
It be nice to preview things right in the editor, but I’m unsure how, NodeTree doesn’t seem to have a background image prop nor any callbacks for drawing things?
- Socket settings.
I’m using all custom socket types, and it can’t seem to change things like ‘step’
import bpy
from bpy.types import NodeTree, Node, NodeSocket
class Float1Socket(NodeSocket):
'''float1 socket type'''
bl_idname = 'Float1SocketType'
bl_label = "float1 Node Socket"
def prop_update(self, context):
self.id_data.update()
value: bpy.props.FloatProperty(default = 0.0, description="", update=prop_update)
def draw(self, context, layout, node, text):
if self.is_output or self.is_linked:
layout.label(text=text)
else:
layout.prop(self, "value", text=text)
def draw_color(self, context, node):
return (0.8, 0.8, 0.8, 1.0)
later on using it
self.inputs.new('Float1SocketType', "Sides")
self.inputs["Sides"].step = 100
The UI seems to completely ignore this and give me a step of 3
paging @jacqueslucke / @Secrop