diff --git a/source/blender/blenlib/BLI_uvproject.h b/source/blender/blenkernel/BKE_uvproject.h similarity index 75% rename from source/blender/blenlib/BLI_uvproject.h rename to source/blender/blenkernel/BKE_uvproject.h index e696a3ac467..6172761c899 100644 --- a/source/blender/blenlib/BLI_uvproject.h +++ b/source/blender/blenkernel/BKE_uvproject.h @@ -4,7 +4,7 @@ #pragma once /** \file - * \ingroup bli + * \ingroup bke */ struct Object; @@ -16,7 +16,7 @@ struct ProjCameraInfo; * \param rotmat: can be `obedit->object_to_world().ptr()` when uv project is used. * \param winx, winy: can be from `scene->r.xsch / ysch`. */ -struct ProjCameraInfo *BLI_uvproject_camera_info(const struct Object *ob, +struct ProjCameraInfo *BKE_uvproject_camera_info(const struct Object *ob, const float rotmat[4][4], float winx, float winy); @@ -24,13 +24,13 @@ struct ProjCameraInfo *BLI_uvproject_camera_info(const struct Object *ob, /** * Apply UV from #ProjCameraInfo (camera). */ -void BLI_uvproject_from_camera(float target[2], float source[3], struct ProjCameraInfo *uci); +void BKE_uvproject_from_camera(float target[2], float source[3], struct ProjCameraInfo *uci); /** * Apply uv from perspective matrix. * \param persmat: Can be `rv3d->persmat`. */ -void BLI_uvproject_from_view(float target[2], +void BKE_uvproject_from_view(float target[2], float source[3], float persmat[4][4], float rotmat[4][4], @@ -40,13 +40,13 @@ void BLI_uvproject_from_view(float target[2], /** * Apply orthographic UVs. */ -void BLI_uvproject_from_view_ortho(float target[2], float source[3], const float rotmat[4][4]); +void BKE_uvproject_from_view_ortho(float target[2], float source[3], const float rotmat[4][4]); /** * So we can adjust scale with keeping the struct private. */ -void BLI_uvproject_camera_info_scale(ProjCameraInfo *uci, float scale_x, float scale_y); +void BKE_uvproject_camera_info_scale(ProjCameraInfo *uci, float scale_x, float scale_y); /* * Free info. */ -void BLI_uvproject_camera_info_free(ProjCameraInfo *uci); +void BKE_uvproject_camera_info_free(ProjCameraInfo *uci); diff --git a/source/blender/blenkernel/CMakeLists.txt b/source/blender/blenkernel/CMakeLists.txt index 7cd32624df6..a217a67ea20 100644 --- a/source/blender/blenkernel/CMakeLists.txt +++ b/source/blender/blenkernel/CMakeLists.txt @@ -302,6 +302,7 @@ set(SRC intern/type_conversions.cc intern/undo_system.cc intern/unit.cc + intern/uvproject.cc intern/vfont.cc intern/vfont_curve.cc intern/vfontdata_freetype.cc @@ -513,6 +514,7 @@ set(SRC BKE_type_conversions.hh BKE_undo_system.hh BKE_unit.hh + BKE_uvproject.h BKE_vfont.hh BKE_vfontdata.hh BKE_viewer_path.hh diff --git a/source/blender/blenlib/intern/uvproject.cc b/source/blender/blenkernel/intern/uvproject.cc similarity index 91% rename from source/blender/blenlib/intern/uvproject.cc rename to source/blender/blenkernel/intern/uvproject.cc index 26b8a680db8..887d9391bfe 100644 --- a/source/blender/blenlib/intern/uvproject.cc +++ b/source/blender/blenkernel/intern/uvproject.cc @@ -3,7 +3,7 @@ * SPDX-License-Identifier: GPL-2.0-or-later */ /** \file - * \ingroup bli + * \ingroup bke */ #include @@ -16,7 +16,8 @@ #include "BLI_math_matrix.h" #include "BLI_math_rotation.h" #include "BLI_math_vector.h" -#include "BLI_uvproject.h" + +#include "BKE_uvproject.h" struct ProjCameraInfo { float camangle; @@ -28,7 +29,7 @@ struct ProjCameraInfo { bool do_persp, do_pano, do_rotmat; }; -void BLI_uvproject_from_camera(float target[2], float source[3], ProjCameraInfo *uci) +void BKE_uvproject_from_camera(float target[2], float source[3], ProjCameraInfo *uci) { float pv4[4]; @@ -80,7 +81,7 @@ void BLI_uvproject_from_camera(float target[2], float source[3], ProjCameraInfo target[1] += uci->shifty; } -void BLI_uvproject_from_view(float target[2], +void BKE_uvproject_from_view(float target[2], float source[3], float persmat[4][4], float rotmat[4][4], @@ -121,7 +122,7 @@ void BLI_uvproject_from_view(float target[2], target[1] = (y + target[1]) / winy; } -ProjCameraInfo *BLI_uvproject_camera_info(const Object *ob, +ProjCameraInfo *BKE_uvproject_camera_info(const Object *ob, const float rotmat[4][4], float winx, float winy) @@ -173,12 +174,12 @@ ProjCameraInfo *BLI_uvproject_camera_info(const Object *ob, return nullptr; } -void BLI_uvproject_camera_info_free(ProjCameraInfo *uci) +void BKE_uvproject_camera_info_free(ProjCameraInfo *uci) { MEM_freeN(uci); } -void BLI_uvproject_from_view_ortho(float target[2], float source[3], const float rotmat[4][4]) +void BKE_uvproject_from_view_ortho(float target[2], float source[3], const float rotmat[4][4]) { float pv[3]; @@ -189,7 +190,7 @@ void BLI_uvproject_from_view_ortho(float target[2], float source[3], const float target[1] = pv[2]; } -void BLI_uvproject_camera_info_scale(ProjCameraInfo *uci, float scale_x, float scale_y) +void BKE_uvproject_camera_info_scale(ProjCameraInfo *uci, float scale_x, float scale_y) { uci->xasp *= scale_x; uci->yasp *= scale_y; diff --git a/source/blender/blenlib/CMakeLists.txt b/source/blender/blenlib/CMakeLists.txt index 1bfe1e330b8..00ec5fb5b13 100644 --- a/source/blender/blenlib/CMakeLists.txt +++ b/source/blender/blenlib/CMakeLists.txt @@ -159,7 +159,6 @@ set(SRC intern/timecode.cc intern/timeit.cc intern/uuid.cc - intern/uvproject.cc intern/vector.cc intern/virtual_array.cc intern/voxel.cc @@ -398,7 +397,6 @@ set(SRC BLI_utildefines_variadic.h BLI_utility_mixins.hh BLI_uuid.h - BLI_uvproject.h BLI_vector.hh BLI_vector_list.hh BLI_vector_set.hh diff --git a/source/blender/editors/uvedit/uvedit_unwrap_ops.cc b/source/blender/editors/uvedit/uvedit_unwrap_ops.cc index 3a5a93afdcf..12a7e7927c7 100644 --- a/source/blender/editors/uvedit/uvedit_unwrap_ops.cc +++ b/source/blender/editors/uvedit/uvedit_unwrap_ops.cc @@ -31,7 +31,6 @@ #include "BLI_string.h" #include "BLI_time.h" #include "BLI_utildefines.h" -#include "BLI_uvproject.h" #include "BLI_vector.hh" #include "BLT_translation.hh" @@ -50,6 +49,7 @@ #include "BKE_subdiv.hh" #include "BKE_subdiv_mesh.hh" #include "BKE_subdiv_modifier.hh" +#include "BKE_uvproject.h" #include "DEG_depsgraph.hh" @@ -3483,14 +3483,14 @@ static wmOperatorStatus uv_from_view_exec(bContext *C, wmOperator *op) BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) { float *luv = BM_ELEM_CD_GET_FLOAT_P(l, cd_loop_uv_offset); - BLI_uvproject_from_view_ortho(luv, l->v->co, rotmat); + BKE_uvproject_from_view_ortho(luv, l->v->co, rotmat); } changed = true; } } else if (camera) { const bool camera_bounds = RNA_boolean_get(op->ptr, "camera_bounds"); - ProjCameraInfo *uci = BLI_uvproject_camera_info( + ProjCameraInfo *uci = BKE_uvproject_camera_info( v3d->camera, obedit->object_to_world().ptr(), camera_bounds ? (scene->r.xsch * scene->r.xasp) : 1.0f, @@ -3504,12 +3504,12 @@ static wmOperatorStatus uv_from_view_exec(bContext *C, wmOperator *op) BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) { float *luv = BM_ELEM_CD_GET_FLOAT_P(l, cd_loop_uv_offset); - BLI_uvproject_from_camera(luv, l->v->co, uci); + BKE_uvproject_from_camera(luv, l->v->co, uci); } changed = true; } - BLI_uvproject_camera_info_free(uci); + BKE_uvproject_camera_info_free(uci); } } else { @@ -3522,7 +3522,7 @@ static wmOperatorStatus uv_from_view_exec(bContext *C, wmOperator *op) BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) { float *luv = BM_ELEM_CD_GET_FLOAT_P(l, cd_loop_uv_offset); - BLI_uvproject_from_view( + BKE_uvproject_from_view( luv, l->v->co, rv3d->persmat, rotmat, region->winx, region->winy); } changed = true; diff --git a/source/blender/modifiers/intern/MOD_uvproject.cc b/source/blender/modifiers/intern/MOD_uvproject.cc index 3d6d10cdd8a..e5cef5cfa0a 100644 --- a/source/blender/modifiers/intern/MOD_uvproject.cc +++ b/source/blender/modifiers/intern/MOD_uvproject.cc @@ -12,7 +12,6 @@ #include "BLI_math_matrix.h" #include "BLI_math_vector.h" -#include "BLI_uvproject.h" #include "BLT_translation.hh" @@ -27,6 +26,7 @@ #include "BKE_customdata.hh" #include "BKE_lib_query.hh" #include "BKE_mesh.hh" +#include "BKE_uvproject.h" #include "UI_interface.hh" #include "UI_resources.hh" @@ -148,8 +148,8 @@ static Mesh *uvprojectModifier_do(UVProjectModifierData *umd, if (projectors[i].ob->type == OB_CAMERA) { const Camera *cam = (const Camera *)projectors[i].ob->data; if (cam->type == CAM_PANO) { - projectors[i].uci = BLI_uvproject_camera_info(projectors[i].ob, nullptr, aspx, aspy); - BLI_uvproject_camera_info_scale( + projectors[i].uci = BKE_uvproject_camera_info(projectors[i].ob, nullptr, aspx, aspy); + BKE_uvproject_camera_info_scale( static_cast(projectors[i].uci), scax, scay); free_uci = true; } @@ -215,7 +215,7 @@ static Mesh *uvprojectModifier_do(UVProjectModifierData *umd, if (projectors[0].uci) { for (const int corner : face) { const int vert = corner_verts[corner]; - BLI_uvproject_from_camera( + BKE_uvproject_from_camera( mloop_uv[corner], coords[vert], static_cast(projectors[0].uci)); } } @@ -254,7 +254,7 @@ static Mesh *uvprojectModifier_do(UVProjectModifierData *umd, if (best_projector->uci) { for (const int corner : face) { const int vert = corner_verts[corner]; - BLI_uvproject_from_camera( + BKE_uvproject_from_camera( mloop_uv[corner], coords[vert], static_cast(best_projector->uci)); } }