23using used_writers = blender::Map<std::string, blender::Set<std::string>>;
27 std::string writer_type;
28 used_writers &writers_map;
30 TestHierarchyWriter(
const std::string &writer_type, used_writers &writers_map)
31 : writer_type(writer_type), writers_map(writers_map)
35 void write(HierarchyContext &context)
override
37 const char *id_name =
context.object->id.name;
38 Set<std::string> &writers = writers_map.lookup_or_add(id_name, {});
41 ADD_FAILURE() <<
"Unexpectedly found another " << writer_type <<
" writer for " << id_name
42 <<
" to export to " <<
context.export_path;
96 BlendfileLoadingBaseTest::SetUp();
125 if (!blendfile_load(
"usd" SEP_STR "usd_hierarchy_export_test.blend")) {
134 used_writers expected_transforms = {
135 {
"OBCamera", {
"/Camera"}},
136 {
"OBDupli1", {
"/Dupli1"}},
137 {
"OBDupli2", {
"/ParentOfDupli2/Dupli2"}},
139 {
"/Dupli1/GEO_Head-0/GEO_Ear_L-1",
140 "/Ground plane/OutsideDupliGrandParent/OutsideDupliParent/GEO_Head/GEO_Ear_L",
141 "/ParentOfDupli2/Dupli2/GEO_Head-0/GEO_Ear_L-1"}},
143 {
"/Dupli1/GEO_Head-0/GEO_Ear_R-2",
144 "/Ground plane/OutsideDupliGrandParent/OutsideDupliParent/GEO_Head/GEO_Ear_R",
145 "/ParentOfDupli2/Dupli2/GEO_Head-0/GEO_Ear_R-2"}},
147 {
"/Dupli1/GEO_Head-0",
148 "/Ground plane/OutsideDupliGrandParent/OutsideDupliParent/GEO_Head",
149 "/ParentOfDupli2/Dupli2/GEO_Head-0"}},
151 {
"/Dupli1/GEO_Head-0/GEO_Nose-3",
152 "/Ground plane/OutsideDupliGrandParent/OutsideDupliParent/GEO_Head/GEO_Nose",
153 "/ParentOfDupli2/Dupli2/GEO_Head-0/GEO_Nose-3"}},
154 {
"OBGround plane", {
"/Ground plane"}},
155 {
"OBOutsideDupliGrandParent", {
"/Ground plane/OutsideDupliGrandParent"}},
156 {
"OBOutsideDupliParent", {
"/Ground plane/OutsideDupliGrandParent/OutsideDupliParent"}},
157 {
"OBParentOfDupli2", {
"/ParentOfDupli2"}}};
160 used_writers expected_data = {
161 {
"OBCamera", {
"/Camera/Camera"}},
163 {
"/Dupli1/GEO_Head-0/GEO_Ear_L-1/Ear",
164 "/Ground plane/OutsideDupliGrandParent/OutsideDupliParent/GEO_Head/GEO_Ear_L/Ear",
165 "/ParentOfDupli2/Dupli2/GEO_Head-0/GEO_Ear_L-1/Ear"}},
167 {
"/Dupli1/GEO_Head-0/GEO_Ear_R-2/Ear",
168 "/Ground plane/OutsideDupliGrandParent/OutsideDupliParent/GEO_Head/GEO_Ear_R/Ear",
169 "/ParentOfDupli2/Dupli2/GEO_Head-0/GEO_Ear_R-2/Ear"}},
171 {
"/Dupli1/GEO_Head-0/Face",
172 "/Ground plane/OutsideDupliGrandParent/OutsideDupliParent/GEO_Head/Face",
173 "/ParentOfDupli2/Dupli2/GEO_Head-0/Face"}},
175 {
"/Dupli1/GEO_Head-0/GEO_Nose-3/Nose",
176 "/Ground plane/OutsideDupliGrandParent/OutsideDupliParent/GEO_Head/GEO_Nose/Nose",
177 "/ParentOfDupli2/Dupli2/GEO_Head-0/GEO_Nose-3/Nose"}},
178 {
"OBGround plane", {
"/Ground plane/Plane"}},
179 {
"OBParentOfDupli2", {
"/ParentOfDupli2/Icosphere"}},
190 iterator->transform_writers.clear();
203 if (!blendfile_load(
"usd" SEP_STR "usd_hierarchy_export_test.blend")) {
210 used_writers expected_transforms = {
211 {
"OBCamera", {
"/Camera"}},
212 {
"OBDupli1", {
"/Dupli1"}},
213 {
"OBDupli2", {
"/ParentOfDupli2/Dupli2"}},
215 {
"/Dupli1/GEO_Head-0/GEO_Ear_L-1",
216 "/Ground plane/OutsideDupliGrandParent/OutsideDupliParent/GEO_Head/GEO_Ear_L",
217 "/ParentOfDupli2/Dupli2/GEO_Head-0/GEO_Ear_L-1"}},
219 {
"/Dupli1/GEO_Head-0/GEO_Ear_R-2",
220 "/Ground plane/OutsideDupliGrandParent/OutsideDupliParent/GEO_Head/GEO_Ear_R",
221 "/ParentOfDupli2/Dupli2/GEO_Head-0/GEO_Ear_R-2"}},
223 {
"/Dupli1/GEO_Head-0",
224 "/Ground plane/OutsideDupliGrandParent/OutsideDupliParent/GEO_Head",
225 "/ParentOfDupli2/Dupli2/GEO_Head-0"}},
227 {
"/Dupli1/GEO_Head-0/GEO_Nose-3",
228 "/Ground plane/OutsideDupliGrandParent/OutsideDupliParent/GEO_Head/GEO_Nose",
229 "/ParentOfDupli2/Dupli2/GEO_Head-0/GEO_Nose-3"}},
230 {
"OBGround plane", {
"/Ground plane"}},
231 {
"OBOutsideDupliGrandParent", {
"/Ground plane/OutsideDupliGrandParent"}},
232 {
"OBOutsideDupliParent", {
"/Ground plane/OutsideDupliGrandParent/OutsideDupliParent"}},
233 {
"OBParentOfDupli2", {
"/ParentOfDupli2"}}};
235 used_writers expected_data = {
236 {
"OBCamera", {
"/Camera/Camera"}},
238 {
"/Dupli1/GEO_Head-0/GEO_Ear_L-1/Ear",
239 "/Ground plane/OutsideDupliGrandParent/OutsideDupliParent/GEO_Head/GEO_Ear_L/Ear",
240 "/ParentOfDupli2/Dupli2/GEO_Head-0/GEO_Ear_L-1/Ear"}},
242 {
"/Dupli1/GEO_Head-0/GEO_Ear_R-2/Ear",
243 "/Ground plane/OutsideDupliGrandParent/OutsideDupliParent/GEO_Head/GEO_Ear_R/Ear",
244 "/ParentOfDupli2/Dupli2/GEO_Head-0/GEO_Ear_R-2/Ear"}},
246 {
"/Dupli1/GEO_Head-0/Face",
247 "/Ground plane/OutsideDupliGrandParent/OutsideDupliParent/GEO_Head/Face",
248 "/ParentOfDupli2/Dupli2/GEO_Head-0/Face"}},
250 {
"/Dupli1/GEO_Head-0/GEO_Nose-3/Nose",
251 "/Ground plane/OutsideDupliGrandParent/OutsideDupliParent/GEO_Head/GEO_Nose/Nose",
252 "/ParentOfDupli2/Dupli2/GEO_Head-0/GEO_Nose-3/Nose"}},
253 {
"OBGround plane", {
"/Ground plane/Plane"}},
254 {
"OBParentOfDupli2", {
"/ParentOfDupli2/Icosphere"}},
262 export_subset.
shapes =
false;
263 iterator->set_export_subset(export_subset);
270 iterator->transform_writers.clear();
279 iterator->transform_writers.clear();
286 export_subset.
shapes =
true;
287 iterator->set_export_subset(export_subset);
294 iterator->transform_writers.clear();
301 export_subset.
shapes =
true;
302 iterator->set_export_subset(export_subset);
315 bfile->main,
bfile->curscene,
bfile->cur_view_layer, depsgraph_evaluation_mode);
323 if (!blendfile_load(
"alembic" SEP_STR "visibility.blend")) {
332 used_writers expected_transforms = {{
"OBInvisibleAnimatedCube", {
"/InvisibleAnimatedCube"}},
333 {
"OBInvisibleCube", {
"/InvisibleCube"}},
334 {
"OBVisibleCube", {
"/VisibleCube"}}};
337 used_writers expected_data = {{
"OBInvisibleAnimatedCube", {
"/InvisibleAnimatedCube/Cube"}},
338 {
"OBInvisibleCube", {
"/InvisibleCube/Cube"}},
339 {
"OBVisibleCube", {
"/VisibleCube/Cube"}}};
void BKE_scene_graph_update_tagged(Depsgraph *depsgraph, Main *bmain)
EXPECT_EQ(BLI_expr_pylike_eval(expr, nullptr, 0, &result), EXPR_PYLIKE_INVALID)
external readfile function prototypes.
Depsgraph * DEG_graph_new(Main *bmain, Scene *scene, ViewLayer *view_layer, eEvaluationMode mode)
void DEG_graph_build_for_all_objects(Depsgraph *graph)
Object is a sort of wrapper for general info.
BPy_StructRNA * depsgraph
struct Depsgraph * depsgraph
struct BlendFileData * bfile
bool contains(const Key &key) const
void add_new(const Key &key)
void depsgraph_create(eEvaluationMode depsgraph_evaluation_mode) override
TestingHierarchyIterator * iterator
AbstractHierarchyIterator(Main *bmain, Depsgraph *depsgraph)
void release_writer(AbstractHierarchyWriter *writer) override
AbstractHierarchyWriter * create_transform_writer(const HierarchyContext *) override
used_writers transform_writers
~TestingHierarchyIterator() override
AbstractHierarchyWriter * create_hair_writer(const HierarchyContext *) override
AbstractHierarchyWriter * create_data_writer(const HierarchyContext *) override
TestingHierarchyIterator(Main *bmain, Depsgraph *depsgraph)
AbstractHierarchyWriter * create_particle_writer(const HierarchyContext *) override
used_writers particle_writers
used_writers hair_writers
used_writers data_writers
int context(const bContext *C, const char *member, bContextDataResult *result)
TEST_F(AbstractHierarchyIteratorTest, ExportHierarchyTest)