Changeset View
Changeset View
Standalone View
Standalone View
intern/cycles/blender/blender_object.cpp
| Show First 20 Lines • Show All 598 Lines • ▼ Show 20 Lines | #ifdef WITH_ALEMBIC | ||||
| bool use_procedural = false; | bool use_procedural = false; | ||||
| bool has_subdivision_modifier = false; | bool has_subdivision_modifier = false; | ||||
| BL::MeshSequenceCacheModifier b_mesh_cache(PointerRNA_NULL); | BL::MeshSequenceCacheModifier b_mesh_cache(PointerRNA_NULL); | ||||
| /* Experimental as Blender does not have good support for procedurals at the moment, also | /* Experimental as Blender does not have good support for procedurals at the moment, also | ||||
| * only available in preview renders since currently do not have a good cache policy, the | * only available in preview renders since currently do not have a good cache policy, the | ||||
| * data being loaded at once for all the frames. */ | * data being loaded at once for all the frames. */ | ||||
| if (experimental && b_v3d) { | if (experimental && b_v3d) { | ||||
| b_mesh_cache = object_mesh_cache_find(b_ob, false, &has_subdivision_modifier); | b_mesh_cache = object_mesh_cache_find(b_ob, &has_subdivision_modifier); | ||||
| use_procedural = b_mesh_cache && b_mesh_cache.cache_file().use_render_procedural(); | use_procedural = b_mesh_cache && b_mesh_cache.cache_file().use_render_procedural(); | ||||
| } | } | ||||
| if (use_procedural) { | if (use_procedural) { | ||||
| /* Skip in the motion case, as generating motion blur data will be handled in the | /* Skip in the motion case, as generating motion blur data will be handled in the | ||||
| * procedural. */ | * procedural. */ | ||||
| if (!motion) { | if (!motion) { | ||||
| sync_procedural(b_ob, b_mesh_cache, has_subdivision_modifier); | sync_procedural(b_ob, b_mesh_cache, has_subdivision_modifier); | ||||
| ▲ Show 20 Lines • Show All 98 Lines • ▼ Show 20 Lines | void BlenderSync::sync_motion(BL::RenderSettings &b_render, | ||||
| * have already been added in a sync_objects call. */ | * have already been added in a sync_objects call. */ | ||||
| if (b_cam) { | if (b_cam) { | ||||
| uint camera_motion_steps = object_motion_steps(b_cam, b_cam); | uint camera_motion_steps = object_motion_steps(b_cam, b_cam); | ||||
| for (size_t step = 0; step < camera_motion_steps; step++) { | for (size_t step = 0; step < camera_motion_steps; step++) { | ||||
| motion_times.insert(scene->camera->motion_time(step)); | motion_times.insert(scene->camera->motion_time(step)); | ||||
| } | } | ||||
| } | } | ||||
| /* Check which geometry already has motion blur so it can be skipped. */ | |||||
| geometry_motion_attribute_synced.clear(); | |||||
| for (Geometry *geom : scene->geometry) { | |||||
| if (geom->attributes.find(ATTR_STD_MOTION_VERTEX_POSITION)) { | |||||
| geometry_motion_attribute_synced.insert(geom); | |||||
| } | |||||
| } | |||||
| /* note iteration over motion_times set happens in sorted order */ | /* note iteration over motion_times set happens in sorted order */ | ||||
| foreach (float relative_time, motion_times) { | foreach (float relative_time, motion_times) { | ||||
| /* center time is already handled. */ | /* center time is already handled. */ | ||||
| if (relative_time == 0.0f) { | if (relative_time == 0.0f) { | ||||
| continue; | continue; | ||||
| } | } | ||||
| VLOG(1) << "Synchronizing motion for the relative time " << relative_time << "."; | VLOG(1) << "Synchronizing motion for the relative time " << relative_time << "."; | ||||
| Show All 14 Lines | foreach (float relative_time, motion_times) { | ||||
| /* Syncs camera motion if relative_time is one of the camera's motion times. */ | /* Syncs camera motion if relative_time is one of the camera's motion times. */ | ||||
| sync_camera_motion(b_render, b_cam, width, height, relative_time); | sync_camera_motion(b_render, b_cam, width, height, relative_time); | ||||
| /* sync object */ | /* sync object */ | ||||
| sync_objects(b_depsgraph, b_v3d, relative_time); | sync_objects(b_depsgraph, b_v3d, relative_time); | ||||
| } | } | ||||
| geometry_motion_attribute_synced.clear(); | |||||
| /* we need to set the python thread state again because this | /* we need to set the python thread state again because this | ||||
| * function assumes it is being executed from python and will | * function assumes it is being executed from python and will | ||||
| * try to save the thread state */ | * try to save the thread state */ | ||||
| python_thread_state_restore(python_thread_state); | python_thread_state_restore(python_thread_state); | ||||
| b_engine.frame_set(frame_center, subframe_center); | b_engine.frame_set(frame_center, subframe_center); | ||||
| python_thread_state_save(python_thread_state); | python_thread_state_save(python_thread_state); | ||||
| } | } | ||||
| CCL_NAMESPACE_END | CCL_NAMESPACE_END | ||||