Merge branch 'blender-v5.1-release'

This commit is contained in:
Jesse Yurkovich 2026-02-26 13:11:57 -08:00
commit 4dc4a36bd7
5 changed files with 196 additions and 2 deletions

View file

@ -86,7 +86,7 @@ void USDXformReader::read_matrix(float4x4 &r_mat /* local matrix */,
* will propagate it. */
if (is_root_xform_) {
if (scale != 1.0f) {
r_mat = math::scale(r_mat, float3(scale));
r_mat = math::scale(r_mat, float4(scale));
}
if (settings_->do_convert_mat) {

View file

@ -98,7 +98,7 @@ void USDTransformWriter::do_write(HierarchyContext &context)
if (usd_export_context_.export_params.convert_scene_units != SceneUnits::Meters) {
const float scale = float(1.0 / get_meters_per_unit(usd_export_context_.export_params));
matrix_world = math::scale(matrix_world, float3(scale));
matrix_world = math::scale(matrix_world, float4(scale));
}
parent_relative_matrix = context.parent_matrix_inv_world * matrix_world;

View file

@ -0,0 +1,105 @@
==== Meshes: 2
- Mesh 'Cube' vtx:8 face:6 loop:24 edge:12
- 0 4 6 2 3 2 6 7 7 6 ... 3 7 1 0 2 3 5 4 0 1
- 0/2 0/4 4/6 2/6 3/7 2/3 6/7 5/7 4/5 1/5 1/3 0/1
- attr 'custom_normal' INT16_2D CORNER
- (0, 0)
- (0, 0)
- (0, 0)
- (0, 0)
- (0, 0)
- (0, 0)
- (0, 0)
- (0, 0)
- (0, 0)
- (0, 0)
...
- (0, 0)
- (0, 0)
- (0, 0)
- (0, 0)
- (0, 0)
- (0, 0)
- (0, 0)
- (0, 0)
- (0, 0)
- (0, 0)
- attr 'material_index' INT FACE
- 0 0 0 0 0 0
- attr 'position' FLOAT_VECTOR POINT
- (1.000, 1.000, 1.000)
- (1.000, 1.000, -1.000)
- (1.000, -1.000, 1.000)
- (1.000, -1.000, -1.000)
- (-1.000, 1.000, 1.000)
- (-1.000, 1.000, -1.000)
- (-1.000, -1.000, 1.000)
- (-1.000, -1.000, -1.000)
- attr 'sharp_edge' BOOLEAN EDGE
- 1 1 1 1 1 1 1 1 1 1 1 1
- Mesh 'Cube_001' vtx:8 face:6 loop:24 edge:12
- 0 4 6 2 3 2 6 7 7 6 ... 3 7 1 0 2 3 5 4 0 1
- 0/2 0/4 4/6 2/6 3/7 2/3 6/7 5/7 4/5 1/5 1/3 0/1
- attr 'custom_normal' INT16_2D CORNER
- (0, 0)
- (0, 0)
- (0, 0)
- (0, 0)
- (0, 0)
- (0, 0)
- (0, 0)
- (0, 0)
- (0, 0)
- (0, 0)
...
- (0, 0)
- (0, 0)
- (0, 0)
- (0, 0)
- (0, 0)
- (0, 0)
- (0, 0)
- (0, 0)
- (0, 0)
- (0, 0)
- attr 'material_index' INT FACE
- 0 0 0 0 0 0
- attr 'position' FLOAT_VECTOR POINT
- (1.000, 3.000, 1.000)
- (1.000, 3.000, -1.000)
- (1.000, 1.000, 1.000)
- (1.000, 1.000, -1.000)
- (-1.000, 3.000, 1.000)
- (-1.000, 3.000, -1.000)
- (-1.000, 1.000, 1.000)
- (-1.000, 1.000, -1.000)
- attr 'sharp_edge' BOOLEAN EDGE
- 1 1 1 1 1 1 1 1 1 1 1 1
==== Objects: 4
- Obj 'Camera' CAMERA data:'Camera'
- pos 7.359, -6.926, 4.958
- rot 1.109, 0.000, 0.815 (XYZ)
- scl 1.000, 1.000, 1.000
- Obj 'Cube' MESH data:'Cube'
- pos 2.000, 0.000, 0.000
- rot 0.000, 0.000, 0.000 (XYZ)
- scl 1.000, 1.000, 1.000
- Obj 'Cube_001' MESH data:'Cube_001'
- pos 0.000, 0.000, 0.000
- rot 0.000, 0.000, 0.000 (XYZ)
- scl 1.000, 1.000, 1.000
- Obj 'Light' LIGHT data:'Light'
- pos 4.076, 1.005, 5.904
- rot 0.650, 0.055, 1.866 (XYZ)
- scl 1.000, 1.000, 1.000
==== Cameras: 1
- Cam 'Camera' PERSP lens:50.0 MILLIMETERS near:0.100 far:100.0 orthosize:6.0
- fov 0.691 (h 0.691 v 0.400)
- sensor 36.0x20.2 shift 0.000,0.000
==== Lights: 1
- Light 'Light' POINT col:(1.000, 1.000, 1.000) energy:1000.000 temp:6500.000

View file

@ -0,0 +1,86 @@
#usda 1.0
(
defaultPrim = "Cube"
doc = "Blender v5.0.1"
metersPerUnit = 0.01
upAxis = "Z"
)
def Xform "Cube"
{
float3 xformOp:rotateXYZ = (0, -0, 0)
float3 xformOp:scale = (100, 100, 100)
double3 xformOp:translate = (200, 0, 0)
uniform token[] xformOpOrder = ["xformOp:translate", "xformOp:rotateXYZ", "xformOp:scale"]
def Mesh "Cube" (
active = true
)
{
uniform bool doubleSided = 1
float3[] extent = [(-1, -1, -1), (1, 1, 1)]
int[] faceVertexCounts = [4, 4, 4, 4, 4, 4]
int[] faceVertexIndices = [0, 4, 6, 2, 3, 2, 6, 7, 7, 6, 4, 5, 5, 1, 3, 7, 1, 0, 2, 3, 5, 4, 0, 1]
normal3f[] normals = [(0, 0, 1), (0, 0, 1), (0, 0, 1), (0, 0, 1), (0, -1, 0), (0, -1, 0), (0, -1, 0), (0, -1, 0), (-1, 0, 0), (-1, 0, 0), (-1, 0, 0), (-1, 0, 0), (0, 0, -1), (0, 0, -1), (0, 0, -1), (0, 0, -1), (1, 0, 0), (1, 0, 0), (1, 0, 0), (1, 0, 0), (0, 1, 0), (0, 1, 0), (0, 1, 0), (0, 1, 0)] (
interpolation = "faceVarying"
)
point3f[] points = [(1, 1, 1), (1, 1, -1), (1, -1, 1), (1, -1, -1), (-1, 1, 1), (-1, 1, -1), (-1, -1, 1), (-1, -1, -1)]
uniform token subdivisionScheme = "none"
}
}
def Xform "Cube_001"
{
float3 xformOp:rotateXYZ = (0, -0, 0)
float3 xformOp:scale = (100, 100, 100)
double3 xformOp:translate = (0, 0, 0)
uniform token[] xformOpOrder = ["xformOp:translate", "xformOp:rotateXYZ", "xformOp:scale"]
def Mesh "Cube_001" (
active = true
)
{
uniform bool doubleSided = 1
float3[] extent = [(-1, 1, -1), (1, 3, 1)]
int[] faceVertexCounts = [4, 4, 4, 4, 4, 4]
int[] faceVertexIndices = [0, 4, 6, 2, 3, 2, 6, 7, 7, 6, 4, 5, 5, 1, 3, 7, 1, 0, 2, 3, 5, 4, 0, 1]
normal3f[] normals = [(0, 0, 1), (0, 0, 1), (0, 0, 1), (0, 0, 1), (0, -1, 0), (0, -1, 0), (0, -1, 0), (0, -1, 0), (-1, 0, 0), (-1, 0, 0), (-1, 0, 0), (-1, 0, 0), (0, 0, -1), (0, 0, -1), (0, 0, -1), (0, 0, -1), (1, 0, 0), (1, 0, 0), (1, 0, 0), (1, 0, 0), (0, 1, 0), (0, 1, 0), (0, 1, 0), (0, 1, 0)] (
interpolation = "faceVarying"
)
point3f[] points = [(1, 3, 1), (1, 3, -1), (1, 1, 1), (1, 1, -1), (-1, 3, 1), (-1, 3, -1), (-1, 1, 1), (-1, 1, -1)]
uniform token subdivisionScheme = "none"
}
}
def Xform "Light"
{
float3 xformOp:rotateXYZ = (37.26105, 3.1637065, 106.93631)
float3 xformOp:scale = (100.00001, 100, 99.99999)
double3 xformOp:translate = (407.6245422363281, 100.54539489746094, 590.38623046875)
uniform token[] xformOpOrder = ["xformOp:translate", "xformOp:rotateXYZ", "xformOp:scale"]
def SphereLight "Light"
{
float3[] extent = [(-0.1, -0.1, -0.1), (0.1, 0.1, 0.1)]
bool inputs:enableColorTemperature = 1
float inputs:intensity = 318.30988
bool inputs:normalize = 1
float inputs:radius = 0.1
}
}
def Xform "Camera"
{
float3 xformOp:rotateXYZ = (63.559296, -0.00000101339, 46.691944)
float3 xformOp:scale = (100, 100, 100)
double3 xformOp:translate = (735.88916015625, -692.5791015625, 495.8309326171875)
uniform token[] xformOpOrder = ["xformOp:translate", "xformOp:rotateXYZ", "xformOp:scale"]
def Camera "Camera"
{
float2 clippingRange = (10, 10000)
float horizontalAperture = 36
token projection = "perspective"
float verticalAperture = 20.25
}
}

View file

@ -1658,12 +1658,15 @@ class USDExportTest(AbstractUSDTest):
# Check one final unit conversion using no /root xform at all (it's a different code path)
bpy.ops.mesh.primitive_cube_add()
ob = bpy.data.objects[0]
ob.location = (.1, .2, .3)
export_path = self.tempdir / f"usd_export_units_test_non_root.usda"
self.export_and_validate(filepath=str(export_path), convert_scene_units="CENTIMETERS", root_prim_path="")
stage = Usd.Stage.Open(str(export_path))
xf = UsdGeom.Xformable(stage.GetPrimAtPath("/Cube"))
self.assertEqual(self.round_vector(xf.GetScaleOp().Get()), [100, 100, 100])
self.assertEqual(self.round_vector(xf.GetTranslateOp().Get()), [10, 20, 30])
def test_export_native_instancing_true(self):
"""Test exporting instanced objects to native (scne graph) instances."""