Merge branch 'master' into sculpt-dev

This commit is contained in:
Pablo Dobarro 2021-02-07 17:49:48 +01:00
commit 03778b787e
94 changed files with 498 additions and 378 deletions

View File

@ -160,7 +160,7 @@ struct REGISTRY_ENTRY {
PCWSTR pszValueName;
DWORD dwValueType;
PCWSTR pszData; // These two fields could/should have been a union, but C++
DWORD dwData; // only lets you initalize the first field in a union.
DWORD dwData; // only lets you initialize the first field in a union.
};
// Creates a registry key (if needed) and sets the default value of the key

View File

@ -128,7 +128,7 @@ class WriteAttribute {
void *array_buffer_ = nullptr;
/* True, when the buffer points to a temporary array. */
bool array_is_temporary_ = false;
/* This helps to protect agains forgetting to apply changes done to the array. */
/* This helps to protect against forgetting to apply changes done to the array. */
bool array_should_be_applied_ = false;
public:

View File

@ -77,7 +77,7 @@ enum {
IDWALK_CB_USER = (1 << 8),
/**
* This ID usage is not refcounted, but at least one user should be generated by it (to avoid
* e.g. loosing the used ID on save/reload).
* e.g. losing the used ID on save/reload).
* Callback is responsible to deal accordingly with #ID.us if needed.
*/
IDWALK_CB_USER_ONE = (1 << 9),

View File

@ -293,7 +293,7 @@ bool BKE_subdiv_ccg_check_coord_valid(const SubdivCCG *subdiv_ccg, const SubdivC
* neighbor elements in total).
*
* - For the corner element a single neighboring element on every adjacent edge, single from
* every gird.
* every grid.
*
* - For the boundary element two neighbor elements on the boundary (from same grid) and one
* element inside of every neighboring grid. */

View File

@ -78,7 +78,7 @@ set(SRC
intern/armature.c
intern/armature_deform.c
intern/armature_update.c
intern/asset.c
intern/asset.cc
intern/attribute.c
intern/attribute_access.cc
intern/autoexec.c

View File

@ -1594,7 +1594,7 @@ static bool nla_combine_get_inverted_strip_value(const int mix_mode,
if (IS_EQF(base_value, 0.0f)) {
base_value = 1.0f;
}
/* Divison by zero. */
/* Division by zero. */
if (IS_EQF(lower_value, 0.0f)) {
/* Resolve 0/0 to 1. */
if (IS_EQF(blended_value, 0.0f)) {
@ -1657,55 +1657,6 @@ static bool nla_combine_quaternion_get_inverted_strip_values(const float lower_v
return true;
}
/* Blend the specified snapshots into the target, and free the input snapshots. */
static void nlaeval_snapshot_mix_and_free(NlaEvalData *nlaeval,
NlaEvalSnapshot *out,
NlaEvalSnapshot *in1,
NlaEvalSnapshot *in2,
float alpha)
{
BLI_assert(in1->base == out && in2->base == out);
nlaeval_snapshot_ensure_size(out, nlaeval->num_channels);
for (int i = 0; i < nlaeval->num_channels; i++) {
NlaEvalChannelSnapshot *c_in1 = nlaeval_snapshot_get(in1, i);
NlaEvalChannelSnapshot *c_in2 = nlaeval_snapshot_get(in2, i);
if (c_in1 || c_in2) {
NlaEvalChannelSnapshot *c_out = out->channels[i];
/* Steal the entry from one of the input snapshots. */
if (c_out == NULL) {
if (c_in1 != NULL) {
c_out = c_in1;
in1->channels[i] = NULL;
}
else {
c_out = c_in2;
in2->channels[i] = NULL;
}
}
if (c_in1 == NULL) {
c_in1 = nlaeval_snapshot_find_channel(in1->base, c_out->channel);
}
if (c_in2 == NULL) {
c_in2 = nlaeval_snapshot_find_channel(in2->base, c_out->channel);
}
out->channels[i] = c_out;
for (int j = 0; j < c_out->length; j++) {
c_out->values[j] = c_in1->values[j] * (1.0f - alpha) + c_in2->values[j] * alpha;
}
}
}
nlaeval_snapshot_free_data(in1);
nlaeval_snapshot_free_data(in2);
}
/* ---------------------- */
/* F-Modifier stack joining/separation utilities -
* should we generalize these for BLI_listbase.h interface? */
@ -1795,6 +1746,11 @@ static void nlasnapshot_from_action(PointerRNA *ptr,
NlaEvalChannel *nec = nlaevalchan_verify(ptr, channels, fcu->rna_path);
/* Invalid path or property cannot be animated. */
if (nec == NULL) {
continue;
}
NlaEvalChannelSnapshot *necs = nlaeval_snapshot_ensure_channel(r_snapshot, nec);
if (!nlaevalchan_validate_index_ex(nec, fcu->array_index)) {
continue;
@ -1905,8 +1861,13 @@ static void nlastrip_evaluate_transition(PointerRNA *ptr,
nlastrip_evaluate(
ptr, channels, &tmp_modifiers, &tmp_nes, &snapshot2, anim_eval_context, flush_to_original);
/* accumulate temp-buffer and full-buffer, using the 'real' strip */
nlaeval_snapshot_mix_and_free(channels, snapshot, &snapshot1, &snapshot2, nes->strip_time);
/** Replace \a snapshot2 NULL channels with base or default values so all channels blend. */
nlasnapshot_ensure_channels(channels, &snapshot2);
nlasnapshot_blend(
channels, &snapshot1, &snapshot2, NLASTRIP_MODE_REPLACE, nes->strip_time, snapshot);
nlaeval_snapshot_free_data(&snapshot1);
nlaeval_snapshot_free_data(&snapshot2);
/* unlink this strip's modifiers from the parent's modifiers again */
nlaeval_fmodifiers_split_stacks(&nes->strip->modifiers, modifiers);
@ -2262,7 +2223,7 @@ static bool is_action_track_evaluated_without_nla(const AnimData *adt,
}
/** NLA settings interference. */
if ((adt->flag & (ADT_NLA_SOLO_TRACK | ADT_NLA_EDIT_ON)) == 0) {
if ((adt->flag & (ADT_NLA_SOLO_TRACK | ADT_NLA_EDIT_ON)) != 0) {
return false;
}
@ -2510,6 +2471,13 @@ static void animsys_calculate_nla(PointerRNA *ptr,
/* ---------------------- */
void nlasnapshot_ensure_channels(NlaEvalData *eval_data, NlaEvalSnapshot *snapshot)
{
LISTBASE_FOREACH (NlaEvalChannel *, nec, &eval_data->channels) {
nlaeval_snapshot_ensure_channel(snapshot, nec);
}
}
/** Blends the \a lower_snapshot with the \a upper_snapshot into \a r_blended_snapshot according
* to the given \a upper_blendmode and \a upper_influence. */
void nlasnapshot_blend(NlaEvalData *eval_data,

View File

@ -20,6 +20,10 @@
#include <string.h>
#include "DNA_ID.h"
#include "DNA_asset_types.h"
#include "DNA_defaults.h"
#include "BLI_listbase.h"
#include "BLI_string.h"
#include "BLI_string_utils.h"
@ -29,17 +33,13 @@
#include "BKE_icons.h"
#include "BKE_idprop.h"
#include "DNA_ID.h"
#include "DNA_asset_types.h"
#include "DNA_defaults.h"
#include "BLO_read_write.h"
#include "MEM_guardedalloc.h"
AssetMetaData *BKE_asset_metadata_create(void)
{
AssetMetaData *asset_data = MEM_callocN(sizeof(*asset_data), __func__);
AssetMetaData *asset_data = (AssetMetaData *)MEM_callocN(sizeof(*asset_data), __func__);
memcpy(asset_data, DNA_struct_default_get(AssetMetaData), sizeof(*asset_data));
return asset_data;
}
@ -57,7 +57,7 @@ void BKE_asset_metadata_free(AssetMetaData **asset_data)
static AssetTag *asset_metadata_tag_add(AssetMetaData *asset_data, const char *const name)
{
AssetTag *tag = MEM_callocN(sizeof(*tag), __func__);
AssetTag *tag = (AssetTag *)MEM_callocN(sizeof(*tag), __func__);
BLI_strncpy(tag->name, name, sizeof(tag->name));
BLI_addtail(&asset_data->tags, tag);
@ -81,12 +81,12 @@ AssetTag *BKE_asset_metadata_tag_add(AssetMetaData *asset_data, const char *name
struct AssetTagEnsureResult BKE_asset_metadata_tag_ensure(AssetMetaData *asset_data,
const char *name)
{
struct AssetTagEnsureResult result = {.tag = NULL};
struct AssetTagEnsureResult result = {nullptr};
if (!name[0]) {
return result;
}
AssetTag *tag = BLI_findstring(&asset_data->tags, name, offsetof(AssetTag, name));
AssetTag *tag = (AssetTag *)BLI_findstring(&asset_data->tags, name, offsetof(AssetTag, name));
if (tag) {
result.tag = tag;

View File

@ -429,7 +429,7 @@ static int brush_undo_preserve_cb(LibraryIDLinkCallbackData *cb_data)
static void brush_undo_preserve(BlendLibReader *reader, ID *id_new, ID *id_old)
{
/* Whole Brush is preserved accross undo's. */
/* Whole Brush is preserved across undos. */
BKE_lib_id_swap(NULL, id_new, id_old);
/* `id_new` now has content from `id_old`, we need to ensure those old ID pointers are valid.

View File

@ -4693,7 +4693,7 @@ static void pivotcon_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *ta
copy_m3_m4(rotMat, cob->matrix);
normalize_m3(rotMat);
/* correct the pivot by the rotation axis otherwise the pivot translates when it shouldnt */
/* correct the pivot by the rotation axis otherwise the pivot translates when it shouldn't */
mat3_normalized_to_axis_angle(axis, &angle, rotMat);
if (angle) {
float dvec[3];

View File

@ -1110,7 +1110,7 @@ void fcurve_samples_to_keyframes(FCurve *fcu, const int start, const int end)
if (fcu->fpt == NULL) {
/* No data to unbake. */
CLOG_ERROR(&LOG, "Error: Curve containts no baked keyframes");
CLOG_ERROR(&LOG, "Error: Curve contains no baked keyframes");
return;
}

View File

@ -1684,11 +1684,12 @@ void BKE_gpencil_stroke_normal(const bGPDstroke *gps, float r_normal[3])
/* Stroke Simplify ------------------------------------- */
/** Reduce a series of points to a simplified version, but
/**
* Reduce a series of points to a simplified version, but
* maintains the general shape of the series
*
* Ramer - Douglas - Peucker algorithm
* by http ://en.wikipedia.org/wiki/Ramer-Douglas-Peucker_algorithm
* by http://en.wikipedia.org/wiki/Ramer-Douglas-Peucker_algorithm
* \param gpd: Grease pencil data-block
* \param gps: Grease pencil stroke
* \param epsilon: Epsilon value to define precision of the algorithm

View File

@ -665,7 +665,7 @@ static float (*mask_spline_feather_differentiated_points_with_resolution__double
len_feather = len_v2v2(bezt_prev->vec[1], bezt_curr->vec[1]);
/* scale by chane in length */
/* scale by change in length */
len_scalar = len_feather / len_base;
dist_ensure_v2_v2fl(bezt_prev->vec[2],
bezt_prev->vec[1],

View File

@ -1219,7 +1219,7 @@ int test_index_face(MFace *mface, CustomData *fdata, int mfindex, int nr)
}
/* Check corrupt cases, bow-tie geometry,
* cant handle these because edge data wont exist so just return 0. */
* can't handle these because edge data won't exist so just return 0. */
if (nr == 3) {
if (
/* real edges */

View File

@ -612,6 +612,7 @@ static void prefair_and_fair_vertices(FairingContext *fairing_context,
/* Fair. */
VoronoiVertexWeight *voronoi_vertex_weights = new VoronoiVertexWeight(fairing_context);
CotangentLoopWeight *cotangent_loop_weights = new CotangentLoopWeight(fairing_context);
fairing_context->fair_vertices(
affected_vertices, depth, voronoi_vertex_weights, cotangent_loop_weights);

View File

@ -263,6 +263,6 @@ void BKE_mesh_calc_edges(Mesh *mesh, bool keep_existing_edges, const bool select
mesh->totedge = new_totedge;
mesh->medge = new_edges.data();
/* Explicitely clear edge maps, because that way it can be parallelized. */
/* Explicitly clear edge maps, because that way it can be parallelized. */
clear_hash_tables(edge_maps);
}

View File

@ -127,7 +127,7 @@ static void palette_blend_read_data(BlendDataReader *reader, ID *id)
static void palette_undo_preserve(BlendLibReader *UNUSED(reader), ID *id_new, ID *id_old)
{
/* Whole Palette is preserved accross undo's, and it has no extra pointer, simple. */
/* Whole Palette is preserved across undos, and it has no extra pointer, simple. */
/* Note: We do not care about potential internal references to self here, Palette has none. */
/* Note: We do not swap IDProperties, as dealing with potential ID pointers in those would be
* fairly delicate. */

View File

@ -2304,7 +2304,7 @@ void psys_particle_on_emitter(ParticleSystemModifierData *psmd,
}
return;
}
/* we cant use the num_dmcache */
/* we can't use the num_dmcache */
psys_particle_on_dm(
psmd->mesh_final, from, index, index_dmcache, fuv, foffset, vec, nor, utan, vtan, orco);
}

View File

@ -138,7 +138,7 @@ TEST_F(TrackingTest, BKE_tracking_marker_get_interpolated)
BKE_tracking_track_free(&track);
}
/* More comprehensive test, which resembles real life trackign scenario better. */
/* More comprehensive test, which resembles real-life tracking scenario better. */
{
MovieTrackingTrack track = {nullptr};

View File

@ -145,7 +145,7 @@ static struct VolumeFileCache {
/* Has the grid tree been loaded? */
bool is_loaded;
/* Error message if an error occured during loading. */
/* Error message if an error occurred while loading. */
std::string error_msg;
/* User counting. */
int num_metadata_users;

View File

@ -182,6 +182,8 @@ void nladata_flush_channels(PointerRNA *ptr,
NlaEvalSnapshot *snapshot,
const bool flush_to_original);
void nlasnapshot_ensure_channels(NlaEvalData *eval_data, NlaEvalSnapshot *snapshot);
void nlasnapshot_blend(NlaEvalData *eval_data,
NlaEvalSnapshot *lower_snapshot,
NlaEvalSnapshot *upper_snapshot,

View File

@ -1312,7 +1312,7 @@ BVHTreeOverlap *BLI_bvhtree_overlap_ex(
bool use_threading = (flag & BVH_OVERLAP_USE_THREADING) != 0 &&
(tree1->totleaf > KDOPBVH_THREAD_LEAF_THRESHOLD);
/* `RETURN_PAIRS` was not implemented without `max_interations`. */
/* 'RETURN_PAIRS' was not implemented without 'max_interactions'. */
BLI_assert(overlap_pairs || max_interactions);
const int root_node_len = BLI_bvhtree_overlap_thread_num(tree1);

View File

@ -27,10 +27,14 @@
# include "BLI_array.hh"
# include "BLI_assert.h"
# include "BLI_delaunay_2d.h"
# include "BLI_double3.hh"
# include "BLI_float3.hh"
# include "BLI_hash.hh"
# include "BLI_kdopbvh.h"
# include "BLI_map.hh"
# include "BLI_math.h"
# include "BLI_math_boolean.hh"
# include "BLI_math_geom.h"
# include "BLI_math_mpq.hh"
# include "BLI_mesh_intersect.hh"
# include "BLI_mpq3.hh"
@ -45,6 +49,7 @@
# include "BLI_mesh_boolean.hh"
// # define PERFDEBUG
namespace blender::meshintersect {
/**
@ -2328,159 +2333,216 @@ static const char *bool_optype_name(BoolOpType op)
}
}
static mpq3 calc_point_inside_tri(const Face &tri)
static double3 calc_point_inside_tri_db(const Face &tri)
{
const Vert *v0 = tri.vert[0];
const Vert *v1 = tri.vert[1];
const Vert *v2 = tri.vert[2];
mpq3 ans = v0->co_exact / 3 + v1->co_exact / 3 + v2->co_exact / 3;
double3 ans = v0->co / 3 + v1->co / 3 + v2->co / 3;
return ans;
}
class InsideShapeTestData {
public:
const IMesh &tm;
std::function<int(int)> shape_fn;
int nshapes;
/* A per-shape vector of parity of hits of that shape. */
Array<int> hit_parity;
InsideShapeTestData(const IMesh &tm, std::function<int(int)> shape_fn, int nshapes)
: tm(tm), shape_fn(shape_fn), nshapes(nshapes)
{
}
};
static void inside_shape_callback(void *userdata,
int index,
const BVHTreeRay *ray,
BVHTreeRayHit *UNUSED(hit))
{
const int dbg_level = 0;
if (dbg_level > 0) {
std::cout << "inside_shape_callback, index = " << index << "\n";
}
InsideShapeTestData *data = static_cast<InsideShapeTestData *>(userdata);
const Face &tri = *data->tm.face(index);
int shape = data->shape_fn(tri.orig);
if (shape == -1) {
return;
}
float dist;
float fv0[3];
float fv1[3];
float fv2[3];
for (int i = 0; i < 3; ++i) {
fv0[i] = float(tri.vert[0]->co[i]);
fv1[i] = float(tri.vert[1]->co[i]);
fv2[i] = float(tri.vert[2]->co[i]);
}
if (dbg_level > 0) {
std::cout << " fv0=(" << fv0[0] << "," << fv0[1] << "," << fv0[2] << ")\n";
std::cout << " fv1=(" << fv1[0] << "," << fv1[1] << "," << fv1[2] << ")\n";
std::cout << " fv2=(" << fv2[0] << "," << fv2[1] << "," << fv2[2] << ")\n";
}
if (isect_ray_tri_epsilon_v3(
ray->origin, ray->direction, fv0, fv1, fv2, &dist, NULL, FLT_EPSILON)) {
/* Count parity as +1 if ray is in the same direction as tri's normal,
* and -1 if the directions are opposite. */
double3 o_db{double(ray->origin[0]), double(ray->origin[1]), double(ray->origin[2])};
int parity = orient3d(tri.vert[0]->co, tri.vert[1]->co, tri.vert[2]->co, o_db);
if (dbg_level > 0) {
std::cout << "origin at " << o_db << ", parity = " << parity << "\n";
}
data->hit_parity[shape] += parity;
}
}
/**
* Return the Generalized Winding Number of point \a testp with respect to the
* volume implied by the faces for which shape_fn returns the value shape.
* See "Robust Inside-Outside Segmentation using Generalized Winding Numbers"
* by Jacobson, Kavan, and Sorkine-Hornung.
* This is like a winding number in that if it is positive, the point
* is inside the volume. But it is tolerant of not-completely-watertight
* volumes, still doing a passable job of classifying inside/outside
* as we intuitively understand that to mean.
*
* TOOD: speed up this calculation using the hierarchical algorithm in that paper.
* Test the triangle with index \a t_index to see which shapes it is inside,
* and fill in \a in_shape with a confidence value between 0 and 1 that says
* how likely we think it is that it is inside.
* This is done by casting some rays from just on the positive side of a test
* face in various directions and summing the parity of crossing faces of each face.
* The BVHtree \a tree contains all the triangles of \a tm and can be used for
* fast raycasting.
*/
static double generalized_winding_number(const IMesh &tm,
std::function<int(int)> shape_fn,
const double3 &testp,
int shape)
static void test_tri_inside_shapes(const IMesh &tm,
std::function<int(int)> shape_fn,
int nshapes,
int test_t_index,
BVHTree *tree,
Array<float> &in_shape)
{
constexpr int dbg_level = 0;
const int dbg_level = 0;
if (dbg_level > 0) {
std::cout << "GENERALIZED_WINDING_NUMBER testp = " << testp << ", shape = " << shape << "\n";
std::cout << "test_point_inside_shapes, t_index = " << test_t_index << "\n";
}
double gwn = 0;
for (int t : tm.face_index_range()) {
const Face *f = tm.face(t);
const Face &tri = *f;
if (shape_fn(tri.orig) == shape) {
if (dbg_level > 0) {
std::cout << "accumulate for tri t = " << t << " = " << f << "\n";
Face &tri_test = *tm.face(test_t_index);
int shape = shape_fn(tri_test.orig);
if (shape == -1) {
in_shape.fill(0.0f);
return;
}
double3 test_point = calc_point_inside_tri_db(tri_test);
/* Offset the test point a tiny bit in the tri_test normal direcction. */
tri_test.populate_plane(false);
double3 norm = tri_test.plane->norm.normalized();
const double offset_amount = 1e-5;
double3 offset_test_point = test_point + offset_amount * norm;
if (dbg_level > 0) {
std::cout << "test tri is in shape " << shape << "\n";
std::cout << "test point = " << test_point << "\n";
std::cout << "offset_test_point = " << offset_test_point << "\n";
}
/* Try six test rays almost along orthogonal axes.
* Perturb their directions slightly to make it less likely to hit a seam.
* Raycast assumes they have unit length, so use r1 near 1 and
* ra near 0.5, and rb near .01, but normalized so sqrt(r1^2 + ra^2 + rb^2) == 1. */
constexpr int num_rays = 6;
constexpr float r1 = 0.9987025295199663f;
constexpr float ra = 0.04993512647599832f;
constexpr float rb = 0.009987025295199663f;
const float test_rays[num_rays][3] = {
{r1, ra, rb}, {-r1, -ra, -rb}, {rb, r1, ra}, {-rb, -r1, -ra}, {ra, rb, r1}, {-ra, -rb, -r1}};
InsideShapeTestData data(tm, shape_fn, nshapes);
data.hit_parity = Array<int>(nshapes, 0);
Array<int> count_insides(nshapes, 0);
const float co[3] = {
float(offset_test_point[0]), float(offset_test_point[1]), float(offset_test_point[2])};
for (int i = 0; i < num_rays; ++i) {
if (dbg_level > 0) {
std::cout << "shoot ray " << i << "(" << test_rays[i][0] << "," << test_rays[i][1] << ","
<< test_rays[i][2] << ")\n";
}
BLI_bvhtree_ray_cast_all(tree, co, test_rays[i], 0.0f, FLT_MAX, inside_shape_callback, &data);
if (dbg_level > 0) {
std::cout << "ray " << i << " result:";
for (int j = 0; j < nshapes; ++j) {
std::cout << " " << data.hit_parity[j];
}
const Vert *v0 = tri.vert[0];
const Vert *v1 = tri.vert[1];
const Vert *v2 = tri.vert[2];
double3 a = v0->co - testp;
double3 b = v1->co - testp;
double3 c = v2->co - testp;
/* Calculate the solid angle of abc relative to origin.
* See "The Solid Angle of a Plane Triangle" by Oosterom and Strackee
* for the derivation of the formula. */
double alen = a.length();
double blen = b.length();
double clen = c.length();
double3 bxc = double3::cross_high_precision(b, c);
double num = double3::dot(a, bxc);
double denom = alen * blen * clen + double3::dot(a, b) * clen + double3::dot(a, c) * blen +
double3::dot(b, c) * alen;
if (denom == 0.0) {
if (dbg_level > 0) {
std::cout << "denom == 0, skipping this tri\n";
}
continue;
std::cout << "\n";
}
for (int j = 0; j < nshapes; ++j) {
if (j != shape && data.hit_parity[j] > 0) {
++count_insides[j];
}
double x = atan2(num, denom);
double fgwn = 2.0 * x;
if (dbg_level > 0) {
std::cout << "tri contributes " << fgwn << "\n";
}
gwn += fgwn;
}
data.hit_parity.fill(0);
}
for (int j = 0; j < nshapes; ++j) {
if (j == shape) {
in_shape[j] = 1.0f; /* Let's say a shape is always inside itself. */
}
else {
in_shape[j] = float(count_insides[j]) / float(num_rays);
}
if (dbg_level > 0) {
std::cout << "shape " << j << " inside = " << in_shape[j] << "\n";
}
}
gwn = gwn / (M_PI * 4.0);
if (dbg_level > 0) {
std::cout << "final gwn = " << gwn << "\n";
}
return gwn;
}
/**
* Return true if point \a testp is inside the volume implied by the
* faces for which the shape_fn returns the value shape.
* If \a high_confidence is true then we want a higher degree
* of "insideness" than if it is false.
*/
static bool point_is_inside_shape(const IMesh &tm,
std::function<int(int)> shape_fn,
const double3 &testp,
int shape,
bool high_confidence)
{
double gwn = generalized_winding_number(tm, shape_fn, testp, shape);
/* Due to floating point error, an outside point should get a value
* of zero for gwn, but may have a very slightly positive value instead.
* It is not important to get this epsilon very small, because practical
* cases of interest will have gwn at least 0.2 if it is not zero. */
if (high_confidence) {
return (gwn > 0.9);
}
return (gwn > 0.01);
}
/**
* Use the Generalized Winding Number method for deciding if a patch of the
* Use the RayCast method for deciding if a triangle of the
* mesh is supposed to be included or excluded in the boolean result,
* and return the mesh that is the boolean result.
* The reason this is done on a triangle-by-triangle basis is that
* when the input is not PWN, some patches can be both inside and outside
* some shapes (e.g., a plane cutting through Suzanne's open eyes).
*/
static IMesh gwn_boolean(const IMesh &tm,
BoolOpType op,
int nshapes,
std::function<int(int)> shape_fn,
const PatchesInfo &pinfo,
IMeshArena *arena)
static IMesh raycast_boolean(const IMesh &tm,
BoolOpType op,
int nshapes,
std::function<int(int)> shape_fn,
IMeshArena *arena)
{
constexpr int dbg_level = 0;
if (dbg_level > 0) {
std::cout << "GWN_BOOLEAN\n";
std::cout << "RAYCAST_BOOLEAN\n";
}
IMesh ans;
/* Build a BVH tree of tm's triangles.
* We could possibly reuse the BVH tree(s) build in TriOverlaps in
* the mesh intersect function. A future TODO. */
BVHTree *tree = BLI_bvhtree_new(tm.face_size(), FLT_EPSILON, 8, 8);
for (int i : tm.face_index_range()) {
const Face *f = tm.face(i);
float t_cos[9];
for (int j = 0; j < 3; ++j) {
const Vert *v = f->vert[j];
for (int k = 0; k < 3; ++k) {
t_cos[3 * j + k] = float(v->co[k]);
}
}
BLI_bvhtree_insert(tree, i, t_cos, 3);
}
BLI_bvhtree_balance(tree);
Vector<Face *> out_faces;
out_faces.reserve(tm.face_size());
Array<float> in_shape(nshapes, 0);
Array<int> winding(nshapes, 0);
for (int p : pinfo.index_range()) {
const Patch &patch = pinfo.patch(p);
/* For test triangle, choose one in the middle of patch list
* as the ones near the beginning may be very near other patches. */
int test_t_index = patch.tri(patch.tot_tri() / 2);
Face &tri_test = *tm.face(test_t_index);
/* Assume all triangles in a patch are in the same shape. */
int shape = shape_fn(tri_test.orig);
for (int t : tm.face_index_range()) {
Face &tri = *tm.face(t);
int shape = shape_fn(tri.orig);
if (dbg_level > 0) {
std::cout << "process patch " << p << " = " << patch << "\n";
std::cout << "test tri = " << test_t_index << " = " << &tri_test << "\n";
std::cout << "process triangle " << t << " = " << &tri << "\n";
std::cout << "shape = " << shape << "\n";
}
if (shape == -1) {
continue;
}
mpq3 test_point = calc_point_inside_tri(tri_test);
double3 test_point_db(test_point[0].get_d(), test_point[1].get_d(), test_point[2].get_d());
if (dbg_level > 0) {
std::cout << "test point = " << test_point_db << "\n";
}
test_tri_inside_shapes(tm, shape_fn, nshapes, t, tree, in_shape);
for (int other_shape = 0; other_shape < nshapes; ++other_shape) {
if (other_shape == shape) {
continue;
}
/* The point_is_inside_shape function has to approximate if the other
* shape is not PWN. For most operations, even a hint of being inside
/* The in_shape array has a confidence value for "insideness".
* For most operations, even a hint of being inside
* gives good results, but when shape is a cutter in a Difference
* operation, we want to be pretty sure that the point is inside other_shape.
* E.g., T75827.
*/
bool need_high_confidence = (op == BoolOpType::Difference) && (shape != 0);
bool inside = point_is_inside_shape(
tm, shape_fn, test_point_db, other_shape, need_high_confidence);
bool inside = in_shape[other_shape] >= (need_high_confidence ? 0.5f : 0.1f);
if (dbg_level > 0) {
std::cout << "test point is " << (inside ? "inside" : "outside") << " other_shape "
<< other_shape << "\n";
@ -2503,26 +2565,22 @@ static IMesh gwn_boolean(const IMesh &tm,
std::cout << winding[i] << " ";
}
std::cout << "\niv0=" << in_output_volume_0 << ", iv1=" << in_output_volume_1 << "\n";
std::cout << "result for patch " << p << ": remove=" << do_remove << ", flip=" << do_flip
std::cout << "result for tri " << t << ": remove=" << do_remove << ", flip=" << do_flip
<< "\n";
}
if (!do_remove) {
for (int t : patch.tris()) {
Face *f = tm.face(t);
if (!do_flip) {
out_faces.append(f);
}
else {
Face &tri = *f;
/* We need flipped version of f. */
Array<const Vert *> flipped_vs = {tri[0], tri[2], tri[1]};
Array<int> flipped_e_origs = {tri.edge_orig[2], tri.edge_orig[1], tri.edge_orig[0]};
Array<bool> flipped_is_intersect = {
tri.is_intersect[2], tri.is_intersect[1], tri.is_intersect[0]};
Face *flipped_f = arena->add_face(
flipped_vs, f->orig, flipped_e_origs, flipped_is_intersect);
out_faces.append(flipped_f);
}
if (!do_flip) {
out_faces.append(&tri);
}
else {
/* We need flipped version of tri. */
Array<const Vert *> flipped_vs = {tri[0], tri[2], tri[1]};
Array<int> flipped_e_origs = {tri.edge_orig[2], tri.edge_orig[1], tri.edge_orig[0]};
Array<bool> flipped_is_intersect = {
tri.is_intersect[2], tri.is_intersect[1], tri.is_intersect[0]};
Face *flipped_f = arena->add_face(
flipped_vs, tri.orig, flipped_e_origs, flipped_is_intersect);
out_faces.append(flipped_f);
}
}
}
@ -3109,6 +3167,14 @@ static Vector<Face *> merge_tris_for_face(Vector<int> tris,
return ans;
}
static bool approx_in_line(const double3 &a, const double3 &b, const double3 &c)
{
double3 vec1 = b - a;
double3 vec2 = c - b;
double cos_ang = double3::dot(vec1.normalized(), vec2.normalized());
return fabs(cos_ang - 1.0) < 1e-4;
}
/**
* Return an array, paralleling imesh_out.vert, saying which vertices can be dissolved.
* A vertex v can be dissolved if (a) it is not an input vertex; (b) it has valence 2;
@ -3161,8 +3227,11 @@ static Array<bool> find_dissolve_verts(IMesh &imesh_out, int *r_count_dissolve)
const std::pair<const Vert *, const Vert *> &nbrs = neighbors[v_out];
if (nbrs.first != nullptr) {
BLI_assert(nbrs.second != nullptr);
dissolve[v_out] = true;
++count;
const Vert *v_v_out = imesh_out.vert(v_out);
if (approx_in_line(nbrs.first->co, v_v_out->co, nbrs.second->co)) {
dissolve[v_out] = true;
++count;
}
}
}
}
@ -3339,30 +3408,27 @@ IMesh boolean_trimesh(IMesh &tm_in,
double topo_time = PIL_check_seconds_timer();
std::cout << " topology built, time = " << topo_time - intersect_time << "\n";
# endif
PatchesInfo pinfo = find_patches(tm_si, tm_si_topo);
bool pwn = is_pwn(tm_si, tm_si_topo);
# ifdef PERFDEBUG
double patch_time = PIL_check_seconds_timer();
std::cout << " patches found, time = " << patch_time - topo_time << "\n";
double pwn_time = PIL_check_seconds_timer();
std::cout << " pwn checked, time = " << pwn_time - topo_time << "\n";
# endif
IMesh tm_out;
if (!is_pwn(tm_si, tm_si_topo)) {
# ifdef PERFDEBUG
double pwn_check_time = PIL_check_seconds_timer();
std::cout << " pwn checked (not pwn), time = " << pwn_check_time - patch_time << "\n";
# endif
if (!pwn) {
if (dbg_level > 0) {
std::cout << "Input is not PWN, using gwn method\n";
std::cout << "Input is not PWN, using raycast method\n";
}
tm_out = gwn_boolean(tm_si, op, nshapes, shape_fn, pinfo, arena);
tm_out = raycast_boolean(tm_si, op, nshapes, shape_fn, arena);
# ifdef PERFDEBUG
double gwn_time = PIL_check_seconds_timer();
std::cout << " gwn, time = " << gwn_time - pwn_check_time << "\n";
double raycast_time = PIL_check_seconds_timer();
std::cout << " raycast_boolean done, time = " << raycast_time - pwn_time << "\n";
# endif
}
else {
PatchesInfo pinfo = find_patches(tm_si, tm_si_topo);
# ifdef PERFDEBUG
double pwn_time = PIL_check_seconds_timer();
std::cout << " pwn checked (ok), time = " << pwn_time - patch_time << "\n";
double patch_time = PIL_check_seconds_timer();
std::cout << " patches found, time = " << patch_time - pwn_time << "\n";
# endif
CellsInfo cinfo = find_cells(tm_si, tm_si_topo, pinfo);
if (dbg_level > 0) {

View File

@ -1375,7 +1375,7 @@ void BLI_make_file_string(const char *relabase, char *string, const char *dir, c
}
}
else {
return; /* string is NULL, probably shouldnt happen but return anyway */
return; /* string is NULL, probably shouldn't happen but return anyway */
}
/* Resolve relative references */

View File

@ -491,7 +491,7 @@ TEST(polyfill2d, Spiral)
TEST_POLYFILL_TEMPLATE_STATIC(poly, false);
}
/* Test case from http:# www.flipcode.com/archives/Efficient_Polygon_Triangulation.shtml */
/* Test case from http://www.flipcode.com/archives/Efficient_Polygon_Triangulation.shtml */
TEST(polyfill2d, TestFlipCode)
{
const float poly[][2] = {
@ -561,7 +561,7 @@ TEST(polyfill2d, SelfOverlap)
TEST_POLYFILL_TEMPLATE_STATIC(poly, true);
}
/* Test case from http:# www.davdata.nl/math/polygons.html */
/* Test case from http://www.davdata.nl/math/polygons.html */
TEST(polyfill2d, TestDavData)
{
const float poly[][2] = {
@ -573,7 +573,7 @@ TEST(polyfill2d, TestDavData)
TEST_POLYFILL_TEMPLATE_STATIC(poly, false);
}
/* Issue 815, http:# code.google.com/p/libgdx/issues/detail?id=815 */
/* Issue 815, http://code.google.com/p/libgdx/issues/detail?id=815 */
TEST(polyfill2d, Issue815)
{
const float poly[][2] = {
@ -589,7 +589,7 @@ TEST(polyfill2d, Issue815)
TEST_POLYFILL_TEMPLATE_STATIC(poly, false);
}
/* Issue 207, comment #1, http:# code.google.com/p/libgdx/issues/detail?id=207#c1 */
/* Issue 207, comment #1, http://code.google.com/p/libgdx/issues/detail?id=207#c1 */
TEST(polyfill2d, Issue207_1)
{
const float poly[][2] = {
@ -608,8 +608,8 @@ TEST(polyfill2d, Issue207_1)
TEST_POLYFILL_TEMPLATE_STATIC(poly, true);
}
/* Issue 207, comment #11, http:# code.google.com/p/libgdx/issues/detail?id=207#c11 */
/* Also on issue 1081, http:# code.google.com/p/libgdx/issues/detail?id=1081 */
/* Issue 207, comment #11, http://code.google.com/p/libgdx/issues/detail?id=207#c11 */
/* Also on issue 1081, http://code.google.com/p/libgdx/issues/detail?id=1081 */
TEST(polyfill2d, Issue207_11)
{
const float poly[][2] = {
@ -628,7 +628,7 @@ TEST(polyfill2d, Issue207_11)
TEST_POLYFILL_TEMPLATE_STATIC(poly, false);
}
/* Issue 1407, http:# code.google.com/p/libgdx/issues/detail?id=1407 */
/* Issue 1407, http://code.google.com/p/libgdx/issues/detail?id=1407 */
TEST(polyfill2d, Issue1407)
{
const float poly[][2] = {
@ -640,7 +640,7 @@ TEST(polyfill2d, Issue1407)
TEST_POLYFILL_TEMPLATE_STATIC(poly, false);
}
/* Issue 1407, http:# code.google.com/p/libgdx/issues/detail?id=1407, */
/* Issue 1407, http://code.google.com/p/libgdx/issues/detail?id=1407, */
/* with an additional point to show what is happening. */
TEST(polyfill2d, Issue1407_pt)
{

View File

@ -731,7 +731,7 @@ static BMOpDefine bmo_edgenet_fill_def = {
*
* - One single loop; an edge is added to connect the ends
* - Two loops; two edges are added to connect the endpoints (based on the
* shortest distance between each endpont).
* shortest distance between each endpoint).
*/
static BMOpDefine bmo_edgenet_prepare_def = {
"edgenet_prepare",

View File

@ -807,6 +807,9 @@ static bool contig_ldata_across_edge(BMesh *bm, BMEdge *e, BMFace *f1, BMFace *f
}
BMVert *v1 = lef1->v;
BMVert *v2 = lef2->v;
if (v1 == v2) {
return false;
}
BLI_assert((v1 == e->v1 && v2 == e->v2) || (v1 == e->v2 && v2 == e->v1));
UNUSED_VARS_NDEBUG(v1, v2);
BMLoop *lv1f1 = lef1;

View File

@ -32,9 +32,9 @@ void ColorCorrectionNode::convertToOperations(NodeConverter &converter,
ColorCorrectionOperation *operation = new ColorCorrectionOperation();
operation->setData((NodeColorCorrection *)editorNode->storage);
operation->setRedChannelEnabled((editorNode->custom1 & 1) > 0);
operation->setGreenChannelEnabled((editorNode->custom1 & 2) > 0);
operation->setBlueChannelEnabled((editorNode->custom1 & 4) > 0);
operation->setRedChannelEnabled((editorNode->custom1 & 1) != 0);
operation->setGreenChannelEnabled((editorNode->custom1 & 2) != 0);
operation->setBlueChannelEnabled((editorNode->custom1 & 4) != 0);
converter.addOperation(operation);
converter.mapInputSocket(getInputSocket(0), operation->getInputSocket(0));

View File

@ -53,7 +53,7 @@ if(NOT WITH_HEADLESS)
include_directories(${PNG_INCLUDE_DIRS})
if(NOT APPLE)
# APPLE plaform uses full paths for linking libraries.
# APPLE platform uses full paths for linking libraries.
link_directories(${PNG_LIBPATH} ${ZLIB_LIBPATH})
endif()

View File

@ -2496,7 +2496,7 @@ void DepsgraphRelationBuilder::build_material(Material *material)
/* Animated / driven parameters (without nodetree). */
OperationKey material_key(&material->id, NodeType::SHADING, OperationCode::MATERIAL_UPDATE);
ComponentKey parameters_key(&material->id, NodeType::PARAMETERS);
add_relation(parameters_key, material_key, "Material's paramters");
add_relation(parameters_key, material_key, "Material's parameters");
/* material's nodetree */
if (material->nodetree != nullptr) {

View File

@ -46,7 +46,7 @@ class SceneBackup {
*
* NOTE: Scene can not disappear after relations update, because otherwise the entire dependency
* graph will be gone. This means we don't need to compare original scene pointer, or worry about
* freeing those if they cant' be restored: we just copy them over to a new scene. */
* freeing those if they can't be restored: we just copy them over to a new scene. */
void *sound_scene;
void *playback_handle;
void *sound_scrub_handle;

View File

@ -22,7 +22,7 @@
* EEVEE LUT generation:
*
* Routine to generate the LUT used by eevee stored in eevee_lut.h
* Theses functions are not to be used in the final executable.
* These functions are not to be used in the final executable.
*/
#include "DRW_render.h"

View File

@ -415,7 +415,7 @@ void EEVEE_materials_cache_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata)
{
/* Renderpass accumulation. */
DRWState state = DRW_STATE_WRITE_COLOR | DRW_STATE_DEPTH_EQUAL | DRW_STATE_BLEND_ADD_FULL;
/* Create an instance of each of theses passes and link them together. */
/* Create an instance of each of these passes and link them together. */
DRWPass *passes[] = {
psl->material_ps,
psl->material_cull_ps,

View File

@ -476,7 +476,7 @@ void EEVEE_motion_blur_cache_finish(EEVEE_Data *vedata)
if (vbo) {
/* Use the vbo to perform the copy on the GPU. */
GPU_vertbuf_use(vbo);
/* Perform a copy to avoid loosing it after RE_engine_frame_set(). */
/* Perform a copy to avoid losing it after RE_engine_frame_set(). */
mb_geom->vbo[mb_step] = vbo = GPU_vertbuf_duplicate(vbo);
/* Find and replace "pos" attrib name. */
GPUVertFormat *format = (GPUVertFormat *)GPU_vertbuf_get_format(vbo);

View File

@ -716,7 +716,7 @@ typedef struct EEVEE_EffectsInfo {
CameraParams past_cam_params;
CameraParams current_cam_params;
char motion_blur_step; /* Which step we are evaluating. */
int motion_blur_max; /* Maximum distance in pixels a motion blured pixel can cover. */
int motion_blur_max; /* Maximum distance in pixels a motion-blurred pixel can cover. */
float motion_blur_near_far[2]; /* Camera near/far clip distances (positive). */
bool cam_params_init;
/* TODO(fclem): Only used in render mode for now.

View File

@ -449,8 +449,8 @@ void EEVEE_renderpasses_draw(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata)
(stl->g_data->render_passes & EEVEE_RENDERPASSES_LIGHT_PASS) :
stl->g_data->render_passes;
bool is_valid = (render_pass & EEVEE_RENDERPASSES_ALL) > 0;
bool needs_color_transfer = (render_pass & EEVEE_RENDERPASSES_COLOR_PASS) > 0 &&
bool is_valid = (render_pass & EEVEE_RENDERPASSES_ALL) != 0;
bool needs_color_transfer = (render_pass & EEVEE_RENDERPASSES_COLOR_PASS) != 0 &&
DRW_state_is_opengl_render();
UNUSED_VARS(needs_color_transfer);

View File

@ -258,7 +258,7 @@ static void eevee_shader_library_ensure(void)
{
if (e_data.lib == NULL) {
e_data.lib = DRW_shader_library_create();
/* NOTE: Theses needs to be ordered by dependencies. */
/* NOTE: These need to be ordered by dependencies. */
DRW_SHADER_LIB_ADD(e_data.lib, common_math_lib);
DRW_SHADER_LIB_ADD(e_data.lib, common_math_geom_lib);
DRW_SHADER_LIB_ADD(e_data.lib, common_hair_lib);

View File

@ -60,7 +60,7 @@ vec2 sample_weights(float center_depth,
float sample_motion_length,
float offset_length)
{
/* Clasify foreground/background. */
/* Classify foreground/background. */
vec2 depth_weight = depth_compare(center_depth, sample_depth);
/* Weight if sample is overlapping or under the center pixel. */
vec2 spread_weight = spread_compare(center_motion_length, sample_motion_length, offset_length);

View File

@ -238,7 +238,7 @@ vec3 raycast(int index,
#endif
}
/* Discard backface hits. Only do this if the ray traveled enough to avoid loosing intricate
/* Discard backface hits. Only do this if the ray traveled enough to avoid losing intricate
* contact reflections. This is only used for SSReflections. */
if (discard_backface && prev_delta < 0.0 && curr_time > 4.1) {
hit = false;

View File

@ -393,7 +393,7 @@ void stroke_vertex()
is_squares = false;
}
/* Enpoints, we discard the vertices. */
/* Endpoints, we discard the vertices. */
if (ma1.x == -1 || (!is_dot && ma2.x == -1)) {
discard_vert();
return;

View File

@ -274,7 +274,7 @@ uniform bool isFirstPass;
vec2 compute_uvs(float x)
{
vec2 uv = uvcoordsvar.xy;
/* Tranform UV (loc, rot, scale) */
/* Transform UV (loc, rot, scale) */
uv = uv.x * uvRotX + uv.y * uvRotY + uvOffset;
uv += blurDir * x;
/* Wave deform. */

View File

@ -49,7 +49,7 @@ void IMAGE_shader_library_ensure(void)
{
if (e_data.lib == NULL) {
e_data.lib = DRW_shader_library_create();
/* NOTE: Theses needs to be ordered by dependencies. */
/* NOTE: These need to be ordered by dependencies. */
DRW_SHADER_LIB_ADD(e_data.lib, common_colormanagement_lib);
DRW_SHADER_LIB_ADD(e_data.lib, common_globals_lib);
DRW_SHADER_LIB_ADD(e_data.lib, common_view_lib);

View File

@ -80,7 +80,7 @@ void OVERLAY_antialiasing_init(OVERLAY_Data *vedata)
bool need_wire_expansion = (G_draw.block.sizePixel > 1.0f);
pd->antialiasing.enabled = need_wire_expansion ||
((U.gpu_flag & USER_GPU_FLAG_OVERLAY_SMOOTH_WIRE) > 0);
((U.gpu_flag & USER_GPU_FLAG_OVERLAY_SMOOTH_WIRE) != 0);
GPUTexture *color_tex = NULL;
GPUTexture *line_tex = NULL;
@ -127,7 +127,7 @@ void OVERLAY_antialiasing_cache_init(OVERLAY_Data *vedata)
if (pd->antialiasing.enabled) {
/* `antialiasing.enabled` is also enabled for wire expansion. Check here if
* anti aliasing is needed. */
const bool do_smooth_lines = (U.gpu_flag & USER_GPU_FLAG_OVERLAY_SMOOTH_WIRE) > 0;
const bool do_smooth_lines = (U.gpu_flag & USER_GPU_FLAG_OVERLAY_SMOOTH_WIRE) != 0;
DRW_PASS_CREATE(psl->antialiasing_ps, DRW_STATE_WRITE_COLOR | DRW_STATE_BLEND_ALPHA_PREMUL);

View File

@ -161,7 +161,7 @@ void OVERLAY_edit_uv_init(OVERLAY_Data *vedata)
pd->edit_uv.do_tiled_image_border_overlay = is_image_type && is_tiled_image;
pd->edit_uv.dash_length = 4.0f * UI_DPI_FAC;
pd->edit_uv.line_style = edit_uv_line_style_from_space_image(sima);
pd->edit_uv.do_smooth_wire = ((U.gpu_flag & USER_GPU_FLAG_OVERLAY_SMOOTH_WIRE) > 0);
pd->edit_uv.do_smooth_wire = ((U.gpu_flag & USER_GPU_FLAG_OVERLAY_SMOOTH_WIRE) != 0);
pd->edit_uv.do_stencil_overlay = show_overlays && do_stencil_overlay;
pd->edit_uv.draw_type = sima->dt_uvstretch;

View File

@ -1176,7 +1176,7 @@ void OVERLAY_camera_cache_populate(OVERLAY_Data *vedata, Object *ob)
invert_v3(scale);
for (int i = 0; i < 4; i++) {
mul_v3_v3(vec[i], scale);
/* Project to z=-1 plane. Makes positionning / scaling easier. (see shader) */
/* Project to z=-1 plane. Makes positioning / scaling easier. (see shader) */
mul_v2_fl(vec[i], 1.0f / fabsf(vec[i][2]));
}

View File

@ -238,7 +238,7 @@ void OVERLAY_shader_library_ensure(void)
{
if (e_data.lib == NULL) {
e_data.lib = DRW_shader_library_create();
/* NOTE: Theses needs to be ordered by dependencies. */
/* NOTE: These need to be ordered by dependencies. */
DRW_SHADER_LIB_ADD(e_data.lib, common_globals_lib);
DRW_SHADER_LIB_ADD(e_data.lib, common_overlay_lib);
DRW_SHADER_LIB_ADD(e_data.lib, common_colormanagement_lib);

View File

@ -146,7 +146,7 @@ void main()
vec4 lines = vec4(neightbor_line0.z, neightbor_line1.z, neightbor_line2.z, neightbor_line3.z);
/* Count number of line neighbors. */
float blend = dot(vec4(0.25), step(0.001, lines));
/* Only do blend if there is more than 2 neighbor. This avoid loosing too much AA. */
/* Only do blend if there are more than 2 neighbors. This avoids losing too much AA. */
blend = clamp(blend * 2.0 - 1.0, 0.0, 1.0);
fragColor = mix(fragColor, fragColor / fragColor.a, blend);
}

View File

@ -222,7 +222,7 @@ void main()
edgePos = edgeStart = ((gl_Position.xy / gl_Position.w) * 0.5 + 0.5) * sizeViewport.xy;
#ifdef SELECT_EDGES
/* HACK: to avoid loosing sub pixel object in selections, we add a bit of randomness to the
/* HACK: to avoid losing sub-pixel object in selections, we add a bit of randomness to the
* wire to at least create one fragment that will pass the occlusion query. */
/* TODO(fclem): Limit this workaround to selection. It's not very noticeable but still... */
gl_Position.xy += sizeViewportInv.xy * gl_Position.w * ((gl_VertexID % 2 == 0) ? -1.0 : 1.0);

View File

@ -18,7 +18,7 @@ void main()
gl_Position = point_world_to_ndc(world_pos);
#ifdef SELECT_EDGES
/* HACK: to avoid loosing sub pixel object in selections, we add a bit of randomness to the
/* HACK: to avoid losing sub-pixel object in selections, we add a bit of randomness to the
* wire to at least create one fragment that will pass the occlusion query. */
/* TODO(fclem): Limit this workaround to selection. It's not very noticeable but still... */
gl_Position.xy += sizeViewportInv.xy * gl_Position.w * ((gl_VertexID % 2 == 0) ? -1.0 : 1.0);

View File

@ -169,7 +169,7 @@ void main()
}
#ifdef SELECT_EDGES
/* HACK: to avoid loosing sub pixel object in selections, we add a bit of randomness to the
/* HACK: to avoid losing sub-pixel object in selections, we add a bit of randomness to the
* wire to at least create one fragment that will pass the occlusion query. */
gl_Position.xy += sizeViewportInv.xy * gl_Position.w * ((gl_VertexID % 2 == 0) ? -1.0 : 1.0);
#endif

View File

@ -120,7 +120,7 @@ void workbench_shader_library_ensure(void)
{
if (e_data.lib == NULL) {
e_data.lib = DRW_shader_library_create();
/* NOTE: Theses needs to be ordered by dependencies. */
/* NOTE: These need to be ordered by dependencies. */
DRW_SHADER_LIB_ADD(e_data.lib, common_math_lib);
DRW_SHADER_LIB_ADD(e_data.lib, common_math_geom_lib);
DRW_SHADER_LIB_ADD(e_data.lib, common_hair_lib);

View File

@ -907,7 +907,7 @@ static void extract_tris_finish(const MeshRenderData *mr,
if (mr->use_final_mesh && cache->final.tris_per_mat) {
MeshBufferCache *mbc = &cache->final;
for (int i = 0; i < mr->mat_len; i++) {
/* Theses IBOs have not been queried yet but we create them just in case they are needed
/* These IBOs have not been queried yet but we create them just in case they are needed
* later since they are not tracked by mesh_buffer_cache_create_requested(). */
if (mbc->tris_per_mat[i] == NULL) {
mbc->tris_per_mat[i] = GPU_indexbuf_calloc();
@ -1380,7 +1380,7 @@ static void extract_lines_paint_mask_iter_poly_mesh(const MeshRenderData *mr,
}
}
else {
/* Set theses unselected loop only if this edge has no other selected loop. */
/* Set these unselected loop only if this edge has no other selected loop. */
if (!BLI_BITMAP_TEST(data->select_map, e_index)) {
GPU_indexbuf_set_line_verts(&data->elb, e_index, ml_index, ml_index_other);
}
@ -5230,7 +5230,7 @@ static void *extract_skin_roots_init(const MeshRenderData *mr,
}
}
/* It's really unlikely that all verts will be roots. Resize to avoid loosing VRAM. */
/* It's really unlikely that all verts will be roots. Resize to avoid losing VRAM. */
GPU_vertbuf_data_len_set(vbo, root_len);
return NULL;

View File

@ -118,7 +118,7 @@
* half-rate linear filtering on GCN.
*
* If SMAA is applied to 64-bit color buffers, switching to point filtering
* when accesing them will increase the performance. Search for
* when accessing them will increase the performance. Search for
* 'SMAASamplePoint' to see which textures may benefit from point
* filtering, and where (which is basically the color input in the edge
* detection and resolve passes).

View File

@ -331,7 +331,7 @@ static void motionpath_calculate_update_range(MPathTarget *mpt,
int fcu_sfra = motionpath_get_prev_prev_keyframe(mpt, &fcu_keys, current_frame);
int fcu_efra = motionpath_get_next_next_keyframe(mpt, &fcu_keys, current_frame);
/* Extend range fuhrer, since acceleration compensation propagates even further away. */
/* Extend range further, since acceleration compensation propagates even further away. */
if (fcu->auto_smoothing != FCURVE_SMOOTH_NONE) {
fcu_sfra = motionpath_get_prev_prev_keyframe(mpt, &fcu_keys, fcu_sfra);
fcu_efra = motionpath_get_next_next_keyframe(mpt, &fcu_keys, fcu_efra);

View File

@ -497,7 +497,7 @@ static float heat_source_distance(LaplacianSystem *sys, int vertex, int source)
{
float closest[3], d[3], dist, cosine;
/* compute euclidian distance */
/* compute Euclidean distance */
closest_to_line_segment_v3(
closest, sys->heat.verts[vertex], sys->heat.root[source], sys->heat.tip[source]);

View File

@ -29,8 +29,8 @@ set(INC_SYS
)
set(SRC
asset_edit.c
asset_ops.c
asset_edit.cc
asset_ops.cc
)
set(LIB

View File

@ -45,7 +45,7 @@ bool ED_asset_mark_id(const bContext *C, ID *id)
id->asset_data = BKE_asset_metadata_create();
UI_icon_render_id(C, NULL, id, ICON_SIZE_PREVIEW, true);
UI_icon_render_id(C, nullptr, id, ICON_SIZE_PREVIEW, true);
return true;
}
@ -65,5 +65,5 @@ bool ED_asset_clear_id(ID *id)
bool ED_asset_can_make_single_from_context(const bContext *C)
{
/* Context needs a "id" pointer to be set for #ASSET_OT_mark()/#ASSET_OT_clear() to use. */
return CTX_data_pointer_get_type_silent(C, "id", &RNA_ID).data != NULL;
return CTX_data_pointer_get_type_silent(C, "id", &RNA_ID).data != nullptr;
}

View File

@ -64,7 +64,8 @@ static ListBase /* CollectionPointerLink */ asset_operation_get_ids_from_context
PointerRNA idptr = CTX_data_pointer_get_type(C, "id", &RNA_ID);
if (idptr.data) {
CollectionPointerLink *ctx_link = MEM_callocN(sizeof(*ctx_link), __func__);
CollectionPointerLink *ctx_link = (CollectionPointerLink *)MEM_callocN(sizeof(*ctx_link),
__func__);
ctx_link->ptr = idptr;
BLI_addtail(&list, ctx_link);
}
@ -84,7 +85,7 @@ static void asset_mark_for_idptr_list(const bContext *C,
LISTBASE_FOREACH (CollectionPointerLink *, ctx_id, ids) {
BLI_assert(RNA_struct_is_ID(ctx_id->ptr.type));
ID *id = ctx_id->ptr.data;
ID *id = (ID *)ctx_id->ptr.data;
if (id->asset_data) {
r_stats->tot_already_asset++;
continue;
@ -138,8 +139,8 @@ static int asset_mark_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
}
WM_main_add_notifier(NC_ID | NA_EDITED, NULL);
WM_main_add_notifier(NC_ASSET | NA_ADDED, NULL);
WM_main_add_notifier(NC_ID | NA_EDITED, nullptr);
WM_main_add_notifier(NC_ASSET | NA_ADDED, nullptr);
return OPERATOR_FINISHED;
}
@ -166,14 +167,14 @@ struct AssetClearResultStats {
};
static void asset_clear_from_idptr_list(const ListBase /* CollectionPointerLink */ *ids,
struct AssetClearResultStats *r_stats)
AssetClearResultStats *r_stats)
{
memset(r_stats, 0, sizeof(*r_stats));
LISTBASE_FOREACH (CollectionPointerLink *, ctx_id, ids) {
BLI_assert(RNA_struct_is_ID(ctx_id->ptr.type));
ID *id = ctx_id->ptr.data;
ID *id = (ID *)ctx_id->ptr.data;
if (!id->asset_data) {
continue;
}
@ -185,8 +186,7 @@ static void asset_clear_from_idptr_list(const ListBase /* CollectionPointerLink
}
}
static bool asset_clear_result_report(const struct AssetClearResultStats *stats,
ReportList *reports)
static bool asset_clear_result_report(const AssetClearResultStats *stats, ReportList *reports)
{
if (stats->tot_removed < 1) {
@ -210,7 +210,7 @@ static int asset_clear_exec(bContext *C, wmOperator *op)
{
ListBase ids = asset_operation_get_ids_from_context(C);
struct AssetClearResultStats stats;
AssetClearResultStats stats;
asset_clear_from_idptr_list(&ids, &stats);
BLI_freelistN(&ids);
@ -218,8 +218,8 @@ static int asset_clear_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
}
WM_main_add_notifier(NC_ID | NA_EDITED, NULL);
WM_main_add_notifier(NC_ASSET | NA_REMOVED, NULL);
WM_main_add_notifier(NC_ID | NA_EDITED, nullptr);
WM_main_add_notifier(NC_ASSET | NA_REMOVED, nullptr);
return OPERATOR_FINISHED;
}

View File

@ -2419,7 +2419,7 @@ static void adduplicateflagNurb(
memcpy(newnu->bp, &nu->bp[a], newu * newv * sizeof(BPoint));
memcpy(&newnu->bp[newu * newv], nu->bp, newu * cyclicv * sizeof(BPoint));
/* check for actvert in cylicv selection */
/* check for actvert in cyclicv selection */
if (cu->actnu == i) {
calc_duplicate_actvert(
editnurb, newnurb, cu, cu->actvert, a, (newu * newv) + cu->actvert);
@ -6102,7 +6102,7 @@ static bool curve_delete_segments(Object *obedit, View3D *v3d, const bool split)
}
if (!split && cut != -1 && nu->pntsu > 2 && !(nu->flagu & CU_NURB_CYCLIC)) {
/* start and points copied if connecting segment was deleted and not cylic spline */
/* start and points copied if connecting segment was deleted and not cyclic spline */
bezt1 = nu->bezt;
bezt2 = &nu->bezt[1];
@ -6232,7 +6232,7 @@ static bool curve_delete_segments(Object *obedit, View3D *v3d, const bool split)
}
if (!split && cut != -1 && nu->pntsu > 2 && !(nu->flagu & CU_NURB_CYCLIC)) {
/* start and points copied if connecting segment was deleted and not cylic spline */
/* start and points copied if connecting segment was deleted and not cyclic spline */
bp1 = nu->bp;
bp2 = &nu->bp[1];
@ -6352,7 +6352,7 @@ static bool curve_delete_segments(Object *obedit, View3D *v3d, const bool split)
}
if (!split && cut != -1 && nu->pntsv > 2 && !(nu->flagv & CU_NURB_CYCLIC)) {
/* start and points copied if connecting segment was deleted and not cylic spline */
/* start and points copied if connecting segment was deleted and not cyclic spline */
bp1 = nu->bp;
bp2 = &nu->bp[nu->pntsu];

View File

@ -151,7 +151,7 @@ typedef struct tGP_BrushVertexpaintData {
tGP_Grid *grid;
/** Total number of rows/cols. */
int grid_size;
/** Total number of cells elments in the grid array. */
/** Total number of cells elements in the grid array. */
int grid_len;
/** Grid sample position (used to determine distance of falloff) */
int grid_sample[2];

View File

@ -194,7 +194,7 @@ typedef enum FSMenuInsert {
FS_INSERT_SAVE = (1 << 1),
/** moves the item to the front of the list when its not already there */
FS_INSERT_FIRST = (1 << 2),
/** just append to preseve delivered order */
/** just append to preserve delivered order */
FS_INSERT_LAST = (1 << 3),
} FSMenuInsert;

View File

@ -118,7 +118,7 @@ typedef struct KeyframeEdit_CircleData {
} KeyframeEdit_CircleData;
/* ************************************************ */
/* Non-Destuctive Editing API (keyframes_edit.c) */
/* Non-Destructive Editing API (keyframes_edit.c) */
/* --- Defines for 'OK' polls + KeyframeEditData Flags --------- */

View File

@ -6837,7 +6837,7 @@ static bool ui_numedit_but_CURVE(uiBlock *block,
#ifdef USE_CONT_MOUSE_CORRECT
/* note: using 'cmp_last' is weak since there may be multiple points selected,
* but in practice this isnt really an issue */
* but in practice this isn't really an issue */
if (ui_but_is_cursor_warp(but)) {
/* OK but can go outside bounds */
data->ungrab_mval[0] = but->rect.xmin + ((cmp_last->x - cumap->curr.xmin) * zoomx);
@ -7108,7 +7108,7 @@ static bool ui_numedit_but_CURVEPROFILE(uiBlock *block,
changed = true;
#ifdef USE_CONT_MOUSE_CORRECT
/* note: using 'cmp_last' is weak since there may be multiple points selected,
* but in practice this isnt really an issue */
* but in practice this isn't really an issue */
if (ui_but_is_cursor_warp(but)) {
/* OK but can go outside bounds */
data->ungrab_mval[0] = but->rect.xmin + ((last_x - profile->view_rect.xmin) * zoomx);
@ -8617,7 +8617,7 @@ void ui_but_activate_event(bContext *C, ARegion *region, uiBut *but)
* Simulate moving the mouse over a button (or navigating to it with arrow keys).
*
* exported so menus can start with a highlighted button,
* even if the mouse isnt over it
* even if the mouse isn't over it
*/
void ui_but_activate_over(bContext *C, ARegion *region, uiBut *but)
{

View File

@ -2341,7 +2341,7 @@ void OBJECT_OT_make_local(wmOperatorType *ot)
static bool make_override_library_object_overridable_check(Main *bmain, Object *object)
{
/* An object is actually overrideable only if it is in at least one local collections.
/* An object is actually overridable only if it is in at least one local collection.
* Unfortunately 'direct link' flag is not enough here. */
LISTBASE_FOREACH (Collection *, collection, &bmain->collections) {
if (!ID_IS_LINKED(collection) && BKE_collection_has_object(collection, object)) {

View File

@ -363,7 +363,7 @@ static void screen_opengl_render_doit(const bContext *C, OGLRender *oglrender, R
}
}
else {
/* shouldnt suddenly give errors mid-render but possible */
/* shouldn't suddenly give errors mid-render but possible */
char err_out[256] = "unknown";
ImBuf *ibuf_view;
const int alpha_mode = (draw_sky) ? R_ADDSKY : R_ALPHAPREMUL;

View File

@ -554,7 +554,7 @@ static void draw_background(FileLayout *layout, View2D *v2d)
for (i = 2; (i <= layout->rows + 1); i += 2) {
sy = (int)v2d->cur.ymax - layout->offset_top - i * item_height - layout->tile_border_y;
/* Offsett pattern slightly to add scroll effect. */
/* Offset pattern slightly to add scroll effect. */
sy += round_fl_to_int(item_height * (v2d->tot.ymax - v2d->cur.ymax) / item_height);
immRectf(pos,

View File

@ -393,7 +393,7 @@ static void view3d_main_region_init(wmWindowManager *wm, ARegion *region)
keymap = WM_keymap_ensure(wm->defaultconf, "Paint Vertex Selection (Weight, Vertex)", 0, 0);
WM_event_add_keymap_handler(&region->handlers, keymap);
/* Before 'Weight/Vertex Paint' so adding curve points is not overriden. */
/* Before 'Weight/Vertex Paint' so adding curve points is not overridden. */
keymap = WM_keymap_ensure(wm->defaultconf, "Paint Curve", 0, 0);
WM_event_add_keymap_handler(&region->handlers, keymap);

View File

@ -845,7 +845,7 @@ void special_aftertrans_update__sequencer(bContext *UNUSED(C), TransInfo *t)
/* Marker transform, not especially nice but we may want to move markers
* at the same time as strips in the Video Sequencer. */
if (sseq->flag & SEQ_MARKER_TRANS) {
/* cant use TFM_TIME_EXTEND
/* can't use TFM_TIME_EXTEND
* for some reason EXTEND is changed into TRANSLATE, so use frame_side instead */
if (t->mode == TFM_SEQ_SLIDE) {

View File

@ -64,6 +64,7 @@ static void applyShrinkFatten(TransInfo *t, const int UNUSED(mval[2]))
int i;
char str[UI_MAX_DRAW_STR];
size_t ofs = 0;
UnitSettings *unit = &t->scene->unit;
distance = t->values[0];
@ -74,15 +75,21 @@ static void applyShrinkFatten(TransInfo *t, const int UNUSED(mval[2]))
t->values_final[0] = distance;
/* header print for NumInput */
ofs += BLI_strncpy_rlen(str + ofs, TIP_("Shrink/Fatten:"), sizeof(str) - ofs);
ofs += BLI_strncpy_rlen(str + ofs, TIP_("Shrink/Fatten: "), sizeof(str) - ofs);
if (hasNumInput(&t->num)) {
char c[NUM_STR_REP_LEN];
outputNumInput(&(t->num), c, &t->scene->unit);
ofs += BLI_snprintf(str + ofs, sizeof(str) - ofs, " %s", c);
outputNumInput(&(t->num), c, unit);
ofs += BLI_snprintf(str + ofs, sizeof(str) - ofs, "%s", c);
}
else {
/* default header print */
ofs += BLI_snprintf(str + ofs, sizeof(str) - ofs, " %.4f", distance);
if (unit != NULL) {
ofs += BKE_unit_value_as_string(
str + ofs, sizeof(str) - ofs, distance * unit->scale_length, 4, B_UNIT_LENGTH, unit, true);
}
else {
ofs += BLI_snprintf(str + ofs, sizeof(str) - ofs, "%.4f", distance);
}
}
if (t->proptext[0]) {

View File

@ -39,7 +39,7 @@ set(SRC
ed_transverts.c
ed_util.c
ed_util_imbuf.c
ed_util_ops.c
ed_util_ops.cc
gizmo_utils.c
numinput.c
select_utils.c

View File

@ -22,6 +22,9 @@
#include <string.h>
#include "DNA_space_types.h"
#include "DNA_windowmanager_types.h"
#include "BLI_fileops.h"
#include "BLI_utildefines.h"
@ -33,9 +36,6 @@
#include "BLT_translation.h"
#include "DNA_space_types.h"
#include "DNA_windowmanager_types.h"
#include "ED_render.h"
#include "ED_undo.h"
#include "ED_util.h"
@ -56,7 +56,7 @@ static bool lib_id_preview_editing_poll(bContext *C)
const PointerRNA idptr = CTX_data_pointer_get(C, "id");
BLI_assert(!idptr.data || RNA_struct_is_ID(idptr.type));
const ID *id = idptr.data;
const ID *id = (ID *)idptr.data;
if (!id) {
return false;
}
@ -88,11 +88,11 @@ static int lib_id_load_custom_preview_exec(bContext *C, wmOperator *op)
}
PointerRNA idptr = CTX_data_pointer_get(C, "id");
ID *id = idptr.data;
ID *id = (ID *)idptr.data;
BKE_previewimg_id_custom_set(id, path);
WM_event_add_notifier(C, NC_ASSET, NULL);
WM_event_add_notifier(C, NC_ASSET, nullptr);
return OPERATOR_FINISHED;
}
@ -123,7 +123,7 @@ static void ED_OT_lib_id_load_custom_preview(wmOperatorType *ot)
static int lib_id_generate_preview_exec(bContext *C, wmOperator *UNUSED(op))
{
PointerRNA idptr = CTX_data_pointer_get(C, "id");
ID *id = idptr.data;
ID *id = (ID *)idptr.data;
ED_preview_kill_jobs(CTX_wm_manager(C), CTX_data_main(C));
@ -131,9 +131,9 @@ static int lib_id_generate_preview_exec(bContext *C, wmOperator *UNUSED(op))
if (preview) {
BKE_previewimg_clear(preview);
}
UI_icon_render_id(C, NULL, id, ICON_SIZE_PREVIEW, true);
UI_icon_render_id(C, nullptr, id, ICON_SIZE_PREVIEW, true);
WM_event_add_notifier(C, NC_ASSET, NULL);
WM_event_add_notifier(C, NC_ASSET, nullptr);
return OPERATOR_FINISHED;
}
@ -169,15 +169,15 @@ static int lib_id_fake_user_toggle_exec(bContext *C, wmOperator *op)
idptr = RNA_property_pointer_get(&pprop.ptr, pprop.prop);
}
if ((pprop.prop == NULL) || RNA_pointer_is_null(&idptr) || !RNA_struct_is_ID(idptr.type)) {
if ((pprop.prop == nullptr) || RNA_pointer_is_null(&idptr) || !RNA_struct_is_ID(idptr.type)) {
BKE_report(
op->reports, RPT_ERROR, "Incorrect context for running data-block fake user toggling");
return OPERATOR_CANCELLED;
}
ID *id = idptr.data;
ID *id = (ID *)idptr.data;
if ((id->lib != NULL) || (ELEM(GS(id->name), ID_GR, ID_SCE, ID_SCR, ID_TXT, ID_OB, ID_WS))) {
if ((id->lib != nullptr) || (ELEM(GS(id->name), ID_GR, ID_SCE, ID_SCR, ID_TXT, ID_OB, ID_WS))) {
BKE_report(op->reports, RPT_ERROR, "Data-block type does not support fake user");
return OPERATOR_CANCELLED;
}
@ -217,14 +217,14 @@ static int lib_id_unlink_exec(bContext *C, wmOperator *op)
idptr = RNA_property_pointer_get(&pprop.ptr, pprop.prop);
}
if ((pprop.prop == NULL) || RNA_pointer_is_null(&idptr) || !RNA_struct_is_ID(idptr.type)) {
if ((pprop.prop == nullptr) || RNA_pointer_is_null(&idptr) || !RNA_struct_is_ID(idptr.type)) {
BKE_report(
op->reports, RPT_ERROR, "Incorrect context for running data-block fake user toggling");
return OPERATOR_CANCELLED;
}
memset(&idptr, 0, sizeof(idptr));
RNA_property_pointer_set(&pprop.ptr, pprop.prop, idptr, NULL);
RNA_property_pointer_set(&pprop.ptr, pprop.prop, idptr, nullptr);
RNA_property_update(C, &pprop.ptr, pprop.prop);
return OPERATOR_FINISHED;

View File

@ -260,8 +260,8 @@ PyDoc_STRVAR(Operators_sequential_split_doc,
"\n"
" .. tip::\n"
"\n"
" By specifiying a starting and stopping predicate allows\n"
" the chains to overlapp rather than chains partitioning.\n"
" By specifying a starting and stopping predicate allows\n"
" the chains to overlap rather than chains partitioning.\n"
"\n"
" :arg starting_pred: The predicate on a point that expresses the\n"
" starting condition. Each time this condition is verified, a new chain begins\n"

View File

@ -228,7 +228,7 @@ class ViewMap {
*/
ViewVertex *InsertViewVertex(SVertex *iVertex, vector<ViewEdge *> &newViewEdges);
/* connects a FEdge to the graph trough a SVertex */
/* connects a FEdge to the graph through a SVertex */
// FEdge *Connect(FEdge *ioEdge, SVertex *ioVertex);
/* Clean temporary FEdges created by chaining */
@ -1085,13 +1085,13 @@ class ViewEdge : public Interface1D {
return __B;
}
/*! Returns the first FEdge that constitues this ViewEdge. */
/*! Returns the first FEdge that constitutes this ViewEdge. */
inline FEdge *fedgeA()
{
return _FEdgeA;
}
/*! Returns the last FEdge that constitues this ViewEdge. */
/*! Returns the last FEdge that constitutes this ViewEdge. */
inline FEdge *fedgeB()
{
return _FEdgeB;

View File

@ -128,7 +128,7 @@ void GPU_batch_program_set_builtin_with_config(GPUBatch *batch,
eGPUShaderConfig sh_cfg);
/* Will only work after setting the batch program. */
/* TODO(fclem): Theses needs to be replaced by GPU_shader_uniform_* with explicit shader. */
/* TODO(fclem): These need to be replaced by GPU_shader_uniform_* with explicit shader. */
#define GPU_batch_uniform_1i(batch, name, x) GPU_shader_uniform_1i((batch)->shader, name, x);
#define GPU_batch_uniform_1b(batch, name, x) GPU_shader_uniform_1b((batch)->shader, name, x);
#define GPU_batch_uniform_1f(batch, name, x) GPU_shader_uniform_1f((batch)->shader, name, x);

View File

@ -308,7 +308,7 @@ static void detect_workarounds()
if (GPU_type_matches(GPU_DEVICE_INTEL, GPU_OS_WIN, GPU_DRIVER_OFFICIAL) && !GLEW_VERSION_4_5) {
GLContext::copy_image_support = false;
}
/* Special fix for theses specific GPUs.
/* Special fix for these specific GPUs.
* Without this workaround, blender crashes on startup. (see T72098) */
if (GPU_type_matches(GPU_DEVICE_INTEL, GPU_OS_WIN, GPU_DRIVER_OFFICIAL) &&
(strstr(renderer, "HD Graphics 620") || strstr(renderer, "HD Graphics 630"))) {

View File

@ -43,7 +43,7 @@ class GLVaoCache;
class GLSharedOrphanLists {
public:
/** Mutex for the bellow structures. */
/** Mutex for the below structures. */
std::mutex lists_mutex;
/** Buffers and textures are shared across context. Any context can free them. */
Vector<GLuint> textures;
@ -92,7 +92,7 @@ class GLContext : public Context {
*/
Set<GLVaoCache *> vao_caches_;
Set<GPUFrameBuffer *> framebuffers_;
/** Mutex for the bellow structures. */
/** Mutex for the below structures. */
std::mutex lists_mutex_;
/** VertexArrays and framebuffers are not shared across context. */
Vector<GLuint> orphaned_vertarrays_;

View File

@ -57,7 +57,7 @@ in float dummy;
vec2 do_widget(void)
{
/* Offset to avoid loosing pixels (mimics conservative rasterization). */
/* Offset to avoid losing pixels (mimics conservative rasterization). */
const vec2 ofs = vec2(0.5, -0.5);
lineWidth = abs(rect.x - recti.x);
vec2 emboss_ofs = vec2(0.0, -lineWidth);

View File

@ -293,7 +293,7 @@ typedef struct Brush {
int curve_preset;
/* Maximun distance to search fake neighbors from a vertex. */
/* Maximum distance to search fake neighbors from a vertex. */
float disconnected_distance_max;
int deform_target;

View File

@ -166,7 +166,7 @@ typedef struct ClothSimSettings {
/** Mechanical damping of shear springs. */
float shear_damp;
/** The maximum lenght an internal spring can have during creation. */
/** The maximum length an internal spring can have during creation. */
float internal_spring_max_length;
/** How much the interal spring can diverge from the vertex normal during creation. */
float internal_spring_max_diversion;

View File

@ -182,7 +182,7 @@ typedef struct ThickGpencilModifierData {
int flag;
/** Relative thickness factor. */
float thickness_fac;
/** Absolute thickness overide. */
/** Absolute thickness override. */
int thickness;
/** Custom index for passes. */
int layer_pass;

View File

@ -236,7 +236,7 @@
.flag = 0, \
}
/* Defines are scattered accross too many files, they need to be moved to DNA. */
/* Defines are scattered across too many files, they need to be moved to DNA. */
#if 0
#define _DNA_DEFAULT_DataTransferModifierData \
{ \

View File

@ -134,7 +134,7 @@ bool RNA_property_overridable_get(PointerRNA *ptr, PropertyRNA *prop)
/* Special handling for insertions of constraints or modifiers... */
/* TODO Note We may want to add a more generic system to RNA
* (like a special property in struct of items)
* if we get more overrideable collections,
* if we get more overridable collections,
* for now we can live with those special-cases handling I think. */
if (RNA_struct_is_a(ptr->type, &RNA_Constraint)) {
bConstraint *con = ptr->data;

View File

@ -168,6 +168,7 @@ static const EnumPropertyItem rna_enum_gpencil_caps_modes_items[] = {
# include "BKE_action.h"
# include "BKE_animsys.h"
# include "BKE_deform.h"
# include "BKE_gpencil.h"
# include "BKE_gpencil_curve.h"
# include "BKE_gpencil_geom.h"
@ -831,6 +832,59 @@ static void rna_GPencil_stroke_point_update(ID *id, bGPDstroke *stroke)
}
}
static float rna_GPencilStrokePoints_weight_get(bGPDstroke *stroke,
ReportList *reports,
int vertex_group_index,
int point_index)
{
MDeformVert *dvert = stroke->dvert;
if (dvert == NULL) {
BKE_report(reports, RPT_ERROR, "Groups: No groups for this stroke");
return -1.0f;
}
if (dvert->totweight <= vertex_group_index || vertex_group_index < 0) {
BKE_report(reports, RPT_ERROR, "Groups: index out of range");
return -1.0f;
}
if (stroke->totpoints <= point_index || point_index < 0) {
BKE_report(reports, RPT_ERROR, "GPencilStrokePoints: index out of range");
return -1.0f;
}
MDeformVert *pt_dvert = stroke->dvert + point_index;
MDeformWeight *dw = BKE_defvert_find_index(pt_dvert, vertex_group_index);
if (dw) {
return dw->weight;
}
return -1.0f;
}
static void rna_GPencilStrokePoints_weight_set(
bGPDstroke *stroke, ReportList *reports, int vertex_group_index, int point_index, float weight)
{
BKE_gpencil_dvert_ensure(stroke);
MDeformVert *dvert = stroke->dvert;
if (dvert == NULL) {
BKE_report(reports, RPT_ERROR, "Groups: No groups for this stroke");
return;
}
if (stroke->totpoints <= point_index || point_index < 0) {
BKE_report(reports, RPT_ERROR, "GPencilStrokePoints: index out of range");
return;
}
MDeformVert *pt_dvert = stroke->dvert + point_index;
MDeformWeight *dw = BKE_defvert_ensure_index(pt_dvert, vertex_group_index);
if (dw) {
dw->weight = weight;
}
}
static bGPDstroke *rna_GPencil_stroke_new(bGPDframe *frame)
{
bGPDstroke *stroke = BKE_gpencil_stroke_new(0, 0, 1.0f);
@ -1069,21 +1123,6 @@ static void rna_GPencil_clear(bGPdata *gpd)
WM_main_add_notifier(NC_GPENCIL | ND_DATA | NA_EDITED, NULL);
}
static void rna_GpencilVertex_groups_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
{
bGPDstroke *gps = ptr->data;
if (gps->dvert) {
MDeformVert *dvert = gps->dvert;
rna_iterator_array_begin(
iter, (void *)dvert->dw, sizeof(MDeformWeight), dvert->totweight, 0, NULL);
}
else {
rna_iterator_array_begin(iter, NULL, 0, 0, 0, NULL);
}
}
static char *rna_GreasePencilGrid_path(PointerRNA *UNUSED(ptr))
{
return BLI_strdup("grid");
@ -1293,6 +1332,54 @@ static void rna_def_gpencil_stroke_points_api(BlenderRNA *brna, PropertyRNA *cpr
func = RNA_def_function(srna, "update", "rna_GPencil_stroke_point_update");
RNA_def_function_ui_description(func, "Recalculate internal triangulation data");
RNA_def_function_flag(func, FUNC_USE_SELF_ID);
func = RNA_def_function(srna, "weight_get", "rna_GPencilStrokePoints_weight_get");
RNA_def_function_ui_description(func, "Get vertex group point weight");
RNA_def_function_flag(func, FUNC_USE_REPORTS);
RNA_def_int(func,
"vertex_group_index",
0,
0,
INT_MAX,
"Vertex Group Index",
"Index of Vertex Group in the array of groups",
0,
INT_MAX);
RNA_def_int(func,
"point_index",
0,
0,
INT_MAX,
"Point Index",
"Index of the Point in the array",
0,
INT_MAX);
parm = RNA_def_float(
func, "weight", 0, -FLT_MAX, FLT_MAX, "Weight", "Point Weight", -FLT_MAX, FLT_MAX);
RNA_def_function_return(func, parm);
func = RNA_def_function(srna, "weight_set", "rna_GPencilStrokePoints_weight_set");
RNA_def_function_ui_description(func, "Set vertex group point weight");
RNA_def_function_flag(func, FUNC_USE_REPORTS);
RNA_def_int(func,
"vertex_group_index",
0,
0,
INT_MAX,
"Vertex Group Index",
"Index of Vertex Group in the array of groups",
0,
INT_MAX);
RNA_def_int(func,
"point_index",
0,
0,
INT_MAX,
"Point Index",
"Index of the Point in the array",
0,
INT_MAX);
RNA_def_float(func, "weight", 0, -FLT_MAX, FLT_MAX, "Weight", "Point Weight", -FLT_MAX, FLT_MAX);
}
/* This information is read only and it can be used by add-ons */
@ -1520,21 +1607,6 @@ static void rna_def_gpencil_stroke(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Stroke Points", "Stroke data points");
rna_def_gpencil_stroke_points_api(brna, prop);
/* vertex groups */
prop = RNA_def_property(srna, "groups", PROP_COLLECTION, PROP_NONE);
RNA_def_property_collection_funcs(prop,
"rna_GpencilVertex_groups_begin",
"rna_iterator_array_next",
"rna_iterator_array_end",
"rna_iterator_array_get",
NULL,
NULL,
NULL,
NULL);
RNA_def_property_struct_type(prop, "GpencilVertexGroupElement");
RNA_def_property_ui_text(
prop, "Groups", "Weights for the vertex groups this vertex is member of");
/* Triangles */
prop = RNA_def_property(srna, "triangles", PROP_COLLECTION, PROP_NONE);
RNA_def_property_collection_sdna(prop, NULL, "triangles", "tot_triangles");

View File

@ -288,7 +288,7 @@ void RNA_api_mesh(StructRNA *srna)
"Define custom split normals of this mesh "
"(use zero-vectors to keep auto ones)");
RNA_def_function_flag(func, FUNC_USE_REPORTS);
/* TODO, see how array size of 0 works, this shouldnt be used */
/* TODO, see how array size of 0 works, this shouldn't be used */
parm = RNA_def_float_array(func, "normals", 1, NULL, -1.0f, 1.0f, "", "Normals", 0.0f, 0.0f);
RNA_def_property_multi_array(parm, 2, normals_array_dim);
RNA_def_parameter_flags(parm, PROP_DYNAMIC, PARM_REQUIRED);
@ -301,7 +301,7 @@ void RNA_api_mesh(StructRNA *srna)
"Define custom split normals of this mesh, from vertices' normals "
"(use zero-vectors to keep auto ones)");
RNA_def_function_flag(func, FUNC_USE_REPORTS);
/* TODO, see how array size of 0 works, this shouldnt be used */
/* TODO, see how array size of 0 works, this shouldn't be used */
parm = RNA_def_float_array(func, "normals", 1, NULL, -1.0f, 1.0f, "", "Normals", 0.0f, 0.0f);
RNA_def_property_multi_array(parm, 2, normals_array_dim);
RNA_def_parameter_flags(parm, PROP_DYNAMIC, PARM_REQUIRED);

View File

@ -5381,7 +5381,7 @@ static void def_sh_tex_pointdensity(StructRNA *srna)
func = RNA_def_function(srna, "calc_point_density", "rna_ShaderNodePointDensity_density_calc");
RNA_def_function_ui_description(func, "Calculate point density");
RNA_def_pointer(func, "depsgraph", "Depsgraph", "", "");
/* TODO, See how array size of 0 works, this shouldnt be used. */
/* TODO, See how array size of 0 works, this shouldn't be used. */
parm = RNA_def_float_array(func, "rgba_values", 1, NULL, 0, 0, "", "RGBA Values", 0, 0);
RNA_def_parameter_flags(parm, PROP_DYNAMIC, 0);
RNA_def_function_output(func, parm);

View File

@ -2122,7 +2122,7 @@ static void rna_def_vertex_group(BlenderRNA *brna)
func = RNA_def_function(srna, "add", "rna_VertexGroup_vertex_add");
RNA_def_function_ui_description(func, "Add vertices to the group");
RNA_def_function_flag(func, FUNC_USE_REPORTS | FUNC_USE_SELF_ID);
/* TODO, see how array size of 0 works, this shouldnt be used */
/* TODO, see how array size of 0 works, this shouldn't be used */
parm = RNA_def_int_array(func, "index", 1, NULL, 0, 0, "", "Index List", 0, 0);
RNA_def_parameter_flags(parm, PROP_DYNAMIC, PARM_REQUIRED);
parm = RNA_def_float(func, "weight", 0, 0.0f, 1.0f, "", "Vertex weight", 0.0f, 1.0f);
@ -2133,7 +2133,7 @@ static void rna_def_vertex_group(BlenderRNA *brna)
func = RNA_def_function(srna, "remove", "rna_VertexGroup_vertex_remove");
RNA_def_function_ui_description(func, "Remove a vertex from the group");
RNA_def_function_flag(func, FUNC_USE_REPORTS | FUNC_USE_SELF_ID);
/* TODO, see how array size of 0 works, this shouldnt be used */
/* TODO, see how array size of 0 works, this shouldn't be used */
parm = RNA_def_int_array(func, "index", 1, NULL, 0, 0, "", "Index List", 0, 0);
RNA_def_parameter_flags(parm, PROP_DYNAMIC, PARM_REQUIRED);
@ -2180,14 +2180,14 @@ static void rna_def_face_map(BlenderRNA *brna)
func = RNA_def_function(srna, "add", "rna_FaceMap_face_add");
RNA_def_function_ui_description(func, "Add vertices to the group");
RNA_def_function_flag(func, FUNC_USE_REPORTS | FUNC_USE_SELF_ID);
/* TODO, see how array size of 0 works, this shouldnt be used */
/* TODO, see how array size of 0 works, this shouldn't be used */
parm = RNA_def_int_array(func, "index", 1, NULL, 0, 0, "", "Index List", 0, 0);
RNA_def_parameter_flags(parm, PROP_DYNAMIC, PARM_REQUIRED);
func = RNA_def_function(srna, "remove", "rna_FaceMap_face_remove");
RNA_def_function_ui_description(func, "Remove a vertex from the group");
RNA_def_function_flag(func, FUNC_USE_REPORTS | FUNC_USE_SELF_ID);
/* TODO, see how array size of 0 works, this shouldnt be used */
/* TODO, see how array size of 0 works, this shouldn't be used */
parm = RNA_def_int_array(func, "index", 1, NULL, 0, 0, "", "Index List", 0, 0);
RNA_def_parameter_flags(parm, PROP_DYNAMIC, PARM_REQUIRED);
}

View File

@ -439,7 +439,7 @@ const EnumPropertyItem rna_enum_clip_editor_mode_items[] = {
{0, NULL, 0, NULL, NULL},
};
/* Actually populated dynamically trough a function,
/* Actually populated dynamically through a function,
* but helps for context-less access (e.g. doc, i18n...). */
static const EnumPropertyItem buttons_context_items[] = {
{BCONTEXT_TOOL, "TOOL", ICON_TOOL_SETTINGS, "Tool", "Active Tool and Workspace settings"},

View File

@ -437,13 +437,13 @@ BLI_INLINE int isPolyValid(const float coords[][2], const uint nr)
for (int i = 0; i < nr; i++) {
sub_v2_v2v2(curr_vec, coords[i], prev_co);
/* Check ovelap between directly adjacent vertices. */
/* Check overlap between directly adjacent vertices. */
const float curr_len = normalize_v2(curr_vec);
if (curr_len < FLT_EPSILON) {
return MOD_SDEF_BIND_RESULT_OVERLAP_ERR;
}
/* Check ovelap between vertices skipping one. */
/* Check overlap between vertices skipping one. */
if (len_squared_v2v2(prev_prev_co, coords[i]) < FLT_EPSILON * FLT_EPSILON) {
return MOD_SDEF_BIND_RESULT_OVERLAP_ERR;
}

View File

@ -293,7 +293,7 @@ static int bpy_bmesh_select_mode_set(BPy_BMesh *self, PyObject *value)
return -1;
}
if (flag == 0) {
PyErr_SetString(PyExc_TypeError, "bm.select_mode: cant assignt an empty value");
PyErr_SetString(PyExc_TypeError, "bm.select_mode: can't assign an empty value");
return -1;
}

View File

@ -1971,7 +1971,7 @@ void RE_RenderFrame(Render *re,
if (write_still && !G.is_break) {
if (BKE_imtype_is_movie(rd.im_format.imtype)) {
/* operator checks this but in case its called from elsewhere */
printf("Error: cant write single images with a movie format!\n");
printf("Error: can't write single images with a movie format!\n");
}
else {
char name[FILE_MAX];

View File

@ -51,7 +51,7 @@ typedef struct SeqRenderData {
bool is_proxy_render;
bool is_prefetch_render;
int view_id;
/* ID of task for asigning temp cache entries to particular task(thread, etc.) */
/* ID of task for assigning temp cache entries to particular task(thread, etc.) */
eSeqTaskId task_id;
/* special case for OpenGL render */

View File

@ -166,7 +166,7 @@ typedef struct SeqCacheKey {
float timeline_frame; /* Only for reference - used for freeing when cache is full. */
float cost; /* In short: render time(s) divided by playback frame duration(s) */
bool is_temp_cache; /* this cache entry will be freed before rendering next frame */
/* ID of task for asigning temp cache entries to particular task(thread, etc.) */
/* ID of task for assigning temp cache entries to particular task(thread, etc.) */
eSeqTaskId task_id;
int type;
} SeqCacheKey;

View File

@ -346,7 +346,7 @@ static const char *wm_area_name(ScrArea *area)
SPACE_NAME(SPACE_TOPBAR);
SPACE_NAME(SPACE_STATUSBAR);
default:
return "Unkown Space";
return "Unknown Space";
}
}

View File

@ -2099,7 +2099,7 @@ static int wm_handler_operator_call(bContext *C,
handler->op = NULL;
}
/* Putting back screen context, reval can pass trough after modal failures! */
/* Putting back screen context, reval can pass through after modal failures! */
if ((retval & OPERATOR_PASS_THROUGH) || wm_event_always_pass(event)) {
CTX_wm_area_set(C, area);
CTX_wm_region_set(C, region);

View File

@ -74,7 +74,7 @@ endif()
if(WITH_TBB)
blender_include_dirs(${TBB_INCLUDE_DIRS})
if(NOT APPLE)
# APPLE plaform uses full paths for linking libraries.
# APPLE platform uses full paths for linking libraries.
link_directories(${LIBDIR}/tbb/lib)
endif()
endif()