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
2 changed files with 32 additions and 0 deletions
Showing only changes of commit 2168d355cf - Show all commits

View File

@ -28,6 +28,10 @@ VolumeModifierData::VolumeModifierData(BlenderSceneDelegate *scene_delegate,
bool VolumeModifierData::is_volume_modifier(Object *object) bool VolumeModifierData::is_volume_modifier(Object *object)
{ {
if (object->type != OB_MESH) {
return false;
}
FluidModifierData *volume_modifier = (FluidModifierData *)BKE_modifiers_findby_type( FluidModifierData *volume_modifier = (FluidModifierData *)BKE_modifiers_findby_type(
object, eModifierType_Fluid); object, eModifierType_Fluid);
return volume_modifier && volume_modifier->type & MOD_FLUID_TYPE_DOMAIN && return volume_modifier && volume_modifier->type & MOD_FLUID_TYPE_DOMAIN &&
@ -62,6 +66,33 @@ void VolumeModifierData::init()
write_materials(); write_materials();
} }
void VolumeModifierData::update()
{
Object *object = (Object *)id;
if ((id->recalc & ID_RECALC_GEOMETRY) || (((ID *)object->data)->recalc & ID_RECALC_GEOMETRY)) {
remove();
init();
insert();
return;
}
pxr::HdDirtyBits bits = pxr::HdChangeTracker::Clean;
if (id->recalc & ID_RECALC_SHADING) {
write_materials();
bits |= pxr::HdChangeTracker::DirtyMaterialId | pxr::HdChangeTracker::DirtyDoubleSided;
}
if (id->recalc & ID_RECALC_TRANSFORM) {
write_transform();
bits |= pxr::HdChangeTracker::DirtyTransform;
}
if (bits == pxr::HdChangeTracker::Clean) {
return;
}
scene_delegate_->GetRenderIndex().GetChangeTracker().MarkRprimDirty(prim_id, bits);
ID_LOG(1, "");
}
void VolumeModifierData::write_transform() void VolumeModifierData::write_transform()
{ {
Object *object = (Object *)this->id; Object *object = (Object *)this->id;

View File

@ -18,6 +18,7 @@ class VolumeModifierData : public VolumeData {
static bool is_volume_modifier(Object *object); static bool is_volume_modifier(Object *object);
void init() override; void init() override;
void update() override;
private: private:
void write_transform() override; void write_transform() override;