main sync #3

Merged
Patrick Busch merged 318 commits from blender/blender:main into main 2023-03-17 15:52:21 +01:00
13 changed files with 47 additions and 46 deletions
Showing only changes of commit 2a1a9307a7 - Show all commits

View File

@ -344,7 +344,7 @@ typedef enum eGP_GetFrame_Mode {
/**
* Get the appropriate gp-frame from a given layer
* - this sets the layer's actframe var (if allowed to)
* - this sets the layer's `actframe` var (if allowed to)
* - extension beyond range (if first gp-frame is after all frame in interest and cannot add)
*
* \param gpl: Grease pencil layer
@ -523,7 +523,7 @@ struct Material *BKE_gpencil_object_material_new(struct Main *bmain,
int *r_index);
/**
* Get material index (0-based like mat_nr not actcol).
* Get material index (0-based like mat_nr not #Object::actcol).
* \param ob: Grease pencil object
* \param ma: Material
* \return Index of the material

View File

@ -43,7 +43,7 @@ float3 poly_center_calc(Span<float3> vert_positions, Span<MLoop> poly_loops);
/** Calculate the surface area of the polygon described by the indexed vertices. */
float poly_area_calc(Span<float3> vert_positions, Span<MLoop> poly_loops);
/** Calculate the angles at each of the polygons's corners. */
/** Calculate the angles at each of the polygons corners. */
void poly_angles_calc(Span<float3> vert_positions,
Span<MLoop> poly_loops,
MutableSpan<float> angles);

View File

@ -45,7 +45,7 @@ void BKE_mesh_remap_item_define_invalid(MeshPairRemap *map, int index);
* https://blenderartists.org/t/619105
*
* We could also use similar topology mappings inside a same mesh
* (cf. Campbell's 'select face islands from similar topology' wip work).
* (cf. Campbell's 'select face islands from similar topology' WIP work).
* Also, users will have to check, whether we can get rid of some modes here,
* not sure all will be useful!
*/

View File

@ -1141,11 +1141,12 @@ static void collection_gobject_hash_ensure_fix(Collection *collection)
/**
* Update the collections object hash, removing `ob_old`, inserting `cob->ob` as the new key.
*
* \note This function is called fron foreach_id callback, and a difference of Object pointers is
* only expected in case ID remapping is happening. This code is the only are in Blender allowed to
* (temporarily) leave the CollectionObject list in an inconsistent/invalid state (with NULL object
* pointers, or duplicates of CollectionObjects). If such invalid cases are encountered, it will
* tag the collection objects list as dirty.
* \note This function is called from #IDTypeInfo::foreach_id callback,
* and a difference of Object pointers is only expected in case ID remapping is happening.
* This code is the only are in Blender allowed to (temporarily) leave the #CollectionObject list
* in an inconsistent/invalid state (with NULL object pointers, or duplicates of
* #CollectionObjects). If such invalid cases are encountered,
* it will tag the collection objects list as dirty.
*
* \param ob_old: The existing key to `cob` in the hash, not removed when NULL.
* \param cob: The `cob->ob` is to be used as the new key,
@ -1162,7 +1163,7 @@ static void collection_gobject_hash_update_object(Collection *collection,
if (ob_old) {
CollectionObject *cob_old = BLI_ghash_popkey(collection->runtime.gobject_hash, ob_old, NULL);
if (cob_old != cob) {
/* Old object alredy removed from the ghash. */
/* Old object already removed from the #GHash. */
collection->runtime.tag |= COLLECTION_TAG_COLLECTION_OBJECT_DIRTY;
}
}
@ -1173,28 +1174,28 @@ static void collection_gobject_hash_update_object(Collection *collection,
*cob_p = cob;
}
else {
/* Duplicate CollectionObject entries. */
/* Duplicate #CollectionObject entries. */
collection->runtime.tag |= COLLECTION_TAG_COLLECTION_OBJECT_DIRTY;
}
}
else {
/* CollectionObject with NULL objetc pointer. */
/* #CollectionObject with NULL object pointer. */
collection->runtime.tag |= COLLECTION_TAG_COLLECTION_OBJECT_DIRTY;
}
}
/**
* Validate the integrity of the collection's CollectionObject list, and of its mapping.
* Validate the integrity of the collection's #CollectionObject list, and of its mapping.
*
* Simple test is very fast, as it only checks that the 'dirty' tag for collection's objects is not
* set.
*
* The extensive check is expensive. This should not be done from within loops over collections
* items, or from low-level operations that can be assumed safe (like adding or removing an object
* from a colleciton). It ensures that:
* from a collection). It ensures that:
* - There is a `gobject_hash` mapping.
* - There is no NULL-object CollectionObject items.
* - there is no duplicate CollectionObject items (two or more referencing the same Object).
* - There is no NULL-object #CollectionObject items.
* - there is no duplicate #CollectionObject items (two or more referencing the same Object).
*/
static void collection_gobject_assert_internal_consistency(Collection *collection,
const bool do_extensive_check)
@ -1205,16 +1206,16 @@ static void collection_gobject_assert_internal_consistency(Collection *collectio
}
if (collection->runtime.gobject_hash == NULL) {
/* NOTE: If the ghash does not exist yet, it's creation will assert on errors, so in theory the
* second loop below could be skipped. */
/* NOTE: If the `ghash` does not exist yet, it's creation will assert on errors,
* so in theory the second loop below could be skipped. */
collection_gobject_hash_create(collection);
}
GHash *gobject_hash = collection->runtime.gobject_hash;
UNUSED_VARS_NDEBUG(gobject_hash);
LISTBASE_FOREACH (CollectionObject *, cob, &collection->gobject) {
BLI_assert(cob->ob != NULL);
/* If there are more than one CollectionObject for the same object, at most one of them will
* pass this test. */
/* If there are more than one #CollectionObject for the same object,
* at most one of them will pass this test. */
BLI_assert(BLI_ghash_lookup(gobject_hash, cob->ob) == cob);
}
}

View File

@ -422,7 +422,7 @@ TEST(BKE_fcurve, BKE_fcurve_calc_bounds)
/* All keys. */
success = BKE_fcurve_calc_bounds(
fcu, false /* sel only */, false /* include handles */, NULL /* frame range */, &bounds);
fcu, false /* select only */, false /* include handles */, NULL /* frame range */, &bounds);
EXPECT_TRUE(success) << "A non-empty FCurve should have bounds.";
EXPECT_FLOAT_EQ(fcu->bezt[0].vec[1][0], bounds.xmin);
EXPECT_FLOAT_EQ(fcu->bezt[4].vec[1][0], bounds.xmax);
@ -431,7 +431,7 @@ TEST(BKE_fcurve, BKE_fcurve_calc_bounds)
/* Only selected. */
success = BKE_fcurve_calc_bounds(
fcu, true /* sel only */, false /* include handles */, NULL /* frame range */, &bounds);
fcu, true /* select only */, false /* include handles */, NULL /* frame range */, &bounds);
EXPECT_FALSE(success)
<< "Using selected keyframes only should not find bounds if nothing is selected.";
@ -439,7 +439,7 @@ TEST(BKE_fcurve, BKE_fcurve_calc_bounds)
fcu->bezt[3].f2 |= SELECT;
success = BKE_fcurve_calc_bounds(
fcu, true /* sel only */, false /* include handles */, NULL /* frame range */, &bounds);
fcu, true /* select only */, false /* include handles */, NULL /* frame range */, &bounds);
EXPECT_TRUE(success) << "Selected keys should have been found.";
EXPECT_FLOAT_EQ(fcu->bezt[1].vec[1][0], bounds.xmin);
EXPECT_FLOAT_EQ(fcu->bezt[3].vec[1][0], bounds.xmax);
@ -448,7 +448,7 @@ TEST(BKE_fcurve, BKE_fcurve_calc_bounds)
/* Including handles. */
success = BKE_fcurve_calc_bounds(
fcu, false /* sel only */, true /* include handles */, NULL /* frame range */, &bounds);
fcu, false /* select only */, true /* include handles */, NULL /* frame range */, &bounds);
EXPECT_TRUE(success) << "A non-empty FCurve should have bounds including handles.";
EXPECT_FLOAT_EQ(fcu->bezt[0].vec[0][0], bounds.xmin);
EXPECT_FLOAT_EQ(fcu->bezt[4].vec[2][0], bounds.xmax);
@ -461,13 +461,13 @@ TEST(BKE_fcurve, BKE_fcurve_calc_bounds)
range[0] = 25;
range[1] = 30;
success = BKE_fcurve_calc_bounds(
fcu, false /* sel only */, false /* include handles */, range /* frame range */, &bounds);
fcu, false /* select only */, false /* include handles */, range /* frame range */, &bounds);
EXPECT_FALSE(success) << "A frame range outside the range of keyframes should not find bounds.";
range[0] = 0;
range[1] = 18.2f;
success = BKE_fcurve_calc_bounds(
fcu, false /* sel only */, false /* include handles */, range /* frame range */, &bounds);
fcu, false /* select only */, false /* include handles */, range /* frame range */, &bounds);
EXPECT_TRUE(success) << "A frame range within the range of keyframes should find bounds.";
EXPECT_FLOAT_EQ(fcu->bezt[0].vec[1][0], bounds.xmin);
EXPECT_FLOAT_EQ(fcu->bezt[3].vec[1][0], bounds.xmax);
@ -476,7 +476,7 @@ TEST(BKE_fcurve, BKE_fcurve_calc_bounds)
/* Range and handles. */
success = BKE_fcurve_calc_bounds(
fcu, false /* sel only */, true /* include handles */, range /* frame range */, &bounds);
fcu, false /* select only */, true /* include handles */, range /* frame range */, &bounds);
EXPECT_TRUE(success)
<< "A frame range within the range of keyframes should find bounds with handles.";
EXPECT_FLOAT_EQ(fcu->bezt[0].vec[0][0], bounds.xmin);
@ -488,7 +488,7 @@ TEST(BKE_fcurve, BKE_fcurve_calc_bounds)
range[0] = 8.0f;
range[1] = 18.2f;
success = BKE_fcurve_calc_bounds(
fcu, true /* sel only */, true /* include handles */, range /* frame range */, &bounds);
fcu, true /* select only */, true /* include handles */, range /* frame range */, &bounds);
EXPECT_TRUE(success)
<< "A frame range within the range of keyframes should find bounds of selected keyframes.";
EXPECT_FLOAT_EQ(fcu->bezt[3].vec[0][0], bounds.xmin);
@ -502,7 +502,7 @@ TEST(BKE_fcurve, BKE_fcurve_calc_bounds)
fcurve_store_samples(fcu, NULL, sample_start, sample_end, fcurve_samplingcb_evalcurve);
success = BKE_fcurve_calc_bounds(
fcu, false /* sel only */, false /* include handles */, NULL /* frame range */, &bounds);
fcu, false /* select only */, false /* include handles */, NULL /* frame range */, &bounds);
EXPECT_TRUE(success) << "FCurve samples should have a range.";
EXPECT_FLOAT_EQ(sample_start, bounds.xmin);
@ -513,7 +513,7 @@ TEST(BKE_fcurve, BKE_fcurve_calc_bounds)
range[0] = 8.0f;
range[1] = 20.0f;
success = BKE_fcurve_calc_bounds(
fcu, false /* sel only */, false /* include handles */, range /* frame range */, &bounds);
fcu, false /* select only */, false /* include handles */, range /* frame range */, &bounds);
EXPECT_TRUE(success) << "FCurve samples should have a range.";
EXPECT_FLOAT_EQ(range[0], bounds.xmin);
@ -524,7 +524,7 @@ TEST(BKE_fcurve, BKE_fcurve_calc_bounds)
range[0] = 20.1f;
range[1] = 30.0f;
success = BKE_fcurve_calc_bounds(
fcu, false /* sel only */, false /* include handles */, range /* frame range */, &bounds);
fcu, false /* select only */, false /* include handles */, range /* frame range */, &bounds);
EXPECT_FALSE(success)
<< "A frame range outside the range of keyframe samples should not have bounds.";

View File

@ -368,7 +368,7 @@ static void gpencil_convert_spline(Main *bmain,
if ((nu->flagu & CU_NURB_CYCLIC) == 0) {
segments--;
}
/* Get all interpolated curve points of Beziert */
/* Get all interpolated curve points of Bezier. */
for (int s = 0; s < segments; s++) {
int inext = (s + 1) % nu->pntsu;
BezTriple *prevbezt = &nu->bezt[s];
@ -915,7 +915,7 @@ static float *gpencil_stroke_points_from_editcurve_adaptive_resolu(
bool is_cyclic,
int *r_points_len)
{
/* One stride contains: x, y, z, pressure, strength, Vr, Vg, Vb, Vmix_factor */
/* One stride contains: `x, y, z, pressure, strength, Vr, Vg, Vb, Vmix_factor`. */
const uint stride = sizeof(float[9]);
const uint cpt_last = curve_point_array_len - 1;
const uint num_segments = (is_cyclic) ? curve_point_array_len : curve_point_array_len - 1;

View File

@ -191,7 +191,7 @@ void BKE_gpencil_blend_read_data(BlendDataReader *reader, bGPdata *gpd)
BLO_read_data_address(reader, &gpd->adt);
BKE_animdata_blend_read_data(reader, gpd->adt);
/* Ensure full objectmode for linked grease pencil. */
/* Ensure full object-mode for linked grease pencil. */
if (ID_IS_LINKED(gpd)) {
gpd->flag &= ~GP_DATA_STROKE_PAINTMODE;
gpd->flag &= ~GP_DATA_STROKE_EDITMODE;
@ -1364,9 +1364,9 @@ bGPDframe *BKE_gpencil_layer_frame_get(bGPDlayer *gpl, int cframe, eGP_GetFrame_
gpl->actframe = gpl->frames.first;
}
else {
/* unresolved errogenous situation! */
/* Unresolved erogenous situation! */
CLOG_STR_ERROR(&LOG, "cannot find appropriate gp-frame");
/* gpl->actframe should still be NULL */
/* `gpl->actframe` should still be NULL. */
}
}
}
@ -2324,7 +2324,7 @@ bool BKE_gpencil_from_image(
pt->strength = 1.0f - color[3];
}
/* Selet Alpha points. */
/* Select Alpha points. */
if (pt->strength < 0.03f) {
gps->flag |= GP_STROKE_SELECT;
pt->flag |= GP_SPOINT_SELECT;

View File

@ -309,7 +309,7 @@ template<typename T> struct AngleCartesianBase {
math::sqrt((T(1) - a.cos_) / T(2))};
/* Recover sign only for sine. Cosine of half angle is given to be positive or 0 since the
* angle stored in #AngleCartesianBase is in the range [-pi..pi]. */
/* TODO(fclem): Could use copysign here. */
/* TODO(fclem): Could use `copysign` here. */
if (a.sin_ < T(0)) {
result.sin_ = -result.sin_;
}

View File

@ -1307,7 +1307,7 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain)
/* Cannot call stuff now (pointers!), done in #setup_app_data. */
ob->id.recalc |= ID_RECALC_ALL;
/* new generic xray option */
/* New generic X-ray option. */
arm = blo_do_versions_newlibadr(fd, lib, ob->data);
enum { ARM_DRAWXRAY = (1 << 1) };
if (arm->flag & ARM_DRAWXRAY) {

View File

@ -1243,7 +1243,7 @@ static void sculpt_draw_cb(DRWSculptCallbackData *scd,
DRWShadingGroup *shgrp = scd->shading_groups[index];
if (geom != nullptr && shgrp != nullptr) {
if (SCULPT_DEBUG_BUFFERS) {
/* Color each buffers in different colors. Only work in solid/Xray mode. */
/* Color each buffers in different colors. Only work in solid/X-ray mode. */
shgrp = DRW_shgroup_create_sub(shgrp);
DRW_shgroup_uniform_vec3(
shgrp, "materialDiffuseColor", SCULPT_DEBUG_COLOR(scd->debug_node_nr++), 1);

View File

@ -174,7 +174,7 @@ static void get_nearest_fcurve_verts_list(bAnimContext *ac, const int mval[2], L
ANIMFILTER_NODUPLIS | ANIMFILTER_FCURVESONLY);
if (U.animation_flag &
USER_ANIM_ONLY_SHOW_SELECTED_CURVE_KEYS) { /* FIXME: this should really be check for by the
filtering code... */
* filtering code. */
filter |= ANIMFILTER_SEL;
}
mapping_flag |= ANIM_get_normalization_flags(ac);

View File

@ -675,7 +675,7 @@ int view3d_opengl_select_ex(ViewContext *vc,
GPU_depth_test(GPU_DEPTH_LESS_EQUAL);
}
/* If in xray mode, we select the wires in priority. */
/* If in X-ray mode, we select the wires in priority. */
if (XRAY_ACTIVE(v3d) && use_nearest) {
/* We need to call "GPU_select_*" API's inside DRW_draw_select_loop
* because the OpenGL context created & destroyed inside this function. */

View File

@ -505,7 +505,7 @@ typedef struct bGPDlayer {
struct Object *parent;
/** Inverse matrix (only used if parented). */
float inverse[4][4];
/** String describing subobject info, MAX_ID_NAME-2. */
/** String describing sub-object info, `MAX_ID_NAME - 2`. */
char parsubstr[64];
short partype;
@ -574,7 +574,7 @@ typedef enum eGPDlayer_Flag {
GP_LAYER_SELECT = (1 << 5),
/* current frame for layer can't be changed */
GP_LAYER_FRAMELOCK = (1 << 6),
/* don't render xray (which is default) */
/* Don't render X-ray (which is default). */
GP_LAYER_NO_XRAY = (1 << 7),
/* "volumetric" strokes */
GP_LAYER_VOLUMETRIC = (1 << 10),
@ -852,7 +852,7 @@ typedef enum eGP_OnionModes {
GP_ONION_MODE_SELECTED = 2,
} eGP_OnionModes;
/* xray modes (Depth Ordering) */
/* X-ray modes (Depth Ordering). */
typedef enum eGP_DepthOrdering {
GP_XRAY_FRONT = 0,
GP_XRAY_3DSPACE = 1,