WIP: Mesh: Improve and simplify modifier evaluation logic #119968
|
@ -29,10 +29,13 @@ struct EditMeshData {
|
|||
|
||||
} // namespace blender::bke
|
||||
|
||||
void BKE_editmesh_cache_ensure_face_normals(BMEditMesh &em, blender::bke::EditMeshData &emd);
|
||||
void BKE_editmesh_cache_ensure_vert_normals(BMEditMesh &em, blender::bke::EditMeshData &emd);
|
||||
blender::Span<blender::float3> BKE_editmesh_cache_ensure_face_normals(
|
||||
BMEditMesh &em, blender::bke::EditMeshData &emd);
|
||||
blender::Span<blender::float3> BKE_editmesh_cache_ensure_vert_normals(
|
||||
BMEditMesh &em, blender::bke::EditMeshData &emd);
|
||||
|
||||
void BKE_editmesh_cache_ensure_face_centers(BMEditMesh &em, blender::bke::EditMeshData &emd);
|
||||
blender::Span<blender::float3> BKE_editmesh_cache_ensure_face_centers(
|
||||
BMEditMesh &em, blender::bke::EditMeshData &emd);
|
||||
|
||||
std::optional<blender::Bounds<blender::float3>> BKE_editmesh_cache_calc_minmax(
|
||||
const BMEditMesh &em, const blender::bke::EditMeshData &emd);
|
||||
|
|
|
@ -83,7 +83,7 @@ bool BKE_linestyle_geometry_modifier_move(FreestyleLineStyle *linestyle,
|
|||
|
||||
void BKE_linestyle_modifier_list_color_ramps(FreestyleLineStyle *linestyle, ListBase *listbase);
|
||||
std::optional<std::string> BKE_linestyle_path_to_color_ramp(FreestyleLineStyle *linestyle,
|
||||
struct ColorBand *color_ramp);
|
||||
const struct ColorBand *color_ramp);
|
||||
|
||||
bool BKE_linestyle_use_textures(FreestyleLineStyle *linestyle, bool use_shading_nodes);
|
||||
|
||||
|
|
|
@ -67,8 +67,8 @@ void BKE_mask_point_free(struct MaskSplinePoint *point);
|
|||
void BKE_mask_layer_unique_name(struct Mask *mask, struct MaskLayer *masklay);
|
||||
void BKE_mask_layer_rename(struct Mask *mask,
|
||||
struct MaskLayer *masklay,
|
||||
char *oldname,
|
||||
char *newname);
|
||||
const char *oldname,
|
||||
const char *newname);
|
||||
|
||||
struct MaskLayer *BKE_mask_layer_copy(const struct MaskLayer *masklay);
|
||||
void BKE_mask_layer_copy_list(struct ListBase *masklayers_new, const struct ListBase *masklayers);
|
||||
|
|
|
@ -87,7 +87,7 @@ void BKE_movieclip_build_proxy_frame(struct MovieClip *clip,
|
|||
int clip_flag,
|
||||
struct MovieDistortion *distortion,
|
||||
int cfra,
|
||||
int *build_sizes,
|
||||
const int *build_sizes,
|
||||
int build_count,
|
||||
bool undistorted);
|
||||
|
||||
|
@ -99,7 +99,7 @@ void BKE_movieclip_build_proxy_frame_for_ibuf(struct MovieClip *clip,
|
|||
struct ImBuf *ibuf,
|
||||
struct MovieDistortion *distortion,
|
||||
int cfra,
|
||||
int *build_sizes,
|
||||
const int *build_sizes,
|
||||
int build_count,
|
||||
bool undistorted);
|
||||
bool BKE_movieclip_proxy_enabled(struct MovieClip *clip);
|
||||
|
|
|
@ -123,7 +123,7 @@ int BKE_packedfile_count_all(struct Main *bmain);
|
|||
*/
|
||||
enum ePF_FileCompare BKE_packedfile_compare_to_file(const char *ref_file_name,
|
||||
const char *filepath_rel,
|
||||
struct PackedFile *pf);
|
||||
const struct PackedFile *pf);
|
||||
|
||||
/* Read. */
|
||||
|
||||
|
@ -143,7 +143,7 @@ void BKE_packedfile_id_unpack(struct Main *bmain,
|
|||
struct ReportList *reports,
|
||||
enum ePF_FileStatus how);
|
||||
|
||||
void BKE_packedfile_blend_write(struct BlendWriter *writer, struct PackedFile *pf);
|
||||
void BKE_packedfile_blend_write(struct BlendWriter *writer, const struct PackedFile *pf);
|
||||
void BKE_packedfile_blend_read(struct BlendDataReader *reader, struct PackedFile **pf_p);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
@ -65,7 +65,7 @@ void txt_clean_text(struct Text *text);
|
|||
void txt_order_cursors(struct Text *text, bool reverse);
|
||||
int txt_find_string(struct Text *text, const char *findstr, int wrap, int match_case);
|
||||
bool txt_has_sel(const struct Text *text);
|
||||
int txt_get_span(struct TextLine *from, const struct TextLine *to);
|
||||
int txt_get_span(const struct TextLine *from, const struct TextLine *to);
|
||||
void txt_move_up(struct Text *text, bool sel);
|
||||
void txt_move_down(struct Text *text, bool sel);
|
||||
void txt_move_left(struct Text *text, bool sel);
|
||||
|
|
|
@ -221,7 +221,8 @@ struct CCGSubSurf {
|
|||
(void)0
|
||||
#define NormCopy(av, bv) \
|
||||
{ \
|
||||
float *_a = (float *)av, *_b = (float *)bv; \
|
||||
float *_a = (float *)av; \
|
||||
const float *_b = (const float *)bv; \
|
||||
_a[0] = _b[0]; \
|
||||
_a[1] = _b[1]; \
|
||||
_a[2] = _b[2]; \
|
||||
|
@ -229,7 +230,8 @@ struct CCGSubSurf {
|
|||
(void)0
|
||||
#define NormAdd(av, bv) \
|
||||
{ \
|
||||
float *_a = (float *)av, *_b = (float *)bv; \
|
||||
float *_a = (float *)av; \
|
||||
const float *_b = (const float *)bv; \
|
||||
_a[0] += _b[0]; \
|
||||
_a[1] += _b[1]; \
|
||||
_a[2] += _b[2]; \
|
||||
|
|
|
@ -70,12 +70,16 @@ static float *_face_getIFNoEdge(CCGFace *f,
|
|||
static void _face_calcIFNo(
|
||||
CCGFace *f, int lvl, int S, int x, int y, float no[3], int levels, int dataSize)
|
||||
{
|
||||
float *a = static_cast<float *>(ccg_face_getIFCo(f, lvl, S, x + 0, y + 0, levels, dataSize));
|
||||
float *b = static_cast<float *>(ccg_face_getIFCo(f, lvl, S, x + 1, y + 0, levels, dataSize));
|
||||
float *c = static_cast<float *>(ccg_face_getIFCo(f, lvl, S, x + 1, y + 1, levels, dataSize));
|
||||
float *d = static_cast<float *>(ccg_face_getIFCo(f, lvl, S, x + 0, y + 1, levels, dataSize));
|
||||
float a_cX = c[0] - a[0], a_cY = c[1] - a[1], a_cZ = c[2] - a[2];
|
||||
float b_dX = d[0] - b[0], b_dY = d[1] - b[1], b_dZ = d[2] - b[2];
|
||||
const float *a = static_cast<float *>(
|
||||
ccg_face_getIFCo(f, lvl, S, x + 0, y + 0, levels, dataSize));
|
||||
const float *b = static_cast<float *>(
|
||||
ccg_face_getIFCo(f, lvl, S, x + 1, y + 0, levels, dataSize));
|
||||
const float *c = static_cast<float *>(
|
||||
ccg_face_getIFCo(f, lvl, S, x + 1, y + 1, levels, dataSize));
|
||||
const float *d = static_cast<float *>(
|
||||
ccg_face_getIFCo(f, lvl, S, x + 0, y + 1, levels, dataSize));
|
||||
const float a_cX = c[0] - a[0], a_cY = c[1] - a[1], a_cZ = c[2] - a[2];
|
||||
const float b_dX = d[0] - b[0], b_dY = d[1] - b[1], b_dZ = d[2] - b[2];
|
||||
|
||||
no[0] = b_dY * a_cZ - b_dZ * a_cY;
|
||||
no[1] = b_dZ * a_cX - b_dX * a_cZ;
|
||||
|
|
|
@ -350,8 +350,8 @@ void action_group_colors_sync(bActionGroup *grp, const bActionGroup *ref_grp)
|
|||
if (grp->customCol) {
|
||||
if (grp->customCol > 0) {
|
||||
/* copy theme colors on-to group's custom color in case user tries to edit color */
|
||||
bTheme *btheme = static_cast<bTheme *>(U.themes.first);
|
||||
ThemeWireColor *col_set = &btheme->tarm[(grp->customCol - 1)];
|
||||
const bTheme *btheme = static_cast<const bTheme *>(U.themes.first);
|
||||
const ThemeWireColor *col_set = &btheme->tarm[(grp->customCol - 1)];
|
||||
|
||||
memcpy(&grp->cs, col_set, sizeof(ThemeWireColor));
|
||||
}
|
||||
|
|
|
@ -182,7 +182,7 @@ static BlendHandle *link_append_context_library_blohandle_ensure(
|
|||
lib_context->bf_reports.reports = reports;
|
||||
}
|
||||
|
||||
char *libname = lib_context->path;
|
||||
const char *libname = lib_context->path;
|
||||
BlendHandle *blo_handle = lib_context->blo_handle;
|
||||
if (blo_handle == nullptr) {
|
||||
if (STREQ(libname, BLO_EMBEDDED_STARTUP_BLEND)) {
|
||||
|
@ -1410,7 +1410,7 @@ void BKE_blendfile_link(BlendfileLinkAppendContext *lapp_context, ReportList *re
|
|||
{
|
||||
BlendfileLinkAppendContextLibrary *lib_context =
|
||||
static_cast<BlendfileLinkAppendContextLibrary *>(liblink->link);
|
||||
char *libname = lib_context->path;
|
||||
const char *libname = lib_context->path;
|
||||
BlendHandle *blo_handle = link_append_context_library_blohandle_ensure(
|
||||
lapp_context, lib_context, reports);
|
||||
|
||||
|
|
|
@ -4750,7 +4750,6 @@ bool BKE_nurb_valid_message(const int pnts,
|
|||
NURBSValidationStatus status = nurb_check_valid(
|
||||
pnts, order, flag, type, is_surf, &points_needed);
|
||||
|
||||
const char *msg_template = nullptr;
|
||||
switch (status) {
|
||||
case NURBSValidationStatus::Valid:
|
||||
message_dst[0] = 0;
|
||||
|
@ -4761,20 +4760,24 @@ bool BKE_nurb_valid_message(const int pnts,
|
|||
message_dst[0] = 0;
|
||||
return false;
|
||||
}
|
||||
msg_template = RPT_("At least two points required");
|
||||
BLI_strncpy(message_dst, RPT_("At least two points required"), maxncpy);
|
||||
break;
|
||||
case NURBSValidationStatus::MorePointsThanOrderRequired:
|
||||
msg_template = RPT_("Must have more control points than Order");
|
||||
BLI_strncpy(message_dst, RPT_("Must have more control points than Order"), maxncpy);
|
||||
break;
|
||||
case NURBSValidationStatus::MoreRowsForBezierRequired:
|
||||
msg_template = RPT_("%d more %s row(s) needed for Bézier");
|
||||
BLI_snprintf(message_dst,
|
||||
maxncpy,
|
||||
RPT_("%d more %s row(s) needed for Bézier"),
|
||||
points_needed,
|
||||
dir == 0 ? "U" : "V");
|
||||
break;
|
||||
case NURBSValidationStatus::MorePointsForBezierRequired:
|
||||
msg_template = RPT_("%d more point(s) needed for Bézier");
|
||||
BLI_snprintf(
|
||||
message_dst, maxncpy, RPT_("%d more point(s) needed for Bézier"), points_needed);
|
||||
break;
|
||||
}
|
||||
|
||||
BLI_snprintf(message_dst, maxncpy, msg_template, points_needed, dir == 0 ? "U" : "V");
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -17,14 +17,18 @@
|
|||
#include "BKE_editmesh.hh"
|
||||
#include "BKE_editmesh_cache.hh" /* own include */
|
||||
|
||||
using blender::float3;
|
||||
using blender::Span;
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/** \name Ensure Data (derived from coords)
|
||||
* \{ */
|
||||
|
||||
void BKE_editmesh_cache_ensure_face_normals(BMEditMesh &em, blender::bke::EditMeshData &emd)
|
||||
Span<float3> BKE_editmesh_cache_ensure_face_normals(BMEditMesh &em,
|
||||
blender::bke::EditMeshData &emd)
|
||||
{
|
||||
if (emd.vert_positions.is_empty() || !emd.face_normals.is_empty()) {
|
||||
return;
|
||||
return emd.face_normals;
|
||||
}
|
||||
BMesh *bm = em.bm;
|
||||
|
||||
|
@ -36,37 +40,35 @@ void BKE_editmesh_cache_ensure_face_normals(BMEditMesh &em, blender::bke::EditMe
|
|||
int i;
|
||||
BM_ITER_MESH_INDEX (efa, &fiter, bm, BM_FACES_OF_MESH, i) {
|
||||
BM_elem_index_set(efa, i); /* set_inline */
|
||||
BM_face_calc_normal_vcos(bm,
|
||||
efa,
|
||||
emd.face_normals[i],
|
||||
reinterpret_cast<const float(*)[3]>(emd.vert_positions.data()));
|
||||
BM_face_calc_normal_vcos(bm, efa, emd.face_normals[i], emd.vert_positions);
|
||||
}
|
||||
bm->elem_index_dirty &= ~BM_FACE;
|
||||
return emd.face_normals;
|
||||
}
|
||||
|
||||
void BKE_editmesh_cache_ensure_vert_normals(BMEditMesh &em, blender::bke::EditMeshData &emd)
|
||||
Span<float3> BKE_editmesh_cache_ensure_vert_normals(BMEditMesh &em,
|
||||
blender::bke::EditMeshData &emd)
|
||||
{
|
||||
if (emd.vert_positions.is_empty() || !emd.vert_normals.is_empty()) {
|
||||
return;
|
||||
return emd.vert_normals;
|
||||
}
|
||||
BMesh *bm = em.bm;
|
||||
|
||||
/* Calculate vertex normals from face normals. */
|
||||
BKE_editmesh_cache_ensure_face_normals(em, emd);
|
||||
const Span<float3> face_normals = BKE_editmesh_cache_ensure_face_normals(em, emd);
|
||||
|
||||
emd.vert_normals.reinitialize(bm->totvert);
|
||||
|
||||
BM_mesh_elem_index_ensure(bm, BM_FACE);
|
||||
BM_verts_calc_normal_vcos(bm,
|
||||
reinterpret_cast<const float(*)[3]>(emd.face_normals.data()),
|
||||
reinterpret_cast<const float(*)[3]>(emd.vert_positions.data()),
|
||||
reinterpret_cast<float(*)[3]>(emd.vert_normals.data()));
|
||||
BM_verts_calc_normal_vcos(bm, face_normals, emd.vert_positions, emd.vert_normals);
|
||||
return emd.vert_normals;
|
||||
}
|
||||
|
||||
void BKE_editmesh_cache_ensure_face_centers(BMEditMesh &em, blender::bke::EditMeshData &emd)
|
||||
Span<float3> BKE_editmesh_cache_ensure_face_centers(BMEditMesh &em,
|
||||
blender::bke::EditMeshData &emd)
|
||||
{
|
||||
if (!emd.face_centers.is_empty()) {
|
||||
return;
|
||||
return emd.face_centers;
|
||||
}
|
||||
BMesh *bm = em.bm;
|
||||
|
||||
|
@ -86,6 +88,7 @@ void BKE_editmesh_cache_ensure_face_centers(BMEditMesh &em, blender::bke::EditMe
|
|||
BM_face_calc_center_median_vcos(bm, efa, emd.face_centers[i], emd.vert_positions);
|
||||
}
|
||||
}
|
||||
return emd.face_centers;
|
||||
}
|
||||
|
||||
/** \} */
|
||||
|
|
|
@ -622,8 +622,8 @@ void BKE_image_free_old_gputextures(Main *bmain)
|
|||
/** \name Paint Update
|
||||
* \{ */
|
||||
|
||||
static ImBuf *update_do_scale(uchar *rect,
|
||||
float *rect_float,
|
||||
static ImBuf *update_do_scale(const uchar *rect,
|
||||
const float *rect_float,
|
||||
int *x,
|
||||
int *y,
|
||||
int *w,
|
||||
|
@ -662,8 +662,8 @@ static ImBuf *update_do_scale(uchar *rect,
|
|||
}
|
||||
|
||||
static void gpu_texture_update_scaled(GPUTexture *tex,
|
||||
uchar *rect,
|
||||
float *rect_float,
|
||||
const uchar *rect,
|
||||
const float *rect_float,
|
||||
int full_w,
|
||||
int full_h,
|
||||
int x,
|
||||
|
|
|
@ -1852,7 +1852,7 @@ void BKE_linestyle_modifier_list_color_ramps(FreestyleLineStyle *linestyle, List
|
|||
}
|
||||
|
||||
std::optional<std::string> BKE_linestyle_path_to_color_ramp(FreestyleLineStyle *linestyle,
|
||||
ColorBand *color_ramp)
|
||||
const ColorBand *color_ramp)
|
||||
{
|
||||
bool found = false;
|
||||
|
||||
|
|
|
@ -340,7 +340,10 @@ void BKE_mask_layer_unique_name(Mask *mask, MaskLayer *masklay)
|
|||
sizeof(masklay->name));
|
||||
}
|
||||
|
||||
void BKE_mask_layer_rename(Mask *mask, MaskLayer *masklay, char *oldname, char *newname)
|
||||
void BKE_mask_layer_rename(Mask *mask,
|
||||
MaskLayer *masklay,
|
||||
const char *oldname,
|
||||
const char *newname)
|
||||
{
|
||||
STRNCPY(masklay->name, newname);
|
||||
|
||||
|
|
|
@ -44,16 +44,16 @@ static void reserve_hash_maps(const Mesh &mesh,
|
|||
edge_maps, [&](EdgeMap &edge_map) { edge_map.reserve(totedge_guess / edge_maps.size()); });
|
||||
}
|
||||
|
||||
static void add_existing_edges_to_hash_maps(Mesh &mesh,
|
||||
MutableSpan<EdgeMap> edge_maps,
|
||||
uint32_t parallel_mask)
|
||||
static void add_existing_edges_to_hash_maps(const Mesh &mesh,
|
||||
const uint32_t parallel_mask,
|
||||
MutableSpan<EdgeMap> edge_maps)
|
||||
{
|
||||
/* Assume existing edges are valid. */
|
||||
const Span<int2> edges = mesh.edges();
|
||||
threading::parallel_for_each(edge_maps, [&](EdgeMap &edge_map) {
|
||||
const int task_index = &edge_map - edge_maps.data();
|
||||
for (const int2 &edge : edges) {
|
||||
OrderedEdge ordered_edge{edge[0], edge[1]};
|
||||
const OrderedEdge ordered_edge(edge[0], edge[1]);
|
||||
/* Only add the edge when it belongs into this map. */
|
||||
if (task_index == (parallel_mask & edge_hash_2(ordered_edge))) {
|
||||
edge_map.add_new(ordered_edge, {&edge});
|
||||
|
@ -62,27 +62,27 @@ static void add_existing_edges_to_hash_maps(Mesh &mesh,
|
|||
});
|
||||
}
|
||||
|
||||
static void add_face_edges_to_hash_maps(Mesh &mesh,
|
||||
MutableSpan<EdgeMap> edge_maps,
|
||||
uint32_t parallel_mask)
|
||||
static void add_face_edges_to_hash_maps(const Mesh &mesh,
|
||||
const uint32_t parallel_mask,
|
||||
MutableSpan<EdgeMap> edge_maps)
|
||||
{
|
||||
const OffsetIndices faces = mesh.faces();
|
||||
const OffsetIndices<int> faces = mesh.faces();
|
||||
const Span<int> corner_verts = mesh.corner_verts();
|
||||
threading::parallel_for_each(edge_maps, [&](EdgeMap &edge_map) {
|
||||
const int task_index = &edge_map - edge_maps.data();
|
||||
for (const int i : faces.index_range()) {
|
||||
const Span<int> face_verts = corner_verts.slice(faces[i]);
|
||||
int vert_prev = face_verts.last();
|
||||
for (const int vert : face_verts) {
|
||||
for (const int face_i : faces.index_range()) {
|
||||
const IndexRange face = faces[face_i];
|
||||
for (const int corner : face) {
|
||||
const int vert = corner_verts[corner];
|
||||
const int vert_prev = corner_verts[bke::mesh::face_corner_prev(face, corner)];
|
||||
/* Can only be the same when the mesh data is invalid. */
|
||||
if (vert_prev != vert) {
|
||||
OrderedEdge ordered_edge{vert_prev, vert};
|
||||
const OrderedEdge ordered_edge(vert_prev, vert);
|
||||
/* Only add the edge when it belongs into this map. */
|
||||
if (task_index == (parallel_mask & edge_hash_2(ordered_edge))) {
|
||||
edge_map.lookup_or_add(ordered_edge, {nullptr});
|
||||
}
|
||||
}
|
||||
vert_prev = vert;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -94,16 +94,16 @@ static void serialize_and_initialize_deduplicated_edges(MutableSpan<EdgeMap> edg
|
|||
/* All edges are distributed in the hash tables now. They have to be serialized into a single
|
||||
* array below. To be able to parallelize this, we have to compute edge index offsets for each
|
||||
* map. */
|
||||
Array<int> edge_index_offsets(edge_maps.size());
|
||||
edge_index_offsets[0] = 0;
|
||||
for (const int i : IndexRange(edge_maps.size() - 1)) {
|
||||
edge_index_offsets[i + 1] = edge_index_offsets[i] + edge_maps[i].size();
|
||||
Array<int> edge_sizes(edge_maps.size() + 1);
|
||||
for (const int i : edge_maps.index_range()) {
|
||||
edge_sizes[i] = edge_maps[i].size();
|
||||
}
|
||||
const OffsetIndices<int> edge_offsets = offset_indices::accumulate_counts_to_offsets(edge_sizes);
|
||||
|
||||
threading::parallel_for_each(edge_maps, [&](EdgeMap &edge_map) {
|
||||
const int task_index = &edge_map - edge_maps.data();
|
||||
|
||||
int new_edge_index = edge_index_offsets[task_index];
|
||||
int new_edge_index = edge_offsets[task_index].first();
|
||||
for (EdgeMap::MutableItem item : edge_map.items()) {
|
||||
int2 &new_edge = new_edges[new_edge_index];
|
||||
const int2 *orig_edge = item.value.original_edge;
|
||||
|
@ -113,8 +113,7 @@ static void serialize_and_initialize_deduplicated_edges(MutableSpan<EdgeMap> edg
|
|||
}
|
||||
else {
|
||||
/* Initialize new edge. */
|
||||
new_edge[0] = item.key.v_low;
|
||||
new_edge[1] = item.key.v_high;
|
||||
new_edge = int2(item.key.v_low, item.key.v_high);
|
||||
}
|
||||
item.value.index = new_edge_index;
|
||||
new_edge_index++;
|
||||
|
@ -131,14 +130,13 @@ static void update_edge_indices_in_face_loops(const OffsetIndices<int> faces,
|
|||
threading::parallel_for(faces.index_range(), 100, [&](IndexRange range) {
|
||||
for (const int face_index : range) {
|
||||
const IndexRange face = faces[face_index];
|
||||
int prev_corner = face.last();
|
||||
for (const int next_corner : face) {
|
||||
const int vert = corner_verts[next_corner];
|
||||
const int vert_prev = corner_verts[prev_corner];
|
||||
for (const int corner : face) {
|
||||
const int vert = corner_verts[corner];
|
||||
const int vert_prev = corner_verts[bke::mesh::face_corner_next(face, corner)];
|
||||
|
||||
int edge_index;
|
||||
if (vert_prev != vert) {
|
||||
OrderedEdge ordered_edge{vert_prev, vert};
|
||||
const OrderedEdge ordered_edge(vert_prev, vert);
|
||||
/* Double lookup: First find the map that contains the edge, then lookup the edge. */
|
||||
const EdgeMap &edge_map = edge_maps[parallel_mask & edge_hash_2(ordered_edge)];
|
||||
edge_index = edge_map.lookup(ordered_edge).index;
|
||||
|
@ -149,8 +147,7 @@ static void update_edge_indices_in_face_loops(const OffsetIndices<int> faces,
|
|||
* #76514. */
|
||||
edge_index = 0;
|
||||
}
|
||||
corner_edges[prev_corner] = edge_index;
|
||||
prev_corner = next_corner;
|
||||
corner_edges[corner] = edge_index;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -187,21 +184,20 @@ void mesh_calc_edges(Mesh &mesh, bool keep_existing_edges, const bool select_new
|
|||
|
||||
/* Add all edges. */
|
||||
if (keep_existing_edges) {
|
||||
calc_edges::add_existing_edges_to_hash_maps(mesh, edge_maps, parallel_mask);
|
||||
calc_edges::add_existing_edges_to_hash_maps(mesh, parallel_mask, edge_maps);
|
||||
}
|
||||
calc_edges::add_face_edges_to_hash_maps(mesh, edge_maps, parallel_mask);
|
||||
calc_edges::add_face_edges_to_hash_maps(mesh, parallel_mask, edge_maps);
|
||||
|
||||
/* Compute total number of edges. */
|
||||
int new_totedge = 0;
|
||||
for (calc_edges::EdgeMap &edge_map : edge_maps) {
|
||||
for (const calc_edges::EdgeMap &edge_map : edge_maps) {
|
||||
new_totedge += edge_map.size();
|
||||
}
|
||||
|
||||
/* Create new edges. */
|
||||
MutableAttributeAccessor attributes = mesh.attributes_for_write();
|
||||
attributes.add<int>(".corner_edge", AttrDomain::Corner, AttributeInitConstruct());
|
||||
MutableSpan<int2> new_edges{
|
||||
static_cast<int2 *>(MEM_calloc_arrayN(new_totedge, sizeof(int2), __func__)), new_totedge};
|
||||
MutableSpan<int2> new_edges(MEM_cnew_array<int2>(new_totedge, __func__), new_totedge);
|
||||
calc_edges::serialize_and_initialize_deduplicated_edges(edge_maps, new_edges);
|
||||
calc_edges::update_edge_indices_in_face_loops(
|
||||
mesh.faces(), mesh.corner_verts(), edge_maps, parallel_mask, mesh.corner_edges_for_write());
|
||||
|
@ -219,7 +215,7 @@ void mesh_calc_edges(Mesh &mesh, bool keep_existing_edges, const bool select_new
|
|||
if (select_edge) {
|
||||
int new_edge_index = 0;
|
||||
for (const calc_edges::EdgeMap &edge_map : edge_maps) {
|
||||
for (calc_edges::EdgeMap::Item item : edge_map.items()) {
|
||||
for (const calc_edges::EdgeMap::Item item : edge_map.items()) {
|
||||
if (item.value.original_edge == nullptr) {
|
||||
select_edge.span[new_edge_index] = true;
|
||||
}
|
||||
|
|
|
@ -45,8 +45,7 @@ void BKE_mesh_foreach_mapped_vert(
|
|||
const blender::Span<blender::float3> positions = mesh->runtime->edit_data->vert_positions;
|
||||
blender::Span<blender::float3> vert_normals;
|
||||
if (flag & MESH_FOREACH_USE_NORMAL) {
|
||||
BKE_editmesh_cache_ensure_vert_normals(*em, *mesh->runtime->edit_data);
|
||||
vert_normals = mesh->runtime->edit_data->vert_normals;
|
||||
vert_normals = BKE_editmesh_cache_ensure_vert_normals(*em, *mesh->runtime->edit_data);
|
||||
}
|
||||
BM_ITER_MESH_INDEX (eve, &iter, bm, BM_VERTS_OF_MESH, i) {
|
||||
const float *no = (flag & MESH_FOREACH_USE_NORMAL) ? &vert_normals[i].x : nullptr;
|
||||
|
@ -236,18 +235,16 @@ void BKE_mesh_foreach_mapped_face_center(
|
|||
if (mesh->runtime->edit_mesh != nullptr && mesh->runtime->edit_data != nullptr) {
|
||||
BMEditMesh *em = mesh->runtime->edit_mesh;
|
||||
BMesh *bm = em->bm;
|
||||
blender::Span<blender::float3> face_centers;
|
||||
blender::Span<blender::float3> face_normals;
|
||||
BMFace *efa;
|
||||
BMIter iter;
|
||||
int i;
|
||||
|
||||
BKE_editmesh_cache_ensure_face_centers(*em, *mesh->runtime->edit_data);
|
||||
face_centers = mesh->runtime->edit_data->face_centers; /* always set */
|
||||
const Span<float3> face_centers = BKE_editmesh_cache_ensure_face_centers(
|
||||
*em, *mesh->runtime->edit_data);
|
||||
|
||||
Span<float3> face_normals;
|
||||
if (flag & MESH_FOREACH_USE_NORMAL) {
|
||||
BKE_editmesh_cache_ensure_face_normals(*em, *mesh->runtime->edit_data);
|
||||
face_normals = mesh->runtime->edit_data->face_normals; /* maybe nullptr */
|
||||
face_normals = BKE_editmesh_cache_ensure_face_normals(*em, *mesh->runtime->edit_data);
|
||||
}
|
||||
|
||||
if (!face_normals.is_empty()) {
|
||||
|
|
|
@ -161,8 +161,8 @@ Span<float3> BKE_mesh_wrapper_face_normals(Mesh *mesh)
|
|||
{
|
||||
switch (mesh->runtime->wrapper_type) {
|
||||
case ME_WRAPPER_TYPE_BMESH:
|
||||
BKE_editmesh_cache_ensure_face_normals(*mesh->runtime->edit_mesh, *mesh->runtime->edit_data);
|
||||
return mesh->runtime->edit_data->face_normals;
|
||||
return BKE_editmesh_cache_ensure_face_normals(*mesh->runtime->edit_mesh,
|
||||
*mesh->runtime->edit_data);
|
||||
case ME_WRAPPER_TYPE_MDATA:
|
||||
case ME_WRAPPER_TYPE_SUBD:
|
||||
return mesh->face_normals();
|
||||
|
@ -175,10 +175,10 @@ void BKE_mesh_wrapper_tag_positions_changed(Mesh *mesh)
|
|||
{
|
||||
switch (mesh->runtime->wrapper_type) {
|
||||
case ME_WRAPPER_TYPE_BMESH:
|
||||
if (mesh->runtime->edit_data) {
|
||||
mesh->runtime->edit_data->vert_normals = {};
|
||||
mesh->runtime->edit_data->face_centers = {};
|
||||
mesh->runtime->edit_data->face_normals = {};
|
||||
if (blender::bke::EditMeshData *edit_data = mesh->runtime->edit_data.get()) {
|
||||
edit_data->vert_normals = {};
|
||||
edit_data->face_centers = {};
|
||||
edit_data->face_normals = {};
|
||||
}
|
||||
break;
|
||||
case ME_WRAPPER_TYPE_MDATA:
|
||||
|
|
|
@ -1804,7 +1804,7 @@ void BKE_movieclip_build_proxy_frame(MovieClip *clip,
|
|||
int clip_flag,
|
||||
MovieDistortion *distortion,
|
||||
int cfra,
|
||||
int *build_sizes,
|
||||
const int *build_sizes,
|
||||
int build_count,
|
||||
bool undistorted)
|
||||
{
|
||||
|
@ -1845,7 +1845,7 @@ void BKE_movieclip_build_proxy_frame_for_ibuf(MovieClip *clip,
|
|||
ImBuf *ibuf,
|
||||
MovieDistortion *distortion,
|
||||
int cfra,
|
||||
int *build_sizes,
|
||||
const int *build_sizes,
|
||||
int build_count,
|
||||
bool undistorted)
|
||||
{
|
||||
|
|
|
@ -444,17 +444,17 @@ static void make_child_duplis(const DupliContext *ctx,
|
|||
|
||||
static const Mesh *mesh_data_from_duplicator_object(Object *ob,
|
||||
BMEditMesh **r_em,
|
||||
const float (**r_vert_coords)[3],
|
||||
const float (**r_vert_normals)[3])
|
||||
Span<float3> *r_vert_coords,
|
||||
Span<float3> *r_vert_normals)
|
||||
{
|
||||
/* Gather mesh info. */
|
||||
BMEditMesh *em = BKE_editmesh_from_object(ob);
|
||||
const Mesh *mesh_eval;
|
||||
|
||||
*r_em = nullptr;
|
||||
*r_vert_coords = nullptr;
|
||||
*r_vert_coords = {};
|
||||
if (r_vert_normals != nullptr) {
|
||||
*r_vert_normals = nullptr;
|
||||
*r_vert_normals = {};
|
||||
}
|
||||
|
||||
/* We do not need any render-specific handling anymore, depsgraph takes care of that. */
|
||||
|
@ -473,10 +473,9 @@ static const Mesh *mesh_data_from_duplicator_object(Object *ob,
|
|||
mesh_eval = nullptr;
|
||||
|
||||
if ((emd != nullptr) && !emd->vert_positions.is_empty()) {
|
||||
*r_vert_coords = reinterpret_cast<const float(*)[3]>(emd->vert_positions.data());
|
||||
*r_vert_coords = emd->vert_positions;
|
||||
if (r_vert_normals != nullptr) {
|
||||
BKE_editmesh_cache_ensure_vert_normals(*em, *emd);
|
||||
*r_vert_normals = reinterpret_cast<const float(*)[3]>(emd->vert_normals.data());
|
||||
*r_vert_normals = BKE_editmesh_cache_ensure_vert_normals(*em, *emd);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -563,9 +562,9 @@ struct VertexDupliData_EditMesh {
|
|||
|
||||
BMEditMesh *em;
|
||||
|
||||
/* Can be nullptr. */
|
||||
const float (*vert_positions_deform)[3];
|
||||
const float (*vert_normals_deform)[3];
|
||||
/* Can be empty. */
|
||||
Span<float3> vert_positions_deform;
|
||||
Span<float3> vert_normals_deform;
|
||||
|
||||
/**
|
||||
* \note The edit-mesh may assign #DupliObject.orco in cases when a regular mesh wouldn't.
|
||||
|
@ -582,8 +581,8 @@ struct VertexDupliData_EditMesh {
|
|||
* currently this is copied from a `short[3]` normal without division.
|
||||
* Can be null when \a use_rotation is false.
|
||||
*/
|
||||
static void get_duplivert_transform(const float co[3],
|
||||
const float no[3],
|
||||
static void get_duplivert_transform(const float3 &co,
|
||||
const float3 &no,
|
||||
const bool use_rotation,
|
||||
const short axis,
|
||||
const short upflag,
|
||||
|
@ -609,8 +608,8 @@ static DupliObject *vertex_dupli(const DupliContext *ctx,
|
|||
Object *inst_ob,
|
||||
const float child_imat[4][4],
|
||||
int index,
|
||||
const float co[3],
|
||||
const float no[3],
|
||||
const float3 &co,
|
||||
const float3 &no,
|
||||
const bool use_rotation)
|
||||
{
|
||||
/* `obmat` is transform to vertex. */
|
||||
|
@ -681,14 +680,13 @@ static void make_child_duplis_verts_from_editmesh(const DupliContext *ctx,
|
|||
BMIter iter;
|
||||
int i;
|
||||
|
||||
const float(*vert_positions_deform)[3] = vdd->vert_positions_deform;
|
||||
const float(*vert_normals_deform)[3] = vdd->vert_normals_deform;
|
||||
|
||||
const Span<float3> vert_positions_deform = vdd->vert_positions_deform;
|
||||
const Span<float3> vert_normals_deform = vdd->vert_normals_deform;
|
||||
BM_ITER_MESH_INDEX (v, &iter, em->bm, BM_VERTS_OF_MESH, i) {
|
||||
const float *co, *no;
|
||||
if (vert_positions_deform != nullptr) {
|
||||
float3 co, no;
|
||||
if (!vert_positions_deform.is_empty()) {
|
||||
co = vert_positions_deform[i];
|
||||
no = vert_normals_deform ? vert_normals_deform[i] : nullptr;
|
||||
no = !vert_normals_deform.is_empty() ? vert_normals_deform[i] : float3(0);
|
||||
}
|
||||
else {
|
||||
co = v->co;
|
||||
|
@ -709,8 +707,8 @@ static void make_duplis_verts(const DupliContext *ctx)
|
|||
|
||||
/* Gather mesh info. */
|
||||
BMEditMesh *em = nullptr;
|
||||
const float(*vert_positions_deform)[3] = nullptr;
|
||||
const float(*vert_normals_deform)[3] = nullptr;
|
||||
Span<float3> vert_positions_deform;
|
||||
Span<float3> vert_normals_deform;
|
||||
const Mesh *mesh_eval = mesh_data_from_duplicator_object(
|
||||
parent, &em, &vert_positions_deform, use_rotation ? &vert_normals_deform : nullptr);
|
||||
if (em == nullptr && mesh_eval == nullptr) {
|
||||
|
@ -725,7 +723,7 @@ static void make_duplis_verts(const DupliContext *ctx)
|
|||
vdd.em = em;
|
||||
vdd.vert_positions_deform = vert_positions_deform;
|
||||
vdd.vert_normals_deform = vert_normals_deform;
|
||||
vdd.has_orco = (vert_positions_deform != nullptr);
|
||||
vdd.has_orco = !vert_positions_deform.is_empty();
|
||||
|
||||
make_child_duplis(ctx, &vdd, make_child_duplis_verts_from_editmesh);
|
||||
}
|
||||
|
@ -1080,8 +1078,8 @@ struct FaceDupliData_EditMesh {
|
|||
|
||||
bool has_orco, has_uvs;
|
||||
int cd_loop_uv_offset;
|
||||
/* Can be nullptr. */
|
||||
const float (*vert_positions_deform)[3];
|
||||
/* Can be empty. */
|
||||
Span<float3> vert_positions_deform;
|
||||
};
|
||||
|
||||
static void get_dupliface_transform_from_coords(Span<float3> coords,
|
||||
|
@ -1186,7 +1184,7 @@ static DupliObject *face_dupli_from_editmesh(const DupliContext *ctx,
|
|||
|
||||
/* Mesh variables. */
|
||||
BMFace *f,
|
||||
const float (*vert_positions_deform)[3])
|
||||
const Span<float3> vert_positions_deform)
|
||||
{
|
||||
const int coords_len = f->len;
|
||||
Array<float3, 64> coords(coords_len);
|
||||
|
@ -1194,7 +1192,7 @@ static DupliObject *face_dupli_from_editmesh(const DupliContext *ctx,
|
|||
BMLoop *l_first, *l_iter;
|
||||
int i = 0;
|
||||
l_iter = l_first = BM_FACE_FIRST_LOOP(f);
|
||||
if (vert_positions_deform != nullptr) {
|
||||
if (!vert_positions_deform.is_empty()) {
|
||||
do {
|
||||
copy_v3_v3(coords[i++], vert_positions_deform[BM_elem_index_get(l_iter->v)]);
|
||||
} while ((l_iter = l_iter->next) != l_first);
|
||||
|
@ -1263,9 +1261,9 @@ static void make_child_duplis_faces_from_editmesh(const DupliContext *ctx,
|
|||
BMIter iter;
|
||||
const bool use_scale = fdd->params.use_scale;
|
||||
|
||||
const float(*vert_positions_deform)[3] = fdd->vert_positions_deform;
|
||||
const Span<float3> vert_positions_deform = fdd->vert_positions_deform;
|
||||
|
||||
BLI_assert((vert_positions_deform == nullptr) || (em->bm->elem_index_dirty & BM_VERT) == 0);
|
||||
BLI_assert(vert_positions_deform.is_empty() || (em->bm->elem_index_dirty & BM_VERT) == 0);
|
||||
|
||||
invert_m4_m4(inst_ob->runtime->world_to_object.ptr(), inst_ob->object_to_world().ptr());
|
||||
/* Relative transform from parent to child space. */
|
||||
|
@ -1296,7 +1294,7 @@ static void make_duplis_faces(const DupliContext *ctx)
|
|||
|
||||
/* Gather mesh info. */
|
||||
BMEditMesh *em = nullptr;
|
||||
const float(*vert_positions_deform)[3] = nullptr;
|
||||
Span<float3> vert_positions_deform;
|
||||
const Mesh *mesh_eval = mesh_data_from_duplicator_object(
|
||||
parent, &em, &vert_positions_deform, nullptr);
|
||||
if (em == nullptr && mesh_eval == nullptr) {
|
||||
|
@ -1311,7 +1309,7 @@ static void make_duplis_faces(const DupliContext *ctx)
|
|||
fdd.params = fdd_params;
|
||||
fdd.em = em;
|
||||
fdd.vert_positions_deform = vert_positions_deform;
|
||||
fdd.has_orco = (vert_positions_deform != nullptr);
|
||||
fdd.has_orco = !vert_positions_deform.is_empty();
|
||||
fdd.has_uvs = (uv_idx != -1);
|
||||
fdd.cd_loop_uv_offset = (uv_idx != -1) ?
|
||||
CustomData_get_n_offset(&em->bm->ldata, CD_PROP_FLOAT2, uv_idx) :
|
||||
|
|
|
@ -367,7 +367,7 @@ int BKE_packedfile_write_to_file(ReportList *reports,
|
|||
|
||||
enum ePF_FileCompare BKE_packedfile_compare_to_file(const char *ref_file_name,
|
||||
const char *filepath_rel,
|
||||
PackedFile *pf)
|
||||
const PackedFile *pf)
|
||||
{
|
||||
BLI_stat_t st;
|
||||
enum ePF_FileCompare ret_val;
|
||||
|
@ -880,7 +880,7 @@ void BKE_packedfile_id_unpack(Main *bmain, ID *id, ReportList *reports, enum ePF
|
|||
}
|
||||
}
|
||||
|
||||
void BKE_packedfile_blend_write(BlendWriter *writer, PackedFile *pf)
|
||||
void BKE_packedfile_blend_write(BlendWriter *writer, const PackedFile *pf)
|
||||
{
|
||||
if (pf == nullptr) {
|
||||
return;
|
||||
|
|
|
@ -795,7 +795,7 @@ static void subdiv_ccg_average_inner_face_grids(SubdivCCG &subdiv_ccg,
|
|||
|
||||
static void subdiv_ccg_average_grids_boundary(SubdivCCG &subdiv_ccg,
|
||||
const CCGKey &key,
|
||||
SubdivCCGAdjacentEdge &adjacent_edge,
|
||||
const SubdivCCGAdjacentEdge &adjacent_edge,
|
||||
MutableSpan<GridElementAccumulator> accumulators)
|
||||
{
|
||||
const int num_adjacent_faces = adjacent_edge.num_adjacent_faces;
|
||||
|
@ -837,7 +837,7 @@ struct AverageGridsCornerData {
|
|||
|
||||
static void subdiv_ccg_average_grids_corners(SubdivCCG &subdiv_ccg,
|
||||
const CCGKey &key,
|
||||
SubdivCCGAdjacentVertex &adjacent_vertex)
|
||||
const SubdivCCGAdjacentVertex &adjacent_vertex)
|
||||
{
|
||||
const int num_adjacent_faces = adjacent_vertex.num_adjacent_faces;
|
||||
if (num_adjacent_faces == 1) {
|
||||
|
@ -871,7 +871,7 @@ static void subdiv_ccg_average_boundaries(SubdivCCG &subdiv_ccg,
|
|||
adjacent_edge_mask.foreach_segment(GrainSize(1024), [&](const IndexMaskSegment segment) {
|
||||
MutableSpan<GridElementAccumulator> accumulators = all_accumulators.local();
|
||||
for (const int i : segment) {
|
||||
SubdivCCGAdjacentEdge &adjacent_edge = subdiv_ccg.adjacent_edges[i];
|
||||
const SubdivCCGAdjacentEdge &adjacent_edge = subdiv_ccg.adjacent_edges[i];
|
||||
subdiv_ccg_average_grids_boundary(subdiv_ccg, key, adjacent_edge, accumulators);
|
||||
}
|
||||
});
|
||||
|
@ -883,7 +883,7 @@ static void subdiv_ccg_average_corners(SubdivCCG &subdiv_ccg,
|
|||
{
|
||||
using namespace blender;
|
||||
adjacent_vert_mask.foreach_index(GrainSize(1024), [&](const int i) {
|
||||
SubdivCCGAdjacentVertex &adjacent_vert = subdiv_ccg.adjacent_verts[i];
|
||||
const SubdivCCGAdjacentVertex &adjacent_vert = subdiv_ccg.adjacent_verts[i];
|
||||
subdiv_ccg_average_grids_corners(subdiv_ccg, key, adjacent_vert);
|
||||
});
|
||||
}
|
||||
|
|
|
@ -673,10 +673,10 @@ void txt_clean_text(Text *text)
|
|||
}
|
||||
}
|
||||
|
||||
int txt_get_span(TextLine *from, const TextLine *to)
|
||||
int txt_get_span(const TextLine *from, const TextLine *to)
|
||||
{
|
||||
int ret = 0;
|
||||
TextLine *tmp = from;
|
||||
const TextLine *tmp = from;
|
||||
|
||||
if (!to || !from) {
|
||||
return 0;
|
||||
|
|
|
@ -27,7 +27,7 @@ BArrayStore *BLI_array_store_at_size_get(struct BArrayStore_AtSize *bs_stride, i
|
|||
|
||||
void BLI_array_store_at_size_clear(struct BArrayStore_AtSize *bs_stride);
|
||||
|
||||
void BLI_array_store_at_size_calc_memory_usage(struct BArrayStore_AtSize *bs_stride,
|
||||
void BLI_array_store_at_size_calc_memory_usage(const struct BArrayStore_AtSize *bs_stride,
|
||||
size_t *r_size_expanded,
|
||||
size_t *r_size_compacted);
|
||||
|
||||
|
|
|
@ -45,6 +45,10 @@ extern "C" {
|
|||
#define BLI_STR_UTF8_DOWNWARDS_ARROW "\xe2\x86\x93"
|
||||
/** u21E7: `⇧` */
|
||||
#define BLI_STR_UTF8_UPWARDS_WHITE_ARROW "\xe2\x87\xa7"
|
||||
/** u21FF: `⇪` For caps lock */
|
||||
#define BLI_STR_UTF8_UPWARDS_UP_ARROW_FROM_BAR "\xe2\x87\xaa"
|
||||
/** u2277: `≷` Greater than / Less than */
|
||||
#define BLI_STR_UTF8_GREATER_THAN_OR_LESS_THAN "\xe2\x89\xb7"
|
||||
/** u2303: `⌃` */
|
||||
#define BLI_STR_UTF8_UP_ARROWHEAD "\xe2\x8c\x83"
|
||||
/** u2318: `⌘` */
|
||||
|
@ -67,12 +71,22 @@ extern "C" {
|
|||
#define BLI_STR_UTF8_BLACK_SQUARE_FOR_STOP "\xe2\x8f\xb9"
|
||||
/** u2423: `␣` */
|
||||
#define BLI_STR_UTF8_OPEN_BOX "\xe2\x90\xa3"
|
||||
/** u25A6: `▦` */
|
||||
#define BLI_STR_UTF8_SQUARE_WITH_ORTHOGONAL_CROSSHATCH "\xe2\x96\xa6"
|
||||
/** u25B8: `▸` */
|
||||
#define BLI_STR_UTF8_BLACK_RIGHT_POINTING_SMALL_TRIANGLE "\xe2\x96\xb8"
|
||||
/** u2B7E: `⭾` */
|
||||
#define BLI_STR_UTF8_HORIZONTAL_TAB_KEY "\xe2\xad\xbe"
|
||||
/** u270E: `✎` Tablet Pen */
|
||||
#define BLI_STR_UTF8_LOWER_RIGHT_PENCIL "\xe2\x9c\x8e"
|
||||
/** u2710: `✐` Tablet Eraser */
|
||||
#define BLI_STR_UTF8_UPPER_RIGHT_PENCIL "\xe2\x9c\x90"
|
||||
/** u2756: `❖` */
|
||||
#define BLI_STR_UTF8_BLACK_DIAMOND_MINUS_WHITE_X "\xe2\x9d\x96"
|
||||
/** u29BE: `⦾` Use for 3D Mice */
|
||||
#define BLI_STR_UTF8_CIRCLED_WHITE_BULLET "\xe2\xa6\xbe"
|
||||
/** u2B2E: `⬮` Generic Mouse */
|
||||
#define BLI_STR_UTF8_BLACK_VERTICAL_ELLIPSE "\xe2\xac\xae"
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -59,14 +59,14 @@ void BLI_array_store_at_size_clear(BArrayStore_AtSize *bs_stride)
|
|||
bs_stride->stride_table_len = 0;
|
||||
}
|
||||
|
||||
void BLI_array_store_at_size_calc_memory_usage(BArrayStore_AtSize *bs_stride,
|
||||
void BLI_array_store_at_size_calc_memory_usage(const BArrayStore_AtSize *bs_stride,
|
||||
size_t *r_size_expanded,
|
||||
size_t *r_size_compacted)
|
||||
{
|
||||
size_t size_compacted = 0;
|
||||
size_t size_expanded = 0;
|
||||
for (int i = 0; i < bs_stride->stride_table_len; i++) {
|
||||
BArrayStore *bs = bs_stride->stride_table[i];
|
||||
const BArrayStore *bs = bs_stride->stride_table[i];
|
||||
if (bs) {
|
||||
size_compacted += BLI_array_store_calc_size_compacted_get(bs);
|
||||
size_expanded += BLI_array_store_calc_size_expanded_get(bs);
|
||||
|
|
|
@ -126,7 +126,7 @@ bool BLO_main_validate_libraries(Main *bmain, ReportList *reports)
|
|||
|
||||
LinkNode *name = names;
|
||||
for (; name; name = name->next) {
|
||||
char *str_name = (char *)name->link;
|
||||
const char *str_name = (const char *)name->link;
|
||||
if (id->name[2] == str_name[0] && STREQ(str_name, id->name + 2)) {
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
|
||||
#include "DNA_scene_types.h"
|
||||
|
||||
#include "BLI_array.hh"
|
||||
#include "BLI_bitmap.h"
|
||||
#include "BLI_linklist_stack.h"
|
||||
#include "BLI_math_base.hh"
|
||||
|
@ -29,15 +30,18 @@
|
|||
|
||||
#include "intern/bmesh_private.hh"
|
||||
|
||||
using blender::Array;
|
||||
using blender::float3;
|
||||
using blender::MutableSpan;
|
||||
using blender::Span;
|
||||
|
||||
/* Smooth angle to use when tagging edges is disabled entirely. */
|
||||
#define EDGE_TAG_FROM_SPLIT_ANGLE_BYPASS -FLT_MAX
|
||||
|
||||
static void bm_edge_tag_from_smooth_and_set_sharp(const float (*fnos)[3],
|
||||
static void bm_edge_tag_from_smooth_and_set_sharp(Span<float3> fnos,
|
||||
BMEdge *e,
|
||||
const float split_angle_cos);
|
||||
static void bm_edge_tag_from_smooth(const float (*fnos)[3],
|
||||
BMEdge *e,
|
||||
const float split_angle_cos);
|
||||
static void bm_edge_tag_from_smooth(Span<float3> fnos, BMEdge *e, const float split_angle_cos);
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/** \name Update Vertex & Face Normals
|
||||
|
@ -53,11 +57,11 @@ static void bm_edge_tag_from_smooth(const float (*fnos)[3],
|
|||
|
||||
struct BMVertsCalcNormalsWithCoordsData {
|
||||
/* Read-only data. */
|
||||
const float (*fnos)[3];
|
||||
const float (*vcos)[3];
|
||||
Span<float3> fnos;
|
||||
Span<float3> vcos;
|
||||
|
||||
/* Write data. */
|
||||
float (*vnos)[3];
|
||||
MutableSpan<float3> vnos;
|
||||
};
|
||||
|
||||
BLI_INLINE void bm_vert_calc_normals_accum_loop(const BMLoop *l_iter,
|
||||
|
@ -204,21 +208,21 @@ static void bm_vert_calc_normals_with_coords_cb(void *userdata,
|
|||
}
|
||||
|
||||
static void bm_mesh_verts_calc_normals(BMesh *bm,
|
||||
const float (*fnos)[3],
|
||||
const float (*vcos)[3],
|
||||
float (*vnos)[3])
|
||||
const Span<float3> fnos,
|
||||
const Span<float3> vcos,
|
||||
MutableSpan<float3> vnos)
|
||||
{
|
||||
BM_mesh_elem_index_ensure(bm, BM_FACE | ((vnos || vcos) ? BM_VERT : 0));
|
||||
BM_mesh_elem_index_ensure(bm, BM_FACE | ((!vnos.is_empty() || !vcos.is_empty()) ? BM_VERT : 0));
|
||||
|
||||
TaskParallelSettings settings;
|
||||
BLI_parallel_mempool_settings_defaults(&settings);
|
||||
settings.use_threading = bm->totvert >= BM_THREAD_LIMIT;
|
||||
|
||||
if (vcos == nullptr) {
|
||||
if (vcos.is_empty()) {
|
||||
BM_iter_parallel(bm, BM_VERTS_OF_MESH, bm_vert_calc_normals_cb, nullptr, &settings);
|
||||
}
|
||||
else {
|
||||
BLI_assert(!ELEM(nullptr, fnos, vnos));
|
||||
BLI_assert(!fnos.is_empty() || !vnos.is_empty());
|
||||
BMVertsCalcNormalsWithCoordsData data{};
|
||||
data.fnos = fnos;
|
||||
data.vcos = vcos;
|
||||
|
@ -248,7 +252,7 @@ void BM_mesh_normals_update_ex(BMesh *bm, const BMeshNormalsUpdate_Params *param
|
|||
}
|
||||
|
||||
/* Add weighted face normals to vertices, and normalize vert normals. */
|
||||
bm_mesh_verts_calc_normals(bm, nullptr, nullptr, nullptr);
|
||||
bm_mesh_verts_calc_normals(bm, {}, {}, {});
|
||||
}
|
||||
|
||||
void BM_mesh_normals_update(BMesh *bm)
|
||||
|
@ -321,9 +325,9 @@ void BM_mesh_normals_update_with_partial(BMesh *bm, const BMPartialUpdate *bmpin
|
|||
* \{ */
|
||||
|
||||
void BM_verts_calc_normal_vcos(BMesh *bm,
|
||||
const float (*fnos)[3],
|
||||
const float (*vcos)[3],
|
||||
float (*vnos)[3])
|
||||
const Span<float3> fnos,
|
||||
const Span<float3> vcos,
|
||||
MutableSpan<float3> vnos)
|
||||
{
|
||||
/* Add weighted face normals to vertices, and normalize vert normals. */
|
||||
bm_mesh_verts_calc_normals(bm, fnos, vcos, vnos);
|
||||
|
@ -374,7 +378,7 @@ void BM_normals_loops_edges_tag(BMesh *bm, const bool do_edges)
|
|||
* Helpers for #BM_mesh_loop_normals_update and #BM_loops_calc_normal_vcos
|
||||
*/
|
||||
static void bm_mesh_edges_sharp_tag(BMesh *bm,
|
||||
const float (*fnos)[3],
|
||||
const Span<float3> fnos,
|
||||
float split_angle_cos,
|
||||
const bool do_sharp_edges_tag)
|
||||
{
|
||||
|
@ -382,7 +386,7 @@ static void bm_mesh_edges_sharp_tag(BMesh *bm,
|
|||
BMEdge *e;
|
||||
int i;
|
||||
|
||||
if (fnos) {
|
||||
if (!fnos.is_empty()) {
|
||||
BM_mesh_elem_index_ensure(bm, BM_FACE);
|
||||
}
|
||||
|
||||
|
@ -413,7 +417,7 @@ void BM_edges_sharp_from_angle_set(BMesh *bm, const float split_angle)
|
|||
return;
|
||||
}
|
||||
|
||||
bm_mesh_edges_sharp_tag(bm, nullptr, cosf(split_angle), true);
|
||||
bm_mesh_edges_sharp_tag(bm, {}, cosf(split_angle), true);
|
||||
}
|
||||
|
||||
/** \} */
|
||||
|
@ -467,8 +471,8 @@ bool BM_loop_check_cyclic_smooth_fan(BMLoop *l_curr)
|
|||
* \return The number of loops that were handled (for early exit when all have been handled).
|
||||
*/
|
||||
static int bm_mesh_loops_calc_normals_for_loop(BMesh *bm,
|
||||
const float (*vcos)[3],
|
||||
const float (*fnos)[3],
|
||||
const Span<float3> vcos,
|
||||
const Span<float3> fnos,
|
||||
const short (*clnors_data)[2],
|
||||
const int cd_loop_clnors_offset,
|
||||
const bool has_clnors,
|
||||
|
@ -477,12 +481,12 @@ static int bm_mesh_loops_calc_normals_for_loop(BMesh *bm,
|
|||
/* Iterate. */
|
||||
BMLoop *l_curr,
|
||||
/* Result. */
|
||||
float (*r_lnos)[3],
|
||||
MutableSpan<float3> r_lnos,
|
||||
MLoopNorSpaceArray *r_lnors_spacearr)
|
||||
{
|
||||
BLI_assert((bm->elem_index_dirty & BM_LOOP) == 0);
|
||||
BLI_assert((fnos == nullptr) || ((bm->elem_index_dirty & BM_FACE) == 0));
|
||||
BLI_assert((vcos == nullptr) || ((bm->elem_index_dirty & BM_VERT) == 0));
|
||||
BLI_assert(fnos.is_empty() || ((bm->elem_index_dirty & BM_FACE) == 0));
|
||||
BLI_assert(vcos.is_empty() || ((bm->elem_index_dirty & BM_VERT) == 0));
|
||||
UNUSED_VARS_NDEBUG(bm);
|
||||
|
||||
int handled = 0;
|
||||
|
@ -514,7 +518,8 @@ static int bm_mesh_loops_calc_normals_for_loop(BMesh *bm,
|
|||
* this vertex just takes its face normal.
|
||||
*/
|
||||
const int l_curr_index = BM_elem_index_get(l_curr);
|
||||
const float *no = fnos ? fnos[BM_elem_index_get(l_curr->f)] : l_curr->f->no;
|
||||
const float3 no = !fnos.is_empty() ? fnos[BM_elem_index_get(l_curr->f)] :
|
||||
float3(l_curr->f->no);
|
||||
copy_v3_v3(r_lnos[l_curr_index], no);
|
||||
|
||||
/* If needed, generate this (simple!) lnor space. */
|
||||
|
@ -524,11 +529,12 @@ static int bm_mesh_loops_calc_normals_for_loop(BMesh *bm,
|
|||
|
||||
{
|
||||
const BMVert *v_pivot = l_curr->v;
|
||||
const float *co_pivot = vcos ? vcos[BM_elem_index_get(v_pivot)] : v_pivot->co;
|
||||
const float3 co_pivot = !vcos.is_empty() ? vcos[BM_elem_index_get(v_pivot)] :
|
||||
float3(v_pivot->co);
|
||||
const BMVert *v_1 = l_curr->next->v;
|
||||
const float *co_1 = vcos ? vcos[BM_elem_index_get(v_1)] : v_1->co;
|
||||
const float3 co_1 = !vcos.is_empty() ? vcos[BM_elem_index_get(v_1)] : float3(v_1->co);
|
||||
const BMVert *v_2 = l_curr->prev->v;
|
||||
const float *co_2 = vcos ? vcos[BM_elem_index_get(v_2)] : v_2->co;
|
||||
const float3 co_2 = !vcos.is_empty() ? vcos[BM_elem_index_get(v_2)] : float3(v_2->co);
|
||||
|
||||
BLI_assert(v_1 == BM_edge_other_vert(l_curr->e, v_pivot));
|
||||
BLI_assert(v_2 == BM_edge_other_vert(l_curr->prev->e, v_pivot));
|
||||
|
@ -586,7 +592,8 @@ static int bm_mesh_loops_calc_normals_for_loop(BMesh *bm,
|
|||
int clnors_count = 0;
|
||||
bool clnors_invalid = false;
|
||||
|
||||
const float *co_pivot = vcos ? vcos[BM_elem_index_get(v_pivot)] : v_pivot->co;
|
||||
const float3 co_pivot = !vcos.is_empty() ? vcos[BM_elem_index_get(v_pivot)] :
|
||||
float3(v_pivot->co);
|
||||
|
||||
MLoopNorSpace *lnor_space = r_lnors_spacearr ? BKE_lnor_space_create(r_lnors_spacearr) :
|
||||
nullptr;
|
||||
|
@ -601,7 +608,7 @@ static int bm_mesh_loops_calc_normals_for_loop(BMesh *bm,
|
|||
* then we can just reuse old current one! */
|
||||
{
|
||||
const BMVert *v_2 = lfan_pivot->next->v;
|
||||
const float *co_2 = vcos ? vcos[BM_elem_index_get(v_2)] : v_2->co;
|
||||
const float3 co_2 = !vcos.is_empty() ? vcos[BM_elem_index_get(v_2)] : float3(v_2->co);
|
||||
|
||||
BLI_assert(v_2 == BM_edge_other_vert(e_next, v_pivot));
|
||||
|
||||
|
@ -633,7 +640,7 @@ static int bm_mesh_loops_calc_normals_for_loop(BMesh *bm,
|
|||
*/
|
||||
{
|
||||
const BMVert *v_2 = BM_edge_other_vert(e_next, v_pivot);
|
||||
const float *co_2 = vcos ? vcos[BM_elem_index_get(v_2)] : v_2->co;
|
||||
const float3 co_2 = !vcos.is_empty() ? vcos[BM_elem_index_get(v_2)] : float3(v_2->co);
|
||||
|
||||
sub_v3_v3v3(vec_next, co_2, co_pivot);
|
||||
normalize_v3(vec_next);
|
||||
|
@ -644,7 +651,7 @@ static int bm_mesh_loops_calc_normals_for_loop(BMesh *bm,
|
|||
/* Calculate angle between the two face edges incident on this vertex. */
|
||||
const BMFace *f = lfan_pivot->f;
|
||||
const float fac = blender::math::safe_acos_approx(dot_v3v3(vec_next, vec_curr));
|
||||
const float *no = fnos ? fnos[BM_elem_index_get(f)] : f->no;
|
||||
const float3 no = !fnos.is_empty() ? fnos[BM_elem_index_get(f)] : float3(f->no);
|
||||
/* Accumulate */
|
||||
madd_v3_v3fl(lnor, no, fac);
|
||||
|
||||
|
@ -795,16 +802,18 @@ BLI_INLINE bool bm_edge_is_smooth_no_angle_test(const BMEdge *e,
|
|||
BM_elem_flag_test(l_a->f, BM_ELEM_SMOOTH) && BM_elem_flag_test(l_b->f, BM_ELEM_SMOOTH));
|
||||
}
|
||||
|
||||
static void bm_edge_tag_from_smooth(const float (*fnos)[3], BMEdge *e, const float split_angle_cos)
|
||||
static void bm_edge_tag_from_smooth(const Span<float3> fnos,
|
||||
BMEdge *e,
|
||||
const float split_angle_cos)
|
||||
{
|
||||
BLI_assert(e->l != nullptr);
|
||||
BMLoop *l_a = e->l, *l_b = l_a->radial_next;
|
||||
bool is_smooth = false;
|
||||
if (bm_edge_is_smooth_no_angle_test(e, l_a, l_b)) {
|
||||
if (split_angle_cos != -1.0f) {
|
||||
const float dot = (fnos == nullptr) ? dot_v3v3(l_a->f->no, l_b->f->no) :
|
||||
dot_v3v3(fnos[BM_elem_index_get(l_a->f)],
|
||||
fnos[BM_elem_index_get(l_b->f)]);
|
||||
const float dot = fnos.is_empty() ? dot_v3v3(l_a->f->no, l_b->f->no) :
|
||||
dot_v3v3(fnos[BM_elem_index_get(l_a->f)],
|
||||
fnos[BM_elem_index_get(l_b->f)]);
|
||||
if (dot >= split_angle_cos) {
|
||||
is_smooth = true;
|
||||
}
|
||||
|
@ -834,7 +843,7 @@ static void bm_edge_tag_from_smooth(const float (*fnos)[3], BMEdge *e, const flo
|
|||
* \note This doesn't have the same atomic requirement as #bm_edge_tag_from_smooth
|
||||
* since it isn't run from multiple threads at once.
|
||||
*/
|
||||
static void bm_edge_tag_from_smooth_and_set_sharp(const float (*fnos)[3],
|
||||
static void bm_edge_tag_from_smooth_and_set_sharp(const Span<float3> fnos,
|
||||
BMEdge *e,
|
||||
const float split_angle_cos)
|
||||
{
|
||||
|
@ -843,9 +852,9 @@ static void bm_edge_tag_from_smooth_and_set_sharp(const float (*fnos)[3],
|
|||
bool is_smooth = false;
|
||||
if (bm_edge_is_smooth_no_angle_test(e, l_a, l_b)) {
|
||||
if (split_angle_cos != -1.0f) {
|
||||
const float dot = (fnos == nullptr) ? dot_v3v3(l_a->f->no, l_b->f->no) :
|
||||
dot_v3v3(fnos[BM_elem_index_get(l_a->f)],
|
||||
fnos[BM_elem_index_get(l_b->f)]);
|
||||
const float dot = fnos.is_empty() ? dot_v3v3(l_a->f->no, l_b->f->no) :
|
||||
dot_v3v3(fnos[BM_elem_index_get(l_a->f)],
|
||||
fnos[BM_elem_index_get(l_b->f)]);
|
||||
if (dot >= split_angle_cos) {
|
||||
is_smooth = true;
|
||||
}
|
||||
|
@ -871,9 +880,9 @@ static void bm_edge_tag_from_smooth_and_set_sharp(const float (*fnos)[3],
|
|||
*/
|
||||
static void bm_mesh_loops_calc_normals_for_vert_with_clnors(
|
||||
BMesh *bm,
|
||||
const float (*vcos)[3],
|
||||
const float (*fnos)[3],
|
||||
float (*r_lnos)[3],
|
||||
const Span<float3> vcos,
|
||||
const Span<float3> fnos,
|
||||
MutableSpan<float3> r_lnos,
|
||||
const short (*clnors_data)[2],
|
||||
const int cd_loop_clnors_offset,
|
||||
const bool do_rebuild,
|
||||
|
@ -993,9 +1002,9 @@ static void bm_mesh_loops_calc_normals_for_vert_with_clnors(
|
|||
*/
|
||||
static void bm_mesh_loops_calc_normals_for_vert_without_clnors(
|
||||
BMesh *bm,
|
||||
const float (*vcos)[3],
|
||||
const float (*fnos)[3],
|
||||
float (*r_lnos)[3],
|
||||
const Span<float3> vcos,
|
||||
const Span<float3> fnos,
|
||||
MutableSpan<float3> r_lnos,
|
||||
const bool do_rebuild,
|
||||
const float split_angle_cos,
|
||||
/* TLS */
|
||||
|
@ -1070,9 +1079,9 @@ static void bm_mesh_loops_calc_normals_for_vert_without_clnors(
|
|||
* we could add a low-level API flag for this, see #BM_ELEM_API_FLAG_ENABLE and friends.
|
||||
*/
|
||||
static void bm_mesh_loops_calc_normals__single_threaded(BMesh *bm,
|
||||
const float (*vcos)[3],
|
||||
const float (*fnos)[3],
|
||||
float (*r_lnos)[3],
|
||||
const Span<float3> vcos,
|
||||
const Span<float3> fnos,
|
||||
MutableSpan<float3> r_lnos,
|
||||
MLoopNorSpaceArray *r_lnors_spacearr,
|
||||
const short (*clnors_data)[2],
|
||||
const int cd_loop_clnors_offset,
|
||||
|
@ -1091,7 +1100,7 @@ static void bm_mesh_loops_calc_normals__single_threaded(BMesh *bm,
|
|||
|
||||
{
|
||||
char htype = 0;
|
||||
if (vcos) {
|
||||
if (!vcos.is_empty()) {
|
||||
htype |= BM_VERT;
|
||||
}
|
||||
/* Face/Loop indices are set inline below. */
|
||||
|
@ -1164,8 +1173,8 @@ static void bm_mesh_loops_calc_normals__single_threaded(BMesh *bm,
|
|||
|
||||
struct BMLoopsCalcNormalsWithCoordsData {
|
||||
/* Read-only data. */
|
||||
const float (*fnos)[3];
|
||||
const float (*vcos)[3];
|
||||
Span<float3> vcos;
|
||||
Span<float3> fnos;
|
||||
BMesh *bm;
|
||||
const short (*clnors_data)[2];
|
||||
int cd_loop_clnors_offset;
|
||||
|
@ -1173,7 +1182,7 @@ struct BMLoopsCalcNormalsWithCoordsData {
|
|||
float split_angle_cos;
|
||||
|
||||
/* Output. */
|
||||
float (*r_lnos)[3];
|
||||
MutableSpan<float3> r_lnos;
|
||||
MLoopNorSpaceArray *r_lnors_spacearr;
|
||||
};
|
||||
|
||||
|
@ -1272,9 +1281,9 @@ static void bm_mesh_loops_calc_normals_for_vert_without_clnors_fn(
|
|||
}
|
||||
|
||||
static void bm_mesh_loops_calc_normals__multi_threaded(BMesh *bm,
|
||||
const float (*vcos)[3],
|
||||
const float (*fnos)[3],
|
||||
float (*r_lnos)[3],
|
||||
const Span<float3> vcos,
|
||||
const Span<float3> fnos,
|
||||
MutableSpan<float3> r_lnos,
|
||||
MLoopNorSpaceArray *r_lnors_spacearr,
|
||||
const short (*clnors_data)[2],
|
||||
const int cd_loop_clnors_offset,
|
||||
|
@ -1286,10 +1295,10 @@ static void bm_mesh_loops_calc_normals__multi_threaded(BMesh *bm,
|
|||
|
||||
{
|
||||
char htype = BM_LOOP;
|
||||
if (vcos) {
|
||||
if (!vcos.is_empty()) {
|
||||
htype |= BM_VERT;
|
||||
}
|
||||
if (fnos) {
|
||||
if (!fnos.is_empty()) {
|
||||
htype |= BM_FACE;
|
||||
}
|
||||
/* Face/Loop indices are set inline below. */
|
||||
|
@ -1347,9 +1356,9 @@ static void bm_mesh_loops_calc_normals__multi_threaded(BMesh *bm,
|
|||
}
|
||||
|
||||
static void bm_mesh_loops_calc_normals(BMesh *bm,
|
||||
const float (*vcos)[3],
|
||||
const float (*fnos)[3],
|
||||
float (*r_lnos)[3],
|
||||
const Span<float3> vcos,
|
||||
const Span<float3> fnos,
|
||||
MutableSpan<float3> r_lnos,
|
||||
MLoopNorSpaceArray *r_lnors_spacearr,
|
||||
const short (*clnors_data)[2],
|
||||
const int cd_loop_clnors_offset,
|
||||
|
@ -1572,8 +1581,8 @@ static void bm_mesh_loops_assign_normal_data(BMesh *bm,
|
|||
* instead, depending on the do_split_fans parameter.
|
||||
*/
|
||||
static void bm_mesh_loops_custom_normals_set(BMesh *bm,
|
||||
const float (*vcos)[3],
|
||||
const float (*fnos)[3],
|
||||
const Span<float3> vcos,
|
||||
const Span<float3> fnos,
|
||||
MLoopNorSpaceArray *r_lnors_spacearr,
|
||||
short (*r_clnors_data)[2],
|
||||
const int cd_loop_clnors_offset,
|
||||
|
@ -1584,8 +1593,7 @@ static void bm_mesh_loops_custom_normals_set(BMesh *bm,
|
|||
BMFace *f;
|
||||
BMLoop *l;
|
||||
BMIter liter, fiter;
|
||||
float(*cur_lnors)[3] = static_cast<float(*)[3]>(
|
||||
MEM_mallocN(sizeof(*cur_lnors) * bm->totloop, __func__));
|
||||
Array<float3> cur_lnors(bm->totloop);
|
||||
|
||||
BKE_lnor_spacearr_clear(r_lnors_spacearr);
|
||||
|
||||
|
@ -1653,27 +1661,25 @@ static void bm_mesh_loops_custom_normals_set(BMesh *bm,
|
|||
bm_mesh_loops_assign_normal_data(
|
||||
bm, r_lnors_spacearr, r_clnors_data, cd_loop_clnors_offset, custom_lnors);
|
||||
|
||||
MEM_freeN(cur_lnors);
|
||||
|
||||
if (custom_lnors != new_lnors) {
|
||||
MEM_freeN(custom_lnors);
|
||||
}
|
||||
}
|
||||
|
||||
static void bm_mesh_loops_calc_normals_no_autosmooth(BMesh *bm,
|
||||
const float (*vnos)[3],
|
||||
const float (*fnos)[3],
|
||||
float (*r_lnos)[3])
|
||||
const Span<float3> vnos,
|
||||
const Span<float3> fnos,
|
||||
MutableSpan<float3> r_lnos)
|
||||
{
|
||||
BMIter fiter;
|
||||
BMFace *f_curr;
|
||||
|
||||
{
|
||||
char htype = BM_LOOP;
|
||||
if (vnos) {
|
||||
if (!vnos.is_empty()) {
|
||||
htype |= BM_VERT;
|
||||
}
|
||||
if (fnos) {
|
||||
if (!fnos.is_empty()) {
|
||||
htype |= BM_FACE;
|
||||
}
|
||||
BM_mesh_elem_index_ensure(bm, htype);
|
||||
|
@ -1685,8 +1691,10 @@ static void bm_mesh_loops_calc_normals_no_autosmooth(BMesh *bm,
|
|||
|
||||
l_curr = l_first = BM_FACE_FIRST_LOOP(f_curr);
|
||||
do {
|
||||
const float *no = is_face_flat ? (fnos ? fnos[BM_elem_index_get(f_curr)] : f_curr->no) :
|
||||
(vnos ? vnos[BM_elem_index_get(l_curr->v)] : l_curr->v->no);
|
||||
const float3 no = is_face_flat ? (!fnos.is_empty() ? fnos[BM_elem_index_get(f_curr)] :
|
||||
float3(f_curr->no)) :
|
||||
(!vnos.is_empty() ? vnos[BM_elem_index_get(l_curr->v)] :
|
||||
float3(l_curr->v->no));
|
||||
copy_v3_v3(r_lnos[BM_elem_index_get(l_curr)], no);
|
||||
|
||||
} while ((l_curr = l_curr->next) != l_first);
|
||||
|
@ -1694,11 +1702,11 @@ static void bm_mesh_loops_calc_normals_no_autosmooth(BMesh *bm,
|
|||
}
|
||||
|
||||
void BM_loops_calc_normal_vcos(BMesh *bm,
|
||||
const float (*vcos)[3],
|
||||
const float (*vnos)[3],
|
||||
const float (*fnos)[3],
|
||||
const Span<float3> vcos,
|
||||
const Span<float3> vnos,
|
||||
const Span<float3> fnos,
|
||||
const bool use_split_normals,
|
||||
float (*r_lnos)[3],
|
||||
MutableSpan<float3> r_lnos,
|
||||
MLoopNorSpaceArray *r_lnors_spacearr,
|
||||
short (*clnors_data)[2],
|
||||
const int cd_loop_clnors_offset,
|
||||
|
@ -1728,7 +1736,7 @@ void BM_loops_calc_normal_vcos(BMesh *bm,
|
|||
/** \name Loop Normal Space API
|
||||
* \{ */
|
||||
|
||||
void BM_lnorspacearr_store(BMesh *bm, float (*r_lnors)[3])
|
||||
void BM_lnorspacearr_store(BMesh *bm, MutableSpan<float3> r_lnors)
|
||||
{
|
||||
BLI_assert(bm->lnor_spacearr != nullptr);
|
||||
|
||||
|
@ -1738,16 +1746,8 @@ void BM_lnorspacearr_store(BMesh *bm, float (*r_lnors)[3])
|
|||
|
||||
int cd_loop_clnors_offset = CustomData_get_offset(&bm->ldata, CD_CUSTOMLOOPNORMAL);
|
||||
|
||||
BM_loops_calc_normal_vcos(bm,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
true,
|
||||
r_lnors,
|
||||
bm->lnor_spacearr,
|
||||
nullptr,
|
||||
cd_loop_clnors_offset,
|
||||
false);
|
||||
BM_loops_calc_normal_vcos(
|
||||
bm, {}, {}, {}, true, r_lnors, bm->lnor_spacearr, nullptr, cd_loop_clnors_offset, false);
|
||||
bm->spacearr_dirty &= ~(BM_SPACEARR_DIRTY | BM_SPACEARR_DIRTY_ALL);
|
||||
}
|
||||
|
||||
|
@ -1834,10 +1834,8 @@ void BM_lnorspace_rebuild(BMesh *bm, bool preserve_clnor)
|
|||
BMLoop *l;
|
||||
BMIter fiter, liter;
|
||||
|
||||
float(*r_lnors)[3] = static_cast<float(*)[3]>(
|
||||
MEM_callocN(sizeof(*r_lnors) * bm->totloop, __func__));
|
||||
float(*oldnors)[3] = static_cast<float(*)[3]>(
|
||||
preserve_clnor ? MEM_mallocN(sizeof(*oldnors) * bm->totloop, __func__) : nullptr);
|
||||
Array<float3> r_lnors(bm->totloop, float3(0));
|
||||
Array<float3> oldnors(preserve_clnor ? bm->totloop : 0, float3(0));
|
||||
|
||||
int cd_loop_clnors_offset = CustomData_get_offset(&bm->ldata, CD_CUSTOMLOOPNORMAL);
|
||||
|
||||
|
@ -1865,17 +1863,8 @@ void BM_lnorspace_rebuild(BMesh *bm, bool preserve_clnor)
|
|||
if (bm->spacearr_dirty & BM_SPACEARR_DIRTY_ALL) {
|
||||
BKE_lnor_spacearr_clear(bm->lnor_spacearr);
|
||||
}
|
||||
BM_loops_calc_normal_vcos(bm,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
true,
|
||||
r_lnors,
|
||||
bm->lnor_spacearr,
|
||||
nullptr,
|
||||
cd_loop_clnors_offset,
|
||||
true);
|
||||
MEM_freeN(r_lnors);
|
||||
BM_loops_calc_normal_vcos(
|
||||
bm, {}, {}, {}, true, r_lnors, bm->lnor_spacearr, nullptr, cd_loop_clnors_offset, true);
|
||||
|
||||
BM_ITER_MESH (f, &fiter, bm, BM_FACES_OF_MESH) {
|
||||
BM_ITER_ELEM (l, &liter, f, BM_LOOPS_OF_FACE) {
|
||||
|
@ -1894,7 +1883,6 @@ void BM_lnorspace_rebuild(BMesh *bm, bool preserve_clnor)
|
|||
}
|
||||
}
|
||||
|
||||
MEM_SAFE_FREE(oldnors);
|
||||
bm->spacearr_dirty &= ~(BM_SPACEARR_DIRTY | BM_SPACEARR_DIRTY_ALL);
|
||||
|
||||
#ifndef NDEBUG
|
||||
|
@ -1908,12 +1896,8 @@ void BM_lnorspace_update(BMesh *bm)
|
|||
bm->lnor_spacearr = MEM_cnew<MLoopNorSpaceArray>(__func__);
|
||||
}
|
||||
if (bm->lnor_spacearr->lspacearr == nullptr) {
|
||||
float(*lnors)[3] = static_cast<float(*)[3]>(
|
||||
MEM_callocN(sizeof(*lnors) * bm->totloop, __func__));
|
||||
|
||||
Array<float3> lnors(bm->totloop, float3(0));
|
||||
BM_lnorspacearr_store(bm, lnors);
|
||||
|
||||
MEM_freeN(lnors);
|
||||
}
|
||||
else if (bm->spacearr_dirty & (BM_SPACEARR_DIRTY | BM_SPACEARR_DIRTY_ALL)) {
|
||||
BM_lnorspace_rebuild(bm, false);
|
||||
|
@ -1945,9 +1929,9 @@ void BM_lnorspace_err(BMesh *bm)
|
|||
BKE_lnor_spacearr_init(temp, bm->totloop, MLNOR_SPACEARR_BMLOOP_PTR);
|
||||
|
||||
int cd_loop_clnors_offset = CustomData_get_offset(&bm->ldata, CD_CUSTOMLOOPNORMAL);
|
||||
float(*lnors)[3] = static_cast<float(*)[3]>(MEM_callocN(sizeof(*lnors) * bm->totloop, __func__));
|
||||
Array<float3> lnors(bm->totloop, float3(0));
|
||||
BM_loops_calc_normal_vcos(
|
||||
bm, nullptr, nullptr, nullptr, true, lnors, temp, nullptr, cd_loop_clnors_offset, true);
|
||||
bm, {}, {}, {}, true, lnors, temp, nullptr, cd_loop_clnors_offset, true);
|
||||
|
||||
for (int i = 0; i < bm->totloop; i++) {
|
||||
int j = 0;
|
||||
|
@ -1969,7 +1953,6 @@ void BM_lnorspace_err(BMesh *bm)
|
|||
}
|
||||
BKE_lnor_spacearr_free(temp);
|
||||
MEM_freeN(temp);
|
||||
MEM_freeN(lnors);
|
||||
BLI_assert(clear);
|
||||
|
||||
bm->spacearr_dirty &= ~BM_SPACEARR_DIRTY_ALL;
|
||||
|
@ -2268,8 +2251,8 @@ void BM_custom_loop_normals_from_vector_layer(BMesh *bm, bool add_sharp_edges)
|
|||
}
|
||||
|
||||
bm_mesh_loops_custom_normals_set(bm,
|
||||
nullptr,
|
||||
nullptr,
|
||||
{},
|
||||
{},
|
||||
bm->lnor_spacearr,
|
||||
nullptr,
|
||||
cd_custom_normal_offset,
|
||||
|
|
|
@ -43,9 +43,9 @@ void BM_mesh_normals_update_with_partial(BMesh *bm, const BMPartialUpdate *bmpin
|
|||
* using given vertex coordinates (vcos) and polygon normals (fnos).
|
||||
*/
|
||||
void BM_verts_calc_normal_vcos(BMesh *bm,
|
||||
const float (*fnos)[3],
|
||||
const float (*vcos)[3],
|
||||
float (*vnos)[3]);
|
||||
blender::Span<blender::float3> fnos,
|
||||
blender::Span<blender::float3> vcos,
|
||||
blender::MutableSpan<blender::float3> vnos);
|
||||
/**
|
||||
* \brief BMesh Compute Loop Normals from/to external data.
|
||||
*
|
||||
|
@ -54,11 +54,11 @@ void BM_verts_calc_normal_vcos(BMesh *bm,
|
|||
* (splitting edges).
|
||||
*/
|
||||
void BM_loops_calc_normal_vcos(BMesh *bm,
|
||||
const float (*vcos)[3],
|
||||
const float (*vnos)[3],
|
||||
const float (*fnos)[3],
|
||||
blender::Span<blender::float3> vcos,
|
||||
blender::Span<blender::float3> vnos,
|
||||
blender::Span<blender::float3> fnos,
|
||||
bool use_split_normals,
|
||||
float (*r_lnos)[3],
|
||||
blender::MutableSpan<blender::float3> r_lnos,
|
||||
MLoopNorSpaceArray *r_lnors_spacearr,
|
||||
short (*clnors_data)[2],
|
||||
int cd_loop_clnors_offset,
|
||||
|
@ -70,7 +70,7 @@ void BM_loops_calc_normal_vcos(BMesh *bm,
|
|||
* and yet we need to walk them once, and only once.
|
||||
*/
|
||||
bool BM_loop_check_cyclic_smooth_fan(BMLoop *l_curr);
|
||||
void BM_lnorspacearr_store(BMesh *bm, float (*r_lnors)[3]);
|
||||
void BM_lnorspacearr_store(BMesh *bm, blender::MutableSpan<blender::float3> r_lnors);
|
||||
void BM_lnorspace_invalidate(BMesh *bm, bool do_invalidate_all);
|
||||
void BM_lnorspace_rebuild(BMesh *bm, bool preserve_clnor);
|
||||
/**
|
||||
|
|
|
@ -31,6 +31,9 @@
|
|||
|
||||
#include "intern/bmesh_private.hh"
|
||||
|
||||
using blender::float3;
|
||||
using blender::Span;
|
||||
|
||||
/**
|
||||
* \brief COMPUTE POLY NORMAL (BMFace)
|
||||
*
|
||||
|
@ -66,7 +69,7 @@ static float bm_face_calc_poly_normal(const BMFace *f, float n[3])
|
|||
*/
|
||||
static float bm_face_calc_poly_normal_vertex_cos(const BMFace *f,
|
||||
float r_no[3],
|
||||
float const (*vertexCos)[3])
|
||||
const Span<float3> vertexCos)
|
||||
{
|
||||
BMLoop *l_first = BM_FACE_FIRST_LOOP(f);
|
||||
BMLoop *l_iter = l_first;
|
||||
|
@ -742,7 +745,7 @@ void BM_face_normal_update(BMFace *f)
|
|||
float BM_face_calc_normal_vcos(const BMesh *bm,
|
||||
const BMFace *f,
|
||||
float r_no[3],
|
||||
float const (*vertexCos)[3])
|
||||
const Span<float3> vertexCos)
|
||||
{
|
||||
BMLoop *l;
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@ float BM_face_calc_normal(const BMFace *f, float r_no[3]) ATTR_NONNULL();
|
|||
float BM_face_calc_normal_vcos(const BMesh *bm,
|
||||
const BMFace *f,
|
||||
float r_no[3],
|
||||
float const (*vertexCos)[3]) ATTR_NONNULL();
|
||||
blender::Span<blender::float3> vertexCos) ATTR_NONNULL();
|
||||
|
||||
/**
|
||||
* Calculate a normal from a vertex cloud.
|
||||
|
|
|
@ -83,7 +83,7 @@ class MotionBlurModule {
|
|||
/** True if motion blur is enabled as a module. */
|
||||
bool enabled_ = false;
|
||||
/** True if motion blur post-fx is enabled. */
|
||||
float motion_blur_fx_enabled_ = false;
|
||||
bool motion_blur_fx_enabled_ = false;
|
||||
/** True if last viewport redraw state was already in navigation state. */
|
||||
bool was_navigating_ = false;
|
||||
|
||||
|
|
|
@ -501,25 +501,14 @@ void mesh_render_data_update_normals(MeshRenderData &mr, const eMRDataType data_
|
|||
mr.normals_domain == bke::MeshNormalDomain::Corner) ||
|
||||
(data_flag & MR_DATA_TAN_LOOP_NOR))
|
||||
{
|
||||
|
||||
const float(*vert_coords)[3] = nullptr;
|
||||
const float(*vert_normals)[3] = nullptr;
|
||||
const float(*face_normals)[3] = nullptr;
|
||||
|
||||
if (mr.edit_data && !mr.edit_data->vert_positions.is_empty()) {
|
||||
vert_coords = reinterpret_cast<const float(*)[3]>(mr.bm_vert_coords.data());
|
||||
vert_normals = reinterpret_cast<const float(*)[3]>(mr.bm_vert_normals.data());
|
||||
face_normals = reinterpret_cast<const float(*)[3]>(mr.bm_face_normals.data());
|
||||
}
|
||||
|
||||
mr.bm_loop_normals.reinitialize(mr.corners_num);
|
||||
const int clnors_offset = CustomData_get_offset(&mr.bm->ldata, CD_CUSTOMLOOPNORMAL);
|
||||
BM_loops_calc_normal_vcos(mr.bm,
|
||||
vert_coords,
|
||||
vert_normals,
|
||||
face_normals,
|
||||
mr.bm_vert_coords,
|
||||
mr.bm_vert_normals,
|
||||
mr.bm_face_normals,
|
||||
true,
|
||||
reinterpret_cast<float(*)[3]>(mr.bm_loop_normals.data()),
|
||||
mr.bm_loop_normals,
|
||||
nullptr,
|
||||
nullptr,
|
||||
clnors_offset,
|
||||
|
@ -570,16 +559,12 @@ MeshRenderData *mesh_render_data_create(Object *object,
|
|||
/* If there is no distinct cage, hide unmapped edges that can't be selected. */
|
||||
mr->hide_unmapped_edges = !do_final || editmesh_eval_final == editmesh_eval_cage;
|
||||
|
||||
if (mr->edit_data) {
|
||||
bke::EditMeshData *emd = mr->edit_data;
|
||||
if (bke::EditMeshData *emd = mr->edit_data) {
|
||||
if (!emd->vert_positions.is_empty()) {
|
||||
BKE_editmesh_cache_ensure_vert_normals(*mr->edit_bmesh, *emd);
|
||||
BKE_editmesh_cache_ensure_face_normals(*mr->edit_bmesh, *emd);
|
||||
mr->bm_vert_coords = mr->edit_data->vert_positions;
|
||||
mr->bm_vert_normals = BKE_editmesh_cache_ensure_vert_normals(*mr->edit_bmesh, *emd);
|
||||
mr->bm_face_normals = BKE_editmesh_cache_ensure_face_normals(*mr->edit_bmesh, *emd);
|
||||
}
|
||||
|
||||
mr->bm_vert_coords = mr->edit_data->vert_positions;
|
||||
mr->bm_vert_normals = mr->edit_data->vert_normals;
|
||||
mr->bm_face_normals = mr->edit_data->face_normals;
|
||||
}
|
||||
|
||||
int bm_ensure_types = BM_VERT | BM_EDGE | BM_LOOP | BM_FACE;
|
||||
|
|
|
@ -1053,10 +1053,12 @@ struct PBVHBatches {
|
|||
|
||||
void create_index_faces(const PBVH_GPU_Args &args)
|
||||
{
|
||||
const bke::AttributeAccessor attributes = args.mesh->attributes();
|
||||
const VArray material_indices = *attributes.lookup_or_default<int>(
|
||||
"material_index", bke::AttrDomain::Face, 0);
|
||||
material_index = material_indices[args.tri_faces[args.prim_indices.first()]];
|
||||
if (!args.prim_indices.is_empty()) {
|
||||
const bke::AttributeAccessor attributes = args.mesh->attributes();
|
||||
const VArray material_indices = *attributes.lookup_or_default<int>(
|
||||
"material_index", bke::AttrDomain::Face, 0);
|
||||
material_index = material_indices[args.tri_faces[args.prim_indices.first()]];
|
||||
}
|
||||
|
||||
const Span<int2> edges = args.mesh->edges();
|
||||
|
||||
|
@ -1144,8 +1146,10 @@ struct PBVHBatches {
|
|||
const BitGroupVector<> &grid_hidden = args.subdiv_ccg->grid_hidden;
|
||||
const Span<int> grid_to_face_map = args.subdiv_ccg->grid_to_face_map;
|
||||
|
||||
material_index = material_indices[BKE_subdiv_ccg_grid_to_face_index(
|
||||
*args.subdiv_ccg, args.grid_indices.first())];
|
||||
if (!args.grid_indices.is_empty()) {
|
||||
material_index = material_indices[BKE_subdiv_ccg_grid_to_face_index(
|
||||
*args.subdiv_ccg, args.grid_indices.first())];
|
||||
}
|
||||
|
||||
needs_tri_index = true;
|
||||
int gridsize = args.ccg_key.grid_size;
|
||||
|
|
|
@ -397,14 +397,6 @@ static void statvis_calc_distort(const MeshRenderData &mr, float *r_distort)
|
|||
BMesh *bm = em->bm;
|
||||
BMFace *f;
|
||||
|
||||
if (!mr.bm_vert_coords.is_empty()) {
|
||||
BKE_editmesh_cache_ensure_face_normals(*em, *mr.edit_data);
|
||||
|
||||
/* Most likely this is already valid, ensure just in case.
|
||||
* Needed for #BM_loop_calc_face_normal_safe_vcos. */
|
||||
BM_mesh_elem_index_ensure(em->bm, BM_VERT);
|
||||
}
|
||||
|
||||
int l_index = 0;
|
||||
int f_index = 0;
|
||||
BM_ITER_MESH_INDEX (f, &iter, bm, BM_FACES_OF_MESH, f_index) {
|
||||
|
|
|
@ -1172,7 +1172,7 @@ static bool is_spline_nearby(ViewContext *vc,
|
|||
return false;
|
||||
}
|
||||
|
||||
static void move_segment(ViewContext *vc, MoveSegmentData *seg_data, const wmEvent *event)
|
||||
static void move_segment(const ViewContext *vc, MoveSegmentData *seg_data, const wmEvent *event)
|
||||
{
|
||||
Nurb *nu = seg_data->nu;
|
||||
BezTriple *bezt1 = nu->bezt + seg_data->bezt_index;
|
||||
|
@ -1290,7 +1290,7 @@ static void toggle_sel_bezt_free_align_handles(ListBase *nurbs)
|
|||
/**
|
||||
* If a point is found under mouse, delete point and return true. Else return false.
|
||||
*/
|
||||
static bool delete_point_under_mouse(ViewContext *vc, const wmEvent *event)
|
||||
static bool delete_point_under_mouse(const ViewContext *vc, const wmEvent *event)
|
||||
{
|
||||
BezTriple *bezt = nullptr;
|
||||
BPoint *bp = nullptr;
|
||||
|
@ -1338,7 +1338,7 @@ static bool delete_point_under_mouse(ViewContext *vc, const wmEvent *event)
|
|||
return deleted;
|
||||
}
|
||||
|
||||
static void move_adjacent_handle(ViewContext *vc, const wmEvent *event, ListBase *nurbs)
|
||||
static void move_adjacent_handle(const ViewContext *vc, const wmEvent *event, ListBase *nurbs)
|
||||
{
|
||||
FOREACH_SELECTED_BEZT_BEGIN (bezt, nurbs) {
|
||||
BezTriple *adj_bezt;
|
||||
|
@ -1382,7 +1382,7 @@ static void move_adjacent_handle(ViewContext *vc, const wmEvent *event, ListBase
|
|||
/**
|
||||
* Close the spline if endpoints are selected consecutively. Return true if cycle was created.
|
||||
*/
|
||||
static bool make_cyclic_if_endpoints(ViewContext *vc,
|
||||
static bool make_cyclic_if_endpoints(const ViewContext *vc,
|
||||
Nurb *sel_nu,
|
||||
BezTriple *sel_bezt,
|
||||
BPoint *sel_bp)
|
||||
|
|
|
@ -1453,7 +1453,7 @@ GHash *gpencil_copybuf_validate_colormap(bContext *C)
|
|||
|
||||
GHASH_ITER (gh_iter, gpencil_strokes_copypastebuf_colors) {
|
||||
int *key = static_cast<int *>(BLI_ghashIterator_getKey(&gh_iter));
|
||||
char *ma_name = static_cast<char *>(BLI_ghashIterator_getValue(&gh_iter));
|
||||
const char *ma_name = static_cast<const char *>(BLI_ghashIterator_getValue(&gh_iter));
|
||||
Material *ma = static_cast<Material *>(BLI_ghash_lookup(name_to_ma, ma_name));
|
||||
|
||||
BKE_gpencil_object_material_ensure(bmain, ob, ma);
|
||||
|
|
|
@ -1469,7 +1469,7 @@ static bool gpencil_sculpt_brush_do_stroke(tGP_BrushEditData *gso,
|
|||
GP_BrushApplyCb apply)
|
||||
{
|
||||
GP_SpaceConversion *gsc = &gso->gsc;
|
||||
rcti *rect = &gso->brush_rect;
|
||||
const rcti *rect = &gso->brush_rect;
|
||||
Brush *brush = gso->brush;
|
||||
const int radius = (brush->flag & GP_BRUSH_USE_PRESSURE) ? gso->brush->size * gso->pressure :
|
||||
gso->brush->size;
|
||||
|
|
|
@ -818,7 +818,7 @@ static bool gpencil_vertexpaint_select_stroke(tGP_BrushVertexpaintData *gso,
|
|||
const float bound_mat[4][4])
|
||||
{
|
||||
GP_SpaceConversion *gsc = &gso->gsc;
|
||||
rcti *rect = &gso->brush_rect;
|
||||
const rcti *rect = &gso->brush_rect;
|
||||
Brush *brush = gso->brush;
|
||||
const int radius = (brush->flag & GP_BRUSH_USE_PRESSURE) ? gso->brush->size * gso->pressure :
|
||||
gso->brush->size;
|
||||
|
|
|
@ -952,7 +952,7 @@ static void gpencil_weightpaint_select_stroke(tGP_BrushWeightpaintData *gso,
|
|||
const float bound_mat[4][4])
|
||||
{
|
||||
GP_SpaceConversion *gsc = &gso->gsc;
|
||||
rcti *rect = &gso->brush_rect;
|
||||
const rcti *rect = &gso->brush_rect;
|
||||
Brush *brush = gso->brush;
|
||||
/* For the blur tool, look a bit wider than the brush itself,
|
||||
* because we need the weight of surrounding points to perform the blur. */
|
||||
|
|
|
@ -1048,6 +1048,123 @@ DEF_ICON_COLOR(EVENT_PAGEUP)
|
|||
DEF_ICON_COLOR(EVENT_PAGEDOWN)
|
||||
DEF_ICON_COLOR(EVENT_RETURN)
|
||||
DEF_ICON_COLOR(EVENT_SPACEKEY)
|
||||
|
||||
DEF_ICON_COLOR(EVENT_ZEROKEY)
|
||||
DEF_ICON_COLOR(EVENT_ONEKEY)
|
||||
DEF_ICON_COLOR(EVENT_TWOKEY)
|
||||
DEF_ICON_COLOR(EVENT_THREEKEY)
|
||||
DEF_ICON_COLOR(EVENT_FOURKEY)
|
||||
DEF_ICON_COLOR(EVENT_FIVEKEY)
|
||||
DEF_ICON_COLOR(EVENT_SIXKEY)
|
||||
DEF_ICON_COLOR(EVENT_SEVENKEY)
|
||||
DEF_ICON_COLOR(EVENT_EIGHTKEY)
|
||||
DEF_ICON_COLOR(EVENT_NINEKEY)
|
||||
|
||||
DEF_ICON_COLOR(EVENT_PAD0)
|
||||
DEF_ICON_COLOR(EVENT_PAD1)
|
||||
DEF_ICON_COLOR(EVENT_PAD2)
|
||||
DEF_ICON_COLOR(EVENT_PAD3)
|
||||
DEF_ICON_COLOR(EVENT_PAD4)
|
||||
DEF_ICON_COLOR(EVENT_PAD5)
|
||||
DEF_ICON_COLOR(EVENT_PAD6)
|
||||
DEF_ICON_COLOR(EVENT_PAD7)
|
||||
DEF_ICON_COLOR(EVENT_PAD8)
|
||||
DEF_ICON_COLOR(EVENT_PAD9)
|
||||
DEF_ICON_COLOR(EVENT_PADASTER)
|
||||
DEF_ICON_COLOR(EVENT_PADSLASH)
|
||||
DEF_ICON_COLOR(EVENT_PADMINUS)
|
||||
DEF_ICON_COLOR(EVENT_PADENTER)
|
||||
DEF_ICON_COLOR(EVENT_PADPLUS)
|
||||
DEF_ICON_COLOR(EVENT_PADPERIOD)
|
||||
|
||||
DEF_ICON_COLOR(EVENT_MOUSE_4)
|
||||
DEF_ICON_COLOR(EVENT_MOUSE_5)
|
||||
DEF_ICON_COLOR(EVENT_MOUSE_6)
|
||||
DEF_ICON_COLOR(EVENT_MOUSE_7)
|
||||
DEF_ICON_COLOR(EVENT_TABLET_STYLUS)
|
||||
DEF_ICON_COLOR(EVENT_TABLET_ERASER)
|
||||
DEF_ICON_COLOR(EVENT_LEFT_ARROW)
|
||||
DEF_ICON_COLOR(EVENT_DOWN_ARROW)
|
||||
DEF_ICON_COLOR(EVENT_RIGHT_ARROW)
|
||||
DEF_ICON_COLOR(EVENT_UP_ARROW)
|
||||
DEF_ICON_COLOR(EVENT_PAUSE)
|
||||
DEF_ICON_COLOR(EVENT_INSERT)
|
||||
DEF_ICON_COLOR(EVENT_HOME)
|
||||
DEF_ICON_COLOR(EVENT_END)
|
||||
DEF_ICON_COLOR(EVENT_UNKNOWN)
|
||||
DEF_ICON_COLOR(EVENT_GRLESS)
|
||||
DEF_ICON_COLOR(EVENT_MEDIAPLAY)
|
||||
DEF_ICON_COLOR(EVENT_MEDIASTOP)
|
||||
DEF_ICON_COLOR(EVENT_MEDIAFIRST)
|
||||
DEF_ICON_COLOR(EVENT_MEDIALAST)
|
||||
DEF_ICON_COLOR(EVENT_APP)
|
||||
DEF_ICON_COLOR(EVENT_CAPSLOCK)
|
||||
DEF_ICON_COLOR(EVENT_BACKSPACE)
|
||||
DEF_ICON_COLOR(EVENT_DEL)
|
||||
DEF_ICON_COLOR(EVENT_SEMICOLON)
|
||||
DEF_ICON_COLOR(EVENT_PERIOD)
|
||||
DEF_ICON_COLOR(EVENT_COMMA)
|
||||
DEF_ICON_COLOR(EVENT_QUOTE)
|
||||
DEF_ICON_COLOR(EVENT_ACCENTGRAVE)
|
||||
DEF_ICON_COLOR(EVENT_MINUS)
|
||||
DEF_ICON_COLOR(EVENT_PLUS)
|
||||
DEF_ICON_COLOR(EVENT_SLASH)
|
||||
DEF_ICON_COLOR(EVENT_BACKSLASH)
|
||||
DEF_ICON_COLOR(EVENT_EQUAL)
|
||||
DEF_ICON_COLOR(EVENT_LEFTBRACKET)
|
||||
DEF_ICON_COLOR(EVENT_RIGHTBRACKET)
|
||||
|
||||
DEF_ICON_COLOR(EVENT_F13)
|
||||
DEF_ICON_COLOR(EVENT_F14)
|
||||
DEF_ICON_COLOR(EVENT_F15)
|
||||
DEF_ICON_COLOR(EVENT_F16)
|
||||
DEF_ICON_COLOR(EVENT_F17)
|
||||
DEF_ICON_COLOR(EVENT_F18)
|
||||
DEF_ICON_COLOR(EVENT_F19)
|
||||
DEF_ICON_COLOR(EVENT_F20)
|
||||
DEF_ICON_COLOR(EVENT_F21)
|
||||
DEF_ICON_COLOR(EVENT_F22)
|
||||
DEF_ICON_COLOR(EVENT_F23)
|
||||
DEF_ICON_COLOR(EVENT_F24)
|
||||
|
||||
DEF_ICON_COLOR(EVENT_NDOF_BUTTON_V1)
|
||||
DEF_ICON_COLOR(EVENT_NDOF_BUTTON_V2)
|
||||
DEF_ICON_COLOR(EVENT_NDOF_BUTTON_V3)
|
||||
DEF_ICON_COLOR(EVENT_NDOF_BUTTON_1)
|
||||
DEF_ICON_COLOR(EVENT_NDOF_BUTTON_2)
|
||||
DEF_ICON_COLOR(EVENT_NDOF_BUTTON_3)
|
||||
DEF_ICON_COLOR(EVENT_NDOF_BUTTON_4)
|
||||
DEF_ICON_COLOR(EVENT_NDOF_BUTTON_5)
|
||||
DEF_ICON_COLOR(EVENT_NDOF_BUTTON_6)
|
||||
DEF_ICON_COLOR(EVENT_NDOF_BUTTON_7)
|
||||
DEF_ICON_COLOR(EVENT_NDOF_BUTTON_8)
|
||||
DEF_ICON_COLOR(EVENT_NDOF_BUTTON_9)
|
||||
DEF_ICON_COLOR(EVENT_NDOF_BUTTON_10)
|
||||
DEF_ICON_COLOR(EVENT_NDOF_BUTTON_A)
|
||||
DEF_ICON_COLOR(EVENT_NDOF_BUTTON_B)
|
||||
DEF_ICON_COLOR(EVENT_NDOF_BUTTON_C)
|
||||
DEF_ICON_COLOR(EVENT_NDOF_BUTTON_MENU)
|
||||
DEF_ICON_COLOR(EVENT_NDOF_BUTTON_FIT)
|
||||
DEF_ICON_COLOR(EVENT_NDOF_BUTTON_TOP)
|
||||
DEF_ICON_COLOR(EVENT_NDOF_BUTTON_BOTTOM)
|
||||
DEF_ICON_COLOR(EVENT_NDOF_BUTTON_LEFT)
|
||||
DEF_ICON_COLOR(EVENT_NDOF_BUTTON_RIGHT)
|
||||
DEF_ICON_COLOR(EVENT_NDOF_BUTTON_FRONT)
|
||||
DEF_ICON_COLOR(EVENT_NDOF_BUTTON_BACK)
|
||||
DEF_ICON_COLOR(EVENT_NDOF_BUTTON_ISO1)
|
||||
DEF_ICON_COLOR(EVENT_NDOF_BUTTON_ISO2)
|
||||
DEF_ICON_COLOR(EVENT_NDOF_BUTTON_ROLL_CW)
|
||||
DEF_ICON_COLOR(EVENT_NDOF_BUTTON_ROLL_CCW)
|
||||
DEF_ICON_COLOR(EVENT_NDOF_BUTTON_SPIN_CW)
|
||||
DEF_ICON_COLOR(EVENT_NDOF_BUTTON_SPIN_CCW)
|
||||
DEF_ICON_COLOR(EVENT_NDOF_BUTTON_TILT_CW)
|
||||
DEF_ICON_COLOR(EVENT_NDOF_BUTTON_TILT_CCW)
|
||||
DEF_ICON_COLOR(EVENT_NDOF_BUTTON_ROTATE)
|
||||
DEF_ICON_COLOR(EVENT_NDOF_BUTTON_PANZOOM)
|
||||
DEF_ICON_COLOR(EVENT_NDOF_BUTTON_DOMINANT)
|
||||
DEF_ICON_COLOR(EVENT_NDOF_BUTTON_PLUS)
|
||||
DEF_ICON_COLOR(EVENT_NDOF_BUTTON_MINUS)
|
||||
|
||||
/* add as needed. */
|
||||
|
||||
/* Undefine all types. */
|
||||
|
|
|
@ -6286,7 +6286,7 @@ static void ui_palette_set_active(uiButColor *color_but)
|
|||
{
|
||||
if (color_but->is_pallete_color) {
|
||||
Palette *palette = (Palette *)color_but->rnapoin.owner_id;
|
||||
PaletteColor *color = static_cast<PaletteColor *>(color_but->rnapoin.data);
|
||||
const PaletteColor *color = static_cast<const PaletteColor *>(color_but->rnapoin.data);
|
||||
palette->active_color = BLI_findindex(&palette->colors, color);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -743,6 +743,122 @@ static void init_event_icons()
|
|||
INIT_EVENT_ICON(ICON_EVENT_RETURN, EVT_RETKEY, KM_ANY);
|
||||
INIT_EVENT_ICON(ICON_EVENT_SPACEKEY, EVT_SPACEKEY, KM_ANY);
|
||||
|
||||
INIT_EVENT_ICON(ICON_EVENT_ZEROKEY, EVT_ZEROKEY, KM_ANY);
|
||||
INIT_EVENT_ICON(ICON_EVENT_ONEKEY, EVT_ONEKEY, KM_ANY);
|
||||
INIT_EVENT_ICON(ICON_EVENT_TWOKEY, EVT_TWOKEY, KM_ANY);
|
||||
INIT_EVENT_ICON(ICON_EVENT_THREEKEY, EVT_THREEKEY, KM_ANY);
|
||||
INIT_EVENT_ICON(ICON_EVENT_FOURKEY, EVT_FOURKEY, KM_ANY);
|
||||
INIT_EVENT_ICON(ICON_EVENT_FIVEKEY, EVT_FIVEKEY, KM_ANY);
|
||||
INIT_EVENT_ICON(ICON_EVENT_SIXKEY, EVT_SIXKEY, KM_ANY);
|
||||
INIT_EVENT_ICON(ICON_EVENT_SEVENKEY, EVT_SEVENKEY, KM_ANY);
|
||||
INIT_EVENT_ICON(ICON_EVENT_EIGHTKEY, EVT_EIGHTKEY, KM_ANY);
|
||||
INIT_EVENT_ICON(ICON_EVENT_NINEKEY, EVT_NINEKEY, KM_ANY);
|
||||
|
||||
INIT_EVENT_ICON(ICON_EVENT_PAD0, EVT_PAD0, KM_ANY);
|
||||
INIT_EVENT_ICON(ICON_EVENT_PAD1, EVT_PAD1, KM_ANY);
|
||||
INIT_EVENT_ICON(ICON_EVENT_PAD2, EVT_PAD2, KM_ANY);
|
||||
INIT_EVENT_ICON(ICON_EVENT_PAD3, EVT_PAD3, KM_ANY);
|
||||
INIT_EVENT_ICON(ICON_EVENT_PAD4, EVT_PAD4, KM_ANY);
|
||||
INIT_EVENT_ICON(ICON_EVENT_PAD5, EVT_PAD5, KM_ANY);
|
||||
INIT_EVENT_ICON(ICON_EVENT_PAD6, EVT_PAD6, KM_ANY);
|
||||
INIT_EVENT_ICON(ICON_EVENT_PAD7, EVT_PAD7, KM_ANY);
|
||||
INIT_EVENT_ICON(ICON_EVENT_PAD8, EVT_PAD8, KM_ANY);
|
||||
INIT_EVENT_ICON(ICON_EVENT_PAD9, EVT_PAD9, KM_ANY);
|
||||
INIT_EVENT_ICON(ICON_EVENT_PADASTER, EVT_PADASTERKEY, KM_ANY);
|
||||
INIT_EVENT_ICON(ICON_EVENT_PADSLASH, EVT_PADSLASHKEY, KM_ANY);
|
||||
INIT_EVENT_ICON(ICON_EVENT_PADMINUS, EVT_PADMINUS, KM_ANY);
|
||||
INIT_EVENT_ICON(ICON_EVENT_PADENTER, EVT_PADENTER, KM_ANY);
|
||||
INIT_EVENT_ICON(ICON_EVENT_PADPLUS, EVT_PADPLUSKEY, KM_ANY);
|
||||
INIT_EVENT_ICON(ICON_EVENT_PADPERIOD, EVT_PADPERIOD, KM_ANY);
|
||||
|
||||
INIT_EVENT_ICON(ICON_EVENT_MOUSE_4, BUTTON4MOUSE, KM_ANY);
|
||||
INIT_EVENT_ICON(ICON_EVENT_MOUSE_5, BUTTON5MOUSE, KM_ANY);
|
||||
INIT_EVENT_ICON(ICON_EVENT_MOUSE_6, BUTTON6MOUSE, KM_ANY);
|
||||
INIT_EVENT_ICON(ICON_EVENT_MOUSE_7, BUTTON7MOUSE, KM_ANY);
|
||||
INIT_EVENT_ICON(ICON_EVENT_TABLET_STYLUS, TABLET_STYLUS, KM_ANY);
|
||||
INIT_EVENT_ICON(ICON_EVENT_TABLET_ERASER, TABLET_ERASER, KM_ANY);
|
||||
INIT_EVENT_ICON(ICON_EVENT_LEFT_ARROW, EVT_LEFTARROWKEY, KM_ANY);
|
||||
INIT_EVENT_ICON(ICON_EVENT_DOWN_ARROW, EVT_DOWNARROWKEY, KM_ANY);
|
||||
INIT_EVENT_ICON(ICON_EVENT_RIGHT_ARROW, EVT_RIGHTARROWKEY, KM_ANY);
|
||||
INIT_EVENT_ICON(ICON_EVENT_UP_ARROW, EVT_UPARROWKEY, KM_ANY);
|
||||
INIT_EVENT_ICON(ICON_EVENT_PAUSE, EVT_PAUSEKEY, KM_ANY);
|
||||
INIT_EVENT_ICON(ICON_EVENT_INSERT, EVT_INSERTKEY, KM_ANY);
|
||||
INIT_EVENT_ICON(ICON_EVENT_HOME, EVT_HOMEKEY, KM_ANY);
|
||||
INIT_EVENT_ICON(ICON_EVENT_END, EVT_ENDKEY, KM_ANY);
|
||||
INIT_EVENT_ICON(ICON_EVENT_UNKNOWN, EVT_UNKNOWNKEY, KM_ANY);
|
||||
INIT_EVENT_ICON(ICON_EVENT_GRLESS, EVT_GRLESSKEY, KM_ANY);
|
||||
INIT_EVENT_ICON(ICON_EVENT_MEDIAPLAY, EVT_MEDIAPLAY, KM_ANY);
|
||||
INIT_EVENT_ICON(ICON_EVENT_MEDIASTOP, EVT_MEDIASTOP, KM_ANY);
|
||||
INIT_EVENT_ICON(ICON_EVENT_MEDIAFIRST, EVT_MEDIAFIRST, KM_ANY);
|
||||
INIT_EVENT_ICON(ICON_EVENT_MEDIALAST, EVT_MEDIALAST, KM_ANY);
|
||||
INIT_EVENT_ICON(ICON_EVENT_APP, EVT_APPKEY, KM_ANY);
|
||||
INIT_EVENT_ICON(ICON_EVENT_CAPSLOCK, EVT_CAPSLOCKKEY, KM_ANY);
|
||||
INIT_EVENT_ICON(ICON_EVENT_BACKSPACE, EVT_BACKSPACEKEY, KM_ANY);
|
||||
INIT_EVENT_ICON(ICON_EVENT_DEL, EVT_DELKEY, KM_ANY);
|
||||
INIT_EVENT_ICON(ICON_EVENT_SEMICOLON, EVT_SEMICOLONKEY, KM_ANY);
|
||||
INIT_EVENT_ICON(ICON_EVENT_PERIOD, EVT_PERIODKEY, KM_ANY);
|
||||
INIT_EVENT_ICON(ICON_EVENT_COMMA, EVT_COMMAKEY, KM_ANY);
|
||||
INIT_EVENT_ICON(ICON_EVENT_QUOTE, EVT_QUOTEKEY, KM_ANY);
|
||||
INIT_EVENT_ICON(ICON_EVENT_ACCENTGRAVE, EVT_ACCENTGRAVEKEY, KM_ANY);
|
||||
INIT_EVENT_ICON(ICON_EVENT_MINUS, EVT_MINUSKEY, KM_ANY);
|
||||
INIT_EVENT_ICON(ICON_EVENT_PLUS, EVT_PLUSKEY, KM_ANY);
|
||||
INIT_EVENT_ICON(ICON_EVENT_SLASH, EVT_SLASHKEY, KM_ANY);
|
||||
INIT_EVENT_ICON(ICON_EVENT_BACKSLASH, EVT_BACKSLASHKEY, KM_ANY);
|
||||
INIT_EVENT_ICON(ICON_EVENT_EQUAL, EVT_EQUALKEY, KM_ANY);
|
||||
INIT_EVENT_ICON(ICON_EVENT_LEFTBRACKET, EVT_LEFTBRACKETKEY, KM_ANY);
|
||||
INIT_EVENT_ICON(ICON_EVENT_RIGHTBRACKET, EVT_RIGHTBRACKETKEY, KM_ANY);
|
||||
|
||||
INIT_EVENT_ICON(ICON_EVENT_F13, EVT_F13KEY, KM_ANY);
|
||||
INIT_EVENT_ICON(ICON_EVENT_F14, EVT_F14KEY, KM_ANY);
|
||||
INIT_EVENT_ICON(ICON_EVENT_F15, EVT_F15KEY, KM_ANY);
|
||||
INIT_EVENT_ICON(ICON_EVENT_F16, EVT_F16KEY, KM_ANY);
|
||||
INIT_EVENT_ICON(ICON_EVENT_F17, EVT_F17KEY, KM_ANY);
|
||||
INIT_EVENT_ICON(ICON_EVENT_F18, EVT_F18KEY, KM_ANY);
|
||||
INIT_EVENT_ICON(ICON_EVENT_F19, EVT_F19KEY, KM_ANY);
|
||||
INIT_EVENT_ICON(ICON_EVENT_F20, EVT_F20KEY, KM_ANY);
|
||||
INIT_EVENT_ICON(ICON_EVENT_F21, EVT_F21KEY, KM_ANY);
|
||||
INIT_EVENT_ICON(ICON_EVENT_F22, EVT_F22KEY, KM_ANY);
|
||||
INIT_EVENT_ICON(ICON_EVENT_F23, EVT_F23KEY, KM_ANY);
|
||||
INIT_EVENT_ICON(ICON_EVENT_F24, EVT_F24KEY, KM_ANY);
|
||||
|
||||
INIT_EVENT_ICON(ICON_EVENT_NDOF_BUTTON_V1, NDOF_BUTTON_V1, KM_ANY);
|
||||
INIT_EVENT_ICON(ICON_EVENT_NDOF_BUTTON_V2, NDOF_BUTTON_V2, KM_ANY);
|
||||
INIT_EVENT_ICON(ICON_EVENT_NDOF_BUTTON_V3, NDOF_BUTTON_V3, KM_ANY);
|
||||
INIT_EVENT_ICON(ICON_EVENT_NDOF_BUTTON_1, NDOF_BUTTON_1, KM_ANY);
|
||||
INIT_EVENT_ICON(ICON_EVENT_NDOF_BUTTON_2, NDOF_BUTTON_2, KM_ANY);
|
||||
INIT_EVENT_ICON(ICON_EVENT_NDOF_BUTTON_3, NDOF_BUTTON_3, KM_ANY);
|
||||
INIT_EVENT_ICON(ICON_EVENT_NDOF_BUTTON_4, NDOF_BUTTON_4, KM_ANY);
|
||||
INIT_EVENT_ICON(ICON_EVENT_NDOF_BUTTON_5, NDOF_BUTTON_5, KM_ANY);
|
||||
INIT_EVENT_ICON(ICON_EVENT_NDOF_BUTTON_6, NDOF_BUTTON_6, KM_ANY);
|
||||
INIT_EVENT_ICON(ICON_EVENT_NDOF_BUTTON_7, NDOF_BUTTON_7, KM_ANY);
|
||||
INIT_EVENT_ICON(ICON_EVENT_NDOF_BUTTON_8, NDOF_BUTTON_8, KM_ANY);
|
||||
INIT_EVENT_ICON(ICON_EVENT_NDOF_BUTTON_9, NDOF_BUTTON_9, KM_ANY);
|
||||
INIT_EVENT_ICON(ICON_EVENT_NDOF_BUTTON_10, NDOF_BUTTON_10, KM_ANY);
|
||||
INIT_EVENT_ICON(ICON_EVENT_NDOF_BUTTON_A, NDOF_BUTTON_A, KM_ANY);
|
||||
INIT_EVENT_ICON(ICON_EVENT_NDOF_BUTTON_B, NDOF_BUTTON_B, KM_ANY);
|
||||
INIT_EVENT_ICON(ICON_EVENT_NDOF_BUTTON_C, NDOF_BUTTON_C, KM_ANY);
|
||||
INIT_EVENT_ICON(ICON_EVENT_NDOF_BUTTON_MENU, NDOF_BUTTON_MENU, KM_ANY);
|
||||
INIT_EVENT_ICON(ICON_EVENT_NDOF_BUTTON_FIT, NDOF_BUTTON_FIT, KM_ANY);
|
||||
INIT_EVENT_ICON(ICON_EVENT_NDOF_BUTTON_TOP, NDOF_BUTTON_TOP, KM_ANY);
|
||||
INIT_EVENT_ICON(ICON_EVENT_NDOF_BUTTON_BOTTOM, NDOF_BUTTON_BOTTOM, KM_ANY);
|
||||
INIT_EVENT_ICON(ICON_EVENT_NDOF_BUTTON_LEFT, NDOF_BUTTON_LEFT, KM_ANY);
|
||||
INIT_EVENT_ICON(ICON_EVENT_NDOF_BUTTON_RIGHT, NDOF_BUTTON_RIGHT, KM_ANY);
|
||||
INIT_EVENT_ICON(ICON_EVENT_NDOF_BUTTON_FRONT, NDOF_BUTTON_FRONT, KM_ANY);
|
||||
INIT_EVENT_ICON(ICON_EVENT_NDOF_BUTTON_BACK, NDOF_BUTTON_BACK, KM_ANY);
|
||||
INIT_EVENT_ICON(ICON_EVENT_NDOF_BUTTON_ISO1, NDOF_BUTTON_ISO1, KM_ANY);
|
||||
INIT_EVENT_ICON(ICON_EVENT_NDOF_BUTTON_ISO2, NDOF_BUTTON_ISO2, KM_ANY);
|
||||
INIT_EVENT_ICON(ICON_EVENT_NDOF_BUTTON_ROLL_CW, NDOF_BUTTON_ROLL_CW, KM_ANY);
|
||||
INIT_EVENT_ICON(ICON_EVENT_NDOF_BUTTON_ROLL_CCW, NDOF_BUTTON_ROLL_CCW, KM_ANY);
|
||||
INIT_EVENT_ICON(ICON_EVENT_NDOF_BUTTON_SPIN_CW, NDOF_BUTTON_SPIN_CW, KM_ANY);
|
||||
INIT_EVENT_ICON(ICON_EVENT_NDOF_BUTTON_SPIN_CCW, NDOF_BUTTON_SPIN_CCW, KM_ANY);
|
||||
INIT_EVENT_ICON(ICON_EVENT_NDOF_BUTTON_TILT_CW, NDOF_BUTTON_TILT_CW, KM_ANY);
|
||||
INIT_EVENT_ICON(ICON_EVENT_NDOF_BUTTON_TILT_CCW, NDOF_BUTTON_TILT_CCW, KM_ANY);
|
||||
INIT_EVENT_ICON(ICON_EVENT_NDOF_BUTTON_ROTATE, NDOF_BUTTON_ROTATE, KM_ANY);
|
||||
INIT_EVENT_ICON(ICON_EVENT_NDOF_BUTTON_PANZOOM, NDOF_BUTTON_PANZOOM, KM_ANY);
|
||||
INIT_EVENT_ICON(ICON_EVENT_NDOF_BUTTON_DOMINANT, NDOF_BUTTON_DOMINANT, KM_ANY);
|
||||
INIT_EVENT_ICON(ICON_EVENT_NDOF_BUTTON_PLUS, NDOF_BUTTON_PLUS, KM_ANY);
|
||||
INIT_EVENT_ICON(ICON_EVENT_NDOF_BUTTON_MINUS, NDOF_BUTTON_MINUS, KM_ANY);
|
||||
|
||||
g_di_event_list = di_next;
|
||||
|
||||
# undef INIT_EVENT_ICON
|
||||
|
|
|
@ -79,9 +79,9 @@ void icon_draw_rect_input(
|
|||
}
|
||||
else if (event_type == EVT_LEFTSHIFTKEY) { /* Right Shift has already been converted to left. */
|
||||
const char str[] = BLI_STR_UTF8_UPWARDS_WHITE_ARROW;
|
||||
icon_draw_rect_input_text(&rect, color, str, 16.0f, 0.0f);
|
||||
icon_draw_rect_input_text(&rect, color, str, 14.0f, 0.0f);
|
||||
}
|
||||
else if (event_type == EVT_LEFTCTRLKEY) { /* Right Shift has already been converted to left. */
|
||||
else if (event_type == EVT_LEFTCTRLKEY) { /* Right Ctrl has already been converted to left. */
|
||||
if (platform == MACOS) {
|
||||
const char str[] = BLI_STR_UTF8_UP_ARROWHEAD;
|
||||
icon_draw_rect_input_text(&rect, color, str, 21.0f, -8.0f);
|
||||
|
@ -96,17 +96,17 @@ void icon_draw_rect_input(
|
|||
icon_draw_rect_input_text(&rect, color, str, 13.0f, 0.0f);
|
||||
}
|
||||
else {
|
||||
icon_draw_rect_input_text(&rect, color, "Alt", 10.0f, 0.0f);
|
||||
icon_draw_rect_input_text(&rect, color, "Alt", 11.0f, 0.0f);
|
||||
}
|
||||
}
|
||||
else if (event_type == EVT_OSKEY) {
|
||||
if (platform == MACOS) {
|
||||
const char str[] = BLI_STR_UTF8_PLACE_OF_INTEREST_SIGN;
|
||||
icon_draw_rect_input_text(&rect, color, str, 16.0f, 0.0f);
|
||||
icon_draw_rect_input_text(&rect, color, str, 13.0f, 0.0f);
|
||||
}
|
||||
else if (platform == MSWIN) {
|
||||
const char str[] = BLI_STR_UTF8_BLACK_DIAMOND_MINUS_WHITE_X;
|
||||
icon_draw_rect_input_text(&rect, color, str, 16.0f, 0.0f);
|
||||
icon_draw_rect_input_text(&rect, color, str, 12.0f, 1.5f);
|
||||
}
|
||||
else {
|
||||
icon_draw_rect_input_text(&rect, color, "OS", 10.0f, 0.0f);
|
||||
|
@ -120,35 +120,35 @@ void icon_draw_rect_input(
|
|||
icon_draw_rect_input_text(&rect, color, str, 18.0f, -1.5f);
|
||||
}
|
||||
else if (event_type == EVT_HOMEKEY) {
|
||||
icon_draw_rect_input_text(&rect, color, "Home", 6.0f, 0.0f);
|
||||
icon_draw_rect_input_text(&rect, color, "Home", 5.5f, 0.0f);
|
||||
}
|
||||
else if (event_type == EVT_ENDKEY) {
|
||||
icon_draw_rect_input_text(&rect, color, "End", 8.0f, 0.0f);
|
||||
}
|
||||
else if (event_type == EVT_RETKEY) {
|
||||
const char str[] = BLI_STR_UTF8_RETURN_SYMBOL;
|
||||
icon_draw_rect_input_text(&rect, color, str, 17.0f, -1.0f);
|
||||
icon_draw_rect_input_text(&rect, color, str, 16.0f, -2.0f);
|
||||
}
|
||||
else if (event_type == EVT_ESCKEY) {
|
||||
if (platform == MACOS) {
|
||||
const char str[] = BLI_STR_UTF8_BROKEN_CIRCLE_WITH_NORTHWEST_ARROW;
|
||||
icon_draw_rect_input_text(&rect, color, str, 21.0f, -1.0f);
|
||||
icon_draw_rect_input_text(&rect, color, str, 16.0f, 0.0f);
|
||||
}
|
||||
else {
|
||||
icon_draw_rect_input_text(&rect, color, "Esc", 8.5f, 0.0f);
|
||||
icon_draw_rect_input_text(&rect, color, "Esc", 9.0f, 0.0f);
|
||||
}
|
||||
}
|
||||
else if (event_type == EVT_PAGEUPKEY) {
|
||||
const char str[] = "P" BLI_STR_UTF8_UPWARDS_ARROW;
|
||||
icon_draw_rect_input_text(&rect, color, str, 12.0f, 0.0f);
|
||||
icon_draw_rect_input_text(&rect, color, str, 10.0f, 0.0f);
|
||||
}
|
||||
else if (event_type == EVT_PAGEDOWNKEY) {
|
||||
const char str[] = "P" BLI_STR_UTF8_DOWNWARDS_ARROW;
|
||||
icon_draw_rect_input_text(&rect, color, str, 12.0f, 0.0f);
|
||||
icon_draw_rect_input_text(&rect, color, str, 10.0f, 0.0f);
|
||||
}
|
||||
else if (event_type == EVT_LEFTARROWKEY) {
|
||||
const char str[] = BLI_STR_UTF8_LEFTWARDS_ARROW;
|
||||
icon_draw_rect_input_text(&rect, color, str, 18.0f, -1.5f);
|
||||
icon_draw_rect_input_text(&rect, color, str, 18.0f, 0.0f);
|
||||
}
|
||||
else if (event_type == EVT_UPARROWKEY) {
|
||||
const char str[] = BLI_STR_UTF8_UPWARDS_ARROW;
|
||||
|
@ -156,7 +156,7 @@ void icon_draw_rect_input(
|
|||
}
|
||||
else if (event_type == EVT_RIGHTARROWKEY) {
|
||||
const char str[] = BLI_STR_UTF8_RIGHTWARDS_ARROW;
|
||||
icon_draw_rect_input_text(&rect, color, str, 18.0f, -1.5f);
|
||||
icon_draw_rect_input_text(&rect, color, str, 18.0f, 0.0f);
|
||||
}
|
||||
else if (event_type == EVT_DOWNARROWKEY) {
|
||||
const char str[] = BLI_STR_UTF8_DOWNWARDS_ARROW;
|
||||
|
@ -166,4 +166,227 @@ void icon_draw_rect_input(
|
|||
const char str[] = BLI_STR_UTF8_OPEN_BOX;
|
||||
icon_draw_rect_input_text(&rect, color, str, 20.0f, 2.0f);
|
||||
}
|
||||
else if (event_type == BUTTON4MOUSE) {
|
||||
icon_draw_rect_input_text(&rect, color, BLI_STR_UTF8_BLACK_VERTICAL_ELLIPSE "4", 12.0f, 0.0f);
|
||||
}
|
||||
else if (event_type == BUTTON5MOUSE) {
|
||||
icon_draw_rect_input_text(&rect, color, BLI_STR_UTF8_BLACK_VERTICAL_ELLIPSE "5", 12.0f, 0.0f);
|
||||
}
|
||||
else if (event_type == BUTTON6MOUSE) {
|
||||
icon_draw_rect_input_text(&rect, color, BLI_STR_UTF8_BLACK_VERTICAL_ELLIPSE "6", 12.0f, 0.0f);
|
||||
}
|
||||
else if (event_type == BUTTON7MOUSE) {
|
||||
icon_draw_rect_input_text(&rect, color, BLI_STR_UTF8_BLACK_VERTICAL_ELLIPSE "7", 12.0f, 0.0f);
|
||||
}
|
||||
else if (event_type == TABLET_STYLUS) {
|
||||
icon_draw_rect_input_text(&rect, color, BLI_STR_UTF8_LOWER_RIGHT_PENCIL, 16.0f, 0.0f);
|
||||
}
|
||||
else if (event_type == TABLET_ERASER) {
|
||||
icon_draw_rect_input_text(&rect, color, BLI_STR_UTF8_UPPER_RIGHT_PENCIL, 16.0f, 0.0f);
|
||||
}
|
||||
else if ((event_type >= EVT_ZEROKEY) && (event_type <= EVT_NINEKEY)) {
|
||||
const char str[2] = {char('0' + (event_type - EVT_ZEROKEY)), '\0'};
|
||||
icon_draw_rect_input_text(&rect, color, str, 13.0f, 0.0f);
|
||||
}
|
||||
else if ((event_type >= EVT_PAD0) && (event_type <= EVT_PAD9)) {
|
||||
char str[5];
|
||||
SNPRINTF(str, "%s%i", BLI_STR_UTF8_SQUARE_WITH_ORTHOGONAL_CROSSHATCH, event_type - EVT_PAD0);
|
||||
icon_draw_rect_input_text(&rect, color, str, 9.0f, 0.0f);
|
||||
}
|
||||
else if (event_type == EVT_PADASTERKEY) {
|
||||
icon_draw_rect_input_text(
|
||||
&rect, color, BLI_STR_UTF8_SQUARE_WITH_ORTHOGONAL_CROSSHATCH "6", 9.0f, 0.0f);
|
||||
}
|
||||
else if (event_type == EVT_PADSLASHKEY) {
|
||||
icon_draw_rect_input_text(
|
||||
&rect, color, BLI_STR_UTF8_SQUARE_WITH_ORTHOGONAL_CROSSHATCH "/", 9.0f, 0.0f);
|
||||
}
|
||||
else if (event_type == EVT_PADMINUS) {
|
||||
icon_draw_rect_input_text(
|
||||
&rect, color, BLI_STR_UTF8_SQUARE_WITH_ORTHOGONAL_CROSSHATCH "-", 9.0f, 0.0f);
|
||||
}
|
||||
else if (event_type == EVT_PADENTER) {
|
||||
icon_draw_rect_input_text(
|
||||
&rect,
|
||||
color,
|
||||
BLI_STR_UTF8_SQUARE_WITH_ORTHOGONAL_CROSSHATCH BLI_STR_UTF8_RETURN_SYMBOL,
|
||||
8.0f,
|
||||
0.0f);
|
||||
}
|
||||
else if (event_type == EVT_PADPLUSKEY) {
|
||||
icon_draw_rect_input_text(
|
||||
&rect, color, BLI_STR_UTF8_SQUARE_WITH_ORTHOGONAL_CROSSHATCH "+", 9.0f, 0.0f);
|
||||
}
|
||||
else if (event_type == EVT_PAUSEKEY) {
|
||||
icon_draw_rect_input_text(&rect, color, "Pause", 5.0f, 0.0f);
|
||||
}
|
||||
else if (event_type == EVT_INSERTKEY) {
|
||||
icon_draw_rect_input_text(&rect, color, "Insert", 5.5f, 0.0f);
|
||||
}
|
||||
else if (event_type == EVT_UNKNOWNKEY) {
|
||||
icon_draw_rect_input_text(&rect, color, " ", 12.0f, 0.0f);
|
||||
}
|
||||
else if (event_type == EVT_GRLESSKEY) {
|
||||
icon_draw_rect_input_text(&rect, color, BLI_STR_UTF8_GREATER_THAN_OR_LESS_THAN, 16.0f, 0.0f);
|
||||
}
|
||||
else if (event_type == EVT_MEDIAPLAY) {
|
||||
icon_draw_rect_input_text(&rect,
|
||||
color,
|
||||
BLI_STR_UTF8_BLACK_RIGHT_POINTING_TRIANGLE_WITH_DOUBLE_VERTICAL_BAR,
|
||||
10.0f,
|
||||
1.0f);
|
||||
}
|
||||
else if (event_type == EVT_MEDIASTOP) {
|
||||
icon_draw_rect_input_text(&rect, color, BLI_STR_UTF8_BLACK_SQUARE_FOR_STOP, 10.0f, 1.0f);
|
||||
}
|
||||
else if (event_type == EVT_MEDIAFIRST) {
|
||||
icon_draw_rect_input_text(&rect,
|
||||
color,
|
||||
BLI_STR_UTF8_BLACK_LEFT_POINTING_DOUBLE_TRIANGLE_WITH_VERTICAL_BAR,
|
||||
11.0f,
|
||||
1.0f);
|
||||
}
|
||||
else if (event_type == EVT_MEDIALAST) {
|
||||
icon_draw_rect_input_text(&rect,
|
||||
color,
|
||||
BLI_STR_UTF8_BLACK_RIGHT_POINTING_DOUBLE_TRIANGLE_WITH_VERTICAL_BAR,
|
||||
10.0f,
|
||||
1.0f);
|
||||
}
|
||||
else if (event_type == EVT_APPKEY) {
|
||||
icon_draw_rect_input_text(&rect, color, "App", 8.0f, 1.0f);
|
||||
}
|
||||
else if (event_type == EVT_PADPERIOD) {
|
||||
icon_draw_rect_input_text(
|
||||
&rect, color, BLI_STR_UTF8_SQUARE_WITH_ORTHOGONAL_CROSSHATCH ".", 9.0f, 0.0f);
|
||||
}
|
||||
else if (event_type == EVT_CAPSLOCKKEY) {
|
||||
icon_draw_rect_input_text(&rect, color, BLI_STR_UTF8_UPWARDS_UP_ARROW_FROM_BAR, 14.0f, 2.0f);
|
||||
}
|
||||
else if (event_type == EVT_LINEFEEDKEY) {
|
||||
icon_draw_rect_input_text(&rect, color, "LF", 12.0f, 0.0f);
|
||||
}
|
||||
else if (event_type == EVT_BACKSPACEKEY) {
|
||||
const char str[] = BLI_STR_UTF8_ERASE_TO_THE_LEFT;
|
||||
icon_draw_rect_input_text(&rect, color, str, 14.0f, 0.0f);
|
||||
}
|
||||
else if (event_type == EVT_SEMICOLONKEY) {
|
||||
icon_draw_rect_input_text(&rect, color, ";", 16.0f, 1.5f);
|
||||
}
|
||||
else if (event_type == EVT_PERIODKEY) {
|
||||
icon_draw_rect_input_text(&rect, color, ".", 18.0f, -2.0f);
|
||||
}
|
||||
else if (event_type == EVT_COMMAKEY) {
|
||||
icon_draw_rect_input_text(&rect, color, ",", 18.0f, 0.0f);
|
||||
}
|
||||
else if (event_type == EVT_QUOTEKEY) {
|
||||
icon_draw_rect_input_text(&rect, color, "'", 18.0f, -6.0f);
|
||||
}
|
||||
else if (event_type == EVT_ACCENTGRAVEKEY) {
|
||||
icon_draw_rect_input_text(&rect, color, "`", 18.0f, -7.0f);
|
||||
}
|
||||
else if (event_type == EVT_MINUSKEY) {
|
||||
icon_draw_rect_input_text(&rect, color, "-", 18.0f, -5.0f);
|
||||
}
|
||||
else if (event_type == EVT_PLUSKEY) {
|
||||
icon_draw_rect_input_text(&rect, color, "+", 18.0f, -1.0f);
|
||||
}
|
||||
else if (event_type == EVT_SLASHKEY) {
|
||||
icon_draw_rect_input_text(&rect, color, "/", 13.0f, 1.0f);
|
||||
}
|
||||
else if (event_type == EVT_BACKSLASHKEY) {
|
||||
icon_draw_rect_input_text(&rect, color, "\\", 13.0f, 1.0f);
|
||||
}
|
||||
else if (event_type == EVT_EQUALKEY) {
|
||||
icon_draw_rect_input_text(&rect, color, "=", 18.0f, -2.5f);
|
||||
}
|
||||
else if (event_type == EVT_LEFTBRACKETKEY) {
|
||||
icon_draw_rect_input_text(&rect, color, "[", 12.0f, 1.5f);
|
||||
}
|
||||
else if (event_type == EVT_RIGHTBRACKETKEY) {
|
||||
icon_draw_rect_input_text(&rect, color, "]", 12.0f, 1.5f);
|
||||
}
|
||||
else if ((event_type >= NDOF_BUTTON_MENU) && (event_type <= NDOF_BUTTON_C)) {
|
||||
if ((event_type >= NDOF_BUTTON_V1) && (event_type <= NDOF_BUTTON_V3)) {
|
||||
char str[7];
|
||||
SNPRINTF(str, "%sv%i", BLI_STR_UTF8_CIRCLED_WHITE_BULLET, 1 + event_type - NDOF_BUTTON_V1);
|
||||
icon_draw_rect_input_text(&rect, color, str, 7.5f, 0.0f);
|
||||
}
|
||||
else if ((event_type >= NDOF_BUTTON_1) && (event_type <= NDOF_BUTTON_9)) {
|
||||
char str[6];
|
||||
SNPRINTF(str, "%s%i", BLI_STR_UTF8_CIRCLED_WHITE_BULLET, 1 + event_type - NDOF_BUTTON_1);
|
||||
icon_draw_rect_input_text(&rect, color, str, 9.0f, 0.0f);
|
||||
}
|
||||
else if (event_type == NDOF_BUTTON_10) {
|
||||
icon_draw_rect_input_text(&rect, color, BLI_STR_UTF8_CIRCLED_WHITE_BULLET "10", 7.5f, 0.0f);
|
||||
}
|
||||
else if ((event_type >= NDOF_BUTTON_A) && (event_type <= NDOF_BUTTON_C)) {
|
||||
char str[6];
|
||||
SNPRINTF(str, "%s%c", BLI_STR_UTF8_CIRCLED_WHITE_BULLET, 'A' + event_type - NDOF_BUTTON_A);
|
||||
icon_draw_rect_input_text(&rect, color, str, 9.0f, 0.0f);
|
||||
}
|
||||
else if (event_type == NDOF_BUTTON_MENU) {
|
||||
icon_draw_rect_input_text(&rect, color, BLI_STR_UTF8_CIRCLED_WHITE_BULLET "Me", 6.5f, 0.0f);
|
||||
}
|
||||
else if (event_type == NDOF_BUTTON_FIT) {
|
||||
icon_draw_rect_input_text(&rect, color, BLI_STR_UTF8_CIRCLED_WHITE_BULLET "Ft", 7.5f, 0.0f);
|
||||
}
|
||||
else if (event_type == NDOF_BUTTON_TOP) {
|
||||
icon_draw_rect_input_text(&rect, color, BLI_STR_UTF8_CIRCLED_WHITE_BULLET "Tp", 7.0f, 0.0f);
|
||||
}
|
||||
else if (event_type == NDOF_BUTTON_BOTTOM) {
|
||||
icon_draw_rect_input_text(&rect, color, BLI_STR_UTF8_CIRCLED_WHITE_BULLET "Bt", 7.5f, 0.0f);
|
||||
}
|
||||
else if (event_type == NDOF_BUTTON_LEFT) {
|
||||
icon_draw_rect_input_text(&rect, color, BLI_STR_UTF8_CIRCLED_WHITE_BULLET "Le", 7.0f, 0.0f);
|
||||
}
|
||||
else if (event_type == NDOF_BUTTON_RIGHT) {
|
||||
icon_draw_rect_input_text(&rect, color, BLI_STR_UTF8_CIRCLED_WHITE_BULLET "Ri", 7.5f, 0.0f);
|
||||
}
|
||||
else if (event_type == NDOF_BUTTON_FRONT) {
|
||||
icon_draw_rect_input_text(&rect, color, BLI_STR_UTF8_CIRCLED_WHITE_BULLET "Fr", 7.5f, 0.0f);
|
||||
}
|
||||
else if (event_type == NDOF_BUTTON_BACK) {
|
||||
icon_draw_rect_input_text(&rect, color, BLI_STR_UTF8_CIRCLED_WHITE_BULLET "Bk", 7.0f, 0.0f);
|
||||
}
|
||||
else if (event_type == NDOF_BUTTON_ISO1) {
|
||||
icon_draw_rect_input_text(&rect, color, BLI_STR_UTF8_CIRCLED_WHITE_BULLET "I1", 7.5f, 0.0f);
|
||||
}
|
||||
else if (event_type == NDOF_BUTTON_ISO2) {
|
||||
icon_draw_rect_input_text(&rect, color, BLI_STR_UTF8_CIRCLED_WHITE_BULLET "I2", 7.5f, 0.0f);
|
||||
}
|
||||
else if (event_type == NDOF_BUTTON_ROLL_CW) {
|
||||
icon_draw_rect_input_text(&rect, color, BLI_STR_UTF8_CIRCLED_WHITE_BULLET "Rl", 7.5f, 0.0f);
|
||||
}
|
||||
else if (event_type == NDOF_BUTTON_ROLL_CCW) {
|
||||
icon_draw_rect_input_text(&rect, color, BLI_STR_UTF8_CIRCLED_WHITE_BULLET "Rc", 7.0f, 0.0f);
|
||||
}
|
||||
else if (event_type == NDOF_BUTTON_SPIN_CW) {
|
||||
icon_draw_rect_input_text(&rect, color, BLI_STR_UTF8_CIRCLED_WHITE_BULLET "Sp", 7.0f, 0.0f);
|
||||
}
|
||||
else if (event_type == NDOF_BUTTON_SPIN_CCW) {
|
||||
icon_draw_rect_input_text(&rect, color, BLI_STR_UTF8_CIRCLED_WHITE_BULLET "Sc", 7.0f, 0.0f);
|
||||
}
|
||||
else if (event_type == NDOF_BUTTON_TILT_CW) {
|
||||
icon_draw_rect_input_text(&rect, color, BLI_STR_UTF8_CIRCLED_WHITE_BULLET "Ti", 8.0f, 0.0f);
|
||||
}
|
||||
else if (event_type == NDOF_BUTTON_TILT_CCW) {
|
||||
icon_draw_rect_input_text(&rect, color, BLI_STR_UTF8_CIRCLED_WHITE_BULLET "Tc", 7.0f, 0.0f);
|
||||
}
|
||||
else if (event_type == NDOF_BUTTON_ROTATE) {
|
||||
icon_draw_rect_input_text(&rect, color, BLI_STR_UTF8_CIRCLED_WHITE_BULLET "Ro", 7.0f, 0.0f);
|
||||
}
|
||||
else if (event_type == NDOF_BUTTON_PANZOOM) {
|
||||
icon_draw_rect_input_text(&rect, color, BLI_STR_UTF8_CIRCLED_WHITE_BULLET "PZ", 7.0f, 0.0f);
|
||||
}
|
||||
else if (event_type == NDOF_BUTTON_DOMINANT) {
|
||||
icon_draw_rect_input_text(&rect, color, BLI_STR_UTF8_CIRCLED_WHITE_BULLET "Dm", 6.5f, 0.0f);
|
||||
}
|
||||
else if (event_type == NDOF_BUTTON_PLUS) {
|
||||
icon_draw_rect_input_text(&rect, color, BLI_STR_UTF8_CIRCLED_WHITE_BULLET "+", 10.0f, 0.0f);
|
||||
}
|
||||
else if (event_type == NDOF_BUTTON_MINUS) {
|
||||
icon_draw_rect_input_text(&rect, color, BLI_STR_UTF8_CIRCLED_WHITE_BULLET "-", 10.0f, 0.0f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -599,7 +599,7 @@ static void ui_searchbox_region_draw_fn(const bContext *C, ARegion *region)
|
|||
/* draw items */
|
||||
for (int a = 0; a < data->items.totitem; a++) {
|
||||
const int but_flag = ((a == data->active) ? UI_HOVER : 0) | data->items.but_flags[a];
|
||||
char *name = data->items.names[a];
|
||||
const char *name = data->items.names[a];
|
||||
int icon = data->items.icons[a];
|
||||
char *name_sep_test = nullptr;
|
||||
|
||||
|
|
|
@ -6176,11 +6176,14 @@ void uiTemplateInputStatus(uiLayout *layout, bContext *C)
|
|||
WM_window_cursor_keymap_status_get(win, i, 1));
|
||||
|
||||
if (msg || (msg_drag == nullptr)) {
|
||||
uiItemL(row, msg ? msg : "", (ICON_MOUSE_LMB + i));
|
||||
/* Icon and text separately are closer together with aligned layout. */
|
||||
uiItemL(row, "", (ICON_MOUSE_LMB + i));
|
||||
uiItemL(row, msg ? msg : "", ICON_NONE);
|
||||
}
|
||||
|
||||
if (msg_drag) {
|
||||
uiItemL(row, msg_drag, (ICON_MOUSE_LMB_DRAG + i));
|
||||
uiItemL(row, "", (ICON_MOUSE_LMB_DRAG + i));
|
||||
uiItemL(row, msg_drag, ICON_NONE);
|
||||
}
|
||||
|
||||
/* Use trick with empty string to keep icons in same position. */
|
||||
|
@ -6415,13 +6418,23 @@ bool uiTemplateEventFromKeymapItem(uiLayout *layout,
|
|||
for (int j = 0; j < ARRAY_SIZE(icon_mod) && icon_mod[j]; j++) {
|
||||
uiItemL(layout, "", icon_mod[j]);
|
||||
}
|
||||
uiItemL(layout, CTX_IFACE_(BLT_I18NCONTEXT_ID_WINDOWMANAGER, text), icon);
|
||||
|
||||
/* Icon and text separately is closer together with aligned layout. */
|
||||
uiItemL(layout, "", icon);
|
||||
if (icon < ICON_MOUSE_LMB || icon > ICON_MOUSE_RMB_DRAG) {
|
||||
/* Mouse icons are left-aliged. Everything else needs a bit of space here. */
|
||||
uiItemS_ex(layout, 0.6f);
|
||||
}
|
||||
uiItemL(layout, CTX_IFACE_(BLT_I18NCONTEXT_ID_WINDOWMANAGER, text), ICON_NONE);
|
||||
/* Separate items with some extra space. */
|
||||
uiItemS_ex(layout, 0.7f);
|
||||
ok = true;
|
||||
}
|
||||
else if (text_fallback) {
|
||||
const char *event_text = WM_key_event_string(kmi->type, true);
|
||||
uiItemL(layout, event_text, ICON_NONE);
|
||||
uiItemL(layout, CTX_IFACE_(BLT_I18NCONTEXT_ID_WINDOWMANAGER, text), ICON_NONE);
|
||||
uiItemS_ex(layout, 0.5f);
|
||||
ok = true;
|
||||
}
|
||||
return ok;
|
||||
|
|
|
@ -28,9 +28,6 @@
|
|||
|
||||
namespace blender::ed::sculpt_paint::greasepencil {
|
||||
|
||||
static constexpr float POINT_OVERRIDE_THRESHOLD_PX = 3.0f;
|
||||
static constexpr float POINT_RESAMPLE_MIN_DISTANCE_PX = 10.0f;
|
||||
|
||||
using ed::greasepencil::MutableDrawingInfo;
|
||||
|
||||
class TintOperation : public GreasePencilStrokeOperation {
|
||||
|
|
|
@ -63,6 +63,10 @@
|
|||
|
||||
namespace blender::ed::sculpt_paint::face_set {
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/** \name Public API
|
||||
* \{ */
|
||||
|
||||
int find_next_available_id(Object &object)
|
||||
{
|
||||
SculptSession &ss = *object.sculpt;
|
||||
|
@ -177,7 +181,11 @@ int ensure_face_sets_bmesh(Object &object)
|
|||
return CustomData_get_offset_named(&bm.pdata, CD_PROP_INT32, ".sculpt_face_set");
|
||||
}
|
||||
|
||||
/* Draw Face Sets Brush. */
|
||||
/** \} */
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/** \name Draw Face Sets Brush
|
||||
* \{ */
|
||||
|
||||
constexpr float FACE_SET_BRUSH_MIN_FADE = 0.05f;
|
||||
|
||||
|
@ -477,6 +485,13 @@ void do_draw_face_sets_brush(Sculpt *sd, Object *ob, Span<PBVHNode *> nodes)
|
|||
}
|
||||
}
|
||||
|
||||
/** \} */
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/** \name Global Mesh Operators
|
||||
* Operators that work on the mesh as a whole.
|
||||
* \{ */
|
||||
|
||||
static void face_sets_update(Object &object,
|
||||
const Span<PBVHNode *> nodes,
|
||||
const FunctionRef<void(Span<int>, MutableSpan<int>)> calc_face_sets)
|
||||
|
@ -515,8 +530,6 @@ static void face_sets_update(Object &object,
|
|||
face_sets.finish();
|
||||
}
|
||||
|
||||
/* Face Sets Operators */
|
||||
|
||||
enum class CreateMode {
|
||||
Masked = 0,
|
||||
Visible = 1,
|
||||
|
@ -1652,8 +1665,11 @@ void SCULPT_OT_face_sets_edit(wmOperatorType *ot)
|
|||
"Apply the edit operation to hidden geometry");
|
||||
}
|
||||
|
||||
/** \} */
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/** \name Gesture Operators
|
||||
* Operators that modify face sets based on a selected area.
|
||||
* \{ */
|
||||
|
||||
struct SculptGestureFaceSetOperation {
|
||||
|
|
|
@ -170,7 +170,7 @@ void file_params_invoke_rename_postscroll(wmWindowManager *wm, wmWindow *win, Sp
|
|||
void file_params_rename_end(wmWindowManager *wm,
|
||||
wmWindow *win,
|
||||
SpaceFile *sfile,
|
||||
FileDirEntry *rename_file);
|
||||
const FileDirEntry *rename_file);
|
||||
/**
|
||||
* Helper used by both main update code, and smooth-scroll timer,
|
||||
* to try to enable rename editing from #FileSelectParams.renamefile name.
|
||||
|
|
|
@ -1349,7 +1349,7 @@ void file_params_invoke_rename_postscroll(wmWindowManager *wm, wmWindow *win, Sp
|
|||
void file_params_rename_end(wmWindowManager *wm,
|
||||
wmWindow *win,
|
||||
SpaceFile *sfile,
|
||||
FileDirEntry *rename_file)
|
||||
const FileDirEntry *rename_file)
|
||||
{
|
||||
FileSelectParams *params = ED_fileselect_get_active_params(sfile);
|
||||
|
||||
|
|
|
@ -821,22 +821,20 @@ void ED_info_draw_stats(
|
|||
}
|
||||
else if (any_objects) {
|
||||
stats_row(col1, labels[OBJ], col2, stats_fmt.totobj, nullptr, y, height);
|
||||
/* Show scene totals if nothing is selected. */
|
||||
stats_row(col1, labels[VERTS], col2, stats_fmt.totvert, nullptr, y, height);
|
||||
stats_row(col1, labels[EDGES], col2, stats_fmt.totedge, nullptr, y, height);
|
||||
stats_row(col1, labels[FACES], col2, stats_fmt.totface, nullptr, y, height);
|
||||
stats_row(col1, labels[TRIS], col2, stats_fmt.tottri, nullptr, y, height);
|
||||
return;
|
||||
}
|
||||
else if (!(object_mode & OB_MODE_SCULPT)) {
|
||||
/* No objects in scene. */
|
||||
stats_row(col1, labels[OBJ], col2, 0, nullptr, y, height);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!any_selected) {
|
||||
if (any_objects) {
|
||||
/* Show scene totals if nothing is selected. */
|
||||
stats_row(col1, labels[VERTS], col2, stats_fmt.totvert, nullptr, y, height);
|
||||
stats_row(col1, labels[EDGES], col2, stats_fmt.totedge, nullptr, y, height);
|
||||
stats_row(col1, labels[FACES], col2, stats_fmt.totface, nullptr, y, height);
|
||||
stats_row(col1, labels[TRIS], col2, stats_fmt.tottri, nullptr, y, height);
|
||||
}
|
||||
else {
|
||||
/* No objects in scene. */
|
||||
stats_row(col1, labels[OBJ], col2, stats_fmt.totobj, nullptr, y, height);
|
||||
}
|
||||
}
|
||||
else if ((ob) && ELEM(ob->type, OB_GPENCIL_LEGACY, OB_GREASE_PENCIL)) {
|
||||
if ((ob) && ELEM(ob->type, OB_GPENCIL_LEGACY, OB_GREASE_PENCIL)) {
|
||||
stats_row(col1, labels[LAYERS], col2, stats_fmt.totgplayer, nullptr, y, height);
|
||||
stats_row(col1, labels[FRAMES], col2, stats_fmt.totgpframe, nullptr, y, height);
|
||||
stats_row(col1, labels[STROKES], col2, stats_fmt.totgpstroke, nullptr, y, height);
|
||||
|
|
|
@ -2263,7 +2263,7 @@ static Sequence *find_next_prev_sequence(Scene *scene, Sequence *test, int lr, i
|
|||
return best_seq; /* Can be nullptr. */
|
||||
}
|
||||
|
||||
static bool seq_is_parent(Sequence *par, Sequence *seq)
|
||||
static bool seq_is_parent(const Sequence *par, const Sequence *seq)
|
||||
{
|
||||
return ((par->seq1 == seq) || (par->seq2 == seq) || (par->seq3 == seq));
|
||||
}
|
||||
|
|
|
@ -219,7 +219,7 @@ void SEQUENCER_OT_view_all_preview(wmOperatorType *ot)
|
|||
|
||||
static int sequencer_view_zoom_ratio_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
RenderData *rd = &CTX_data_scene(C)->r;
|
||||
const RenderData *rd = &CTX_data_scene(C)->r;
|
||||
View2D *v2d = UI_view2d_fromcontext(C);
|
||||
|
||||
float ratio = RNA_float_get(op->ptr, "ratio");
|
||||
|
|
|
@ -848,12 +848,12 @@ int space_text_get_visible_lines(const SpaceText *st, const ARegion *region, con
|
|||
|
||||
int space_text_get_span_wrap(const SpaceText *st,
|
||||
const ARegion *region,
|
||||
TextLine *from,
|
||||
TextLine *to)
|
||||
const TextLine *from,
|
||||
const TextLine *to)
|
||||
{
|
||||
if (st->wordwrap) {
|
||||
int ret = 0;
|
||||
TextLine *tmp = from;
|
||||
const TextLine *tmp = from;
|
||||
|
||||
/* Look forwards */
|
||||
while (tmp) {
|
||||
|
|
|
@ -91,8 +91,8 @@ void text_pop_suggest_list();
|
|||
int space_text_get_visible_lines(const SpaceText *st, const ARegion *region, const char *str);
|
||||
int space_text_get_span_wrap(const SpaceText *st,
|
||||
const ARegion *region,
|
||||
TextLine *from,
|
||||
TextLine *to);
|
||||
const TextLine *from,
|
||||
const TextLine *to);
|
||||
int space_text_get_total_lines(SpaceText *st, const ARegion *region);
|
||||
|
||||
/* `text_ops.cc` */
|
||||
|
|
|
@ -1102,7 +1102,7 @@ void TEXT_OT_duplicate_line(wmOperatorType *ot)
|
|||
/** \name Copy Operator
|
||||
* \{ */
|
||||
|
||||
static void txt_copy_clipboard(Text *text)
|
||||
static void txt_copy_clipboard(const Text *text)
|
||||
{
|
||||
char *buf;
|
||||
|
||||
|
@ -1120,7 +1120,7 @@ static void txt_copy_clipboard(Text *text)
|
|||
|
||||
static int text_copy_exec(bContext *C, wmOperator * /*op*/)
|
||||
{
|
||||
Text *text = CTX_data_edit_text(C);
|
||||
const Text *text = CTX_data_edit_text(C);
|
||||
|
||||
txt_copy_clipboard(text);
|
||||
|
||||
|
|
|
@ -61,7 +61,7 @@ void GLIndexBuf::bind_as_ssbo(uint binding)
|
|||
void GLIndexBuf::read(uint32_t *data) const
|
||||
{
|
||||
BLI_assert(is_active());
|
||||
void *buffer = glMapBuffer(GL_ELEMENT_ARRAY_BUFFER, GL_READ_ONLY);
|
||||
const void *buffer = glMapBuffer(GL_ELEMENT_ARRAY_BUFFER, GL_READ_ONLY);
|
||||
memcpy(data, buffer, size_get());
|
||||
glUnmapBuffer(GL_ELEMENT_ARRAY_BUFFER);
|
||||
}
|
||||
|
|
|
@ -201,8 +201,8 @@ static void *imb_gpu_get_data(const ImBuf *ibuf,
|
|||
}
|
||||
|
||||
if (do_rescale) {
|
||||
uint8_t *rect = (is_float_rect) ? nullptr : (uint8_t *)data_rect;
|
||||
float *rect_float = (is_float_rect) ? (float *)data_rect : nullptr;
|
||||
const uint8_t *rect = (is_float_rect) ? nullptr : (uint8_t *)data_rect;
|
||||
const float *rect_float = (is_float_rect) ? (float *)data_rect : nullptr;
|
||||
|
||||
ImBuf *scale_ibuf = IMB_allocFromBuffer(rect, rect_float, ibuf->x, ibuf->y, 4);
|
||||
IMB_scaleImBuf(scale_ibuf, UNPACK2(rescale_size));
|
||||
|
|
|
@ -80,7 +80,7 @@ static void rna_Palette_active_color_set(PointerRNA *ptr,
|
|||
ReportList * /*reports*/)
|
||||
{
|
||||
Palette *palette = static_cast<Palette *>(ptr->data);
|
||||
PaletteColor *color = static_cast<PaletteColor *>(value.data);
|
||||
const PaletteColor *color = static_cast<const PaletteColor *>(value.data);
|
||||
|
||||
/* -1 is ok for an unset index */
|
||||
if (color == nullptr) {
|
||||
|
|
|
@ -1507,7 +1507,8 @@ static void rna_Sequence_separate(ID *id, Sequence *seqm, Main *bmain)
|
|||
}
|
||||
|
||||
/* Find channel owner. If nullptr, owner is `Editing`, otherwise it's `Sequence`. */
|
||||
static Sequence *rna_SeqTimelineChannel_owner_get(Editing *ed, SeqTimelineChannel *channel)
|
||||
static Sequence *rna_SeqTimelineChannel_owner_get(const Editing *ed,
|
||||
const SeqTimelineChannel *channel)
|
||||
{
|
||||
blender::VectorSet strips = SEQ_query_all_meta_strips_recursive(&ed->seqbase);
|
||||
|
||||
|
|
|
@ -263,7 +263,7 @@ RenderPass *render_layer_add_pass(RenderResult *rr,
|
|||
}
|
||||
|
||||
RenderResult *render_result_new(Render *re,
|
||||
rcti *partrct,
|
||||
const rcti *partrct,
|
||||
const char *layername,
|
||||
const char *viewname)
|
||||
{
|
||||
|
|
|
@ -37,7 +37,7 @@ extern "C" {
|
|||
* `re->winx`, `re->winy` is coordinate space of entire image, `partrct` the part within.
|
||||
*/
|
||||
struct RenderResult *render_result_new(struct Render *re,
|
||||
struct rcti *partrct,
|
||||
const struct rcti *partrct,
|
||||
const char *layername,
|
||||
const char *viewname);
|
||||
|
||||
|
|
|
@ -86,14 +86,14 @@ blender::VectorSet<Sequence *> SEQ_query_all_strips(ListBase *seqbase);
|
|||
* \param seqbase: ListBase in which strips are queried
|
||||
* \return set of strips
|
||||
*/
|
||||
blender::VectorSet<Sequence *> SEQ_query_all_strips_recursive(ListBase *seqbase);
|
||||
blender::VectorSet<Sequence *> SEQ_query_all_strips_recursive(const ListBase *seqbase);
|
||||
/**
|
||||
* Query all meta strips in seqbase and nested meta strips.
|
||||
*
|
||||
* \param seqbase: ListBase in which strips are queried
|
||||
* \return set of meta strips
|
||||
*/
|
||||
blender::VectorSet<Sequence *> SEQ_query_all_meta_strips_recursive(ListBase *seqbase);
|
||||
blender::VectorSet<Sequence *> SEQ_query_all_meta_strips_recursive(const ListBase *seqbase);
|
||||
|
||||
/**
|
||||
* Query all effect strips that are directly or indirectly connected to seq_reference.
|
||||
|
|
|
@ -77,7 +77,7 @@ void SEQ_iterator_set_expand(const Scene *scene,
|
|||
strips.add_multiple(query_matches);
|
||||
}
|
||||
|
||||
static void query_all_strips_recursive(ListBase *seqbase, VectorSet<Sequence *> &strips)
|
||||
static void query_all_strips_recursive(const ListBase *seqbase, VectorSet<Sequence *> &strips)
|
||||
{
|
||||
LISTBASE_FOREACH (Sequence *, seq, seqbase) {
|
||||
if (seq->type == SEQ_TYPE_META) {
|
||||
|
@ -87,7 +87,7 @@ static void query_all_strips_recursive(ListBase *seqbase, VectorSet<Sequence *>
|
|||
}
|
||||
}
|
||||
|
||||
static void query_all_meta_strips_recursive(ListBase *seqbase, VectorSet<Sequence *> &strips)
|
||||
static void query_all_meta_strips_recursive(const ListBase *seqbase, VectorSet<Sequence *> &strips)
|
||||
{
|
||||
LISTBASE_FOREACH (Sequence *, seq, seqbase) {
|
||||
if (seq->type == SEQ_TYPE_META) {
|
||||
|
@ -97,14 +97,14 @@ static void query_all_meta_strips_recursive(ListBase *seqbase, VectorSet<Sequenc
|
|||
}
|
||||
}
|
||||
|
||||
VectorSet<Sequence *> SEQ_query_all_strips_recursive(ListBase *seqbase)
|
||||
VectorSet<Sequence *> SEQ_query_all_strips_recursive(const ListBase *seqbase)
|
||||
{
|
||||
VectorSet<Sequence *> strips;
|
||||
query_all_strips_recursive(seqbase, strips);
|
||||
return strips;
|
||||
}
|
||||
|
||||
VectorSet<Sequence *> SEQ_query_all_meta_strips_recursive(ListBase *seqbase)
|
||||
VectorSet<Sequence *> SEQ_query_all_meta_strips_recursive(const ListBase *seqbase)
|
||||
{
|
||||
VectorSet<Sequence *> strips;
|
||||
query_all_meta_strips_recursive(seqbase, strips);
|
||||
|
|
Loading…
Reference in New Issue