8#include <pxr/usd/usdLux/domeLight.h>
9#include <pxr/usd/usdLux/domeLight_1.h>
10#include <pxr/usd/usdLux/tokens.h>
14static const pxr::TfToken
color(
"color", pxr::TfToken::Immortal);
15static const pxr::TfToken
intensity(
"intensity", pxr::TfToken::Immortal);
16static const pxr::TfToken
texture_file(
"texture:file", pxr::TfToken::Immortal);
17static const pxr::TfToken
pole_axis(
"poleAxis", pxr::TfToken::Immortal);
34 const pxr::UsdTimeCode time,
35 const pxr::UsdPrim &prim,
36 const pxr::TfToken fallback_attr_name,
39 if (attr && attr.HasAuthoredValue()) {
40 return attr.Get<
T>(r_value, time);
43 if (!prim || fallback_attr_name.IsEmpty()) {
47 pxr::UsdAttribute fallback_attr = prim.GetAttribute(fallback_attr_name);
48 if (fallback_attr && fallback_attr.HasAuthoredValue()) {
49 return fallback_attr.Get<
T>(r_value, time);
55template<
typename T>
static float get_intensity(
const T &dome_light,
const pxr::UsdTimeCode time)
57 float intensity = 1.0f;
65 const pxr::UsdTimeCode time,
66 pxr::SdfAssetPath *tex_path)
77static bool get_color(
const T &dome_light,
const pxr::UsdTimeCode time, pxr::GfVec3f *
color)
84static pxr::TfToken
get_pole_axis(
const pxr::UsdLuxDomeLight_1 &dome_light,
85 const pxr::UsdTimeCode time)
87 pxr::TfToken pole_axis = pxr::UsdLuxTokens->scene;
88 get_authored_value(dome_light.GetPoleAxisAttr(), time, dome_light.GetPrim(), {}, &pole_axis);
97 constexpr pxr::UsdTimeCode time = 0.0;
99 if (
prim_.IsA<pxr::UsdLuxDomeLight>()) {
100 pxr::UsdLuxDomeLight dome_light = pxr::UsdLuxDomeLight(
prim_);
104 dome_light_data.
pole_axis = pxr::UsdLuxTokens->Y;
106 else if (
prim_.IsA<pxr::UsdLuxDomeLight_1>()) {
107 pxr::UsdLuxDomeLight_1 dome_light = pxr::UsdLuxDomeLight_1(
prim_);
void create_object(Main *) override
const USDImportParams & import_params_
static pxr::TfToken get_pole_axis(const pxr::UsdLuxDomeLight_1 &dome_light, const pxr::UsdTimeCode time)
void dome_light_to_world_material(const USDImportParams ¶ms, Scene *scene, Main *bmain, const USDImportDomeLightData &dome_light_data, const pxr::UsdPrim &prim, const pxr::UsdTimeCode time)
static bool get_color(const T &dome_light, const pxr::UsdTimeCode time, pxr::GfVec3f *color)
static bool get_authored_value(const pxr::UsdAttribute &attr, const pxr::UsdTimeCode time, const pxr::UsdPrim &prim, const pxr::TfToken fallback_attr_name, T *r_value)
static bool get_tex_path(const T &dome_light, const pxr::UsdTimeCode time, pxr::SdfAssetPath *tex_path)
static float get_intensity(const T &dome_light, const pxr::UsdTimeCode time)
static const pxr::TfToken intensity("intensity", pxr::TfToken::Immortal)
static const pxr::TfToken texture_file("texture:file", pxr::TfToken::Immortal)
static const pxr::TfToken pole_axis("poleAxis", pxr::TfToken::Immortal)
static const pxr::TfToken color("color", pxr::TfToken::Immortal)
pxr::SdfAssetPath tex_path