Blender V4.3
dupli_parent_finder.hh
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2020 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4#pragma once
5
7
8#include "BKE_duplilist.hh"
9
10#include <map>
11#include <set>
12
13namespace blender::io {
14
15/* Find relations between duplicated objects. This class should be instanced for a single real
16 * object, and fed its dupli-objects. */
17class DupliParentFinder final {
18 private:
19 /* To check whether an Object * is instanced by this duplicator. */
20 std::set<const Object *> dupli_set_;
21
22 /* To find the DupliObject given its Persistent ID. */
23 typedef std::map<const PersistentID, const DupliObject *> PIDToDupliMap;
24 PIDToDupliMap pid_to_dupli_;
25
26 /* Mapping from instancer PID to duplis instanced by it. */
27 typedef std::map<const PersistentID, std::set<const DupliObject *>> InstancerPIDToDuplisMap;
28 InstancerPIDToDuplisMap instancer_pid_to_duplis_;
29
30 public:
31 void insert(const DupliObject *dupli_ob);
32
33 bool is_duplicated(const Object *object) const;
34 const DupliObject *find_suitable_export_parent(const DupliObject *dupli_ob) const;
35
36 private:
37 const DupliObject *find_duplicated_parent(const DupliObject *dupli_ob) const;
38 const DupliObject *find_instancer(const DupliObject *dupli_ob) const;
39};
40
41} // namespace blender::io
const DupliObject * find_suitable_export_parent(const DupliObject *dupli_ob) const
void insert(const DupliObject *dupli_ob)
bool is_duplicated(const Object *object) const