← All ideas
  • Published 1 Jul 2020

Copy Nodes to System Clipboard (as text/JSON)

For users to share nodes in chat and possibly pastebins, it would be great to copy to the System clipboard in a text format, and to Paste from System Clipboard (JSON). JSON is not itself necessary, of course, if there's a more-preferred format.

The keys would be: 1. Converting node data to a sensical format, and back. and 2. Handling incompatibilities or corrupt text upon paste.

For 2. We could put the blender version in the text, but it's not necessary. "Some node data did not match your Blender capabilities. Check the console for details."

In console you might see, "Text Node (Blahblah) output "Imag" not found in Blender's Node (Gamma)".

93.9%

Development Status: Open

Upvote 31 Downvote 2
jaggz.h
1 Jul 2020

15 Comments

aikenchau

This would be very useful for my current film project and would be a helpful pipeline tool as we are trying to find an alternative way to replace characters and shaders across 50+ scenes.

2
bedroomnight

Go and do it, it's not that hard.I'll do it because it should be interesting to copy this faster.

intracube

This would definitely be useful. For an example of this feature, have a look at BlackMagic Fusion.

1
jtxt

* @intracube * Sure. Mind linking to what you are talking about as an example? I did not find it though searching yet

sharaths21312

* @jtxt * Blackmagic fusion is just a part of Davinci Resolve .

jtxt

* @sharaths21312 * Ok, how are they a good example of OP's suggestion? Mind linking to a page/video that shows the feature in action? or even just an anecdotal evidence/personal account of how it works.

intracube

* @jtxt * In Fusion you can select some/all of a node tree, copy with ctrl+c and then paste in a different Fusion window. It's stored in human readable format so it can be easily shared with others. Here's a sample of three connected nodes (exr loader-->colour correction node-->exr saver):

drive.google.com/file/d/1wiS5pymx4kOEJym9JaPYTFEUFculQNRF/view

Fusion can be run as a standalone program or from within BlackMagic Resolve

Nuke can also do the same thing although the free version does so in an encrypted/scrambled format.

2
havocthehobbit

was just searching google to see if something like this existed , and option to export nodes for material, geo nodes, post proc nodes etc , would be incredibly useful as a priority to export and then potentially as a lower priority to import. Main reason is so that 3rd party app and plugin developers can import nodes and update their own material , color grading and lighting systems extremely easy after creating them in blender . For example I can create a godot/unreal plugin that adjusts the scene lighting and background to match with the scene I created in blender without having to manually tweek brightness background color settings in Godot or unreal . Or if I want to bring data from the 3rd party app into blender ,I can write code in the 3rd party app to convert its material system into blender nodes , or create a cluster movement system that can be converted into geo nodes and imported into blender , then exported to json file after editing , so that I can reimport it into the 3rd party engine with code I created applying the geonode changes to the engines shaders and movement systems .

phil123456789

while your at it, add an option to export nodes to unreal shader format !!

sandyvujakovicjoutlookcom

This would be such a game-changer!

wxz18883234348

I vote!

jtxt

Interesting. It may be useful and not hard to make.

This might be the ingredients for it: blenderartists.org/t/copy-all-nodes-from-one-material-to-another/1212351/2 docs.python.org/3/library/json.html get the materials node data and json it, and the reverse. Probably would be more work to make it work with the clipboard properly, but as a plugin with convert to and from json buttons, it might be very easy to make, test out this idea.

jtxt

* @jtxt * * @intracube *

I started to try to inspect material node objects.

import bpy
from pprint import pprint
context = bpy.context

source_mat = bpy.data.materials['Material'].node_tree

# source_mat bpy.data.materials['Material'].node_tree.nodes
# this is closer but gives an error. I don't know the correct way to view this yet, but I am able to see it in the Outliner panel -> "data api" browser.

print("-------------------------------------")
def dump(obj):
  for attr in dir(obj):
    print("obj.%s = %r" % (attr, getattr(obj, attr)))

dump(source_mat)

#pprint(source_mat)
#print(source_mat)

I did not get far. Perhaps next just try to just feed it into the json library? Perhaps there's nested and linked objects that might be difficult to resolve? There's bpy.ops.node.clipboard_copy() and bpy.ops.node.clipboard_paste() that handles copping and pasting nodes from the current selection. They seem like a black box. I don't know if the api can cleanly read and recreate node trees directly yet. I imagine there's a way... Hopefully it's actually super simple.

johan1

I have made it! Not tested extensively, but for the materials that I have it seems to work fine.

It copies active material of selected object to the clipboard as JSON. Then you can paste onto other objects.

I literally finished it just now, so would be excited to hear from you all. And I would LOVE to see everyone starting some serious material sharing! Web sites should be made! Yeah!

Get it here: github.com/Gatada/JB-MaterialSharing