Is there any way to change the nodes' default width?

I usually work with rather lengthly texture filenames, so I’m constantly finding myself widening the image texture nodes to have them show those filenames in full.

Is there any way to set their (or all the node types’) default size to something bigger than the usual? I can’t seem to find anything I could tweak in Blender’s preferences.

If you just want bigger ImageTexture nodes, then the best is to add that setting in to the add_node operation…

Edit the file /bl_path/2.8x/startup/nodeitems_buildins.py, and in the line 229, where there’s:


    NodeItem("ShaderNodeTexImage"),

change it to:


    NodeItem("ShaderNodeTexImage", settings={"width":"500"}),

ps. you might want to do the same for CompositorNodeImage and TextureNodeImage, if you need it.

1 Like

Thanks, worked like a charm :slight_smile:

Hello,
The similar question: is there a way to decrease default width for the most nodes?

Due to the changes of Blender there is no line 229 with the text “NodeItem(“ShaderNodeTexImage”)” in the file: “nodeitems_builTins.py” now.

In Blender 4.x, you need to look into the node_add_menu_*.py files, inside the scripts/startup/bl_ui folder.
To change default settings is now similar to adding settings to other UILayout operator calls:

Before:

node_add_menu.add_node_type(layout, "SomeNodeIdentifier")

After:

props = node_add_menu.add_node_type(layout, "SomeNodeIdentifier")
ops = props.settings.add()
ops.name = "width"
ops.value = "350"

Thank you for the reply Secrop.

Though I’m not sure I understand you correctly (I’m not a coder, sorry :slight_smile: ) - do you propose to change width for every node in the file the way as it’s shown in your example above?
But there are a lot of nodes:

Isn’t there default width value for all the nodes somewhere ?

Changing one or two nodes can be done as I posted above.
You may also modify the NodeAddOperator in scripts/startup/bl_operators/node.py if you want (or the add_node_type in node_add_menu.py), but I don’t recomend it. (it will overwrite any changes in the Add_Menu definitions)

:confused: Well, that may be a problem, because if you want to change the overall default values in Blender (>=4.x), the best option is for you to grab the source code, change the node_type_size_preset in node.cc (ln:4431):

void node_type_size_preset(bNodeType *ntype, const eNodeSizePreset size)
{
  switch (size) {
    case eNodeSizePreset::DEFAULT:
      node_type_size(ntype, 140, 100, NODE_DEFAULT_MAX_WIDTH);
      break;
    case eNodeSizePreset::SMALL:
      node_type_size(ntype, 100, 80, NODE_DEFAULT_MAX_WIDTH);
      break;
    case eNodeSizePreset::MIDDLE:
      node_type_size(ntype, 150, 120, NODE_DEFAULT_MAX_WIDTH);
      break;
    case eNodeSizePreset::LARGE:
      node_type_size(ntype, 240, 140, NODE_DEFAULT_MAX_WIDTH);
      break;
  }
}

And compile it yourself.

1 Like