Skip to content

Commit 8326c71

Browse files
committed
Preparing release
1 parent a381910 commit 8326c71

6 files changed

+148
-145
lines changed

__init__.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
bl_info = {
44
"name": "Substance Textures Importer",
55
"author": "Cosmin Planchon",
6-
"version": (0, 6, 1),
6+
"version": (0, 7, 0),
77
"blender": (4, 2, 0),
8-
"location": "Shader editor > Sidebar > STM",
9-
"description": "Import & autoassign images from Substance Painter or similar 3D painting tools",
8+
"location": "File > Import > Substance Textures",
9+
"description": "Import & autoassign images from Substance or similar 3D painting tools",
1010
"warning": "",
1111
"wiki_url": "https://github.com/Kos-Design/substance_textures_importer/blob/main/readme.rst",
1212
"tracker_url": "https://github.com/Kos-Design/substance_textures_importer/issues",

blender_manifest.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
schema_version = "1.0.0"
22
id = "substance_textures_importer"
3-
version = "6.1.0"
3+
version = "7.0.0"
44
name = "Substance Textures Importer"
55
tagline = "Import & autoassign images from 3D painting tools like Substance"
66
maintainer = "Cosmin Planchon <info@kosmin.fr>"

operators.py

+5-9
Original file line numberDiff line numberDiff line change
@@ -125,19 +125,15 @@ def execute(self, context):
125125
'FAKE_USER_ON')
126126
return {'CANCELLED'}
127127
if props().setup_nodes:
128-
self.report({'INFO'}, ("\n").join(ndh.report_content))
129128
ndh.handle_nodes(True)
130-
ShowMessageBox("Check Shader nodes panel",
131-
"Nodes created",
132-
'FAKE_USER_ON')
129+
if context.preferences.addons[__package__].preferences.debug_results:
130+
self.report({'INFO'}, ("\n").join(ndh.report_content))
133131
if props().assign_images:
134132
ndh.handle_nodes()
135133
if ndh.report_content :
136-
self.report({'INFO'}, ("\n").join(ndh.report_content))
137-
img_count = len([l for l in ndh.report_content if "assigned" in l])
138-
ShowMessageBox(f"{img_count} matching images loaded",
139-
"Images assigned to respective nodes",
140-
'FAKE_USER_ON')
134+
if context.preferences.addons[__package__].preferences.debug_results:
135+
ndh.report_content.insert(0,f' {len([l for l in ndh.report_content if "assigned" in l])} images assigned')
136+
self.report({'INFO'}, ("\n ").join(ndh.report_content))
141137
return {'FINISHED'}
142138

143139
class NODE_OT_stm_surfacing_setup(BasePanel,Operator):

preferences.py

+9-100
Original file line numberDiff line numberDiff line change
@@ -3,103 +3,8 @@
33
BoolVectorProperty, PointerProperty, CollectionProperty,EnumProperty)
44
from bpy.types import (PropertyGroup, UIList,AddonPreferences)
55

6-
from . functions import ( enum_sockets_cb, auto_mode_up, ch_sockets_up, enum_sockets_up, manual_up,
7-
split_rgb_up, line_on_up, get_name_up,set_name_up,
8-
get_line_bools,set_line_bools,get_line_vals,set_line_vals)
9-
10-
from . propertygroups import (StmProps, NodesLinks, ShaderLinks)
11-
12-
13-
class StmChannelSocket(PropertyGroup):
14-
input_sockets: EnumProperty(
15-
name="Input socket",
16-
description="Target shader input sockets for this texture node.\
17-
\n Selected automaticaly if -Detect target socket- is enabled",
18-
items=enum_sockets_cb,
19-
update=ch_sockets_up
20-
)
21-
line_name: StringProperty(
22-
name="Color",
23-
description="name of the line owning this instance",
24-
default="Select a name"
25-
)
26-
27-
28-
class StmChannelSockets(PropertyGroup):
29-
socket: CollectionProperty(type=StmChannelSocket)
30-
31-
32-
class StmPanelLines(PropertyGroup):
33-
name: StringProperty(
34-
name="name",
35-
description="Keyword identifier of the texture map to import",
36-
get=get_name_up,
37-
set=set_name_up
38-
)
39-
line_id: IntProperty()
40-
41-
line_bools: BoolVectorProperty(get=get_line_bools,set=set_line_bools,size=4)
42-
line_vals: IntVectorProperty(get=get_line_vals,set=set_line_vals,size=4)
43-
44-
channels: PointerProperty(type=StmChannelSockets)
45-
46-
file_name: StringProperty(
47-
name="File",
48-
subtype='FILE_PATH',
49-
description="Complete filepath of the texture map",
50-
default="Select a file"
51-
)
52-
auto_mode: BoolProperty(
53-
name="Detect target socket",
54-
description="Auto detect target shader socket",
55-
default=True,
56-
update=auto_mode_up
57-
)
58-
input_sockets: EnumProperty(
59-
name="",
60-
description="Target shader input sockets for this texture node.\
61-
\n Selected automaticaly if Autodetect sockets is enabled",
62-
items=enum_sockets_cb,
63-
update=enum_sockets_up
64-
)
65-
file_is_real: BoolProperty(
66-
description="Associated file exists",
67-
default=False
68-
)
69-
manual: BoolProperty(
70-
name='Overwrite file name',
71-
description="Manual mode switch",
72-
default=False,
73-
update=manual_up
74-
)
75-
line_on: BoolProperty(
76-
name="Active",
77-
description="Enable/Disable line",
78-
default=True,
79-
update=line_on_up
80-
)
81-
split_rgb: BoolProperty(
82-
name="Split rgb channels",
83-
description="Split the RGB channels of the target image \
84-
to plug them into individual sockets",
85-
default=False,
86-
update=split_rgb_up
87-
)
88-
89-
90-
class StmPanelLiner(PropertyGroup):
91-
textures: CollectionProperty(type=StmPanelLines)
92-
texture_index: IntProperty(default=0)
93-
94-
95-
class StmNodes(PropertyGroup):
96-
node_links: CollectionProperty(type=NodesLinks)
97-
node_index: IntProperty(default=0)
98-
99-
100-
class StmShaders(PropertyGroup):
101-
shader_links: CollectionProperty(type=ShaderLinks)
102-
shader_index: IntProperty(default=0)
6+
from . propertygroups import (StmProps, NodesLinks, ShaderLinks, StmChannelSocket,StmShaders,
7+
StmChannelSockets,StmPanelLines, StmPanelLiner, StmNodes)
1038

1049

10510
class NODE_UL_stm_list(UIList):
@@ -137,17 +42,21 @@ class StmAddonPreferences(AddonPreferences):
13742
\n It will remain available in the File menu\
13843
> Import > Substance Textures and via \
13944
\n F3 Search > Import Surfacing Textures")
45+
debug_results: BoolProperty(
46+
default=True,
47+
description="Show extension activity in Blender console")
14048
props: bpy.props.PointerProperty(type=StmProps)
14149

14250
def draw(self, context):
14351
layout = self.layout
14452
row = layout.row()
14553
row.prop(self.props, 'usr_dir',text="Textures folder:")
14654
row = layout.row()
147-
row.operator('node.stm_surfacing_setup',text="Show Extension Panel")
55+
row.operator('node.stm_surfacing_setup',text="Show Substance Texture Importer Panel")
14856
row = layout.row()
14957
row.label(text="Separator used for multi-sockets: ")
15058
row.split(factor=10)
15159
row.prop(self.props,'separators_list',text="")
152-
layout.prop(self,'display_in_editor',text="Display shortcut button in Shader Nodes Editor")
153-
layout.prop(self,'display_in_properties',text="Display shortcut button in Material Properties")
60+
layout.prop(self,'display_in_editor',text="Display shortcut button in Shader Nodes Editor.")
61+
layout.prop(self,'display_in_properties',text="Display shortcut button in Material Properties.")
62+
layout.prop(self,'debug_results',text="Show output messages in console.")

propertygroups.py

+100-3
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
11
import bpy
2-
from bpy.props import (StringProperty,IntProperty,BoolProperty,IntVectorProperty,
3-
BoolVectorProperty,EnumProperty,CollectionProperty)
2+
from bpy.props import ( StringProperty,IntProperty,BoolProperty,
3+
IntVectorProperty,BoolVectorProperty,
4+
EnumProperty,CollectionProperty,PointerProperty)
45
from bpy.types import PropertyGroup
56
from . functions import (include_ngroups_up,clear_nodes_up,target_list_cb,target_list_up,
67
usr_dir_up,get_liners_bools,set_liners_vals,get_liners_name,
78
set_liners_name,set_liners_bools,get_liners_vals,
89
replace_shader_up,shaders_list_cb,shaders_list_up,separators_cb,
9-
advanced_mode_up,only_active_mat_up)
10+
advanced_mode_up,only_active_mat_up, enum_sockets_cb,
11+
auto_mode_up, ch_sockets_up, enum_sockets_up, manual_up,
12+
split_rgb_up, line_on_up, get_name_up,set_name_up,
13+
get_line_bools,set_line_bools,get_line_vals,set_line_vals)
1014

1115
class StringItem(PropertyGroup):
1216

@@ -57,6 +61,98 @@ class NodesLinks(PropertyGroup):
5761
in_sockets : CollectionProperty(type=StringItem)
5862

5963

64+
class StmChannelSocket(PropertyGroup):
65+
input_sockets: EnumProperty(
66+
name="Input socket",
67+
description="Target shader input sockets for this texture node.\
68+
\n Selected automaticaly if -Detect target socket- is enabled",
69+
items=enum_sockets_cb,
70+
update=ch_sockets_up
71+
)
72+
line_name: StringProperty(
73+
name="Color",
74+
description="name of the line owning this instance",
75+
default="Select a name"
76+
)
77+
78+
79+
class StmChannelSockets(PropertyGroup):
80+
socket: CollectionProperty(type=StmChannelSocket)
81+
82+
83+
class StmPanelLines(PropertyGroup):
84+
name: StringProperty(
85+
name="name",
86+
description="Keyword identifier of the texture map to import",
87+
get=get_name_up,
88+
set=set_name_up
89+
)
90+
line_id: IntProperty()
91+
92+
line_bools: BoolVectorProperty(get=get_line_bools,set=set_line_bools,size=4)
93+
line_vals: IntVectorProperty(get=get_line_vals,set=set_line_vals,size=4)
94+
95+
channels: PointerProperty(type=StmChannelSockets)
96+
97+
file_name: StringProperty(
98+
name="File",
99+
subtype='FILE_PATH',
100+
description="Complete filepath of the texture map",
101+
default="Select a file"
102+
)
103+
auto_mode: BoolProperty(
104+
name="Detect target socket",
105+
description="Auto detect target shader socket",
106+
default=True,
107+
update=auto_mode_up
108+
)
109+
input_sockets: EnumProperty(
110+
name="",
111+
description="Target shader input sockets for this texture node.\
112+
\n Selected automaticaly if Autodetect sockets is enabled",
113+
items=enum_sockets_cb,
114+
update=enum_sockets_up
115+
)
116+
file_is_real: BoolProperty(
117+
description="Associated file exists",
118+
default=False
119+
)
120+
manual: BoolProperty(
121+
name='Overwrite file name',
122+
description="Manual mode switch",
123+
default=False,
124+
update=manual_up
125+
)
126+
line_on: BoolProperty(
127+
name="Active",
128+
description="Enable/Disable line",
129+
default=True,
130+
update=line_on_up
131+
)
132+
split_rgb: BoolProperty(
133+
name="Split rgb channels",
134+
description="Split the RGB channels of the target image \
135+
to plug them into individual sockets",
136+
default=False,
137+
update=split_rgb_up
138+
)
139+
140+
141+
class StmPanelLiner(PropertyGroup):
142+
textures: CollectionProperty(type=StmPanelLines)
143+
texture_index: IntProperty(default=0)
144+
145+
146+
class StmNodes(PropertyGroup):
147+
node_links: CollectionProperty(type=NodesLinks)
148+
node_index: IntProperty(default=0)
149+
150+
151+
class StmShaders(PropertyGroup):
152+
shader_links: CollectionProperty(type=ShaderLinks)
153+
shader_index: IntProperty(default=0)
154+
155+
60156
class StmProps(PropertyGroup):
61157

62158
include_ngroups: BoolProperty(
@@ -182,3 +278,4 @@ class StmProps(PropertyGroup):
182278
\n as the original ones (ignores the .00x suffix)",
183279
default=True
184280
)
281+

0 commit comments

Comments
 (0)