Skip to content
Merged

v2.0 #39

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
68 commits
Select commit Hold shift + click to select a range
ab69444
feat: initial material->python setup
BrendanParmer Dec 24, 2022
81fb043
Added quick dropdown menu
carls3d Jan 2, 2023
0afc4e2
Merge pull request #26 from carls3d/main
BrendanParmer Jan 3, 2023
da4ea05
style: ui code style updates
BrendanParmer Jan 3, 2023
c9fa496
Merge branch 'v2.0' into material_update
BrendanParmer Jan 9, 2023
ec92a1b
feat: material update addon fluff
BrendanParmer Jan 9, 2023
b8628bb
fix: issue with periods in node group names
BrendanParmer Jan 9, 2023
5d40641
feat: basic material recreation
BrendanParmer Jan 9, 2023
fb635be
refactor: geo_nodes logic now handled in separate file
BrendanParmer Jan 10, 2023
d7d2edf
refactor: added utils module for common functionality
BrendanParmer Jan 10, 2023
1c6bead
style: removed unused logic that was commented out
BrendanParmer Jan 10, 2023
f610177
docs: update README
BrendanParmer Jan 10, 2023
5c7be17
fix: properly imports utils file
BrendanParmer Jan 10, 2023
2ca7a7e
fix: materials properly imports utils
BrendanParmer Jan 10, 2023
ddda89c
feat: addon now creates material as well as shader node group
BrendanParmer Jan 10, 2023
a29af8f
fix: issue where deleted node groups would still be referenced
BrendanParmer Jan 10, 2023
bd1bfb9
Merge pull request #29 from BrendanParmer/material_update
BrendanParmer Jan 10, 2023
f91ef2c
feat: geo node input/output update
BrendanParmer Jan 13, 2023
5ae1843
style: deleted unused sets
BrendanParmer Jan 13, 2023
b5149b3
refactor: create_header moved to utils
BrendanParmer Jan 13, 2023
c1964e8
refactor: init_operator, make_indents, and create_node moved to utils
BrendanParmer Jan 13, 2023
f2d12cd
feat: more comprehensive string cleaning function
BrendanParmer Jan 13, 2023
5ce0cb4
refactor: moved set_settings_defaults to utils
BrendanParmer Jan 13, 2023
bb537e7
refactor: moved special color ramp and curve node logic to utils)
BrendanParmer Jan 13, 2023
c4339b0
style: cleaned up curve node code
BrendanParmer Jan 13, 2023
cfbe293
refactor: a few conversion functions for different types of objects
BrendanParmer Jan 13, 2023
ef2b7fb
refactor: input defaults moved to utils
BrendanParmer Jan 13, 2023
be850ae
refactor: links initialization moved to utils
BrendanParmer Jan 13, 2023
3a6a6c9
refactor: moved menu, register, unregister, and main func creation in…
BrendanParmer Jan 13, 2023
d2f4272
fix: a few import errors and other bugs
BrendanParmer Jan 13, 2023
baf01be
Merge pull request #32 from BrendanParmer/utils_refactor
BrendanParmer Jan 13, 2023
e75c383
misc: removed pycache folder
BrendanParmer Jan 13, 2023
1c74bd9
fix: temporarily removed frame nodes
BrendanParmer Jan 13, 2023
60908bd
fix: node spacing and frames are now functional
BrendanParmer Jan 14, 2023
2a986f7
docs: updated README to reflect support for frame nodes
BrendanParmer Jan 14, 2023
9d14730
feat: node colors now replicated
BrendanParmer Jan 14, 2023
a8ff077
feat: nodes can now be muted
BrendanParmer Jan 14, 2023
1dda44e
feat: image saving and zipping
BrendanParmer Jan 17, 2023
f6632b2
fix: zip files now contain folder as their top level
BrendanParmer Jan 17, 2023
f804010
fix: image filenames extensions no longer doubled
BrendanParmer Jan 17, 2023
13e391c
fix: issue with base material node tree automatically adding two nodes
BrendanParmer Jan 17, 2023
a9fea3e
fix: material add-on names now use the name of the material instead o…
BrendanParmer Jan 17, 2023
b35866c
fix: issue with non-existent images
BrendanParmer Jan 17, 2023
a960ae0
docs: update README
BrendanParmer Jan 18, 2023
b6f5ba8
feat: copy image source, colorspace, and alpha mode
BrendanParmer Jan 20, 2023
90870cf
feat: image user copying
BrendanParmer Jan 20, 2023
dcc5f5c
feat: added environment texture and restricted image copying to singl…
BrendanParmer Jan 20, 2023
1e54f0c
fix: material class name no longer derives from node tree name
BrendanParmer Jan 20, 2023
ae6e36b
feat: zips addon again
BrendanParmer Jan 20, 2023
aa49d63
Merge pull request #35 from BrendanParmer/copy_image
BrendanParmer Jan 20, 2023
89ee0bb
feat: set defaults for some attributes if they exist in a blend file
BrendanParmer Jan 21, 2023
5807de0
feat: set defaults for textures if they exist in a blend file
BrendanParmer Jan 21, 2023
3c96b43
refactor: dont_set_defaults set moved to utils.py
BrendanParmer Jan 21, 2023
e414cf8
Merge pull request #38 from BrendanParmer/copy_image
BrendanParmer Jan 21, 2023
6376db8
fix: issue with no default value set
BrendanParmer Jan 22, 2023
648e892
feat: geo nodes node automatically apply to the object
BrendanParmer Jan 22, 2023
b8ced76
feat: settings for input geo nodes
BrendanParmer Jan 22, 2023
e748ffa
feat: basic function for nodes that need outputs set
BrendanParmer Jan 22, 2023
cda8090
fix: issue with color defaults
BrendanParmer Jan 22, 2023
3fa45d2
fix: variable names now checked for uniqueness
BrendanParmer Jan 22, 2023
477605f
docs: updated README to include current status on asset copying
BrendanParmer Jan 22, 2023
a134c84
fix: geo nodes and materials are now stable
BrendanParmer Jan 22, 2023
7fd3b0e
docs: image showing new location
BrendanParmer Jan 22, 2023
1fb9651
fix: zips addons again
BrendanParmer Jan 22, 2023
28ab84f
docs: clarification on where to find add-on
BrendanParmer Jan 22, 2023
4612d11
docs: images now responsive
BrendanParmer Jan 22, 2023
4caa9e1
docs: misc README updates
BrendanParmer Jan 22, 2023
d0cff4f
Merge branch 'main' into v2.0
BrendanParmer Jan 22, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 0 additions & 56 deletions README.md

This file was deleted.

49 changes: 49 additions & 0 deletions __init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
bl_info = {
"name": "Node to Python",
"description": "Convert Blender node groups to a Python add-on!",
"author": "Brendan Parmer",
"version": (2, 0, 0),
"blender": (3, 0, 0),
"location": "Node",
"category": "Node",
}

if "bpy" in locals():
import importlib
importlib.reload(materials)
importlib.reload(geo_nodes)
else:
from . import materials
from . import geo_nodes

import bpy

class NodeToPythonMenu(bpy.types.Menu):
bl_idname = "NODE_MT_node_to_python"
bl_label = "Node To Python"

@classmethod
def poll(cls, context):
return True

def draw(self, context):
layout = self.layout.column_flow(columns=1)
layout.operator_context = 'INVOKE_DEFAULT'

classes = [NodeToPythonMenu,
geo_nodes.GeoNodesToPython,
geo_nodes.SelectGeoNodesMenu,
geo_nodes.GeoNodesToPythonPanel,
materials.MaterialToPython,
materials.SelectMaterialMenu,
materials.MaterialToPythonPanel]

def register():
for cls in classes:
bpy.utils.register_class(cls)
def unregister():
for cls in classes:
bpy.utils.unregister_class(cls)

if __name__ == "__main__":
register()
68 changes: 68 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# Node to Python

![Node To Python Logo](./img/ntp.jpg "Node To Python Logo")

[![GitHub release (latest by date)](https://img.shields.io/github/v/release/BrendanParmer/NodeToPython)](https://github.com/BrendanParmer/NodeToPython/releases) [![GitHub](https://img.shields.io/github/license/BrendanParmer/NodeToPython)](https://github.com/BrendanParmer/NodeToPython/blob/main/LICENSE) ![](https://visitor-badge.laobi.icu/badge?page_id=BrendanParmer.NodeToPython)

## About
A Blender add-on to create add-ons! This add-on will take your Geometry Nodes or Materials and convert them into legible Python add-ons!

It automatically handles node layout, default values, subgroups, naming, colors, and more!

I think Blender's node-based editors are powerful, yet accessible tools, and I wanted to make scripting them easier for add-on creators. Combining Python with node based setups allows you to do things that would otherwise be tedious or impossible, such as
* `for` loops
* creating different node trees for different versions or settings
* interfacing with other parts of the software or properties of an object

NodeToPython recreates the node networks for you, so you can focus on the good stuff.

## Supported Versions
NodeToPython v2.0 is compatible with Blender 3.0 - 3.4 on Windows, macOS, and Linux. I generally try to update the addon to handle new nodes around the beta release of each update.

## Installation
1. Download the .zip file from the [latest release](https://github.com/BrendanParmer/NodeToPython/releases)
2. In Blender, navigate to `Edit > Preferences > Add-ons`
3. Click Install, and find where you downloaded the zip file. Then hit the `Install Add-on` button, and you're done!

## Usage
Once you've installed the add-on, you'll see a new tab in any Node Editor's sidebar. You can open this with keyboard shortcut `N` when focused in the Node Editor.

In the tab, there's panels to create add-ons for Geometry Nodes and Materials, each with a drop-down menu.

![Add-on Location](./img/location.png "Add-on Location")

Just select the one you want, and soon a zip file will be created in an `addons` folder located in the folder where your blend file is.

From here, you can install it like a regular add-on.

## Future
* Expansion to Compositing nodes
* Add all referenced assets to the Asset Library for use outside of the original blend file
* Auto-set handle movies and image sequences
* Automatically format code to be PEP8 compliant
* Automatically detect the minimum version of Blender needed to run the add-on

## Potential Issues
* As of version 2.0.0, the add-on will not set default values for
* Scripts
* IES files
* Filepaths
* UV maps
* Currently when setting default values for the following, the add-on must be run in the same blend file as the node group was created in to set the default, otherwise it will just set it to `None`:
* Materials
* Objects
* Collections
* Textures

* In a future version, I plan on having the add-on adding all of the above to the Asset Library for reference

## Bug Reports and Suggestions

When submitting an issue, please include

* Your version of Blender
* Your operating system
* A short description of what you were trying to accomplish, or steps to reproduce the issue.
* Sample blend files are more than welcome!

Suggestions for how to improve the add-on are more than welcome!
Binary file added docs/img/location.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
Loading