Move to use blender::Map container instead std::unordered_map #47

Merged
Bogdan Nagirniak merged 17 commits from Vasyl-Pidhirskyi/blender_bn:BLEN-418 into hydra-render 2023-06-02 12:02:46 +02:00
8 changed files with 39 additions and 42 deletions
Showing only changes of commit f603bf3e02 - Show all commits

View File

@ -218,7 +218,6 @@ void BlenderSceneDelegate::clear()
it->remove(); it->remove();
} }
objects_.clear(); objects_.clear();
instancers_.clear(); instancers_.clear();
materials_.clear_and_shrink(); materials_.clear_and_shrink();
@ -567,7 +566,6 @@ void BlenderSceneDelegate::remove_unused_objects()
return ret; return ret;
}); });
/* Remove unused materials */ /* Remove unused materials */
std::set<pxr::SdfPath> available_materials; std::set<pxr::SdfPath> available_materials;
for (auto &it : objects_.values()) { for (auto &it : objects_.values()) {

View File

@ -199,7 +199,8 @@ void CurvesData::write_material()
pxr::SdfPath p_id = scene_delegate_->material_prim_id(mat); pxr::SdfPath p_id = scene_delegate_->material_prim_id(mat);
mat_data_ = scene_delegate_->material_data(p_id); mat_data_ = scene_delegate_->material_data(p_id);
if (!mat_data_) { if (!mat_data_) {
scene_delegate_->materials_.add_overwrite(p_id, std::make_unique<MaterialData>(scene_delegate_, mat, p_id)); scene_delegate_->materials_.add_overwrite(
p_id, std::make_unique<MaterialData>(scene_delegate_, mat, p_id));
mat_data_ = scene_delegate_->material_data(p_id); mat_data_ = scene_delegate_->material_data(p_id);
mat_data_->init(); mat_data_->init();
mat_data_->insert(); mat_data_->insert();

View File

@ -7,8 +7,8 @@
#include <pxr/base/vt/value.h> #include <pxr/base/vt/value.h>
#include <pxr/usd/sdf/path.h> #include <pxr/usd/sdf/path.h>
#include "DNA_ID.h"
#include "BLI_hash.hh" #include "BLI_hash.hh"
#include "DNA_ID.h"
template<> struct blender::DefaultHash<pxr::SdfPath> { template<> struct blender::DefaultHash<pxr::SdfPath> {
uint64_t operator()(const pxr::SdfPath &value) const uint64_t operator()(const pxr::SdfPath &value) const

View File

@ -62,7 +62,6 @@ class InstancerData : public ObjectData {
pxr::VtMatrix4dArray mesh_transforms_; pxr::VtMatrix4dArray mesh_transforms_;
}; };
using InstancerDataMap = using InstancerDataMap = Map<pxr::SdfPath, std::unique_ptr<InstancerData>>;
Map<pxr::SdfPath, std::unique_ptr<InstancerData>>;
} // namespace blender::render::hydra } // namespace blender::render::hydra

View File

@ -7,8 +7,8 @@
#include <pxr/usd/sdf/assetPath.h> #include <pxr/usd/sdf/assetPath.h>
#include <pxr/usd/sdf/path.h> #include <pxr/usd/sdf/path.h>
#include "DNA_material_types.h"
#include "BLI_map.hh" #include "BLI_map.hh"
#include "DNA_material_types.h"
#include "id.h" #include "id.h"

View File

@ -304,8 +304,8 @@ void MeshData::write_materials()
pxr::SdfPath p_id = scene_delegate_->material_prim_id(mat); pxr::SdfPath p_id = scene_delegate_->material_prim_id(mat);
m.mat_data = scene_delegate_->material_data(p_id); m.mat_data = scene_delegate_->material_data(p_id);
if (!m.mat_data) { if (!m.mat_data) {
scene_delegate_->materials_.add_overwrite(p_id, scene_delegate_->materials_.add_overwrite(
std::make_unique<MaterialData>(scene_delegate_, mat, p_id)); p_id, std::make_unique<MaterialData>(scene_delegate_, mat, p_id));
m.mat_data = scene_delegate_->material_data(p_id); m.mat_data = scene_delegate_->material_data(p_id);
m.mat_data->init(); m.mat_data->init();
m.mat_data->insert(); m.mat_data->insert();

View File

@ -7,8 +7,8 @@
#include <pxr/base/gf/matrix4d.h> #include <pxr/base/gf/matrix4d.h>
#include "BKE_layer.h" #include "BKE_layer.h"
#include "DNA_object_types.h"
#include "BLI_map.hh" #include "BLI_map.hh"
#include "DNA_object_types.h"
#include "id.h" #include "id.h"
#include "material.h" #include "material.h"
@ -37,8 +37,7 @@ class ObjectData : public IdData {
Object *parent_ = nullptr; Object *parent_ = nullptr;
}; };
using ObjectDataMap = using ObjectDataMap = Map<pxr::SdfPath, std::unique_ptr<ObjectData>>;
Map<pxr::SdfPath, std::unique_ptr<ObjectData>>;
pxr::GfMatrix4d gf_matrix_from_transform(float m[4][4]); pxr::GfMatrix4d gf_matrix_from_transform(float m[4][4]);