Skip to content

Commit

Permalink
Remove support for older Blender versions in code
Browse files Browse the repository at this point in the history
  • Loading branch information
lasa01 committed Dec 4, 2024
1 parent 0612a07 commit df87ffe
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 20 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.10'
python-version: '3.12'
cache: 'pip'
cache-dependency-path: 'requirements-dev.txt'
- name: Dependencies
Expand All @@ -49,7 +49,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Select Python version
run: echo "/opt/python/cp310-cp310/bin" >> $GITHUB_PATH
run: echo "/opt/python/cp312-cp312/bin" >> $GITHUB_PATH
- uses: actions-rs/toolchain@v1
with:
profile: minimal
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.10'
python-version: '3.12'
cache: 'pip'
cache-dependency-path: 'requirements-dev.txt'
- name: Dependencies
Expand Down Expand Up @@ -56,7 +56,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.10'
python-version: '3.12'
cache: 'pip'
cache-dependency-path: 'requirements-dev.txt'
- name: Dependencies
Expand Down Expand Up @@ -87,7 +87,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Select Python version
run: echo "/opt/python/cp310-cp310/bin" >> $GITHUB_PATH
run: echo "/opt/python/cp312-cp312/bin" >> $GITHUB_PATH
- uses: actions-rs/toolchain@v1
with:
profile: minimal
Expand Down
8 changes: 2 additions & 6 deletions plumber/asset/brush.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,7 @@ def import_solid(collection: Collection, brush_name: str, solid: BuiltSolid) ->
mesh.polygons.foreach_set("vertices", solid.polygon_vertices())
mesh.polygons.foreach_set("material_index", solid.polygon_material_indices())

# Blender 3.6 sets meshes to smooth by default, which looks bad
if bpy.app.version >= (3, 6, 0):
mesh.shade_flat()
mesh.shade_flat()

mesh.update()

Expand Down Expand Up @@ -74,9 +72,7 @@ def import_merged_solids(
"material_index", merged_solids.polygon_material_indices()
)

# Blender 3.6 sets meshes to smooth by default, which looks bad
if bpy.app.version >= (3, 6, 0):
mesh.shade_flat()
mesh.shade_flat()

mesh.update()

Expand Down
9 changes: 4 additions & 5 deletions plumber/asset/material.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,10 @@
".png": "PNG",
}

NODE_INPUT_SOCKET_MAP = {}

if bpy.app.version >= (4, 0, 0):
NODE_INPUT_SOCKET_MAP["Specular"] = "Specular IOR Level"
NODE_INPUT_SOCKET_MAP["Emission"] = "Emission Color"
NODE_INPUT_SOCKET_MAP = {
"Specular": "Specular IOR Level",
"Emission": "Emission Color",
}


def import_texture(texture: Texture) -> None:
Expand Down
3 changes: 0 additions & 3 deletions plumber/asset/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,9 +177,6 @@ def import_mesh(
mesh_data.polygons.foreach_set("use_smooth", [True] * polygons_len)
mesh_data.update(calc_edges=True)

if bpy.app.version < (4, 1, 0):
mesh_data.use_auto_smooth = True

mesh_data.normals_split_custom_set_from_vertices(mesh.normals())

uv_layer = mesh_data.uv_layers.new()
Expand Down
2 changes: 1 addition & 1 deletion requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
fake-bpy-module-2.82
fake-bpy-module-4.2
setuptools
setuptools-rust
black
Expand Down

0 comments on commit df87ffe

Please sign in to comment.