1010 "name" : "Segment Display Generator" ,
1111 "description" : "Generates 7 segment displays in various formats and styles." ,
1212 "author" : "DUDSS" ,
13- "version" : (1 , 0 , 1 ),
14- "blender" : (3 , 0 , 0 ),
13+ "version" : (1 , 0 , 2 ),
14+ "blender" : (4 , 2 , 1 ),
1515 "location" : "3D View > Right sidebar > Segment display" ,
1616 "warning" : "" ,
1717 "doc_url" : "https://github.com/xDUDSSx/segment-display-blender-addon" ,
@@ -624,7 +624,7 @@ def execute(self, context):
624624 skew_value *= - 1
625625 bpy .ops .object .mode_set (mode = 'EDIT' )
626626 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' )
628628 bpy .ops .object .mode_set (mode = 'OBJECT' )
629629
630630 # Delete background
@@ -650,7 +650,6 @@ def execute(self, context):
650650 'mirror' : False },
651651 TRANSFORM_OT_translate = {
652652 'value' : (0 , 0 , extrude_value ),
653- 'orient_axis_ortho' : 'X' ,
654653 'orient_type' : 'NORMAL' ,
655654 'constraint_axis' : (False , False , True ),
656655 'mirror' : False ,
@@ -687,7 +686,6 @@ def execute(self, context):
687686
688687 bpy .ops .transform .translate (
689688 value = (cursor [0 ], cursor [1 ], cursor [2 ]),
690- orient_axis_ortho = 'X' ,
691689 orient_type = 'GLOBAL' ,
692690 orient_matrix = ((1 , 0 , 0 ), (0 , 1 , 0 ), (0 , 0 , 1 )),
693691 orient_matrix_type = 'GLOBAL' ,
@@ -881,11 +879,11 @@ def setup_display_shader(self, mat):
881879
882880 # Connect the shader group to the principled shader
883881 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
889887
890888 def create_display_style_shader (self , mat ):
891889 node_tree = None
@@ -1043,7 +1041,7 @@ def create_digit(self, digit_prototype, offset, display, digit, generated):
10431041 Assumes:
10441042 No materials / slots
10451043 "Segment" vertex color map defining segments
1046- "segments" face map for active areas
1044+ "segments" boolean face attribute for active areas
10471045 """
10481046 obj = Utils .copy_object (digit_prototype )
10491047 obj .location = (0 , 0 , 0 )
@@ -1053,20 +1051,7 @@ def create_digit(self, digit_prototype, offset, display, digit, generated):
10531051 bpy .context .view_layer .objects .active = obj
10541052 obj .select_set (True )
10551053
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 ()
10701055
10711056 mesh = obj .data
10721057 self .create_vertex_color_map (mesh , "Digit" , digit )
@@ -1085,7 +1070,7 @@ def create_aux(self, prototype, offset, generated):
10851070 Assumes:
10861071 No materials / slots
10871072 No vertex colors
1088- "segments" face map for active areas
1073+ "segments" boolean face attribute for active areas
10891074 """
10901075 obj = self .create_segment (prototype )
10911076
@@ -1118,18 +1103,22 @@ def assign_segment_materials(self):
11181103 Uses operators on context.object
11191104 """
11201105 bpy .ops .object .mode_set (mode = 'EDIT' )
1121-
1106+
11221107 # Select segments face map
11231108 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 ()
11261114
11271115 # Add materials
11281116 bpy .context .object .data .materials .append (self .resource .materials [1 ])
11291117 bpy .context .object .data .materials .append (self .resource .materials [0 ])
11301118 bpy .context .object .active_material_index = 1
11311119 bpy .ops .object .material_slot_assign ()
1132-
1120+
1121+ bpy .ops .mesh .select_mode (type = 'VERT' )
11331122 bpy .ops .object .mode_set (mode = 'OBJECT' )
11341123
11351124 @staticmethod
0 commit comments