Skip to content
This repository was archived by the owner on Jun 6, 2024. It is now read-only.

Commit c0398df

Browse files
author
root
committed
Add support for USD version >= 21.05
1 parent 6d288cc commit c0398df

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

convert/converter.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -479,7 +479,7 @@ void Converter::CreateDebugBoneMesh(const SdfPath& parent_path,
479479
material_path.AppendElementString("pbr_shader");
480480
UsdShadeShader pbr_shader = UsdShadeShader::Define(stage, pbr_shader_path);
481481
pbr_shader.CreateIdAttr(VtValue(kTokPreviewSurface));
482-
usd_material.CreateSurfaceOutput().ConnectToSource(pbr_shader, kTokSurface);
482+
usd_material.CreateSurfaceOutput().ConnectToSource(pbr_shader.ConnectableAPI(), kTokSurface);
483483
pbr_shader.CreateInput(kTokInputUseSpecular, SdfValueTypeNames->Int).Set(1);
484484
pbr_shader.CreateInput(kTokInputSpecularColor, SdfValueTypeNames->Color3f)
485485
.Set(kColorBlack);

convert/materializer.cc

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ const Materializer::Value& Materializer::FindOrCreate(Gltf::Id material_id) {
8686
UsdShadeShader pbr_shader =
8787
UsdShadeShader::Define(cc_->stage, pbr_shader_path);
8888
pbr_shader.CreateIdAttr(VtValue(kTokPreviewSurface));
89-
value.material.CreateSurfaceOutput().ConnectToSource(pbr_shader, kTokSurface);
89+
value.material.CreateSurfaceOutput().ConnectToSource(pbr_shader.ConnectableAPI(), kTokSurface);
9090

9191
if (material.unlit) {
9292
AttachUnlitTextureInputs(
@@ -241,7 +241,7 @@ UsdShadeShader Materializer::CreateTextureShader(
241241
const auto uvset_found = uvsets.find(uvset_index);
242242
UFG_ASSERT_LOGIC(uvset_found != uvsets.end());
243243
tex.CreateInput(kTokSt, SdfValueTypeNames->Float2)
244-
.ConnectToSource(uvset_found->second.shader, kTokResult);
244+
.ConnectToSource(uvset_found->second.shader.ConnectableAPI(), kTokResult);
245245

246246
// Set sampler states.
247247
Gltf::Sampler::WrapMode wrap_s =
@@ -331,7 +331,7 @@ template <typename Vec>void Materializer::AttachTextureInputTo(
331331
.Set(ToVec4(scale));
332332
}
333333
tex.CreateOutput(connect_tok, output_type);
334-
in.ConnectToSource(tex, connect_tok);
334+
in.ConnectToSource(tex.ConnectableAPI(), connect_tok);
335335
}
336336

337337

@@ -407,7 +407,7 @@ void Materializer::AttachBaseTextureInput(
407407
}
408408
tex.CreateOutput(kTokRgb, SdfValueTypeNames->Float3);
409409
tex.CreateOutput(kTokA, SdfValueTypeNames->Float);
410-
in.ConnectToSource(tex, kTokRgb);
410+
in.ConnectToSource(tex.ConnectableAPI(), kTokRgb);
411411
} else {
412412
in.Set(uvset_valid ? tex_args.scale.ToVec3() : ToVec3(kFallbackBase));
413413
}
@@ -430,7 +430,7 @@ void Materializer::AttachBaseTextureInput(
430430
// into the texture.
431431
in_opacity.Set(tex_args.opacity);
432432
} else {
433-
in_opacity.ConnectToSource(tex, kTokA);
433+
in_opacity.ConnectToSource(tex.ConnectableAPI(), kTokA);
434434
}
435435
} else {
436436
// The scale alpha value is 1 if we are baking the baseColorFactor into
@@ -515,7 +515,7 @@ void Materializer::AttachUnlitTextureInputs(
515515
}
516516
tex.CreateOutput(kTokRgb, SdfValueTypeNames->Float3);
517517
tex.CreateOutput(kTokA, SdfValueTypeNames->Float);
518-
emissive_in.ConnectToSource(tex, kTokRgb);
518+
emissive_in.ConnectToSource(tex.ConnectableAPI(), kTokRgb);
519519
} else {
520520
emissive_in.Set(uvset_valid ? tex_args.scale.ToVec3()
521521
: ToVec3(kFallbackBase));
@@ -561,8 +561,8 @@ void Materializer::AttachUnlitTextureInputs(
561561
}
562562
tex.CreateOutput(kTokRgb, SdfValueTypeNames->Float3);
563563
tex.CreateOutput(kTokA, SdfValueTypeNames->Float);
564-
diffuse_in.ConnectToSource(tex, kTokRgb);
565-
opacity_in.ConnectToSource(tex, kTokA);
564+
diffuse_in.ConnectToSource(tex.ConnectableAPI(), kTokRgb);
565+
opacity_in.ConnectToSource(tex.ConnectableAPI(), kTokA);
566566
} else {
567567
diffuse_in.Set(kColorBlack);
568568
opacity_in.Set(opacity_scale);

0 commit comments

Comments
 (0)