Fix review comments #51

Merged
Bogdan Nagirniak merged 15 commits from BLEN-430 into hydra-render 2023-06-08 18:10:55 +02:00
4 changed files with 9 additions and 8 deletions
Showing only changes of commit ec7212792f - Show all commits

View File

@ -241,9 +241,9 @@ void BlenderSceneDelegate::set_setting(const std::string &key, const pxr::VtValu
pxr::SdfPath BlenderSceneDelegate::prim_id(ID *id, const char *prefix) const
{
/* Making id of object in form like <prefix>_<pointer in 16 hex digits format> */
char str[32];
snprintf(str, 32, "%s_%016llx", prefix, (uintptr_t)id);
return GetDelegateID().AppendElementString(str);
char name[32];
snprintf(name, sizeof(name), "%s_%016llx", prefix, (uintptr_t)id);
return GetDelegateID().AppendElementString(name);
}
pxr::SdfPath BlenderSceneDelegate::object_prim_id(Object *object) const

View File

@ -184,6 +184,7 @@ void CurvesData::write_material()
{
Object *object = (Object *)id;
Material *mat = nullptr;
/* TODO: Using only first material. Add support for multimaterial. */
if (BKE_object_material_count_eval(object) > 0) {
mat = BKE_object_material_get_eval(object, 0);
}

View File

@ -319,15 +319,15 @@ bool InstancerData::is_instance_visible(Object *object)
pxr::SdfPath InstancerData::object_prim_id(Object *object) const
{
/* Making id of object in form like <prefix>_<pointer in 16 hex digits format> */
char str[32];
snprintf(str, 32, "O_%016llx", (uint64_t)object);
return prim_id.AppendElementString(str);
char name[32];
snprintf(name, sizeof(name), "O_%016llx", (uint64_t)object);
return prim_id.AppendElementString(name);
}
pxr::SdfPath InstancerData::light_prim_id(LightInstance const &inst, int index) const
{
char name[16];
snprintf(name, 16, "L_%08x", index);
snprintf(name, sizeof(name), "L_%08x", index);
return inst.data->prim_id.AppendElementString(name);
}

View File

@ -186,7 +186,7 @@ pxr::SdfPathVector MeshData::submesh_paths() const
pxr::SdfPath MeshData::submesh_prim_id(int index) const
{
char name[16];
snprintf(name, 16, "SM_%04x", index);
snprintf(name, sizeof(name), "SM_%04x", index);
return prim_id.AppendElementString(name);
}