Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 52 additions & 13 deletions .github/workflows/create-usd-release.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
# Workflow to build USD versions required to run the usd plugins
# this assumes there is a Release created called USD Artifacts
# This assumes there is a Release created called USD Artifacts
name: Create USD Release
run-name: Create USD Release v${{ github.event.inputs.usd_version }}

on:
workflow_dispatch:
inputs:
usd_version:
description: 'USD Version to build'
description: "USD Version to build"
required: true
default: '2405'
default: "2405"

jobs:
prepare-matrix:
Expand All @@ -36,24 +36,24 @@ jobs:
os: ${{ fromJson(needs.prepare-matrix.outputs.matrix) }}
steps:
- uses: actions/checkout@v4
- uses: ilammy/msvc-dev-cmd@v1

- name: Check if artifact exists in 'USD-${{ github.event.inputs.usd_version }}-Artifacts' Release
id: check_artifact
shell: pwsh
run: |
$usd_version="${{ github.event.inputs.usd_version }}"
$usdFormattedVersion="$($usd_version.Substring(0,2)).$($usd_version.Substring(2))"
$usd_version = "${{ github.event.inputs.usd_version }}"
$usdFormattedVersion = "$($usd_version.Substring(0,2)).$($usd_version.Substring(2))"
"USD_FORMATTED_VERSION=$usdFormattedVersion" | Out-File -FilePath $env:GITHUB_ENV -Append
$releaseName="USD-${{ github.event.inputs.usd_version }}-Artifacts"
$ASSET_NAME="usd-${{ github.event.inputs.usd_version }}-${{ matrix.os }}.zip"
$releaseName = "USD-${usd_version}-Artifacts"
$ASSET_NAME = "usd-${usd_version}-${{ matrix.os }}.zip"
$releaseExists = $false
$stderr = $null
$releaseView = gh release view $releaseName 2>&1 | Tee-Object -Variable stderr
if ($stderr -match "release not found") {
$releaseExists = $false
"exists=false" | Out-File -FilePath $env:GITHUB_ENV -Append
Write-Output "Release not found: $releaseName -- Creating new one"
gh release create $releaseName --notes "USD built with the following parameters: --build-shared --openimageio --tools --python --debug-python --usd-imaging --build-variant release --use-cxx11-abi=0 (linux)"
gh release create "$releaseName" --title "$releaseName" --notes "USD built with the following parameters: --build-shared --openimageio --tools --python --debug-python --usd-imaging --build-variant release --use-cxx11-abi=0 (linux)"
} else {
$releaseExists = $true
}
Expand All @@ -75,11 +75,11 @@ jobs:
if: env.exists == 'false'
uses: actions/setup-python@v5
with:
python-version: '3.10.11'
python-version: "3.10.11"
id: setup-python

- name: Install Ninja (Cross-platform)
if: env.exists == 'false'
- name: Install Ninja (Unix)
if: env.exists == 'false' && matrix.os != 'windows-2022'
run: |
python -m pip install ninja

Expand Down Expand Up @@ -114,9 +114,46 @@ jobs:

- name: Install Python Dependencies
if: env.exists == 'false'
shell: pwsh
run: |
python -m pip install PySide6
python -m pip install pyopengl
if ("${{runner.os}}" -eq "Windows") {
python -m pip install jinja2
}

# New Step: Patch build_usd.py to override IsVisualStudioVersionOrGreater
- name: Patch build_usd.py to Always Return True on Windows
if: env.exists == 'false' && matrix.os == 'windows-2022'
shell: pwsh
run: |
# Define the path to build_usd.py
$buildUsdPath = "OpenUSD/build_scripts/build_usd.py"

# Verify that build_usd.py exists
if (-Not (Test-Path $buildUsdPath)) {
Write-Error "build_usd.py not found at path: $buildUsdPath"
exit 1
}

# Read the entire content of build_usd.py
$content = Get-Content -Path $buildUsdPath -Raw

# Define the new function as a here-string
$newFunction = @"
def IsVisualStudioVersionOrGreater(desiredVersion):
if not Windows():
return False
return True
"@

# Define a regex pattern to match the existing function
$pattern = '(?s)def\s+IsVisualStudioVersionOrGreater\(desiredVersion\):.*?return False'

# Perform the replacement and write the updated content back to build_usd.py
$updatedContent = $content -replace $pattern, $newFunction
Set-Content -Path $buildUsdPath -Value $updatedContent
Write-Output "Successfully patched IsVisualStudioVersionOrGreater in build_usd.py"

- name: Build USD
if: env.exists == 'false'
Expand All @@ -128,7 +165,9 @@ jobs:
$env:LD_LIBRARY_PATH = "/usr/local/lib;$env:LD_LIBRARY_PATH"
$abi_arg = ""
$generator = "--generator Ninja"

if ("${{runner.os}}" -eq "Windows") {
$generator = '--generator "Visual Studio 17 2022"'
$fileContent = Get-Content $file -Raw
$fileContent = $fileContent -replace ' -- \{multiproc\}', ''
Set-Content $file -Value $fileContent
Expand Down Expand Up @@ -196,7 +235,7 @@ jobs:
if: env.exists == 'false'
shell: pwsh
run: |
$ARTIFACT_PATH="${{ github.workspace }}/usd-${{ github.event.inputs.usd_version }}-${{ matrix.os }}.zip"
$ARTIFACT_PATH = "${{ github.workspace }}/usd-${{ github.event.inputs.usd_version }}-${{ matrix.os }}.zip"
if (-Not (Test-Path $ARTIFACT_PATH)) {
Write-Output "$ARTIFACT_PATH does not exist."
}
Expand Down
2 changes: 0 additions & 2 deletions obj/src/obj.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@ governing permissions and limitations under the License.
#include "obj.h"
#include "debugCodes.h"
#include <algorithm>
#include <boost/algorithm/string/erase.hpp>
#include <boost/algorithm/string/trim.hpp>
#include <charconv>
#include <common.h>
#include <cstdio>
Expand Down
4 changes: 2 additions & 2 deletions obj/src/objExport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ exportMesh(Obj& obj,
}
g.vertices = m.points;
for (GfVec3f& v : g.vertices) {
v = worldTransform.Transform(v);
v = GfVec3f(worldTransform.Transform(v));
}
if (m.colors.size()) {
const Primvar<PXR_NS::GfVec3f>& color = m.colors[0]; // only export first color set
Expand All @@ -148,7 +148,7 @@ exportMesh(Obj& obj,
g.normals = m.normals.values;
auto normalTransform = worldTransform.GetInverse().GetTranspose();
for (GfVec3f& v : g.normals) {
v = normalTransform.TransformDir(v);
v = GfVec3f(normalTransform.TransformDir(v));
v.Normalize();
}
if (m.subsets.size()) {
Expand Down
4 changes: 2 additions & 2 deletions ply/src/plyExport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -178,10 +178,10 @@ aggregateMeshInstance(PlyTotalMesh& totalMesh,
}

for (size_t i = 0; i < currentMeshPointsSize; i++) {
totalMesh.points[pointsOffset + i] = modelMatrix.Transform(mesh.points[i]);
totalMesh.points[pointsOffset + i] = GfVec3f(modelMatrix.Transform(mesh.points[i]));
}
for (size_t i = 0; i < mesh.normals.values.size(); i++) {
totalMesh.normals[normalsOffset + i] = normalMatrix.TransformDir(mesh.normals.values[i]);
totalMesh.normals[normalsOffset + i] = GfVec3f(normalMatrix.TransformDir(mesh.normals.values[i]));
totalMesh.normals[normalsOffset + i].Normalize();
}
for (size_t i = 0; i < mesh.uvs.values.size(); i++) {
Expand Down
2 changes: 1 addition & 1 deletion stl/src/stlExport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ exportStl(const ExportStlOptions& options, const UsdData& usd, StlModel& stl)
StlVec3f vertex;
const int vertex_index = meshIndices[i + j];
const PXR_NS::GfVec3f& vertex_data = mesh.points[vertex_index];
const PXR_NS::GfVec3f transformedPoint = worldTransform.Transform(vertex_data);
const PXR_NS::GfVec3f transformedPoint = GfVec3f(worldTransform.Transform(vertex_data));
vertex = { transformedPoint[0], transformedPoint[1], transformedPoint[2] };
facet.vertices[j] = vertex;
}
Expand Down
10 changes: 9 additions & 1 deletion test/full_versions.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,20 @@
{"os": "windows-2022", "usd_version": "2308"},
{"os": "windows-2022", "usd_version": "2311"},
{"os": "windows-2022", "usd_version": "2405"},
{"os": "windows-2022", "usd_version": "2408"},
{"os": "windows-2022", "usd_version": "2411"},
{"os": "macOS-13", "usd_version": "2308"},
{"os": "macOS-13", "usd_version": "2311"},
{"os": "macOS-13", "usd_version": "2405"},
{"os": "macOS-13", "usd_version": "2408"},
{"os": "macOS-13", "usd_version": "2411"},
{"os": "macOS-14", "usd_version": "2405"},
{"os": "macOS-14", "usd_version": "2408"},
{"os": "macOS-14", "usd_version": "2411"},
{"os": "ubuntu-22.04", "usd_version": "2308"},
{"os": "ubuntu-22.04", "usd_version": "2311"},
{"os": "ubuntu-22.04", "usd_version": "2405"}
{"os": "ubuntu-22.04", "usd_version": "2405"},
{"os": "ubuntu-22.04", "usd_version": "2408"},
{"os": "ubuntu-22.04", "usd_version": "2411"}
]
}
9 changes: 5 additions & 4 deletions test/pr_versions.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
{
"include": [
{"os": "windows-2022", "usd_version": "2308"},
{"os": "windows-2022", "usd_version": "2405"},
{"os": "windows-2022", "usd_version": "2411"},
{"os": "macOS-13", "usd_version": "2308"},
{"os": "macOS-13", "usd_version": "2405"},
{"os": "macOS-14", "usd_version": "2405"},
{"os": "macOS-13", "usd_version": "2411"},
{"os": "macOS-14", "usd_version": "2408"},
{"os": "macOS-14", "usd_version": "2411"},
{"os": "ubuntu-22.04", "usd_version": "2308"},
{"os": "ubuntu-22.04", "usd_version": "2405"}
{"os": "ubuntu-22.04", "usd_version": "2411"}
]
}