Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenkernel/intern/pbvh_pixels.cc
| Show All 17 Lines | |||||
| #include "PIL_time.h" | #include "PIL_time.h" | ||||
| #include "BKE_global.h" | #include "BKE_global.h" | ||||
| #include "BKE_image_wrappers.hh" | #include "BKE_image_wrappers.hh" | ||||
| #include "bmesh.h" | #include "bmesh.h" | ||||
| #include "pbvh_intern.h" | #include "pbvh_intern.h" | ||||
| #include "pbvh_pixels_copy.hh" | |||||
| #include "pbvh_uv_islands.hh" | #include "pbvh_uv_islands.hh" | ||||
| namespace blender::bke::pbvh::pixels { | namespace blender::bke::pbvh::pixels { | ||||
| /** | /** | ||||
| * Calculate the delta of two neighbor UV coordinates in the given image buffer. | * Calculate the delta of two neighbor UV coordinates in the given image buffer. | ||||
| */ | */ | ||||
| static float2 calc_barycentric_delta(const float2 uvs[3], | static float2 calc_barycentric_delta(const float2 uvs[3], | ||||
| ▲ Show 20 Lines • Show All 676 Lines • ▼ Show 20 Lines | static bool update_pixels(PBVH *pbvh, Mesh *mesh, Image *image, ImageUser *image_user) | ||||
| TaskParallelSettings settings; | TaskParallelSettings settings; | ||||
| BKE_pbvh_parallel_range_settings(&settings, true, nodes_to_update.size()); | BKE_pbvh_parallel_range_settings(&settings, true, nodes_to_update.size()); | ||||
| BLI_task_parallel_range(0, nodes_to_update.size(), &user_data, do_encode_pixels, &settings); | BLI_task_parallel_range(0, nodes_to_update.size(), &user_data, do_encode_pixels, &settings); | ||||
| if (USE_WATERTIGHT_CHECK) { | if (USE_WATERTIGHT_CHECK) { | ||||
| apply_watertight_check(pbvh, image, image_user); | apply_watertight_check(pbvh, image, image_user); | ||||
| } | } | ||||
| /* Add solution for non-manifold parts of the model. */ | |||||
| BKE_pbvh_pixels_copy_update(*pbvh, *image, *image_user, mesh_data); | |||||
| /* Rebuild the undo regions. */ | /* Rebuild the undo regions. */ | ||||
| for (PBVHNode *node : nodes_to_update) { | for (PBVHNode *node : nodes_to_update) { | ||||
| NodeData *node_data = static_cast<NodeData *>(node->pixels.node_data); | NodeData *node_data = static_cast<NodeData *>(node->pixels.node_data); | ||||
| node_data->rebuild_undo_regions(); | node_data->rebuild_undo_regions(); | ||||
| } | } | ||||
| /* Clear the UpdatePixels flag. */ | /* Clear the UpdatePixels flag. */ | ||||
| for (PBVHNode *node : nodes_to_update) { | for (PBVHNode *node : nodes_to_update) { | ||||
| ▲ Show 20 Lines • Show All 67 Lines • ▼ Show 20 Lines | LISTBASE_FOREACH (ImageTile *, tile, &image.tiles) { | ||||
| } | } | ||||
| node_data->mark_region(image, image_tile, *image_buffer); | node_data->mark_region(image, image_tile, *image_buffer); | ||||
| BKE_image_release_ibuf(&image, image_buffer, nullptr); | BKE_image_release_ibuf(&image, image_buffer, nullptr); | ||||
| } | } | ||||
| node_data->flags.dirty = false; | node_data->flags.dirty = false; | ||||
| } | } | ||||
| } | } | ||||
| void BKE_pbvh_pixels_collect_dirty_tiles(PBVHNode &node, Vector<image::TileNumber> &r_dirty_tiles) | |||||
| { | |||||
| NodeData *node_data = static_cast<NodeData *>(node.pixels.node_data); | |||||
| node_data->collect_dirty_tiles(r_dirty_tiles); | |||||
| } | |||||
| } // namespace blender::bke::pbvh::pixels | } // namespace blender::bke::pbvh::pixels | ||||
| extern "C" { | extern "C" { | ||||
| using namespace blender::bke::pbvh::pixels; | using namespace blender::bke::pbvh::pixels; | ||||
| void BKE_pbvh_build_pixels(PBVH *pbvh, Mesh *mesh, Image *image, ImageUser *image_user) | void BKE_pbvh_build_pixels(PBVH *pbvh, Mesh *mesh, Image *image, ImageUser *image_user) | ||||
| { | { | ||||
| if (update_pixels(pbvh, mesh, image, image_user)) { | if (update_pixels(pbvh, mesh, image, image_user)) { | ||||
| Show All 23 Lines | |||||