Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorJacques Lucke <jacques@blender.org>2021-08-18 17:14:32 +0300
committerJacques Lucke <jacques@blender.org>2021-08-18 17:14:32 +0300
commit55b333d3e3cb18c0c546c292e1325b13f68c6f1c (patch)
tree36566a73d3eeffbaff9a8b15046fb16f0b7ffde9 /source
parent00cfad85782f47e9158e5fc8e2f97c3e02e01ba3 (diff)
parent04376c3bac796c9fb4bc2e33150484e357a65eab (diff)
Merge branch 'master' into mf-procedure
Diffstat (limited to 'source')
-rw-r--r--source/blender/blenkernel/BKE_gpencil_geom.h3
-rw-r--r--source/blender/blenkernel/BKE_image.h2
-rw-r--r--source/blender/blenkernel/intern/gpencil_geom.cc255
-rw-r--r--source/blender/blenkernel/intern/image.c87
-rw-r--r--source/blender/blenkernel/intern/image_gpu.c3
-rw-r--r--source/blender/blenkernel/intern/image_save.c18
-rw-r--r--source/blender/draw/engines/overlay/overlay_engine.c28
-rw-r--r--source/blender/draw/engines/overlay/overlay_paint.c27
-rw-r--r--source/blender/draw/engines/overlay/overlay_private.h2
-rw-r--r--source/blender/draw/engines/overlay/overlay_shader.c13
-rw-r--r--source/blender/draw/engines/overlay/shaders/paint_weight_frag.glsl23
-rw-r--r--source/blender/draw/engines/overlay/shaders/paint_weight_vert.glsl15
-rw-r--r--source/blender/draw/tests/shaders_test.cc3
-rw-r--r--source/blender/editors/gpencil/gpencil_mesh.c3
-rw-r--r--source/blender/editors/object/object_add.c3
-rw-r--r--source/blender/editors/space_image/image_ops.c32
-rw-r--r--source/blender/editors/space_image/image_sequence.c34
-rw-r--r--source/blender/editors/space_view3d/view3d_select.c6
-rw-r--r--source/blender/editors/transform/transform.h1
-rw-r--r--source/blender/editors/transform/transform_convert.h1
-rw-r--r--source/blender/editors/transform/transform_convert_graph.c11
-rw-r--r--source/blender/editors/transform/transform_convert_nla.c4
-rw-r--r--source/blender/editors/transform/transform_generics.c1
-rw-r--r--source/blender/editors/transform/transform_mode_align.c2
-rw-r--r--source/blender/editors/transform/transform_mode_baketime.c4
-rw-r--r--source/blender/editors/transform/transform_mode_bbone_resize.c4
-rw-r--r--source/blender/editors/transform/transform_mode_bend.c4
-rw-r--r--source/blender/editors/transform/transform_mode_boneenvelope.c4
-rw-r--r--source/blender/editors/transform/transform_mode_boneroll.c4
-rw-r--r--source/blender/editors/transform/transform_mode_curveshrinkfatten.c4
-rw-r--r--source/blender/editors/transform/transform_mode_edge_bevelweight.c4
-rw-r--r--source/blender/editors/transform/transform_mode_edge_crease.c4
-rw-r--r--source/blender/editors/transform/transform_mode_edge_rotate_normal.c3
-rw-r--r--source/blender/editors/transform/transform_mode_gpopacity.c4
-rw-r--r--source/blender/editors/transform/transform_mode_gpshrinkfatten.c4
-rw-r--r--source/blender/editors/transform/transform_mode_maskshrinkfatten.c4
-rw-r--r--source/blender/editors/transform/transform_mode_mirror.c2
-rw-r--r--source/blender/editors/transform/transform_mode_push_pull.c4
-rw-r--r--source/blender/editors/transform/transform_mode_rotate.c4
-rw-r--r--source/blender/editors/transform/transform_mode_shear.c4
-rw-r--r--source/blender/editors/transform/transform_mode_shrink_fatten.c4
-rw-r--r--source/blender/editors/transform/transform_mode_skin_resize.c4
-rw-r--r--source/blender/editors/transform/transform_mode_tilt.c4
-rw-r--r--source/blender/editors/transform/transform_mode_timescale.c1
-rw-r--r--source/blender/editors/transform/transform_mode_timeslide.c2
-rw-r--r--source/blender/editors/transform/transform_mode_timetranslate.c4
-rw-r--r--source/blender/editors/transform/transform_mode_tosphere.c4
-rw-r--r--source/blender/editors/transform/transform_mode_trackball.c4
-rw-r--r--source/blender/editors/util/CMakeLists.txt1
-rw-r--r--source/blender/gpencil_modifiers/intern/lineart/MOD_lineart.h2
-rw-r--r--source/blender/makesrna/RNA_enum_items.h240
-rw-r--r--source/blender/makesrna/RNA_enum_types.h214
-rw-r--r--source/blender/makesrna/intern/CMakeLists.txt1
-rw-r--r--source/blender/makesrna/intern/makesrna.c93
-rw-r--r--source/blender/makesrna/intern/rna_image.c9
-rw-r--r--source/blender/nodes/shader/nodes/node_shader_mixRgb.cc58
-rw-r--r--source/blender/sequencer/intern/strip_add.c2
m---------source/tools0
58 files changed, 782 insertions, 503 deletions
diff --git a/source/blender/blenkernel/BKE_gpencil_geom.h b/source/blender/blenkernel/BKE_gpencil_geom.h
index c1ccae7a437..29e3a74b1b2 100644
--- a/source/blender/blenkernel/BKE_gpencil_geom.h
+++ b/source/blender/blenkernel/BKE_gpencil_geom.h
@@ -169,7 +169,8 @@ bool BKE_gpencil_convert_mesh(struct Main *bmain,
const float matrix[4][4],
const int frame_offset,
const bool use_seams,
- const bool use_faces);
+ const bool use_faces,
+ const bool use_vgroups);
void BKE_gpencil_stroke_uniform_subdivide(struct bGPdata *gpd,
struct bGPDstroke *gps,
diff --git a/source/blender/blenkernel/BKE_image.h b/source/blender/blenkernel/BKE_image.h
index ac73bd2b595..3cab1a6b755 100644
--- a/source/blender/blenkernel/BKE_image.h
+++ b/source/blender/blenkernel/BKE_image.h
@@ -308,6 +308,8 @@ void BKE_image_get_tile_label(struct Image *ima,
struct ImageTile *BKE_image_add_tile(struct Image *ima, int tile_number, const char *label);
bool BKE_image_remove_tile(struct Image *ima, struct ImageTile *tile);
+void BKE_image_reassign_tile(struct Image *ima, struct ImageTile *tile, int new_tile_number);
+void BKE_image_sort_tiles(struct Image *ima);
bool BKE_image_fill_tile(struct Image *ima,
struct ImageTile *tile,
diff --git a/source/blender/blenkernel/intern/gpencil_geom.cc b/source/blender/blenkernel/intern/gpencil_geom.cc
index f8a07939096..0f218d6166c 100644
--- a/source/blender/blenkernel/intern/gpencil_geom.cc
+++ b/source/blender/blenkernel/intern/gpencil_geom.cc
@@ -31,6 +31,7 @@
#include "MEM_guardedalloc.h"
+#include "BLI_array_utils.h"
#include "BLI_blenlib.h"
#include "BLI_float3.hh"
#include "BLI_ghash.h"
@@ -2269,7 +2270,8 @@ static void gpencil_generate_edgeloops(Object *ob,
const int thickness,
const float offset,
const float matrix[4][4],
- const bool use_seams)
+ const bool use_seams,
+ const bool use_vgroups)
{
Mesh *me = (Mesh *)ob->data;
if (me->totedge == 0) {
@@ -2278,9 +2280,9 @@ static void gpencil_generate_edgeloops(Object *ob,
/* Arrays for all edge vertices (forward and backward) that form a edge loop.
* This is reused for each edge-loop to create gpencil stroke. */
- uint *stroke = (uint *)MEM_callocN(sizeof(uint) * me->totedge * 2, __func__);
- uint *stroke_fw = (uint *)MEM_callocN(sizeof(uint) * me->totedge, __func__);
- uint *stroke_bw = (uint *)MEM_callocN(sizeof(uint) * me->totedge, __func__);
+ uint *stroke = (uint *)MEM_mallocN(sizeof(uint) * me->totedge * 2, __func__);
+ uint *stroke_fw = (uint *)MEM_mallocN(sizeof(uint) * me->totedge, __func__);
+ uint *stroke_bw = (uint *)MEM_mallocN(sizeof(uint) * me->totedge, __func__);
/* Create array with all edges. */
GpEdge *gp_edges = (GpEdge *)MEM_callocN(sizeof(GpEdge) * me->totedge, __func__);
@@ -2311,11 +2313,6 @@ static void gpencil_generate_edgeloops(Object *ob,
bool pending = true;
int e = 0;
while (pending) {
- /* Clear arrays of stroke. */
- memset(stroke_fw, 0, sizeof(uint) * me->totedge);
- memset(stroke_bw, 0, sizeof(uint) * me->totedge);
- memset(stroke, 0, sizeof(uint) * me->totedge * 2);
-
gped = &gp_edges[e];
/* Look first unused edge. */
if (gped->flag != 0) {
@@ -2330,7 +2327,7 @@ static void gpencil_generate_edgeloops(Object *ob,
stroke_bw[0] = e;
gped->flag = 1;
- /* Hash used to avoid loop over same vertice. */
+ /* Hash used to avoid loop over same vertices. */
GHash *v_table = BLI_ghash_int_new(__func__);
/* Look forward edges. */
int totedges = gpencil_walk_edge(v_table, gp_edges, me->totedge, stroke_fw, e, angle, false);
@@ -2354,38 +2351,41 @@ static void gpencil_generate_edgeloops(Object *ob,
bGPDstroke *gps_stroke = BKE_gpencil_stroke_add(
gpf_stroke, MAX2(stroke_mat_index, 0), array_len + 1, thickness * thickness, false);
+ /* Create dvert data. */
+ MDeformVert *me_dvert = me->dvert;
+ if (use_vgroups && me_dvert) {
+ gps_stroke->dvert = (MDeformVert *)MEM_callocN(sizeof(MDeformVert) * (array_len + 1),
+ "gp_stroke_dverts");
+ }
+
/* Create first segment. */
float fpt[3];
- uint v = stroke[0];
- gped = &gp_edges[v];
- bGPDspoint *pt = &gps_stroke->points[0];
- mul_v3_v3fl(fpt, gped->n1, offset);
- add_v3_v3v3(&pt->x, gped->v1_co, fpt);
- mul_m4_v3(matrix, &pt->x);
-
- pt->pressure = 1.0f;
- pt->strength = 1.0f;
-
- pt = &gps_stroke->points[1];
- mul_v3_v3fl(fpt, gped->n2, offset);
- add_v3_v3v3(&pt->x, gped->v2_co, fpt);
- mul_m4_v3(matrix, &pt->x);
-
- pt->pressure = 1.0f;
- pt->strength = 1.0f;
-
- /* Add next segments. */
- for (int i = 1; i < array_len; i++) {
- v = stroke[i];
- gped = &gp_edges[v];
-
- pt = &gps_stroke->points[i + 1];
- mul_v3_v3fl(fpt, gped->n2, offset);
- add_v3_v3v3(&pt->x, gped->v2_co, fpt);
+ for (int i = 0; i < array_len + 1; i++) {
+ int vertex_index = i == 0 ? gp_edges[stroke[0]].v1 : gp_edges[stroke[i - 1]].v2;
+ MVert *mv = &me->mvert[vertex_index];
+
+ /* Add segment. */
+ bGPDspoint *pt = &gps_stroke->points[i];
+ normal_short_to_float_v3(fpt, mv->no);
+ mul_v3_v3fl(fpt, fpt, offset);
+ add_v3_v3v3(&pt->x, mv->co, fpt);
mul_m4_v3(matrix, &pt->x);
pt->pressure = 1.0f;
pt->strength = 1.0f;
+
+ /* Copy vertex groups from mesh. Assuming they already exist in the same order. */
+ if (use_vgroups && me_dvert) {
+ MDeformVert *dv = &gps_stroke->dvert[i];
+ MDeformVert *src_dv = &me_dvert[vertex_index];
+ dv->totweight = src_dv->totweight;
+ dv->dw = (MDeformWeight *)MEM_callocN(sizeof(MDeformWeight) * dv->totweight,
+ "gp_stroke_dverts_dw");
+ for (int j = 0; j < dv->totweight; j++) {
+ dv->dw[j].weight = src_dv->dw[j].weight;
+ dv->dw[j].def_nr = src_dv->dw[j].def_nr;
+ }
+ }
}
BKE_gpencil_stroke_geometry_update(gpd, gps_stroke);
@@ -2488,7 +2488,8 @@ bool BKE_gpencil_convert_mesh(Main *bmain,
const float matrix[4][4],
const int frame_offset,
const bool use_seams,
- const bool use_faces)
+ const bool use_faces,
+ const bool use_vgroups)
{
if (ELEM(nullptr, ob_gp, ob_mesh) || (ob_gp->type != OB_GPENCIL) || (ob_gp->data == nullptr)) {
return false;
@@ -2505,83 +2506,105 @@ bool BKE_gpencil_convert_mesh(Main *bmain,
char element_name[200];
/* Need at least an edge. */
- if (me_eval->totvert < 2) {
+ if (me_eval->totedge < 1) {
return false;
}
+ /* Create matching vertex groups. */
+ BKE_defgroup_copy_list(&gpd->vertex_group_names, &me_eval->vertex_group_names);
+ gpd->vertex_group_active_index = me_eval->vertex_group_active_index;
+
const float default_colors[2][4] = {{0.0f, 0.0f, 0.0f, 1.0f}, {0.7f, 0.7f, 0.7f, 1.0f}};
- /* Create stroke material. */
+ /* Lookup existing stroke material on gp object. */
make_element_name(ob_mesh->id.name + 2, "Stroke", 64, element_name);
int stroke_mat_index = gpencil_material_find_index_by_name(ob_gp, element_name);
if (stroke_mat_index == -1) {
+ /* Create new default stroke material as there is no existing material. */
gpencil_add_material(
bmain, ob_gp, element_name, default_colors[0], true, false, &stroke_mat_index);
}
/* Export faces as filled strokes. */
- if (use_faces) {
-
+ if (use_faces && mpoly_len > 0) {
/* Read all polygons and create fill for each. */
- if (mpoly_len > 0) {
- make_element_name(ob_mesh->id.name + 2, "Fills", 128, element_name);
- /* Create Layer and Frame. */
- bGPDlayer *gpl_fill = BKE_gpencil_layer_named_get(gpd, element_name);
- if (gpl_fill == nullptr) {
- gpl_fill = BKE_gpencil_layer_addnew(gpd, element_name, true, false);
- }
- bGPDframe *gpf_fill = BKE_gpencil_layer_frame_get(
- gpl_fill, CFRA + frame_offset, GP_GETFRAME_ADD_NEW);
- int i;
- for (i = 0; i < mpoly_len; i++) {
- const MPoly *mp = &mpoly[i];
-
- /* Find material. */
- int mat_idx = 0;
- Material *ma = BKE_object_material_get(ob_mesh, mp->mat_nr + 1);
- make_element_name(
- ob_mesh->id.name + 2, (ma != nullptr) ? ma->id.name + 2 : "Fill", 64, element_name);
- mat_idx = BKE_gpencil_material_find_index_by_name_prefix(ob_gp, element_name);
- if (mat_idx == -1) {
- float color[4];
- if (ma != nullptr) {
- copy_v3_v3(color, &ma->r);
- color[3] = 1.0f;
- }
- else {
- copy_v4_v4(color, default_colors[1]);
- }
- gpencil_add_material(bmain, ob_gp, element_name, color, false, true, &mat_idx);
+ make_element_name(ob_mesh->id.name + 2, "Fills", 128, element_name);
+ /* Create Layer and Frame. */
+ bGPDlayer *gpl_fill = BKE_gpencil_layer_named_get(gpd, element_name);
+ if (gpl_fill == nullptr) {
+ gpl_fill = BKE_gpencil_layer_addnew(gpd, element_name, true, false);
+ }
+ bGPDframe *gpf_fill = BKE_gpencil_layer_frame_get(
+ gpl_fill, CFRA + frame_offset, GP_GETFRAME_ADD_NEW);
+ int i;
+ for (i = 0; i < mpoly_len; i++) {
+ const MPoly *mp = &mpoly[i];
+
+ /* Find material. */
+ int mat_idx = 0;
+ Material *ma = BKE_object_material_get(ob_mesh, mp->mat_nr + 1);
+ make_element_name(
+ ob_mesh->id.name + 2, (ma != nullptr) ? ma->id.name + 2 : "Fill", 64, element_name);
+ mat_idx = BKE_gpencil_material_find_index_by_name_prefix(ob_gp, element_name);
+ if (mat_idx == -1) {
+ float color[4];
+ if (ma != nullptr) {
+ copy_v3_v3(color, &ma->r);
+ color[3] = 1.0f;
+ }
+ else {
+ copy_v4_v4(color, default_colors[1]);
}
+ gpencil_add_material(bmain, ob_gp, element_name, color, false, true, &mat_idx);
+ }
- bGPDstroke *gps_fill = BKE_gpencil_stroke_add(gpf_fill, mat_idx, mp->totloop, 10, false);
- gps_fill->flag |= GP_STROKE_CYCLIC;
+ bGPDstroke *gps_fill = BKE_gpencil_stroke_add(gpf_fill, mat_idx, mp->totloop, 10, false);
+ gps_fill->flag |= GP_STROKE_CYCLIC;
- /* Add points to strokes. */
- for (int j = 0; j < mp->totloop; j++) {
- const MLoop *ml = &mloop[mp->loopstart + j];
- const MVert *mv = &me_eval->mvert[ml->v];
+ /* Create dvert data. */
+ MDeformVert *me_dvert = me_eval->dvert;
+ if (use_vgroups && me_dvert) {
+ gps_fill->dvert = (MDeformVert *)MEM_callocN(sizeof(MDeformVert) * mp->totloop,
+ "gp_fill_dverts");
+ }
- bGPDspoint *pt = &gps_fill->points[j];
- copy_v3_v3(&pt->x, mv->co);
- mul_m4_v3(matrix, &pt->x);
- pt->pressure = 1.0f;
- pt->strength = 1.0f;
- }
- /* If has only 3 points subdivide. */
- if (mp->totloop == 3) {
- BKE_gpencil_stroke_subdivide(gpd, gps_fill, 1, GP_SUBDIV_SIMPLE);
+ /* Add points to strokes. */
+ for (int j = 0; j < mp->totloop; j++) {
+ const MLoop *ml = &mloop[mp->loopstart + j];
+ const MVert *mv = &me_eval->mvert[ml->v];
+
+ bGPDspoint *pt = &gps_fill->points[j];
+ copy_v3_v3(&pt->x, mv->co);
+ mul_m4_v3(matrix, &pt->x);
+ pt->pressure = 1.0f;
+ pt->strength = 1.0f;
+
+ /* Copy vertex groups from mesh. Assuming they already exist in the same order. */
+ if (use_vgroups && me_dvert) {
+ MDeformVert *dv = &gps_fill->dvert[j];
+ MDeformVert *src_dv = &me_dvert[ml->v];
+ dv->totweight = src_dv->totweight;
+ dv->dw = (MDeformWeight *)MEM_callocN(sizeof(MDeformWeight) * dv->totweight,
+ "gp_fill_dverts_dw");
+ for (int k = 0; k < dv->totweight; k++) {
+ dv->dw[k].weight = src_dv->dw[k].weight;
+ dv->dw[k].def_nr = src_dv->dw[k].def_nr;
+ }
}
-
- BKE_gpencil_stroke_geometry_update(gpd, gps_fill);
}
+ /* If has only 3 points subdivide. */
+ if (mp->totloop == 3) {
+ BKE_gpencil_stroke_subdivide(gpd, gps_fill, 1, GP_SUBDIV_SIMPLE);
+ }
+
+ BKE_gpencil_stroke_geometry_update(gpd, gps_fill);
}
}
/* Create stroke from edges. */
- make_element_name(ob_mesh->id.name + 2, "Lines", 128, element_name);
/* Create Layer and Frame. */
+ make_element_name(ob_mesh->id.name + 2, "Lines", 128, element_name);
bGPDlayer *gpl_stroke = BKE_gpencil_layer_named_get(gpd, element_name);
if (gpl_stroke == nullptr) {
gpl_stroke = BKE_gpencil_layer_addnew(gpd, element_name, true, false);
@@ -2589,8 +2612,16 @@ bool BKE_gpencil_convert_mesh(Main *bmain,
bGPDframe *gpf_stroke = BKE_gpencil_layer_frame_get(
gpl_stroke, CFRA + frame_offset, GP_GETFRAME_ADD_NEW);
- gpencil_generate_edgeloops(
- ob_eval, gpd, gpf_stroke, stroke_mat_index, angle, thickness, offset, matrix, use_seams);
+ gpencil_generate_edgeloops(ob_eval,
+ gpd,
+ gpf_stroke,
+ stroke_mat_index,
+ angle,
+ thickness,
+ offset,
+ matrix,
+ use_seams,
+ use_vgroups);
/* Tag for recalculation */
DEG_id_tag_update(&gpd->id, ID_RECALC_GEOMETRY | ID_RECALC_COPY_ON_WRITE);
@@ -2787,46 +2818,12 @@ void BKE_gpencil_stroke_set_random_color(bGPDstroke *gps)
/* Flip stroke. */
void BKE_gpencil_stroke_flip(bGPDstroke *gps)
{
- int end = gps->totpoints - 1;
+ /* Reverse points. */
+ BLI_array_reverse(gps->points, gps->totpoints);
- for (int i = 0; i < gps->totpoints / 2; i++) {
- bGPDspoint *point, *point2;
- bGPDspoint pt;
-
- /* save first point */
- point = &gps->points[i];
- pt.x = point->x;
- pt.y = point->y;
- pt.z = point->z;
- pt.flag = point->flag;
- pt.pressure = point->pressure;
- pt.strength = point->strength;
- pt.time = point->time;
- copy_v4_v4(pt.vert_color, point->vert_color);
-
- /* replace first point with last point */
- point2 = &gps->points[end];
- point->x = point2->x;
- point->y = point2->y;
- point->z = point2->z;
- point->flag = point2->flag;
- point->pressure = point2->pressure;
- point->strength = point2->strength;
- point->time = point2->time;
- copy_v4_v4(point->vert_color, point2->vert_color);
-
- /* replace last point with first saved before */
- point = &gps->points[end];
- point->x = pt.x;
- point->y = pt.y;
- point->z = pt.z;
- point->flag = pt.flag;
- point->pressure = pt.pressure;
- point->strength = pt.strength;
- point->time = pt.time;
- copy_v4_v4(point->vert_color, pt.vert_color);
-
- end--;
+ /* Reverse vertex groups if available. */
+ if (gps->dvert) {
+ BLI_array_reverse(gps->dvert, gps->totpoints);
}
}
diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c
index ba54858ba84..d2ab54de697 100644
--- a/source/blender/blenkernel/intern/image.c
+++ b/source/blender/blenkernel/intern/image.c
@@ -670,24 +670,27 @@ bool BKE_image_has_opengl_texture(Image *ima)
return false;
}
+static int image_get_tile_number_from_iuser(Image *ima, const ImageUser *iuser)
+{
+ BLI_assert(ima != NULL && ima->tiles.first);
+ ImageTile *tile = ima->tiles.first;
+ return (iuser && iuser->tile) ? iuser->tile : tile->tile_number;
+}
+
ImageTile *BKE_image_get_tile(Image *ima, int tile_number)
{
if (ima == NULL) {
return NULL;
}
- /* Verify valid tile range. */
- if ((tile_number != 0) && (tile_number < 1001 || tile_number > IMA_UDIM_MAX)) {
- return NULL;
- }
-
- /* Tile number 0 is a special case and refers to the first tile, typically
+ /* Tiles 0 and 1001 are a special case and refer to the first tile, typically
* coming from non-UDIM-aware code. */
if (ELEM(tile_number, 0, 1001)) {
return ima->tiles.first;
}
- if (ima->source != IMA_SRC_TILED) {
+ /* Must have a tiled image and a valid tile number at this point. */
+ if (ima->source != IMA_SRC_TILED || tile_number < 1001 || tile_number > IMA_UDIM_MAX) {
return NULL;
}
@@ -702,7 +705,7 @@ ImageTile *BKE_image_get_tile(Image *ima, int tile_number)
ImageTile *BKE_image_get_tile_from_iuser(Image *ima, const ImageUser *iuser)
{
- return BKE_image_get_tile(ima, (iuser && iuser->tile) ? iuser->tile : 1001);
+ return BKE_image_get_tile(ima, image_get_tile_number_from_iuser(ima, iuser));
}
int BKE_image_get_tile_from_pos(struct Image *ima,
@@ -3803,8 +3806,8 @@ bool BKE_image_remove_tile(struct Image *ima, ImageTile *tile)
return false;
}
- if (tile == ima->tiles.first) {
- /* Can't remove first tile. */
+ if (BLI_listbase_is_single(&ima->tiles)) {
+ /* Can't remove the last remaining tile. */
return false;
}
@@ -3815,6 +3818,64 @@ bool BKE_image_remove_tile(struct Image *ima, ImageTile *tile)
return true;
}
+void BKE_image_reassign_tile(struct Image *ima, ImageTile *tile, int new_tile_number)
+{
+ if (ima == NULL || tile == NULL || ima->source != IMA_SRC_TILED) {
+ return;
+ }
+
+ if (new_tile_number < 1001 || new_tile_number > IMA_UDIM_MAX) {
+ return;
+ }
+
+ const int old_tile_number = tile->tile_number;
+ tile->tile_number = new_tile_number;
+
+ if (BKE_image_is_multiview(ima)) {
+ const int totviews = BLI_listbase_count(&ima->views);
+ for (int i = 0; i < totviews; i++) {
+ ImBuf *ibuf = image_get_cached_ibuf_for_index_entry(ima, i, old_tile_number);
+ image_remove_ibuf(ima, i, old_tile_number);
+ image_assign_ibuf(ima, ibuf, i, new_tile_number);
+ IMB_freeImBuf(ibuf);
+ }
+ }
+ else {
+ ImBuf *ibuf = image_get_cached_ibuf_for_index_entry(ima, 0, old_tile_number);
+ image_remove_ibuf(ima, 0, old_tile_number);
+ image_assign_ibuf(ima, ibuf, 0, new_tile_number);
+ IMB_freeImBuf(ibuf);
+ }
+
+ for (int eye = 0; eye < 2; eye++) {
+ /* Reallocate GPU tile array. */
+ if (ima->gputexture[TEXTARGET_2D_ARRAY][eye] != NULL) {
+ GPU_texture_free(ima->gputexture[TEXTARGET_2D_ARRAY][eye]);
+ ima->gputexture[TEXTARGET_2D_ARRAY][eye] = NULL;
+ }
+ if (ima->gputexture[TEXTARGET_TILE_MAPPING][eye] != NULL) {
+ GPU_texture_free(ima->gputexture[TEXTARGET_TILE_MAPPING][eye]);
+ ima->gputexture[TEXTARGET_TILE_MAPPING][eye] = NULL;
+ }
+ }
+}
+
+static int tile_sort_cb(const void *a, const void *b)
+{
+ const ImageTile *tile_a = a;
+ const ImageTile *tile_b = b;
+ return (tile_a->tile_number > tile_b->tile_number) ? 1 : 0;
+}
+
+void BKE_image_sort_tiles(struct Image *ima)
+{
+ if (ima == NULL || ima->source != IMA_SRC_TILED) {
+ return;
+ }
+
+ BLI_listbase_sort(&ima->tiles, tile_sort_cb);
+}
+
bool BKE_image_fill_tile(struct Image *ima,
ImageTile *tile,
int width,
@@ -4890,7 +4951,7 @@ static void image_get_entry_and_index(Image *ima, ImageUser *iuser, int *r_entry
}
}
else if (ima->source == IMA_SRC_TILED) {
- frame = (iuser && iuser->tile) ? iuser->tile : 1001;
+ frame = image_get_tile_number_from_iuser(ima, iuser);
}
*r_entry = frame;
@@ -4955,7 +5016,7 @@ static ImBuf *image_get_cached_ibuf(Image *ima, ImageUser *iuser, int *r_entry,
}
else if (ima->source == IMA_SRC_TILED) {
if (ELEM(ima->type, IMA_TYPE_IMAGE, IMA_TYPE_MULTILAYER)) {
- entry = (iuser && iuser->tile) ? iuser->tile : 1001;
+ entry = image_get_tile_number_from_iuser(ima, iuser);
ibuf = image_get_cached_ibuf_for_index_entry(ima, index, entry);
if ((ima->type == IMA_TYPE_IMAGE) && ibuf != NULL) {
@@ -5507,7 +5568,7 @@ void BKE_image_user_file_path(ImageUser *iuser, Image *ima, char *filepath)
index = iuser ? iuser->framenr : ima->lastframe;
}
else {
- index = (iuser && iuser->tile) ? iuser->tile : 1001;
+ index = image_get_tile_number_from_iuser(ima, iuser);
}
BLI_path_sequence_decode(filepath, head, tail, &numlen);
diff --git a/source/blender/blenkernel/intern/image_gpu.c b/source/blender/blenkernel/intern/image_gpu.c
index bb7495437bb..d179dd40c33 100644
--- a/source/blender/blenkernel/intern/image_gpu.c
+++ b/source/blender/blenkernel/intern/image_gpu.c
@@ -108,8 +108,9 @@ static GPUTexture *gpu_texture_create_tile_mapping(Image *ima, const int multivi
float array_w = GPU_texture_width(tilearray);
float array_h = GPU_texture_height(tilearray);
+ /* Determine maximum tile number. */
+ BKE_image_sort_tiles(ima);
ImageTile *last_tile = (ImageTile *)ima->tiles.last;
- /* Tiles are sorted by number. */
int max_tile = last_tile->tile_number - 1001;
/* create image */
diff --git a/source/blender/blenkernel/intern/image_save.c b/source/blender/blenkernel/intern/image_save.c
index 360bad3e786..be86da05b57 100644
--- a/source/blender/blenkernel/intern/image_save.c
+++ b/source/blender/blenkernel/intern/image_save.c
@@ -404,11 +404,12 @@ bool BKE_image_save(
if (ima->source == IMA_SRC_TILED) {
/* Verify filepath for tiles images. */
- if (BLI_path_sequence_decode(opts->filepath, NULL, NULL, NULL) != 1001) {
+ ImageTile *first_tile = ima->tiles.first;
+ if (BLI_path_sequence_decode(opts->filepath, NULL, NULL, NULL) != first_tile->tile_number) {
BKE_reportf(reports,
RPT_ERROR,
- "When saving a tiled image, the path '%s' must contain the UDIM tag 1001",
- opts->filepath);
+ "When saving a tiled image, the path '%s' must contain the UDIM tile number %d",
+ opts->filepath, first_tile->tile_number);
return false;
}
@@ -430,9 +431,14 @@ bool BKE_image_save(
BLI_path_sequence_decode(filepath, head, tail, &numlen);
/* Save all other tiles. */
- LISTBASE_FOREACH (ImageTile *, tile, &ima->tiles) {
- /* Tile 1001 was already saved before the loop. */
- if (tile->tile_number == 1001 || !ok) {
+ int index;
+ LISTBASE_FOREACH_INDEX (ImageTile *, tile, &ima->tiles, index) {
+ /* First tile was already saved before the loop. */
+ if (index == 0) {
+ continue;
+ }
+
+ if (!ok) {
continue;
}
diff --git a/source/blender/draw/engines/overlay/overlay_engine.c b/source/blender/draw/engines/overlay/overlay_engine.c
index 235104245cc..b07e86000fd 100644
--- a/source/blender/draw/engines/overlay/overlay_engine.c
+++ b/source/blender/draw/engines/overlay/overlay_engine.c
@@ -576,9 +576,20 @@ static void OVERLAY_draw_scene(void *vedata)
OVERLAY_extra_blend_draw(vedata);
OVERLAY_volume_draw(vedata);
- if (pd->ctx_mode == CTX_MODE_SCULPT) {
- /* Sculpt overlays are drawn here to avoid artifacts with wireframe opacity. */
- OVERLAY_sculpt_draw(vedata);
+ /* These overlays are drawn here to avoid artifacts with wireframe opacity. */
+ switch (pd->ctx_mode) {
+ case CTX_MODE_SCULPT:
+ OVERLAY_sculpt_draw(vedata);
+ break;
+ case CTX_MODE_EDIT_MESH:
+ case CTX_MODE_POSE:
+ case CTX_MODE_PAINT_WEIGHT:
+ case CTX_MODE_PAINT_VERTEX:
+ case CTX_MODE_PAINT_TEXTURE:
+ OVERLAY_paint_draw(vedata);
+ break;
+ default:
+ break;
}
if (DRW_state_is_fbo()) {
@@ -601,11 +612,6 @@ static void OVERLAY_draw_scene(void *vedata)
OVERLAY_xray_depth_infront_copy(vedata);
- if (pd->ctx_mode == CTX_MODE_PAINT_WEIGHT) {
- /* Fix weird case where weightpaint mode needs to draw before xray bones. */
- OVERLAY_paint_draw(vedata);
- }
-
if (DRW_state_is_fbo()) {
GPU_framebuffer_bind(fbl->overlay_in_front_fb);
}
@@ -640,7 +646,6 @@ static void OVERLAY_draw_scene(void *vedata)
switch (pd->ctx_mode) {
case CTX_MODE_EDIT_MESH:
- OVERLAY_paint_draw(vedata);
OVERLAY_edit_mesh_draw(vedata);
break;
case CTX_MODE_EDIT_SURFACE:
@@ -654,13 +659,8 @@ static void OVERLAY_draw_scene(void *vedata)
OVERLAY_edit_lattice_draw(vedata);
break;
case CTX_MODE_POSE:
- OVERLAY_paint_draw(vedata);
OVERLAY_pose_draw(vedata);
break;
- case CTX_MODE_PAINT_VERTEX:
- case CTX_MODE_PAINT_TEXTURE:
- OVERLAY_paint_draw(vedata);
- break;
case CTX_MODE_PARTICLE:
OVERLAY_edit_particle_draw(vedata);
break;
diff --git a/source/blender/draw/engines/overlay/overlay_paint.c b/source/blender/draw/engines/overlay/overlay_paint.c
index d52640ed174..60a90616d29 100644
--- a/source/blender/draw/engines/overlay/overlay_paint.c
+++ b/source/blender/draw/engines/overlay/overlay_paint.c
@@ -92,18 +92,26 @@ void OVERLAY_paint_cache_init(OVERLAY_Data *vedata)
case CTX_MODE_PAINT_WEIGHT: {
opacity = is_edit_mode ? 1.0 : pd->overlay.weight_paint_mode_opacity;
if (opacity > 0.0f) {
- state = DRW_STATE_WRITE_COLOR | DRW_STATE_DEPTH_EQUAL;
- state |= pd->painting.alpha_blending ? DRW_STATE_BLEND_ALPHA : DRW_STATE_BLEND_MUL;
+ state = DRW_STATE_WRITE_COLOR | DRW_STATE_DEPTH_EQUAL | DRW_STATE_BLEND_ALPHA;
DRW_PASS_CREATE(psl->paint_color_ps, state | pd->clipping_state);
- sh = OVERLAY_shader_paint_weight();
+ const bool do_shading = draw_ctx->v3d->shading.type != OB_WIRE;
+
+ sh = OVERLAY_shader_paint_weight(do_shading);
pd->paint_surf_grp = grp = DRW_shgroup_create(sh, psl->paint_color_ps);
DRW_shgroup_uniform_block(grp, "globalsBlock", G_draw.block_ubo);
DRW_shgroup_uniform_bool_copy(grp, "drawContours", draw_contours);
- DRW_shgroup_uniform_bool_copy(grp, "useAlphaBlend", pd->painting.alpha_blending);
DRW_shgroup_uniform_float_copy(grp, "opacity", opacity);
DRW_shgroup_uniform_texture(grp, "colorramp", G_draw.weight_ramp);
+ /* Arbitrary light to give a hint of the geometry behind the weights. */
+ if (do_shading) {
+ float light_dir[3];
+ copy_v3_fl3(light_dir, 0.0f, 0.5f, 0.86602f);
+ normalize_v3(light_dir);
+ DRW_shgroup_uniform_vec3_copy(grp, "light_dir", light_dir);
+ }
+
if (pd->painting.alpha_blending) {
state = DRW_STATE_WRITE_DEPTH | DRW_STATE_DEPTH_LESS_EQUAL;
DRW_PASS_CREATE(psl->paint_depth_ps, state | pd->clipping_state);
@@ -257,17 +265,10 @@ void OVERLAY_paint_draw(OVERLAY_Data *vedata)
OVERLAY_PassList *psl = vedata->psl;
OVERLAY_FramebufferList *fbl = vedata->fbl;
- DefaultFramebufferList *dfbl = DRW_viewport_framebuffer_list_get();
if (DRW_state_is_fbo()) {
- if (pd->painting.alpha_blending) {
- GPU_framebuffer_bind(pd->painting.in_front ? fbl->overlay_in_front_fb :
- fbl->overlay_default_fb);
- }
- else {
- /* Paint overlay needs final color because of multiply blend mode. */
- GPU_framebuffer_bind(pd->painting.in_front ? dfbl->in_front_fb : dfbl->default_fb);
- }
+ GPU_framebuffer_bind(pd->painting.in_front ? fbl->overlay_in_front_fb :
+ fbl->overlay_default_fb);
}
if (psl->paint_depth_ps) {
diff --git a/source/blender/draw/engines/overlay/overlay_private.h b/source/blender/draw/engines/overlay/overlay_private.h
index 03bfaf56f24..68f60bee779 100644
--- a/source/blender/draw/engines/overlay/overlay_private.h
+++ b/source/blender/draw/engines/overlay/overlay_private.h
@@ -736,7 +736,7 @@ GPUShader *OVERLAY_shader_paint_face(void);
GPUShader *OVERLAY_shader_paint_point(void);
GPUShader *OVERLAY_shader_paint_texture(void);
GPUShader *OVERLAY_shader_paint_vertcol(void);
-GPUShader *OVERLAY_shader_paint_weight(void);
+GPUShader *OVERLAY_shader_paint_weight(bool shading);
GPUShader *OVERLAY_shader_paint_wire(void);
GPUShader *OVERLAY_shader_particle_dot(void);
GPUShader *OVERLAY_shader_particle_shape(void);
diff --git a/source/blender/draw/engines/overlay/overlay_shader.c b/source/blender/draw/engines/overlay/overlay_shader.c
index 7a7ae9a921b..edf9148c8c0 100644
--- a/source/blender/draw/engines/overlay/overlay_shader.c
+++ b/source/blender/draw/engines/overlay/overlay_shader.c
@@ -211,7 +211,7 @@ typedef struct OVERLAY_Shaders {
GPUShader *paint_point;
GPUShader *paint_texture;
GPUShader *paint_vertcol;
- GPUShader *paint_weight;
+ GPUShader *paint_weight[2];
GPUShader *paint_wire;
GPUShader *particle_dot;
GPUShader *particle_shape;
@@ -1334,13 +1334,14 @@ GPUShader *OVERLAY_shader_paint_vertcol(void)
return sh_data->paint_vertcol;
}
-GPUShader *OVERLAY_shader_paint_weight(void)
+GPUShader *OVERLAY_shader_paint_weight(const bool shading)
{
+ int index = shading ? 1 : 0;
const DRWContextState *draw_ctx = DRW_context_state_get();
const GPUShaderConfigData *sh_cfg = &GPU_shader_cfg_data[draw_ctx->sh_cfg];
OVERLAY_Shaders *sh_data = &e_data.sh_data[draw_ctx->sh_cfg];
- if (!sh_data->paint_weight) {
- sh_data->paint_weight = GPU_shader_create_from_arrays({
+ if (!sh_data->paint_weight[index]) {
+ sh_data->paint_weight[index] = GPU_shader_create_from_arrays({
.vert = (const char *[]){sh_cfg->lib,
datatoc_common_globals_lib_glsl,
datatoc_common_view_lib_glsl,
@@ -1349,10 +1350,10 @@ GPUShader *OVERLAY_shader_paint_weight(void)
.frag = (const char *[]){datatoc_common_globals_lib_glsl,
datatoc_paint_weight_frag_glsl,
NULL},
- .defs = (const char *[]){sh_cfg->def, NULL},
+ .defs = (const char *[]){sh_cfg->def, shading ? "#define FAKE_SHADING\n" : "", NULL},
});
}
- return sh_data->paint_weight;
+ return sh_data->paint_weight[index];
}
GPUShader *OVERLAY_shader_paint_wire(void)
diff --git a/source/blender/draw/engines/overlay/shaders/paint_weight_frag.glsl b/source/blender/draw/engines/overlay/shaders/paint_weight_frag.glsl
index 0020d76ed6a..8009713d655 100644
--- a/source/blender/draw/engines/overlay/shaders/paint_weight_frag.glsl
+++ b/source/blender/draw/engines/overlay/shaders/paint_weight_frag.glsl
@@ -1,12 +1,12 @@
in vec2 weight_interp; /* (weight, alert) */
+in float color_fac;
out vec4 fragColor;
uniform float opacity = 1.0;
uniform sampler1D colorramp;
-uniform bool useAlphaBlend = false;
uniform bool drawContours = false;
float contours(float value, float steps, float width_px, float max_rel_width, float gradient)
@@ -68,6 +68,13 @@ vec4 contour_grid(float weight, float weight_gradient)
return grid * clamp((weight_gradient - flt_eps) / flt_eps, 0.0, 1.0);
}
+vec4 apply_color_fac(vec4 color_in)
+{
+ vec4 color = color_in;
+ color.rgb = max(vec3(0.005), color_in.rgb) * color_fac;
+ return color;
+}
+
void main()
{
float alert = weight_interp.y;
@@ -75,12 +82,13 @@ void main()
/* Missing vertex group alert color. Uniform in practice. */
if (alert > 1.1) {
- color = colorVertexMissingData;
+ color = apply_color_fac(colorVertexMissingData);
}
/* Weights are available */
else {
float weight = weight_interp.x;
vec4 weight_color = texture(colorramp, weight, 0);
+ weight_color = apply_color_fac(weight_color);
/* Contour display */
if (drawContours) {
@@ -93,14 +101,9 @@ void main()
}
/* Zero weight alert color. Nonlinear blend to reduce impact. */
- color = mix(weight_color, colorVertexUnreferenced, alert * alert);
+ vec4 color_unreferenced = apply_color_fac(colorVertexUnreferenced);
+ color = mix(weight_color, color_unreferenced, alert * alert);
}
- if (useAlphaBlend) {
- fragColor = vec4(color.rgb, opacity);
- }
- else {
- /* mix with 1.0 -> is like opacity when using multiply blend mode */
- fragColor = vec4(mix(vec3(1.0), color.rgb, opacity), 1.0);
- }
+ fragColor = vec4(color.rgb, opacity);
}
diff --git a/source/blender/draw/engines/overlay/shaders/paint_weight_vert.glsl b/source/blender/draw/engines/overlay/shaders/paint_weight_vert.glsl
index b3baa8c7b07..31b6dc42cf4 100644
--- a/source/blender/draw/engines/overlay/shaders/paint_weight_vert.glsl
+++ b/source/blender/draw/engines/overlay/shaders/paint_weight_vert.glsl
@@ -1,8 +1,13 @@
+#ifdef FAKE_SHADING
+uniform vec3 light_dir;
+#endif
in float weight;
in vec3 pos;
+in vec3 nor;
out vec2 weight_interp; /* (weight, alert) */
+out float color_fac;
void main()
{
@@ -14,6 +19,16 @@ void main()
/* Separate actual weight and alerts for independent interpolation */
weight_interp = max(vec2(weight, -weight), 0.0);
+ /* Saturate the weight to give a hint of the geometry behind the weights. */
+#ifdef FAKE_SHADING
+ vec3 view_normal = normalize(normal_object_to_view(nor));
+ color_fac = abs(dot(view_normal, light_dir));
+ color_fac = color_fac * 0.9 + 0.1;
+
+#else
+ color_fac = 1.0;
+#endif
+
#ifdef USE_WORLD_CLIP_PLANES
world_clip_planes_calc_clip_distance(world_pos);
#endif
diff --git a/source/blender/draw/tests/shaders_test.cc b/source/blender/draw/tests/shaders_test.cc
index 0c7cbd4dac8..a9810b4cc77 100644
--- a/source/blender/draw/tests/shaders_test.cc
+++ b/source/blender/draw/tests/shaders_test.cc
@@ -267,7 +267,8 @@ static void test_overlay_glsl_shaders()
EXPECT_NE(OVERLAY_shader_paint_point(), nullptr);
EXPECT_NE(OVERLAY_shader_paint_texture(), nullptr);
EXPECT_NE(OVERLAY_shader_paint_vertcol(), nullptr);
- EXPECT_NE(OVERLAY_shader_paint_weight(), nullptr);
+ EXPECT_NE(OVERLAY_shader_paint_weight(false), nullptr);
+ EXPECT_NE(OVERLAY_shader_paint_weight(true), nullptr);
EXPECT_NE(OVERLAY_shader_paint_wire(), nullptr);
EXPECT_NE(OVERLAY_shader_particle_dot(), nullptr);
EXPECT_NE(OVERLAY_shader_particle_shape(), nullptr);
diff --git a/source/blender/editors/gpencil/gpencil_mesh.c b/source/blender/editors/gpencil/gpencil_mesh.c
index 1882285a230..0939d53736b 100644
--- a/source/blender/editors/gpencil/gpencil_mesh.c
+++ b/source/blender/editors/gpencil/gpencil_mesh.c
@@ -316,7 +316,8 @@ static int gpencil_bake_mesh_animation_exec(bContext *C, wmOperator *op)
ob_eval->obmat,
frame_offset,
use_seams,
- use_faces);
+ use_faces,
+ true);
/* Reproject all un-tagged created strokes. */
if (project_type != GP_REPROJECT_KEEP) {
diff --git a/source/blender/editors/object/object_add.c b/source/blender/editors/object/object_add.c
index f98f3242163..12b52907057 100644
--- a/source/blender/editors/object/object_add.c
+++ b/source/blender/editors/object/object_add.c
@@ -2844,7 +2844,8 @@ static int object_convert_exec(bContext *C, wmOperator *op)
matrix,
0,
use_seams,
- use_faces);
+ use_faces,
+ true);
/* Remove unused materials. */
int actcol = ob_gpencil->actcol;
diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c
index 999d2956fef..29c1452b988 100644
--- a/source/blender/editors/space_image/image_ops.c
+++ b/source/blender/editors/space_image/image_ops.c
@@ -1289,8 +1289,10 @@ static Image *image_open_single(Main *bmain,
}
if ((range->length > 1) && (ima->source == IMA_SRC_FILE)) {
- if (range->udim_tiles.first && range->offset == 1001) {
+ if (range->udim_tiles.first) {
ima->source = IMA_SRC_TILED;
+ ImageTile *first_tile = ima->tiles.first;
+ first_tile->tile_number = range->offset;
LISTBASE_FOREACH (LinkData *, node, &range->udim_tiles) {
BKE_image_add_tile(ima, POINTER_AS_INT(node->data), NULL);
}
@@ -1806,10 +1808,13 @@ static int image_save_options_init(Main *bmain,
}
/* append UDIM numbering if not present */
- if (ima->source == IMA_SRC_TILED &&
- (BLI_path_sequence_decode(ima->filepath, NULL, NULL, NULL) != 1001)) {
+ if (ima->source == IMA_SRC_TILED) {
+ char udim[6];
+ ImageTile *tile = ima->tiles.first;
+ BLI_snprintf(udim, sizeof(udim), ".%d", tile->tile_number);
+
int len = strlen(opts->filepath);
- STR_CONCAT(opts->filepath, len, ".1001");
+ STR_CONCAT(opts->filepath, len, udim);
}
}
@@ -3868,9 +3873,9 @@ static void tile_fill_init(PointerRNA *ptr, Image *ima, ImageTile *tile)
/* Acquire ibuf to get the default values.
* If the specified tile has no ibuf, try acquiring the main tile instead
- * (unless the specified tile already was the main tile). */
+ * (unless the specified tile already was the first tile). */
ImBuf *ibuf = BKE_image_acquire_ibuf(ima, &iuser, NULL);
- if (ibuf == NULL && (tile != NULL) && (tile->tile_number != 1001)) {
+ if (ibuf == NULL && (tile != NULL) && (tile != ima->tiles.first)) {
ibuf = BKE_image_acquire_ibuf(ima, NULL, NULL);
}
@@ -3932,27 +3937,30 @@ static int tile_add_exec(bContext *C, wmOperator *op)
bool fill_tile = RNA_boolean_get(op->ptr, "fill");
char *label = RNA_string_get_alloc(op->ptr, "label", NULL, 0);
- bool created_tile = false;
+ /* BKE_image_add_tile assumes a pre-sorted list of tiles. */
+ BKE_image_sort_tiles(ima);
+
+ ImageTile *last_tile_created = NULL;
for (int tile_number = start_tile; tile_number <= end_tile; tile_number++) {
ImageTile *tile = BKE_image_add_tile(ima, tile_number, label);
if (tile != NULL) {
- ima->active_tile_index = BLI_findindex(&ima->tiles, tile);
-
if (fill_tile) {
do_fill_tile(op->ptr, ima, tile);
}
- created_tile = true;
+ last_tile_created = tile;
}
}
MEM_freeN(label);
- if (!created_tile) {
+ if (!last_tile_created) {
BKE_report(op->reports, RPT_WARNING, "No UDIM tiles were created");
return OPERATOR_CANCELLED;
}
+ ima->active_tile_index = BLI_findindex(&ima->tiles, last_tile_created);
+
WM_event_add_notifier(C, NC_IMAGE | ND_DRAW, NULL);
return OPERATOR_FINISHED;
}
@@ -4041,7 +4049,7 @@ static bool tile_remove_poll(bContext *C)
{
Image *ima = CTX_data_edit_image(C);
- return (ima != NULL && ima->source == IMA_SRC_TILED && ima->active_tile_index != 0);
+ return (ima != NULL && ima->source == IMA_SRC_TILED && !BLI_listbase_is_single(&ima->tiles));
}
static int tile_remove_exec(bContext *C, wmOperator *UNUSED(op))
diff --git a/source/blender/editors/space_image/image_sequence.c b/source/blender/editors/space_image/image_sequence.c
index 02546e3e3b3..288b3d94b1d 100644
--- a/source/blender/editors/space_image/image_sequence.c
+++ b/source/blender/editors/space_image/image_sequence.c
@@ -124,7 +124,7 @@ static int image_cmp_frame(const void *a, const void *b)
*
* udim_tiles may get filled even if the result ultimately is false!
*/
-static int image_get_udim(char *filepath, ListBase *udim_tiles)
+static bool image_get_udim(char *filepath, ListBase *udim_tiles, int *udim_start, int *udim_range)
{
char filename[FILE_MAX], dirname[FILE_MAXDIR];
BLI_split_dirfile(filepath, dirname, filename, sizeof(dirname), sizeof(filename));
@@ -133,12 +133,12 @@ static int image_get_udim(char *filepath, ListBase *udim_tiles)
char base_head[FILE_MAX], base_tail[FILE_MAX];
int id = BLI_path_sequence_decode(filename, base_head, base_tail, &digits);
- if (id < 1001 || id >= IMA_UDIM_MAX) {
- return 0;
+ if (id < 1001 || id > IMA_UDIM_MAX) {
+ return false;
}
bool is_udim = true;
- bool has_primary = false;
+ int min_udim = IMA_UDIM_MAX + 1;
int max_udim = 0;
struct direntry *dir;
@@ -155,26 +155,27 @@ static int image_get_udim(char *filepath, ListBase *udim_tiles)
continue;
}
- if (id < 1001 || id >= IMA_UDIM_MAX) {
+ if (id < 1001 || id > IMA_UDIM_MAX) {
is_udim = false;
break;
}
- if (id == 1001) {
- has_primary = true;
- }
BLI_addtail(udim_tiles, BLI_genericNodeN(POINTER_FROM_INT(id)));
+ min_udim = min_ii(min_udim, id);
max_udim = max_ii(max_udim, id);
}
BLI_filelist_free(dir, totfile);
- if (is_udim && has_primary) {
+ if (is_udim && min_udim <= IMA_UDIM_MAX) {
char primary_filename[FILE_MAX];
- BLI_path_sequence_encode(primary_filename, base_head, base_tail, digits, 1001);
+ BLI_path_sequence_encode(primary_filename, base_head, base_tail, digits, min_udim);
BLI_join_dirfile(filepath, FILE_MAX, dirname, primary_filename);
- return max_udim - 1000;
+
+ *udim_start = min_udim;
+ *udim_range = max_udim - min_udim + 1;
+ return true;
}
- return 0;
+ return false;
}
/**
@@ -185,11 +186,12 @@ static void image_detect_frame_range(ImageFrameRange *range, const bool detect_u
{
/* UDIM */
if (detect_udim) {
- int len_udim = image_get_udim(range->filepath, &range->udim_tiles);
+ int udim_start, udim_range;
+ bool result = image_get_udim(range->filepath, &range->udim_tiles, &udim_start, &udim_range);
- if (len_udim > 0) {
- range->offset = 1001;
- range->length = len_udim;
+ if (result) {
+ range->offset = udim_start;
+ range->length = udim_range;
return;
}
}
diff --git a/source/blender/editors/space_view3d/view3d_select.c b/source/blender/editors/space_view3d/view3d_select.c
index 2ce5684e874..e3f97dd1c63 100644
--- a/source/blender/editors/space_view3d/view3d_select.c
+++ b/source/blender/editors/space_view3d/view3d_select.c
@@ -2521,6 +2521,7 @@ static bool ed_object_select_pick(bContext *C,
}
/* also prevent making it active on mouse selection */
else if (BASE_SELECTABLE(v3d, basact)) {
+ const bool use_activate_selected_base = (oldbasact != basact) && (is_obedit == false);
if (extend) {
ED_object_base_select(basact, BA_SELECT);
}
@@ -2529,7 +2530,8 @@ static bool ed_object_select_pick(bContext *C,
}
else if (toggle) {
if (basact->flag & BASE_SELECTED) {
- if (basact == oldbasact) {
+ /* Keep selected if the base is to be activated. */
+ if (use_activate_selected_base == false) {
ED_object_base_select(basact, BA_DESELECT);
}
}
@@ -2545,7 +2547,7 @@ static bool ed_object_select_pick(bContext *C,
}
}
- if ((oldbasact != basact) && (is_obedit == false)) {
+ if (use_activate_selected_base) {
ED_object_base_activate(C, basact); /* adds notifier */
if ((scene->toolsettings->object_flag & SCE_OBJECT_MODE_LOCK) == 0) {
WM_toolsystem_update_from_context_view3d(C);
diff --git a/source/blender/editors/transform/transform.h b/source/blender/editors/transform/transform.h
index 1fa123e8507..549ad770ac6 100644
--- a/source/blender/editors/transform/transform.h
+++ b/source/blender/editors/transform/transform.h
@@ -779,7 +779,6 @@ void drawLine(TransInfo *t, const float center[3], const float dir[3], char axis
void applyTransObjects(TransInfo *t);
void restoreTransObjects(TransInfo *t);
-void recalcData(TransInfo *t);
void calculateCenter2D(TransInfo *t);
void calculateCenterLocal(TransInfo *t, const float center_global[3]);
diff --git a/source/blender/editors/transform/transform_convert.h b/source/blender/editors/transform/transform_convert.h
index 971c23b8c69..55731bfa321 100644
--- a/source/blender/editors/transform/transform_convert.h
+++ b/source/blender/editors/transform/transform_convert.h
@@ -43,6 +43,7 @@ void sort_trans_data_dist(TransInfo *t);
void createTransData(struct bContext *C, TransInfo *t);
bool clipUVTransform(TransInfo *t, float vec[2], const bool resize);
void clipUVData(TransInfo *t);
+void recalcData(TransInfo *t);
/* transform_convert_mesh.c */
void transform_convert_mesh_customdatacorrect_init(TransInfo *t);
diff --git a/source/blender/editors/transform/transform_convert_graph.c b/source/blender/editors/transform/transform_convert_graph.c
index 111f81ff87b..a6cbbb299ac 100644
--- a/source/blender/editors/transform/transform_convert_graph.c
+++ b/source/blender/editors/transform/transform_convert_graph.c
@@ -41,6 +41,7 @@
#include "transform.h"
#include "transform_convert.h"
+#include "transform_mode.h"
typedef struct TransDataGraph {
float unit_scale;
@@ -656,7 +657,6 @@ static bool fcu_test_selected(FCurve *fcu)
*/
static void flushTransGraphData(TransInfo *t)
{
- SpaceGraph *sipo = (SpaceGraph *)t->area->spacedata.first;
TransData *td;
TransData2D *td2d;
TransDataGraph *tdg;
@@ -680,7 +680,8 @@ static void flushTransGraphData(TransInfo *t)
* - Don't do this when canceling, or else these changes won't go away.
*/
if ((t->state != TRANS_CANCEL) && (td->flag & TD_NOTIMESNAP) == 0) {
- switch (sipo->autosnap) {
+ const short autosnap = getAnimEdit_SnapMode(t);
+ switch (autosnap) {
case SACTSNAP_FRAME: /* snap to nearest frame */
td2d->loc[0] = floor((double)td2d->loc[0] + 0.5);
break;
@@ -714,9 +715,9 @@ static void flushTransGraphData(TransInfo *t)
*
* \note We don't do this when canceling transforms, or else these changes don't go away.
*/
- if ((t->state != TRANS_CANCEL) && (td->flag & TD_NOTIMESNAP) == 0 &&
- ELEM(sipo->autosnap, SACTSNAP_STEP, SACTSNAP_TSTEP)) {
- switch (sipo->autosnap) {
+ if ((t->state != TRANS_CANCEL) && (td->flag & TD_NOTIMESNAP) == 0) {
+ const short autosnap = getAnimEdit_SnapMode(t);
+ switch (autosnap) {
case SACTSNAP_STEP: /* frame step */
td2d->loc2d[0] = floor((double)td2d->loc[0] + 0.5);
td->loc[0] = floor((double)td->loc[0] + 0.5);
diff --git a/source/blender/editors/transform/transform_convert_nla.c b/source/blender/editors/transform/transform_convert_nla.c
index b55005673d9..f96f2e93bbc 100644
--- a/source/blender/editors/transform/transform_convert_nla.c
+++ b/source/blender/editors/transform/transform_convert_nla.c
@@ -42,6 +42,7 @@
#include "transform.h"
#include "transform_convert.h"
+#include "transform_mode.h"
/** Used for NLA transform (stored in #TransData.extra pointer). */
typedef struct TransDataNla {
@@ -411,7 +412,8 @@ void recalcData_nla(TransInfo *t)
* NOTE: only do this when transform is still running, or we can't restore
*/
if (t->state != TRANS_CANCEL) {
- switch (snla->autosnap) {
+ const short autosnap = getAnimEdit_SnapMode(t);
+ switch (autosnap) {
case SACTSNAP_FRAME: /* snap to nearest frame */
case SACTSNAP_STEP: /* frame step - this is basically the same,
* since we don't have any remapping going on */
diff --git a/source/blender/editors/transform/transform_generics.c b/source/blender/editors/transform/transform_generics.c
index be8e551a1e8..81fc1496b1a 100644
--- a/source/blender/editors/transform/transform_generics.c
+++ b/source/blender/editors/transform/transform_generics.c
@@ -60,6 +60,7 @@
#include "UI_view2d.h"
#include "transform.h"
+#include "transform_convert.h"
#include "transform_mode.h"
#include "transform_orientations.h"
#include "transform_snap.h"
diff --git a/source/blender/editors/transform/transform_mode_align.c b/source/blender/editors/transform/transform_mode_align.c
index 5bc2aa68443..1a1d84699f4 100644
--- a/source/blender/editors/transform/transform_mode_align.c
+++ b/source/blender/editors/transform/transform_mode_align.c
@@ -32,6 +32,8 @@
#include "BLT_translation.h"
#include "transform.h"
+#include "transform_convert.h"
+
#include "transform_mode.h"
/* -------------------------------------------------------------------- */
diff --git a/source/blender/editors/transform/transform_mode_baketime.c b/source/blender/editors/transform/transform_mode_baketime.c
index 5efed6920dc..653944b56a7 100644
--- a/source/blender/editors/transform/transform_mode_baketime.c
+++ b/source/blender/editors/transform/transform_mode_baketime.c
@@ -36,9 +36,11 @@
#include "BLT_translation.h"
#include "transform.h"
-#include "transform_mode.h"
+#include "transform_convert.h"
#include "transform_snap.h"
+#include "transform_mode.h"
+
/* -------------------------------------------------------------------- */
/** \name Transform (Bake-Time)
* \{ */
diff --git a/source/blender/editors/transform/transform_mode_bbone_resize.c b/source/blender/editors/transform/transform_mode_bbone_resize.c
index e827e604327..95e2d944b9b 100644
--- a/source/blender/editors/transform/transform_mode_bbone_resize.c
+++ b/source/blender/editors/transform/transform_mode_bbone_resize.c
@@ -37,9 +37,11 @@
#include "transform.h"
#include "transform_constraints.h"
-#include "transform_mode.h"
+#include "transform_convert.h"
#include "transform_snap.h"
+#include "transform_mode.h"
+
/* -------------------------------------------------------------------- */
/** \name Transform (EditBone B-Bone width scaling)
* \{ */
diff --git a/source/blender/editors/transform/transform_mode_bend.c b/source/blender/editors/transform/transform_mode_bend.c
index 850d26571cd..6d84c397fa6 100644
--- a/source/blender/editors/transform/transform_mode_bend.c
+++ b/source/blender/editors/transform/transform_mode_bend.c
@@ -44,9 +44,11 @@
#include "BLT_translation.h"
#include "transform.h"
-#include "transform_mode.h"
+#include "transform_convert.h"
#include "transform_snap.h"
+#include "transform_mode.h"
+
/* -------------------------------------------------------------------- */
/** \name Transform (Bend) Custom Data
* \{ */
diff --git a/source/blender/editors/transform/transform_mode_boneenvelope.c b/source/blender/editors/transform/transform_mode_boneenvelope.c
index ced159a76c9..da7393ab42e 100644
--- a/source/blender/editors/transform/transform_mode_boneenvelope.c
+++ b/source/blender/editors/transform/transform_mode_boneenvelope.c
@@ -36,9 +36,11 @@
#include "BLT_translation.h"
#include "transform.h"
-#include "transform_mode.h"
+#include "transform_convert.h"
#include "transform_snap.h"
+#include "transform_mode.h"
+
/* -------------------------------------------------------------------- */
/** \name Transform (Bone Envelope)
* \{ */
diff --git a/source/blender/editors/transform/transform_mode_boneroll.c b/source/blender/editors/transform/transform_mode_boneroll.c
index da6c0b44c3a..cd04ca2b844 100644
--- a/source/blender/editors/transform/transform_mode_boneroll.c
+++ b/source/blender/editors/transform/transform_mode_boneroll.c
@@ -36,9 +36,11 @@
#include "BLT_translation.h"
#include "transform.h"
-#include "transform_mode.h"
+#include "transform_convert.h"
#include "transform_snap.h"
+#include "transform_mode.h"
+
/* -------------------------------------------------------------------- */
/** \name Transform (EditBone Roll)
* \{ */
diff --git a/source/blender/editors/transform/transform_mode_curveshrinkfatten.c b/source/blender/editors/transform/transform_mode_curveshrinkfatten.c
index 68416c780ef..9433502ef55 100644
--- a/source/blender/editors/transform/transform_mode_curveshrinkfatten.c
+++ b/source/blender/editors/transform/transform_mode_curveshrinkfatten.c
@@ -36,9 +36,11 @@
#include "BLT_translation.h"
#include "transform.h"
-#include "transform_mode.h"
+#include "transform_convert.h"
#include "transform_snap.h"
+#include "transform_mode.h"
+
/* -------------------------------------------------------------------- */
/** \name Transform (Curve Shrink/Fatten)
* \{ */
diff --git a/source/blender/editors/transform/transform_mode_edge_bevelweight.c b/source/blender/editors/transform/transform_mode_edge_bevelweight.c
index 425bfec241e..5466ba3e91f 100644
--- a/source/blender/editors/transform/transform_mode_edge_bevelweight.c
+++ b/source/blender/editors/transform/transform_mode_edge_bevelweight.c
@@ -37,9 +37,11 @@
#include "BLT_translation.h"
#include "transform.h"
-#include "transform_mode.h"
+#include "transform_convert.h"
#include "transform_snap.h"
+#include "transform_mode.h"
+
/* -------------------------------------------------------------------- */
/** \name Transform (Bevel Weight) Element
* \{ */
diff --git a/source/blender/editors/transform/transform_mode_edge_crease.c b/source/blender/editors/transform/transform_mode_edge_crease.c
index 91e2507e544..1d3b4dbb4f0 100644
--- a/source/blender/editors/transform/transform_mode_edge_crease.c
+++ b/source/blender/editors/transform/transform_mode_edge_crease.c
@@ -37,9 +37,11 @@
#include "BLT_translation.h"
#include "transform.h"
-#include "transform_mode.h"
+#include "transform_convert.h"
#include "transform_snap.h"
+#include "transform_mode.h"
+
/* -------------------------------------------------------------------- */
/** \name Transform (Crease) Element
* \{ */
diff --git a/source/blender/editors/transform/transform_mode_edge_rotate_normal.c b/source/blender/editors/transform/transform_mode_edge_rotate_normal.c
index 6f2bcc148ce..1f57bacf78f 100644
--- a/source/blender/editors/transform/transform_mode_edge_rotate_normal.c
+++ b/source/blender/editors/transform/transform_mode_edge_rotate_normal.c
@@ -35,9 +35,10 @@
#include "UI_interface.h"
#include "transform.h"
-#include "transform_mode.h"
+#include "transform_convert.h"
#include "transform_snap.h"
+#include "transform_mode.h"
/* -------------------------------------------------------------------- */
/** \name Transform (Normal Rotation)
* \{ */
diff --git a/source/blender/editors/transform/transform_mode_gpopacity.c b/source/blender/editors/transform/transform_mode_gpopacity.c
index 7c496d271ef..748769491f1 100644
--- a/source/blender/editors/transform/transform_mode_gpopacity.c
+++ b/source/blender/editors/transform/transform_mode_gpopacity.c
@@ -38,9 +38,11 @@
#include "BLT_translation.h"
#include "transform.h"
-#include "transform_mode.h"
+#include "transform_convert.h"
#include "transform_snap.h"
+#include "transform_mode.h"
+
/* -------------------------------------------------------------------- */
/** \name Transform (GPencil Strokes Opacity)
* \{ */
diff --git a/source/blender/editors/transform/transform_mode_gpshrinkfatten.c b/source/blender/editors/transform/transform_mode_gpshrinkfatten.c
index 608a49f38b1..bc081edd597 100644
--- a/source/blender/editors/transform/transform_mode_gpshrinkfatten.c
+++ b/source/blender/editors/transform/transform_mode_gpshrinkfatten.c
@@ -38,9 +38,11 @@
#include "BLT_translation.h"
#include "transform.h"
-#include "transform_mode.h"
+#include "transform_convert.h"
#include "transform_snap.h"
+#include "transform_mode.h"
+
/* -------------------------------------------------------------------- */
/** \name Transform (GPencil Strokes Shrink/Fatten)
* \{ */
diff --git a/source/blender/editors/transform/transform_mode_maskshrinkfatten.c b/source/blender/editors/transform/transform_mode_maskshrinkfatten.c
index cfbd6030788..327a639773c 100644
--- a/source/blender/editors/transform/transform_mode_maskshrinkfatten.c
+++ b/source/blender/editors/transform/transform_mode_maskshrinkfatten.c
@@ -36,9 +36,11 @@
#include "BLT_translation.h"
#include "transform.h"
-#include "transform_mode.h"
+#include "transform_convert.h"
#include "transform_snap.h"
+#include "transform_mode.h"
+
/* -------------------------------------------------------------------- */
/** \name Transform (Mask Shrink/Fatten)
* \{ */
diff --git a/source/blender/editors/transform/transform_mode_mirror.c b/source/blender/editors/transform/transform_mode_mirror.c
index f225f1a7c06..2ae32f3545a 100644
--- a/source/blender/editors/transform/transform_mode_mirror.c
+++ b/source/blender/editors/transform/transform_mode_mirror.c
@@ -37,6 +37,8 @@
#include "BLT_translation.h"
#include "transform.h"
+#include "transform_convert.h"
+
#include "transform_mode.h"
/* -------------------------------------------------------------------- */
diff --git a/source/blender/editors/transform/transform_mode_push_pull.c b/source/blender/editors/transform/transform_mode_push_pull.c
index 0492ec8df8c..0527d1bc08e 100644
--- a/source/blender/editors/transform/transform_mode_push_pull.c
+++ b/source/blender/editors/transform/transform_mode_push_pull.c
@@ -38,9 +38,11 @@
#include "transform.h"
#include "transform_constraints.h"
-#include "transform_mode.h"
+#include "transform_convert.h"
#include "transform_snap.h"
+#include "transform_mode.h"
+
/* -------------------------------------------------------------------- */
/** \name Transform (Push/Pull) Element
* \{ */
diff --git a/source/blender/editors/transform/transform_mode_rotate.c b/source/blender/editors/transform/transform_mode_rotate.c
index 44a29cfac45..bfbdaa389f4 100644
--- a/source/blender/editors/transform/transform_mode_rotate.c
+++ b/source/blender/editors/transform/transform_mode_rotate.c
@@ -34,9 +34,11 @@
#include "UI_interface.h"
#include "transform.h"
-#include "transform_mode.h"
+#include "transform_convert.h"
#include "transform_snap.h"
+#include "transform_mode.h"
+
/* -------------------------------------------------------------------- */
/** \name Transform (Rotation) Matrix Cache
* \{ */
diff --git a/source/blender/editors/transform/transform_mode_shear.c b/source/blender/editors/transform/transform_mode_shear.c
index f5672887905..018725ec6dd 100644
--- a/source/blender/editors/transform/transform_mode_shear.c
+++ b/source/blender/editors/transform/transform_mode_shear.c
@@ -41,9 +41,11 @@
#include "BLT_translation.h"
#include "transform.h"
-#include "transform_mode.h"
+#include "transform_convert.h"
#include "transform_snap.h"
+#include "transform_mode.h"
+
/* -------------------------------------------------------------------- */
/** \name Transform (Shear) Element
* \{ */
diff --git a/source/blender/editors/transform/transform_mode_shrink_fatten.c b/source/blender/editors/transform/transform_mode_shrink_fatten.c
index 4cdaab599b4..b96b8103392 100644
--- a/source/blender/editors/transform/transform_mode_shrink_fatten.c
+++ b/source/blender/editors/transform/transform_mode_shrink_fatten.c
@@ -40,9 +40,11 @@
#include "BLT_translation.h"
#include "transform.h"
-#include "transform_mode.h"
+#include "transform_convert.h"
#include "transform_snap.h"
+#include "transform_mode.h"
+
/* -------------------------------------------------------------------- */
/** \name Transform (Shrink-Fatten) Element
* \{ */
diff --git a/source/blender/editors/transform/transform_mode_skin_resize.c b/source/blender/editors/transform/transform_mode_skin_resize.c
index 0a7eea8a989..236c9024201 100644
--- a/source/blender/editors/transform/transform_mode_skin_resize.c
+++ b/source/blender/editors/transform/transform_mode_skin_resize.c
@@ -35,9 +35,11 @@
#include "transform.h"
#include "transform_constraints.h"
-#include "transform_mode.h"
+#include "transform_convert.h"
#include "transform_snap.h"
+#include "transform_mode.h"
+
/* -------------------------------------------------------------------- */
/** \name Transform (Skin) Element
* \{ */
diff --git a/source/blender/editors/transform/transform_mode_tilt.c b/source/blender/editors/transform/transform_mode_tilt.c
index d3b72fdf503..b48f474e16e 100644
--- a/source/blender/editors/transform/transform_mode_tilt.c
+++ b/source/blender/editors/transform/transform_mode_tilt.c
@@ -36,9 +36,11 @@
#include "BLT_translation.h"
#include "transform.h"
-#include "transform_mode.h"
+#include "transform_convert.h"
#include "transform_snap.h"
+#include "transform_mode.h"
+
/* -------------------------------------------------------------------- */
/** \name Transform (Tilt)
* \{ */
diff --git a/source/blender/editors/transform/transform_mode_timescale.c b/source/blender/editors/transform/transform_mode_timescale.c
index 7ae97c66660..98ffc0abbd4 100644
--- a/source/blender/editors/transform/transform_mode_timescale.c
+++ b/source/blender/editors/transform/transform_mode_timescale.c
@@ -39,6 +39,7 @@
#include "BLT_translation.h"
#include "transform.h"
+#include "transform_convert.h"
#include "transform_mode.h"
/* -------------------------------------------------------------------- */
diff --git a/source/blender/editors/transform/transform_mode_timeslide.c b/source/blender/editors/transform/transform_mode_timeslide.c
index 34d3251f9cf..5cc53eb08ce 100644
--- a/source/blender/editors/transform/transform_mode_timeslide.c
+++ b/source/blender/editors/transform/transform_mode_timeslide.c
@@ -42,6 +42,8 @@
#include "BLT_translation.h"
#include "transform.h"
+#include "transform_convert.h"
+
#include "transform_mode.h"
/* -------------------------------------------------------------------- */
diff --git a/source/blender/editors/transform/transform_mode_timetranslate.c b/source/blender/editors/transform/transform_mode_timetranslate.c
index 948242e547f..01b9a08cf27 100644
--- a/source/blender/editors/transform/transform_mode_timetranslate.c
+++ b/source/blender/editors/transform/transform_mode_timetranslate.c
@@ -39,9 +39,11 @@
#include "BLT_translation.h"
#include "transform.h"
-#include "transform_mode.h"
+#include "transform_convert.h"
#include "transform_snap.h"
+#include "transform_mode.h"
+
/* -------------------------------------------------------------------- */
/** \name Transform (Animation Translation)
* \{ */
diff --git a/source/blender/editors/transform/transform_mode_tosphere.c b/source/blender/editors/transform/transform_mode_tosphere.c
index 8587d5ae140..bfc85b2fe44 100644
--- a/source/blender/editors/transform/transform_mode_tosphere.c
+++ b/source/blender/editors/transform/transform_mode_tosphere.c
@@ -39,9 +39,11 @@
#include "BLT_translation.h"
#include "transform.h"
-#include "transform_mode.h"
+#include "transform_convert.h"
#include "transform_snap.h"
+#include "transform_mode.h"
+
/* -------------------------------------------------------------------- */
/** \name To Sphere Utilities
* \{ */
diff --git a/source/blender/editors/transform/transform_mode_trackball.c b/source/blender/editors/transform/transform_mode_trackball.c
index 68177c6becf..aa8b0783d0a 100644
--- a/source/blender/editors/transform/transform_mode_trackball.c
+++ b/source/blender/editors/transform/transform_mode_trackball.c
@@ -37,9 +37,11 @@
#include "BLT_translation.h"
#include "transform.h"
-#include "transform_mode.h"
+#include "transform_convert.h"
#include "transform_snap.h"
+#include "transform_mode.h"
+
/* -------------------------------------------------------------------- */
/** \name Transform (Rotation - Trackball) Element
* \{ */
diff --git a/source/blender/editors/util/CMakeLists.txt b/source/blender/editors/util/CMakeLists.txt
index 54ec6b22e70..b396e348845 100644
--- a/source/blender/editors/util/CMakeLists.txt
+++ b/source/blender/editors/util/CMakeLists.txt
@@ -64,6 +64,7 @@ set(SRC
../include/ED_info.h
../include/ED_keyframes_draw.h
../include/ED_keyframes_edit.h
+ ../include/ED_keyframes_keylist.h
../include/ED_keyframing.h
../include/ED_lattice.h
../include/ED_markers.h
diff --git a/source/blender/gpencil_modifiers/intern/lineart/MOD_lineart.h b/source/blender/gpencil_modifiers/intern/lineart/MOD_lineart.h
index 9ac07b9632d..4b71011b99a 100644
--- a/source/blender/gpencil_modifiers/intern/lineart/MOD_lineart.h
+++ b/source/blender/gpencil_modifiers/intern/lineart/MOD_lineart.h
@@ -208,7 +208,7 @@ typedef struct LineartChainRegisterEntry {
enum eLineArtTileRecursiveLimit {
/* If tile gets this small, it's already much smaller than a pixel. No need to continue
* splitting. */
- LRT_TILE_RECURSIVE_PERSPECTIVE = 30,
+ LRT_TILE_RECURSIVE_PERSPECTIVE = 16,
/* This is a tried-and-true safe value for high poly models that also needed ortho rendering. */
LRT_TILE_RECURSIVE_ORTHO = 10,
};
diff --git a/source/blender/makesrna/RNA_enum_items.h b/source/blender/makesrna/RNA_enum_items.h
new file mode 100644
index 00000000000..c8f44262020
--- /dev/null
+++ b/source/blender/makesrna/RNA_enum_items.h
@@ -0,0 +1,240 @@
+/*
+ * This program is free software you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+/** \file
+ * \ingroup RNA
+ */
+
+/* NOTE: this is included multiple times with different #defines for DEF_ENUM. */
+
+/* use in cases where only dynamic types are used */
+DEF_ENUM(DummyRNA_NULL_items)
+DEF_ENUM(DummyRNA_DEFAULT_items)
+
+/* all others should follow 'rna_enum_*_items' naming */
+DEF_ENUM(rna_enum_id_type_items)
+
+DEF_ENUM(rna_enum_object_mode_items)
+DEF_ENUM(rna_enum_workspace_object_mode_items)
+DEF_ENUM(rna_enum_object_empty_drawtype_items)
+DEF_ENUM(rna_enum_object_gpencil_type_items)
+DEF_ENUM(rna_enum_metaelem_type_items)
+
+DEF_ENUM(rna_enum_proportional_falloff_items)
+DEF_ENUM(rna_enum_proportional_falloff_curve_only_items)
+DEF_ENUM(rna_enum_snap_target_items)
+DEF_ENUM(rna_enum_snap_element_items)
+DEF_ENUM(rna_enum_snap_node_element_items)
+DEF_ENUM(rna_enum_curve_fit_method_items)
+DEF_ENUM(rna_enum_mesh_select_mode_items)
+DEF_ENUM(rna_enum_mesh_select_mode_uv_items)
+DEF_ENUM(rna_enum_mesh_delimit_mode_items)
+DEF_ENUM(rna_enum_space_graph_mode_items)
+DEF_ENUM(rna_enum_space_file_browse_mode_items)
+DEF_ENUM(rna_enum_space_sequencer_view_type_items)
+DEF_ENUM(rna_enum_space_type_items)
+DEF_ENUM(rna_enum_space_image_mode_items)
+DEF_ENUM(rna_enum_space_image_mode_all_items)
+DEF_ENUM(rna_enum_space_action_mode_items)
+DEF_ENUM(rna_enum_fileselect_params_sort_items)
+DEF_ENUM(rna_enum_region_type_items)
+DEF_ENUM(rna_enum_object_modifier_type_items)
+DEF_ENUM(rna_enum_constraint_type_items)
+DEF_ENUM(rna_enum_boidrule_type_items)
+DEF_ENUM(rna_enum_sequence_modifier_type_items)
+DEF_ENUM(rna_enum_object_greasepencil_modifier_type_items)
+DEF_ENUM(rna_enum_object_shaderfx_type_items)
+
+DEF_ENUM(rna_enum_modifier_triangulate_quad_method_items)
+DEF_ENUM(rna_enum_modifier_triangulate_ngon_method_items)
+DEF_ENUM(rna_enum_modifier_shrinkwrap_mode_items)
+
+DEF_ENUM(rna_enum_image_type_items)
+DEF_ENUM(rna_enum_image_color_mode_items)
+DEF_ENUM(rna_enum_image_color_depth_items)
+DEF_ENUM(rna_enum_image_generated_type_items)
+
+DEF_ENUM(rna_enum_normal_space_items)
+DEF_ENUM(rna_enum_normal_swizzle_items)
+DEF_ENUM(rna_enum_bake_save_mode_items)
+DEF_ENUM(rna_enum_bake_target_items)
+
+DEF_ENUM(rna_enum_views_format_items)
+DEF_ENUM(rna_enum_views_format_multilayer_items)
+DEF_ENUM(rna_enum_views_format_multiview_items)
+DEF_ENUM(rna_enum_stereo3d_display_items)
+DEF_ENUM(rna_enum_stereo3d_anaglyph_type_items)
+DEF_ENUM(rna_enum_stereo3d_interlace_type_items)
+
+#ifdef WITH_OPENEXR
+DEF_ENUM(rna_enum_exr_codec_items)
+#endif
+DEF_ENUM(rna_enum_color_sets_items)
+
+DEF_ENUM(rna_enum_beztriple_keyframe_type_items)
+DEF_ENUM(rna_enum_beztriple_interpolation_mode_items)
+DEF_ENUM(rna_enum_beztriple_interpolation_easing_items)
+DEF_ENUM(rna_enum_fcurve_auto_smoothing_items)
+DEF_ENUM(rna_enum_keyframe_handle_type_items)
+DEF_ENUM(rna_enum_driver_target_rotation_mode_items)
+
+DEF_ENUM(rna_enum_keyingset_path_grouping_items)
+DEF_ENUM(rna_enum_keying_flag_items)
+DEF_ENUM(rna_enum_keying_flag_items_api)
+
+DEF_ENUM(rna_enum_fmodifier_type_items)
+
+DEF_ENUM(rna_enum_motionpath_bake_location_items)
+
+DEF_ENUM(rna_enum_event_value_all_items)
+DEF_ENUM(rna_enum_event_value_keymouse_items)
+DEF_ENUM(rna_enum_event_value_tweak_items)
+
+DEF_ENUM(rna_enum_event_type_items)
+DEF_ENUM(rna_enum_event_type_mask_items)
+
+DEF_ENUM(rna_enum_operator_type_flag_items)
+DEF_ENUM(rna_enum_operator_return_items)
+DEF_ENUM(rna_enum_operator_property_tags)
+
+DEF_ENUM(rna_enum_brush_sculpt_tool_items)
+DEF_ENUM(rna_enum_brush_uv_sculpt_tool_items)
+DEF_ENUM(rna_enum_brush_vertex_tool_items)
+DEF_ENUM(rna_enum_brush_weight_tool_items)
+DEF_ENUM(rna_enum_brush_gpencil_types_items)
+DEF_ENUM(rna_enum_brush_gpencil_vertex_types_items)
+DEF_ENUM(rna_enum_brush_gpencil_sculpt_types_items)
+DEF_ENUM(rna_enum_brush_gpencil_weight_types_items)
+DEF_ENUM(rna_enum_brush_image_tool_items)
+
+DEF_ENUM(rna_enum_axis_xy_items)
+DEF_ENUM(rna_enum_axis_xyz_items)
+
+DEF_ENUM(rna_enum_axis_flag_xyz_items)
+
+DEF_ENUM(rna_enum_symmetrize_direction_items)
+
+DEF_ENUM(rna_enum_texture_type_items)
+
+DEF_ENUM(rna_enum_light_type_items)
+
+DEF_ENUM(rna_enum_lightprobes_type_items)
+
+DEF_ENUM(rna_enum_unpack_method_items)
+
+DEF_ENUM(rna_enum_object_type_items)
+DEF_ENUM(rna_enum_object_rotation_mode_items)
+
+DEF_ENUM(rna_enum_object_type_curve_items)
+
+DEF_ENUM(rna_enum_rigidbody_object_type_items)
+DEF_ENUM(rna_enum_rigidbody_object_shape_items)
+DEF_ENUM(rna_enum_rigidbody_constraint_type_items)
+
+DEF_ENUM(rna_enum_object_axis_items)
+
+DEF_ENUM(rna_enum_render_pass_type_items)
+
+DEF_ENUM(rna_enum_bake_pass_type_items)
+DEF_ENUM(rna_enum_bake_pass_filter_type_items)
+
+DEF_ENUM(rna_enum_keymap_propvalue_items)
+
+DEF_ENUM(rna_enum_operator_context_items)
+
+DEF_ENUM(rna_enum_wm_report_items)
+
+DEF_ENUM(rna_enum_property_type_items)
+DEF_ENUM(rna_enum_property_subtype_items)
+DEF_ENUM(rna_enum_property_unit_items)
+
+DEF_ENUM(rna_enum_shading_type_items)
+
+DEF_ENUM(rna_enum_navigation_mode_items)
+
+DEF_ENUM(rna_enum_node_socket_in_out_items)
+
+DEF_ENUM(rna_enum_node_math_items)
+DEF_ENUM(rna_enum_mapping_type_items)
+DEF_ENUM(rna_enum_node_vec_math_items)
+DEF_ENUM(rna_enum_node_boolean_math_items)
+DEF_ENUM(rna_enum_node_float_compare_items)
+DEF_ENUM(rna_enum_node_filter_items)
+DEF_ENUM(rna_enum_node_float_to_int_items)
+DEF_ENUM(rna_enum_node_map_range_items)
+DEF_ENUM(rna_enum_node_clamp_items)
+
+DEF_ENUM(rna_enum_ramp_blend_items)
+
+DEF_ENUM(rna_enum_prop_dynamicpaint_type_items)
+
+DEF_ENUM(rna_enum_clip_editor_mode_items)
+
+DEF_ENUM(rna_enum_icon_items)
+DEF_ENUM(rna_enum_uilist_layout_type_items)
+
+DEF_ENUM(rna_enum_linestyle_color_modifier_type_items)
+DEF_ENUM(rna_enum_linestyle_alpha_modifier_type_items)
+DEF_ENUM(rna_enum_linestyle_thickness_modifier_type_items)
+DEF_ENUM(rna_enum_linestyle_geometry_modifier_type_items)
+
+DEF_ENUM(rna_enum_window_cursor_items)
+
+DEF_ENUM(rna_enum_dt_method_vertex_items)
+DEF_ENUM(rna_enum_dt_method_edge_items)
+DEF_ENUM(rna_enum_dt_method_loop_items)
+DEF_ENUM(rna_enum_dt_method_poly_items)
+DEF_ENUM(rna_enum_dt_mix_mode_items)
+DEF_ENUM(rna_enum_dt_layers_select_src_items)
+DEF_ENUM(rna_enum_dt_layers_select_dst_items)
+
+DEF_ENUM(rna_enum_context_mode_items)
+
+DEF_ENUM(rna_enum_preference_section_items)
+
+DEF_ENUM(rna_enum_attribute_type_items)
+DEF_ENUM(rna_enum_attribute_type_with_auto_items)
+DEF_ENUM(rna_enum_attribute_domain_items)
+DEF_ENUM(rna_enum_attribute_domain_with_auto_items)
+
+DEF_ENUM(rna_enum_collection_color_items)
+
+DEF_ENUM(rna_enum_subdivision_uv_smooth_items)
+DEF_ENUM(rna_enum_subdivision_boundary_smooth_items)
+
+DEF_ENUM(rna_enum_transform_orientation_items)
+
+/* Not available to RNA pre-processing (`makrsrna`).
+ * Defined in editors for example. */
+#ifndef RNA_MAKESRNA
+
+DEF_ENUM(rna_enum_particle_edit_hair_brush_items)
+DEF_ENUM(rna_enum_particle_edit_disconnected_hair_brush_items)
+
+DEF_ENUM(rna_enum_keyframe_paste_offset_items)
+DEF_ENUM(rna_enum_keyframe_paste_merge_items)
+
+DEF_ENUM(rna_enum_transform_pivot_items_full)
+DEF_ENUM(rna_enum_transform_mode_types)
+
+/* In the runtime part of RNA, could be removed from this section. */
+DEF_ENUM(rna_enum_nla_mode_extend_items)
+DEF_ENUM(rna_enum_nla_mode_blend_items)
+DEF_ENUM(rna_enum_keyblock_type_items)
+
+#endif
+
+#undef DEF_ENUM
diff --git a/source/blender/makesrna/RNA_enum_types.h b/source/blender/makesrna/RNA_enum_types.h
index 7e3f279b251..d7520834287 100644
--- a/source/blender/makesrna/RNA_enum_types.h
+++ b/source/blender/makesrna/RNA_enum_types.h
@@ -32,221 +32,11 @@ struct bNodeTreeType;
struct bNodeType;
/* Types */
+#define DEF_ENUM(id) extern const EnumPropertyItem id[];
+#include "RNA_enum_items.h"
-/* use in cases where only dynamic types are used */
-extern const EnumPropertyItem DummyRNA_NULL_items[];
-extern const EnumPropertyItem DummyRNA_DEFAULT_items[];
-
-/* all others should follow 'rna_enum_*_items' naming */
-extern const EnumPropertyItem rna_enum_id_type_items[];
-
-extern const EnumPropertyItem rna_enum_object_mode_items[];
-extern const EnumPropertyItem rna_enum_workspace_object_mode_items[];
-extern const EnumPropertyItem rna_enum_object_empty_drawtype_items[];
-extern const EnumPropertyItem rna_enum_object_gpencil_type_items[];
-extern const EnumPropertyItem rna_enum_metaelem_type_items[];
-
-extern const EnumPropertyItem rna_enum_proportional_falloff_items[];
-extern const EnumPropertyItem rna_enum_proportional_falloff_curve_only_items[];
-extern const EnumPropertyItem rna_enum_snap_target_items[];
-extern const EnumPropertyItem rna_enum_snap_element_items[];
-extern const EnumPropertyItem rna_enum_snap_node_element_items[];
-extern const EnumPropertyItem rna_enum_curve_fit_method_items[];
-extern const EnumPropertyItem rna_enum_mesh_select_mode_items[];
-extern const EnumPropertyItem rna_enum_mesh_select_mode_uv_items[];
-extern const EnumPropertyItem rna_enum_mesh_delimit_mode_items[];
-extern const EnumPropertyItem rna_enum_space_graph_mode_items[];
-extern const EnumPropertyItem rna_enum_space_file_browse_mode_items[];
-extern const EnumPropertyItem rna_enum_space_sequencer_view_type_items[];
-extern const EnumPropertyItem rna_enum_space_type_items[];
-extern const EnumPropertyItem rna_enum_space_image_mode_items[];
-extern const EnumPropertyItem rna_enum_space_image_mode_all_items[];
-extern const EnumPropertyItem rna_enum_space_action_mode_items[];
-extern const EnumPropertyItem rna_enum_fileselect_params_sort_items[];
-extern const EnumPropertyItem rna_enum_region_type_items[];
-extern const EnumPropertyItem rna_enum_object_modifier_type_items[];
-extern const EnumPropertyItem rna_enum_constraint_type_items[];
-extern const EnumPropertyItem rna_enum_boidrule_type_items[];
-extern const EnumPropertyItem rna_enum_sequence_modifier_type_items[];
-extern const EnumPropertyItem rna_enum_object_greasepencil_modifier_type_items[];
-extern const EnumPropertyItem rna_enum_object_shaderfx_type_items[];
-
-extern const EnumPropertyItem rna_enum_modifier_triangulate_quad_method_items[];
-extern const EnumPropertyItem rna_enum_modifier_triangulate_ngon_method_items[];
-extern const EnumPropertyItem rna_enum_modifier_shrinkwrap_mode_items[];
-
-extern const EnumPropertyItem rna_enum_image_type_items[];
-extern const EnumPropertyItem rna_enum_image_color_mode_items[];
-extern const EnumPropertyItem rna_enum_image_color_depth_items[];
-extern const EnumPropertyItem rna_enum_image_generated_type_items[];
-
-extern const EnumPropertyItem rna_enum_normal_space_items[];
-extern const EnumPropertyItem rna_enum_normal_swizzle_items[];
-extern const EnumPropertyItem rna_enum_bake_save_mode_items[];
-extern const EnumPropertyItem rna_enum_bake_target_items[];
-
-extern const EnumPropertyItem rna_enum_views_format_items[];
-extern const EnumPropertyItem rna_enum_views_format_multilayer_items[];
-extern const EnumPropertyItem rna_enum_views_format_multiview_items[];
-extern const EnumPropertyItem rna_enum_stereo3d_display_items[];
-extern const EnumPropertyItem rna_enum_stereo3d_anaglyph_type_items[];
-extern const EnumPropertyItem rna_enum_stereo3d_interlace_type_items[];
-
-extern const EnumPropertyItem rna_enum_exr_codec_items[];
-extern const EnumPropertyItem rna_enum_color_sets_items[];
-
-extern const EnumPropertyItem rna_enum_beztriple_keyframe_type_items[];
-extern const EnumPropertyItem rna_enum_beztriple_interpolation_mode_items[];
-extern const EnumPropertyItem rna_enum_beztriple_interpolation_easing_items[];
-extern const EnumPropertyItem rna_enum_fcurve_auto_smoothing_items[];
-extern const EnumPropertyItem rna_enum_keyframe_handle_type_items[];
-extern const EnumPropertyItem rna_enum_driver_target_rotation_mode_items[];
-
-extern const EnumPropertyItem rna_enum_keyblock_type_items[];
-
-extern const EnumPropertyItem rna_enum_keyingset_path_grouping_items[];
-extern const EnumPropertyItem rna_enum_keying_flag_items[];
-extern const EnumPropertyItem rna_enum_keying_flag_items_api[];
-
-extern const EnumPropertyItem rna_enum_keyframe_paste_offset_items[];
-extern const EnumPropertyItem rna_enum_keyframe_paste_merge_items[];
-
-extern const EnumPropertyItem rna_enum_fmodifier_type_items[];
-
-extern const EnumPropertyItem rna_enum_nla_mode_extend_items[];
-extern const EnumPropertyItem rna_enum_nla_mode_blend_items[];
-
-extern const EnumPropertyItem rna_enum_motionpath_bake_location_items[];
-
-extern const EnumPropertyItem rna_enum_event_value_all_items[];
-extern const EnumPropertyItem rna_enum_event_value_keymouse_items[];
-extern const EnumPropertyItem rna_enum_event_value_tweak_items[];
-
-extern const EnumPropertyItem rna_enum_event_type_items[];
-extern const EnumPropertyItem rna_enum_event_type_mask_items[];
-
-extern const EnumPropertyItem rna_enum_operator_type_flag_items[];
-extern const EnumPropertyItem rna_enum_operator_return_items[];
-extern const EnumPropertyItem rna_enum_operator_property_tags[];
-
-extern const EnumPropertyItem rna_enum_brush_sculpt_tool_items[];
-extern const EnumPropertyItem rna_enum_brush_uv_sculpt_tool_items[];
-extern const EnumPropertyItem rna_enum_brush_vertex_tool_items[];
-extern const EnumPropertyItem rna_enum_brush_weight_tool_items[];
-extern const EnumPropertyItem rna_enum_brush_gpencil_types_items[];
-extern const EnumPropertyItem rna_enum_brush_gpencil_vertex_types_items[];
-extern const EnumPropertyItem rna_enum_brush_gpencil_sculpt_types_items[];
-extern const EnumPropertyItem rna_enum_brush_gpencil_weight_types_items[];
-extern const EnumPropertyItem rna_enum_brush_image_tool_items[];
-
-extern const EnumPropertyItem rna_enum_particle_edit_hair_brush_items[];
-extern const EnumPropertyItem rna_enum_particle_edit_disconnected_hair_brush_items[];
-
-extern const EnumPropertyItem rna_enum_uv_sculpt_tool_items[];
-
-extern const EnumPropertyItem rna_enum_axis_xy_items[];
-extern const EnumPropertyItem rna_enum_axis_xyz_items[];
-
-extern const EnumPropertyItem rna_enum_axis_flag_xyz_items[];
-
-extern const EnumPropertyItem rna_enum_symmetrize_direction_items[];
-
-extern const EnumPropertyItem rna_enum_texture_type_items[];
-
-extern const EnumPropertyItem rna_enum_light_type_items[];
-
-extern const EnumPropertyItem rna_enum_lightprobes_type_items[];
-
-extern const EnumPropertyItem rna_enum_unpack_method_items[];
-
-extern const EnumPropertyItem rna_enum_object_type_items[];
-extern const EnumPropertyItem rna_enum_object_rotation_mode_items[];
-
-extern const EnumPropertyItem rna_enum_object_type_curve_items[];
-
-extern const EnumPropertyItem rna_enum_rigidbody_object_type_items[];
-extern const EnumPropertyItem rna_enum_rigidbody_object_shape_items[];
-extern const EnumPropertyItem rna_enum_rigidbody_constraint_type_items[];
-
-extern const EnumPropertyItem rna_enum_object_axis_items[];
-
-extern const EnumPropertyItem rna_enum_controller_type_items[];
-
-extern const EnumPropertyItem rna_enum_render_pass_type_items[];
-extern const EnumPropertyItem rna_enum_render_pass_debug_type_items[];
-
-extern const EnumPropertyItem rna_enum_bake_pass_type_items[];
-extern const EnumPropertyItem rna_enum_bake_pass_filter_type_items[];
-
-extern const EnumPropertyItem rna_enum_keymap_propvalue_items[];
-
-extern const EnumPropertyItem rna_enum_operator_context_items[];
-
-extern const EnumPropertyItem rna_enum_wm_report_items[];
-
-extern const EnumPropertyItem rna_enum_transform_pivot_items_full[];
-extern const EnumPropertyItem rna_enum_transform_orientation_items[];
-extern const EnumPropertyItem rna_enum_transform_mode_types[];
-
-extern const EnumPropertyItem rna_enum_property_type_items[];
-extern const EnumPropertyItem rna_enum_property_subtype_items[];
-extern const EnumPropertyItem rna_enum_property_unit_items[];
-
-extern const EnumPropertyItem rna_enum_shading_type_items[];
-
-extern const EnumPropertyItem rna_enum_navigation_mode_items[];
-
-extern const EnumPropertyItem rna_enum_node_socket_in_out_items[];
-
-extern const EnumPropertyItem rna_enum_node_math_items[];
-extern const EnumPropertyItem rna_enum_mapping_type_items[];
-extern const EnumPropertyItem rna_enum_node_vec_math_items[];
-extern const EnumPropertyItem rna_enum_node_boolean_math_items[];
-extern const EnumPropertyItem rna_enum_node_float_compare_items[];
-extern const EnumPropertyItem rna_enum_node_filter_items[];
-extern const EnumPropertyItem rna_enum_node_float_to_int_items[];
-extern const EnumPropertyItem rna_enum_node_map_range_items[];
-extern const EnumPropertyItem rna_enum_node_clamp_items[];
-
-extern const EnumPropertyItem rna_enum_ramp_blend_items[];
-
-extern const EnumPropertyItem rna_enum_prop_dynamicpaint_type_items[];
-
-extern const EnumPropertyItem rna_enum_clip_editor_mode_items[];
-
-extern const EnumPropertyItem rna_enum_icon_items[];
-extern const EnumPropertyItem rna_enum_uilist_layout_type_items[];
-
-extern const EnumPropertyItem rna_enum_linestyle_color_modifier_type_items[];
-extern const EnumPropertyItem rna_enum_linestyle_alpha_modifier_type_items[];
-extern const EnumPropertyItem rna_enum_linestyle_thickness_modifier_type_items[];
-extern const EnumPropertyItem rna_enum_linestyle_geometry_modifier_type_items[];
-
-extern const EnumPropertyItem rna_enum_window_cursor_items[];
-
-extern const EnumPropertyItem rna_enum_dt_method_vertex_items[];
-extern const EnumPropertyItem rna_enum_dt_method_edge_items[];
-extern const EnumPropertyItem rna_enum_dt_method_loop_items[];
-extern const EnumPropertyItem rna_enum_dt_method_poly_items[];
-extern const EnumPropertyItem rna_enum_dt_mix_mode_items[];
-extern const EnumPropertyItem rna_enum_dt_layers_select_src_items[];
-extern const EnumPropertyItem rna_enum_dt_layers_select_dst_items[];
-
-extern const EnumPropertyItem rna_enum_context_mode_items[];
-
-extern const EnumPropertyItem rna_enum_curveprofile_preset_items[];
-extern const EnumPropertyItem rna_enum_preference_section_items[];
-
-extern const EnumPropertyItem rna_enum_attribute_type_items[];
-extern const EnumPropertyItem rna_enum_attribute_type_with_auto_items[];
-extern const EnumPropertyItem rna_enum_attribute_domain_items[];
-extern const EnumPropertyItem rna_enum_attribute_domain_with_auto_items[];
extern const EnumPropertyItem *rna_enum_attribute_domain_itemf(struct ID *id, bool *r_free);
-extern const EnumPropertyItem rna_enum_collection_color_items[];
-
-extern const EnumPropertyItem rna_enum_subdivision_uv_smooth_items[];
-extern const EnumPropertyItem rna_enum_subdivision_boundary_smooth_items[];
/**
* For ID filters (#FILTER_ID_AC, #FILTER_ID_AR, ...) an int isn't enough. This version allows 64
* bit integers. So can't use the regular #EnumPropertyItem. Would be nice if RNA supported this
diff --git a/source/blender/makesrna/intern/CMakeLists.txt b/source/blender/makesrna/intern/CMakeLists.txt
index 95b7b7e5406..7e6d0aea2ee 100644
--- a/source/blender/makesrna/intern/CMakeLists.txt
+++ b/source/blender/makesrna/intern/CMakeLists.txt
@@ -175,6 +175,7 @@ set(SRC_RNA_INC
../RNA_access.h
../RNA_define.h
../RNA_documentation.h
+ ../RNA_enum_items.h
../RNA_enum_types.h
../RNA_types.h
)
diff --git a/source/blender/makesrna/intern/makesrna.c b/source/blender/makesrna/intern/makesrna.c
index 719b0f73a9d..36f19907080 100644
--- a/source/blender/makesrna/intern/makesrna.c
+++ b/source/blender/makesrna/intern/makesrna.c
@@ -582,6 +582,23 @@ static int rna_color_quantize(PropertyRNA *prop, PropertyDefRNA *dp)
(IS_DNATYPE_FLOAT_COMPAT(dp->dnatype) == 0));
}
+/**
+ * Return the identifier for an enum which is defined in "RNA_enum_items.h".
+ *
+ * Prevents expanding duplicate enums bloating the binary size.
+ */
+static const char *rna_enum_id_from_pointer(const EnumPropertyItem *item)
+{
+#define RNA_MAKESRNA
+#define DEF_ENUM(id) \
+ if (item == id) { \
+ return STRINGIFY(id); \
+ }
+#include "RNA_enum_items.h"
+#undef RNA_MAKESRNA
+ return NULL;
+}
+
static const char *rna_function_string(const void *func)
{
return (func) ? (const char *)func : "NULL";
@@ -3675,37 +3692,55 @@ static void rna_generate_property(FILE *f, StructRNA *srna, const char *nest, Pr
int i, defaultfound = 0, totflag = 0;
if (eprop->item) {
- fprintf(f,
- "static const EnumPropertyItem rna_%s%s_%s_items[%d] = {\n\t",
- srna->identifier,
- strnest,
- prop->identifier,
- eprop->totitem + 1);
-
- for (i = 0; i < eprop->totitem; i++) {
- fprintf(f, "{%d, ", eprop->item[i].value);
- rna_print_c_string(f, eprop->item[i].identifier);
- fprintf(f, ", ");
- fprintf(f, "%d, ", eprop->item[i].icon);
- rna_print_c_string(f, eprop->item[i].name);
- fprintf(f, ", ");
- rna_print_c_string(f, eprop->item[i].description);
- fprintf(f, "},\n\t");
-
- if (eprop->item[i].identifier[0]) {
- if (prop->flag & PROP_ENUM_FLAG) {
- totflag |= eprop->item[i].value;
+ /* Inline the enum if this is not a defined in "RNA_enum_items.h". */
+ const char *item_global_id = rna_enum_id_from_pointer(eprop->item);
+ if (item_global_id == NULL) {
+ fprintf(f,
+ "static const EnumPropertyItem rna_%s%s_%s_items[%d] = {\n\t",
+ srna->identifier,
+ strnest,
+ prop->identifier,
+ eprop->totitem + 1);
+
+ for (i = 0; i < eprop->totitem; i++) {
+ fprintf(f, "{%d, ", eprop->item[i].value);
+ rna_print_c_string(f, eprop->item[i].identifier);
+ fprintf(f, ", ");
+ fprintf(f, "%d, ", eprop->item[i].icon);
+ rna_print_c_string(f, eprop->item[i].name);
+ fprintf(f, ", ");
+ rna_print_c_string(f, eprop->item[i].description);
+ fprintf(f, "},\n\t");
+
+ if (eprop->item[i].identifier[0]) {
+ if (prop->flag & PROP_ENUM_FLAG) {
+ totflag |= eprop->item[i].value;
+ }
+ else {
+ if (eprop->defaultvalue == eprop->item[i].value) {
+ defaultfound = 1;
+ }
+ }
}
- else {
- if (eprop->defaultvalue == eprop->item[i].value) {
- defaultfound = 1;
+ }
+
+ fprintf(f, "{0, NULL, 0, NULL, NULL}\n};\n\n");
+ }
+ else {
+ for (i = 0; i < eprop->totitem; i++) {
+ if (eprop->item[i].identifier[0]) {
+ if (prop->flag & PROP_ENUM_FLAG) {
+ totflag |= eprop->item[i].value;
+ }
+ else {
+ if (eprop->defaultvalue == eprop->item[i].value) {
+ defaultfound = 1;
+ }
}
}
}
}
- fprintf(f, "{0, NULL, 0, NULL, NULL}\n};\n\n");
-
if (prop->flag & PROP_ENUM_FLAG) {
if (eprop->defaultvalue & ~totflag) {
CLOG_ERROR(&LOG,
@@ -4047,7 +4082,13 @@ static void rna_generate_property(FILE *f, StructRNA *srna, const char *nest, Pr
rna_function_string(eprop->get_ex),
rna_function_string(eprop->set_ex));
if (eprop->item) {
- fprintf(f, "rna_%s%s_%s_items, ", srna->identifier, strnest, prop->identifier);
+ const char *item_global_id = rna_enum_id_from_pointer(eprop->item);
+ if (item_global_id != NULL) {
+ fprintf(f, "%s, ", item_global_id);
+ }
+ else {
+ fprintf(f, "rna_%s%s_%s_items, ", srna->identifier, strnest, prop->identifier);
+ }
}
else {
fprintf(f, "NULL, ");
diff --git a/source/blender/makesrna/intern/rna_image.c b/source/blender/makesrna/intern/rna_image.c
index c058ab6cfcc..e44ddb07d53 100644
--- a/source/blender/makesrna/intern/rna_image.c
+++ b/source/blender/makesrna/intern/rna_image.c
@@ -290,15 +290,10 @@ static void rna_UDIMTile_tile_number_set(PointerRNA *ptr, int value)
ImageTile *tile = (ImageTile *)ptr->data;
Image *image = (Image *)ptr->owner_id;
- /* The index of the first tile can't be changed. */
- if (tile->tile_number == 1001) {
- return;
- }
-
/* Check that no other tile already has that number. */
ImageTile *cur_tile = BKE_image_get_tile(image, value);
- if (cur_tile == NULL || cur_tile == tile) {
- tile->tile_number = value;
+ if (cur_tile == NULL) {
+ BKE_image_reassign_tile(image, tile, value);
}
}
diff --git a/source/blender/nodes/shader/nodes/node_shader_mixRgb.cc b/source/blender/nodes/shader/nodes/node_shader_mixRgb.cc
index 6baaa17f956..47011caeeb6 100644
--- a/source/blender/nodes/shader/nodes/node_shader_mixRgb.cc
+++ b/source/blender/nodes/shader/nodes/node_shader_mixRgb.cc
@@ -127,15 +127,71 @@ static int gpu_shader_mix_rgb(GPUMaterial *mat,
return 0;
}
+class MixRGBFunction : public blender::fn::MultiFunction {
+ private:
+ bool clamp_;
+ int type_;
+
+ public:
+ MixRGBFunction(bool clamp, int type) : clamp_(clamp), type_(type)
+ {
+ static blender::fn::MFSignature signature = create_signature();
+ this->set_signature(&signature);
+ }
+
+ static blender::fn::MFSignature create_signature()
+ {
+ blender::fn::MFSignatureBuilder signature{"MixRGB"};
+ signature.single_input<float>("Fac");
+ signature.single_input<blender::ColorGeometry4f>("Color1");
+ signature.single_input<blender::ColorGeometry4f>("Color2");
+ signature.single_output<blender::ColorGeometry4f>("Color");
+ return signature.build();
+ }
+
+ void call(blender::IndexMask mask,
+ blender::fn::MFParams params,
+ blender::fn::MFContext UNUSED(context)) const override
+ {
+ const blender::VArray<float> &fac = params.readonly_single_input<float>(0, "Fac");
+ const blender::VArray<blender::ColorGeometry4f> &col1 =
+ params.readonly_single_input<blender::ColorGeometry4f>(1, "Color1");
+ const blender::VArray<blender::ColorGeometry4f> &col2 =
+ params.readonly_single_input<blender::ColorGeometry4f>(2, "Color2");
+ blender::MutableSpan<blender::ColorGeometry4f> results =
+ params.uninitialized_single_output<blender::ColorGeometry4f>(3, "Color");
+
+ for (int64_t i : mask) {
+ results[i] = col1[i];
+ ramp_blend(type_, results[i], clamp_f(fac[i], 0.0f, 1.0f), col2[i]);
+ }
+
+ if (clamp_) {
+ for (int64_t i : mask) {
+ clamp_v3(results[i], 0.0f, 1.0f);
+ }
+ }
+ }
+};
+
+static void sh_node_mix_rgb_expand_in_mf_network(blender::nodes::NodeMFNetworkBuilder &builder)
+{
+ bNode &node = builder.bnode();
+ bool clamp = node.custom2 & SHD_MIXRGB_CLAMP;
+ int mix_type = node.custom1;
+ builder.construct_and_set_matching_fn<MixRGBFunction>(clamp, mix_type);
+}
+
void register_node_type_sh_mix_rgb(void)
{
static bNodeType ntype;
- sh_node_type_base(&ntype, SH_NODE_MIX_RGB, "Mix", NODE_CLASS_OP_COLOR, 0);
+ sh_fn_node_type_base(&ntype, SH_NODE_MIX_RGB, "Mix", NODE_CLASS_OP_COLOR, 0);
node_type_socket_templates(&ntype, sh_node_mix_rgb_in, sh_node_mix_rgb_out);
node_type_label(&ntype, node_blend_label);
node_type_exec(&ntype, nullptr, nullptr, node_shader_exec_mix_rgb);
node_type_gpu(&ntype, gpu_shader_mix_rgb);
+ ntype.expand_in_mf_network = sh_node_mix_rgb_expand_in_mf_network;
nodeRegisterType(&ntype);
}
diff --git a/source/blender/sequencer/intern/strip_add.c b/source/blender/sequencer/intern/strip_add.c
index 7b383bcb330..9081c655d2f 100644
--- a/source/blender/sequencer/intern/strip_add.c
+++ b/source/blender/sequencer/intern/strip_add.c
@@ -99,7 +99,7 @@ void SEQ_add_load_data_init(SeqLoadData *load_data,
static void seq_add_generic_update(Scene *scene, ListBase *seqbase, Sequence *seq)
{
- SEQ_sequence_base_unique_name_recursive(scene, seqbase, seq);
+ SEQ_sequence_base_unique_name_recursive(scene, &scene->ed->seqbase, seq);
SEQ_time_update_sequence_bounds(scene, seq);
SEQ_sort(seqbase);
SEQ_relations_invalidate_cache_composite(scene, seq);
diff --git a/source/tools b/source/tools
-Subproject c8579c5cf43229843df505da9644b5b0b720197
+Subproject 5cf2fc3e5dc28025394b57d8743401295528f31