9#include <pxr/usd/usdLux/domeLight.h>
10#include <pxr/usd/usdLux/domeLight_1.h>
11#include <pxr/usd/usdLux/tokens.h>
17static const pxr::TfToken
color(
"color", pxr::TfToken::Immortal);
18static const pxr::TfToken
intensity(
"intensity", pxr::TfToken::Immortal);
19static const pxr::TfToken
texture_file(
"texture:file", pxr::TfToken::Immortal);
20static const pxr::TfToken
pole_axis(
"poleAxis", pxr::TfToken::Immortal);
37 const pxr::UsdTimeCode time,
38 const pxr::UsdPrim &prim,
39 const pxr::TfToken fallback_attr_name,
42 if (attr && attr.HasAuthoredValue()) {
43 return attr.Get<
T>(r_value, time);
46 if (!prim || fallback_attr_name.IsEmpty()) {
50 pxr::UsdAttribute fallback_attr = prim.GetAttribute(fallback_attr_name);
51 if (fallback_attr && fallback_attr.HasAuthoredValue()) {
52 return fallback_attr.Get<
T>(r_value, time);
58template<
typename T>
static float get_intensity(
const T &dome_light,
const pxr::UsdTimeCode time)
60 float intensity = 1.0f;
68 const pxr::UsdTimeCode time,
69 pxr::SdfAssetPath *tex_path)
80static bool get_color(
const T &dome_light,
const pxr::UsdTimeCode time, pxr::GfVec3f *
color)
90static pxr::TfToken
get_pole_axis(
const pxr::UsdLuxDomeLight_1 &dome_light,
91 const pxr::UsdTimeCode time)
93 pxr::TfToken pole_axis = pxr::UsdLuxTokens->scene;
94 get_authored_value(dome_light.GetPoleAxisAttr(), time, dome_light.GetPrim(), {}, &pole_axis);
103 constexpr pxr::UsdTimeCode time = 0.0;
105 if (
prim_.IsA<pxr::UsdLuxDomeLight>()) {
106 pxr::UsdLuxDomeLight dome_light = pxr::UsdLuxDomeLight(
prim_);
110 dome_light_data.
pole_axis = pxr::UsdLuxTokens->Y;
112 else if (
prim_.IsA<pxr::UsdLuxDomeLight_1>()) {
113 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)
void colorspace_attr_to_scene_linear(const pxr::UsdAttribute &attr, 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 texture_file("texture:file", pxr::TfToken::Immortal)
static const pxr::TfToken pole_axis("poleAxis", pxr::TfToken::Immortal)
static const pxr::TfToken intensity("intensity", pxr::TfToken::Immortal)
static const pxr::TfToken color("color", pxr::TfToken::Immortal)
pxr::SdfAssetPath tex_path