@@ -11,8 +11,9 @@ __pragma(warning(push)) __pragma(warning(disable : 4003))
1111#endif
1212
1313// Note: variable names should match the USD token names as closely as possible, with special characters converted to underscores
14+ // Split into multiple sequences to avoid MSVC C1009 "macros nested too deeply" error
1415
15- #define USD_TOKENS \
16+ #define USD_TOKENS_1 \
1617 (base_color_texture) \
1718 (cesium_base_color_texture_float4) \
1819 (cesium_feature_id_int) \
@@ -63,7 +64,9 @@ __pragma(warning(push)) __pragma(warning(disable : 4003))
6364 (cesium_property_int) \
6465 (cesium_property_int2) \
6566 (cesium_property_int3) \
66- (cesium_property_int4) \
67+ (cesium_property_int4)
68+
69+ #define USD_TOKENS_2 \
6770 (clipping_raster_overlay_resolver) \
6871 (doubleSided) \
6972 (extent) \
@@ -113,7 +116,9 @@ __pragma(warning(push)) __pragma(warning(disable : 4003))
113116 ((inputs_maximum_value, " inputs:maximum_value" )) \
114117 ((inputs_metallic_factor, " inputs:metallic_factor" )) \
115118 ((inputs_no_data, " inputs:no_data" )) \
116- ((inputs_null_feature_id, " inputs:null_feature_id" )) \
119+ ((inputs_null_feature_id, " inputs:null_feature_id" ))
120+
121+ #define USD_TOKENS_3 \
117122 ((inputs_offset, " inputs:offset" )) \
118123 ((inputs_primvar_name, " inputs:primvar_name" )) \
119124 ((inputs_property_id, " inputs:property_id" )) \
@@ -159,20 +164,37 @@ __pragma(warning(push)) __pragma(warning(disable : 4003))
159164#pragma clang diagnostic ignored "-Wgnu-zero-variadic-macro-arguments"
160165#endif
161166
162- TF_DECLARE_PUBLIC_TOKENS (UsdTokens, USD_TOKENS);
167+ TF_DECLARE_PUBLIC_TOKENS (UsdTokens1, USD_TOKENS_1);
168+ TF_DECLARE_PUBLIC_TOKENS (UsdTokens2, USD_TOKENS_2);
169+ TF_DECLARE_PUBLIC_TOKENS (UsdTokens3, USD_TOKENS_3);
163170
164171#ifdef CESIUM_OMNI_CLANG
165172#pragma clang diagnostic pop
166173#endif
167174
168- #define FABRIC_DEFINE_TOKEN_ELEM (elem ) const omni::fabric::TokenC elem = omni::fabric::asInt(pxr::UsdTokens->elem);
175+ // Macros for defining FabricTokens from each UsdTokens struct
176+ #define FABRIC_DEFINE_TOKEN_ELEM_1 (elem ) const omni::fabric::TokenC elem = omni::fabric::asInt(pxr::UsdTokens1->elem);
177+ #define FABRIC_DEFINE_TOKEN_ELEM_2 (elem ) const omni::fabric::TokenC elem = omni::fabric::asInt(pxr::UsdTokens2->elem);
178+ #define FABRIC_DEFINE_TOKEN_ELEM_3 (elem ) const omni::fabric::TokenC elem = omni::fabric::asInt(pxr::UsdTokens3->elem);
179+
180+ #define FABRIC_DEFINE_TOKEN_1 (r, elem ) \
181+ TF_PP_TUPLE_ELEM (0 , _TF_PP_IFF(TF_PP_IS_TUPLE(elem), \
182+ (FABRIC_DEFINE_TOKEN_ELEM_1(TF_PP_TUPLE_ELEM(0 , elem))), \
183+ (FABRIC_DEFINE_TOKEN_ELEM_1(elem))))
184+
185+ #define FABRIC_DEFINE_TOKEN_2 (r, elem ) \
186+ TF_PP_TUPLE_ELEM (0 , _TF_PP_IFF(TF_PP_IS_TUPLE(elem), \
187+ (FABRIC_DEFINE_TOKEN_ELEM_2(TF_PP_TUPLE_ELEM(0 , elem))), \
188+ (FABRIC_DEFINE_TOKEN_ELEM_2(elem))))
169189
170- #define FABRIC_DEFINE_TOKEN (r, elem ) \
190+ #define FABRIC_DEFINE_TOKEN_3 (r, elem ) \
171191 TF_PP_TUPLE_ELEM (0 , _TF_PP_IFF(TF_PP_IS_TUPLE(elem), \
172- (FABRIC_DEFINE_TOKEN_ELEM (TF_PP_TUPLE_ELEM(0 , elem))), \
173- (FABRIC_DEFINE_TOKEN_ELEM (elem))))
192+ (FABRIC_DEFINE_TOKEN_ELEM_3 (TF_PP_TUPLE_ELEM(0 , elem))), \
193+ (FABRIC_DEFINE_TOKEN_ELEM_3 (elem))))
174194
175- #define FABRIC_DEFINE_TOKENS (seq ) TF_PP_SEQ_FOR_EACH(FABRIC_DEFINE_TOKEN, ~, seq)
195+ #define FABRIC_DEFINE_TOKENS_1 (seq ) TF_PP_SEQ_FOR_EACH(FABRIC_DEFINE_TOKEN_1, ~, seq)
196+ #define FABRIC_DEFINE_TOKENS_2 (seq ) TF_PP_SEQ_FOR_EACH(FABRIC_DEFINE_TOKEN_2, ~, seq)
197+ #define FABRIC_DEFINE_TOKENS_3 (seq ) TF_PP_SEQ_FOR_EACH(FABRIC_DEFINE_TOKEN_3, ~, seq)
176198
177199#define FABRIC_DECLARE_TOKEN_ELEM (elem ) extern const omni::fabric::TokenC elem;
178200
@@ -190,7 +212,9 @@ __pragma(warning(pop))
190212PXR_NAMESPACE_CLOSE_SCOPE
191213
192214namespace cesium ::omniverse::FabricTokens {
193- FABRIC_DECLARE_TOKENS (USD_TOKENS);
215+ FABRIC_DECLARE_TOKENS (USD_TOKENS_1);
216+ FABRIC_DECLARE_TOKENS (USD_TOKENS_2);
217+ FABRIC_DECLARE_TOKENS (USD_TOKENS_3);
194218
195219const omni::fabric::TokenC feature_id_n (uint64_t index);
196220const omni::fabric::TokenC raster_overlay_n (uint64_t index);
0 commit comments