14
$\begingroup$

After playing with nodes it is sometimes easier to start from scratch...

Is there a shortcut to return the values of a node to their default values?

EDIT

Right clicking and choosing Reset Values works in some cases, but not in all nodes. For example in the mapping node it resets values to 0 and 1 for scale (indeed the default values). But on a noise texture node the default values are not 0 but Scale=5 and detail=2, if you use reset value both of them get zeroed out... It would be great to be able to reset curves, gradients and color correction nodes...

The only solution I've found is creating a new node and plugging it back in place of the old...

enter image description here

enter image description here

$\endgroup$
  • 2
    $\begingroup$ I don't think they are actually kept (at least not properly). You can right click on a value and choose Reset to Default Value but for almost every property this just sets to 0.0 it is hardly ever a value that is set when an item is first created. $\endgroup$ – sambler Nov 30 '15 at 8:37
  • 1
    $\begingroup$ sambler is right. The default values are not implemented properly for nodes, probably nobody bothered with this. There is no solution as far as I know.. $\endgroup$ – Jaroslav Jerryno Novotny Nov 30 '15 at 9:20
19
+300
$\begingroup$

UPDATE

Good news! "node reset" functionality is now part of node wrangler and will "land" after the release of 2.78, means hopefully in 2.78a: https://developer.blender.org/D2129 If you are interested, download a preview here:

Even it's now possible resetting multiple nodes. You can simply select the nodes you like to reset and hit backspace, which makes sense (thanks to Greg Zaal) since this is also the shortcut to reset a single node parameter.

Original text:

I almost hesitate to suggest this as an answer, as it seems like there should be a built-in way to do this for the standard Node Trees. But in the interest of experimentation here's an operator that resets the node by:

  1. copying location / size / name / bl_idname of the active node
  2. copying the links
  3. deleting the original node
  4. replacing it with a fresh one of the same type
  5. reconnecting all links

code (rather inelegant, but seems to work for Node Groups too):

def store_replace(node):
    node_tree = node.id_data
    props_to_copy = 'bl_idname name location height width'.split(' ')

    reconnections = []
    mappings = itertools.chain.from_iterable([node.inputs, node.outputs])
    for i in (i for i in mappings if i.is_linked):
        for L in i.links:
            reconnections.append([L.from_socket.path_from_id(), L.to_socket.path_from_id()])

    props = {j: getattr(node, j) for j in props_to_copy}

    new_node = node_tree.nodes.new(props['bl_idname'])
    props_to_copy.pop(0)

    for prop in props_to_copy:
        setattr(new_node, prop, props[prop])

    nodes = node_tree.nodes
    nodes.remove(node)
    new_node.name = props['name']

    for str_from, str_to in reconnections:
        node_tree.links.new(eval(str_from), eval(str_to))

Add-on

https://gist.github.com/zeffii/010a108a612fd6071a4b

via search menu (Spacebar)

enter image description here

via node properties (N)

enter image description here

$\endgroup$
  • 2
    $\begingroup$ @poor and Zeffii, Thanks! It works nicely. You should submit it to add in trunk! $\endgroup$ – cegaton Nov 30 '15 at 20:14
  • 1
    $\begingroup$ @cegaton Might be also interesting for Color Balance :) $\endgroup$ – p2or Nov 30 '15 at 20:31
  • 1
    $\begingroup$ poor, feel free to submit :) (and no, i don't get automatic notification on gist comments.. i must have switched that off at some point) $\endgroup$ – zeffii Apr 23 '16 at 9:30
  • $\begingroup$ @cegaton is this backspace key really working in blender 2.78 ? $\endgroup$ – Old Man Nov 16 '16 at 16:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.