Skip to content

Commit 4dd03ff

Browse files
Merge pull request #39 from BrendanParmer/v2.0
v2.0
2 parents 4769eef + d0cff4f commit 4dd03ff

File tree

9 files changed

+1501
-587
lines changed

9 files changed

+1501
-587
lines changed

README.md

Lines changed: 0 additions & 56 deletions
This file was deleted.

__init__.py

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
bl_info = {
2+
"name": "Node to Python",
3+
"description": "Convert Blender node groups to a Python add-on!",
4+
"author": "Brendan Parmer",
5+
"version": (2, 0, 0),
6+
"blender": (3, 0, 0),
7+
"location": "Node",
8+
"category": "Node",
9+
}
10+
11+
if "bpy" in locals():
12+
import importlib
13+
importlib.reload(materials)
14+
importlib.reload(geo_nodes)
15+
else:
16+
from . import materials
17+
from . import geo_nodes
18+
19+
import bpy
20+
21+
class NodeToPythonMenu(bpy.types.Menu):
22+
bl_idname = "NODE_MT_node_to_python"
23+
bl_label = "Node To Python"
24+
25+
@classmethod
26+
def poll(cls, context):
27+
return True
28+
29+
def draw(self, context):
30+
layout = self.layout.column_flow(columns=1)
31+
layout.operator_context = 'INVOKE_DEFAULT'
32+
33+
classes = [NodeToPythonMenu,
34+
geo_nodes.GeoNodesToPython,
35+
geo_nodes.SelectGeoNodesMenu,
36+
geo_nodes.GeoNodesToPythonPanel,
37+
materials.MaterialToPython,
38+
materials.SelectMaterialMenu,
39+
materials.MaterialToPythonPanel]
40+
41+
def register():
42+
for cls in classes:
43+
bpy.utils.register_class(cls)
44+
def unregister():
45+
for cls in classes:
46+
bpy.utils.unregister_class(cls)
47+
48+
if __name__ == "__main__":
49+
register()

docs/README.md

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
# Node to Python
2+
3+
![Node To Python Logo](./img/ntp.jpg "Node To Python Logo")
4+
5+
[![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)
6+
7+
## About
8+
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!
9+
10+
It automatically handles node layout, default values, subgroups, naming, colors, and more!
11+
12+
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
13+
* `for` loops
14+
* creating different node trees for different versions or settings
15+
* interfacing with other parts of the software or properties of an object
16+
17+
NodeToPython recreates the node networks for you, so you can focus on the good stuff.
18+
19+
## Supported Versions
20+
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.
21+
22+
## Installation
23+
1. Download the .zip file from the [latest release](https://github.com/BrendanParmer/NodeToPython/releases)
24+
2. In Blender, navigate to `Edit > Preferences > Add-ons`
25+
3. Click Install, and find where you downloaded the zip file. Then hit the `Install Add-on` button, and you're done!
26+
27+
## Usage
28+
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.
29+
30+
In the tab, there's panels to create add-ons for Geometry Nodes and Materials, each with a drop-down menu.
31+
32+
![Add-on Location](./img/location.png "Add-on Location")
33+
34+
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.
35+
36+
From here, you can install it like a regular add-on.
37+
38+
## Future
39+
* Expansion to Compositing nodes
40+
* Add all referenced assets to the Asset Library for use outside of the original blend file
41+
* Auto-set handle movies and image sequences
42+
* Automatically format code to be PEP8 compliant
43+
* Automatically detect the minimum version of Blender needed to run the add-on
44+
45+
## Potential Issues
46+
* As of version 2.0.0, the add-on will not set default values for
47+
* Scripts
48+
* IES files
49+
* Filepaths
50+
* UV maps
51+
* 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`:
52+
* Materials
53+
* Objects
54+
* Collections
55+
* Textures
56+
57+
* In a future version, I plan on having the add-on adding all of the above to the Asset Library for reference
58+
59+
## Bug Reports and Suggestions
60+
61+
When submitting an issue, please include
62+
63+
* Your version of Blender
64+
* Your operating system
65+
* A short description of what you were trying to accomplish, or steps to reproduce the issue.
66+
* Sample blend files are more than welcome!
67+
68+
Suggestions for how to improve the add-on are more than welcome!

docs/img/location.png

46.8 KB
Loading
File renamed without changes.

0 commit comments

Comments
 (0)