Skip to content

Commit

Permalink
Automatically switch to Cycles in Rasterized material mode
Browse files Browse the repository at this point in the history
  • Loading branch information
30350n committed Dec 12, 2022
1 parent c235865 commit 6f54932
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions pcb2blender_importer/importer.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ class PCB2BLENDER_OT_import_pcb3d(bpy.types.Operator, ImportHelper):
stack_boards: BoolProperty(name="Stack PCBs", default=True)

pcb_material: EnumProperty(name="PCB Material", default="RASTERIZED",
items=(("RASTERIZED", "Rasterized", ""), ("3D", "3D", "")))
items=(("RASTERIZED", "Rasterized (Cycles)", ""), ("3D", "3D (deprecated)", "")))
texture_dpi: FloatProperty(name="Texture DPI",
default=1016.0, soft_min=508.0, soft_max=2032.0)

Expand Down Expand Up @@ -213,6 +213,9 @@ def execute(self, context):

# materials

if self.pcb_material == "RASTERIZED":
context.scene.render.engine = "CYCLES"

if self.merge_materials:
merge_materials(self.component_cache.values())

Expand Down Expand Up @@ -262,7 +265,7 @@ def import_pcb3d(self, context, filepath):

# rasterize/import layer svgs

if self.pcb_material == "RASTERIZED" and self.enhance_materials:
if self.enhance_materials and self.pcb_material == "RASTERIZED":
layers_path = tempdir / LAYERS
dpi = self.texture_dpi
images = {}
Expand Down Expand Up @@ -317,7 +320,7 @@ def import_pcb3d(self, context, filepath):

pcb_meshes = {obj.data for obj in pcb_objects if obj.type == "MESH"}

if self.pcb_material == "RASTERIZED" and self.enhance_materials:
if self.enhance_materials and self.pcb_material == "RASTERIZED":
for obj in pcb_objects[1:]:
bpy.data.objects.remove(obj)
pcb_object = pcb_objects[0]
Expand Down

0 comments on commit 6f54932

Please sign in to comment.