forked from blender/blender
Export volumes from object modifier (quick effect) #62
@ -28,6 +28,10 @@ VolumeModifierData::VolumeModifierData(BlenderSceneDelegate *scene_delegate,
|
||||
|
||||
bool VolumeModifierData::is_volume_modifier(Object *object)
|
||||
{
|
||||
if (object->type != OB_MESH) {
|
||||
return false;
|
||||
}
|
||||
|
||||
FluidModifierData *volume_modifier = (FluidModifierData *)BKE_modifiers_findby_type(
|
||||
object, eModifierType_Fluid);
|
||||
return volume_modifier && volume_modifier->type & MOD_FLUID_TYPE_DOMAIN &&
|
||||
@ -62,6 +66,33 @@ void VolumeModifierData::init()
|
||||
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()
|
||||
{
|
||||
Object *object = (Object *)this->id;
|
||||
|
@ -18,6 +18,7 @@ class VolumeModifierData : public VolumeData {
|
||||
static bool is_volume_modifier(Object *object);
|
||||
|
||||
void init() override;
|
||||
void update() override;
|
||||
|
||||
private:
|
||||
void write_transform() override;
|
||||
|
Loading…
Reference in New Issue
Block a user