PyAPI: Support Python 3.9 (for VFX platform support)
Support Python 3.9, part of VFX platform support. The intention of restoring Python 3.9 support is so it's possible to build a (mostly) VFX compatible version of Blender, not to provide official builds on the buildbot. Includes contribution by Brecht. Reviewed By: brecht Ref D16030
This commit is contained in:
parent
a920f32ccd
commit
243e28b73b
|
@ -956,8 +956,8 @@ if(WITH_PYTHON)
|
|||
# Do this before main 'platform_*' checks,
|
||||
# because UNIX will search for the old Python paths which may not exist.
|
||||
# giving errors about missing paths before this case is met.
|
||||
if(DEFINED PYTHON_VERSION AND "${PYTHON_VERSION}" VERSION_LESS "3.10")
|
||||
message(FATAL_ERROR "At least Python 3.10 is required to build, but found Python ${PYTHON_VERSION}")
|
||||
if(DEFINED PYTHON_VERSION AND "${PYTHON_VERSION}" VERSION_LESS "3.9")
|
||||
message(FATAL_ERROR "At least Python 3.9 is required to build, but found Python ${PYTHON_VERSION}")
|
||||
endif()
|
||||
|
||||
file(GLOB RESULT "${CMAKE_SOURCE_DIR}/release/scripts/addons")
|
||||
|
|
|
@ -113,7 +113,7 @@ endif()
|
|||
|
||||
if(WITH_PYTHON)
|
||||
# Use precompiled libraries by default.
|
||||
set(PYTHON_VERSION 3.10)
|
||||
SET(PYTHON_VERSION 3.10 CACHE STRING "Python Version (major and minor only)")
|
||||
if(NOT WITH_PYTHON_MODULE AND NOT WITH_PYTHON_FRAMEWORK)
|
||||
# Normally cached but not since we include them with blender.
|
||||
set(PYTHON_INCLUDE_DIR "${LIBDIR}/python/include/python${PYTHON_VERSION}")
|
||||
|
|
|
@ -497,7 +497,7 @@ if(WITH_JACK)
|
|||
endif()
|
||||
|
||||
if(WITH_PYTHON)
|
||||
set(PYTHON_VERSION 3.10) # CACHE STRING)
|
||||
SET(PYTHON_VERSION 3.10 CACHE STRING "Python Version (major and minor only)")
|
||||
|
||||
string(REPLACE "." "" _PYTHON_VERSION_NO_DOTS ${PYTHON_VERSION})
|
||||
set(PYTHON_LIBRARY ${LIBDIR}/python/${_PYTHON_VERSION_NO_DOTS}/libs/python${_PYTHON_VERSION_NO_DOTS}.lib)
|
||||
|
|
|
@ -483,68 +483,68 @@ class SelectPaintSlotHelper:
|
|||
|
||||
have_image = False
|
||||
|
||||
match getattr(mode_settings, self.canvas_source_attr_name):
|
||||
case 'MATERIAL':
|
||||
if len(ob.material_slots) > 1:
|
||||
layout.template_list(
|
||||
"MATERIAL_UL_matslots", "layers",
|
||||
ob, "material_slots",
|
||||
ob, "active_material_index", rows=2,
|
||||
)
|
||||
mat = ob.active_material
|
||||
if mat and mat.texture_paint_images:
|
||||
row = layout.row()
|
||||
row.template_list(
|
||||
"TEXTURE_UL_texpaintslots", "",
|
||||
mat, "texture_paint_slots",
|
||||
mat, "paint_active_slot", rows=2,
|
||||
)
|
||||
|
||||
if mat.texture_paint_slots:
|
||||
slot = mat.texture_paint_slots[mat.paint_active_slot]
|
||||
else:
|
||||
slot = None
|
||||
|
||||
have_image = slot is not None
|
||||
else:
|
||||
row = layout.row()
|
||||
|
||||
box = row.box()
|
||||
box.label(text="No Textures")
|
||||
|
||||
sub = row.column(align=True)
|
||||
sub.operator_menu_enum("paint.add_texture_paint_slot", "type", icon='ADD', text="")
|
||||
|
||||
case 'IMAGE':
|
||||
mesh = ob.data
|
||||
uv_text = mesh.uv_layers.active.name if mesh.uv_layers.active else ""
|
||||
layout.template_ID(mode_settings, self.canvas_image_attr_name, new="image.new", open="image.open")
|
||||
if settings.missing_uvs:
|
||||
layout.operator("paint.add_simple_uvs", icon='ADD', text="Add UVs")
|
||||
else:
|
||||
layout.menu("VIEW3D_MT_tools_projectpaint_uvlayer", text=uv_text, translate=False)
|
||||
have_image = getattr(settings, self.canvas_image_attr_name) is not None
|
||||
|
||||
self.draw_image_interpolation(layout=layout, mode_settings=mode_settings)
|
||||
|
||||
case 'COLOR_ATTRIBUTE':
|
||||
mesh = ob.data
|
||||
|
||||
canvas_source = getattr(mode_settings, self.canvas_source_attr_name)
|
||||
if canvas_source == 'MATERIAL':
|
||||
if len(ob.material_slots) > 1:
|
||||
layout.template_list(
|
||||
"MATERIAL_UL_matslots", "layers",
|
||||
ob, "material_slots",
|
||||
ob, "active_material_index", rows=2,
|
||||
)
|
||||
mat = ob.active_material
|
||||
if mat and mat.texture_paint_images:
|
||||
row = layout.row()
|
||||
col = row.column()
|
||||
col.template_list(
|
||||
"MESH_UL_color_attributes_selector",
|
||||
"color_attributes",
|
||||
mesh,
|
||||
"color_attributes",
|
||||
mesh.color_attributes,
|
||||
"active_color_index",
|
||||
rows=3,
|
||||
row.template_list(
|
||||
"TEXTURE_UL_texpaintslots", "",
|
||||
mat, "texture_paint_slots",
|
||||
mat, "paint_active_slot", rows=2,
|
||||
)
|
||||
|
||||
col = row.column(align=True)
|
||||
col.operator("geometry.color_attribute_add", icon='ADD', text="")
|
||||
col.operator("geometry.color_attribute_remove", icon='REMOVE', text="")
|
||||
if mat.texture_paint_slots:
|
||||
slot = mat.texture_paint_slots[mat.paint_active_slot]
|
||||
else:
|
||||
slot = None
|
||||
|
||||
have_image = slot is not None
|
||||
else:
|
||||
row = layout.row()
|
||||
|
||||
box = row.box()
|
||||
box.label(text="No Textures")
|
||||
|
||||
sub = row.column(align=True)
|
||||
sub.operator_menu_enum("paint.add_texture_paint_slot", "type", icon='ADD', text="")
|
||||
|
||||
elif canvas_source == 'IMAGE':
|
||||
mesh = ob.data
|
||||
uv_text = mesh.uv_layers.active.name if mesh.uv_layers.active else ""
|
||||
layout.template_ID(mode_settings, self.canvas_image_attr_name, new="image.new", open="image.open")
|
||||
if settings.missing_uvs:
|
||||
layout.operator("paint.add_simple_uvs", icon='ADD', text="Add UVs")
|
||||
else:
|
||||
layout.menu("VIEW3D_MT_tools_projectpaint_uvlayer", text=uv_text, translate=False)
|
||||
have_image = getattr(settings, self.canvas_image_attr_name) is not None
|
||||
|
||||
self.draw_image_interpolation(layout=layout, mode_settings=mode_settings)
|
||||
|
||||
elif canvas_source == 'COLOR_ATTRIBUTE':
|
||||
mesh = ob.data
|
||||
|
||||
row = layout.row()
|
||||
col = row.column()
|
||||
col.template_list(
|
||||
"MESH_UL_color_attributes_selector",
|
||||
"color_attributes",
|
||||
mesh,
|
||||
"color_attributes",
|
||||
mesh.color_attributes,
|
||||
"active_color_index",
|
||||
rows=3,
|
||||
)
|
||||
|
||||
col = row.column(align=True)
|
||||
col.operator("geometry.color_attribute_add", icon='ADD', text="")
|
||||
col.operator("geometry.color_attribute_remove", icon='REMOVE', text="")
|
||||
|
||||
if settings.missing_uvs:
|
||||
layout.separator()
|
||||
|
|
|
@ -6,8 +6,8 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#if PY_VERSION_HEX < 0x030a0000
|
||||
# error "Python 3.10 or greater is required, you'll need to update your Python."
|
||||
#if PY_VERSION_HEX < 0x03090000
|
||||
# error "Python 3.9 or greater is required, you'll need to update your Python."
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
@ -389,7 +389,9 @@ static const bool secure_opcodes[255] = {
|
|||
OK_OP(BINARY_TRUE_DIVIDE),
|
||||
OK_OP(INPLACE_FLOOR_DIVIDE),
|
||||
OK_OP(INPLACE_TRUE_DIVIDE),
|
||||
#if PY_VERSION_HEX >= 0x030a0000 /* Python3.9 doesn't support. */
|
||||
OK_OP(GET_LEN),
|
||||
#endif
|
||||
OK_OP(INPLACE_ADD),
|
||||
OK_OP(INPLACE_SUBTRACT),
|
||||
OK_OP(INPLACE_MULTIPLY),
|
||||
|
@ -407,7 +409,9 @@ static const bool secure_opcodes[255] = {
|
|||
OK_OP(INPLACE_OR),
|
||||
OK_OP(LIST_TO_TUPLE),
|
||||
OK_OP(RETURN_VALUE),
|
||||
#if PY_VERSION_HEX >= 0x030a0000 /* Python3.9 doesn't support. */
|
||||
OK_OP(ROT_N),
|
||||
#endif
|
||||
OK_OP(BUILD_TUPLE),
|
||||
OK_OP(BUILD_LIST),
|
||||
OK_OP(BUILD_SET),
|
||||
|
|
|
@ -76,7 +76,11 @@ Py_hash_t mathutils_array_hash(const float *array, size_t array_len)
|
|||
x = 0x345678UL;
|
||||
i = 0;
|
||||
while (--len >= 0) {
|
||||
#if PY_VERSION_HEX < 0x030a0000
|
||||
y = _Py_HashDouble((double)(array[i++]));
|
||||
#else
|
||||
y = _Py_HashDouble(NULL, (double)(array[i++]));
|
||||
#endif
|
||||
if (y == -1) {
|
||||
return -1;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue