Export volumes from object modifier (quick effect) #62

Merged
Bogdan Nagirniak merged 28 commits from BLEN-448 into hydra-render 2023-07-20 23:49:25 +02:00
4 changed files with 8 additions and 7 deletions
Showing only changes of commit b49e816dbe - Show all commits

View File

@ -25,16 +25,16 @@ std::unique_ptr<ObjectData> ObjectData::create(BlenderSceneDelegate *scene_deleg
{ {
std::unique_ptr<ObjectData> obj_data; std::unique_ptr<ObjectData> obj_data;
if (VolumeModifierData::is_volume_modifier(object)) {
return std::make_unique<VolumeModifierData>(scene_delegate, object, prim_id);
}
switch (object->type) { switch (object->type) {
case OB_MESH: case OB_MESH:
DagerD marked this conversation as resolved Outdated

Propose to create class VolumeModifierData::public VolumeData and separate logic in these two classes

Propose to create `class VolumeModifierData::public VolumeData` and separate logic in these two classes
case OB_SURF: case OB_SURF:
case OB_FONT: case OB_FONT:
case OB_CURVES_LEGACY: case OB_CURVES_LEGACY:
case OB_MBALL: case OB_MBALL:
if (VolumeModifierData::is_volume_modifier(object)) {
obj_data = std::make_unique<VolumeModifierData>(scene_delegate, object, prim_id);
break;
}
obj_data = std::make_unique<MeshData>(scene_delegate, object, prim_id); obj_data = std::make_unique<MeshData>(scene_delegate, object, prim_id);
break; break;
case OB_CURVES: case OB_CURVES:

View File

@ -29,7 +29,6 @@ class VolumeData : public ObjectData {
protected: protected:
void write_materials() override; void write_materials() override;
private:
std::string filepath_; std::string filepath_;
pxr::HdVolumeFieldDescriptorVector field_descriptors_; pxr::HdVolumeFieldDescriptorVector field_descriptors_;
MaterialData *mat_data_ = nullptr; MaterialData *mat_data_ = nullptr;

View File

@ -120,7 +120,8 @@ std::string VolumeModifierData::get_cached_file_path(std::string directory, int
{ {
char file_path[FILE_MAX]; char file_path[FILE_MAX];
char file_name[32]; char file_name[32];
strcat(strcat(strcpy(file_name, FLUID_NAME_DATA), "_####"), FLUID_DOMAIN_EXTENSION_OPENVDB); snprintf(
file_name, sizeof(file_name), "%s_####%s", FLUID_NAME_DATA, FLUID_DOMAIN_EXTENSION_OPENVDB);
BLI_path_frame(file_name, sizeof(file_name), frame, 0); BLI_path_frame(file_name, sizeof(file_name), frame, 0);
BLI_path_join(file_path, sizeof(file_path), directory.c_str(), FLUID_DOMAIN_DIR_DATA, file_name); BLI_path_join(file_path, sizeof(file_path), directory.c_str(), FLUID_DOMAIN_DIR_DATA, file_name);

View File

@ -20,9 +20,10 @@ class VolumeModifierData : public VolumeData {
void init() override; void init() override;
void update() override; void update() override;
private: protected:
void write_transform() override; void write_transform() override;
private:
std::string get_cached_file_path(std::string directory, int frame); std::string get_cached_file_path(std::string directory, int frame);
FluidModifierData *modifier_; FluidModifierData *modifier_;