Fix T60379: Cycles viewport adaptive subdivision hangs after updates.
The camera world to raster computation was using wrong values. Also fixes update when changing subdivision scene settings.
This commit is contained in:
@@ -927,8 +927,6 @@ static void create_subd_mesh(Scene *scene,
|
||||
sdparams.dicing_rate = max(0.1f, RNA_float_get(&cobj, "dicing_rate") * dicing_rate);
|
||||
sdparams.max_level = max_subdivisions;
|
||||
|
||||
scene->dicing_camera->update(scene);
|
||||
sdparams.camera = scene->dicing_camera;
|
||||
sdparams.objecttoworld = get_transform(b_ob.matrix_world());
|
||||
}
|
||||
|
||||
|
||||
@@ -85,10 +85,11 @@ void BlenderSync::sync_recalc(BL::Depsgraph& b_depsgraph)
|
||||
* so we can do it later on if doing it immediate is not suitable. */
|
||||
|
||||
bool has_updated_objects = b_depsgraph.id_type_updated(BL::DriverTarget::id_type_OBJECT);
|
||||
bool dicing_prop_changed = false;
|
||||
|
||||
if(experimental) {
|
||||
/* Mark all meshes as needing to be exported again if dicing changed. */
|
||||
PointerRNA cscene = RNA_pointer_get(&b_scene.ptr, "cycles");
|
||||
bool dicing_prop_changed = false;
|
||||
|
||||
float updated_dicing_rate = preview ? RNA_float_get(&cscene, "preview_dicing_rate")
|
||||
: RNA_float_get(&cscene, "dicing_rate");
|
||||
@@ -104,6 +105,15 @@ void BlenderSync::sync_recalc(BL::Depsgraph& b_depsgraph)
|
||||
max_subdivisions = updated_max_subdivisions;
|
||||
dicing_prop_changed = true;
|
||||
}
|
||||
|
||||
if(dicing_prop_changed) {
|
||||
for(const pair<void*, Mesh*>& iter: mesh_map.key_to_scene_data()) {
|
||||
Mesh *mesh = iter.second;
|
||||
if(mesh->subdivision_type != Mesh::SUBDIVISION_NONE) {
|
||||
mesh_map.set_recalc(iter.first);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Iterate over all IDs in this depsgraph. */
|
||||
@@ -133,7 +143,7 @@ void BlenderSync::sync_recalc(BL::Depsgraph& b_depsgraph)
|
||||
|
||||
if(object_is_mesh(b_ob)) {
|
||||
if(updated_geometry ||
|
||||
(dicing_prop_changed && object_subdivision_type(b_ob, preview, experimental) != Mesh::SUBDIVISION_NONE))
|
||||
(object_subdivision_type(b_ob, preview, experimental) != Mesh::SUBDIVISION_NONE))
|
||||
{
|
||||
BL::ID key = BKE_object_is_modified(b_ob)? b_ob: b_ob.data();
|
||||
mesh_map.set_recalc(key);
|
||||
|
||||
@@ -628,6 +628,11 @@ public:
|
||||
b_recalc.insert(id.ptr.data);
|
||||
}
|
||||
|
||||
void set_recalc(void *id_ptr)
|
||||
{
|
||||
b_recalc.insert(id_ptr);
|
||||
}
|
||||
|
||||
bool has_recalc()
|
||||
{
|
||||
return !(b_recalc.empty());
|
||||
@@ -723,6 +728,11 @@ public:
|
||||
return deleted;
|
||||
}
|
||||
|
||||
const map<K, T*>& key_to_scene_data()
|
||||
{
|
||||
return b_map;
|
||||
}
|
||||
|
||||
protected:
|
||||
vector<T*> *scene_data;
|
||||
map<K, T*> b_map;
|
||||
|
||||
Reference in New Issue
Block a user