Blender 2.8 - 4.5 Support

This commit is contained in:
2025-09-28 12:44:04 -07:00
parent 8f8d4b1376
commit f97d8fd846
34 changed files with 581 additions and 399 deletions

View File

@ -5,7 +5,7 @@ import json
import os
import re
import subprocess
from typing import Any, Optional, Callable
from typing import Any, Callable, Dict, List, Optional, Tuple, Union
import bpy
@ -56,7 +56,7 @@ def is_version_installed(version_major: str) -> bool:
return any(v['version_major'] == version_major for v in _installed_versions)
def get_installed_version(version_major: str, re_fetch=False) -> Optional[dict[str, str]]:
def get_installed_version(version_major: str, re_fetch=False) -> Optional[Dict[str, str]]:
for installed_version in _installed_versions:
if installed_version['version_major'] == version_major:
return installed_version
@ -71,7 +71,7 @@ def get_installed_version(version_major: str, re_fetch=False) -> Optional[dict[s
return None
def get_supported_version(version_major: str) -> Optional[dict[str, str]]:
def get_supported_version(version_major: str) -> Optional[Dict[str, str]]:
for version in supported_versions:
if version[0] == version_major:
return {
@ -100,7 +100,7 @@ def fetch_installed_vs(silent=False) -> bool:
if not silent:
log.warn(
f'Found a Visual Studio installation with incomplete information, skipping\n'
f' ({name=}, {versions=}, {path=})'
f' (name={name if name is not None else "None"}, versions={versions}, path={path if path is not None else "None"})'
)
continue
@ -212,14 +212,14 @@ def compile_in_vs(version_major: str, done: Callable[[], None]) -> bool:
return True
def _vswhere_get_display_name(instance_data: dict[str, Any]) -> Optional[str]:
def _vswhere_get_display_name(instance_data: Dict[str, Any]) -> Optional[str]:
name_raw = instance_data.get('displayName', None)
if name_raw is None:
return None
return lnx.utils.safestr(name_raw).replace('_', ' ').strip()
def _vswhere_get_version(instance_data: dict[str, Any]) -> Optional[tuple[str, str, tuple[int, ...]]]:
def _vswhere_get_version(instance_data: Dict[str, Any]) -> Optional[Tuple[str, str, Tuple[int, int, int, int]]]:
version_raw = instance_data.get('installationVersion', None)
if version_raw is None:
return None
@ -230,11 +230,11 @@ def _vswhere_get_version(instance_data: dict[str, Any]) -> Optional[tuple[str, s
return version_major, version_full, version_full_ints
def _vswhere_get_path(instance_data: dict[str, Any]) -> Optional[str]:
def _vswhere_get_path(instance_data: Dict[str, Any]) -> Optional[str]:
return instance_data.get('installationPath', None)
def _vswhere_get_instances(silent=False) -> Optional[list[dict[str, Any]]]:
def _vswhere_get_instances(silent: bool = False) -> Optional[List[Dict[str, Any]]]:
# vswhere.exe only exists at that location since VS2017 v15.2, for
# earlier versions we'd need to package vswhere with Leenkx
exe_path = os.path.join(os.environ["ProgramFiles(x86)"], 'Microsoft Visual Studio', 'Installer', 'vswhere.exe')
@ -256,7 +256,7 @@ def _vswhere_get_instances(silent=False) -> Optional[list[dict[str, Any]]]:
return result
def version_full_to_ints(version_full: str) -> tuple[int, ...]:
def version_full_to_ints(version_full: str) -> Tuple[int, ...]:
return tuple(int(i) for i in version_full.split('.'))
@ -281,7 +281,7 @@ def get_vcxproj_path() -> str:
return os.path.join(project_path, project_name + '.vcxproj')
def fetch_project_version() -> tuple[Optional[str], Optional[str], Optional[str]]:
def fetch_project_version() -> Tuple[Optional[str], Optional[str], Optional[str]]:
version_major = None
version_min_full = None