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();
}
BogdanNagirniak marked this conversation as resolved Outdated

rename val -> obj_data, i_data, m_data

rename `val` -> `obj_data`, `i_data`, `m_data`
objects_.clear();
instancers_.clear();
materials_.clear_and_shrink();
@ -567,7 +566,6 @@ void BlenderSceneDelegate::remove_unused_objects()
return ret;
});
/* Remove unused materials */
std::set<pxr::SdfPath> available_materials;
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);
mat_data_ = scene_delegate_->material_data(p_id);
if (!mat_data_) {
scene_delegate_->materials_.add_overwrite(p_id, std::make_unique<MaterialData>(scene_delegate_, mat, p_id));
scene_delegate_->materials_.add_overwrite(
Vasyl-Pidhirskyi marked this conversation as resolved Outdated

seems like here should be add_new.

seems like here should be `add_new`.
p_id, std::make_unique<MaterialData>(scene_delegate_, mat, p_id));
mat_data_ = scene_delegate_->material_data(p_id);
mat_data_->init();
mat_data_->insert();

View File

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

View File

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

View File

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

View File

@ -304,8 +304,8 @@ void MeshData::write_materials()
pxr::SdfPath p_id = scene_delegate_->material_prim_id(mat);
m.mat_data = scene_delegate_->material_data(p_id);
if (!m.mat_data) {
scene_delegate_->materials_.add_overwrite(p_id,
std::make_unique<MaterialData>(scene_delegate_, mat, p_id));
scene_delegate_->materials_.add_overwrite(
Vasyl-Pidhirskyi marked this conversation as resolved Outdated

seems like here should be add_new.

seems like here should be `add_new`.

lookup_or_add_default

`lookup_or_add_default`

implemented via lookup_or_add

implemented via `lookup_or_add`
p_id, std::make_unique<MaterialData>(scene_delegate_, mat, p_id));
m.mat_data = scene_delegate_->material_data(p_id);
m.mat_data->init();
m.mat_data->insert();

View File

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