0

I'm looking for the most widely applicable a way to convert materials into executable python code, with code. This method should be able to accomodate node groups, and multiple nodes with identically named inputs and outputs.

I am aware of solutions such as the ones proposed here: What's the most reliable way of converting a material into reusable code blocks?

However, such solutions do not have the versatility that I require. For example, BatFinger's solution (though great otherwise,) does not work with nodes that have identically named inputs, and disables certain nodes.

Similarly, Gorgious' solution, though not suffering from the problems that BatFinger's solution has, does not encode node groups, but rather calls node groups.

Apologies if my question seems brash, it was not my intention.

To test your script, please download the below file and try to convert it into python code. Then take the script and use it in another file.

Thanks for your time!

Exporer
  • 13
  • 3
  • 4
    This question would be better as comments to the mentioned question. Perhaps batFINGER and Gorgious will care to improve their answers. You may even suggest edits to these answers with info on limitations of each and put the .blend file links with your tests in an edit to the question... – Markus von Broady Jul 11 '21 at 12:50
  • 2
    Ironically (to me at least) was my intention to make an edit to aforementioned question after adding this answer to revert to method in original re naming links by index in case of sockets having same name. – batFINGER Jul 11 '21 at 15:03
  • @batFINGER Nice! I'll be looking forward to see what you can do with that!

    Note: I also found that the code put the input of math nodes (or at least a lot of them) as .enabled = False

    – Exporer Jul 12 '21 at 07:26
  • @batFINGER Are you still working on fixing the original code? Sorry for disturbing you, but it's been a month since you stated your intention to fix it and you haven't done it. Thanks! – Exporer Aug 23 '21 at 12:24
  • When I noticed your suggested edit on other I imagined you had made some fixes, but alas instead the edit was to replace the code with your warning of the issues stated above. Another case of PBS @Gorgeous – batFINGER Aug 23 '21 at 13:13
  • No worries then. Before and after I made this post, I had been trying to amend some of the issues that I outlined. I spent a few weeks on and off trying. That allowed me to solve a few smaller issues that I found but didn't mention, so after having no success with the larger issues, I made this post. It was suggested to me by Markus von Broady in the above comment to make edits outlining the issues that I found instead of putting them in a post detached from the answers. So I did. I'm sorry for continually disturbing you. I'll keep trying to fix the issues in the code and won't disturb you. – Exporer Aug 23 '21 at 23:40

0 Answers0