forked from blender/blender
Fix instances update when parent object is changed #33
@ -307,15 +307,6 @@ void BlenderSceneDelegate::update_instancers(Object *object)
|
||||
i_data->update_visibility();
|
||||
}
|
||||
|
||||
void BlenderSceneDelegate::update_instancer_as_parent(Object *object)
|
||||
{
|
||||
pxr::SdfPath id = instancer_prim_id(object);
|
||||
InstancerData *i_data = instancer_data(id);
|
||||
if (i_data) {
|
||||
i_data->update_as_parent();
|
||||
}
|
||||
}
|
||||
|
||||
void BlenderSceneDelegate::update_world()
|
||||
{
|
||||
World *world = scene->world;
|
||||
|
@ -21,7 +21,7 @@ namespace blender::render::hydra {
|
||||
extern struct CLG_LogRef *LOG_RENDER_HYDRA_SCENE; /* BSD - Blender Scene Delegate */
|
||||
|
||||
class BlenderSceneDelegate : public pxr::HdSceneDelegate {
|
||||
friend MeshData; /* has access to materials_*/
|
||||
friend MeshData; /* has access to materials and instances */
|
||||
|
||||
public:
|
||||
enum class EngineType { VIEWPORT = 1, FINAL, PREVIEW };
|
||||
@ -74,7 +74,6 @@ class BlenderSceneDelegate : public pxr::HdSceneDelegate {
|
||||
|
||||
void update_objects(Object *object);
|
||||
void update_instancers(Object *object);
|
||||
void update_instancer_as_parent(Object *object);
|
||||
void update_world();
|
||||
void check_updates();
|
||||
void add_new_objects();
|
||||
|
@ -66,11 +66,15 @@ void MeshData::remove()
|
||||
void MeshData::update()
|
||||
{
|
||||
Object *object = (Object *)id;
|
||||
if ((id->recalc & ID_RECALC_TRANSFORM) && parent_ != object->parent) {
|
||||
if (parent_ != object->parent) {
|
||||
/* parent was changed */
|
||||
parent_ = object->parent;
|
||||
if (parent_) {
|
||||
scene_delegate_->update_instancer_as_parent(parent_);
|
||||
pxr::SdfPath i_id = scene_delegate_->instancer_prim_id(parent_);
|
||||
InstancerData *i_data = scene_delegate_->instancer_data(i_id);
|
||||
if (i_data) {
|
||||
i_data->update_as_parent();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user