node_to_json 0.2.0__tar.gz → 0.2.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {node_to_json-0.2.0 → node_to_json-0.2.2}/PKG-INFO +1 -1
- {node_to_json-0.2.0 → node_to_json-0.2.2}/pyproject.toml +1 -1
- {node_to_json-0.2.0 → node_to_json-0.2.2}/pyproject.toml.orig +1 -1
- {node_to_json-0.2.0 → node_to_json-0.2.2}/src/node_to_json/__init__.py +2 -0
- {node_to_json-0.2.0 → node_to_json-0.2.2}/src/node_to_json/func_util.py +5 -5
- {node_to_json-0.2.0 → node_to_json-0.2.2}/src/node_to_json/node_getters.py +5 -2
- {node_to_json-0.2.0 → node_to_json-0.2.2}/src/node_to_json/node_setters.py +32 -0
- {node_to_json-0.2.0 → node_to_json-0.2.2}/src/node_to_json/setter_funcs.py +0 -4
- {node_to_json-0.2.0 → node_to_json-0.2.2}/README.md +0 -0
- {node_to_json-0.2.0 → node_to_json-0.2.2}/src/node_to_json/asset_funcs.py +0 -0
- {node_to_json-0.2.0 → node_to_json-0.2.2}/src/node_to_json/file_util.py +0 -0
- {node_to_json-0.2.0 → node_to_json-0.2.2}/src/node_to_json/json_io.py +0 -0
- {node_to_json-0.2.0 → node_to_json-0.2.2}/src/node_to_json/node_registry.py +0 -0
- {node_to_json-0.2.0 → node_to_json-0.2.2}/src/node_to_json/py.typed +0 -0
- {node_to_json-0.2.0 → node_to_json-0.2.2}/src/node_to_json/type_util.py +0 -0
|
@@ -99,6 +99,7 @@ from .node_setters import (
|
|
|
99
99
|
set_geometry_node_presets,
|
|
100
100
|
set_node_group_input_presets,
|
|
101
101
|
set_node_group_presets,
|
|
102
|
+
node_common_attr,
|
|
102
103
|
)
|
|
103
104
|
from .file_util import (
|
|
104
105
|
is_file_accessible,
|
|
@@ -231,6 +232,7 @@ __all__ = [
|
|
|
231
232
|
"CallBeforeFunc",
|
|
232
233
|
"benchmark",
|
|
233
234
|
"get_profile",
|
|
235
|
+
"node_common_attr",
|
|
234
236
|
]
|
|
235
237
|
|
|
236
238
|
def __dir__():
|
|
@@ -64,7 +64,7 @@ def convert_attr(val: PYObject | list[PYObject]) -> PYObject | list[PYObject]:
|
|
|
64
64
|
return [list(v) for v in val]
|
|
65
65
|
if isinstance(val, (bpy.types.Object, bpy.types.Material, bpy.types.Image, bpy.types.ImageTexture, bpy.types.Texture, bpy.types.Collection, bpy.types.Scene, bpy.types.Sound, bpy.types.MovieClip, bpy.types.AnimData, bpy.types.Action, bpy.types.Annotation, bpy.types.Mask)):
|
|
66
66
|
return None
|
|
67
|
-
if isinstance(val, (bpy.types.Node, bpy.types.GeometryNodeTree, bpy.types.ShaderNodeTree, bpy.types.CompositorNodeTree)):
|
|
67
|
+
if isinstance(val, (bpy.types.Node, bpy.types.GeometryNodeTree, bpy.types.ShaderNodeTree, bpy.types.CompositorNodeTree, bpy.types.TextureNodeTree)):
|
|
68
68
|
return val.name
|
|
69
69
|
if isinstance(val, (bpy.types.NodeTreeInterfaceItem, bpy.types.NodeTreeInterfacePanel)):
|
|
70
70
|
if hasattr(val, 'persistent_uid'):
|
|
@@ -519,7 +519,7 @@ def split_list_of_dicts(data: list[PYDict], item: str) -> defaultdict[str, list[
|
|
|
519
519
|
:type item: str
|
|
520
520
|
:return: A dict of list seperated by item retrieved data
|
|
521
521
|
:rtype: defaultdict[str, list[Any]]"""
|
|
522
|
-
split_data =
|
|
522
|
+
split_data = grouped_by_dict()
|
|
523
523
|
for element in data:
|
|
524
524
|
split_data[element[item]].append(element)
|
|
525
525
|
return split_data
|
|
@@ -533,9 +533,9 @@ def string_point_check(text: str) -> str | None:
|
|
|
533
533
|
:return: Text stripped of period unless it begins with a period.
|
|
534
534
|
:rtype: str | None"""
|
|
535
535
|
t = text.split(".")
|
|
536
|
-
if
|
|
536
|
+
if text.startswith(".") and len(t) > 1:
|
|
537
537
|
return f".{t[1]}"
|
|
538
|
-
elif len(t) > 0:
|
|
538
|
+
elif not text.startswith(".") and len(t) > 0:
|
|
539
539
|
return t[0]
|
|
540
540
|
else:
|
|
541
541
|
return
|
|
@@ -606,7 +606,7 @@ def benchmark(func: Callable[..., Any]) -> Any:
|
|
|
606
606
|
|
|
607
607
|
|
|
608
608
|
def get_profile(func: Callable[..., Any]) -> Any:
|
|
609
|
-
"""Get the profiling times for a function run.
|
|
609
|
+
"""Get the profiling times for a function run. Used for developmnent.
|
|
610
610
|
|
|
611
611
|
:param func: Function to pass decorator to.
|
|
612
612
|
:type func: Callable[..., Any]
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import bpy
|
|
2
|
+
from idprop.types import IDPropertyArray
|
|
2
3
|
from typing import Any, Generator
|
|
3
4
|
from operator import itemgetter
|
|
4
5
|
from itertools import groupby
|
|
@@ -237,12 +238,14 @@ def get_node_data(node: BNode) -> PYDict:
|
|
|
237
238
|
val = getattr(node, attr, None)
|
|
238
239
|
val_ = convert_attr(val)
|
|
239
240
|
if type(val).__name__ not in node_type_exclude and attr not in {'parent'}:
|
|
240
|
-
if
|
|
241
|
+
if isinstance(val, (bpy.types.bpy_prop_array, IDPropertyArray)):
|
|
242
|
+
return [attr, convert_attr(list(val))]
|
|
243
|
+
elif type(val).__name__ in dir(bpy.types):
|
|
241
244
|
return [attr, get_node_data(val)]
|
|
242
245
|
else:
|
|
243
246
|
return [attr, val_]
|
|
244
247
|
else:
|
|
245
|
-
if type(val).__name__ in {'Node', 'GeometryNodeTree', 'ShaderNodeTree', 'CompositorNodeTree'} or attr in {'parent'}:
|
|
248
|
+
if type(val).__name__ in {'Node', 'GeometryNodeTree', 'ShaderNodeTree', 'CompositorNodeTree', 'TextureNodeTree'} or attr in {'parent'}:
|
|
246
249
|
return [attr, val_]
|
|
247
250
|
elif type(val).__name__ in {'bpy_prop_collection'}:
|
|
248
251
|
return [attr, [get_node_data(v) for v in val[:]]]
|
|
@@ -25,6 +25,38 @@ tree_exclude = {
|
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
|
|
28
|
+
node_common_attr = {
|
|
29
|
+
'bl_icon',
|
|
30
|
+
'bl_description',
|
|
31
|
+
'bl_label',
|
|
32
|
+
'bl_width_default',
|
|
33
|
+
'bl_width_min',
|
|
34
|
+
'bl_width_max',
|
|
35
|
+
'bl_height_default',
|
|
36
|
+
'bl_height_min',
|
|
37
|
+
'bl_height_max',
|
|
38
|
+
'name',
|
|
39
|
+
'use_custom_color',
|
|
40
|
+
'color',
|
|
41
|
+
'width',
|
|
42
|
+
'height',
|
|
43
|
+
'label',
|
|
44
|
+
'mute',
|
|
45
|
+
'select',
|
|
46
|
+
'hide',
|
|
47
|
+
'warning_propagation',
|
|
48
|
+
'show_preview',
|
|
49
|
+
'show_texture',
|
|
50
|
+
'show_options',
|
|
51
|
+
'location_absolute',
|
|
52
|
+
'location',
|
|
53
|
+
'type',
|
|
54
|
+
'parent',
|
|
55
|
+
'bl_idname',
|
|
56
|
+
'id_data',
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
|
|
28
60
|
########################## NODE ###########################
|
|
29
61
|
|
|
30
62
|
|
|
@@ -2,14 +2,10 @@ from .type_util import PYDict, BNode, BGroup
|
|
|
2
2
|
from .node_registry import register_node_setter, bpy_types_funcs, BtypeFn
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
# set_node_exclude = ['type', 'parent', 'inputs', 'outputs', 'bl_idname', 'object', 'image', 'material', 'scene', 'id_data']
|
|
6
|
-
|
|
7
|
-
|
|
8
5
|
#### HELPER FUNCS ####
|
|
9
6
|
|
|
10
7
|
|
|
11
8
|
def set_node_attr(node: BNode, attr: PYDict, *args: str) -> None:
|
|
12
|
-
# global set_node_exclude
|
|
13
9
|
exclude_ = {a for a in ['type', 'parent', 'inputs', 'outputs', 'bl_idname', 'object', 'image', 'material', 'scene', 'id_data'] + list(args)}
|
|
14
10
|
for a in attr:
|
|
15
11
|
if not isinstance(attr[a], dict):
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|