10
10
"name" : "Segment Display Generator" ,
11
11
"description" : "Generates 7 segment displays in various formats and styles." ,
12
12
"author" : "DUDSS" ,
13
- "version" : (1 , 0 , 1 ),
14
- "blender" : (3 , 0 , 0 ),
13
+ "version" : (1 , 0 , 2 ),
14
+ "blender" : (4 , 2 , 1 ),
15
15
"location" : "3D View > Right sidebar > Segment display" ,
16
16
"warning" : "" ,
17
17
"doc_url" : "https://github.com/xDUDSSx/segment-display-blender-addon" ,
@@ -624,7 +624,7 @@ def execute(self, context):
624
624
skew_value *= - 1
625
625
bpy .ops .object .mode_set (mode = 'EDIT' )
626
626
bpy .ops .mesh .select_all (action = 'SELECT' )
627
- bpy .ops .transform .shear (value = skew_value , orient_axis = 'Z' , orient_axis_ortho = 'X' , orient_type = 'GLOBAL' )
627
+ bpy .ops .transform .shear (value = skew_value , orient_axis = 'Z' , orient_type = 'GLOBAL' )
628
628
bpy .ops .object .mode_set (mode = 'OBJECT' )
629
629
630
630
# Delete background
@@ -650,7 +650,6 @@ def execute(self, context):
650
650
'mirror' : False },
651
651
TRANSFORM_OT_translate = {
652
652
'value' : (0 , 0 , extrude_value ),
653
- 'orient_axis_ortho' : 'X' ,
654
653
'orient_type' : 'NORMAL' ,
655
654
'constraint_axis' : (False , False , True ),
656
655
'mirror' : False ,
@@ -687,7 +686,6 @@ def execute(self, context):
687
686
688
687
bpy .ops .transform .translate (
689
688
value = (cursor [0 ], cursor [1 ], cursor [2 ]),
690
- orient_axis_ortho = 'X' ,
691
689
orient_type = 'GLOBAL' ,
692
690
orient_matrix = ((1 , 0 , 0 ), (0 , 1 , 0 ), (0 , 0 , 1 )),
693
691
orient_matrix_type = 'GLOBAL' ,
@@ -881,11 +879,11 @@ def setup_display_shader(self, mat):
881
879
882
880
# Connect the shader group to the principled shader
883
881
principled = mat .node_tree .nodes ['segment_principled' ]
884
- mat .node_tree .links .new (shader_node_group .outputs [0 ], principled .inputs [0 ]) # Base
885
- mat .node_tree .links .new (shader_node_group .outputs [1 ], principled .inputs [9 ]) # Roughness
886
- mat .node_tree .links .new (shader_node_group .outputs [2 ], principled .inputs [19 ]) # Emission
887
- mat .node_tree .links .new (shader_node_group .outputs [3 ], principled .inputs [20 ]) # Emission strength
888
- mat .node_tree .links .new (shader_node_group .outputs [4 ], principled .inputs [22 ]) # Normal
882
+ mat .node_tree .links .new (shader_node_group .outputs [0 ], principled .inputs ['Base Color' ]) # Base
883
+ mat .node_tree .links .new (shader_node_group .outputs [1 ], principled .inputs ['Roughness' ]) # Roughness
884
+ mat .node_tree .links .new (shader_node_group .outputs [2 ], principled .inputs ['Emission Color' ]) # Emission
885
+ mat .node_tree .links .new (shader_node_group .outputs [3 ], principled .inputs ['Emission Strength' ]) # Emission strength
886
+ mat .node_tree .links .new (shader_node_group .outputs [4 ], principled .inputs ['Normal' ]) # Normal
889
887
890
888
def create_display_style_shader (self , mat ):
891
889
node_tree = None
@@ -1043,7 +1041,7 @@ def create_digit(self, digit_prototype, offset, display, digit, generated):
1043
1041
Assumes:
1044
1042
No materials / slots
1045
1043
"Segment" vertex color map defining segments
1046
- "segments" face map for active areas
1044
+ "segments" boolean face attribute for active areas
1047
1045
"""
1048
1046
obj = Utils .copy_object (digit_prototype )
1049
1047
obj .location = (0 , 0 , 0 )
@@ -1053,20 +1051,7 @@ def create_digit(self, digit_prototype, offset, display, digit, generated):
1053
1051
bpy .context .view_layer .objects .active = obj
1054
1052
obj .select_set (True )
1055
1053
1056
- bpy .ops .object .mode_set (mode = 'EDIT' )
1057
-
1058
- # Select segments face map
1059
- bpy .ops .mesh .select_all (action = 'DESELECT' )
1060
- obj .face_maps .active_index = bpy .context .object .face_maps ['segments' ].index
1061
- bpy .ops .object .face_map_select ()
1062
-
1063
- # Add materials
1064
- obj .data .materials .append (self .resource .materials [1 ])
1065
- obj .data .materials .append (self .resource .materials [0 ])
1066
- obj .active_material_index = 1
1067
- bpy .ops .object .material_slot_assign ()
1068
-
1069
- bpy .ops .object .mode_set (mode = 'OBJECT' )
1054
+ self .assign_segment_materials ()
1070
1055
1071
1056
mesh = obj .data
1072
1057
self .create_vertex_color_map (mesh , "Digit" , digit )
@@ -1085,7 +1070,7 @@ def create_aux(self, prototype, offset, generated):
1085
1070
Assumes:
1086
1071
No materials / slots
1087
1072
No vertex colors
1088
- "segments" face map for active areas
1073
+ "segments" boolean face attribute for active areas
1089
1074
"""
1090
1075
obj = self .create_segment (prototype )
1091
1076
@@ -1118,18 +1103,22 @@ def assign_segment_materials(self):
1118
1103
Uses operators on context.object
1119
1104
"""
1120
1105
bpy .ops .object .mode_set (mode = 'EDIT' )
1121
-
1106
+
1122
1107
# Select segments face map
1123
1108
bpy .ops .mesh .select_all (action = 'DESELECT' )
1124
- bpy .context .object .face_maps .active_index = bpy .context .object .face_maps ['segments' ].index
1125
- bpy .ops .object .face_map_select ()
1109
+ bpy .ops .mesh .select_mode (type = 'FACE' )
1110
+
1111
+ mesh = bpy .context .object .data ;
1112
+ mesh .attributes .active = mesh .attributes ['segments' ]
1113
+ bpy .ops .mesh .select_by_attribute ()
1126
1114
1127
1115
# Add materials
1128
1116
bpy .context .object .data .materials .append (self .resource .materials [1 ])
1129
1117
bpy .context .object .data .materials .append (self .resource .materials [0 ])
1130
1118
bpy .context .object .active_material_index = 1
1131
1119
bpy .ops .object .material_slot_assign ()
1132
-
1120
+
1121
+ bpy .ops .mesh .select_mode (type = 'VERT' )
1133
1122
bpy .ops .object .mode_set (mode = 'OBJECT' )
1134
1123
1135
1124
@staticmethod
0 commit comments