Cleanup: Move uvedit_intern.h to C++
This commit is contained in:
parent
02582213de
commit
2eabfc4854
@ -42,7 +42,7 @@
|
||||
#include "RNA_define.hh"
|
||||
|
||||
#include "paint_intern.hh"
|
||||
#include "uvedit_intern.h"
|
||||
#include "uvedit_intern.hh"
|
||||
|
||||
#include "UI_view2d.hh"
|
||||
|
||||
|
@ -33,7 +33,7 @@ set(SRC
|
||||
uvedit_unwrap_ops.cc
|
||||
|
||||
uvedit_clipboard_graph_iso.hh
|
||||
uvedit_intern.h
|
||||
uvedit_intern.hh
|
||||
)
|
||||
|
||||
set(LIB
|
||||
|
@ -34,7 +34,7 @@
|
||||
#include "WM_api.hh"
|
||||
|
||||
#include "uvedit_clipboard_graph_iso.hh"
|
||||
#include "uvedit_intern.h" /* linker, extern "C" */
|
||||
#include "uvedit_intern.hh" /* linker, extern "C" */
|
||||
|
||||
void UV_clipboard_free();
|
||||
|
||||
|
@ -1,182 +0,0 @@
|
||||
/* SPDX-FileCopyrightText: 2008 Blender Authors
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0-or-later */
|
||||
|
||||
/** \file
|
||||
* \ingroup eduv
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct BMFace;
|
||||
struct BMLoop;
|
||||
struct Object;
|
||||
struct Scene;
|
||||
struct SpaceImage;
|
||||
struct wmOperatorType;
|
||||
|
||||
/* find nearest */
|
||||
|
||||
typedef struct UvNearestHit {
|
||||
/** Only for `*_multi(..)` versions of functions. */
|
||||
struct Object *ob;
|
||||
/** Always set if we have a hit. */
|
||||
struct BMFace *efa;
|
||||
struct BMLoop *l;
|
||||
/**
|
||||
* Needs to be set before calling nearest functions.
|
||||
*
|
||||
* \note When #uv_nearest_hit_init_dist_px or #uv_nearest_hit_init_max are used,
|
||||
* this value is pixels squared.
|
||||
*/
|
||||
float dist_sq;
|
||||
|
||||
/** Scale the UVs to account for aspect ratio from the image view. */
|
||||
float scale[2];
|
||||
} UvNearestHit;
|
||||
|
||||
UvNearestHit uv_nearest_hit_init_dist_px(const struct View2D *v2d, const float dist_px);
|
||||
UvNearestHit uv_nearest_hit_init_max(const struct View2D *v2d);
|
||||
|
||||
bool uv_find_nearest_vert(struct Scene *scene,
|
||||
struct Object *obedit,
|
||||
const float co[2],
|
||||
float penalty_dist,
|
||||
struct UvNearestHit *hit);
|
||||
bool uv_find_nearest_vert_multi(struct Scene *scene,
|
||||
struct Object **objects,
|
||||
uint objects_len,
|
||||
const float co[2],
|
||||
float penalty_dist,
|
||||
struct UvNearestHit *hit);
|
||||
|
||||
bool uv_find_nearest_edge(struct Scene *scene,
|
||||
struct Object *obedit,
|
||||
const float co[2],
|
||||
float penalty,
|
||||
struct UvNearestHit *hit);
|
||||
bool uv_find_nearest_edge_multi(struct Scene *scene,
|
||||
struct Object **objects,
|
||||
uint objects_len,
|
||||
const float co[2],
|
||||
float penalty,
|
||||
struct UvNearestHit *hit);
|
||||
|
||||
/**
|
||||
* \param only_in_face: when true, only hit faces which `co` is inside.
|
||||
* This gives users a result they might expect, especially when zoomed in.
|
||||
*
|
||||
* \note Concave faces can cause odd behavior, although in practice this isn't often an issue.
|
||||
* The center can be outside the face, in this case the distance to the center
|
||||
* could cause the face to be considered too far away.
|
||||
* If this becomes an issue we could track the distance to the faces closest edge.
|
||||
*/
|
||||
bool uv_find_nearest_face_ex(struct Scene *scene,
|
||||
struct Object *obedit,
|
||||
const float co[2],
|
||||
struct UvNearestHit *hit,
|
||||
bool only_in_face);
|
||||
bool uv_find_nearest_face(struct Scene *scene,
|
||||
struct Object *obedit,
|
||||
const float co[2],
|
||||
struct UvNearestHit *hit);
|
||||
bool uv_find_nearest_face_multi_ex(struct Scene *scene,
|
||||
struct Object **objects,
|
||||
uint objects_len,
|
||||
const float co[2],
|
||||
struct UvNearestHit *hit,
|
||||
bool only_in_face);
|
||||
bool uv_find_nearest_face_multi(struct Scene *scene,
|
||||
struct Object **objects,
|
||||
uint objects_len,
|
||||
const float co[2],
|
||||
struct UvNearestHit *hit);
|
||||
|
||||
BMLoop *uv_find_nearest_loop_from_vert(struct Scene *scene,
|
||||
struct Object *obedit,
|
||||
struct BMVert *v,
|
||||
const float co[2]);
|
||||
BMLoop *uv_find_nearest_loop_from_edge(struct Scene *scene,
|
||||
struct Object *obedit,
|
||||
struct BMEdge *e,
|
||||
const float co[2]);
|
||||
|
||||
bool uvedit_vert_is_edge_select_any_other(const struct Scene *scene,
|
||||
struct BMLoop *l,
|
||||
BMUVOffsets offsets);
|
||||
bool uvedit_vert_is_face_select_any_other(const struct Scene *scene,
|
||||
struct BMLoop *l,
|
||||
BMUVOffsets offsets);
|
||||
bool uvedit_vert_is_all_other_faces_selected(const struct Scene *scene,
|
||||
struct BMLoop *l,
|
||||
BMUVOffsets offsets);
|
||||
|
||||
/* utility tool functions */
|
||||
|
||||
void uvedit_live_unwrap_update(struct SpaceImage *sima,
|
||||
struct Scene *scene,
|
||||
struct Object *obedit);
|
||||
|
||||
/* operators */
|
||||
|
||||
void UV_OT_average_islands_scale(struct wmOperatorType *ot);
|
||||
void UV_OT_cube_project(struct wmOperatorType *ot);
|
||||
void UV_OT_cylinder_project(struct wmOperatorType *ot);
|
||||
void UV_OT_project_from_view(struct wmOperatorType *ot);
|
||||
void UV_OT_minimize_stretch(struct wmOperatorType *ot);
|
||||
void UV_OT_pack_islands(struct wmOperatorType *ot);
|
||||
void UV_OT_reset(struct wmOperatorType *ot);
|
||||
void UV_OT_sphere_project(struct wmOperatorType *ot);
|
||||
void UV_OT_unwrap(struct wmOperatorType *ot);
|
||||
void UV_OT_rip(struct wmOperatorType *ot);
|
||||
void UV_OT_stitch(struct wmOperatorType *ot);
|
||||
void UV_OT_smart_project(struct wmOperatorType *ot);
|
||||
|
||||
/* uvedit_copy_paste.cc */
|
||||
void UV_OT_copy(wmOperatorType *ot);
|
||||
void UV_OT_paste(wmOperatorType *ot);
|
||||
|
||||
/* `uvedit_path.cc` */
|
||||
|
||||
void UV_OT_shortest_path_pick(struct wmOperatorType *ot);
|
||||
void UV_OT_shortest_path_select(struct wmOperatorType *ot);
|
||||
|
||||
/* `uvedit_select.cc` */
|
||||
|
||||
bool uvedit_select_is_any_selected(const struct Scene *scene, struct Object *obedit);
|
||||
bool uvedit_select_is_any_selected_multi(const struct Scene *scene,
|
||||
struct Object **objects,
|
||||
uint objects_len);
|
||||
/**
|
||||
* \warning This returns first selected UV,
|
||||
* not ideal in many cases since there could be multiple.
|
||||
*/
|
||||
const float *uvedit_first_selected_uv_from_vertex(struct Scene *scene,
|
||||
struct BMVert *eve,
|
||||
BMUVOffsets offsets);
|
||||
|
||||
void UV_OT_select_all(struct wmOperatorType *ot);
|
||||
void UV_OT_select(struct wmOperatorType *ot);
|
||||
void UV_OT_select_loop(struct wmOperatorType *ot);
|
||||
void UV_OT_select_edge_ring(struct wmOperatorType *ot);
|
||||
void UV_OT_select_linked(struct wmOperatorType *ot);
|
||||
void UV_OT_select_linked_pick(struct wmOperatorType *ot);
|
||||
void UV_OT_select_split(struct wmOperatorType *ot);
|
||||
void UV_OT_select_pinned(struct wmOperatorType *ot);
|
||||
void UV_OT_select_box(struct wmOperatorType *ot);
|
||||
void UV_OT_select_lasso(struct wmOperatorType *ot);
|
||||
void UV_OT_select_circle(struct wmOperatorType *ot);
|
||||
void UV_OT_select_more(struct wmOperatorType *ot);
|
||||
void UV_OT_select_less(struct wmOperatorType *ot);
|
||||
void UV_OT_select_overlap(struct wmOperatorType *ot);
|
||||
void UV_OT_select_similar(struct wmOperatorType *ot);
|
||||
/* Used only when UV sync select is disabled. */
|
||||
void UV_OT_select_mode(struct wmOperatorType *ot);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
146
source/blender/editors/uvedit/uvedit_intern.hh
Normal file
146
source/blender/editors/uvedit/uvedit_intern.hh
Normal file
@ -0,0 +1,146 @@
|
||||
/* SPDX-FileCopyrightText: 2008 Blender Authors
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-2.0-or-later */
|
||||
|
||||
/** \file
|
||||
* \ingroup eduv
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "BKE_customdata.hh"
|
||||
|
||||
struct BMVert;
|
||||
struct BMEdge;
|
||||
struct BMFace;
|
||||
struct BMLoop;
|
||||
struct Object;
|
||||
struct Scene;
|
||||
struct SpaceImage;
|
||||
struct wmOperatorType;
|
||||
struct View2D;
|
||||
|
||||
/* find nearest */
|
||||
|
||||
struct UvNearestHit {
|
||||
/** Only for `*_multi(..)` versions of functions. */
|
||||
Object *ob;
|
||||
/** Always set if we have a hit. */
|
||||
BMFace *efa;
|
||||
BMLoop *l;
|
||||
/**
|
||||
* Needs to be set before calling nearest functions.
|
||||
*
|
||||
* \note When #uv_nearest_hit_init_dist_px or #uv_nearest_hit_init_max are used,
|
||||
* this value is pixels squared.
|
||||
*/
|
||||
float dist_sq;
|
||||
|
||||
/** Scale the UVs to account for aspect ratio from the image view. */
|
||||
float scale[2];
|
||||
};
|
||||
|
||||
UvNearestHit uv_nearest_hit_init_dist_px(const View2D *v2d, float dist_px);
|
||||
UvNearestHit uv_nearest_hit_init_max(const View2D *v2d);
|
||||
|
||||
bool uv_find_nearest_vert(
|
||||
Scene *scene, Object *obedit, const float co[2], float penalty_dist, UvNearestHit *hit);
|
||||
bool uv_find_nearest_vert_multi(Scene *scene,
|
||||
Object **objects,
|
||||
uint objects_len,
|
||||
const float co[2],
|
||||
float penalty_dist,
|
||||
UvNearestHit *hit);
|
||||
|
||||
bool uv_find_nearest_edge(
|
||||
Scene *scene, Object *obedit, const float co[2], float penalty, UvNearestHit *hit);
|
||||
bool uv_find_nearest_edge_multi(Scene *scene,
|
||||
Object **objects,
|
||||
uint objects_len,
|
||||
const float co[2],
|
||||
float penalty,
|
||||
UvNearestHit *hit);
|
||||
|
||||
/**
|
||||
* \param only_in_face: when true, only hit faces which `co` is inside.
|
||||
* This gives users a result they might expect, especially when zoomed in.
|
||||
*
|
||||
* \note Concave faces can cause odd behavior, although in practice this isn't often an issue.
|
||||
* The center can be outside the face, in this case the distance to the center
|
||||
* could cause the face to be considered too far away.
|
||||
* If this becomes an issue we could track the distance to the faces closest edge.
|
||||
*/
|
||||
bool uv_find_nearest_face_ex(
|
||||
Scene *scene, Object *obedit, const float co[2], UvNearestHit *hit, bool only_in_face);
|
||||
bool uv_find_nearest_face(Scene *scene, Object *obedit, const float co[2], UvNearestHit *hit);
|
||||
bool uv_find_nearest_face_multi_ex(Scene *scene,
|
||||
Object **objects,
|
||||
uint objects_len,
|
||||
const float co[2],
|
||||
UvNearestHit *hit,
|
||||
bool only_in_face);
|
||||
bool uv_find_nearest_face_multi(
|
||||
Scene *scene, Object **objects, uint objects_len, const float co[2], UvNearestHit *hit);
|
||||
|
||||
BMLoop *uv_find_nearest_loop_from_vert(Scene *scene, Object *obedit, BMVert *v, const float co[2]);
|
||||
BMLoop *uv_find_nearest_loop_from_edge(Scene *scene, Object *obedit, BMEdge *e, const float co[2]);
|
||||
|
||||
bool uvedit_vert_is_edge_select_any_other(const Scene *scene, BMLoop *l, BMUVOffsets offsets);
|
||||
bool uvedit_vert_is_face_select_any_other(const Scene *scene, BMLoop *l, BMUVOffsets offsets);
|
||||
bool uvedit_vert_is_all_other_faces_selected(const Scene *scene, BMLoop *l, BMUVOffsets offsets);
|
||||
|
||||
/* utility tool functions */
|
||||
|
||||
void uvedit_live_unwrap_update(SpaceImage *sima, Scene *scene, Object *obedit);
|
||||
|
||||
/* operators */
|
||||
|
||||
void UV_OT_average_islands_scale(wmOperatorType *ot);
|
||||
void UV_OT_cube_project(wmOperatorType *ot);
|
||||
void UV_OT_cylinder_project(wmOperatorType *ot);
|
||||
void UV_OT_project_from_view(wmOperatorType *ot);
|
||||
void UV_OT_minimize_stretch(wmOperatorType *ot);
|
||||
void UV_OT_pack_islands(wmOperatorType *ot);
|
||||
void UV_OT_reset(wmOperatorType *ot);
|
||||
void UV_OT_sphere_project(wmOperatorType *ot);
|
||||
void UV_OT_unwrap(wmOperatorType *ot);
|
||||
void UV_OT_rip(wmOperatorType *ot);
|
||||
void UV_OT_stitch(wmOperatorType *ot);
|
||||
void UV_OT_smart_project(wmOperatorType *ot);
|
||||
|
||||
/* uvedit_copy_paste.cc */
|
||||
void UV_OT_copy(wmOperatorType *ot);
|
||||
void UV_OT_paste(wmOperatorType *ot);
|
||||
|
||||
/* `uvedit_path.cc` */
|
||||
|
||||
void UV_OT_shortest_path_pick(wmOperatorType *ot);
|
||||
void UV_OT_shortest_path_select(wmOperatorType *ot);
|
||||
|
||||
/* `uvedit_select.cc` */
|
||||
|
||||
bool uvedit_select_is_any_selected(const Scene *scene, Object *obedit);
|
||||
bool uvedit_select_is_any_selected_multi(const Scene *scene, Object **objects, uint objects_len);
|
||||
/**
|
||||
* \warning This returns first selected UV,
|
||||
* not ideal in many cases since there could be multiple.
|
||||
*/
|
||||
const float *uvedit_first_selected_uv_from_vertex(Scene *scene, BMVert *eve, BMUVOffsets offsets);
|
||||
|
||||
void UV_OT_select_all(wmOperatorType *ot);
|
||||
void UV_OT_select(wmOperatorType *ot);
|
||||
void UV_OT_select_loop(wmOperatorType *ot);
|
||||
void UV_OT_select_edge_ring(wmOperatorType *ot);
|
||||
void UV_OT_select_linked(wmOperatorType *ot);
|
||||
void UV_OT_select_linked_pick(wmOperatorType *ot);
|
||||
void UV_OT_select_split(wmOperatorType *ot);
|
||||
void UV_OT_select_pinned(wmOperatorType *ot);
|
||||
void UV_OT_select_box(wmOperatorType *ot);
|
||||
void UV_OT_select_lasso(wmOperatorType *ot);
|
||||
void UV_OT_select_circle(wmOperatorType *ot);
|
||||
void UV_OT_select_more(wmOperatorType *ot);
|
||||
void UV_OT_select_less(wmOperatorType *ot);
|
||||
void UV_OT_select_overlap(wmOperatorType *ot);
|
||||
void UV_OT_select_similar(wmOperatorType *ot);
|
||||
/* Used only when UV sync select is disabled. */
|
||||
void UV_OT_select_mode(wmOperatorType *ot);
|
@ -56,7 +56,7 @@
|
||||
#include "UI_resources.hh"
|
||||
#include "UI_view2d.hh"
|
||||
|
||||
#include "uvedit_intern.h"
|
||||
#include "uvedit_intern.hh"
|
||||
|
||||
using namespace blender;
|
||||
|
||||
|
@ -52,7 +52,7 @@
|
||||
#include "UI_view2d.hh"
|
||||
|
||||
#include "intern/bmesh_marking.hh"
|
||||
#include "uvedit_intern.h"
|
||||
#include "uvedit_intern.hh"
|
||||
|
||||
#include "bmesh_tools.hh"
|
||||
|
||||
|
@ -44,7 +44,7 @@
|
||||
|
||||
#include "UI_view2d.hh"
|
||||
|
||||
#include "uvedit_intern.h"
|
||||
#include "uvedit_intern.hh"
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/** \name UV Loop Rip Data Struct
|
||||
|
@ -63,7 +63,7 @@
|
||||
|
||||
#include "UI_view2d.hh"
|
||||
|
||||
#include "uvedit_intern.h"
|
||||
#include "uvedit_intern.hh"
|
||||
|
||||
static void uv_select_all_perform(const Scene *scene, Object *obedit, int action);
|
||||
|
||||
|
@ -54,7 +54,7 @@
|
||||
#include "UI_resources.hh"
|
||||
#include "UI_view2d.hh"
|
||||
|
||||
#include "uvedit_intern.h"
|
||||
#include "uvedit_intern.hh"
|
||||
|
||||
/* ********************** smart stitch operator *********************** */
|
||||
|
||||
|
@ -73,7 +73,7 @@
|
||||
#include "WM_api.hh"
|
||||
#include "WM_types.hh"
|
||||
|
||||
#include "uvedit_intern.h"
|
||||
#include "uvedit_intern.hh"
|
||||
|
||||
using blender::geometry::ParamHandle;
|
||||
using blender::geometry::ParamKey;
|
||||
|
Loading…
Reference in New Issue
Block a user