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 double motionSampleTime,
35 const pxr::UsdPrim &prim,
36 const pxr::TfToken fallback_attr_name,
39 if (attr && attr.HasAuthoredValue()) {
40 return attr.Get<
T>(r_value, motionSampleTime);
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, motionSampleTime);
55template<
typename T>
static float get_intensity(
const T &dome_light,
float motionSampleTime)
57 float intensity = 1.0f;
67static bool get_tex_path(
const T &dome_light,
float motionSampleTime, pxr::SdfAssetPath *tex_path)
78static bool get_color(
const T &dome_light,
float motionSampleTime, pxr::GfVec3f *
color)
85static pxr::TfToken
get_pole_axis(
const pxr::UsdLuxDomeLight_1 &dome_light,
float motionSampleTime)
87 pxr::TfToken pole_axis = pxr::UsdLuxTokens->scene;
89 dome_light.GetPoleAxisAttr(), motionSampleTime, dome_light.GetPrim(), {}, &pole_axis);
98 const double motionSampleTime = 0.0;
100 if (
prim_.IsA<pxr::UsdLuxDomeLight>()) {
101 pxr::UsdLuxDomeLight dome_light = pxr::UsdLuxDomeLight(
prim_);
104 dome_light, motionSampleTime, &dome_light_data.
tex_path);
106 dome_light_data.
pole_axis = pxr::UsdLuxTokens->Y;
108 else if (
prim_.IsA<pxr::UsdLuxDomeLight_1>()) {
109 pxr::UsdLuxDomeLight_1 dome_light = pxr::UsdLuxDomeLight_1(
prim_);
112 dome_light, motionSampleTime, &dome_light_data.
tex_path);
void create_object(Main *) override
const USDImportParams & import_params_
static pxr::TfToken get_pole_axis(const pxr::UsdLuxDomeLight_1 &dome_light, float motionSampleTime)
static bool get_tex_path(const T &dome_light, float motionSampleTime, pxr::SdfAssetPath *tex_path)
static bool get_color(const T &dome_light, float motionSampleTime, pxr::GfVec3f *color)
void dome_light_to_world_material(const USDImportParams ¶ms, Scene *scene, Main *bmain, const USDImportDomeLightData &dome_light_data, const pxr::UsdPrim &prim, const double motionSampleTime)
static bool get_authored_value(const pxr::UsdAttribute &attr, const double motionSampleTime, const pxr::UsdPrim &prim, const pxr::TfToken fallback_attr_name, T *r_value)
static float get_intensity(const T &dome_light, float motionSampleTime)
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