diff options
author | Joseph Eagar <joeedh@gmail.com> | 2021-06-26 23:00:26 +0300 |
---|---|---|
committer | Joseph Eagar <joeedh@gmail.com> | 2021-06-26 23:00:26 +0300 |
commit | 83c491f044db0072143801b03aded573ed7093f9 (patch) | |
tree | 45376aedcded9033be0b795a205c42638c345ef9 /source/blender | |
parent | 7ef7843ada944a5530ff4de812a5684e39809142 (diff) | |
parent | abc62003314af2b39136bf43031590d4fbfb72df (diff) |
Merge branch 'master' into temp_bmesh_multires
Diffstat (limited to 'source/blender')
1097 files changed, 10333 insertions, 5799 deletions
diff --git a/source/blender/blenfont/intern/blf.c b/source/blender/blenfont/intern/blf.c index 4d483934717..7428798581d 100644 --- a/source/blender/blenfont/intern/blf.c +++ b/source/blender/blenfont/intern/blf.c @@ -206,7 +206,7 @@ int BLF_load_mem(const char *name, const unsigned char *mem, int mem_size) { int i = blf_search(name); if (i >= 0) { - /*font = global_font[i];*/ /*UNUSED*/ + // font = global_font[i]; /* UNUSED */ return i; } return BLF_load_mem_unique(name, mem, mem_size); diff --git a/source/blender/blenfont/intern/blf_internal.h b/source/blender/blenfont/intern/blf_internal.h index ada772c53d2..63e1eb999cd 100644 --- a/source/blender/blenfont/intern/blf_internal.h +++ b/source/blender/blenfont/intern/blf_internal.h @@ -38,7 +38,7 @@ unsigned int blf_hash(unsigned int val); char *blf_dir_search(const char *file); char *blf_dir_metrics_search(const char *filename); -/* int blf_dir_split(const char *str, char *file, int *size); */ /* UNUSED */ +/* int blf_dir_split(const char *str, char *file, int *size); */ /* UNUSED */ int blf_font_init(void); void blf_font_exit(void); diff --git a/source/blender/blenkernel/BKE_DerivedMesh.h b/source/blender/blenkernel/BKE_DerivedMesh.h index 092eec578c9..684296381eb 100644 --- a/source/blender/blenkernel/BKE_DerivedMesh.h +++ b/source/blender/blenkernel/BKE_DerivedMesh.h @@ -329,7 +329,7 @@ void DM_copy_vert_data(struct DerivedMesh *source, int dest_index, int count); -/*sets up mpolys for a DM based on face iterators in source*/ +/* Sets up mpolys for a DM based on face iterators in source. */ void DM_DupPolys(DerivedMesh *source, DerivedMesh *target); void DM_ensure_normals(DerivedMesh *dm); @@ -345,7 +345,7 @@ void DM_interp_vert_data(struct DerivedMesh *source, void mesh_get_mapped_verts_coords(struct Mesh *me_eval, float (*r_cos)[3], const int totcos); -/* same as above but wont use render settings */ +/* same as above but won't use render settings */ struct Mesh *editbmesh_get_eval_cage(struct Depsgraph *depsgraph, struct Scene *scene, struct Object *, diff --git a/source/blender/blenkernel/BKE_action.h b/source/blender/blenkernel/BKE_action.h index 3d81fcba37d..9f69c5e3976 100644 --- a/source/blender/blenkernel/BKE_action.h +++ b/source/blender/blenkernel/BKE_action.h @@ -108,7 +108,7 @@ void action_group_colors_sync(struct bActionGroup *grp, const struct bActionGrou /* Add a new action group with the given name to the action */ struct bActionGroup *action_groups_add_new(struct bAction *act, const char name[]); -/* Add given channel into (active) group */ +/* Add given channel into (active) group */ void action_groups_add_channel(struct bAction *act, struct bActionGroup *agrp, struct FCurve *fcurve); diff --git a/source/blender/blenkernel/BKE_animsys.h b/source/blender/blenkernel/BKE_animsys.h index d43332ae1ac..030560015a9 100644 --- a/source/blender/blenkernel/BKE_animsys.h +++ b/source/blender/blenkernel/BKE_animsys.h @@ -242,7 +242,7 @@ bool BKE_animsys_rna_path_resolve(struct PointerRNA *ptr, bool BKE_animsys_read_from_rna_path(struct PathResolvedRNA *anim_rna, float *r_value); bool BKE_animsys_write_to_rna_path(struct PathResolvedRNA *anim_rna, const float value); -/* Evaluation loop for evaluating animation data */ +/* Evaluation loop for evaluating animation data. */ void BKE_animsys_evaluate_animdata(struct ID *id, struct AnimData *adt, const struct AnimationEvalContext *anim_eval_context, diff --git a/source/blender/blenkernel/BKE_armature.h b/source/blender/blenkernel/BKE_armature.h index 112b8bf3ad4..07b7aa2ec50 100644 --- a/source/blender/blenkernel/BKE_armature.h +++ b/source/blender/blenkernel/BKE_armature.h @@ -49,24 +49,30 @@ typedef struct EditBone { struct EditBone *next, *prev; /** User-Defined Properties on this Bone */ struct IDProperty *prop; - /** Editbones have a one-way link (i.e. children refer + /** + * Editbones have a one-way link (i.e. children refer * to parents. This is converted to a two-way link for - * normal bones when leaving editmode. */ + * normal bones when leaving editmode. + */ struct EditBone *parent; /** (64 == MAXBONENAME) */ char name[64]; - /** Roll along axis. We'll ultimately use the axis/angle method + /** + * Roll along axis. We'll ultimately use the axis/angle method * for determining the transformation matrix of the bone. The axis * is tail-head while roll provides the angle. Refer to Graphics - * Gems 1 p. 466 (section IX.6) if it's not already in here somewhere*/ + * Gems 1 p. 466 (section IX.6) if it's not already in here somewhere. + */ float roll; /** Orientation and length is implicit during editing */ float head[3]; float tail[3]; - /** All joints are considered to have zero rotation with respect to + /** + * All joints are considered to have zero rotation with respect to * their parents. Therefore any rotations specified during the - * animation are automatically relative to the bones' rest positions*/ + * animation are automatically relative to the bones' rest positions. + */ int flag; int layer; char inherit_scale_mode; diff --git a/source/blender/blenkernel/BKE_attribute.h b/source/blender/blenkernel/BKE_attribute.h index 30a595dba8e..6a1f1feb14f 100644 --- a/source/blender/blenkernel/BKE_attribute.h +++ b/source/blender/blenkernel/BKE_attribute.h @@ -38,12 +38,16 @@ struct ID; struct ReportList; /* Attribute.domain */ +/** + * \warning: Careful when changing existing items. Arrays may be initialized from this (e.g. + * #DATASET_layout_hierarchy). + */ typedef enum AttributeDomain { ATTR_DOMAIN_AUTO = -1, /* Use for nodes to choose automatically based on other data. */ ATTR_DOMAIN_POINT = 0, /* Mesh, Hair or PointCloud Point */ ATTR_DOMAIN_EDGE = 1, /* Mesh Edge */ - ATTR_DOMAIN_CORNER = 2, /* Mesh Corner */ - ATTR_DOMAIN_FACE = 3, /* Mesh Face */ + ATTR_DOMAIN_FACE = 2, /* Mesh Face */ + ATTR_DOMAIN_CORNER = 3, /* Mesh Corner */ ATTR_DOMAIN_CURVE = 4, /* Hair Curve */ ATTR_DOMAIN_NUM diff --git a/source/blender/blenkernel/BKE_attribute_math.hh b/source/blender/blenkernel/BKE_attribute_math.hh index ba683362e69..2ce41e95b65 100644 --- a/source/blender/blenkernel/BKE_attribute_math.hh +++ b/source/blender/blenkernel/BKE_attribute_math.hh @@ -306,7 +306,7 @@ template<> struct DefaultMixerStruct<float3> { }; template<> struct DefaultMixerStruct<ColorGeometry4f> { /* Use a special mixer for colors. ColorGeometry4f can't be added/multiplied, because this is not - * something one should usually do with colors. */ + * something one should usually do with colors. */ using type = ColorGeometryMixer; }; template<> struct DefaultMixerStruct<int> { diff --git a/source/blender/blenkernel/BKE_blender_version.h b/source/blender/blenkernel/BKE_blender_version.h index 1767077fa45..bac982708bc 100644 --- a/source/blender/blenkernel/BKE_blender_version.h +++ b/source/blender/blenkernel/BKE_blender_version.h @@ -39,7 +39,7 @@ extern "C" { /* Blender file format version. */ #define BLENDER_FILE_VERSION BLENDER_VERSION -#define BLENDER_FILE_SUBVERSION 4 +#define BLENDER_FILE_SUBVERSION 5 /* Minimum Blender version that supports reading file written with the current * version. Older Blender versions will test this and show a warning if the file diff --git a/source/blender/blenkernel/BKE_blendfile.h b/source/blender/blenkernel/BKE_blendfile.h index 429e294a337..3e0a343a766 100644 --- a/source/blender/blenkernel/BKE_blendfile.h +++ b/source/blender/blenkernel/BKE_blendfile.h @@ -25,6 +25,7 @@ extern "C" { struct BlendFileData; struct BlendFileReadParams; +struct BlendFileReadReport; struct ID; struct Main; struct MemFile; @@ -35,7 +36,7 @@ struct bContext; void BKE_blendfile_read_setup_ex(struct bContext *C, struct BlendFileData *bfd, const struct BlendFileReadParams *params, - struct ReportList *reports, + struct BlendFileReadReport *reports, /* Extra args. */ const bool startup_update_defaults, const char *startup_app_template); @@ -43,11 +44,11 @@ void BKE_blendfile_read_setup_ex(struct bContext *C, void BKE_blendfile_read_setup(struct bContext *C, struct BlendFileData *bfd, const struct BlendFileReadParams *params, - struct ReportList *reports); + struct BlendFileReadReport *reports); struct BlendFileData *BKE_blendfile_read(const char *filepath, const struct BlendFileReadParams *params, - struct ReportList *reports); + struct BlendFileReadReport *reports); struct BlendFileData *BKE_blendfile_read_from_memory(const void *filebuf, int filelength, diff --git a/source/blender/blenkernel/BKE_cloth.h b/source/blender/blenkernel/BKE_cloth.h index 04fcdd6ed6f..a0e3d5dc142 100644 --- a/source/blender/blenkernel/BKE_cloth.h +++ b/source/blender/blenkernel/BKE_cloth.h @@ -103,11 +103,11 @@ typedef struct Cloth { * The definition of a cloth vertex. */ typedef struct ClothVertex { - int flags; /* General flags per vertex. */ - float v[3]; /* The velocity of the point. */ + int flags; /* General flags per vertex. */ + float v[3]; /* The velocity of the point. */ float xconst[3]; /* constrained position */ float x[3]; /* The current position of this vertex. */ - float xold[3]; /* The previous position of this vertex.*/ + float xold[3]; /* The previous position of this vertex. */ float tx[3]; /* temporary position */ float txold[3]; /* temporary old position */ float tv[3]; /* temporary "velocity", mostly used as tv = tx-txold */ @@ -194,7 +194,7 @@ typedef struct ClothSpring { } \ ((void)0) -/* Spring types as defined in the paper.*/ +/* Spring types as defined in the paper. */ typedef enum { CLOTH_SPRING_TYPE_STRUCTURAL = (1 << 1), CLOTH_SPRING_TYPE_SHEAR = (1 << 2), diff --git a/source/blender/blenkernel/BKE_collision.h b/source/blender/blenkernel/BKE_collision.h index ff1bca896b1..2c21b7355d6 100644 --- a/source/blender/blenkernel/BKE_collision.h +++ b/source/blender/blenkernel/BKE_collision.h @@ -63,7 +63,7 @@ typedef struct CollPair { float time; /* collision time, from 0 up to 1 */ /* mesh-mesh collision */ -#ifdef WITH_ELTOPO /*either ap* or bp* can be set, but not both*/ +#ifdef WITH_ELTOPO /* Either ap* or bp* can be set, but not both. */ float bary[3]; int ap1, ap2, ap3, collp, bp1, bp2, bp3; int collface; diff --git a/source/blender/blenkernel/BKE_constraint.h b/source/blender/blenkernel/BKE_constraint.h index afad1e26159..575df93a9fc 100644 --- a/source/blender/blenkernel/BKE_constraint.h +++ b/source/blender/blenkernel/BKE_constraint.h @@ -59,7 +59,7 @@ typedef struct bConstraintOb { /** space matrix for custom object space */ float space_obj_world_matrix[4][4]; - /** type of owner */ + /** type of owner. */ short type; /** rotation order for constraint owner (as defined in eEulerRotationOrders in BLI_math.h) */ short rotOrder; diff --git a/source/blender/blenkernel/BKE_customdata.h b/source/blender/blenkernel/BKE_customdata.h index 7b33a6077d0..1958e414bad 100644 --- a/source/blender/blenkernel/BKE_customdata.h +++ b/source/blender/blenkernel/BKE_customdata.h @@ -41,7 +41,7 @@ struct CustomData_MeshMasks; struct ID; typedef uint64_t CustomDataMask; -/*a data type large enough to hold 1 element from any customdata layer type*/ +/* A data type large enough to hold 1 element from any custom-data layer type. */ typedef struct { unsigned char data[64]; } CDBlockBytes; @@ -111,9 +111,9 @@ bool CustomData_layout_is_same(const struct CustomData *_a, const struct CustomD */ bool CustomData_has_referenced(const struct CustomData *data); -/* copies the "value" (e.g. mloopuv uv or mloopcol colors) from one block to +/* Copies the "value" (e.g. mloopuv uv or mloopcol colors) from one block to * another, while not overwriting anything else (e.g. flags). probably only - * implemented for mloopuv/mloopcol, for now.*/ + * implemented for mloopuv/mloopcol, for now. */ void CustomData_data_copy_value(int type, const void *source, void *dest); /* Same as above, but doing advanced mixing. @@ -123,7 +123,7 @@ void CustomData_data_mix_value( /* compares if data1 is equal to data2. type is a valid CustomData type * enum (e.g. CD_MLOOPUV). the layer type's equal function is used to compare - * the data, if it exists, otherwise memcmp is used.*/ + * the data, if it exists, otherwise memcmp is used. */ bool CustomData_data_equals(int type, const void *data1, const void *data2); void CustomData_data_initminmax(int type, void *min, void *max); void CustomData_data_dominmax(int type, const void *data, void *min, void *max); @@ -164,7 +164,7 @@ void CustomData_realloc(struct CustomData *data, int totelem); /* bmesh version of CustomData_merge; merges the layouts of source and dest, * then goes through the mesh and makes sure all the customdata blocks are - * consistent with the new layout.*/ + * consistent with the new layout. */ bool CustomData_bmesh_merge(const struct CustomData *source, struct CustomData *dest, CustomDataMask mask, @@ -192,7 +192,7 @@ void CustomData_free_temporary(struct CustomData *data, int totelem); */ void *CustomData_add_layer( struct CustomData *data, int type, eCDAllocType alloctype, void *layer, int totelem); -/*same as above but accepts a name */ +/* Same as above but accepts a name. */ void *CustomData_add_layer_named(struct CustomData *data, int type, eCDAllocType alloctype, @@ -239,6 +239,9 @@ void *CustomData_duplicate_referenced_layer_named(struct CustomData *data, const int totelem); bool CustomData_is_referenced_layer(struct CustomData *data, int type); +/* Duplicate all the layers with flag NOFREE, and remove the flag from duplicated layers. */ +void CustomData_duplicate_referenced_layers(CustomData *data, int totelem); + /* set the CD_FLAG_NOCOPY flag in custom data layers where the mask is * zero for the layer type, so only layer types specified by the mask * will be copied @@ -455,7 +458,7 @@ void CustomData_validate_layer_name(const struct CustomData *data, * only after this test passes, layer->data should be assigned */ bool CustomData_verify_versions(struct CustomData *data, int index); -/*BMesh specific customdata stuff*/ +/* BMesh specific custom-data stuff. */ void CustomData_to_bmeshpoly(struct CustomData *fdata, struct CustomData *ldata, int totloop); void CustomData_from_bmeshpoly(struct CustomData *fdata, struct CustomData *ldata, int total); void CustomData_bmesh_update_active_layers(struct CustomData *fdata, struct CustomData *ldata); diff --git a/source/blender/blenkernel/BKE_displist.h b/source/blender/blenkernel/BKE_displist.h index a2d9bbcd011..de2a746dc3e 100644 --- a/source/blender/blenkernel/BKE_displist.h +++ b/source/blender/blenkernel/BKE_displist.h @@ -32,11 +32,11 @@ extern "C" { /** #DispList.type */ enum { - /** A closed polygon (that can be filled). */ + /** A closed polygon (that can be filled). */ DL_POLY = 0, - /** An open polygon. */ + /** An open polygon. */ DL_SEGM = 1, - /** A grid surface that respects #DL_CYCL_U & #DL_CYCL_V. */ + /** A grid surface that respects #DL_CYCL_U & #DL_CYCL_V. */ DL_SURF = 2, /** Triangles. */ DL_INDEX3 = 4, diff --git a/source/blender/blenkernel/BKE_editmesh.h b/source/blender/blenkernel/BKE_editmesh.h index 075a9bc0eac..e31a0a16408 100644 --- a/source/blender/blenkernel/BKE_editmesh.h +++ b/source/blender/blenkernel/BKE_editmesh.h @@ -53,12 +53,12 @@ struct Scene; typedef struct BMEditMesh { struct BMesh *bm; - /*this is for undoing failed operations*/ + /* This is for undoing failed operations. */ struct BMEditMesh *emcopy; int emcopyusers; /* we store tessellations as triplets of three loops, - * which each define a triangle.*/ + * which each define a triangle. */ struct BMLoop *(*looptris)[3]; int tottri; @@ -67,14 +67,14 @@ typedef struct BMEditMesh { /** Cached cage bounding box for selection. */ struct BoundBox *bb_cage; - /*derivedmesh stuff*/ + /** Evaluated mesh data-mask. */ CustomData_MeshMasks lastDataMask; - /*selection mode*/ + /* Selection mode. */ short selectmode; short mat_nr; - /*temp variables for x-mirror editing*/ + /* Temp variables for x-mirror editing. */ int mirror_cdlayer; /* -1 is invalid */ /** diff --git a/source/blender/blenkernel/BKE_effect.h b/source/blender/blenkernel/BKE_effect.h index 231a4563630..3a964ddb1aa 100644 --- a/source/blender/blenkernel/BKE_effect.h +++ b/source/blender/blenkernel/BKE_effect.h @@ -179,7 +179,7 @@ unsigned int BKE_sim_debug_data_hash(int i); unsigned int BKE_sim_debug_data_hash_combine(unsigned int kx, unsigned int ky); /* _VA_SIM_DEBUG_HASH#(i, ...): combined hash value of multiple integers */ -/* internal helpers*/ +/* Internal helpers. */ #define _VA_SIM_DEBUG_HASH1(a) (BKE_sim_debug_data_hash(a)) #define _VA_SIM_DEBUG_HASH2(a, b) \ (BKE_sim_debug_data_hash_combine(BKE_sim_debug_data_hash(a), _VA_SIM_DEBUG_HASH1(b))) diff --git a/source/blender/blenkernel/BKE_fcurve.h b/source/blender/blenkernel/BKE_fcurve.h index 589d1839dd4..ed2d9d4507f 100644 --- a/source/blender/blenkernel/BKE_fcurve.h +++ b/source/blender/blenkernel/BKE_fcurve.h @@ -180,7 +180,7 @@ int BKE_fcm_envelope_find_index(struct FCM_EnvelopeData *array, * but should become userpref */ #define BEZT_BINARYSEARCH_THRESH 0.01f /* was 0.00001, but giving errors */ -/* -------- Data Management -------- */ +/* -------- Data Management -------- */ struct FCurve *BKE_fcurve_create(void); void BKE_fcurve_free(struct FCurve *fcu); struct FCurve *BKE_fcurve_copy(const struct FCurve *fcu); @@ -302,7 +302,7 @@ bool BKE_fcurve_bezt_subdivide_handles(struct BezTriple *bezt, struct BezTriple *next, float *r_pdelta); -/* -------- Curve Sanity -------- */ +/* -------- Curve Sanity -------- */ void calchandles_fcurve(struct FCurve *fcu); void calchandles_fcurve_ex(struct FCurve *fcu, eBezTriple_Flag handle_sel_flag); @@ -312,7 +312,7 @@ bool test_time_fcurve(struct FCurve *fcu); void BKE_fcurve_correct_bezpart(const float v1[2], float v2[2], float v3[2], const float v4[2]); -/* -------- Evaluation -------- */ +/* -------- Evaluation -------- */ /* evaluate fcurve */ float evaluate_fcurve(struct FCurve *fcu, float evaltime); @@ -329,7 +329,7 @@ float calculate_fcurve(struct PathResolvedRNA *anim_rna, /* ************* F-Curve Samples API ******************** */ -/* -------- Defines -------- */ +/* -------- Defines -------- */ /* Basic signature for F-Curve sample-creation function * - fcu: the F-Curve being operated on @@ -337,12 +337,12 @@ float calculate_fcurve(struct PathResolvedRNA *anim_rna, */ typedef float (*FcuSampleFunc)(struct FCurve *fcu, void *data, float evaltime); -/* ----- Sampling Callbacks ------ */ +/* ----- Sampling Callbacks ------ */ /* Basic sampling callback which acts as a wrapper for evaluate_fcurve() */ float fcurve_samplingcb_evalcurve(struct FCurve *fcu, void *data, float evaltime); -/* -------- Main Methods -------- */ +/* -------- Main Methods -------- */ /* Main API function for creating a set of sampled curve data, given some callback function * used to retrieve the values to store. diff --git a/source/blender/blenkernel/BKE_global.h b/source/blender/blenkernel/BKE_global.h index 74f2bf7c6ad..69c950a86dc 100644 --- a/source/blender/blenkernel/BKE_global.h +++ b/source/blender/blenkernel/BKE_global.h @@ -149,7 +149,7 @@ enum { G_DEBUG_DEPSGRAPH_TIME | G_DEBUG_DEPSGRAPH_UUID), G_DEBUG_SIMDATA = (1 << 15), /* sim debug data display */ G_DEBUG_GPU = (1 << 16), /* gpu debug */ - G_DEBUG_IO = (1 << 17), /* IO Debugging (for Collada, ...)*/ + G_DEBUG_IO = (1 << 17), /* IO Debugging (for Collada, ...). */ G_DEBUG_GPU_FORCE_WORKAROUNDS = (1 << 18), /* force gpu workarounds bypassing detections. */ G_DEBUG_XR = (1 << 19), /* XR/OpenXR messages */ G_DEBUG_XR_TIME = (1 << 20), /* XR/OpenXR timing messages */ diff --git a/source/blender/blenkernel/BKE_gpencil.h b/source/blender/blenkernel/BKE_gpencil.h index d0a1f102a43..657e66729e1 100644 --- a/source/blender/blenkernel/BKE_gpencil.h +++ b/source/blender/blenkernel/BKE_gpencil.h @@ -214,6 +214,10 @@ void BKE_gpencil_layer_mask_remove_ref(struct bGPdata *gpd, const char *name); struct bGPDlayer_Mask *BKE_gpencil_layer_mask_named_get(struct bGPDlayer *gpl, const char *name); void BKE_gpencil_layer_mask_sort(struct bGPdata *gpd, struct bGPDlayer *gpl); void BKE_gpencil_layer_mask_sort_all(struct bGPdata *gpd); +void BKE_gpencil_layer_mask_copy(const struct bGPDlayer *gpl_src, struct bGPDlayer *gpl_dst); +void BKE_gpencil_layer_mask_cleanup(struct bGPdata *gpd, struct bGPDlayer *gpl); +void BKE_gpencil_layer_mask_cleanup_all_layers(struct bGPdata *gpd); + void BKE_gpencil_layer_frames_sort(struct bGPDlayer *gpl, bool *r_has_duplicate_frames); struct bGPDlayer *BKE_gpencil_layer_get_by_name(struct bGPdata *gpd, diff --git a/source/blender/blenkernel/BKE_idprop.h b/source/blender/blenkernel/BKE_idprop.h index bcf35bf1197..a5cb6489194 100644 --- a/source/blender/blenkernel/BKE_idprop.h +++ b/source/blender/blenkernel/BKE_idprop.h @@ -67,7 +67,7 @@ void IDP_AppendArray(struct IDProperty *prop, struct IDProperty *item); void IDP_ResizeIDPArray(struct IDProperty *prop, int len); /* ----------- Numeric Array Type ----------- */ -/*this function works for strings too!*/ +/* This function works for strings too! */ void IDP_ResizeArray(struct IDProperty *prop, int newlen); void IDP_FreeArray(struct IDProperty *prop); diff --git a/source/blender/blenkernel/BKE_lib_id.h b/source/blender/blenkernel/BKE_lib_id.h index e16507bf3cc..fac5dc8c010 100644 --- a/source/blender/blenkernel/BKE_lib_id.h +++ b/source/blender/blenkernel/BKE_lib_id.h @@ -315,6 +315,9 @@ void BKE_id_blend_write(struct BlendWriter *writer, struct ID *id); #define IS_TAGGED(_id) ((_id) && (((ID *)_id)->tag & LIB_TAG_DOIT)) +/* lib_id_eval.c */ +void BKE_id_eval_properties_copy(struct ID *id_cow, struct ID *id); + #ifdef __cplusplus } #endif diff --git a/source/blender/blenkernel/BKE_lib_override.h b/source/blender/blenkernel/BKE_lib_override.h index 4dc99e64cf2..3eb0ff44129 100644 --- a/source/blender/blenkernel/BKE_lib_override.h +++ b/source/blender/blenkernel/BKE_lib_override.h @@ -43,6 +43,7 @@ extern "C" { #endif struct Collection; +struct BlendFileReadReport; struct ID; struct IDOverrideLibrary; struct IDOverrideLibraryProperty; @@ -90,11 +91,11 @@ bool BKE_lib_override_library_resync(struct Main *bmain, struct Collection *override_resync_residual_storage, const bool do_hierarchy_enforce, const bool do_post_process, - struct ReportList *reports); + struct BlendFileReadReport *reports); void BKE_lib_override_library_main_resync(struct Main *bmain, struct Scene *scene, struct ViewLayer *view_layer, - struct ReportList *reports); + struct BlendFileReadReport *reports); void BKE_lib_override_library_delete(struct Main *bmain, struct ID *id_root); diff --git a/source/blender/blenkernel/BKE_mesh.h b/source/blender/blenkernel/BKE_mesh.h index 1c56e64d300..1219a234d55 100644 --- a/source/blender/blenkernel/BKE_mesh.h +++ b/source/blender/blenkernel/BKE_mesh.h @@ -275,13 +275,6 @@ void BKE_mesh_vert_normals_apply(struct Mesh *mesh, const short (*vert_normals)[ /* *** mesh_tessellate.c *** */ -void BKE_mesh_loops_to_tessdata(struct CustomData *fdata, - struct CustomData *ldata, - struct MFace *mface, - const int *polyindices, - unsigned int (*loopindices)[4], - const int num_faces); - int BKE_mesh_tessface_calc_ex(struct CustomData *fdata, struct CustomData *ldata, struct CustomData *pdata, diff --git a/source/blender/blenkernel/BKE_mesh_remap.h b/source/blender/blenkernel/BKE_mesh_remap.h index d9b6ab3813e..02f8af6443c 100644 --- a/source/blender/blenkernel/BKE_mesh_remap.h +++ b/source/blender/blenkernel/BKE_mesh_remap.h @@ -36,7 +36,7 @@ typedef struct MeshPairRemapItem { int sources_num; int *indices_src; /* NULL if no source found. */ float *weights_src; /* NULL if no source found, else, always normalized! */ - /* UNUSED (at the moment)*/ + /* UNUSED (at the moment). */ // float hit_dist; /* FLT_MAX if irrelevant or no source found. */ int island; /* For loops only. */ } MeshPairRemapItem; diff --git a/source/blender/blenkernel/BKE_modifier.h b/source/blender/blenkernel/BKE_modifier.h index 48b4540e3d9..0b4e1191956 100644 --- a/source/blender/blenkernel/BKE_modifier.h +++ b/source/blender/blenkernel/BKE_modifier.h @@ -324,7 +324,7 @@ typedef struct ModifierTypeInfo { /** * True when a deform modifier uses normals, the requiredDataMask - * cant be used here because that refers to a normal layer whereas + * can't be used here because that refers to a normal layer whereas * in this case we need to know if the deform modifier uses normals. * * this is needed because applying 2 deform modifiers will give the diff --git a/source/blender/blenkernel/BKE_multires.h b/source/blender/blenkernel/BKE_multires.h index 391d0104be5..765f285c324 100644 --- a/source/blender/blenkernel/BKE_multires.h +++ b/source/blender/blenkernel/BKE_multires.h @@ -222,7 +222,7 @@ void BKE_multires_bmesh_space_set(struct Object *ob, struct BMesh *bm, int mode) /* Versioning. */ /* Convert displacement which is stored for simply-subdivided mesh to a Catmull-Clark - * subdivided mesh. */ + * subdivided mesh. */ void multires_do_versions_simple_to_catmull_clark(struct Object *object, struct MultiresModifierData *mmd); diff --git a/source/blender/blenkernel/BKE_object.h b/source/blender/blenkernel/BKE_object.h index dc8b8c93c80..91be4b0645a 100644 --- a/source/blender/blenkernel/BKE_object.h +++ b/source/blender/blenkernel/BKE_object.h @@ -339,9 +339,9 @@ bool BKE_object_obdata_texspace_get(struct Object *ob, float **r_loc, float **r_size); -struct Mesh *BKE_object_get_evaluated_mesh(struct Object *object); -struct Mesh *BKE_object_get_pre_modified_mesh(struct Object *object); -struct Mesh *BKE_object_get_original_mesh(struct Object *object); +struct Mesh *BKE_object_get_evaluated_mesh(const struct Object *object); +struct Mesh *BKE_object_get_pre_modified_mesh(const struct Object *object); +struct Mesh *BKE_object_get_original_mesh(const struct Object *object); /* Lattice accessors. * These functions return either the regular lattice, or the edit-mode lattice, @@ -379,24 +379,24 @@ void BKE_object_runtime_reset_on_copy(struct Object *object, const int flag); void BKE_object_runtime_free_data(struct Object *object); void BKE_object_batch_cache_dirty_tag(struct Object *ob); +void BKE_object_data_batch_cache_dirty_tag(struct ID *object_data); /* this function returns a superset of the scenes selection based on relationships */ typedef enum eObRelationTypes { - OB_REL_NONE = 0, /* just the selection as is */ - OB_REL_PARENT = (1 << 0), /* immediate parent */ - OB_REL_PARENT_RECURSIVE = (1 << 1), /* parents up to root of selection tree*/ - OB_REL_CHILDREN = (1 << 2), /* immediate children */ - OB_REL_CHILDREN_RECURSIVE = (1 << 3), /* All children */ - OB_REL_MOD_ARMATURE = (1 << 4), /* Armatures related to the selected objects */ - /* OB_REL_SCENE_CAMERA = (1 << 5), */ /* you might want the scene camera too even if unselected? - */ + OB_REL_NONE = 0, /* Just the selection as is. */ + OB_REL_PARENT = (1 << 0), /* Immediate parent. */ + OB_REL_PARENT_RECURSIVE = (1 << 1), /* Parents up to root of selection tree. */ + OB_REL_CHILDREN = (1 << 2), /* Immediate children. */ + OB_REL_CHILDREN_RECURSIVE = (1 << 3), /* All children. */ + OB_REL_MOD_ARMATURE = (1 << 4), /* Armatures related to the selected objects. */ + // OB_REL_SCENE_CAMERA = (1 << 5), /* You might want the scene camera too even if unselected? */ } eObRelationTypes; typedef enum eObjectSet { - OB_SET_SELECTED, /* Selected Objects */ - OB_SET_VISIBLE, /* Visible Objects */ - OB_SET_ALL, /* All Objects */ + OB_SET_SELECTED, /* Selected Objects. */ + OB_SET_VISIBLE, /* Visible Objects. */ + OB_SET_ALL, /* All Objects. */ } eObjectSet; struct LinkNode *BKE_object_relational_superset(struct ViewLayer *view_layer, diff --git a/source/blender/blenkernel/BKE_particle.h b/source/blender/blenkernel/BKE_particle.h index 3913ede9049..e5b547d2557 100644 --- a/source/blender/blenkernel/BKE_particle.h +++ b/source/blender/blenkernel/BKE_particle.h @@ -78,7 +78,7 @@ struct Scene; for (p = 0; p < psys->totpart; p++) \ if ((pa = psys->particles + p)->state.time > 0.0f) -/* fast but sure way to get the modifier*/ +/* Fast but sure way to get the modifier. */ #define PARTICLE_PSMD \ ParticleSystemModifierData *psmd = sim->psmd ? sim->psmd : psys_get_modifier(sim->ob, sim->psys) @@ -190,7 +190,7 @@ typedef struct ParticleCollisionElement { /* pointers to original data */ float *x[3], *v[3]; - /* values interpolated from original data*/ + /* Values interpolated from original data. */ float x0[3], x1[3], x2[3], p[3]; /* results for found intersection point */ diff --git a/source/blender/blenkernel/BKE_pointcache.h b/source/blender/blenkernel/BKE_pointcache.h index 170eb4ba662..8731162b720 100644 --- a/source/blender/blenkernel/BKE_pointcache.h +++ b/source/blender/blenkernel/BKE_pointcache.h @@ -33,7 +33,7 @@ extern "C" { #endif /* Point cache clearing option, for BKE_ptcache_id_clear, before - * and after are non inclusive (they wont remove the cfra) */ + * and after are non-inclusive (they won't remove the cfra) */ #define PTCACHE_CLEAR_ALL 0 #define PTCACHE_CLEAR_FRAME 1 #define PTCACHE_CLEAR_BEFORE 2 diff --git a/source/blender/blenkernel/BKE_screen.h b/source/blender/blenkernel/BKE_screen.h index 085851ba5e6..fed155626ed 100644 --- a/source/blender/blenkernel/BKE_screen.h +++ b/source/blender/blenkernel/BKE_screen.h @@ -62,7 +62,7 @@ struct wmWindow; struct wmWindowManager; /* spacetype has everything stored to get an editor working, it gets initialized via - * ED_spacetypes_init() in editors/space_api/spacetypes.c */ + * #ED_spacetypes_init() in `editors/space_api/spacetypes.c` */ /* an editor in Blender is a combined ScrArea + SpaceType + SpaceData */ #define BKE_ST_MAXNAME 64 @@ -206,7 +206,7 @@ typedef struct ARegionType { * performed. * * This callback is not called on indirect changes of the current viewport (which could happen - * when the `v2d->tot is changed and `cur` is adopted accordingly). */ + * when the `v2d->tot is changed and `cur` is adopted accordingly). */ void (*on_view2d_changed)(const struct bContext *C, struct ARegion *region); /* custom drawing callbacks */ diff --git a/source/blender/blenkernel/BKE_spline.hh b/source/blender/blenkernel/BKE_spline.hh index 5e88dd02bdd..0de9270bde1 100644 --- a/source/blender/blenkernel/BKE_spline.hh +++ b/source/blender/blenkernel/BKE_spline.hh @@ -49,7 +49,7 @@ using SplinePtr = std::unique_ptr<Spline>; * evaluation happens in a layer on top of the evaluated points generated by the derived types. * * There are a few methods to evaluate a spline: - * 1. #evaluated_positions and #interpolate_to_evaluated_points give data for the initial + * 1. #evaluated_positions and #interpolate_to_evaluated give data for the initial * evaluated points, depending on the resolution. * 2. #lookup_evaluated_factor and #lookup_evaluated_factor are meant for one-off lookups * along the length of a curve. @@ -72,8 +72,7 @@ class Spline { Minimum, Tangent, }; - /* Only #Zup is supported at the moment. */ - NormalCalculationMode normal_mode; + NormalCalculationMode normal_mode = Minimum; blender::bke::CustomDataAttributes attributes; @@ -106,9 +105,9 @@ class Spline { copy_base_settings(other, *this); } - virtual SplinePtr copy() const = 0; - /** Return a new spline with the same type and settings like "cyclic", but without any data. */ - virtual SplinePtr copy_settings() const = 0; + SplinePtr copy() const; + SplinePtr copy_only_settings() const; + SplinePtr copy_without_attributes() const; Spline::Type type() const; @@ -172,23 +171,23 @@ class Spline { blender::Array<float> sample_uniform_index_factors(const int samples_size) const; LookupResult lookup_data_from_index_factor(const float index_factor) const; - void sample_based_on_index_factors(const blender::fn::GVArray &src, - blender::Span<float> index_factors, - blender::fn::GMutableSpan dst) const; + void sample_with_index_factors(const blender::fn::GVArray &src, + blender::Span<float> index_factors, + blender::fn::GMutableSpan dst) const; template<typename T> - void sample_based_on_index_factors(const blender::VArray<T> &src, - blender::Span<float> index_factors, - blender::MutableSpan<T> dst) const + void sample_with_index_factors(const blender::VArray<T> &src, + blender::Span<float> index_factors, + blender::MutableSpan<T> dst) const { - this->sample_based_on_index_factors( + this->sample_with_index_factors( blender::fn::GVArray_For_VArray(src), index_factors, blender::fn::GMutableSpan(dst)); } template<typename T> - void sample_based_on_index_factors(blender::Span<T> src, - blender::Span<float> index_factors, - blender::MutableSpan<T> dst) const + void sample_with_index_factors(blender::Span<T> src, + blender::Span<float> index_factors, + blender::MutableSpan<T> dst) const { - this->sample_based_on_index_factors(blender::VArray_For_Span(src), index_factors, dst); + this->sample_with_index_factors(blender::VArray_For_Span(src), index_factors, dst); } /** @@ -196,24 +195,21 @@ class Spline { * evaluated points. For poly splines, the lifetime of the returned virtual array must not * exceed the lifetime of the input data. */ - virtual blender::fn::GVArrayPtr interpolate_to_evaluated_points( - const blender::fn::GVArray &source_data) const = 0; - blender::fn::GVArrayPtr interpolate_to_evaluated_points(blender::fn::GSpan data) const; + virtual blender::fn::GVArrayPtr interpolate_to_evaluated( + const blender::fn::GVArray &src) const = 0; + blender::fn::GVArrayPtr interpolate_to_evaluated(blender::fn::GSpan data) const; template<typename T> - blender::fn::GVArray_Typed<T> interpolate_to_evaluated_points(blender::Span<T> data) const + blender::fn::GVArray_Typed<T> interpolate_to_evaluated(blender::Span<T> data) const { - return blender::fn::GVArray_Typed<T>( - this->interpolate_to_evaluated_points(blender::fn::GSpan(data))); + return blender::fn::GVArray_Typed<T>(this->interpolate_to_evaluated(blender::fn::GSpan(data))); } protected: virtual void correct_end_tangents() const = 0; - /** Copy settings stored in the base spline class. */ - static void copy_base_settings(const Spline &src, Spline &dst) - { - dst.normal_mode = src.normal_mode; - dst.is_cyclic_ = src.is_cyclic_; - } + virtual void copy_settings(Spline &dst) const = 0; + virtual void copy_data(Spline &dst) const = 0; + + static void copy_base_settings(const Spline &src, Spline &dst); }; /** @@ -266,8 +262,6 @@ class BezierSpline final : public Spline { mutable bool mapping_cache_dirty_ = true; public: - virtual SplinePtr copy() const final; - SplinePtr copy_settings() const final; BezierSpline() : Spline(Type::Bezier) { } @@ -334,8 +328,8 @@ class BezierSpline final : public Spline { }; InterpolationData interpolation_data_from_index_factor(const float index_factor) const; - virtual blender::fn::GVArrayPtr interpolate_to_evaluated_points( - const blender::fn::GVArray &source_data) const override; + virtual blender::fn::GVArrayPtr interpolate_to_evaluated( + const blender::fn::GVArray &src) const override; void evaluate_segment(const int index, const int next_index, @@ -343,8 +337,11 @@ class BezierSpline final : public Spline { bool segment_is_vector(const int start_index) const; private: - void ensure_auto_handles() const; void correct_end_tangents() const final; + void copy_settings(Spline &dst) const final; + void copy_data(Spline &dst) const final; + + void ensure_auto_handles() const; }; /** @@ -409,8 +406,6 @@ class NURBSpline final : public Spline { mutable bool position_cache_dirty_ = true; public: - SplinePtr copy() const final; - SplinePtr copy_settings() const final; NURBSpline() : Spline(Type::NURBS) { } @@ -457,13 +452,15 @@ class NURBSpline final : public Spline { blender::Span<blender::float3> evaluated_positions() const final; - blender::fn::GVArrayPtr interpolate_to_evaluated_points( - const blender::fn::GVArray &source_data) const final; + blender::fn::GVArrayPtr interpolate_to_evaluated(const blender::fn::GVArray &src) const final; protected: void correct_end_tangents() const final; + void copy_settings(Spline &dst) const final; + void copy_data(Spline &dst) const final; + void calculate_knots() const; - void calculate_basis_cache() const; + blender::Span<BasisCache> calculate_basis_cache() const; }; /** @@ -477,8 +474,6 @@ class PolySpline final : public Spline { blender::Vector<float> tilts_; public: - SplinePtr copy() const final; - SplinePtr copy_settings() const final; PolySpline() : Spline(Type::Poly) { } @@ -507,11 +502,12 @@ class PolySpline final : public Spline { blender::Span<blender::float3> evaluated_positions() const final; - blender::fn::GVArrayPtr interpolate_to_evaluated_points( - const blender::fn::GVArray &source_data) const final; + blender::fn::GVArrayPtr interpolate_to_evaluated(const blender::fn::GVArray &src) const final; protected: void correct_end_tangents() const final; + void copy_settings(Spline &dst) const final; + void copy_data(Spline &dst) const final; }; /** diff --git a/source/blender/blenkernel/BKE_subsurf.h b/source/blender/blenkernel/BKE_subsurf.h index 07bbeafb1ae..3816a822279 100644 --- a/source/blender/blenkernel/BKE_subsurf.h +++ b/source/blender/blenkernel/BKE_subsurf.h @@ -25,7 +25,7 @@ /* struct DerivedMesh is used directly */ #include "BKE_DerivedMesh.h" -/* Thread sync primitives used directly. */ +/* Thread sync primitives used directly. */ #include "BLI_threads.h" #ifdef __cplusplus diff --git a/source/blender/blenkernel/BKE_text.h b/source/blender/blenkernel/BKE_text.h index c60d5c7bfec..26351ee65c2 100644 --- a/source/blender/blenkernel/BKE_text.h +++ b/source/blender/blenkernel/BKE_text.h @@ -91,7 +91,7 @@ bool txt_cursor_is_line_end(struct Text *text); int txt_calc_tab_left(struct TextLine *tl, int ch); int txt_calc_tab_right(struct TextLine *tl, int ch); -/* utility functions, could be moved somewhere more generic but are python/text related */ +/* Utility functions, could be moved somewhere more generic but are python/text related. */ int text_check_bracket(const char ch); bool text_check_delim(const char ch); bool text_check_digit(const char ch); diff --git a/source/blender/blenkernel/CMakeLists.txt b/source/blender/blenkernel/CMakeLists.txt index 3d2c41b4bdc..8cab5308785 100644 --- a/source/blender/blenkernel/CMakeLists.txt +++ b/source/blender/blenkernel/CMakeLists.txt @@ -165,6 +165,7 @@ set(SRC intern/layer_utils.c intern/lib_id.c intern/lib_id_delete.c + intern/lib_id_eval.c intern/lib_override.c intern/lib_query.c intern/lib_remap.c diff --git a/source/blender/blenkernel/intern/DerivedMesh.cc b/source/blender/blenkernel/intern/DerivedMesh.cc index 4cd611d2fa8..1d5eebf0abe 100644 --- a/source/blender/blenkernel/intern/DerivedMesh.cc +++ b/source/blender/blenkernel/intern/DerivedMesh.cc @@ -42,6 +42,7 @@ #include "BLI_linklist.h" #include "BLI_math.h" #include "BLI_task.h" +#include "BLI_task.hh" #include "BLI_utildefines.h" #include "BLI_vector.hh" @@ -959,7 +960,7 @@ static Mesh *modifier_modify_mesh_and_geometry_set(ModifierData *md, mesh_output = mesh_component.release(); } - /* Return an empty mesh instead of null. */ + /* Return an empty mesh instead of null. */ if (mesh_output == nullptr) { mesh_output = BKE_mesh_new_nomain(0, 0, 0, 0, 0); BKE_mesh_copy_parameters_for_eval(mesh_output, input_mesh); @@ -1463,10 +1464,14 @@ static void mesh_calc_modifiers(struct Depsgraph *depsgraph, BLI_assert(runtime->eval_mutex != nullptr); BLI_mutex_lock((ThreadMutex *)runtime->eval_mutex); if (runtime->mesh_eval == nullptr) { - mesh_final = BKE_mesh_copy_for_eval(mesh_input, true); - mesh_calc_modifier_final_normals(mesh_input, &final_datamask, sculpt_dyntopo, mesh_final); - mesh_calc_finalize(mesh_input, mesh_final); - runtime->mesh_eval = mesh_final; + /* Isolate since computing normals is multithreaded and we are holding a lock. */ + blender::threading::isolate_task([&] { + mesh_final = BKE_mesh_copy_for_eval(mesh_input, true); + mesh_calc_modifier_final_normals( + mesh_input, &final_datamask, sculpt_dyntopo, mesh_final); + mesh_calc_finalize(mesh_input, mesh_final); + runtime->mesh_eval = mesh_final; + }); } BLI_mutex_unlock((ThreadMutex *)runtime->eval_mutex); } @@ -1567,7 +1572,7 @@ static void editbmesh_calc_modifier_final_normals(Mesh *mesh_final, /* BMESH_ONLY, ensure tessface's used for drawing, * but don't recalculate if the last modifier in the stack gives us tessfaces * check if the derived meshes are DM_TYPE_EDITBMESH before calling, this isn't essential - * but quiets annoying error messages since tessfaces wont be created. */ + * but quiets annoying error messages since tessfaces won't be created. */ if (final_datamask->fmask & CD_MASK_MFACE) { if (mesh_final->edit_mesh == nullptr) { BKE_mesh_tessface_ensure(mesh_final); diff --git a/source/blender/blenkernel/intern/action.c b/source/blender/blenkernel/intern/action.c index 5db2eceb0d1..cf7023bc672 100644 --- a/source/blender/blenkernel/intern/action.c +++ b/source/blender/blenkernel/intern/action.c @@ -370,7 +370,7 @@ void set_active_action_group(bAction *act, bActionGroup *agrp, short select) /* Sync colors used for action/bone group with theme settings */ void action_group_colors_sync(bActionGroup *grp, const bActionGroup *ref_grp) { - /* only do color copying if using a custom color (i.e. not default color) */ + /* Only do color copying if using a custom color (i.e. not default color). */ if (grp->customCol) { if (grp->customCol > 0) { /* copy theme colors on-to group's custom color in case user tries to edit color */ @@ -846,8 +846,9 @@ void BKE_pose_copy_data_ex(bPose **dst, } if (copy_constraints) { - BKE_constraints_copy_ex( - &listb, &pchan->constraints, flag, true); /* BKE_constraints_copy NULLs listb */ + /* #BKE_constraints_copy NULL's `listb` */ + BKE_constraints_copy_ex(&listb, &pchan->constraints, flag, true); + pchan->constraints = listb; /* XXX: This is needed for motionpath drawing to work. @@ -1855,7 +1856,7 @@ void BKE_pose_blend_write(BlendWriter *writer, bPose *pose, bArmature *arm) /* Write channels */ LISTBASE_FOREACH (bPoseChannel *, chan, &pose->chanbase) { /* Write ID Properties -- and copy this comment EXACTLY for easy finding - * of library blocks that implement this.*/ + * of library blocks that implement this. */ if (chan->prop) { IDP_BlendWrite(writer, chan->prop); } diff --git a/source/blender/blenkernel/intern/anim_data.c b/source/blender/blenkernel/intern/anim_data.c index ccf67672fb1..00004275f9b 100644 --- a/source/blender/blenkernel/intern/anim_data.c +++ b/source/blender/blenkernel/intern/anim_data.c @@ -946,7 +946,7 @@ static bool nlastrips_path_rename_fix(ID *owner_id, is_changed |= fcurves_path_rename_fix( owner_id, prefix, oldName, newName, oldKey, newKey, &strip->act->curves, verify_paths); } - /* Ignore own F-Curves, since those are local. */ + /* Ignore own F-Curves, since those are local. */ /* Check sub-strips (if meta-strips). */ is_changed |= nlastrips_path_rename_fix( owner_id, prefix, oldName, newName, oldKey, newKey, &strip->strips, verify_paths); @@ -1422,7 +1422,7 @@ void BKE_animdata_fix_paths_rename_all(ID *ref_id, * NOTE: it is assumed that the structure we're replacing is <prefix><["><name><"]> * i.e. pose.bones["Bone"] */ -/* TODO: use BKE_animdata_main_cb for looping over all data */ +/* TODO: use BKE_animdata_main_cb for looping over all data. */ void BKE_animdata_fix_paths_rename_all_ex(Main *bmain, ID *ref_id, const char *prefix, diff --git a/source/blender/blenkernel/intern/anim_path.c b/source/blender/blenkernel/intern/anim_path.c index af2b386a30a..e2c2708101b 100644 --- a/source/blender/blenkernel/intern/anim_path.c +++ b/source/blender/blenkernel/intern/anim_path.c @@ -327,7 +327,7 @@ bool BKE_where_on_path(const Object *ob, } const Nurb *nu = nurbs->first; - /* make sure that first and last frame are included in the vectors here */ + /* Make sure that first and last frame are included in the vectors here. */ if (ELEM(nu->type, CU_POLY, CU_BEZIER, CU_NURBS)) { key_curve_position_weights(frac, w, KEY_LINEAR); } diff --git a/source/blender/blenkernel/intern/anim_sys.c b/source/blender/blenkernel/intern/anim_sys.c index e347306e0ae..08a3f3fcf4f 100644 --- a/source/blender/blenkernel/intern/anim_sys.c +++ b/source/blender/blenkernel/intern/anim_sys.c @@ -852,7 +852,7 @@ NlaEvalStrip *nlastrips_ctime_get_strip(ListBase *list, /* loop over strips, checking if they fall within the range */ for (strip = strips->first; strip; strip = strip->next) { - /* check if current time occurs within this strip */ + /* Check if current time occurs within this strip. */ if (IN_RANGE_INCL(ctime, strip->start, strip->end) || (strip->flag & NLASTRIP_FLAG_NO_TIME_MAP)) { /* this strip is active, so try to use it */ @@ -1564,7 +1564,7 @@ static bool nla_blend_get_inverted_strip_value(const int blendmode, } } -/** \returns true if solution exists and output is written to. */ +/** \returns true if solution exists and output is written to. */ static bool nla_combine_get_inverted_strip_value(const int mix_mode, float base_value, const float lower_value, @@ -2017,7 +2017,7 @@ static void nlaeval_fmodifiers_join_stacks(ListBase *result, ListBase *list1, Li { FModifier *fcm1, *fcm2; - /* if list1 is invalid... */ + /* if list1 is invalid... */ if (ELEM(NULL, list1, list1->first)) { if (list2 && list2->first) { result->first = list2->first; diff --git a/source/blender/blenkernel/intern/appdir.c b/source/blender/blenkernel/intern/appdir.c index bcfd34ab42f..579f671e2b0 100644 --- a/source/blender/blenkernel/intern/appdir.c +++ b/source/blender/blenkernel/intern/appdir.c @@ -200,7 +200,7 @@ bool BKE_appdir_folder_documents(char *dir) return true; } - /* Ghost couldn't give us a documents path, let's try if we can find it ourselves.*/ + /* Ghost couldn't give us a documents path, let's try if we can find it ourselves. */ const char *home_path = BKE_appdir_folder_home(); if (!home_path || !BLI_is_dir(home_path)) { diff --git a/source/blender/blenkernel/intern/armature.c b/source/blender/blenkernel/intern/armature.c index 2cd089545e8..5799f82bf94 100644 --- a/source/blender/blenkernel/intern/armature.c +++ b/source/blender/blenkernel/intern/armature.c @@ -198,7 +198,7 @@ static void write_bone(BlendWriter *writer, Bone *bone) BLO_write_struct(writer, Bone, bone); /* Write ID Properties -- and copy this comment EXACTLY for easy finding - * of library blocks that implement this.*/ + * of library blocks that implement this. */ if (bone->prop) { IDP_BlendWrite(writer, bone->prop); } @@ -1627,7 +1627,7 @@ void BKE_armature_mat_world_to_pose(Object *ob, const float inmat[4][4], float o return; } - /* get inverse of (armature) object's matrix */ + /* Get inverse of (armature) object's matrix. */ invert_m4_m4(obmat, ob->obmat); /* multiply given matrix by object's-inverse to find pose-space matrix */ @@ -2063,9 +2063,11 @@ void BKE_armature_mat_pose_to_delta(float delta_mat[4][4], * Used for Objects and Pose Channels, since both can have multiple rotation representations. * \{ */ -/* Called from RNA when rotation mode changes +/** + * Called from RNA when rotation mode changes * - the result should be that the rotations given in the provided pointers have had conversions - * applied (as appropriate), such that the rotation of the element hasn't 'visually' changed */ + * applied (as appropriate), such that the rotation of the element hasn't 'visually' changed. + */ void BKE_rotMode_change_values( float quat[4], float eul[3], float axis[3], float *angle, short oldMode, short newMode) { @@ -2333,7 +2335,7 @@ void BKE_armature_where_is_bone(Bone *bone, const Bone *bone_parent, const bool /* yoffs(b-1) + root(b) + bonemat(b) */ BKE_bone_offset_matrix_get(bone, offs_bone); - /* Compose the matrix for this bone */ + /* Compose the matrix for this bone. */ mul_m4_m4m4(bone->arm_mat, bone_parent->arm_mat, offs_bone); } else { @@ -2381,7 +2383,7 @@ static void pose_proxy_sync(Object *ob, Object *from, int layer_protected) return; } - /* in some cases when rigs change, we cant synchronize + /* in some cases when rigs change, we can't synchronize * to avoid crashing check for possible errors here */ for (pchan = pose->chanbase.first; pchan; pchan = pchan->next) { if (pchan->bone->layer & layer_protected) { diff --git a/source/blender/blenkernel/intern/armature_test.cc b/source/blender/blenkernel/intern/armature_test.cc index 366bbe3e37c..589337d9d01 100644 --- a/source/blender/blenkernel/intern/armature_test.cc +++ b/source/blender/blenkernel/intern/armature_test.cc @@ -121,7 +121,7 @@ TEST(vec_roll_to_mat3_normalized, Rotationmatrix) /* TODO: This test will pass after fixing T82455) */ /* If normalized_vector is close to -Y and * it has X and Z values above a threshold, - * apply the special case. */ + * apply the special case. */ { const float expected_roll_mat[3][3] = {{0.000000f, -9.99999975e-06f, 1.000000f}, {9.99999975e-06f, -0.999999881f, 9.99999975e-06f}, diff --git a/source/blender/blenkernel/intern/armature_update.c b/source/blender/blenkernel/intern/armature_update.c index 4504f10967c..0f8956a1a91 100644 --- a/source/blender/blenkernel/intern/armature_update.c +++ b/source/blender/blenkernel/intern/armature_update.c @@ -837,7 +837,7 @@ void BKE_pose_eval_init_ik(struct Depsgraph *depsgraph, Scene *scene, Object *ob BIK_init_tree(depsgraph, scene, object, ctime); /* construct the Spline IK trees * - this is not integrated as an IK plugin, since it should be able - * to function in conjunction with standard IK. */ + * to function in conjunction with standard IK. */ BKE_pose_splineik_init_tree(scene, object, ctime); } diff --git a/source/blender/blenkernel/intern/blender_copybuffer.c b/source/blender/blenkernel/intern/blender_copybuffer.c index ec8962d5f6d..9c9f898afef 100644 --- a/source/blender/blenkernel/intern/blender_copybuffer.c +++ b/source/blender/blenkernel/intern/blender_copybuffer.c @@ -87,7 +87,8 @@ bool BKE_copybuffer_read(Main *bmain_dst, ReportList *reports, const uint64_t id_types_mask) { - BlendHandle *bh = BLO_blendhandle_from_file(libname, reports); + BlendFileReadReport bf_reports = {.reports = reports}; + BlendHandle *bh = BLO_blendhandle_from_file(libname, &bf_reports); if (bh == NULL) { /* Error reports will have been made by BLO_blendhandle_from_file(). */ return false; @@ -106,7 +107,7 @@ bool BKE_copybuffer_read(Main *bmain_dst, /* Append, rather than linking. */ Library *lib = BLI_findstring(&bmain_dst->libraries, libname, offsetof(Library, filepath_abs)); BKE_library_make_local(bmain_dst, lib, NULL, true, false); - /* Important we unset, otherwise these object wont + /* Important we unset, otherwise these object won't * link into other scenes from this blend file. */ BKE_main_id_tag_all(bmain_dst, LIB_TAG_PRE_EXISTING, false); @@ -133,7 +134,8 @@ int BKE_copybuffer_paste(bContext *C, BlendHandle *bh; const int id_tag_extra = 0; - bh = BLO_blendhandle_from_file(libname, reports); + BlendFileReadReport bf_reports = {.reports = reports}; + bh = BLO_blendhandle_from_file(libname, &bf_reports); if (bh == NULL) { /* error reports will have been made by BLO_blendhandle_from_file() */ @@ -166,7 +168,7 @@ int BKE_copybuffer_paste(bContext *C, lib = BLI_findstring(&bmain->libraries, libname, offsetof(Library, filepath_abs)); BKE_library_make_local(bmain, lib, NULL, true, false); - /* important we unset, otherwise these object wont + /* important we unset, otherwise these object won't * link into other scenes from this blend file */ BKE_main_id_tag_all(bmain, LIB_TAG_PRE_EXISTING, false); diff --git a/source/blender/blenkernel/intern/blender_undo.c b/source/blender/blenkernel/intern/blender_undo.c index 02076823675..411ece21599 100644 --- a/source/blender/blenkernel/intern/blender_undo.c +++ b/source/blender/blenkernel/intern/blender_undo.c @@ -78,9 +78,10 @@ bool BKE_memfile_undo_decode(MemFileUndoData *mfu, if (UNDO_DISK) { const struct BlendFileReadParams params = {0}; - struct BlendFileData *bfd = BKE_blendfile_read(mfu->filename, ¶ms, NULL); + BlendFileReadReport bf_reports = {.reports = NULL}; + struct BlendFileData *bfd = BKE_blendfile_read(mfu->filename, ¶ms, &bf_reports); if (bfd != NULL) { - BKE_blendfile_read_setup(C, bfd, ¶ms, NULL); + BKE_blendfile_read_setup(C, bfd, ¶ms, &bf_reports); success = true; } } @@ -93,7 +94,7 @@ bool BKE_memfile_undo_decode(MemFileUndoData *mfu, struct BlendFileData *bfd = BKE_blendfile_read_from_memfile( bmain, &mfu->memfile, ¶ms, NULL); if (bfd != NULL) { - BKE_blendfile_read_setup(C, bfd, ¶ms, NULL); + BKE_blendfile_read_setup(C, bfd, ¶ms, &(BlendFileReadReport){NULL}); success = true; } } @@ -105,7 +106,7 @@ bool BKE_memfile_undo_decode(MemFileUndoData *mfu, if (success) { /* important not to update time here, else non keyed transforms are lost */ - DEG_on_visible_update(bmain, false); + DEG_tag_on_visible_update(bmain, false); } return success; diff --git a/source/blender/blenkernel/intern/blendfile.c b/source/blender/blenkernel/intern/blendfile.c index 54fd3f55c31..f31d8f5ade7 100644 --- a/source/blender/blenkernel/intern/blendfile.c +++ b/source/blender/blenkernel/intern/blendfile.c @@ -36,6 +36,8 @@ #include "BLI_system.h" #include "BLI_utildefines.h" +#include "PIL_time.h" + #include "IMB_colormanagement.h" #include "BKE_addon.h" @@ -136,7 +138,7 @@ static void setup_app_userdef(BlendFileData *bfd) static void setup_app_data(bContext *C, BlendFileData *bfd, const struct BlendFileReadParams *params, - ReportList *reports) + BlendFileReadReport *reports) { Main *bmain = G_MAIN; Scene *curscene = NULL; @@ -155,7 +157,7 @@ static void setup_app_data(bContext *C, /* may happen with library files - UNDO file should never have NULL curscene (but may have a * NULL curscreen)... */ else if (ELEM(NULL, bfd->curscreen, bfd->curscene)) { - BKE_report(reports, RPT_WARNING, "Library file, loading empty scene"); + BKE_report(reports->reports, RPT_WARNING, "Library file, loading empty scene"); mode = LOAD_UI_OFF; } else if (G.fileflags & G_FILE_NO_UI) { @@ -269,8 +271,8 @@ static void setup_app_data(bContext *C, } /* We need to tag this here because events may be handled immediately after. - * only the current screen is important because we wont have to handle - * events from multiple screens at once.*/ + * only the current screen is important because we won't have to handle + * events from multiple screens at once. */ if (curscreen) { BKE_screen_gizmo_tag_refresh(curscreen); } @@ -396,11 +398,17 @@ static void setup_app_data(bContext *C, } if (mode != LOAD_UNDO && !USER_EXPERIMENTAL_TEST(&U, no_override_auto_resync)) { + reports->duration.lib_overrides_resync = PIL_check_seconds_timer(); + BKE_lib_override_library_main_resync( bmain, curscene, bfd->cur_view_layer ? bfd->cur_view_layer : BKE_view_layer_default_view(curscene), reports); + + reports->duration.lib_overrides_resync = PIL_check_seconds_timer() - + reports->duration.lib_overrides_resync; + /* We need to rebuild some of the deleted override rules (for UI feedback purpose). */ BKE_lib_override_library_main_operations_create(bmain, true); } @@ -409,7 +417,7 @@ static void setup_app_data(bContext *C, static void setup_app_blend_file_data(bContext *C, BlendFileData *bfd, const struct BlendFileReadParams *params, - ReportList *reports) + BlendFileReadReport *reports) { if ((params->skip_flags & BLO_READ_SKIP_USERDEF) == 0) { setup_app_userdef(bfd); @@ -419,12 +427,12 @@ static void setup_app_blend_file_data(bContext *C, } } -static void handle_subversion_warning(Main *main, ReportList *reports) +static void handle_subversion_warning(Main *main, BlendFileReadReport *reports) { if (main->minversionfile > BLENDER_FILE_VERSION || (main->minversionfile == BLENDER_FILE_VERSION && main->minsubversionfile > BLENDER_FILE_SUBVERSION)) { - BKE_reportf(reports, + BKE_reportf(reports->reports, RPT_ERROR, "File written by newer Blender binary (%d.%d), expect loss of data!", main->minversionfile, @@ -443,7 +451,7 @@ static void handle_subversion_warning(Main *main, ReportList *reports) void BKE_blendfile_read_setup_ex(bContext *C, BlendFileData *bfd, const struct BlendFileReadParams *params, - ReportList *reports, + BlendFileReadReport *reports, /* Extra args. */ const bool startup_update_defaults, const char *startup_app_template) @@ -460,7 +468,7 @@ void BKE_blendfile_read_setup_ex(bContext *C, void BKE_blendfile_read_setup(bContext *C, BlendFileData *bfd, const struct BlendFileReadParams *params, - ReportList *reports) + BlendFileReadReport *reports) { BKE_blendfile_read_setup_ex(C, bfd, params, reports, false, NULL); } @@ -470,7 +478,7 @@ void BKE_blendfile_read_setup(bContext *C, */ struct BlendFileData *BKE_blendfile_read(const char *filepath, const struct BlendFileReadParams *params, - ReportList *reports) + BlendFileReadReport *reports) { /* Don't print startup file loading. */ if (params->is_startup == false) { @@ -482,7 +490,7 @@ struct BlendFileData *BKE_blendfile_read(const char *filepath, handle_subversion_warning(bfd->main, reports); } else { - BKE_reports_prependf(reports, "Loading '%s' failed: ", filepath); + BKE_reports_prependf(reports->reports, "Loading '%s' failed: ", filepath); } return bfd; } @@ -559,7 +567,9 @@ UserDef *BKE_blendfile_userdef_read(const char *filepath, ReportList *reports) BlendFileData *bfd; UserDef *userdef = NULL; - bfd = BLO_read_from_file(filepath, BLO_READ_SKIP_ALL & ~BLO_READ_SKIP_USERDEF, reports); + bfd = BLO_read_from_file(filepath, + BLO_READ_SKIP_ALL & ~BLO_READ_SKIP_USERDEF, + &(struct BlendFileReadReport){.reports = reports}); if (bfd) { if (bfd->user) { userdef = bfd->user; @@ -770,7 +780,8 @@ WorkspaceConfigFileData *BKE_blendfile_workspace_config_read(const char *filepat WorkspaceConfigFileData *workspace_config = NULL; if (filepath) { - bfd = BLO_read_from_file(filepath, BLO_READ_SKIP_USERDEF, reports); + bfd = BLO_read_from_file( + filepath, BLO_READ_SKIP_USERDEF, &(struct BlendFileReadReport){.reports = reports}); } else { bfd = BLO_read_from_memory(filebuf, filelength, BLO_READ_SKIP_USERDEF, reports); diff --git a/source/blender/blenkernel/intern/bpath.c b/source/blender/blenkernel/intern/bpath.c index 47427beccba..f26a9f06697 100644 --- a/source/blender/blenkernel/intern/bpath.c +++ b/source/blender/blenkernel/intern/bpath.c @@ -345,7 +345,7 @@ static bool missing_files_find__recursive(char *filename_new, BLI_join_dirfile(path, sizeof(path), dirname, de->d_name); if (BLI_stat(path, &status) == -1) { - continue; /* cant stat, don't bother with this file, could print debug info here */ + continue; /* can't stat, don't bother with this file, could print debug info here */ } if (S_ISREG(status.st_mode)) { /* is file */ @@ -812,7 +812,7 @@ bool BKE_bpath_relocate_visitor(void *pathbase_v, char *path_dst, const char *pa if (BLI_path_abs(filepath, base_old)) { /* Path was relative and is now absolute. Remap. * Important BLI_path_normalize runs before the path is made relative - * because it wont work for paths that start with "//../" */ + * because it won't work for paths that start with "//../" */ BLI_path_normalize(base_new, filepath); BLI_path_rel(filepath, base_new); BLI_strncpy(path_dst, filepath, FILE_MAX); @@ -850,7 +850,7 @@ static bool bpath_list_append(void *userdata, char *UNUSED(path_dst), const char static bool bpath_list_restore(void *userdata, char *path_dst, const char *path_src) { - /* assume ls->first wont be NULL because the number of paths can't change! + /* assume ls->first won't be NULL because the number of paths can't change! * (if they do caller is wrong) */ ListBase *ls = userdata; struct PathStore *path_store = ls->first; diff --git a/source/blender/blenkernel/intern/bvhutils.c b/source/blender/blenkernel/intern/bvhutils.c index 116e6279657..4659c464099 100644 --- a/source/blender/blenkernel/intern/bvhutils.c +++ b/source/blender/blenkernel/intern/bvhutils.c @@ -1143,7 +1143,7 @@ static BVHTree *bvhtree_from_editmesh_looptri_create_tree(float epsilon, bool insert = looptri_mask ? BLI_BITMAP_TEST_BOOL(looptri_mask, i) : true; if (insert) { - /* No reason found to block hit-testing the triangle for snap, so insert it now.*/ + /* No reason found to block hit-testing the triangle for snap, so insert it now. */ float co[3][3]; copy_v3_v3(co[0], ltri[0]->v->co); copy_v3_v3(co[1], ltri[1]->v->co); diff --git a/source/blender/blenkernel/intern/camera.c b/source/blender/blenkernel/intern/camera.c index bab9e2a5592..5172b067eba 100644 --- a/source/blender/blenkernel/intern/camera.c +++ b/source/blender/blenkernel/intern/camera.c @@ -615,7 +615,7 @@ static void camera_frame_fit_data_init(const Scene *scene, BKE_camera_params_init(params); BKE_camera_params_from_object(params, ob); - /* compute matrix, viewplane, .. */ + /* Compute matrix, view-plane, etc. */ if (scene) { BKE_camera_params_compute_viewplane( params, scene->r.xsch, scene->r.ysch, scene->r.xasp, scene->r.yasp); @@ -975,7 +975,7 @@ void BKE_camera_multiview_window_matrix(const RenderData *rd, BKE_camera_params_from_object(¶ms, camera); BKE_camera_multiview_params(rd, ¶ms, camera, viewname); - /* Compute matrix, viewplane, .. */ + /* Compute matrix, view-plane, etc. */ BKE_camera_params_compute_viewplane(¶ms, rd->xsch, rd->ysch, rd->xasp, rd->yasp); BKE_camera_params_compute_matrix(¶ms); diff --git a/source/blender/blenkernel/intern/collection.c b/source/blender/blenkernel/intern/collection.c index 8a89d215e32..0c28b8e4804 100644 --- a/source/blender/blenkernel/intern/collection.c +++ b/source/blender/blenkernel/intern/collection.c @@ -711,7 +711,7 @@ Collection *BKE_collection_duplicate(Main *bmain, * unless its duplication is a sub-process of another one. */ collection_new->id.tag &= ~LIB_TAG_NEW; - /* This code will follow into all ID links using an ID tagged with LIB_TAG_NEW.*/ + /* This code will follow into all ID links using an ID tagged with LIB_TAG_NEW. */ BKE_libblock_relink_to_newid(&collection_new->id); #ifndef NDEBUG @@ -1459,7 +1459,7 @@ bool BKE_collection_cycle_find(Collection *new_ancestor, Collection *collection) } /* Find possible objects in collection or its children, that would instantiate the given ancestor - * collection (that would also make a fully invalid cycle of dependencies) .*/ + * collection (that would also make a fully invalid cycle of dependencies). */ return collection_instance_find_recursive(collection, new_ancestor); } diff --git a/source/blender/blenkernel/intern/colortools.c b/source/blender/blenkernel/intern/colortools.c index f30fcc54b23..df2277387ce 100644 --- a/source/blender/blenkernel/intern/colortools.c +++ b/source/blender/blenkernel/intern/colortools.c @@ -1280,12 +1280,12 @@ static void save_sample_line( { float yuv[3]; - /* vectorscope*/ + /* Vector-scope. */ rgb_to_yuv(rgb[0], rgb[1], rgb[2], &yuv[0], &yuv[1], &yuv[2], BLI_YUV_ITU_BT709); scopes->vecscope[idx + 0] = yuv[1]; scopes->vecscope[idx + 1] = yuv[2]; - /* waveform */ + /* Waveform. */ switch (scopes->wavefrm_mode) { case SCOPES_WAVEFRM_RGB: case SCOPES_WAVEFRM_RGB_PARADE: @@ -1497,7 +1497,7 @@ static void scopes_update_cb(void *__restrict userdata, mul_v3_fl(ycc, INV_255); minmax_v3v3_v3(min, max, ycc); } - /* increment count for histo*/ + /* Increment count for histo. */ bin_lum[get_bin_float(luma)]++; bin_r[get_bin_float(rgba[0])]++; bin_g[get_bin_float(rgba[1])]++; diff --git a/source/blender/blenkernel/intern/constraint.c b/source/blender/blenkernel/intern/constraint.c index 826c79c3764..1d5cfa752a4 100644 --- a/source/blender/blenkernel/intern/constraint.c +++ b/source/blender/blenkernel/intern/constraint.c @@ -222,7 +222,7 @@ void BKE_constraints_clear_evalob(bConstraintOb *cob) /* XXX This would seem to be in wrong order. However, it does not work in 'right' order - * would be nice to understand why premul is needed here instead of usual postmul? * In any case, we **do not get a delta** here (e.g. startmat & matrix having same location, - * still gives a 'delta' with non-null translation component :/ ).*/ + * still gives a 'delta' with non-null translation component :/ ). */ mul_m4_m4m4(delta, cob->matrix, imat); /* copy matrices back to source */ @@ -272,7 +272,7 @@ void BKE_constraint_mat_convertspace(Object *ob, float diff_mat[4][4]; float imat[4][4]; - /* prevent crashes in these unlikely events */ + /* Prevent crashes in these unlikely events. */ if (ob == NULL || mat == NULL) { return; } @@ -1491,7 +1491,7 @@ static void followpath_get_tarmat(struct Depsgraph *UNUSED(depsgraph), dir, (data->followflag & FOLLOWPATH_FOLLOW) ? quat : NULL, &radius, - NULL)) { /* quat_pt is quat or NULL*/ + NULL)) { /* quat_pt is quat or NULL. */ float totmat[4][4]; unit_m4(totmat); @@ -2361,7 +2361,7 @@ static void pycon_new_data(void *cdata) { bPythonConstraint *data = (bPythonConstraint *)cdata; - /* everything should be set correctly by calloc, except for the prop->type constant.*/ + /* Everything should be set correctly by calloc, except for the prop->type constant. */ data->prop = MEM_callocN(sizeof(IDProperty), "PyConstraintProps"); data->prop->type = IDP_GROUP; } @@ -3523,7 +3523,7 @@ static void stretchto_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *t scale[0] = 1.0; scale[2] = 1.0; break; - default: /* should not happen, but in case*/ + default: /* Should not happen, but in case. */ return; } /* switch (data->volmode) */ @@ -3536,34 +3536,34 @@ static void stretchto_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *t damptrack_do_transform(cob->matrix, vec, TRACK_Y); break; case PLANE_X: - /* new Y aligns object target connection*/ + /* New Y aligns object target connection. */ copy_v3_v3(cob->matrix[1], vec); - /* build new Z vector */ - /* othogonal to "new Y" "old X! plane */ + /* Build new Z vector. */ + /* Orthogonal to "new Y" "old X! plane. */ cross_v3_v3v3(orth, xx, vec); normalize_v3(orth); - /* new Z*/ + /* New Z. */ copy_v3_v3(cob->matrix[2], orth); - /* we decided to keep X plane*/ + /* We decided to keep X plane. */ cross_v3_v3v3(xx, vec, orth); normalize_v3_v3(cob->matrix[0], xx); break; case PLANE_Z: - /* new Y aligns object target connection*/ + /* New Y aligns object target connection. */ copy_v3_v3(cob->matrix[1], vec); - /* build new X vector */ - /* othogonal to "new Y" "old Z! plane */ + /* Build new X vector. */ + /* Orthogonal to "new Y" "old Z! plane. */ cross_v3_v3v3(orth, zz, vec); normalize_v3(orth); - /* new X */ + /* New X. */ negate_v3_v3(cob->matrix[0], orth); - /* we decided to keep Z */ + /* We decided to keep Z. */ cross_v3_v3v3(zz, vec, orth); normalize_v3_v3(cob->matrix[2], zz); break; @@ -4678,7 +4678,7 @@ static void pivotcon_evaluate(bConstraint *con, bConstraintOb *cob, ListBase *ta } } - /* find the pivot-point to use */ + /* Find the pivot-point to use. */ if (VALID_CONS_TARGET(ct)) { /* apply offset to target location */ add_v3_v3v3(pivot, ct->matrix[3], data->offset); @@ -6297,7 +6297,7 @@ void BKE_constraint_blend_write(BlendWriter *writer, ListBase *conlist) } /* Write ID Properties -- and copy this comment EXACTLY for easy finding - * of library blocks that implement this.*/ + * of library blocks that implement this. */ IDP_BlendWrite(writer, data->prop); break; diff --git a/source/blender/blenkernel/intern/context.c b/source/blender/blenkernel/intern/context.c index 81830f5bb61..1028790856c 100644 --- a/source/blender/blenkernel/intern/context.c +++ b/source/blender/blenkernel/intern/context.c @@ -1225,8 +1225,11 @@ enum eContextObjectMode CTX_data_mode_enum(const bContext *C) return CTX_data_mode_enum_ex(obedit, obact, obact ? obact->mode : OB_MODE_OBJECT); } -/* would prefer if we can use the enum version below over this one - Campbell */ -/* must be aligned with above enum */ +/** + * Would prefer if we can use the enum version below over this one - Campbell. + * + * \note Must be aligned with above enum. + */ static const char *data_mode_strings[] = { "mesh_edit", "curve_edit", "surface_edit", "text_edit", "armature_edit", "mball_edit", "lattice_edit", "posemode", diff --git a/source/blender/blenkernel/intern/curve.c b/source/blender/blenkernel/intern/curve.c index 65cdb8503a4..462451fe72b 100644 --- a/source/blender/blenkernel/intern/curve.c +++ b/source/blender/blenkernel/intern/curve.c @@ -1926,7 +1926,7 @@ static int cu_isectLL(const float v1[3], static bool bevelinside(const BevList *bl1, const BevList *bl2) { /* is bl2 INSIDE bl1 ? with left-right method and "lambda's" */ - /* returns '1' if correct hole */ + /* returns '1' if correct hole. */ BevPoint *bevp, *prevbevp; float min, max, vec[3], hvec1[3], hvec2[3], lab, mu; int nr, links = 0, rechts = 0, mode; @@ -1941,7 +1941,7 @@ static bool bevelinside(const BevList *bl1, const BevList *bl2) hvec2[0] += 1000; /* test it with all edges of potential surrounding poly */ - /* count number of transitions left-right */ + /* count number of transitions left-right. */ bevp = bl1->bevpoints; nr = bl1->nr; @@ -2133,7 +2133,7 @@ static void tilt_bezpart(const BezTriple *prevbezt, } if (weight_array) { - /* basic interpolation for now, could copy tilt interp too */ + /* Basic interpolation for now, could copy tilt interp too. */ *weight_array = prevbezt->weight + (bezt->weight - prevbezt->weight) * (3.0f * fac * fac - 2.0f * fac * fac * fac); @@ -2684,7 +2684,7 @@ void BKE_curve_bevelList_make(Object *ob, ListBase *nurbs, bool for_render) 1; #endif - /* STEP 1: MAKE POLYS */ + /* STEP 1: MAKE POLYS */ BKE_curve_bevelList_free(&ob->runtime.curve_cache->bev); if (cu->editnurb && ob->type != OB_FONT) { @@ -4361,7 +4361,7 @@ void BKE_nurbList_handles_set(ListBase *editnurb, const char code) else { char h_new = HD_FREE; - /* there is 1 handle not FREE: FREE it all, else make ALIGNED */ + /* There is 1 handle not FREE: FREE it all, else make ALIGNED. */ if (code == 5) { h_new = HD_ALIGN; } @@ -4932,7 +4932,7 @@ bool BKE_nurb_type_convert(Nurb *nu, int a, c, nr; if (nu->type == CU_POLY) { - if (type == CU_BEZIER) { /* to Bezier with vecthandles */ + if (type == CU_BEZIER) { /* To Bezier with vecthandles. */ nr = nu->pntsu; bezt = (BezTriple *)MEM_calloc_arrayN(nr, sizeof(BezTriple), "setsplinetype2"); nu->bezt = bezt; diff --git a/source/blender/blenkernel/intern/curve_bevel.c b/source/blender/blenkernel/intern/curve_bevel.c index 0b9cd7affdf..f853e584537 100644 --- a/source/blender/blenkernel/intern/curve_bevel.c +++ b/source/blender/blenkernel/intern/curve_bevel.c @@ -97,7 +97,7 @@ static void curve_bevel_make_extrude_and_fill(const Curve *cu, * in a consistent direction. * * These should be small enough for stack allocations because the current limit - * for #Curve.bevresol is 32. */ + * for #Curve.bevresol is 32. */ float *quarter_coords_x = alloca(sizeof(float) * (cu->bevresol + 1)); float *quarter_coords_y = alloca(sizeof(float) * (cu->bevresol + 1)); bevel_quarter_fill((Curve *)cu, quarter_coords_x, quarter_coords_y); diff --git a/source/blender/blenkernel/intern/curve_decimate.c b/source/blender/blenkernel/intern/curve_decimate.c index e4647908b58..62de7c74183 100644 --- a/source/blender/blenkernel/intern/curve_decimate.c +++ b/source/blender/blenkernel/intern/curve_decimate.c @@ -32,8 +32,8 @@ struct Knot { struct Knot *next, *prev; - uint point_index; /* index in point array */ - uint knot_index; /* index in knot array*/ + uint point_index; /* Index in point array. */ + uint knot_index; /* Index in knot array. */ float tan[2][3]; float handles[2]; diff --git a/source/blender/blenkernel/intern/curve_deform.c b/source/blender/blenkernel/intern/curve_deform.c index 10c6d2213ff..7deac4e4f19 100644 --- a/source/blender/blenkernel/intern/curve_deform.c +++ b/source/blender/blenkernel/intern/curve_deform.c @@ -173,12 +173,10 @@ static bool calc_curve_deform( copy_qt_qt(quat, new_quat); copy_v3_v3(cent, co); - /* zero the axis which is not used, - * the big block of text above now applies to these 3 lines */ - quat_apply_track(quat, - axis, - (ELEM(axis, 0, 2)) ? 1 : - 0); /* up flag is a dummy, set so no rotation is done */ + /* Zero the axis which is not used, + * the big block of text above now applies to these 3 lines. + * The `upflag` argument may be a dummy, set so no rotation is done. */ + quat_apply_track(quat, axis, (ELEM(axis, 0, 2)) ? 1 : 0); vec_apply_track(cent, axis); cent[index] = 0.0f; diff --git a/source/blender/blenkernel/intern/curve_eval.cc b/source/blender/blenkernel/intern/curve_eval.cc index c9408cf4fcd..0a6e4458a35 100644 --- a/source/blender/blenkernel/intern/curve_eval.cc +++ b/source/blender/blenkernel/intern/curve_eval.cc @@ -15,10 +15,13 @@ */ #include "BLI_array.hh" +#include "BLI_index_range.hh" #include "BLI_listbase.h" #include "BLI_map.hh" #include "BLI_span.hh" #include "BLI_string_ref.hh" +#include "BLI_task.hh" +#include "BLI_vector.hh" #include "DNA_curve_types.h" @@ -28,9 +31,12 @@ using blender::Array; using blender::float3; using blender::float4x4; +using blender::IndexRange; using blender::Map; +using blender::MutableSpan; using blender::Span; using blender::StringRefNull; +using blender::Vector; blender::Span<SplinePtr> CurveEval::splines() const { @@ -168,70 +174,118 @@ static NURBSpline::KnotsMode knots_mode_from_dna_nurb(const short flag) return NURBSpline::KnotsMode::Normal; } +static SplinePtr spline_from_dna_bezier(const Nurb &nurb) +{ + std::unique_ptr<BezierSpline> spline = std::make_unique<BezierSpline>(); + spline->set_resolution(nurb.resolu); + spline->set_cyclic(nurb.flagu & CU_NURB_CYCLIC); + + Span<const BezTriple> src_points{nurb.bezt, nurb.pntsu}; + spline->resize(src_points.size()); + MutableSpan<float3> positions = spline->positions(); + MutableSpan<float3> handle_positions_left = spline->handle_positions_left(); + MutableSpan<float3> handle_positions_right = spline->handle_positions_right(); + MutableSpan<BezierSpline::HandleType> handle_types_left = spline->handle_types_left(); + MutableSpan<BezierSpline::HandleType> handle_types_right = spline->handle_types_right(); + MutableSpan<float> radii = spline->radii(); + MutableSpan<float> tilts = spline->tilts(); + + blender::threading::parallel_for(src_points.index_range(), 2048, [&](IndexRange range) { + for (const int i : range) { + const BezTriple &bezt = src_points[i]; + positions[i] = bezt.vec[1]; + handle_positions_left[i] = bezt.vec[0]; + handle_types_left[i] = handle_type_from_dna_bezt((eBezTriple_Handle)bezt.h1); + handle_positions_right[i] = bezt.vec[2]; + handle_types_right[i] = handle_type_from_dna_bezt((eBezTriple_Handle)bezt.h2); + radii[i] = bezt.radius; + tilts[i] = bezt.tilt; + } + }); + + return spline; +} + +static SplinePtr spline_from_dna_nurbs(const Nurb &nurb) +{ + std::unique_ptr<NURBSpline> spline = std::make_unique<NURBSpline>(); + spline->set_resolution(nurb.resolu); + spline->set_cyclic(nurb.flagu & CU_NURB_CYCLIC); + spline->set_order(nurb.orderu); + spline->knots_mode = knots_mode_from_dna_nurb(nurb.flagu); + + Span<const BPoint> src_points{nurb.bp, nurb.pntsu}; + spline->resize(src_points.size()); + MutableSpan<float3> positions = spline->positions(); + MutableSpan<float> weights = spline->weights(); + MutableSpan<float> radii = spline->radii(); + MutableSpan<float> tilts = spline->tilts(); + + blender::threading::parallel_for(src_points.index_range(), 2048, [&](IndexRange range) { + for (const int i : range) { + const BPoint &bp = src_points[i]; + positions[i] = bp.vec; + weights[i] = bp.vec[3]; + radii[i] = bp.radius; + tilts[i] = bp.tilt; + } + }); + + return spline; +} + +static SplinePtr spline_from_dna_poly(const Nurb &nurb) +{ + std::unique_ptr<PolySpline> spline = std::make_unique<PolySpline>(); + spline->set_cyclic(nurb.flagu & CU_NURB_CYCLIC); + + Span<const BPoint> src_points{nurb.bp, nurb.pntsu}; + spline->resize(src_points.size()); + MutableSpan<float3> positions = spline->positions(); + MutableSpan<float> radii = spline->radii(); + MutableSpan<float> tilts = spline->tilts(); + + blender::threading::parallel_for(src_points.index_range(), 2048, [&](IndexRange range) { + for (const int i : range) { + const BPoint &bp = src_points[i]; + positions[i] = bp.vec; + radii[i] = bp.radius; + tilts[i] = bp.tilt; + } + }); + + return spline; +} + std::unique_ptr<CurveEval> curve_eval_from_dna_curve(const Curve &dna_curve) { + Vector<const Nurb *> nurbs(*BKE_curve_nurbs_get(&const_cast<Curve &>(dna_curve))); + std::unique_ptr<CurveEval> curve = std::make_unique<CurveEval>(); + curve->resize(nurbs.size()); + MutableSpan<SplinePtr> splines = curve->splines(); - const ListBase *nurbs = BKE_curve_nurbs_get(&const_cast<Curve &>(dna_curve)); - - /* TODO: Optimize by reserving the correct points size. */ - LISTBASE_FOREACH (const Nurb *, nurb, nurbs) { - switch (nurb->type) { - case CU_BEZIER: { - std::unique_ptr<BezierSpline> spline = std::make_unique<BezierSpline>(); - spline->set_resolution(nurb->resolu); - spline->set_cyclic(nurb->flagu & CU_NURB_CYCLIC); - - for (const BezTriple &bezt : Span(nurb->bezt, nurb->pntsu)) { - spline->add_point(bezt.vec[1], - handle_type_from_dna_bezt((eBezTriple_Handle)bezt.h1), - bezt.vec[0], - handle_type_from_dna_bezt((eBezTriple_Handle)bezt.h2), - bezt.vec[2], - bezt.radius, - bezt.tilt); - } - spline->attributes.reallocate(spline->size()); - curve->add_spline(std::move(spline)); - break; - } - case CU_NURBS: { - std::unique_ptr<NURBSpline> spline = std::make_unique<NURBSpline>(); - spline->set_resolution(nurb->resolu); - spline->set_cyclic(nurb->flagu & CU_NURB_CYCLIC); - spline->set_order(nurb->orderu); - spline->knots_mode = knots_mode_from_dna_nurb(nurb->flagu); - - for (const BPoint &bp : Span(nurb->bp, nurb->pntsu)) { - spline->add_point(bp.vec, bp.radius, bp.tilt, bp.vec[3]); - } - spline->attributes.reallocate(spline->size()); - curve->add_spline(std::move(spline)); - break; - } - case CU_POLY: { - std::unique_ptr<PolySpline> spline = std::make_unique<PolySpline>(); - spline->set_cyclic(nurb->flagu & CU_NURB_CYCLIC); - - for (const BPoint &bp : Span(nurb->bp, nurb->pntsu)) { - spline->add_point(bp.vec, bp.radius, bp.tilt); - } - spline->attributes.reallocate(spline->size()); - curve->add_spline(std::move(spline)); - break; - } - default: { - BLI_assert_unreachable(); - break; + blender::threading::parallel_for(nurbs.index_range(), 256, [&](IndexRange range) { + for (const int i : range) { + switch (nurbs[i]->type) { + case CU_BEZIER: + splines[i] = spline_from_dna_bezier(*nurbs[i]); + break; + case CU_NURBS: + splines[i] = spline_from_dna_nurbs(*nurbs[i]); + break; + case CU_POLY: + splines[i] = spline_from_dna_poly(*nurbs[i]); + break; + default: + BLI_assert_unreachable(); + break; } } - } - - /* Though the curve has no attributes, this is necessary to properly set the custom data size. */ - curve->attributes.reallocate(curve->splines().size()); + }); - /* Note: Normal mode is stored separately in each spline to facilitate combining splines - * from multiple curve objects, where the value may be different. */ + /* Normal mode is stored separately in each spline to facilitate combining + * splines from multiple curve objects, where the value may be different. */ const Spline::NormalCalculationMode normal_mode = normal_mode_from_dna_curve( dna_curve.twist_mode); for (SplinePtr &spline : curve->splines()) { diff --git a/source/blender/blenkernel/intern/customdata.c b/source/blender/blenkernel/intern/customdata.c index 352e5f0093d..cdf3bf09b64 100644 --- a/source/blender/blenkernel/intern/customdata.c +++ b/source/blender/blenkernel/intern/customdata.c @@ -2066,7 +2066,7 @@ const CustomData_MeshMasks CD_MASK_BMESH = { CD_MASK_SCULPT_FACE_SETS), }; /** - * cover values copied by #BKE_mesh_loops_to_tessdata + * cover values copied by #mesh_loops_to_tessdata */ const CustomData_MeshMasks CD_MASK_FACECORNERS = { .vmask = 0, @@ -2220,7 +2220,7 @@ bool CustomData_merge(const struct CustomData *source, eCDAllocType alloctype, int totelem) { - /*const LayerTypeInfo *typeInfo;*/ + // const LayerTypeInfo *typeInfo; CustomDataLayer *layer, *newlayer; int lasttype = -1, lastactive = 0, lastrender = 0, lastclone = 0, lastmask = 0; int number = 0, maxnumber = -1; @@ -2228,7 +2228,7 @@ bool CustomData_merge(const struct CustomData *source, for (int i = 0; i < source->totlayer; i++) { layer = &source->layers[i]; - /*typeInfo = layerType_getInfo(layer->type);*/ /*UNUSED*/ + // typeInfo = layerType_getInfo(layer->type); /* UNUSED */ int type = layer->type; int flag = layer->flag; @@ -2752,7 +2752,7 @@ void *CustomData_add_layer( return NULL; } -/*same as above but accepts a name*/ +/* Same as above but accepts a name. */ void *CustomData_add_layer_named(CustomData *data, int type, eCDAllocType alloctype, @@ -2934,6 +2934,14 @@ void *CustomData_duplicate_referenced_layer_named(CustomData *data, return customData_duplicate_referenced_layer_index(data, layer_index, totelem); } +void CustomData_duplicate_referenced_layers(CustomData *data, int totelem) +{ + for (int i = 0; i < data->totlayer; i++) { + CustomDataLayer *layer = &data->layers[i]; + layer->data = CustomData_duplicate_referenced_layer(data, layer->type, totelem); + } +} + bool CustomData_is_referenced_layer(struct CustomData *data, int type) { /* get the layer index of the first layer of type */ @@ -3698,7 +3706,7 @@ bool CustomData_bmesh_merge(const CustomData *source, if (iter_type != BM_LOOPS_OF_FACE) { BMHeader *h; BMIter iter; - /*ensure all current elements follow new customdata layout*/ + /* Ensure all current elements follow new customdata layout. */ BM_ITER_MESH (h, &iter, bm, iter_type) { void *tmp = NULL; CustomData_bmesh_copy_data(&destold, dest, h->data, &tmp); @@ -3712,7 +3720,7 @@ bool CustomData_bmesh_merge(const CustomData *source, BMIter iter; BMIter liter; - /*ensure all current elements follow new customdata layout*/ + /* Ensure all current elements follow new customdata layout. */ BM_ITER_MESH (f, &iter, bm, BM_FACES_OF_MESH) { BM_ITER_ELEM (l, &liter, f, BM_LOOPS_OF_FACE) { void *tmp = NULL; @@ -4005,7 +4013,7 @@ void *CustomData_bmesh_get_n(const CustomData *data, void *block, int type, int return POINTER_OFFSET(block, data->layers[layer_index + n].offset); } -/*gets from the layer at physical index n, note: doesn't check type.*/ +/* Gets from the layer at physical index n, note: doesn't check type. */ void *CustomData_bmesh_get_layer_n(const CustomData *data, void *block, int n) { if (n < 0 || n >= data->totlayer) { @@ -4087,7 +4095,7 @@ bool CustomData_has_referenced(const struct CustomData *data) } /* copies the "value" (e.g. mloopuv uv or mloopcol colors) from one block to - * another, while not overwriting anything else (e.g. flags)*/ + * another, while not overwriting anything else (e.g. flags). */ void CustomData_data_copy_value(int type, const void *source, void *dest) { const LayerTypeInfo *typeInfo = layerType_getInfo(type); @@ -4105,7 +4113,7 @@ void CustomData_data_copy_value(int type, const void *source, void *dest) } /* Mixes the "value" (e.g. mloopuv uv or mloopcol colors) from one block into - * another, while not overwriting anything else (e.g. flags)*/ + * another, while not overwriting anything else (e.g. flags). */ void CustomData_data_mix_value( int type, const void *source, void *dest, const int mixmode, const float mixfactor) { diff --git a/source/blender/blenkernel/intern/data_transfer.c b/source/blender/blenkernel/intern/data_transfer.c index 7bcb8607a4e..5165d0cd282 100644 --- a/source/blender/blenkernel/intern/data_transfer.c +++ b/source/blender/blenkernel/intern/data_transfer.c @@ -1263,7 +1263,7 @@ void BKE_object_data_transfer_layout(struct Depsgraph *depsgraph, me_dst = ob_dst->data; - /* Get source evaluated mesh.*/ + /* Get source evaluated mesh. */ BKE_object_data_transfer_dttypes_to_cdmask(data_types, &me_src_mask); me_src = mesh_get_eval_final(depsgraph, scene, ob_src, &me_src_mask); if (!me_src) { @@ -1444,7 +1444,7 @@ bool BKE_object_data_transfer_ex(struct Depsgraph *depsgraph, } } - /* Get source evaluated mesh.*/ + /* Get source evaluated mesh. */ BKE_object_data_transfer_dttypes_to_cdmask(data_types, &me_src_mask); BKE_mesh_remap_calc_source_cddata_masks_from_map_modes( map_vert_mode, map_edge_mode, map_loop_mode, map_poly_mode, &me_src_mask); diff --git a/source/blender/blenkernel/intern/displist.cc b/source/blender/blenkernel/intern/displist.cc index 70355f3883d..65251ac1807 100644 --- a/source/blender/blenkernel/intern/displist.cc +++ b/source/blender/blenkernel/intern/displist.cc @@ -323,7 +323,7 @@ static void curve_to_displist(const Curve *cu, /* Check that there are more than two points so the curve doesn't loop back on itself. This * needs to be separate from `is_cyclic` because cyclic sampling can work with two points - * and resolution > 1. */ + * and resolution > 1. */ const bool use_cyclic_sample = is_cyclic && (samples_len != 2); DispList *dl = (DispList *)MEM_callocN(sizeof(DispList), __func__); diff --git a/source/blender/blenkernel/intern/dynamicpaint.c b/source/blender/blenkernel/intern/dynamicpaint.c index 42af3a391ed..2eb18a06799 100644 --- a/source/blender/blenkernel/intern/dynamicpaint.c +++ b/source/blender/blenkernel/intern/dynamicpaint.c @@ -1757,7 +1757,7 @@ void dynamicPaint_clearSurface(const Scene *scene, DynamicPaintSurface *surface) } } -/* completely (re)initializes surface (only for point cache types)*/ +/* Completely (re)initializes surface (only for point cache types). */ bool dynamicPaint_resetSurface(const Scene *scene, DynamicPaintSurface *surface) { int numOfPoints = dynamicPaint_surfaceNumOfPoints(surface); @@ -4145,7 +4145,7 @@ static void dynamic_paint_paint_mesh_cell_point_cb_ex( /* mix final sample strength depending on brush settings */ if (hit_found) { - /* if "negate volume" enabled, negate all factors within volume*/ + /* If "negate volume" enabled, negate all factors within volume. */ if (brush->collision == MOD_DPAINT_COL_VOLDIST && brush->flags & MOD_DPAINT_NEGATE_VOLUME) { volume_factor = 1.0f - volume_factor; if (inner_proximity) { @@ -5185,7 +5185,7 @@ static int dynamicPaint_prepareEffectStep(struct Depsgraph *depsgraph, } /* Get number of required steps using average point distance - * so that just a few ultra close pixels wont up substeps to max. */ + * so that just a few ultra close pixels won't increase substeps to max. */ /* adjust number of required substep by fastest active effect */ if (surface->effect & MOD_DPAINT_EFFECT_DO_SPREAD) { diff --git a/source/blender/blenkernel/intern/editmesh.c b/source/blender/blenkernel/intern/editmesh.c index b512309a773..49c2a2cbd89 100644 --- a/source/blender/blenkernel/intern/editmesh.c +++ b/source/blender/blenkernel/intern/editmesh.c @@ -222,7 +222,7 @@ void BKE_editmesh_free_derivedmesh(BMEditMesh *em) MEM_SAFE_FREE(em->bb_cage); } -/*does not free the BMEditMesh struct itself*/ +/* Does not free the #BMEditMesh struct itself. */ void BKE_editmesh_free(BMEditMesh *em) { BKE_editmesh_free_derivedmesh(em); diff --git a/source/blender/blenkernel/intern/editmesh_bvh.c b/source/blender/blenkernel/intern/editmesh_bvh.c index c4f855dd8c2..9e0e1933a00 100644 --- a/source/blender/blenkernel/intern/editmesh_bvh.c +++ b/source/blender/blenkernel/intern/editmesh_bvh.c @@ -117,7 +117,7 @@ BMBVHTree *BKE_bmbvh_new_ex(BMesh *bm, for (int i = 0; i < looptris_tot; i++) { if (test_fn) { - /* note, the arrays wont align now! take care */ + /* Note: the arrays won't align now! Take care. */ f_test = looptris[i][0]->f; if (f_test != f_test_prev) { test_fn_ret = test_fn(f_test, user_data); diff --git a/source/blender/blenkernel/intern/effect.c b/source/blender/blenkernel/intern/effect.c index e39749225ea..ff0fc4754e3 100644 --- a/source/blender/blenkernel/intern/effect.c +++ b/source/blender/blenkernel/intern/effect.c @@ -773,7 +773,7 @@ int get_effector_data(EffectorCache *eff, /* use center of object for distance calculus */ const Object *ob = eff->ob; - /* use z-axis as normal*/ + /* Use z-axis as normal. */ normalize_v3_v3(efd->nor, ob->obmat[2]); if (eff->pd && ELEM(eff->pd->shape, PFIELD_SHAPE_PLANE, PFIELD_SHAPE_LINE)) { diff --git a/source/blender/blenkernel/intern/fcurve.c b/source/blender/blenkernel/intern/fcurve.c index 68ed3c239ef..18dac2fb679 100644 --- a/source/blender/blenkernel/intern/fcurve.c +++ b/source/blender/blenkernel/intern/fcurve.c @@ -1309,7 +1309,7 @@ void calchandles_fcurve_ex(FCurve *fcu, eBezTriple_Flag handle_sel_flag) * - Need bezier keys. * - Only bezier-interpolation has handles (for now). */ - if (ELEM(NULL, fcu, fcu->bezt) || (a < 2) /*|| ELEM(fcu->ipo, BEZT_IPO_CONST, BEZT_IPO_LIN)*/) { + if (ELEM(NULL, fcu, fcu->bezt) || (a < 2) /*|| ELEM(fcu->ipo, BEZT_IPO_CONST, BEZT_IPO_LIN) */) { return; } @@ -2322,7 +2322,7 @@ void BKE_fmodifiers_blend_write(BlendWriter *writer, ListBase *fmodifiers) FMod_Python *data = fcm->data; /* Write ID Properties -- and copy this comment EXACTLY for easy finding - * of library blocks that implement this.*/ + * of library blocks that implement this. */ IDP_BlendWrite(writer, data->prop); break; diff --git a/source/blender/blenkernel/intern/fluid.c b/source/blender/blenkernel/intern/fluid.c index 2e8f08519d2..947417af55d 100644 --- a/source/blender/blenkernel/intern/fluid.c +++ b/source/blender/blenkernel/intern/fluid.c @@ -1615,8 +1615,9 @@ static void emit_from_particles(Object *flow_ob, } } - state.time = BKE_scene_frame_get( - scene); /* DEG_get_ctime(depsgraph) does not give subframe time */ + /* `DEG_get_ctime(depsgraph)` does not give sub-frame time. */ + state.time = BKE_scene_frame_get(scene); + if (psys_get_particle_state(&sim, p, &state, 0) == 0) { continue; } @@ -4394,7 +4395,7 @@ static void manta_smoke_calc_transparency(FluidDomainSettings *fds, ViewLayer *v int cell[3]; float t_ray = 1.0; - /* Reset shadow value.*/ + /* Reset shadow value. */ shadow[index] = -1.0f; voxel_center[0] = (float)x; @@ -5022,7 +5023,7 @@ void BKE_fluid_modifier_copy(const struct FluidModifierData *fmd, /* viscosity options */ tfds->viscosity_value = fds->viscosity_value; - /* diffusion options*/ + /* Diffusion options. */ tfds->surface_tension = fds->surface_tension; tfds->viscosity_base = fds->viscosity_base; tfds->viscosity_exponent = fds->viscosity_exponent; diff --git a/source/blender/blenkernel/intern/fmodifier.c b/source/blender/blenkernel/intern/fmodifier.c index 8d1e6b26d4d..b9f0b97ab46 100644 --- a/source/blender/blenkernel/intern/fmodifier.c +++ b/source/blender/blenkernel/intern/fmodifier.c @@ -875,7 +875,7 @@ static void fcm_python_new_data(void *mdata) { FMod_Python *data = (FMod_Python *)mdata; - /* everything should be set correctly by calloc, except for the prop->type constant.*/ + /* Everything should be set correctly by calloc, except for the prop->type constant. */ data->prop = MEM_callocN(sizeof(IDProperty), "PyFModifierProps"); data->prop->type = IDP_GROUP; } diff --git a/source/blender/blenkernel/intern/font.c b/source/blender/blenkernel/intern/font.c index 92cc3c763b6..95de9a9d636 100644 --- a/source/blender/blenkernel/intern/font.c +++ b/source/blender/blenkernel/intern/font.c @@ -1271,7 +1271,7 @@ static bool vfont_to_curve(Object *ob, MEM_freeN(i_textbox_array); /* TEXT ON CURVE */ - /* Note: Only OB_CURVE objects could have a path */ + /* NOTE: Only OB_CURVE objects could have a path. */ if (cu->textoncurve && cu->textoncurve->type == OB_CURVE) { BLI_assert(cu->textoncurve->runtime.curve_cache != NULL); if (cu->textoncurve->runtime.curve_cache != NULL && @@ -1746,7 +1746,7 @@ void BKE_vfont_clipboard_set(const char32_t *text_buf, const CharInfo *info_buf, char32_t *text; CharInfo *info; - /* clean previous buffers*/ + /* Clean previous buffers. */ BKE_vfont_clipboard_free(); text = MEM_malloc_arrayN((len + 1), sizeof(*text), __func__); diff --git a/source/blender/blenkernel/intern/geometry_component_mesh.cc b/source/blender/blenkernel/intern/geometry_component_mesh.cc index 42f3a854aec..28e46aab732 100644 --- a/source/blender/blenkernel/intern/geometry_component_mesh.cc +++ b/source/blender/blenkernel/intern/geometry_component_mesh.cc @@ -29,7 +29,7 @@ #include "attribute_access_intern.hh" -/* Can't include BKE_object_deform.h right now, due to an enum forward declaration. */ +/* Can't include BKE_object_deform.h right now, due to an enum forward declaration. */ extern "C" MDeformVert *BKE_object_defgroup_data_create(ID *id); using blender::fn::GVArray; diff --git a/source/blender/blenkernel/intern/geometry_set_instances.cc b/source/blender/blenkernel/intern/geometry_set_instances.cc index 791a8d219df..8cf08d05d9d 100644 --- a/source/blender/blenkernel/intern/geometry_set_instances.cc +++ b/source/blender/blenkernel/intern/geometry_set_instances.cc @@ -550,7 +550,45 @@ static void join_attributes(Span<GeometryInstanceGroup> set_groups, } } -static CurveEval *join_curve_splines(Span<GeometryInstanceGroup> set_groups) +static PointCloud *join_pointcloud_position_attribute(Span<GeometryInstanceGroup> set_groups) +{ + /* Count the total number of points. */ + int totpoint = 0; + for (const GeometryInstanceGroup &set_group : set_groups) { + const GeometrySet &set = set_group.geometry_set; + if (set.has<PointCloudComponent>()) { + const PointCloudComponent &component = *set.get_component_for_read<PointCloudComponent>(); + totpoint += component.attribute_domain_size(ATTR_DOMAIN_POINT); + } + } + if (totpoint == 0) { + return nullptr; + } + + PointCloud *new_pointcloud = BKE_pointcloud_new_nomain(totpoint); + + /* Transform each instance's point locations into the new point cloud. */ + int offset = 0; + for (const GeometryInstanceGroup &set_group : set_groups) { + const GeometrySet &set = set_group.geometry_set; + const PointCloud *pointcloud = set.get_pointcloud_for_read(); + if (pointcloud == nullptr) { + continue; + } + for (const float4x4 &transform : set_group.transforms) { + for (const int i : IndexRange(pointcloud->totpoint)) { + const float3 old_position = pointcloud->co[i]; + const float3 new_position = transform * old_position; + copy_v3_v3(new_pointcloud->co[offset + i], new_position); + } + offset += pointcloud->totpoint; + } + } + + return new_pointcloud; +} + +static CurveEval *join_curve_splines_and_builtin_attributes(Span<GeometryInstanceGroup> set_groups) { Vector<SplinePtr> new_splines; for (const GeometryInstanceGroup &set_group : set_groups) { @@ -562,7 +600,7 @@ static CurveEval *join_curve_splines(Span<GeometryInstanceGroup> set_groups) const CurveEval &source_curve = *set.get_curve_for_read(); for (const SplinePtr &source_spline : source_curve.splines()) { for (const float4x4 &transform : set_group.transforms) { - SplinePtr new_spline = source_spline->copy(); + SplinePtr new_spline = source_spline->copy_without_attributes(); new_spline->transform(transform); new_splines.append(std::move(new_spline)); } @@ -577,15 +615,6 @@ static CurveEval *join_curve_splines(Span<GeometryInstanceGroup> set_groups) new_curve->add_spline(std::move(new_spline)); } - for (SplinePtr &spline : new_curve->splines()) { - /* Spline instances should have no custom attributes, since they always come - * from original objects which currently do not support custom attributes. - * - * This is only true as long as a #GeometrySet cannot be instanced directly. */ - BLI_assert(spline->attributes.data.totlayer == 0); - UNUSED_VARS_NDEBUG(spline); - } - new_curve->attributes.reallocate(new_curve->splines().size()); return new_curve; } @@ -623,24 +652,17 @@ static void join_instance_groups_mesh(Span<GeometryInstanceGroup> set_groups, static void join_instance_groups_pointcloud(Span<GeometryInstanceGroup> set_groups, GeometrySet &result) { - int totpoint = 0; - for (const GeometryInstanceGroup &set_group : set_groups) { - const GeometrySet &set = set_group.geometry_set; - if (set.has<PointCloudComponent>()) { - const PointCloudComponent &component = *set.get_component_for_read<PointCloudComponent>(); - totpoint += component.attribute_domain_size(ATTR_DOMAIN_POINT); - } - } - if (totpoint == 0) { + PointCloud *new_pointcloud = join_pointcloud_position_attribute(set_groups); + if (new_pointcloud == nullptr) { return; } PointCloudComponent &dst_component = result.get_component_for_write<PointCloudComponent>(); - PointCloud *pointcloud = BKE_pointcloud_new_nomain(totpoint); - dst_component.replace(pointcloud); + dst_component.replace(new_pointcloud); + Map<std::string, AttributeKind> attributes; geometry_set_gather_instances_attribute_info( - set_groups, {GEO_COMPONENT_TYPE_POINT_CLOUD}, {}, attributes); + set_groups, {GEO_COMPONENT_TYPE_POINT_CLOUD}, {"position"}, attributes); join_attributes(set_groups, {GEO_COMPONENT_TYPE_POINT_CLOUD}, attributes, @@ -664,12 +686,24 @@ static void join_instance_groups_volume(Span<GeometryInstanceGroup> set_groups, static void join_instance_groups_curve(Span<GeometryInstanceGroup> set_groups, GeometrySet &result) { - CurveEval *curve = join_curve_splines(set_groups); + CurveEval *curve = join_curve_splines_and_builtin_attributes(set_groups); if (curve == nullptr) { return; } + CurveComponent &dst_component = result.get_component_for_write<CurveComponent>(); dst_component.replace(curve); + + Map<std::string, AttributeKind> attributes; + geometry_set_gather_instances_attribute_info( + set_groups, + {GEO_COMPONENT_TYPE_CURVE}, + {"position", "radius", "tilt", "cyclic", "resolution"}, + attributes); + join_attributes(set_groups, + {GEO_COMPONENT_TYPE_CURVE}, + attributes, + static_cast<GeometryComponent &>(dst_component)); } GeometrySet geometry_set_realize_mesh_for_modifier(const GeometrySet &geometry_set) diff --git a/source/blender/blenkernel/intern/gpencil.c b/source/blender/blenkernel/intern/gpencil.c index f0dda488216..459fc5e4c68 100644 --- a/source/blender/blenkernel/intern/gpencil.c +++ b/source/blender/blenkernel/intern/gpencil.c @@ -195,12 +195,12 @@ static void greasepencil_blend_write(BlendWriter *writer, ID *id, const void *id void BKE_gpencil_blend_read_data(BlendDataReader *reader, bGPdata *gpd) { - /* we must firstly have some grease-pencil data to link! */ + /* We must firstly have some grease-pencil data to link! */ if (gpd == NULL) { return; } - /* relink animdata */ + /* Relink anim-data. */ BLO_read_data_address(reader, &gpd->adt); BKE_animdata_blend_read_data(reader, gpd->adt); @@ -219,7 +219,7 @@ void BKE_gpencil_blend_read_data(BlendDataReader *reader, bGPdata *gpd) gpd->runtime.sbuffer_size = 0; gpd->runtime.tot_cp_points = 0; - /* relink palettes (old palettes deprecated, only to convert old files) */ + /* Relink palettes (old palettes deprecated, only to convert old files). */ BLO_read_list(reader, &gpd->palettes); if (gpd->palettes.first != NULL) { LISTBASE_FOREACH (bGPDpalette *, palette, &gpd->palettes) { @@ -227,14 +227,14 @@ void BKE_gpencil_blend_read_data(BlendDataReader *reader, bGPdata *gpd) } } - /* materials */ + /* Materials. */ BLO_read_pointer_array(reader, (void **)&gpd->mat); - /* relink layers */ + /* Relink layers. */ BLO_read_list(reader, &gpd->layers); LISTBASE_FOREACH (bGPDlayer *, gpl, &gpd->layers) { - /* relink frames */ + /* Relink frames. */ BLO_read_list(reader, &gpl->frames); BLO_read_data_address(reader, &gpl->actframe); @@ -245,23 +245,23 @@ void BKE_gpencil_blend_read_data(BlendDataReader *reader, bGPdata *gpd) BLO_read_list(reader, &gpl->mask_layers); LISTBASE_FOREACH (bGPDframe *, gpf, &gpl->frames) { - /* relink strokes (and their points) */ + /* Relink strokes (and their points). */ BLO_read_list(reader, &gpf->strokes); LISTBASE_FOREACH (bGPDstroke *, gps, &gpf->strokes) { - /* relink stroke points array */ + /* Relink stroke points array. */ BLO_read_data_address(reader, &gps->points); - /* Relink geometry*/ + /* Relink geometry. */ BLO_read_data_address(reader, &gps->triangles); - /* relink stroke edit curve. */ + /* Relink stroke edit curve. */ BLO_read_data_address(reader, &gps->editcurve); if (gps->editcurve != NULL) { - /* relink curve point array */ + /* Relink curve point array. */ BLO_read_data_address(reader, &gps->editcurve->curve_points); } - /* relink weight data */ + /* Relink weight data. */ if (gps->dvert) { BLO_read_data_address(reader, &gps->dvert); BKE_defvert_blend_read(reader, gps->totpoints, gps->dvert); @@ -458,7 +458,7 @@ void BKE_gpencil_free_frames(bGPDlayer *gpl) void BKE_gpencil_free_layer_masks(bGPDlayer *gpl) { - /* Free masks.*/ + /* Free masks. */ bGPDlayer_Mask *mask_next = NULL; for (bGPDlayer_Mask *mask = gpl->mask_layers.first; mask; mask = mask_next) { mask_next = mask->next; @@ -482,7 +482,7 @@ void BKE_gpencil_free_layers(ListBase *list) /* free layers and their data */ BKE_gpencil_free_frames(gpl); - /* Free masks.*/ + /* Free masks. */ BKE_gpencil_free_layer_masks(gpl); BLI_freelinkN(list, gpl); @@ -1076,12 +1076,7 @@ bGPDlayer *BKE_gpencil_layer_duplicate(const bGPDlayer *gpl_src, gpl_dst->prev = gpl_dst->next = NULL; /* Copy masks. */ - BLI_listbase_clear(&gpl_dst->mask_layers); - LISTBASE_FOREACH (bGPDlayer_Mask *, mask_src, &gpl_src->mask_layers) { - bGPDlayer_Mask *mask_dst = MEM_dupallocN(mask_src); - mask_dst->prev = mask_dst->next = NULL; - BLI_addtail(&gpl_dst->mask_layers, mask_dst); - } + BKE_gpencil_layer_mask_copy(gpl_src, gpl_dst); /* copy frames */ BLI_listbase_clear(&gpl_dst->frames); @@ -1122,10 +1117,8 @@ void BKE_gpencil_layer_copy_settings(const bGPDlayer *gpl_src, bGPDlayer *gpl_ds copy_v3_v3(gpl_dst->scale, gpl_src->scale); copy_m4_m4(gpl_dst->layer_mat, gpl_src->layer_mat); copy_m4_m4(gpl_dst->layer_invmat, gpl_src->layer_invmat); - /* Use Lights flag. */ - if (gpl_src->flag & GP_LAYER_USE_LIGHTS) { - gpl_dst->flag |= GP_LAYER_USE_LIGHTS; - } + gpl_dst->blend_mode = gpl_src->blend_mode; + gpl_dst->flag = gpl_src->flag; } /** @@ -1644,6 +1637,41 @@ void BKE_gpencil_layer_mask_sort_all(bGPdata *gpd) } } +/** + * Make a copy of a given gpencil mask layers. + */ +void BKE_gpencil_layer_mask_copy(const bGPDlayer *gpl_src, bGPDlayer *gpl_dst) +{ + BLI_listbase_clear(&gpl_dst->mask_layers); + LISTBASE_FOREACH (bGPDlayer_Mask *, mask_src, &gpl_src->mask_layers) { + bGPDlayer_Mask *mask_dst = MEM_dupallocN(mask_src); + mask_dst->prev = mask_dst->next = NULL; + BLI_addtail(&gpl_dst->mask_layers, mask_dst); + } +} + +/** + * Clean any invalid mask layer. + */ +void BKE_gpencil_layer_mask_cleanup(bGPdata *gpd, bGPDlayer *gpl) +{ + LISTBASE_FOREACH_MUTABLE (bGPDlayer_Mask *, mask, &gpl->mask_layers) { + if (BKE_gpencil_layer_named_get(gpd, mask->name) == NULL) { + BKE_gpencil_layer_mask_remove(gpl, mask); + } + } +} + +/** + * Clean any invalid mask layer for all layers. + */ +void BKE_gpencil_layer_mask_cleanup_all_layers(bGPdata *gpd) +{ + LISTBASE_FOREACH (bGPDlayer *, gpl, &gpd->layers) { + BKE_gpencil_layer_mask_cleanup(gpd, gpl); + } +} + static int gpencil_cb_cmp_frame(void *thunk, const void *a, const void *b) { const bGPDframe *frame_a = a; @@ -3006,8 +3034,8 @@ void BKE_gpencil_update_layer_transforms(const Depsgraph *depsgraph, Object *ob) bGPdata *gpd = (bGPdata *)ob->data; float cur_mat[4][4]; - bool changed = false; LISTBASE_FOREACH (bGPDlayer *, gpl, &gpd->layers) { + bool changed = false; unit_m4(cur_mat); if (gpl->actframe != NULL) { if (gpl->parent != NULL) { diff --git a/source/blender/blenkernel/intern/gpencil_curve.c b/source/blender/blenkernel/intern/gpencil_curve.c index 906d0fb0792..74bb787eac3 100644 --- a/source/blender/blenkernel/intern/gpencil_curve.c +++ b/source/blender/blenkernel/intern/gpencil_curve.c @@ -243,7 +243,7 @@ static int gpencil_get_stroke_material_fromcurve( /* If the curve has 2 materials, the first is considered as Fill and the second as Stroke. * If the has only one material, if the name contains _stroke, the is used - * as stroke, else as fill.*/ + * as stroke, else as fill. */ if (ob_cu->totcol >= 2) { *do_stroke = true; *do_fill = true; @@ -350,7 +350,7 @@ static void gpencil_convert_spline(Main *bmain, /* Assign material index to stroke. */ gps->mat_nr = r_idx; - /* Add stroke to frame.*/ + /* Add stroke to frame. */ BLI_addtail(&gpf->strokes, gps); float *coord_array = NULL; diff --git a/source/blender/blenkernel/intern/gpencil_geom.c b/source/blender/blenkernel/intern/gpencil_geom.c index 7f839650f33..2b16bbb10b2 100644 --- a/source/blender/blenkernel/intern/gpencil_geom.c +++ b/source/blender/blenkernel/intern/gpencil_geom.c @@ -793,6 +793,7 @@ bool BKE_gpencil_stroke_smooth(bGPDstroke *gps, int i, float inf) { bGPDspoint *pt = &gps->points[i]; float sco[3] = {0.0f}; + const bool is_cyclic = (gps->flag & GP_STROKE_CYCLIC) != 0; /* Do nothing if not enough points to smooth out */ if (gps->totpoints <= 2) { @@ -802,7 +803,7 @@ bool BKE_gpencil_stroke_smooth(bGPDstroke *gps, int i, float inf) /* Only affect endpoints by a fraction of the normal strength, * to prevent the stroke from shrinking too much */ - if (ELEM(i, 0, gps->totpoints - 1)) { + if (!is_cyclic && ELEM(i, 0, gps->totpoints - 1)) { inf *= 0.1f; } @@ -828,8 +829,22 @@ bool BKE_gpencil_stroke_smooth(bGPDstroke *gps, int i, float inf) int before = i - step; int after = i + step; - CLAMP_MIN(before, 0); - CLAMP_MAX(after, gps->totpoints - 1); + if (is_cyclic) { + if (before < 0) { + /* Sub to end point (before is already negative). */ + before = gps->totpoints + before; + CLAMP(before, 0, gps->totpoints - 1); + } + if (after > gps->totpoints - 1) { + /* Add to start point. */ + after = after - gps->totpoints; + CLAMP(after, 0, gps->totpoints - 1); + } + } + else { + CLAMP_MIN(before, 0); + CLAMP_MAX(after, gps->totpoints - 1); + } pt1 = &gps->points[before]; pt2 = &gps->points[after]; @@ -855,6 +870,7 @@ bool BKE_gpencil_stroke_smooth(bGPDstroke *gps, int i, float inf) bool BKE_gpencil_stroke_smooth_strength(bGPDstroke *gps, int point_index, float influence) { bGPDspoint *ptb = &gps->points[point_index]; + const bool is_cyclic = (gps->flag & GP_STROKE_CYCLIC) != 0; /* Do nothing if not enough points */ if ((gps->totpoints <= 2) || (point_index < 1)) { @@ -862,7 +878,7 @@ bool BKE_gpencil_stroke_smooth_strength(bGPDstroke *gps, int point_index, float } /* Only affect endpoints by a fraction of the normal influence */ float inf = influence; - if (ELEM(point_index, 0, gps->totpoints - 1)) { + if (!is_cyclic && ELEM(point_index, 0, gps->totpoints - 1)) { inf *= 0.01f; } /* Limit max influence to reduce pop effect. */ @@ -884,9 +900,22 @@ bool BKE_gpencil_stroke_smooth_strength(bGPDstroke *gps, int point_index, float int before = point_index - step; int after = point_index + step; - CLAMP_MIN(before, 0); - CLAMP_MAX(after, gps->totpoints - 1); - + if (is_cyclic) { + if (before < 0) { + /* Sub to end point (before is already negative). */ + before = gps->totpoints + before; + CLAMP(before, 0, gps->totpoints - 1); + } + if (after > gps->totpoints - 1) { + /* Add to start point. */ + after = after - gps->totpoints; + CLAMP(after, 0, gps->totpoints - 1); + } + } + else { + CLAMP_MIN(before, 0); + CLAMP_MAX(after, gps->totpoints - 1); + } pt1 = &gps->points[before]; pt2 = &gps->points[after]; @@ -919,6 +948,7 @@ bool BKE_gpencil_stroke_smooth_strength(bGPDstroke *gps, int point_index, float bool BKE_gpencil_stroke_smooth_thickness(bGPDstroke *gps, int point_index, float influence) { bGPDspoint *ptb = &gps->points[point_index]; + const bool is_cyclic = (gps->flag & GP_STROKE_CYCLIC) != 0; /* Do nothing if not enough points */ if ((gps->totpoints <= 2) || (point_index < 1)) { @@ -926,7 +956,7 @@ bool BKE_gpencil_stroke_smooth_thickness(bGPDstroke *gps, int point_index, float } /* Only affect endpoints by a fraction of the normal influence */ float inf = influence; - if (ELEM(point_index, 0, gps->totpoints - 1)) { + if (!is_cyclic && ELEM(point_index, 0, gps->totpoints - 1)) { inf *= 0.01f; } /* Limit max influence to reduce pop effect. */ @@ -948,9 +978,22 @@ bool BKE_gpencil_stroke_smooth_thickness(bGPDstroke *gps, int point_index, float int before = point_index - step; int after = point_index + step; - CLAMP_MIN(before, 0); - CLAMP_MAX(after, gps->totpoints - 1); - + if (is_cyclic) { + if (before < 0) { + /* Sub to end point (before is already negative). */ + before = gps->totpoints + before; + CLAMP(before, 0, gps->totpoints - 1); + } + if (after > gps->totpoints - 1) { + /* Add to start point. */ + after = after - gps->totpoints; + CLAMP(after, 0, gps->totpoints - 1); + } + } + else { + CLAMP_MIN(before, 0); + CLAMP_MAX(after, gps->totpoints - 1); + } pt1 = &gps->points[before]; pt2 = &gps->points[after]; @@ -982,6 +1025,7 @@ bool BKE_gpencil_stroke_smooth_thickness(bGPDstroke *gps, int point_index, float bool BKE_gpencil_stroke_smooth_uv(bGPDstroke *gps, int point_index, float influence) { bGPDspoint *ptb = &gps->points[point_index]; + const bool is_cyclic = (gps->flag & GP_STROKE_CYCLIC) != 0; /* Do nothing if not enough points */ if (gps->totpoints <= 2) { @@ -993,9 +1037,22 @@ bool BKE_gpencil_stroke_smooth_uv(bGPDstroke *gps, int point_index, float influe int before = point_index - 1; int after = point_index + 1; - CLAMP_MIN(before, 0); - CLAMP_MAX(after, gps->totpoints - 1); - + if (is_cyclic) { + if (before < 0) { + /* Sub to end point (before is already negative). */ + before = gps->totpoints + before; + CLAMP(before, 0, gps->totpoints - 1); + } + if (after > gps->totpoints - 1) { + /* Add to start point. */ + after = after - gps->totpoints; + CLAMP(after, 0, gps->totpoints - 1); + } + } + else { + CLAMP_MIN(before, 0); + CLAMP_MAX(after, gps->totpoints - 1); + } pta = &gps->points[before]; ptc = &gps->points[after]; @@ -1993,7 +2050,7 @@ void BKE_gpencil_stroke_subdivide(bGPdata *gpd, bGPDstroke *gps, int level, int MEM_SAFE_FREE(temp_points); MEM_SAFE_FREE(temp_dverts); - /* move points to smooth stroke (not simple type )*/ + /* Move points to smooth stroke (not simple type). */ if (type != GP_SUBDIV_SIMPLE) { /* duplicate points in a temp area with the new subdivide data */ temp_points = MEM_dupallocN(gps->points); @@ -2076,7 +2133,7 @@ void BKE_gpencil_stroke_merge_distance(bGPdata *gpd, else { pt->flag |= GP_SPOINT_TAG; } - /* Jump to next pair of points, keeping first point segment equals.*/ + /* Jump to next pair of points, keeping first point segment equals. */ step++; } else { @@ -2811,7 +2868,7 @@ static void gpencil_stroke_join_islands(bGPdata *gpd, MDeformVert *dvert_src = NULL; MDeformVert *dvert_dst = NULL; - /* Copy weights (last before)*/ + /* Copy weights (last before). */ e1 = 0; e2 = 0; for (int i = 0; i < totpoints; i++) { @@ -2984,6 +3041,9 @@ bGPDstroke *BKE_gpencil_stroke_delete_tagged_points(bGPdata *gpd, /* Add new stroke to the frame or delete if below limit */ if ((limit > 0) && (new_stroke->totpoints <= limit)) { + if (gps_first == new_stroke) { + gps_first = NULL; + } BKE_gpencil_free_stroke(new_stroke); } else { @@ -3748,11 +3808,11 @@ static ListBase *gpencil_stroke_perimeter_ex(const bGPdata *gpd, last_prev_pt[0] -= 1.0f; } - /* generate points for start cap */ + /* Generate points for start cap. */ num_perimeter_points += generate_perimeter_cap( first_pt, first_next_pt, first_radius, perimeter_right_side, subdivisions, gps->caps[0]); - /* generate perimeter points */ + /* Generate perimeter points. */ float curr_pt[3], next_pt[3], prev_pt[3]; float vec_next[2], vec_prev[2]; float nvec_next[2], nvec_prev[2]; diff --git a/source/blender/blenkernel/intern/idprop.c b/source/blender/blenkernel/intern/idprop.c index 58715ac2e05..a67e78ceea0 100644 --- a/source/blender/blenkernel/intern/idprop.c +++ b/source/blender/blenkernel/intern/idprop.c @@ -54,15 +54,15 @@ static CLG_LogRef LOG = {"bke.idprop"}; -/*local size table.*/ +/* Local size table. */ static size_t idp_size_table[] = { 1, /*strings*/ sizeof(int), sizeof(float), - sizeof(float[3]), /*Vector type, deprecated*/ - sizeof(float[16]), /*Matrix type, deprecated*/ - 0, /*arrays don't have a fixed size*/ - sizeof(ListBase), /*Group type*/ + sizeof(float[3]), /* Vector type, deprecated. */ + sizeof(float[16]), /* Matrix type, deprecated. */ + 0, /* Arrays don't have a fixed size. */ + sizeof(ListBase), /* Group type. */ sizeof(void *), sizeof(double), }; @@ -99,12 +99,12 @@ IDProperty *IDP_CopyIDPArray(const IDProperty *array, const int flag) narray->data.pointer = MEM_dupallocN(array->data.pointer); for (int i = 0; i < narray->len; i++) { - /* ok, the copy functions always allocate a new structure, + /* OK, the copy functions always allocate a new structure, * which doesn't work here. instead, simply copy the * contents of the new structure into the array cell, * then free it. this makes for more maintainable * code than simply re-implementing the copy functions - * in this loop.*/ + * in this loop. */ IDProperty *tmp = IDP_CopyProperty_ex(GETPROP(narray, i), flag); memcpy(GETPROP(narray, i), tmp, sizeof(IDProperty)); MEM_freeN(tmp); @@ -228,7 +228,7 @@ static void idp_resize_group_array(IDProperty *prop, int newlen, void *newarr) } } -/*this function works for strings too!*/ +/* This function works for strings too! */ void IDP_ResizeArray(IDProperty *prop, int newlen) { const bool is_grow = newlen >= prop->len; @@ -390,8 +390,8 @@ void IDP_ConcatStringC(IDProperty *prop, const char *st) BLI_assert(prop->type == IDP_STRING); int newlen = prop->len + (int)strlen(st); - /* we have to remember that prop->len includes the null byte for strings. - * so there's no need to add +1 to the resize function.*/ + /* We have to remember that prop->len includes the null byte for strings. + * so there's no need to add +1 to the resize function. */ IDP_ResizeArray(prop, newlen); strcat(prop->data.pointer, st); } @@ -400,8 +400,8 @@ void IDP_ConcatString(IDProperty *str1, IDProperty *append) { BLI_assert(append->type == IDP_STRING); - /* since ->len for strings includes the NULL byte, we have to subtract one or - * we'll get an extra null byte after each concatenation operation.*/ + /* Since ->len for strings includes the NULL byte, we have to subtract one or + * we'll get an extra null byte after each concatenation operation. */ int newlen = str1->len + append->len - 1; IDP_ResizeArray(str1, newlen); strcat(str1->data.pointer, append->data.pointer); @@ -775,10 +775,10 @@ IDProperty *IDP_GetProperties(ID *id, const bool create_if_needed) if (create_if_needed) { id->properties = MEM_callocN(sizeof(IDProperty), "IDProperty"); id->properties->type = IDP_GROUP; - /* don't overwrite the data's name and type + /* NOTE(campbell): Don't overwrite the data's name and type * some functions might need this if they - * don't have a real ID, should be named elsewhere - Campbell */ - /* strcpy(id->name, "top_level_group");*/ + * don't have a real ID, should be named elsewhere. */ + // strcpy(id->name, "top_level_group"); } return id->properties; } @@ -1106,7 +1106,7 @@ void IDP_WriteProperty_OnlyData(const IDProperty *prop, BlendWriter *writer); static void IDP_WriteArray(const IDProperty *prop, BlendWriter *writer) { - /*REMEMBER to set totalen to len in the linking code!!*/ + /* Remember to set #IDProperty.totallen to len in the linking code! */ if (prop->data.pointer) { BLO_write_raw(writer, MEM_allocN_len(prop->data.pointer), prop->data.pointer); @@ -1123,7 +1123,7 @@ static void IDP_WriteArray(const IDProperty *prop, BlendWriter *writer) static void IDP_WriteIDPArray(const IDProperty *prop, BlendWriter *writer) { - /*REMEMBER to set totalen to len in the linking code!!*/ + /* Remember to set #IDProperty.totallen to len in the linking code! */ if (prop->data.pointer) { const IDProperty *array = prop->data.pointer; @@ -1137,7 +1137,7 @@ static void IDP_WriteIDPArray(const IDProperty *prop, BlendWriter *writer) static void IDP_WriteString(const IDProperty *prop, BlendWriter *writer) { - /*REMEMBER to set totalen to len in the linking code!!*/ + /* Remember to set #IDProperty.totallen to len in the linking code! */ BLO_write_raw(writer, (size_t)prop->len, prop->data.pointer); } @@ -1219,7 +1219,7 @@ static void IDP_DirectLinkArray(IDProperty *prop, BlendDataReader *reader) static void IDP_DirectLinkString(IDProperty *prop, BlendDataReader *reader) { - /*since we didn't save the extra string buffer, set totallen to len.*/ + /* Since we didn't save the extra string buffer, set totallen to len. */ prop->totallen = prop->len; BLO_read_data_address(reader, &prop->data.pointer); } @@ -1230,7 +1230,7 @@ static void IDP_DirectLinkGroup(IDProperty *prop, BlendDataReader *reader) BLO_read_list(reader, lb); - /*Link child id properties now*/ + /* Link child id properties now. */ LISTBASE_FOREACH (IDProperty *, loop, &prop->data.group) { IDP_DirectLinkProperty(loop, reader); } diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c index dad518ec696..a2131d735a6 100644 --- a/source/blender/blenkernel/intern/image.c +++ b/source/blender/blenkernel/intern/image.c @@ -3208,7 +3208,7 @@ Image *BKE_image_ensure_viewer(Main *bmain, int type, const char *name) ima = image_alloc(bmain, name, IMA_SRC_VIEWER, type); } - /* happens on reload, imagewindow cannot be image user when hidden*/ + /* Happens on reload, imagewindow cannot be image user when hidden. */ if (ima->id.us == 0) { id_us_ensure_real(&ima->id); } @@ -4349,7 +4349,7 @@ static ImBuf *load_movie_single(Image *ima, ImageUser *iuser, int frame, const i BKE_image_user_file_path(&iuser_t, ima, str); - /* FIXME: make several stream accessible in image editor, too*/ + /* FIXME: make several stream accessible in image editor, too. */ ia->anim = openanim(str, flags, 0, ima->colorspace_settings.name); /* let's initialize this user */ @@ -5188,7 +5188,7 @@ bool BKE_image_has_ibuf(Image *ima, ImageUser *iuser) return ibuf != NULL; } -/* ******** Pool for image buffers ******** */ +/* ******** Pool for image buffers ******** */ typedef struct ImagePoolItem { struct ImagePoolItem *next, *prev; @@ -5359,7 +5359,7 @@ int BKE_image_user_frame_get(const ImageUser *iuser, int cfra, bool *r_is_in_ran } } - /* important to apply after else we cant loop on frames 100 - 110 for eg. */ + /* important to apply after else we can't loop on frames 100 - 110 for eg. */ framenr += iuser->offset; return framenr; diff --git a/source/blender/blenkernel/intern/image_save.c b/source/blender/blenkernel/intern/image_save.c index e571499ba8e..b68cd9e4d2d 100644 --- a/source/blender/blenkernel/intern/image_save.c +++ b/source/blender/blenkernel/intern/image_save.c @@ -207,7 +207,7 @@ static bool image_save_single(ReportList *reports, goto cleanup; } - /* it shouldn't ever happen*/ + /* It shouldn't ever happen. */ if ((BLI_findstring(&rr->views, STEREO_LEFT_NAME, offsetof(RenderView, name)) == NULL) || (BLI_findstring(&rr->views, STEREO_RIGHT_NAME, offsetof(RenderView, name)) == NULL)) { BKE_reportf(reports, diff --git a/source/blender/blenkernel/intern/ipo.c b/source/blender/blenkernel/intern/ipo.c index bdc763cf4ca..f365e759221 100644 --- a/source/blender/blenkernel/intern/ipo.c +++ b/source/blender/blenkernel/intern/ipo.c @@ -262,7 +262,7 @@ static AdrBit2Path *adrcode_bitmaps_to_paths(int blocktype, int adrcode, int *to /* Object types */ static const char *ob_adrcodes_to_paths(int adrcode, int *array_index) { - /* set array index like this in-case nothing sets it correctly */ + /* Set array index like this in-case nothing sets it correctly. */ *array_index = 0; /* result depends on adrcode */ @@ -377,7 +377,7 @@ static const char *ob_adrcodes_to_paths(int adrcode, int *array_index) */ static const char *pchan_adrcodes_to_paths(int adrcode, int *array_index) { - /* set array index like this in-case nothing sets it correctly */ + /* Set array index like this in-case nothing sets it correctly. */ *array_index = 0; /* result depends on adrcode */ @@ -434,7 +434,7 @@ static const char *pchan_adrcodes_to_paths(int adrcode, int *array_index) /* Constraint types */ static const char *constraint_adrcodes_to_paths(int adrcode, int *array_index) { - /* set array index like this in-case nothing sets it correctly */ + /* Set array index like this in-case nothing sets it correctly. */ *array_index = 0; /* result depends on adrcode */ @@ -605,7 +605,7 @@ static const char *mtex_adrcodes_to_paths(int adrcode, int *UNUSED(array_index)) /* Texture types */ static const char *texture_adrcodes_to_paths(int adrcode, int *array_index) { - /* set array index like this in-case nothing sets it correctly */ + /* Set array index like this in-case nothing sets it correctly. */ *array_index = 0; /* result depends on adrcode */ @@ -692,7 +692,7 @@ static const char *texture_adrcodes_to_paths(int adrcode, int *array_index) /* Material Types */ static const char *material_adrcodes_to_paths(int adrcode, int *array_index) { - /* set array index like this in-case nothing sets it correctly */ + /* Set array index like this in-case nothing sets it correctly. */ *array_index = 0; /* result depends on adrcode */ @@ -785,7 +785,7 @@ static const char *material_adrcodes_to_paths(int adrcode, int *array_index) /* Camera Types */ static const char *camera_adrcodes_to_paths(int adrcode, int *array_index) { - /* set array index like this in-case nothing sets it correctly */ + /* Set array index like this in-case nothing sets it correctly. */ *array_index = 0; /* result depends on adrcode */ @@ -830,7 +830,7 @@ static const char *camera_adrcodes_to_paths(int adrcode, int *array_index) /* Light Types */ static const char *light_adrcodes_to_paths(int adrcode, int *array_index) { - /* set array index like this in-case nothing sets it correctly */ + /* Set array index like this in-case nothing sets it correctly. */ *array_index = 0; /* result depends on adrcode */ @@ -875,7 +875,7 @@ static const char *light_adrcodes_to_paths(int adrcode, int *array_index) /* Sound Types */ static const char *sound_adrcodes_to_paths(int adrcode, int *array_index) { - /* set array index like this in-case nothing sets it correctly */ + /* Set array index like this in-case nothing sets it correctly. */ *array_index = 0; /* result depends on adrcode */ @@ -901,7 +901,7 @@ static const char *sound_adrcodes_to_paths(int adrcode, int *array_index) /* World Types */ static const char *world_adrcodes_to_paths(int adrcode, int *array_index) { - /* set array index like this in-case nothing sets it correctly */ + /* Set array index like this in-case nothing sets it correctly. */ *array_index = 0; /* result depends on adrcode */ @@ -947,7 +947,7 @@ static const char *world_adrcodes_to_paths(int adrcode, int *array_index) /* Particle Types */ static const char *particle_adrcodes_to_paths(int adrcode, int *array_index) { - /* set array index like this in-case nothing sets it correctly */ + /* Set array index like this in-case nothing sets it correctly. */ *array_index = 0; /* result depends on adrcode */ diff --git a/source/blender/blenkernel/intern/keyconfig.c b/source/blender/blenkernel/intern/keyconfig.c index 552760c9b34..d25f475c140 100644 --- a/source/blender/blenkernel/intern/keyconfig.c +++ b/source/blender/blenkernel/intern/keyconfig.c @@ -55,7 +55,7 @@ wmKeyConfigPref *BKE_keyconfig_pref_ensure(UserDef *userdef, const char *kc_idna } if (kpt->prop == NULL) { IDPropertyTemplate val = {0}; - kpt->prop = IDP_New(IDP_GROUP, &val, kc_idname); /* name is unimportant */ + kpt->prop = IDP_New(IDP_GROUP, &val, kc_idname); /* name is unimportant. */ } return kpt; } diff --git a/source/blender/blenkernel/intern/lattice_deform.c b/source/blender/blenkernel/intern/lattice_deform.c index a8126cb5538..a3133b58a0a 100644 --- a/source/blender/blenkernel/intern/lattice_deform.c +++ b/source/blender/blenkernel/intern/lattice_deform.c @@ -93,18 +93,18 @@ LatticeDeformData *BKE_lattice_deform_data_create(const Object *oblatt, const Ob /* for example with a particle system: (ob == NULL) */ if (ob == NULL) { - /* in deformspace, calc matrix */ + /* In deform-space, calc matrix. */ invert_m4_m4(latmat, oblatt->obmat); /* back: put in deform array */ invert_m4_m4(imat, latmat); } else { - /* in deformspace, calc matrix */ + /* In deform-space, calc matrix. */ invert_m4_m4(imat, oblatt->obmat); mul_m4_m4m4(latmat, imat, ob->obmat); - /* back: put in deform array */ + /* back: put in deform array. */ invert_m4_m4(imat, latmat); } diff --git a/source/blender/blenkernel/intern/layer.c b/source/blender/blenkernel/intern/layer.c index 2ac10586fd9..1edf83b6685 100644 --- a/source/blender/blenkernel/intern/layer.c +++ b/source/blender/blenkernel/intern/layer.c @@ -819,7 +819,7 @@ static void layer_collection_sync(ViewLayer *view_layer, } /* We separate restrict viewport and visible view layer because a layer collection can be - * hidden in the view layer yet (locally) visible in a viewport (if it is not restricted).*/ + * hidden in the view layer yet (locally) visible in a viewport (if it is not restricted). */ if (child_restrict & COLLECTION_RESTRICT_VIEWPORT) { lc->runtime_flag |= LAYER_COLLECTION_RESTRICT_VIEWPORT; } @@ -1000,7 +1000,7 @@ void BKE_main_collection_sync_remap(const Main *bmain) /* On remapping of object or collection pointers free caches. */ /* TODO: try to make this faster */ - for (const Scene *scene = bmain->scenes.first; scene; scene = scene->id.next) { + for (Scene *scene = bmain->scenes.first; scene; scene = scene->id.next) { LISTBASE_FOREACH (ViewLayer *, view_layer, &scene->view_layers) { MEM_SAFE_FREE(view_layer->object_bases_array); @@ -1009,6 +1009,10 @@ void BKE_main_collection_sync_remap(const Main *bmain) view_layer->object_bases_hash = NULL; } } + + BKE_collection_object_cache_free(scene->master_collection); + DEG_id_tag_update_ex((Main *)bmain, &scene->master_collection->id, ID_RECALC_COPY_ON_WRITE); + DEG_id_tag_update_ex((Main *)bmain, &scene->id, ID_RECALC_COPY_ON_WRITE); } for (Collection *collection = bmain->collections.first; collection; @@ -1823,7 +1827,7 @@ void BKE_view_layer_bases_in_mode_iterator_end(BLI_Iterator *UNUSED(iter)) /** \} */ -/* Evaluation */ +/* Evaluation. */ /* Applies object's restrict flags on top of flags coming from the collection * and stores those in base->flag. BASE_VISIBLE_DEPSGRAPH ignores viewport flags visibility diff --git a/source/blender/blenkernel/intern/lib_id.c b/source/blender/blenkernel/intern/lib_id.c index 0ea64c63ba1..89ebf90e4f6 100644 --- a/source/blender/blenkernel/intern/lib_id.c +++ b/source/blender/blenkernel/intern/lib_id.c @@ -1952,7 +1952,7 @@ void BKE_library_make_local(Main *bmain, } /* The check on the fourth line (LIB_TAG_PRE_EXISTING) is done so it's possible to tag data * you don't want to be made local, used for appending data, - * so any libdata already linked wont become local (very nasty + * so any libdata already linked won't become local (very nasty * to discover all your links are lost after appending). * Also, never ever make proxified objects local, would not make any sense. */ /* Some more notes: diff --git a/source/blender/blenkernel/intern/lib_id_eval.c b/source/blender/blenkernel/intern/lib_id_eval.c new file mode 100644 index 00000000000..140fe403ac3 --- /dev/null +++ b/source/blender/blenkernel/intern/lib_id_eval.c @@ -0,0 +1,48 @@ +/* + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +/** \file + * \ingroup bke + * + * Contains management of ID's and libraries + * allocate and free of all library data + */ + +#include "DNA_ID.h" +#include "DNA_mesh_types.h" + +#include "BLI_utildefines.h" + +#include "BKE_lib_id.h" +#include "BKE_mesh.h" + +/** + * Copy relatives parameters, from `id` to `id_cow`. + * Use handle the #ID_RECALC_PARAMETERS tag. + * \note Keep in sync with #ID_TYPE_SUPPORTS_PARAMS_WITHOUT_COW. + */ +void BKE_id_eval_properties_copy(ID *id_cow, ID *id) +{ + const ID_Type id_type = GS(id->name); + BLI_assert((id_cow->tag & LIB_TAG_COPIED_ON_WRITE) && !(id->tag & LIB_TAG_COPIED_ON_WRITE)); + BLI_assert(ID_TYPE_SUPPORTS_PARAMS_WITHOUT_COW(id_type)); + if (id_type == ID_ME) { + BKE_mesh_copy_parameters((Mesh *)id_cow, (const Mesh *)id); + } + else { + BLI_assert_unreachable(); + } +} diff --git a/source/blender/blenkernel/intern/lib_override.c b/source/blender/blenkernel/intern/lib_override.c index c93971e7b11..9a45f484581 100644 --- a/source/blender/blenkernel/intern/lib_override.c +++ b/source/blender/blenkernel/intern/lib_override.c @@ -52,12 +52,17 @@ #include "BKE_report.h" #include "BKE_scene.h" +#include "BLO_readfile.h" + #include "BLI_ghash.h" +#include "BLI_linklist.h" #include "BLI_listbase.h" #include "BLI_string.h" #include "BLI_task.h" #include "BLI_utildefines.h" +#include "PIL_time.h" + #include "RNA_access.h" #include "RNA_types.h" @@ -466,11 +471,14 @@ bool BKE_lib_override_library_create_from_tag(Main *bmain, typedef struct LibOverrideGroupTagData { Main *bmain; + Scene *scene; ID *id_root; uint tag; uint missing_tag; /* Whether we are looping on override data, or their references (linked) one. */ bool is_override; + /* Whether we are creating new override, or resyncing existing one. */ + bool is_resync; } LibOverrideGroupTagData; /* Tag all IDs in dependency relationships within an override hierarchy/group. @@ -591,7 +599,9 @@ static void lib_override_linked_group_tag_recursive(LibOverrideGroupTagData *dat static void lib_override_linked_group_tag(LibOverrideGroupTagData *data) { Main *bmain = data->bmain; + Scene *scene = data->scene; ID *id_root = data->id_root; + const bool is_resync = data->is_resync; BLI_assert(!data->is_override); if ((id_root->tag & LIB_TAG_MISSING)) { @@ -616,6 +626,43 @@ static void lib_override_linked_group_tag(LibOverrideGroupTagData *data) } } } + + /* For each object tagged for override, ensure we get at least one local or liboverride + * collection to host it. Avoids getting a bunch of random object in the scene's master + * collection when all objects' dependencies are not properly 'packed' into a single root + * collection. */ + LISTBASE_FOREACH (Object *, ob, &bmain->objects) { + if (ID_IS_LINKED(ob) && (ob->id.tag & data->tag) != 0) { + Collection *instantiating_collection = NULL; + Collection *instantiating_collection_override_candidate = NULL; + /* Loop over all collections instantiating the object, if we already have a 'locale' one we + * have nothing to do, otherwise try to find a 'linked' one that we can override too. */ + while ((instantiating_collection = BKE_collection_object_find( + bmain, scene, instantiating_collection, ob)) != NULL) { + /* In (recursive) resync case, if a collection of a 'parent' lib instantiates the linked + * object, it is also fine. */ + if (!ID_IS_LINKED(instantiating_collection) || + (is_resync && ID_IS_LINKED(id_root) && + instantiating_collection->id.lib->temp_index < id_root->lib->temp_index)) { + break; + } + else if (ID_IS_LINKED(instantiating_collection) && + (!is_resync || instantiating_collection->id.lib == id_root->lib)) { + instantiating_collection_override_candidate = instantiating_collection; + } + } + + if (instantiating_collection == NULL && + instantiating_collection_override_candidate != NULL) { + if ((instantiating_collection_override_candidate->id.tag & LIB_TAG_MISSING)) { + instantiating_collection_override_candidate->id.tag |= data->missing_tag; + } + else { + instantiating_collection_override_candidate->id.tag |= data->tag; + } + } + } + } } } @@ -694,14 +741,16 @@ static void lib_override_overrides_group_tag(LibOverrideGroupTagData *data) lib_override_overrides_group_tag_recursive(data); } -static bool lib_override_library_create_do(Main *bmain, ID *id_root) +static bool lib_override_library_create_do(Main *bmain, Scene *scene, ID *id_root) { BKE_main_relations_create(bmain, 0); LibOverrideGroupTagData data = {.bmain = bmain, + .scene = scene, .id_root = id_root, .tag = LIB_TAG_DOIT, .missing_tag = LIB_TAG_MISSING, - .is_override = false}; + .is_override = false, + .is_resync = false}; lib_override_linked_group_tag(&data); BKE_main_relations_tag_set(bmain, MAINIDRELATIONS_ENTRY_TAGS_PROCESSED, false); @@ -862,7 +911,7 @@ bool BKE_lib_override_library_create(Main *bmain, *r_id_root_override = NULL; } - const bool success = lib_override_library_create_do(bmain, id_root); + const bool success = lib_override_library_create_do(bmain, scene, id_root); if (!success) { return success; @@ -958,7 +1007,7 @@ bool BKE_lib_override_library_resync(Main *bmain, Collection *override_resync_residual_storage, const bool do_hierarchy_enforce, const bool do_post_process, - ReportList *reports) + BlendFileReadReport *reports) { BLI_assert(ID_IS_OVERRIDE_LIBRARY_REAL(id_root)); @@ -966,10 +1015,12 @@ bool BKE_lib_override_library_resync(Main *bmain, BKE_main_relations_create(bmain, 0); LibOverrideGroupTagData data = {.bmain = bmain, + .scene = scene, .id_root = id_root, .tag = LIB_TAG_DOIT, .missing_tag = LIB_TAG_MISSING, - .is_override = true}; + .is_override = true, + .is_resync = true}; lib_override_overrides_group_tag(&data); BKE_main_relations_tag_set(bmain, MAINIDRELATIONS_ENTRY_TAGS_PROCESSED, false); @@ -1286,7 +1337,7 @@ bool BKE_lib_override_library_resync(Main *bmain, id_root = id_root_reference->newid; if (user_edited_overrides_deletion_count > 0) { - BKE_reportf(reports, + BKE_reportf(reports != NULL ? reports->reports : NULL, RPT_WARNING, "During resync of data-block %s, %d obsolete overrides were deleted, that had " "local changes defined by user", @@ -1438,8 +1489,11 @@ static void lib_override_library_main_resync_on_library_indirect_level( ViewLayer *view_layer, Collection *override_resync_residual_storage, const int library_indirect_level, - ReportList *reports) + BlendFileReadReport *reports) { + const bool do_reports_recursive_resync_timing = (library_indirect_level != 0); + const double init_time = do_reports_recursive_resync_timing ? PIL_check_seconds_timer() : 0.0; + BKE_main_relations_create(bmain, 0); BKE_main_id_tag_all(bmain, LIB_TAG_DOIT, false); @@ -1460,10 +1514,12 @@ static void lib_override_library_main_resync_on_library_indirect_level( } LibOverrideGroupTagData data = {.bmain = bmain, + .scene = scene, .id_root = id->override_library->reference, .tag = LIB_TAG_DOIT, .missing_tag = LIB_TAG_MISSING, - .is_override = false}; + .is_override = false, + .is_resync = true}; lib_override_linked_group_tag(&data); BKE_main_relations_tag_set(bmain, MAINIDRELATIONS_ENTRY_TAGS_PROCESSED, false); lib_override_hierarchy_dependencies_recursive_tag(&data); @@ -1530,6 +1586,7 @@ static void lib_override_library_main_resync_on_library_indirect_level( (!ID_IS_LINKED(id) && library_indirect_level != 0)) { continue; } + Library *library = id->lib; int level = 0; /* In complex non-supported cases, with several different override hierarchies sharing @@ -1541,12 +1598,21 @@ static void lib_override_library_main_resync_on_library_indirect_level( id = lib_override_library_main_resync_find_root_recurse(id, &level); id->tag &= ~LIB_TAG_LIB_OVERRIDE_NEED_RESYNC; BLI_assert(ID_IS_OVERRIDE_LIBRARY_REAL(id)); + BLI_assert(id->lib == library); do_continue = true; - CLOG_INFO(&LOG, 2, "Resyncing %s (%p)...", id->name, id->lib); + CLOG_INFO(&LOG, 2, "Resyncing %s (%p)...", id->name, library); const bool success = BKE_lib_override_library_resync( bmain, scene, view_layer, id, override_resync_residual_storage, false, false, reports); CLOG_INFO(&LOG, 2, "\tSuccess: %d", success); + if (success) { + reports->count.resynced_lib_overrides++; + if (library_indirect_level > 0 && + BLI_linklist_index(reports->resynced_lib_overrides_libraries, library) < 0) { + BLI_linklist_prepend(&reports->resynced_lib_overrides_libraries, library); + reports->resynced_lib_overrides_libraries_count++; + } + } break; } FOREACH_MAIN_LISTBASE_ID_END; @@ -1556,6 +1622,10 @@ static void lib_override_library_main_resync_on_library_indirect_level( } FOREACH_MAIN_LISTBASE_END; } + + if (do_reports_recursive_resync_timing) { + reports->duration.lib_overrides_recursive_resync += PIL_check_seconds_timer() - init_time; + } } static int lib_override_sort_libraries_func(LibraryIDLinkCallbackData *cb_data) @@ -1633,7 +1703,7 @@ static int lib_override_libraries_index_define(Main *bmain) void BKE_lib_override_library_main_resync(Main *bmain, Scene *scene, ViewLayer *view_layer, - ReportList *reports) + BlendFileReadReport *reports) { /* We use a specific collection to gather/store all 'orphaned' override collections and objects * generated by re-sync-process. This avoids putting them in scene's master collection. */ @@ -1688,10 +1758,12 @@ void BKE_lib_override_library_delete(Main *bmain, ID *id_root) /* Tag all library overrides in the chains of dependencies from the given root one. */ BKE_main_relations_create(bmain, 0); LibOverrideGroupTagData data = {.bmain = bmain, + .scene = NULL, .id_root = id_root, .tag = LIB_TAG_DOIT, .missing_tag = LIB_TAG_MISSING, - .is_override = true}; + .is_override = true, + .is_resync = false}; lib_override_overrides_group_tag(&data); BKE_main_relations_free(bmain); diff --git a/source/blender/blenkernel/intern/lib_query.c b/source/blender/blenkernel/intern/lib_query.c index b748061ef8a..9d2552777bf 100644 --- a/source/blender/blenkernel/intern/lib_query.c +++ b/source/blender/blenkernel/intern/lib_query.c @@ -83,7 +83,7 @@ bool BKE_lib_query_foreachid_process(LibraryForeachIDData *data, ID **id_pp, int ID *old_id = *id_pp; /* Update the callback flags with the ones defined (or forbidden) in `data` by the generic - * caller code. */ + * caller code. */ cb_flag = ((cb_flag | data->cb_flag) & ~data->cb_flag_clear); /* Update the callback flags with some extra information regarding overrides: all 'loopback', diff --git a/source/blender/blenkernel/intern/mask.c b/source/blender/blenkernel/intern/mask.c index a3f122115d8..371af2a95ed 100644 --- a/source/blender/blenkernel/intern/mask.c +++ b/source/blender/blenkernel/intern/mask.c @@ -1923,7 +1923,7 @@ static void interp_weights_uv_v2_apply(const float uv[2], r_pt[1] += dvec[0] * uv[1]; } -/* when a new points added - resize all shapekey array */ +/* When a new points added - resize all shape-key array. */ void BKE_mask_layer_shape_changed_add(MaskLayer *masklay, int index, bool do_init, diff --git a/source/blender/blenkernel/intern/mball.c b/source/blender/blenkernel/intern/mball.c index 6bef11dea76..f5d898e801b 100644 --- a/source/blender/blenkernel/intern/mball.c +++ b/source/blender/blenkernel/intern/mball.c @@ -158,7 +158,7 @@ static void metaball_blend_read_data(BlendDataReader *reader, ID *id) mb->editelems = NULL; /* Must always be cleared (meta's don't have their own edit-data). */ mb->needs_flush_to_id = 0; - /* mb->edit_elems.first= mb->edit_elems.last= NULL;*/ + // mb->edit_elems.first = mb->edit_elems.last = NULL; mb->lastelem = NULL; mb->batch_cache = NULL; } diff --git a/source/blender/blenkernel/intern/mball_tessellate.c b/source/blender/blenkernel/intern/mball_tessellate.c index bb46c7b16c0..413cefd2271 100644 --- a/source/blender/blenkernel/intern/mball_tessellate.c +++ b/source/blender/blenkernel/intern/mball_tessellate.c @@ -272,20 +272,20 @@ static void build_bvh_spatial(PROCESS *process, * any and all purposes, provided that this notice appears in all copies. */ -#define L 0 /* left direction: -x, -i */ -#define R 1 /* right direction: +x, +i */ -#define B 2 /* bottom direction: -y, -j */ -#define T 3 /* top direction: +y, +j */ -#define N 4 /* near direction: -z, -k */ -#define F 5 /* far direction: +z, +k */ -#define LBN 0 /* left bottom near corner */ -#define LBF 1 /* left bottom far corner */ -#define LTN 2 /* left top near corner */ -#define LTF 3 /* left top far corner */ -#define RBN 4 /* right bottom near corner */ -#define RBF 5 /* right bottom far corner */ -#define RTN 6 /* right top near corner */ -#define RTF 7 /* right top far corner */ +#define L 0 /* Left direction: -x, -i. */ +#define R 1 /* Right direction: +x, +i. */ +#define B 2 /* Bottom direction: -y, -j. */ +#define T 3 /* Top direction: +y, +j. */ +#define N 4 /* Near direction: -z, -k. */ +#define F 5 /* Far direction: +z, +k. */ +#define LBN 0 /* Left bottom near corner. */ +#define LBF 1 /* Left bottom far corner. */ +#define LTN 2 /* Left top near corner. */ +#define LTF 3 /* Left top far corner. */ +#define RBN 4 /* Right bottom near corner. */ +#define RBF 5 /* Right bottom far corner. */ +#define RTN 6 /* Right top near corner. */ +#define RTF 7 /* Right top far corner. */ /** * the LBN corner of cube (i, j, k), corresponds with location @@ -293,7 +293,8 @@ static void build_bvh_spatial(PROCESS *process, */ #define HASHBIT (5) -#define HASHSIZE (size_t)(1 << (3 * HASHBIT)) /*! < hash table size (32768) */ +/** Hash table size (32768). */ +#define HASHSIZE (size_t)(1 << (3 * HASHBIT)) #define HASH(i, j, k) ((((((i)&31) << 5) | ((j)&31)) << 5) | ((k)&31)) diff --git a/source/blender/blenkernel/intern/mesh.c b/source/blender/blenkernel/intern/mesh.c index 190596571b0..5ece44c948f 100644 --- a/source/blender/blenkernel/intern/mesh.c +++ b/source/blender/blenkernel/intern/mesh.c @@ -413,8 +413,7 @@ static const char *cmpcode_to_str(int code) } } -/* thresh is threshold for comparing vertices, uvs, vertex colors, - * weights, etc.*/ +/** Thresh is threshold for comparing vertices, UV's, vertex colors, weights, etc. */ static int customdata_compare( CustomData *c1, CustomData *c2, Mesh *m1, Mesh *m2, const float thresh) { @@ -479,11 +478,11 @@ static int customdata_compare( if (len_squared_v3v3(v1->co, v2->co) > thresh_sq) { return MESHCMP_VERTCOMISMATCH; } - /* I don't care about normals, let's just do coordinates */ + /* I don't care about normals, let's just do coordinates. */ } } - /*we're order-agnostic for edges here*/ + /* We're order-agnostic for edges here. */ if (l1->type == CD_MEDGE) { MEdge *e1 = l1->data; MEdge *e2 = l2->data; @@ -748,12 +747,14 @@ bool BKE_mesh_clear_facemap_customdata(struct Mesh *me) return changed; } -/* this ensures grouped customdata (e.g. mtexpoly and mloopuv and mtface, or +/** + * This ensures grouped customdata (e.g. mtexpoly and mloopuv and mtface, or * mloopcol and mcol) have the same relative active/render/clone/mask indices. * - * note that for undo mesh data we want to skip 'ensure_tess_cd' call since + * NOTE(campbell): that for undo mesh data we want to skip 'ensure_tess_cd' call since * we don't want to store memory for tessface when its only used for older - * versions of the mesh. - campbell*/ + * Versions of the mesh. + */ static void mesh_update_linked_customdata(Mesh *me, const bool do_ensure_tess_cd) { if (do_ensure_tess_cd) { @@ -811,7 +812,7 @@ static void mesh_clear_geometry(Mesh *mesh) /* Note that materials and shape keys are not freed here. This is intentional, as freeing * shape keys requires tagging the depsgraph for updated relations, which is expensive. - * Material slots should be kept in sync with the object.*/ + * Material slots should be kept in sync with the object. */ mesh->totvert = 0; mesh->totedge = 0; @@ -2094,6 +2095,14 @@ void BKE_mesh_split_faces(Mesh *mesh, bool free_loop_normals) SplitFaceNewVert *new_verts = NULL; SplitFaceNewEdge *new_edges = NULL; + /* Ensure we own the layers, we need to do this before split_faces_prepare_new_verts as it will + * directly assign new indices to existing edges and loops. */ + CustomData_duplicate_referenced_layers(&mesh->vdata, mesh->totvert); + CustomData_duplicate_referenced_layers(&mesh->edata, mesh->totedge); + CustomData_duplicate_referenced_layers(&mesh->ldata, mesh->totloop); + /* Update pointers in case we duplicated referenced layers. */ + BKE_mesh_update_customdata_pointers(mesh, false); + /* Detect loop normal spaces (a.k.a. smooth fans) that will need a new vert. */ const int num_new_verts = split_faces_prepare_new_verts( mesh, &lnors_spacearr, &new_verts, memarena); diff --git a/source/blender/blenkernel/intern/mesh_boolean_convert.cc b/source/blender/blenkernel/intern/mesh_boolean_convert.cc index cfb1c192afe..5a8921132af 100644 --- a/source/blender/blenkernel/intern/mesh_boolean_convert.cc +++ b/source/blender/blenkernel/intern/mesh_boolean_convert.cc @@ -304,7 +304,7 @@ static IMesh meshes_to_imesh(Span<const Mesh *> meshes, r_info->mesh_edge_offset[mi] = e; r_info->mesh_poly_offset[mi] = f; /* Get matrix that transforms a coordinate in objects[mi]'s local space - * to the target space space.*/ + * to the target space space. */ const float4x4 objn_mat = (obmats[mi] == nullptr) ? float4x4::identity() : clean_obmat(*obmats[mi]); r_info->to_target_transform[mi] = inv_target_mat * objn_mat; diff --git a/source/blender/blenkernel/intern/mesh_convert.c b/source/blender/blenkernel/intern/mesh_convert.c index 31cb21b0f00..934f9ce5018 100644 --- a/source/blender/blenkernel/intern/mesh_convert.c +++ b/source/blender/blenkernel/intern/mesh_convert.c @@ -1704,7 +1704,7 @@ void BKE_mesh_nomain_to_mesh(Mesh *mesh_src, tmp.texflag &= ~ME_AUTOSPACE_EVALUATED; /* Clear any run-time data. - * Even though this mesh wont typically have run-time data, the Python API can for e.g. + * Even though this mesh won't typically have run-time data, the Python API can for e.g. * create loop-triangle cache here, which is confusing when left in the mesh, see: T81136. */ BKE_mesh_runtime_clear_geometry(&tmp); diff --git a/source/blender/blenkernel/intern/mesh_evaluate.c b/source/blender/blenkernel/intern/mesh_evaluate.c index 2260ffc668a..961c10ea5d3 100644 --- a/source/blender/blenkernel/intern/mesh_evaluate.c +++ b/source/blender/blenkernel/intern/mesh_evaluate.c @@ -3280,8 +3280,8 @@ void BKE_mesh_flush_select_from_polys_ex(MVert *mvert, i = totpoly; for (mp = mpoly; i--; mp++) { - /* assume if its selected its not hidden and none of its verts/edges are hidden - * (a common assumption)*/ + /* Assume if its selected its not hidden and none of its verts/edges are hidden + * (a common assumption). */ if (mp->flag & ME_FACE_SEL) { const MLoop *ml; int j; diff --git a/source/blender/blenkernel/intern/mesh_merge.c b/source/blender/blenkernel/intern/mesh_merge.c index fb73152cb8e..1e51ee73c7c 100644 --- a/source/blender/blenkernel/intern/mesh_merge.c +++ b/source/blender/blenkernel/intern/mesh_merge.c @@ -109,7 +109,7 @@ static int cddm_poly_compare(MLoop *mloop_array, i_loop_source++; if (i_loop_source == mpoly_source->totloop) { - /* End of loops for source, must match end of loop for target. */ + /* End of loops for source, must match end of loop for target. */ if (i_loop_target_offset == mpoly_target->totloop - 1) { compare_completed = true; same_loops = true; @@ -597,7 +597,7 @@ Mesh *BKE_mesh_merge_verts(Mesh *mesh, mp_new->loopstart = STACK_SIZE(mloop) - c; STACK_PUSH(oldp, i); - } /* end of the loop that tests polys */ + } /* End of the loop that tests polys. */ if (poly_gset) { // printf("hash quality %.6f\n", BLI_gset_calc_quality(poly_gset)); @@ -606,11 +606,11 @@ Mesh *BKE_mesh_merge_verts(Mesh *mesh, MEM_freeN(poly_keys); } - /*create new cddm*/ + /* Create new cddm. */ result = BKE_mesh_new_nomain_from_template( mesh, STACK_SIZE(mvert), STACK_SIZE(medge), 0, STACK_SIZE(mloop), STACK_SIZE(mpoly)); - /*update edge indices and copy customdata*/ + /* Update edge indices and copy customdata. */ med = medge; for (i = 0; i < result->totedge; i++, med++) { BLI_assert(newv[med->v1] != -1); @@ -624,7 +624,7 @@ Mesh *BKE_mesh_merge_verts(Mesh *mesh, CustomData_copy_data(&mesh->edata, &result->edata, olde[i], i, 1); } - /*update loop indices and copy customdata*/ + /* Update loop indices and copy customdata. */ ml = mloop; for (i = 0; i < result->totloop; i++, ml++) { /* Edge remapping has already be done in main loop handling part above. */ @@ -634,19 +634,19 @@ Mesh *BKE_mesh_merge_verts(Mesh *mesh, CustomData_copy_data(&mesh->ldata, &result->ldata, oldl[i], i, 1); } - /*copy vertex customdata*/ + /* Copy vertex customdata. */ mv = mvert; for (i = 0; i < result->totvert; i++, mv++) { CustomData_copy_data(&mesh->vdata, &result->vdata, oldv[i], i, 1); } - /*copy poly customdata*/ + /* Copy poly customdata. */ mp = mpoly; for (i = 0; i < result->totpoly; i++, mp++) { CustomData_copy_data(&mesh->pdata, &result->pdata, oldp[i], i, 1); } - /*copy over data. CustomData_add_layer can do this, need to look it up.*/ + /* Copy over data. #CustomData_add_layer can do this, need to look it up. */ memcpy(result->mvert, mvert, sizeof(MVert) * STACK_SIZE(mvert)); memcpy(result->medge, medge, sizeof(MEdge) * STACK_SIZE(medge)); memcpy(result->mloop, mloop, sizeof(MLoop) * STACK_SIZE(mloop)); diff --git a/source/blender/blenkernel/intern/mesh_runtime.c b/source/blender/blenkernel/intern/mesh_runtime.c index fae4c87626a..011dd7e25ee 100644 --- a/source/blender/blenkernel/intern/mesh_runtime.c +++ b/source/blender/blenkernel/intern/mesh_runtime.c @@ -30,6 +30,7 @@ #include "DNA_object_types.h" #include "BLI_math_geom.h" +#include "BLI_task.h" #include "BLI_threads.h" #include "BKE_bvhutils.h" @@ -151,6 +152,12 @@ int BKE_mesh_runtime_looptri_len(const Mesh *mesh) return looptri_len; } +static void mesh_runtime_looptri_recalc_isolated(void *userdata) +{ + Mesh *mesh = userdata; + BKE_mesh_runtime_looptri_recalc(mesh); +} + /* This is a ported copy of dm_getLoopTriArray(dm). */ const MLoopTri *BKE_mesh_runtime_looptri_ensure(Mesh *mesh) { @@ -163,7 +170,8 @@ const MLoopTri *BKE_mesh_runtime_looptri_ensure(Mesh *mesh) BLI_assert(BKE_mesh_runtime_looptri_len(mesh) == mesh->runtime.looptris.len); } else { - BKE_mesh_runtime_looptri_recalc(mesh); + /* Must isolate multithreaded tasks while holding a mutex lock. */ + BLI_task_isolate(mesh_runtime_looptri_recalc_isolated, mesh); looptri = mesh->runtime.looptris.array; } diff --git a/source/blender/blenkernel/intern/mesh_tessellate.c b/source/blender/blenkernel/intern/mesh_tessellate.c index 0cd1b211e4d..213f2929d63 100644 --- a/source/blender/blenkernel/intern/mesh_tessellate.c +++ b/source/blender/blenkernel/intern/mesh_tessellate.c @@ -49,6 +49,8 @@ /* -------------------------------------------------------------------- */ /** \name MFace Tessellation + * + * #MFace is a legacy data-structure that should be avoided, use #MLoopTri instead. * \{ */ /** @@ -60,18 +62,17 @@ * \note when mface is not NULL, mface[face_index].v4 * is used to test quads, else, loopindices[face_index][3] is used. */ -void BKE_mesh_loops_to_tessdata(CustomData *fdata, - CustomData *ldata, - MFace *mface, - const int *polyindices, - uint (*loopindices)[4], - const int num_faces) +static void mesh_loops_to_tessdata(CustomData *fdata, + CustomData *ldata, + MFace *mface, + const int *polyindices, + uint (*loopindices)[4], + const int num_faces) { - /* Note: performances are sub-optimal when we get a NULL mface, - * we could be ~25% quicker with dedicated code... - * Issue is, unless having two different functions with nearly the same code, - * there's not much ways to solve this. Better imho to live with it for now. :/ --mont29 - */ + /* NOTE(mont29): performances are sub-optimal when we get a NULL #MFace, + * we could be ~25% quicker with dedicated code. + * The issue is, unless having two different functions with nearly the same code, + * there's not much ways to solve this. Better IMHO to live with it for now (sigh). */ const int numUV = CustomData_number_of_layers(ldata, CD_MLOOPUV); const int numCol = CustomData_number_of_layers(ldata, CD_MLOOPCOL); const bool hasPCol = CustomData_has_layer(ldata, CD_PREVIEW_MLOOPCOL); @@ -139,7 +140,7 @@ void BKE_mesh_loops_to_tessdata(CustomData *fdata, } if (hasLoopTangent) { - /* need to do for all uv maps at some point */ + /* Need to do for all UV maps at some point. */ float(*ftangents)[4] = CustomData_get_layer(fdata, CD_TANGENT); float(*ltangents)[4] = CustomData_get_layer(ldata, CD_TANGENT); @@ -154,12 +155,15 @@ void BKE_mesh_loops_to_tessdata(CustomData *fdata, } /** - * Recreate tessellation. + * Recreate #MFace Tessellation. * * \param do_face_nor_copy: Controls whether the normals from the poly * are copied to the tessellated faces. * * \return number of tessellation faces. + * + * \note This doesn't use multi-threading like #BKE_mesh_recalc_looptri since + * it's not used in many places and #MFace should be phased out. */ int BKE_mesh_tessface_calc_ex(CustomData *fdata, CustomData *ldata, @@ -170,13 +174,10 @@ int BKE_mesh_tessface_calc_ex(CustomData *fdata, int totpoly, const bool do_face_nor_copy) { - /* use this to avoid locking pthread for _every_ polygon - * and calling the fill function */ - #define USE_TESSFACE_SPEEDUP -#define USE_TESSFACE_QUADS /* NEEDS FURTHER TESTING */ +#define USE_TESSFACE_QUADS -/* We abuse MFace->edcode to tag quad faces. See below for details. */ +/* We abuse #MFace.edcode to tag quad faces. See below for details. */ #define TESSFACE_IS_QUAD 1 const int looptri_num = poly_to_tri_count(totpoly, totloop); @@ -193,9 +194,9 @@ int BKE_mesh_tessface_calc_ex(CustomData *fdata, mpoly = CustomData_get_layer(pdata, CD_MPOLY); mloop = CustomData_get_layer(ldata, CD_MLOOP); - /* allocate the length of totfaces, avoid many small reallocs, - * if all faces are tri's it will be correct, quads == 2x allocs */ - /* take care. we are _not_ calloc'ing so be sure to initialize each field */ + /* Allocate the length of `totfaces`, avoid many small reallocation's, + * if all faces are triangles it will be correct, `quads == 2x` allocations. */ + /* Take care since memory is _not_ zeroed so be sure to initialize each field. */ mface_to_poly_map = MEM_malloc_arrayN((size_t)looptri_num, sizeof(*mface_to_poly_map), __func__); mface = MEM_malloc_arrayN((size_t)looptri_num, sizeof(*mface), __func__); lindices = MEM_malloc_arrayN((size_t)looptri_num, sizeof(*lindices), __func__); @@ -208,7 +209,7 @@ int BKE_mesh_tessface_calc_ex(CustomData *fdata, uint l1, l2, l3, l4; uint *lidx; if (mp_totloop < 3) { - /* do nothing */ + /* Do nothing. */ } #ifdef USE_TESSFACE_SPEEDUP @@ -217,7 +218,7 @@ int BKE_mesh_tessface_calc_ex(CustomData *fdata, mface_to_poly_map[mface_index] = poly_index; \ mf = &mface[mface_index]; \ lidx = lindices[mface_index]; \ - /* set loop indices, transformed to vert indices later */ \ + /* Set loop indices, transformed to vert indices later. */ \ l1 = mp_loopstart + i1; \ l2 = mp_loopstart + i2; \ l3 = mp_loopstart + i3; \ @@ -239,7 +240,7 @@ int BKE_mesh_tessface_calc_ex(CustomData *fdata, mface_to_poly_map[mface_index] = poly_index; \ mf = &mface[mface_index]; \ lidx = lindices[mface_index]; \ - /* set loop indices, transformed to vert indices later */ \ + /* Set loop indices, transformed to vert indices later. */ \ l1 = mp_loopstart + 0; /* EXCEPTION */ \ l2 = mp_loopstart + 1; /* EXCEPTION */ \ l3 = mp_loopstart + 2; /* EXCEPTION */ \ @@ -293,7 +294,7 @@ int BKE_mesh_tessface_calc_ex(CustomData *fdata, zero_v3(normal); - /* calc normal, flipped: to get a positive 2d cross product */ + /* Calculate the normal, flipped: to get a positive 2D cross product. */ ml = mloop + mp_loopstart; co_prev = mvert[ml[mp_totloop - 1].v].co; for (j = 0; j < mp_totloop; j++, ml++) { @@ -305,7 +306,7 @@ int BKE_mesh_tessface_calc_ex(CustomData *fdata, normal[2] = 1.0f; } - /* project verts to 2d */ + /* Project verts to 2D. */ axis_dominant_v3_to_m3_negate(axis_mat, normal); ml = mloop + mp_loopstart; @@ -315,7 +316,7 @@ int BKE_mesh_tessface_calc_ex(CustomData *fdata, BLI_polyfill_calc_arena(projverts, mp_totloop, 1, tris, arena); - /* apply fill */ + /* Apply fill. */ for (j = 0; j < totfilltri; j++) { uint *tri = tris[j]; lidx = lindices[mface_index]; @@ -323,7 +324,7 @@ int BKE_mesh_tessface_calc_ex(CustomData *fdata, mface_to_poly_map[mface_index] = poly_index; mf = &mface[mface_index]; - /* set loop indices, transformed to vert indices later */ + /* Set loop indices, transformed to vert indices later. */ l1 = mp_loopstart + tri[0]; l2 = mp_loopstart + tri[1]; l3 = mp_loopstart + tri[2]; @@ -359,7 +360,7 @@ int BKE_mesh_tessface_calc_ex(CustomData *fdata, BLI_assert(totface <= looptri_num); - /* not essential but without this we store over-alloc'd memory in the CustomData layers */ + /* Not essential but without this we store over-allocated memory in the #CustomData layers. */ if (LIKELY(looptri_num != totface)) { mface = MEM_reallocN(mface, sizeof(*mface) * (size_t)totface); mface_to_poly_map = MEM_reallocN(mface_to_poly_map, @@ -368,14 +369,14 @@ int BKE_mesh_tessface_calc_ex(CustomData *fdata, CustomData_add_layer(fdata, CD_MFACE, CD_ASSIGN, mface, totface); - /* CD_ORIGINDEX will contain an array of indices from tessfaces to the polygons - * they are directly tessellated from */ + /* #CD_ORIGINDEX will contain an array of indices from tessellation-faces to the polygons + * they are directly tessellated from. */ CustomData_add_layer(fdata, CD_ORIGINDEX, CD_ASSIGN, mface_to_poly_map, totface); CustomData_from_bmeshpoly(fdata, ldata, totface); if (do_face_nor_copy) { /* If polys have a normals layer, copying that to faces can help - * avoid the need to recalculate normals later */ + * avoid the need to recalculate normals later. */ if (CustomData_has_layer(pdata, CD_NORMAL)) { float(*pnors)[3] = CustomData_get_layer(pdata, CD_NORMAL); float(*fnors)[3] = CustomData_add_layer(fdata, CD_NORMAL, CD_CALLOC, NULL, totface); @@ -387,14 +388,12 @@ int BKE_mesh_tessface_calc_ex(CustomData *fdata, /* NOTE: quad detection issue - fourth vertidx vs fourth loopidx: * Polygons take care of their loops ordering, hence not of their vertices ordering. - * Currently, our tfaces' fourth vertex index might be 0 even for a quad. However, - * we know our fourth loop index is never 0 for quads (because they are sorted for polygons, - * and our quads are still mere copies of their polygons). - * So we pass NULL as MFace pointer, and BKE_mesh_loops_to_tessdata - * will use the fourth loop index as quad test. - * ... - */ - BKE_mesh_loops_to_tessdata(fdata, ldata, NULL, mface_to_poly_map, lindices, totface); + * Currently, our tfaces' fourth vertex index might be 0 even for a quad. + * However, we know our fourth loop index is never 0 for quads + * (because they are sorted for polygons, and our quads are still mere copies of their polygons). + * So we pass NULL as MFace pointer, and #mesh_loops_to_tessdata + * will use the fourth loop index as quad test. */ + mesh_loops_to_tessdata(fdata, ldata, NULL, mface_to_poly_map, lindices, totface); /* NOTE: quad detection issue - fourth vertidx vs fourth loopidx: * ...However, most TFace code uses 'MFace->v4 == 0' test to check whether it is a tri or quad. @@ -431,7 +430,7 @@ void BKE_mesh_tessface_calc(Mesh *mesh) mesh->totface, mesh->totloop, mesh->totpoly, - /* calc normals right after, don't copy from polys here */ + /* Calculate normals right after, don't copy from polys here. */ false); BKE_mesh_update_customdata_pointers(mesh, true); @@ -441,6 +440,8 @@ void BKE_mesh_tessface_calc(Mesh *mesh) /* -------------------------------------------------------------------- */ /** \name Loop Tessellation + * + * Fill in #MLoopTri data-structure. * \{ */ /** diff --git a/source/blender/blenkernel/intern/mesh_validate.c b/source/blender/blenkernel/intern/mesh_validate.c index 6b34604b1ac..bfdbf844a26 100644 --- a/source/blender/blenkernel/intern/mesh_validate.c +++ b/source/blender/blenkernel/intern/mesh_validate.c @@ -217,6 +217,16 @@ static int search_polyloop_cmp(const void *v1, const void *v2) * Validate the mesh, \a do_fixes requires \a mesh to be non-null. * * \return false if no changes needed to be made. + * + * Vertex Normals + * ============== + * + * While zeroed normals are checked, these checks aren't comprehensive. + * Technically, to detect errors here a normal recalculation and comparison is necessary. + * However this function is mainly to prevent severe errors in geometry + * (invalid data that will crash Blender, or cause some features to behave incorrectly), + * not to detect subtle differences in the resulting normals which could be caused + * by importers that load normals (for example). */ /* NOLINTNEXTLINE: readability-function-size */ bool BKE_mesh_validate_arrays(Mesh *mesh, @@ -328,10 +338,21 @@ bool BKE_mesh_validate_arrays(Mesh *mesh, } if (fix_normal) { - PRINT_ERR("\tVertex %u: has zero normal, assuming Z-up normal", i); - if (do_fixes) { - mv->no[2] = SHRT_MAX; - fix_flag.verts = true; + /* If the vertex normal accumulates to zero or isn't part of a face, the location is used. + * When the location is also zero, a zero normal warning should not be raised. + * since this is the expected behavior of normal calculation. + * + * This avoids false positives but isn't foolproof as it's possible the vertex + * is part of a polygon that has a normal which this vertex should be using, + * although it's also possible degenerate/opposite faces accumulate to a zero vector. + * To detect this a full normal recalculation would be needed, which is out of scope + * for a basic validity check (see "Vertex Normal" in the doc-string). */ + if (!is_zero_v3(mv->co)) { + PRINT_ERR("\tVertex %u: has zero normal, assuming Z-up normal", i); + if (do_fixes) { + mv->no[2] = SHRT_MAX; + fix_flag.verts = true; + } } } } @@ -1084,7 +1105,7 @@ bool BKE_mesh_validate(Mesh *me, const bool do_verbose, const bool cddata_check_ &changed); if (changed) { - DEG_id_tag_update(&me->id, ID_RECALC_GEOMETRY); + DEG_id_tag_update(&me->id, ID_RECALC_GEOMETRY_ALL_MODES); return true; } @@ -1162,7 +1183,7 @@ bool BKE_mesh_validate_material_indices(Mesh *me) } if (!is_valid) { - DEG_id_tag_update(&me->id, ID_RECALC_GEOMETRY); + DEG_id_tag_update(&me->id, ID_RECALC_GEOMETRY_ALL_MODES); return true; } @@ -1441,7 +1462,7 @@ static void mesh_calc_edges_mdata(MVert *UNUSED(allvert), med->flag |= ME_LOOSEEDGE; } - /* order is swapped so extruding this edge as a surface wont flip face normals + /* order is swapped so extruding this edge as a surface won't flip face normals * with cyclic curves */ if (ed->v1 + 1 != ed->v2) { SWAP(uint, med->v1, med->v2); diff --git a/source/blender/blenkernel/intern/mesh_wrapper.c b/source/blender/blenkernel/intern/mesh_wrapper.c index cf1dba3325c..fe6af432314 100644 --- a/source/blender/blenkernel/intern/mesh_wrapper.c +++ b/source/blender/blenkernel/intern/mesh_wrapper.c @@ -40,6 +40,7 @@ #include "BLI_ghash.h" #include "BLI_math.h" +#include "BLI_task.h" #include "BLI_threads.h" #include "BLI_utildefines.h" @@ -95,15 +96,9 @@ Mesh *BKE_mesh_wrapper_from_editmesh(BMEditMesh *em, return BKE_mesh_wrapper_from_editmesh_with_coords(em, cd_mask_extra, NULL, me_settings); } -void BKE_mesh_wrapper_ensure_mdata(Mesh *me) +static void mesh_wrapper_ensure_mdata_isolated(void *userdata) { - ThreadMutex *mesh_eval_mutex = (ThreadMutex *)me->runtime.eval_mutex; - BLI_mutex_lock(mesh_eval_mutex); - - if (me->runtime.wrapper_type == ME_WRAPPER_TYPE_MDATA) { - BLI_mutex_unlock(mesh_eval_mutex); - return; - } + Mesh *me = userdata; const eMeshWrapperType geom_type_orig = me->runtime.wrapper_type; me->runtime.wrapper_type = ME_WRAPPER_TYPE_MDATA; @@ -136,6 +131,20 @@ void BKE_mesh_wrapper_ensure_mdata(Mesh *me) if (me->runtime.wrapper_type_finalize) { BKE_mesh_wrapper_deferred_finalize(me, &me->runtime.cd_mask_extra); } +} + +void BKE_mesh_wrapper_ensure_mdata(Mesh *me) +{ + ThreadMutex *mesh_eval_mutex = (ThreadMutex *)me->runtime.eval_mutex; + BLI_mutex_lock(mesh_eval_mutex); + + if (me->runtime.wrapper_type == ME_WRAPPER_TYPE_MDATA) { + BLI_mutex_unlock(mesh_eval_mutex); + return; + } + + /* Must isolate multithreaded tasks while holding a mutex lock. */ + BLI_task_isolate(mesh_wrapper_ensure_mdata_isolated, me); BLI_mutex_unlock(mesh_eval_mutex); } diff --git a/source/blender/blenkernel/intern/movieclip.c b/source/blender/blenkernel/intern/movieclip.c index 0f2f56f4f2b..3a7910d1a9f 100644 --- a/source/blender/blenkernel/intern/movieclip.c +++ b/source/blender/blenkernel/intern/movieclip.c @@ -1320,7 +1320,7 @@ static ImBuf *movieclip_get_postprocessed_ibuf( clip->lastframe = framenr; real_ibuf_size(clip, user, ibuf, &clip->lastsize[0], &clip->lastsize[1]); - /* postprocess frame and put to cache if needed*/ + /* Post-process frame and put to cache if needed. */ if (need_postprocess) { ImBuf *tmpibuf = ibuf; ibuf = postprocess_frame(clip, user, tmpibuf, flag, postprocess_flag); @@ -2128,9 +2128,9 @@ GPUTexture *BKE_movieclip_get_gpu_texture(MovieClip *clip, MovieClipUser *cuser) void BKE_movieclip_free_gputexture(struct MovieClip *clip) { - /* number of gpu textures to keep around as cache + /* Number of gpu textures to keep around as cache. * We don't want to keep too many GPU textures for - * movie clips around, as they can be large.*/ + * movie clips around, as they can be large. */ const int MOVIECLIP_NUM_GPUTEXTURES = 1; while (BLI_listbase_count(&clip->runtime.gputextures) > MOVIECLIP_NUM_GPUTEXTURES) { diff --git a/source/blender/blenkernel/intern/multires.c b/source/blender/blenkernel/intern/multires.c index 80de3748595..ad53f29f3f6 100644 --- a/source/blender/blenkernel/intern/multires.c +++ b/source/blender/blenkernel/intern/multires.c @@ -1449,7 +1449,7 @@ static void multiresModifier_disp_run( } } - /*numGrids = dm->getNumGrids(dm);*/ /*UNUSED*/ + // numGrids = dm->getNumGrids(dm); /* UNUSED */ gridSize = dm->getGridSize(dm); gridData = dm->getGridData(dm); gridOffset = dm->getGridOffset(dm); @@ -1740,7 +1740,7 @@ DerivedMesh *multires_make_derived_from_derived( multires_set_tot_mdisps(me, mmd->totlvl); multiresModifier_ensure_external_read(me, mmd); - /*run displacement*/ + /* Run displacement. */ multiresModifier_disp_run(result, ob->data, dm, APPLY_DISPLACEMENTS, subGridData, mmd->totlvl); /* copy hidden elements for this level */ @@ -1969,7 +1969,7 @@ void multires_topology_changed(Mesh *me) * * Since the multires data files only contain displacement vectors without knowledge about * subdivision level some extra work is needed. Namely make is to all displacement grids have - * proper level and number of displacement vectors set. */ + * proper level and number of displacement vectors set. */ void multires_ensure_external_read(struct Mesh *mesh, int top_level) { if (!CustomData_external_test(&mesh->ldata, CD_MDISPS)) { diff --git a/source/blender/blenkernel/intern/multires_reshape.c b/source/blender/blenkernel/intern/multires_reshape.c index 04ad78ec0de..bd52d70b223 100644 --- a/source/blender/blenkernel/intern/multires_reshape.c +++ b/source/blender/blenkernel/intern/multires_reshape.c @@ -235,7 +235,7 @@ void multiresModifier_subdivide_to_level(struct Object *object, /* Free original grids which makes it so smoothing with details thinks all the details were * added against base mesh's limit surface. This is similar behavior to as if we've done all - * displacement in sculpt mode at the old top level and then propagated to the new top level.*/ + * displacement in sculpt mode at the old top level and then propagated to the new top level. */ multires_reshape_free_original_grids(&reshape_context); if (ELEM(mode, MULTIRES_SUBDIVIDE_LINEAR, MULTIRES_SUBDIVIDE_SIMPLE)) { diff --git a/source/blender/blenkernel/intern/multires_reshape_smooth.c b/source/blender/blenkernel/intern/multires_reshape_smooth.c index d7ab6773991..b9cbf227925 100644 --- a/source/blender/blenkernel/intern/multires_reshape_smooth.c +++ b/source/blender/blenkernel/intern/multires_reshape_smooth.c @@ -88,7 +88,7 @@ bool debug_invert_m3_m3(float m1[3][3], const float m2[3][3], const char *func, /* Surface refers to a simplified and lower-memory footprint representation of the limit surface. * * Used to store pre-calculated information which is expensive or impossible to evaluate when - * traversing the final limit surface. */ + * traversing the final limit surface. */ typedef struct SurfacePoint { float P[3]; @@ -1060,7 +1060,7 @@ static void converter_init(const MultiresReshapeSmoothContext *reshape_smooth_co converter->user_data = (void *)reshape_smooth_context; } -/* Create subdiv descriptor created for topology at a reshape level, */ +/* Create subdiv descriptor created for topology at a reshape level. */ static void reshape_subdiv_create(MultiresReshapeSmoothContext *reshape_smooth_context) { const MultiresReshapeContext *reshape_context = reshape_smooth_context->reshape_context; @@ -1083,7 +1083,7 @@ typedef void(ReshapeSubdivCoarsePositionCb)( const Vertex *vertex, float r_P[3]); -/* Refine subdivision surface topology at a reshape level for new coarse vertices positions. */ +/* Refine subdivision surface topology at a reshape level for new coarse vertices positions. */ static void reshape_subdiv_refine(const MultiresReshapeSmoothContext *reshape_smooth_context, ReshapeSubdivCoarsePositionCb coarse_position_cb) { diff --git a/source/blender/blenkernel/intern/multires_unsubdivide.c b/source/blender/blenkernel/intern/multires_unsubdivide.c index 7440700a3de..275c9c3e01b 100644 --- a/source/blender/blenkernel/intern/multires_unsubdivide.c +++ b/source/blender/blenkernel/intern/multires_unsubdivide.c @@ -312,7 +312,7 @@ static bool unsubdivide_tag_disconnected_mesh_element(BMesh *bm, int *elem_id, i /* Also try from the different 4 vertices of a quad in the current * disconnected element ID. If a solution exists the search should return a valid solution from - * one of these vertices.*/ + * one of these vertices. */ BMFace *f, *init_face = NULL; BMVert *v; BMIter iter_a, iter_b; diff --git a/source/blender/blenkernel/intern/nla.c b/source/blender/blenkernel/intern/nla.c index 92e21183acb..bf18765aa94 100644 --- a/source/blender/blenkernel/intern/nla.c +++ b/source/blender/blenkernel/intern/nla.c @@ -1289,7 +1289,7 @@ void BKE_nlastrip_set_active(AnimData *adt, NlaStrip *strip) return; } - /* loop over tracks, deactivating*/ + /* Loop over tracks, deactivating. */ for (nlt = adt->nla_tracks.first; nlt; nlt = nlt->next) { for (nls = nlt->strips.first; nls; nls = nls->next) { if (nls != strip) { @@ -1560,7 +1560,7 @@ bool BKE_nlatracks_have_animated_strips(ListBase *tracks) return false; } -/* Validate the NLA-Strips 'control' F-Curves based on the flags set*/ +/* Validate the NLA-Strips 'control' F-Curves based on the flags set. */ void BKE_nlastrip_validate_fcurves(NlaStrip *strip) { FCurve *fcu; diff --git a/source/blender/blenkernel/intern/node.cc b/source/blender/blenkernel/intern/node.cc index db18cecb5d3..cf0dd75ea9d 100644 --- a/source/blender/blenkernel/intern/node.cc +++ b/source/blender/blenkernel/intern/node.cc @@ -875,7 +875,7 @@ void ntreeBlendReadLib(struct BlendLibReader *reader, struct bNodeTree *ntree) LISTBASE_FOREACH (bNode *, node, &ntree->nodes) { /* Link ID Properties -- and copy this comment EXACTLY for easy finding - * of library blocks that implement this.*/ + * of library blocks that implement this. */ IDP_BlendReadLib(reader, node->prop); BLO_read_id_address(reader, lib, &node->id); @@ -2365,7 +2365,7 @@ static void nodeUnMuteLink(bNodeLink *link) link->tosock->flag |= SOCK_IN_USE; } -/* Upstream muting. Always happens when unmuting but checks when muting. O(n^2) algorithm.*/ +/* Upstream muting. Always happens when unmuting but checks when muting. O(n^2) algorithm. */ static void nodeMuteRerouteInputLinks(bNodeTree *ntree, bNode *node, const bool mute) { if (node->type != NODE_REROUTE) { @@ -2388,7 +2388,7 @@ static void nodeMuteRerouteInputLinks(bNodeTree *ntree, bNode *node, const bool } } -/* Downstream muting propagates when reaching reroute nodes. O(n^2) algorithm.*/ +/* Downstream muting propagates when reaching reroute nodes. O(n^2) algorithm. */ static void nodeMuteRerouteOutputLinks(bNodeTree *ntree, bNode *node, const bool mute) { if (node->type != NODE_REROUTE) { diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c index b73f6a5b78c..c5614a69744 100644 --- a/source/blender/blenkernel/intern/object.c +++ b/source/blender/blenkernel/intern/object.c @@ -957,8 +957,8 @@ static void object_blend_read_lib(BlendLibReader *reader, ID *id) ob, eModifierType_Fluidsim); if (fluidmd && fluidmd->fss) { - BLO_read_id_address( - reader, ob->id.lib, &fluidmd->fss->ipo); /* XXX deprecated - old animation system */ + /* XXX: deprecated - old animation system. */ + BLO_read_id_address(reader, ob->id.lib, &fluidmd->fss->ipo); } } @@ -2759,7 +2759,7 @@ Object *BKE_object_duplicate(Main *bmain, } if (!is_subprocess) { - /* This code will follow into all ID links using an ID tagged with LIB_TAG_NEW.*/ + /* This code will follow into all ID links using an ID tagged with LIB_TAG_NEW. */ BKE_libblock_relink_to_newid(&obn->id); #ifndef NDEBUG @@ -2854,7 +2854,7 @@ void BKE_object_copy_proxy_drivers(Object *ob, Object *target) else { /* only on local objects because this causes indirect links * 'a -> b -> c', blend to point directly to a.blend - * when a.blend has a proxy that's linked into c.blend */ + * when a.blend has a proxy that's linked into `c.blend`. */ if (!ID_IS_LINKED(ob)) { id_lib_extern((ID *)dtar->id); } @@ -2890,7 +2890,7 @@ void BKE_object_make_proxy(Main *bmain, Object *ob, Object *target, Object *cob) /* copy transform * - cob means this proxy comes from a collection, just apply the matrix - * so the object wont move from its dupli-transform. + * so the object won't move from its dupli-transform. * * - no cob means this is being made from a linked object, * this is closer to making a copy of the object - in-place. */ @@ -3212,12 +3212,11 @@ void BKE_object_to_mat3(Object *ob, float r_mat[3][3]) /* no parent */ { float smat[3][3]; float rmat[3][3]; - /*float q1[4];*/ - /* scale */ + /* Scale. */ BKE_object_scale_to_mat3(ob, smat); - /* rot */ + /* Rotation. */ BKE_object_rot_to_mat3(ob, rmat, true); mul_m3_m3m3(r_mat, rmat, smat); } @@ -4447,7 +4446,7 @@ bool BKE_object_obdata_texspace_get(Object *ob, short **r_texflag, float **r_loc } /** Get evaluated mesh for given object. */ -Mesh *BKE_object_get_evaluated_mesh(Object *object) +Mesh *BKE_object_get_evaluated_mesh(const Object *object) { ID *data_eval = object->runtime.data_eval; return (data_eval && GS(data_eval->name) == ID_ME) ? (Mesh *)data_eval : NULL; @@ -4460,7 +4459,7 @@ Mesh *BKE_object_get_evaluated_mesh(Object *object) * - For copied-on-write objects it will give pointer to a copied-on-write * mesh which corresponds to original object's mesh. */ -Mesh *BKE_object_get_pre_modified_mesh(Object *object) +Mesh *BKE_object_get_pre_modified_mesh(const Object *object) { if (object->type == OB_MESH && object->runtime.data_orig != NULL) { BLI_assert(object->id.tag & LIB_TAG_COPIED_ON_WRITE); @@ -4481,7 +4480,7 @@ Mesh *BKE_object_get_pre_modified_mesh(Object *object) * - For evaluated objects it will be same mesh as corresponding original * object uses as data. */ -Mesh *BKE_object_get_original_mesh(Object *object) +Mesh *BKE_object_get_original_mesh(const Object *object) { Mesh *result = NULL; if (object->id.orig_id == NULL) { diff --git a/source/blender/blenkernel/intern/object_update.c b/source/blender/blenkernel/intern/object_update.c index e6909127503..b1afd968bdc 100644 --- a/source/blender/blenkernel/intern/object_update.c +++ b/source/blender/blenkernel/intern/object_update.c @@ -349,38 +349,45 @@ void BKE_object_eval_uber_transform(Depsgraph *depsgraph, Object *object) BKE_object_eval_proxy_copy(depsgraph, object); } -void BKE_object_batch_cache_dirty_tag(Object *ob) +void BKE_object_data_batch_cache_dirty_tag(ID *object_data) { - switch (ob->type) { - case OB_MESH: - BKE_mesh_batch_cache_dirty_tag(ob->data, BKE_MESH_BATCH_DIRTY_ALL); + switch (GS(object_data->name)) { + case ID_ME: + BKE_mesh_batch_cache_dirty_tag((struct Mesh *)object_data, BKE_MESH_BATCH_DIRTY_ALL); break; - case OB_LATTICE: - BKE_lattice_batch_cache_dirty_tag(ob->data, BKE_LATTICE_BATCH_DIRTY_ALL); + case ID_LT: + BKE_lattice_batch_cache_dirty_tag((struct Lattice *)object_data, + BKE_LATTICE_BATCH_DIRTY_ALL); break; - case OB_CURVE: - case OB_FONT: - case OB_SURF: - BKE_curve_batch_cache_dirty_tag(ob->data, BKE_CURVE_BATCH_DIRTY_ALL); + case ID_CU: + BKE_curve_batch_cache_dirty_tag((struct Curve *)object_data, BKE_CURVE_BATCH_DIRTY_ALL); break; - case OB_MBALL: - BKE_mball_batch_cache_dirty_tag(ob->data, BKE_MBALL_BATCH_DIRTY_ALL); + case ID_MB: + BKE_mball_batch_cache_dirty_tag((struct MetaBall *)object_data, BKE_MBALL_BATCH_DIRTY_ALL); break; - case OB_GPENCIL: - BKE_gpencil_batch_cache_dirty_tag(ob->data); + case ID_GD: + BKE_gpencil_batch_cache_dirty_tag((struct bGPdata *)object_data); break; - case OB_HAIR: - BKE_hair_batch_cache_dirty_tag(ob->data, BKE_HAIR_BATCH_DIRTY_ALL); + case ID_HA: + BKE_hair_batch_cache_dirty_tag((struct Hair *)object_data, BKE_HAIR_BATCH_DIRTY_ALL); break; - case OB_POINTCLOUD: - BKE_pointcloud_batch_cache_dirty_tag(ob->data, BKE_POINTCLOUD_BATCH_DIRTY_ALL); + case ID_PT: + BKE_pointcloud_batch_cache_dirty_tag((struct PointCloud *)object_data, + BKE_POINTCLOUD_BATCH_DIRTY_ALL); break; - case OB_VOLUME: - BKE_volume_batch_cache_dirty_tag(ob->data, BKE_VOLUME_BATCH_DIRTY_ALL); + case ID_VO: + BKE_volume_batch_cache_dirty_tag((struct Volume *)object_data, BKE_VOLUME_BATCH_DIRTY_ALL); + break; + default: break; } } +void BKE_object_batch_cache_dirty_tag(Object *ob) +{ + BKE_object_data_batch_cache_dirty_tag(ob->data); +} + void BKE_object_eval_uber_data(Depsgraph *depsgraph, Scene *scene, Object *ob) { DEG_debug_print_eval(depsgraph, __func__, ob->id.name, ob); diff --git a/source/blender/blenkernel/intern/ocean.c b/source/blender/blenkernel/intern/ocean.c index 9d53dad8d03..2e7152302c7 100644 --- a/source/blender/blenkernel/intern/ocean.c +++ b/source/blender/blenkernel/intern/ocean.c @@ -248,7 +248,7 @@ void BKE_ocean_eval_uv(struct Ocean *oc, struct OceanResult *ocr, float u, float if (oc->_do_normals) { ocr->normal[0] = BILERP(oc->_N_x); - ocr->normal[1] = oc->_N_y /*BILERP(oc->_N_y) (MEM01)*/; + ocr->normal[1] = oc->_N_y /* BILERP(oc->_N_y) (MEM01) */; ocr->normal[2] = BILERP(oc->_N_z); } @@ -347,7 +347,7 @@ void BKE_ocean_eval_uv_catrom(struct Ocean *oc, struct OceanResult *ocr, float u } if (oc->_do_normals) { ocr->normal[0] = INTERP(oc->_N_x); - ocr->normal[1] = oc->_N_y /*INTERP(oc->_N_y) (MEM01)*/; + ocr->normal[1] = oc->_N_y /* INTERP(oc->_N_y) (MEM01) */; ocr->normal[2] = INTERP(oc->_N_z); } if (oc->_do_chop) { @@ -1052,7 +1052,7 @@ void BKE_ocean_free_data(struct Ocean *oc) fftw_destroy_plan(oc->_N_x_plan); fftw_destroy_plan(oc->_N_z_plan); MEM_freeN(oc->_N_x); - /*fftwf_free(oc->_N_y); (MEM01)*/ + /* fftwf_free(oc->_N_y); (MEM01) */ MEM_freeN(oc->_N_z); } @@ -1437,9 +1437,9 @@ void BKE_ocean_bake(struct Ocean *o, rgb_to_rgba_unit_alpha(&ibuf_disp->rect_float[4 * (res_x * y + x)], ocr.disp); if (o->_do_jacobian) { - /* TODO, cleanup unused code - campbell */ + /* TODO: cleanup unused code - campbell */ - float /*r, */ /* UNUSED */ pr = 0.0f, foam_result; + float /* r, */ /* UNUSED */ pr = 0.0f, foam_result; float neg_disp, neg_eplus; ocr.foam = BKE_ocean_jminus_to_foam(ocr.Jminus, och->foam_coverage); @@ -1449,9 +1449,9 @@ void BKE_ocean_bake(struct Ocean *o, pr = prev_foam[res_x * y + x]; } - /* r = BLI_rng_get_float(rng); */ /* UNUSED */ /* randomly reduce foam */ + // r = BLI_rng_get_float(rng); /* UNUSED */ /* randomly reduce foam */ - /* pr = pr * och->foam_fade; */ /* overall fade */ + // pr = pr * och->foam_fade; /* overall fade */ /* Remember ocean coord sys is Y up! * break up the foam where height (Y) is low (wave valley), @@ -1475,7 +1475,7 @@ void BKE_ocean_bake(struct Ocean *o, prev_foam[res_x * y + x] = foam_result; - /*foam_result = min_ff(foam_result, 1.0f); */ + // foam_result = min_ff(foam_result, 1.0f); value_to_rgba_unit_alpha(&ibuf_foam->rect_float[4 * (res_x * y + x)], foam_result); diff --git a/source/blender/blenkernel/intern/ocean_intern.h b/source/blender/blenkernel/intern/ocean_intern.h index b55b211fa33..4ebd03789af 100644 --- a/source/blender/blenkernel/intern/ocean_intern.h +++ b/source/blender/blenkernel/intern/ocean_intern.h @@ -99,7 +99,7 @@ typedef struct Ocean { double *_N_x; /* init w sim w via plan? */ /* all member of this array has same values, * so convert this array to a float to reduce memory usage (MEM01). */ - /*float * _N_y; */ + // float * _N_y; double _N_y; /* sim w ********* can be rearranged? */ double *_N_z; /* init w sim w via plan? */ double *_disp_x; /* init w sim w via plan? */ diff --git a/source/blender/blenkernel/intern/ocean_spectrum.c b/source/blender/blenkernel/intern/ocean_spectrum.c index 1f7cc56f1a9..7ed70234baf 100644 --- a/source/blender/blenkernel/intern/ocean_spectrum.c +++ b/source/blender/blenkernel/intern/ocean_spectrum.c @@ -122,7 +122,7 @@ static float jonswap(const Ocean *oc, const float k2) float val = alpha_beta_spectrum(m_alpha, beta, GRAVITY, omega, m_peakomega); - /* Peak sharpening */ + /* Peak sharpening. */ val *= peak_sharpen(m_omega, m_peakomega, m_gamma); return val; diff --git a/source/blender/blenkernel/intern/paint.c b/source/blender/blenkernel/intern/paint.c index 2c830e92142..708fbae0d49 100644 --- a/source/blender/blenkernel/intern/paint.c +++ b/source/blender/blenkernel/intern/paint.c @@ -1823,7 +1823,7 @@ void BKE_sculpt_color_layer_create_if_needed(struct Object *object) CustomData_add_layer(&orig_me->vdata, CD_PROP_COLOR, CD_DEFAULT, NULL, orig_me->totvert); BKE_mesh_update_customdata_pointers(orig_me, true); - DEG_id_tag_update(&orig_me->id, ID_RECALC_GEOMETRY); + DEG_id_tag_update(&orig_me->id, ID_RECALC_GEOMETRY_ALL_MODES); SCULPT_dynamic_topology_sync_layers(object, orig_me); } diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c index a873ecec6f1..d386967bf8b 100644 --- a/source/blender/blenkernel/intern/particle.c +++ b/source/blender/blenkernel/intern/particle.c @@ -384,8 +384,9 @@ void BKE_particle_partdeflect_blend_read_lib(BlendLibReader *reader, ID *id, Par static void particle_settings_blend_read_lib(BlendLibReader *reader, ID *id) { ParticleSettings *part = (ParticleSettings *)id; - BLO_read_id_address( - reader, part->id.lib, &part->ipo); /* XXX deprecated - old animation system */ + + /* XXX: deprecated - old animation system. */ + BLO_read_id_address(reader, part->id.lib, &part->ipo); BLO_read_id_address(reader, part->id.lib, &part->instance_object); BLO_read_id_address(reader, part->id.lib, &part->instance_collection); @@ -1437,7 +1438,7 @@ static void do_particle_interpolation(ParticleSystem *psys, int point_vel = (point && point->keys->vel); float real_t, dfra, keytime, invdt = 1.0f; - /* billboards wont fill in all of these, so start cleared */ + /* billboards won't fill in all of these, so start cleared */ memset(keys, 0, sizeof(keys)); /* interpret timing and find keys */ @@ -2461,7 +2462,7 @@ int do_guides(Depsgraph *depsgraph, (int)(data->strength * guidetime * 100.0f), 100)); } - else { /* curve size*/ + else { /* Curve size. */ if (cu->flag & CU_PATH_RADIUS) { mul_v3_fl(vec_to_point, radius); } diff --git a/source/blender/blenkernel/intern/particle_child.c b/source/blender/blenkernel/intern/particle_child.c index 6e0965650d3..2231731287d 100644 --- a/source/blender/blenkernel/intern/particle_child.c +++ b/source/blender/blenkernel/intern/particle_child.c @@ -785,7 +785,7 @@ static void do_twist(const ParticleChildModifierContext *modifier_ctx, return; } if (part->twist == 0.0f) { - /* No twist along the strand. */ + /* No twist along the strand. */ return; } /* Dependent on whether it's threaded update or not, curve comes diff --git a/source/blender/blenkernel/intern/particle_distribute.c b/source/blender/blenkernel/intern/particle_distribute.c index ad617b4198b..1fd99bb2cbd 100644 --- a/source/blender/blenkernel/intern/particle_distribute.c +++ b/source/blender/blenkernel/intern/particle_distribute.c @@ -142,7 +142,7 @@ static void distribute_grid(Mesh *mesh, ParticleSystem *psys) size[(axis + 1) % 3] = (int)ceil(delta[(axis + 1) % 3] / d); size[(axis + 2) % 3] = (int)ceil(delta[(axis + 2) % 3] / d); - /* float errors grrr.. */ + /* float errors grrr. */ size[(axis + 1) % 3] = MIN2(size[(axis + 1) % 3], res); size[(axis + 2) % 3] = MIN2(size[(axis + 2) % 3], res); @@ -481,7 +481,7 @@ static void distribute_from_verts_exec(ParticleTask *thread, ParticleData *pa, i mface = ctx->mesh->mface; - int rng_skip_tot = PSYS_RND_DIST_SKIP; /* count how many rng_* calls wont need skipping */ + int rng_skip_tot = PSYS_RND_DIST_SKIP; /* count how many rng_* calls won't need skipping */ /* TODO_PARTICLE - use original index */ pa->num = ctx->index[p]; @@ -538,7 +538,7 @@ static void distribute_from_faces_exec(ParticleTask *thread, ParticleData *pa, i float randu, randv; int distr = ctx->distr; int i; - int rng_skip_tot = PSYS_RND_DIST_SKIP; /* count how many rng_* calls wont need skipping */ + int rng_skip_tot = PSYS_RND_DIST_SKIP; /* count how many rng_* calls won't need skipping */ MFace *mface; @@ -587,7 +587,7 @@ static void distribute_from_volume_exec(ParticleTask *thread, ParticleData *pa, float cur_d, min_d, randu, randv; int distr = ctx->distr; int i, intersect, tot; - int rng_skip_tot = PSYS_RND_DIST_SKIP; /* count how many rng_* calls wont need skipping */ + int rng_skip_tot = PSYS_RND_DIST_SKIP; /* count how many rng_* calls won't need skipping */ MFace *mface; MVert *mvert = mesh->mvert; @@ -692,7 +692,7 @@ static void distribute_children_exec(ParticleTask *thread, ChildParticle *cpa, i float randu, randv; int cfrom = ctx->cfrom; int i; - int rng_skip_tot = PSYS_RND_DIST_SKIP; /* count how many rng_* calls wont need skipping */ + int rng_skip_tot = PSYS_RND_DIST_SKIP; /* count how many rng_* calls won't need skipping */ MFace *mf; diff --git a/source/blender/blenkernel/intern/particle_system.c b/source/blender/blenkernel/intern/particle_system.c index 149e345e501..c35f703b072 100644 --- a/source/blender/blenkernel/intern/particle_system.c +++ b/source/blender/blenkernel/intern/particle_system.c @@ -250,7 +250,7 @@ static void realloc_particles(ParticleSimulationData *sim, int new_totpart) if (psys->particles) { totsaved = MIN2(psys->totpart, totpart); - /*save old pars*/ + /* Save old pars. */ if (totsaved) { memcpy(newpars, psys->particles, totsaved * sizeof(ParticleData)); @@ -607,8 +607,8 @@ void init_particle(ParticleSimulationData *sim, ParticleData *pa) pa->time = part->sta + (part->end - part->sta) * birth_time; pa->hair_index = 0; - /* we can't reset to -1 anymore since we've figured out correct index in distribute_particles */ - /* usage other than straight after distribute has to handle this index by itself - jahka*/ + /* We can't reset to -1 anymore since we've figured out correct index in #distribute_particles + * usage other than straight after distribute has to handle this index by itself - jahka. */ // pa->num_dmcache = DMCACHE_NOTFOUND; /* assume we don't have a derived mesh face */ } @@ -840,7 +840,7 @@ void psys_get_birth_coords( copy_v3_v3(state->co, loc); - /* boids don't get any initial velocity */ + /* boids don't get any initial velocity. */ zero_v3(state->vel); /* boids store direction in ave */ @@ -1007,7 +1007,7 @@ void psys_get_birth_coords( mul_qt_v3(q_imat, rot_vec_local); /* vtan_local */ - copy_v3_v3(vtan_local, vtan); /* flips, cant use */ + copy_v3_v3(vtan_local, vtan); /* flips, can't use */ mul_qt_v3(q_imat, vtan_local); /* ensure orthogonal matrix (rot_vec aligned) */ @@ -1320,6 +1320,14 @@ void psys_get_pointcache_start_end(Scene *scene, ParticleSystem *psys, int *sfra *efra = min_ii((int)(part->end + part->lifetime + 1.0f), max_ii(scene->r.pefra, scene->r.efra)); } +/* BVH tree balancing inside a mutex lock must be run in isolation. Balancing + * is multithreaded, and we do not want the current thread to start another task + * that may involve acquiring the same mutex lock that it is waiting for. */ +static void bvhtree_balance_isolated(void *userdata) +{ + BLI_bvhtree_balance((BVHTree *)userdata); +} + /************************************************/ /* Effectors */ /************************************************/ @@ -1356,7 +1364,8 @@ static void psys_update_particle_bvhtree(ParticleSystem *psys, float cfra) } } } - BLI_bvhtree_balance(psys->bvhtree); + + BLI_task_isolate(bvhtree_balance_isolated, psys->bvhtree); psys->bvhtree_frame = cfra; @@ -1464,7 +1473,7 @@ static void integrate_particle( force_func(forcedata, states + i, force, impulse); - /* force to acceleration*/ + /* Force to acceleration. */ mul_v3_v3fl(acceleration, force, 1.0f / pa_mass); if (external_acceleration) { @@ -1911,7 +1920,7 @@ static void sph_force_cb(void *sphdata_v, ParticleKey *state, float *force, floa } } - /* Artificial buoyancy force in negative gravity direction */ + /* Artificial buoyancy force in negative gravity direction. */ if (fluid->buoyancy > 0.0f && gravity) { madd_v3_v3fl(force, gravity, fluid->buoyancy * (density - rest_density)); } @@ -2086,7 +2095,7 @@ static void sphclassical_force_cb(void *sphdata_v, } } - /* Artificial buoyancy force in negative gravity direction */ + /* Artificial buoyancy force in negative gravity direction. */ if (fluid->buoyancy > 0.0f && gravity) { madd_v3_v3fl(force, gravity, fluid->buoyancy * (pa->sphdensity - rest_density)); } @@ -2217,7 +2226,7 @@ static void sph_integrate(ParticleSimulationData *sim, sphdata->pass = 0; // sphdata.element_size and sphdata.flow are set in the callback. - /* restore previous state and treat gravity & effectors as external acceleration*/ + /* Restore previous state and treat gravity & effectors as external acceleration. */ sub_v3_v3v3(effector_acceleration, pa->state.vel, pa->prev_state.vel); mul_v3_fl(effector_acceleration, 1.0f / dtime); @@ -2992,7 +3001,7 @@ static int collision_response(ParticleSimulationData *sim, /* get back to global coordinates */ add_v3_v3(v1_tan, vc_tan); - /* convert to angular velocity*/ + /* Convert to angular velocity. */ cross_v3_v3v3(ave, vr_tan, pce->nor); mul_v3_fl(ave, 1.0f / MAX2(pa->size, 0.001f)); @@ -3360,7 +3369,7 @@ static void hair_create_input_mesh(ParticleSimulationData *sim, /* XXX placeholder for more flexible future hair settings */ hair_radius = part->size; - /* make vgroup for pin roots etc.. */ + /* Make vgroup for pin roots etc. */ hair_index = 1; LOOP_PARTICLES { @@ -3918,7 +3927,7 @@ static void dynamics_step(ParticleSimulationData *sim, float cfra) pa->alive = PARS_DYING; } else if (birthtime <= cfra && birthtime >= psys->cfra) { - /* particle is born some time between this and last step*/ + /* Particle is born some time between this and last step. */ reset_particle(sim, pa, dfra * timestep, cfra); pa->alive = PARS_ALIVE; pa->state.time = cfra - birthtime; @@ -3927,7 +3936,7 @@ static void dynamics_step(ParticleSimulationData *sim, float cfra) /* nothing to be done when particle is dead */ } - /* only reset unborn particles if they're shown or if the particle is born soon*/ + /* Only reset unborn particles if they're shown or if the particle is born soon. */ if (pa->alive == PARS_UNBORN && (part->flag & PART_UNBORN || (cfra + psys->pointcache->step > pa->time))) { reset_particle(sim, pa, dtime, cfra); @@ -4095,7 +4104,7 @@ static void update_children(ParticleSimulationData *sim, const bool use_render_p psys_free_children(sim->psys); } } -/* updates cached particles' alive & other flags etc..*/ +/* Updates cached particles' alive & other flags etc. */ static void cached_step(ParticleSimulationData *sim, float cfra, const bool use_render_params) { ParticleSystem *psys = sim->psys; diff --git a/source/blender/blenkernel/intern/pbvh.c b/source/blender/blenkernel/intern/pbvh.c index ff1173f3c3c..55049129b23 100644 --- a/source/blender/blenkernel/intern/pbvh.c +++ b/source/blender/blenkernel/intern/pbvh.c @@ -2204,7 +2204,7 @@ bool ray_face_intersection_tri(const float ray_start[3], return false; } -/* Take advantage of the fact we know this wont be an intersection. +/* Take advantage of the fact we know this won't be an intersection. * Just handle ray-tri edges. */ static float dist_squared_ray_to_tri_v3_fast(const float ray_origin[3], const float ray_direction[3], diff --git a/source/blender/blenkernel/intern/pbvh_bmesh.c b/source/blender/blenkernel/intern/pbvh_bmesh.c index 54acd45d9af..a3330a409f9 100644 --- a/source/blender/blenkernel/intern/pbvh_bmesh.c +++ b/source/blender/blenkernel/intern/pbvh_bmesh.c @@ -295,7 +295,7 @@ static BMVert *bm_vert_hash_lookup_chain(GHash *deleted_verts, BMVert *v) while (true) { BMVert **v_next_p = (BMVert **)BLI_ghash_lookup_p(deleted_verts, v); if (v_next_p == NULL) { - /* not remapped*/ + /* Not remapped. */ return v; } if (*v_next_p == NULL) { @@ -4818,7 +4818,7 @@ static void pbvh_bmesh_verify(PBVH *pbvh) vert_count++; } - /* if totvert differs from number of verts inside the hash. hash-totvert is checked above */ + /* If totvert differs from number of verts inside the hash. hash-totvert is checked above. */ BLI_assert(vert_count == pbvh->bm->totvert); # endif diff --git a/source/blender/blenkernel/intern/pointcache.c b/source/blender/blenkernel/intern/pointcache.c index be206f8a642..a05eb6962ce 100644 --- a/source/blender/blenkernel/intern/pointcache.c +++ b/source/blender/blenkernel/intern/pointcache.c @@ -2632,7 +2632,7 @@ void BKE_ptcache_id_clear(PTCacheID *pid, int mode, unsigned int cfra) } #endif - /*if (!G.relbase_valid) return; */ /* save blend file before using pointcache */ + // if (!G.relbase_valid) return; /* Save blend file before using pointcache. */ /* clear all files in the temp dir with the prefix of the ID and the ".bphys" suffix */ switch (mode) { @@ -2659,8 +2659,8 @@ void BKE_ptcache_id_clear(PTCacheID *pid, int mode, unsigned int cfra) ptcache_filename_ext_append(pid, ext, 0, false, 0); while ((de = readdir(dir)) != NULL) { - if (strstr(de->d_name, ext)) { /* do we have the right extension?*/ - if (STREQLEN(filename, de->d_name, len)) { /* do we have the right prefix */ + if (strstr(de->d_name, ext)) { /* Do we have the right extension? */ + if (STREQLEN(filename, de->d_name, len)) { /* Do we have the right prefix. */ if (mode == PTCACHE_CLEAR_ALL) { pid->cache->last_exact = MIN2(pid->cache->startframe, 0); BLI_join_dirfile(path_full, sizeof(path_full), path, de->d_name); @@ -2695,7 +2695,7 @@ void BKE_ptcache_id_clear(PTCacheID *pid, int mode, unsigned int cfra) PTCacheMem *link = NULL; if (mode == PTCACHE_CLEAR_ALL) { - /*we want startframe if the cache starts before zero*/ + /* We want startframe if the cache starts before zero. */ pid->cache->last_exact = MIN2(pid->cache->startframe, 0); for (; pm; pm = pm->next) { ptcache_mem_clear(pm); @@ -2856,8 +2856,8 @@ void BKE_ptcache_id_time( ptcache_filename_ext_append(pid, ext, 0, false, 0); while ((de = readdir(dir)) != NULL) { - if (strstr(de->d_name, ext)) { /* do we have the right extension?*/ - if (STREQLEN(filename, de->d_name, len)) { /* do we have the right prefix */ + if (strstr(de->d_name, ext)) { /* Do we have the right extension? */ + if (STREQLEN(filename, de->d_name, len)) { /* Do we have the right prefix. */ /* read the number of the file */ const int frame = ptcache_frame_from_filename(de->d_name, ext); @@ -3038,7 +3038,7 @@ void BKE_ptcache_remove(void) if (FILENAME_IS_CURRPAR(de->d_name)) { /* do nothing */ } - else if (strstr(de->d_name, PTCACHE_EXT)) { /* do we have the right extension?*/ + else if (strstr(de->d_name, PTCACHE_EXT)) { /* Do we have the right extension? */ BLI_join_dirfile(path_full, sizeof(path_full), path, de->d_name); BLI_delete(path_full, false, false); } @@ -3050,7 +3050,7 @@ void BKE_ptcache_remove(void) closedir(dir); } else { - rmdir = 0; /* path doesn't exist */ + rmdir = 0; /* Path doesn't exist. */ } if (rmdir) { @@ -3569,8 +3569,8 @@ void BKE_ptcache_disk_cache_rename(PTCacheID *pid, const char *name_src, const c BLI_strncpy(pid->cache->name, name_dst, sizeof(pid->cache->name)); while ((de = readdir(dir)) != NULL) { - if (strstr(de->d_name, ext)) { /* do we have the right extension?*/ - if (STREQLEN(old_filename, de->d_name, len)) { /* do we have the right prefix */ + if (strstr(de->d_name, ext)) { /* Do we have the right extension? */ + if (STREQLEN(old_filename, de->d_name, len)) { /* Do we have the right prefix. */ /* read the number of the file */ const int frame = ptcache_frame_from_filename(de->d_name, ext); @@ -3589,7 +3589,7 @@ void BKE_ptcache_disk_cache_rename(PTCacheID *pid, const char *name_src, const c void BKE_ptcache_load_external(PTCacheID *pid) { - /*todo*/ + /* TODO: */ PointCache *cache = pid->cache; int len; /* store the length of the string */ int info = 0; @@ -3626,8 +3626,8 @@ void BKE_ptcache_load_external(PTCacheID *pid) } while ((de = readdir(dir)) != NULL) { - if (strstr(de->d_name, ext)) { /* do we have the right extension?*/ - if (STREQLEN(filename, de->d_name, len)) { /* do we have the right prefix */ + if (strstr(de->d_name, ext)) { /* Do we have the right extension? */ + if (STREQLEN(filename, de->d_name, len)) { /* Do we have the right prefix. */ /* read the number of the file */ const int frame = ptcache_frame_from_filename(de->d_name, ext); diff --git a/source/blender/blenkernel/intern/report.c b/source/blender/blenkernel/intern/report.c index 43ab1a71647..c877ec6b6b0 100644 --- a/source/blender/blenkernel/intern/report.c +++ b/source/blender/blenkernel/intern/report.c @@ -107,7 +107,7 @@ void BKE_report(ReportList *reports, ReportType type, const char *_message) int len; const char *message = TIP_(_message); - /* in background mode always print otherwise there are cases the errors wont be displayed, + /* in background mode always print otherwise there are cases the errors won't be displayed, * but still add to the report list since this is used for python exception handling */ if (G.background || !reports || ((reports->flag & RPT_PRINT) && (type >= reports->printlevel))) { printf("%s: %s\n", BKE_report_type_str(type), message); diff --git a/source/blender/blenkernel/intern/rigidbody.c b/source/blender/blenkernel/intern/rigidbody.c index 21b86aa8148..2d4cce4b953 100644 --- a/source/blender/blenkernel/intern/rigidbody.c +++ b/source/blender/blenkernel/intern/rigidbody.c @@ -668,7 +668,7 @@ void BKE_rigidbody_calc_volume(Object *ob, float *r_vol) radius = max_fff(size[0], size[1], size[2]) * 0.5f; } - /* calculate volume as appropriate */ + /* Calculate volume as appropriate. */ switch (rbo->shape) { case RB_SHAPE_BOX: volume = size[0] * size[1] * size[2]; @@ -744,10 +744,10 @@ void BKE_rigidbody_calc_center_of_mass(Object *ob, float r_center[3]) * (i.e. Object pivot is centralized in boundbox) * - boundbox gives full width */ - /* XXX: all dimensions are auto-determined now... later can add stored settings for this */ + /* XXX: all dimensions are auto-determined now... later can add stored settings for this. */ BKE_object_dimensions_get(ob, size); - /* calculate volume as appropriate */ + /* Calculate volume as appropriate. */ switch (rbo->shape) { case RB_SHAPE_BOX: case RB_SHAPE_SPHERE: diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c index 41ef7eaf179..7ab126868ae 100644 --- a/source/blender/blenkernel/intern/scene.c +++ b/source/blender/blenkernel/intern/scene.c @@ -1466,8 +1466,8 @@ static void scene_blend_read_lib(BlendLibReader *reader, ID *id) IDP_BlendReadLib(reader, seq->prop); if (seq->ipo) { - BLO_read_id_address( - reader, sce->id.lib, &seq->ipo); /* XXX deprecated - old animation system */ + /* XXX: deprecated - old animation system. */ + BLO_read_id_address(reader, sce->id.lib, &seq->ipo); } seq->scene_sound = NULL; if (seq->scene) { @@ -2013,7 +2013,7 @@ Scene *BKE_scene_duplicate(Main *bmain, Scene *sce, eSceneCopyMethod type) bmain, NULL, sce_copy->master_collection, duplicate_flags, LIB_ID_DUPLICATE_IS_SUBPROCESS); if (!is_subprocess) { - /* This code will follow into all ID links using an ID tagged with LIB_TAG_NEW.*/ + /* This code will follow into all ID links using an ID tagged with LIB_TAG_NEW. */ BKE_libblock_relink_to_newid(&sce_copy->id); #ifndef NDEBUG @@ -3380,7 +3380,7 @@ static bool depsgraph_key_compare(const void *key_a_v, const void *key_b_v) { const DepsgraphKey *key_a = key_a_v; const DepsgraphKey *key_b = key_b_v; - /* TODO(sergey): Compare rest of */ + /* TODO(sergey): Compare rest of. */ return !(key_a->view_layer == key_b->view_layer); } diff --git a/source/blender/blenkernel/intern/screen.c b/source/blender/blenkernel/intern/screen.c index 269aeaebe82..608317933f5 100644 --- a/source/blender/blenkernel/intern/screen.c +++ b/source/blender/blenkernel/intern/screen.c @@ -1467,7 +1467,6 @@ static void direct_link_region(BlendDataReader *reader, ARegion *region, int spa BLO_read_data_address(reader, &rv3d->localvd); BLO_read_data_address(reader, &rv3d->clipbb); - rv3d->depths = NULL; rv3d->render_engine = NULL; rv3d->sms = NULL; rv3d->smooth_timer = NULL; @@ -1704,9 +1703,9 @@ static void direct_link_area(BlendDataReader *reader, ScrArea *area) BLO_read_list(reader, &sconsole->scrollback); BLO_read_list(reader, &sconsole->history); - /* comma expressions, (e.g. expr1, expr2, expr3) evaluate each expression, + /* Comma expressions, (e.g. expr1, expr2, expr3) evaluate each expression, * from left to right. the right-most expression sets the result of the comma - * expression as a whole*/ + * expression as a whole. */ LISTBASE_FOREACH_MUTABLE (ConsoleLine *, cl, &sconsole->history) { BLO_read_data_address(reader, &cl->line); if (cl->line) { diff --git a/source/blender/blenkernel/intern/shrinkwrap.c b/source/blender/blenkernel/intern/shrinkwrap.c index ae39b200b56..aeb8133974e 100644 --- a/source/blender/blenkernel/intern/shrinkwrap.c +++ b/source/blender/blenkernel/intern/shrinkwrap.c @@ -546,7 +546,7 @@ static void shrinkwrap_calc_normal_projection_cb_ex(void *__restrict userdata, } if (calc->vert != NULL && calc->smd->projAxis == MOD_SHRINKWRAP_PROJECT_OVER_NORMAL) { - /* calc->vert contains verts from evaluated mesh. */ + /* calc->vert contains verts from evaluated mesh. */ /* These coordinates are deformed by vertexCos only for normal projection * (to get correct normals) for other cases calc->verts contains undeformed coordinates and * vertexCos should be used */ diff --git a/source/blender/blenkernel/intern/softbody.c b/source/blender/blenkernel/intern/softbody.c index fcc1afbc59b..123843c88db 100644 --- a/source/blender/blenkernel/intern/softbody.c +++ b/source/blender/blenkernel/intern/softbody.c @@ -109,11 +109,11 @@ typedef struct ReferenceVert { } ReferenceVert; typedef struct ReferenceState { - float com[3]; /* center of mass*/ - ReferenceVert *ivert; /* list of initial values */ + float com[3]; /* Center of mass. */ + ReferenceVert *ivert; /* List of initial values. */ } ReferenceState; -/*private scratch pad for caching and other data only needed when alive*/ +/* Private scratch pad for caching and other data only needed when alive. */ typedef struct SBScratch { GHash *colliderhash; short needstobuildcollider; @@ -150,11 +150,11 @@ typedef struct SB_thread_context { #define BSF_INTERSECT 1 /* edge intersects collider face */ /* private definitions for bodypoint states */ -#define SBF_DOFUZZY 1 /* Bodypoint do fuzzy */ -#define SBF_OUTOFCOLLISION 2 /* Bodypoint does not collide */ +#define SBF_DOFUZZY 1 /* Bodypoint do fuzzy. */ +#define SBF_OUTOFCOLLISION 2 /* Bodypoint does not collide. */ -#define BFF_INTERSECT 1 /* collider edge intrudes face */ -#define BFF_CLOSEVERT 2 /* collider vertex repulses face */ +#define BFF_INTERSECT 1 /* collider edge intrudes face. */ +#define BFF_CLOSEVERT 2 /* collider vertex repulses face. */ /* humm .. this should be calculated from sb parameters and sizes. */ static float SoftHeunTol = 1.0f; @@ -162,9 +162,9 @@ static float SoftHeunTol = 1.0f; /* local prototypes */ static void free_softbody_intern(SoftBody *sb); -/*+++ frame based timing +++*/ +/*+++ frame based timing +++ */ -/*physical unit of force is [kg * m / sec^2]*/ +/* Physical unit of force is `kg * m / sec^2`. */ /** * Since unit of g is [m/sec^2] and F = mass * g we re-scale unit mass of node to 1 gram @@ -207,7 +207,7 @@ static float sb_time_scale(Object *ob) } /*--- frame based timing ---*/ -/* helper functions for everything is animatable jow_go_for2_5 +++++++*/ +/* helper functions for everything is animatable jow_go_for2_5 +++++++ */ /* introducing them here, because i know: steps in properties ( at frame timing ) * will cause unwanted responses of the softbody system (which does inter frame calculations ) * so first 'cure' would be: interpolate linear in time .. @@ -217,7 +217,7 @@ static float sb_time_scale(Object *ob) */ /* animate sb->maxgoal, sb->mingoal */ -static float _final_goal(Object *ob, BodyPoint *bp) /*jow_go_for2_5 */ +static float _final_goal(Object *ob, BodyPoint *bp) /* jow_go_for2_5 */ { float f = -1999.99f; if (ob) { @@ -235,7 +235,7 @@ static float _final_goal(Object *ob, BodyPoint *bp) /*jow_go_for2_5 */ } } CLOG_ERROR(&LOG, "sb or bp == NULL"); - return f; /*using crude but spot able values some times helps debuggin */ + return f; /* Using crude but spot able values some times helps debugging. */ } static float _final_mass(Object *ob, BodyPoint *bp) @@ -251,7 +251,7 @@ static float _final_mass(Object *ob, BodyPoint *bp) } /* helper functions for everything is animateble jow_go_for2_5 ------*/ -/*+++ collider caching and dicing +++*/ +/* +++ collider caching and dicing +++ */ /* * for each target object/face the axis aligned bounding box (AABB) is stored @@ -311,7 +311,7 @@ static ccd_Mesh *ccd_mesh_make(Object *ob) /* blow it up with forcefield ranges */ hull = max_ff(ob->pd->pdef_sbift, ob->pd->pdef_sboft); - /* alloc and copy verts*/ + /* Allocate and copy verts. */ pccd_M->mvert = MEM_dupallocN(cmd->xnew); /* note that xnew coords are already in global space, */ /* determine the ortho BB */ @@ -328,7 +328,7 @@ static ccd_Mesh *ccd_mesh_make(Object *ob) pccd_M->bbmax[1] = max_ff(pccd_M->bbmax[1], v[1] + hull); pccd_M->bbmax[2] = max_ff(pccd_M->bbmax[2], v[2] + hull); } - /* alloc and copy faces*/ + /* Allocate and copy faces. */ pccd_M->tri = MEM_dupallocN(cmd->tri); /* OBBs for idea1 */ @@ -401,7 +401,7 @@ static void ccd_mesh_update(Object *ob, ccd_Mesh *pccd_M) MEM_freeN((void *)pccd_M->mprevvert); } pccd_M->mprevvert = pccd_M->mvert; - /* alloc and copy verts*/ + /* Allocate and copy verts. */ pccd_M->mvert = MEM_dupallocN(cmd->xnew); /* note that xnew coords are already in global space, */ /* determine the ortho BB */ @@ -598,7 +598,7 @@ static int count_mesh_quads(Mesh *me) static void add_mesh_quad_diag_springs(Object *ob) { Mesh *me = ob->data; - /*BodyPoint *bp;*/ /*UNUSED*/ + // BodyPoint *bp; /* UNUSED */ int a; if (ob->soft) { @@ -618,7 +618,7 @@ static void add_mesh_quad_diag_springs(Object *ob) /* fill the tail */ a = 0; bs = &ob->soft->bspring[ob->soft->totspring]; - /*bp= ob->soft->bpoint; */ /*UNUSED*/ + // bp = ob->soft->bpoint; /* UNUSED */ for (a = me->totpoly; a > 0; a--, mp++) { if (mp->totloop == 4) { bs->v1 = mloop[mp->loopstart + 0].v; @@ -640,7 +640,7 @@ static void add_mesh_quad_diag_springs(Object *ob) static void add_2nd_order_roller(Object *ob, float UNUSED(stiffness), int *counter, int addsprings) { - /*assume we have a softbody*/ + /* Assume we have a softbody. */ SoftBody *sb = ob->soft; /* is supposed to be there */ BodyPoint *bp, *bpo; BodySpring *bs, *bs2, *bs3 = NULL; @@ -654,7 +654,7 @@ static void add_2nd_order_roller(Object *ob, float UNUSED(stiffness), int *count bs3 = ob->soft->bspring + ob->soft->totspring; } for (a = sb->totpoint, bp = sb->bpoint; a > 0; a--, bp++) { - /*scan for neighborhood*/ + /* Scan for neighborhood. */ bpo = NULL; v0 = (sb->totpoint - a); for (b = bp->nofsprings; b > 0; b--) { @@ -678,7 +678,7 @@ static void add_2nd_order_roller(Object *ob, float UNUSED(stiffness), int *count for (c = bpo->nofsprings; c > 0; c--) { bs2 = sb->bspring + bpo->springs[c - 1]; if ((bs2->v1 != notthis) && (bs2->v1 > v0)) { - (*counter)++; /*hit */ + (*counter)++; /* hit */ if (addsprings) { bs3->v1 = v0; bs3->v2 = bs2->v1; @@ -698,7 +698,7 @@ static void add_2nd_order_roller(Object *ob, float UNUSED(stiffness), int *count } } } - /*scan for neighborhood done*/ + /* Scan for neighborhood done. */ } } @@ -772,8 +772,8 @@ static void build_bps_springlist(Object *ob) if (((sb->totpoint - a) == bs->v2)) { add_bp_springlist(bp, sb->totspring - b); } - } /*for springs*/ - } /*for bp*/ + } /* For springs. */ + } /* For bp. */ } static void calculate_collision_balls(Object *ob) @@ -825,7 +825,7 @@ static void calculate_collision_balls(Object *ob) else { bp->colball = 0; } - } /*for bp*/ + } /* For bp. */ } /* creates new softbody if didn't exist yet, makes new points and springs arrays */ @@ -905,7 +905,7 @@ static void free_scratch(SoftBody *sb) if (sb->scratch->colliderhash) { BLI_ghash_free(sb->scratch->colliderhash, NULL, - (GHashValFreeFP)ccd_mesh_free); /*this hoepfully will free all caches*/ + (GHashValFreeFP)ccd_mesh_free); /* This hopefully will free all caches. */ sb->scratch->colliderhash = NULL; } if (sb->scratch->bodyface) { @@ -976,7 +976,7 @@ static void free_softbody_intern(SoftBody *sb) * since that would only valid for 'slow' moving collision targets and dito particles */ -/* +++ dependency information functions*/ +/* +++ dependency information functions. */ /** * \note collection overrides scene when not NULL. @@ -990,9 +990,9 @@ static int query_external_colliders(Depsgraph *depsgraph, Collection *collection return (numobjects != 0); } -/* --- dependency information functions*/ +/* --- dependency information functions. */ -/* +++ the aabb "force" section*/ +/* +++ the aabb "force" section. */ static int sb_detect_aabb_collisionCached(float UNUSED(force[3]), struct Object *vertexowner, float UNUSED(time)) @@ -1036,7 +1036,7 @@ static int sb_detect_aabb_collisionCached(float UNUSED(force[3]), deflected = 2; } else { - /*aye that should be cached*/ + /* Aye that should be cached. */ CLOG_ERROR(&LOG, "missing cache error"); BLI_ghashIterator_step(ihash); continue; @@ -1048,9 +1048,9 @@ static int sb_detect_aabb_collisionCached(float UNUSED(force[3]), BLI_ghashIterator_free(ihash); return deflected; } -/* --- the aabb section*/ +/* --- the aabb section. */ -/* +++ the face external section*/ +/* +++ the face external section. */ static int sb_detect_face_pointCached(const float face_v1[3], const float face_v2[3], const float face_v3[3], @@ -1104,13 +1104,13 @@ static int sb_detect_face_pointCached(const float face_v1[3], } } else { - /*aye that should be cached*/ + /* Aye that should be cached. */ CLOG_ERROR(&LOG, "missing cache error"); BLI_ghashIterator_step(ihash); continue; } - /* use mesh*/ + /* Use mesh. */ if (mvert) { while (a) { copy_v3_v3(nv1, mvert[a - 1].co); @@ -1118,7 +1118,7 @@ static int sb_detect_face_pointCached(const float face_v1[3], mul_v3_fl(nv1, time); madd_v3_v3fl(nv1, mprevvert[a - 1].co, 1.0f - time); } - /* origin to face_v2*/ + /* Origin to face_v2. */ sub_v3_v3(nv1, face_v2); facedist = dot_v3v3(nv1, d_nvect); if (fabsf(facedist) < outerfacethickness) { @@ -1139,7 +1139,7 @@ static int sb_detect_face_pointCached(const float face_v1[3], } } a--; - } /* while (a)*/ + } /* while (a) */ } /* if (mvert) */ } /* if (ob->pd && ob->pd->deflect) */ BLI_ghashIterator_step(ihash); @@ -1201,13 +1201,13 @@ static int sb_detect_face_collisionCached(const float face_v1[3], } } else { - /*aye that should be cached*/ + /* Aye that should be cached. */ CLOG_ERROR(&LOG, "missing cache error"); BLI_ghashIterator_step(ihash); continue; } - /* use mesh*/ + /* Use mesh. */ while (a--) { if ((aabbmax[0] < mima->minx) || (aabbmin[0] > mima->maxx) || (aabbmax[1] < mima->miny) || (aabbmin[1] > mima->maxy) || @@ -1235,7 +1235,7 @@ static int sb_detect_face_collisionCached(const float face_v1[3], } } - /* switch origin to be nv2*/ + /* Switch origin to be nv2. */ sub_v3_v3v3(edge1, nv1, nv2); sub_v3_v3v3(edge2, nv3, nv2); cross_v3_v3v3(d_nvect, edge2, edge1); @@ -1272,7 +1272,7 @@ static void scan_for_ext_face_forces(Object *ob, float timenow) bf = sb->scratch->bodyface; for (a = 0; a < sb->scratch->totface; a++, bf++) { bf->ext_force[0] = bf->ext_force[1] = bf->ext_force[2] = 0.0f; - /*+++edges intruding*/ + /*+++edges intruding. */ bf->flag &= ~BFF_INTERSECT; zero_v3(feedback); if (sb_detect_face_collisionCached(sb->bpoint[bf->v1].pos, @@ -1289,9 +1289,9 @@ static void scan_for_ext_face_forces(Object *ob, float timenow) bf->flag |= BFF_INTERSECT; choke = min_ff(max_ff(damp, choke), 1.0f); } - /*---edges intruding*/ + /*---edges intruding. */ - /*+++ close vertices*/ + /*+++ close vertices. */ if ((bf->flag & BFF_INTERSECT) == 0) { bf->flag &= ~BFF_CLOSEVERT; tune = -1.0f; @@ -1311,7 +1311,7 @@ static void scan_for_ext_face_forces(Object *ob, float timenow) choke = min_ff(max_ff(damp, choke), 1.0f); } } - /*--- close vertices*/ + /*--- close vertices. */ } bf = sb->scratch->bodyface; for (a = 0; a < sb->scratch->totface; a++, bf++) { @@ -1324,9 +1324,9 @@ static void scan_for_ext_face_forces(Object *ob, float timenow) } } -/* --- the face external section*/ +/* --- the face external section. */ -/* +++ the spring external section*/ +/* +++ the spring external section. */ static int sb_detect_edge_collisionCached(const float edge_v1[3], const float edge_v2[3], @@ -1377,13 +1377,13 @@ static int sb_detect_edge_collisionCached(const float edge_v1[3], } } else { - /*aye that should be cached*/ + /* Aye that should be cached. */ CLOG_ERROR(&LOG, "missing cache error"); BLI_ghashIterator_step(ihash); continue; } - /* use mesh*/ + /* Use mesh. */ while (a--) { if ((aabbmax[0] < mima->minx) || (aabbmin[0] > mima->maxx) || (aabbmax[1] < mima->miny) || (aabbmin[1] > mima->maxy) || @@ -1411,7 +1411,7 @@ static int sb_detect_edge_collisionCached(const float edge_v1[3], } } - /* switch origin to be nv2*/ + /* Switch origin to be nv2. */ sub_v3_v3v3(edge1, nv1, nv2); sub_v3_v3v3(edge2, nv3, nv2); @@ -1469,12 +1469,12 @@ static void _scan_for_ext_spring_forces( } /* ---- springs colliding */ - /* +++ springs seeing wind ... n stuff depending on their orientation*/ - /* note we don't use sb->mediafrict but use sb->aeroedge for magnitude of effect*/ + /* +++ springs seeing wind ... n stuff depending on their orientation. */ + /* NOTE: we don't use `sb->mediafrict` but use `sb->aeroedge` for magnitude of effect. */ if (sb->aeroedge) { float vel[3], sp[3], pr[3], force[3]; float f, windfactor = 0.25f; - /*see if we have wind*/ + /* See if we have wind. */ if (effectors) { EffectedPoint epoint; float speed[3] = {0.0f, 0.0f, 0.0f}; @@ -1543,7 +1543,7 @@ static void sb_sfesf_threads_run(struct Depsgraph *depsgraph, /* figure the number of threads while preventing pretty pointless threading overhead */ totthread = BKE_scene_num_threads(scene); - /* what if we got zillions of CPUs running but less to spread*/ + /* What if we got zillions of CPUs running but less to spread. */ while ((totsprings / totthread < lowsprings) && (totthread > 1)) { totthread--; } @@ -1590,7 +1590,7 @@ static void sb_sfesf_threads_run(struct Depsgraph *depsgraph, BKE_effectors_free(effectors); } -/* --- the spring external section*/ +/* --- the spring external section. */ static int choose_winner( float *w, float *pos, float *a, float *b, float *c, float *ca, float *cb, float *cc) @@ -1683,7 +1683,7 @@ static int sb_detect_vertex_collisionCached(float opco[3], } } else { - /*aye that should be cached*/ + /* Aye that should be cached. */ CLOG_ERROR(&LOG, "missing cache error"); BLI_ghashIterator_step(ihash); continue; @@ -1697,7 +1697,7 @@ static int sb_detect_vertex_collisionCached(float opco[3], fa *= fa; fa = 1.0f / fa; avel[0] = avel[1] = avel[2] = 0.0f; - /* use mesh*/ + /* Use mesh. */ while (a--) { if ((opco[0] < mima->minx) || (opco[0] > mima->maxx) || (opco[1] < mima->miny) || (opco[1] > mima->maxy) || (opco[2] < mima->minz) || (opco[2] > mima->maxz)) { @@ -1733,7 +1733,7 @@ static int sb_detect_vertex_collisionCached(float opco[3], } } - /* switch origin to be nv2*/ + /* Switch origin to be nv2. */ sub_v3_v3v3(edge1, nv1, nv2); sub_v3_v3v3(edge2, nv3, nv2); /* Abuse dv1 to have vertex in question at *origin* of triangle. */ @@ -2068,7 +2068,7 @@ static int _softbody_calc_forces_slice_in_a_thread(Scene *scene, bp->force[1] += -ks * (auxvect[1]); bp->force[2] += -ks * (auxvect[2]); - /* calculate damping forces generated by goals*/ + /* Calculate damping forces generated by goals. */ sub_v3_v3v3(velgoal, bp->origS, bp->origE); kd = sb->goalfrict * sb_fric_force_scale(ob); add_v3_v3v3(auxvect, velgoal, bp->vec); @@ -2113,7 +2113,7 @@ static int _softbody_calc_forces_slice_in_a_thread(Scene *scene, pd_point_from_soft(scene, bp->pos, bp->vec, sb->bpoint - bp, &epoint); BKE_effectors_apply(effectors, NULL, sb->effector_weights, &epoint, force, NULL, speed); - /* apply forcefield*/ + /* Apply force-field. */ mul_v3_fl(force, fieldfactor * eval_sb_fric_force_scale); add_v3_v3(bp->force, force); @@ -2125,7 +2125,7 @@ static int _softbody_calc_forces_slice_in_a_thread(Scene *scene, /* now we'll have nice centrifugal effect for vortex */ } else { - /* BP friction in media (not) moving*/ + /* BP friction in media (not) moving. */ float kd = sb->mediafrict * sb_fric_force_scale(ob); /* assume it to be proportional to actual velocity */ bp->force[0] -= bp->vec[0] * kd; @@ -2160,7 +2160,7 @@ static int _softbody_calc_forces_slice_in_a_thread(Scene *scene, /* +++springs */ iks = 1.0f / (1.0f - sb->inspring) - 1.0f; /* inner spring constants function */ if (ob->softflag & OB_SB_EDGES) { - if (sb->bspring) { /* spring list exists at all ? */ + if (sb->bspring) { /* Spring list exists at all? */ int b; BodySpring *bs; for (b = bp->nofsprings; b > 0; b--) { @@ -2173,13 +2173,13 @@ static int _softbody_calc_forces_slice_in_a_thread(Scene *scene, } // sb_spring_force(Object *ob, int bpi, BodySpring *bs, float iks, float forcetime) sb_spring_force(ob, ilast - bb, bs, iks, forcetime); - } /* loop springs */ - } /* existing spring list */ - } /*any edges*/ + } /* loop springs. */ + } /* existing spring list. */ + } /* Any edges. */ /* ---springs */ - } /*omit on snap */ - } /*loop all bp's*/ - return 0; /*done fine*/ + } /* Omit on snap. */ + } /* Loop all bp's. */ + return 0; /* Done fine. */ } static void *exec_softbody_calc_forces(void *data) @@ -2220,7 +2220,7 @@ static void sb_cf_threads_run(Scene *scene, /* figure the number of threads while preventing pretty pointless threading overhead */ totthread = BKE_scene_num_threads(scene); - /* what if we got zillions of CPUs running but less to spread*/ + /* What if we got zillions of CPUs running but less to spread. */ while ((totpoint / totthread < lowpoints) && (totthread > 1)) { totthread--; } @@ -2275,11 +2275,11 @@ static void softbody_calc_forces( * this will ruin adaptive stepsize AKA heun! (BM) */ SoftBody *sb = ob->soft; /* is supposed to be there */ - /*BodyPoint *bproot;*/ /* UNUSED */ - /* float gravity; */ /* UNUSED */ - /* float iks; */ + // BodyPoint *bproot; /* UNUSED */ + // float gravity; /* UNUSED */ + // float iks; float fieldfactor = -1.0f, windfactor = 0.25; - int do_deflector /*, do_selfcollision*/, do_springcollision, do_aero; + int do_deflector /*, do_selfcollision */, do_springcollision, do_aero; /* gravity = sb->grav * sb_grav_force_scale(ob); */ /* UNUSED */ @@ -2292,8 +2292,8 @@ static void softbody_calc_forces( (ob->softflag & OB_SB_EDGECOLL); do_aero = ((sb->aeroedge) && (ob->softflag & OB_SB_EDGES)); - /* iks = 1.0f/(1.0f-sb->inspring)-1.0f; */ /* inner spring constants function */ /* UNUSED */ - /* bproot= sb->bpoint; */ /* need this for proper spring addressing */ /* UNUSED */ + // iks = 1.0f / (1.0f - sb->inspring) - 1.0f; /* Inner spring constants function. */ /* UNUSED */ + // bproot = sb->bpoint; /* Need this for proper spring addressing. */ /* UNUSED */ if (do_springcollision || do_aero) { sb_sfesf_threads_run(depsgraph, scene, ob, timenow, sb->totspring, NULL); @@ -2344,7 +2344,7 @@ static void softbody_apply_forces(Object *ob, float forcetime, int mode, float * aabbmin[0] = aabbmin[1] = aabbmin[2] = 1e20f; aabbmax[0] = aabbmax[1] = aabbmax[2] = -1e20f; - /* old one with homogeneous masses */ + /* old one with homogeneous masses */ /* claim a minimum mass for vertex */ #if 0 if (sb->nodemass > 0.009999f) { @@ -2489,7 +2489,7 @@ static void softbody_apply_forces(Object *ob, float forcetime, int mode, float * /* used by heun when it overshoots */ static void softbody_restore_prev_step(Object *ob) { - SoftBody *sb = ob->soft; /* is supposed to be there*/ + SoftBody *sb = ob->soft; /* is supposed to be there. */ BodyPoint *bp; int a; @@ -2502,7 +2502,7 @@ static void softbody_restore_prev_step(Object *ob) #if 0 static void softbody_store_step(Object *ob) { - SoftBody *sb = ob->soft; /* is supposed to be there*/ + SoftBody *sb = ob->soft; /* is supposed to be there. */ BodyPoint *bp; int a; @@ -2515,7 +2515,7 @@ static void softbody_store_step(Object *ob) /* used by predictors and correctors */ static void softbody_store_state(Object *ob, float *ppos, float *pvel) { - SoftBody *sb = ob->soft; /* is supposed to be there*/ + SoftBody *sb = ob->soft; /* is supposed to be there. */ BodyPoint *bp; int a; float *pp = ppos, *pv = pvel; @@ -2533,7 +2533,7 @@ static void softbody_store_state(Object *ob, float *ppos, float *pvel) /* used by predictors and correctors */ static void softbody_retrieve_state(Object *ob, float *ppos, float *pvel) { - SoftBody *sb = ob->soft; /* is supposed to be there*/ + SoftBody *sb = ob->soft; /* is supposed to be there. */ BodyPoint *bp; int a; float *pp = ppos, *pv = pvel; @@ -2551,7 +2551,7 @@ static void softbody_retrieve_state(Object *ob, float *ppos, float *pvel) /* used by predictors and correctors */ static void softbody_swap_state(Object *ob, float *ppos, float *pvel) { - SoftBody *sb = ob->soft; /* is supposed to be there*/ + SoftBody *sb = ob->soft; /* is supposed to be there. */ BodyPoint *bp; int a; float *pp = ppos, *pv = pvel; @@ -2773,7 +2773,7 @@ static void mesh_faces_to_scratch(Object *ob) MLoopTri *looptri, *lt; BodyFace *bodyface; int a; - /* alloc and copy faces*/ + /* Allocate and copy faces. */ sb->scratch->totface = poly_to_tri_count(me->totpoly, me->totloop); looptri = lt = MEM_mallocN(sizeof(*looptri) * sb->scratch->totface, __func__); @@ -3000,8 +3000,8 @@ static void curve_surf_to_softbody(Object *ob) bp = sb->bpoint; bs = sb->bspring; - /* weights from bpoints, same code used as for mesh vertices */ - /* if ((ob->softflag & OB_SB_GOAL) && sb->vertgroup) 2.4x hack*/ + /* Weights from bpoints, same code used as for mesh vertices. */ + /* if ((ob->softflag & OB_SB_GOAL) && sb->vertgroup) 2.4x hack. */ /* new! take the weights from curve vertex anyhow */ if (ob->softflag & OB_SB_GOAL) { setgoal = 1; @@ -3022,10 +3022,10 @@ static void curve_surf_to_softbody(Object *ob) if (setgoal) { bp->goal *= bezt->weight; - /* all three triples */ + /* All three triples. */ (bp + 1)->goal = bp->goal; (bp + 2)->goal = bp->goal; - /*do not collide handles */ + /* Do not collide handles. */ (bp + 1)->loc_flag |= SBF_OUTOFCOLLISION; (bp + 2)->loc_flag |= SBF_OUTOFCOLLISION; } @@ -3137,7 +3137,7 @@ SoftBody *sbNew(void) sb->inspring = 0.5f; sb->infrict = 0.5f; - /*todo backward file compat should copy inspring to inpush while reading old files*/ + /* TODO: backward file compat should copy `inspring` to `inpush` while reading old files. */ sb->inpush = 0.5f; sb->colball = 0.49f; @@ -3150,7 +3150,7 @@ SoftBody *sbNew(void) sb->choke = 3; sb_new_scratch(sb); - /*todo backward file compat should set sb->shearstiff = 1.0f while reading old files*/ + /* TODO: backward file compat should set `sb->shearstiff = 1.0f` while reading old files. */ sb->shearstiff = 1.0f; sb->solverflags |= SBSO_OLDERR; @@ -3311,7 +3311,7 @@ static void softbody_reset(Object *ob, SoftBody *sb, float (*vertexCos)[3], int for (a = 0, bp = sb->bpoint; a < numVerts; a++, bp++) { copy_v3_v3(bp->pos, vertexCos[a]); - mul_m4_v3(ob->obmat, bp->pos); /* yep, sofbody is global coords*/ + mul_m4_v3(ob->obmat, bp->pos); /* Yep, soft-body is global coords. */ copy_v3_v3(bp->origS, bp->pos); copy_v3_v3(bp->origE, bp->pos); copy_v3_v3(bp->origT, bp->pos); @@ -3493,18 +3493,18 @@ static void softbody_step( else if (sb->solver_ID == 2) { /* do semi "fake" implicit euler */ /* removed */ - } /*SOLVER SELECT*/ + } /* SOLVER SELECT */ else if (sb->solver_ID == 4) { /* do semi "fake" implicit euler */ - } /*SOLVER SELECT*/ + } /* SOLVER SELECT */ else if (sb->solver_ID == 3) { /* do "stupid" semi "fake" implicit euler */ /* removed */ - } /*SOLVER SELECT*/ + } /* SOLVER SELECT */ else { CLOG_ERROR(&LOG, "softbody no valid solver ID!"); - } /*SOLVER SELECT*/ + } /* SOLVER SELECT */ if (sb->plastic) { apply_spring_memory(ob); } diff --git a/source/blender/blenkernel/intern/sound.c b/source/blender/blenkernel/intern/sound.c index 6dd1f66f6b5..f4a9d328d86 100644 --- a/source/blender/blenkernel/intern/sound.c +++ b/source/blender/blenkernel/intern/sound.c @@ -187,8 +187,8 @@ static void sound_blend_read_data(BlendDataReader *reader, ID *id) static void sound_blend_read_lib(BlendLibReader *reader, ID *id) { bSound *sound = (bSound *)id; - BLO_read_id_address( - reader, sound->id.lib, &sound->ipo); /* XXX deprecated - old animation system */ + /* XXX: deprecated - old animation system. */ + BLO_read_id_address(reader, sound->id.lib, &sound->ipo); } static void sound_blend_read_expand(BlendExpander *expander, ID *id) diff --git a/source/blender/blenkernel/intern/spline_base.cc b/source/blender/blenkernel/intern/spline_base.cc index e375fa929ed..aa0d95d4d61 100644 --- a/source/blender/blenkernel/intern/spline_base.cc +++ b/source/blender/blenkernel/intern/spline_base.cc @@ -40,6 +40,60 @@ Spline::Type Spline::type() const return type_; } +void Spline::copy_base_settings(const Spline &src, Spline &dst) +{ + dst.normal_mode = src.normal_mode; + dst.is_cyclic_ = src.is_cyclic_; +} + +static SplinePtr create_spline(const Spline::Type type) +{ + switch (type) { + case Spline::Type::Poly: + return std::make_unique<PolySpline>(); + case Spline::Type::Bezier: + return std::make_unique<BezierSpline>(); + case Spline::Type::NURBS: + return std::make_unique<NURBSpline>(); + } + BLI_assert_unreachable(); + return {}; +} + +/** + * Return a new spline with the same data, settings, and attributes. + */ +SplinePtr Spline::copy() const +{ + SplinePtr dst = this->copy_without_attributes(); + dst->attributes = this->attributes; + return dst; +} + +/** + * Return a new spline with the same type and settings like "cyclic", but without any data. + */ +SplinePtr Spline::copy_only_settings() const +{ + SplinePtr dst = create_spline(type_); + this->copy_base_settings(*this, *dst); + this->copy_settings(*dst); + return dst; +} + +/** + * The same as #copy, but skips copying dynamic attributes to the new spline. + */ +SplinePtr Spline::copy_without_attributes() const +{ + SplinePtr dst = this->copy_only_settings(); + this->copy_data(*dst); + + /* Though the attributes storage is empty, it still needs to know the correct size. */ + dst->attributes.reallocate(dst->size()); + return dst; +} + void Spline::translate(const blender::float3 &translation) { for (float3 &position : this->positions()) { @@ -74,9 +128,9 @@ float Spline::length() const int Spline::segments_size() const { - const int points_len = this->size(); + const int size = this->size(); - return is_cyclic_ ? points_len : points_len - 1; + return is_cyclic_ ? size : size - 1; } bool Spline::is_cyclic() const @@ -331,7 +385,7 @@ Span<float3> Spline::evaluated_normals() const } /* Rotate the generated normals with the interpolated tilt data. */ - GVArray_Typed<float> tilts = this->interpolate_to_evaluated_points(this->tilts()); + GVArray_Typed<float> tilts = this->interpolate_to_evaluated(this->tilts()); for (const int i : normals.index_range()) { normals[i] = rotate_direction_around_axis(normals[i], tangents[i], tilts[i]); } @@ -411,23 +465,23 @@ Array<float> Spline::sample_uniform_index_factors(const int samples_size) const Spline::LookupResult Spline::lookup_data_from_index_factor(const float index_factor) const { - const int points_len = this->evaluated_points_size(); + const int eval_size = this->evaluated_points_size(); if (is_cyclic_) { - if (index_factor < points_len) { + if (index_factor < eval_size) { const int index = std::floor(index_factor); - const int next_index = (index < points_len - 1) ? index + 1 : 0; + const int next_index = (index < eval_size - 1) ? index + 1 : 0; return LookupResult{index, next_index, index_factor - index}; } - return LookupResult{points_len - 1, 0, 1.0f}; + return LookupResult{eval_size - 1, 0, 1.0f}; } - if (index_factor < points_len - 1) { + if (index_factor < eval_size - 1) { const int index = std::floor(index_factor); const int next_index = index + 1; return LookupResult{index, next_index, index_factor - index}; } - return LookupResult{points_len - 2, points_len - 1, 1.0f}; + return LookupResult{eval_size - 2, eval_size - 1, 1.0f}; } void Spline::bounds_min_max(float3 &min, float3 &max, const bool use_evaluated) const @@ -438,9 +492,9 @@ void Spline::bounds_min_max(float3 &min, float3 &max, const bool use_evaluated) } } -GVArrayPtr Spline::interpolate_to_evaluated_points(GSpan data) const +GVArrayPtr Spline::interpolate_to_evaluated(GSpan data) const { - return this->interpolate_to_evaluated_points(GVArray_For_GSpan(data)); + return this->interpolate_to_evaluated(GVArray_For_GSpan(data)); } /** @@ -448,9 +502,9 @@ GVArrayPtr Spline::interpolate_to_evaluated_points(GSpan data) const * points) to arbitrary parameters in between the evaluated points. The interpolation is quite * simple, but this handles the cyclic and end point special cases. */ -void Spline::sample_based_on_index_factors(const GVArray &src, - Span<float> index_factors, - GMutableSpan dst) const +void Spline::sample_with_index_factors(const GVArray &src, + Span<float> index_factors, + GMutableSpan dst) const { BLI_assert(src.size() == this->evaluated_points_size()); diff --git a/source/blender/blenkernel/intern/spline_bezier.cc b/source/blender/blenkernel/intern/spline_bezier.cc index 88b680850cf..02d26ac715b 100644 --- a/source/blender/blenkernel/intern/spline_bezier.cc +++ b/source/blender/blenkernel/intern/spline_bezier.cc @@ -25,18 +25,26 @@ using blender::float3; using blender::IndexRange; using blender::MutableSpan; using blender::Span; +using blender::fn::GVArray; +using blender::fn::GVArray_For_ArrayContainer; +using blender::fn::GVArrayPtr; -SplinePtr BezierSpline::copy() const +void BezierSpline::copy_settings(Spline &dst) const { - return std::make_unique<BezierSpline>(*this); + BezierSpline &bezier = static_cast<BezierSpline &>(dst); + bezier.resolution_ = resolution_; } -SplinePtr BezierSpline::copy_settings() const +void BezierSpline::copy_data(Spline &dst) const { - std::unique_ptr<BezierSpline> copy = std::make_unique<BezierSpline>(); - copy_base_settings(*this, *copy); - copy->resolution_ = resolution_; - return copy; + BezierSpline &bezier = static_cast<BezierSpline &>(dst); + bezier.positions_ = positions_; + bezier.handle_types_left_ = handle_types_left_; + bezier.handle_positions_left_ = handle_positions_left_; + bezier.handle_types_right_ = handle_types_right_; + bezier.handle_positions_right_ = handle_positions_right_; + bezier.radii_ = radii_; + bezier.tilts_ = tilts_; } int BezierSpline::size() const @@ -389,13 +397,13 @@ Span<int> BezierSpline::control_point_offsets() const return offset_cache_; } - const int points_len = this->size(); - offset_cache_.resize(points_len + 1); + const int size = this->size(); + offset_cache_.resize(size + 1); MutableSpan<int> offsets = offset_cache_; int offset = 0; - for (const int i : IndexRange(points_len)) { + for (const int i : IndexRange(size)) { offsets[i] = offset; offset += this->segment_is_vector(i) ? 1 : resolution_; } @@ -524,66 +532,66 @@ Span<float3> BezierSpline::evaluated_positions() const BezierSpline::InterpolationData BezierSpline::interpolation_data_from_index_factor( const float index_factor) const { - const int points_len = this->size(); + const int size = this->size(); if (is_cyclic_) { - if (index_factor < points_len) { + if (index_factor < size) { const int index = std::floor(index_factor); - const int next_index = (index < points_len - 1) ? index + 1 : 0; + const int next_index = (index < size - 1) ? index + 1 : 0; return InterpolationData{index, next_index, index_factor - index}; } - return InterpolationData{points_len - 1, 0, 1.0f}; + return InterpolationData{size - 1, 0, 1.0f}; } - if (index_factor < points_len - 1) { + if (index_factor < size - 1) { const int index = std::floor(index_factor); const int next_index = index + 1; return InterpolationData{index, next_index, index_factor - index}; } - return InterpolationData{points_len - 2, points_len - 1, 1.0f}; + return InterpolationData{size - 2, size - 1, 1.0f}; } /* Use a spline argument to avoid adding this to the header. */ template<typename T> -static void interpolate_to_evaluated_points_impl(const BezierSpline &spline, - const blender::VArray<T> &source_data, - MutableSpan<T> result_data) +static void interpolate_to_evaluated_impl(const BezierSpline &spline, + const blender::VArray<T> &src, + MutableSpan<T> dst) { + BLI_assert(src.size() == spline.size()); + BLI_assert(dst.size() == spline.evaluated_points_size()); Span<float> mappings = spline.evaluated_mappings(); - for (const int i : result_data.index_range()) { + for (const int i : dst.index_range()) { BezierSpline::InterpolationData interp = spline.interpolation_data_from_index_factor( mappings[i]); - const T &value = source_data[interp.control_point_index]; - const T &next_value = source_data[interp.next_control_point_index]; + const T &value = src[interp.control_point_index]; + const T &next_value = src[interp.next_control_point_index]; - result_data[i] = blender::attribute_math::mix2(interp.factor, value, next_value); + dst[i] = blender::attribute_math::mix2(interp.factor, value, next_value); } } -blender::fn::GVArrayPtr BezierSpline::interpolate_to_evaluated_points( - const blender::fn::GVArray &source_data) const +GVArrayPtr BezierSpline::interpolate_to_evaluated(const GVArray &src) const { - BLI_assert(source_data.size() == this->size()); + BLI_assert(src.size() == this->size()); - if (source_data.is_single()) { - return source_data.shallow_copy(); + if (src.is_single()) { + return src.shallow_copy(); } const int eval_size = this->evaluated_points_size(); if (eval_size == 1) { - return source_data.shallow_copy(); + return src.shallow_copy(); } - blender::fn::GVArrayPtr new_varray; - blender::attribute_math::convert_to_static_type(source_data.type(), [&](auto dummy) { + GVArrayPtr new_varray; + blender::attribute_math::convert_to_static_type(src.type(), [&](auto dummy) { using T = decltype(dummy); if constexpr (!std::is_void_v<blender::attribute_math::DefaultMixer<T>>) { Array<T> values(eval_size); - interpolate_to_evaluated_points_impl<T>(*this, source_data.typed<T>(), values); - new_varray = std::make_unique<blender::fn::GVArray_For_ArrayContainer<Array<T>>>( - std::move(values)); + interpolate_to_evaluated_impl<T>(*this, src.typed<T>(), values); + new_varray = std::make_unique<GVArray_For_ArrayContainer<Array<T>>>(std::move(values)); } }); diff --git a/source/blender/blenkernel/intern/spline_nurbs.cc b/source/blender/blenkernel/intern/spline_nurbs.cc index bfb0d652b1a..76d046337c0 100644 --- a/source/blender/blenkernel/intern/spline_nurbs.cc +++ b/source/blender/blenkernel/intern/spline_nurbs.cc @@ -26,21 +26,28 @@ using blender::float3; using blender::IndexRange; using blender::MutableSpan; using blender::Span; +using blender::fn::GVArray; +using blender::fn::GVArray_For_ArrayContainer; using blender::fn::GVArray_Typed; +using blender::fn::GVArrayPtr; -SplinePtr NURBSpline::copy() const +void NURBSpline::copy_settings(Spline &dst) const { - return std::make_unique<NURBSpline>(*this); + NURBSpline &nurbs = static_cast<NURBSpline &>(dst); + nurbs.knots_mode = knots_mode; + nurbs.resolution_ = resolution_; + nurbs.order_ = order_; } -SplinePtr NURBSpline::copy_settings() const +void NURBSpline::copy_data(Spline &dst) const { - std::unique_ptr<NURBSpline> copy = std::make_unique<NURBSpline>(); - copy_base_settings(*this, *copy); - copy->knots_mode = knots_mode; - copy->resolution_ = resolution_; - copy->order_ = order_; - return copy; + NURBSpline &nurbs = static_cast<NURBSpline &>(dst); + nurbs.positions_ = positions_; + nurbs.weights_ = weights_; + nurbs.knots_ = knots_; + nurbs.knots_dirty_ = knots_dirty_; + nurbs.radii_ = radii_; + nurbs.tilts_ = tilts_; } int NURBSpline::size() const @@ -268,18 +275,18 @@ Span<float> NURBSpline::knots() const } static void calculate_basis_for_point(const float parameter, - const int points_len, + const int size, const int order, Span<float> knots, MutableSpan<float> basis_buffer, NURBSpline::BasisCache &basis_cache) { /* Clamp parameter due to floating point inaccuracy. */ - const float t = std::clamp(parameter, knots[0], knots[points_len + order - 1]); + const float t = std::clamp(parameter, knots[0], knots[size + order - 1]); int start = 0; int end = 0; - for (const int i : IndexRange(points_len + order - 1)) { + for (const int i : IndexRange(size + order - 1)) { const bool knots_equal = knots[i] == knots[i + 1]; if (knots_equal || t < knots[i] || t > knots[i + 1]) { basis_buffer[i] = 0.0f; @@ -289,14 +296,14 @@ static void calculate_basis_for_point(const float parameter, basis_buffer[i] = 1.0f; start = std::max(i - order - 1, 0); end = i; - basis_buffer.slice(i + 1, points_len + order - 1 - i).fill(0.0f); + basis_buffer.slice(i + 1, size + order - 1 - i).fill(0.0f); break; } - basis_buffer[points_len + order - 1] = 0.0f; + basis_buffer[size + order - 1] = 0.0f; for (const int i_order : IndexRange(2, order - 1)) { - if (end + i_order >= points_len + order) { - end = points_len + order - 1 - i_order; + if (end + i_order >= size + order) { + end = size + order - 1 - i_order; } for (const int i : IndexRange(start, end - start + 1)) { float new_basis = 0.0f; @@ -326,18 +333,18 @@ static void calculate_basis_for_point(const float parameter, basis_cache.start_index = start; } -void NURBSpline::calculate_basis_cache() const +Span<NURBSpline::BasisCache> NURBSpline::calculate_basis_cache() const { if (!basis_cache_dirty_) { - return; + return basis_cache_; } std::lock_guard lock{basis_cache_mutex_}; if (!basis_cache_dirty_) { - return; + return basis_cache_; } - const int points_len = this->size(); + const int size = this->size(); const int eval_size = this->evaluated_points_size(); BLI_assert(this->evaluated_edges_size() > 0); basis_cache_.resize(eval_size); @@ -353,17 +360,17 @@ void NURBSpline::calculate_basis_cache() const Array<float> basis_buffer(this->knots_size()); const float start = knots[order - 1]; - const float end = is_cyclic_ ? knots[points_len + order - 1] : knots[points_len]; + const float end = is_cyclic_ ? knots[size + order - 1] : knots[size]; const float step = (end - start) / this->evaluated_edges_size(); float parameter = start; for (const int i : IndexRange(eval_size)) { BasisCache &basis = basis_cache[i]; calculate_basis_for_point( - parameter, points_len + (is_cyclic_ ? order - 1 : 0), order, knots, basis_buffer, basis); + parameter, size + (is_cyclic_ ? order - 1 : 0), order, knots, basis_buffer, basis); BLI_assert(basis.weights.size() <= order); for (const int j : basis.weights.index_range()) { - const int point_index = (basis.start_index + j) % points_len; + const int point_index = (basis.start_index + j) % size; basis.weights[j] *= control_weights[point_index]; } @@ -371,50 +378,47 @@ void NURBSpline::calculate_basis_cache() const } basis_cache_dirty_ = false; + return basis_cache_; } template<typename T> -void interpolate_to_evaluated_points_impl(Span<NURBSpline::BasisCache> weights, - const blender::VArray<T> &source_data, - MutableSpan<T> result_data) +void interpolate_to_evaluated_impl(Span<NURBSpline::BasisCache> weights, + const blender::VArray<T> &src, + MutableSpan<T> dst) { - const int points_len = source_data.size(); - BLI_assert(result_data.size() == weights.size()); - blender::attribute_math::DefaultMixer<T> mixer(result_data); + const int size = src.size(); + BLI_assert(dst.size() == weights.size()); + blender::attribute_math::DefaultMixer<T> mixer(dst); - for (const int i : result_data.index_range()) { + for (const int i : dst.index_range()) { Span<float> point_weights = weights[i].weights; const int start_index = weights[i].start_index; - for (const int j : point_weights.index_range()) { - const int point_index = (start_index + j) % points_len; - mixer.mix_in(i, source_data[point_index], point_weights[j]); + const int point_index = (start_index + j) % size; + mixer.mix_in(i, src[point_index], point_weights[j]); } } mixer.finalize(); } -blender::fn::GVArrayPtr NURBSpline::interpolate_to_evaluated_points( - const blender::fn::GVArray &source_data) const +GVArrayPtr NURBSpline::interpolate_to_evaluated(const GVArray &src) const { - BLI_assert(source_data.size() == this->size()); + BLI_assert(src.size() == this->size()); - if (source_data.is_single()) { - return source_data.shallow_copy(); + if (src.is_single()) { + return src.shallow_copy(); } - this->calculate_basis_cache(); - Span<BasisCache> weights(basis_cache_); + Span<BasisCache> basis_cache = this->calculate_basis_cache(); - blender::fn::GVArrayPtr new_varray; - blender::attribute_math::convert_to_static_type(source_data.type(), [&](auto dummy) { + GVArrayPtr new_varray; + blender::attribute_math::convert_to_static_type(src.type(), [&](auto dummy) { using T = decltype(dummy); if constexpr (!std::is_void_v<blender::attribute_math::DefaultMixer<T>>) { Array<T> values(this->evaluated_points_size()); - interpolate_to_evaluated_points_impl<T>(weights, source_data.typed<T>(), values); - new_varray = std::make_unique<blender::fn::GVArray_For_ArrayContainer<Array<T>>>( - std::move(values)); + interpolate_to_evaluated_impl<T>(basis_cache, src.typed<T>(), values); + new_varray = std::make_unique<GVArray_For_ArrayContainer<Array<T>>>(std::move(values)); } }); @@ -436,7 +440,7 @@ Span<float3> NURBSpline::evaluated_positions() const evaluated_position_cache_.resize(eval_size); /* TODO: Avoid copying the evaluated data from the temporary array. */ - GVArray_Typed<float3> evaluated = Spline::interpolate_to_evaluated_points(positions_.as_span()); + GVArray_Typed<float3> evaluated = Spline::interpolate_to_evaluated(positions_.as_span()); evaluated->materialize(evaluated_position_cache_); position_cache_dirty_ = false; diff --git a/source/blender/blenkernel/intern/spline_poly.cc b/source/blender/blenkernel/intern/spline_poly.cc index 5f8e81d5ad0..dfd24b2566e 100644 --- a/source/blender/blenkernel/intern/spline_poly.cc +++ b/source/blender/blenkernel/intern/spline_poly.cc @@ -22,17 +22,20 @@ using blender::float3; using blender::MutableSpan; using blender::Span; +using blender::fn::GVArray; +using blender::fn::GVArrayPtr; -SplinePtr PolySpline::copy() const +void PolySpline::copy_settings(Spline &UNUSED(dst)) const { - return std::make_unique<PolySpline>(*this); + /* Poly splines have no settings not covered by the base class. */ } -SplinePtr PolySpline::copy_settings() const +void PolySpline::copy_data(Spline &dst) const { - std::unique_ptr<PolySpline> copy = std::make_unique<PolySpline>(); - copy_base_settings(*this, *copy); - return copy; + PolySpline &poly = static_cast<PolySpline &>(dst); + poly.positions_ = positions_; + poly.radii_ = radii_; + poly.tilts_ = tilts_; } int PolySpline::size() const @@ -115,10 +118,9 @@ Span<float3> PolySpline::evaluated_positions() const * the original data. Therefore the lifetime of the returned virtual array must not be longer than * the source data. */ -blender::fn::GVArrayPtr PolySpline::interpolate_to_evaluated_points( - const blender::fn::GVArray &source_data) const +GVArrayPtr PolySpline::interpolate_to_evaluated(const GVArray &src) const { - BLI_assert(source_data.size() == this->size()); + BLI_assert(src.size() == this->size()); - return source_data.shallow_copy(); + return src.shallow_copy(); } diff --git a/source/blender/blenkernel/intern/subdiv_ccg.c b/source/blender/blenkernel/intern/subdiv_ccg.c index 4ca6f93b014..8b672b2cb49 100644 --- a/source/blender/blenkernel/intern/subdiv_ccg.c +++ b/source/blender/blenkernel/intern/subdiv_ccg.c @@ -63,7 +63,7 @@ void subdiv_ccg_average_faces_boundaries_and_corners(SubdivCCG *subdiv_ccg, /** \name Generally useful internal helpers * \{ */ -/* Number of floats in per-vertex elements. */ +/* Number of floats in per-vertex elements. */ static int num_element_float_get(const SubdivCCG *subdiv_ccg) { /* We always have 3 floats for coordinate. */ @@ -1116,7 +1116,7 @@ typedef struct AverageGridsCornerData { SubdivCCG *subdiv_ccg; CCGKey *key; - /* Optional lookup table. Maps task range index to index in subdiv_ccg->adjacent_vertices*/ + /* Optional lookup table. Maps task range index to index in `subdiv_ccg->adjacent_vertices`. */ const int *adjacent_vert_index_map; } AverageGridsCornerData; @@ -1489,7 +1489,7 @@ BLI_INLINE SubdivCCGCoord coord_at_next_col(const SubdivCCG *subdiv_ccg, return result; } -/* For the input coordinate which is at the boundary of the grid do one step inside. */ +/* For the input coordinate which is at the boundary of the grid do one step inside. */ static SubdivCCGCoord coord_step_inside_from_boundary(const SubdivCCG *subdiv_ccg, const SubdivCCGCoord *coord) diff --git a/source/blender/blenkernel/intern/subdiv_eval.c b/source/blender/blenkernel/intern/subdiv_eval.c index 201d308e096..693827f99ac 100644 --- a/source/blender/blenkernel/intern/subdiv_eval.c +++ b/source/blender/blenkernel/intern/subdiv_eval.c @@ -282,7 +282,7 @@ static void buffer_apply_offset(void **buffer, const int offset) *buffer = ((unsigned char *)*buffer) + offset; } -/* Write given number of floats to the beginning of given buffer. */ +/* Write given number of floats to the beginning of given buffer. */ static void buffer_write_float_value(void **buffer, const float *values_buffer, int num_values) { memcpy(*buffer, values_buffer, sizeof(float) * num_values); diff --git a/source/blender/blenkernel/intern/subdiv_foreach.c b/source/blender/blenkernel/intern/subdiv_foreach.c index 4400e9c976f..061c196df2a 100644 --- a/source/blender/blenkernel/intern/subdiv_foreach.c +++ b/source/blender/blenkernel/intern/subdiv_foreach.c @@ -1749,7 +1749,7 @@ static void subdiv_foreach_vertices_of_loose_edges_task(void *__restrict userdat /* Subdivision vertices which corresponds to edge's v1 and v2. */ const int subdiv_v1_index = ctx->vertices_corner_offset + coarse_edge->v1; const int subdiv_v2_index = ctx->vertices_corner_offset + coarse_edge->v2; - /* First subdivided inner vertex of the edge. */ + /* First subdivided inner vertex of the edge. */ const int subdiv_start_vertex = ctx->vertices_edge_offset + coarse_edge_index * num_subdiv_vertices_per_coarse_edge; /* Perform interpolation. */ diff --git a/source/blender/blenkernel/intern/subsurf_ccg.c b/source/blender/blenkernel/intern/subsurf_ccg.c index 23eccbfba9b..0dbfeaaaadb 100644 --- a/source/blender/blenkernel/intern/subsurf_ccg.c +++ b/source/blender/blenkernel/intern/subsurf_ccg.c @@ -580,16 +580,16 @@ static void ss_sync_ccg_from_derivedmesh(CCGSubSurf *ss, #endif MVert *mvert = dm->getVertArray(dm); MEdge *medge = dm->getEdgeArray(dm); - /* MFace *mface = dm->getTessFaceArray(dm); */ /* UNUSED */ + // MFace *mface = dm->getTessFaceArray(dm); /* UNUSED */ MVert *mv; MEdge *me; MLoop *mloop = dm->getLoopArray(dm), *ml; MPoly *mpoly = dm->getPolyArray(dm), *mp; - /*MFace *mf;*/ /*UNUSED*/ + // MFace *mf; /* UNUSED */ int totvert = dm->getNumVerts(dm); int totedge = dm->getNumEdges(dm); - /*int totface = dm->getNumTessFaces(dm);*/ /*UNUSED*/ - /*int totpoly = dm->getNumFaces(dm);*/ /*UNUSED*/ + // int totface = dm->getNumTessFaces(dm); /* UNUSED */ + // int totpoly = dm->getNumFaces(dm); /* UNUSED */ int i, j; int *index; @@ -641,10 +641,10 @@ static void ss_sync_ccg_from_derivedmesh(CCGSubSurf *ss, fVerts[j] = POINTER_FROM_UINT(ml->v); } - /* this is very bad, means mesh is internally inconsistent. + /* This is very bad, means mesh is internally inconsistent. * it is not really possible to continue without modifying * other parts of code significantly to handle missing faces. - * since this really shouldn't even be possible we just bail.*/ + * since this really shouldn't even be possible we just bail. */ if (ccgSubSurf_syncFace(ss, POINTER_FROM_INT(i), mp->totloop, fVerts, &f) == eCCGError_InvalidValue) { static int hasGivenError = 0; @@ -1008,11 +1008,11 @@ static void ccgDM_getFinalFace(DerivedMesh *dm, int faceNum, MFace *mf) int gridFaces = gridSideEdges * gridSideEdges; int i; CCGFace *f; - /*int numVerts;*/ + // int numVerts; int offset; int grid; int x, y; - /*int lastface = ccgSubSurf_getNumFaces(ss) - 1;*/ /*UNUSED*/ + // int lastface = ccgSubSurf_getNumFaces(ss) - 1; /* UNUSED */ DMFlagMat *faceFlags = ccgdm->faceFlags; memset(mf, 0, sizeof(*mf)); @@ -1023,7 +1023,7 @@ static void ccgDM_getFinalFace(DerivedMesh *dm, int faceNum, MFace *mf) i = ccgdm->reverseFaceMap[faceNum]; f = ccgdm->faceMap[i].face; - /*numVerts = ccgSubSurf_getFaceNumVerts(f);*/ /*UNUSED*/ + // numVerts = ccgSubSurf_getFaceNumVerts(f); /* UNUSED */ offset = faceNum - ccgdm->faceMap[i].startFace; grid = offset / gridFaces; @@ -1781,7 +1781,7 @@ static void ccgdm_create_grids(DerivedMesh *dm) numGrids = ccgDM_getNumGrids(dm); numFaces = ccgSubSurf_getNumFaces(ss); - /*gridSize = ccgDM_getGridSize(dm);*/ /*UNUSED*/ + // gridSize = ccgDM_getGridSize(dm); /* UNUSED */ /* compute offset into grid array for each face */ gridOffset = MEM_mallocN(sizeof(int) * numFaces, "ccgdm.gridOffset"); @@ -2089,7 +2089,7 @@ static void set_ccgdm_all_geometry(CCGDerivedMesh *ccgdm, vertidx[s] = POINTER_AS_INT(ccgSubSurf_getVertVertHandle(v)); } - /*I think this is for interpolating the center vert?*/ + /* I think this is for interpolating the center vert? */ w2 = w; // + numVerts*(g2_wid-1) * (g2_wid-1); //numVerts*((g2_wid-1) * g2_wid+g2_wid-1); DM_interp_vert_data(dm, &ccgdm->dm, vertidx, w2, numVerts, vertNum); if (vertOrigIndex) { @@ -2099,7 +2099,7 @@ static void set_ccgdm_all_geometry(CCGDerivedMesh *ccgdm, vertNum++; - /*interpolate per-vert data*/ + /* Interpolate per-vert data. */ for (s = 0; s < numVerts; s++) { for (x = 1; x < gridFaces; x++) { w2 = w + s * numVerts * g2_wid * g2_wid + x * numVerts; @@ -2114,7 +2114,7 @@ static void set_ccgdm_all_geometry(CCGDerivedMesh *ccgdm, } } - /*interpolate per-vert data*/ + /* Interpolate per-vert data. */ for (s = 0; s < numVerts; s++) { for (y = 1; y < gridFaces; y++) { for (x = 1; x < gridFaces; x++) { @@ -2138,7 +2138,7 @@ static void set_ccgdm_all_geometry(CCGDerivedMesh *ccgdm, } for (s = 0; s < numVerts; s++) { - /*interpolate per-face data*/ + /* Interpolate per-face data. */ for (y = 0; y < gridFaces; y++) { for (x = 0; x < gridFaces; x++) { w2 = w + s * numVerts * g2_wid * g2_wid + (y * g2_wid + x) * numVerts; @@ -2161,10 +2161,10 @@ static void set_ccgdm_all_geometry(CCGDerivedMesh *ccgdm, &dm->loopData, &ccgdm->dm.loopData, loopidx, w2, NULL, numVerts, loopindex2); loopindex2++; - /*copy over poly data, e.g. mtexpoly*/ + /* Copy over poly data, e.g. mtexpoly. */ CustomData_copy_data(&dm->polyData, &ccgdm->dm.polyData, origIndex, faceNum, 1); - /*set original index data*/ + /* Set original index data. */ if (faceOrigIndex) { /* reference the index in 'polyOrigIndex' */ *faceOrigIndex = faceNum; diff --git a/source/blender/blenkernel/intern/tracking_stabilize.c b/source/blender/blenkernel/intern/tracking_stabilize.c index 46589a578a8..3dff750edfb 100644 --- a/source/blender/blenkernel/intern/tracking_stabilize.c +++ b/source/blender/blenkernel/intern/tracking_stabilize.c @@ -1381,7 +1381,7 @@ ImBuf *BKE_tracking_stabilize_frame( return ibuf; } - /* Allocate frame for stabilization result, copy alpha mode and colorspace. */ + /* Allocate frame for stabilization result, copy alpha mode and colorspace. */ ibuf_flags = 0; if (ibuf->rect) { ibuf_flags |= IB_rect; diff --git a/source/blender/blenkernel/intern/unit.c b/source/blender/blenkernel/intern/unit.c index 5cf76bb6452..3a9ce5ad932 100644 --- a/source/blender/blenkernel/intern/unit.c +++ b/source/blender/blenkernel/intern/unit.c @@ -152,7 +152,7 @@ static struct bUnitDef buMetricLenDef[] = { {"micrometer", "micrometers", "µm", "um", "Micrometers", "MICROMETERS", UN_SC_UM, 0.0, B_UNIT_DEF_NONE}, /* These get displayed because of float precision problems in the transform header, - * could work around, but for now probably people wont use these. */ + * could work around, but for now probably people won't use these. */ #if 0 {"nanometer", "Nanometers", "nm", NULL, 0.000000001, 0.0, B_UNIT_DEF_NONE}, {"picometer", "Picometers", "pm", NULL, 0.000000000001, 0.0, B_UNIT_DEF_NONE}, @@ -747,7 +747,7 @@ static const char *unit_find_str(const char *str, const char *substr, bool case_ * "1*1+1*0.01 +2*0.001 " - Add add signs if ( + - * / | & ~ < > ^ ! = % ) not found in between. */ -/* Not too strict, (+ - * /) are most common. */ +/* Not too strict, (+ - * /) are most common. */ static bool ch_is_op(char op) { switch (op) { @@ -917,7 +917,7 @@ static int unit_scale_str(char *str, return 0; } - /* XXX - investigate, does not respect len_max properly. */ + /* XXX - investigate, does not respect len_max properly. */ char *str_found = (char *)unit_find_str(str, replace_str, case_sensitive); if (str_found == NULL) { @@ -988,7 +988,7 @@ static int unit_scale_str(char *str, memcpy(str_found, str_tmp, len_num); /* Without the string terminator. */ } - /* Since the null terminator wont be moved if the stringlen_max + /* Since the null terminator won't be moved if the stringlen_max * was not long enough to fit everything in it. */ str[len_max - 1] = '\0'; return found_ofs + len_num; @@ -1136,8 +1136,8 @@ bool BKE_unit_replace_string( strncpy(str, str_tmp, len_max); } else { - /* BLI_snprintf would not fit into str_tmp, cant do much in this case. - * Check for this because otherwise BKE_unit_replace_string could call its self forever. */ + /* BLI_snprintf would not fit into str_tmp, can't do much in this case. + * Check for this because otherwise BKE_unit_replace_string could call itself forever. */ return changed; } diff --git a/source/blender/blenkernel/intern/volume.cc b/source/blender/blenkernel/intern/volume.cc index 5e444e66a15..5fc55aad6a2 100644 --- a/source/blender/blenkernel/intern/volume.cc +++ b/source/blender/blenkernel/intern/volume.cc @@ -745,7 +745,7 @@ static int volume_sequence_frame(const Depsgraph *depsgraph, const Volume *volum } } - /* Important to apply after, else we cant loop on e.g. frames 100 - 110. */ + /* Important to apply after, else we can't loop on e.g. frames 100 - 110. */ frame += frame_offset; return frame; diff --git a/source/blender/blenkernel/intern/workspace.c b/source/blender/blenkernel/intern/workspace.c index be67b2370e3..533107b2bf6 100644 --- a/source/blender/blenkernel/intern/workspace.c +++ b/source/blender/blenkernel/intern/workspace.c @@ -105,8 +105,8 @@ static void workspace_blend_read_data(BlendDataReader *reader, ID *id) BLO_read_list(reader, &workspace->tools); LISTBASE_FOREACH (WorkSpaceDataRelation *, relation, &workspace->hook_layout_relations) { - /* parent pointer does not belong to workspace data and is therefore restored in lib_link step - * of window manager.*/ + /* Parent pointer does not belong to workspace data and is therefore restored in lib_link step + * of window manager. */ BLO_read_data_address(reader, &relation->value); } diff --git a/source/blender/blenlib/BLI_array.h b/source/blender/blenlib/BLI_array.h index 4e37314ed3e..e40a79dad21 100644 --- a/source/blender/blenlib/BLI_array.h +++ b/source/blender/blenlib/BLI_array.h @@ -105,8 +105,9 @@ void _bli_array_grow_func(void **arr_p, ((void)BLI_array_grow_one(arr), (void)(arr[_##arr##_len - 1] = item)) /** - * appends an item to the array and returns a pointer to the item in the array. - * item is not a pointer, but actual data value.*/ + * Appends an item to the array and returns a pointer to the item in the array. + * item is not a pointer, but actual data value. + */ #define BLI_array_append_r(arr, item) \ ((void)BLI_array_grow_one(arr), (void)(arr[_##arr##_len - 1] = item), (&arr[_##arr##_len - 1])) diff --git a/source/blender/blenlib/BLI_buffer.h b/source/blender/blenlib/BLI_buffer.h index f641c89e53b..9d66fe9a14e 100644 --- a/source/blender/blenlib/BLI_buffer.h +++ b/source/blender/blenlib/BLI_buffer.h @@ -42,7 +42,7 @@ enum { BLI_Buffer name_ = { \ (name_##_static_), sizeof(type_), 0, static_count_, BLI_BUFFER_USE_STATIC | (flag_)} -/* never use static*/ +/* Never use static. */ #define BLI_buffer_declare(type_, name_, flag_) \ bool name_##user; /* warn for free only */ \ BLI_Buffer name_ = {NULL, sizeof(type_), 0, 0, (flag_)} diff --git a/source/blender/blenlib/BLI_color.hh b/source/blender/blenlib/BLI_color.hh index 3b01bbfb86e..76dfcf0b57d 100644 --- a/source/blender/blenlib/BLI_color.hh +++ b/source/blender/blenlib/BLI_color.hh @@ -180,7 +180,7 @@ class ColorSceneLinear4f final : public ColorRGBA<float, eSpace::SceneLinear, Al /** * Convert to its byte encoded counter space. - **/ + */ ColorSceneLinearByteEncoded4b<Alpha> encode() const { ColorSceneLinearByteEncoded4b<Alpha> encoded; diff --git a/source/blender/blenlib/BLI_delaunay_2d.h b/source/blender/blenlib/BLI_delaunay_2d.h index e91726991ca..d42bd6af637 100644 --- a/source/blender/blenlib/BLI_delaunay_2d.h +++ b/source/blender/blenlib/BLI_delaunay_2d.h @@ -178,6 +178,8 @@ typedef enum CDT_output_type { CDT_FULL, /** All triangles fully enclosed by constraint edges or faces. */ CDT_INSIDE, + /** Like previous, but detect holes and omit those from output. */ + CDT_INSIDE_WITH_HOLES, /** Only point, edge, and face constraints, and their intersections. */ CDT_CONSTRAINTS, /** @@ -186,7 +188,9 @@ typedef enum CDT_output_type { * #BMesh faces in Blender: that is, * no vertex appears more than once and no isolated holes in faces. */ - CDT_CONSTRAINTS_VALID_BMESH + CDT_CONSTRAINTS_VALID_BMESH, + /** Like previous, but detect holes and omit those from output. */ + CDT_CONSTRAINTS_VALID_BMESH_WITH_HOLES, } CDT_output_type; /** diff --git a/source/blender/blenlib/BLI_dlrbTree.h b/source/blender/blenlib/BLI_dlrbTree.h index fc52904d699..8c20e3d3988 100644 --- a/source/blender/blenlib/BLI_dlrbTree.h +++ b/source/blender/blenlib/BLI_dlrbTree.h @@ -35,7 +35,7 @@ extern "C" { */ /* ********************************************** */ -/* Data Types and Type Defines */ +/* Data Types and Type Defines */ /* Base Structs --------------------------------- */ diff --git a/source/blender/blenlib/BLI_fnmatch.h b/source/blender/blenlib/BLI_fnmatch.h index 2d0c13bc423..1df5b6f814a 100644 --- a/source/blender/blenlib/BLI_fnmatch.h +++ b/source/blender/blenlib/BLI_fnmatch.h @@ -34,36 +34,36 @@ extern "C" { # if defined(__cplusplus) || (defined(__STDC__) && __STDC__) # undef __P # define __P(protos) protos -# else /* Not C++ or ANSI C. */ +# else /* Not C++ or ANSI C. */ # undef __P # define __P(protos) () /* We can get away without defining `const' here only because in this file * it is used only inside the prototype for `fnmatch', which is elided in - * non-ANSI C where `const' is problematical. */ -# endif /* C++ or ANSI C. */ + * non-ANSI C where `const' is problematical. */ +# endif /* C++ or ANSI C. */ /* We #undef these before defining them because some losing systems - * (HP-UX A.08.07 for example) define these in <unistd.h>. */ + * (HP-UX A.08.07 for example) define these in <unistd.h>. */ # undef FNM_PATHNAME # undef FNM_NOESCAPE # undef FNM_PERIOD -/* Bits set in the FLAGS argument to `fnmatch'. */ -# define FNM_PATHNAME (1 << 0) /* No wildcard can ever match `/'. */ -# define FNM_NOESCAPE (1 << 1) /* Backslashes don't quote special chars. */ -# define FNM_PERIOD (1 << 2) /* Leading `.' is matched only explicitly. */ +/* Bits set in the FLAGS argument to `fnmatch'. */ +# define FNM_PATHNAME (1 << 0) /* No wildcard can ever match `/'. */ +# define FNM_NOESCAPE (1 << 1) /* Backslashes don't quote special chars. */ +# define FNM_PERIOD (1 << 2) /* Leading `.' is matched only explicitly. */ # if !defined(_POSIX_C_SOURCE) || _POSIX_C_SOURCE < 2 || defined(_GNU_SOURCE) -# define FNM_FILE_NAME FNM_PATHNAME /* Preferred GNU name. */ -# define FNM_LEADING_DIR (1 << 3) /* Ignore `/...' after a match. */ -# define FNM_CASEFOLD (1 << 4) /* Compare without regard to case. */ +# define FNM_FILE_NAME FNM_PATHNAME /* Preferred GNU name. */ +# define FNM_LEADING_DIR (1 << 3) /* Ignore `/...' after a match. */ +# define FNM_CASEFOLD (1 << 4) /* Compare without regard to case. */ # endif -/* Value returned by `fnmatch' if STRING does not match PATTERN. */ +/* Value returned by `fnmatch' if STRING does not match PATTERN. */ # define FNM_NOMATCH 1 /* Match STRING against the filename pattern PATTERN, - * returning zero if it matches, FNM_NOMATCH if not. */ + * returning zero if it matches, FNM_NOMATCH if not. */ extern int fnmatch __P((const char *__pattern, const char *__string, int __flags)); #else diff --git a/source/blender/blenlib/BLI_ghash.h b/source/blender/blenlib/BLI_ghash.h index fcf9ca61200..01a18b81b87 100644 --- a/source/blender/blenlib/BLI_ghash.h +++ b/source/blender/blenlib/BLI_ghash.h @@ -277,7 +277,7 @@ void *BLI_gset_pop_key(GSet *gs, const void *key) ATTR_WARN_UNUSED_RESULT; /* so we can cast but compiler sees as different */ typedef struct GSetIterator { GHashIterator _ghi -#ifdef __GNUC__ +#if defined(__GNUC__) && !defined(__clang__) __attribute__((deprecated)) #endif ; diff --git a/source/blender/blenlib/BLI_hash_md5.h b/source/blender/blenlib/BLI_hash_md5.h index 4a5cd8b19f3..227cfcc8876 100644 --- a/source/blender/blenlib/BLI_hash_md5.h +++ b/source/blender/blenlib/BLI_hash_md5.h @@ -27,13 +27,13 @@ extern "C" { /* Compute MD5 message digest for LEN bytes beginning at BUFFER. The * result is always in little endian byte order, so that a byte-wise * output yields to the wanted ASCII representation of the message - * digest. */ + * digest. */ void *BLI_hash_md5_buffer(const char *buffer, size_t len, void *resblock); /* Compute MD5 message digest for bytes read from STREAM. The * resulting message digest number will be written into the 16 bytes - * beginning at RESBLOCK. */ + * beginning at RESBLOCK. */ int BLI_hash_md5_stream(FILE *stream, void *resblock); diff --git a/source/blender/blenlib/BLI_math.h b/source/blender/blenlib/BLI_math.h index f6075367ac5..3b61c0feb51 100644 --- a/source/blender/blenlib/BLI_math.h +++ b/source/blender/blenlib/BLI_math.h @@ -70,4 +70,5 @@ #include "BLI_math_rotation.h" #include "BLI_math_solvers.h" #include "BLI_math_statistics.h" +#include "BLI_math_time.h" #include "BLI_math_vector.h" diff --git a/source/blender/blenlib/BLI_math_geom.h b/source/blender/blenlib/BLI_math_geom.h index 49188964f3b..43b31d76bb0 100644 --- a/source/blender/blenlib/BLI_math_geom.h +++ b/source/blender/blenlib/BLI_math_geom.h @@ -677,8 +677,8 @@ void window_translate_m4(float winmat[4][4], float perspmat[4][4], const float x void planes_from_projmat(const float mat[4][4], float left[4], float right[4], - float top[4], float bottom[4], + float top[4], float near[4], float far[4]); diff --git a/source/blender/blenlib/BLI_math_rotation.h b/source/blender/blenlib/BLI_math_rotation.h index fe995b2e46e..ef10d02f10f 100644 --- a/source/blender/blenlib/BLI_math_rotation.h +++ b/source/blender/blenlib/BLI_math_rotation.h @@ -164,6 +164,9 @@ void compatible_eul(float eul[3], const float old[3]); void rotate_eul(float eul[3], const char axis, const float angle); +void add_eul_euleul(float r_eul[3], float a[3], float b[3], const short order); +void sub_eul_euleul(float r_eul[3], float a[3], float b[3], const short order); + /************************** Arbitrary Order Eulers ***************************/ /* warning: must match the eRotationModes in DNA_action_types.h diff --git a/source/blender/blenlib/BLI_math_time.h b/source/blender/blenlib/BLI_math_time.h new file mode 100644 index 00000000000..671ec6f857f --- /dev/null +++ b/source/blender/blenlib/BLI_math_time.h @@ -0,0 +1,51 @@ +/* + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2021 by Blender Foundation. + * All rights reserved. + */ + +#pragma once + +/** \file + * \ingroup bli + */ + +#ifdef __cplusplus +extern "C" { +#endif + +/************************ Time constants definitions***************************/ +#define SECONDS_IN_MILLISECONDS 0.001 +#define SECONDS_IN_MINUTE 60.0 +#define MINUTES_IN_HOUR 60.0 +#define HOURS_IN_DAY 24.0 + +#define MINUTES_IN_DAY (MINUTES_IN_HOUR * HOURS_IN_DAY) +#define SECONDS_IN_DAY (MINUTES_IN_DAY * SECONDS_IN_MINUTE) +#define SECONDS_IN_HOUR (MINUTES_IN_HOUR * SECONDS_IN_MINUTE) + +void BLI_math_time_seconds_decompose(double seconds, + double *r_days, + double *r_hours, + double *r_minutes, + double *r_seconds, + double *r_milliseconds); + +/**************************** Inline Definitions ******************************/ + +#ifdef __cplusplus +} +#endif diff --git a/source/blender/blenlib/BLI_math_vector.h b/source/blender/blenlib/BLI_math_vector.h index 556a216bb89..2f4cf1721af 100644 --- a/source/blender/blenlib/BLI_math_vector.h +++ b/source/blender/blenlib/BLI_math_vector.h @@ -382,10 +382,11 @@ MINLINE float line_point_side_v2(const float l1[2], const float pt[2]) ATTR_WARN_UNUSED_RESULT; /********************************** Angles ***********************************/ -/* - angle with 2 arguments is angle between vector */ -/* - angle with 3 arguments is angle between 3 points at the middle point */ -/* - angle_normalized_* is faster equivalent if vectors are normalized */ +/* - angle with 2 arguments is angle between vector. + * - angle with 3 arguments is angle between 3 points at the middle point. + * - angle_normalized_* is faster equivalent if vectors are normalized. + */ float angle_v2v2(const float a[2], const float b[2]) ATTR_WARN_UNUSED_RESULT; float angle_signed_v2v2(const float v1[2], const float v2[2]) ATTR_WARN_UNUSED_RESULT; float angle_v2v2v2(const float a[2], const float b[2], const float c[2]) ATTR_WARN_UNUSED_RESULT; diff --git a/source/blender/blenlib/BLI_smallhash.h b/source/blender/blenlib/BLI_smallhash.h index daea2fcd914..f7aec716e9e 100644 --- a/source/blender/blenlib/BLI_smallhash.h +++ b/source/blender/blenlib/BLI_smallhash.h @@ -34,8 +34,8 @@ typedef struct { void *val; } SmallHashEntry; -/* how much stack space to use before dynamically allocating memory. - * set to match one of the values in 'hashsizes' to avoid too many mallocs */ +/* How much stack space to use before dynamically allocating memory. + * set to match one of the values in 'hashsizes' to avoid too many mallocs. */ #define SMSTACKSIZE 131 typedef struct SmallHash { unsigned int nbuckets; diff --git a/source/blender/blenlib/BLI_strict_flags.h b/source/blender/blenlib/BLI_strict_flags.h index 142782c6d86..ab7aacc4d2d 100644 --- a/source/blender/blenlib/BLI_strict_flags.h +++ b/source/blender/blenlib/BLI_strict_flags.h @@ -30,7 +30,7 @@ # pragma GCC diagnostic error "-Wconversion" # endif # if (__GNUC__ * 100 + __GNUC_MINOR__) >= 408 -/* gcc4.8+ only (behavior changed to ignore globals)*/ +/* gcc4.8+ only (behavior changed to ignore globals). */ # pragma GCC diagnostic error "-Wshadow" /* older gcc changed behavior with ternary */ # pragma GCC diagnostic error "-Wsign-conversion" diff --git a/source/blender/blenlib/BLI_string.h b/source/blender/blenlib/BLI_string.h index 5a80680c350..0c51d38e813 100644 --- a/source/blender/blenlib/BLI_string.h +++ b/source/blender/blenlib/BLI_string.h @@ -100,7 +100,7 @@ size_t BLI_str_format_int_grouped(char dst[16], int num) ATTR_NONNULL(); size_t BLI_str_format_uint64_grouped(char dst[16], uint64_t num) ATTR_NONNULL(); void BLI_str_format_byte_unit(char dst[15], long long int bytes, const bool base_10) ATTR_NONNULL(); - +void BLI_str_format_attribute_domain_size(char dst[7], int number_to_format) ATTR_NONNULL(); int BLI_strcaseeq(const char *a, const char *b) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(); char *BLI_strcasestr(const char *s, const char *find) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(); char *BLI_strncasestr(const char *s, const char *find, size_t len) ATTR_WARN_UNUSED_RESULT diff --git a/source/blender/blenlib/BLI_task.h b/source/blender/blenlib/BLI_task.h index d6b068c3889..dbe8ec3dcc0 100644 --- a/source/blender/blenlib/BLI_task.h +++ b/source/blender/blenlib/BLI_task.h @@ -147,7 +147,7 @@ typedef struct TaskParallelSettings { * (similar to OpenMP's firstprivate). */ void *userdata_chunk; /* Pointer to actual data. */ - size_t userdata_chunk_size; /* Size of that data. */ + size_t userdata_chunk_size; /* Size of that data. */ /* Function called from calling thread once whole range have been * processed. */ diff --git a/source/blender/blenlib/BLI_threads.h b/source/blender/blenlib/BLI_threads.h index eefde1afefb..4f71e3aa6e4 100644 --- a/source/blender/blenlib/BLI_threads.h +++ b/source/blender/blenlib/BLI_threads.h @@ -38,7 +38,7 @@ struct ListBase; /* Threading API */ -/*this is run once at startup*/ +/* This is run once at startup. */ void BLI_threadapi_init(void); void BLI_threadapi_exit(void); diff --git a/source/blender/blenlib/BLI_utildefines.h b/source/blender/blenlib/BLI_utildefines.h index 0bf117df43b..0ddabcaa2fb 100644 --- a/source/blender/blenlib/BLI_utildefines.h +++ b/source/blender/blenlib/BLI_utildefines.h @@ -517,7 +517,7 @@ extern "C" { # define ARRAY_SIZE(arr) (sizeof(arr) / sizeof(*(arr))) #endif -/* ARRAY_SET_ITEMS#(v, ...): set indices of array 'v' */ +/* ARRAY_SET_ITEMS#(v, ...): set indices of array 'v' */ /* internal helpers */ #define _VA_ARRAY_SET_ITEMS2(v, a) ((v)[0] = (a)) #define _VA_ARRAY_SET_ITEMS3(v, a, b) \ diff --git a/source/blender/blenlib/BLI_vector.hh b/source/blender/blenlib/BLI_vector.hh index f6f546c90b9..0e878d549c1 100644 --- a/source/blender/blenlib/BLI_vector.hh +++ b/source/blender/blenlib/BLI_vector.hh @@ -963,7 +963,7 @@ class Vector { } /* At least double the size of the previous allocation. Otherwise consecutive calls to grow can - * cause a reallocation every time even though min_capacity only increments. */ + * cause a reallocation every time even though min_capacity only increments. */ const int64_t min_new_capacity = this->capacity() * 2; const int64_t new_capacity = std::max(min_capacity, min_new_capacity); diff --git a/source/blender/blenlib/CMakeLists.txt b/source/blender/blenlib/CMakeLists.txt index e04f3c1b19d..677df9db026 100644 --- a/source/blender/blenlib/CMakeLists.txt +++ b/source/blender/blenlib/CMakeLists.txt @@ -20,7 +20,7 @@ set(INC . - # ../blenkernel # dont add this back! + # ../blenkernel # don't add this back! ../makesdna ../../../intern/atomic ../../../intern/eigen @@ -103,6 +103,7 @@ set(SRC intern/math_rotation.c intern/math_solvers.c intern/math_statistics.c + intern/math_time.c intern/math_vec.cc intern/math_vector.c intern/math_vector_inline.c @@ -241,6 +242,7 @@ set(SRC BLI_math_rotation.h BLI_math_solvers.h BLI_math_statistics.h + BLI_math_time.h BLI_math_vector.h BLI_memarena.h BLI_memblock.h @@ -419,6 +421,7 @@ if(WITH_GTESTS) tests/BLI_math_matrix_test.cc tests/BLI_math_rotation_test.cc tests/BLI_math_solvers_test.cc + tests/BLI_math_time_test.cc tests/BLI_math_vector_test.cc tests/BLI_memiter_test.cc tests/BLI_memory_utils_test.cc diff --git a/source/blender/blenlib/intern/BLI_dynstr.c b/source/blender/blenlib/intern/BLI_dynstr.c index 7b25fecfa45..5255e8b9902 100644 --- a/source/blender/blenlib/intern/BLI_dynstr.c +++ b/source/blender/blenlib/intern/BLI_dynstr.c @@ -166,7 +166,7 @@ void BLI_dynstr_vappendf(DynStr *__restrict ds, const char *__restrict format, v message = MEM_callocN(sizeof(char) * len, "BLI_dynstr_appendf"); } - /* cant reuse the same args, so work on a copy */ + /* can't reuse the same args, so work on a copy */ va_copy(args_cpy, args); retval = vsnprintf(message, len, format, args_cpy); va_end(args_cpy); diff --git a/source/blender/blenlib/intern/BLI_filelist.c b/source/blender/blenlib/intern/BLI_filelist.c index cc01693422c..55fd28667fc 100644 --- a/source/blender/blenlib/intern/BLI_filelist.c +++ b/source/blender/blenlib/intern/BLI_filelist.c @@ -26,7 +26,7 @@ # include <dirent.h> #endif -#include <string.h> /* strcpy etc.. */ +#include <string.h> /* #strcpy etc. */ #include <sys/stat.h> #include <time.h> diff --git a/source/blender/blenlib/intern/DLRB_tree.c b/source/blender/blenlib/intern/DLRB_tree.c index b0c3379ac97..09234dcfa26 100644 --- a/source/blender/blenlib/intern/DLRB_tree.c +++ b/source/blender/blenlib/intern/DLRB_tree.c @@ -414,7 +414,7 @@ static void rotate_right(DLRBT_Tree *tree, DLRBT_Node *root) } /* *********************************************** */ -/* Post-Insertion Balancing */ +/* Post-Insertion Balancing */ /* forward defines for insertion checks */ static void insert_check_1(DLRBT_Tree *tree, DLRBT_Node *node); @@ -472,7 +472,7 @@ static void insert_check_2(DLRBT_Tree *tree, DLRBT_Node *node) } } -/* W. 4+5) Perform rotation on sub-tree containing the 'new' node, then do any */ +/* W. 4+5) Perform rotation on sub-tree containing the 'new' node, then do any. */ static void insert_check_3(DLRBT_Tree *tree, DLRBT_Node *node) { DLRBT_Node *gp = get_grandparent(node); diff --git a/source/blender/blenlib/intern/array_store.c b/source/blender/blenlib/intern/array_store.c index b694f9c7fc0..250915383cf 100644 --- a/source/blender/blenlib/intern/array_store.c +++ b/source/blender/blenlib/intern/array_store.c @@ -192,7 +192,7 @@ /* Disallow chunks bigger than the regular chunk size scaled by this value * note: must be at least 2! - * however, this code runs wont run in tests unless its ~1.1 ugh. + * however, this code runs won't run in tests unless it's ~1.1 ugh. * so lower only to check splitting works. */ # define BCHUNK_SIZE_MAX_MUL 2 diff --git a/source/blender/blenlib/intern/boxpack_2d.c b/source/blender/blenlib/intern/boxpack_2d.c index 84b3f728884..ea6c2d8d498 100644 --- a/source/blender/blenlib/intern/boxpack_2d.c +++ b/source/blender/blenlib/intern/boxpack_2d.c @@ -290,7 +290,7 @@ static int vertex_sort(const void *p1, const void *p2, void *vs_ctx_p) * to have some way of writing the boxes back to the original data. * \param len: the number of boxes in the array. * \param r_tot_x, r_tot_y: set so you can normalize the data. - * */ + */ void BLI_box_pack_2d(BoxPack *boxarray, const uint len, float *r_tot_x, float *r_tot_y) { uint box_index, verts_pack_len, i, j, k; @@ -298,8 +298,8 @@ void BLI_box_pack_2d(BoxPack *boxarray, const uint len, float *r_tot_x, float *r bool isect; float tot_x = 0.0f, tot_y = 0.0f; - BoxPack *box, *box_test; /*current box and another for intersection tests*/ - BoxVert *vert; /* the current vert */ + BoxPack *box, *box_test; /* Current box and another for intersection tests. */ + BoxVert *vert; /* The current vert. */ struct VertSortContext vs_ctx; @@ -312,7 +312,7 @@ void BLI_box_pack_2d(BoxPack *boxarray, const uint len, float *r_tot_x, float *r /* Sort boxes, biggest first */ qsort(boxarray, (size_t)len, sizeof(BoxPack), box_areasort); - /* add verts to the boxes, these are only used internally */ + /* Add verts to the boxes, these are only used internally. */ vert = MEM_mallocN(sizeof(BoxVert[4]) * (size_t)len, "BoxPack Verts"); vertex_pack_indices = MEM_mallocN(sizeof(int[3]) * (size_t)len, "BoxPack Indices"); @@ -357,7 +357,7 @@ void BLI_box_pack_2d(BoxPack *boxarray, const uint len, float *r_tot_x, float *r /* Pack the First box! * then enter the main box-packing loop */ - box = boxarray; /* get the first box */ + box = boxarray; /* Get the first box. */ /* First time, no boxes packed */ box->v[BL]->free = 0; /* Can't use any if these */ box->v[BR]->free &= ~(BLF | BRF); diff --git a/source/blender/blenlib/intern/delaunay_2d.cc b/source/blender/blenlib/intern/delaunay_2d.cc index 9444d1a29cb..eb3e64c49e6 100644 --- a/source/blender/blenlib/intern/delaunay_2d.cc +++ b/source/blender/blenlib/intern/delaunay_2d.cc @@ -226,6 +226,8 @@ template<typename Arith_t> struct CDTFace { int visit_index{0}; /** Marks this face no longer used. */ bool deleted{false}; + /** Marks this face as part of a hole. */ + bool hole{false}; CDTFace() = default; }; @@ -481,9 +483,9 @@ template<typename T> void cdt_draw(const std::string &label, const CDTArrangemen * This is just for developer debugging anyway, and should never be called in production Blender. */ # ifdef _WIN32 - const char *drawfile = "./debug_draw.html"; + const char *drawfile = "./cdt_debug_draw.html"; # else - const char *drawfile = "/tmp/debug_draw.html"; + const char *drawfile = "/tmp/cdt_debug_draw.html"; # endif constexpr int max_draw_width = 1800; constexpr int max_draw_height = 1600; @@ -2364,9 +2366,6 @@ template<typename T> void remove_non_constraint_edges_leave_valid_bmesh(CDT_stat template<typename T> void remove_outer_edges_until_constraints(CDT_state<T> *cdt_state) { - // LinkNode *fstack = NULL; - // SymEdge *se, *se_start; - // CDTFace *f, *fsym; int visit = ++cdt_state->visit_count; cdt_state->cdt.outer_face->visit_index = visit; @@ -2415,6 +2414,137 @@ template<typename T> void remove_outer_edges_until_constraints(CDT_state<T> *cdt } } +template<typename T> void remove_faces_in_holes(CDT_state<T> *cdt_state) +{ + CDTArrangement<T> *cdt = &cdt_state->cdt; + for (int i : cdt->faces.index_range()) { + CDTFace<T> *f = cdt->faces[i]; + if (!f->deleted && f->hole) { + f->deleted = true; + SymEdge<T> *se = f->symedge; + SymEdge<T> *se_start = se; + SymEdge<T> *se_next = nullptr; + do { + BLI_assert(se != nullptr); + se_next = se->next; /* In case we delete this edge. */ + if (se->edge && !is_constrained_edge(se->edge)) { + /* Invalidate one half of this edge. The other has will be or has been + * handled with the adjacent triangle is processed: it should be part of the same hole. + */ + se->next = nullptr; + } + se = se_next; + } while (se != se_start); + } + } +} + +/** + * Set the hole member of each CDTFace to true for each face that is detected to be part of a + * hole. A hole face is define as one for which, when a ray is shot from a point inside the face + * to infinity, it crosses an even number of constraint edges. We'll choose a ray direction that + * is extremely unlikely to exactly superimpose some edge, so avoiding the need to be careful + * about such overlaps. + * + * To improve performance, we gather together faces that should have the same winding number, and + * only shoot rays once. + */ +template<typename T> void detect_holes(CDT_state<T> *cdt_state) +{ + CDTArrangement<T> *cdt = &cdt_state->cdt; + + /* Make it so that each face with the same visit_index is connected through a path of + * non-constraint edges. */ + Vector<CDTFace<T> *> fstack; + Vector<CDTFace<T> *> region_rep_face; + for (int i : cdt->faces.index_range()) { + cdt->faces[i]->visit_index = -1; + } + int cur_region = -1; + cdt->outer_face->visit_index = -2; /* Don't visit this one. */ + for (int i : cdt->faces.index_range()) { + CDTFace<T> *f = cdt->faces[i]; + if (!f->deleted && f->symedge && f->visit_index == -1) { + fstack.append(f); + ++cur_region; + region_rep_face.append(f); + while (!fstack.is_empty()) { + CDTFace<T> *f = fstack.pop_last(); + if (f->visit_index != -1) { + continue; + } + f->visit_index = cur_region; + SymEdge<T> *se_start = f->symedge; + SymEdge<T> *se = se_start; + do { + if (se->edge && !is_constrained_edge(se->edge)) { + CDTFace<T> *fsym = sym(se)->face; + if (fsym && !fsym->deleted && fsym->visit_index == -1) { + fstack.append(fsym); + } + } + se = se->next; + } while (se != se_start); + } + } + } + cdt_state->visit_count = ++cur_region; /* Good start for next use of visit_count. */ + + /* Now get hole status for each region_rep_face. */ + + /* Pick a ray end almost certain to be outside everything and in direction + * that is unlikely to hit a vertex or overlap an edge exactly. */ + FatCo<T> ray_end; + ray_end.exact = vec2<T>(123456, 654321); + for (int i : region_rep_face.index_range()) { + CDTFace<T> *f = region_rep_face[i]; + FatCo<T> mid; + mid.exact[0] = (f->symedge->vert->co.exact[0] + f->symedge->next->vert->co.exact[0] + + f->symedge->next->next->vert->co.exact[0]) / + 3; + mid.exact[1] = (f->symedge->vert->co.exact[1] + f->symedge->next->vert->co.exact[1] + + f->symedge->next->next->vert->co.exact[1]) / + 3; + int hits = 0; + /* TODO: Use CDT data structure here to greatly reduce search for intersections! */ + for (const CDTEdge<T> *e : cdt->edges) { + if (!is_deleted_edge(e) && is_constrained_edge(e)) { + if (e->symedges[0].face->visit_index == e->symedges[1].face->visit_index) { + continue; /* Don't count hits on edges between faces in same region. */ + } + auto isect = vec2<T>::isect_seg_seg(ray_end.exact, + mid.exact, + e->symedges[0].vert->co.exact, + e->symedges[1].vert->co.exact); + switch (isect.kind) { + case vec2<T>::isect_result::LINE_LINE_CROSS: { + hits++; + break; + } + case vec2<T>::isect_result::LINE_LINE_EXACT: + case vec2<T>::isect_result::LINE_LINE_NONE: + case vec2<T>::isect_result::LINE_LINE_COLINEAR: + break; + } + } + } + f->hole = (hits % 2) == 0; + } + + /* Finally, propagate hole status to all holes of a region. */ + for (int i : cdt->faces.index_range()) { + CDTFace<T> *f = cdt->faces[i]; + int region = f->visit_index; + if (region < 0) { + continue; + } + CDTFace<T> *f_region_rep = region_rep_face[region]; + if (i >= 0) { + f->hole = f_region_rep->hole; + } + } +} + /** * Remove edges and merge faces to get desired output, as per options. * \note the cdt cannot be further changed after this. @@ -2439,6 +2569,13 @@ void prepare_cdt_for_output(CDT_state<T> *cdt_state, const CDT_output_type outpu } } + bool need_holes = output_type == CDT_INSIDE_WITH_HOLES || + output_type == CDT_CONSTRAINTS_VALID_BMESH_WITH_HOLES; + + if (need_holes) { + detect_holes(cdt_state); + } + if (output_type == CDT_CONSTRAINTS) { remove_non_constraint_edges(cdt_state); } @@ -2448,6 +2585,14 @@ void prepare_cdt_for_output(CDT_state<T> *cdt_state, const CDT_output_type outpu else if (output_type == CDT_INSIDE) { remove_outer_edges_until_constraints(cdt_state); } + else if (output_type == CDT_INSIDE_WITH_HOLES) { + remove_outer_edges_until_constraints(cdt_state); + remove_faces_in_holes(cdt_state); + } + else if (output_type == CDT_CONSTRAINTS_VALID_BMESH_WITH_HOLES) { + remove_non_constraint_edges_leave_valid_bmesh(cdt_state); + remove_faces_in_holes(cdt_state); + } } template<typename T> diff --git a/source/blender/blenlib/intern/expr_pylike_eval.c b/source/blender/blenlib/intern/expr_pylike_eval.c index f8618c54ea4..a5d4130cb20 100644 --- a/source/blender/blenlib/intern/expr_pylike_eval.c +++ b/source/blender/blenlib/intern/expr_pylike_eval.c @@ -66,29 +66,29 @@ * \{ */ typedef enum eOpCode { - /* Double constant: (-> dval) */ + /* Double constant: (-> dval). */ OPCODE_CONST, - /* 1 argument function call: (a -> func1(a)) */ + /* 1 argument function call: (a -> func1(a)). */ OPCODE_FUNC1, - /* 2 argument function call: (a b -> func2(a,b)) */ + /* 2 argument function call: (a b -> func2(a,b)). */ OPCODE_FUNC2, - /* 3 argument function call: (a b c -> func3(a,b,c)) */ + /* 3 argument function call: (a b c -> func3(a,b,c)). */ OPCODE_FUNC3, /* Parameter access: (-> params[ival]) */ OPCODE_PARAMETER, - /* Minimum of multiple inputs: (a b c... -> min); ival = arg count */ + /* Minimum of multiple inputs: (a b c... -> min); ival = arg count. */ OPCODE_MIN, - /* Maximum of multiple inputs: (a b c... -> max); ival = arg count */ + /* Maximum of multiple inputs: (a b c... -> max); ival = arg count. */ OPCODE_MAX, /* Jump (pc += jmp_offset) */ OPCODE_JMP, - /* Pop and jump if zero: (a -> ); JUMP IF NOT a */ + /* Pop and jump if zero: (a -> ); JUMP IF NOT a. */ OPCODE_JMP_ELSE, - /* Jump if nonzero, or pop: (a -> a JUMP) IF a ELSE (a -> ) */ + /* Jump if nonzero, or pop: (a -> a JUMP) IF a ELSE (a -> ). */ OPCODE_JMP_OR, - /* Jump if zero, or pop: (a -> a JUMP) IF NOT a ELSE (a -> ) */ + /* Jump if zero, or pop: (a -> a JUMP) IF NOT a ELSE (a -> ). */ OPCODE_JMP_AND, - /* For comparison chaining: (a b -> 0 JUMP) IF NOT func2(a,b) ELSE (a b -> b) */ + /* For comparison chaining: (a b -> 0 JUMP) IF NOT func2(a,b) ELSE (a b -> b). */ OPCODE_CMP_CHAIN, } eOpCode; diff --git a/source/blender/blenlib/intern/fnmatch.c b/source/blender/blenlib/intern/fnmatch.c index 33fe34e7c24..6709dfda1be 100644 --- a/source/blender/blenlib/intern/fnmatch.c +++ b/source/blender/blenlib/intern/fnmatch.c @@ -239,7 +239,7 @@ fnmatch (const char *pattern, const char *string, int flags) # undef FOLD } -#endif /* _LIBC or not __GNU_LIBRARY__. */ +#endif /* _LIBC or not __GNU_LIBRARY__. */ /* clang-format on */ diff --git a/source/blender/blenlib/intern/hash_md5.c b/source/blender/blenlib/intern/hash_md5.c index 8c869ce28c3..3db1b7df0fa 100644 --- a/source/blender/blenlib/intern/hash_md5.c +++ b/source/blender/blenlib/intern/hash_md5.c @@ -92,7 +92,7 @@ struct md5_ctx { /* This array contains the bytes used to pad the buffer to the next 64-byte boundary. * (RFC 1321, 3.1: Step 1) */ -static const unsigned char fillbuf[64] = {0x80, 0 /* , 0, 0, ... */}; +static const unsigned char fillbuf[64] = {0x80, 0 /* , 0, 0, ... */}; /** * Initialize structure containing state of computation. @@ -136,7 +136,7 @@ static void md5_process_block(const void *buffer, size_t len, struct md5_ctx *ct md5_uint32 C = ctx->C; md5_uint32 D = ctx->D; - /* Process all bytes in the buffer with 64 bytes in each round of the loop. */ + /* Process all bytes in the buffer with 64 bytes in each round of the loop. */ while (words < endp) { md5_uint32 *cwp = correct_words; md5_uint32 A_save = A; @@ -161,7 +161,7 @@ static void md5_process_block(const void *buffer, size_t len, struct md5_ctx *ct * T[i] = (int) (4294967296.0 * fabs (sin (i))), i=1..64 */ - /* Round 1. */ + /* Round 1. */ OP(A, B, C, D, 7, 0xd76aa478); OP(D, A, B, C, 12, 0xe8c7b756); OP(C, D, A, B, 17, 0x242070db); @@ -190,7 +190,7 @@ static void md5_process_block(const void *buffer, size_t len, struct md5_ctx *ct a += b; \ (void)0 - /* Round 2. */ + /* Round 2. */ OP(FG, A, B, C, D, 1, 5, 0xf61e2562); OP(FG, D, A, B, C, 6, 9, 0xc040b340); OP(FG, C, D, A, B, 11, 14, 0x265e5a51); @@ -208,7 +208,7 @@ static void md5_process_block(const void *buffer, size_t len, struct md5_ctx *ct OP(FG, C, D, A, B, 7, 14, 0x676f02d9); OP(FG, B, C, D, A, 12, 20, 0x8d2a4c8a); - /* Round 3. */ + /* Round 3. */ OP(FH, A, B, C, D, 5, 4, 0xfffa3942); OP(FH, D, A, B, C, 8, 11, 0x8771f681); OP(FH, C, D, A, B, 11, 16, 0x6d9d6122); @@ -226,7 +226,7 @@ static void md5_process_block(const void *buffer, size_t len, struct md5_ctx *ct OP(FH, C, D, A, B, 15, 16, 0x1fa27cf8); OP(FH, B, C, D, A, 2, 23, 0xc4ac5665); - /* Round 4. */ + /* Round 4. */ OP(FI, A, B, C, D, 0, 6, 0xf4292244); OP(FI, D, A, B, C, 7, 10, 0x432aff97); OP(FI, C, D, A, B, 14, 15, 0xab9423a7); @@ -246,14 +246,14 @@ static void md5_process_block(const void *buffer, size_t len, struct md5_ctx *ct #undef OP - /* Add the starting values of the context. */ + /* Add the starting values of the context. */ A += A_save; B += B_save; C += C_save; D += D_save; } - /* Put checksum in context given as argument. */ + /* Put checksum in context given as argument. */ ctx->A = A; ctx->B = B; ctx->C = C; @@ -330,7 +330,7 @@ int BLI_hash_md5_stream(FILE *stream, void *resblock) ++len[1]; } - /* If end of file is reached, end the loop. */ + /* If end of file is reached, end the loop. */ if (n == 0) { break; } @@ -354,10 +354,10 @@ int BLI_hash_md5_stream(FILE *stream, void *resblock) *(md5_uint32 *)&buffer[sum + pad] = SWAP(len[0] << 3); *(md5_uint32 *)&buffer[sum + pad + 4] = SWAP((len[1] << 3) | (len[0] >> 29)); - /* Process last bytes. */ + /* Process last bytes. */ md5_process_block(buffer, sum + pad + 8, &ctx); - /* Construct result in desired memory. */ + /* Construct result in desired memory. */ md5_read_ctx(&ctx, resblock); return 0; } @@ -374,15 +374,15 @@ void *BLI_hash_md5_buffer(const char *buffer, size_t len, void *resblock) size_t blocks = len & ~63; size_t pad, rest; - /* Initialize the computation context. */ + /* Initialize the computation context. */ md5_init_ctx(&ctx); - /* Process whole buffer but last len % 64 bytes. */ + /* Process whole buffer but last len % 64 bytes. */ md5_process_block(buffer, blocks, &ctx); - /* REST bytes are not processed yet. */ + /* REST bytes are not processed yet. */ rest = len - blocks; - /* Copy to own buffer. */ + /* Copy to own buffer. */ memcpy(restbuf, &buffer[blocks], rest); /* Append needed fill bytes at end of buffer. * We can copy 64 bytes because the buffer is always big enough. */ diff --git a/source/blender/blenlib/intern/kdtree_impl.h b/source/blender/blenlib/intern/kdtree_impl.h index c92dc2e95a3..2a0e8b3ec68 100644 --- a/source/blender/blenlib/intern/kdtree_impl.h +++ b/source/blender/blenlib/intern/kdtree_impl.h @@ -882,7 +882,7 @@ static void deduplicate_recursive(const struct DeDuplicateParams *p, uint i) * although it can still be used as a target. * \returns The number of merges found (includes any merges already in the \a duplicates array). * - * \note Merging is always a single step (target indices wont be marked for merging). + * \note Merging is always a single step (target indices won't be marked for merging). */ int BLI_kdtree_nd_(calc_duplicates_fast)(const KDTree *tree, const float range, diff --git a/source/blender/blenlib/intern/math_base_inline.c b/source/blender/blenlib/intern/math_base_inline.c index c1db9ec1a69..58b109eca10 100644 --- a/source/blender/blenlib/intern/math_base_inline.c +++ b/source/blender/blenlib/intern/math_base_inline.c @@ -192,14 +192,14 @@ MINLINE double ratiod(double min, double max, double pos) return range == 0 ? 0 : ((pos - min) / range); } -/* Map a normalized value, i.e. from interval [0, 1] to interval [a, b] */ +/* Map a normalized value, i.e. from interval [0, 1] to interval [a, b]. */ MINLINE float scalenorm(float a, float b, float x) { BLI_assert(x <= 1 && x >= 0); return (x * (b - a)) + a; } -/* used for zoom values*/ +/* Used for zoom values. */ MINLINE float power_of_2(float val) { return (float)pow(2.0, ceil(log((double)val) / M_LN2)); @@ -760,7 +760,7 @@ MALWAYS_INLINE __m128 _bli_math_fastpow24(const __m128 arg) __m128 x = _bli_math_fastpow(0x3F4CCCCD, 0x4F55A7FB, arg); __m128 arg2 = _mm_mul_ps(arg, arg); __m128 arg4 = _mm_mul_ps(arg2, arg2); - /* error max = 0.018 avg = 0.0031 |avg| = 0.0031 */ + /* error max = 0.018 avg = 0.0031 |avg| = 0.0031 */ x = _bli_math_improve_5throot_solution(x, arg4); /* error max = 0.00021 avg = 1.6e-05 |avg| = 1.6e-05 */ x = _bli_math_improve_5throot_solution(x, arg4); diff --git a/source/blender/blenlib/intern/math_color.c b/source/blender/blenlib/intern/math_color.c index abcb3139dc7..67c4ad95d79 100644 --- a/source/blender/blenlib/intern/math_color.c +++ b/source/blender/blenlib/intern/math_color.c @@ -478,7 +478,7 @@ void minmax_rgb(short c[3]) * accessible from the given triple of primaries. Desaturate * it by adding white, equal quantities of R, G, and B, enough * to make RGB all positive. The function returns 1 if the - * components were modified, zero otherwise.*/ + * components were modified, zero otherwise. */ int constrain_rgb(float *r, float *g, float *b) { /* Amount of white needed */ diff --git a/source/blender/blenlib/intern/math_geom.c b/source/blender/blenlib/intern/math_geom.c index 0a5dc8517d8..3175bf116a0 100644 --- a/source/blender/blenlib/intern/math_geom.c +++ b/source/blender/blenlib/intern/math_geom.c @@ -856,7 +856,7 @@ void dist_squared_to_projected_aabb_precalc(struct DistProjectedAABBPrecalc *pre } #else if (!isect_plane_plane_v3(px, py, precalc->ray_origin, precalc->ray_direction)) { - /* Matrix with weird coplanar planes. Undetermined origin.*/ + /* Matrix with weird co-planar planes. Undetermined origin. */ zero_v3(precalc->ray_origin); precalc->ray_direction[0] = precalc->pmat[0][3]; precalc->ray_direction[1] = precalc->pmat[1][3]; @@ -2133,7 +2133,7 @@ bool isect_ray_line_v3(const float ray_origin[3], const float nlen = len_squared_v3(n); if (nlen == 0.0f) { - /* the lines are parallel.*/ + /* The lines are parallel. */ return false; } @@ -2903,7 +2903,7 @@ bool isect_sweeping_sphere_tri_v3(const float p1[3], /*---test edges---*/ sub_v3_v3v3(e3, v2, v1); /* wasn't yet calculated */ - /*e1*/ + /* `e1` */ sub_v3_v3v3(bv, v0, p1); elen2 = dot_v3v3(e1, e1); @@ -2926,8 +2926,8 @@ bool isect_sweeping_sphere_tri_v3(const float p1[3], } } - /*e2*/ - /*bv is same*/ + /* `e2` */ + /* `bv` is same. */ elen2 = dot_v3v3(e2, e2); edotv = dot_v3v3(e2, vel); edotbv = dot_v3v3(e2, bv); @@ -2948,11 +2948,11 @@ bool isect_sweeping_sphere_tri_v3(const float p1[3], } } - /*e3*/ - /* sub_v3_v3v3(bv, v0, p1); */ /* UNUSED */ - /* elen2 = dot_v3v3(e1, e1); */ /* UNUSED */ - /* edotv = dot_v3v3(e1, vel); */ /* UNUSED */ - /* edotbv = dot_v3v3(e1, bv); */ /* UNUSED */ + /* `e3` */ + // sub_v3_v3v3(bv, v0, p1); /* UNUSED */ + // elen2 = dot_v3v3(e1, e1); /* UNUSED */ + // edotv = dot_v3v3(e1, vel); /* UNUSED */ + // edotbv = dot_v3v3(e1, bv); /* UNUSED */ sub_v3_v3v3(bv, v1, p1); elen2 = dot_v3v3(e3, e3); @@ -4642,7 +4642,7 @@ void resolve_quad_uv_v2_deriv(float r_uv[2], (st3[0] * st0[1] - st3[1] * st0[0]); /* X is 2D cross product (determinant) - * A = (p0 - p) X (p0 - p3)*/ + * A = (p0 - p) X (p0 - p3) */ const double a = (st0[0] - st[0]) * (st0[1] - st3[1]) - (st0[1] - st[1]) * (st0[0] - st3[0]); /* B = ( (p0 - p) X (p1 - p2) + (p1 - p) X (p0 - p3) ) / 2 */ @@ -4731,7 +4731,7 @@ float resolve_quad_u_v2(const float st[2], (st3[0] * st0[1] - st3[1] * st0[0]); /* X is 2D cross product (determinant) - * A = (p0 - p) X (p0 - p3)*/ + * A = (p0 - p) X (p0 - p3) */ const double a = (st0[0] - st[0]) * (st0[1] - st3[1]) - (st0[1] - st[1]) * (st0[0] - st3[0]); /* B = ( (p0 - p) X (p1 - p2) + (p1 - p) X (p0 - p3) ) / 2 */ @@ -4911,8 +4911,8 @@ void window_translate_m4(float winmat[4][4], float perspmat[4][4], const float x void planes_from_projmat(const float mat[4][4], float left[4], float right[4], - float top[4], float bottom[4], + float top[4], float near[4], float far[4]) { @@ -6244,12 +6244,12 @@ float cubic_tangent_factor_circle_v3(const float tan_l[3], const float tan_r[3]) BLI_ASSERT_UNIT_V3(tan_l); BLI_ASSERT_UNIT_V3(tan_r); - /* -7f causes instability/glitches with Bendy Bones + Custom Refs */ + /* -7f causes instability/glitches with Bendy Bones + Custom Refs. */ const float eps = 1e-5f; const float tan_dot = dot_v3v3(tan_l, tan_r); if (tan_dot > 1.0f - eps) { - /* no angle difference (use fallback, length wont make any difference) */ + /* no angle difference (use fallback, length won't make any difference) */ return (1.0f / 3.0f) * 0.75f; } if (tan_dot < -1.0f + eps) { diff --git a/source/blender/blenlib/intern/math_geom_inline.c b/source/blender/blenlib/intern/math_geom_inline.c index 23c351026f2..655d3fcc4c0 100644 --- a/source/blender/blenlib/intern/math_geom_inline.c +++ b/source/blender/blenlib/intern/math_geom_inline.c @@ -244,10 +244,13 @@ MINLINE int min_axis_v3(const float vec[3]) } /** - * Simple method to find how many tri's we need when we already know the corner+poly count. + * Simple function to either: + * - Calculate how many triangles needed from the total number of polygons + loops. + * - Calculate the first triangle index from the polygon index & that polygons loop-start. * - * \param poly_count: The number of ngon's/tris (1-2 sided faces will give incorrect results) - * \param corner_count: also known as loops in BMesh/DNA + * \param poly_count: The number of polygons or polygon-index + * (3+ sided faces, 1-2 sided give incorrect results). + * \param corner_count: The number of corners (also called loop-index). */ MINLINE int poly_to_tri_count(const int poly_count, const int corner_count) { diff --git a/source/blender/blenlib/intern/math_matrix.c b/source/blender/blenlib/intern/math_matrix.c index d447da4de64..5eb0125062d 100644 --- a/source/blender/blenlib/intern/math_matrix.c +++ b/source/blender/blenlib/intern/math_matrix.c @@ -2665,7 +2665,7 @@ void loc_eul_size_to_mat4(float R[4][4], size_to_mat3(smat, size); mul_m3_m3m3(tmat, rmat, smat); - /* copy rot/scale part to output matrix*/ + /* Copy rot/scale part to output matrix. */ copy_m4_m3(R, tmat); /* copy location to matrix */ @@ -2686,18 +2686,18 @@ void loc_eulO_size_to_mat4(float R[4][4], { float rmat[3][3], smat[3][3], tmat[3][3]; - /* initialize new matrix */ + /* Initialize new matrix. */ unit_m4(R); - /* make rotation + scaling part */ + /* Make rotation + scaling part. */ eulO_to_mat3(rmat, eul, rotOrder); size_to_mat3(smat, size); mul_m3_m3m3(tmat, rmat, smat); - /* copy rot/scale part to output matrix*/ + /* Copy rot/scale part to output matrix. */ copy_m4_m3(R, tmat); - /* copy location to matrix */ + /* Copy location to matrix. */ R[3][0] = loc[0]; R[3][1] = loc[1]; R[3][2] = loc[2]; @@ -2722,7 +2722,7 @@ void loc_quat_size_to_mat4(float R[4][4], size_to_mat3(smat, size); mul_m3_m3m3(tmat, rmat, smat); - /* copy rot/scale part to output matrix*/ + /* Copy rot/scale part to output matrix. */ copy_m4_m3(R, tmat); /* copy location to matrix */ diff --git a/source/blender/blenlib/intern/math_rotation.c b/source/blender/blenlib/intern/math_rotation.c index 57fe99ce019..52737de227b 100644 --- a/source/blender/blenlib/intern/math_rotation.c +++ b/source/blender/blenlib/intern/math_rotation.c @@ -1924,6 +1924,31 @@ void eulO_to_gimbal_axis(float gmat[3][3], const float eul[3], const short order gmat[R->axis[2]][R->axis[2]] = 1; } +void add_eul_euleul(float r_eul[3], float a[3], float b[3], const short order) +{ + float quat[4], quat_b[4]; + + eulO_to_quat(quat, a, order); + eulO_to_quat(quat_b, b, order); + + mul_qt_qtqt(quat, quat_b, quat); + + quat_to_eulO(r_eul, order, quat); +} + +void sub_eul_euleul(float r_eul[3], float a[3], float b[3], const short order) +{ + float quat[4], quat_b[4]; + + eulO_to_quat(quat, a, order); + eulO_to_quat(quat_b, b, order); + + invert_qt_normalized(quat_b); + mul_qt_qtqt(quat, quat_b, quat); + + quat_to_eulO(r_eul, order, quat); +} + /******************************* Dual Quaternions ****************************/ /** @@ -1974,7 +1999,7 @@ void mat4_to_dquat(DualQuat *dq, const float basemat[4][4], const float mat[4][4 if (!is_orthonormal_m3(mat3) || (determinant_m4(mat) < 0.0f) || len_squared_v3(dscale) > square_f(1e-4f)) { - /* extract R and S */ + /* Extract R and S. */ float tmp[4][4]; /* extra orthogonalize, to avoid flipping with stretched bones */ diff --git a/source/blender/blenlib/intern/math_time.c b/source/blender/blenlib/intern/math_time.c new file mode 100644 index 00000000000..b85de7817dd --- /dev/null +++ b/source/blender/blenlib/intern/math_time.c @@ -0,0 +1,70 @@ +/* + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2021 by Blender Foundation. + * All rights reserved. + */ + +/** \file + * \ingroup bli + */ + +#include "BLI_math.h" + +/** Explode given time value expressed in seconds, into a set of days, hours, minutes, seconds + * and/or milliseconds (depending on which return parameters are not NULL). + * + * \note The smallest given return parameter will get the potential fractional remaining time + * value. E.g. if you give `seconds=90.0` and do not pass `r_seconds` and `r_milliseconds`, + * `r_minutes` will be set to `1.5`. + */ +void BLI_math_time_seconds_decompose(double seconds, + double *r_days, + double *r_hours, + double *r_minutes, + double *r_seconds, + double *r_milliseconds) +{ + BLI_assert(r_days != NULL || r_hours != NULL || r_minutes != NULL || r_seconds != NULL || + r_milliseconds != NULL); + + if (r_days != NULL) { + seconds = modf(seconds / SECONDS_IN_DAY, r_days) * SECONDS_IN_DAY; + } + if (r_hours != NULL) { + seconds = modf(seconds / SECONDS_IN_HOUR, r_hours) * SECONDS_IN_HOUR; + } + if (r_minutes != NULL) { + seconds = modf(seconds / SECONDS_IN_MINUTE, r_minutes) * SECONDS_IN_MINUTE; + } + if (r_seconds != NULL) { + seconds = modf(seconds, r_seconds); + } + if (r_milliseconds != NULL) { + *r_milliseconds = seconds / SECONDS_IN_MILLISECONDS; + } + else if (r_seconds != NULL) { + *r_seconds += seconds; + } + else if (r_minutes != NULL) { + *r_minutes += seconds / SECONDS_IN_MINUTE; + } + else if (r_hours != NULL) { + *r_hours += seconds / SECONDS_IN_HOUR; + } + else if (r_days != NULL) { + *r_days = seconds / SECONDS_IN_DAY; + } +} diff --git a/source/blender/blenlib/intern/mesh_intersect.cc b/source/blender/blenlib/intern/mesh_intersect.cc index 5b7b6d9a929..32f0216951a 100644 --- a/source/blender/blenlib/intern/mesh_intersect.cc +++ b/source/blender/blenlib/intern/mesh_intersect.cc @@ -2246,7 +2246,7 @@ class TriOverlaps { } overlap_tot_ += overlap_tot_; } - /* Sort the overlaps to bring all the intersects with a given indexA together. */ + /* Sort the overlaps to bring all the intersects with a given indexA together. */ std::sort(overlap_, overlap_ + overlap_tot_, bvhtreeverlap_cmp); if (dbg_level > 0) { std::cout << overlap_tot_ << " overlaps found:\n"; diff --git a/source/blender/blenlib/intern/path_util.c b/source/blender/blenlib/intern/path_util.c index e8027836ed6..f3c348b2b44 100644 --- a/source/blender/blenlib/intern/path_util.c +++ b/source/blender/blenlib/intern/path_util.c @@ -180,7 +180,7 @@ void BLI_path_normalize(const char *relabase, char *path) else { if (path[0] == '/' && path[1] == '/') { if (path[2] == '\0') { - return; /* path is "//" - cant clean it */ + return; /* path is "//" - can't clean it */ } path = path + 2; /* leave the initial "//" untouched */ } @@ -236,7 +236,7 @@ void BLI_path_normalize(const char *relabase, char *path) } else { /* support for odd paths: eg /../home/me --> /home/me - * this is a valid path in blender but we cant handle this the usual way below + * this is a valid path in blender but we can't handle this the usual way below * simply strip this prefix then evaluate the path as usual. * pythons os.path.normpath() does this */ @@ -1646,8 +1646,8 @@ bool BLI_path_filename_ensure(char *filepath, size_t maxlen, const char *filenam /** * Converts `/foo/bar.txt` to `/foo/` and `bar.txt` * - * - Wont change \a string. - * - Wont create any directories. + * - Won't change \a string. + * - Won't create any directories. * - Doesn't use CWD, or deal with relative paths. * - Only fill's in \a dir and \a file when they are non NULL. */ diff --git a/source/blender/blenlib/intern/polyfill_2d_beautify.c b/source/blender/blenlib/intern/polyfill_2d_beautify.c index 98fa5c872b0..7425bab885c 100644 --- a/source/blender/blenlib/intern/polyfill_2d_beautify.c +++ b/source/blender/blenlib/intern/polyfill_2d_beautify.c @@ -320,7 +320,7 @@ static void polyedge_rotate(struct HalfEdge *edges, struct HalfEdge *e) * The intention is that this calculates the output of #BLI_polyfill_calc * \note assumes the \a coords form a boundary, * so any edges running along contiguous (wrapped) indices, - * are ignored since the edges wont share 2 faces. + * are ignored since the edges won't share 2 faces. */ void BLI_polyfill_beautify(const float (*coords)[2], const uint coords_tot, diff --git a/source/blender/blenlib/intern/storage.c b/source/blender/blenlib/intern/storage.c index 8964dac31a9..19b925535e2 100644 --- a/source/blender/blenlib/intern/storage.c +++ b/source/blender/blenlib/intern/storage.c @@ -47,7 +47,7 @@ #endif #include <fcntl.h> -#include <string.h> /* strcpy etc.. */ +#include <string.h> /* `strcpy` etc. */ #ifdef WIN32 # include "BLI_string_utf8.h" diff --git a/source/blender/blenlib/intern/string.c b/source/blender/blenlib/intern/string.c index 3d40c6ef146..b2b8d6a0f24 100644 --- a/source/blender/blenlib/intern/string.c +++ b/source/blender/blenlib/intern/string.c @@ -1230,6 +1230,47 @@ void BLI_str_format_byte_unit(char dst[15], long long int bytes, const bool base } /** + * Format a attribute domain to a up to 6 places (plus '\0' terminator) string using long number + * names abbreviations. This function is designed to produce a compact representation of large + * numbers. + * + * 1 -> 1 + * 15 -> 15 + * 155 -> 155 + * 1555 -> 1.6K + * 15555 -> 15.6K + * 155555 -> 156K + * 1555555 -> 1.6M + * 15555555 -> 15.6M + * 155555555 -> 156M + * 1000000000 -> 1B + * ... + * + * Dimension of 7 is the maximum length of the resulting string + * A combination with 7 places would be -15.5K\0 + */ +void BLI_str_format_attribute_domain_size(char dst[7], int number_to_format) +{ + float number_to_format_converted = number_to_format; + int order = 0; + const float base = 1000; + const char *units[] = {"", "K", "M", "B"}; + const int tot_units = ARRAY_SIZE(units); + + while ((fabsf(number_to_format_converted) >= base) && ((order + 1) < tot_units)) { + number_to_format_converted /= base; + order++; + } + + const size_t dst_len = 7; + int decimals = 0; + if ((order > 0) && fabsf(number_to_format_converted) < 100.0f) { + decimals = 1; + } + BLI_snprintf(dst, dst_len, "%.*f%s", decimals, number_to_format_converted, units[order]); +} + +/** * Find the ranges needed to split \a str into its individual words. * * \param str: The string to search for words. diff --git a/source/blender/blenlib/intern/string_utf8.c b/source/blender/blenlib/intern/string_utf8.c index 7aa5930b4ad..3a02ddaa349 100644 --- a/source/blender/blenlib/intern/string_utf8.c +++ b/source/blender/blenlib/intern/string_utf8.c @@ -290,7 +290,7 @@ size_t BLI_strncpy_utf8_rlen(char *__restrict dst, const char *__restrict src, s #undef BLI_STR_UTF8_CPY /* --------------------------------------------------------------------------*/ -/* wchar_t / utf8 functions */ +/* wchar_t / utf8 functions */ size_t BLI_strncpy_wchar_as_utf8(char *__restrict dst, const wchar_t *__restrict src, @@ -401,7 +401,7 @@ size_t BLI_strncpy_wchar_from_utf8(wchar_t *__restrict dst_w, #endif } -/* end wchar_t / utf8 functions */ +/* end wchar_t / utf8 functions */ /* --------------------------------------------------------------------------*/ /* count columns that character/string occupies, based on wcwidth.c */ diff --git a/source/blender/blenlib/intern/string_utils.c b/source/blender/blenlib/intern/string_utils.c index c847f7e1921..6a2ed8fac2c 100644 --- a/source/blender/blenlib/intern/string_utils.c +++ b/source/blender/blenlib/intern/string_utils.c @@ -194,7 +194,7 @@ void BLI_string_flip_side_name(char *r_name, BLI_strncpy(prefix, r_name, name_len); - /* first case; separator . - _ with extensions r R l L */ + /* first case; separator . - _ with extensions r R l L. */ if ((len > 1) && is_char_sep(r_name[len - 2])) { is_set = true; switch (r_name[len - 1]) { diff --git a/source/blender/blenlib/intern/system_win32.c b/source/blender/blenlib/intern/system_win32.c index 7572936592e..f65234b656b 100644 --- a/source/blender/blenlib/intern/system_win32.c +++ b/source/blender/blenlib/intern/system_win32.c @@ -309,7 +309,7 @@ static bool BLI_windows_system_backtrace_stack(FILE *fp) /* If we are handling an exception use the context record from that. */ if (current_exception && current_exception->ExceptionRecord->ExceptionAddress) { /* The back trace code will write to the context record, to protect the original record from - * modifications give the backtrace a copy to work on. */ + * modifications give the backtrace a copy to work on. */ CONTEXT TempContext = *current_exception->ContextRecord; return BLI_windows_system_backtrace_run_trace(fp, GetCurrentThread(), &TempContext); } diff --git a/source/blender/blenlib/intern/winstuff.c b/source/blender/blenlib/intern/winstuff.c index d40f665ba0d..beeae175869 100644 --- a/source/blender/blenlib/intern/winstuff.c +++ b/source/blender/blenlib/intern/winstuff.c @@ -45,7 +45,7 @@ int BLI_windows_get_executable_dir(char *str) { char dir[FILE_MAXDIR]; int a; - /*change to utf support*/ + /* Change to utf support. */ GetModuleFileName(NULL, str, FILE_MAX); BLI_split_dir_part(str, dir, sizeof(dir)); /* shouldn't be relative */ a = strlen(dir); diff --git a/source/blender/blenlib/tests/BLI_delaunay_2d_test.cc b/source/blender/blenlib/tests/BLI_delaunay_2d_test.cc index d00e8bf55fd..59c4be6d952 100644 --- a/source/blender/blenlib/tests/BLI_delaunay_2d_test.cc +++ b/source/blender/blenlib/tests/BLI_delaunay_2d_test.cc @@ -17,6 +17,7 @@ extern "C" { #define DO_CPP_TESTS 1 #define DO_C_TESTS 1 +#define DO_TEXT_TESTS 0 #define DO_RANDOM_TESTS 0 #include "BLI_array.hh" @@ -267,7 +268,7 @@ template<typename T> void graph_draw(const std::string &label, const Array<vec2<T>> &verts, const Array<std::pair<int, int>> &edges, - const Array<Vector<int>> &UNUSED(faces)) + const Array<Vector<int>> &faces) { /* Would like to use BKE_tempdir_base() here, but that brings in dependence on kernel library. * This is just for developer debugging anyway, and should never be called in production Blender. @@ -281,7 +282,7 @@ void graph_draw(const std::string &label, constexpr int max_draw_height = 1000; constexpr int thin_line = 1; constexpr int vert_radius = 3; - constexpr bool draw_vert_labels = true; + constexpr bool draw_vert_labels = false; constexpr bool draw_edge_labels = false; if (verts.size() == 0) { @@ -339,6 +340,15 @@ void graph_draw(const std::string &label, "xml:space=\"preserve\"\n" << "width=\"" << view_width << "\" height=\"" << view_height << "\">n"; + for (const Vector<int> &fverts : faces) { + f << "<polygon fill=\"azure\" stroke=\"none\"\n points=\""; + for (int vi : fverts) { + const vec2<T> &co = verts[vi]; + f << SX(co[0]) << "," << SY(co[1]) << " "; + } + f << "\"\n />\n"; + } + for (const std::pair<int, int> &e : edges) { const vec2<T> &uco = verts[e.first]; const vec2<T> &vco = verts[e.second]; @@ -642,6 +652,110 @@ template<typename T> void lineinsquare_test() if (DO_DRAW) { graph_draw<T>("LineInSquare - constraints", out2.vert, out2.edge, out2.face); } + CDT_result<T> out3 = delaunay_2d_calc(in, CDT_INSIDE_WITH_HOLES); + EXPECT_EQ(out3.vert.size(), 6); + EXPECT_EQ(out3.face.size(), 6); + if (DO_DRAW) { + graph_draw<T>("LineInSquare - inside with holes", out3.vert, out3.edge, out3.face); + } + CDT_result<T> out4 = delaunay_2d_calc(in, CDT_CONSTRAINTS_VALID_BMESH_WITH_HOLES); + EXPECT_EQ(out4.vert.size(), 6); + EXPECT_EQ(out4.face.size(), 2); + if (DO_DRAW) { + graph_draw<T>("LineInSquare - valid bmesh with holes", out4.vert, out4.edge, out4.face); + } +} + +template<typename T> void lineholeinsquare_test() +{ + const char *spec = R"(10 1 2 + -0.5 -0.5 + 0.5 -0.5 + -0.5 0.5 + 0.5 0.5 + -0.25 0.0 + 0.25 0.0 + -0.4 -0.4 + 0.4 -0.4 + 0.4 -0.3 + -0.4 -0.3 + 4 5 + 0 1 3 2 + 6 7 8 9 + )"; + + CDT_input<T> in = fill_input_from_string<T>(spec); + CDT_result<T> out = delaunay_2d_calc(in, CDT_FULL); + EXPECT_EQ(out.vert.size(), 10); + EXPECT_EQ(out.face.size(), 14); + if (DO_DRAW) { + graph_draw<T>("LineHoleInSquare - full", out.vert, out.edge, out.face); + } + CDT_result<T> out2 = delaunay_2d_calc(in, CDT_CONSTRAINTS); + EXPECT_EQ(out2.vert.size(), 10); + EXPECT_EQ(out2.face.size(), 2); + if (DO_DRAW) { + graph_draw<T>("LineHoleInSquare - constraints", out2.vert, out2.edge, out2.face); + } + CDT_result<T> out3 = delaunay_2d_calc(in, CDT_INSIDE_WITH_HOLES); + EXPECT_EQ(out3.vert.size(), 10); + EXPECT_EQ(out3.face.size(), 12); + if (DO_DRAW) { + graph_draw<T>("LineHoleInSquare - inside with holes", out3.vert, out3.edge, out3.face); + } + CDT_result<T> out4 = delaunay_2d_calc(in, CDT_CONSTRAINTS_VALID_BMESH_WITH_HOLES); + EXPECT_EQ(out4.vert.size(), 10); + EXPECT_EQ(out4.face.size(), 2); + if (DO_DRAW) { + graph_draw<T>("LineHoleInSquare - valid bmesh with holes", out4.vert, out4.edge, out4.face); + } +} + +template<typename T> void nestedholes_test() +{ + const char *spec = R"(12 0 3 + -0.5 -0.5 + 0.5 -0.5 + -0.5 0.5 + 0.5 0.5 + -0.4 -0.4 + 0.4 -0.4 + 0.4 0.4 + -0.4 0.4 + -0.2 -0.2 + 0.2 -0.2 + 0.2 0.2 + -0.2 0.2 + 0 1 3 2 + 4 7 6 5 + 8 9 10 11 + )"; + + CDT_input<T> in = fill_input_from_string<T>(spec); + CDT_result<T> out = delaunay_2d_calc(in, CDT_FULL); + EXPECT_EQ(out.vert.size(), 12); + EXPECT_EQ(out.face.size(), 18); + if (DO_DRAW) { + graph_draw<T>("NestedHoles - full", out.vert, out.edge, out.face); + } + CDT_result<T> out2 = delaunay_2d_calc(in, CDT_CONSTRAINTS); + EXPECT_EQ(out2.vert.size(), 12); + EXPECT_EQ(out2.face.size(), 3); + if (DO_DRAW) { + graph_draw<T>("NestedHoles - constraints", out2.vert, out2.edge, out2.face); + } + CDT_result<T> out3 = delaunay_2d_calc(in, CDT_INSIDE_WITH_HOLES); + EXPECT_EQ(out3.vert.size(), 12); + EXPECT_EQ(out3.face.size(), 10); + if (DO_DRAW) { + graph_draw<T>("NestedHoles - inside with holes", out3.vert, out3.edge, out3.face); + } + CDT_result<T> out4 = delaunay_2d_calc(in, CDT_CONSTRAINTS_VALID_BMESH_WITH_HOLES); + EXPECT_EQ(out4.vert.size(), 12); + EXPECT_EQ(out4.face.size(), 3); + if (DO_DRAW) { + graph_draw<T>("NestedHoles - valid bmesh with holes", out4.vert, out4.edge, out4.face); + } } template<typename T> void crosssegs_test() @@ -1025,16 +1139,28 @@ template<typename T> void overlapfaces_test() graph_draw<T>("OverlapFaces - inside", out2.vert, out2.edge, out2.face); } - CDT_result<T> out3 = delaunay_2d_calc(in, CDT_CONSTRAINTS); - EXPECT_EQ(out3.face.size(), 4); + CDT_result<T> out3 = delaunay_2d_calc(in, CDT_INSIDE_WITH_HOLES); + EXPECT_EQ(out3.face.size(), 14); + if (DO_DRAW) { + graph_draw<T>("OverlapFaces - inside with holes", out3.vert, out3.edge, out3.face); + } + + CDT_result<T> out4 = delaunay_2d_calc(in, CDT_CONSTRAINTS); + EXPECT_EQ(out4.face.size(), 4); if (DO_DRAW) { - graph_draw<T>("OverlapFaces - constraints", out3.vert, out3.edge, out3.face); + graph_draw<T>("OverlapFaces - constraints", out4.vert, out4.edge, out4.face); } - CDT_result<T> out4 = delaunay_2d_calc(in, CDT_CONSTRAINTS_VALID_BMESH); - EXPECT_EQ(out4.face.size(), 5); + CDT_result<T> out5 = delaunay_2d_calc(in, CDT_CONSTRAINTS_VALID_BMESH); + EXPECT_EQ(out5.face.size(), 5); if (DO_DRAW) { - graph_draw<T>("OverlapFaces - valid bmesh", out4.vert, out4.edge, out4.face); + graph_draw<T>("OverlapFaces - valid bmesh", out5.vert, out5.edge, out5.face); + } + + CDT_result<T> out6 = delaunay_2d_calc(in, CDT_CONSTRAINTS_VALID_BMESH_WITH_HOLES); + EXPECT_EQ(out6.face.size(), 3); + if (DO_DRAW) { + graph_draw<T>("OverlapFaces - valid bmesh with holes", out6.vert, out6.edge, out6.face); } } @@ -1246,6 +1372,34 @@ template<typename T> void repeattri_test() } } +template<typename T> void square_o_test() +{ + const char *spec = R"(8 0 2 + 0.0 0.0 + 1.0 0.0 + 1.0 1.0 + 0.0 1.0 + 0.2 0.2 + 0.2 0.8 + 0.8 0.8 + 0.8 0.2 + 0 1 2 3 + 4 5 6 7 + )"; + CDT_input<T> in = fill_input_from_string<T>(spec); + CDT_result<T> out1 = delaunay_2d_calc(in, CDT_INSIDE_WITH_HOLES); + EXPECT_EQ(out1.face.size(), 8); + if (DO_DRAW) { + graph_draw<T>("Square O - inside with holes", out1.vert, out1.edge, out1.face); + } + + CDT_result<T> out2 = delaunay_2d_calc(in, CDT_CONSTRAINTS_VALID_BMESH_WITH_HOLES); + EXPECT_EQ(out2.face.size(), 2); + if (DO_DRAW) { + graph_draw<T>("Square O - valid bmesh with holes", out2.vert, out2.edge, out2.face); + } +} + TEST(delaunay_d, Empty) { empty_test<double>(); @@ -1301,6 +1455,16 @@ TEST(delaunay_d, LineInSquare) lineinsquare_test<double>(); } +TEST(delaunay_d, LineHoleInSquare) +{ + lineholeinsquare_test<double>(); +} + +TEST(delaunay_d, NestedHoles) +{ + nestedholes_test<double>(); +} + TEST(delaunay_d, CrossSegs) { crosssegs_test<double>(); @@ -1371,6 +1535,11 @@ TEST(delaunay_d, RepeatTri) repeattri_test<double>(); } +TEST(delaunay_d, SquareO) +{ + square_o_test<double>(); +} + # ifdef WITH_GMP TEST(delaunay_m, Empty) { @@ -1426,6 +1595,16 @@ TEST(delaunay_m, LineInSquare) lineinsquare_test<mpq_class>(); } +TEST(delaunay_m, LineHoleInSquare) +{ + lineholeinsquare_test<mpq_class>(); +} + +TEST(delaunay_m, NestedHoles) +{ + nestedholes_test<mpq_class>(); +} + TEST(delaunay_m, CrossSegs) { crosssegs_test<mpq_class>(); @@ -1496,7 +1675,6 @@ TEST(delaunay_m, RepeatTri) repeattri_test<mpq_class>(); } # endif - #endif #if DO_C_TESTS @@ -1524,6 +1702,182 @@ TEST(delaunay_d, CintTwoFace) } #endif +#if DO_TEXT_TESTS +template<typename T> +void text_test(int num_arc_points, int num_lets_per_line, int num_lines, CDT_output_type otype) +{ + constexpr bool print_timing = true; + /* + * Make something like a letter B: + * + * 4------------3 + * | ) + * | 12--11 ) + * | | ) a3 ) a1 + * | 9---10 ) + * | ) + * | 2 + * | ) + * | 8----7 ) + * | | ) a2 ) a0 + * | 5----6 ) + * | ) + * 0------------1 + * + * Where the numbers are the first 13 vertices, and the rest of + * the vertices are in arcs a0, a1, a2, a3, each of which have + * num_arc_points per arc in them. + */ + + const char *b_before_arcs = R"(13 0 3 + 0.0 0.0 + 1.0 0.0 + 1.0 1.5 + 1.0 3.0 + 0.0 3.0 + 0.2 0.2 + 0.6 0.2 + 0.6 1.4 + 0.2 1.4 + 0.2 1.6 + 0.6 1.6 + 0.6 2.8 + 0.2 2.8 + 3 4 0 1 2 + 6 5 8 7 + 10 9 12 11 + )"; + + CDT_input<T> b_before_arcs_in = fill_input_from_string<T>(b_before_arcs); + constexpr int narcs = 4; + int b_npts = b_before_arcs_in.vert.size() + narcs * num_arc_points; + constexpr int b_nfaces = 3; + Array<vec2<T>> b_vert(b_npts); + Array<Vector<int>> b_face(b_nfaces); + std::copy(b_before_arcs_in.vert.begin(), b_before_arcs_in.vert.end(), b_vert.begin()); + std::copy(b_before_arcs_in.face.begin(), b_before_arcs_in.face.end(), b_face.begin()); + if (num_arc_points > 0) { + b_face[0].pop_last(); // We'll add center point back between arcs for outer face. + for (int arc = 0; arc < narcs; ++arc) { + int arc_origin_vert; + int arc_terminal_vert; + bool ccw; + switch (arc) { + case 0: + arc_origin_vert = 1; + arc_terminal_vert = 2; + ccw = true; + break; + case 1: + arc_origin_vert = 2; + arc_terminal_vert = 3; + ccw = true; + break; + case 2: + arc_origin_vert = 7; + arc_terminal_vert = 6; + ccw = false; + break; + case 3: + arc_origin_vert = 11; + arc_terminal_vert = 10; + ccw = false; + break; + default: + BLI_assert(false); + } + vec2<T> start_co = b_vert[arc_origin_vert]; + vec2<T> end_co = b_vert[arc_terminal_vert]; + vec2<T> center_co = 0.5 * (start_co + end_co); + BLI_assert(start_co[0] == end_co[2]); + double radius = abs(math_to_double<T>(end_co[1] - center_co[1])); + double angle_delta = M_PI / (num_arc_points + 1); + int start_vert = b_before_arcs_in.vert.size() + arc * num_arc_points; + Vector<int> &face = b_face[(arc <= 1) ? 0 : arc - 1]; + for (int i = 0; i < num_arc_points; ++i) { + vec2<T> delta; + float ang = ccw ? (-M_PI_2 + (i + 1) * angle_delta) : (M_PI_2 - (i + 1) * angle_delta); + delta[0] = T(radius * cos(ang)); + delta[1] = T(radius * sin(ang)); + b_vert[start_vert + i] = center_co + delta; + face.append(start_vert + i); + } + if (arc == 0) { + face.append(arc_terminal_vert); + } + } + } + + CDT_input<T> in; + int tot_instances = num_lets_per_line * num_lines; + if (tot_instances == 1) { + in.vert = b_vert; + in.face = b_face; + } + else { + in.vert = Array<vec2<T>>(tot_instances * b_vert.size()); + in.face = Array<Vector<int>>(tot_instances * b_face.size()); + T cur_x = T(0); + T cur_y = T(0); + T delta_x = T(2); + T delta_y = T(3.25); + int instance = 0; + for (int line = 0; line < num_lines; ++line) { + for (int let = 0; let < num_lets_per_line; ++let) { + vec2<T> co_offset(cur_x, cur_y); + int in_v_offset = instance * b_vert.size(); + for (int v = 0; v < b_vert.size(); ++v) { + in.vert[in_v_offset + v] = b_vert[v] + co_offset; + } + int in_f_offset = instance * b_face.size(); + for (int f : b_face.index_range()) { + for (int fv : b_face[f]) { + in.face[in_f_offset + f].append(in_v_offset + fv); + } + } + cur_x += delta_x; + ++instance; + } + cur_y += delta_y; + cur_x = T(0); + } + } + in.epsilon = b_before_arcs_in.epsilon; + double tstart = PIL_check_seconds_timer(); + CDT_result<T> out = delaunay_2d_calc(in, otype); + double tend = PIL_check_seconds_timer(); + if (print_timing) { + std::cout << "time = " << tend - tstart << "\n"; + } + if (DO_DRAW) { + std::string label = "Text arcpts=" + std::to_string(num_arc_points); + if (num_lets_per_line > 1) { + label += " linelen=" + std::to_string(num_lets_per_line); + } + if (num_lines > 1) { + label += " lines=" + std::to_string(num_lines); + } + graph_draw<T>(label, out.vert, out.edge, out.face); + } +} + +TEST(delaunay_d, TextB10) +{ + text_test<double>(10, 1, 1, CDT_INSIDE_WITH_HOLES); +} + +TEST(delaunay_d, TextB200) +{ + text_test<double>(200, 1, 1, CDT_INSIDE_WITH_HOLES); +} + +TEST(delaunay_d, TextB10_10_10) +{ + text_test<double>(10, 10, 10, CDT_INSIDE_WITH_HOLES); +} + +#endif + #if DO_RANDOM_TESTS enum { diff --git a/source/blender/blenlib/tests/BLI_kdopbvh_test.cc b/source/blender/blenlib/tests/BLI_kdopbvh_test.cc index f921c3ae2a4..04e4c3a1625 100644 --- a/source/blender/blenlib/tests/BLI_kdopbvh_test.cc +++ b/source/blender/blenlib/tests/BLI_kdopbvh_test.cc @@ -2,7 +2,7 @@ #include "testing/testing.h" -/* TODO: ray intersection, overlap ... etc.*/ +/* TODO: ray intersection, overlap ... etc. */ #include "MEM_guardedalloc.h" diff --git a/source/blender/blenlib/tests/BLI_math_time_test.cc b/source/blender/blenlib/tests/BLI_math_time_test.cc new file mode 100644 index 00000000000..61a504ac2d7 --- /dev/null +++ b/source/blender/blenlib/tests/BLI_math_time_test.cc @@ -0,0 +1,35 @@ +/* Apache License, Version 2.0 */ + +#include "testing/testing.h" + +#include "BLI_math.h" + +TEST(math_time, SecondsExplode) +{ + const double seconds = 2.0 * SECONDS_IN_DAY + 13.0 * SECONDS_IN_HOUR + 33.0 * SECONDS_IN_MINUTE + + 9.0 + 369.0 * SECONDS_IN_MILLISECONDS; + const double epsilon = 1e-8; + + double r_days, r_hours, r_minutes, r_seconds, r_milliseconds; + + BLI_math_time_seconds_decompose( + seconds, &r_days, &r_hours, &r_minutes, &r_seconds, &r_milliseconds); + EXPECT_NEAR(2.0, r_days, epsilon); + EXPECT_NEAR(13.0, r_hours, epsilon); + EXPECT_NEAR(33.0, r_minutes, epsilon); + EXPECT_NEAR(9.0, r_seconds, epsilon); + EXPECT_NEAR(369.0, r_milliseconds, epsilon); + + BLI_math_time_seconds_decompose(seconds, nullptr, &r_hours, &r_minutes, &r_seconds, nullptr); + EXPECT_NEAR(61.0, r_hours, epsilon); + EXPECT_NEAR(33.0, r_minutes, epsilon); + EXPECT_NEAR(9.369, r_seconds, epsilon); + + BLI_math_time_seconds_decompose(seconds, nullptr, nullptr, nullptr, &r_seconds, nullptr); + EXPECT_NEAR(seconds, r_seconds, epsilon); + + BLI_math_time_seconds_decompose(seconds, &r_days, nullptr, &r_minutes, nullptr, &r_milliseconds); + EXPECT_NEAR(2.0, r_days, epsilon); + EXPECT_NEAR(813.0, r_minutes, epsilon); + EXPECT_NEAR(9369.0, r_milliseconds, epsilon); +} diff --git a/source/blender/blenlib/tests/BLI_mesh_intersect_test.cc b/source/blender/blenlib/tests/BLI_mesh_intersect_test.cc index 769cadd2f47..ec57cf29cad 100644 --- a/source/blender/blenlib/tests/BLI_mesh_intersect_test.cc +++ b/source/blender/blenlib/tests/BLI_mesh_intersect_test.cc @@ -389,7 +389,7 @@ TEST(mesh_intersect, TwoTris) {4, 13, 6, 2}, /* 11: non-parallel planes, not intersecting, all one side. */ {0, 14, 6, 2}, /* 12: non-paralel planes, not intersecting, alternate sides. */ /* Following are all coplanar cases. */ - {15, 16, 6, 8}, /* 13: T16 inside T15. Note: dup'd tri is expected. */ + {15, 16, 6, 8}, /* 13: T16 inside T15. Note: dup'd tri is expected. */ {15, 17, 8, 8}, /* 14: T17 intersects one edge of T15 at (1,1,0)(3,3,0). */ {15, 18, 10, 12}, /* 15: T18 intersects T15 at (1,1,0)(3,3,0)(3,15/4,1/2)(0,3,2). */ {15, 19, 8, 10}, /* 16: T19 intersects T15 at (3,3,0)(0,3,2). */ diff --git a/source/blender/blenlib/tests/BLI_stack_test.cc b/source/blender/blenlib/tests/BLI_stack_test.cc index 1fef5998b99..a2650e5509d 100644 --- a/source/blender/blenlib/tests/BLI_stack_test.cc +++ b/source/blender/blenlib/tests/BLI_stack_test.cc @@ -137,7 +137,7 @@ TEST(stack, Clear) BLI_stack_clear(stack); EXPECT_TRUE(BLI_stack_is_empty(stack)); - /* and again, this time check its valid */ + /* and again, this time check it is valid */ for (in = 0; in < tot; in++) { BLI_stack_push(stack, (void *)&in); } @@ -150,7 +150,7 @@ TEST(stack, Clear) EXPECT_TRUE(BLI_stack_is_empty(stack)); - /* without this, we wont test case when mixed free/used */ + /* without this, we won't test case when mixed free/used */ tot /= 2; } diff --git a/source/blender/blenlib/tests/BLI_string_test.cc b/source/blender/blenlib/tests/BLI_string_test.cc index 88cecaa5fee..ccd2d01be98 100644 --- a/source/blender/blenlib/tests/BLI_string_test.cc +++ b/source/blender/blenlib/tests/BLI_string_test.cc @@ -420,10 +420,103 @@ TEST(string, StrFormatByteUnits) EXPECT_STREQ("-8191.8472 PiB", size_str); } +/* BLI_str_format_attribute_domain_size */ +TEST(string, StrFormatAttributeDomainSize) +{ + char size_str[7]; + int size; + + BLI_str_format_attribute_domain_size(size_str, size = 0); + EXPECT_STREQ("0", size_str); + BLI_str_format_attribute_domain_size(size_str, size = 1); + EXPECT_STREQ("1", size_str); + BLI_str_format_attribute_domain_size(size_str, size = 10); + EXPECT_STREQ("10", size_str); + BLI_str_format_attribute_domain_size(size_str, size = 15); + EXPECT_STREQ("15", size_str); + BLI_str_format_attribute_domain_size(size_str, size = 100); + EXPECT_STREQ("100", size_str); + BLI_str_format_attribute_domain_size(size_str, size = 155); + EXPECT_STREQ("155", size_str); + BLI_str_format_attribute_domain_size(size_str, size = 1000); + EXPECT_STREQ("1.0K", size_str); + BLI_str_format_attribute_domain_size(size_str, size = 1555); + EXPECT_STREQ("1.6K", size_str); + BLI_str_format_attribute_domain_size(size_str, size = 10000); + EXPECT_STREQ("10.0K", size_str); + BLI_str_format_attribute_domain_size(size_str, size = 15555); + EXPECT_STREQ("15.6K", size_str); + BLI_str_format_attribute_domain_size(size_str, size = 100000); + EXPECT_STREQ("100K", size_str); + BLI_str_format_attribute_domain_size(size_str, size = 100000); + EXPECT_STREQ("100K", size_str); + BLI_str_format_attribute_domain_size(size_str, size = 155555); + EXPECT_STREQ("156K", size_str); + BLI_str_format_attribute_domain_size(size_str, size = 1000000); + EXPECT_STREQ("1.0M", size_str); + BLI_str_format_attribute_domain_size(size_str, size = 1555555); + EXPECT_STREQ("1.6M", size_str); + BLI_str_format_attribute_domain_size(size_str, size = 10000000); + EXPECT_STREQ("10.0M", size_str); + BLI_str_format_attribute_domain_size(size_str, size = 15555555); + EXPECT_STREQ("15.6M", size_str); + BLI_str_format_attribute_domain_size(size_str, size = 100000000); + EXPECT_STREQ("100M", size_str); + BLI_str_format_attribute_domain_size(size_str, size = 155555555); + EXPECT_STREQ("156M", size_str); + BLI_str_format_attribute_domain_size(size_str, size = 1000000000); + EXPECT_STREQ("1.0B", size_str); + + /* Largest possible value. */ + BLI_str_format_attribute_domain_size(size_str, size = INT32_MAX); + EXPECT_STREQ("2.1B", size_str); + + BLI_str_format_attribute_domain_size(size_str, size = -0); + EXPECT_STREQ("0", size_str); + BLI_str_format_attribute_domain_size(size_str, size = -1); + EXPECT_STREQ("-1", size_str); + BLI_str_format_attribute_domain_size(size_str, size = -10); + EXPECT_STREQ("-10", size_str); + BLI_str_format_attribute_domain_size(size_str, size = -15); + EXPECT_STREQ("-15", size_str); + BLI_str_format_attribute_domain_size(size_str, size = -100); + EXPECT_STREQ("-100", size_str); + BLI_str_format_attribute_domain_size(size_str, size = -155); + EXPECT_STREQ("-155", size_str); + BLI_str_format_attribute_domain_size(size_str, size = -1000); + EXPECT_STREQ("-1.0K", size_str); + BLI_str_format_attribute_domain_size(size_str, size = -1555); + EXPECT_STREQ("-1.6K", size_str); + BLI_str_format_attribute_domain_size(size_str, size = -10000); + EXPECT_STREQ("-10.0K", size_str); + BLI_str_format_attribute_domain_size(size_str, size = -15555); + EXPECT_STREQ("-15.6K", size_str); + BLI_str_format_attribute_domain_size(size_str, size = -100000); + EXPECT_STREQ("-100K", size_str); + BLI_str_format_attribute_domain_size(size_str, size = -155555); + EXPECT_STREQ("-156K", size_str); + BLI_str_format_attribute_domain_size(size_str, size = -1000000); + EXPECT_STREQ("-1.0M", size_str); + BLI_str_format_attribute_domain_size(size_str, size = -1555555); + EXPECT_STREQ("-1.6M", size_str); + BLI_str_format_attribute_domain_size(size_str, size = -10000000); + EXPECT_STREQ("-10.0M", size_str); + BLI_str_format_attribute_domain_size(size_str, size = -15555555); + EXPECT_STREQ("-15.6M", size_str); + BLI_str_format_attribute_domain_size(size_str, size = -100000000); + EXPECT_STREQ("-100M", size_str); + BLI_str_format_attribute_domain_size(size_str, size = -155555555); + EXPECT_STREQ("-156M", size_str); + BLI_str_format_attribute_domain_size(size_str, size = -1000000000); + EXPECT_STREQ("-1.0B", size_str); + + /* Smallest possible value. */ + BLI_str_format_attribute_domain_size(size_str, size = -INT32_MAX); + EXPECT_STREQ("-2.1B", size_str); +} + struct WordInfo { - WordInfo() - { - } + WordInfo() = default; WordInfo(int start, int end) : start(start), end(end) { } @@ -441,9 +534,7 @@ static std::ostream &operator<<(std::ostream &os, const WordInfo &word_info) class StringFindSplitWords : public testing::Test { protected: - StringFindSplitWords() - { - } + StringFindSplitWords() = default; /* If max_words is -1 it will be initialized from the number of expected * words +1. This way there is no need to pass an explicit number of words, @@ -807,9 +898,7 @@ TEST_F(StringCasecmpNatural, TextAndNumbers) class StringEscape : public testing::Test { protected: - StringEscape() - { - } + StringEscape() = default; using CompareWordsArray = vector<std::array<const char *, 2>>; @@ -832,6 +921,9 @@ class StringEscape : public testing::Test { TEST_F(StringEscape, Simple) { + /* NOTE: clang-tidy `modernize-raw-string-literal` is disabled as it causes errors with MSVC. + * TODO: investigate resolving with `/Zc:preprocessor` flag. */ + const CompareWordsArray equal{ {"", ""}, {"/", "/"}, @@ -845,11 +937,16 @@ TEST_F(StringEscape, Simple) {"\\A", "\\\\A"}, {"A\\B", "A\\\\B"}, {"?", "?"}, + /* NOLINTNEXTLINE: modernize-raw-string-literal. */ {"\"\\", "\\\"\\\\"}, + /* NOLINTNEXTLINE: modernize-raw-string-literal. */ {"\\\"", "\\\\\\\""}, + /* NOLINTNEXTLINE: modernize-raw-string-literal. */ {"\"\\\"", "\\\"\\\\\\\""}, + /* NOLINTNEXTLINE: modernize-raw-string-literal. */ {"\"\"\"", "\\\"\\\"\\\""}, + /* NOLINTNEXTLINE: modernize-raw-string-literal. */ {"\\\\\\", "\\\\\\\\\\\\"}, }; @@ -868,8 +965,11 @@ TEST_F(StringEscape, Control) {"\f", "\\f"}, {"A\n", "A\\n"}, {"\nA", "\\nA"}, + /* NOLINTNEXTLINE: modernize-raw-string-literal. */ {"\n\r\t\a\b\f", "\\n\\r\\t\\a\\b\\f"}, + /* NOLINTNEXTLINE: modernize-raw-string-literal. */ {"\n_\r_\t_\a_\b_\f", "\\n_\\r_\\t_\\a_\\b_\\f"}, + /* NOLINTNEXTLINE: modernize-raw-string-literal. */ {"\n\\\r\\\t\\\a\\\b\\\f", "\\n\\\\\\r\\\\\\t\\\\\\a\\\\\\b\\\\\\f"}, }; diff --git a/source/blender/blenloader/BLO_read_write.h b/source/blender/blenloader/BLO_read_write.h index ea0532d884b..86c7c367816 100644 --- a/source/blender/blenloader/BLO_read_write.h +++ b/source/blender/blenloader/BLO_read_write.h @@ -54,6 +54,7 @@ typedef struct BlendExpander BlendExpander; typedef struct BlendLibReader BlendLibReader; typedef struct BlendWriter BlendWriter; +struct BlendFileReadReport; struct Main; struct ReportList; @@ -216,7 +217,7 @@ bool BLO_read_requires_endian_switch(BlendDataReader *reader); bool BLO_read_data_is_undo(BlendDataReader *reader); void BLO_read_data_globmap_add(BlendDataReader *reader, void *oldaddr, void *newaddr); void BLO_read_glob_list(BlendDataReader *reader, struct ListBase *list); -struct ReportList *BLO_read_data_reports(BlendDataReader *reader); +struct BlendFileReadReport *BLO_read_data_reports(BlendDataReader *reader); /* Blend Read Lib API * =================== @@ -233,7 +234,7 @@ ID *BLO_read_get_new_id_address(BlendLibReader *reader, struct Library *lib, str /* Misc. */ bool BLO_read_lib_is_undo(BlendLibReader *reader); struct Main *BLO_read_lib_get_main(BlendLibReader *reader); -struct ReportList *BLO_read_lib_reports(BlendLibReader *reader); +struct BlendFileReadReport *BLO_read_lib_reports(BlendLibReader *reader); /* Blend Expand API * =================== @@ -250,8 +251,10 @@ void BLO_expand_id(BlendExpander *expander, struct ID *id); * =================== */ -void BLO_reportf_wrap(struct ReportList *reports, ReportType type, const char *format, ...) - ATTR_PRINTF_FORMAT(3, 4); +void BLO_reportf_wrap(struct BlendFileReadReport *reports, + ReportType type, + const char *format, + ...) ATTR_PRINTF_FORMAT(3, 4); #ifdef __cplusplus } diff --git a/source/blender/blenloader/BLO_readfile.h b/source/blender/blenloader/BLO_readfile.h index 89db216aada..52ef577fceb 100644 --- a/source/blender/blenloader/BLO_readfile.h +++ b/source/blender/blenloader/BLO_readfile.h @@ -82,13 +82,42 @@ typedef struct BlendFileData { } BlendFileData; struct BlendFileReadParams { - uint skip_flags : 3; /* eBLOReadSkip */ + uint skip_flags : 3; /* #eBLOReadSkip */ uint is_startup : 1; /** Whether we are reading the memfile for an undo or a redo. */ - int undo_direction; /* eUndoStepDir */ + int undo_direction; /* #eUndoStepDir */ }; +typedef struct BlendFileReadReport { + /* General reports handling. */ + struct ReportList *reports; + + /* Timing information. */ + struct { + double whole; + double libraries; + double lib_overrides; + double lib_overrides_resync; + double lib_overrides_recursive_resync; + } duration; + + /* Count information. */ + struct { + /* Some numbers of IDs that ended up in a specific state, or required some specific process + * during this file read. */ + int missing_libraries; + int missing_linked_id; + /* Number of root override IDs that were resynced. */ + int resynced_lib_overrides; + } count; + + /* Number of libraries which had overrides that needed to be resynced, and a single linked list + * of those. */ + int resynced_lib_overrides_libraries_count; + struct LinkNode *resynced_lib_overrides_libraries; +} BlendFileReadReport; + /* skip reading some data-block types (may want to skip screen data too). */ typedef enum eBLOReadSkip { BLO_READ_SKIP_NONE = 0, @@ -101,7 +130,7 @@ typedef enum eBLOReadSkip { BlendFileData *BLO_read_from_file(const char *filepath, eBLOReadSkip skip_flags, - struct ReportList *reports); + struct BlendFileReadReport *reports); BlendFileData *BLO_read_from_memory(const void *mem, int memsize, eBLOReadSkip skip_flags, @@ -125,8 +154,10 @@ struct BLODataBlockInfo { struct AssetMetaData *asset_data; }; -BlendHandle *BLO_blendhandle_from_file(const char *filepath, struct ReportList *reports); -BlendHandle *BLO_blendhandle_from_memory(const void *mem, int memsize); +BlendHandle *BLO_blendhandle_from_file(const char *filepath, struct BlendFileReadReport *reports); +BlendHandle *BLO_blendhandle_from_memory(const void *mem, + int memsize, + struct BlendFileReadReport *reports); struct LinkNode *BLO_blendhandle_get_datablock_names(BlendHandle *bh, int ofblocktype, @@ -231,6 +262,7 @@ typedef struct TempLibraryContext { /** Temporary main used to load data into (currently initialized from `real_main`). */ struct Main *bmain_base; struct BlendHandle *blendhandle; + struct BlendFileReadReport bf_reports; struct LibraryLink_Params liblink_params; struct Library *lib; diff --git a/source/blender/blenloader/intern/blend_validate.c b/source/blender/blenloader/intern/blend_validate.c index f3fc1453461..5b093223fda 100644 --- a/source/blender/blenloader/intern/blend_validate.c +++ b/source/blender/blenloader/intern/blend_validate.c @@ -83,7 +83,8 @@ bool BLO_main_validate_libraries(Main *bmain, ReportList *reports) } BKE_library_filepath_set(bmain, curlib, curlib->filepath); - BlendHandle *bh = BLO_blendhandle_from_file(curlib->filepath_abs, reports); + BlendFileReadReport bf_reports = {.reports = reports}; + BlendHandle *bh = BLO_blendhandle_from_file(curlib->filepath_abs, &bf_reports); if (bh == NULL) { BKE_reportf(reports, diff --git a/source/blender/blenloader/intern/readblenentry.c b/source/blender/blenloader/intern/readblenentry.c index 19033ba9bf1..44a26b9bf85 100644 --- a/source/blender/blenloader/intern/readblenentry.c +++ b/source/blender/blenloader/intern/readblenentry.c @@ -68,7 +68,7 @@ void BLO_blendhandle_print_sizes(BlendHandle *bh, void *fp); * \param reports: Report errors in opening the file (can be NULL). * \return A handle on success, or NULL on failure. */ -BlendHandle *BLO_blendhandle_from_file(const char *filepath, ReportList *reports) +BlendHandle *BLO_blendhandle_from_file(const char *filepath, BlendFileReadReport *reports) { BlendHandle *bh; @@ -84,11 +84,13 @@ BlendHandle *BLO_blendhandle_from_file(const char *filepath, ReportList *reports * \param memsize: The size of the data. * \return A handle on success, or NULL on failure. */ -BlendHandle *BLO_blendhandle_from_memory(const void *mem, int memsize) +BlendHandle *BLO_blendhandle_from_memory(const void *mem, + int memsize, + BlendFileReadReport *reports) { BlendHandle *bh; - bh = (BlendHandle *)blo_filedata_from_memory(mem, memsize, NULL); + bh = (BlendHandle *)blo_filedata_from_memory(mem, memsize, reports); return bh; } @@ -366,14 +368,13 @@ void BLO_blendhandle_close(BlendHandle *bh) */ BlendFileData *BLO_read_from_file(const char *filepath, eBLOReadSkip skip_flags, - ReportList *reports) + BlendFileReadReport *reports) { BlendFileData *bfd = NULL; FileData *fd; fd = blo_filedata_from_file(filepath, reports); if (fd) { - fd->reports = reports; fd->skip_flags = skip_flags; bfd = blo_read_file_internal(fd, filepath); blo_filedata_free(fd); @@ -398,10 +399,10 @@ BlendFileData *BLO_read_from_memory(const void *mem, { BlendFileData *bfd = NULL; FileData *fd; + BlendFileReadReport bf_reports = {.reports = reports}; - fd = blo_filedata_from_memory(mem, memsize, reports); + fd = blo_filedata_from_memory(mem, memsize, &bf_reports); if (fd) { - fd->reports = reports; fd->skip_flags = skip_flags; bfd = blo_read_file_internal(fd, ""); blo_filedata_free(fd); @@ -427,10 +428,10 @@ BlendFileData *BLO_read_from_memfile(Main *oldmain, BlendFileData *bfd = NULL; FileData *fd; ListBase old_mainlist; + BlendFileReadReport bf_reports = {.reports = reports}; - fd = blo_filedata_from_memfile(memfile, params, reports); + fd = blo_filedata_from_memfile(memfile, params, &bf_reports); if (fd) { - fd->reports = reports; fd->skip_flags = params->skip_flags; BLI_strncpy(fd->relabase, filename, sizeof(fd->relabase)); diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 47ed4e5c06f..f9982d96d76 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -40,6 +40,8 @@ # include <io.h> /* for open close read */ #endif +#include "CLG_log.h" + /* allow readfile to use deprecated functionality */ #define DNA_DEPRECATED_ALLOW @@ -72,6 +74,8 @@ #include "BLI_mmap.h" #include "BLI_threads.h" +#include "PIL_time.h" + #include "BLT_translation.h" #include "BKE_anim_data.h" @@ -186,14 +190,8 @@ /* Use GHash for restoring pointers by name */ #define USE_GHASH_RESTORE_POINTER -/* Define this to have verbose debug prints. */ -//#define USE_DEBUG_PRINT - -#ifdef USE_DEBUG_PRINT -# define DEBUG_PRINTF(...) printf(__VA_ARGS__) -#else -# define DEBUG_PRINTF(...) -#endif +static CLG_LogRef LOG = {"blo.readfile"}; +static CLG_LogRef LOG_UNDO = {"blo.readfile.undo"}; /* local prototypes */ static void read_libraries(FileData *basefd, ListBase *mainlist); @@ -227,7 +225,7 @@ typedef struct BHeadN { * bit kludge but better than doubling up on prints, * we could alternatively have a versions of a report function which forces printing - campbell */ -void BLO_reportf_wrap(ReportList *reports, ReportType type, const char *format, ...) +void BLO_reportf_wrap(BlendFileReadReport *reports, ReportType type, const char *format, ...) { char fixed_buf[1024]; /* should be long enough */ @@ -239,7 +237,7 @@ void BLO_reportf_wrap(ReportList *reports, ReportType type, const char *format, fixed_buf[sizeof(fixed_buf) - 1] = '\0'; - BKE_report(reports, type, fixed_buf); + BKE_report(reports->reports, type, fixed_buf); if (G.background == 0) { printf("%s: %s\n", BKE_report_type_str(type), fixed_buf); @@ -488,7 +486,7 @@ static void split_libdata(ListBase *lb_src, Main **lib_main_array, const uint li BLI_addtail(lb_dst, id); } else { - printf("%s: invalid library for '%s'\n", __func__, id->name); + CLOG_ERROR(&LOG, "Invalid library for '%s'", id->name); BLI_assert(0); } } @@ -635,7 +633,7 @@ static Main *blo_find_main(FileData *fd, const char *filepath, const char *relab if (BLI_path_cmp(name1, libname) == 0) { if (G.debug & G_DEBUG) { - printf("blo_find_main: found library %s\n", libname); + CLOG_INFO(&LOG, 3, "Found library %s", libname); } return m; } @@ -662,7 +660,7 @@ static Main *blo_find_main(FileData *fd, const char *filepath, const char *relab read_file_version(fd, m); if (G.debug & G_DEBUG) { - printf("blo_find_main: added new lib %s\n", filepath); + CLOG_INFO(&LOG, 3, "Added new lib %s", filepath); } return m; } @@ -1296,7 +1294,7 @@ static ssize_t fd_read_from_memfile(FileData *filedata, /* debug, should never happen */ if (chunk == NULL) { - printf("illegal read, chunk zero\n"); + CLOG_ERROR(&LOG, "Illegal read, got a NULL chunk"); return 0; } @@ -1331,8 +1329,10 @@ static ssize_t fd_read_from_memfile(FileData *filedata, return 0; } -static FileData *filedata_new(void) +static FileData *filedata_new(BlendFileReadReport *reports) { + BLI_assert(reports != NULL); + FileData *fd = MEM_callocN(sizeof(FileData), "FileData"); fd->filedes = -1; @@ -1344,6 +1344,8 @@ static FileData *filedata_new(void) fd->globmap = oldnewmap_new(); fd->libmap = oldnewmap_new(); + fd->reports = reports; + return fd; } @@ -1371,7 +1373,7 @@ static FileData *blo_decode_and_check(FileData *fd, ReportList *reports) } static FileData *blo_filedata_from_file_descriptor(const char *filepath, - ReportList *reports, + BlendFileReadReport *reports, int file) { FileDataReadFn *read_fn = NULL; @@ -1386,7 +1388,7 @@ static FileData *blo_filedata_from_file_descriptor(const char *filepath, /* Regular file. */ errno = 0; if (read(file, header, sizeof(header)) != sizeof(header)) { - BKE_reportf(reports, + BKE_reportf(reports->reports, RPT_WARNING, "Unable to read '%s': %s", filepath, @@ -1416,7 +1418,7 @@ static FileData *blo_filedata_from_file_descriptor(const char *filepath, (header[0] == 0x1f && header[1] == 0x8b)) { gzfile = BLI_gzopen(filepath, "rb"); if (gzfile == (gzFile)Z_NULL) { - BKE_reportf(reports, + BKE_reportf(reports->reports, RPT_WARNING, "Unable to open '%s': %s", filepath, @@ -1431,11 +1433,11 @@ static FileData *blo_filedata_from_file_descriptor(const char *filepath, } if (read_fn == NULL) { - BKE_reportf(reports, RPT_WARNING, "Unrecognized file format '%s'", filepath); + BKE_reportf(reports->reports, RPT_WARNING, "Unrecognized file format '%s'", filepath); return NULL; } - FileData *fd = filedata_new(); + FileData *fd = filedata_new(reports); fd->filedes = file; fd->gzfiledes = gzfile; @@ -1448,12 +1450,12 @@ static FileData *blo_filedata_from_file_descriptor(const char *filepath, return fd; } -static FileData *blo_filedata_from_file_open(const char *filepath, ReportList *reports) +static FileData *blo_filedata_from_file_open(const char *filepath, BlendFileReadReport *reports) { errno = 0; const int file = BLI_open(filepath, O_BINARY | O_RDONLY, 0); if (file == -1) { - BKE_reportf(reports, + BKE_reportf(reports->reports, RPT_WARNING, "Unable to open '%s': %s", filepath, @@ -1469,14 +1471,14 @@ static FileData *blo_filedata_from_file_open(const char *filepath, ReportList *r /* cannot be called with relative paths anymore! */ /* on each new library added, it now checks for the current FileData and expands relativeness */ -FileData *blo_filedata_from_file(const char *filepath, ReportList *reports) +FileData *blo_filedata_from_file(const char *filepath, BlendFileReadReport *reports) { FileData *fd = blo_filedata_from_file_open(filepath, reports); if (fd != NULL) { /* needed for library_append and read_libraries */ BLI_strncpy(fd->relabase, filepath, sizeof(fd->relabase)); - return blo_decode_and_check(fd, reports); + return blo_decode_and_check(fd, reports->reports); } return NULL; } @@ -1487,7 +1489,7 @@ FileData *blo_filedata_from_file(const char *filepath, ReportList *reports) */ static FileData *blo_filedata_from_file_minimal(const char *filepath) { - FileData *fd = blo_filedata_from_file_open(filepath, NULL); + FileData *fd = blo_filedata_from_file_open(filepath, &(BlendFileReadReport){.reports = NULL}); if (fd != NULL) { decode_blender_header(fd); if (fd->flags & FD_FLAGS_FILE_OK) { @@ -1515,7 +1517,7 @@ static ssize_t fd_read_gzip_from_memory(FileData *filedata, return 0; } if (err != Z_OK) { - printf("fd_read_gzip_from_memory: zlib error\n"); + CLOG_ERROR(&LOG, "ZLib error (code %d)", err); return 0; } @@ -1542,14 +1544,15 @@ static int fd_read_gzip_from_memory_init(FileData *fd) return 1; } -FileData *blo_filedata_from_memory(const void *mem, int memsize, ReportList *reports) +FileData *blo_filedata_from_memory(const void *mem, int memsize, BlendFileReadReport *reports) { if (!mem || memsize < SIZEOFBLENDERHEADER) { - BKE_report(reports, RPT_WARNING, (mem) ? TIP_("Unable to read") : TIP_("Unable to open")); + BKE_report( + reports->reports, RPT_WARNING, (mem) ? TIP_("Unable to read") : TIP_("Unable to open")); return NULL; } - FileData *fd = filedata_new(); + FileData *fd = filedata_new(reports); const char *cp = mem; fd->buffer = mem; @@ -1568,26 +1571,26 @@ FileData *blo_filedata_from_memory(const void *mem, int memsize, ReportList *rep fd->flags |= FD_FLAGS_NOT_MY_BUFFER; - return blo_decode_and_check(fd, reports); + return blo_decode_and_check(fd, reports->reports); } FileData *blo_filedata_from_memfile(MemFile *memfile, const struct BlendFileReadParams *params, - ReportList *reports) + BlendFileReadReport *reports) { if (!memfile) { - BKE_report(reports, RPT_WARNING, "Unable to open blend <memory>"); + BKE_report(reports->reports, RPT_WARNING, "Unable to open blend <memory>"); return NULL; } - FileData *fd = filedata_new(); + FileData *fd = filedata_new(reports); fd->memfile = memfile; fd->undo_direction = params->undo_direction; fd->read = fd_read_from_memfile; fd->flags |= FD_FLAGS_NOT_MY_BUFFER; - return blo_decode_and_check(fd, reports); + return blo_decode_and_check(fd, reports->reports); } void blo_filedata_free(FileData *fd) @@ -1602,8 +1605,9 @@ void blo_filedata_free(FileData *fd) } if (fd->strm.next_in) { - if (inflateEnd(&fd->strm) != Z_OK) { - printf("close gzip stream error\n"); + int err = inflateEnd(&fd->strm); + if (err != Z_OK) { + CLOG_ERROR(&LOG, "Close gzip stream error (code %d)", err); } } @@ -2470,7 +2474,7 @@ static void direct_link_id_common( BKE_asset_metadata_read(reader, id->asset_data); } - /*link direct data of ID properties*/ + /* Link direct data of ID properties. */ if (id->properties) { BLO_read_data_address(reader, &id->properties); /* this case means the data was written incorrectly, it should not happen */ @@ -2586,7 +2590,7 @@ static void lib_link_scenes_check_set(Main *bmain) if (sce->flag & SCE_READFILE_LIBLINK_NEED_SETSCENE_CHECK) { sce->flag &= ~SCE_READFILE_LIBLINK_NEED_SETSCENE_CHECK; if (!scene_validate_setscene__liblink(sce, totscene)) { - printf("Found cyclic background scene when linking %s\n", sce->id.name + 2); + CLOG_WARN(&LOG, "Found cyclic background scene when linking %s", sce->id.name + 2); } } } @@ -2839,7 +2843,7 @@ static void lib_link_workspace_layout_restore(struct IDNameLib_Map *id_map, } /* TODO: restore path pointers: T40046 - * (complicated because this contains data pointers too, not just ID)*/ + * (complicated because this contains data pointers too, not just ID). */ MEM_SAFE_FREE(sbuts->path); } else if (sl->spacetype == SPACE_FILE) { @@ -3420,15 +3424,17 @@ static bool read_libblock_undo_restore_library(FileData *fd, Main *main, const I * That means we have to carefully check whether current lib or * libdata already exits in old main, if it does we merely copy it over into new main area, * otherwise we have to do a full read of that bhead... */ - DEBUG_PRINTF("UNDO: restore library %s\n", id->name); + CLOG_INFO(&LOG_UNDO, 2, "UNDO: restore library %s", id->name); Main *libmain = fd->old_mainlist->first; /* Skip oldmain itself... */ for (libmain = libmain->next; libmain; libmain = libmain->next) { - DEBUG_PRINTF(" compare with %s -> ", libmain->curlib ? libmain->curlib->id.name : "<NULL>"); if (libmain->curlib && STREQ(id->name, libmain->curlib->id.name)) { Main *oldmain = fd->old_mainlist->first; - DEBUG_PRINTF("match!\n"); + CLOG_INFO(&LOG_UNDO, + 2, + " compare with %s -> match", + libmain->curlib ? libmain->curlib->id.name : "<NULL>"); /* In case of a library, we need to re-add its main to fd->mainlist, * because if we have later a missing ID_LINK_PLACEHOLDER, * we need to get the correct lib it is linked to! @@ -3440,7 +3446,10 @@ static bool read_libblock_undo_restore_library(FileData *fd, Main *main, const I BLI_addtail(&main->libraries, libmain->curlib); return true; } - DEBUG_PRINTF("no match\n"); + CLOG_INFO(&LOG_UNDO, + 2, + " compare with %s -> NO match", + libmain->curlib ? libmain->curlib->id.name : "<NULL>"); } return false; @@ -3449,14 +3458,15 @@ static bool read_libblock_undo_restore_library(FileData *fd, Main *main, const I /* For undo, restore existing linked datablock from the old main. */ static bool read_libblock_undo_restore_linked(FileData *fd, Main *main, const ID *id, BHead *bhead) { - DEBUG_PRINTF("UNDO: restore linked datablock %s\n", id->name); - DEBUG_PRINTF(" from %s (%s): ", - main->curlib ? main->curlib->id.name : "<NULL>", - main->curlib ? main->curlib->filepath : "<NULL>"); + CLOG_INFO(&LOG_UNDO, 2, "UNDO: restore linked datablock %s", id->name); ID *id_old = BKE_libblock_find_name(main, GS(id->name), id->name + 2); if (id_old != NULL) { - DEBUG_PRINTF(" found!\n"); + CLOG_INFO(&LOG_UNDO, + 2, + " from %s (%s): found", + main->curlib ? main->curlib->id.name : "<NULL>", + main->curlib ? main->curlib->filepath : "<NULL>"); /* Even though we found our linked ID, there is no guarantee its address * is still the same. */ if (id_old != bhead->old) { @@ -3468,7 +3478,11 @@ static bool read_libblock_undo_restore_linked(FileData *fd, Main *main, const ID return true; } - DEBUG_PRINTF(" not found\n"); + CLOG_INFO(&LOG_UNDO, + 2, + " from %s (%s): NOT found", + main->curlib ? main->curlib->id.name : "<NULL>", + main->curlib ? main->curlib->filepath : "<NULL>"); return false; } @@ -3577,8 +3591,6 @@ static bool read_libblock_undo_restore( } /* Restore local datablocks. */ - DEBUG_PRINTF("UNDO: read %s (uuid %u) -> ", id->name, id->session_uuid); - ID *id_old = NULL; const bool do_partial_undo = (fd->skip_flags & BLO_READ_SKIP_UNDO_OLD_MAIN) == 0; if (do_partial_undo && (bhead->code != ID_LINK_PLACEHOLDER)) { @@ -3593,7 +3605,11 @@ static bool read_libblock_undo_restore( if (id_old != NULL && read_libblock_is_identical(fd, bhead)) { /* Local datablock was unchanged, restore from the old main. */ - DEBUG_PRINTF("keep identical datablock\n"); + CLOG_INFO(&LOG_UNDO, + 2, + "UNDO: read %s (uuid %u) -> keep identical datablock", + id->name, + id->session_uuid); /* Do not add LIB_TAG_NEW here, this should not be needed/used in undo case anyway (as * this is only for do_version-like code), but for sake of consistency, and also because @@ -3613,13 +3629,18 @@ static bool read_libblock_undo_restore( } if (id_old != NULL) { /* Local datablock was changed. Restore at the address of the old datablock. */ - DEBUG_PRINTF("read to old existing address\n"); + CLOG_INFO(&LOG_UNDO, + 2, + "UNDO: read %s (uuid %u) -> read to old existing address", + id->name, + id->session_uuid); *r_id_old = id_old; return false; } /* Local datablock does not exist in the undo step, so read from scratch. */ - DEBUG_PRINTF("read at new address\n"); + CLOG_INFO( + &LOG_UNDO, 2, "UNDO: read %s (uuid %u) -> read at new address", id->name, id->session_uuid); return false; } @@ -3664,7 +3685,7 @@ static BHead *read_libblock(FileData *fd, ListBase *lb = which_libbase(main, idcode); if (lb == NULL) { /* Unknown ID type. */ - printf("%s: unknown id code '%c%c'\n", __func__, (idcode & 0xff), (idcode >> 8)); + CLOG_WARN(&LOG, "Unknown id code '%c%c'", (idcode & 0xff), (idcode >> 8)); MEM_freeN(id); if (r_id) { *r_id = NULL; @@ -3856,12 +3877,14 @@ static void do_versions(FileData *fd, Library *lib, Main *main) BLI_strncpy(build_commit_datetime, "unknown", sizeof(build_commit_datetime)); } - printf("read file %s\n Version %d sub %d date %s hash %s\n", - fd->relabase, - main->versionfile, - main->subversionfile, - build_commit_datetime, - main->build_hash); + CLOG_INFO(&LOG, 0, "Read file %s", fd->relabase); + CLOG_INFO(&LOG, + 0, + " Version %d sub %d date %s hash %s", + main->versionfile, + main->subversionfile, + build_commit_datetime, + main->build_hash); } blo_do_versions_pre250(fd, lib, main); @@ -3883,8 +3906,13 @@ static void do_versions(FileData *fd, Library *lib, Main *main) static void do_versions_after_linking(Main *main, ReportList *reports) { - // printf("%s for %s (%s), %d.%d\n", __func__, main->curlib ? main->curlib->filepath : - // main->name, main->curlib ? "LIB" : "MAIN", main->versionfile, main->subversionfile); + CLOG_INFO(&LOG, + 2, + "Processing %s (%s), %d.%d", + main->curlib ? main->curlib->filepath : main->name, + main->curlib ? "LIB" : "MAIN", + main->versionfile, + main->subversionfile); /* Don't allow versioning to create new data-blocks. */ main->is_locked_for_linking = true; @@ -4105,7 +4133,7 @@ BlendFileData *blo_read_file_internal(FileData *fd, const char *filepath) ListBase mainlist = {NULL, NULL}; if (fd->memfile != NULL) { - DEBUG_PRINTF("\nUNDO: read step\n"); + CLOG_INFO(&LOG_UNDO, 2, "UNDO: read step"); } bfd = MEM_callocN(sizeof(BlendFileData), "blendfiledata"); @@ -4206,6 +4234,7 @@ BlendFileData *blo_read_file_internal(FileData *fd, const char *filepath) } if ((fd->skip_flags & BLO_READ_SKIP_DATA) == 0) { + fd->reports->duration.libraries = PIL_check_seconds_timer(); read_libraries(fd, &mainlist); blo_join_main(&mainlist); @@ -4213,6 +4242,8 @@ BlendFileData *blo_read_file_internal(FileData *fd, const char *filepath) lib_link_all(fd, bfd->main); after_liblink_merged_bmain_process(bfd->main); + fd->reports->duration.libraries = PIL_check_seconds_timer() - fd->reports->duration.libraries; + /* Skip in undo case. */ if (fd->memfile == NULL) { /* Note that we can't recompute user-counts at this point in undo case, we play too much with @@ -4228,7 +4259,7 @@ BlendFileData *blo_read_file_internal(FileData *fd, const char *filepath) blo_split_main(&mainlist, bfd->main); LISTBASE_FOREACH (Main *, mainvar, &mainlist) { BLI_assert(mainvar->versionfile != 0); - do_versions_after_linking(mainvar, fd->reports); + do_versions_after_linking(mainvar, fd->reports->reports); } blo_join_main(&mainlist); @@ -4249,8 +4280,13 @@ BlendFileData *blo_read_file_internal(FileData *fd, const char *filepath) * we can re-generate overrides from their references. */ if (fd->memfile == NULL) { /* Do not apply in undo case! */ - BKE_lib_override_library_main_validate(bfd->main, fd->reports); + fd->reports->duration.lib_overrides = PIL_check_seconds_timer(); + + BKE_lib_override_library_main_validate(bfd->main, fd->reports->reports); BKE_lib_override_library_main_update(bfd->main); + + fd->reports->duration.lib_overrides = PIL_check_seconds_timer() - + fd->reports->duration.lib_overrides; } BKE_collections_after_lib_link(bfd->main); @@ -4908,9 +4944,7 @@ static ID *link_named_part( } else { /* already linked */ - if (G.debug) { - printf("append: already linked\n"); - } + CLOG_WARN(&LOG, "Append: ID '%s' is already linked", id->name); oldnewmap_insert(fd->libmap, bhead->old, id, bhead->code); if (!force_indirect && (id->tag & LIB_TAG_INDIRECT)) { id->tag &= ~LIB_TAG_INDIRECT; @@ -5184,7 +5218,7 @@ static void library_link_end(Main *mainl, blo_join_main((*fd)->mainlist); mainvar = (*fd)->mainlist->first; - mainl = NULL; /* blo_join_main free's mainl, cant use anymore */ + mainl = NULL; /* blo_join_main free's mainl, can't use anymore */ lib_link_all(*fd, mainvar); after_liblink_merged_bmain_process(mainvar); @@ -5206,7 +5240,7 @@ static void library_link_end(Main *mainl, * or they will go again through do_versions - bad, very bad! */ split_main_newid(mainvar, main_newid); - do_versions_after_linking(main_newid, (*fd)->reports); + do_versions_after_linking(main_newid, (*fd)->reports->reports); add_main_to_main(mainvar, main_newid); } @@ -5340,7 +5374,7 @@ static void read_library_linked_id( id->name + 2, mainvar->curlib->filepath_abs, library_parent_filepath(mainvar->curlib)); - basefd->library_id_missing_count++; + basefd->reports->count.missing_linked_id++; /* Generate a placeholder for this ID (simplified version of read_libblock actually...). */ if (r_id) { @@ -5414,7 +5448,7 @@ static void read_library_clear_weak_links(FileData *basefd, ListBase *mainlist, while (id) { ID *id_next = id->next; if ((id->tag & LIB_TAG_ID_LINK_PLACEHOLDER) && (id->flag & LIB_INDIRECT_WEAK_LINK)) { - /* printf("Dropping weak link to %s\n", id->name); */ + CLOG_INFO(&LOG, 3, "Dropping weak link to '%s'", id->name); change_link_placeholder_to_real_ID_pointer(mainlist, basefd, id, NULL); BLI_freelinkN(lbarray[a], id); } @@ -5495,7 +5529,7 @@ static FileData *read_library_file_data(FileData *basefd, if (fd == NULL) { BLO_reportf_wrap( basefd->reports, RPT_INFO, TIP_("Cannot find lib '%s'"), mainptr->curlib->filepath_abs); - basefd->library_file_missing_count++; + basefd->reports->count.missing_libraries++; } return fd; @@ -5524,11 +5558,11 @@ static void read_libraries(FileData *basefd, ListBase *mainlist) for (Main *mainptr = mainl->next; mainptr; mainptr = mainptr->next) { /* Does this library have any more linked data-blocks we need to read? */ if (has_linked_ids_to_read(mainptr)) { -#if 0 - printf("Reading linked data-blocks from %s (%s)\n", - mainptr->curlib->id.name, - mainptr->curlib->filepath); -#endif + CLOG_INFO(&LOG, + 3, + "Reading linked data-blocks from %s (%s)", + mainptr->curlib->id.name, + mainptr->curlib->filepath); /* Open file if it has not been done yet. */ FileData *fd = read_library_file_data(basefd, mainlist, mainl, mainptr); @@ -5589,15 +5623,6 @@ static void read_libraries(FileData *basefd, ListBase *mainlist) mainptr->curlib->filedata = NULL; } BKE_main_free(main_newid); - - if (basefd->library_file_missing_count != 0 || basefd->library_id_missing_count != 0) { - BKE_reportf(basefd->reports, - RPT_WARNING, - "LIB: %d libraries and %d linked data-blocks are missing, please check the " - "Info and Outliner editors for details", - basefd->library_file_missing_count, - basefd->library_id_missing_count); - } } void *BLO_read_get_new_data_address(BlendDataReader *reader, const void *old_address) @@ -5785,7 +5810,7 @@ void BLO_read_glob_list(BlendDataReader *reader, ListBase *list) link_glob_list(reader->fd, list); } -ReportList *BLO_read_data_reports(BlendDataReader *reader) +BlendFileReadReport *BLO_read_data_reports(BlendDataReader *reader) { return reader->fd->reports; } @@ -5800,7 +5825,7 @@ Main *BLO_read_lib_get_main(BlendLibReader *reader) return reader->main; } -ReportList *BLO_read_lib_reports(BlendLibReader *reader) +BlendFileReadReport *BLO_read_lib_reports(BlendLibReader *reader) { return reader->fd->reports; } diff --git a/source/blender/blenloader/intern/readfile.h b/source/blender/blenloader/intern/readfile.h index d1d4e0b3256..b04043f9641 100644 --- a/source/blender/blenloader/intern/readfile.h +++ b/source/blender/blenloader/intern/readfile.h @@ -145,11 +145,7 @@ typedef struct FileData { ListBase *old_mainlist; struct IDNameLib_Map *old_idmap; - struct ReportList *reports; - /* Counters for amount of missing libraries, and missing IDs in libraries. - * Used to generate a synthetic report in the UI. */ - int library_file_missing_count; - int library_id_missing_count; + struct BlendFileReadReport *reports; } FileData; #define SIZEOFBLENDERHEADER 12 @@ -161,11 +157,13 @@ void blo_split_main(ListBase *mainlist, struct Main *main); BlendFileData *blo_read_file_internal(FileData *fd, const char *filepath); -FileData *blo_filedata_from_file(const char *filepath, struct ReportList *reports); -FileData *blo_filedata_from_memory(const void *mem, int memsize, struct ReportList *reports); +FileData *blo_filedata_from_file(const char *filepath, struct BlendFileReadReport *reports); +FileData *blo_filedata_from_memory(const void *mem, + int memsize, + struct BlendFileReadReport *reports); FileData *blo_filedata_from_memfile(struct MemFile *memfile, const struct BlendFileReadParams *params, - struct ReportList *reports); + struct BlendFileReadReport *reports); void blo_clear_proxy_pointers_from_lib(struct Main *oldmain); void blo_make_packed_pointer_map(FileData *fd, struct Main *oldmain); diff --git a/source/blender/blenloader/intern/readfile_tempload.c b/source/blender/blenloader/intern/readfile_tempload.c index 4566e1e9b4d..1b1cbb29ef5 100644 --- a/source/blender/blenloader/intern/readfile_tempload.c +++ b/source/blender/blenloader/intern/readfile_tempload.c @@ -36,11 +36,13 @@ TempLibraryContext *BLO_library_temp_load_id(struct Main *real_main, { TempLibraryContext *temp_lib_ctx = MEM_callocN(sizeof(*temp_lib_ctx), __func__); temp_lib_ctx->bmain_base = BKE_main_new(); + temp_lib_ctx->bf_reports.reports = reports; /* Copy the file path so any path remapping is performed properly. */ STRNCPY(temp_lib_ctx->bmain_base->name, real_main->name); - temp_lib_ctx->blendhandle = BLO_blendhandle_from_file(blend_file_path, reports); + temp_lib_ctx->blendhandle = BLO_blendhandle_from_file(blend_file_path, + &temp_lib_ctx->bf_reports); BLO_library_link_params_init( &temp_lib_ctx->liblink_params, temp_lib_ctx->bmain_base, 0, LIB_TAG_TEMP_MAIN); diff --git a/source/blender/blenloader/intern/versioning_250.c b/source/blender/blenloader/intern/versioning_250.c index 990fc1d65d7..9399af5eb11 100644 --- a/source/blender/blenloader/intern/versioning_250.c +++ b/source/blender/blenloader/intern/versioning_250.c @@ -2052,7 +2052,7 @@ void blo_do_versions_250(FileData *fd, Library *lib, Main *bmain) } } - /* replace 'rim material' option for in offset*/ + /* Replace 'rim material' option for in offset. */ for (ob = bmain->objects.first; ob; ob = ob->id.next) { ModifierData *md; for (md = ob->modifiers.first; md; md = md->next) { diff --git a/source/blender/blenloader/intern/versioning_260.c b/source/blender/blenloader/intern/versioning_260.c index 3fa8e0f0e7b..3257c5a12bd 100644 --- a/source/blender/blenloader/intern/versioning_260.c +++ b/source/blender/blenloader/intern/versioning_260.c @@ -861,7 +861,7 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain) int i; for (i = 0; i < 3; i++) { if ((ob->dsize[i] == 0.0f) || /* simple case, user never touched dsize */ - (ob->scale[i] == 0.0f)) /* cant scale the dsize to give a non zero result, + (ob->scale[i] == 0.0f)) /* can't scale the dsize to give a non zero result, * so fallback to 1.0f */ { ob->dscale[i] = 1.0f; @@ -2614,9 +2614,9 @@ void do_versions_after_linking_260(Main *bmain) float input_locx = 1000000.0f, input_locy = 0.0f; float output_locx = -1000000.0f, output_locy = 0.0f; - /* rough guess, not nice but we don't have access to UI constants here ... */ - static const float offsetx = 42 + 3 * 20 + 20; - /*static const float offsety = 0.0f;*/ + /* Rough guess, not nice but we don't have access to UI constants here. */ + const float offsetx = 42 + 3 * 20 + 20; + // const float offsety = 0.0f; if (create_io_nodes) { if (ntree->inputs.first) { diff --git a/source/blender/blenloader/intern/versioning_280.c b/source/blender/blenloader/intern/versioning_280.c index bf8f7eeca5c..c6514edb417 100644 --- a/source/blender/blenloader/intern/versioning_280.c +++ b/source/blender/blenloader/intern/versioning_280.c @@ -182,7 +182,7 @@ static void do_version_workspaces_create_from_screens(Main *bmain) workspace = BKE_workspace_add(bmain, screen->id.name + 2); } if (workspace == NULL) { - continue; /* Not much we can do.. */ + continue; /* Not much we can do. */ } BKE_workspace_layout_add(bmain, workspace, screen, screen->id.name + 2); } @@ -1652,7 +1652,7 @@ void do_versions_after_linking_280(Main *bmain, ReportList *UNUSED(reports)) * which exact version fully deprecated tessfaces, so think we can keep that one here, no * harm to be expected anyway for being over-conservative. */ for (Mesh *me = bmain->meshes.first; me != NULL; me = me->id.next) { - /*check if we need to convert mfaces to mpolys*/ + /* Check if we need to convert mfaces to mpolys. */ if (me->totface && !me->totpoly) { /* temporarily switch main so that reading from * external CustomData works */ @@ -1912,7 +1912,9 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain) FOREACH_NODETREE_END; if (error & NTREE_DOVERSION_NEED_OUTPUT) { - BKE_report(fd->reports, RPT_ERROR, "Eevee material conversion problem. Error in console"); + BKE_report(fd->reports != NULL ? fd->reports->reports : NULL, + RPT_ERROR, + "Eevee material conversion problem. Error in console"); printf( "You need to connect Principled and Eevee Specular shader nodes to new material " "output " @@ -1920,7 +1922,9 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain) } if (error & NTREE_DOVERSION_TRANSPARENCY_EMISSION) { - BKE_report(fd->reports, RPT_ERROR, "Eevee material conversion problem. Error in console"); + BKE_report(fd->reports != NULL ? fd->reports->reports : NULL, + RPT_ERROR, + "Eevee material conversion problem. Error in console"); printf( "You need to combine transparency and emission shaders to the converted Principled " "shader nodes.\n"); @@ -3543,7 +3547,7 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain) } } - /* Grease pencil cutter/select segment intersection threshold */ + /* Grease pencil cutter/select segment intersection threshold. */ if (!DNA_struct_elem_find(fd->filesdna, "GP_Sculpt_Settings", "float", "isect_threshold")) { for (Scene *scene = bmain->scenes.first; scene; scene = scene->id.next) { GP_Sculpt_Settings *gset = &scene->toolsettings->gp_sculpt; @@ -3553,7 +3557,7 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain) } } - /* Fix anamorphic bokeh eevee rna limits.*/ + /* Fix anamorphic bokeh eevee rna limits. */ for (Camera *ca = bmain->cameras.first; ca; ca = ca->id.next) { if (ca->gpu_dof.ratio < 0.01f) { ca->gpu_dof.ratio = 0.01f; @@ -4920,7 +4924,7 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain) } } - /* Corrective smooth modifier scale*/ + /* Corrective smooth modifier scale. */ if (!DNA_struct_elem_find(fd->filesdna, "CorrectiveSmoothModifierData", "float", "scale")) { for (Object *ob = bmain->objects.first; ob; ob = ob->id.next) { LISTBASE_FOREACH (ModifierData *, md, &ob->modifiers) { @@ -4969,7 +4973,7 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain) } } - /* Surface deform modifier strength*/ + /* Surface deform modifier strength. */ if (!DNA_struct_elem_find(fd->filesdna, "SurfaceDeformModifierData", "float", "strength")) { for (Object *ob = bmain->objects.first; ob; ob = ob->id.next) { LISTBASE_FOREACH (ModifierData *, md, &ob->modifiers) { diff --git a/source/blender/blenloader/intern/versioning_290.c b/source/blender/blenloader/intern/versioning_290.c index 29166a2dd96..9f658a0a98c 100644 --- a/source/blender/blenloader/intern/versioning_290.c +++ b/source/blender/blenloader/intern/versioning_290.c @@ -1462,7 +1462,7 @@ void blo_do_versions_290(FileData *fd, Library *UNUSED(lib), Main *bmain) } } - /* Replace object hidden filter with inverted object visible filter. */ + /* Replace object hidden filter with inverted object visible filter. */ LISTBASE_FOREACH (bScreen *, screen, &bmain->screens) { LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) { LISTBASE_FOREACH (SpaceLink *, space, &area->spacedata) { @@ -2082,7 +2082,7 @@ void blo_do_versions_290(FileData *fd, Library *UNUSED(lib), Main *bmain) } } - /* Initialize the spread parameter for area lights*/ + /* Initialize the spread parameter for area lights. */ if (!DNA_struct_elem_find(fd->filesdna, "Lamp", "float", "area_spread")) { LISTBASE_FOREACH (Light *, la, &bmain->lights) { la->area_spread = DEG2RADF(180.0f); diff --git a/source/blender/blenloader/intern/versioning_300.c b/source/blender/blenloader/intern/versioning_300.c index 0fe1267b871..85b063ae54c 100644 --- a/source/blender/blenloader/intern/versioning_300.c +++ b/source/blender/blenloader/intern/versioning_300.c @@ -40,7 +40,9 @@ #include "BKE_node.h" #include "BLO_readfile.h" +#include "MEM_guardedalloc.h" #include "readfile.h" +#include "versioning_common.h" #include "MEM_guardedalloc.h" @@ -122,6 +124,7 @@ void do_versions_after_linking_300(Main *bmain, ReportList *UNUSED(reports)) sort_linked_ids(bmain); assert_sorted_ids(bmain); } + if (MAIN_VERSION_ATLEAST(bmain, 300, 3)) { assert_sorted_ids(bmain); } @@ -392,6 +395,26 @@ void blo_do_versions_300(FileData *fd, Library *UNUSED(lib), Main *bmain) } } + if (!MAIN_VERSION_ATLEAST(bmain, 300, 5)) { + /* Add a dataset sidebar to the spreadsheet editor. */ + LISTBASE_FOREACH (bScreen *, screen, &bmain->screens) { + LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) { + LISTBASE_FOREACH (SpaceLink *, sl, &area->spacedata) { + if (sl->spacetype == SPACE_SPREADSHEET) { + ListBase *regionbase = (sl == area->spacedata.first) ? &area->regionbase : + &sl->regionbase; + ARegion *spreadsheet_dataset_region = do_versions_add_region_if_not_found( + regionbase, RGN_TYPE_CHANNELS, "spreadsheet dataset region", RGN_TYPE_FOOTER); + + if (spreadsheet_dataset_region) { + spreadsheet_dataset_region->alignment = RGN_ALIGN_LEFT; + spreadsheet_dataset_region->v2d.scroll = (V2D_SCROLL_RIGHT | V2D_SCROLL_BOTTOM); + } + } + } + } + } + } /** * Versioning code until next subversion bump goes here. * diff --git a/source/blender/blenloader/intern/versioning_legacy.c b/source/blender/blenloader/intern/versioning_legacy.c index 56b2f18f8a6..46e25251fd4 100644 --- a/source/blender/blenloader/intern/versioning_legacy.c +++ b/source/blender/blenloader/intern/versioning_legacy.c @@ -363,7 +363,7 @@ static void customdata_version_242(Mesh *me) BKE_mesh_update_customdata_pointers(me, true); } -/*only copy render texface layer from active*/ +/* Only copy render texface layer from active. */ static void customdata_version_243(Mesh *me) { CustomDataLayer *layer; @@ -1266,8 +1266,8 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain) } cam = cam->id.next; } - /* force oops draw if depgraph was set*/ - /* set time line var */ + /* Force oops draw if depgraph was set. */ + /* Set time line var. */ /* softbody init new vars */ for (ob = bmain->objects.first; ob; ob = ob->id.next) { @@ -2021,7 +2021,7 @@ void blo_do_versions_pre250(FileData *fd, Library *lib, Main *bmain) /* fix all versions before 2.45 */ if (bmain->versionfile != 245) { - /* repair preview from 242 - 244*/ + /* Repair preview from 242 - 244. */ for (ima = bmain->images.first; ima; ima = ima->id.next) { ima->preview = NULL; } diff --git a/source/blender/blenloader/intern/versioning_userdef.c b/source/blender/blenloader/intern/versioning_userdef.c index be3834faa5a..42b27f57e2c 100644 --- a/source/blender/blenloader/intern/versioning_userdef.c +++ b/source/blender/blenloader/intern/versioning_userdef.c @@ -277,6 +277,15 @@ static void do_versions_theme(const UserDef *userdef, bTheme *btheme) btheme->space_spreadsheet = btheme->space_outliner; } + if (!USER_VERSION_ATLEAST(300, 5)) { + FROM_DEFAULT_V4_UCHAR(space_spreadsheet.active); + FROM_DEFAULT_V4_UCHAR(space_spreadsheet.list); + FROM_DEFAULT_V4_UCHAR(space_spreadsheet.list_text); + FROM_DEFAULT_V4_UCHAR(space_spreadsheet.list_text_hi); + FROM_DEFAULT_V4_UCHAR(space_spreadsheet.hilite); + FROM_DEFAULT_V4_UCHAR(space_spreadsheet.selected_highlight); + } + /** * Versioning code until next subversion bump goes here. * diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c index 38c00b3f132..930ce0ba06f 100644 --- a/source/blender/blenloader/intern/writefile.c +++ b/source/blender/blenloader/intern/writefile.c @@ -262,7 +262,7 @@ typedef struct { size_t write_len; #endif - /** Set on unlikely case of an error (ignores further file writing). */ + /** Set on unlikely case of an error (ignores further file writing). */ bool error; /** #MemFile writing (used for undo). */ @@ -605,7 +605,7 @@ static void writelist_id(WriteData *wd, int filecode, const char *structname, co * \{ */ /** - * Take care using 'use_active_win', since we wont want the currently active window + * Take care using 'use_active_win', since we won't want the currently active window * to change which scene renders (currently only used for undo). */ static void current_screen_compat(Main *mainvar, diff --git a/source/blender/blenloader/tests/blendfile_loading_base_test.cc b/source/blender/blenloader/tests/blendfile_loading_base_test.cc index 280a4b42b36..e93348b2158 100644 --- a/source/blender/blenloader/tests/blendfile_loading_base_test.cc +++ b/source/blender/blenloader/tests/blendfile_loading_base_test.cc @@ -123,7 +123,8 @@ bool BlendfileLoadingBaseTest::blendfile_load(const char *filepath) char abspath[FILENAME_MAX]; BLI_path_join(abspath, sizeof(abspath), test_assets_dir.c_str(), filepath, NULL); - bfile = BLO_read_from_file(abspath, BLO_READ_SKIP_NONE, nullptr /* reports */); + BlendFileReadReport bf_reports = {NULL}; + bfile = BLO_read_from_file(abspath, BLO_READ_SKIP_NONE, &bf_reports); if (bfile == nullptr) { ADD_FAILURE() << "Unable to load file '" << filepath << "' from test assets dir '" << test_assets_dir << "'"; diff --git a/source/blender/blentranslation/BLT_translation.h b/source/blender/blentranslation/BLT_translation.h index b8979caa909..341e648443e 100644 --- a/source/blender/blentranslation/BLT_translation.h +++ b/source/blender/blentranslation/BLT_translation.h @@ -119,7 +119,7 @@ bool BLT_lang_is_ime_supported(void); #define BLT_I18NCONTEXT_ID_HAIR "Hair" #define BLT_I18NCONTEXT_ID_ID "ID" #define BLT_I18NCONTEXT_ID_IMAGE "Image" -/*#define BLT_I18NCONTEXT_ID_IPO "Ipo"*/ /* Deprecated */ +// #define BLT_I18NCONTEXT_ID_IPO "Ipo" /* DEPRECATED */ #define BLT_I18NCONTEXT_ID_SHAPEKEY "Key" #define BLT_I18NCONTEXT_ID_SIMULATION "Simulation" #define BLT_I18NCONTEXT_ID_LIGHT "Light" @@ -182,7 +182,7 @@ typedef struct { BLT_I18NCONTEXTS_ITEM(BLT_I18NCONTEXT_ID_ID, "id_id"), \ BLT_I18NCONTEXTS_ITEM( \ BLT_I18NCONTEXT_ID_IMAGE, \ - "id_image"), /*BLT_I18NCONTEXTS_ITEM(BLT_I18NCONTEXT_ID_IPO, "id_ipo"),*/ \ + "id_image"), /* BLT_I18NCONTEXTS_ITEM(BLT_I18NCONTEXT_ID_IPO, "id_ipo"), */ \ BLT_I18NCONTEXTS_ITEM(BLT_I18NCONTEXT_ID_SHAPEKEY, "id_shapekey"), \ BLT_I18NCONTEXTS_ITEM(BLT_I18NCONTEXT_ID_LIGHT, "id_light"), \ BLT_I18NCONTEXTS_ITEM(BLT_I18NCONTEXT_ID_LIBRARY, "id_library"), \ diff --git a/source/blender/bmesh/bmesh_class.h b/source/blender/bmesh/bmesh_class.h index f61921cd61c..727c2dd2ea9 100644 --- a/source/blender/bmesh/bmesh_class.h +++ b/source/blender/bmesh/bmesh_class.h @@ -26,7 +26,7 @@ */ /* disable holes for now, - * these are ifdef'd because they use more memory and cant be saved in DNA currently */ + * these are ifdef'd because they use more memory and can't be saved in DNA currently */ // #define USE_BMESH_HOLES struct BMEdge; @@ -91,9 +91,9 @@ typedef struct BMHeader { BLI_STATIC_ASSERT((sizeof(BMHeader) <= 16), "BMHeader size has grown!"); -/* note: need some way to specify custom locations for custom data layers. so we can +/* NOTE: need some way to specify custom locations for custom data layers. so we can * make them point directly into structs. and some way to make it only happen to the - * active layer, and properly update when switching active layers.*/ + * active layer, and properly update when switching active layers. */ typedef struct BMVert { BMHeader head; @@ -269,7 +269,7 @@ typedef struct BMFace { BMHeader head; #ifdef USE_BMESH_HOLES - int totbounds; /*total boundaries, is one plus the number of holes in the face*/ + int totbounds; /* Total boundaries, is one plus the number of holes in the face. */ ListBase loops; #else BMLoop *l_first; @@ -348,7 +348,7 @@ typedef struct BMesh { /* Should be copy of scene select mode. */ /* Stored in #BMEditMesh too, this is a bit confusing, * make sure they're in sync! - * Only use when the edit mesh cant be accessed - campbell */ + * Only use when the edit mesh can't be accessed - campbell */ short selectmode; /* ID of the shape key this bmesh came from */ @@ -550,7 +550,7 @@ typedef bool (*BMLoopPairFilterFunc)(const BMLoop *, const BMLoop *, void *user_ #define BM_ELEM_CD_GET_FLOAT_AS_UCHAR(ele, offset) \ (BLI_assert(offset != -1), (uchar)(BM_ELEM_CD_GET_FLOAT(ele, offset) * 255.0f)) -/*forward declarations*/ +/* Forward declarations. */ #ifdef USE_BMESH_HOLES # define BM_FACE_FIRST_LOOP(p) (((BMLoopList *)((p)->loops.first))->first) diff --git a/source/blender/bmesh/intern/bmesh_construct.c b/source/blender/bmesh/intern/bmesh_construct.c index 3eab252df7a..f79f1925560 100644 --- a/source/blender/bmesh/intern/bmesh_construct.c +++ b/source/blender/bmesh/intern/bmesh_construct.c @@ -673,7 +673,7 @@ BMesh *BM_mesh_copy(BMesh *bm_old) ftable = MEM_mallocN(sizeof(BMFace *) * bm_old->totface, "BM_mesh_copy ftable"); BM_ITER_MESH_INDEX (v, &iter, bm_old, BM_VERTS_OF_MESH, i) { - /* copy between meshes so cant use 'example' argument */ + /* copy between meshes so can't use 'example' argument */ v_new = BM_vert_create(bm_new, v->co, NULL, BM_CREATE_SKIP_CD); BM_elem_attrs_copy_ex(bm_old, bm_new, v, v_new, 0xff, 0x0); v_new->head.hflag = v->head.hflag; /* low level! don't do this for normal api use */ diff --git a/source/blender/bmesh/intern/bmesh_edgeloop.c b/source/blender/bmesh/intern/bmesh_edgeloop.c index 51a6ada6c42..f937ccbccc5 100644 --- a/source/blender/bmesh/intern/bmesh_edgeloop.c +++ b/source/blender/bmesh/intern/bmesh_edgeloop.c @@ -50,7 +50,7 @@ typedef struct BMEdgeLoopStore { #define EDGELOOP_EPS 1e-10f /* -------------------------------------------------------------------- */ -/* BM_mesh_edgeloops_find & Util Functions */ +/* BM_mesh_edgeloops_find & Util Functions. */ static int bm_vert_other_tag(BMVert *v, BMVert *v_prev, BMEdge **r_e) { @@ -187,7 +187,7 @@ int BM_mesh_edgeloops_find(BMesh *bm, } /* -------------------------------------------------------------------- */ -/* BM_mesh_edgeloops_find_path & Util Functions */ +/* BM_mesh_edgeloops_find_path & Util Functions. */ /** * Find s single, open edge loop - given 2 vertices. diff --git a/source/blender/bmesh/intern/bmesh_error.h b/source/blender/bmesh/intern/bmesh_error.h index 41d02e334fb..587e33e7dfd 100644 --- a/source/blender/bmesh/intern/bmesh_error.h +++ b/source/blender/bmesh/intern/bmesh_error.h @@ -24,12 +24,12 @@ /*----------- bmop error system ----------*/ -/* pushes an error onto the bmesh error stack. +/* Pushes an error onto the bmesh error stack. * if msg is null, then the default message for the `errcode` is used. */ void BMO_error_raise(BMesh *bm, BMOperator *owner, int errcode, const char *msg); -/* gets the topmost error from the stack. - * returns error code or 0 if no error.*/ +/* Gets the topmost error from the stack. + * returns error code or 0 if no error. */ int BMO_error_get(BMesh *bm, const char **msg, BMOperator **op); bool BMO_error_occurred(BMesh *bm); @@ -37,23 +37,22 @@ bool BMO_error_occurred(BMesh *bm); int BMO_error_pop(BMesh *bm, const char **msg, BMOperator **op); void BMO_error_clear(BMesh *bm); -/* this is meant for handling errors, like self-intersection test failures. +/* This is meant for handling errors, like self-intersection test failures. * it's dangerous to handle errors in general though, so disabled for now. */ -/* catches an error raised by the op pointed to by catchop. +/* Catches an error raised by the op pointed to by catchop. * errorcode is either the errorcode, or BMERR_ALL for any - * error.*/ + * error. */ -/* not yet implemented. - * int BMO_error_catch_op(BMesh *bm, BMOperator *catchop, int errorcode, char **msg); - */ +/* Not yet implemented. */ +// int BMO_error_catch_op(BMesh *bm, BMOperator *catchop, int errorcode, char **msg); #define BM_ELEM_INDEX_VALIDATE(_bm, _msg_a, _msg_b) \ BM_mesh_elem_index_validate(_bm, __FILE__ ":" STRINGIFY(__LINE__), __func__, _msg_a, _msg_b) /*------ error code defines -------*/ -/*error messages*/ +/** Error messages. */ enum { BMERR_CONNECTVERT_FAILED = 1, BMERR_DISSOLVEFACES_FAILED, @@ -71,8 +70,8 @@ enum { # define _BMESH_DUMMY_ABORT() (void)0 #endif -/* this is meant to be higher level than BLI_assert(), - * its enabled even when in Release mode*/ +/* This is meant to be higher level than BLI_assert(), + * its enabled even when in Release mode. */ #define BMESH_ASSERT(a) \ (void)((!(a)) ? ((fprintf(stderr, \ "BMESH_ASSERT failed: %s, %s(), %d at \'%s\'\n", \ diff --git a/source/blender/bmesh/intern/bmesh_inline.h b/source/blender/bmesh/intern/bmesh_inline.h index 2888d7e7526..4350b4d04ed 100644 --- a/source/blender/bmesh/intern/bmesh_inline.h +++ b/source/blender/bmesh/intern/bmesh_inline.h @@ -95,7 +95,7 @@ BLI_INLINE void _bm_elem_flag_merge_into(BMHeader *head, /** * notes on #BM_elem_index_set(...) usage, - * Set index is sometimes abused as temp storage, other times we cant be + * Set index is sometimes abused as temp storage, other times we can't be * sure if the index values are valid because certain operations have modified * the mesh structure. * diff --git a/source/blender/bmesh/intern/bmesh_iterators.h b/source/blender/bmesh/intern/bmesh_iterators.h index f2e7a48a16c..470aceeb756 100644 --- a/source/blender/bmesh/intern/bmesh_iterators.h +++ b/source/blender/bmesh/intern/bmesh_iterators.h @@ -61,11 +61,11 @@ typedef enum BMIterType { BM_LOOPS_OF_FACE = 11, /* returns elements from all boundaries, and returns * the first element at the end to flag that we're entering - * a different face hole boundary*/ + * a different face hole boundary. */ // BM_ALL_LOOPS_OF_FACE = 12, /* iterate through loops around this loop, which are fetched * from the other faces in the radial cycle surrounding the - * input loop's edge.*/ + * input loop's edge. */ BM_LOOPS_OF_LOOP = 12, BM_LOOPS_OF_EDGE = 13, } BMIterType; diff --git a/source/blender/bmesh/intern/bmesh_marking.c b/source/blender/bmesh/intern/bmesh_marking.c index 88b1d9f058e..8e1f1bc019f 100644 --- a/source/blender/bmesh/intern/bmesh_marking.c +++ b/source/blender/bmesh/intern/bmesh_marking.c @@ -330,6 +330,106 @@ void BM_mesh_select_mode_clean(BMesh *bm) BM_mesh_select_mode_clean_ex(bm, bm->selectmode); } +/* -------------------------------------------------------------------- */ +/** \name Select mode flush selection + * \{ */ + +typedef struct SelectionFlushChunkData { + int delta_selection_len; +} SelectionFlushChunkData; + +static void bm_mesh_select_mode_flush_vert_to_edge_iter_fn(void *UNUSED(userdata), + MempoolIterData *iter, + const TaskParallelTLS *__restrict tls) +{ + SelectionFlushChunkData *chunk_data = tls->userdata_chunk; + BMEdge *e = (BMEdge *)iter; + const bool is_selected = BM_elem_flag_test(e, BM_ELEM_SELECT); + const bool is_hidden = BM_elem_flag_test(e, BM_ELEM_HIDDEN); + if (!is_hidden && + (BM_elem_flag_test(e->v1, BM_ELEM_SELECT) && BM_elem_flag_test(e->v2, BM_ELEM_SELECT))) { + BM_elem_flag_enable(e, BM_ELEM_SELECT); + chunk_data->delta_selection_len += is_selected ? 0 : 1; + } + else { + BM_elem_flag_disable(e, BM_ELEM_SELECT); + chunk_data->delta_selection_len += is_selected ? -1 : 0; + } +} + +static void bm_mesh_select_mode_flush_edge_to_face_iter_fn(void *UNUSED(userdata), + MempoolIterData *iter, + const TaskParallelTLS *__restrict tls) +{ + SelectionFlushChunkData *chunk_data = tls->userdata_chunk; + BMFace *f = (BMFace *)iter; + BMLoop *l_iter; + BMLoop *l_first; + const bool is_selected = BM_elem_flag_test(f, BM_ELEM_SELECT); + bool ok = true; + if (!BM_elem_flag_test(f, BM_ELEM_HIDDEN)) { + l_iter = l_first = BM_FACE_FIRST_LOOP(f); + do { + if (!BM_elem_flag_test(l_iter->e, BM_ELEM_SELECT)) { + ok = false; + break; + } + } while ((l_iter = l_iter->next) != l_first); + } + else { + ok = false; + } + + BM_elem_flag_set(f, BM_ELEM_SELECT, ok); + if (is_selected && !ok) { + chunk_data->delta_selection_len -= 1; + } + else if (ok && !is_selected) { + chunk_data->delta_selection_len += 1; + } +} + +static void bm_mesh_select_mode_flush_reduce_fn(const void *__restrict UNUSED(userdata), + void *__restrict chunk_join, + void *__restrict chunk) +{ + SelectionFlushChunkData *dst = chunk_join; + const SelectionFlushChunkData *src = chunk; + dst->delta_selection_len += src->delta_selection_len; +} + +static void bm_mesh_select_mode_flush_vert_to_edge(BMesh *bm) +{ + SelectionFlushChunkData chunk_data = {0}; + + TaskParallelSettings settings; + BLI_parallel_range_settings_defaults(&settings); + settings.use_threading = bm->totedge >= BM_OMP_LIMIT; + settings.userdata_chunk = &chunk_data; + settings.userdata_chunk_size = sizeof(chunk_data); + settings.func_reduce = bm_mesh_select_mode_flush_reduce_fn; + + BM_iter_parallel( + bm, BM_EDGES_OF_MESH, bm_mesh_select_mode_flush_vert_to_edge_iter_fn, NULL, &settings); + bm->totedgesel += chunk_data.delta_selection_len; +} + +static void bm_mesh_select_mode_flush_edge_to_face(BMesh *bm) +{ + SelectionFlushChunkData chunk_data = {0}; + + TaskParallelSettings settings; + BLI_parallel_range_settings_defaults(&settings); + settings.use_threading = bm->totface >= BM_OMP_LIMIT; + settings.userdata_chunk = &chunk_data; + settings.userdata_chunk_size = sizeof(chunk_data); + settings.func_reduce = bm_mesh_select_mode_flush_reduce_fn; + + BM_iter_parallel( + bm, BM_FACES_OF_MESH, bm_mesh_select_mode_flush_edge_to_face_iter_fn, NULL, &settings); + bm->totfacesel += chunk_data.delta_selection_len; +} + /** * \brief Select Mode Flush * @@ -339,55 +439,12 @@ void BM_mesh_select_mode_clean(BMesh *bm) */ void BM_mesh_select_mode_flush_ex(BMesh *bm, const short selectmode, eBMSelectionFlushFLags flags) { - BMEdge *e; - BMLoop *l_iter; - BMLoop *l_first; - BMFace *f; - - BMIter eiter; - BMIter fiter; - if (selectmode & SCE_SELECT_VERTEX) { - /* both loops only set edge/face flags and read off verts */ - BM_ITER_MESH (e, &eiter, bm, BM_EDGES_OF_MESH) { - const bool is_selected = BM_elem_flag_test(e, BM_ELEM_SELECT); - if (!is_selected && - (BM_elem_flag_test(e->v1, BM_ELEM_SELECT) && BM_elem_flag_test(e->v2, BM_ELEM_SELECT))) { - BM_elem_flag_enable(e, BM_ELEM_SELECT); - bm->totedgesel += 1; - } - else { - BM_elem_flag_disable(e, BM_ELEM_SELECT); - bm->totedgesel += is_selected ? -1 : 0; - } - } + bm_mesh_select_mode_flush_vert_to_edge(bm); } if (selectmode & (SCE_SELECT_VERTEX | SCE_SELECT_EDGE)) { - BM_ITER_MESH (f, &fiter, bm, BM_FACES_OF_MESH) { - const bool is_selected = BM_elem_flag_test(f, BM_ELEM_SELECT); - bool ok = true; - if (!BM_elem_flag_test(f, BM_ELEM_HIDDEN)) { - l_iter = l_first = BM_FACE_FIRST_LOOP(f); - do { - if (!BM_elem_flag_test(l_iter->e, BM_ELEM_SELECT)) { - ok = false; - break; - } - } while ((l_iter = l_iter->next) != l_first); - } - else { - ok = false; - } - - BM_elem_flag_set(f, BM_ELEM_SELECT, ok); - if (is_selected && !ok) { - bm->totfacesel -= 1; - } - else if (ok && !is_selected) { - bm->totfacesel += 1; - } - } + bm_mesh_select_mode_flush_edge_to_face(bm); } /* Remove any deselected elements from the BMEditSelection */ @@ -410,6 +467,8 @@ void BM_mesh_select_mode_flush(BMesh *bm) BM_mesh_select_mode_flush_ex(bm, bm->selectmode, BM_SELECT_LEN_FLUSH_RECALC_ALL); } +/** \} */ + /** * mode independent flushing up/down */ diff --git a/source/blender/bmesh/intern/bmesh_marking.h b/source/blender/bmesh/intern/bmesh_marking.h index ff6c359138a..99feae1d66c 100644 --- a/source/blender/bmesh/intern/bmesh_marking.h +++ b/source/blender/bmesh/intern/bmesh_marking.h @@ -68,8 +68,8 @@ void BM_mesh_elem_hflag_disable_all(BMesh *bm, const char hflag, const bool respecthide); -/* individual element select functions, BM_elem_select_set is a shortcut for these - * that automatically detects which one to use*/ +/* Individual element select functions, BM_elem_select_set is a shortcut for these + * that automatically detects which one to use. */ void BM_vert_select_set(BMesh *bm, BMVert *v, const bool select); void BM_edge_select_set(BMesh *bm, BMEdge *e, const bool select); void BM_face_select_set(BMesh *bm, BMFace *f, const bool select); diff --git a/source/blender/bmesh/intern/bmesh_mesh.c b/source/blender/bmesh/intern/bmesh_mesh.c index c8e4e182b12..04d775607e8 100644 --- a/source/blender/bmesh/intern/bmesh_mesh.c +++ b/source/blender/bmesh/intern/bmesh_mesh.c @@ -825,8 +825,8 @@ void BM_mesh_remap(BMesh *bm, const uint *vert_idx, const uint *edge_idx, const BMVert **verts_pool, *verts_copy, **vep; int i, totvert = bm->totvert; const uint *new_idx; - /* Special case: Python uses custom - data layers to hold PyObject references. - * These have to be kept in - place, else the PyObject's we point to, wont point back to us. */ + /* Special case: Python uses custom data layers to hold PyObject references. + * These have to be kept in place, else the PyObjects we point to, won't point back to us. */ const int cd_vert_pyptr = CustomData_get_offset(&bm->vdata, CD_BM_ELEM_PYPTR); /* Init the old-to-new vert pointers mapping */ @@ -839,7 +839,7 @@ void BM_mesh_remap(BMesh *bm, const uint *vert_idx, const uint *edge_idx, const for (i = totvert, ve = verts_copy + totvert - 1, vep = verts_pool + totvert - 1; i--; ve--, vep--) { *ve = **vep; - /* printf("*vep: %p, verts_pool[%d]: %p\n", *vep, i, verts_pool[i]);*/ + // printf("*vep: %p, verts_pool[%d]: %p\n", *vep, i, verts_pool[i]); if (cd_vert_pyptr != -1) { void **pyptr = BM_ELEM_CD_GET_VOID_P(((BMElem *)ve), cd_vert_pyptr); pyptrs[i] = *pyptr; @@ -877,8 +877,8 @@ void BM_mesh_remap(BMesh *bm, const uint *vert_idx, const uint *edge_idx, const BMEdge **edges_pool, *edges_copy, **edp; int i, totedge = bm->totedge; const uint *new_idx; - /* Special case: Python uses custom - data layers to hold PyObject references. - * These have to be kept in - place, else the PyObject's we point to, wont point back to us. */ + /* Special case: Python uses custom data layers to hold PyObject references. + * These have to be kept in place, else the PyObjects we point to, won't point back to us. */ const int cd_edge_pyptr = CustomData_get_offset(&bm->edata, CD_BM_ELEM_PYPTR); /* Init the old-to-new vert pointers mapping */ @@ -928,8 +928,8 @@ void BM_mesh_remap(BMesh *bm, const uint *vert_idx, const uint *edge_idx, const BMFace **faces_pool, *faces_copy, **fap; int i, totface = bm->totface; const uint *new_idx; - /* Special case: Python uses custom - data layers to hold PyObject references. - * These have to be kept in - place, else the PyObject's we point to, wont point back to us. */ + /* Special case: Python uses custom data layers to hold PyObject references. + * These have to be kept in place, else the PyObjects we point to, won't point back to us. */ const int cd_poly_pyptr = CustomData_get_offset(&bm->pdata, CD_BM_ELEM_PYPTR); /* Init the old-to-new vert pointers mapping */ @@ -975,7 +975,7 @@ void BM_mesh_remap(BMesh *bm, const uint *vert_idx, const uint *edge_idx, const /* Verts' pointers, only edge pointers... */ if (eptr_map) { BM_ITER_MESH (ve, &iter, bm, BM_VERTS_OF_MESH) { - /* printf("Vert e: %p -> %p\n", ve->e, BLI_ghash_lookup(eptr_map, ve->e));*/ + // printf("Vert e: %p -> %p\n", ve->e, BLI_ghash_lookup(eptr_map, ve->e)); if (ve->e) { ve->e = BLI_ghash_lookup(eptr_map, ve->e); BLI_assert(ve->e); @@ -989,22 +989,30 @@ void BM_mesh_remap(BMesh *bm, const uint *vert_idx, const uint *edge_idx, const if (vptr_map || eptr_map) { BM_ITER_MESH (ed, &iter, bm, BM_EDGES_OF_MESH) { if (vptr_map) { - /* printf("Edge v1: %p -> %p\n", ed->v1, BLI_ghash_lookup(vptr_map, ed->v1));*/ - /* printf("Edge v2: %p -> %p\n", ed->v2, BLI_ghash_lookup(vptr_map, ed->v2));*/ +#if 0 + printf("Edge v1: %p -> %p\n", ed->v1, BLI_ghash_lookup(vptr_map, ed->v1)); + printf("Edge v2: %p -> %p\n", ed->v2, BLI_ghash_lookup(vptr_map, ed->v2)); +#endif ed->v1 = BLI_ghash_lookup(vptr_map, ed->v1); ed->v2 = BLI_ghash_lookup(vptr_map, ed->v2); BLI_assert(ed->v1); BLI_assert(ed->v2); } if (eptr_map) { - /* printf("Edge v1_disk_link prev: %p -> %p\n", ed->v1_disk_link.prev,*/ - /* BLI_ghash_lookup(eptr_map, ed->v1_disk_link.prev));*/ - /* printf("Edge v1_disk_link next: %p -> %p\n", ed->v1_disk_link.next,*/ - /* BLI_ghash_lookup(eptr_map, ed->v1_disk_link.next));*/ - /* printf("Edge v2_disk_link prev: %p -> %p\n", ed->v2_disk_link.prev,*/ - /* BLI_ghash_lookup(eptr_map, ed->v2_disk_link.prev));*/ - /* printf("Edge v2_disk_link next: %p -> %p\n", ed->v2_disk_link.next,*/ - /* BLI_ghash_lookup(eptr_map, ed->v2_disk_link.next));*/ +#if 0 + printf("Edge v1_disk_link prev: %p -> %p\n", + ed->v1_disk_link.prev, + BLI_ghash_lookup(eptr_map, ed->v1_disk_link.prev)); + printf("Edge v1_disk_link next: %p -> %p\n", + ed->v1_disk_link.next, + BLI_ghash_lookup(eptr_map, ed->v1_disk_link.next)); + printf("Edge v2_disk_link prev: %p -> %p\n", + ed->v2_disk_link.prev, + BLI_ghash_lookup(eptr_map, ed->v2_disk_link.prev)); + printf("Edge v2_disk_link next: %p -> %p\n", + ed->v2_disk_link.next, + BLI_ghash_lookup(eptr_map, ed->v2_disk_link.next)); +#endif ed->v1_disk_link.prev = BLI_ghash_lookup(eptr_map, ed->v1_disk_link.prev); ed->v1_disk_link.next = BLI_ghash_lookup(eptr_map, ed->v1_disk_link.next); ed->v2_disk_link.prev = BLI_ghash_lookup(eptr_map, ed->v2_disk_link.prev); @@ -1021,17 +1029,17 @@ void BM_mesh_remap(BMesh *bm, const uint *vert_idx, const uint *edge_idx, const BM_ITER_MESH (fa, &iter, bm, BM_FACES_OF_MESH) { BM_ITER_ELEM (lo, &iterl, fa, BM_LOOPS_OF_FACE) { if (vptr_map) { - /* printf("Loop v: %p -> %p\n", lo->v, BLI_ghash_lookup(vptr_map, lo->v));*/ + // printf("Loop v: %p -> %p\n", lo->v, BLI_ghash_lookup(vptr_map, lo->v)); lo->v = BLI_ghash_lookup(vptr_map, lo->v); BLI_assert(lo->v); } if (eptr_map) { - /* printf("Loop e: %p -> %p\n", lo->e, BLI_ghash_lookup(eptr_map, lo->e));*/ + // printf("Loop e: %p -> %p\n", lo->e, BLI_ghash_lookup(eptr_map, lo->e)); lo->e = BLI_ghash_lookup(eptr_map, lo->e); BLI_assert(lo->e); } if (fptr_map) { - /* printf("Loop f: %p -> %p\n", lo->f, BLI_ghash_lookup(fptr_map, lo->f));*/ + // printf("Loop f: %p -> %p\n", lo->f, BLI_ghash_lookup(fptr_map, lo->f)); lo->f = BLI_ghash_lookup(fptr_map, lo->f); BLI_assert(lo->f); } diff --git a/source/blender/bmesh/intern/bmesh_mesh_convert.c b/source/blender/bmesh/intern/bmesh_mesh_convert.c index 216a580a8d1..ad82d5d69aa 100644 --- a/source/blender/bmesh/intern/bmesh_mesh_convert.c +++ b/source/blender/bmesh/intern/bmesh_mesh_convert.c @@ -1076,7 +1076,7 @@ void BM_mesh_bm_to_me( /* Topology could be changed, ensure #CD_MDISPS are ok. */ multires_topology_changed(me); - /* To be removed as soon as COW is enabled by default.. */ + /* To be removed as soon as COW is enabled by default. */ BKE_mesh_runtime_clear_geometry(me); diff --git a/source/blender/bmesh/intern/bmesh_mesh_normals.c b/source/blender/bmesh/intern/bmesh_mesh_normals.c index bddd3da98b7..db09bbff97c 100644 --- a/source/blender/bmesh/intern/bmesh_mesh_normals.c +++ b/source/blender/bmesh/intern/bmesh_mesh_normals.c @@ -292,6 +292,10 @@ void BM_mesh_normals_update_with_partial_ex(BMesh *UNUSED(bm), const struct BMeshNormalsUpdate_Params *params) { BLI_assert(bmpinfo->params.do_normals); + /* While harmless, exit early if there is nothing to do. */ + if (UNLIKELY((bmpinfo->verts_len == 0) && (bmpinfo->faces_len == 0))) { + return; + } BMVert **verts = bmpinfo->verts; BMFace **faces = bmpinfo->faces; @@ -1542,7 +1546,7 @@ static int bm_loop_normal_mark_indiv(BMesh *bm, BLI_bitmap *loops, const bool do /* Using face history allows to select a single loop from a single face... * Note that this is O(n^2) piece of code, * but it is not designed to be used with huge selection sets, - * rather with only a few items selected at most.*/ + * rather with only a few items selected at most. */ /* Goes from last selected to the first selected element. */ for (ese = bm->selected.last; ese; ese = ese->prev) { if (ese->htype == BM_FACE) { diff --git a/source/blender/bmesh/intern/bmesh_mesh_partial_update.c b/source/blender/bmesh/intern/bmesh_mesh_partial_update.c index 267705aa7c7..46fd2ad9a31 100644 --- a/source/blender/bmesh/intern/bmesh_mesh_partial_update.c +++ b/source/blender/bmesh/intern/bmesh_mesh_partial_update.c @@ -25,16 +25,26 @@ * * In the future this could be integrated into GPU updates too. * - * Potential Improvements - * ====================== + * Kinds of Partial Geometry + * ========================= * - * Some calculations could be significantly limited in the case of affine transformations - * (tessellation is an obvious candidate). Where only faces which have a mix - * of tagged and untagged vertices would need to be recalculated. + * All Tagged + * ---------- + * Operate on everything that's tagged as well as connected geometry. + * see: #BM_mesh_partial_create_from_verts * - * In general this would work well besides some corner cases such as scaling to zero. - * Although the exact result may depend on the normal (for N-GONS), - * so for now update the tessellation of all tagged geometry. + * Grouped + * ------- + * Operate on everything that is connected to both tagged and un-tagged. + * see: #BM_mesh_partial_create_from_verts_group_single + * + * Reduces computations when transforming isolated regions. + * + * Optionally support multiple groups since axis-mirror (for example) + * will transform vertices in different directions, as well as keeping centered vertices. + * see: #BM_mesh_partial_create_from_verts_group_multi + * + * \note Others can be added as needed. */ #include "DNA_object_types.h" @@ -93,21 +103,24 @@ BLI_INLINE bool partial_elem_face_ensure(BMPartialUpdate *bmpinfo, return false; } +/** + * All Tagged & Connected, see: #BM_mesh_partial_create_from_verts + * Operate on everything that's tagged as well as connected geometry. + */ BMPartialUpdate *BM_mesh_partial_create_from_verts(BMesh *bm, const BMPartialUpdate_Params *params, - const int verts_len, - bool (*filter_fn)(BMVert *, void *user_data), - void *user_data) + const BLI_bitmap *verts_mask, + const int verts_mask_count) { /* The caller is doing something wrong if this isn't the case. */ - BLI_assert(verts_len <= bm->totvert); + BLI_assert(verts_mask_count <= bm->totvert); BMPartialUpdate *bmpinfo = MEM_callocN(sizeof(*bmpinfo), __func__); /* Reserve more edges than vertices since it's common for a grid topology * to use around twice as many edges as vertices. */ - const int default_verts_len_alloc = verts_len; - const int default_faces_len_alloc = min_ii(bm->totface, verts_len); + const int default_verts_len_alloc = verts_mask_count; + const int default_faces_len_alloc = min_ii(bm->totface, verts_mask_count); /* Allocate tags instead of using #BM_ELEM_TAG because the caller may already be using tags. * Further, walking over all geometry to clear the tags isn't so efficient. */ @@ -143,7 +156,7 @@ BMPartialUpdate *BM_mesh_partial_create_from_verts(BMesh *bm, int i; BM_ITER_MESH_INDEX (v, &iter, bm, BM_VERTS_OF_MESH, i) { BM_elem_index_set(v, i); /* set_inline */ - if (!filter_fn(v, user_data)) { + if (!BLI_BITMAP_TEST(verts_mask, i)) { continue; } BMEdge *e_iter = v->e; @@ -203,6 +216,224 @@ BMPartialUpdate *BM_mesh_partial_create_from_verts(BMesh *bm, return bmpinfo; } +/** + * All Connected, operate on all faces that have both tagged and un-tagged vertices. + * + * Reduces computations when transforming isolated regions. + */ +BMPartialUpdate *BM_mesh_partial_create_from_verts_group_single( + BMesh *bm, + const BMPartialUpdate_Params *params, + const BLI_bitmap *verts_mask, + const int verts_mask_count) +{ + BMPartialUpdate *bmpinfo = MEM_callocN(sizeof(*bmpinfo), __func__); + + BLI_bitmap *verts_tag = NULL; + BLI_bitmap *faces_tag = NULL; + + /* It's not worth guessing a large number as isolated regions will allocate zero faces. */ + const int default_faces_len_alloc = 1; + + int face_tag_loop_len = 0; + + if (params->do_normals || params->do_tessellate) { + + /* Faces. */ + if (bmpinfo->faces == NULL) { + bmpinfo->faces_len_alloc = default_faces_len_alloc; + bmpinfo->faces = MEM_mallocN((sizeof(BMFace *) * bmpinfo->faces_len_alloc), __func__); + faces_tag = BLI_BITMAP_NEW((size_t)bm->totface, __func__); + } + + BMFace *f; + BMIter iter; + int i; + BM_ITER_MESH_INDEX (f, &iter, bm, BM_FACES_OF_MESH, i) { + enum { SIDE_A = (1 << 0), SIDE_B = (1 << 1) } side_flag = 0; + BM_elem_index_set(f, i); /* set_inline */ + BMLoop *l_iter, *l_first; + l_iter = l_first = BM_FACE_FIRST_LOOP(f); + do { + const int j = BM_elem_index_get(l_iter->v); + side_flag |= BLI_BITMAP_TEST(verts_mask, j) ? SIDE_A : SIDE_B; + if (UNLIKELY(side_flag == (SIDE_A | SIDE_B))) { + partial_elem_face_ensure(bmpinfo, faces_tag, f); + face_tag_loop_len += f->len; + break; + } + } while ((l_iter = l_iter->next) != l_first); + } + } + + if (params->do_normals) { + /* Extend to all faces vertices: + * Any changes to the faces normal needs to update all surrounding vertices. */ + + /* Over allocate using the total number of face loops. */ + const int default_verts_len_alloc = min_ii(bm->totvert, max_ii(1, face_tag_loop_len)); + + /* Vertices. */ + if (bmpinfo->verts == NULL) { + bmpinfo->verts_len_alloc = default_verts_len_alloc; + bmpinfo->verts = MEM_mallocN((sizeof(BMVert *) * bmpinfo->verts_len_alloc), __func__); + verts_tag = BLI_BITMAP_NEW((size_t)bm->totvert, __func__); + } + + for (int i = 0; i < bmpinfo->faces_len; i++) { + BMFace *f = bmpinfo->faces[i]; + BMLoop *l_iter, *l_first; + l_iter = l_first = BM_FACE_FIRST_LOOP(f); + do { + partial_elem_vert_ensure(bmpinfo, verts_tag, l_iter->v); + } while ((l_iter = l_iter->next) != l_first); + } + + /* Loose vertex support, these need special handling as loose normals depend on location. */ + if (bmpinfo->verts_len < verts_mask_count) { + BMVert *v; + BMIter iter; + int i; + BM_ITER_MESH_INDEX (v, &iter, bm, BM_VERTS_OF_MESH, i) { + if (BLI_BITMAP_TEST(verts_mask, i) && (BM_vert_find_first_loop(v) == NULL)) { + partial_elem_vert_ensure(bmpinfo, verts_tag, v); + } + } + } + } + + if (verts_tag) { + MEM_freeN(verts_tag); + } + if (faces_tag) { + MEM_freeN(faces_tag); + } + + bmpinfo->params = *params; + + return bmpinfo; +} + +/** + * All Connected, operate on all faces that have vertices in the same group. + * + * Reduces computations when transforming isolated regions. + * + * This is a version of #BM_mesh_partial_create_from_verts_group_single + * that handles multiple groups instead of a bitmap mask. + * + * This is needed for example when transform has mirror enabled, + * since one side needs to have a different group to the other since a face that has vertices + * attached to both won't have an affine transformation. + * + * \param verts_groups: Vertex aligned array of groups. + * Values are used as follows: + * - >0: Each face is grouped with other faces of the same group. + * - 0: Not in a group (don't handle these). + * - -1: Don't use grouping logic (include any face that contains a vertex with this group). + * \param verts_groups_count: The number of non-zero values in `verts_groups`. + */ +BMPartialUpdate *BM_mesh_partial_create_from_verts_group_multi( + BMesh *bm, + const BMPartialUpdate_Params *params, + const int *verts_group, + const int verts_group_count) +{ + /* Provide a quick way of visualizing which faces are being manipulated. */ + // #define DEBUG_MATERIAL + + BMPartialUpdate *bmpinfo = MEM_callocN(sizeof(*bmpinfo), __func__); + + BLI_bitmap *verts_tag = NULL; + BLI_bitmap *faces_tag = NULL; + + /* It's not worth guessing a large number as isolated regions will allocate zero faces. */ + const int default_faces_len_alloc = 1; + + int face_tag_loop_len = 0; + + if (params->do_normals || params->do_tessellate) { + + /* Faces. */ + if (bmpinfo->faces == NULL) { + bmpinfo->faces_len_alloc = default_faces_len_alloc; + bmpinfo->faces = MEM_mallocN((sizeof(BMFace *) * bmpinfo->faces_len_alloc), __func__); + faces_tag = BLI_BITMAP_NEW((size_t)bm->totface, __func__); + } + + BMFace *f; + BMIter iter; + int i; + BM_ITER_MESH_INDEX (f, &iter, bm, BM_FACES_OF_MESH, i) { + BM_elem_index_set(f, i); /* set_inline */ + BMLoop *l_iter, *l_first; + l_iter = l_first = BM_FACE_FIRST_LOOP(f); + const int group_test = verts_group[BM_elem_index_get(l_iter->prev->v)]; +#ifdef DEBUG_MATERIAL + f->mat_nr = 0; +#endif + do { + const int group_iter = verts_group[BM_elem_index_get(l_iter->v)]; + if (UNLIKELY((group_iter != group_test) || (group_iter == -1))) { + partial_elem_face_ensure(bmpinfo, faces_tag, f); + face_tag_loop_len += f->len; +#ifdef DEBUG_MATERIAL + f->mat_nr = 1; +#endif + break; + } + } while ((l_iter = l_iter->next) != l_first); + } + } + + if (params->do_normals) { + /* Extend to all faces vertices: + * Any changes to the faces normal needs to update all surrounding vertices. */ + + /* Over allocate using the total number of face loops. */ + const int default_verts_len_alloc = min_ii(bm->totvert, max_ii(1, face_tag_loop_len)); + + /* Vertices. */ + if (bmpinfo->verts == NULL) { + bmpinfo->verts_len_alloc = default_verts_len_alloc; + bmpinfo->verts = MEM_mallocN((sizeof(BMVert *) * bmpinfo->verts_len_alloc), __func__); + verts_tag = BLI_BITMAP_NEW((size_t)bm->totvert, __func__); + } + + for (int i = 0; i < bmpinfo->faces_len; i++) { + BMFace *f = bmpinfo->faces[i]; + BMLoop *l_iter, *l_first; + l_iter = l_first = BM_FACE_FIRST_LOOP(f); + do { + partial_elem_vert_ensure(bmpinfo, verts_tag, l_iter->v); + } while ((l_iter = l_iter->next) != l_first); + } + + /* Loose vertex support, these need special handling as loose normals depend on location. */ + if (bmpinfo->verts_len < verts_group_count) { + BMVert *v; + BMIter iter; + int i; + BM_ITER_MESH_INDEX (v, &iter, bm, BM_VERTS_OF_MESH, i) { + if ((verts_group[i] != 0) && (BM_vert_find_first_loop(v) == NULL)) { + partial_elem_vert_ensure(bmpinfo, verts_tag, v); + } + } + } + } + + if (verts_tag) { + MEM_freeN(verts_tag); + } + if (faces_tag) { + MEM_freeN(faces_tag); + } + + bmpinfo->params = *params; + + return bmpinfo; +} + void BM_mesh_partial_destroy(BMPartialUpdate *bmpinfo) { if (bmpinfo->verts) { diff --git a/source/blender/bmesh/intern/bmesh_mesh_partial_update.h b/source/blender/bmesh/intern/bmesh_mesh_partial_update.h index 3dbfb985e92..cf4eab22836 100644 --- a/source/blender/bmesh/intern/bmesh_mesh_partial_update.h +++ b/source/blender/bmesh/intern/bmesh_mesh_partial_update.h @@ -54,9 +54,20 @@ typedef struct BMPartialUpdate { BMPartialUpdate *BM_mesh_partial_create_from_verts(BMesh *bm, const BMPartialUpdate_Params *params, - const int verts_len, - bool (*filter_fn)(BMVert *, void *user_data), - void *user_data) - ATTR_NONNULL(1, 2, 4) ATTR_WARN_UNUSED_RESULT; + const unsigned int *verts_mask, + const int verts_mask_count) + ATTR_NONNULL(1, 2, 3) ATTR_WARN_UNUSED_RESULT; + +BMPartialUpdate *BM_mesh_partial_create_from_verts_group_single( + BMesh *bm, + const BMPartialUpdate_Params *params, + const unsigned int *verts_mask, + const int verts_mask_count) ATTR_NONNULL(1, 2, 3) ATTR_WARN_UNUSED_RESULT; + +BMPartialUpdate *BM_mesh_partial_create_from_verts_group_multi( + BMesh *bm, + const BMPartialUpdate_Params *params, + const int *verts_group, + const int verts_group_count) ATTR_NONNULL(1, 2, 3) ATTR_WARN_UNUSED_RESULT; void BM_mesh_partial_destroy(BMPartialUpdate *bmpinfo) ATTR_NONNULL(1); diff --git a/source/blender/bmesh/intern/bmesh_mesh_tessellate.c b/source/blender/bmesh/intern/bmesh_mesh_tessellate.c index c9b027474e1..9f477bc8a9c 100644 --- a/source/blender/bmesh/intern/bmesh_mesh_tessellate.c +++ b/source/blender/bmesh/intern/bmesh_mesh_tessellate.c @@ -406,6 +406,10 @@ void BM_mesh_calc_tessellation_with_partial_ex(BMesh *bm, const struct BMeshCalcTessellation_Params *params) { BLI_assert(bmpinfo->params.do_tessellate); + /* While harmless, exit early if there is nothing to do (avoids ensuring the index). */ + if (UNLIKELY(bmpinfo->faces_len == 0)) { + return; + } BM_mesh_elem_index_ensure(bm, BM_LOOP | BM_FACE); diff --git a/source/blender/bmesh/intern/bmesh_mods.c b/source/blender/bmesh/intern/bmesh_mods.c index 76e32667804..b61ef47351a 100644 --- a/source/blender/bmesh/intern/bmesh_mods.c +++ b/source/blender/bmesh/intern/bmesh_mods.c @@ -46,7 +46,7 @@ * </pre> * * This function can also collapse edges too - * in cases when it cant merge into faces. + * in cases when it can't merge into faces. * * \par Example: * <pre> @@ -118,7 +118,7 @@ bool BM_disk_dissolve(BMesh *bm, BMVert *v) if (keepedge == NULL && len == 3) { #if 0 /* handle specific case for three-valence. solve it by - * increasing valence to four. this may be hackish. . */ + * increasing valence to four. this may be hackish. */ BMLoop *l_a = BM_face_vert_share_loop(e->l->f, v); BMLoop *l_b = (e->l->v == v) ? e->l->next : e->l; @@ -369,7 +369,7 @@ BMFace *BM_face_split_n(BMesh *bm, #endif /* bmesh_kernel_split_face_make_edge returns in 'l_new' * a Loop for f_new going from 'v_a' to 'v_b'. - * The radial_next is for 'f' and goes from 'v_b' to 'v_a' */ + * The radial_next is for 'f' and goes from 'v_b' to 'v_a'. */ if (f_new) { e = l_new->e; @@ -962,7 +962,7 @@ bool BM_edge_rotate_check_beauty(BMEdge *e, BMLoop *l1, BMLoop *l2) { /* Stupid check for now: * Could compare angles of surrounding edges - * before & after, but this is OK.*/ + * before & after, but this is OK. */ return (len_squared_v3v3(e->v1->co, e->v2->co) > len_squared_v3v3(l1->v->co, l2->v->co)); } diff --git a/source/blender/bmesh/intern/bmesh_opdefines.c b/source/blender/bmesh/intern/bmesh_opdefines.c index 1bef0ad2650..b19bb41c6d6 100644 --- a/source/blender/bmesh/intern/bmesh_opdefines.c +++ b/source/blender/bmesh/intern/bmesh_opdefines.c @@ -1352,7 +1352,7 @@ static BMOpDefine bmo_bisect_plane_def = { {{'\0'}}, }, {{"geom_cut.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE}}, /* output geometry aligned with the plane (new and existing) */ - {"geom.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}}, /* input and output geometry (result of cut) */ + {"geom.out", BMO_OP_SLOT_ELEMENT_BUF, {BM_VERT | BM_EDGE | BM_FACE}}, /* input and output geometry (result of cut). */ {{'\0'}}}, bmo_bisect_plane_exec, (BMO_OPTYPE_FLAG_UNTAN_MULTIRES | diff --git a/source/blender/bmesh/intern/bmesh_operator_api.h b/source/blender/bmesh/intern/bmesh_operator_api.h index 706979abeba..d09c0ee428d 100644 --- a/source/blender/bmesh/intern/bmesh_operator_api.h +++ b/source/blender/bmesh/intern/bmesh_operator_api.h @@ -256,7 +256,7 @@ typedef struct BMO_FlagSet { } BMO_FlagSet; /* please ignore all these structures, don't touch them in tool code, except - * for when your defining an operator with BMOpDefine.*/ + * for when your defining an operator with BMOpDefine. */ typedef struct BMOpSlot { const char *slot_name; /* pointer to BMOpDefine.slot_args */ @@ -345,16 +345,16 @@ typedef struct BMOpDefine { /* data types that use pointers (arrays, etc) should never * have it set directly. and never use BMO_slot_ptr_set to - * pass in a list of edges or any arrays, really.*/ + * pass in a list of edges or any arrays, really. */ void BMO_op_init(BMesh *bm, BMOperator *op, const int flag, const char *opname); /* executes an operator, pushing and popping a new tool flag - * layer as appropriate.*/ + * layer as appropriate. */ void BMO_op_exec(BMesh *bm, BMOperator *op); /* finishes an operator (though note the operator's tool flag is removed - * after it finishes executing in BMO_op_exec).*/ + * after it finishes executing in BMO_op_exec). */ void BMO_op_finish(BMesh *bm, BMOperator *op); /* count the number of elements with the specified flag enabled. @@ -369,7 +369,7 @@ int BMO_mesh_disabled_flag_count(BMesh *bm, const char htype, const short oflag) void BMO_push(BMesh *bm, BMOperator *op); void BMO_pop(BMesh *bm); -/*executes an operator*/ +/* Executes an operator. */ bool BMO_op_callf(BMesh *bm, const int flag, const char *fmt, ...); /* initializes, but doesn't execute an operator. this is so you can @@ -538,7 +538,7 @@ void BMO_slot_buffer_hflag_disable(BMesh *bm, /* puts every element of type 'type' (which is a bitmask) with header * flag 'flag', into a slot. note: ignores hidden elements - * (e.g. elements with header flag BM_ELEM_HIDDEN set).*/ + * (e.g. elements with header flag BM_ELEM_HIDDEN set). */ void BMO_slot_buffer_from_enabled_hflag(BMesh *bm, BMOperator *op, BMOpSlot slot_args[BMO_OP_MAX_SLOTS], @@ -548,7 +548,7 @@ void BMO_slot_buffer_from_enabled_hflag(BMesh *bm, /* puts every element of type 'type' (which is a bitmask) without * header flag 'flag', into a slot. note: ignores hidden elements - * (e.g. elements with header flag BM_ELEM_HIDDEN set).*/ + * (e.g. elements with header flag BM_ELEM_HIDDEN set). */ void BMO_slot_buffer_from_disabled_hflag(BMesh *bm, BMOperator *op, BMOpSlot slot_args[BMO_OP_MAX_SLOTS], @@ -571,7 +571,7 @@ int BMO_slot_map_count(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_na void BMO_slot_map_insert(BMOperator *op, BMOpSlot *slot, const void *element, const void *data); /* flags all elements in a mapping. note that the mapping must only have - * bmesh elements in it.*/ + * bmesh elements in it. */ void BMO_slot_map_to_flag(BMesh *bm, BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name, diff --git a/source/blender/bmesh/intern/bmesh_operators.c b/source/blender/bmesh/intern/bmesh_operators.c index e47fd1c035d..65285d8d464 100644 --- a/source/blender/bmesh/intern/bmesh_operators.c +++ b/source/blender/bmesh/intern/bmesh_operators.c @@ -1293,7 +1293,7 @@ static void bmo_flag_layer_alloc(BMesh *bm) bm->ftoolflagpool = BLI_mempool_create( sizeof(BMFlagLayer) * bm->totflags, bm->totface, 512, BLI_MEMPOOL_NOP); - /* now go through and memcpy all the flags. Loops don't get a flag layer at this time.. */ + /* now go through and memcpy all the flags. Loops don't get a flag layer at this time. */ BMIter iter; int i; @@ -1346,7 +1346,7 @@ static void bmo_flag_layer_free(BMesh *bm) /* store memcpy size for reuse */ const size_t new_totflags_size = ((bm->totflags - 1) * sizeof(BMFlagLayer)); - /* de-increment the totflags first.. */ + /* de-increment the totflags first. */ bm->totflags--; bm->vtoolflagpool = BLI_mempool_create(new_totflags_size, bm->totvert, 512, BLI_MEMPOOL_NOP); diff --git a/source/blender/bmesh/intern/bmesh_operators.h b/source/blender/bmesh/intern/bmesh_operators.h index 2d9e244e54d..a701fe3eb85 100644 --- a/source/blender/bmesh/intern/bmesh_operators.h +++ b/source/blender/bmesh/intern/bmesh_operators.h @@ -20,7 +20,7 @@ * \ingroup bmesh */ -/*see comments in intern/bmesh_opdefines.c for documentation of specific operators*/ +/* See comments in `intern/bmesh_opdefines.c` for documentation of specific operators. */ /*--------defines/enumerations for specific operators-------*/ diff --git a/source/blender/bmesh/intern/bmesh_private.h b/source/blender/bmesh/intern/bmesh_private.h index 2c3bac6df33..e1df7744e41 100644 --- a/source/blender/bmesh/intern/bmesh_private.h +++ b/source/blender/bmesh/intern/bmesh_private.h @@ -56,16 +56,17 @@ int bmesh_disk_count(const BMVert *v); /** * Internal BMHeader.api_flag * \note Ensure different parts of the API do not conflict - * on using these internal flags!*/ + * on using these internal flags! + */ enum { - _FLAG_JF = (1 << 0), /* join faces */ - _FLAG_MF = (1 << 1), /* make face */ - _FLAG_MV = (1 << 1), /* make face, vertex */ - _FLAG_OVERLAP = (1 << 2), /* general overlap flag */ - _FLAG_WALK = (1 << 3), /* general walk flag (keep clean) */ - _FLAG_WALK_ALT = (1 << 4), /* same as _FLAG_WALK, for when a second tag is needed */ + _FLAG_JF = (1 << 0), /* Join faces. */ + _FLAG_MF = (1 << 1), /* Make face. */ + _FLAG_MV = (1 << 1), /* Make face, vertex. */ + _FLAG_OVERLAP = (1 << 2), /* General overlap flag. */ + _FLAG_WALK = (1 << 3), /* General walk flag (keep clean). */ + _FLAG_WALK_ALT = (1 << 4), /* Same as #_FLAG_WALK, for when a second tag is needed. */ - _FLAG_ELEM_CHECK = (1 << 7), /* reserved for bmesh_elem_check */ + _FLAG_ELEM_CHECK = (1 << 7), /* Reserved for bmesh_elem_check. */ }; #define BM_ELEM_API_FLAG_ENABLE(element, f) \ diff --git a/source/blender/bmesh/intern/bmesh_query.c b/source/blender/bmesh/intern/bmesh_query.c index 03655bccf1c..1449df9925f 100644 --- a/source/blender/bmesh/intern/bmesh_query.c +++ b/source/blender/bmesh/intern/bmesh_query.c @@ -699,7 +699,7 @@ BMEdge *BM_vert_other_disk_edge(BMVert *v, BMEdge *e_first) if (BM_edge_is_manifold(l_a->e)) { l_a = l_a->radial_next; } - /* this wont have changed from the previous loop */ + /* this won't have changed from the previous loop */ i++; } while (l_a != e_first->l); @@ -978,7 +978,7 @@ bool BM_vert_is_manifold(const BMVert *v) /* start at the boundary */ l_first = e_iter->l; boundary_num += 1; - /* >2 boundaries cant be manifold */ + /* >2 boundaries can't be manifold */ if (boundary_num == 3) { return false; } @@ -2365,7 +2365,7 @@ bool BM_face_exists_overlap_subset(BMVert **varr, const int len) for (int i = 0; i < len; i++) { BM_ITER_ELEM (f, &viter, varr[i], BM_FACES_OF_VERT) { if ((f->len <= len) && (BM_ELEM_API_FLAG_TEST(f, _FLAG_OVERLAP) == 0)) { - /* check if all vers in this face are flagged*/ + /* Check if all vers in this face are flagged. */ BMLoop *l_iter, *l_first; if (is_init == false) { diff --git a/source/blender/bmesh/intern/bmesh_walkers.h b/source/blender/bmesh/intern/bmesh_walkers.h index ce0f8ae8324..d0348aa11dc 100644 --- a/source/blender/bmesh/intern/bmesh_walkers.h +++ b/source/blender/bmesh/intern/bmesh_walkers.h @@ -80,7 +80,7 @@ void *BMW_step(struct BMWalker *walker); void BMW_end(struct BMWalker *walker); int BMW_current_depth(BMWalker *walker); -/*these are used by custom walkers*/ +/* These are used by custom walkers. */ void *BMW_current_state(BMWalker *walker); void *BMW_state_add(BMWalker *walker); void BMW_state_remove(BMWalker *walker); diff --git a/source/blender/bmesh/intern/bmesh_walkers_impl.c b/source/blender/bmesh/intern/bmesh_walkers_impl.c index a8558ec4011..40f09d7e719 100644 --- a/source/blender/bmesh/intern/bmesh_walkers_impl.c +++ b/source/blender/bmesh/intern/bmesh_walkers_impl.c @@ -1631,7 +1631,7 @@ static void *bmw_NonManifoldedgeWalker_yield(BMWalker *walker) /** * Walk over manifold loops around `v` until loop-edge is found with `face_count` users. * or return NULL if not found. - * */ + */ static BMLoop *bmw_NonManifoldLoop_find_next_around_vertex(BMLoop *l, BMVert *v, int face_count) { BLI_assert(!BM_loop_is_manifold(l)); @@ -1667,7 +1667,7 @@ static void *bmw_NonManifoldedgeWalker_step(BMWalker *walker) v = BM_edge_other_vert(e, lwalk->lastv); /* If `lwalk.lastv` can't be walked along, start walking in the opposite direction - * on the initial edge, do this at most one time during this walk operation. */ + * on the initial edge, do this at most one time during this walk operation. */ if (UNLIKELY(pass == 1)) { e = lwalk->start; v = lwalk->startv; diff --git a/source/blender/bmesh/operators/bmo_bridge.c b/source/blender/bmesh/operators/bmo_bridge.c index 5713c17e146..0a6540c0e5e 100644 --- a/source/blender/bmesh/operators/bmo_bridge.c +++ b/source/blender/bmesh/operators/bmo_bridge.c @@ -236,7 +236,7 @@ static void bridge_loop_pair(BMesh *bm, if (UNLIKELY((len_squared_v3(el_dir) < eps) || ((fabsf(dot_a) < eps) && (fabsf(dot_b) < eps)))) { /* in this case there is no depth between the two loops, * eg: 2x 2d circles, one scaled smaller, - * in this case 'el_dir' cant be used, just ensure we have matching flipping. */ + * in this case 'el_dir' can't be used, just ensure we have matching flipping. */ if (dot_v3v3(BM_edgeloop_normal_get(el_store_a), BM_edgeloop_normal_get(el_store_b)) < 0.0f) { BM_edgeloop_flip(bm, el_store_b); } diff --git a/source/blender/bmesh/operators/bmo_connect_pair.c b/source/blender/bmesh/operators/bmo_connect_pair.c index 8a0673c9b33..b57c8686e1c 100644 --- a/source/blender/bmesh/operators/bmo_connect_pair.c +++ b/source/blender/bmesh/operators/bmo_connect_pair.c @@ -436,7 +436,7 @@ static bool state_step(PathContext *pc, PathLinkState *state) BM_ITER_ELEM (l_start, &liter, e, BM_LOOPS_OF_EDGE) { if ((l_start->f != ele_from) && FACE_WALK_TEST(l_start->f)) { MinDistDir mddir = MIN_DIST_DIR_INIT; - /* very similar to block below */ + /* Very similar to block below. */ state = state_step__face_edges(pc, state, &state_orig, l_start->next, l_start, &mddir); state = state_step__face_verts( pc, state, &state_orig, l_start->next->next, l_start, &mddir); @@ -446,7 +446,7 @@ static bool state_step(PathContext *pc, PathLinkState *state) else if (ele->head.htype == BM_VERT) { BMVert *v = (BMVert *)ele; - /* vert loops */ + /* Vert loops. */ { BMIter liter; BMLoop *l_start; @@ -454,11 +454,11 @@ static bool state_step(PathContext *pc, PathLinkState *state) BM_ITER_ELEM (l_start, &liter, v, BM_LOOPS_OF_VERT) { if ((l_start->f != ele_from) && FACE_WALK_TEST(l_start->f)) { MinDistDir mddir = MIN_DIST_DIR_INIT; - /* very similar to block above */ + /* Very similar to block above. */ state = state_step__face_edges( pc, state, &state_orig, l_start->next, l_start->prev, &mddir); if (l_start->f->len > 3) { - /* adjacent verts are handled in state_step__vert_edges */ + /* Adjacent verts are handled in #state_step__vert_edges. */ state = state_step__face_verts( pc, state, &state_orig, l_start->next->next, l_start->prev, &mddir); } @@ -466,7 +466,7 @@ static bool state_step(PathContext *pc, PathLinkState *state) } } - /* vert edges */ + /* Vert edges. */ { BMIter eiter; BMEdge *e; diff --git a/source/blender/bmesh/operators/bmo_extrude.c b/source/blender/bmesh/operators/bmo_extrude.c index 0a08b340e87..ffdce943d9f 100644 --- a/source/blender/bmesh/operators/bmo_extrude.c +++ b/source/blender/bmesh/operators/bmo_extrude.c @@ -459,8 +459,10 @@ void bmo_extrude_face_region_exec(BMesh *bm, BMOperator *op) } /* Allocate array to store possible vertices that will be dissolved. */ - int boundary_verts_len = BMO_slot_map_count(dupeop.slots_out, "boundary_map.out"); - dissolve_verts = MEM_mallocN((size_t)boundary_verts_len * sizeof(*dissolve_verts), __func__); + int boundary_edges_len = BMO_slot_map_count(dupeop.slots_out, "boundary_map.out"); + /* We do not know the real number of boundary vertices. */ + int boundary_verts_len_maybe = 2 * boundary_edges_len; + dissolve_verts = MEM_mallocN(boundary_verts_len_maybe * sizeof(*dissolve_verts), __func__); } BMO_slot_copy(&dupeop, slots_out, "geom.out", op, slots_out, "geom.out"); diff --git a/source/blender/bmesh/operators/bmo_fill_attribute.c b/source/blender/bmesh/operators/bmo_fill_attribute.c index 782fd98c2ea..e377fa6079b 100644 --- a/source/blender/bmesh/operators/bmo_fill_attribute.c +++ b/source/blender/bmesh/operators/bmo_fill_attribute.c @@ -154,8 +154,9 @@ void bmo_face_attribute_fill_exec(BMesh *bm, BMOperator *op) int face_tot; BM_mesh_elem_hflag_disable_all(bm, BM_FACE, BM_ELEM_TAG, false); - BMO_slot_buffer_hflag_enable( - bm, op->slots_in, "faces", BM_FACE, BM_ELEM_TAG, false); /* do inline */ + + /* do inline */ + BMO_slot_buffer_hflag_enable(bm, op->slots_in, "faces", BM_FACE, BM_ELEM_TAG, false); /* now we can copy adjacent data */ face_tot = bmesh_face_attribute_fill(bm, use_normals, use_data); diff --git a/source/blender/bmesh/operators/bmo_inset.c b/source/blender/bmesh/operators/bmo_inset.c index 9e8e330e87c..39f8f41432a 100644 --- a/source/blender/bmesh/operators/bmo_inset.c +++ b/source/blender/bmesh/operators/bmo_inset.c @@ -361,7 +361,7 @@ static void bmo_face_inset_individual(BMesh *bm, madd_v3_v3fl(v_new_co, tvec, thickness); - /* Set normal, add depth and write new vertex position*/ + /* Set normal, add depth and write new vertex position. */ copy_v3_v3(l_iter->v->no, f->no); if (depth != 0.0f) { diff --git a/source/blender/bmesh/operators/bmo_join_triangles.c b/source/blender/bmesh/operators/bmo_join_triangles.c index 086114f64e9..c3e96a9b08e 100644 --- a/source/blender/bmesh/operators/bmo_join_triangles.c +++ b/source/blender/bmesh/operators/bmo_join_triangles.c @@ -44,7 +44,7 @@ static float quad_calc_error(const float v1[3], { /* Gives a 'weight' to a pair of triangles that join an edge * to decide how good a join they would make. */ - /* Note: this is more complicated than it needs to be and should be cleaned up.. */ + /* Note: this is more complicated than it needs to be and should be cleaned up. */ float error = 0.0f; /* Normal difference */ diff --git a/source/blender/bmesh/operators/bmo_normals.c b/source/blender/bmesh/operators/bmo_normals.c index 3311ffefb0d..b5f5e5e308b 100644 --- a/source/blender/bmesh/operators/bmo_normals.c +++ b/source/blender/bmesh/operators/bmo_normals.c @@ -138,7 +138,7 @@ static int recalc_face_normals_find_index(BMesh *bm, * then the outer-most loop attached to that vertex. * * Important this is correctly detected, - * where casting a ray from the center wont hit any loops past this one. + * where casting a ray from the center won't hit any loops past this one. * Otherwise the result may be incorrect. */ for (i = 0; i < faces_len; i++) { diff --git a/source/blender/bmesh/operators/bmo_smooth_laplacian.c b/source/blender/bmesh/operators/bmo_smooth_laplacian.c index a9879ce025a..b2b93bfd003 100644 --- a/source/blender/bmesh/operators/bmo_smooth_laplacian.c +++ b/source/blender/bmesh/operators/bmo_smooth_laplacian.c @@ -36,17 +36,17 @@ #define SMOOTH_LAPLACIAN_MIN_EDGE_PERCENTAGE 0.15f struct BLaplacianSystem { - float *eweights; /* Length weights per Edge */ - float (*fweights)[3]; /* Cotangent weights per face */ - float *ring_areas; /* Total area per ring*/ - float *vlengths; /* Total sum of lengths(edges) per vertice*/ - float *vweights; /* Total sum of weights per vertice*/ - int numEdges; /* Number of edges*/ - int numFaces; /* Number of faces*/ - int numVerts; /* Number of verts*/ - short *zerola; /* Is zero area or length*/ - - /* Pointers to data*/ + float *eweights; /* Length weights per Edge. */ + float (*fweights)[3]; /* Cotangent weights per face. */ + float *ring_areas; /* Total area per ring. */ + float *vlengths; /* Total sum of lengths(edges) per vertex. */ + float *vweights; /* Total sum of weights per vertex. */ + int numEdges; /* Number of edges. */ + int numFaces; /* Number of faces. */ + int numVerts; /* Number of verts. */ + short *zerola; /* Is zero area or length. */ + + /* Pointers to data. */ BMesh *bm; BMOperator *op; LinearSolver *context; @@ -343,7 +343,7 @@ static void fill_laplacian_matrix(LaplacianSystem *sys) idv1 = BM_elem_index_get(vf[0]); idv2 = BM_elem_index_get(vf[1]); idv3 = BM_elem_index_get(vf[2]); - /* Is ring if number of faces == number of edges around vertice*/ + /* Is ring if number of faces == number of edges around vertice. */ i = BM_elem_index_get(f); if (!vert_is_boundary(vf[0]) && sys->zerola[idv1] == 0) { EIG_linear_solver_matrix_add( diff --git a/source/blender/bmesh/operators/bmo_subdivide.c b/source/blender/bmesh/operators/bmo_subdivide.c index 883420e59f6..ae4fa65b55c 100644 --- a/source/blender/bmesh/operators/bmo_subdivide.c +++ b/source/blender/bmesh/operators/bmo_subdivide.c @@ -240,7 +240,7 @@ static void interp_slerp_co_no_v3( } } -/* calculates offset for co, based on fractal, sphere or smooth settings */ +/* Calculates offset for co, based on fractal, sphere or smooth settings. */ static void alter_co(BMVert *v, BMEdge *UNUSED(e_orig), const SubDParams *params, diff --git a/source/blender/bmesh/operators/bmo_subdivide_edgering.c b/source/blender/bmesh/operators/bmo_subdivide_edgering.c index 38a27b811b0..d5b84cb2165 100644 --- a/source/blender/bmesh/operators/bmo_subdivide_edgering.c +++ b/source/blender/bmesh/operators/bmo_subdivide_edgering.c @@ -244,7 +244,7 @@ static GSet *bm_edgering_pair_calc(BMesh *bm, ListBase *eloops_rim) el_store_other = BLI_ghash_lookup(vert_eloop_gh, v_other); - /* in rare cases we cant find a match */ + /* in rare cases we can't find a match */ if (el_store_other) { pair_test.first = el_store; pair_test.second = el_store_other; @@ -586,7 +586,7 @@ static void bm_edgering_pair_interpolate(BMesh *bm, } /* now normals are correct, don't touch! */ - /* calculate the center spline, multiple */ + /* Calculate the center spline, multiple. */ if ((interp_mode == SUBD_RING_INTERP_PATH) || falloff_cache) { float handle_a[3], handle_b[3]; float handle_len; @@ -1028,7 +1028,7 @@ static void bm_edgering_pair_subdiv(BMesh *bm, } while ((l_iter = l_iter->next) != l_first); } - /* clear tags so subdiv verts don't get tagged too */ + /* Clear tags so subdiv verts don't get tagged too. */ for (el_store_ring = eloops_ring->first; el_store_ring; el_store_ring = BM_EDGELOOP_NEXT(el_store_ring)) { bm_edgeloop_vert_tag(el_store_ring, false); diff --git a/source/blender/bmesh/tools/bmesh_beautify.c b/source/blender/bmesh/tools/bmesh_beautify.c index 2d9b35697ff..4ef165fe6c1 100644 --- a/source/blender/bmesh/tools/bmesh_beautify.c +++ b/source/blender/bmesh/tools/bmesh_beautify.c @@ -277,10 +277,10 @@ float BM_verts_calc_rotate_beauty(const BMVert *v1, static float bm_edge_calc_rotate_beauty(const BMEdge *e, const short flag, const short method) { const BMVert *v1, *v2, *v3, *v4; - v1 = e->l->prev->v; /* first vert co */ - v2 = e->l->v; /* e->v1 or e->v2*/ - v3 = e->l->radial_next->prev->v; /* second vert co */ - v4 = e->l->next->v; /* e->v1 or e->v2*/ + v1 = e->l->prev->v; /* First vert co */ + v2 = e->l->v; /* `e->v1` or `e->v2`. */ + v3 = e->l->radial_next->prev->v; /* Second vert co */ + v4 = e->l->next->v; /* `e->v1` or `e->v2`. */ return BM_verts_calc_rotate_beauty(v1, v2, v3, v4, flag, method); } diff --git a/source/blender/bmesh/tools/bmesh_bevel.c b/source/blender/bmesh/tools/bmesh_bevel.c index d39fb5e81f1..13cd2b392d0 100644 --- a/source/blender/bmesh/tools/bmesh_bevel.c +++ b/source/blender/bmesh/tools/bmesh_bevel.c @@ -288,7 +288,10 @@ typedef struct BevVert { VMesh *vmesh; } BevVert; -/* Face classification. Note: depends on F_RECON > F_EDGE > F_VERT .*/ +/** + * Face classification. + * \note depends on `F_RECON > F_EDGE > F_VERT`. + */ typedef enum { /** Used when there is no face at all. */ F_NONE, @@ -1680,7 +1683,7 @@ static void project_to_edge(const BMEdge *e, } /* If there is a bndv->ebev edge, find the mid control point if necessary. - * It is the closest point on the beveled edge to the line segment between bndv and bndv->next. */ + * It is the closest point on the beveled edge to the line segment between bndv and bndv->next. */ static void set_profile_params(BevelParams *bp, BevVert *bv, BoundVert *bndv) { bool do_linear_interp = true; @@ -2160,7 +2163,7 @@ static void calculate_profile(BevelParams *bp, BoundVert *bndv, bool reversed, b /* Calculate the 3D locations for the profile points */ calculate_profile_segments( pro, map, use_map, reversed, bp->seg, pro_spacing->xvals, pro_spacing->yvals, pro->prof_co); - /* Also calculate for the is the seg_2 case if it's needed .*/ + /* Also calculate for the is the seg_2 case if it's needed. */ if (need_2) { calculate_profile_segments(pro, map, diff --git a/source/blender/bmesh/tools/bmesh_bisect_plane.c b/source/blender/bmesh/tools/bmesh_bisect_plane.c index e7d0fe6a0c6..8f03b86b859 100644 --- a/source/blender/bmesh/tools/bmesh_bisect_plane.c +++ b/source/blender/bmesh/tools/bmesh_bisect_plane.c @@ -368,7 +368,7 @@ static void bm_face_bisect_verts( } } - /* Ideally wont happen, but it can for self intersecting faces. */ + /* Ideally won't happen, but it can for self-intersecting faces. */ // BLI_assert(found == true); /* In fact this simple test is good enough, test if the loops are adjacent. */ diff --git a/source/blender/bmesh/tools/bmesh_decimate_collapse.c b/source/blender/bmesh/tools/bmesh_decimate_collapse.c index 869856d0c5b..a1630d9d2ff 100644 --- a/source/blender/bmesh/tools/bmesh_decimate_collapse.c +++ b/source/blender/bmesh/tools/bmesh_decimate_collapse.c @@ -568,9 +568,9 @@ static bool bm_decim_triangulate_begin(BMesh *bm, int *r_edges_tri_tot) pf_heap = NULL; } - /* adding new faces as we loop over faces + /* Adding new faces as we loop over faces * is normally best avoided, however in this case its not so bad because any face touched twice - * will already be triangulated*/ + * will already be triangulated. */ BM_ITER_MESH (f, &iter, bm, BM_FACES_OF_MESH) { if (f->len > 3) { has_cut |= bm_face_triangulate(bm, @@ -1285,6 +1285,11 @@ static bool bm_decim_edge_collapse(BMesh *bm, * a vertex group is the usual source for this. * \param symmetry_axis: Axis of symmetry, -1 to disable mirror decimate. * \param symmetry_eps: Threshold when matching mirror verts. + * + * \note The caller is responsible for recalculating face and vertex normals. + * - Vertex normals are maintained while decimating, + * although they won't necessarily match the final recalculated normals. + * - Face normals are not maintained at all. */ void BM_mesh_decimate_collapse(BMesh *bm, const float factor, @@ -1367,7 +1372,7 @@ void BM_mesh_decimate_collapse(BMesh *bm, /* handy to detect corruptions elsewhere */ BLI_assert(BM_elem_index_get(e) < tot_edge_orig); - /* Under normal conditions wont be accessed again, + /* Under normal conditions won't be accessed again, * but NULL just in case so we don't use freed node. */ eheap_table[BM_elem_index_get(e)] = NULL; diff --git a/source/blender/bmesh/tools/bmesh_intersect.c b/source/blender/bmesh/tools/bmesh_intersect.c index 710d7f79637..d51661a08bb 100644 --- a/source/blender/bmesh/tools/bmesh_intersect.c +++ b/source/blender/bmesh/tools/bmesh_intersect.c @@ -379,7 +379,7 @@ static BMVert *bm_isect_edge_tri(struct ISectState *s, } \ (void)0 - /* order tri, then order (1-2, 2-3)*/ + /* Order tri, then order (1-2, 2-3). */ #define KEY_EDGE_TRI_ORDER(k) \ { \ if (k[2] > k[3]) { \ @@ -560,8 +560,8 @@ static void bm_isect_tri_tri( /* vert-vert * --------- */ { - /* first check in any verts are touching - * (any case where we wont create new verts) + /* first check if any verts are touching + * (any case where we won't create new verts) */ uint i_a; for (i_a = 0; i_a < 3; i_a++) { @@ -1606,7 +1606,7 @@ bool BM_mesh_intersect(BMesh *bm, for (node = s.vert_dissolve; node; node = node->next) { BMVert *v = node->link; if (BM_vert_is_edge_pair(v)) { - /* we wont create degenerate faces from this */ + /* we won't create degenerate faces from this */ bool ok = true; /* would we create a 2-sided-face? diff --git a/source/blender/bmesh/tools/bmesh_separate.c b/source/blender/bmesh/tools/bmesh_separate.c index 701c7dc7e03..3c69ea111bf 100644 --- a/source/blender/bmesh/tools/bmesh_separate.c +++ b/source/blender/bmesh/tools/bmesh_separate.c @@ -67,7 +67,7 @@ void BM_mesh_separate_faces(BMesh *bm, BMFaceFilterFunc filter_fn, void *user_da BMFace **faces_a = faces_array_all; BMFace **faces_b = faces_array_all + faces_a_len; - /* Enable for all */ + /* Enable for all. */ BM_mesh_elem_hflag_enable_all(bm, BM_VERT, BM_ELEM_TAG, false); /* Disable vert tag on faces_b */ diff --git a/source/blender/bmesh/tools/bmesh_wireframe.c b/source/blender/bmesh/tools/bmesh_wireframe.c index 1c820db74f4..de2deee2929 100644 --- a/source/blender/bmesh/tools/bmesh_wireframe.c +++ b/source/blender/bmesh/tools/bmesh_wireframe.c @@ -63,7 +63,7 @@ static void bm_vert_boundary_tangent( float tvec_a[3], tvec_b[3]; /* get 2 boundary edges, there should only _be_ 2, - * in case there are more - results wont be valid of course */ + * in case there are more - results won't be valid of course */ BM_ITER_ELEM (e_iter, &iter, v, BM_EDGES_OF_VERT) { if (BM_elem_flag_test(e_iter, BM_ELEM_TAG)) { if (e_a == NULL) { @@ -195,7 +195,7 @@ void BM_mesh_wireframe(BMesh *bm, BMVert **verts_neg = MEM_mallocN(sizeof(BMVert *) * totvert_orig, __func__); BMVert **verts_pos = MEM_mallocN(sizeof(BMVert *) * totvert_orig, __func__); - /* will over-alloc, but makes for easy lookups by index to keep aligned */ + /* Will over-alloc, but makes for easy lookups by index to keep aligned. */ BMVert **verts_boundary = use_boundary ? MEM_mallocN(sizeof(BMVert *) * totvert_orig, __func__) : NULL; diff --git a/source/blender/compositor/COM_defines.h b/source/blender/compositor/COM_defines.h index 5a52d216117..857cbf0beee 100644 --- a/source/blender/compositor/COM_defines.h +++ b/source/blender/compositor/COM_defines.h @@ -62,6 +62,24 @@ constexpr int COM_data_type_num_channels(const DataType datatype) constexpr int COM_DATA_TYPE_VALUE_CHANNELS = COM_data_type_num_channels(DataType::Value); constexpr int COM_DATA_TYPE_COLOR_CHANNELS = COM_data_type_num_channels(DataType::Color); +constexpr float COM_VALUE_ZERO[1] = {0.0f}; + +/** + * Utility to get data type for given number of channels. + */ +constexpr DataType COM_num_channels_data_type(const int num_channels) +{ + switch (num_channels) { + case 1: + return DataType::Value; + case 3: + return DataType::Vector; + case 4: + default: + return DataType::Color; + } +} + // configurable items // chunk size determination diff --git a/source/blender/compositor/intern/COM_MemoryBuffer.cc b/source/blender/compositor/intern/COM_MemoryBuffer.cc index 8c30d3215d7..44d3f059374 100644 --- a/source/blender/compositor/intern/COM_MemoryBuffer.cc +++ b/source/blender/compositor/intern/COM_MemoryBuffer.cc @@ -18,10 +18,31 @@ #include "COM_MemoryBuffer.h" +#include "IMB_colormanagement.h" +#include "IMB_imbuf_types.h" #include "MEM_guardedalloc.h" +#define ASSERT_BUFFER_CONTAINS_AREA(buf, area) \ + BLI_assert(BLI_rcti_inside_rcti(&(buf)->get_rect(), &(area))) + +#define ASSERT_BUFFER_CONTAINS_AREA_AT_COORDS(buf, area, x, y) \ + BLI_assert((buf)->get_rect().xmin <= (x)); \ + BLI_assert((buf)->get_rect().ymin <= (y)); \ + BLI_assert((buf)->get_rect().xmax >= (x) + BLI_rcti_size_x(&(area))); \ + BLI_assert((buf)->get_rect().ymax >= (y) + BLI_rcti_size_y(&(area))) + +#define ASSERT_VALID_ELEM_SIZE(buf, channel_offset, elem_size) \ + BLI_assert((buf)->get_num_channels() <= (channel_offset) + (elem_size)) + namespace blender::compositor { +static rcti create_rect(const int width, const int height) +{ + rcti rect; + BLI_rcti_init(&rect, 0, width, 0, height); + return rect; +} + MemoryBuffer::MemoryBuffer(MemoryProxy *memoryProxy, const rcti &rect, MemoryBufferState state) { m_rect = rect; @@ -30,6 +51,7 @@ MemoryBuffer::MemoryBuffer(MemoryProxy *memoryProxy, const rcti &rect, MemoryBuf this->m_num_channels = COM_data_type_num_channels(memoryProxy->getDataType()); this->m_buffer = (float *)MEM_mallocN_aligned( sizeof(float) * buffer_len() * this->m_num_channels, 16, "COM_MemoryBuffer"); + owns_data_ = true; this->m_state = state; this->m_datatype = memoryProxy->getDataType(); @@ -44,12 +66,44 @@ MemoryBuffer::MemoryBuffer(DataType dataType, const rcti &rect, bool is_a_single this->m_num_channels = COM_data_type_num_channels(dataType); this->m_buffer = (float *)MEM_mallocN_aligned( sizeof(float) * buffer_len() * this->m_num_channels, 16, "COM_MemoryBuffer"); + owns_data_ = true; this->m_state = MemoryBufferState::Temporary; this->m_datatype = dataType; set_strides(); } +/** + * Construct MemoryBuffer from a float buffer. MemoryBuffer is not responsible for + * freeing it. + */ +MemoryBuffer::MemoryBuffer( + float *buffer, int num_channels, int width, int height, bool is_a_single_elem) + : MemoryBuffer(buffer, num_channels, create_rect(width, height), is_a_single_elem) +{ +} + +/** + * Construct MemoryBuffer from a float buffer area. MemoryBuffer is not responsible for + * freeing given buffer. + */ +MemoryBuffer::MemoryBuffer(float *buffer, + const int num_channels, + const rcti &rect, + const bool is_a_single_elem) +{ + m_rect = rect; + m_is_a_single_elem = is_a_single_elem; + m_memoryProxy = nullptr; + m_num_channels = num_channels; + m_datatype = COM_num_channels_data_type(num_channels); + m_buffer = buffer; + owns_data_ = false; + m_state = MemoryBufferState::Temporary; + + set_strides(); +} + MemoryBuffer::MemoryBuffer(const MemoryBuffer &src) : MemoryBuffer(src.m_datatype, src.m_rect, false) { @@ -112,31 +166,195 @@ float MemoryBuffer::get_max_value(const rcti &rect) const MemoryBuffer::~MemoryBuffer() { - if (this->m_buffer) { + if (this->m_buffer && owns_data_) { MEM_freeN(this->m_buffer); this->m_buffer = nullptr; } } -void MemoryBuffer::fill_from(const MemoryBuffer &src) +void MemoryBuffer::copy_from(const MemoryBuffer *src, const rcti &area) { - BLI_assert(!this->is_a_single_elem()); + copy_from(src, area, area.xmin, area.ymin); +} + +void MemoryBuffer::copy_from(const MemoryBuffer *src, + const rcti &area, + const int to_x, + const int to_y) +{ + BLI_assert(this->get_num_channels() == src->get_num_channels()); + copy_from(src, area, 0, src->get_num_channels(), to_x, to_y, 0); +} + +void MemoryBuffer::copy_from(const MemoryBuffer *src, + const rcti &area, + const int channel_offset, + const int elem_size, + const int to_channel_offset) +{ + copy_from(src, area, channel_offset, elem_size, area.xmin, area.ymin, to_channel_offset); +} + +void MemoryBuffer::copy_from(const MemoryBuffer *src, + const rcti &area, + const int channel_offset, + const int elem_size, + const int to_x, + const int to_y, + const int to_channel_offset) +{ + if (this->is_a_single_elem()) { + copy_single_elem_from(src, channel_offset, elem_size, to_channel_offset); + } + else if (!src->is_a_single_elem() && elem_size == src->get_num_channels() && + elem_size == this->get_num_channels()) { + BLI_assert(to_channel_offset == 0); + BLI_assert(channel_offset == 0); + copy_rows_from(src, area, to_x, to_y); + } + else { + copy_elems_from(src, area, channel_offset, elem_size, to_x, to_y, to_channel_offset); + } +} + +void MemoryBuffer::copy_from(const uchar *src, const rcti &area) +{ + copy_from(src, area, 0, this->get_num_channels(), this->get_num_channels(), 0); +} + +void MemoryBuffer::copy_from(const uchar *src, + const rcti &area, + const int channel_offset, + const int elem_size, + const int elem_stride, + const int to_channel_offset) +{ + copy_from( + src, area, channel_offset, elem_size, elem_stride, area.xmin, area.ymin, to_channel_offset); +} + +void MemoryBuffer::copy_from(const uchar *src, + const rcti &area, + const int channel_offset, + const int elem_size, + const int elem_stride, + const int to_x, + const int to_y, + const int to_channel_offset) +{ + ASSERT_BUFFER_CONTAINS_AREA_AT_COORDS(this, area, to_x, to_y); + ASSERT_VALID_ELEM_SIZE(this, to_channel_offset, elem_size); + + const int width = BLI_rcti_size_x(&area); + const int height = BLI_rcti_size_y(&area); + const int src_row_stride = width * elem_stride; + const uchar *const src_start = src + area.ymin * src_row_stride + channel_offset; + for (int y = 0; y < height; y++) { + const uchar *from_elem = src_start + y * src_row_stride; + float *to_elem = &this->get_value(to_x, to_y + y, to_channel_offset); + const float *row_end = to_elem + width * this->elem_stride; + while (to_elem < row_end) { + for (int i = 0; i < elem_size; i++) { + to_elem[i] = ((float)from_elem[i]) * (1.0f / 255.0f); + } + to_elem += this->elem_stride; + from_elem += elem_stride; + } + } +} + +static void colorspace_to_scene_linear(MemoryBuffer *buf, const rcti &area, ColorSpace *colorspace) +{ + const int width = BLI_rcti_size_x(&area); + const int height = BLI_rcti_size_y(&area); + float *out = buf->get_elem(area.xmin, area.ymin); + /* If area allows continuous memory do conversion in one step. Otherwise per row. */ + if (buf->getWidth() == width) { + IMB_colormanagement_colorspace_to_scene_linear( + out, width, height, buf->get_num_channels(), colorspace, false); + } + else { + for (int y = 0; y < height; y++) { + IMB_colormanagement_colorspace_to_scene_linear( + out, width, 1, buf->get_num_channels(), colorspace, false); + out += buf->row_stride; + } + } +} + +void MemoryBuffer::copy_from(const ImBuf *src, const rcti &area, const bool ensure_linear_space) +{ + copy_from(src, area, 0, this->get_num_channels(), 0, ensure_linear_space); +} - unsigned int otherY; - unsigned int minX = MAX2(this->m_rect.xmin, src.m_rect.xmin); - unsigned int maxX = MIN2(this->m_rect.xmax, src.m_rect.xmax); - unsigned int minY = MAX2(this->m_rect.ymin, src.m_rect.ymin); - unsigned int maxY = MIN2(this->m_rect.ymax, src.m_rect.ymax); - int offset; - int otherOffset; +void MemoryBuffer::copy_from(const ImBuf *src, + const rcti &area, + const int channel_offset, + const int elem_size, + const int to_channel_offset, + const bool ensure_linear_space) +{ + copy_from(src, + area, + channel_offset, + elem_size, + area.xmin, + area.ymin, + to_channel_offset, + ensure_linear_space); +} - for (otherY = minY; otherY < maxY; otherY++) { - otherOffset = src.get_coords_offset(minX, otherY); - offset = this->get_coords_offset(minX, otherY); - memcpy(&this->m_buffer[offset], - &src.m_buffer[otherOffset], - (maxX - minX) * this->m_num_channels * sizeof(float)); +void MemoryBuffer::copy_from(const ImBuf *src, + const rcti &area, + const int channel_offset, + const int elem_size, + const int to_x, + const int to_y, + const int to_channel_offset, + const bool ensure_linear_space) +{ + if (src->rect_float) { + const MemoryBuffer mem_buf(src->rect_float, src->channels, src->x, src->y, false); + copy_from(&mem_buf, area, channel_offset, elem_size, to_x, to_y, to_channel_offset); } + else if (src->rect) { + const uchar *uc_buf = (uchar *)src->rect; + const int elem_stride = src->channels; + copy_from(uc_buf, area, channel_offset, elem_size, elem_stride, to_x, to_y, to_channel_offset); + if (ensure_linear_space) { + colorspace_to_scene_linear(this, area, src->rect_colorspace); + } + } + else { + /* Empty ImBuf source. Fill destination with empty values. */ + const float *zero_elem = new float[elem_size]{0}; + fill(area, to_channel_offset, zero_elem, elem_size); + delete[] zero_elem; + } +} + +void MemoryBuffer::fill(const rcti &area, const float *value) +{ + fill(area, 0, value, this->get_num_channels()); +} + +void MemoryBuffer::fill(const rcti &area, + const int channel_offset, + const float *value, + const int value_size) +{ + const MemoryBuffer single_elem(const_cast<float *>(value), value_size, this->get_rect(), true); + copy_from(&single_elem, area, 0, value_size, area.xmin, area.ymin, channel_offset); +} + +void MemoryBuffer::fill_from(const MemoryBuffer &src) +{ + rcti overlap; + overlap.xmin = MAX2(this->m_rect.xmin, src.m_rect.xmin); + overlap.xmax = MIN2(this->m_rect.xmax, src.m_rect.xmax); + overlap.ymin = MAX2(this->m_rect.ymin, src.m_rect.ymin); + overlap.ymax = MIN2(this->m_rect.ymax, src.m_rect.ymax); + copy_from(&src, overlap); } void MemoryBuffer::writePixel(int x, int y, const float color[4]) @@ -196,4 +414,70 @@ void MemoryBuffer::readEWA(float *result, const float uv[2], const float derivat } } +void MemoryBuffer::copy_single_elem_from(const MemoryBuffer *src, + const int channel_offset, + const int elem_size, + const int to_channel_offset) +{ + ASSERT_VALID_ELEM_SIZE(this, to_channel_offset, elem_size); + ASSERT_VALID_ELEM_SIZE(src, channel_offset, elem_size); + BLI_assert(this->is_a_single_elem()); + + float *to_elem = &this->get_value( + this->get_rect().xmin, this->get_rect().ymin, to_channel_offset); + const float *from_elem = &src->get_value( + src->get_rect().xmin, src->get_rect().ymin, channel_offset); + const int elem_bytes = elem_size * sizeof(float); + memcpy(to_elem, from_elem, elem_bytes); +} + +void MemoryBuffer::copy_rows_from(const MemoryBuffer *src, + const rcti &area, + const int to_x, + const int to_y) +{ + ASSERT_BUFFER_CONTAINS_AREA(src, area); + ASSERT_BUFFER_CONTAINS_AREA_AT_COORDS(this, area, to_x, to_y); + BLI_assert(this->get_num_channels() == src->get_num_channels()); + BLI_assert(!this->is_a_single_elem()); + BLI_assert(!src->is_a_single_elem()); + + const int width = BLI_rcti_size_x(&area); + const int height = BLI_rcti_size_y(&area); + const int row_bytes = this->get_num_channels() * width * sizeof(float); + for (int y = 0; y < height; y++) { + float *to_row = this->get_elem(to_x, to_y + y); + const float *from_row = src->get_elem(area.xmin, area.ymin + y); + memcpy(to_row, from_row, row_bytes); + } +} + +void MemoryBuffer::copy_elems_from(const MemoryBuffer *src, + const rcti &area, + const int channel_offset, + const int elem_size, + const int to_x, + const int to_y, + const int to_channel_offset) +{ + ASSERT_BUFFER_CONTAINS_AREA(src, area); + ASSERT_BUFFER_CONTAINS_AREA_AT_COORDS(this, area, to_x, to_y); + ASSERT_VALID_ELEM_SIZE(this, to_channel_offset, elem_size); + ASSERT_VALID_ELEM_SIZE(src, channel_offset, elem_size); + + const int width = BLI_rcti_size_x(&area); + const int height = BLI_rcti_size_y(&area); + const int elem_bytes = elem_size * sizeof(float); + for (int y = 0; y < height; y++) { + float *to_elem = &this->get_value(to_x, to_y + y, to_channel_offset); + const float *from_elem = &src->get_value(area.xmin, area.ymin + y, channel_offset); + const float *row_end = to_elem + width * this->elem_stride; + while (to_elem < row_end) { + memcpy(to_elem, from_elem, elem_bytes); + to_elem += this->elem_stride; + from_elem += src->elem_stride; + } + } +} + } // namespace blender::compositor diff --git a/source/blender/compositor/intern/COM_MemoryBuffer.h b/source/blender/compositor/intern/COM_MemoryBuffer.h index 97b220508e0..fdfd1c1c37b 100644 --- a/source/blender/compositor/intern/COM_MemoryBuffer.h +++ b/source/blender/compositor/intern/COM_MemoryBuffer.h @@ -34,7 +34,7 @@ enum class MemoryBufferState { /** \brief memory has been allocated on creator device and CPU machine, * but kernel has not been executed */ Default = 0, - /** \brief chunk is consolidated from other chunks. special state.*/ + /** \brief chunk is consolidated from other chunks. special state. */ Temporary = 6, }; @@ -106,6 +106,11 @@ class MemoryBuffer { */ bool m_is_a_single_elem; + /** + * Whether MemoryBuffer owns buffer data. + */ + bool owns_data_; + public: /** * \brief construct new temporarily MemoryBuffer for an area @@ -117,6 +122,11 @@ class MemoryBuffer { */ MemoryBuffer(DataType datatype, const rcti &rect, bool is_a_single_elem = false); + MemoryBuffer( + float *buffer, int num_channels, int width, int height, bool is_a_single_elem = false); + + MemoryBuffer(float *buffer, int num_channels, const rcti &rect, bool is_a_single_elem = false); + /** * Copy constructor */ @@ -223,7 +233,7 @@ class MemoryBuffer { return is_a_single_elem() ? 1 : getHeight(); } - uint8_t get_num_channels() + uint8_t get_num_channels() const { return this->m_num_channels; } @@ -404,11 +414,58 @@ class MemoryBuffer { return this->m_state == MemoryBufferState::Temporary; } + void copy_from(const MemoryBuffer *src, const rcti &area); + void copy_from(const MemoryBuffer *src, const rcti &area, int to_x, int to_y); + void copy_from(const MemoryBuffer *src, + const rcti &area, + int channel_offset, + int elem_size, + int to_channel_offset); + void copy_from(const MemoryBuffer *src, + const rcti &area, + int channel_offset, + int elem_size, + int to_x, + int to_y, + int to_channel_offset); + void copy_from(const uchar *src, const rcti &area); + void copy_from(const uchar *src, + const rcti &area, + int channel_offset, + int elem_size, + int elem_stride, + int to_channel_offset); + void copy_from(const uchar *src, + const rcti &area, + int channel_offset, + int elem_size, + int elem_stride, + int to_x, + int to_y, + int to_channel_offset); + void copy_from(const struct ImBuf *src, const rcti &area, bool ensure_linear_space = false); + void copy_from(const struct ImBuf *src, + const rcti &area, + int channel_offset, + int elem_size, + int to_channel_offset, + bool ensure_linear_space = false); + void copy_from(const struct ImBuf *src, + const rcti &src_area, + int channel_offset, + int elem_size, + int to_x, + int to_y, + int to_channel_offset, + bool ensure_linear_space = false); + + void fill(const rcti &area, const float *value); + void fill(const rcti &area, int channel_offset, const float *value, int value_size); /** * \brief add the content from otherBuffer to this MemoryBuffer * \param otherBuffer: source buffer * - * \note take care when running this on a new buffer since it wont fill in + * \note take care when running this on a new buffer since it won't fill in * uninitialized values in areas where the buffers don't overlap. */ void fill_from(const MemoryBuffer &src); @@ -452,6 +509,22 @@ class MemoryBuffer { return get_memory_width() * get_memory_height(); } + void copy_single_elem_from(const MemoryBuffer *src, + int channel_offset, + int elem_size, + const int to_channel_offset); + void copy_rows_from(const MemoryBuffer *src, + const rcti &src_area, + const int to_x, + const int to_y); + void copy_elems_from(const MemoryBuffer *src, + const rcti &area, + const int channel_offset, + const int elem_size, + const int to_x, + const int to_y, + const int to_channel_offset); + #ifdef WITH_CXX_GUARDEDALLOC MEM_CXX_CLASS_ALLOC_FUNCS("COM:MemoryBuffer") #endif diff --git a/source/blender/compositor/intern/COM_MetaData.cc b/source/blender/compositor/intern/COM_MetaData.cc index 88bfa385514..a6fb84dfb87 100644 --- a/source/blender/compositor/intern/COM_MetaData.cc +++ b/source/blender/compositor/intern/COM_MetaData.cc @@ -41,7 +41,7 @@ void MetaData::addCryptomatteEntry(const blender::StringRef layer_name, /* Replace the hash neutral cryptomatte keys with hashed versions. * * When a conversion happens it will also add the cryptomatte name key with the given - * `layer_name`.*/ + * `layer_name`. */ void MetaData::replaceHashNeutralCryptomatteKeys(const blender::StringRef layer_name) { std::string cryptomatte_hash = entries_.pop_default(META_DATA_KEY_CRYPTOMATTE_HASH, ""); diff --git a/source/blender/compositor/intern/COM_MultiThreadedOperation.cc b/source/blender/compositor/intern/COM_MultiThreadedOperation.cc index c54c2edccb0..e6e98d69b36 100644 --- a/source/blender/compositor/intern/COM_MultiThreadedOperation.cc +++ b/source/blender/compositor/intern/COM_MultiThreadedOperation.cc @@ -5,21 +5,22 @@ namespace blender::compositor { MultiThreadedOperation::MultiThreadedOperation() { - m_num_passes = 1; + num_passes_ = 1; + current_pass_ = 0; flags.is_fullframe_operation = true; } void MultiThreadedOperation::update_memory_buffer(MemoryBuffer *output, - const rcti &output_area, - blender::Span<MemoryBuffer *> inputs, + const rcti &area, + Span<MemoryBuffer *> inputs, ExecutionSystem &exec_system) { - for (int current_pass = 0; current_pass < m_num_passes; current_pass++) { - update_memory_buffer_started(output, output_area, inputs, exec_system, current_pass); - exec_system.execute_work(output_area, [=, &exec_system](const rcti &split_rect) { - update_memory_buffer_partial(output, split_rect, inputs, exec_system, current_pass); + for (current_pass_ = 0; current_pass_ < num_passes_; current_pass_++) { + update_memory_buffer_started(output, area, inputs); + exec_system.execute_work(area, [=](const rcti &split_rect) { + update_memory_buffer_partial(output, split_rect, inputs); }); - update_memory_buffer_finished(output, output_area, inputs, exec_system, current_pass); + update_memory_buffer_finished(output, area, inputs); } } diff --git a/source/blender/compositor/intern/COM_MultiThreadedOperation.h b/source/blender/compositor/intern/COM_MultiThreadedOperation.h index 97c5fba4ead..ad09c4df089 100644 --- a/source/blender/compositor/intern/COM_MultiThreadedOperation.h +++ b/source/blender/compositor/intern/COM_MultiThreadedOperation.h @@ -27,7 +27,11 @@ class MultiThreadedOperation : public NodeOperation { /** * Number of execution passes. */ - int m_num_passes; + int num_passes_; + /** + * Current execution pass. + */ + int current_pass_; protected: MultiThreadedOperation(); @@ -36,37 +40,31 @@ class MultiThreadedOperation : public NodeOperation { * Called before an update memory buffer pass is executed. Single-threaded calls. */ virtual void update_memory_buffer_started(MemoryBuffer *UNUSED(output), - const rcti &UNUSED(output_rect), - blender::Span<MemoryBuffer *> UNUSED(inputs), - ExecutionSystem &UNUSED(exec_system), - int UNUSED(current_pass)) + const rcti &UNUSED(area), + Span<MemoryBuffer *> UNUSED(inputs)) { } /** - * Executes operation updating output memory buffer on output_rect area. Multi-threaded calls. + * Executes operation updating a memory buffer area. Multi-threaded calls. */ virtual void update_memory_buffer_partial(MemoryBuffer *output, - const rcti &output_rect, - blender::Span<MemoryBuffer *> inputs, - ExecutionSystem &exec_system, - int current_pass) = 0; + const rcti &area, + Span<MemoryBuffer *> inputs) = 0; /** * Called after an update memory buffer pass is executed. Single-threaded calls. */ virtual void update_memory_buffer_finished(MemoryBuffer *UNUSED(output), - const rcti &UNUSED(output_rect), - blender::Span<MemoryBuffer *> UNUSED(inputs), - ExecutionSystem &UNUSED(exec_system), - int UNUSED(current_pass)) + const rcti &UNUSED(area), + Span<MemoryBuffer *> UNUSED(inputs)) { } private: void update_memory_buffer(MemoryBuffer *output, - const rcti &output_area, - blender::Span<MemoryBuffer *> inputs, + const rcti &area, + Span<MemoryBuffer *> inputs, ExecutionSystem &exec_system) override; }; diff --git a/source/blender/compositor/intern/COM_NodeOperation.cc b/source/blender/compositor/intern/COM_NodeOperation.cc index 83de8a751c4..b943ab6af7f 100644 --- a/source/blender/compositor/intern/COM_NodeOperation.cc +++ b/source/blender/compositor/intern/COM_NodeOperation.cc @@ -188,12 +188,12 @@ bool NodeOperation::determineDependingAreaOfInterest(rcti *input, * caller must clamp it. * TODO: See if it's possible to use parameter overloading (input_id for example). * - * \param input_op_idx: Input operation index for which we want to calculate the area being read. + * \param input_idx: Input operation index for which we want to calculate the area being read. * \param output_area: Area being rendered by this operation. * \param r_input_area: Returned input operation area that needs to be read in order to render * given output area. */ -void NodeOperation::get_area_of_interest(const int input_op_idx, +void NodeOperation::get_area_of_interest(const int input_idx, const rcti &output_area, rcti &r_input_area) { @@ -203,7 +203,7 @@ void NodeOperation::get_area_of_interest(const int input_op_idx, else { /* Non full-frame operations never implement this method. To ensure correctness assume * whole area is used. */ - NodeOperation *input_op = getInputOperation(input_op_idx); + NodeOperation *input_op = getInputOperation(input_idx); BLI_rcti_init(&r_input_area, 0, input_op->getWidth(), 0, input_op->getHeight()); } } diff --git a/source/blender/compositor/intern/COM_NodeOperation.h b/source/blender/compositor/intern/COM_NodeOperation.h index 5c4d6dd19ba..5ae0aae67d5 100644 --- a/source/blender/compositor/intern/COM_NodeOperation.h +++ b/source/blender/compositor/intern/COM_NodeOperation.h @@ -578,7 +578,7 @@ class NodeOperation { * Executes operation updating output memory buffer. Single-threaded calls. */ virtual void update_memory_buffer(MemoryBuffer *UNUSED(output), - const rcti &UNUSED(output_area), + const rcti &UNUSED(area), Span<MemoryBuffer *> UNUSED(inputs), ExecutionSystem &UNUSED(exec_system)) { @@ -587,7 +587,7 @@ class NodeOperation { /** * Get input operation area being read by this operation on rendering given output area. */ - virtual void get_area_of_interest(int input_op_idx, const rcti &output_area, rcti &r_input_area); + virtual void get_area_of_interest(int input_idx, const rcti &output_area, rcti &r_input_area); void get_area_of_interest(NodeOperation *input_op, const rcti &output_area, rcti &r_input_area); /** \} */ diff --git a/source/blender/compositor/nodes/COM_OutputFileNode.cc b/source/blender/compositor/nodes/COM_OutputFileNode.cc index e5b9cfb8cc2..8b5140636c1 100644 --- a/source/blender/compositor/nodes/COM_OutputFileNode.cc +++ b/source/blender/compositor/nodes/COM_OutputFileNode.cc @@ -96,7 +96,7 @@ void OutputFileNode::convertToOperations(NodeConverter &converter, converter.addOperation(outputOperation); /* First add all inputs. Inputs are stored in a Vector and can be moved to a different - * memory address during this time.*/ + * memory address during this time. */ add_input_sockets(*outputOperation); /* After adding the sockets the memory addresses will stick. */ map_input_sockets(converter, *outputOperation); diff --git a/source/blender/compositor/operations/COM_AntiAliasOperation.cc b/source/blender/compositor/operations/COM_AntiAliasOperation.cc index 23d6f4b80c7..deccbb28f49 100644 --- a/source/blender/compositor/operations/COM_AntiAliasOperation.cc +++ b/source/blender/compositor/operations/COM_AntiAliasOperation.cc @@ -202,4 +202,72 @@ void *AntiAliasOperation::initializeTileData(rcti *rect) return getInputOperation(0)->initializeTileData(rect); } +void AntiAliasOperation::get_area_of_interest(const int input_idx, + const rcti &output_area, + rcti &r_input_area) +{ + BLI_assert(input_idx == 0); + UNUSED_VARS_NDEBUG(input_idx); + r_input_area.xmax = output_area.xmax + 1; + r_input_area.xmin = output_area.xmin - 1; + r_input_area.ymax = output_area.ymax + 1; + r_input_area.ymin = output_area.ymin - 1; +} + +void AntiAliasOperation::update_memory_buffer_partial(MemoryBuffer *output, + const rcti &area, + Span<MemoryBuffer *> inputs) +{ + const MemoryBuffer *input = inputs[0]; + const rcti &input_area = input->get_rect(); + float ninepix[9]; + for (int y = area.ymin; y < area.ymax; y++) { + float *out = output->get_elem(area.xmin, y); + const float *row_curr = input->get_elem(area.xmin, y); + const float *row_prev = row_curr - input->row_stride; + const float *row_next = row_curr + input->row_stride; + int x_offset = 0; + for (int x = area.xmin; x < area.xmax; + x++, out += output->elem_stride, x_offset += input->elem_stride) { + if (x == input_area.xmin || x == input_area.xmax - 1 || y == input_area.xmin || + y == input_area.ymax - 1) { + out[0] = row_curr[x_offset]; + continue; + } + + if (extrapolate9(&ninepix[0], + &ninepix[1], + &ninepix[2], + &ninepix[3], + &ninepix[4], + &ninepix[5], + &ninepix[6], + &ninepix[7], + &ninepix[8], + &row_prev[x_offset - input->elem_stride], + &row_prev[x_offset], + &row_prev[x_offset + input->elem_stride], + &row_curr[x_offset - input->elem_stride], + &row_curr[x_offset], + &row_curr[x_offset + input->elem_stride], + &row_next[x_offset - input->elem_stride], + &row_next[x_offset], + &row_next[x_offset + input->elem_stride])) { + /* Some rounding magic to make weighting correct with the + * original coefficients. */ + unsigned char result = ((3 * ninepix[0] + 5 * ninepix[1] + 3 * ninepix[2] + + 5 * ninepix[3] + 6 * ninepix[4] + 5 * ninepix[5] + + 3 * ninepix[6] + 5 * ninepix[7] + 3 * ninepix[8]) * + 255.0f + + 19.0f) / + 38.0f; + out[0] = result / 255.0f; + } + else { + out[0] = row_curr[x_offset]; + } + } + } +} + } // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_AntiAliasOperation.h b/source/blender/compositor/operations/COM_AntiAliasOperation.h index fc9102b5b4c..b5048248425 100644 --- a/source/blender/compositor/operations/COM_AntiAliasOperation.h +++ b/source/blender/compositor/operations/COM_AntiAliasOperation.h @@ -18,7 +18,7 @@ #pragma once -#include "COM_NodeOperation.h" +#include "COM_MultiThreadedOperation.h" #include "DNA_node_types.h" namespace blender::compositor { @@ -28,7 +28,7 @@ namespace blender::compositor { * it only supports anti aliasing on BW buffers. * \ingroup operation */ -class AntiAliasOperation : public NodeOperation { +class AntiAliasOperation : public MultiThreadedOperation { protected: /** * \brief Cached reference to the reader @@ -57,6 +57,12 @@ class AntiAliasOperation : public NodeOperation { bool determineDependingAreaOfInterest(rcti *input, ReadBufferOperation *readOperation, rcti *output) override; + + void get_area_of_interest(int input_idx, const rcti &output_area, rcti &r_input_area) override; + + void update_memory_buffer_partial(MemoryBuffer *output, + const rcti &area, + Span<MemoryBuffer *> inputs) override; }; } // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_ChannelMatteOperation.cc b/source/blender/compositor/operations/COM_ChannelMatteOperation.cc index 89290978608..ec4331dc231 100644 --- a/source/blender/compositor/operations/COM_ChannelMatteOperation.cc +++ b/source/blender/compositor/operations/COM_ChannelMatteOperation.cc @@ -104,12 +104,12 @@ void ChannelMatteOperation::executePixelSampled(float output[4], /* test range */ if (alpha > limit_max) { - alpha = inColor[3]; /*whatever it was prior */ + alpha = inColor[3]; /* Whatever it was prior. */ } else if (alpha < limit_min) { alpha = 0.0f; } - else { /*blend */ + else { /* Blend. */ alpha = (alpha - limit_min) / limit_range; } diff --git a/source/blender/compositor/operations/COM_ChromaMatteOperation.cc b/source/blender/compositor/operations/COM_ChromaMatteOperation.cc index 69aa4aac163..b7fec5f07e5 100644 --- a/source/blender/compositor/operations/COM_ChromaMatteOperation.cc +++ b/source/blender/compositor/operations/COM_ChromaMatteOperation.cc @@ -79,12 +79,12 @@ void ChromaMatteOperation::executePixelSampled(float output[4], theta = atan2(inKey[2], inKey[1]); - /*rotate the cb and cr into x/z space */ + /* Rotate the cb and cr into x/z space. */ x_angle = inImage[1] * cosf(theta) + inImage[2] * sinf(theta); z_angle = inImage[2] * cosf(theta) - inImage[1] * sinf(theta); - /*if within the acceptance angle */ - /* if kfg is <0 then the pixel is outside of the key color */ + /* If within the acceptance angle. */ + /* If kfg is <0 then the pixel is outside of the key color. */ kfg = x_angle - (fabsf(z_angle) / tanf(acceptance / 2.0f)); if (kfg > 0.0f) { /* found a pixel that is within key color */ @@ -105,8 +105,8 @@ void ChromaMatteOperation::executePixelSampled(float output[4], output[0] = inImage[3]; } } - else { /*pixel is outside key color */ - output[0] = inImage[3]; /* make pixel just as transparent as it was before */ + else { /* Pixel is outside key color. */ + output[0] = inImage[3]; /* Make pixel just as transparent as it was before. */ } } diff --git a/source/blender/compositor/operations/COM_ColorMatteOperation.cc b/source/blender/compositor/operations/COM_ColorMatteOperation.cc index 89f56ac4aae..ddfbf415d9c 100644 --- a/source/blender/compositor/operations/COM_ColorMatteOperation.cc +++ b/source/blender/compositor/operations/COM_ColorMatteOperation.cc @@ -65,7 +65,7 @@ void ColorMatteOperation::executePixelSampled(float output[4], */ if ( - /* do hue last because it needs to wrap, and does some more checks */ + /* Do hue last because it needs to wrap, and does some more checks. */ /* sat */ (fabsf(inColor[1] - inKey[1]) < sat) && /* val */ (fabsf(inColor[2] - inKey[2]) < val) && @@ -77,8 +77,8 @@ void ColorMatteOperation::executePixelSampled(float output[4], output[0] = 0.0f; /* make transparent */ } - else { /*pixel is outside key color */ - output[0] = inColor[3]; /* make pixel just as transparent as it was before */ + else { /* Pixel is outside key color. */ + output[0] = inColor[3]; /* Make pixel just as transparent as it was before. */ } } diff --git a/source/blender/compositor/operations/COM_DifferenceMatteOperation.cc b/source/blender/compositor/operations/COM_DifferenceMatteOperation.cc index e380131634f..0acdfc1651f 100644 --- a/source/blender/compositor/operations/COM_DifferenceMatteOperation.cc +++ b/source/blender/compositor/operations/COM_DifferenceMatteOperation.cc @@ -68,11 +68,11 @@ void DifferenceMatteOperation::executePixelSampled(float output[4], if (difference <= tolerance) { output[0] = 0.0f; } - /*in the falloff region, make partially transparent */ + /* In the falloff region, make partially transparent. */ else if (difference <= falloff + tolerance) { difference = difference - tolerance; alpha = difference / falloff; - /*only change if more transparent than before */ + /* Only change if more transparent than before. */ if (alpha < inColor1[3]) { output[0] = alpha; } diff --git a/source/blender/compositor/operations/COM_DistanceRGBMatteOperation.cc b/source/blender/compositor/operations/COM_DistanceRGBMatteOperation.cc index 12cb7e7d075..1b3403cbb29 100644 --- a/source/blender/compositor/operations/COM_DistanceRGBMatteOperation.cc +++ b/source/blender/compositor/operations/COM_DistanceRGBMatteOperation.cc @@ -71,15 +71,15 @@ void DistanceRGBMatteOperation::executePixelSampled(float output[4], * COM_SetAlphaMultiplyOperation and the Value output. */ - /*make 100% transparent */ + /* Make 100% transparent. */ if (distance < tolerance) { output[0] = 0.0f; } - /*in the falloff region, make partially transparent */ + /* In the falloff region, make partially transparent. */ else if (distance < falloff + tolerance) { distance = distance - tolerance; alpha = distance / falloff; - /*only change if more transparent than before */ + /* Only change if more transparent than before. */ if (alpha < inImage[3]) { output[0] = alpha; } diff --git a/source/blender/compositor/operations/COM_DoubleEdgeMaskOperation.cc b/source/blender/compositor/operations/COM_DoubleEdgeMaskOperation.cc index a3a86a6c502..c4099a6d33d 100644 --- a/source/blender/compositor/operations/COM_DoubleEdgeMaskOperation.cc +++ b/source/blender/compositor/operations/COM_DoubleEdgeMaskOperation.cc @@ -960,7 +960,7 @@ static void do_createEdgeLocationBuffer(unsigned int t, /* For looping gradient pixel indexes, represents current position from offset. */ unsigned int gradientAccum = 0; - /* */ + /* Disable clang-format to prevent line-wrapping. */ /* clang-format off */ /* * Here we compute the size of buffer needed to hold (row,col) coordinates diff --git a/source/blender/compositor/operations/COM_IDMaskOperation.cc b/source/blender/compositor/operations/COM_IDMaskOperation.cc index 1bb247e9bc5..38f8b7e075f 100644 --- a/source/blender/compositor/operations/COM_IDMaskOperation.cc +++ b/source/blender/compositor/operations/COM_IDMaskOperation.cc @@ -42,4 +42,22 @@ void IDMaskOperation::executePixel(float output[4], int x, int y, void *data) output[0] = (roundf(buffer[buffer_index]) == this->m_objectIndex) ? 1.0f : 0.0f; } +void IDMaskOperation::update_memory_buffer_partial(MemoryBuffer *output, + const rcti &area, + Span<MemoryBuffer *> inputs) +{ + const MemoryBuffer *input = inputs[0]; + const int width = BLI_rcti_size_x(&area); + for (int y = area.ymin; y < area.ymax; y++) { + float *out = output->get_elem(area.xmin, y); + const float *in = input->get_elem(area.xmin, y); + const float *row_end = out + width * output->elem_stride; + while (out < row_end) { + out[0] = (roundf(in[0]) == m_objectIndex) ? 1.0f : 0.0f; + in += input->elem_stride; + out += output->elem_stride; + } + } +} + } // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_IDMaskOperation.h b/source/blender/compositor/operations/COM_IDMaskOperation.h index 79b7e53b67c..c2e13641b46 100644 --- a/source/blender/compositor/operations/COM_IDMaskOperation.h +++ b/source/blender/compositor/operations/COM_IDMaskOperation.h @@ -18,11 +18,11 @@ #pragma once -#include "COM_NodeOperation.h" +#include "COM_MultiThreadedOperation.h" namespace blender::compositor { -class IDMaskOperation : public NodeOperation { +class IDMaskOperation : public MultiThreadedOperation { private: float m_objectIndex; @@ -36,6 +36,10 @@ class IDMaskOperation : public NodeOperation { { this->m_objectIndex = objectIndex; } + + void update_memory_buffer_partial(MemoryBuffer *output, + const rcti &area, + Span<MemoryBuffer *> inputs) override; }; } // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_ImageOperation.cc b/source/blender/compositor/operations/COM_ImageOperation.cc index a1d401d4499..e78d389410f 100644 --- a/source/blender/compositor/operations/COM_ImageOperation.cc +++ b/source/blender/compositor/operations/COM_ImageOperation.cc @@ -44,6 +44,7 @@ BaseImageOperation::BaseImageOperation() this->m_imageheight = 0; this->m_framenumber = 0; this->m_depthBuffer = nullptr; + depth_buffer_ = nullptr; this->m_numberOfChannels = 0; this->m_rd = nullptr; this->m_viewName = nullptr; @@ -91,6 +92,9 @@ void BaseImageOperation::initExecution() this->m_imageFloatBuffer = stackbuf->rect_float; this->m_imageByteBuffer = stackbuf->rect; this->m_depthBuffer = stackbuf->zbuf_float; + if (stackbuf->zbuf_float) { + depth_buffer_ = new MemoryBuffer(stackbuf->zbuf_float, 1, stackbuf->x, stackbuf->y); + } this->m_imagewidth = stackbuf->x; this->m_imageheight = stackbuf->y; this->m_numberOfChannels = stackbuf->channels; @@ -102,6 +106,10 @@ void BaseImageOperation::deinitExecution() this->m_imageFloatBuffer = nullptr; this->m_imageByteBuffer = nullptr; BKE_image_release_ibuf(this->m_image, this->m_buffer, nullptr); + if (depth_buffer_) { + delete depth_buffer_; + depth_buffer_ = nullptr; + } } void BaseImageOperation::determineResolution(unsigned int resolution[2], @@ -170,6 +178,13 @@ void ImageOperation::executePixelSampled(float output[4], float x, float y, Pixe } } +void ImageOperation::update_memory_buffer_partial(MemoryBuffer *output, + const rcti &area, + Span<MemoryBuffer *> UNUSED(inputs)) +{ + output->copy_from(m_buffer, area, true); +} + void ImageAlphaOperation::executePixelSampled(float output[4], float x, float y, @@ -187,6 +202,13 @@ void ImageAlphaOperation::executePixelSampled(float output[4], } } +void ImageAlphaOperation::update_memory_buffer_partial(MemoryBuffer *output, + const rcti &area, + Span<MemoryBuffer *> UNUSED(inputs)) +{ + output->copy_from(m_buffer, area, 3, COM_DATA_TYPE_VALUE_CHANNELS, 0); +} + void ImageDepthOperation::executePixelSampled(float output[4], float x, float y, @@ -206,4 +228,16 @@ void ImageDepthOperation::executePixelSampled(float output[4], } } +void ImageDepthOperation::update_memory_buffer_partial(MemoryBuffer *output, + const rcti &area, + Span<MemoryBuffer *> UNUSED(inputs)) +{ + if (depth_buffer_) { + output->copy_from(depth_buffer_, area); + } + else { + output->fill(area, COM_VALUE_ZERO); + } +} + } // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_ImageOperation.h b/source/blender/compositor/operations/COM_ImageOperation.h index 58373663db5..f8b4239c9f8 100644 --- a/source/blender/compositor/operations/COM_ImageOperation.h +++ b/source/blender/compositor/operations/COM_ImageOperation.h @@ -21,7 +21,7 @@ #include "BKE_image.h" #include "BLI_listbase.h" #include "BLI_utildefines.h" -#include "COM_NodeOperation.h" +#include "COM_MultiThreadedOperation.h" #include "MEM_guardedalloc.h" #include "RE_pipeline.h" @@ -32,14 +32,17 @@ namespace blender::compositor { /** * \brief Base class for all image operations */ -class BaseImageOperation : public NodeOperation { +class BaseImageOperation : public MultiThreadedOperation { protected: ImBuf *m_buffer; Image *m_image; ImageUser *m_imageUser; + /* TODO: Remove raw buffers when removing Tiled implementation. */ float *m_imageFloatBuffer; unsigned int *m_imageByteBuffer; float *m_depthBuffer; + + MemoryBuffer *depth_buffer_; int m_imageheight; int m_imagewidth; int m_framenumber; @@ -87,6 +90,10 @@ class ImageOperation : public BaseImageOperation { */ ImageOperation(); void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; + + void update_memory_buffer_partial(MemoryBuffer *output, + const rcti &area, + Span<MemoryBuffer *> inputs) override; }; class ImageAlphaOperation : public BaseImageOperation { public: @@ -95,6 +102,10 @@ class ImageAlphaOperation : public BaseImageOperation { */ ImageAlphaOperation(); void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; + + void update_memory_buffer_partial(MemoryBuffer *output, + const rcti &area, + Span<MemoryBuffer *> inputs) override; }; class ImageDepthOperation : public BaseImageOperation { public: @@ -103,6 +114,10 @@ class ImageDepthOperation : public BaseImageOperation { */ ImageDepthOperation(); void executePixelSampled(float output[4], float x, float y, PixelSampler sampler) override; + + void update_memory_buffer_partial(MemoryBuffer *output, + const rcti &area, + Span<MemoryBuffer *> inputs) override; }; } // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_LuminanceMatteOperation.cc b/source/blender/compositor/operations/COM_LuminanceMatteOperation.cc index 0afc4278a45..5ca16e40ce3 100644 --- a/source/blender/compositor/operations/COM_LuminanceMatteOperation.cc +++ b/source/blender/compositor/operations/COM_LuminanceMatteOperation.cc @@ -66,7 +66,7 @@ void LuminanceMatteOperation::executePixelSampled(float output[4], else if (luminance < low) { alpha = 0.0f; } - else { /*blend */ + else { /* Blend. */ alpha = (luminance - low) / (high - low); } diff --git a/source/blender/compositor/operations/COM_MaskOperation.h b/source/blender/compositor/operations/COM_MaskOperation.h index 48fd54b00fe..92a2c291a72 100644 --- a/source/blender/compositor/operations/COM_MaskOperation.h +++ b/source/blender/compositor/operations/COM_MaskOperation.h @@ -39,8 +39,8 @@ class MaskOperation : public NodeOperation { * but they _do_ impact on mask detail */ int m_maskWidth; int m_maskHeight; - float m_maskWidthInv; /* 1 / m_maskWidth */ - float m_maskHeightInv; /* 1 / m_maskHeight */ + float m_maskWidthInv; /* `1 / m_maskWidth` */ + float m_maskHeightInv; /* `1 / m_maskHeight` */ float m_mask_px_ofs[2]; float m_frame_shutter; diff --git a/source/blender/compositor/operations/COM_MultilayerImageOperation.cc b/source/blender/compositor/operations/COM_MultilayerImageOperation.cc index 647e93225e5..3a5de944a00 100644 --- a/source/blender/compositor/operations/COM_MultilayerImageOperation.cc +++ b/source/blender/compositor/operations/COM_MultilayerImageOperation.cc @@ -51,6 +51,13 @@ ImBuf *MultilayerBaseOperation::getImBuf() return nullptr; } +void MultilayerBaseOperation::update_memory_buffer_partial(MemoryBuffer *output, + const rcti &area, + Span<MemoryBuffer *> UNUSED(inputs)) +{ + output->copy_from(m_buffer, area); +} + std::unique_ptr<MetaData> MultilayerColorOperation::getMetaData() { BLI_assert(this->m_buffer); diff --git a/source/blender/compositor/operations/COM_MultilayerImageOperation.h b/source/blender/compositor/operations/COM_MultilayerImageOperation.h index 6e6062cf854..a682ca1941c 100644 --- a/source/blender/compositor/operations/COM_MultilayerImageOperation.h +++ b/source/blender/compositor/operations/COM_MultilayerImageOperation.h @@ -37,6 +37,10 @@ class MultilayerBaseOperation : public BaseImageOperation { * Constructor */ MultilayerBaseOperation(RenderLayer *render_layer, RenderPass *render_pass, int view); + + void update_memory_buffer_partial(MemoryBuffer *output, + const rcti &area, + Span<MemoryBuffer *> inputs) override; }; class MultilayerColorOperation : public MultilayerBaseOperation { diff --git a/source/blender/compositor/operations/COM_SMAAOperation.cc b/source/blender/compositor/operations/COM_SMAAOperation.cc index 74807f281d7..7a272fa8795 100644 --- a/source/blender/compositor/operations/COM_SMAAOperation.cc +++ b/source/blender/compositor/operations/COM_SMAAOperation.cc @@ -332,7 +332,7 @@ void SMAABlendingWeightCalculationOperation::executePixel(float output[4], /* in one of the boundaries is enough. */ calculateDiagWeights(x, y, edges, output); - /* We give priority to diagonals, so if we find a diagonal we skip */ + /* We give priority to diagonals, so if we find a diagonal we skip. */ /* horizontal/vertical processing. */ if (!is_zero_v2(output)) { return; diff --git a/source/blender/compositor/operations/COM_SetColorOperation.cc b/source/blender/compositor/operations/COM_SetColorOperation.cc index 6cefab83848..79dee33e266 100644 --- a/source/blender/compositor/operations/COM_SetColorOperation.cc +++ b/source/blender/compositor/operations/COM_SetColorOperation.cc @@ -43,12 +43,12 @@ void SetColorOperation::determineResolution(unsigned int resolution[2], } void SetColorOperation::update_memory_buffer(MemoryBuffer *output, - const rcti &output_area, + const rcti &area, Span<MemoryBuffer *> UNUSED(inputs), ExecutionSystem &UNUSED(exec_system)) { BLI_assert(output->is_a_single_elem()); - float *out_elem = output->get_elem(output_area.xmin, output_area.ymin); + float *out_elem = output->get_elem(area.xmin, area.ymin); copy_v4_v4(out_elem, m_color); } diff --git a/source/blender/compositor/operations/COM_SetColorOperation.h b/source/blender/compositor/operations/COM_SetColorOperation.h index ba5b007bef0..2e22ef60ba4 100644 --- a/source/blender/compositor/operations/COM_SetColorOperation.h +++ b/source/blender/compositor/operations/COM_SetColorOperation.h @@ -82,7 +82,7 @@ class SetColorOperation : public NodeOperation { unsigned int preferredResolution[2]) override; void update_memory_buffer(MemoryBuffer *output, - const rcti &output_area, + const rcti &area, Span<MemoryBuffer *> inputs, ExecutionSystem &exec_system) override; }; diff --git a/source/blender/compositor/operations/COM_SetValueOperation.cc b/source/blender/compositor/operations/COM_SetValueOperation.cc index 39cf92d325f..359647c8fe3 100644 --- a/source/blender/compositor/operations/COM_SetValueOperation.cc +++ b/source/blender/compositor/operations/COM_SetValueOperation.cc @@ -43,12 +43,12 @@ void SetValueOperation::determineResolution(unsigned int resolution[2], } void SetValueOperation::update_memory_buffer(MemoryBuffer *output, - const rcti &output_area, + const rcti &area, Span<MemoryBuffer *> UNUSED(inputs), ExecutionSystem &UNUSED(exec_system)) { BLI_assert(output->is_a_single_elem()); - float *out_elem = output->get_elem(output_area.xmin, output_area.ymin); + float *out_elem = output->get_elem(area.xmin, area.ymin); *out_elem = m_value; } diff --git a/source/blender/compositor/operations/COM_SetValueOperation.h b/source/blender/compositor/operations/COM_SetValueOperation.h index cf578e1794f..acde5aa03b7 100644 --- a/source/blender/compositor/operations/COM_SetValueOperation.h +++ b/source/blender/compositor/operations/COM_SetValueOperation.h @@ -52,7 +52,7 @@ class SetValueOperation : public NodeOperation { void determineResolution(unsigned int resolution[2], unsigned int preferredResolution[2]) override; void update_memory_buffer(MemoryBuffer *output, - const rcti &output_area, + const rcti &area, Span<MemoryBuffer *> inputs, ExecutionSystem &exec_system) override; }; diff --git a/source/blender/datatoc/datatoc_icon.c b/source/blender/datatoc/datatoc_icon.c index 7f1d90f20ea..2023260c168 100644 --- a/source/blender/datatoc/datatoc_icon.c +++ b/source/blender/datatoc/datatoc_icon.c @@ -453,7 +453,7 @@ static bool icondir_to_png(const char *path_src, const char *file_dst) printf("%s: dir '%s' failed %d icons\n", __func__, path_src, fail); } - /* write pixels */ + /* Write pixels. */ write_png(file_dst, pixels_canvas, canvas_w, canvas_h); free(pixels_canvas); diff --git a/source/blender/depsgraph/CMakeLists.txt b/source/blender/depsgraph/CMakeLists.txt index 95ae587f4ce..3ad26c6f4db 100644 --- a/source/blender/depsgraph/CMakeLists.txt +++ b/source/blender/depsgraph/CMakeLists.txt @@ -158,6 +158,7 @@ set(SRC ) set(LIB + bf_blenkernel ) blender_add_lib(bf_depsgraph "${SRC}" "${INC}" "${INC_SYS}" "${LIB}") diff --git a/source/blender/depsgraph/DEG_depsgraph.h b/source/blender/depsgraph/DEG_depsgraph.h index 740124f6113..27441c9a7ae 100644 --- a/source/blender/depsgraph/DEG_depsgraph.h +++ b/source/blender/depsgraph/DEG_depsgraph.h @@ -109,11 +109,11 @@ void DEG_free_node_types(void); /* Update Tagging -------------------------------- */ -/* Update dependency graph when visible scenes/layers changes. */ -void DEG_graph_on_visible_update(struct Main *bmain, Depsgraph *depsgraph, const bool do_time); +/* Tag dependency graph for updates when visible scenes/layers changes. */ +void DEG_graph_tag_on_visible_update(Depsgraph *depsgraph, const bool do_time); -/* Update all dependency graphs when visible scenes/layers changes. */ -void DEG_on_visible_update(struct Main *bmain, const bool do_time); +/* Tag all dependency graphs for update when visible scenes/layers changes. */ +void DEG_tag_on_visible_update(struct Main *bmain, const bool do_time); /* NOTE: Will return NULL if the flag is not known, allowing to gracefully handle situations * when recalc flag has been removed. */ diff --git a/source/blender/depsgraph/DEG_depsgraph_build.h b/source/blender/depsgraph/DEG_depsgraph_build.h index b4acf9b010c..42c9cccceed 100644 --- a/source/blender/depsgraph/DEG_depsgraph_build.h +++ b/source/blender/depsgraph/DEG_depsgraph_build.h @@ -75,7 +75,7 @@ void DEG_graph_tag_relations_update(struct Depsgraph *graph); /* Create or update relations in the specified graph. */ void DEG_graph_relations_update(struct Depsgraph *graph); -/* Tag all relations in the database for update.*/ +/* Tag all relations in the database for update. */ void DEG_relations_tag_update(struct Main *bmain); /* Add Dependencies ----------------------------- */ @@ -92,7 +92,7 @@ typedef enum eDepsSceneComponentType { * (i.e. just SDNA property setting). */ DEG_SCENE_COMP_PARAMETERS, /* Animation Component - * TODO(sergey): merge in with parameters? */ + * TODO(sergey): merge in with parameters? */ DEG_SCENE_COMP_ANIMATION, /* Sequencer Component (Scene Only). */ DEG_SCENE_COMP_SEQUENCER, diff --git a/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc b/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc index ae530cc010e..56168739fae 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc @@ -450,6 +450,22 @@ void DepsgraphNodeBuilder::update_invalid_cow_pointers() /* Node/ID already tagged for COW flush, no need to check it. */ continue; } + if ((id_node->id_cow->flag & LIB_EMBEDDED_DATA) != 0) { + /* For now, we assume embedded data are managed by their owner IDs and do not need to be + * checked here. + * + * NOTE: This exception somewhat weak, and ideally should not be needed. Currently however, + * embedded data are handled as full local (private) data of their owner IDs in part of + * Blender (like read/write code, including undo/redo), while depsgraph generally treat them + * as regular independent IDs. This leads to inconsistencies that can lead to bad level + * memory accesses. + * + * E.g. when undoing creation/deletion of a collection directly child of a scene's master + * collection, the scene itself is re-read in place, but its master collection becomes a + * completely new different pointer, and the existing COW of the old master collection in the + * matching deg node is therefore pointing to fully invalid (freed) memory. */ + continue; + } BKE_library_foreach_ID_link(nullptr, id_node->id_cow, deg::foreach_id_cow_detect_need_for_update_callback, @@ -1199,7 +1215,19 @@ void DepsgraphNodeBuilder::build_parameters(ID *id) op_node = add_operation_node(id, NodeType::PARAMETERS, OperationCode::PARAMETERS_ENTRY); op_node->set_as_entry(); /* Generic evaluation node. */ - add_operation_node(id, NodeType::PARAMETERS, OperationCode::PARAMETERS_EVAL); + + if (ID_TYPE_SUPPORTS_PARAMS_WITHOUT_COW(GS(id->name))) { + ID *id_cow = get_cow_id(id); + add_operation_node( + id, + NodeType::PARAMETERS, + OperationCode::PARAMETERS_EVAL, + [id_cow, id](::Depsgraph * /*depsgraph*/) { BKE_id_eval_properties_copy(id_cow, id); }); + } + else { + add_operation_node(id, NodeType::PARAMETERS, OperationCode::PARAMETERS_EVAL); + } + /* Explicit exit operation. */ op_node = add_operation_node(id, NodeType::PARAMETERS, OperationCode::PARAMETERS_EXIT); op_node->set_as_exit(); @@ -1352,7 +1380,7 @@ void DepsgraphNodeBuilder::build_particle_systems(Object *object, bool is_object ParticleSettings *part = psys->part; /* Build particle settings operations. * - * NOTE: The call itself ensures settings are only build once. */ + * NOTE: The call itself ensures settings are only build once. */ build_particle_settings(part); /* Particle system evaluation. */ add_operation_node(psys_comp, OperationCode::PARTICLE_SYSTEM_EVAL, nullptr, psys->name); diff --git a/source/blender/depsgraph/intern/builder/deg_builder_nodes_scene.cc b/source/blender/depsgraph/intern/builder/deg_builder_nodes_scene.cc index 21a32b0d005..090b7f9dcb3 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_nodes_scene.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_nodes_scene.cc @@ -68,7 +68,7 @@ void DepsgraphNodeBuilder::build_scene_parameters(Scene *scene) * * Would be nice to find some reliable way of ignoring compositor here, but it's already pulled * in when building scene from view layer, so this particular case does not make things - * marginally worse. */ + * marginally worse. */ build_scene_compositor(scene); LISTBASE_FOREACH (TimeMarker *, marker, &scene->markers) { diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc index 8a02228146a..c269ad16824 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc @@ -220,7 +220,7 @@ OperationCode bone_target_opcode(ID *target, const char *component_subdata, RootPChanMap *root_map) { - /* Same armature. */ + /* Same armature. */ if (target == id) { /* Using "done" here breaks in-chain deps, while using * "ready" here breaks most production rigs instead. @@ -240,7 +240,7 @@ bool object_have_geometry_component(const Object *object) } // namespace -/* **** General purpose functions **** */ +/* **** General purpose functions **** */ DepsgraphRelationBuilder::DepsgraphRelationBuilder(Main *bmain, Depsgraph *graph, @@ -1148,7 +1148,7 @@ void DepsgraphRelationBuilder::build_constraints(ID *id, /* Special case for camera tracking -- it doesn't use targets to * define relations. */ /* TODO: we can now represent dependencies in a much richer manner, - * so review how this is done. */ + * so review how this is done. */ if (ELEM(cti->type, CONSTRAINT_TYPE_FOLLOWTRACK, CONSTRAINT_TYPE_CAMERASOLVER, @@ -1911,7 +1911,7 @@ void DepsgraphRelationBuilder::build_particle_systems(Object *object) /* Effectors. */ add_particle_forcefield_relations( psys_key, object, psys, part->effector_weights, part->type == PART_HAIR, "Particle Field"); - /* Boids .*/ + /* Boids. */ if (part->boids != nullptr) { LISTBASE_FOREACH (BoidState *, state, &part->boids->states) { LISTBASE_FOREACH (BoidRule *, rule, &state->rules) { @@ -1947,7 +1947,7 @@ void DepsgraphRelationBuilder::build_particle_systems(Object *object) switch (part->ren_as) { case PART_DRAW_OB: if (part->instance_object != nullptr) { - /* Make sure object's relations are all built. */ + /* Make sure object's relations are all built. */ build_object(part->instance_object); /* Build relation for the particle visualization. */ build_particle_system_visualization_object(object, psys, part->instance_object); diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations_impl.h b/source/blender/depsgraph/intern/builder/deg_builder_relations_impl.h index cab20dadc50..035d636b977 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_relations_impl.h +++ b/source/blender/depsgraph/intern/builder/deg_builder_relations_impl.h @@ -192,7 +192,7 @@ bool DepsgraphRelationBuilder::is_same_bone_dependency(const KeyFrom &key_from, op_to->opcode == OperationCode::BONE_LOCAL)) { return false; } - /* ... BUT, we also need to check if it's same bone. */ + /* ... BUT, we also need to check if it's same bone. */ if (op_from->owner->name != op_to->owner->name) { return false; } diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations_rig.cc b/source/blender/depsgraph/intern/builder/deg_builder_relations_rig.cc index e4591e2e994..4754749e2e5 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_relations_rig.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_relations_rig.cc @@ -397,7 +397,7 @@ void DepsgraphRelationBuilder::build_rig(Object *object) add_relation(bone_local_key, constraints_key, "Local -> Constraints Stack"); /* Constraints -> ready/ */ /* TODO(sergey): When constraint stack is exploded, this step should - * occur before the first IK solver. */ + * occur before the first IK solver. */ add_relation(constraints_key, bone_ready_key, "Constraints -> Ready"); } else { diff --git a/source/blender/depsgraph/intern/builder/pipeline.cc b/source/blender/depsgraph/intern/builder/pipeline.cc index 10bc7213061..28e4c973c1e 100644 --- a/source/blender/depsgraph/intern/builder/pipeline.cc +++ b/source/blender/depsgraph/intern/builder/pipeline.cc @@ -98,7 +98,7 @@ void AbstractBuilderPipeline::build_step_finalize() deg_graph_->scene_cow = (Scene *)deg_graph_->get_cow_id(°_graph_->scene->id); /* Flush visibility layer and re-schedule nodes for update. */ deg_graph_build_finalize(bmain_, deg_graph_); - DEG_graph_on_visible_update(bmain_, reinterpret_cast<::Depsgraph *>(deg_graph_), false); + DEG_graph_tag_on_visible_update(reinterpret_cast<::Depsgraph *>(deg_graph_), false); #if 0 if (!DEG_debug_consistency_check(deg_graph_)) { printf("Consistency validation failed, ABORTING!\n"); diff --git a/source/blender/depsgraph/intern/depsgraph.cc b/source/blender/depsgraph/intern/depsgraph.cc index 8e1ab23fae0..6fe7d5f5d8b 100644 --- a/source/blender/depsgraph/intern/depsgraph.cc +++ b/source/blender/depsgraph/intern/depsgraph.cc @@ -62,6 +62,8 @@ namespace blender::deg { Depsgraph::Depsgraph(Main *bmain, Scene *scene, ViewLayer *view_layer, eEvaluationMode mode) : time_source(nullptr), need_update(true), + need_visibility_update(true), + need_visibility_time_update(false), bmain(bmain), scene(scene), view_layer(view_layer), diff --git a/source/blender/depsgraph/intern/depsgraph.h b/source/blender/depsgraph/intern/depsgraph.h index b87ce94709a..ff536c19c05 100644 --- a/source/blender/depsgraph/intern/depsgraph.h +++ b/source/blender/depsgraph/intern/depsgraph.h @@ -108,6 +108,11 @@ struct Depsgraph { /* Indicates whether relations needs to be updated. */ bool need_update; + /* Indicated whether IDs in this graph are to be tagged as if they first appear visible, with + * an optional tag for their animation (time) update. */ + bool need_visibility_update; + bool need_visibility_time_update; + /* Indicates which ID types were updated. */ char id_type_updated[INDEX_ID_MAX]; diff --git a/source/blender/depsgraph/intern/depsgraph_tag.cc b/source/blender/depsgraph/intern/depsgraph_tag.cc index 204143d7cbd..b00cae87311 100644 --- a/source/blender/depsgraph/intern/depsgraph_tag.cc +++ b/source/blender/depsgraph/intern/depsgraph_tag.cc @@ -230,6 +230,7 @@ void depsgraph_tag_to_component_opcode(const ID *id, case ID_RECALC_SOURCE: *component_type = NodeType::PARAMETERS; break; + case ID_RECALC_GEOMETRY_ALL_MODES: case ID_RECALC_ALL: case ID_RECALC_PSYS_ALL: BLI_assert(!"Should not happen"); @@ -500,8 +501,23 @@ void deg_graph_node_tag_zero(Main *bmain, deg_graph_id_tag_legacy_compat(bmain, graph, id, (IDRecalcFlag)0, update_source); } -void deg_graph_on_visible_update(Main *bmain, Depsgraph *graph, const bool do_time) +void graph_tag_on_visible_update(Depsgraph *graph, const bool do_time) { + graph->need_visibility_update = true; + graph->need_visibility_time_update |= do_time; +} + +} /* namespace */ + +void graph_tag_ids_for_visible_update(Depsgraph *graph) +{ + if (!graph->need_visibility_update) { + return; + } + + const bool do_time = graph->need_visibility_time_update; + Main *bmain = graph->bmain; + /* NOTE: It is possible to have this function called with `do_time=false` first and later (prior * to evaluation though) with `do_time=true`. This means early output checks should be aware of * this. */ @@ -559,9 +575,10 @@ void deg_graph_on_visible_update(Main *bmain, Depsgraph *graph, const bool do_ti * dependency graph. */ id_node->previously_visible_components_mask = id_node->visible_components_mask; } -} -} /* namespace */ + graph->need_visibility_update = false; + graph->need_visibility_time_update = false; +} NodeType geometry_tag_to_component(const ID *id) { @@ -689,6 +706,8 @@ const char *DEG_update_tag_as_string(IDRecalcFlag flag) return "TRANSFORM"; case ID_RECALC_GEOMETRY: return "GEOMETRY"; + case ID_RECALC_GEOMETRY_ALL_MODES: + return "GEOMETRY_ALL_MODES"; case ID_RECALC_ANIMATION: return "ANIMATION"; case ID_RECALC_PSYS_REDO: @@ -739,7 +758,7 @@ const char *DEG_update_tag_as_string(IDRecalcFlag flag) return nullptr; } -/* Data-Based Tagging */ +/* Data-Based Tagging. */ /* Tag given ID for an update in all the dependency graphs. */ void DEG_id_tag_update(ID *id, int flag) @@ -804,16 +823,16 @@ void DEG_id_type_tag(Main *bmain, short id_type) } /* Update dependency graph when visible scenes/layers changes. */ -void DEG_graph_on_visible_update(Main *bmain, Depsgraph *depsgraph, const bool do_time) +void DEG_graph_tag_on_visible_update(Depsgraph *depsgraph, const bool do_time) { deg::Depsgraph *graph = (deg::Depsgraph *)depsgraph; - deg::deg_graph_on_visible_update(bmain, graph, do_time); + deg::graph_tag_on_visible_update(graph, do_time); } -void DEG_on_visible_update(Main *bmain, const bool do_time) +void DEG_tag_on_visible_update(Main *bmain, const bool do_time) { for (deg::Depsgraph *depsgraph : deg::get_all_registered_graphs(bmain)) { - DEG_graph_on_visible_update(bmain, reinterpret_cast<::Depsgraph *>(depsgraph), do_time); + deg::graph_tag_on_visible_update(depsgraph, do_time); } } diff --git a/source/blender/depsgraph/intern/depsgraph_tag.h b/source/blender/depsgraph/intern/depsgraph_tag.h index 68b6a164be4..6a0b1826cd9 100644 --- a/source/blender/depsgraph/intern/depsgraph_tag.h +++ b/source/blender/depsgraph/intern/depsgraph_tag.h @@ -31,7 +31,7 @@ namespace deg { struct Depsgraph; -/* Get type of a node which corresponds to a ID_RECALC_GEOMETRY tag. */ +/* Get type of a node which corresponds to a ID_RECALC_GEOMETRY tag. */ NodeType geometry_tag_to_component(const ID *id); /* Tag given ID for an update in all registered dependency graphs. */ @@ -41,5 +41,9 @@ void id_tag_update(Main *bmain, ID *id, int flag, eUpdateSource update_source); void graph_id_tag_update( Main *bmain, Depsgraph *graph, ID *id, int flag, eUpdateSource update_source); +/* Tag IDs of the graph for the visibility update tags. + * Will do nothing if the graph is not tagged for visibility update. */ +void graph_tag_ids_for_visible_update(Depsgraph *graph); + } // namespace deg } // namespace blender diff --git a/source/blender/depsgraph/intern/eval/deg_eval.cc b/source/blender/depsgraph/intern/eval/deg_eval.cc index 620e86550cc..6f35143e28f 100644 --- a/source/blender/depsgraph/intern/eval/deg_eval.cc +++ b/source/blender/depsgraph/intern/eval/deg_eval.cc @@ -45,6 +45,7 @@ #include "intern/depsgraph.h" #include "intern/depsgraph_relation.h" +#include "intern/depsgraph_tag.h" #include "intern/eval/deg_eval_copy_on_write.h" #include "intern/eval/deg_eval_flush.h" #include "intern/eval/deg_eval_stats.h" @@ -365,6 +366,8 @@ static TaskPool *deg_evaluate_task_pool_create(DepsgraphEvalState *state) */ void deg_evaluate_on_refresh(Depsgraph *graph) { + graph_tag_ids_for_visible_update(graph); + /* Nothing to update, early out. */ if (graph->entry_tags.is_empty()) { return; diff --git a/source/blender/depsgraph/intern/node/deg_node.h b/source/blender/depsgraph/intern/node/deg_node.h index 56bc0b41823..e1469b68b0e 100644 --- a/source/blender/depsgraph/intern/node/deg_node.h +++ b/source/blender/depsgraph/intern/node/deg_node.h @@ -100,7 +100,7 @@ enum class NodeType { AUDIO, ARMATURE, /* Un-interesting data-block, which is a part of dependency graph, but does - * not have very distinctive update procedure. */ + * not have very distinctive update procedure. */ GENERIC_DATABLOCK, /* **** Evaluation-Related Outer Types (with Subdata) **** */ diff --git a/source/blender/depsgraph/intern/node/deg_node_component.h b/source/blender/depsgraph/intern/node/deg_node_component.h index 06582c88d8b..6e31ef268ed 100644 --- a/source/blender/depsgraph/intern/node/deg_node_component.h +++ b/source/blender/depsgraph/intern/node/deg_node_component.h @@ -23,12 +23,18 @@ #pragma once +#include "intern/eval/deg_eval_copy_on_write.h" #include "intern/node/deg_node.h" +#include "intern/node/deg_node_id.h" #include "intern/node/deg_node_operation.h" #include "BLI_string.h" #include "BLI_utildefines.h" +#include "BKE_object.h" + +#include "DNA_object_types.h" + struct ID; struct bPoseChannel; @@ -156,6 +162,23 @@ struct ComponentNode : public Node { DEG_COMPONENT_NODE_DECLARE; \ } +/* When updating object data in edit-mode, don't request COW update since this will duplicate + * all object data which is unnecessary when the edit-mode data is used for calculating modifiers. + * + * TODO: Investigate modes besides edit-mode. */ +#define DEG_COMPONENT_NODE_DECLARE_NO_COW_TAG_ON_OBDATA_IN_EDIT_MODE(name) \ + struct name##ComponentNode : public ComponentNode { \ + DEG_COMPONENT_NODE_DECLARE; \ + virtual bool need_tag_cow_before_update() override \ + { \ + if (OB_DATA_SUPPORT_EDITMODE(owner->id_type) && \ + BKE_object_data_is_in_editmode(owner->id_orig)) { \ + return false; \ + } \ + return true; \ + } \ + } + #define DEG_COMPONENT_NODE_DECLARE_NO_COW_TAG_ON_UPDATE(name) \ struct name##ComponentNode : public ComponentNode { \ DEG_COMPONENT_NODE_DECLARE; \ @@ -169,10 +192,9 @@ DEG_COMPONENT_NODE_DECLARE_GENERIC(Animation); DEG_COMPONENT_NODE_DECLARE_NO_COW_TAG_ON_UPDATE(BatchCache); DEG_COMPONENT_NODE_DECLARE_GENERIC(Cache); DEG_COMPONENT_NODE_DECLARE_GENERIC(CopyOnWrite); -DEG_COMPONENT_NODE_DECLARE_GENERIC(Geometry); +DEG_COMPONENT_NODE_DECLARE_NO_COW_TAG_ON_OBDATA_IN_EDIT_MODE(Geometry); DEG_COMPONENT_NODE_DECLARE_GENERIC(ImageAnimation); DEG_COMPONENT_NODE_DECLARE_GENERIC(LayerCollections); -DEG_COMPONENT_NODE_DECLARE_GENERIC(Parameters); DEG_COMPONENT_NODE_DECLARE_GENERIC(Particles); DEG_COMPONENT_NODE_DECLARE_GENERIC(ParticleSettings); DEG_COMPONENT_NODE_DECLARE_GENERIC(Pose); @@ -199,6 +221,22 @@ struct BoneComponentNode : public ComponentNode { DEG_COMPONENT_NODE_DECLARE; }; +/* Eventually we would not tag parameters in all cases. + * Support for this each ID needs to be added on an individual basis. */ +struct ParametersComponentNode : public ComponentNode { + virtual bool need_tag_cow_before_update() override + { + if (ID_TYPE_SUPPORTS_PARAMS_WITHOUT_COW(owner->id_type)) { + /* Disabled as this is not true for newly added objects, needs investigation. */ + // BLI_assert(deg_copy_on_write_is_expanded(owner->id_cow)); + return false; + } + return true; + } + + DEG_COMPONENT_NODE_DECLARE; +}; + void deg_register_component_depsnodes(); } // namespace deg diff --git a/source/blender/depsgraph/intern/node/deg_node_operation.h b/source/blender/depsgraph/intern/node/deg_node_operation.h index 1d966cffd5d..a17186da941 100644 --- a/source/blender/depsgraph/intern/node/deg_node_operation.h +++ b/source/blender/depsgraph/intern/node/deg_node_operation.h @@ -79,7 +79,7 @@ enum class OperationCode { TRANSFORM_PARENT, /* Constraints */ TRANSFORM_CONSTRAINTS, - /* Handle object-level updates, mainly proxies hacks and recalc flags. */ + /* Handle object-level updates, mainly proxies hacks and recalc flags. */ TRANSFORM_EVAL, /* Initializes transformation for simulation. * For example, ensures point cache is properly reset before doing rigid @@ -102,7 +102,7 @@ enum class OperationCode { GEOMETRY_EVAL_INIT, /* Evaluate the whole geometry, including modifiers. */ GEOMETRY_EVAL, - /* Evaluation of geometry is completely done.. */ + /* Evaluation of geometry is completely done. */ GEOMETRY_EVAL_DONE, /* Evaluation of a shape key. * NOTE: Currently only for object data data-blocks. */ diff --git a/source/blender/draw/CMakeLists.txt b/source/blender/draw/CMakeLists.txt index e99bf1f5b0c..4f68c3fdc7e 100644 --- a/source/blender/draw/CMakeLists.txt +++ b/source/blender/draw/CMakeLists.txt @@ -85,6 +85,7 @@ set(SRC intern/draw_manager_text.c intern/draw_manager_texture.c intern/draw_select_buffer.c + intern/draw_shader.c intern/draw_view.c engines/basic/basic_engine.c engines/image/image_engine.c @@ -185,6 +186,7 @@ set(SRC intern/draw_manager_testing.h intern/draw_manager_text.h intern/draw_view.h + intern/draw_shader.h intern/smaa_textures.h engines/basic/basic_engine.h engines/eevee/eevee_engine.h diff --git a/source/blender/draw/engines/eevee/eevee_depth_of_field.c b/source/blender/draw/engines/eevee/eevee_depth_of_field.c index 7986d7a2810..4748323d6a7 100644 --- a/source/blender/draw/engines/eevee/eevee_depth_of_field.c +++ b/source/blender/draw/engines/eevee/eevee_depth_of_field.c @@ -234,7 +234,7 @@ int EEVEE_depth_of_field_init(EEVEE_ViewLayerData *UNUSED(sldata), } const float scale_camera = (is_ortho) ? 1.0 : 0.001f; - /* we want radius here for the aperture number */ + /* We want radius here for the aperture number. */ float aperture = 0.5f * scale_camera * focal_len / fstop; float focal_len_scaled = scale_camera * focal_len; float sensor_scaled = scale_camera * sensor; @@ -352,7 +352,7 @@ int EEVEE_depth_of_field_init(EEVEE_ViewLayerData *UNUSED(sldata), /** * Create bokeh texture. - **/ + */ static void dof_bokeh_pass_init(EEVEE_FramebufferList *fbl, EEVEE_PassList *psl, EEVEE_EffectsInfo *fx) @@ -392,7 +392,7 @@ static void dof_bokeh_pass_init(EEVEE_FramebufferList *fbl, /** * Outputs halfResColorBuffer and halfResCocBuffer. - **/ + */ static void dof_setup_pass_init(EEVEE_FramebufferList *fbl, EEVEE_PassList *psl, EEVEE_EffectsInfo *fx) @@ -426,7 +426,7 @@ static void dof_setup_pass_init(EEVEE_FramebufferList *fbl, /** * Outputs min & max COC in each 8x8 half res pixel tiles (so 1/16th of full resolution). - **/ + */ static void dof_flatten_tiles_pass_init(EEVEE_FramebufferList *fbl, EEVEE_PassList *psl, EEVEE_EffectsInfo *fx) @@ -459,7 +459,7 @@ static void dof_flatten_tiles_pass_init(EEVEE_FramebufferList *fbl, * Dilates the min & max COCS to cover maximum COC values. * Output format/dimensions should be the same as coc_flatten_pass as they are swapped for * doing multiple dilation passes. - **/ + */ static void dof_dilate_tiles_pass_init(EEVEE_FramebufferList *fbl, EEVEE_PassList *psl, EEVEE_EffectsInfo *fx) @@ -540,7 +540,7 @@ static void dof_dilate_tiles_pass_draw(EEVEE_FramebufferList *fbl, /** * Create mipmapped color & COC textures for gather passes. - **/ + */ static void dof_reduce_pass_init(EEVEE_FramebufferList *fbl, EEVEE_PassList *psl, EEVEE_TextureList *txl, @@ -626,7 +626,7 @@ static void dof_reduce_pass_init(EEVEE_FramebufferList *fbl, if (txl->dof_reduced_color) { /* TODO(fclem) In the future, we need to check if mip_count did not change. - * For now it's ok as we always define all mip level.*/ + * For now it's ok as we always define all mip level. */ if (res[0] != GPU_texture_width(txl->dof_reduced_color) || res[1] != GPU_texture_width(txl->dof_reduced_color)) { DRW_TEXTURE_FREE_SAFE(txl->dof_reduced_color); @@ -666,7 +666,7 @@ static void dof_reduce_pass_init(EEVEE_FramebufferList *fbl, /** * Do the gather convolution. For each pixels we gather multiple pixels in its neighborhood * depending on the min & max CoC tiles. - **/ + */ static void dof_gather_pass_init(EEVEE_FramebufferList *fbl, EEVEE_PassList *psl, EEVEE_TextureList *txl, @@ -792,7 +792,7 @@ static void dof_gather_pass_init(EEVEE_FramebufferList *fbl, * Filter an input buffer using a median filter to reduce noise. * NOTE: We use the holefill texture as our input to reduce memory usage. * Thus, the holefill pass cannot be filtered. - **/ + */ static void dof_filter_pass_init(EEVEE_FramebufferList *fbl, EEVEE_PassList *psl, EEVEE_EffectsInfo *fx) @@ -825,7 +825,7 @@ static void dof_filter_pass_init(EEVEE_FramebufferList *fbl, /** * Do the Scatter convolution. A sprite is emitted for every 4 pixels but is only expanded if the * pixels are bright enough to be scattered. - **/ + */ static void dof_scatter_pass_init(EEVEE_FramebufferList *fbl, EEVEE_PassList *psl, EEVEE_TextureList *txl, @@ -896,7 +896,7 @@ static void dof_scatter_pass_init(EEVEE_FramebufferList *fbl, /** * Recombine the result of the foreground and background processing. Also perform a slight out of * focus blur to improve geometric continuity. - **/ + */ static void dof_recombine_pass_init(EEVEE_FramebufferList *UNUSED(fbl), EEVEE_PassList *psl, EEVEE_EffectsInfo *fx) diff --git a/source/blender/draw/engines/eevee/eevee_lightcache.c b/source/blender/draw/engines/eevee/eevee_lightcache.c index 37ecdb20651..cdd66759308 100644 --- a/source/blender/draw/engines/eevee/eevee_lightcache.c +++ b/source/blender/draw/engines/eevee/eevee_lightcache.c @@ -866,7 +866,7 @@ static void eevee_lightbake_delete_resources(EEVEE_LightBake *lbake) } /* XXX Free the resources contained in the viewlayer data - * to be able to free the context before deleting the depsgraph. */ + * to be able to free the context before deleting the depsgraph. */ if (lbake->sldata) { EEVEE_view_layer_data_free(lbake->sldata); } @@ -1480,7 +1480,7 @@ void EEVEE_lightbake_job(void *custom_data, short *stop, short *do_update, float eevee_lightbake_delete_resources(lbake); - /* Free GPU smoke textures and the smoke domain list correctly: See also T73921.*/ + /* Free GPU smoke textures and the smoke domain list correctly: See also T73921. */ EEVEE_volumes_free_smoke_textures(); } diff --git a/source/blender/draw/engines/eevee/eevee_materials.c b/source/blender/draw/engines/eevee/eevee_materials.c index d2e0c8308c5..7dd3449ad6e 100644 --- a/source/blender/draw/engines/eevee/eevee_materials.c +++ b/source/blender/draw/engines/eevee/eevee_materials.c @@ -172,7 +172,7 @@ static void eevee_init_util_texture(void) } texels_layer += 64 * 64; - /* Copy blue noise in 3rd layer */ + /* Copy blue noise in 3rd layer. */ for (int i = 0; i < 64 * 64; i++) { texels_layer[i][0] = blue_noise[i][0]; texels_layer[i][1] = blue_noise[i][2]; @@ -181,7 +181,7 @@ static void eevee_init_util_texture(void) } texels_layer += 64 * 64; - /* Copy ltc_disk_integral in 4th layer */ + /* Copy ltc_disk_integral in 4th layer. */ for (int i = 0; i < 64 * 64; i++) { texels_layer[i][0] = ltc_disk_integral[i]; texels_layer[i][1] = 0.0; /* UNUSED */ diff --git a/source/blender/draw/engines/eevee/eevee_motion_blur.c b/source/blender/draw/engines/eevee/eevee_motion_blur.c index 0a79d9466e9..2e200c8e053 100644 --- a/source/blender/draw/engines/eevee/eevee_motion_blur.c +++ b/source/blender/draw/engines/eevee/eevee_motion_blur.c @@ -245,7 +245,7 @@ void EEVEE_motion_blur_hair_cache_populate(EEVEE_ViewLayerData *UNUSED(sldata), if (mb_data) { int mb_step = effects->motion_blur_step; - /* Store transform */ + /* Store transform. */ DRW_hair_duplimat_get(ob, psys, md, mb_data->obmat[mb_step]); EEVEE_HairMotionData *mb_hair = EEVEE_motion_blur_hair_data_get(&effects->motion_blur, ob); @@ -323,7 +323,7 @@ void EEVEE_motion_blur_cache_populate(EEVEE_ViewLayerData *UNUSED(sldata), if (mb_data) { int mb_step = effects->motion_blur_step; - /* Store transform */ + /* Store transform. */ copy_m4_m4(mb_data->obmat[mb_step], ob->obmat); EEVEE_GeometryMotionData *mb_geom = EEVEE_motion_blur_geometry_data_get(&effects->motion_blur, @@ -349,7 +349,7 @@ void EEVEE_motion_blur_cache_populate(EEVEE_ViewLayerData *UNUSED(sldata), } /* Avoid drawing object that has no motions since object_moves is always true. */ - if (!mb_geom->use_deform && /* Object deformation can happen without transform. */ + if (!mb_geom->use_deform && /* Object deformation can happen without transform. */ equals_m4m4(mb_data->obmat[MB_PREV], mb_data->obmat[MB_CURR]) && equals_m4m4(mb_data->obmat[MB_NEXT], mb_data->obmat[MB_CURR])) { return; diff --git a/source/blender/draw/engines/eevee/eevee_private.h b/source/blender/draw/engines/eevee/eevee_private.h index bc04fe024fc..ab297620afe 100644 --- a/source/blender/draw/engines/eevee/eevee_private.h +++ b/source/blender/draw/engines/eevee/eevee_private.h @@ -565,7 +565,7 @@ typedef struct EEVEE_LightsInfo { /* Update bitmap. */ BLI_bitmap sh_cube_update[BLI_BITMAP_SIZE(MAX_SHADOW_CUBE)]; /* Lights tracking */ - struct BoundSphere shadow_bounds[MAX_LIGHT]; /* Tightly packed light bounds */ + struct BoundSphere shadow_bounds[MAX_LIGHT]; /* Tightly packed light bounds. */ /* List of bbox and update bitmap. Double buffered. */ struct EEVEE_ShadowCasterBuffer *shcaster_frontbuffer, *shcaster_backbuffer; /* AABB of all shadow casters combined. */ diff --git a/source/blender/draw/engines/eevee/eevee_shaders.c b/source/blender/draw/engines/eevee/eevee_shaders.c index 90b7eeb9293..a4e4352ac16 100644 --- a/source/blender/draw/engines/eevee/eevee_shaders.c +++ b/source/blender/draw/engines/eevee/eevee_shaders.c @@ -1274,7 +1274,7 @@ Material *EEVEE_material_default_error_get(void) return e_data.error_mat; } -/* Configure a default nodetree with the given material. */ +/* Configure a default nodetree with the given material. */ struct bNodeTree *EEVEE_shader_default_surface_nodetree(Material *ma) { /* WARNING: This function is not threadsafe. Which is not a problem for the moment. */ @@ -1302,7 +1302,7 @@ struct bNodeTree *EEVEE_shader_default_surface_nodetree(Material *ma) return e_data.surface.ntree; } -/* Configure a default nodetree with the given world. */ +/* Configure a default nodetree with the given world. */ struct bNodeTree *EEVEE_shader_default_world_nodetree(World *wo) { /* WARNING: This function is not threadsafe. Which is not a problem for the moment. */ diff --git a/source/blender/draw/engines/eevee/eevee_shadows.c b/source/blender/draw/engines/eevee/eevee_shadows.c index 6a98c3316f3..5060c209b8b 100644 --- a/source/blender/draw/engines/eevee/eevee_shadows.c +++ b/source/blender/draw/engines/eevee/eevee_shadows.c @@ -247,7 +247,7 @@ void EEVEE_shadows_update(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata) sldata->shadow_fb = GPU_framebuffer_create("shadow_fb"); } - /* Gather all light own update bits. to avoid costly intersection check. */ + /* Gather all light own update bits. to avoid costly intersection check. */ for (int j = 0; j < linfo->cube_len; j++) { const EEVEE_Light *evli = linfo->light_data + linfo->shadow_cube_light_indices[j]; /* Setup shadow cube in UBO and tag for update if necessary. */ diff --git a/source/blender/draw/engines/eevee/eevee_subsurface.c b/source/blender/draw/engines/eevee/eevee_subsurface.c index 7fd39007263..129822ed8a9 100644 --- a/source/blender/draw/engines/eevee/eevee_subsurface.c +++ b/source/blender/draw/engines/eevee/eevee_subsurface.c @@ -315,7 +315,7 @@ void EEVEE_subsurface_compute(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata) if (!DRW_pass_is_empty(psl->sss_translucency_ps)) { /* We sample the shadow-maps using normal sampler. We need to disable Comparison mode. - * TODO(fclem): avoid this by using sampler objects.*/ + * TODO(fclem): avoid this by using sampler objects. */ GPU_texture_compare_mode(sldata->shadow_cube_pool, false); GPU_texture_compare_mode(sldata->shadow_cascade_pool, false); diff --git a/source/blender/draw/engines/eevee/eevee_volumes.c b/source/blender/draw/engines/eevee/eevee_volumes.c index eed36221fcb..56c5b367f7e 100644 --- a/source/blender/draw/engines/eevee/eevee_volumes.c +++ b/source/blender/draw/engines/eevee/eevee_volumes.c @@ -709,7 +709,7 @@ void EEVEE_volumes_compute(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata) DRW_stats_group_start("Volumetrics"); /* We sample the shadow-maps using shadow sampler. We need to enable Comparison mode. - * TODO(fclem): avoid this by using sampler objects.*/ + * TODO(fclem): avoid this by using sampler objects. */ GPU_texture_compare_mode(sldata->shadow_cube_pool, true); GPU_texture_compare_mode(sldata->shadow_cascade_pool, true); diff --git a/source/blender/draw/engines/eevee/shaders/ambient_occlusion_lib.glsl b/source/blender/draw/engines/eevee/shaders/ambient_occlusion_lib.glsl index cdc453eed40..d4e3b879426 100644 --- a/source/blender/draw/engines/eevee/shaders/ambient_occlusion_lib.glsl +++ b/source/blender/draw/engines/eevee/shaders/ambient_occlusion_lib.glsl @@ -338,7 +338,7 @@ float diffuse_occlusion( * radius2 : Second caps’ radius (in radians) * dist : Distance between caps (radians between centers of caps) * Note: Result is divided by pi to save one multiply. - **/ + */ float spherical_cap_intersection(float radius1, float radius2, float dist) { /* From "Ambient Aperture Lighting" by Chris Oat @@ -407,7 +407,7 @@ OcclusionData occlusion_load(vec3 vP, float custom_occlusion) data = unpack_occlusion_data(texelFetch(horizonBuffer, ivec2(gl_FragCoord.xy), 0)); } #else - /* For blended surfaces. */ + /* For blended surfaces. */ data = occlusion_search(vP, maxzBuffer, aoDistance, 0.0, 8.0); #endif diff --git a/source/blender/draw/engines/eevee/shaders/bsdf_common_lib.glsl b/source/blender/draw/engines/eevee/shaders/bsdf_common_lib.glsl index 05496ad4ab0..4ee21cf8c2e 100644 --- a/source/blender/draw/engines/eevee/shaders/bsdf_common_lib.glsl +++ b/source/blender/draw/engines/eevee/shaders/bsdf_common_lib.glsl @@ -201,6 +201,6 @@ float cone_cosine(float r) // return cos(2.0 * sqrt(2.0 / (gloss + 2))); /* Uludag 2014 in GPUPro5 */ // return pow(0.244, 1 / (gloss + 1)); - /* Jimenez 2016 in Practical Realtime Strategies for Accurate Indirect Occlusion*/ + /* Jimenez 2016 in Practical Realtime Strategies for Accurate Indirect Occlusion. */ return exp2(-3.32193 * r * r); } diff --git a/source/blender/draw/engines/eevee/shaders/bsdf_sampling_lib.glsl b/source/blender/draw/engines/eevee/shaders/bsdf_sampling_lib.glsl index 7ce95a4aff2..4fcfac36376 100644 --- a/source/blender/draw/engines/eevee/shaders/bsdf_sampling_lib.glsl +++ b/source/blender/draw/engines/eevee/shaders/bsdf_sampling_lib.glsl @@ -1,7 +1,7 @@ /** * Sampling distribution routines for Monte-carlo integration. - **/ + */ #pragma BLENDER_REQUIRE(common_math_geom_lib.glsl) #pragma BLENDER_REQUIRE(bsdf_common_lib.glsl) diff --git a/source/blender/draw/engines/eevee/shaders/btdf_lut_frag.glsl b/source/blender/draw/engines/eevee/shaders/btdf_lut_frag.glsl index 2f1298e2707..c8c3fa548fc 100644 --- a/source/blender/draw/engines/eevee/shaders/btdf_lut_frag.glsl +++ b/source/blender/draw/engines/eevee/shaders/btdf_lut_frag.glsl @@ -83,7 +83,7 @@ void main() btdf_accum = 0.0; } - /* There is place to put multiscater result (which is a little bit different still) - * and / or lobe fitting for better sampling of */ + /* There is place to put multi-scatter result (which is a little bit different still) + * and / or lobe fitting for better sampling of. */ FragColor = vec4(btdf_accum, fresnel_accum, 0.0, 1.0); } diff --git a/source/blender/draw/engines/eevee/shaders/closure_eval_lib.glsl b/source/blender/draw/engines/eevee/shaders/closure_eval_lib.glsl index 94dd1a439db..e5cbc487e93 100644 --- a/source/blender/draw/engines/eevee/shaders/closure_eval_lib.glsl +++ b/source/blender/draw/engines/eevee/shaders/closure_eval_lib.glsl @@ -19,7 +19,7 @@ * CLOSURE_EVAL_FUNCTION_3(name, Diffuse, Glossy, Refraction); * // Get the cl_out * closure.radiance = out_Diffuse_0.radiance + out_Glossy_1.radiance + out_Refraction_2.radiance; - **/ + */ #define CLOSURE_VARS_DECLARE(t0, t1, t2, t3) \ ClosureInputCommon in_common = CLOSURE_INPUT_COMMON_DEFAULT; \ @@ -291,7 +291,7 @@ ClosurePlanarData closure_planar_eval_init(inout ClosureEvalCommon cl_common) ClosurePlanarData planar; planar.attenuation = 0.0; - /* Find planar with the maximum weight. TODO(fclem) */ + /* TODO(fclem): Find planar with the maximum weight. */ for (int i = 0; i < prbNumPlanar && i < MAX_PLANAR; i++) { float attenuation = probe_attenuation_planar(planars_data[i], cl_common.P); if (attenuation > planar.attenuation) { diff --git a/source/blender/draw/engines/eevee/shaders/closure_type_lib.glsl b/source/blender/draw/engines/eevee/shaders/closure_type_lib.glsl index 38ae3972aa7..f66f45635f4 100644 --- a/source/blender/draw/engines/eevee/shaders/closure_type_lib.glsl +++ b/source/blender/draw/engines/eevee/shaders/closure_type_lib.glsl @@ -99,7 +99,7 @@ Closure closure_mix(Closure cl1, Closure cl2, float fac) cl.flag = cl1.flag | cl2.flag; cl.ssr_data = mix(cl1.ssr_data, cl2.ssr_data, fac); bool use_cl1_ssr = FLAG_TEST(cl1.flag, CLOSURE_SSR_FLAG); - /* When mixing SSR don't blend roughness and normals but only specular (ssr_data.xyz).*/ + /* When mixing SSR don't blend roughness and normals but only specular (ssr_data.xyz). */ cl.ssr_data.w = (use_cl1_ssr) ? cl1.ssr_data.w : cl2.ssr_data.w; cl.ssr_normal = (use_cl1_ssr) ? cl1.ssr_normal : cl2.ssr_normal; @@ -122,7 +122,7 @@ Closure closure_add(Closure cl1, Closure cl2) cl.flag = cl1.flag | cl2.flag; cl.ssr_data = cl1.ssr_data + cl2.ssr_data; bool use_cl1_ssr = FLAG_TEST(cl1.flag, CLOSURE_SSR_FLAG); - /* When mixing SSR don't blend roughness and normals.*/ + /* When mixing SSR don't blend roughness and normals. */ cl.ssr_data.w = (use_cl1_ssr) ? cl1.ssr_data.w : cl2.ssr_data.w; cl.ssr_normal = (use_cl1_ssr) ? cl1.ssr_normal : cl2.ssr_normal; diff --git a/source/blender/draw/engines/eevee/shaders/common_uniforms_lib.glsl b/source/blender/draw/engines/eevee/shaders/common_uniforms_lib.glsl index d7996ab4bd1..c935eca6a39 100644 --- a/source/blender/draw/engines/eevee/shaders/common_uniforms_lib.glsl +++ b/source/blender/draw/engines/eevee/shaders/common_uniforms_lib.glsl @@ -37,7 +37,7 @@ layout(std140) uniform common_block int prbIrradianceVisSize; float prbIrradianceSmooth; float prbLodCubeMax; - /* Misc*/ + /* Misc */ int rayType; float rayDepth; float alphaHashOffset; diff --git a/source/blender/draw/engines/eevee/shaders/common_utiltex_lib.glsl b/source/blender/draw/engines/eevee/shaders/common_utiltex_lib.glsl index 821859b3228..c3325ec4286 100644 --- a/source/blender/draw/engines/eevee/shaders/common_utiltex_lib.glsl +++ b/source/blender/draw/engines/eevee/shaders/common_utiltex_lib.glsl @@ -27,7 +27,7 @@ const float lut_btdf_layer_count = 16.0; * x : Uniformly distributed value [0..1] (noise 1). * y : Uniformly distributed value [0..1] (noise 2). * z,w : Uniformly distributed point on the unit circle [-1..1] (noise 3). - **/ + */ #define texelfetch_noise_tex(coord) texelFetch(utilTex, ivec3(ivec2(coord) % LUT_SIZE, 2.0), 0) /* Return texture coordinates to sample Surface LUT. */ diff --git a/source/blender/draw/engines/eevee/shaders/effect_dof_bokeh_frag.glsl b/source/blender/draw/engines/eevee/shaders/effect_dof_bokeh_frag.glsl index 40e4c5a313e..5fd00986adc 100644 --- a/source/blender/draw/engines/eevee/shaders/effect_dof_bokeh_frag.glsl +++ b/source/blender/draw/engines/eevee/shaders/effect_dof_bokeh_frag.glsl @@ -5,7 +5,7 @@ * a perfect circle. * We correct samples spacing for polygonal bokeh shapes. However, we do not for anamorphic bokeh * as it is way more complex and expensive to do. - **/ + */ #pragma BLENDER_REQUIRE(effect_dof_lib.glsl) diff --git a/source/blender/draw/engines/eevee/shaders/effect_dof_dilate_tiles_frag.glsl b/source/blender/draw/engines/eevee/shaders/effect_dof_dilate_tiles_frag.glsl index 22e6f929f36..0cbf92466aa 100644 --- a/source/blender/draw/engines/eevee/shaders/effect_dof_dilate_tiles_frag.glsl +++ b/source/blender/draw/engines/eevee/shaders/effect_dof_dilate_tiles_frag.glsl @@ -2,7 +2,7 @@ /** * Tile dilate pass: Takes the 8x8 Tiles buffer and converts dilates the tiles with large CoC to * their neighborhood. This pass is repeated multiple time until the maximum CoC can be covered. - **/ + */ #pragma BLENDER_REQUIRE(effect_dof_lib.glsl) diff --git a/source/blender/draw/engines/eevee/shaders/effect_dof_downsample_frag.glsl b/source/blender/draw/engines/eevee/shaders/effect_dof_downsample_frag.glsl index c477e0f6eb8..c33eda0acd2 100644 --- a/source/blender/draw/engines/eevee/shaders/effect_dof_downsample_frag.glsl +++ b/source/blender/draw/engines/eevee/shaders/effect_dof_downsample_frag.glsl @@ -4,7 +4,7 @@ * * Pretty much identical to the setup pass but get CoC from buffer. Also does not * weight luma for the bilateral weights. - **/ + */ #pragma BLENDER_REQUIRE(effect_dof_lib.glsl) diff --git a/source/blender/draw/engines/eevee/shaders/effect_dof_filter_frag.glsl b/source/blender/draw/engines/eevee/shaders/effect_dof_filter_frag.glsl index 78c80438f60..aa72cda4fb7 100644 --- a/source/blender/draw/engines/eevee/shaders/effect_dof_filter_frag.glsl +++ b/source/blender/draw/engines/eevee/shaders/effect_dof_filter_frag.glsl @@ -4,7 +4,7 @@ * * This is a simple 3x3 median filter to avoid dilating highlights with a 3x3 max filter even if * cheaper. - **/ + */ #pragma BLENDER_REQUIRE(effect_dof_lib.glsl) diff --git a/source/blender/draw/engines/eevee/shaders/effect_dof_flatten_tiles_frag.glsl b/source/blender/draw/engines/eevee/shaders/effect_dof_flatten_tiles_frag.glsl index bd81171c759..48195a1daea 100644 --- a/source/blender/draw/engines/eevee/shaders/effect_dof_flatten_tiles_frag.glsl +++ b/source/blender/draw/engines/eevee/shaders/effect_dof_flatten_tiles_frag.glsl @@ -5,7 +5,7 @@ * Output min and max values for each tile and for both foreground & background. * Also outputs min intersectable CoC for the background, which is the minimum CoC * that comes from the background pixels. - **/ + */ #pragma BLENDER_REQUIRE(effect_dof_lib.glsl) diff --git a/source/blender/draw/engines/eevee/shaders/effect_dof_gather_frag.glsl b/source/blender/draw/engines/eevee/shaders/effect_dof_gather_frag.glsl index 8c2633084db..39a7e8fb931 100644 --- a/source/blender/draw/engines/eevee/shaders/effect_dof_gather_frag.glsl +++ b/source/blender/draw/engines/eevee/shaders/effect_dof_gather_frag.glsl @@ -7,7 +7,7 @@ * * We sample using an octaweb sampling pattern. We randomize the kernel center and each ring * rotation to ensure maximum coverage. - **/ + */ #pragma BLENDER_REQUIRE(common_utiltex_lib.glsl) #pragma BLENDER_REQUIRE(effect_dof_lib.glsl) diff --git a/source/blender/draw/engines/eevee/shaders/effect_dof_lib.glsl b/source/blender/draw/engines/eevee/shaders/effect_dof_lib.glsl index dac53719149..da34b221104 100644 --- a/source/blender/draw/engines/eevee/shaders/effect_dof_lib.glsl +++ b/source/blender/draw/engines/eevee/shaders/effect_dof_lib.glsl @@ -395,7 +395,7 @@ void dof_gather_accumulate_sample_pair(DofGatherData pair_data[2], /** * If a CoC is larger than bordering radius we accumulate it to the general accumulator. * If not, we accumulate to the ring bucket. This is to have more consistent sample occlusion. - **/ + */ float accum_weight = dof_gather_accum_weight(pair_data[i].coc, bordering_radius, first_ring); dof_gather_accumulate_sample(pair_data[i], weight * accum_weight, accum_data); dof_gather_accumulate_sample(pair_data[i], weight * (1.0 - accum_weight), ring_data); @@ -607,7 +607,7 @@ ivec2 dof_square_ring_sample_offset(int ring_distance, int sample_id) * . . . . . * * Samples are expected to be mirrored to complete the pattern. - **/ + */ ivec2 offset; if (sample_id < ring_distance) { offset.x = ring_distance; diff --git a/source/blender/draw/engines/eevee/shaders/effect_dof_reduce_frag.glsl b/source/blender/draw/engines/eevee/shaders/effect_dof_reduce_frag.glsl index 51a139ad343..1b5b305dfc1 100644 --- a/source/blender/draw/engines/eevee/shaders/effect_dof_reduce_frag.glsl +++ b/source/blender/draw/engines/eevee/shaders/effect_dof_reduce_frag.glsl @@ -2,14 +2,14 @@ /** * Reduce pass: Downsample the color buffer to generate mipmaps. * Also decide if a pixel is to be convolved by scattering or gathering during the first pass. - **/ + */ #pragma BLENDER_REQUIRE(effect_dof_lib.glsl) /** Inputs: * COPY_PASS: Is output of setup pass (halfres) and downsample pass (quarter res). * REDUCE_PASS: Is previous Gather input miplvl (halfres >> miplvl). - **/ + */ uniform sampler2D colorBuffer; uniform sampler2D cocBuffer; uniform sampler2D downsampledBuffer; @@ -23,7 +23,7 @@ uniform float colorNeighborClamping; /** Outputs: * COPY_PASS: Gather input mip0. * REDUCE_PASS: Is next Gather input miplvl (halfres >> miplvl). - **/ + */ layout(location = 0) out vec4 outColor; layout(location = 1) out float outCoc; diff --git a/source/blender/draw/engines/eevee/shaders/effect_dof_resolve_frag.glsl b/source/blender/draw/engines/eevee/shaders/effect_dof_resolve_frag.glsl index 32841b7749c..57027c71156 100644 --- a/source/blender/draw/engines/eevee/shaders/effect_dof_resolve_frag.glsl +++ b/source/blender/draw/engines/eevee/shaders/effect_dof_resolve_frag.glsl @@ -34,7 +34,7 @@ out vec4 fragColor; void dof_slight_focus_gather(float radius, out vec4 out_color, out float out_weight) { - /* offset coord to avoid correlation with sampling pattern. */ + /* offset coord to avoid correlation with sampling pattern. */ vec4 noise = texelfetch_noise_tex(gl_FragCoord.xy + 7.0); DofGatherData fg_accum = GATHER_DATA_INIT; @@ -199,7 +199,7 @@ void main(void) fragColor = fragColor * (1.0 - layer_weight) + layer_color; } - /* Fix float precision issue in alpha compositing. */ + /* Fix float precision issue in alpha compositing. */ if (fragColor.a > 0.99) { fragColor.a = 1.0; } diff --git a/source/blender/draw/engines/eevee/shaders/effect_dof_scatter_frag.glsl b/source/blender/draw/engines/eevee/shaders/effect_dof_scatter_frag.glsl index 704bbf6d999..06dcbeaed66 100644 --- a/source/blender/draw/engines/eevee/shaders/effect_dof_scatter_frag.glsl +++ b/source/blender/draw/engines/eevee/shaders/effect_dof_scatter_frag.glsl @@ -4,7 +4,7 @@ * * We only scatter one triangle per sprite and one sprite per 4 pixels to reduce vertex shader * invocations and overdraw. - **/ + */ #pragma BLENDER_REQUIRE(effect_dof_lib.glsl) diff --git a/source/blender/draw/engines/eevee/shaders/effect_dof_scatter_vert.glsl b/source/blender/draw/engines/eevee/shaders/effect_dof_scatter_vert.glsl index 276ab119fab..f349806d37e 100644 --- a/source/blender/draw/engines/eevee/shaders/effect_dof_scatter_vert.glsl +++ b/source/blender/draw/engines/eevee/shaders/effect_dof_scatter_vert.glsl @@ -25,7 +25,8 @@ flat out float spritesize; /* Load 4 Circle of confusion values. texel_co is centered around the 4 taps. */ vec4 fetch_cocs(vec2 texel_co) { - /* TODO(fclem) The textureGather(sampler, co, comp) variant isn't here on some implementations.*/ + /* TODO(fclem) The textureGather(sampler, co, comp) variant isn't here on some implementations. + */ #if 0 // GPU_ARB_texture_gather vec2 uvs = texel_co / vec2(textureSize(cocBuffer, 0)); /* Reminder: Samples order is CW starting from top left. */ diff --git a/source/blender/draw/engines/eevee/shaders/effect_dof_setup_frag.glsl b/source/blender/draw/engines/eevee/shaders/effect_dof_setup_frag.glsl index d1ecc0fc244..235145b221b 100644 --- a/source/blender/draw/engines/eevee/shaders/effect_dof_setup_frag.glsl +++ b/source/blender/draw/engines/eevee/shaders/effect_dof_setup_frag.glsl @@ -4,7 +4,7 @@ * * An addition to the downsample CoC, we output the maximum slight out of focus CoC to be * sure we don't miss a pixel. - **/ + */ #pragma BLENDER_REQUIRE(effect_dof_lib.glsl) diff --git a/source/blender/draw/engines/eevee/shaders/effect_translucency_frag.glsl b/source/blender/draw/engines/eevee/shaders/effect_translucency_frag.glsl index 356ed102928..97b31a972e3 100644 --- a/source/blender/draw/engines/eevee/shaders/effect_translucency_frag.glsl +++ b/source/blender/draw/engines/eevee/shaders/effect_translucency_frag.glsl @@ -49,7 +49,7 @@ float light_translucent_power_with_falloff(LightData ld, vec3 N, vec4 l_vector) } else if (ld.l_type == SUN) { power = 1.0 / (1.0 + (ld.l_radius * ld.l_radius * 0.5)); - power *= ld.l_radius * ld.l_radius * M_PI; /* Removing area light power*/ + power *= ld.l_radius * ld.l_radius * M_PI; /* Removing area light power. */ power *= M_2PI * 0.78; /* Matching cycles with point light. */ power *= 0.082; /* XXX ad hoc, empirical */ falloff = dot(N, -ld.l_forward); diff --git a/source/blender/draw/engines/eevee/shaders/lightprobe_lib.glsl b/source/blender/draw/engines/eevee/shaders/lightprobe_lib.glsl index c9b5d0dea36..a648e7a8b26 100644 --- a/source/blender/draw/engines/eevee/shaders/lightprobe_lib.glsl +++ b/source/blender/draw/engines/eevee/shaders/lightprobe_lib.glsl @@ -208,7 +208,7 @@ vec3 probe_evaluate_planar(int id, PlanarData pd, vec3 P, vec3 N, vec3 V, float /* TODO: If we support non-ssr planar reflection, we should blur them with gaussian * and chose the right mip depending on the cone footprint after projection */ - /* NOTE: X is inverted here to compensate inverted drawing. */ + /* NOTE: X is inverted here to compensate inverted drawing. */ vec3 radiance = textureLod(probePlanars, vec3(refco.xy * vec2(-0.5, 0.5) + 0.5, id), 0.0).rgb; return radiance; diff --git a/source/blender/draw/engines/eevee/shaders/random_lib.glsl b/source/blender/draw/engines/eevee/shaders/random_lib.glsl index 25a3e0f56b4..3a4ae257bbe 100644 --- a/source/blender/draw/engines/eevee/shaders/random_lib.glsl +++ b/source/blender/draw/engines/eevee/shaders/random_lib.glsl @@ -1,7 +1,7 @@ /** * Random numbers and low discrepency sequences utilities. - **/ + */ #pragma BLENDER_REQUIRE(common_math_lib.glsl) diff --git a/source/blender/draw/engines/eevee/shaders/raytrace_lib.glsl b/source/blender/draw/engines/eevee/shaders/raytrace_lib.glsl index 1b2135646c9..f1476e4f2c4 100644 --- a/source/blender/draw/engines/eevee/shaders/raytrace_lib.glsl +++ b/source/blender/draw/engines/eevee/shaders/raytrace_lib.glsl @@ -90,7 +90,7 @@ ScreenSpaceRay raytrace_screenspace_ray_create(Ray ray, float thickness) } struct RayTraceParameters { - /** ViewSpace thickness the objects */ + /** ViewSpace thickness the objects. */ float thickness; /** Jitter along the ray to avoid banding artifact when steps are too large. */ float jitter; diff --git a/source/blender/draw/engines/eevee/shaders/surface_lib.glsl b/source/blender/draw/engines/eevee/shaders/surface_lib.glsl index 0acb35b2399..0efa7b80b0b 100644 --- a/source/blender/draw/engines/eevee/shaders/surface_lib.glsl +++ b/source/blender/draw/engines/eevee/shaders/surface_lib.glsl @@ -1,4 +1,4 @@ -/** This describe the entire interface of the shader. */ +/** This describe the entire interface of the shader. */ #define SURFACE_INTERFACE \ vec3 worldPosition; \ diff --git a/source/blender/draw/engines/eevee/shaders/volumetric_lib.glsl b/source/blender/draw/engines/eevee/shaders/volumetric_lib.glsl index 788e621c3c1..c48c3bffaef 100644 --- a/source/blender/draw/engines/eevee/shaders/volumetric_lib.glsl +++ b/source/blender/draw/engines/eevee/shaders/volumetric_lib.glsl @@ -70,7 +70,7 @@ vec3 light_volume(LightData ld, vec4 l_vector) * Using "Point Light Attenuation Without Singularity" from Cem Yuksel * http://www.cemyuksel.com/research/pointlightattenuation/pointlightattenuation.pdf * http://www.cemyuksel.com/research/pointlightattenuation/ - **/ + */ float d = l_vector.w; float d_sqr = sqr(d); float r_sqr = ld.l_volume_radius; diff --git a/source/blender/draw/engines/gpencil/gpencil_cache_utils.c b/source/blender/draw/engines/gpencil/gpencil_cache_utils.c index af8b029a08e..8a2aebc95ab 100644 --- a/source/blender/draw/engines/gpencil/gpencil_cache_utils.c +++ b/source/blender/draw/engines/gpencil/gpencil_cache_utils.c @@ -102,7 +102,7 @@ GPENCIL_tObject *gpencil_object_cache_add(GPENCIL_PrivateData *pd, Object *ob) transpose_m4(mat); /* mat is now a "normal" matrix which will transform - * BBox space normal to world space. */ + * BBox space normal to world space. */ mul_mat3_m4_v3(mat, tgp_ob->plane_normal); normalize_v3(tgp_ob->plane_normal); diff --git a/source/blender/draw/engines/gpencil/gpencil_engine.c b/source/blender/draw/engines/gpencil/gpencil_engine.c index 32884eb9e3f..1921055c3d7 100644 --- a/source/blender/draw/engines/gpencil/gpencil_engine.c +++ b/source/blender/draw/engines/gpencil/gpencil_engine.c @@ -320,7 +320,7 @@ void GPENCIL_cache_init(void *ved) float focal_len = cam->lens; const float scale_camera = 0.001f; - /* we want radius here for the aperture number */ + /* We want radius here for the aperture number. */ float aperture = 0.5f * scale_camera * focal_len / fstop; float focal_len_scaled = scale_camera * focal_len; float sensor_scaled = scale_camera * sensor; diff --git a/source/blender/draw/engines/gpencil/shaders/gpencil_antialiasing_frag.glsl b/source/blender/draw/engines/gpencil/shaders/gpencil_antialiasing_frag.glsl index b512b54e392..7758fdceb46 100644 --- a/source/blender/draw/engines/gpencil/shaders/gpencil_antialiasing_frag.glsl +++ b/source/blender/draw/engines/gpencil/shaders/gpencil_antialiasing_frag.glsl @@ -17,7 +17,7 @@ out vec2 fragColor; #elif SMAA_STAGE == 1 out vec4 fragColor; #elif SMAA_STAGE == 2 -/* Reminder: Blending func is fragRevealage * DST + fragColor .*/ +/* Reminder: Blending func is `fragRevealage * DST + fragColor`. */ layout(location = 0, index = 0) out vec4 outColor; layout(location = 0, index = 1) out vec4 outReveal; #endif diff --git a/source/blender/draw/engines/gpencil/shaders/gpencil_common_lib.glsl b/source/blender/draw/engines/gpencil/shaders/gpencil_common_lib.glsl index ac48b94fea9..b1368f90846 100644 --- a/source/blender/draw/engines/gpencil/shaders/gpencil_common_lib.glsl +++ b/source/blender/draw/engines/gpencil/shaders/gpencil_common_lib.glsl @@ -101,23 +101,23 @@ void blend_mode_output( { switch (blend_mode) { case MODE_REGULAR: - /* Reminder: Blending func is premult alpha blend (dst.rgba * (1 - src.a) + src.rgb).*/ + /* Reminder: Blending func is premult alpha blend (dst.rgba * (1 - src.a) + src.rgb). */ color *= opacity; frag_color = color; frag_revealage = vec4(0.0, 0.0, 0.0, color.a); break; case MODE_MULTIPLY: - /* Reminder: Blending func is multiply blend (dst.rgba * src.rgba).*/ + /* Reminder: Blending func is multiply blend (dst.rgba * src.rgba). */ color.a *= opacity; frag_revealage = frag_color = (1.0 - color.a) + color.a * color; break; case MODE_DIVIDE: - /* Reminder: Blending func is multiply blend (dst.rgba * src.rgba).*/ + /* Reminder: Blending func is multiply blend (dst.rgba * src.rgba). */ color.a *= opacity; frag_revealage = frag_color = clamp(1.0 / max(vec4(1e-6), 1.0 - color * color.a), 0.0, 1e18); break; case MODE_HARDLIGHT: - /* Reminder: Blending func is multiply blend (dst.rgba * src.rgba).*/ + /* Reminder: Blending func is multiply blend (dst.rgba * src.rgba). */ /** * We need to separate the overlay equation into 2 term (one mul and one add). * This is the standard overlay equation (per channel): @@ -135,14 +135,14 @@ void blend_mode_output( frag_revealage = max(vec4(0.0), frag_revealage); break; case MODE_HARDLIGHT_SECOND_PASS: - /* Reminder: Blending func is additive blend (dst.rgba + src.rgba).*/ + /* Reminder: Blending func is additive blend (dst.rgba + src.rgba). */ color = mix(vec4(0.5), color, color.a * opacity); frag_revealage = frag_color = (-1.0 + 2.0 * color) * step(-0.5, -color); frag_revealage = max(vec4(0.0), frag_revealage); break; case MODE_SUB: case MODE_ADD: - /* Reminder: Blending func is additive / subtractive blend (dst.rgba +/- src.rgba).*/ + /* Reminder: Blending func is additive / subtractive blend (dst.rgba +/- src.rgba). */ frag_color = color * color.a * opacity; frag_revealage = vec4(0.0); break; @@ -238,7 +238,7 @@ in vec4 pos; /* Prev adj vert */ in vec4 pos1; /* Current edge */ in vec4 pos2; /* Current edge */ in vec4 pos3; /* Next adj vert */ -/* xy is UV for fills, z is U of stroke, w is strength. */ +/* xy is UV for fills, z is U of stroke, w is strength. */ in vec4 uv1; in vec4 uv2; in vec4 col1; @@ -347,7 +347,7 @@ float stroke_thickness_modulate(float thickness) float clamp_small_stroke_thickness(float thickness) { /* To avoid aliasing artifacts, we clamp the line thickness and - * reduce its opacity in the fragment shader.*/ + * reduce its opacity in the fragment shader. */ float min_thickness = gl_Position.w * 1.3; thickness = max(min_thickness, thickness); diff --git a/source/blender/draw/engines/image/shaders/engine_image_frag.glsl b/source/blender/draw/engines/image/shaders/engine_image_frag.glsl index 2bccf0d99b5..55a2f2a72f1 100644 --- a/source/blender/draw/engines/image/shaders/engine_image_frag.glsl +++ b/source/blender/draw/engines/image/shaders/engine_image_frag.glsl @@ -28,7 +28,7 @@ in vec2 uvs; out vec4 fragColor; #ifdef TILED_IMAGE -/* TODO(fclem): deduplicate code. */ +/* TODO(fclem): deduplicate code. */ bool node_tex_tile_lookup(inout vec3 co, sampler2DArray ima, sampler1DArray map) { vec2 tile_pos = floor(co.xy); diff --git a/source/blender/draw/engines/overlay/overlay_armature.c b/source/blender/draw/engines/overlay/overlay_armature.c index ea636c3d185..0e350ea5a68 100644 --- a/source/blender/draw/engines/overlay/overlay_armature.c +++ b/source/blender/draw/engines/overlay/overlay_armature.c @@ -1889,7 +1889,7 @@ static void draw_bone_name(ArmatureDrawContext *ctx, bool highlight = (pchan && (arm->flag & ARM_POSEMODE) && (boneflag & BONE_SELECTED)) || (eBone && (eBone->flag & BONE_SELECTED)); - /* Color Management: Exception here as texts are drawn in sRGB space directly. */ + /* Color Management: Exception here as texts are drawn in sRGB space directly. */ UI_GetThemeColor4ubv(highlight ? TH_TEXT_HI : TH_TEXT, color); float *head = pchan ? pchan->pose_head : eBone->head; @@ -2018,7 +2018,7 @@ static void draw_armature_pose(ArmatureDrawContext *ctx) ((draw_ctx->object_mode == OB_MODE_OBJECT) && (scene->toolsettings->object_flag & SCE_OBJECT_MODE_LOCK) == 0) || /* Allow selection when in weight-paint mode - * (selection code ensures this wont become active). */ + * (selection code ensures this won't become active). */ ((draw_ctx->object_mode & OB_MODE_ALL_WEIGHT_PAINT) && (draw_ctx->object_pose != NULL))))) && DRW_state_is_select(); diff --git a/source/blender/draw/engines/overlay/overlay_edit_uv.c b/source/blender/draw/engines/overlay/overlay_edit_uv.c index 9c58a2b574f..01ab47ac1de 100644 --- a/source/blender/draw/engines/overlay/overlay_edit_uv.c +++ b/source/blender/draw/engines/overlay/overlay_edit_uv.c @@ -325,7 +325,7 @@ void OVERLAY_edit_uv_cache_init(OVERLAY_Data *vedata) if (pd->edit_uv.do_tiled_image_overlay) { struct DRWTextStore *dt = DRW_text_cache_ensure(); uchar color[4]; - /* Color Management: Exception here as texts are drawn in sRGB space directly. */ + /* Color Management: Exception here as texts are drawn in sRGB space directly. */ UI_GetThemeColorShade4ubv(TH_BACK, 60, color); char text[16]; LISTBASE_FOREACH (ImageTile *, tile, &image->tiles) { diff --git a/source/blender/draw/engines/overlay/overlay_extra.c b/source/blender/draw/engines/overlay/overlay_extra.c index 2e1c0165513..b70c71de188 100644 --- a/source/blender/draw/engines/overlay/overlay_extra.c +++ b/source/blender/draw/engines/overlay/overlay_extra.c @@ -887,7 +887,7 @@ static void camera_view3d_reconstruction(OVERLAY_ExtraCallBuffers *cb, float *bundle_color_solid = G_draw.block.colorBundleSolid; float *bundle_color_unselected = G_draw.block.colorWire; uchar text_color_selected[4], text_color_unselected[4]; - /* Color Management: Exception here as texts are drawn in sRGB space directly. */ + /* Color Management: Exception here as texts are drawn in sRGB space directly. */ UI_GetThemeColor4ubv(TH_SELECT, text_color_selected); UI_GetThemeColor4ubv(TH_TEXT, text_color_unselected); @@ -1544,7 +1544,7 @@ static void OVERLAY_object_name(Object *ob, int theme_id) { struct DRWTextStore *dt = DRW_text_cache_ensure(); uchar color[4]; - /* Color Management: Exception here as texts are drawn in sRGB space directly. */ + /* Color Management: Exception here as texts are drawn in sRGB space directly. */ UI_GetThemeColor4ubv(theme_id, color); DRW_text_cache_add(dt, diff --git a/source/blender/draw/engines/overlay/overlay_motion_path.c b/source/blender/draw/engines/overlay/overlay_motion_path.c index a92f11aca38..e19d99dc597 100644 --- a/source/blender/draw/engines/overlay/overlay_motion_path.c +++ b/source/blender/draw/engines/overlay/overlay_motion_path.c @@ -177,7 +177,7 @@ static void motion_path_cache(OVERLAY_Data *vedata, if (show_frame_no || (show_keyframes_no && show_keyframes)) { int i; uchar col[4], col_kf[4]; - /* Color Management: Exception here as texts are drawn in sRGB space directly. */ + /* Color Management: Exception here as texts are drawn in sRGB space directly. */ UI_GetThemeColor3ubv(TH_TEXT_HI, col); UI_GetThemeColor3ubv(TH_VERTEX_SELECT, col_kf); col[3] = col_kf[3] = 255; diff --git a/source/blender/draw/engines/overlay/overlay_outline.c b/source/blender/draw/engines/overlay/overlay_outline.c index f1467ff9794..a2c3b5bf4aa 100644 --- a/source/blender/draw/engines/overlay/overlay_outline.c +++ b/source/blender/draw/engines/overlay/overlay_outline.c @@ -77,7 +77,7 @@ static void gpencil_depth_plane(Object *ob, float r_plane[4]) transpose_m4(mat); /* mat is now a "normal" matrix which will transform - * BBox space normal to world space. */ + * BBox space normal to world space. */ mul_mat3_m4_v3(mat, r_plane); normalize_v3(r_plane); diff --git a/source/blender/draw/engines/overlay/overlay_particle.c b/source/blender/draw/engines/overlay/overlay_particle.c index 5fa74a8c3a6..e51f7032288 100644 --- a/source/blender/draw/engines/overlay/overlay_particle.c +++ b/source/blender/draw/engines/overlay/overlay_particle.c @@ -174,7 +174,7 @@ void OVERLAY_particle_cache_populate(OVERLAY_Data *vedata, Object *ob) int draw_as = (part->draw_as == PART_DRAW_REND) ? part->ren_as : part->draw_as; if (part->type == PART_HAIR) { - /* Hairs should have been rendered by the render engine.*/ + /* Hairs should have been rendered by the render engine. */ continue; } diff --git a/source/blender/draw/engines/overlay/overlay_private.h b/source/blender/draw/engines/overlay/overlay_private.h index 969289a3219..a48b46a61fc 100644 --- a/source/blender/draw/engines/overlay/overlay_private.h +++ b/source/blender/draw/engines/overlay/overlay_private.h @@ -358,7 +358,7 @@ typedef struct OVERLAY_PrivateData { bool select_vert; bool select_face; bool select_edge; - int flag; /** Copy of v3d->overlay.edit_flag. */ + int flag; /** Copy of #v3d->overlay.edit_flag. */ } edit_mesh; struct { bool use_weight; diff --git a/source/blender/draw/engines/overlay/shaders/armature_shape_outline_geom.glsl b/source/blender/draw/engines/overlay/shaders/armature_shape_outline_geom.glsl index 6398426952c..a2a478f400b 100644 --- a/source/blender/draw/engines/overlay/shaders/armature_shape_outline_geom.glsl +++ b/source/blender/draw/engines/overlay/shaders/armature_shape_outline_geom.glsl @@ -54,7 +54,7 @@ void main(void) * (avoid problems with point behind near plane). * If the chosen point is parallel to the edge in screen space, * choose the other point anyway. - * This fixes some issue with cubes in orthographic views.*/ + * This fixes some issue with cubes in orthographic views. */ if (vPos[0].z < vPos[3].z) { hidden_point = (abs(fac0) > 1e-5) ? ssPos[0] : ssPos[3]; } diff --git a/source/blender/draw/engines/overlay/shaders/extra_vert.glsl b/source/blender/draw/engines/overlay/shaders/extra_vert.glsl index 74854dc0f8d..59c9d0a665d 100644 --- a/source/blender/draw/engines/overlay/shaders/extra_vert.glsl +++ b/source/blender/draw/engines/overlay/shaders/extra_vert.glsl @@ -162,13 +162,13 @@ void main() int color_class = int(floor(color.r)); float color_intensity = fract(color.r); switch (color_class) { - case 0: /* No eye (convergence plane) */ + case 0: /* No eye (convergence plane). */ finalColor = vec4(1.0, 1.0, 1.0, 1.0); break; - case 1: /* Left eye */ + case 1: /* Left eye. */ finalColor = vec4(0.0, 1.0, 1.0, 1.0); break; - case 2: /* Right eye */ + case 2: /* Right eye. */ finalColor = vec4(1.0, 0.0, 0.0, 1.0); break; } @@ -207,7 +207,7 @@ void main() vec3 n1 = normalize(cross(edge, world_pos - p1)); bool persp = (ProjectionMatrix[3][3] == 0.0); vec3 V = (persp) ? normalize(ViewMatrixInverse[3].xyz - world_pos) : ViewMatrixInverse[2].xyz; - /* Discard non-silhouete edges. */ + /* Discard non-silhouette edges. */ bool facing0 = dot(n0, V) > 0.0; bool facing1 = dot(n1, V) > 0.0; if (facing0 == facing1) { diff --git a/source/blender/draw/engines/workbench/shaders/workbench_common_lib.glsl b/source/blender/draw/engines/workbench/shaders/workbench_common_lib.glsl index 122c99ca536..8cbc8608f5b 100644 --- a/source/blender/draw/engines/workbench/shaders/workbench_common_lib.glsl +++ b/source/blender/draw/engines/workbench/shaders/workbench_common_lib.glsl @@ -59,7 +59,7 @@ void workbench_float_pair_decode(float data, out float v1, out float v2) { // const uint v1_mask = ~(0xFFFFFFFFu << ROUGHNESS_BITS); // const uint v2_mask = ~(0xFFFFFFFFu << METALLIC_BITS); - /* Same as above because some compiler are very dumb and think we use medium int. */ + /* Same as above because some compiler are very dumb and think we use medium int. */ const int v1_mask = 0x1F; const int v2_mask = 0x7; int idata = int(data); diff --git a/source/blender/draw/engines/workbench/shaders/workbench_data_lib.glsl b/source/blender/draw/engines/workbench/shaders/workbench_data_lib.glsl index a76a14fa750..2e229d4d83a 100644 --- a/source/blender/draw/engines/workbench/shaders/workbench_data_lib.glsl +++ b/source/blender/draw/engines/workbench/shaders/workbench_data_lib.glsl @@ -12,7 +12,7 @@ struct WorldData { float shadow_shift; float shadow_mul; float shadow_add; - /* - 16 bytes alignment- */ + /* - 16 bytes alignment - */ LightData lights[4]; vec4 ambient_color; diff --git a/source/blender/draw/engines/workbench/shaders/workbench_image_lib.glsl b/source/blender/draw/engines/workbench/shaders/workbench_image_lib.glsl index 690ba1b92bc..57d648d3565 100644 --- a/source/blender/draw/engines/workbench/shaders/workbench_image_lib.glsl +++ b/source/blender/draw/engines/workbench/shaders/workbench_image_lib.glsl @@ -1,5 +1,5 @@ -/* TODO(fclem): deduplicate code. */ +/* TODO(fclem): deduplicate code. */ bool node_tex_tile_lookup(inout vec3 co, sampler2DArray ima, sampler1DArray map) { vec2 tile_pos = floor(co.xy); diff --git a/source/blender/draw/engines/workbench/workbench_effect_dof.c b/source/blender/draw/engines/workbench/workbench_effect_dof.c index a00453fe125..2261790226a 100644 --- a/source/blender/draw/engines/workbench/workbench_effect_dof.c +++ b/source/blender/draw/engines/workbench/workbench_effect_dof.c @@ -157,7 +157,7 @@ void workbench_dof_engine_init(WORKBENCH_Data *vedata) const float *full_size = DRW_viewport_size_get(); const int size[2] = {max_ii(1, (int)full_size[0] / 2), max_ii(1, (int)full_size[1] / 2)}; #if 0 /* TODO(fclem): finish COC min_max optimization. */ - /* NOTE: We Ceil here in order to not miss any edge texel if using a NPO2 texture. */ + /* NOTE: We Ceil here in order to not miss any edge texel if using a NPO2 texture. */ int shrink_h_size[2] = {ceilf(size[0] / 8.0f), size[1]}; int shrink_w_size[2] = {shrink_h_size[0], ceilf(size[1] / 8.0f)}; #endif @@ -218,9 +218,9 @@ void workbench_dof_engine_init(WORKBENCH_Data *vedata) float focus_dist = BKE_camera_object_dof_distance(camera); float focal_len = cam->lens; - /* TODO(fclem): deduplicate with eevee */ + /* TODO(fclem): de-duplicate with EEVEE. */ const float scale_camera = 0.001f; - /* we want radius here for the aperture number */ + /* We want radius here for the aperture number. */ float aperture = 0.5f * scale_camera * focal_len / fstop; float focal_len_scaled = scale_camera * focal_len; float sensor_scaled = scale_camera * sensor; diff --git a/source/blender/draw/engines/workbench/workbench_private.h b/source/blender/draw/engines/workbench/workbench_private.h index 6247436feea..453ef9c7f8e 100644 --- a/source/blender/draw/engines/workbench/workbench_private.h +++ b/source/blender/draw/engines/workbench/workbench_private.h @@ -381,13 +381,13 @@ typedef struct WORKBENCH_ObjectData { } WORKBENCH_ObjectData; typedef struct WORKBENCH_ViewLayerData { - /** Depth of field sample location array.*/ + /** Depth of field sample location array. */ struct GPUUniformBuf *dof_sample_ubo; - /** All constant data used for a render loop.*/ + /** All constant data used for a render loop. */ struct GPUUniformBuf *world_ubo; - /** Cavity sample location array.*/ + /** Cavity sample location array. */ struct GPUUniformBuf *cavity_sample_ubo; - /** Blue noise texture used to randomize the sampling of some effects.*/ + /** Blue noise texture used to randomize the sampling of some effects. */ struct GPUTexture *cavity_jitter_tx; /** Materials UBO's allocated in a memblock for easy bookkeeping. */ struct BLI_memblock *material_ubo; diff --git a/source/blender/draw/engines/workbench/workbench_volume.c b/source/blender/draw/engines/workbench/workbench_volume.c index ddda6d7b58e..daeadce3059 100644 --- a/source/blender/draw/engines/workbench/workbench_volume.c +++ b/source/blender/draw/engines/workbench/workbench_volume.c @@ -125,7 +125,7 @@ static void workbench_volume_modifier_cache_populate(WORKBENCH_Data *vedata, fds->slice_axis - 1; float dim[3]; BKE_object_dimensions_get(ob, dim); - /* 0.05f to achieve somewhat the same opacity as the full view. */ + /* 0.05f to achieve somewhat the same opacity as the full view. */ float step_length = max_ff(1e-16f, dim[axis] * 0.05f); grp = DRW_shgroup_create(sh, vedata->psl->volume_ps); @@ -266,7 +266,7 @@ static void workbench_volume_object_cache_populate(WORKBENCH_Data *vedata, float dim[3]; BKE_object_dimensions_get(ob, dim); - /* 0.05f to achieve somewhat the same opacity as the full view. */ + /* 0.05f to achieve somewhat the same opacity as the full view. */ float step_length = max_ff(1e-16f, dim[axis] * 0.05f); const float slice_position = volume->display.slice_depth; diff --git a/source/blender/draw/intern/DRW_render.h b/source/blender/draw/intern/DRW_render.h index 5071658fd82..5d5a506c1e7 100644 --- a/source/blender/draw/intern/DRW_render.h +++ b/source/blender/draw/intern/DRW_render.h @@ -308,7 +308,7 @@ void DRW_shader_library_free(DRWShaderLibrary *lib); * on the differences the minimum state changes can be invoked to setup the desired render state. * * The Write Stencil, Stencil test, Depth test and Blend state options are mutual exclusive - * therefore they aren't ordered as a bit mask.*/ + * therefore they aren't ordered as a bit mask. */ typedef enum { /** Write mask */ DRW_STATE_WRITE_DEPTH = (1 << 0), diff --git a/source/blender/draw/intern/draw_cache.c b/source/blender/draw/intern/draw_cache.c index edf3decef8a..50f4b6d7cb6 100644 --- a/source/blender/draw/intern/draw_cache.c +++ b/source/blender/draw/intern/draw_cache.c @@ -2566,7 +2566,7 @@ GPUBatch *DRW_cache_bone_arrows_get(void) for (int axis = 0; axis < 3; axis++) { int flag = VCLASS_EMPTY_AXES | VCLASS_SCREENALIGNED; /* Vertex layout is XY screen position and axis in Z. - * Fractional part of Z is a positive offset at axis unit position.*/ + * Fractional part of Z is a positive offset at axis unit position. */ float p[3] = {0.0f, 0.0f, axis}; /* center to axis line */ GPU_vertbuf_vert_set(vbo, v++, &(Vert){{0.0f, 0.0f, 0.0f}, 0}); diff --git a/source/blender/draw/intern/draw_cache_extract.h b/source/blender/draw/intern/draw_cache_extract.h index 5fc6629e804..be61b0a9baf 100644 --- a/source/blender/draw/intern/draw_cache_extract.h +++ b/source/blender/draw/intern/draw_cache_extract.h @@ -81,7 +81,7 @@ typedef enum eMRDataType { MR_DATA_POLY_NOR = 1 << 1, MR_DATA_LOOP_NOR = 1 << 2, MR_DATA_LOOPTRI = 1 << 3, - /** Force loop normals calculation. */ + /** Force loop normals calculation. */ MR_DATA_TAN_LOOP_NOR = 1 << 4, MR_DATA_MAT_OFFSETS = 1 << 5, } eMRDataType; @@ -263,8 +263,7 @@ typedef struct MeshBatchCache { #define MBC_IBO_LEN (sizeof(((MeshBufferCache){0}).ibo) / sizeof(void *)) #define MBC_BATCH_INDEX(batch_name) \ - ((offsetof(MeshBatchCache, batch_name) - offsetof(MeshBatchCache, batch.surface)) / \ - sizeof(void *)) + ((offsetof(MeshBatchCache, batch_name) - offsetof(MeshBatchCache, batch)) / sizeof(void *)) typedef enum DRWBatchFlag { MBC_SURFACE = (1u << MBC_BATCH_INDEX(batch.surface)), diff --git a/source/blender/draw/intern/draw_cache_extract_mesh_extractors.c b/source/blender/draw/intern/draw_cache_extract_mesh_extractors.c index 159e3ea7ff5..42eef7372f7 100644 --- a/source/blender/draw/intern/draw_cache_extract_mesh_extractors.c +++ b/source/blender/draw/intern/draw_cache_extract_mesh_extractors.c @@ -991,6 +991,7 @@ const MeshExtract extract_tan_hq = { .data_type = MR_DATA_POLY_NOR | MR_DATA_TAN_LOOP_NOR | MR_DATA_LOOPTRI, .data_size = 0, .use_threading = false, + .mesh_buffer_offset = offsetof(MeshBufferCache, vbo.tan), }; /** \} */ diff --git a/source/blender/draw/intern/draw_cache_extract_mesh_private.h b/source/blender/draw/intern/draw_cache_extract_mesh_private.h index a258967564b..1b4521335ec 100644 --- a/source/blender/draw/intern/draw_cache_extract_mesh_private.h +++ b/source/blender/draw/intern/draw_cache_extract_mesh_private.h @@ -41,66 +41,6 @@ extern "C" { #define MIN_RANGE_LEN 1024 /* ---------------------------------------------------------------------- */ -/** \name Dependencies between buffer and batch - * \{ */ -#ifndef NDEBUG -# define _MDEF_type(name) static DRWBatchFlag MDEP_assert_##name = 0, MDEP_##name -#else -# define _MDEF_type(name) static const DRWBatchFlag MDEP_##name -#endif - -/* clang-format off */ - -#define _MDEPS_CREATE1(b) (1u << MBC_BATCH_INDEX(b)) -#define _MDEPS_CREATE2(b1, b2) _MDEPS_CREATE1(b1) | _MDEPS_CREATE1(b2) -#define _MDEPS_CREATE3(b1, b2, b3) _MDEPS_CREATE2(b1, b2) | _MDEPS_CREATE1(b3) -#define _MDEPS_CREATE4(b1, b2, b3, b4) _MDEPS_CREATE3(b1, b2, b3) | _MDEPS_CREATE1(b4) -#define _MDEPS_CREATE5(b1, b2, b3, b4, b5) _MDEPS_CREATE4(b1, b2, b3, b4) | _MDEPS_CREATE1(b5) -#define _MDEPS_CREATE6(b1, b2, b3, b4, b5, b6) _MDEPS_CREATE5(b1, b2, b3, b4, b5) | _MDEPS_CREATE1(b6) -#define _MDEPS_CREATE7(b1, b2, b3, b4, b5, b6, b7) _MDEPS_CREATE6(b1, b2, b3, b4, b5, b6) | _MDEPS_CREATE1(b7) -#define _MDEPS_CREATE8(b1, b2, b3, b4, b5, b6, b7, b8) _MDEPS_CREATE7(b1, b2, b3, b4, b5, b6, b7) | _MDEPS_CREATE1(b8) -#define _MDEPS_CREATE9(b1, b2, b3, b4, b5, b6, b7, b8, b9) _MDEPS_CREATE8(b1, b2, b3, b4, b5, b6, b7, b8) | _MDEPS_CREATE1(b9) -#define _MDEPS_CREATE10(b1, b2, b3, b4, b5, b6, b7, b8, b9, b10) _MDEPS_CREATE9(b1, b2, b3, b4, b5, b6, b7, b8, b9) | _MDEPS_CREATE1(b10) -#define _MDEPS_CREATE19(b1, b2, b3, b4, b5, b6, b7, b8, b9, b10, b11, b12, b13, b14, b15, b16, b17, b18, b19) _MDEPS_CREATE10(b1, b2, b3, b4, b5, b6, b7, b8, b9, b10) | _MDEPS_CREATE9(b11, b12, b13, b14, b15, b16, b17, b18, b19) - -#define MDEPS_CREATE(name, ...) _MDEF_type(name) = VA_NARGS_CALL_OVERLOAD(_MDEPS_CREATE, __VA_ARGS__) - -#define _MDEPS_CREATE_MAP1(a) MDEP_##a -#define _MDEPS_CREATE_MAP2(a, b) MDEP_##a | MDEP_##b -#define _MDEPS_CREATE_MAP3(a, b, c) _MDEPS_CREATE_MAP2(a, b) | MDEP_##c -#define _MDEPS_CREATE_MAP4(a, b, c, d) _MDEPS_CREATE_MAP3(a, b, c) | MDEP_##d -#define _MDEPS_CREATE_MAP5(a, b, c, d, e) _MDEPS_CREATE_MAP4(a, b, c, d) | MDEP_##e -#define _MDEPS_CREATE_MAP6(a, b, c, d, e, f) _MDEPS_CREATE_MAP5(a, b, c, d, e) | MDEP_##f -#define _MDEPS_CREATE_MAP7(a, b, c, d, e, f, g) _MDEPS_CREATE_MAP6(a, b, c, d, e, f) | MDEP_##g -#define _MDEPS_CREATE_MAP8(a, b, c, d, e, f, g, h) _MDEPS_CREATE_MAP7(a, b, c, d, e, f, g) | MDEP_##h -#define _MDEPS_CREATE_MAP9(a, b, c, d, e, f, g, h, i) _MDEPS_CREATE_MAP8(a, b, c, d, e, f, g, h) | MDEP_##i -#define _MDEPS_CREATE_MAP10(a, b, c, d, e, f, g, h, i, j) _MDEPS_CREATE_MAP9(a, b, c, d, e, f, g, h, i) | MDEP_##j - -#define MDEPS_CREATE_MAP(...) VA_NARGS_CALL_OVERLOAD(_MDEPS_CREATE_MAP, __VA_ARGS__) - -#ifndef NDEBUG -# define _MDEPS_ASSERT2(b, name) \ - MDEP_assert_##name |= _MDEPS_CREATE1(b); \ - BLI_assert(MDEP_##name & _MDEPS_CREATE1(b)) -# define _MDEPS_ASSERT3(b, n1, n2) _MDEPS_ASSERT2(b, n1); _MDEPS_ASSERT2(b, n2) -# define _MDEPS_ASSERT4(b, n1, n2, n3) _MDEPS_ASSERT3(b, n1, n2); _MDEPS_ASSERT2(b, n3) -# define _MDEPS_ASSERT5(b, n1, n2, n3, n4) _MDEPS_ASSERT4(b, n1, n2, n3); _MDEPS_ASSERT2(b, n4) -# define _MDEPS_ASSERT6(b, n1, n2, n3, n4, n5) _MDEPS_ASSERT5(b, n1, n2, n3, n4); _MDEPS_ASSERT2(b, n5) -# define _MDEPS_ASSERT7(b, n1, n2, n3, n4, n5, n6) _MDEPS_ASSERT6(b, n1, n2, n3, n4, n5); _MDEPS_ASSERT2(b, n6) -# define _MDEPS_ASSERT8(b, n1, n2, n3, n4, n5, n6, n7) _MDEPS_ASSERT7(b, n1, n2, n3, n4, n5, n6); _MDEPS_ASSERT2(b, n7) - -# define MDEPS_ASSERT(...) VA_NARGS_CALL_OVERLOAD(_MDEPS_ASSERT, __VA_ARGS__) -# define MDEPS_ASSERT_MAP(name) BLI_assert(MDEP_assert_##name == MDEP_##name) -#else -# define MDEPS_ASSERT(...) -# define MDEPS_ASSERT_MAP(name) UNUSED_VARS(MDEP_##name) -#endif - -/* clang-format on */ - -/** \} */ - -/* ---------------------------------------------------------------------- */ /** \name Mesh Render Data * \{ */ diff --git a/source/blender/draw/intern/draw_cache_extract_mesh_render_data.c b/source/blender/draw/intern/draw_cache_extract_mesh_render_data.c index b0eb0c8bcb3..bccf894cc53 100644 --- a/source/blender/draw/intern/draw_cache_extract_mesh_render_data.c +++ b/source/blender/draw/intern/draw_cache_extract_mesh_render_data.c @@ -67,8 +67,8 @@ static void mesh_render_data_loose_geom_load(MeshRenderData *mr, MeshBufferExtra static void mesh_render_data_loose_geom_ensure(const MeshRenderData *mr, MeshBufferExtractionCache *cache) { - /* Early exit: Are loose geometry already available. Only checking for loose verts as loose edges - * and verts are calculated at the same time.*/ + /* Early exit: Are loose geometry already available. + * Only checking for loose verts as loose edges and verts are calculated at the same time. */ if (cache->loose_geom.verts) { return; } @@ -230,7 +230,7 @@ static void mesh_render_data_mat_offset_build(MeshRenderData *mr, MeshBufferExtr typedef struct MatOffsetUserData { MeshRenderData *mr; - /* struct is extended during allocation to hold mat_tri_len for each material. */ + /** This struct is extended during allocation to hold mat_tri_len for each material. */ int mat_tri_len[0]; } MatOffsetUserData; @@ -252,7 +252,7 @@ static void mesh_render_data_mat_offset_build_threaded(MeshRenderData *mr, int face_len, TaskParallelRangeFunc range_func) { - /* Extending the MatOffsetUserData with an int per material slot. */ + /* Extending the #MatOffsetUserData with an int per material slot. */ size_t userdata_size = sizeof(MatOffsetUserData) + (mr->mat_len) * sizeof(*cache->mat_offsets.tri); MatOffsetUserData *userdata = MEM_callocN(userdata_size, __func__); @@ -348,6 +348,9 @@ void mesh_render_data_update_looptris(MeshRenderData *mr, if (mr->extract_type != MR_EXTRACT_BMESH) { /* Mesh */ if ((iter_type & MR_ITER_LOOPTRI) || (data_flag & MR_DATA_LOOPTRI)) { + /* NOTE(campbell): It's possible to skip allocating tessellation, + * the tessellation can be calculated as part of the iterator, see: P2188. + * The overall advantage is small (around 1%), so keep this as-is. */ mr->mlooptri = MEM_mallocN(sizeof(*mr->mlooptri) * mr->tri_len, "MR_DATATYPE_LOOPTRI"); if (mr->poly_normals != NULL) { BKE_mesh_recalc_looptri_with_normals(me->mloop, @@ -575,7 +578,7 @@ void mesh_render_data_free(MeshRenderData *mr) MEM_SAFE_FREE(mr->mlooptri); MEM_SAFE_FREE(mr->loop_normals); - /* Loose geometry are owned by MeshBufferExtractionCache. */ + /* Loose geometry are owned by #MeshBufferExtractionCache. */ mr->ledges = NULL; mr->lverts = NULL; diff --git a/source/blender/draw/intern/draw_cache_impl_curve.cc b/source/blender/draw/intern/draw_cache_impl_curve.cc index 9ca452cdacc..c4cd547ef43 100644 --- a/source/blender/draw/intern/draw_cache_impl_curve.cc +++ b/source/blender/draw/intern/draw_cache_impl_curve.cc @@ -94,7 +94,7 @@ static void curve_render_overlay_verts_edges_len_get(ListBase *lb, LISTBASE_FOREACH (Nurb *, nu, lb) { if (nu->bezt) { vert_len += nu->pntsu * 3; - /* 2x handles per point*/ + /* 2x handles per point. */ edge_len += 2 * nu->pntsu; } else if (nu->bp) { diff --git a/source/blender/draw/intern/draw_cache_impl_displist.c b/source/blender/draw/intern/draw_cache_impl_displist.c index b59c4db8383..1d4f411c94d 100644 --- a/source/blender/draw/intern/draw_cache_impl_displist.c +++ b/source/blender/draw/intern/draw_cache_impl_displist.c @@ -861,7 +861,7 @@ void DRW_displist_indexbuf_create_edges_adjacency_lines(struct ListBase *lb, } BLI_edgehashIterator_getKey(ehi, &v1, &v2); uint v0 = (uint)abs(v_data) - 1; - if (v_data < 0) { /* inv_opposite */ + if (v_data < 0) { /* inv_opposite */ SWAP(uint, v1, v2); } GPU_indexbuf_add_line_adj_verts(&elb, v0, v1, v2, v0); diff --git a/source/blender/draw/intern/draw_cache_impl_lattice.c b/source/blender/draw/intern/draw_cache_impl_lattice.c index e6c7341759b..eabef49fa22 100644 --- a/source/blender/draw/intern/draw_cache_impl_lattice.c +++ b/source/blender/draw/intern/draw_cache_impl_lattice.c @@ -165,7 +165,7 @@ static LatticeRenderData *lattice_render_data_create(Lattice *lt, const int type } if (types & (LR_DATATYPE_EDGE)) { rdata->edge_len = lattice_render_edges_len_get(lt); - /*no edge data */ + /* No edge data. */ } } diff --git a/source/blender/draw/intern/draw_cache_impl_mesh.c b/source/blender/draw/intern/draw_cache_impl_mesh.c index 20ec22a2f78..33f8ec38a54 100644 --- a/source/blender/draw/intern/draw_cache_impl_mesh.c +++ b/source/blender/draw/intern/draw_cache_impl_mesh.c @@ -72,85 +72,150 @@ #include "draw_cache_impl.h" /* own include */ -MDEPS_CREATE(vbo_lnor, batch.surface, batch.wire_loops, batch.edit_lnor, surface_per_mat); -MDEPS_CREATE(vbo_pos_nor, - batch.surface, - batch.surface_weights, - batch.all_verts, - batch.all_edges, - batch.loose_edges, - batch.edge_detection, - batch.wire_loops, - batch.wire_edges, - batch.edit_vnor, - batch.edit_lnor, - batch.edit_vertices, - batch.edit_edges, - batch.edit_triangles, - batch.edit_selection_verts, - batch.edit_selection_edges, - batch.edit_selection_faces, - batch.edit_mesh_analysis, - batch.sculpt_overlays, - surface_per_mat); -MDEPS_CREATE(vbo_uv, - batch.surface, - batch.wire_loops_uvs, - batch.edituv_faces, - batch.edituv_faces_stretch_area, - batch.edituv_faces_stretch_angle, - batch.edituv_edges, - batch.edituv_verts, - surface_per_mat); -MDEPS_CREATE(vbo_vcol, batch.surface, surface_per_mat); -MDEPS_CREATE(vbo_sculpt_data, batch.sculpt_overlays); -MDEPS_CREATE(vbo_weights, batch.surface_weights); -MDEPS_CREATE(vbo_edge_fac, batch.wire_edges); -MDEPS_CREATE(vbo_mesh_analysis, batch.edit_mesh_analysis); -MDEPS_CREATE(vbo_tan, surface_per_mat); -MDEPS_CREATE(vbo_orco, surface_per_mat); -MDEPS_CREATE(vbo_edit_data, batch.edit_triangles, batch.edit_edges, batch.edit_vertices); -MDEPS_CREATE(vbo_fdots_pos, batch.edit_fdots, batch.edit_selection_fdots); -MDEPS_CREATE(vbo_fdots_nor, batch.edit_fdots); -MDEPS_CREATE(vbo_skin_roots, batch.edit_skin_roots); -MDEPS_CREATE(vbo_vert_idx, batch.edit_selection_verts); -MDEPS_CREATE(vbo_edge_idx, batch.edit_selection_edges); -MDEPS_CREATE(vbo_poly_idx, batch.edit_selection_faces); -MDEPS_CREATE(vbo_fdot_idx, batch.edit_selection_fdots); -MDEPS_CREATE(vbo_edituv_data, - batch.edituv_faces, - batch.edituv_faces_stretch_area, - batch.edituv_faces_stretch_angle, - batch.edituv_edges, - batch.edituv_verts); -MDEPS_CREATE(vbo_edituv_stretch_area, batch.edituv_faces_stretch_area); -MDEPS_CREATE(vbo_edituv_stretch_angle, batch.edituv_faces_stretch_angle); -MDEPS_CREATE(vbo_fdots_uv, batch.edituv_fdots); -MDEPS_CREATE(vbo_fdots_edituv_data, batch.edituv_fdots); - -MDEPS_CREATE(ibo_tris, - batch.surface, - batch.sculpt_overlays, - batch.surface_weights, - batch.edit_mesh_analysis, - batch.edit_triangles, - batch.edit_lnor, - batch.edit_selection_faces); -MDEPS_CREATE( - ibo_lines, batch.all_edges, batch.wire_edges, batch.edit_edges, batch.edit_selection_edges); -MDEPS_CREATE(ibo_lines_loose, batch.loose_edges); -MDEPS_CREATE(ibo_lines_adjacency, batch.edge_detection); -MDEPS_CREATE(ibo_lines_paint_mask, batch.wire_loops); -MDEPS_CREATE(ibo_tris_per_mat, surface_per_mat); -MDEPS_CREATE(ibo_points, batch.edit_vnor, batch.edit_selection_verts, batch.edit_vertices); -MDEPS_CREATE(ibo_fdots, batch.edit_fdots, batch.edit_selection_fdots); -MDEPS_CREATE(ibo_edituv_tris, - batch.edituv_faces, - batch.edituv_faces_stretch_area, - batch.edituv_faces_stretch_angle); -MDEPS_CREATE(ibo_edituv_lines, batch.edituv_edges, batch.wire_loops_uvs); -MDEPS_CREATE(ibo_edituv_points, batch.edituv_verts); -MDEPS_CREATE(ibo_edituv_fdots, batch.edituv_fdots); +/* ---------------------------------------------------------------------- */ +/** \name Dependencies between buffer and batch + * \{ */ + +/* clang-format off */ + +#define _BUFFER_INDEX(buff_name) ((offsetof(MeshBufferCache, buff_name) - offsetof(MeshBufferCache, vbo)) / sizeof(void *)) + +#define _MDEPS_CREATE1(b) (1u << MBC_BATCH_INDEX(b)) +#define _MDEPS_CREATE2(b1, b2) _MDEPS_CREATE1(b1) | _MDEPS_CREATE1(b2) +#define _MDEPS_CREATE3(b1, b2, b3) _MDEPS_CREATE2(b1, b2) | _MDEPS_CREATE1(b3) +#define _MDEPS_CREATE4(b1, b2, b3, b4) _MDEPS_CREATE3(b1, b2, b3) | _MDEPS_CREATE1(b4) +#define _MDEPS_CREATE5(b1, b2, b3, b4, b5) _MDEPS_CREATE4(b1, b2, b3, b4) | _MDEPS_CREATE1(b5) +#define _MDEPS_CREATE6(b1, b2, b3, b4, b5, b6) _MDEPS_CREATE5(b1, b2, b3, b4, b5) | _MDEPS_CREATE1(b6) +#define _MDEPS_CREATE7(b1, b2, b3, b4, b5, b6, b7) _MDEPS_CREATE6(b1, b2, b3, b4, b5, b6) | _MDEPS_CREATE1(b7) +#define _MDEPS_CREATE8(b1, b2, b3, b4, b5, b6, b7, b8) _MDEPS_CREATE7(b1, b2, b3, b4, b5, b6, b7) | _MDEPS_CREATE1(b8) +#define _MDEPS_CREATE9(b1, b2, b3, b4, b5, b6, b7, b8, b9) _MDEPS_CREATE8(b1, b2, b3, b4, b5, b6, b7, b8) | _MDEPS_CREATE1(b9) +#define _MDEPS_CREATE10(b1, b2, b3, b4, b5, b6, b7, b8, b9, b10) _MDEPS_CREATE9(b1, b2, b3, b4, b5, b6, b7, b8, b9) | _MDEPS_CREATE1(b10) +#define _MDEPS_CREATE19(b1, b2, b3, b4, b5, b6, b7, b8, b9, b10, b11, b12, b13, b14, b15, b16, b17, b18, b19) _MDEPS_CREATE10(b1, b2, b3, b4, b5, b6, b7, b8, b9, b10) | _MDEPS_CREATE9(b11, b12, b13, b14, b15, b16, b17, b18, b19) + +#define MDEPS_CREATE(buff_name, ...) [_BUFFER_INDEX(buff_name)] = VA_NARGS_CALL_OVERLOAD(_MDEPS_CREATE, __VA_ARGS__) + +#define _MDEPS_CREATE_MAP1(a) g_buffer_desps[_BUFFER_INDEX(a)] +#define _MDEPS_CREATE_MAP2(a, b) _MDEPS_CREATE_MAP1(a) | _MDEPS_CREATE_MAP1(b) +#define _MDEPS_CREATE_MAP3(a, b, c) _MDEPS_CREATE_MAP2(a, b) | _MDEPS_CREATE_MAP1(c) +#define _MDEPS_CREATE_MAP4(a, b, c, d) _MDEPS_CREATE_MAP3(a, b, c) | _MDEPS_CREATE_MAP1(d) +#define _MDEPS_CREATE_MAP5(a, b, c, d, e) _MDEPS_CREATE_MAP4(a, b, c, d) | _MDEPS_CREATE_MAP1(e) +#define _MDEPS_CREATE_MAP6(a, b, c, d, e, f) _MDEPS_CREATE_MAP5(a, b, c, d, e) | _MDEPS_CREATE_MAP1(f) +#define _MDEPS_CREATE_MAP7(a, b, c, d, e, f, g) _MDEPS_CREATE_MAP6(a, b, c, d, e, f) | _MDEPS_CREATE_MAP1(g) +#define _MDEPS_CREATE_MAP8(a, b, c, d, e, f, g, h) _MDEPS_CREATE_MAP7(a, b, c, d, e, f, g) | _MDEPS_CREATE_MAP1(h) +#define _MDEPS_CREATE_MAP9(a, b, c, d, e, f, g, h, i) _MDEPS_CREATE_MAP8(a, b, c, d, e, f, g, h) | _MDEPS_CREATE_MAP1(i) +#define _MDEPS_CREATE_MAP10(a, b, c, d, e, f, g, h, i, j) _MDEPS_CREATE_MAP9(a, b, c, d, e, f, g, h, i) | _MDEPS_CREATE_MAP1(j) + +#define MDEPS_CREATE_MAP(...) VA_NARGS_CALL_OVERLOAD(_MDEPS_CREATE_MAP, __VA_ARGS__) + +#ifndef NDEBUG +# define _MDEPS_ASSERT2(b, name) \ + g_buffer_desps_d[_BUFFER_INDEX(name)] |= _MDEPS_CREATE1(b); \ + BLI_assert(g_buffer_desps[_BUFFER_INDEX(name)] & _MDEPS_CREATE1(b)) +# define _MDEPS_ASSERT3(b, n1, n2) _MDEPS_ASSERT2(b, n1); _MDEPS_ASSERT2(b, n2) +# define _MDEPS_ASSERT4(b, n1, n2, n3) _MDEPS_ASSERT3(b, n1, n2); _MDEPS_ASSERT2(b, n3) +# define _MDEPS_ASSERT5(b, n1, n2, n3, n4) _MDEPS_ASSERT4(b, n1, n2, n3); _MDEPS_ASSERT2(b, n4) +# define _MDEPS_ASSERT6(b, n1, n2, n3, n4, n5) _MDEPS_ASSERT5(b, n1, n2, n3, n4); _MDEPS_ASSERT2(b, n5) +# define _MDEPS_ASSERT7(b, n1, n2, n3, n4, n5, n6) _MDEPS_ASSERT6(b, n1, n2, n3, n4, n5); _MDEPS_ASSERT2(b, n6) +# define _MDEPS_ASSERT8(b, n1, n2, n3, n4, n5, n6, n7) _MDEPS_ASSERT7(b, n1, n2, n3, n4, n5, n6); _MDEPS_ASSERT2(b, n7) + +# define MDEPS_ASSERT(...) VA_NARGS_CALL_OVERLOAD(_MDEPS_ASSERT, __VA_ARGS__) +# define MDEPS_ASSERT_MAP(name) BLI_assert(g_buffer_desps_d[_BUFFER_INDEX(name)] == g_buffer_desps[_BUFFER_INDEX(name)]) +#else +# define MDEPS_ASSERT(...) +# define MDEPS_ASSERT_MAP(name) +#endif + +/* clang-format on */ + +static const DRWBatchFlag g_buffer_desps[] = { + MDEPS_CREATE(vbo.pos_nor, + batch.surface, + batch.surface_weights, + batch.edit_triangles, + batch.edit_vertices, + batch.edit_edges, + batch.edit_vnor, + batch.edit_lnor, + batch.edit_mesh_analysis, + batch.edit_selection_verts, + batch.edit_selection_edges, + batch.edit_selection_faces, + batch.all_verts, + batch.all_edges, + batch.loose_edges, + batch.edge_detection, + batch.wire_edges, + batch.wire_loops, + batch.sculpt_overlays, + surface_per_mat), + MDEPS_CREATE(vbo.lnor, batch.surface, batch.edit_lnor, batch.wire_loops, surface_per_mat), + MDEPS_CREATE(vbo.edge_fac, batch.wire_edges), + MDEPS_CREATE(vbo.weights, batch.surface_weights), + MDEPS_CREATE(vbo.uv, + batch.surface, + batch.edituv_faces_stretch_area, + batch.edituv_faces_stretch_angle, + batch.edituv_faces, + batch.edituv_edges, + batch.edituv_verts, + batch.wire_loops_uvs, + surface_per_mat), + MDEPS_CREATE(vbo.tan, surface_per_mat), + MDEPS_CREATE(vbo.vcol, batch.surface, surface_per_mat), + MDEPS_CREATE(vbo.sculpt_data, batch.sculpt_overlays), + MDEPS_CREATE(vbo.orco, surface_per_mat), + MDEPS_CREATE(vbo.edit_data, batch.edit_triangles, batch.edit_edges, batch.edit_vertices), + MDEPS_CREATE(vbo.edituv_data, + batch.edituv_faces, + batch.edituv_faces_stretch_area, + batch.edituv_faces_stretch_angle, + batch.edituv_edges, + batch.edituv_verts), + MDEPS_CREATE(vbo.edituv_stretch_area, batch.edituv_faces_stretch_area), + MDEPS_CREATE(vbo.edituv_stretch_angle, batch.edituv_faces_stretch_angle), + MDEPS_CREATE(vbo.mesh_analysis, batch.edit_mesh_analysis), + MDEPS_CREATE(vbo.fdots_pos, batch.edit_fdots, batch.edit_selection_fdots), + MDEPS_CREATE(vbo.fdots_nor, batch.edit_fdots), + MDEPS_CREATE(vbo.fdots_uv, batch.edituv_fdots), + MDEPS_CREATE(vbo.fdots_edituv_data, batch.edituv_fdots), + MDEPS_CREATE(vbo.skin_roots, batch.edit_skin_roots), + MDEPS_CREATE(vbo.vert_idx, batch.edit_selection_verts), + MDEPS_CREATE(vbo.edge_idx, batch.edit_selection_edges), + MDEPS_CREATE(vbo.poly_idx, batch.edit_selection_faces), + MDEPS_CREATE(vbo.fdot_idx, batch.edit_selection_fdots), + + MDEPS_CREATE(ibo.tris, + batch.surface, + batch.surface_weights, + batch.edit_triangles, + batch.edit_lnor, + batch.edit_mesh_analysis, + batch.edit_selection_faces, + batch.sculpt_overlays), + MDEPS_CREATE(ibo.lines, + batch.edit_edges, + batch.edit_selection_edges, + batch.all_edges, + batch.wire_edges), + MDEPS_CREATE(ibo.lines_loose, batch.loose_edges), + MDEPS_CREATE(ibo.points, batch.edit_vnor, batch.edit_vertices, batch.edit_selection_verts), + MDEPS_CREATE(ibo.fdots, batch.edit_fdots, batch.edit_selection_fdots), + MDEPS_CREATE(ibo.lines_paint_mask, batch.wire_loops), + MDEPS_CREATE(ibo.lines_adjacency, batch.edge_detection), + MDEPS_CREATE(ibo.edituv_tris, + batch.edituv_faces, + batch.edituv_faces_stretch_area, + batch.edituv_faces_stretch_angle), + MDEPS_CREATE(ibo.edituv_lines, batch.edituv_edges, batch.wire_loops_uvs), + MDEPS_CREATE(ibo.edituv_points, batch.edituv_verts), + MDEPS_CREATE(ibo.edituv_fdots, batch.edituv_fdots), + + MDEPS_CREATE(tris_per_mat, surface_per_mat), +}; + +#ifndef NDEBUG +static DRWBatchFlag g_buffer_desps_d[sizeof(g_buffer_desps)] = {0}; +#endif static void mesh_batch_cache_discard_surface_batches(MeshBatchCache *cache); static void mesh_batch_cache_clear(Mesh *me); @@ -659,7 +724,7 @@ static void mesh_batch_cache_discard_shaded_tri(MeshBatchCache *cache) GPU_VERTBUF_DISCARD_SAFE(mbufcache->vbo.vcol); GPU_VERTBUF_DISCARD_SAFE(mbufcache->vbo.orco); } - DRWBatchFlag batch_map = MDEPS_CREATE_MAP(vbo_uv, vbo_tan, vbo_vcol, vbo_orco); + DRWBatchFlag batch_map = MDEPS_CREATE_MAP(vbo.uv, vbo.tan, vbo.vcol, vbo.orco); mesh_batch_cache_discard_batch(cache, batch_map); mesh_cd_layers_type_clear(&cache->cd_used); } @@ -678,16 +743,16 @@ static void mesh_batch_cache_discard_uvedit(MeshBatchCache *cache) GPU_INDEXBUF_DISCARD_SAFE(mbufcache->ibo.edituv_points); GPU_INDEXBUF_DISCARD_SAFE(mbufcache->ibo.edituv_fdots); } - DRWBatchFlag batch_map = MDEPS_CREATE_MAP(vbo_edituv_stretch_angle, - vbo_edituv_stretch_area, - vbo_uv, - vbo_edituv_data, - vbo_fdots_uv, - vbo_fdots_edituv_data, - ibo_edituv_tris, - ibo_edituv_lines, - ibo_edituv_points, - ibo_edituv_fdots); + DRWBatchFlag batch_map = MDEPS_CREATE_MAP(vbo.edituv_stretch_angle, + vbo.edituv_stretch_area, + vbo.uv, + vbo.edituv_data, + vbo.fdots_uv, + vbo.fdots_edituv_data, + ibo.edituv_tris, + ibo.edituv_lines, + ibo.edituv_points, + ibo.edituv_fdots); mesh_batch_cache_discard_batch(cache, batch_map); cache->tot_area = 0.0f; @@ -710,12 +775,12 @@ static void mesh_batch_cache_discard_uvedit_select(MeshBatchCache *cache) GPU_INDEXBUF_DISCARD_SAFE(mbufcache->ibo.edituv_points); GPU_INDEXBUF_DISCARD_SAFE(mbufcache->ibo.edituv_fdots); } - DRWBatchFlag batch_map = MDEPS_CREATE_MAP(vbo_edituv_data, - vbo_fdots_edituv_data, - ibo_edituv_tris, - ibo_edituv_lines, - ibo_edituv_points, - ibo_edituv_fdots); + DRWBatchFlag batch_map = MDEPS_CREATE_MAP(vbo.edituv_data, + vbo.fdots_edituv_data, + ibo.edituv_tris, + ibo.edituv_lines, + ibo.edituv_points, + ibo.edituv_fdots); mesh_batch_cache_discard_batch(cache, batch_map); } @@ -732,7 +797,7 @@ void DRW_mesh_batch_cache_dirty_tag(Mesh *me, eMeshBatchDirtyMode mode) GPU_VERTBUF_DISCARD_SAFE(mbufcache->vbo.edit_data); GPU_VERTBUF_DISCARD_SAFE(mbufcache->vbo.fdots_nor); } - batch_map = MDEPS_CREATE_MAP(vbo_edit_data, vbo_fdots_nor); + batch_map = MDEPS_CREATE_MAP(vbo.edit_data, vbo.fdots_nor); mesh_batch_cache_discard_batch(cache, batch_map); /* Because visible UVs depends on edit mode selection, discard topology. */ @@ -746,7 +811,7 @@ void DRW_mesh_batch_cache_dirty_tag(Mesh *me, eMeshBatchDirtyMode mode) GPU_VERTBUF_DISCARD_SAFE(mbufcache->vbo.pos_nor); GPU_VERTBUF_DISCARD_SAFE(mbufcache->vbo.lnor); } - batch_map = MDEPS_CREATE_MAP(ibo_lines_paint_mask, vbo_pos_nor, vbo_lnor); + batch_map = MDEPS_CREATE_MAP(ibo.lines_paint_mask, vbo.pos_nor, vbo.lnor); mesh_batch_cache_discard_batch(cache, batch_map); break; case BKE_MESH_BATCH_DIRTY_ALL: @@ -764,7 +829,7 @@ void DRW_mesh_batch_cache_dirty_tag(Mesh *me, eMeshBatchDirtyMode mode) GPU_VERTBUF_DISCARD_SAFE(mbufcache->vbo.edituv_data); GPU_VERTBUF_DISCARD_SAFE(mbufcache->vbo.fdots_edituv_data); } - batch_map = MDEPS_CREATE_MAP(vbo_edituv_data, vbo_fdots_edituv_data); + batch_map = MDEPS_CREATE_MAP(vbo.edituv_data, vbo.fdots_edituv_data); mesh_batch_cache_discard_batch(cache, batch_map); break; default: @@ -1299,7 +1364,7 @@ void DRW_mesh_batch_cache_create_requested(struct TaskGraph *task_graph, /* Don't check `DRW_object_is_in_edit_mode(ob)` here because it means the same mesh * may draw with edit-mesh data and regular mesh data. - * In this case the custom-data layers used wont always match in `me->runtime.batch_cache`. + * In this case the custom-data layers used won't always match in `me->runtime.batch_cache`. * If we want to display regular mesh data, we should have a separate cache for the edit-mesh. * See T77359. */ const bool is_editmode = (me->edit_mesh != NULL) && @@ -1437,7 +1502,7 @@ void DRW_mesh_batch_cache_create_requested(struct TaskGraph *task_graph, MeshBufferCache *mbufcache = &cache->final; /* Initialize batches and request VBO's & IBO's. */ - MDEPS_ASSERT(batch.surface, ibo_tris, vbo_lnor, vbo_pos_nor, vbo_uv, vbo_vcol); + MDEPS_ASSERT(batch.surface, ibo.tris, vbo.lnor, vbo.pos_nor, vbo.uv, vbo.vcol); if (DRW_batch_requested(cache->batch.surface, GPU_PRIM_TRIS)) { DRW_ibo_request(cache->batch.surface, &mbufcache->ibo.tris); /* Order matters. First ones override latest VBO's attributes. */ @@ -1450,52 +1515,52 @@ void DRW_mesh_batch_cache_create_requested(struct TaskGraph *task_graph, DRW_vbo_request(cache->batch.surface, &mbufcache->vbo.vcol); } } - MDEPS_ASSERT(batch.all_verts, vbo_pos_nor); + MDEPS_ASSERT(batch.all_verts, vbo.pos_nor); if (DRW_batch_requested(cache->batch.all_verts, GPU_PRIM_POINTS)) { DRW_vbo_request(cache->batch.all_verts, &mbufcache->vbo.pos_nor); } - MDEPS_ASSERT(batch.sculpt_overlays, ibo_tris, vbo_pos_nor, vbo_sculpt_data); + MDEPS_ASSERT(batch.sculpt_overlays, ibo.tris, vbo.pos_nor, vbo.sculpt_data); if (DRW_batch_requested(cache->batch.sculpt_overlays, GPU_PRIM_TRIS)) { DRW_ibo_request(cache->batch.sculpt_overlays, &mbufcache->ibo.tris); DRW_vbo_request(cache->batch.sculpt_overlays, &mbufcache->vbo.pos_nor); DRW_vbo_request(cache->batch.sculpt_overlays, &mbufcache->vbo.sculpt_data); } - MDEPS_ASSERT(batch.all_edges, ibo_lines, vbo_pos_nor); + MDEPS_ASSERT(batch.all_edges, ibo.lines, vbo.pos_nor); if (DRW_batch_requested(cache->batch.all_edges, GPU_PRIM_LINES)) { DRW_ibo_request(cache->batch.all_edges, &mbufcache->ibo.lines); DRW_vbo_request(cache->batch.all_edges, &mbufcache->vbo.pos_nor); } - MDEPS_ASSERT(batch.loose_edges, ibo_lines_loose, vbo_pos_nor); + MDEPS_ASSERT(batch.loose_edges, ibo.lines_loose, vbo.pos_nor); if (DRW_batch_requested(cache->batch.loose_edges, GPU_PRIM_LINES)) { DRW_ibo_request(NULL, &mbufcache->ibo.lines); DRW_ibo_request(cache->batch.loose_edges, &mbufcache->ibo.lines_loose); DRW_vbo_request(cache->batch.loose_edges, &mbufcache->vbo.pos_nor); } - MDEPS_ASSERT(batch.edge_detection, ibo_lines_adjacency, vbo_pos_nor); + MDEPS_ASSERT(batch.edge_detection, ibo.lines_adjacency, vbo.pos_nor); if (DRW_batch_requested(cache->batch.edge_detection, GPU_PRIM_LINES_ADJ)) { DRW_ibo_request(cache->batch.edge_detection, &mbufcache->ibo.lines_adjacency); DRW_vbo_request(cache->batch.edge_detection, &mbufcache->vbo.pos_nor); } - MDEPS_ASSERT(batch.surface_weights, ibo_tris, vbo_pos_nor, vbo_weights); + MDEPS_ASSERT(batch.surface_weights, ibo.tris, vbo.pos_nor, vbo.weights); if (DRW_batch_requested(cache->batch.surface_weights, GPU_PRIM_TRIS)) { DRW_ibo_request(cache->batch.surface_weights, &mbufcache->ibo.tris); DRW_vbo_request(cache->batch.surface_weights, &mbufcache->vbo.pos_nor); DRW_vbo_request(cache->batch.surface_weights, &mbufcache->vbo.weights); } - MDEPS_ASSERT(batch.wire_loops, ibo_lines_paint_mask, vbo_lnor, vbo_pos_nor); + MDEPS_ASSERT(batch.wire_loops, ibo.lines_paint_mask, vbo.lnor, vbo.pos_nor); if (DRW_batch_requested(cache->batch.wire_loops, GPU_PRIM_LINES)) { DRW_ibo_request(cache->batch.wire_loops, &mbufcache->ibo.lines_paint_mask); /* Order matters. First ones override latest VBO's attributes. */ DRW_vbo_request(cache->batch.wire_loops, &mbufcache->vbo.lnor); DRW_vbo_request(cache->batch.wire_loops, &mbufcache->vbo.pos_nor); } - MDEPS_ASSERT(batch.wire_edges, ibo_lines, vbo_pos_nor, vbo_edge_fac); + MDEPS_ASSERT(batch.wire_edges, ibo.lines, vbo.pos_nor, vbo.edge_fac); if (DRW_batch_requested(cache->batch.wire_edges, GPU_PRIM_LINES)) { DRW_ibo_request(cache->batch.wire_edges, &mbufcache->ibo.lines); DRW_vbo_request(cache->batch.wire_edges, &mbufcache->vbo.pos_nor); DRW_vbo_request(cache->batch.wire_edges, &mbufcache->vbo.edge_fac); } - MDEPS_ASSERT(batch.wire_loops_uvs, ibo_edituv_lines, vbo_uv); + MDEPS_ASSERT(batch.wire_loops_uvs, ibo.edituv_lines, vbo.uv); if (DRW_batch_requested(cache->batch.wire_loops_uvs, GPU_PRIM_LINES)) { DRW_ibo_request(cache->batch.wire_loops_uvs, &mbufcache->ibo.edituv_lines); /* For paint overlay. Active layer should have been queried. */ @@ -1503,7 +1568,7 @@ void DRW_mesh_batch_cache_create_requested(struct TaskGraph *task_graph, DRW_vbo_request(cache->batch.wire_loops_uvs, &mbufcache->vbo.uv); } } - MDEPS_ASSERT(batch.edit_mesh_analysis, ibo_tris, vbo_pos_nor, vbo_mesh_analysis); + MDEPS_ASSERT(batch.edit_mesh_analysis, ibo.tris, vbo.pos_nor, vbo.mesh_analysis); if (DRW_batch_requested(cache->batch.edit_mesh_analysis, GPU_PRIM_TRIS)) { DRW_ibo_request(cache->batch.edit_mesh_analysis, &mbufcache->ibo.tris); DRW_vbo_request(cache->batch.edit_mesh_analysis, &mbufcache->vbo.pos_nor); @@ -1511,14 +1576,8 @@ void DRW_mesh_batch_cache_create_requested(struct TaskGraph *task_graph, } /* Per Material */ - MDEPS_ASSERT(surface_per_mat, - ibo_tris_per_mat, - vbo_lnor, - vbo_pos_nor, - vbo_uv, - vbo_tan, - vbo_vcol, - vbo_orco); + MDEPS_ASSERT( + surface_per_mat, tris_per_mat, vbo.lnor, vbo.pos_nor, vbo.uv, vbo.tan, vbo.vcol, vbo.orco); for (int i = 0; i < cache->mat_len; i++) { if (DRW_batch_requested(cache->surface_per_mat[i], GPU_PRIM_TRIS)) { DRW_ibo_request(cache->surface_per_mat[i], &mbufcache->tris_per_mat[i]); @@ -1543,66 +1602,66 @@ void DRW_mesh_batch_cache_create_requested(struct TaskGraph *task_graph, mbufcache = (do_cage) ? &cache->cage : &cache->final; /* Edit Mesh */ - MDEPS_ASSERT(batch.edit_triangles, ibo_tris, vbo_pos_nor, vbo_edit_data); + MDEPS_ASSERT(batch.edit_triangles, ibo.tris, vbo.pos_nor, vbo.edit_data); if (DRW_batch_requested(cache->batch.edit_triangles, GPU_PRIM_TRIS)) { DRW_ibo_request(cache->batch.edit_triangles, &mbufcache->ibo.tris); DRW_vbo_request(cache->batch.edit_triangles, &mbufcache->vbo.pos_nor); DRW_vbo_request(cache->batch.edit_triangles, &mbufcache->vbo.edit_data); } - MDEPS_ASSERT(batch.edit_vertices, ibo_points, vbo_pos_nor, vbo_edit_data); + MDEPS_ASSERT(batch.edit_vertices, ibo.points, vbo.pos_nor, vbo.edit_data); if (DRW_batch_requested(cache->batch.edit_vertices, GPU_PRIM_POINTS)) { DRW_ibo_request(cache->batch.edit_vertices, &mbufcache->ibo.points); DRW_vbo_request(cache->batch.edit_vertices, &mbufcache->vbo.pos_nor); DRW_vbo_request(cache->batch.edit_vertices, &mbufcache->vbo.edit_data); } - MDEPS_ASSERT(batch.edit_edges, ibo_lines, vbo_pos_nor, vbo_edit_data); + MDEPS_ASSERT(batch.edit_edges, ibo.lines, vbo.pos_nor, vbo.edit_data); if (DRW_batch_requested(cache->batch.edit_edges, GPU_PRIM_LINES)) { DRW_ibo_request(cache->batch.edit_edges, &mbufcache->ibo.lines); DRW_vbo_request(cache->batch.edit_edges, &mbufcache->vbo.pos_nor); DRW_vbo_request(cache->batch.edit_edges, &mbufcache->vbo.edit_data); } - MDEPS_ASSERT(batch.edit_vnor, ibo_points, vbo_pos_nor); + MDEPS_ASSERT(batch.edit_vnor, ibo.points, vbo.pos_nor); if (DRW_batch_requested(cache->batch.edit_vnor, GPU_PRIM_POINTS)) { DRW_ibo_request(cache->batch.edit_vnor, &mbufcache->ibo.points); DRW_vbo_request(cache->batch.edit_vnor, &mbufcache->vbo.pos_nor); } - MDEPS_ASSERT(batch.edit_lnor, ibo_tris, vbo_pos_nor, vbo_lnor); + MDEPS_ASSERT(batch.edit_lnor, ibo.tris, vbo.pos_nor, vbo.lnor); if (DRW_batch_requested(cache->batch.edit_lnor, GPU_PRIM_POINTS)) { DRW_ibo_request(cache->batch.edit_lnor, &mbufcache->ibo.tris); DRW_vbo_request(cache->batch.edit_lnor, &mbufcache->vbo.pos_nor); DRW_vbo_request(cache->batch.edit_lnor, &mbufcache->vbo.lnor); } - MDEPS_ASSERT(batch.edit_fdots, ibo_fdots, vbo_fdots_pos, vbo_fdots_nor); + MDEPS_ASSERT(batch.edit_fdots, ibo.fdots, vbo.fdots_pos, vbo.fdots_nor); if (DRW_batch_requested(cache->batch.edit_fdots, GPU_PRIM_POINTS)) { DRW_ibo_request(cache->batch.edit_fdots, &mbufcache->ibo.fdots); DRW_vbo_request(cache->batch.edit_fdots, &mbufcache->vbo.fdots_pos); DRW_vbo_request(cache->batch.edit_fdots, &mbufcache->vbo.fdots_nor); } - MDEPS_ASSERT(batch.edit_skin_roots, vbo_skin_roots); + MDEPS_ASSERT(batch.edit_skin_roots, vbo.skin_roots); if (DRW_batch_requested(cache->batch.edit_skin_roots, GPU_PRIM_POINTS)) { DRW_vbo_request(cache->batch.edit_skin_roots, &mbufcache->vbo.skin_roots); } /* Selection */ - MDEPS_ASSERT(batch.edit_selection_verts, ibo_points, vbo_pos_nor, vbo_vert_idx); + MDEPS_ASSERT(batch.edit_selection_verts, ibo.points, vbo.pos_nor, vbo.vert_idx); if (DRW_batch_requested(cache->batch.edit_selection_verts, GPU_PRIM_POINTS)) { DRW_ibo_request(cache->batch.edit_selection_verts, &mbufcache->ibo.points); DRW_vbo_request(cache->batch.edit_selection_verts, &mbufcache->vbo.pos_nor); DRW_vbo_request(cache->batch.edit_selection_verts, &mbufcache->vbo.vert_idx); } - MDEPS_ASSERT(batch.edit_selection_edges, ibo_lines, vbo_pos_nor, vbo_edge_idx); + MDEPS_ASSERT(batch.edit_selection_edges, ibo.lines, vbo.pos_nor, vbo.edge_idx); if (DRW_batch_requested(cache->batch.edit_selection_edges, GPU_PRIM_LINES)) { DRW_ibo_request(cache->batch.edit_selection_edges, &mbufcache->ibo.lines); DRW_vbo_request(cache->batch.edit_selection_edges, &mbufcache->vbo.pos_nor); DRW_vbo_request(cache->batch.edit_selection_edges, &mbufcache->vbo.edge_idx); } - MDEPS_ASSERT(batch.edit_selection_faces, ibo_tris, vbo_pos_nor, vbo_poly_idx); + MDEPS_ASSERT(batch.edit_selection_faces, ibo.tris, vbo.pos_nor, vbo.poly_idx); if (DRW_batch_requested(cache->batch.edit_selection_faces, GPU_PRIM_TRIS)) { DRW_ibo_request(cache->batch.edit_selection_faces, &mbufcache->ibo.tris); DRW_vbo_request(cache->batch.edit_selection_faces, &mbufcache->vbo.pos_nor); DRW_vbo_request(cache->batch.edit_selection_faces, &mbufcache->vbo.poly_idx); } - MDEPS_ASSERT(batch.edit_selection_fdots, ibo_fdots, vbo_fdots_pos, vbo_fdot_idx); + MDEPS_ASSERT(batch.edit_selection_fdots, ibo.fdots, vbo.fdots_pos, vbo.fdot_idx); if (DRW_batch_requested(cache->batch.edit_selection_fdots, GPU_PRIM_POINTS)) { DRW_ibo_request(cache->batch.edit_selection_fdots, &mbufcache->ibo.fdots); DRW_vbo_request(cache->batch.edit_selection_fdots, &mbufcache->vbo.fdots_pos); @@ -1617,17 +1676,17 @@ void DRW_mesh_batch_cache_create_requested(struct TaskGraph *task_graph, mbufcache = (do_uvcage) ? &cache->uv_cage : &cache->final; /* Edit UV */ - MDEPS_ASSERT(batch.edituv_faces, ibo_edituv_tris, vbo_uv, vbo_edituv_data); + MDEPS_ASSERT(batch.edituv_faces, ibo.edituv_tris, vbo.uv, vbo.edituv_data); if (DRW_batch_requested(cache->batch.edituv_faces, GPU_PRIM_TRIS)) { DRW_ibo_request(cache->batch.edituv_faces, &mbufcache->ibo.edituv_tris); DRW_vbo_request(cache->batch.edituv_faces, &mbufcache->vbo.uv); DRW_vbo_request(cache->batch.edituv_faces, &mbufcache->vbo.edituv_data); } MDEPS_ASSERT(batch.edituv_faces_stretch_area, - ibo_edituv_tris, - vbo_uv, - vbo_edituv_data, - vbo_edituv_stretch_area); + ibo.edituv_tris, + vbo.uv, + vbo.edituv_data, + vbo.edituv_stretch_area); if (DRW_batch_requested(cache->batch.edituv_faces_stretch_area, GPU_PRIM_TRIS)) { DRW_ibo_request(cache->batch.edituv_faces_stretch_area, &mbufcache->ibo.edituv_tris); DRW_vbo_request(cache->batch.edituv_faces_stretch_area, &mbufcache->vbo.uv); @@ -1635,71 +1694,72 @@ void DRW_mesh_batch_cache_create_requested(struct TaskGraph *task_graph, DRW_vbo_request(cache->batch.edituv_faces_stretch_area, &mbufcache->vbo.edituv_stretch_area); } MDEPS_ASSERT(batch.edituv_faces_stretch_angle, - ibo_edituv_tris, - vbo_uv, - vbo_edituv_data, - vbo_edituv_stretch_angle); + ibo.edituv_tris, + vbo.uv, + vbo.edituv_data, + vbo.edituv_stretch_angle); if (DRW_batch_requested(cache->batch.edituv_faces_stretch_angle, GPU_PRIM_TRIS)) { DRW_ibo_request(cache->batch.edituv_faces_stretch_angle, &mbufcache->ibo.edituv_tris); DRW_vbo_request(cache->batch.edituv_faces_stretch_angle, &mbufcache->vbo.uv); DRW_vbo_request(cache->batch.edituv_faces_stretch_angle, &mbufcache->vbo.edituv_data); DRW_vbo_request(cache->batch.edituv_faces_stretch_angle, &mbufcache->vbo.edituv_stretch_angle); } - MDEPS_ASSERT(batch.edituv_edges, ibo_edituv_lines, vbo_uv, vbo_edituv_data); + MDEPS_ASSERT(batch.edituv_edges, ibo.edituv_lines, vbo.uv, vbo.edituv_data); if (DRW_batch_requested(cache->batch.edituv_edges, GPU_PRIM_LINES)) { DRW_ibo_request(cache->batch.edituv_edges, &mbufcache->ibo.edituv_lines); DRW_vbo_request(cache->batch.edituv_edges, &mbufcache->vbo.uv); DRW_vbo_request(cache->batch.edituv_edges, &mbufcache->vbo.edituv_data); } - MDEPS_ASSERT(batch.edituv_verts, ibo_edituv_points, vbo_uv, vbo_edituv_data); + MDEPS_ASSERT(batch.edituv_verts, ibo.edituv_points, vbo.uv, vbo.edituv_data); if (DRW_batch_requested(cache->batch.edituv_verts, GPU_PRIM_POINTS)) { DRW_ibo_request(cache->batch.edituv_verts, &mbufcache->ibo.edituv_points); DRW_vbo_request(cache->batch.edituv_verts, &mbufcache->vbo.uv); DRW_vbo_request(cache->batch.edituv_verts, &mbufcache->vbo.edituv_data); } - MDEPS_ASSERT(batch.edituv_fdots, ibo_edituv_fdots, vbo_fdots_uv, vbo_fdots_edituv_data); + MDEPS_ASSERT(batch.edituv_fdots, ibo.edituv_fdots, vbo.fdots_uv, vbo.fdots_edituv_data); if (DRW_batch_requested(cache->batch.edituv_fdots, GPU_PRIM_POINTS)) { DRW_ibo_request(cache->batch.edituv_fdots, &mbufcache->ibo.edituv_fdots); DRW_vbo_request(cache->batch.edituv_fdots, &mbufcache->vbo.fdots_uv); DRW_vbo_request(cache->batch.edituv_fdots, &mbufcache->vbo.fdots_edituv_data); } - MDEPS_ASSERT_MAP(vbo_lnor); - MDEPS_ASSERT_MAP(vbo_pos_nor); - MDEPS_ASSERT_MAP(vbo_uv); - MDEPS_ASSERT_MAP(vbo_vcol); - MDEPS_ASSERT_MAP(vbo_sculpt_data); - MDEPS_ASSERT_MAP(vbo_weights); - MDEPS_ASSERT_MAP(vbo_edge_fac); - MDEPS_ASSERT_MAP(vbo_mesh_analysis); - MDEPS_ASSERT_MAP(vbo_tan); - MDEPS_ASSERT_MAP(vbo_orco); - MDEPS_ASSERT_MAP(vbo_edit_data); - MDEPS_ASSERT_MAP(vbo_fdots_pos); - MDEPS_ASSERT_MAP(vbo_fdots_nor); - MDEPS_ASSERT_MAP(vbo_skin_roots); - MDEPS_ASSERT_MAP(vbo_vert_idx); - MDEPS_ASSERT_MAP(vbo_edge_idx); - MDEPS_ASSERT_MAP(vbo_poly_idx); - MDEPS_ASSERT_MAP(vbo_fdot_idx); - MDEPS_ASSERT_MAP(vbo_edituv_data); - MDEPS_ASSERT_MAP(vbo_edituv_stretch_area); - MDEPS_ASSERT_MAP(vbo_edituv_stretch_angle); - MDEPS_ASSERT_MAP(vbo_fdots_uv); - MDEPS_ASSERT_MAP(vbo_fdots_edituv_data); - - MDEPS_ASSERT_MAP(ibo_tris); - MDEPS_ASSERT_MAP(ibo_lines); - MDEPS_ASSERT_MAP(ibo_lines_loose); - MDEPS_ASSERT_MAP(ibo_lines_adjacency); - MDEPS_ASSERT_MAP(ibo_lines_paint_mask); - MDEPS_ASSERT_MAP(ibo_tris_per_mat); - MDEPS_ASSERT_MAP(ibo_points); - MDEPS_ASSERT_MAP(ibo_fdots); - MDEPS_ASSERT_MAP(ibo_edituv_tris); - MDEPS_ASSERT_MAP(ibo_edituv_lines); - MDEPS_ASSERT_MAP(ibo_edituv_points); - MDEPS_ASSERT_MAP(ibo_edituv_fdots); + MDEPS_ASSERT_MAP(vbo.lnor); + MDEPS_ASSERT_MAP(vbo.pos_nor); + MDEPS_ASSERT_MAP(vbo.uv); + MDEPS_ASSERT_MAP(vbo.vcol); + MDEPS_ASSERT_MAP(vbo.sculpt_data); + MDEPS_ASSERT_MAP(vbo.weights); + MDEPS_ASSERT_MAP(vbo.edge_fac); + MDEPS_ASSERT_MAP(vbo.mesh_analysis); + MDEPS_ASSERT_MAP(vbo.tan); + MDEPS_ASSERT_MAP(vbo.orco); + MDEPS_ASSERT_MAP(vbo.edit_data); + MDEPS_ASSERT_MAP(vbo.fdots_pos); + MDEPS_ASSERT_MAP(vbo.fdots_nor); + MDEPS_ASSERT_MAP(vbo.skin_roots); + MDEPS_ASSERT_MAP(vbo.vert_idx); + MDEPS_ASSERT_MAP(vbo.edge_idx); + MDEPS_ASSERT_MAP(vbo.poly_idx); + MDEPS_ASSERT_MAP(vbo.fdot_idx); + MDEPS_ASSERT_MAP(vbo.edituv_data); + MDEPS_ASSERT_MAP(vbo.edituv_stretch_area); + MDEPS_ASSERT_MAP(vbo.edituv_stretch_angle); + MDEPS_ASSERT_MAP(vbo.fdots_uv); + MDEPS_ASSERT_MAP(vbo.fdots_edituv_data); + + MDEPS_ASSERT_MAP(ibo.tris); + MDEPS_ASSERT_MAP(ibo.lines); + MDEPS_ASSERT_MAP(ibo.lines_loose); + MDEPS_ASSERT_MAP(ibo.lines_adjacency); + MDEPS_ASSERT_MAP(ibo.lines_paint_mask); + MDEPS_ASSERT_MAP(ibo.points); + MDEPS_ASSERT_MAP(ibo.fdots); + MDEPS_ASSERT_MAP(ibo.edituv_tris); + MDEPS_ASSERT_MAP(ibo.edituv_lines); + MDEPS_ASSERT_MAP(ibo.edituv_points); + MDEPS_ASSERT_MAP(ibo.edituv_fdots); + + MDEPS_ASSERT_MAP(tris_per_mat); /* Meh loose Scene const correctness here. */ const bool use_subsurf_fdots = scene ? BKE_modifiers_uses_subsurf_facedots(scene, ob) : false; diff --git a/source/blender/draw/intern/draw_common.h b/source/blender/draw/intern/draw_common.h index 6e3a73a8314..7e6e1f03f8a 100644 --- a/source/blender/draw/intern/draw_common.h +++ b/source/blender/draw/intern/draw_common.h @@ -142,8 +142,8 @@ typedef struct GlobalsUboStorage { float colorUVShadow[4]; /* NOTE! Put all color before UBO_LAST_COLOR */ - float screenVecs[2][4]; /* padded as vec4 */ - float sizeViewport[2], sizeViewportInv[2]; /* packed as vec4 in glsl */ + float screenVecs[2][4]; /* Padded as vec4. */ + float sizeViewport[2], sizeViewportInv[2]; /* Packed as vec4 in GLSL. */ /* Pack individual float at the end of the buffer to avoid alignment errors */ float sizePixel, pixelFac; @@ -190,7 +190,7 @@ void DRW_hair_free(void); /* draw_fluid.c */ -/* Fluid simulation. */ +/* Fluid simulation. */ void DRW_smoke_ensure(struct FluidModifierData *fmd, int highres); void DRW_smoke_ensure_coba_field(struct FluidModifierData *fmd); void DRW_smoke_ensure_velocity(struct FluidModifierData *fmd); @@ -206,7 +206,7 @@ struct DRW_Global { * Add needed theme colors / values to DRW_globals_update() and update UBO * Not needed for constant color. */ GlobalsUboStorage block; - /** Define "globalsBlock" uniform for 'block'. */ + /** Define "globalsBlock" uniform for 'block'. */ struct GPUUniformBuf *block_ubo; struct GPUTexture *ramp; diff --git a/source/blender/draw/intern/draw_hair.c b/source/blender/draw/intern/draw_hair.c index 585e171adc5..d101df737ff 100644 --- a/source/blender/draw/intern/draw_hair.c +++ b/source/blender/draw/intern/draw_hair.c @@ -43,26 +43,26 @@ #include "GPU_vertex_buffer.h" #include "draw_hair_private.h" +#include "draw_shader.h" #ifndef __APPLE__ # define USE_TRANSFORM_FEEDBACK # define USE_COMPUTE_SHADERS #endif -BLI_INLINE bool drw_hair_use_compute_shaders(void) +BLI_INLINE eParticleRefineShaderType drw_hair_shader_type_get(void) { #ifdef USE_COMPUTE_SHADERS - return GPU_compute_shader_support(); -#else - return false; + if (GPU_compute_shader_support()) { + return PART_REFINE_SHADER_COMPUTE; + } #endif +#ifdef USE_TRANSFORM_FEEDBACK + return PART_REFINE_SHADER_TRANSFORM_FEEDBACK; +#endif + return PART_REFINE_SHADER_TRANSFORM_FEEDBACK_WORKAROUND; } -typedef enum ParticleRefineShader { - PART_REFINE_CATMULL_ROM = 0, - PART_REFINE_MAX_SHADER, -} ParticleRefineShader; - #ifndef USE_TRANSFORM_FEEDBACK typedef struct ParticleRefineCall { struct ParticleRefineCall *next; @@ -79,89 +79,11 @@ static int g_tf_target_height; static GPUVertBuf *g_dummy_vbo = NULL; static GPUTexture *g_dummy_texture = NULL; -static GPUShader *g_refine_shaders[PART_REFINE_MAX_SHADER] = {NULL}; static DRWPass *g_tf_pass; /* XXX can be a problem with multiple DRWManager in the future */ -extern char datatoc_common_hair_lib_glsl[]; -extern char datatoc_common_hair_refine_vert_glsl[]; -extern char datatoc_common_hair_refine_comp_glsl[]; -extern char datatoc_gpu_shader_3D_smooth_color_frag_glsl[]; - -/* TODO(jbakker): move shader creation to `draw_shaders` and add test cases. */ -/* TODO(jbakker): replace defines with `constexpr` to check compilation on all OS's. - * Currently the `__APPLE__` code-path does not compile on other platforms and vice versa. */ -#ifdef USE_COMPUTE_SHADERS -static GPUShader *hair_refine_shader_compute_create(ParticleRefineShader UNUSED(refinement)) -{ - GPUShader *sh = NULL; - sh = GPU_shader_create_compute(datatoc_common_hair_refine_comp_glsl, - datatoc_common_hair_lib_glsl, - "#define HAIR_PHASE_SUBDIV\n", - __func__); - return sh; -} -#endif - -#ifdef USE_TRANSFORM_FEEDBACK -static GPUShader *hair_refine_shader_transform_feedback_create( - ParticleRefineShader UNUSED(refinement)) -{ - GPUShader *sh = NULL; - - char *shader_src = BLI_string_joinN(datatoc_common_hair_lib_glsl, - datatoc_common_hair_refine_vert_glsl); - const char *var_names[1] = {"finalColor"}; - sh = DRW_shader_create_with_transform_feedback( - shader_src, NULL, "#define HAIR_PHASE_SUBDIV\n", GPU_SHADER_TFB_POINTS, var_names, 1); - MEM_freeN(shader_src); - - return sh; -} -#endif - -static GPUShader *hair_refine_shader_transform_feedback_workaround_create( - ParticleRefineShader UNUSED(refinement)) -{ - GPUShader *sh = NULL; - - char *shader_src = BLI_string_joinN(datatoc_common_hair_lib_glsl, - datatoc_common_hair_refine_vert_glsl); - sh = DRW_shader_create(shader_src, - NULL, - datatoc_gpu_shader_3D_smooth_color_frag_glsl, - "#define blender_srgb_to_framebuffer_space(a) a\n" - "#define HAIR_PHASE_SUBDIV\n" - "#define TF_WORKAROUND\n"); - MEM_freeN(shader_src); - - return sh; -} - static GPUShader *hair_refine_shader_get(ParticleRefineShader refinement) { - if (g_refine_shaders[refinement]) { - return g_refine_shaders[refinement]; - } - -#ifdef USE_COMPUTE_SHADERS - if (drw_hair_use_compute_shaders()) { - g_refine_shaders[refinement] = hair_refine_shader_compute_create(refinement); - if (g_refine_shaders[refinement]) { - return g_refine_shaders[refinement]; - } - } -#endif - -#ifdef USE_TRANSFORM_FEEDBACK - g_refine_shaders[refinement] = hair_refine_shader_transform_feedback_create(refinement); - if (g_refine_shaders[refinement]) { - return g_refine_shaders[refinement]; - } -#endif - - g_refine_shaders[refinement] = hair_refine_shader_transform_feedback_workaround_create( - refinement); - return g_refine_shaders[refinement]; + return DRW_shader_hair_refine_get(refinement, drw_hair_shader_type_get()); } void DRW_hair_init(void) @@ -265,7 +187,7 @@ static ParticleHairCache *drw_hair_particle_cache_get( } if (update) { - if (drw_hair_use_compute_shaders()) { + if (drw_hair_shader_type_get() == PART_REFINE_SHADER_COMPUTE) { drw_hair_particle_cache_update_compute(cache, subdiv); } else { @@ -473,7 +395,7 @@ void DRW_hair_update(void) #else /* Just render the pass when using compute shaders or transform feedback. */ DRW_draw_pass(g_tf_pass); - if (drw_hair_use_compute_shaders()) { + if (drw_hair_shader_type_get() == PART_REFINE_SHADER_COMPUTE) { GPU_memory_barrier(GPU_BARRIER_SHADER_STORAGE); } #endif @@ -481,10 +403,6 @@ void DRW_hair_update(void) void DRW_hair_free(void) { - for (int i = 0; i < PART_REFINE_MAX_SHADER; i++) { - DRW_SHADER_FREE_SAFE(g_refine_shaders[i]); - } - GPU_VERTBUF_DISCARD_SAFE(g_dummy_vbo); DRW_TEXTURE_FREE_SAFE(g_dummy_texture); } diff --git a/source/blender/draw/intern/draw_hair_private.h b/source/blender/draw/intern/draw_hair_private.h index 28bd5d4dfb5..1f58d8d0ead 100644 --- a/source/blender/draw/intern/draw_hair_private.h +++ b/source/blender/draw/intern/draw_hair_private.h @@ -23,11 +23,20 @@ #pragma once +#ifdef __cplusplus +extern "C" { +#endif + #define MAX_LAYER_NAME_CT 4 /* u0123456789, u, au, a0123456789 */ #define MAX_LAYER_NAME_LEN (GPU_MAX_SAFE_ATTR_NAME + 2) #define MAX_THICKRES 2 /* see eHairType */ #define MAX_HAIR_SUBDIV 4 /* see hair_subdiv rna */ +typedef enum ParticleRefineShader { + PART_REFINE_CATMULL_ROM = 0, + PART_REFINE_MAX_SHADER, +} ParticleRefineShader; + struct ModifierData; struct Object; struct ParticleHairCache; @@ -91,3 +100,7 @@ bool hair_ensure_procedural_data(struct Object *object, struct ParticleHairCache **r_hair_cache, int subdiv, int thickness_res); + +#ifdef __cplusplus +} +#endif diff --git a/source/blender/draw/intern/draw_manager.c b/source/blender/draw/intern/draw_manager.c index 37f6bbf52b5..3ba89a1a91e 100644 --- a/source/blender/draw/intern/draw_manager.c +++ b/source/blender/draw/intern/draw_manager.c @@ -87,6 +87,7 @@ #include "draw_manager_profiling.h" #include "draw_manager_testing.h" #include "draw_manager_text.h" +#include "draw_shader.h" /* only for callbacks */ #include "draw_cache_impl.h" @@ -2089,7 +2090,7 @@ void DRW_draw_render_loop_2d_ex(struct Depsgraph *depsgraph, drw_viewport_colormanagement_set(); /* TODO(jbakker): Only populate when editor needs to draw object. - * for the image editor this is when showing UV's.*/ + * for the image editor this is when showing UV's. */ const bool do_populate_loop = (DST.draw_ctx.space_data->spacetype == SPACE_IMAGE); const bool do_annotations = drw_draw_show_annotation(); const bool do_draw_gizmos = (DST.draw_ctx.space_data->spacetype != SPACE_IMAGE); @@ -2987,6 +2988,7 @@ void DRW_engines_free(void) DRW_TEXTURE_FREE_SAFE(g_select_buffer.texture_depth); GPU_FRAMEBUFFER_FREE_SAFE(g_select_buffer.framebuffer_depth_only); + DRW_shaders_free(); DRW_hair_free(); DRW_shape_cache_free(); DRW_stats_free(); diff --git a/source/blender/draw/intern/draw_manager.h b/source/blender/draw/intern/draw_manager.h index d4e22c83798..373b51a67e0 100644 --- a/source/blender/draw/intern/draw_manager.h +++ b/source/blender/draw/intern/draw_manager.h @@ -172,9 +172,9 @@ typedef struct DRWObjectInfos { float orcotexfac[2][4]; float ob_color[4]; float ob_index; - float pad; /* UNUSED*/ + float pad; /*UNUSED*/ float ob_random; - float ob_flag; /* sign is negative scaling, */ + float ob_flag; /* Sign is negative scaling. */ } DRWObjectInfos; BLI_STATIC_ASSERT_ALIGN(DRWObjectMatrix, 16) diff --git a/source/blender/draw/intern/draw_manager_data.c b/source/blender/draw/intern/draw_manager_data.c index 29ce8b7510c..4a6b16797c2 100644 --- a/source/blender/draw/intern/draw_manager_data.c +++ b/source/blender/draw/intern/draw_manager_data.c @@ -1586,8 +1586,8 @@ static void draw_frustum_culling_planes_calc(const float (*persmat)[4], float (* planes_from_projmat(persmat, frustum_planes[0], frustum_planes[5], - frustum_planes[3], frustum_planes[1], + frustum_planes[3], frustum_planes[4], frustum_planes[2]); @@ -2131,8 +2131,8 @@ void DRW_pass_sort_shgroup_z(DRWPass *pass) } } } - /* To be sorted a shgroup needs to have at least one draw command. */ - /* FIXME(fclem) In some case, we can still have empty shading group to sort. However their + /* To be sorted a shgroup needs to have at least one draw command. */ + /* FIXME(fclem): In some case, we can still have empty shading group to sort. However their * final order is not well defined. * (see T76730 & D7729). */ // BLI_assert(handle != 0); diff --git a/source/blender/draw/intern/draw_shader.c b/source/blender/draw/intern/draw_shader.c new file mode 100644 index 00000000000..9c756065353 --- /dev/null +++ b/source/blender/draw/intern/draw_shader.c @@ -0,0 +1,122 @@ +/* + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * Copyright 2020, Blender Foundation. + */ + +/** \file + * \ingroup draw_engine + */ + +#include "DRW_render.h" + +#include "BLI_dynstr.h" +#include "BLI_string_utils.h" + +#include "GPU_batch.h" +#include "GPU_index_buffer.h" +#include "GPU_vertex_buffer.h" + +#include "draw_shader.h" + +extern char datatoc_common_hair_lib_glsl[]; + +extern char datatoc_common_hair_refine_vert_glsl[]; +extern char datatoc_common_hair_refine_comp_glsl[]; +extern char datatoc_gpu_shader_3D_smooth_color_frag_glsl[]; + +static struct { + struct GPUShader *hair_refine_sh[PART_REFINE_MAX_SHADER]; +} e_data = {{NULL}}; + +/* -------------------------------------------------------------------- */ +/** \name Hair refinement + * \{ */ + +static GPUShader *hair_refine_shader_compute_create(ParticleRefineShader UNUSED(refinement)) +{ + GPUShader *sh = NULL; + sh = GPU_shader_create_compute(datatoc_common_hair_refine_comp_glsl, + datatoc_common_hair_lib_glsl, + "#define HAIR_PHASE_SUBDIV\n", + __func__); + return sh; +} + +static GPUShader *hair_refine_shader_transform_feedback_create( + ParticleRefineShader UNUSED(refinement)) +{ + GPUShader *sh = NULL; + + char *shader_src = BLI_string_joinN(datatoc_common_hair_lib_glsl, + datatoc_common_hair_refine_vert_glsl); + const char *var_names[1] = {"finalColor"}; + sh = DRW_shader_create_with_transform_feedback( + shader_src, NULL, "#define HAIR_PHASE_SUBDIV\n", GPU_SHADER_TFB_POINTS, var_names, 1); + MEM_freeN(shader_src); + + return sh; +} + +static GPUShader *hair_refine_shader_transform_feedback_workaround_create( + ParticleRefineShader UNUSED(refinement)) +{ + GPUShader *sh = NULL; + + char *shader_src = BLI_string_joinN(datatoc_common_hair_lib_glsl, + datatoc_common_hair_refine_vert_glsl); + sh = DRW_shader_create(shader_src, + NULL, + datatoc_gpu_shader_3D_smooth_color_frag_glsl, + "#define blender_srgb_to_framebuffer_space(a) a\n" + "#define HAIR_PHASE_SUBDIV\n" + "#define TF_WORKAROUND\n"); + MEM_freeN(shader_src); + + return sh; +} + +GPUShader *DRW_shader_hair_refine_get(ParticleRefineShader refinement, + eParticleRefineShaderType sh_type) +{ + if (e_data.hair_refine_sh[refinement] == NULL) { + GPUShader *sh = NULL; + switch (sh_type) { + case PART_REFINE_SHADER_COMPUTE: + sh = hair_refine_shader_compute_create(refinement); + break; + case PART_REFINE_SHADER_TRANSFORM_FEEDBACK: + sh = hair_refine_shader_transform_feedback_create(refinement); + break; + case PART_REFINE_SHADER_TRANSFORM_FEEDBACK_WORKAROUND: + sh = hair_refine_shader_transform_feedback_workaround_create(refinement); + break; + default: + BLI_assert(!"Incorrect shader type"); + } + e_data.hair_refine_sh[refinement] = sh; + } + + return e_data.hair_refine_sh[refinement]; +} + +/** \} */ + +void DRW_shaders_free(void) +{ + for (int i = 0; i < PART_REFINE_MAX_SHADER; i++) { + DRW_SHADER_FREE_SAFE(e_data.hair_refine_sh[i]); + } +} diff --git a/source/blender/draw/intern/draw_shader.h b/source/blender/draw/intern/draw_shader.h new file mode 100644 index 00000000000..f9fa452671b --- /dev/null +++ b/source/blender/draw/intern/draw_shader.h @@ -0,0 +1,47 @@ +/* + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2021 by Blender Foundation. + * All rights reserved. + */ + +/** \file + * \ingroup draw + */ + +#pragma once + +#include "draw_hair_private.h" + +#ifdef __cplusplus +extern "C" { +#endif + +struct GPUShader; + +typedef enum eParticleRefineShaderType { + PART_REFINE_SHADER_TRANSFORM_FEEDBACK, + PART_REFINE_SHADER_TRANSFORM_FEEDBACK_WORKAROUND, + PART_REFINE_SHADER_COMPUTE, +} eParticleRefineShaderType; + +/* draw_shader.c */ +struct GPUShader *DRW_shader_hair_refine_get(ParticleRefineShader refinement, + eParticleRefineShaderType sh_type); +void DRW_shaders_free(void); + +#ifdef __cplusplus +} +#endif diff --git a/source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_lines_adjacency.cc b/source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_lines_adjacency.cc index 35b60002c1f..43ad28c2618 100644 --- a/source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_lines_adjacency.cc +++ b/source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_lines_adjacency.cc @@ -153,7 +153,7 @@ static void extract_lines_adjacency_finish(const MeshRenderData *UNUSED(mr), if (v_data != NO_EDGE) { BLI_edgehashIterator_getKey(ehi, &v2, &v3); l1 = (uint)abs(v_data) - 1; - if (v_data < 0) { /* inv_opposite */ + if (v_data < 0) { /* `inv_opposite`. */ SWAP(uint, v2, v3); } l2 = data->vert_to_loop[v2]; diff --git a/source/blender/draw/tests/shaders_test.cc b/source/blender/draw/tests/shaders_test.cc index c96f22859ca..cce69714f5e 100644 --- a/source/blender/draw/tests/shaders_test.cc +++ b/source/blender/draw/tests/shaders_test.cc @@ -3,17 +3,22 @@ #include "testing/testing.h" #include "draw_testing.hh" -#include "intern/draw_manager_testing.h" #include "GPU_context.h" +#include "GPU_index_buffer.h" #include "GPU_init_exit.h" #include "GPU_shader.h" +#include "GPU_texture.h" +#include "GPU_vertex_buffer.h" + +#include "intern/draw_manager_testing.h" #include "engines/eevee/eevee_private.h" #include "engines/gpencil/gpencil_engine.h" #include "engines/image/image_private.h" #include "engines/overlay/overlay_private.h" #include "engines/workbench/workbench_private.h" +#include "intern/draw_shader.h" namespace blender::draw { @@ -366,4 +371,20 @@ TEST_F(DrawTest, eevee_glsl_shaders_static) EEVEE_shaders_free(); } +static void test_draw_shaders(eParticleRefineShaderType sh_type) +{ + DRW_shaders_free(); + EXPECT_NE(DRW_shader_hair_refine_get(PART_REFINE_CATMULL_ROM, sh_type), nullptr); + DRW_shaders_free(); +} + +TEST_F(DrawTest, draw_glsl_shaders) +{ +#ifndef __APPLE__ + test_draw_shaders(PART_REFINE_SHADER_TRANSFORM_FEEDBACK); + test_draw_shaders(PART_REFINE_SHADER_COMPUTE); +#endif + test_draw_shaders(PART_REFINE_SHADER_TRANSFORM_FEEDBACK_WORKAROUND); +} + } // namespace blender::draw diff --git a/source/blender/editors/animation/anim_channels_defines.c b/source/blender/editors/animation/anim_channels_defines.c index 0b587191807..f69830fc015 100644 --- a/source/blender/editors/animation/anim_channels_defines.c +++ b/source/blender/editors/animation/anim_channels_defines.c @@ -502,7 +502,7 @@ static bool acf_summary_setting_valid(bAnimContext *UNUSED(ac), return (setting == ACHANNEL_SETTING_EXPAND); } -/* get the appropriate flag(s) for the setting when it is valid */ +/* Get the appropriate flag(s) for the setting when it is valid. */ static int acf_summary_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Settings setting, bool *neg) @@ -595,7 +595,7 @@ static bool acf_scene_setting_valid(bAnimContext *ac, } } -/* get the appropriate flag(s) for the setting when it is valid */ +/* Get the appropriate flag(s) for the setting when it is valid. */ static int acf_scene_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Settings setting, bool *neg) @@ -766,7 +766,7 @@ static bool acf_object_setting_valid(bAnimContext *ac, } } -/* get the appropriate flag(s) for the setting when it is valid */ +/* Get the appropriate flag(s) for the setting when it is valid. */ static int acf_object_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Settings setting, bool *neg) @@ -949,7 +949,7 @@ static bool acf_group_setting_valid(bAnimContext *ac, } } -/* get the appropriate flag(s) for the setting when it is valid */ +/* Get the appropriate flag(s) for the setting when it is valid. */ static int acf_group_setting_flag(bAnimContext *ac, eAnimChannel_Settings setting, bool *neg) { /* clear extra return data first */ @@ -1086,7 +1086,7 @@ static bool acf_fcurve_setting_valid(bAnimContext *ac, } } -/* get the appropriate flag(s) for the setting when it is valid */ +/* Get the appropriate flag(s) for the setting when it is valid. */ static int acf_fcurve_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Settings setting, bool *neg) @@ -1212,7 +1212,7 @@ static bool acf_nla_controls_setting_valid(bAnimContext *UNUSED(ac), } } -/* get the appropriate flag(s) for the setting when it is valid */ +/* Get the appropriate flag(s) for the setting when it is valid. */ static int acf_nla_controls_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Settings setting, bool *neg) @@ -1330,7 +1330,7 @@ static bool acf_fillactd_setting_valid(bAnimContext *UNUSED(ac), } } -/* get the appropriate flag(s) for the setting when it is valid */ +/* Get the appropriate flag(s) for the setting when it is valid. */ static int acf_fillactd_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Settings setting, bool *neg) @@ -1425,7 +1425,7 @@ static bool acf_filldrivers_setting_valid(bAnimContext *UNUSED(ac), } } -/* get the appropriate flag(s) for the setting when it is valid */ +/* Get the appropriate flag(s) for the setting when it is valid. */ static int acf_filldrivers_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Settings setting, bool *neg) @@ -1489,7 +1489,7 @@ static int acf_dsmat_icon(bAnimListElem *UNUSED(ale)) return ICON_MATERIAL_DATA; } -/* get the appropriate flag(s) for the setting when it is valid */ +/* Get the appropriate flag(s) for the setting when it is valid. */ static int acf_dsmat_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Settings setting, bool *neg) @@ -1568,7 +1568,7 @@ static int acf_dslight_icon(bAnimListElem *UNUSED(ale)) return ICON_LIGHT_DATA; } -/* get the appropriate flag(s) for the setting when it is valid */ +/* Get the appropriate flag(s) for the setting when it is valid. */ static int acf_dslight_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Settings setting, bool *neg) @@ -1656,7 +1656,7 @@ static short acf_dstex_offset(bAnimContext *UNUSED(ac), bAnimListElem *UNUSED(al return 14; /* XXX: simply include this in indention instead? */ } -/* get the appropriate flag(s) for the setting when it is valid */ +/* Get the appropriate flag(s) for the setting when it is valid. */ static int acf_dstex_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Settings setting, bool *neg) @@ -1736,7 +1736,7 @@ static int acf_dscachefile_icon(bAnimListElem *ale) return ICON_FILE; } -/* get the appropriate flag(s) for the setting when it is valid */ +/* Get the appropriate flag(s) for the setting when it is valid. */ static int acf_dscachefile_setting_flag(bAnimContext *ac, eAnimChannel_Settings setting, bool *neg) { /* clear extra return data first */ @@ -1818,7 +1818,7 @@ static int acf_dscam_icon(bAnimListElem *UNUSED(ale)) return ICON_CAMERA_DATA; } -/* get the appropriate flag(s) for the setting when it is valid */ +/* Get the appropriate flag(s) for the setting when it is valid. */ static int acf_dscam_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Settings setting, bool *neg) @@ -1911,7 +1911,7 @@ static int acf_dscur_icon(bAnimListElem *ale) } } -/* get the appropriate flag(s) for the setting when it is valid */ +/* Get the appropriate flag(s) for the setting when it is valid. */ static int acf_dscur_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Settings setting, bool *neg) @@ -2009,7 +2009,7 @@ static bool acf_dsskey_setting_valid(bAnimContext *ac, } } -/* get the appropriate flag(s) for the setting when it is valid */ +/* Get the appropriate flag(s) for the setting when it is valid. */ static int acf_dsskey_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Settings setting, bool *neg) @@ -2088,7 +2088,7 @@ static int acf_dswor_icon(bAnimListElem *UNUSED(ale)) return ICON_WORLD_DATA; } -/* get the appropriate flag(s) for the setting when it is valid */ +/* Get the appropriate flag(s) for the setting when it is valid. */ static int acf_dswor_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Settings setting, bool *neg) @@ -2167,7 +2167,7 @@ static int acf_dspart_icon(bAnimListElem *UNUSED(ale)) return ICON_PARTICLE_DATA; } -/* get the appropriate flag(s) for the setting when it is valid */ +/* Get the appropriate flag(s) for the setting when it is valid. */ static int acf_dspart_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Settings setting, bool *neg) @@ -2246,7 +2246,7 @@ static int acf_dsmball_icon(bAnimListElem *UNUSED(ale)) return ICON_META_DATA; } -/* get the appropriate flag(s) for the setting when it is valid */ +/* Get the appropriate flag(s) for the setting when it is valid. */ static int acf_dsmball_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Settings setting, bool *neg) @@ -2327,7 +2327,7 @@ static int acf_dsarm_icon(bAnimListElem *UNUSED(ale)) return ICON_ARMATURE_DATA; } -/* get the appropriate flag(s) for the setting when it is valid */ +/* Get the appropriate flag(s) for the setting when it is valid. */ static int acf_dsarm_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Settings setting, bool *neg) @@ -2417,7 +2417,7 @@ static short acf_dsntree_offset(bAnimContext *ac, bAnimListElem *ale) return offset; } -/* get the appropriate flag(s) for the setting when it is valid */ +/* Get the appropriate flag(s) for the setting when it is valid. */ static int acf_dsntree_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Settings setting, bool *neg) @@ -2498,7 +2498,7 @@ static int acf_dslinestyle_icon(bAnimListElem *UNUSED(ale)) return ICON_LINE_DATA; } -/* get the appropriate flag(s) for the setting when it is valid */ +/* Get the appropriate flag(s) for the setting when it is valid. */ static int acf_dslinestyle_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Settings setting, bool *neg) @@ -2579,7 +2579,7 @@ static int acf_dsmesh_icon(bAnimListElem *UNUSED(ale)) return ICON_MESH_DATA; } -/* get the appropriate flag(s) for the setting when it is valid */ +/* Get the appropriate flag(s) for the setting when it is valid. */ static int acf_dsmesh_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Settings setting, bool *neg) @@ -2659,7 +2659,7 @@ static int acf_dslat_icon(bAnimListElem *UNUSED(ale)) return ICON_LATTICE_DATA; } -/* get the appropriate flag(s) for the setting when it is valid */ +/* Get the appropriate flag(s) for the setting when it is valid. */ static int acf_dslat_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Settings setting, bool *neg) @@ -2739,7 +2739,7 @@ static int acf_dsspk_icon(bAnimListElem *UNUSED(ale)) return ICON_SPEAKER; } -/* get the appropriate flag(s) for the setting when it is valid */ +/* Get the appropriate flag(s) for the setting when it is valid. */ static int acf_dsspk_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Settings setting, bool *neg) @@ -2818,7 +2818,7 @@ static int acf_dshair_icon(bAnimListElem *UNUSED(ale)) return ICON_HAIR_DATA; } -/* get the appropriate flag(s) for the setting when it is valid */ +/* Get the appropriate flag(s) for the setting when it is valid. */ static int acf_dshair_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Settings setting, bool *neg) @@ -2897,7 +2897,7 @@ static int acf_dspointcloud_icon(bAnimListElem *UNUSED(ale)) return ICON_POINTCLOUD_DATA; } -/* get the appropriate flag(s) for the setting when it is valid */ +/* Get the appropriate flag(s) for the setting when it is valid. */ static int acf_dspointcloud_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Settings setting, bool *neg) @@ -2978,7 +2978,7 @@ static int acf_dsvolume_icon(bAnimListElem *UNUSED(ale)) return ICON_VOLUME_DATA; } -/* get the appropriate flag(s) for the setting when it is valid */ +/* Get the appropriate flag(s) for the setting when it is valid. */ static int acf_dsvolume_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Settings setting, bool *neg) @@ -3137,7 +3137,7 @@ static int acf_dsgpencil_icon(bAnimListElem *UNUSED(ale)) return ICON_GREASEPENCIL; } -/* get the appropriate flag(s) for the setting when it is valid */ +/* Get the appropriate flag(s) for the setting when it is valid. */ static int acf_dsgpencil_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Settings setting, bool *neg) @@ -3218,7 +3218,7 @@ static int acf_dsmclip_icon(bAnimListElem *UNUSED(ale)) return ICON_SEQUENCE; } -/* get the appropriate flag(s) for the setting when it is valid */ +/* Get the appropriate flag(s) for the setting when it is valid. */ static int acf_dsmclip_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Settings setting, bool *neg) @@ -3343,7 +3343,7 @@ static bool acf_shapekey_setting_valid(bAnimContext *UNUSED(ac), } } -/* get the appropriate flag(s) for the setting when it is valid */ +/* Get the appropriate flag(s) for the setting when it is valid. */ static int acf_shapekey_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Settings setting, bool *neg) @@ -3437,7 +3437,7 @@ static bool acf_gpd_setting_valid(bAnimContext *UNUSED(ac), } } -/* get the appropriate flag(s) for the setting when it is valid */ +/* Get the appropriate flag(s) for the setting when it is valid. */ static int acf_gpd_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Settings setting, bool *neg) { /* clear extra return data first */ @@ -3530,7 +3530,7 @@ static bool acf_gpl_setting_valid(bAnimContext *UNUSED(ac), } } -/* get the appropriate flag(s) for the setting when it is valid */ +/* Get the appropriate flag(s) for the setting when it is valid. */ static int acf_gpl_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Settings setting, bool *neg) { /* clear extra return data first */ @@ -3616,7 +3616,7 @@ static bool acf_mask_setting_valid(bAnimContext *UNUSED(ac), } } -/* get the appropriate flag(s) for the setting when it is valid */ +/* Get the appropriate flag(s) for the setting when it is valid. */ static int acf_mask_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Settings setting, bool *neg) @@ -3713,7 +3713,7 @@ static bool acf_masklay_setting_valid(bAnimContext *UNUSED(ac), } } -/* get the appropriate flag(s) for the setting when it is valid */ +/* Get the appropriate flag(s) for the setting when it is valid. */ static int acf_masklay_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Settings setting, bool *neg) @@ -3849,7 +3849,7 @@ static bool acf_nlatrack_setting_valid(bAnimContext *UNUSED(ac), } } -/* get the appropriate flag(s) for the setting when it is valid */ +/* Get the appropriate flag(s) for the setting when it is valid. */ static int acf_nlatrack_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Settings setting, bool *neg) @@ -4038,7 +4038,7 @@ static bool acf_nlaaction_setting_valid(bAnimContext *UNUSED(ac), } } -/* get the appropriate flag(s) for the setting when it is valid */ +/* Get the appropriate flag(s) for the setting when it is valid. */ static int acf_nlaaction_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Settings setting, bool *neg) @@ -4415,7 +4415,7 @@ void ANIM_channel_draw( /* set blending again, as may not be set in previous step */ GPU_blend(GPU_BLEND_ALPHA); - /* step 1) draw backdrop ........................................... */ + /* step 1) draw backdrop ........................................... */ if (acf->draw_backdrop) { acf->draw_backdrop(ac, ale, yminc, ymaxc); } @@ -5096,7 +5096,7 @@ static void draw_setting_widget(bAnimContext *ac, /* set call to send relevant notifiers and/or perform type-specific updates */ if (but) { switch (setting) { - /* settings needing flushing up/down hierarchy */ + /* Settings needing flushing up/down hierarchy. */ case ACHANNEL_SETTING_VISIBLE: /* Graph Editor - 'visibility' toggles */ case ACHANNEL_SETTING_PROTECT: /* General - protection flags */ case ACHANNEL_SETTING_MUTE: /* General - muting flags */ @@ -5184,12 +5184,12 @@ void ANIM_channel_draw_widgets(const bContext *C, if ((ac->spacetype == SPACE_GRAPH) && (acf->has_setting(ac, ale, ACHANNEL_SETTING_VISIBLE) || acf->has_setting(ac, ale, ACHANNEL_SETTING_ALWAYS_VISIBLE))) { - /* pin toggle */ + /* Pin toggle. */ if (acf->has_setting(ac, ale, ACHANNEL_SETTING_ALWAYS_VISIBLE)) { draw_setting_widget(ac, ale, acf, block, offset, ymid, ACHANNEL_SETTING_ALWAYS_VISIBLE); offset += ICON_WIDTH; } - /* visibility toggle */ + /* Visibility toggle. */ if (acf->has_setting(ac, ale, ACHANNEL_SETTING_VISIBLE)) { /* For F-curves, add the extra space for the color bands. */ if (ELEM(ale->type, ANIMTYPE_FCURVE, ANIMTYPE_NLACURVE)) { diff --git a/source/blender/editors/animation/anim_channels_edit.c b/source/blender/editors/animation/anim_channels_edit.c index 6c6fab13b7a..58e257259c2 100644 --- a/source/blender/editors/animation/anim_channels_edit.c +++ b/source/blender/editors/animation/anim_channels_edit.c @@ -1685,7 +1685,7 @@ static void animchannels_group_channels(bAnimContext *ac, agrp = action_groups_add_new(act, name); BLI_assert(agrp != NULL); - /* transfer selected F-Curves across to new group */ + /* Transfer selected F-Curves across to new group. */ for (ale = anim_data.first; ale; ale = ale->next) { FCurve *fcu = (FCurve *)ale->data; bActionGroup *grp = fcu->grp; @@ -1726,7 +1726,7 @@ static int animchannels_group_exec(bContext *C, wmOperator *op) bAnimListElem *ale; int filter; - /* handle each animdata block separately, so that the regrouping doesn't flow into blocks */ + /* Handle each animdata block separately, so that the regrouping doesn't flow into blocks. */ filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_ANIMDATA | ANIMFILTER_NODUPLIS); ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype); @@ -3443,12 +3443,14 @@ static void ANIM_OT_channels_click(wmOperatorType *ot) ot->flag = OPTYPE_UNDO; /* properties */ - /* NOTE: don't save settings, otherwise, can end up with some weird behavior (sticky extend) */ - prop = RNA_def_boolean(ot->srna, "extend", false, "Extend Select", ""); /* SHIFTKEY */ + /* NOTE: don't save settings, otherwise, can end up with some weird behavior (sticky extend) + * + * Key-map: Enable with `Shift`. */ + prop = RNA_def_boolean(ot->srna, "extend", false, "Extend Select", ""); RNA_def_property_flag(prop, PROP_SKIP_SAVE); - prop = RNA_def_boolean( - ot->srna, "children_only", false, "Select Children Only", ""); /* CTRLKEY|SHIFTKEY */ + /* Key-map: Enable with `Ctrl-Shift`. */ + prop = RNA_def_boolean(ot->srna, "children_only", false, "Select Children Only", ""); RNA_def_property_flag(prop, PROP_SKIP_SAVE); } diff --git a/source/blender/editors/animation/anim_deps.c b/source/blender/editors/animation/anim_deps.c index 17251587d3b..42fdb714127 100644 --- a/source/blender/editors/animation/anim_deps.c +++ b/source/blender/editors/animation/anim_deps.c @@ -93,9 +93,9 @@ void ANIM_list_elem_update(Main *bmain, Scene *scene, bAnimListElem *ale) fcu = (ale->datatype == ALE_FCURVE) ? ale->key_data : NULL; if (fcu && fcu->rna_path) { - /* if we have an fcurve, call the update for the property we + /* If we have an fcurve, call the update for the property we * are editing, this is then expected to do the proper redraws - * and depsgraph updates */ + * and depsgraph updates. */ PointerRNA id_ptr, ptr; PropertyRNA *prop; @@ -109,8 +109,8 @@ void ANIM_list_elem_update(Main *bmain, Scene *scene, bAnimListElem *ale) /* in other case we do standard depsgraph update, ideally * we'd be calling property update functions here too ... */ DEG_id_tag_update(id, - ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY | - ID_RECALC_ANIMATION); /* XXX or do we want something more restrictive? */ + /* XXX: or do we want something more restrictive? */ + ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY | ID_RECALC_ANIMATION); } } @@ -119,11 +119,10 @@ void ANIM_list_elem_update(Main *bmain, Scene *scene, bAnimListElem *ale) void ANIM_id_update(Main *bmain, ID *id) { if (id) { - DEG_id_tag_update_ex( - bmain, - id, - ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY | - ID_RECALC_ANIMATION); /* XXX or do we want something more restrictive? */ + DEG_id_tag_update_ex(bmain, + id, + /* XXX: or do we want something more restrictive? */ + ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY | ID_RECALC_ANIMATION); } } diff --git a/source/blender/editors/animation/anim_draw.c b/source/blender/editors/animation/anim_draw.c index aca332ff0fe..745b869228a 100644 --- a/source/blender/editors/animation/anim_draw.c +++ b/source/blender/editors/animation/anim_draw.c @@ -168,7 +168,7 @@ void ANIM_draw_framerange(Scene *scene, View2D *v2d) } /* *************************************************** */ -/* NLA-MAPPING UTILITIES (required for drawing and also editing keyframes) */ +/* NLA-MAPPING UTILITIES (required for drawing and also editing keyframes). */ /** * Obtain the AnimData block providing NLA-mapping for the given channel (if applicable). @@ -413,7 +413,7 @@ static float normalization_factor_get(Scene *scene, FCurve *fcu, short flag, flo else { /* Calculate min/max using full fcurve evaluation. * [slower than bezier forward differencing but evaluates Back/Elastic interpolation - * as well].*/ + * as well]. */ float step_size = (bezt->vec[1][0] - prev_bezt->vec[1][0]) / resol; for (int j = 0; j <= resol; j++) { float eval_time = prev_bezt->vec[1][0] + step_size * j; diff --git a/source/blender/editors/animation/anim_filter.c b/source/blender/editors/animation/anim_filter.c index a03f19d0111..1cdd879a8f9 100644 --- a/source/blender/editors/animation/anim_filter.c +++ b/source/blender/editors/animation/anim_filter.c @@ -3132,7 +3132,7 @@ static bool animdata_filter_base_is_ok(bDopeSheet *ads, Base *base, int filter_m /* check selection and object type filters */ if ((ads->filterflag & ADS_FILTER_ONLYSEL) && - !((base->flag & BASE_SELECTED) /*|| (base == sce->basact)*/)) { + !((base->flag & BASE_SELECTED) /*|| (base == sce->basact) */)) { /* only selected should be shown */ return false; } diff --git a/source/blender/editors/animation/drivers.c b/source/blender/editors/animation/drivers.c index 43d5efe9ea9..dae2138e481 100644 --- a/source/blender/editors/animation/drivers.c +++ b/source/blender/editors/animation/drivers.c @@ -568,7 +568,7 @@ bool ANIM_remove_driver(ReportList *UNUSED(reports), FCurve *fcu_iter = adt->drivers.first; while ((fcu = BKE_fcurve_iter_step(fcu_iter, rna_path)) != NULL) { - /* store the next fcurve for looping */ + /* Store the next fcurve for looping. */ fcu_iter = fcu->next; /* remove F-Curve from driver stack, then free it */ @@ -1253,7 +1253,7 @@ static int copy_driver_button_exec(bContext *C, wmOperator *op) } } - /* since we're just copying, we don't really need to do anything else...*/ + /* Since we're just copying, we don't really need to do anything else. */ return (changed) ? OPERATOR_FINISHED : OPERATOR_CANCELLED; } @@ -1303,7 +1303,7 @@ static int paste_driver_button_exec(bContext *C, wmOperator *op) } } - /* since we're just copying, we don't really need to do anything else...*/ + /* Since we're just copying, we don't really need to do anything else. */ return (changed) ? OPERATOR_FINISHED : OPERATOR_CANCELLED; } diff --git a/source/blender/editors/animation/fmodifier_ui.c b/source/blender/editors/animation/fmodifier_ui.c index 653bd72b364..31552330071 100644 --- a/source/blender/editors/animation/fmodifier_ui.c +++ b/source/blender/editors/animation/fmodifier_ui.c @@ -246,7 +246,7 @@ static PanelType *fmodifier_subpanel_register(ARegionType *region_type, #define B_REDR 1 #define B_FMODIFIER_REDRAW 20 -/* callback to remove the given modifier */ +/* Callback to remove the given modifier. */ typedef struct FModifierDeleteContext { ID *owner_id; ListBase *modifiers; diff --git a/source/blender/editors/animation/keyframes_edit.c b/source/blender/editors/animation/keyframes_edit.c index 636f0d3cbea..badd7a4e3b6 100644 --- a/source/blender/editors/animation/keyframes_edit.c +++ b/source/blender/editors/animation/keyframes_edit.c @@ -1109,7 +1109,7 @@ static short set_bezier_auto_clamped(KeyframeEditData *UNUSED(ked), BezTriple *b return 0; } -/* Sets the selected bezier handles to type 'vector' */ +/* Sets the selected bezier handles to type 'vector'. */ static short set_bezier_vector(KeyframeEditData *UNUSED(ked), BezTriple *bezt) { /* If the key is selected, always apply to both handles. */ @@ -1164,7 +1164,7 @@ static short set_bezier_align(KeyframeEditData *UNUSED(ked), BezTriple *bezt) return 0; } -/* Sets selected bezier handles to type 'free' */ +/* Sets selected bezier handles to type 'free'. */ static short set_bezier_free(KeyframeEditData *UNUSED(ked), BezTriple *bezt) { /* If the key is selected, always apply to both handles. */ diff --git a/source/blender/editors/animation/keyframes_general.c b/source/blender/editors/animation/keyframes_general.c index 87291974e08..aeddd03f3c1 100644 --- a/source/blender/editors/animation/keyframes_general.c +++ b/source/blender/editors/animation/keyframes_general.c @@ -193,7 +193,7 @@ void clean_fcurve(struct bAnimContext *ac, bAnimListElem *ale, float thresh, boo BezTriple *lastb; int totCount, i; - /* check if any points */ + /* Check if any points. */ if ((fcu == NULL) || (fcu->bezt == NULL) || (fcu->totvert == 0) || (!cleardefault && fcu->totvert == 1)) { return; @@ -408,7 +408,7 @@ bool decimate_fcurve(bAnimListElem *ale, float remove_ratio, float error_sq_max) { FCurve *fcu = (FCurve *)ale->key_data; - /* Check if the curve actually has any points */ + /* Check if the curve actually has any points. */ if (fcu == NULL || fcu->bezt == NULL || fcu->totvert == 0) { return true; } @@ -588,7 +588,7 @@ typedef struct TempFrameValCache { float frame, val; } TempFrameValCache; -/* Evaluates the curves between each selected keyframe on each frame, and keys the value */ +/* Evaluates the curves between each selected keyframe on each frame, and keys the value. */ void sample_fcurve(FCurve *fcu) { BezTriple *bezt, *start = NULL, *end = NULL; @@ -600,7 +600,7 @@ void sample_fcurve(FCurve *fcu) return; } - /* find selected keyframes... once pair has been found, add keyframes */ + /* Find selected keyframes... once pair has been found, add keyframes. */ for (i = 0, bezt = fcu->bezt; i < fcu->totvert; i++, bezt++) { /* check if selected, and which end this is */ if (BEZT_ISSEL_ANY(bezt)) { @@ -693,7 +693,7 @@ typedef struct tAnimCopybufItem { int totvert; /* number of keyframes stored for this channel */ BezTriple *bezt; /* keyframes in buffer */ - short id_type; /* Result of GS(id->name)*/ + short id_type; /* Result of `GS(id->name)`. */ bool is_bone; /* special flag for armature bones */ } tAnimCopybufItem; @@ -913,7 +913,7 @@ static tAnimCopybufItem *pastebuf_match_path_property(Main *bmain, if (aci->rna_path && fcu->rna_path) { /* find the property of the fcurve and compare against the end of the tAnimCopybufItem * more involved since it needs to do path lookups. - * This is not 100% reliable since the user could be editing the curves on a path that wont + * This is not 100% reliable since the user could be editing the curves on a path that won't * resolve, or a bone could be renamed after copying for eg. but in normal copy & paste * this should work out ok. */ diff --git a/source/blender/editors/animation/keyframing.c b/source/blender/editors/animation/keyframing.c index f229d48b4eb..506b126d01e 100644 --- a/source/blender/editors/animation/keyframing.c +++ b/source/blender/editors/animation/keyframing.c @@ -952,7 +952,7 @@ static bool visualkey_can_use(PointerRNA *ptr, PropertyRNA *prop) case CONSTRAINT_TYPE_KINEMATIC: return true; - /* single-transform constraints */ + /* Single-transform constraints. */ case CONSTRAINT_TYPE_TRACKTO: if (searchtype == VISUALKEY_ROT) { return true; @@ -2244,7 +2244,7 @@ static int clear_anim_v3d_exec(bContext *C, wmOperator *UNUSED(op)) bPoseChannel *pchan = BKE_pose_channel_find_name(ob->pose, bone_name); MEM_freeN(bone_name); - /* delete if bone is selected*/ + /* Delete if bone is selected. */ if ((pchan) && (pchan->bone)) { if (pchan->bone->flag & BONE_SELECTED) { can_delete = true; @@ -2817,7 +2817,7 @@ bool fcurve_frame_has_keyframe(FCurve *fcu, float frame, short filter) return false; } - /* we either include all regardless of muting, or only non-muted */ + /* We either include all regardless of muting, or only non-muted. */ if ((filter & ANIMFILTER_KEYS_MUTED) || (fcu->flag & FCURVE_MUTED) == 0) { bool replace; int i = BKE_fcurve_bezt_binarysearch_index(fcu->bezt, frame, fcu->totvert, &replace); diff --git a/source/blender/editors/animation/keyingsets.c b/source/blender/editors/animation/keyingsets.c index fda7b600c1c..0206aabd359 100644 --- a/source/blender/editors/animation/keyingsets.c +++ b/source/blender/editors/animation/keyingsets.c @@ -529,7 +529,7 @@ void ANIM_OT_keying_set_active_set(wmOperatorType *ot) /* Keying Set Type Info declarations */ static ListBase keyingset_type_infos = {NULL, NULL}; -/* Built-In Keying Sets (referencing type infos)*/ +/* Built-In Keying Sets (referencing type information). */ ListBase builtin_keyingsets = {NULL, NULL}; /* --------------- */ diff --git a/source/blender/editors/armature/armature_add.c b/source/blender/editors/armature/armature_add.c index 1d4936bdf5e..0ee11a6ef55 100644 --- a/source/blender/editors/armature/armature_add.c +++ b/source/blender/editors/armature/armature_add.c @@ -1558,7 +1558,7 @@ void ARMATURE_OT_extrude(wmOperatorType *ot) /* ********************** Bone Add *************************************/ -/*op makes a new bone and returns it with its tip selected */ +/* Op makes a new bone and returns it with its tip selected. */ static int armature_bone_primitive_add_exec(bContext *C, wmOperator *op) { diff --git a/source/blender/editors/armature/armature_edit.c b/source/blender/editors/armature/armature_edit.c index 912aafbd6e3..67d6dd94190 100644 --- a/source/blender/editors/armature/armature_edit.c +++ b/source/blender/editors/armature/armature_edit.c @@ -1030,7 +1030,7 @@ void ARMATURE_OT_switch_direction(wmOperatorType *ot) /** \name Align Operator * \{ */ -/* helper to fix a ebone position if its parent has moved due to alignment*/ +/* Helper to fix a ebone position if its parent has moved due to alignment. */ static void fix_connected_bone(EditBone *ebone) { float diff[3]; @@ -1073,9 +1073,9 @@ static void bone_align_to_bone(ListBase *edbo, EditBone *selbone, EditBone *actb add_v3_v3v3(selbone->tail, selbone->head, actboneaxis); selbone->roll = actbone->roll; - /* if the bone being aligned has connected descendants they must be moved + /* If the bone being aligned has connected descendants they must be moved * according to their parent new position, otherwise they would be left - * in an inconsistent state: connected but away from the parent*/ + * in an inconsistent state: connected but away from the parent. */ fix_editbone_connected_children(edbo, selbone); } diff --git a/source/blender/editors/armature/armature_relations.c b/source/blender/editors/armature/armature_relations.c index 66ca38ce218..59780bf011e 100644 --- a/source/blender/editors/armature/armature_relations.c +++ b/source/blender/editors/armature/armature_relations.c @@ -457,7 +457,7 @@ static void separated_armature_fix_links(Main *bmain, Object *origArm, Object *n bConstraint *con; ListBase *opchans, *npchans; - /* get reference to list of bones in original and new armatures */ + /* Get reference to list of bones in original and new armatures. */ opchans = &origArm->pose->chanbase; npchans = &newArm->pose->chanbase; @@ -576,7 +576,7 @@ static void separate_armature_bones(Main *bmain, Object *ob, const bool is_selec /* check if bone needs to be removed */ if (is_select == (EBONE_VISIBLE(arm, curbone) && (curbone->flag & BONE_SELECTED))) { - /* clear the bone->parent var of any bone that had this as its parent */ + /* Clear the bone->parent var of any bone that had this as its parent. */ LISTBASE_FOREACH (EditBone *, ebo, arm->edbo) { if (ebo->parent == curbone) { ebo->parent = NULL; diff --git a/source/blender/editors/armature/armature_skinning.c b/source/blender/editors/armature/armature_skinning.c index f86ec545712..fc9191967f8 100644 --- a/source/blender/editors/armature/armature_skinning.c +++ b/source/blender/editors/armature/armature_skinning.c @@ -486,8 +486,8 @@ void ED_object_vgroup_calc_from_armature(ReportList *reports, defbase_add = bone_looper(ob, arm->bonebase.first, NULL, vgroup_add_unique_bone_cb); if (defbase_add) { - /* its possible there are DWeight's outside the range of the current - * objects deform groups, in this case the new groups wont be empty T33889. */ + /* It's possible there are DWeights outside the range of the current + * object's deform groups. In this case the new groups won't be empty T33889. */ ED_vgroup_data_clamp_range(ob->data, defbase_tot); } } diff --git a/source/blender/editors/armature/armature_utils.c b/source/blender/editors/armature/armature_utils.c index ffcdb99c5a3..bc6d0687654 100644 --- a/source/blender/editors/armature/armature_utils.c +++ b/source/blender/editors/armature/armature_utils.c @@ -847,7 +847,7 @@ void ED_armature_to_edit(bArmature *arm) } /* *************************************************************** */ -/* Used by Undo for Armature EditMode*/ +/* Used by Undo for Armature EditMode. */ /* free's bones and their properties */ diff --git a/source/blender/editors/armature/pose_edit.c b/source/blender/editors/armature/pose_edit.c index f5daa427149..f86cc1159d5 100644 --- a/source/blender/editors/armature/pose_edit.c +++ b/source/blender/editors/armature/pose_edit.c @@ -224,7 +224,7 @@ void ED_pose_recalculate_paths(bContext *C, Scene *scene, Object *ob, ePosePathC #endif /* For a single frame update it's faster to re-use existing dependency graph and avoid overhead - * of building all the relations and so on for a temporary one. */ + * of building all the relations and so on for a temporary one. */ if (range == POSE_PATH_CALC_RANGE_CURRENT_FRAME) { /* NOTE: Dependency graph will be evaluated at all the frames, but we first need to access some * nested pointers, like animation data. */ @@ -455,7 +455,7 @@ static void ED_pose_clear_paths(Object *ob, bool only_selected) DEG_id_tag_update(&ob->id, ID_RECALC_COPY_ON_WRITE); } -/* operator callback - wrapper for the backend function */ +/* Operator callback - wrapper for the back-end function. */ static int pose_clear_paths_exec(bContext *C, wmOperator *op) { Object *ob = BKE_object_pose_armature_get(CTX_data_active_object(C)); @@ -663,7 +663,7 @@ static int pose_bone_rotmode_exec(bContext *C, wmOperator *op) const int mode = RNA_enum_get(op->ptr, "type"); Object *prev_ob = NULL; - /* set rotation mode of selected bones */ + /* Set rotation mode of selected bones. */ CTX_DATA_BEGIN_WITH_ID (C, bPoseChannel *, pchan, selected_pose_bones, Object *, ob) { /* use API Method for conversions... */ BKE_rotMode_change_values( diff --git a/source/blender/editors/armature/pose_lib.c b/source/blender/editors/armature/pose_lib.c index 21fcbf8886b..df3550d5db6 100644 --- a/source/blender/editors/armature/pose_lib.c +++ b/source/blender/editors/armature/pose_lib.c @@ -516,7 +516,7 @@ static int poselib_add_exec(bContext *C, wmOperator *op) /* use Keying Set to determine what to store for the pose */ - /* this includes custom props :)*/ + /* This includes custom props :). */ ks = ANIM_builtin_keyingset_get_named(NULL, ANIM_KS_WHOLE_CHARACTER_SELECTED_ID); ANIM_apply_keyingset(C, NULL, act, ks, MODIFYKEY_MODE_INSERT, (float)frame); @@ -863,7 +863,7 @@ typedef struct tPoseLib_PreviewData { /** active area. */ ScrArea *area; - /** RNA-Pointer to Object 'ob' .*/ + /** RNA-Pointer to Object 'ob'. */ PointerRNA rna_ptr; /** object to work on. */ Object *ob; @@ -1100,7 +1100,7 @@ static void poselib_keytag_pose(bContext *C, Scene *scene, tPoseLib_PreviewData /* start tagging/keying */ for (agrp = act->groups.first; agrp; agrp = agrp->next) { - /* only for selected bones unless there aren't any selected, in which case all are included */ + /* Only for selected bones unless there aren't any selected, in which case all are included. */ pchan = BKE_pose_channel_find_name(pose, agrp->name); if (pchan) { @@ -1462,7 +1462,7 @@ static int poselib_preview_handle_event(bContext *UNUSED(C), wmOperator *op, con pld->state = PL_PREVIEW_CONFIRM; break; - /* toggle between original pose and poselib pose*/ + /* Toggle between original pose and poselib pose. */ case EVT_TABKEY: pld->flag |= PL_PREVIEW_SHOWORIGINAL; pld->redraw = PL_PREVIEW_REDRAWALL; diff --git a/source/blender/editors/armature/pose_slide.c b/source/blender/editors/armature/pose_slide.c index d32faf9a9ea..9b1de742332 100644 --- a/source/blender/editors/armature/pose_slide.c +++ b/source/blender/editors/armature/pose_slide.c @@ -444,7 +444,7 @@ static void pose_slide_draw_2d_slider(const struct bContext *UNUSED(C), ARegion color_line); /* Draw triangles at the ends of the line in overshoot mode to indicate direction of 0-100% - * range.*/ + * range. */ if (pso->overshoot) { if (pso->factor > 1 + OVERSHOOT_RANGE_DELTA + 0.5) { draw_overshoot_triangle(color_line, false, main_line_rect.xmin, line_y); @@ -1468,7 +1468,7 @@ static int pose_slide_modal(bContext *C, wmOperator *op, const wmEvent *event) /* Reset transforms back to original state. */ pose_slide_reset(pso); - /* Depsgraph updates + redraws.*/ + /* Depsgraph updates + redraws. */ pose_slide_refresh(C, pso); /* Clean up temp data. */ @@ -1513,7 +1513,7 @@ static int pose_slide_modal(bContext *C, wmOperator *op, const wmEvent *event) } if (event->val == KM_PRESS) { switch (event->type) { - /* Transform Channel Limits */ + /* Transform Channel Limits. */ /* XXX: Replace these hard-coded hotkeys with a modal-map that can be customized. */ case EVT_GKEY: /* Location */ { diff --git a/source/blender/editors/armature/pose_transform.c b/source/blender/editors/armature/pose_transform.c index 6466773daac..e597fd46106 100644 --- a/source/blender/editors/armature/pose_transform.c +++ b/source/blender/editors/armature/pose_transform.c @@ -1383,7 +1383,7 @@ static int pose_clear_user_transforms_exec(bContext *C, wmOperator *op) BKE_animsys_evaluate_animdata( &workob.id, workob.adt, &anim_eval_context, ADT_RECALC_ANIM, false); - /* copy back values, but on selected bones only */ + /* Copy back values, but on selected bones only. */ for (pchan = dummyPose->chanbase.first; pchan; pchan = pchan->next) { pose_bone_do_paste(ob, pchan, only_select, 0); } diff --git a/source/blender/editors/armature/pose_utils.c b/source/blender/editors/armature/pose_utils.c index 8eae5288f7a..500b9663a6c 100644 --- a/source/blender/editors/armature/pose_utils.c +++ b/source/blender/editors/armature/pose_utils.c @@ -144,7 +144,9 @@ Object *poseAnim_object_get(Object *ob_) return NULL; } -/* get sets of F-Curves providing transforms for the bones in the Pose */ +/** + * Get sets of F-Curves providing transforms for the bones in the Pose. + */ void poseAnim_mapping_get(bContext *C, ListBase *pfLinks) { /* for each Pose-Channel which gets affected, get the F-Curves for that channel @@ -190,7 +192,7 @@ void poseAnim_mapping_get(bContext *C, ListBase *pfLinks) } } -/* free F-Curve <-> PoseChannel links */ +/* Free F-Curve <-> PoseChannel links. */ void poseAnim_mapping_free(ListBase *pfLinks) { tPChanFCurveLink *pfl, *pfln = NULL; diff --git a/source/blender/editors/curve/editcurve.c b/source/blender/editors/curve/editcurve.c index 2999ac784ba..58cd69781a7 100644 --- a/source/blender/editors/curve/editcurve.c +++ b/source/blender/editors/curve/editcurve.c @@ -3747,8 +3747,8 @@ static void subdividenurb(Object *obedit, View3D *v3d, int number_cuts) } if (sel) { /* U ! */ - /* Inserting U points is sort of 'default' Flat curves only get */ - /* U points inserted in them. */ + /* Inserting U points is sort of 'default' Flat curves only get + * U points inserted in them. */ bpn = bpnew = MEM_mallocN((sel + nu->pntsu) * nu->pntsv * sizeof(BPoint), "subdivideNurb4"); bp = nu->bp; @@ -3786,7 +3786,7 @@ static void subdividenurb(Object *obedit, View3D *v3d, int number_cuts) MEM_freeN(usel); MEM_freeN(vsel); - } /* End of 'if (nu->type == CU_NURBS)' */ + } /* End of `if (nu->type == CU_NURBS)`. */ } } diff --git a/source/blender/editors/curve/editcurve_paint.c b/source/blender/editors/curve/editcurve_paint.c index 03c120df28b..febcf83116b 100644 --- a/source/blender/editors/curve/editcurve_paint.c +++ b/source/blender/editors/curve/editcurve_paint.c @@ -128,6 +128,7 @@ struct CurveDrawData { } prev; ViewContext vc; + ViewDepths *depths; enum { CURVE_DRAW_IDLE = 0, CURVE_DRAW_PAINTING = 1, @@ -188,7 +189,6 @@ static bool stroke_elem_project(const struct CurveDrawData *cdd, float r_normal_world[3]) { ARegion *region = cdd->vc.region; - RegionView3D *rv3d = cdd->vc.rv3d; bool is_location_world_set = false; @@ -204,7 +204,7 @@ static bool stroke_elem_project(const struct CurveDrawData *cdd, } } else { - const ViewDepths *depths = rv3d->depths; + const ViewDepths *depths = cdd->depths; if (depths && ((uint)mval_i[0] < depths->w) && ((uint)mval_i[1] < depths->h)) { float depth_fl = 1.0f; ED_view3d_depth_read_cached(depths, mval_i, 0, &depth_fl); @@ -219,7 +219,7 @@ static bool stroke_elem_project(const struct CurveDrawData *cdd, if (surface_offset != 0.0f) { const float offset = cdd->project.use_surface_offset_absolute ? 1.0f : radius; float normal[3]; - if (ED_view3d_depth_read_cached_normal(&cdd->vc, mval_i, normal)) { + if (ED_view3d_depth_read_cached_normal(region, depths, mval_i, normal)) { madd_v3_v3fl(r_location_world, normal, offset * surface_offset); if (r_normal_world) { copy_v3_v3(r_normal_world, normal); @@ -528,7 +528,7 @@ static void curve_draw_event_add_first(wmOperator *op, const wmEvent *event) if (ELEM(cps->surface_plane, CURVE_PAINT_SURFACE_PLANE_NORMAL_VIEW, CURVE_PAINT_SURFACE_PLANE_NORMAL_SURFACE)) { - if (ED_view3d_depth_read_cached_normal(&cdd->vc, event->mval, normal)) { + if (ED_view3d_depth_read_cached_normal(cdd->vc.region, cdd->depths, event->mval, normal)) { if (cps->surface_plane == CURVE_PAINT_SURFACE_PLANE_NORMAL_VIEW) { float cross_a[3], cross_b[3]; cross_v3_v3v3(cross_a, rv3d->viewinv[2], normal); @@ -622,6 +622,9 @@ static void curve_draw_exit(wmOperator *op) BLI_mempool_destroy(cdd->stroke_elem_pool); } + if (cdd->depths) { + ED_view3d_depths_free(cdd->depths); + } MEM_freeN(cdd); op->customdata = NULL; } @@ -1084,10 +1087,14 @@ static int curve_draw_invoke(bContext *C, wmOperator *op, const wmEvent *event) /* needed or else the draw matrix can be incorrect */ view3d_operator_needs_opengl(C); - ED_view3d_depth_override( - cdd->vc.depsgraph, cdd->vc.region, cdd->vc.v3d, NULL, V3D_DEPTH_NO_GPENCIL, true); + ED_view3d_depth_override(cdd->vc.depsgraph, + cdd->vc.region, + cdd->vc.v3d, + NULL, + V3D_DEPTH_NO_GPENCIL, + &cdd->depths); - if (cdd->vc.rv3d->depths != NULL) { + if (cdd->depths != NULL) { cdd->project.use_depth = true; } else { diff --git a/source/blender/editors/curve/editcurve_query.c b/source/blender/editors/curve/editcurve_query.c index 56392aab5bf..a8fd3ea2803 100644 --- a/source/blender/editors/curve/editcurve_query.c +++ b/source/blender/editors/curve/editcurve_query.c @@ -168,8 +168,8 @@ bool ED_curve_pick_vert(ViewContext *vc, void ED_curve_nurb_vert_selected_find( Curve *cu, View3D *v3d, Nurb **r_nu, BezTriple **r_bezt, BPoint **r_bp) { - /* in nu and (bezt or bp) selected are written if there's 1 sel. */ - /* if more points selected in 1 spline: return only nu, bezt and bp are 0 */ + /* In nu and (bezt or bp) selected are written if there's 1 sel. */ + /* If more points selected in 1 spline: return only nu, bezt and bp are 0. */ ListBase *editnurb = &cu->editnurb->nurbs; BezTriple *bezt1; BPoint *bp1; diff --git a/source/blender/editors/curve/editcurve_select.c b/source/blender/editors/curve/editcurve_select.c index 90cefef38ee..e1dc2ec30ca 100644 --- a/source/blender/editors/curve/editcurve_select.c +++ b/source/blender/editors/curve/editcurve_select.c @@ -885,10 +885,10 @@ static void curve_select_more(Object *obedit) int a; short sel = 0; - /* note that NURBS surface is a special case because we mimic */ - /* the behavior of "select more" of mesh tools. */ - /* The algorithm is designed to work in planar cases so it */ - /* may not be optimal always (example: end of NURBS sphere) */ + /* NOTE: NURBS surface is a special case because we mimic + * the behavior of "select more" of mesh tools. + * The algorithm is designed to work in planar cases so it + * may not be optimal always (example: end of NURBS sphere). */ if (obedit->type == OB_SURF) { LISTBASE_FOREACH (Nurb *, nu, editnurb) { BLI_bitmap *selbpoints; diff --git a/source/blender/editors/curve/editcurve_undo.c b/source/blender/editors/curve/editcurve_undo.c index b07c3c85f4a..88f6398567d 100644 --- a/source/blender/editors/curve/editcurve_undo.c +++ b/source/blender/editors/curve/editcurve_undo.c @@ -97,7 +97,7 @@ static void undocurve_to_editcurve(Main *bmain, UndoCurve *ucu, Curve *cu, short BKE_fcurves_copy(&ad->drivers, &ucu->drivers); } - /* copy */ + /* Copy. */ for (nu = undobase->first; nu; nu = nu->next) { newnu = BKE_nurb_duplicate(nu); @@ -139,7 +139,7 @@ static void undocurve_from_editcurve(UndoCurve *ucu, Curve *cu, const short shap BKE_fcurves_copy(&ucu->drivers, &ad->drivers); } - /* copy */ + /* Copy. */ for (nu = nubase->first; nu; nu = nu->next) { newnu = BKE_nurb_duplicate(nu); diff --git a/source/blender/editors/gizmo_library/gizmo_library_utils.c b/source/blender/editors/gizmo_library/gizmo_library_utils.c index 847f3e3916c..77c65cd1bb8 100644 --- a/source/blender/editors/gizmo_library/gizmo_library_utils.c +++ b/source/blender/editors/gizmo_library/gizmo_library_utils.c @@ -118,10 +118,10 @@ void gizmo_property_data_update(wmGizmo *gz, const bool inverted) { if (gz_prop->custom_func.value_get_fn != NULL) { - /* pass */ + /* Pass. */ } else if (gz_prop->prop != NULL) { - /* pass */ + /* Pass. */ } else { data->offset = 0.0f; diff --git a/source/blender/editors/gpencil/annotate_draw.c b/source/blender/editors/gpencil/annotate_draw.c index fe1c5efc747..3131ec70fb0 100644 --- a/source/blender/editors/gpencil/annotate_draw.c +++ b/source/blender/editors/gpencil/annotate_draw.c @@ -760,15 +760,15 @@ static void annotation_draw_data_all(Scene *scene, int winy, int cfra, int dflag, - const char spacetype) + const eSpace_Type space_type) { bGPdata *gpd_source = NULL; if (scene) { - if (spacetype == SPACE_VIEW3D) { + if (space_type == SPACE_VIEW3D) { gpd_source = (scene->gpd ? scene->gpd : NULL); } - else if (spacetype == SPACE_CLIP && scene->clip) { + else if (space_type == SPACE_CLIP && scene->clip) { /* currently drawing only gpencil data from either clip or track, * but not both - XXX fix logic behind */ gpd_source = (scene->clip->gpd ? scene->clip->gpd : NULL); diff --git a/source/blender/editors/gpencil/annotate_paint.c b/source/blender/editors/gpencil/annotate_paint.c index c155587e95a..69b21731284 100644 --- a/source/blender/editors/gpencil/annotate_paint.c +++ b/source/blender/editors/gpencil/annotate_paint.c @@ -667,7 +667,7 @@ static short annotation_stroke_addpoint(tGPsdata *p, (ts->annotate_v3d_align & GP_PROJECT_DEPTH_STROKE) ? V3D_DEPTH_GPENCIL_ONLY : V3D_DEPTH_NO_GPENCIL, - false); + NULL); } /* convert screen-coordinates to appropriate coordinates (and store them) */ @@ -908,7 +908,7 @@ static void annotation_stroke_newfrombuffer(tGPsdata *p) CLAMP(pt->strength, GPENCIL_STRENGTH_MIN, 1.0f); pt->time = ptc->time; - /** Create arrow strokes. **/ + /** Create arrow strokes. */ /* End arrow stroke. */ if ((runtime.sbuffer_sflag & GP_STROKE_USE_ARROW_END) && (runtime.arrow_end_style != GP_STROKE_ARROWSTYLE_NONE)) { @@ -1226,7 +1226,7 @@ static void annotation_stroke_doeraser(tGPsdata *p) if (p->flags & GP_PAINTFLAG_V3D_ERASER_DEPTH) { View3D *v3d = p->area->spacedata.first; view3d_region_operator_needs_opengl(p->win, p->region); - ED_view3d_depth_override(p->depsgraph, p->region, v3d, NULL, V3D_DEPTH_NO_GPENCIL, false); + ED_view3d_depth_override(p->depsgraph, p->region, v3d, NULL, V3D_DEPTH_NO_GPENCIL, NULL); } } @@ -1706,7 +1706,7 @@ static void annotation_paint_strokeend(tGPsdata *p) (ts->annotate_v3d_align & GP_PROJECT_DEPTH_STROKE) ? V3D_DEPTH_GPENCIL_ONLY : V3D_DEPTH_NO_GPENCIL, - false); + NULL); } /* check if doing eraser or not */ diff --git a/source/blender/editors/gpencil/drawgpencil.c b/source/blender/editors/gpencil/drawgpencil.c index 751f8333aaa..2160aaf705f 100644 --- a/source/blender/editors/gpencil/drawgpencil.c +++ b/source/blender/editors/gpencil/drawgpencil.c @@ -323,7 +323,7 @@ static void gpencil_draw_strokes(tGPDdraw *tgpw) MaterialGPencilStyle *gp_style = (ma) ? ma->gp_style : NULL; if ((gp_style == NULL) || (gp_style->flag & GP_MATERIAL_HIDE) || - /* if onion and ghost flag do not draw*/ + /* If onion and ghost flag do not draw. */ (tgpw->onion && (gp_style->flag & GP_MATERIAL_HIDE_ONIONSKIN))) { continue; } diff --git a/source/blender/editors/gpencil/editaction_gpencil.c b/source/blender/editors/gpencil/editaction_gpencil.c index 166111c582c..92f1629f7f7 100644 --- a/source/blender/editors/gpencil/editaction_gpencil.c +++ b/source/blender/editors/gpencil/editaction_gpencil.c @@ -268,7 +268,7 @@ void ED_gpencil_layer_frames_duplicate(bGPDlayer *gpl) return; } - /* duplicate selected frames */ + /* Duplicate selected frames. */ LISTBASE_FOREACH_MUTABLE (bGPDframe *, gpf, &gpl->frames) { /* duplicate this frame */ @@ -421,7 +421,7 @@ bool ED_gpencil_anim_copybuf_paste(bAnimContext *ac, const short offset_mode) return false; } - /* check if single channel in buffer (disregard names if so) */ + /* Check if single channel in buffer (disregard names if so). */ if (gpencil_anim_copybuf.first == gpencil_anim_copybuf.last) { no_name = true; } diff --git a/source/blender/editors/gpencil/gpencil_armature.c b/source/blender/editors/gpencil/gpencil_armature.c index 3271096c433..24fb0873a86 100644 --- a/source/blender/editors/gpencil/gpencil_armature.c +++ b/source/blender/editors/gpencil/gpencil_armature.c @@ -425,7 +425,7 @@ static void gpencil_add_verts_to_dgroups( } } - /* if not multiedit, exit loop*/ + /* If not multi-edit, exit loop. */ if (!is_multiedit) { break; } @@ -462,8 +462,8 @@ static void gpencil_object_vgroup_calc_from_armature(const bContext *C, defbase_add = gpencil_bone_looper(ob, arm->bonebase.first, NULL, vgroup_add_unique_bone_cb); if (defbase_add) { - /* its possible there are DWeight's outside the range of the current - * objects deform groups, in this case the new groups wont be empty */ + /* It's possible there are DWeights outside the range of the current + * object's deform groups. In this case the new groups won't be empty */ ED_vgroup_data_clamp_range(ob->data, defbase_tot); } diff --git a/source/blender/editors/gpencil/gpencil_bake_animation.c b/source/blender/editors/gpencil/gpencil_bake_animation.c index 30ebc9189c5..1a5e2950e09 100644 --- a/source/blender/editors/gpencil/gpencil_bake_animation.c +++ b/source/blender/editors/gpencil/gpencil_bake_animation.c @@ -185,7 +185,7 @@ static void gpencil_bake_ob_list(bContext *C, Depsgraph *depsgraph, Scene *scene if (ob == obact) { continue; } - /* Add selected objects.*/ + /* Add selected objects. */ if (ob->type == OB_GPENCIL) { elem = MEM_callocN(sizeof(GpBakeOb), __func__); elem->ob = ob; diff --git a/source/blender/editors/gpencil/gpencil_convert.c b/source/blender/editors/gpencil/gpencil_convert.c index 8ab413e907c..9bea1868895 100644 --- a/source/blender/editors/gpencil/gpencil_convert.c +++ b/source/blender/editors/gpencil/gpencil_convert.c @@ -168,7 +168,7 @@ static void gpencil_strokepoint_convertcoords(bContext *C, ARegion *region = CTX_wm_region(C); /* TODO(sergey): This function might be called from a loop, but no tagging is happening in it, * so it's not that expensive to ensure evaluated depsgraph here. However, ideally all the - * parameters are to wrapped into a context style struct and queried from Context once.*/ + * parameters are to wrapped into a context style struct and queried from Context once. */ Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C); Object *obact = CTX_data_active_object(C); bGPDspoint mypt, *pt; @@ -219,7 +219,7 @@ typedef struct tGpTimingData { int frame_range; /* Number of frames evaluated for path animation */ int start_frame, end_frame; bool realtime; /* Will overwrite end_frame in case of Original or CustomGap timing... */ - float gap_duration, gap_randomness; /* To be used with CustomGap mode*/ + float gap_duration, gap_randomness; /* To be used with CustomGap mode. */ int seed; /* Data set from points, used to compute final timing FCurve */ diff --git a/source/blender/editors/gpencil/gpencil_data.c b/source/blender/editors/gpencil/gpencil_data.c index d9a807d17ab..47bb153cf46 100644 --- a/source/blender/editors/gpencil/gpencil_data.c +++ b/source/blender/editors/gpencil/gpencil_data.c @@ -828,7 +828,7 @@ static int gpencil_frame_clean_loose_exec(bContext *C, wmOperator *op) } } - /* if not multiedit, exit loop*/ + /* If not multi-edit, exit loop. */ if (!is_multiedit) { break; } @@ -1572,7 +1572,7 @@ static int gpencil_stroke_arrange_exec(bContext *C, wmOperator *op) continue; } bool gpf_lock = false; - /* some stroke is already at front*/ + /* Some stroke is already at front. */ if (ELEM(direction, GP_STROKE_MOVE_TOP, GP_STROKE_MOVE_UP)) { if (gps == gpf->strokes.last) { gpf_lock = true; @@ -1664,7 +1664,7 @@ static int gpencil_stroke_arrange_exec(bContext *C, wmOperator *op) BLI_freelistN(&selected); } - /* if not multiedit, exit loop*/ + /* If not multi-edit, exit loop. */ if (!is_multiedit) { break; } @@ -1772,7 +1772,7 @@ static int gpencil_stroke_change_color_exec(bContext *C, wmOperator *op) } } } - /* if not multiedit, exit loop*/ + /* If not multi-edit, exit loop. */ if (!is_multiedit) { break; } @@ -2865,7 +2865,7 @@ int ED_gpencil_join_objects_exec(bContext *C, wmOperator *op) BKE_gpencil_object_material_ensure(bmain, ob_dst, tmp_ma); } - /* duplicate bGPDlayers */ + /* Duplicate #bGPDlayers. */ tJoinGPencil_AdtFixData afd = {0}; afd.src_gpd = gpd_src; afd.tar_gpd = gpd_dst; @@ -3356,7 +3356,7 @@ static int gpencil_material_unlock_all_exec(bContext *C, wmOperator *UNUSED(op)) return OPERATOR_CANCELLED; } - /* make all layers editable again*/ + /* Make all layers editable again. */ MaterialGPencilStyle *gp_style = NULL; for (short i = 0; i < *totcol; i++) { @@ -3410,7 +3410,7 @@ static int gpencil_material_select_exec(bContext *C, wmOperator *op) return OPERATOR_CANCELLED; } - /* read all strokes and select*/ + /* Read all strokes and select. */ CTX_DATA_BEGIN (C, bGPDlayer *, gpl, editable_gpencil_layers) { bGPDframe *init_gpf = (is_multiedit) ? gpl->frames.first : gpl->actframe; @@ -3452,7 +3452,7 @@ static int gpencil_material_select_exec(bContext *C, wmOperator *op) } } } - /* if not multiedit, exit loop*/ + /* If not multi-edit, exit loop. */ if (!is_multiedit) { break; } diff --git a/source/blender/editors/gpencil/gpencil_edit.c b/source/blender/editors/gpencil/gpencil_edit.c index 21fa3ad3967..8d1f841da6c 100644 --- a/source/blender/editors/gpencil/gpencil_edit.c +++ b/source/blender/editors/gpencil/gpencil_edit.c @@ -3285,7 +3285,7 @@ static int gpencil_stroke_cyclical_set_exec(bContext *C, wmOperator *op) } } - /* if not multiedit, exit loop*/ + /* If not multi-edit, exit loop. */ if (!is_multiedit) { break; } @@ -3555,7 +3555,7 @@ static int gpencil_stroke_join_exec(bContext *C, wmOperator *op) BLI_assert(ELEM(type, GP_STROKE_JOIN, GP_STROKE_JOINCOPY)); int tot_strokes = 0; - /** Alloc memory */ + /** Alloc memory. */ tJoinStrokes *strokes_list = MEM_malloc_arrayN(sizeof(tJoinStrokes), max_join_strokes, __func__); tJoinStrokes *elem = NULL; /* Read all selected strokes to create a list. */ @@ -4478,7 +4478,7 @@ static int gpencil_stroke_trim_exec(bContext *C, wmOperator *op) } } } - /* if not multiedit, exit loop*/ + /* If not multi-edit, exit loop. */ if (!is_multiedit) { break; } @@ -4619,6 +4619,8 @@ static int gpencil_stroke_separate_exec(bContext *C, wmOperator *op) if (gpl_dst == NULL) { gpl_dst = BKE_gpencil_layer_addnew(gpd_dst, gpl->info, false, false); BKE_gpencil_layer_copy_settings(gpl, gpl_dst); + /* Copy masks. */ + BKE_gpencil_layer_mask_copy(gpl, gpl_dst); } /* add frame if not created before */ @@ -4679,7 +4681,7 @@ static int gpencil_stroke_separate_exec(bContext *C, wmOperator *op) } } - /* if not multiedit, exit loop*/ + /* If not multi-edit, exit loop. */ if (!is_multiedit) { break; } @@ -4737,6 +4739,9 @@ static int gpencil_stroke_separate_exec(bContext *C, wmOperator *op) } ob_dst->actcol = actcol; + /* Remove any invalid Mask relationship. */ + BKE_gpencil_layer_mask_cleanup_all_layers(gpd_dst); + DEG_id_tag_update(&gpd_src->id, ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY); DEG_id_tag_update(&gpd_dst->id, ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY); @@ -4855,7 +4860,7 @@ static int gpencil_stroke_split_exec(bContext *C, wmOperator *op) } } - /* if not multiedit, exit loop*/ + /* If not multi-edit, exit loop. */ if (!is_multiedit) { break; } @@ -5082,7 +5087,7 @@ static int gpencil_cutter_lasso_select(bContext *C, BKE_gpencil_stroke_select_index_reset(gps); } } - /* if not multiedit, exit loop. */ + /* If not multi-edit, exit loop. */ if (!is_multiedit) { break; } @@ -5146,7 +5151,7 @@ static int gpencil_cutter_lasso_select(bContext *C, } } } - /* if not multiedit, exit loop. */ + /* If not multi-edit, exit loop. */ if (!is_multiedit) { break; } @@ -5165,7 +5170,7 @@ static int gpencil_cutter_lasso_select(bContext *C, gpencil_cutter_dissolve(gpd, gpl, gps, flat_caps); } } - /* if not multiedit, exit loop. */ + /* If not multi-edit, exit loop. */ if (!is_multiedit) { break; } @@ -5473,7 +5478,7 @@ static int gpencil_stroke_normalize_exec(bContext *C, wmOperator *op) BKE_gpencil_stroke_geometry_update(gpd, gps); } } - /* If not multiedit, exit loop. */ + /* If not multi-edit, exit loop. */ if (!is_multiedit) { break; } diff --git a/source/blender/editors/gpencil/gpencil_fill.c b/source/blender/editors/gpencil/gpencil_fill.c index f74e211dd65..4419833a99c 100644 --- a/source/blender/editors/gpencil/gpencil_fill.c +++ b/source/blender/editors/gpencil/gpencil_fill.c @@ -125,7 +125,7 @@ typedef struct tGPDfill { struct bGPDframe *gpf; /** Temp mouse position stroke. */ struct bGPDstroke *gps_mouse; - /** Pointer to report messages. */ + /** Pointer to report messages. */ struct ReportList *reports; /** flags */ short flag; @@ -810,7 +810,7 @@ static bool is_leak_narrow(ImBuf *ibuf, const int maxpixel, int limit, int index } } else { - /* edge of image*/ + /* Edge of image. */ t_a = true; } /* pixels on bottom */ @@ -822,7 +822,7 @@ static bool is_leak_narrow(ImBuf *ibuf, const int maxpixel, int limit, int index } } else { - /* edge of image*/ + /* Edge of image. */ t_b = true; } } @@ -846,7 +846,7 @@ static bool is_leak_narrow(ImBuf *ibuf, const int maxpixel, int limit, int index } } else { - t_a = true; /* edge of image*/ + t_a = true; /* Edge of image. */ } /* pixels to left */ pt = index + extreme; @@ -1373,7 +1373,7 @@ static void gpencil_get_depth_array(tGPDfill *tgpf) /* need to restore the original projection settings before packing up */ view3d_region_operator_needs_opengl(tgpf->win, tgpf->region); ED_view3d_depth_override( - tgpf->depsgraph, tgpf->region, tgpf->v3d, NULL, V3D_DEPTH_NO_GPENCIL, false); + tgpf->depsgraph, tgpf->region, tgpf->v3d, NULL, V3D_DEPTH_NO_GPENCIL, NULL); /* Since strokes are so fine, when using their depth we need a margin * otherwise they might get missed. */ @@ -1869,7 +1869,7 @@ static int gpencil_fill_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSE DEG_id_tag_update(&tgpf->gpd->id, ID_RECALC_TRANSFORM | ID_RECALC_GEOMETRY); WM_event_add_notifier(C, NC_GPENCIL | NA_EDITED, NULL); - /* add a modal handler for this operator*/ + /* Add a modal handler for this operator. */ WM_event_add_modal_handler(C, op); return OPERATOR_RUNNING_MODAL; @@ -2123,7 +2123,7 @@ static int gpencil_fill_modal(bContext *C, wmOperator *op, const wmEvent *event) gpencil_stroke_convertcoords_tpoint( tgpf->scene, tgpf->region, tgpf->ob, &point2D, NULL, &pt->x); - /* Hash of selected frames.*/ + /* Hash of selected frames. */ GHash *frame_list = BLI_ghash_int_new_ex(__func__, 64); /* If not multiframe and there is no frame in CFRA for the active layer, create diff --git a/source/blender/editors/gpencil/gpencil_intern.h b/source/blender/editors/gpencil/gpencil_intern.h index 276e8c81e0f..39be3db71b9 100644 --- a/source/blender/editors/gpencil/gpencil_intern.h +++ b/source/blender/editors/gpencil/gpencil_intern.h @@ -637,7 +637,7 @@ struct GP_EditableStrokes_Iter { if (ED_gpencil_stroke_material_editable(obact_, gpl, gps) == false) { \ continue; \ } \ - /* ... Do Stuff With Strokes ... */ + /* ... Do Stuff With Strokes ... */ #define GP_EDITABLE_STROKES_END(gpstroke_iter) \ } \ @@ -687,7 +687,7 @@ struct GP_EditableStrokes_Iter { if (gps->editcurve == NULL) \ continue; \ bGPDcurve *gpc = gps->editcurve; \ - /* ... Do Stuff With Strokes ... */ + /* ... Do Stuff With Strokes ... */ #define GP_EDITABLE_CURVES_END(gpstroke_iter) \ } \ @@ -738,7 +738,7 @@ struct GP_EditableStrokes_Iter { if (ED_gpencil_stroke_material_editable(obact_, gpl, gps) == false) { \ continue; \ } \ - /* ... Do Stuff With Strokes ... */ + /* ... Do Stuff With Strokes ... */ #define GP_EVALUATED_STROKES_END(gpstroke_iter) \ } \ diff --git a/source/blender/editors/gpencil/gpencil_mesh.c b/source/blender/editors/gpencil/gpencil_mesh.c index 55468dffab0..1882285a230 100644 --- a/source/blender/editors/gpencil/gpencil_mesh.c +++ b/source/blender/editors/gpencil/gpencil_mesh.c @@ -159,7 +159,7 @@ static bool gpencil_bake_ob_list(bContext *C, Depsgraph *depsgraph, Scene *scene if (ob == obact) { continue; } - /* Add selected meshes.*/ + /* Add selected meshes. */ if (ob->type == OB_MESH) { elem = MEM_callocN(sizeof(GpBakeOb), __func__); elem->ob = ob; diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c index e40748e5f6e..d0c0933c5be 100644 --- a/source/blender/editors/gpencil/gpencil_paint.c +++ b/source/blender/editors/gpencil/gpencil_paint.c @@ -1433,7 +1433,7 @@ static void gpencil_stroke_soft_refine(bGPDstroke *gps) bGPDspoint *pt2 = NULL; int i; - /* check if enough points*/ + /* Check if enough points. */ if (gps->totpoints < 3) { return; } @@ -1744,7 +1744,7 @@ static void gpencil_stroke_doeraser(tGPsdata *p) if ((gp_settings != NULL) && (gp_settings->flag & GP_BRUSH_OCCLUDE_ERASER)) { View3D *v3d = p->area->spacedata.first; view3d_region_operator_needs_opengl(p->win, p->region); - ED_view3d_depth_override(p->depsgraph, p->region, v3d, NULL, V3D_DEPTH_NO_GPENCIL, false); + ED_view3d_depth_override(p->depsgraph, p->region, v3d, NULL, V3D_DEPTH_NO_GPENCIL, NULL); } } @@ -1792,7 +1792,7 @@ static void gpencil_stroke_doeraser(tGPsdata *p) } } - /* if not multiedit, exit loop*/ + /* If not multi-edit, exit loop. */ if (!is_multiedit) { break; } @@ -2334,7 +2334,7 @@ static void gpencil_paint_strokeend(tGPsdata *p) (ts->gpencil_v3d_align & GP_PROJECT_DEPTH_STROKE) ? V3D_DEPTH_GPENCIL_ONLY : V3D_DEPTH_NO_GPENCIL, - false); + NULL); } /* check if doing eraser or not */ @@ -3178,7 +3178,7 @@ static void gpencil_guide_event_handling(bContext *C, guide->type = GP_GUIDE_CIRCULAR; } } - /* Change line angle */ + /* Change line angle. */ else if (ELEM(event->type, EVT_JKEY, EVT_KKEY) && (event->val == KM_RELEASE)) { add_notifier = true; float angle = guide->angle; @@ -3460,7 +3460,7 @@ static void gpencil_add_arc_points(tGPsdata *p, const float mval[2], int segment interp_v4_v4v4( pt->vert_color, pt_before->vert_color, pt_prev->vert_color, stepcolor * (i + 1)); - /* Apply angle of stroke to brush size to interpolated points but slightly attenuated.. */ + /* Apply angle of stroke to brush size to interpolated points but slightly attenuated. */ if (brush_settings->draw_angle_factor != 0.0f) { gpencil_brush_angle_segment(p, pt_step, pt); CLAMP(pt->pressure, pt_prev->pressure * 0.5f, 1.0f); @@ -3771,7 +3771,7 @@ static int gpencil_draw_modal(bContext *C, wmOperator *op, const wmEvent *event) } } else if (p->region) { - /* Perform bounds check using */ + /* Perform bounds check using. */ const rcti *region_rect = ED_region_visible_rect(p->region); in_bounds = BLI_rcti_isect_pt_v(region_rect, event->mval); } diff --git a/source/blender/editors/gpencil/gpencil_primitive.c b/source/blender/editors/gpencil/gpencil_primitive.c index 5f02bbf0a77..a2b4e5dee64 100644 --- a/source/blender/editors/gpencil/gpencil_primitive.c +++ b/source/blender/editors/gpencil/gpencil_primitive.c @@ -792,7 +792,7 @@ static void gpencil_primitive_update_strokes(bContext *C, tGPDprimitive *tgpi) (ts->gpencil_v3d_align & GP_PROJECT_DEPTH_STROKE) ? V3D_DEPTH_GPENCIL_ONLY : V3D_DEPTH_NO_GPENCIL, - false); + NULL); depth_arr = MEM_mallocN(sizeof(float) * gps->totpoints, "depth_points"); tGPspoint *ptc = &points2D[0]; diff --git a/source/blender/editors/gpencil/gpencil_sculpt_paint.c b/source/blender/editors/gpencil/gpencil_sculpt_paint.c index 2b8800e5136..864231e6aab 100644 --- a/source/blender/editors/gpencil/gpencil_sculpt_paint.c +++ b/source/blender/editors/gpencil/gpencil_sculpt_paint.c @@ -2020,7 +2020,7 @@ static int gpencil_sculpt_brush_modal(bContext *C, wmOperator *op, const wmEvent /* The operator can be in 2 states: Painting and Idling */ if (gso->is_painting) { - /* Painting */ + /* Painting. */ switch (event->type) { /* Mouse Move = Apply somewhere else */ case MOUSEMOVE: diff --git a/source/blender/editors/gpencil/gpencil_select.c b/source/blender/editors/gpencil/gpencil_select.c index e1776988186..c33b43247fd 100644 --- a/source/blender/editors/gpencil/gpencil_select.c +++ b/source/blender/editors/gpencil/gpencil_select.c @@ -1276,7 +1276,7 @@ static bool gpencil_stroke_do_circle_sel(bGPdata *gpd, pt_active = (pt->runtime.pt_orig) ? pt->runtime.pt_orig : pt; bGPDspoint pt_temp; - gpencil_point_to_parent_space(pt_active, diff_mat, &pt_temp); + gpencil_point_to_parent_space(pt, diff_mat, &pt_temp); gpencil_point_to_xy(gsc, gps, &pt_temp, &x0, &y0); /* do boundbox check first */ @@ -1374,7 +1374,7 @@ static bool gpencil_do_curve_circle_sel(bContext *C, const bool handles_visible = (v3d->overlay.handle_display != CURVE_HANDLE_NONE) && (!only_selected || BEZT_ISSEL_ANY(bezt)); - /* if the handles are not visible only check ctrl point (vec[1])*/ + /* If the handles are not visible only check control point (vec[1]). */ int from = (!handles_visible) ? 1 : 0; int to = (!handles_visible) ? 2 : 3; @@ -1719,7 +1719,7 @@ static bool gpencil_generic_curve_select(bContext *C, } } } - /* if the handles are not visible only check ctrl point (vec[1])*/ + /* If the handles are not visible only check ctrl point (vec[1]). */ else { const bool is_select = bezt->f2; bool is_inside = is_inside_fn(region, gps_iter.diff_mat, bezt->vec[1], user_data); @@ -1847,7 +1847,7 @@ static bool gpencil_generic_stroke_select(bContext *C, bGPDspoint *pt; int i; bool hit = false; - for (i = 0, pt = gps_active->points; i < gps_active->totpoints; i++, pt++) { + for (i = 0, pt = gps->points; i < gps->totpoints; i++, pt++) { bGPDspoint *pt_active = (pt->runtime.pt_orig) ? pt->runtime.pt_orig : pt; /* convert point coords to screenspace */ @@ -1889,7 +1889,7 @@ static bool gpencil_generic_stroke_select(bContext *C, mval[0] = (box.xmax + box.xmin) / 2; mval[1] = (box.ymax + box.ymin) / 2; - whole = ED_gpencil_stroke_point_is_inside(gps_active, &gsc, mval, gpstroke_iter.diff_mat); + whole = ED_gpencil_stroke_point_is_inside(gps, &gsc, mval, gpstroke_iter.diff_mat); } /* if stroke mode expand selection. */ @@ -2153,7 +2153,7 @@ static void gpencil_select_curve_point(bContext *C, const bool handles_visible = (v3d->overlay.handle_display != CURVE_HANDLE_NONE) && (!only_selected || BEZT_ISSEL_ANY(bezt)); - /* if the handles are not visible only check ctrl point (vec[1])*/ + /* If the handles are not visible only check control point (vec[1]). */ int from = (!handles_visible) ? 1 : 0; int to = (!handles_visible) ? 2 : 3; @@ -2252,7 +2252,7 @@ static int gpencil_select_exec(bContext *C, wmOperator *op) int i; /* firstly, check for hit-point */ - for (i = 0, pt = gps_active->points; i < gps_active->totpoints; i++, pt++) { + for (i = 0, pt = gps->points; i < gps->totpoints; i++, pt++) { int xy[2]; bGPDspoint pt2; diff --git a/source/blender/editors/gpencil/gpencil_trace_utils.c b/source/blender/editors/gpencil/gpencil_trace_utils.c index 12c38fb2744..970afc3ff6b 100644 --- a/source/blender/editors/gpencil/gpencil_trace_utils.c +++ b/source/blender/editors/gpencil/gpencil_trace_utils.c @@ -250,7 +250,7 @@ void ED_gpencil_trace_data_to_strokes(Main *bmain, const int32_t thickness) { #define MAX_LENGTH 100.0f - /* Find materials and create them if not found. */ + /* Find materials and create them if not found. */ int32_t mat_fill_idx = BKE_gpencil_material_find_index_by_name_prefix(ob, "Stroke"); int32_t mat_mask_idx = BKE_gpencil_material_find_index_by_name_prefix(ob, "Holdout"); diff --git a/source/blender/editors/gpencil/gpencil_utils.c b/source/blender/editors/gpencil/gpencil_utils.c index c9ef340b9d3..15ada6e0891 100644 --- a/source/blender/editors/gpencil/gpencil_utils.c +++ b/source/blender/editors/gpencil/gpencil_utils.c @@ -565,7 +565,7 @@ bool ED_gpencil_layer_has_selected_stroke(const bGPDlayer *gpl, const bool is_mu return true; } } - /* If not multiedit, exit loop. */ + /* If not multi-edit, exit loop. */ if (!is_multiedit) { break; } @@ -680,7 +680,7 @@ void gpencil_point_conversion_init(bContext *C, GP_SpaceConversion *r_gsc) view3d_operator_needs_opengl(C); view3d_region_operator_needs_opengl(win, region); - ED_view3d_depth_override(depsgraph, region, v3d, NULL, V3D_DEPTH_NO_GPENCIL, false); + ED_view3d_depth_override(depsgraph, region, v3d, NULL, V3D_DEPTH_NO_GPENCIL, NULL); /* for camera view set the subrect */ if (rv3d->persp == RV3D_CAMOB) { @@ -1640,7 +1640,7 @@ void ED_gpencil_vgroup_assign(bContext *C, Object *ob, float weight) } } - /* if not multiedit, exit loop*/ + /* If not multi-edit, exit loop. */ if (!is_multiedit) { break; } @@ -1693,7 +1693,7 @@ void ED_gpencil_vgroup_remove(bContext *C, Object *ob) } } - /* if not multiedit, exit loop*/ + /* If not multi-edit, exit loop. */ if (!is_multiedit) { break; } @@ -1748,7 +1748,7 @@ void ED_gpencil_vgroup_select(bContext *C, Object *ob) } } - /* if not multiedit, exit loop*/ + /* If not multi-edit, exit loop. */ if (!is_multiedit) { break; } @@ -1798,7 +1798,7 @@ void ED_gpencil_vgroup_deselect(bContext *C, Object *ob) } } - /* if not multiedit, exit loop*/ + /* If not multi-edit, exit loop. */ if (!is_multiedit) { break; } @@ -2215,7 +2215,7 @@ void ED_gpencil_tpoint_to_point(ARegion *region, void ED_gpencil_update_color_uv(Main *bmain, Material *mat) { Material *gps_ma = NULL; - /* read all strokes */ + /* Read all strokes. */ for (Object *ob = bmain->objects.first; ob; ob = ob->id.next) { if (ob->type == OB_GPENCIL) { bGPdata *gpd = ob->data; @@ -2478,7 +2478,7 @@ int ED_gpencil_select_stroke_segment(bGPdata *gpd, return 0; } - /* convert all gps points to 2d and save in a hash to avoid recalculation */ + /* Convert all gps points to 2d and save in a hash to avoid recalculation. */ int direction = 0; float(*points2d)[2] = MEM_mallocN(sizeof(*points2d) * gps->totpoints, "GP Stroke temp 2d points"); @@ -3302,7 +3302,7 @@ bGPDstroke *ED_gpencil_stroke_nearest_to_ends(bContext *C, return gps_rtn; } -/* Join two stroke using a contact point index and trimming the rest. */ +/* Join two stroke using a contact point index and trimming the rest. */ bGPDstroke *ED_gpencil_stroke_join_and_trim( bGPdata *gpd, bGPDframe *gpf, bGPDstroke *gps, bGPDstroke *gps_dst, const int pt_index) { diff --git a/source/blender/editors/gpencil/gpencil_vertex_ops.c b/source/blender/editors/gpencil/gpencil_vertex_ops.c index bf46fa2544f..402bccce2f7 100644 --- a/source/blender/editors/gpencil/gpencil_vertex_ops.c +++ b/source/blender/editors/gpencil/gpencil_vertex_ops.c @@ -99,7 +99,7 @@ static bool is_any_stroke_selected(bContext *C, const bool is_multiedit, const b } } } - /* if not multiedit, exit loop*/ + /* If not multi-edit, exit loop. */ if (!is_multiedit) { break; } @@ -204,7 +204,7 @@ static int gpencil_vertexpaint_brightness_contrast_exec(bContext *C, wmOperator } } } - /* if not multiedit, exit loop*/ + /* If not multi-edit, exit loop. */ if (!is_multiedit) { break; } @@ -325,7 +325,7 @@ static int gpencil_vertexpaint_hsv_exec(bContext *C, wmOperator *op) } } } - /* if not multiedit, exit loop*/ + /* If not multi-edit, exit loop. */ if (!is_multiedit) { break; } @@ -419,7 +419,7 @@ static int gpencil_vertexpaint_invert_exec(bContext *C, wmOperator *op) } } } - /* if not multiedit, exit loop*/ + /* If not multi-edit, exit loop. */ if (!is_multiedit) { break; } @@ -510,7 +510,7 @@ static int gpencil_vertexpaint_levels_exec(bContext *C, wmOperator *op) } } } - /* if not multiedit, exit loop*/ + /* If not multi-edit, exit loop. */ if (!is_multiedit) { break; } @@ -605,7 +605,7 @@ static int gpencil_vertexpaint_set_exec(bContext *C, wmOperator *op) } } } - /* if not multiedit, exit loop*/ + /* If not multi-edit, exit loop. */ if (!is_multiedit) { break; } @@ -1113,7 +1113,7 @@ static int gpencil_stroke_reset_vertex_color_exec(bContext *C, wmOperator *op) changed = true; } - /* if not multiedit, exit loop*/ + /* If not multi-edit, exit loop. */ if (!is_multiedit) { break; } diff --git a/source/blender/editors/gpencil/gpencil_vertex_paint.c b/source/blender/editors/gpencil/gpencil_vertex_paint.c index a05cc3c4dbd..7ec64b2afd6 100644 --- a/source/blender/editors/gpencil/gpencil_vertex_paint.c +++ b/source/blender/editors/gpencil/gpencil_vertex_paint.c @@ -1107,7 +1107,7 @@ static bool gpencil_vertexpaint_brush_do_frame(bContext *C, break; } } - /* Clear the selected array, but keep the memory allocation.*/ + /* Clear the selected array, but keep the memory allocation. */ gso->pbuffer = gpencil_select_buffer_ensure( gso->pbuffer, &gso->pbuffer_size, &gso->pbuffer_used, true); @@ -1335,7 +1335,7 @@ static int gpencil_vertexpaint_brush_modal(bContext *C, wmOperator *op, const wm /* The operator can be in 2 states: Painting and Idling */ if (gso->is_painting) { - /* Painting */ + /* Painting. */ switch (event->type) { /* Mouse Move = Apply somewhere else */ case MOUSEMOVE: diff --git a/source/blender/editors/gpencil/gpencil_weight_paint.c b/source/blender/editors/gpencil/gpencil_weight_paint.c index a3e5ece5862..56eed187d87 100644 --- a/source/blender/editors/gpencil/gpencil_weight_paint.c +++ b/source/blender/editors/gpencil/gpencil_weight_paint.c @@ -555,7 +555,7 @@ static bool gpencil_weightpaint_brush_do_frame(bContext *C, break; } } - /* Clear the selected array, but keep the memory allocation.*/ + /* Clear the selected array, but keep the memory allocation. */ gso->pbuffer = gpencil_select_buffer_ensure( gso->pbuffer, &gso->pbuffer_size, &gso->pbuffer_used, true); @@ -774,7 +774,7 @@ static int gpencil_weightpaint_brush_modal(bContext *C, wmOperator *op, const wm /* The operator can be in 2 states: Painting and Idling */ if (gso->is_painting) { - /* Painting */ + /* Painting. */ switch (event->type) { /* Mouse Move = Apply somewhere else */ case MOUSEMOVE: diff --git a/source/blender/editors/include/ED_keyframes_edit.h b/source/blender/editors/include/ED_keyframes_edit.h index cf90a21f799..e29ff3ed890 100644 --- a/source/blender/editors/include/ED_keyframes_edit.h +++ b/source/blender/editors/include/ED_keyframes_edit.h @@ -160,7 +160,7 @@ typedef struct KeyframeEditData { /* generic properties/data access */ /** temp list for storing custom list of data to check */ ListBase list; - /** pointer to current scene - many tools need access to cfra/etc. */ + /** pointer to current scene - many tools need access to cfra/etc. */ struct Scene *scene; /** pointer to custom data - usually 'Object' but also 'rectf', but could be other types too */ void *data; diff --git a/source/blender/editors/include/ED_keyframing.h b/source/blender/editors/include/ED_keyframing.h index 179c9d5b30d..08d19318d4c 100644 --- a/source/blender/editors/include/ED_keyframing.h +++ b/source/blender/editors/include/ED_keyframing.h @@ -434,7 +434,7 @@ void ANIM_copy_as_driver(struct ID *target_id, const char *target_path, const ch /* check if auto-keyframing is enabled (per scene takes precedence) */ #define IS_AUTOKEY_ON(scene) \ ((scene) ? ((scene)->toolsettings->autokey_mode & AUTOKEY_ON) : (U.autokey_mode & AUTOKEY_ON)) -/* check the mode for auto-keyframing (per scene takes precedence) */ +/* Check the mode for auto-keyframing (per scene takes precedence). */ #define IS_AUTOKEY_MODE(scene, mode) \ ((scene) ? ((scene)->toolsettings->autokey_mode == AUTOKEY_MODE_##mode) : \ (U.autokey_mode == AUTOKEY_MODE_##mode)) diff --git a/source/blender/editors/include/ED_mesh.h b/source/blender/editors/include/ED_mesh.h index 0e2be5eb568..7fcae2349db 100644 --- a/source/blender/editors/include/ED_mesh.h +++ b/source/blender/editors/include/ED_mesh.h @@ -91,7 +91,7 @@ void EDBM_mesh_load(struct Main *bmain, struct Object *ob); /* flushes based on the current select mode. if in vertex select mode, * verts select/deselect edges and faces, if in edge select mode, * edges select/deselect faces and vertices, and in face select mode faces select/deselect - * edges and vertices.*/ + * edges and vertices. */ void EDBM_select_more(struct BMEditMesh *em, const bool use_face_step); void EDBM_select_less(struct BMEditMesh *em, const bool use_face_step); @@ -481,9 +481,8 @@ int ED_mesh_mirror_spatial_table_lookup(struct Object *ob, void ED_mesh_mirror_topo_table_begin(struct Object *ob, struct Mesh *me_eval); void ED_mesh_mirror_topo_table_end(struct Object *ob); -/* retrieves mirrored cache vert, or NULL if there isn't one. - * note: calling this without ensuring the mirror cache state - * is bad.*/ +/* Retrieves mirrored cache vert, or NULL if there isn't one. + * NOTE: calling this without ensuring the mirror cache state is bad. */ int mesh_get_x_mirror_vert(struct Object *ob, struct Mesh *me_eval, int index, diff --git a/source/blender/editors/include/ED_particle.h b/source/blender/editors/include/ED_particle.h index e84298bd9c2..6d0172e724a 100644 --- a/source/blender/editors/include/ED_particle.h +++ b/source/blender/editors/include/ED_particle.h @@ -34,6 +34,7 @@ struct ParticleSystem; struct Scene; struct UndoType; struct ViewLayer; +struct wmGenericUserData; struct bContext; struct rcti; @@ -68,7 +69,11 @@ void PE_update_object(struct Depsgraph *depsgraph, bool PE_mouse_particles( struct bContext *C, const int mval[2], bool extend, bool deselect, bool toggle); bool PE_box_select(struct bContext *C, const struct rcti *rect, const int sel_op); -bool PE_circle_select(struct bContext *C, const int sel_op, const int mval[2], float rad); +bool PE_circle_select(struct bContext *C, + struct wmGenericUserData *wm_userdata, + const int sel_op, + const int mval[2], + float rad); int PE_lasso_select(struct bContext *C, const int mcoords[][2], const int mcoords_len, diff --git a/source/blender/editors/include/ED_spreadsheet.h b/source/blender/editors/include/ED_spreadsheet.h index 3a07b1b9d4b..88bc4738c0b 100644 --- a/source/blender/editors/include/ED_spreadsheet.h +++ b/source/blender/editors/include/ED_spreadsheet.h @@ -30,9 +30,9 @@ struct SpreadsheetContext *ED_spreadsheet_context_new(int type); void ED_spreadsheet_context_free(struct SpreadsheetContext *context); void ED_spreadsheet_context_path_clear(struct SpaceSpreadsheet *sspreadsheet); void ED_spreadsheet_context_path_update_tag(struct SpaceSpreadsheet *sspreadsheet); -uint64_t ED_spreadsheet_context_path_hash(struct SpaceSpreadsheet *sspreadsheet); +uint64_t ED_spreadsheet_context_path_hash(const struct SpaceSpreadsheet *sspreadsheet); -struct ID *ED_spreadsheet_get_current_id(struct SpaceSpreadsheet *sspreadsheet); +struct ID *ED_spreadsheet_get_current_id(const struct SpaceSpreadsheet *sspreadsheet); void ED_spreadsheet_set_geometry_node_context(struct SpaceSpreadsheet *sspreadsheet, struct SpaceNode *snode, diff --git a/source/blender/editors/include/ED_undo.h b/source/blender/editors/include/ED_undo.h index ed1ec96a13f..059277e1466 100644 --- a/source/blender/editors/include/ED_undo.h +++ b/source/blender/editors/include/ED_undo.h @@ -53,7 +53,7 @@ void ED_OT_undo_redo(struct wmOperatorType *ot); void ED_OT_undo_history(struct wmOperatorType *ot); int ED_undo_operator_repeat(struct bContext *C, struct wmOperator *op); -/* convenience since UI callbacks use this mostly*/ +/* Convenience since UI callbacks use this mostly. */ void ED_undo_operator_repeat_cb(struct bContext *C, void *arg_op, void *arg_unused); void ED_undo_operator_repeat_cb_evt(struct bContext *C, void *arg_op, int arg_unused); diff --git a/source/blender/editors/include/ED_view3d.h b/source/blender/editors/include/ED_view3d.h index 52d69d12253..64883ed5f1d 100644 --- a/source/blender/editors/include/ED_view3d.h +++ b/source/blender/editors/include/ED_view3d.h @@ -90,8 +90,6 @@ typedef struct ViewDepths { short x, y; /* only for temp use for sub-rects, added to region->winx/y */ float *depths; double depth_range[2]; - - bool damaged; } ViewDepths; /* Rotate 3D cursor on placement. */ @@ -154,19 +152,20 @@ void ED_view3d_depth_override(struct Depsgraph *depsgraph, struct View3D *v3d, struct Object *obact, eV3DDepthOverrideMode mode, - bool update_cache); + struct ViewDepths **r_depths); +void ED_view3d_depths_free(ViewDepths *depths); bool ED_view3d_depth_read_cached(const ViewDepths *vd, const int mval[2], int margin, float *r_depth); -bool ED_view3d_depth_read_cached_normal(const ViewContext *vc, +bool ED_view3d_depth_read_cached_normal(const struct ARegion *region, + const ViewDepths *depths, const int mval[2], float r_normal[3]); bool ED_view3d_depth_unproject_v3(const struct ARegion *region, const int mval[2], const double depth, float r_location_world[3]); -void ED_view3d_depth_tag_update(struct RegionView3D *rv3d); /* Projection */ #define IS_CLIPPED 12000 @@ -196,12 +195,38 @@ typedef enum { V3D_PROJ_TEST_CLIP_NEAR = (1 << 2), V3D_PROJ_TEST_CLIP_FAR = (1 << 3), V3D_PROJ_TEST_CLIP_ZERO = (1 << 4), + /** + * Clip the contents of the data being iterated over. + * Currently this is only used to edges when projecting into screen space. + * + * Clamp the edge within the viewport limits defined by + * #V3D_PROJ_TEST_CLIP_WIN, #V3D_PROJ_TEST_CLIP_NEAR & #V3D_PROJ_TEST_CLIP_FAR. + * This resolves the problem of a visible edge having one of it's vertices + * behind the viewport. See: T32214. + * + * This is not default behavior as it may be important for the screen-space location + * of an edges vertex to represent that vertices location (instead of a location along the edge). + * + * \note Perspective views should enable #V3D_PROJ_TEST_CLIP_WIN along with + * #V3D_PROJ_TEST_CLIP_NEAR as the near-plane-clipped location of a point + * may become very large (even infinite) when projected into screen-space. + * Unless the that point happens to coincide with the camera's point of view. + * + * Use #V3D_PROJ_TEST_CLIP_CONTENT_DEFAULT instead of #V3D_PROJ_TEST_CLIP_CONTENT, + * to avoid accidentally enabling near clipping without clipping by window bounds. + */ + V3D_PROJ_TEST_CLIP_CONTENT = (1 << 5), } eV3DProjTest; #define V3D_PROJ_TEST_CLIP_DEFAULT \ (V3D_PROJ_TEST_CLIP_BB | V3D_PROJ_TEST_CLIP_WIN | V3D_PROJ_TEST_CLIP_NEAR) #define V3D_PROJ_TEST_ALL \ - (V3D_PROJ_TEST_CLIP_DEFAULT | V3D_PROJ_TEST_CLIP_FAR | V3D_PROJ_TEST_CLIP_ZERO) + (V3D_PROJ_TEST_CLIP_DEFAULT | V3D_PROJ_TEST_CLIP_FAR | V3D_PROJ_TEST_CLIP_ZERO | \ + V3D_PROJ_TEST_CLIP_CONTENT) + +#define V3D_PROJ_TEST_CLIP_CONTENT_DEFAULT \ + (V3D_PROJ_TEST_CLIP_CONTENT | V3D_PROJ_TEST_CLIP_NEAR | V3D_PROJ_TEST_CLIP_FAR | \ + V3D_PROJ_TEST_CLIP_WIN) /* view3d_iterators.c */ @@ -404,7 +429,7 @@ bool ED_view3d_win_to_segment_clipped(struct Depsgraph *depsgraph, float r_ray_end[3], const bool do_clip); void ED_view3d_ob_project_mat_get(const struct RegionView3D *v3d, - struct Object *ob, + const struct Object *ob, float r_pmat[4][4]); void ED_view3d_ob_project_mat_get_from_obmat(const struct RegionView3D *rv3d, const float obmat[4][4], @@ -578,8 +603,8 @@ bool ED_view3d_area_user_region(const struct ScrArea *area, struct ARegion **r_region); bool ED_operator_rv3d_user_region_poll(struct bContext *C); -void ED_view3d_init_mats_rv3d(struct Object *ob, struct RegionView3D *rv3d); -void ED_view3d_init_mats_rv3d_gl(struct Object *ob, struct RegionView3D *rv3d); +void ED_view3d_init_mats_rv3d(const struct Object *ob, struct RegionView3D *rv3d); +void ED_view3d_init_mats_rv3d_gl(const struct Object *ob, struct RegionView3D *rv3d); #ifdef DEBUG void ED_view3d_clear_mats_rv3d(struct RegionView3D *rv3d); void ED_view3d_check_mats_rv3d(struct RegionView3D *rv3d); diff --git a/source/blender/editors/include/UI_icons.h b/source/blender/editors/include/UI_icons.h index 1b05f91a479..fb08331a667 100644 --- a/source/blender/editors/include/UI_icons.h +++ b/source/blender/editors/include/UI_icons.h @@ -992,7 +992,7 @@ DEF_ICON_VECTOR(COLLECTION_COLOR_06) DEF_ICON_VECTOR(COLLECTION_COLOR_07) DEF_ICON_VECTOR(COLLECTION_COLOR_08) -/* Events */ +/* Events. */ DEF_ICON_COLOR(EVENT_A) DEF_ICON_COLOR(EVENT_B) DEF_ICON_COLOR(EVENT_C) diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h index df65c602fc4..b8443b952a8 100644 --- a/source/blender/editors/include/UI_interface.h +++ b/source/blender/editors/include/UI_interface.h @@ -318,8 +318,8 @@ typedef enum { UI_BUT_POIN_SHORT = 64, UI_BUT_POIN_INT = 96, UI_BUT_POIN_FLOAT = 128, - /* UI_BUT_POIN_FUNCTION = 192, */ /*UNUSED*/ - UI_BUT_POIN_BIT = 256, /* OR'd with a bit index*/ + // UI_BUT_POIN_FUNCTION = 192, /* UNUSED */ + UI_BUT_POIN_BIT = 256, /* OR'd with a bit index. */ } eButPointerType; /* requires (but->poin != NULL) */ @@ -386,6 +386,7 @@ typedef enum { /** Resize handle (resize uilist). */ UI_BTYPE_GRIP = 57 << 9, UI_BTYPE_DECORATOR = 58 << 9, + UI_BTYPE_DATASETROW = 59 << 9, } eButType; #define BUTTYPE (63 << 9) @@ -516,7 +517,7 @@ typedef struct ARegion *(*uiButSearchTooltipFn)(struct bContext *C, /* Must return allocated string. */ typedef char *(*uiButToolTipFunc)(struct bContext *C, void *argN, const char *tip); -typedef int (*uiButPushedStateFunc)(struct bContext *C, void *arg); +typedef int (*uiButPushedStateFunc)(struct uiBut *but, const void *arg); typedef void (*uiBlockHandleFunc)(struct bContext *C, void *arg, int event); @@ -1612,6 +1613,13 @@ int UI_searchbox_size_x(void); /* check if a string is in an existing search box */ int UI_search_items_find_index(uiSearchItems *items, const char *name); +void UI_but_hint_drawstr_set(uiBut *but, const char *string); +void UI_but_datasetrow_indentation_set(uiBut *but, int indentation); +void UI_but_datasetrow_component_set(uiBut *but, uint8_t geometry_component_type); +void UI_but_datasetrow_domain_set(uiBut *but, uint8_t attribute_domain); +uint8_t UI_but_datasetrow_component_get(uiBut *but); +uint8_t UI_but_datasetrow_domain_get(uiBut *but); + void UI_but_node_link_set(uiBut *but, struct bNodeSocket *socket, const float draw_color[4]); void UI_but_number_step_size_set(uiBut *but, float step_size); @@ -1650,7 +1658,7 @@ void UI_but_focus_on_enter_event(struct wmWindow *win, uiBut *but); void UI_but_func_hold_set(uiBut *but, uiButHandleHoldFunc func, void *argN); -void UI_but_func_pushed_state_set(uiBut *but, uiButPushedStateFunc func, void *arg); +void UI_but_func_pushed_state_set(uiBut *but, uiButPushedStateFunc func, const void *arg); struct PointerRNA *UI_but_extra_operator_icon_add(uiBut *but, const char *opname, diff --git a/source/blender/editors/include/UI_view2d.h b/source/blender/editors/include/UI_view2d.h index 999f42efe65..16729873b4e 100644 --- a/source/blender/editors/include/UI_view2d.h +++ b/source/blender/editors/include/UI_view2d.h @@ -288,7 +288,7 @@ void UI_view2d_smooth_view(struct bContext *C, /* Gizmo Types */ /* view2d_gizmo_navigate.c */ -/* Caller passes in own idname. */ +/* Caller passes in own idname. */ void VIEW2D_GGT_navigate_impl(struct wmGizmoGroupType *gzgt, const char *idname); /* Edge pan */ diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c index b72e0f30ef5..9e5e1a33564 100644 --- a/source/blender/editors/interface/interface.c +++ b/source/blender/editors/interface/interface.c @@ -985,12 +985,12 @@ bool UI_but_active_only(const bContext *C, ARegion *region, uiBlock *block, uiBu /** * \warning This must run after other handlers have been added, - * otherwise the handler wont be removed, see: T71112. + * otherwise the handler won't be removed, see: T71112. */ bool UI_block_active_only_flagged_buttons(const bContext *C, ARegion *region, uiBlock *block) { /* Running this command before end-block has run, means buttons that open menus - * wont have those menus correctly positioned, see T83539. */ + * won't have those menus correctly positioned, see T83539. */ BLI_assert(block->endblock); bool done = false; @@ -1198,7 +1198,7 @@ static bool ui_but_event_operator_string_from_menu(const bContext *C, /* annoying, create a property */ const IDPropertyTemplate val = {0}; - IDProperty *prop_menu = IDP_New(IDP_GROUP, &val, __func__); /* dummy, name is unimportant */ + IDProperty *prop_menu = IDP_New(IDP_GROUP, &val, __func__); /* Dummy, name is unimportant. */ IDP_AddToGroup(prop_menu, IDP_NewString(mt->idname, "name", sizeof(mt->idname))); if (WM_key_event_operator_string( @@ -1223,7 +1223,7 @@ static bool ui_but_event_operator_string_from_panel(const bContext *C, /* annoying, create a property */ const IDPropertyTemplate val = {0}; - IDProperty *prop_panel = IDP_New(IDP_GROUP, &val, __func__); /* dummy, name is unimportant */ + IDProperty *prop_panel = IDP_New(IDP_GROUP, &val, __func__); /* Dummy, name is unimportant. */ IDP_AddToGroup(prop_panel, IDP_NewString(pt->idname, "name", sizeof(pt->idname))); IDP_AddToGroup(prop_panel, IDP_New(IDP_INT, @@ -1804,7 +1804,7 @@ void UI_block_update_from_old(const bContext *C, uiBlock *block) static void ui_but_validate(const uiBut *but) { /* Number buttons must have a click-step, - * assert instead of correcting the value to ensure the caller knows what they're doing. */ + * assert instead of correcting the value to ensure the caller knows what they're doing. */ if (but->type == UI_BTYPE_NUM) { uiButNumber *number_but = (uiButNumber *)but; @@ -2105,8 +2105,10 @@ void UI_region_message_subscribe(ARegion *region, struct wmMsgBus *mbus) int ui_but_is_pushed_ex(uiBut *but, double *value) { int is_push = 0; - - if (but->bit) { + if (but->pushed_state_func) { + return but->pushed_state_func(but, but->pushed_state_arg); + } + else if (but->bit) { const bool state = !ELEM( but->type, UI_BTYPE_TOGGLE_N, UI_BTYPE_ICON_TOGGLE_N, UI_BTYPE_CHECKBOX_N); int lvalue; @@ -2253,7 +2255,6 @@ void ui_but_v3_get(uiBut *but, float vec[3]) } else if (but->pointype == UI_BUT_POIN_CHAR) { const char *cp = (char *)but->poin; - vec[0] = ((float)cp[0]) / 255.0f; vec[1] = ((float)cp[1]) / 255.0f; vec[2] = ((float)cp[2]) / 255.0f; @@ -3223,8 +3224,8 @@ void ui_but_range_set_hard(uiBut *but) /* note: this could be split up into functions which handle arrays and not */ void ui_but_range_set_soft(uiBut *but) { - /* ideally we would not limit this but practically, its more than - * enough worst case is very long vectors wont use a smart soft-range + /* Ideally we would not limit this, but practically it's more than + * enough. Worst case is very long vectors won't use a smart soft-range, * which isn't so bad. */ if (but->rnaprop) { @@ -3243,8 +3244,8 @@ void ui_but_range_set_soft(uiBut *but) RNA_property_int_ui_range(&but->rnapoin, but->rnaprop, &imin, &imax, &istep); softmin = (imin == INT_MIN) ? -1e4 : imin; softmax = (imin == INT_MAX) ? 1e4 : imax; - /*step = istep;*/ /*UNUSED*/ - /*precision = 1;*/ /*UNUSED*/ + // step = istep; /* UNUSED */ + // precision = 1; /* UNUSED */ if (is_array) { int value_range[2]; @@ -3263,8 +3264,8 @@ void ui_but_range_set_soft(uiBut *but) RNA_property_float_ui_range(&but->rnapoin, but->rnaprop, &fmin, &fmax, &fstep, &fprecision); softmin = (fmin == -FLT_MAX) ? (float)-1e4 : fmin; softmax = (fmax == FLT_MAX) ? (float)1e4 : fmax; - /*step = fstep;*/ /*UNUSED*/ - /*precision = fprecision;*/ /*UNUSED*/ + // step = fstep; /* UNUSED */ + // precision = fprecision; /* UNUSED */ /* Use shared min/max for array values, except for color alpha. */ if (is_array && !(subtype == PROP_COLOR && but->rnaindex == 3)) { @@ -3578,7 +3579,7 @@ static void ui_but_build_drawstr_float(uiBut *but, double value) subtype = RNA_property_subtype(but->rnaprop); } - /* Change negative zero to regular zero, without altering anything else. */ + /* Change negative zero to regular zero, without altering anything else. */ value += +0.0f; if (value == (double)FLT_MAX) { @@ -3903,6 +3904,10 @@ static void ui_but_alloc_info(const eButType type, alloc_size = sizeof(uiButCurveProfile); alloc_str = "uiButCurveProfile"; break; + case UI_BTYPE_DATASETROW: + alloc_size = sizeof(uiButDatasetRow); + alloc_str = "uiButDatasetRow"; + break; default: alloc_size = sizeof(uiBut); alloc_str = "uiBut"; @@ -4100,6 +4105,7 @@ static uiBut *ui_def_but(uiBlock *block, UI_BTYPE_BUT_MENU, UI_BTYPE_SEARCH_MENU, UI_BTYPE_PROGRESS_BAR, + UI_BTYPE_DATASETROW, UI_BTYPE_POPOVER)) { but->drawflag |= (UI_BUT_TEXT_LEFT | UI_BUT_ICON_LEFT); } @@ -4146,7 +4152,7 @@ static uiBut *ui_def_but(uiBlock *block, } #ifdef WITH_PYTHON - /* if the 'UI_OT_editsource' is running, extract the source info from the button */ + /* If the 'UI_OT_editsource' is running, extract the source info from the button. */ if (UI_editsource_enable_check()) { UI_editsource_active_but_test(but); } @@ -4184,7 +4190,7 @@ static void ui_def_but_rna__menu(bContext *UNUSED(C), uiLayout *layout, void *bu uiPopupBlockHandle *handle = block->handle; uiBut *but = (uiBut *)but_p; - /* see comment in ui_item_enum_expand, re: uiname */ + /* see comment in ui_item_enum_expand, re: `uiname`. */ const EnumPropertyItem *item_array; UI_block_flag_enable(block, UI_BLOCK_MOVEMOUSE_QUIT); @@ -4589,7 +4595,7 @@ static uiBut *ui_def_but_rna(uiBlock *block, if (proptype == PROP_POINTER) { /* If the button shows an ID, automatically set it as focused in context so operators can - * access it.*/ + * access it. */ const PointerRNA pptr = RNA_property_pointer_get(ptr, prop); if (pptr.data && RNA_struct_is_ID(pptr.type)) { but->context = CTX_store_add(&block->contexts, "id", &pptr); @@ -6336,10 +6342,11 @@ void UI_but_func_tooltip_set(uiBut *but, uiButToolTipFunc func, void *argN) but->tip_argN = argN; } -void UI_but_func_pushed_state_set(uiBut *but, uiButPushedStateFunc func, void *arg) +void UI_but_func_pushed_state_set(uiBut *but, uiButPushedStateFunc func, const void *arg) { but->pushed_state_func = func; but->pushed_state_arg = arg; + ui_but_update(but); } uiBut *uiDefBlockBut(uiBlock *block, @@ -6824,6 +6831,55 @@ uiBut *uiDefSearchButO_ptr(uiBlock *block, return but; } +void UI_but_datasetrow_indentation_set(uiBut *but, int indentation) +{ + uiButDatasetRow *but_dataset = (uiButDatasetRow *)but; + BLI_assert(but->type == UI_BTYPE_DATASETROW); + + but_dataset->indentation = indentation; + BLI_assert(indentation >= 0); +} + +/** + * Adds a hint to the button which draws right aligned, grayed out and never clipped. + */ +void UI_but_hint_drawstr_set(uiBut *but, const char *string) +{ + ui_but_add_shortcut(but, string, false); +} + +void UI_but_datasetrow_component_set(uiBut *but, uint8_t geometry_component_type) +{ + uiButDatasetRow *but_dataset_row = (uiButDatasetRow *)but; + BLI_assert(but->type == UI_BTYPE_DATASETROW); + + but_dataset_row->geometry_component_type = geometry_component_type; +} + +void UI_but_datasetrow_domain_set(uiBut *but, uint8_t attribute_domain) +{ + uiButDatasetRow *but_dataset_row = (uiButDatasetRow *)but; + BLI_assert(but->type == UI_BTYPE_DATASETROW); + + but_dataset_row->attribute_domain = attribute_domain; +} + +uint8_t UI_but_datasetrow_component_get(uiBut *but) +{ + uiButDatasetRow *but_dataset_row = (uiButDatasetRow *)but; + BLI_assert(but->type == UI_BTYPE_DATASETROW); + + return but_dataset_row->geometry_component_type; +} + +uint8_t UI_but_datasetrow_domain_get(uiBut *but) +{ + uiButDatasetRow *but_dataset_row = (uiButDatasetRow *)but; + BLI_assert(but->type == UI_BTYPE_DATASETROW); + + return but_dataset_row->attribute_domain; +} + void UI_but_node_link_set(uiBut *but, bNodeSocket *socket, const float draw_color[4]) { but->flag |= UI_BUT_NODE_LINK; diff --git a/source/blender/editors/interface/interface_draw.c b/source/blender/editors/interface/interface_draw.c index 40cfcaea883..05b6fcdded1 100644 --- a/source/blender/editors/interface/interface_draw.c +++ b/source/blender/editors/interface/interface_draw.c @@ -69,8 +69,7 @@ static int roundboxtype = UI_CNR_ALL; void UI_draw_roundbox_corner_set(int type) { /* Not sure the roundbox function is the best place to change this - * if this is undone, it's not that big a deal, only makes curves edges - * square for the */ + * if this is undone, it's not that big a deal, only makes curves edges square. */ roundboxtype = type; } diff --git a/source/blender/editors/interface/interface_eyedropper_gpencil_color.c b/source/blender/editors/interface/interface_eyedropper_gpencil_color.c index f2899fc0098..417807afff1 100644 --- a/source/blender/editors/interface/interface_eyedropper_gpencil_color.c +++ b/source/blender/editors/interface/interface_eyedropper_gpencil_color.c @@ -255,7 +255,7 @@ static void eyedropper_gpencil_color_set(bContext *C, const wmEvent *event, Eyed copy_v3_v3(col_conv, eye->color); } - /* Add material or Palette color*/ + /* Add material or Palette color. */ if (eye->mode == 0) { eyedropper_add_material(C, col_conv, only_stroke, only_fill, both); } diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index 5f98a501bec..f255507ddaf 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -1461,12 +1461,9 @@ static bool ui_drag_toggle_but_is_supported(const uiBut *but) /* Button pushed state to compare if other buttons match. Can be more * then just true or false for toggle buttons with more than 2 states. */ -static int ui_drag_toggle_but_pushed_state(bContext *C, uiBut *but) +static int ui_drag_toggle_but_pushed_state(uiBut *but) { if (but->rnapoin.data == NULL && but->poin == NULL && but->icon) { - if (but->pushed_state_func) { - return but->pushed_state_func(C, but->pushed_state_arg); - } /* Assume icon identifies a unique state, for buttons that * work through functions callbacks and don't have an boolean * value that indicates the state. */ @@ -1513,7 +1510,7 @@ static bool ui_drag_toggle_set_xy_xy( /* execute the button */ if (ui_drag_toggle_but_is_supported(but)) { /* is it pressed? */ - const int pushed_state_but = ui_drag_toggle_but_pushed_state(C, but); + const int pushed_state_but = ui_drag_toggle_but_pushed_state(but); if (pushed_state_but != pushed_state) { UI_but_execute(C, region, but); if (do_check) { @@ -1561,7 +1558,7 @@ static void ui_drag_toggle_set(bContext *C, uiDragToggleHandle *drag_info, const }; /* check if this is a different button, - * chances are high the button wont move about :) */ + * chances are high the button won't move about :) */ if (len_manhattan_v2v2(drag_info->but_cent_start, but_cent_new) > 1.0f) { if (fabsf(drag_info->but_cent_start[0] - but_cent_new[0]) < fabsf(drag_info->but_cent_start[1] - but_cent_new[1])) { @@ -1939,11 +1936,11 @@ static bool ui_but_drag_init(bContext *C, uiDragToggleHandle *drag_info = MEM_callocN(sizeof(*drag_info), __func__); ARegion *region_prev; - /* call here because regular mouse-up event wont run, + /* call here because regular mouse-up event won't run, * typically 'button_activate_exit()' handles this */ ui_apply_but_autokey(C, but); - drag_info->pushed_state = ui_drag_toggle_but_pushed_state(C, but); + drag_info->pushed_state = ui_drag_toggle_but_pushed_state(but); drag_info->but_cent_start[0] = BLI_rctf_cent_x(&but->rect); drag_info->but_cent_start[1] = BLI_rctf_cent_y(&but->rect); copy_v2_v2_int(drag_info->xy_init, &event->x); @@ -2187,6 +2184,9 @@ static void ui_apply_but( case UI_BTYPE_LISTROW: ui_apply_but_ROW(C, block, but, data); break; + case UI_BTYPE_DATASETROW: + ui_apply_but_ROW(C, block, but, data); + break; case UI_BTYPE_TAB: ui_apply_but_TAB(C, but, data); break; @@ -3068,7 +3068,7 @@ static bool ui_textedit_insert_buf(uiBut *but, if ((len + step >= data->maxlen) && (data->maxlen - (len + 1) > 0)) { if (UI_but_is_utf8(but)) { - /* shorten 'step' to a utf8 aligned size that fits */ + /* Shorten 'step' to a utf8 aligned size that fits. */ BLI_strnlen_utf8_ex(buf, data->maxlen - (len + 1), &step); } else { @@ -3414,7 +3414,7 @@ static void ui_textedit_end(bContext *C, uiBut *but, uiHandleButtonData *data) const int strip = BLI_utf8_invalid_strip(but->editstr, strlen(but->editstr)); /* not a file?, strip non utf-8 chars */ if (strip) { - /* wont happen often so isn't that annoying to keep it here for a while */ + /* won't happen often so isn't that annoying to keep it here for a while */ printf("%s: invalid utf8 - stripped chars %d\n", __func__, strip); } } @@ -3906,7 +3906,6 @@ static void ui_numedit_begin_set_values(uiBut *but, uiHandleButtonData *data) data->startvalue = ui_but_value_get(but); data->origvalue = data->startvalue; data->value = data->origvalue; - but->editval = &data->value; } static void ui_numedit_begin(uiBut *but, uiHandleButtonData *data) @@ -3935,6 +3934,7 @@ static void ui_numedit_begin(uiBut *but, uiHandleButtonData *data) } else { ui_numedit_begin_set_values(but, data); + but->editval = &data->value; float softmin = but->softmin; float softmax = but->softmax; @@ -4770,7 +4770,7 @@ static float ui_numedit_apply_snapf( UnitSettings *unit = but->block->unit; const int unit_type = UI_but_unit_type_get(but); if ((unit_type == PROP_UNIT_ROTATION) && (unit->system_rotation != USER_UNIT_ROT_RADIANS)) { - /* pass (degrees)*/ + /* Pass (degrees). */ } else { softrange = 20.0f; @@ -7851,6 +7851,9 @@ static int ui_do_button(bContext *C, uiBlock *block, uiBut *but, const wmEvent * case UI_BTYPE_LABEL: case UI_BTYPE_IMAGE: case UI_BTYPE_PROGRESS_BAR: + case UI_BTYPE_DATASETROW: + retval = ui_do_but_TOG(C, but, data, event); + break; case UI_BTYPE_NODE_SOCKET: retval = ui_do_but_EXIT(C, but, data, event); break; @@ -8216,8 +8219,8 @@ static void button_activate_state(bContext *C, uiBut *but, uiHandleButtonState s data->hold_action_timer = NULL; } - /* add a blocking ui handler at the window handler for blocking, modal states - * but not for popups, because we already have a window level handler*/ + /* Add a blocking ui handler at the window handler for blocking, modal states + * but not for popups, because we already have a window level handler. */ if (!(but->block->handle && but->block->handle->popup)) { if (button_modal_state(state)) { if (!button_modal_state(data->state)) { @@ -9662,7 +9665,7 @@ static void ui_region_auto_open_clear(ARegion *region) * This allows a menu to be open, * but send key events to the parent if there's no active buttons. * - * Without this keyboard navigation from menu's wont work. + * Without this keyboard navigation from menus won't work. */ static bool ui_menu_pass_event_to_parent_if_nonactive(uiPopupBlockHandle *menu, const uiBut *but, @@ -10015,7 +10018,7 @@ static int ui_handle_menu_event(bContext *C, } if (!but) { - /* wrap button or no active button*/ + /* Wrap button or no active button. */ uiBut *but_wrap = NULL; if (ELEM(scrolltype, MENU_SCROLL_UP, MENU_SCROLL_BOTTOM)) { but_wrap = ui_but_last(block); @@ -10359,7 +10362,7 @@ static int ui_handle_menu_event(bContext *C, * anymore why it was there? but it meant enter didn't work * for example when mouse was not over submenu */ if ((event->type == TIMER) || - (/*inside &&*/ (!menu->menuretval || (menu->menuretval & UI_RETURN_UPDATE)) && + (/* inside && */ (!menu->menuretval || (menu->menuretval & UI_RETURN_UPDATE)) && retval == WM_UI_HANDLER_CONTINUE)) { retval = ui_handle_menu_button(C, event, menu); } diff --git a/source/blender/editors/interface/interface_intern.h b/source/blender/editors/interface/interface_intern.h index 23856c41ceb..97b9bb66f07 100644 --- a/source/blender/editors/interface/interface_intern.h +++ b/source/blender/editors/interface/interface_intern.h @@ -137,19 +137,19 @@ extern const short ui_radial_dir_to_angle[8]; /** #PieMenuData.flags */ enum { - /** pie menu item collision is detected at 90 degrees */ + /** Pie menu item collision is detected at 90 degrees. */ UI_PIE_DEGREES_RANGE_LARGE = (1 << 0), - /** use initial center of pie menu to calculate direction */ + /** Use initial center of pie menu to calculate direction. */ UI_PIE_INITIAL_DIRECTION = (1 << 1), - /** pie menu is drag style */ + /** Pie menu is drag style. */ UI_PIE_DRAG_STYLE = (1 << 2), - /** mouse not far enough from center position */ + /** Mouse not far enough from center position. */ UI_PIE_INVALID_DIR = (1 << 3), - /** pie menu changed to click style, click to confirm */ + /** Pie menu changed to click style, click to confirm. */ UI_PIE_CLICK_STYLE = (1 << 4), - /** pie animation finished, do not calculate any more motion */ + /** Pie animation finished, do not calculate any more motion. */ UI_PIE_ANIMATION_FINISHED = (1 << 5), - /** pie gesture selection has been done, now wait for mouse motion to end */ + /** Pie gesture selection has been done, now wait for mouse motion to end. */ UI_PIE_GESTURE_END_WAIT = (1 << 6), }; @@ -279,7 +279,7 @@ struct uiBut { float *editvec; uiButPushedStateFunc pushed_state_func; - void *pushed_state_arg; + const void *pushed_state_arg; /* pointer back */ uiBlock *block; @@ -350,6 +350,15 @@ typedef struct uiButProgressbar { float progress; } uiButProgressbar; +/** Derived struct for #UI_BTYPE_DATASETROW. */ +typedef struct uiButDatasetRow { + uiBut but; + + uint8_t geometry_component_type; + uint8_t attribute_domain; + int indentation; +} uiButDatasetRow; + /** Derived struct for #UI_BTYPE_HSVCUBE. */ typedef struct uiButHSVCube { uiBut but; diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c index c04432a2912..1ab6d050b4d 100644 --- a/source/blender/editors/interface/interface_layout.c +++ b/source/blender/editors/interface/interface_layout.c @@ -2346,7 +2346,7 @@ void uiItemFullR(uiLayout *layout, * In this case we want the ability not to have an icon. * * We could pass an argument not to set the icon to begin with however this is the one case - * the functionality is needed. */ + * the functionality is needed. */ if (but && no_icon) { if ((icon == ICON_NONE) && (but->icon != ICON_NONE)) { ui_def_but_icon_clear(but); @@ -2860,7 +2860,7 @@ static uiBut *ui_item_menu(uiLayout *layout, int w = ui_text_icon_width(layout, name, icon, 1); const int h = UI_UNIT_Y; - if (layout->root->type == UI_LAYOUT_HEADER) { /* ugly .. */ + if (layout->root->type == UI_LAYOUT_HEADER) { /* Ugly! */ if (icon == ICON_NONE && force_menu) { /* pass */ } @@ -2893,7 +2893,7 @@ static uiBut *ui_item_menu(uiLayout *layout, } if (argN) { - /* ugly .. */ + /* ugly! */ if (arg != argN) { but->poin = (char *)but; } diff --git a/source/blender/editors/interface/interface_ops.c b/source/blender/editors/interface/interface_ops.c index 0cf3ad59903..ce5c17a0718 100644 --- a/source/blender/editors/interface/interface_ops.c +++ b/source/blender/editors/interface/interface_ops.c @@ -803,7 +803,7 @@ bool UI_context_copy_to_selected_list(bContext *C, } else if (RNA_struct_is_a(ptr->type, &RNA_Sequence)) { /* Special case when we do this for 'Sequence.lock'. - * (if the sequence is locked, it wont be in "selected_editable_sequences"). */ + * (if the sequence is locked, it won't be in "selected_editable_sequences"). */ const char *prop_id = RNA_property_identifier(prop); if (STREQ(prop_id, "lock")) { *r_lb = CTX_data_collection_get(C, "selected_sequences"); @@ -921,7 +921,7 @@ bool UI_context_copy_to_selected_list(bContext *C, * to handle situations like T41062... */ if ((*r_path = RNA_path_resolve_from_type_to_property(ptr, prop, &RNA_Sequence)) != NULL) { /* Special case when we do this for 'Sequence.lock'. - * (if the sequence is locked, it wont be in "selected_editable_sequences"). */ + * (if the sequence is locked, it won't be in "selected_editable_sequences"). */ const char *prop_id = RNA_property_identifier(prop); if (STREQ(prop_id, "lock")) { *r_lb = CTX_data_collection_get(C, "selected_sequences"); diff --git a/source/blender/editors/interface/interface_panel.c b/source/blender/editors/interface/interface_panel.c index 6694535e3af..dc0650af7a7 100644 --- a/source/blender/editors/interface/interface_panel.c +++ b/source/blender/editors/interface/interface_panel.c @@ -1188,7 +1188,6 @@ static void panel_draw_aligned_widgets(const uiStyle *style, /* Draw text label. */ if (panel->drawname[0] != '\0') { - /* + 0.001f to avoid flirting with float inaccuracy .*/ const rcti title_rect = { .xmin = widget_rect.xmin + (panel->labelofs / aspect) + scaled_unit * 1.1f, .xmax = widget_rect.xmax, diff --git a/source/blender/editors/interface/interface_query.c b/source/blender/editors/interface/interface_query.c index aa10d092f5e..95218e2e7e3 100644 --- a/source/blender/editors/interface/interface_query.c +++ b/source/blender/editors/interface/interface_query.c @@ -67,7 +67,8 @@ bool ui_but_is_toggle(const uiBut *but) UI_BTYPE_TOGGLE_N, UI_BTYPE_CHECKBOX, UI_BTYPE_CHECKBOX_N, - UI_BTYPE_ROW); + UI_BTYPE_ROW, + UI_BTYPE_DATASETROW); } /** diff --git a/source/blender/editors/interface/interface_region_tooltip.c b/source/blender/editors/interface/interface_region_tooltip.c index accfb78ab94..bf3425dd3eb 100644 --- a/source/blender/editors/interface/interface_region_tooltip.c +++ b/source/blender/editors/interface/interface_region_tooltip.c @@ -188,11 +188,11 @@ static void ui_tooltip_region_draw_cb(const bContext *UNUSED(C), ARegion *region /* tone_fg = rgb_to_grayscale(main_color); */ /* mix the colors */ - rgb_tint(value_color, 0.0f, 0.0f, tone_bg, 0.2f); /* light gray */ - rgb_tint(active_color, 0.6f, 0.2f, tone_bg, 0.2f); /* light blue */ - rgb_tint(normal_color, 0.0f, 0.0f, tone_bg, 0.4f); /* gray */ - rgb_tint(python_color, 0.0f, 0.0f, tone_bg, 0.5f); /* dark gray */ - rgb_tint(alert_color, 0.0f, 0.8f, tone_bg, 0.1f); /* red */ + rgb_tint(value_color, 0.0f, 0.0f, tone_bg, 0.2f); /* Light gray. */ + rgb_tint(active_color, 0.6f, 0.2f, tone_bg, 0.2f); /* Light blue. */ + rgb_tint(normal_color, 0.0f, 0.0f, tone_bg, 0.4f); /* Gray. */ + rgb_tint(python_color, 0.0f, 0.0f, tone_bg, 0.5f); /* Dark gray. */ + rgb_tint(alert_color, 0.0f, 0.8f, tone_bg, 0.1f); /* Red. */ /* draw text */ BLF_wordwrap(data->fstyle.uifont_id, data->wrap_width); diff --git a/source/blender/editors/interface/interface_style.c b/source/blender/editors/interface/interface_style.c index ad0c523a594..88ab6a377d0 100644 --- a/source/blender/editors/interface/interface_style.c +++ b/source/blender/editors/interface/interface_style.c @@ -245,7 +245,7 @@ void UI_fontstyle_draw_rotated(const uiFontStyle *fs, /* ignore UI_STYLE, always aligned to top */ - /* rotate counter-clockwise for now (assumes left-to-right language)*/ + /* Rotate counter-clockwise for now (assumes left-to-right language). */ xofs += height; yofs = BLF_width(fs->uifont_id, str, BLF_DRAW_STR_DUMMY_MAX) + 5; angle = M_PI_2; diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c index 3990ad68c4d..122a43513b1 100644 --- a/source/blender/editors/interface/interface_templates.c +++ b/source/blender/editors/interface/interface_templates.c @@ -344,7 +344,7 @@ typedef struct TemplateID { float scale; } TemplateID; -/* Search browse menu, assign */ +/* Search browse menu, assign. */ static void template_ID_set_property_exec_fn(bContext *C, void *arg_template, void *item) { TemplateID *template_ui = (TemplateID *)arg_template; @@ -3050,7 +3050,7 @@ static void colorband_flip_cb(bContext *C, ColorBand *coba) coba->data[a] = data_tmp[a]; } - /* may as well flip the cur*/ + /* May as well flip the `cur`. */ coba->cur = coba->tot - (coba->cur + 1); ED_undo_push(C, "Flip Color Ramp"); @@ -5883,7 +5883,7 @@ static void uilist_prepare(uiList *ui_list, } /* If list length changes or list is tagged to check this, - * and active is out of view, scroll to it .*/ + * and active is out of view, scroll to it. */ if (ui_list->list_last_len != len || ui_list->flag & UILST_SCROLL_TO_ACTIVE_ITEM) { if (activei_row < ui_list->list_scroll) { ui_list->list_scroll = activei_row; diff --git a/source/blender/editors/interface/interface_undo.c b/source/blender/editors/interface/interface_undo.c index 304d2254a81..40f196d9b45 100644 --- a/source/blender/editors/interface/interface_undo.c +++ b/source/blender/editors/interface/interface_undo.c @@ -107,7 +107,7 @@ void ui_textedit_undo_push(uiUndoStack_Text *stack, const char *text, int cursor } } - /* Create the new state */ + /* Create the new state. */ const int text_size = strlen(text) + 1; stack->current = MEM_mallocN(sizeof(uiUndoStack_Text_State) + text_size, __func__); stack->current->cursor_index = cursor_index; diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c index ce1109ad9df..8badc05065d 100644 --- a/source/blender/editors/interface/interface_widgets.c +++ b/source/blender/editors/interface/interface_widgets.c @@ -113,6 +113,7 @@ typedef enum { UI_WTYPE_LISTITEM, UI_WTYPE_PROGRESSBAR, UI_WTYPE_NODESOCKET, + UI_WTYPE_DATASETROW, } uiWidgetTypeEnum; /* Button state argument shares bits with 'uiBut.flag'. @@ -1531,14 +1532,14 @@ static void ui_text_clip_right_ex(const uiFontStyle *fstyle, int l_end = BLF_width_to_strlen(fstyle->uifont_id, str, max_len, okwidth - sep_strwidth, NULL); if (l_end > 0) { - /* At least one character, so clip and add the ellipsis. */ + /* At least one character, so clip and add the ellipsis. */ memcpy(str + l_end, sep, sep_len + 1); /* +1 for trailing '\0'. */ if (r_final_len) { *r_final_len = (size_t)(l_end) + sep_len; } } else { - /* Otherwise fit as much as we can without adding an ellipsis. */ + /* Otherwise fit as much as we can without adding an ellipsis. */ l_end = BLF_width_to_strlen(fstyle->uifont_id, str, max_len, okwidth, NULL); str[l_end] = '\0'; if (r_final_len) { @@ -3697,6 +3698,28 @@ static void widget_progressbar( rect->xmax += (BLI_rcti_size_x(&rect_prog) / 2); } +static void widget_datasetrow( + uiBut *but, uiWidgetColors *wcol, rcti *rect, int state, int UNUSED(roundboxalign)) +{ + uiButDatasetRow *but_componentrow = (uiButDatasetRow *)but; + uiWidgetBase wtb; + widget_init(&wtb); + + /* no outline */ + wtb.draw_outline = false; + const float rad = wcol->roundness * U.widget_unit; + round_box_edges(&wtb, UI_CNR_ALL, rect, rad); + + if ((state & UI_ACTIVE) || (state & UI_SELECT)) { + widgetbase_draw(&wtb, wcol); + } + + BLI_rcti_resize(rect, + BLI_rcti_size_x(rect) - UI_UNIT_X * but_componentrow->indentation, + BLI_rcti_size_y(rect)); + BLI_rcti_translate(rect, 0.5f * UI_UNIT_X * but_componentrow->indentation, 0); +} + static void widget_nodesocket( uiBut *but, uiWidgetColors *wcol, rcti *rect, int UNUSED(state), int UNUSED(roundboxalign)) { @@ -4469,6 +4492,10 @@ static uiWidgetType *widget_type(uiWidgetTypeEnum type) wt.custom = widget_progressbar; break; + case UI_WTYPE_DATASETROW: + wt.custom = widget_datasetrow; + break; + case UI_WTYPE_NODESOCKET: wt.custom = widget_nodesocket; break; @@ -4792,6 +4819,11 @@ void ui_draw_but(const bContext *C, struct ARegion *region, uiStyle *style, uiBu fstyle = &style->widgetlabel; break; + case UI_BTYPE_DATASETROW: + wt = widget_type(UI_WTYPE_DATASETROW); + fstyle = &style->widgetlabel; + break; + case UI_BTYPE_SCROLL: wt = widget_type(UI_WTYPE_SCROLL); break; diff --git a/source/blender/editors/interface/view2d.c b/source/blender/editors/interface/view2d.c index e4dad0f1a53..5eb20ae601b 100644 --- a/source/blender/editors/interface/view2d.c +++ b/source/blender/editors/interface/view2d.c @@ -535,7 +535,7 @@ static void ui_view2d_curRect_validate_resize(View2D *v2d, bool resize) curRatio = height / width; winRatio = winy / winx; - /* both sizes change (area/region maximized) */ + /* Both sizes change (area/region maximized). */ if (do_x == do_y) { if (do_x && do_y) { /* here is 1,1 case, so all others must be 0,0 */ @@ -991,10 +991,11 @@ void UI_view2d_totRect_set_resize(View2D *v2d, int width, int height, bool resiz if (ELEM(0, width, height)) { if (G.debug & G_DEBUG) { + /* XXX: temp debug info. */ printf("Error: View2D totRect set exiting: v2d=%p width=%d height=%d\n", (void *)v2d, width, - height); /* XXX temp debug info */ + height); } return; } @@ -1737,15 +1738,15 @@ bool UI_view2d_view_to_region_clip( void UI_view2d_view_to_region( const View2D *v2d, float x, float y, int *r_region_x, int *r_region_y) { - /* step 1: express given coordinates as proportional values */ + /* Step 1: express given coordinates as proportional values. */ x = (x - v2d->cur.xmin) / BLI_rctf_size_x(&v2d->cur); y = (y - v2d->cur.ymin) / BLI_rctf_size_y(&v2d->cur); - /* step 2: convert proportional distances to screen coordinates */ + /* Step 2: convert proportional distances to screen coordinates. */ x = v2d->mask.xmin + (x * BLI_rcti_size_x(&v2d->mask)); y = v2d->mask.ymin + (y * BLI_rcti_size_y(&v2d->mask)); - /* although we don't clamp to lie within region bounds, we must avoid exceeding size of ints */ + /* Although we don't clamp to lie within region bounds, we must avoid exceeding size of ints. */ *r_region_x = clamp_float_to_int(x); *r_region_y = clamp_float_to_int(y); } @@ -1768,13 +1769,13 @@ void UI_view2d_view_to_region_rcti(const View2D *v2d, const rctf *rect_src, rcti const float mask_size[2] = {BLI_rcti_size_x(&v2d->mask), BLI_rcti_size_y(&v2d->mask)}; rctf rect_tmp; - /* step 1: express given coordinates as proportional values */ + /* Step 1: express given coordinates as proportional values. */ rect_tmp.xmin = (rect_src->xmin - v2d->cur.xmin) / cur_size[0]; rect_tmp.xmax = (rect_src->xmax - v2d->cur.xmin) / cur_size[0]; rect_tmp.ymin = (rect_src->ymin - v2d->cur.ymin) / cur_size[1]; rect_tmp.ymax = (rect_src->ymax - v2d->cur.ymin) / cur_size[1]; - /* step 2: convert proportional distances to screen coordinates */ + /* Step 2: convert proportional distances to screen coordinates. */ rect_tmp.xmin = v2d->mask.xmin + (rect_tmp.xmin * mask_size[0]); rect_tmp.xmax = v2d->mask.xmin + (rect_tmp.xmax * mask_size[0]); rect_tmp.ymin = v2d->mask.ymin + (rect_tmp.ymin * mask_size[1]); @@ -1799,7 +1800,7 @@ bool UI_view2d_view_to_region_rcti_clip(const View2D *v2d, const rctf *rect_src, BLI_assert(rect_src->xmin <= rect_src->xmax && rect_src->ymin <= rect_src->ymax); - /* step 1: express given coordinates as proportional values */ + /* Step 1: express given coordinates as proportional values. */ rect_tmp.xmin = (rect_src->xmin - v2d->cur.xmin) / cur_size[0]; rect_tmp.xmax = (rect_src->xmax - v2d->cur.xmin) / cur_size[0]; rect_tmp.ymin = (rect_src->ymin - v2d->cur.ymin) / cur_size[1]; @@ -1807,7 +1808,7 @@ bool UI_view2d_view_to_region_rcti_clip(const View2D *v2d, const rctf *rect_src, if (((rect_tmp.xmax < 0.0f) || (rect_tmp.xmin > 1.0f) || (rect_tmp.ymax < 0.0f) || (rect_tmp.ymin > 1.0f)) == 0) { - /* step 2: convert proportional distances to screen coordinates */ + /* Step 2: convert proportional distances to screen coordinates. */ rect_tmp.xmin = v2d->mask.xmin + (rect_tmp.xmin * mask_size[0]); rect_tmp.xmax = v2d->mask.ymin + (rect_tmp.xmax * mask_size[0]); rect_tmp.ymin = v2d->mask.ymin + (rect_tmp.ymin * mask_size[1]); diff --git a/source/blender/editors/interface/view2d_gizmo_navigate.c b/source/blender/editors/interface/view2d_gizmo_navigate.c index 8d3f1beb947..30b4a7c097a 100644 --- a/source/blender/editors/interface/view2d_gizmo_navigate.c +++ b/source/blender/editors/interface/view2d_gizmo_navigate.c @@ -113,7 +113,7 @@ static struct NavigateGizmoInfo *navigate_params_from_space_type(short space_typ case SPACE_CLIP: return g_navigate_params_for_space_clip; default: - /* Used for sequencer. */ + /* Used for sequencer. */ return g_navigate_params_for_view2d; } } diff --git a/source/blender/editors/interface/view2d_ops.c b/source/blender/editors/interface/view2d_ops.c index 7ad28cd6069..69acfc657dc 100644 --- a/source/blender/editors/interface/view2d_ops.c +++ b/source/blender/editors/interface/view2d_ops.c @@ -187,7 +187,7 @@ static void view_pan_apply(bContext *C, wmOperator *op) view_pan_apply_ex(C, vpd, RNA_int_get(op->ptr, "deltax"), RNA_int_get(op->ptr, "deltay")); } -/* cleanup temp customdata */ +/* Cleanup temp custom-data. */ static void view_pan_exit(wmOperator *op) { MEM_SAFE_FREE(op->customdata); @@ -805,7 +805,7 @@ static void view_zoomstep_apply(bContext *C, wmOperator *op) /** \name View Zoom Operator (single step) * \{ */ -/* cleanup temp customdata */ +/* Cleanup temp custom-data. */ static void view_zoomstep_exit(wmOperator *op) { UI_view2d_zoom_cache_reset(); @@ -1034,7 +1034,7 @@ static void view_zoomdrag_apply(bContext *C, wmOperator *op) UI_view2d_sync(CTX_wm_screen(C), CTX_wm_area(C), v2d, V2D_LOCK_COPY); } -/* cleanup temp customdata */ +/* Cleanup temp custom-data. */ static void view_zoomdrag_exit(bContext *C, wmOperator *op) { UI_view2d_zoom_cache_reset(); @@ -1914,7 +1914,7 @@ static void scroller_activate_init(bContext *C, ED_region_tag_redraw_no_rebuild(region); } -/* cleanup temp customdata */ +/* Cleanup temp custom-data. */ static void scroller_activate_exit(bContext *C, wmOperator *op) { if (op->customdata) { @@ -2056,7 +2056,7 @@ static int scroller_activate_modal(bContext *C, wmOperator *op, const wmEvent *e return OPERATOR_FINISHED; } - /* otherwise, end the drag action */ + /* Otherwise, end the drag action. */ if (vsm->lastx || vsm->lasty) { scroller_activate_exit(C, op); return OPERATOR_FINISHED; diff --git a/source/blender/editors/mask/mask_editaction.c b/source/blender/editors/mask/mask_editaction.c index 1792f0e13bc..03f3f438829 100644 --- a/source/blender/editors/mask/mask_editaction.c +++ b/source/blender/editors/mask/mask_editaction.c @@ -283,25 +283,25 @@ void ED_masklayer_frames_duplicate(MaskLayer *mask_layer) { MaskLayerShape *mask_layer_shape, *gpfn; - /* error checking */ + /* Error checking. */ if (mask_layer == NULL) { return; } - /* duplicate selected frames */ + /* Duplicate selected frames. */ for (mask_layer_shape = mask_layer->splines_shapes.first; mask_layer_shape; mask_layer_shape = gpfn) { gpfn = mask_layer_shape->next; - /* duplicate this frame */ + /* Duplicate this frame. */ if (mask_layer_shape->flag & MASK_SHAPE_SELECT) { MaskLayerShape *mask_shape_dupe; - /* duplicate frame, and deselect self */ + /* Duplicate frame, and deselect self. */ mask_shape_dupe = BKE_mask_layer_shape_duplicate(mask_layer_shape); mask_layer_shape->flag &= ~MASK_SHAPE_SELECT; - /* XXX - how to handle duplicate frames? */ + /* XXX: how to handle duplicate frames? */ BLI_insertlinkafter(&mask_layer->splines_shapes, mask_layer_shape, mask_shape_dupe); } } diff --git a/source/blender/editors/mask/mask_ops.c b/source/blender/editors/mask/mask_ops.c index 1a6ac8597ae..3476f1ca735 100644 --- a/source/blender/editors/mask/mask_ops.c +++ b/source/blender/editors/mask/mask_ops.c @@ -83,7 +83,9 @@ Mask *ED_mask_new(bContext *C, const char *name) return mask; } -/* Get ative layer. Will create mask/layer to be sure there's an active layer. */ +/** + * Get active layer. Will create mask/layer to be sure there's an active layer. + */ MaskLayer *ED_mask_layer_ensure(bContext *C, bool *r_added_mask) { Mask *mask = CTX_data_edit_mask(C); diff --git a/source/blender/editors/mask/mask_query.c b/source/blender/editors/mask/mask_query.c index 401b6eac4f2..cd51026d20c 100644 --- a/source/blender/editors/mask/mask_query.c +++ b/source/blender/editors/mask/mask_query.c @@ -169,7 +169,7 @@ bool ED_mask_find_nearest_diff_point(const bContext *C, } if (r_u) { - /* TODO(sergey): Projection fails in some weirdo cases.. */ + /* TODO(sergey): Projection fails in some weirdo cases. */ if (use_project) { u = BKE_mask_spline_project_co(point_spline, point, u, normal_co, MASK_PROJ_ANY); } diff --git a/source/blender/editors/mask/mask_select.c b/source/blender/editors/mask/mask_select.c index 5c369afc4cd..3bb05a27c54 100644 --- a/source/blender/editors/mask/mask_select.c +++ b/source/blender/editors/mask/mask_select.c @@ -92,7 +92,6 @@ bool ED_mask_select_check(const Mask *mask) return false; } -/* 'sel' select */ void ED_mask_spline_select_set(MaskSpline *spline, const bool do_select) { if (do_select) { diff --git a/source/blender/editors/mask/mask_shapekey.c b/source/blender/editors/mask/mask_shapekey.c index 81bf66da72c..4ce4a416796 100644 --- a/source/blender/editors/mask/mask_shapekey.c +++ b/source/blender/editors/mask/mask_shapekey.c @@ -291,7 +291,7 @@ static int mask_shape_key_rekey_exec(bContext *C, wmOperator *op) BLI_addtail(&shapes_tmp, mask_layer_shape_tmp); } - /* re-key, note: cant modify the keys here since it messes uop */ + /* re-key, note: can't modify the keys here since it messes uop */ for (mask_layer_shape_tmp = shapes_tmp.first; mask_layer_shape_tmp; mask_layer_shape_tmp = mask_layer_shape_tmp->next) { BKE_mask_layer_evaluate(mask_layer, mask_layer_shape_tmp->frame, true); diff --git a/source/blender/editors/mesh/editmesh_bisect.c b/source/blender/editors/mesh/editmesh_bisect.c index fe627d38f46..42cf36dda81 100644 --- a/source/blender/editors/mesh/editmesh_bisect.c +++ b/source/blender/editors/mesh/editmesh_bisect.c @@ -347,7 +347,7 @@ static int mesh_bisect_exec(bContext *C, wmOperator *op) BMOperator bmop_attr; /* The fill normal sign is ignored as the face-winding is defined by surrounding faces. - * The normal is passed so triangle fill wont have to calculate it. */ + * The normal is passed so triangle fill won't have to calculate it. */ normalize_v3_v3(normal_fill, plane_no_local); /* Fill */ diff --git a/source/blender/editors/mesh/editmesh_extrude.c b/source/blender/editors/mesh/editmesh_extrude.c index e03390780f9..907881a44f3 100644 --- a/source/blender/editors/mesh/editmesh_extrude.c +++ b/source/blender/editors/mesh/editmesh_extrude.c @@ -509,7 +509,7 @@ static int edbm_extrude_context_exec(bContext *C, wmOperator *op) edbm_extrude_mesh(obedit, em, op); /* This normally happens when pushing undo but modal operators - * like this one don't push undo data until after modal mode is done.*/ + * like this one don't push undo data until after modal mode is done. */ EDBM_update(obedit->data, &(const struct EDBMUpdate_Params){ .calc_looptri = true, diff --git a/source/blender/editors/mesh/editmesh_knife.c b/source/blender/editors/mesh/editmesh_knife.c index f7cc95af619..0e2dd492e06 100644 --- a/source/blender/editors/mesh/editmesh_knife.c +++ b/source/blender/editors/mesh/editmesh_knife.c @@ -272,8 +272,7 @@ static void knifetool_draw_angle_snapping(const KnifeTool_OpData *kcd) float v1[3], v2[3]; float planes[4][4]; - planes_from_projmat( - (const float(*)[4])kcd->projmat, planes[2], planes[0], planes[3], planes[1], NULL, NULL); + planes_from_projmat(kcd->projmat, planes[2], planes[0], planes[1], planes[3], NULL, NULL); /* ray-cast all planes */ { @@ -938,7 +937,7 @@ static KnifeVert *knife_split_edge(KnifeTool_OpData *kcd, static void knife_start_cut(KnifeTool_OpData *kcd) { kcd->prev = kcd->curr; - kcd->curr.is_space = 0; /*TODO: why do we do this? */ + kcd->curr.is_space = 0; /* TODO: why do we do this? */ if (kcd->prev.vert == NULL && kcd->prev.edge == NULL) { float origin[3], origin_ofs[3]; @@ -953,7 +952,7 @@ static void knife_start_cut(KnifeTool_OpData *kcd) zero_v3(kcd->prev.cage); } - copy_v3_v3(kcd->prev.co, kcd->prev.cage); /*TODO: do we need this? */ + copy_v3_v3(kcd->prev.co, kcd->prev.cage); /* TODO: do we need this? */ copy_v3_v3(kcd->curr.cage, kcd->prev.cage); copy_v3_v3(kcd->curr.co, kcd->prev.co); } @@ -1161,7 +1160,7 @@ static void knife_add_single_cut(KnifeTool_OpData *kcd, } else if (lh1->kfe) { kfe->v1 = knife_split_edge(kcd, lh1->kfe, lh1->hit, lh1->cagehit, &kfe2); - lh1->v = kfe->v1; /* record the KnifeVert for this hit */ + lh1->v = kfe->v1; /* Record the #KnifeVert for this hit. */ } else { BLI_assert(lh1->f); @@ -1169,7 +1168,7 @@ static void knife_add_single_cut(KnifeTool_OpData *kcd, kfe->v1->is_cut = true; kfe->v1->is_face = true; knife_append_list(kcd, &kfe->v1->faces, lh1->f); - lh1->v = kfe->v1; /* record the KnifeVert for this hit */ + lh1->v = kfe->v1; /* Record the #KnifeVert for this hit. */ } if (lh2->v) { diff --git a/source/blender/editors/mesh/editmesh_loopcut.c b/source/blender/editors/mesh/editmesh_loopcut.c index 428bdbd637e..71319338a53 100644 --- a/source/blender/editors/mesh/editmesh_loopcut.c +++ b/source/blender/editors/mesh/editmesh_loopcut.c @@ -223,7 +223,7 @@ static void ringsel_finish(bContext *C, wmOperator *op) EDBM_selectmode_flush_ex(lcd->em, SCE_SELECT_VERTEX); } - /* we cant slide multiple edges in vertex select mode */ + /* we can't slide multiple edges in vertex select mode */ else if (is_macro && (cuts > 1) && (em->selectmode & SCE_SELECT_VERTEX)) { EDBM_selectmode_disable(lcd->vc.scene, em, SCE_SELECT_VERTEX, SCE_SELECT_EDGE); } diff --git a/source/blender/editors/mesh/editmesh_polybuild.c b/source/blender/editors/mesh/editmesh_polybuild.c index 92d97f76509..303cf41df0d 100644 --- a/source/blender/editors/mesh/editmesh_polybuild.c +++ b/source/blender/editors/mesh/editmesh_polybuild.c @@ -575,7 +575,7 @@ static int edbm_polybuild_dissolve_at_cursor_invoke(bContext *C, else { /* too involved to do inline */ - /* Avoid using selection so failure wont leave modified state. */ + /* Avoid using selection so failure won't leave modified state. */ EDBM_flag_disable_all(em, BM_ELEM_TAG); BM_elem_flag_enable(v_act, BM_ELEM_TAG); diff --git a/source/blender/editors/mesh/editmesh_rip.c b/source/blender/editors/mesh/editmesh_rip.c index 21262c95699..8626520ec37 100644 --- a/source/blender/editors/mesh/editmesh_rip.c +++ b/source/blender/editors/mesh/editmesh_rip.c @@ -170,15 +170,15 @@ static float edbm_rip_edge_side_measure( * * The method used for checking the side of selection is as follows... * - First tag all rip-able edges. - * - Build a contiguous edge list by looping over tagged edges and following each ones tagged + * - Build a contiguous edge list by looping over tagged edges and following each one's tagged * siblings in both directions. - * - The loops are not stored in an array, Instead both loops on either side of each edge has - * its index values set to count down from the last edge, this way, once we have the 'last' - * edge its very easy to walk down the connected edge loops. - * The reason for using loops like this is because when the edges are split we don't which - * face user gets the newly created edge - * (its as good as random so we cant assume new edges will be on once side). - * After splitting, its very simple to walk along boundary loops since each only has one edge + * - The loops are not stored in an array. Instead both loops on either side of each edge has + * its index values set to count down from the last edge. This way once we have the 'last' + * edge it's very easy to walk down the connected edge loops. + * The reason for using loops like this is because when the edges are split we don't know + * which face user gets the newly created edge + * (it's as good as random so we can't assume new edges will be on one side). + * After splitting, it's very simple to walk along boundary loops since each only has one edge * from a single side. * - The end loop pairs are stored in an array however to support multiple edge-selection-islands, * so you can rip multiple selections at once. @@ -189,7 +189,7 @@ static float edbm_rip_edge_side_measure( * * Limitation! * This currently works very poorly with intersecting edge islands - * (verts with more than 2 tagged edges). This is nice to but for now not essential. + * (verts with more than 2 tagged edges). This is nice to do but for now not essential. * * - campbell. */ @@ -270,7 +270,7 @@ static EdgeLoopPair *edbm_ripsel_looptag_helper(BMesh *bm) break; } - /* initialize */ + /* Initialize. */ e_first = e; v_step = e_first->v1; e_step = NULL; /* quiet warning, will never remain this value */ @@ -639,7 +639,7 @@ static int edbm_rip_invoke__vert(bContext *C, const wmEvent *event, Object *obed /* should we go ahead with edge rip or do we need to do special case, split off vertex?: * split off vertex if... - * - we cant find an edge - this means we are ripping a faces vert that is connected to other + * - we can't find an edge - this means we are ripping a faces vert that is connected to other * geometry only at the vertex. * - the boundary edge total is greater than 2, * in this case edge split _can_ work but we get far nicer results if we use this special case. diff --git a/source/blender/editors/mesh/editmesh_select.c b/source/blender/editors/mesh/editmesh_select.c index 6e5dd47e282..4a87266f1c9 100644 --- a/source/blender/editors/mesh/editmesh_select.c +++ b/source/blender/editors/mesh/editmesh_select.c @@ -547,8 +547,10 @@ BMEdge *EDBM_edge_find_nearest_ex(ViewContext *vc, ED_view3d_init_mats_rv3d(vc->obedit, vc->rv3d); - mesh_foreachScreenEdge( - vc, find_nearest_edge_center__doZBuf, &data, V3D_PROJ_TEST_CLIP_DEFAULT); + mesh_foreachScreenEdge(vc, + find_nearest_edge_center__doZBuf, + &data, + V3D_PROJ_TEST_CLIP_DEFAULT | V3D_PROJ_TEST_CLIP_CONTENT_DEFAULT); *r_dist_center_px_manhattan = data.dist; } @@ -601,7 +603,8 @@ BMEdge *EDBM_edge_find_nearest_ex(ViewContext *vc, *dist_px_manhattan_p; ED_view3d_init_mats_rv3d(vc->obedit, vc->rv3d); - mesh_foreachScreenEdge(vc, find_nearest_edge__doClosest, &data, clip_flag); + mesh_foreachScreenEdge( + vc, find_nearest_edge__doClosest, &data, clip_flag | V3D_PROJ_TEST_CLIP_CONTENT_DEFAULT); hit = (data.use_cycle && data.hit_cycle.edge) ? &data.hit_cycle : &data.hit; @@ -1802,7 +1805,7 @@ static bool mouse_mesh_loop( V3D_PROJ_RET_OK) { tdist = len_squared_v2v2(mvalf, co); if (tdist < best_dist) { - /* printf("Best face: %p (%f)\n", f, tdist);*/ + // printf("Best face: %p (%f)\n", f, tdist); best_dist = tdist; efa = f; } @@ -2568,7 +2571,7 @@ bool EDBM_selectmode_disable(Scene *scene, const short selectmode_fallback) { /* note essential, but switch out of vertex mode since the - * selected regions wont be nicely isolated after flushing */ + * selected regions won't be nicely isolated after flushing */ if (em->selectmode & selectmode_disable) { if (em->selectmode == selectmode_disable) { em->selectmode = selectmode_fallback; @@ -2980,7 +2983,7 @@ bool EDBM_select_interior_faces(BMEditMesh *em) int i_b = BM_elem_index_get(l_pair[1]->f); if (i_a != i_b) { /* Only for predictable results that don't depend on the order of radial loops, - * not essential. */ + * not essential. */ if (i_a > i_b) { SWAP(int, i_a, i_b); } @@ -3639,8 +3642,9 @@ static int edbm_select_linked_pick_exec(bContext *C, wmOperator *op) { ViewLayer *view_layer = CTX_data_view_layer(C); - const int object_index = RNA_int_get(op->ptr, "object_index"); - const int index = RNA_int_get(op->ptr, "index"); + /* Intentionally wrap negative values so the lookup fails. */ + const uint object_index = (uint)RNA_int_get(op->ptr, "object_index"); + const uint index = (uint)RNA_int_get(op->ptr, "index"); ele = EDBM_elem_from_index_any_multi(view_layer, object_index, index, &obedit); } diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c index 4c3149f2529..f7a63b3a522 100644 --- a/source/blender/editors/mesh/editmesh_tools.c +++ b/source/blender/editors/mesh/editmesh_tools.c @@ -984,7 +984,7 @@ static int edbm_add_edge_face_exec(bContext *C, wmOperator *op) * copying face data from surrounding, may have copied hidden face flag too. * * Important that faces use flushing since 'edges.out' - * wont include hidden edges that already existed. + * won't include hidden edges that already existed. */ BMO_slot_buffer_hflag_disable( em->bm, bmop.slots_out, "faces.out", BM_FACE, BM_ELEM_HIDDEN, true); @@ -1794,7 +1794,7 @@ static int edbm_face_make_planar_exec(bContext *C, wmOperator *op) EDBM_update(obedit->data, &(const struct EDBMUpdate_Params){ .calc_looptri = true, - .calc_normals = false, + .calc_normals = true, .is_destructive = true, }); } @@ -2309,8 +2309,8 @@ static int edbm_edge_rotate_selected_exec(bContext *C, wmOperator *op) } } - /* ok, we don't have two adjacent faces, but we do have two selected ones. - * that's an error condition.*/ + /* OK, we don't have two adjacent faces, but we do have two selected ones. + * that's an error condition. */ if (tot == 0) { continue; } @@ -3639,7 +3639,7 @@ void MESH_OT_remove_doubles(wmOperatorType *ot) /** \name Shape Key Propagate Operator * \{ */ -/* BMESH_TODO this should be properly encapsulated in a bmop. but later.*/ +/* BMESH_TODO this should be properly encapsulated in a bmop. but later. */ static bool shape_propagate(BMEditMesh *em) { BMIter iter; @@ -3732,7 +3732,7 @@ void MESH_OT_shape_propagate_to_all(wmOperatorType *ot) /** \name Blend from Shape Operator * \{ */ -/* BMESH_TODO this should be properly encapsulated in a bmop. but later.*/ +/* BMESH_TODO this should be properly encapsulated in a bmop. but later. */ static int edbm_blend_from_shape_exec(bContext *C, wmOperator *op) { Object *obedit_ref = CTX_data_edit_object(C); @@ -4038,7 +4038,7 @@ static float bm_edge_seg_isect(const float sco_a[2], b2 = ((x22 * y21) - (x21 * y22)) / xdiff2; } else { - m2 = MAXSLOPE; /* Vertical slope */ + m2 = MAXSLOPE; /* Vertical slope. */ b2 = x22; } @@ -4088,7 +4088,7 @@ static float bm_edge_seg_isect(const float sco_a[2], /* Calculate the distance from point to line. */ if (m2 != MAXSLOPE) { - /* sqrt(m2 * m2 + 1); Only looking for change in sign. Skip extra math .*/ + /* `sqrt(m2 * m2 + 1);` Only looking for change in sign. Skip extra math. */ dist = (y12 - m2 * x12 - b2); } else { @@ -4110,8 +4110,8 @@ static float bm_edge_seg_isect(const float sco_a[2], m1 = MAXSLOPE; b1 = x12; } - x2max = max_ff(x21, x22) + 0.001f; /* prevent missed edges */ - x2min = min_ff(x21, x22) - 0.001f; /* due to round off error */ + x2max = max_ff(x21, x22) + 0.001f; /* Prevent missed edges. */ + x2min = min_ff(x21, x22) - 0.001f; /* Due to round off error. */ y2max = max_ff(y21, y22) + 0.001f; y2min = min_ff(y21, y22) - 0.001f; @@ -4139,9 +4139,9 @@ static float bm_edge_seg_isect(const float sco_a[2], yi = (b1 * m2 - m1 * b2) / (m2 - m1); } - /* Intersect inside bounding box of edge?*/ + /* Intersect inside bounding box of edge? */ if ((xi >= x2min) && (xi <= x2max) && (yi <= y2max) && (yi >= y2min)) { - /* test for vertex intersect that may be 'close enough'*/ + /* Test for vertex intersect that may be 'close enough'. */ if (mode != KNIFE_MULTICUT) { if (xi <= (x21 + threshold) && xi >= (x21 - threshold)) { if (yi <= (y21 + threshold) && yi >= (y21 - threshold)) { @@ -4244,7 +4244,7 @@ static int edbm_knife_cut_exec(bContext *C, wmOperator *op) return OPERATOR_CANCELLED; } - /* store percentage of edge cut for KNIFE_EXACT here.*/ + /* Store percentage of edge cut for KNIFE_EXACT here. */ BMOpSlot *slot_edge_percents = BMO_slot_get(bmop.slots_in, "edge_percents"); BM_ITER_MESH (be, &iter, bm, BM_EDGES_OF_MESH) { bool is_cut = false; @@ -4252,7 +4252,7 @@ static int edbm_knife_cut_exec(bContext *C, wmOperator *op) const float *sco_a = screen_vert_coords[BM_elem_index_get(be->v1)]; const float *sco_b = screen_vert_coords[BM_elem_index_get(be->v2)]; - /* check for error value (vert cant be projected) */ + /* check for error value (vert can't be projected) */ if ((sco_a[0] != FLT_MAX) && (sco_b[0] != FLT_MAX)) { isect = bm_edge_seg_isect(sco_a, sco_b, mouse_path, len, mode, &isected); @@ -4757,7 +4757,7 @@ static int edbm_separate_exec(bContext *C, wmOperator *op) .calc_object_remap = true, })); - DEG_id_tag_update(&me->id, ID_RECALC_GEOMETRY); + DEG_id_tag_update(&me->id, ID_RECALC_GEOMETRY_ALL_MODES); WM_event_add_notifier(C, NC_GEOM | ND_DATA, me); } @@ -5827,7 +5827,7 @@ static int edbm_decimate_exec(bContext *C, wmOperator *op) EDBM_update(obedit->data, &(const struct EDBMUpdate_Params){ .calc_looptri = true, - .calc_normals = false, + .calc_normals = true, .is_destructive = true, }); } @@ -7072,9 +7072,9 @@ static void sort_bmelem_flag(bContext *C, } } - /* printf("%d vertices: %d to be affected...\n", totelem[0], affected[0]);*/ - /* printf("%d edges: %d to be affected...\n", totelem[1], affected[1]);*/ - /* printf("%d faces: %d to be affected...\n", totelem[2], affected[2]);*/ + // printf("%d vertices: %d to be affected...\n", totelem[0], affected[0]); + // printf("%d edges: %d to be affected...\n", totelem[1], affected[1]); + // printf("%d faces: %d to be affected...\n", totelem[2], affected[2]); if (affected[0] == 0 && affected[1] == 0 && affected[2] == 0) { for (j = 3; j--;) { if (pblock[j]) { @@ -7335,7 +7335,7 @@ static int edbm_bridge_tag_boundary_edges(BMesh *bm) /* check if its only used by selected faces */ BM_ITER_ELEM (f, &fiter, e, BM_FACES_OF_EDGE) { if (BM_elem_flag_test(f, BM_ELEM_SELECT)) { - /* tag face for removal*/ + /* Tag face for removal. */ if (!BM_elem_flag_test(f, BM_ELEM_TAG)) { BM_elem_flag_enable(f, BM_ELEM_TAG); totface_del++; @@ -8333,7 +8333,7 @@ enum { EDBM_CLNOR_MODAL_POINTTO_SET_USE_SELECTED = 114, }; -/* called in transform_ops.c, on each regeneration of keymaps */ +/* Called in transform_ops.c, on each regeneration of key-maps. */ wmKeyMap *point_normals_modal_keymap(wmKeyConfig *keyconf) { static const EnumPropertyItem modal_items[] = { diff --git a/source/blender/editors/mesh/editmesh_utils.c b/source/blender/editors/mesh/editmesh_utils.c index fa997d9b945..f2ee6f89ee5 100644 --- a/source/blender/editors/mesh/editmesh_utils.c +++ b/source/blender/editors/mesh/editmesh_utils.c @@ -475,7 +475,7 @@ void EDBM_select_more(BMEditMesh *em, const bool use_face_step) use_faces, use_face_step); BMO_op_exec(em->bm, &bmop); - /* don't flush selection in edge/vertex mode */ + /* Don't flush selection in edge/vertex mode. */ BMO_slot_buffer_hflag_enable( em->bm, bmop.slots_out, "geom.out", BM_ALL_NOLOOP, BM_ELEM_SELECT, use_faces ? true : false); BMO_op_finish(em->bm, &bmop); @@ -497,7 +497,7 @@ void EDBM_select_less(BMEditMesh *em, const bool use_face_step) use_faces, use_face_step); BMO_op_exec(em->bm, &bmop); - /* don't flush selection in edge/vertex mode */ + /* Don't flush selection in edge/vertex mode. */ BMO_slot_buffer_hflag_disable( em->bm, bmop.slots_out, "geom.out", BM_ALL_NOLOOP, BM_ELEM_SELECT, use_faces ? true : false); BMO_op_finish(em->bm, &bmop); @@ -1012,7 +1012,7 @@ BMFace *EDBM_uv_active_face_get(BMEditMesh *em, const bool sloppy, const bool se return NULL; } -/* can we edit UV's for this mesh?*/ +/* Can we edit UV's for this mesh? */ bool EDBM_uv_check(BMEditMesh *em) { /* some of these checks could be a touch overkill */ @@ -1223,12 +1223,12 @@ BMVert *EDBM_verts_mirror_get(BMEditMesh *em, BMVert *v) BMEdge *EDBM_verts_mirror_get_edge(BMEditMesh *em, BMEdge *e) { - BMVert *v1_mirr = EDBM_verts_mirror_get(em, e->v1); - if (v1_mirr) { - BMVert *v2_mirr = EDBM_verts_mirror_get(em, e->v2); - if (v2_mirr) { - return BM_edge_exists(v1_mirr, v2_mirr); - } + BMVert *v1_mirr, *v2_mirr; + if ((v1_mirr = EDBM_verts_mirror_get(em, e->v1)) && + (v2_mirr = EDBM_verts_mirror_get(em, e->v2)) && + /* While highly unlikely, a zero length central edges vertices can match, see T89342. */ + LIKELY(v1_mirr != v2_mirr)) { + return BM_edge_exists(v1_mirr, v2_mirr); } return NULL; @@ -1575,7 +1575,7 @@ int EDBM_elem_to_index_any(BMEditMesh *em, BMElem *ele) return index; } -BMElem *EDBM_elem_from_index_any(BMEditMesh *em, int index) +BMElem *EDBM_elem_from_index_any(BMEditMesh *em, uint index) { BMesh *bm = em->bm; @@ -1616,14 +1616,14 @@ int EDBM_elem_to_index_any_multi(ViewLayer *view_layer, } BMElem *EDBM_elem_from_index_any_multi(ViewLayer *view_layer, - int object_index, - int elem_index, + uint object_index, + uint elem_index, Object **r_obedit) { uint bases_len; Base **bases = BKE_view_layer_array_from_bases_in_edit_mode(view_layer, NULL, &bases_len); *r_obedit = NULL; - Object *obedit = ((uint)object_index < bases_len) ? bases[object_index]->object : NULL; + Object *obedit = (object_index < bases_len) ? bases[object_index]->object : NULL; MEM_freeN(bases); if (obedit != NULL) { BMEditMesh *em = BKE_editmesh_from_object(obedit); @@ -1690,8 +1690,8 @@ bool BMBVH_EdgeVisible(struct BMBVHTree *tree, scale_point(co1, co2, 0.99); scale_point(co3, co2, 0.99); - /* ok, idea is to generate rays going from the camera origin to the - * three points on the edge (v1, mid, v2)*/ + /* OK, idea is to generate rays going from the camera origin to the + * three points on the edge (v1, mid, v2). */ sub_v3_v3v3(dir1, origin, co1); sub_v3_v3v3(dir2, origin, co2); sub_v3_v3v3(dir3, origin, co3); @@ -1700,8 +1700,8 @@ bool BMBVH_EdgeVisible(struct BMBVHTree *tree, normalize_v3_length(dir2, epsilon); normalize_v3_length(dir3, epsilon); - /* offset coordinates slightly along view vectors, to avoid - * hitting the faces that own the edge.*/ + /* Offset coordinates slightly along view vectors, + * to avoid hitting the faces that own the edge. */ add_v3_v3v3(co1, co1, dir1); add_v3_v3v3(co2, co2, dir2); add_v3_v3v3(co3, co3, dir3); diff --git a/source/blender/editors/mesh/mesh_data.c b/source/blender/editors/mesh/mesh_data.c index 3a05cde7aa1..7c6dc6516ed 100644 --- a/source/blender/editors/mesh/mesh_data.c +++ b/source/blender/editors/mesh/mesh_data.c @@ -61,7 +61,6 @@ static CustomData *mesh_customdata_get_type(Mesh *me, const char htype, int *r_t BMesh *bm = (me->edit_mesh) ? me->edit_mesh->bm : NULL; int tot; - /* this */ switch (htype) { case BM_VERT: if (bm) { @@ -167,7 +166,7 @@ static void mesh_uv_reset_array(float **fuv, const int len) fuv[3][0] = 0.0; fuv[3][1] = 1.0; - /*make sure we ignore 2-sided faces*/ + /* Make sure we ignore 2-sided faces. */ } else if (len > 2) { float fac = 0.0f, dfac = 1.0f / (float)len; @@ -1097,7 +1096,7 @@ static void mesh_add_edges(Mesh *mesh, int len) totedge = mesh->totedge + len; - /* update customdata */ + /* Update custom-data. */ CustomData_copy(&mesh->edata, &edata, CD_MASK_MESH.emask, CD_DEFAULT, totedge); CustomData_copy_data(&mesh->edata, &edata, 0, 0, mesh->totedge); diff --git a/source/blender/editors/mesh/mesh_intern.h b/source/blender/editors/mesh/mesh_intern.h index 6a173911fd6..721486c149c 100644 --- a/source/blender/editors/mesh/mesh_intern.h +++ b/source/blender/editors/mesh/mesh_intern.h @@ -51,7 +51,7 @@ bool EDBM_op_call_and_selectf(struct BMEditMesh *em, const bool select_replace, const char *fmt, ...); -/* Same as above, but doesn't report errors.*/ +/* Same as above, but doesn't report errors. */ bool EDBM_op_call_silentf(struct BMEditMesh *em, const char *fmt, ...); /* these next two functions are the split version of EDBM_op_callf, so you can @@ -77,15 +77,15 @@ struct BMElem *EDBM_elem_from_selectmode(struct BMEditMesh *em, struct BMFace *efa); int EDBM_elem_to_index_any(struct BMEditMesh *em, struct BMElem *ele); -struct BMElem *EDBM_elem_from_index_any(struct BMEditMesh *em, int index); +struct BMElem *EDBM_elem_from_index_any(struct BMEditMesh *em, uint index); int EDBM_elem_to_index_any_multi(struct ViewLayer *view_layer, struct BMEditMesh *em, struct BMElem *ele, int *r_object_index); struct BMElem *EDBM_elem_from_index_any_multi(struct ViewLayer *view_layer, - int object_index, - int elem_index, + uint object_index, + uint elem_index, struct Object **r_obedit); bool edbm_extrude_edges_indiv(struct BMEditMesh *em, diff --git a/source/blender/editors/mesh/mesh_mirror.c b/source/blender/editors/mesh/mesh_mirror.c index 0f746dfd3a0..25d3eaf11d4 100644 --- a/source/blender/editors/mesh/mesh_mirror.c +++ b/source/blender/editors/mesh/mesh_mirror.c @@ -309,7 +309,7 @@ void ED_mesh_mirrtopo_init(BMEditMesh *em, last = 0; /* Get the pairs out of the sorted hashes, note, totvert+1 means we can use the previous 2, - * but you cant ever access the last 'a' index of MirrTopoPairs */ + * but you can't ever access the last 'a' index of MirrTopoPairs */ if (em) { BMVert **vtable = em->bm->vtable; for (a = 1; a <= totvert; a++) { diff --git a/source/blender/editors/object/object_add.c b/source/blender/editors/object/object_add.c index aefcf68390e..3f2356fa774 100644 --- a/source/blender/editors/object/object_add.c +++ b/source/blender/editors/object/object_add.c @@ -1854,7 +1854,7 @@ static int object_speaker_add_exec(bContext *C, wmOperator *op) /* hook them up */ BKE_nlatrack_add_strip(nlt, strip, is_liboverride); - /* auto-name the strip, and give the track an interesting name */ + /* Auto-name the strip, and give the track an interesting name. */ BLI_strncpy(nlt->name, DATA_("SoundTrack"), sizeof(nlt->name)); BKE_nlastrip_validate_name(adt, strip); @@ -2648,10 +2648,10 @@ static Base *duplibase_for_convert( ED_object_base_select(basen, BA_SELECT); ED_object_base_select(base, BA_DESELECT); - /* XXX An ugly hack needed because if we re-run depsgraph with some new MBall objects - * having same 'family name' as orig ones, they will affect end result of MBall computation... + /* XXX: An ugly hack needed because if we re-run depsgraph with some new meta-ball objects + * having same 'family name' as orig ones, they will affect end result of meta-ball computation. * For until we get rid of that name-based thingy in MBalls, that should do the trick - * (this is weak, but other solution (to change name of obn) is even worse imho). + * (this is weak, but other solution (to change name of `obn`) is even worse imho). * See T65996. */ const bool is_meta_ball = (obn->type == OB_MBALL); void *obdata = obn->data; @@ -2794,11 +2794,11 @@ static int object_convert_exec(bContext *C, wmOperator *op) basen = duplibase_for_convert(bmain, depsgraph, scene, view_layer, base, NULL); newob = basen->object; - /* decrement original mesh's usage count */ + /* Decrement original mesh's usage count. */ Mesh *me = newob->data; id_us_min(&me->id); - /* make a new copy of the mesh */ + /* Make a new copy of the mesh. */ newob->data = BKE_id_copy(bmain, &me->id); } else { @@ -2868,11 +2868,11 @@ static int object_convert_exec(bContext *C, wmOperator *op) basen = duplibase_for_convert(bmain, depsgraph, scene, view_layer, base, NULL); newob = basen->object; - /* decrement original mesh's usage count */ + /* Decrement original mesh's usage count. */ Mesh *me = newob->data; id_us_min(&me->id); - /* make a new copy of the mesh */ + /* Make a new copy of the mesh. */ newob->data = BKE_id_copy(bmain, &me->id); } else { @@ -2893,11 +2893,11 @@ static int object_convert_exec(bContext *C, wmOperator *op) basen = duplibase_for_convert(bmain, depsgraph, scene, view_layer, base, NULL); newob = basen->object; - /* decrement original mesh's usage count */ + /* Decrement original mesh's usage count. */ Mesh *me = newob->data; id_us_min(&me->id); - /* make a new copy of the mesh */ + /* Make a new copy of the mesh. */ newob->data = BKE_id_copy(bmain, &me->id); } else { @@ -2926,10 +2926,10 @@ static int object_convert_exec(bContext *C, wmOperator *op) basen = duplibase_for_convert(bmain, depsgraph, scene, view_layer, base, NULL); newob = basen->object; - /* decrement original curve's usage count */ + /* Decrement original curve's usage count. */ id_us_min(&((Curve *)newob->data)->id); - /* make a new copy of the curve */ + /* Make a new copy of the curve. */ newob->data = BKE_id_copy(bmain, ob->data); } else { @@ -3007,7 +3007,7 @@ static int object_convert_exec(bContext *C, wmOperator *op) basen = duplibase_for_convert(bmain, depsgraph, scene, view_layer, base, NULL); newob = basen->object; - /* decrement original curve's usage count */ + /* Decrement original curve's usage count. */ id_us_min(&((Curve *)newob->data)->id); /* make a new copy of the curve */ @@ -3091,11 +3091,11 @@ static int object_convert_exec(bContext *C, wmOperator *op) basen = duplibase_for_convert(bmain, depsgraph, scene, view_layer, base, NULL); newob = basen->object; - /* decrement original pointclouds's usage count */ + /* Decrement original point-cloud's usage count. */ PointCloud *pointcloud = newob->data; id_us_min(&pointcloud->id); - /* make a new copy of the pointcloud */ + /* Make a new copy of the point-cloud. */ newob->data = BKE_id_copy(bmain, &pointcloud->id); } else { diff --git a/source/blender/editors/object/object_bake_api.c b/source/blender/editors/object/object_bake_api.c index 3370476d466..e941b27879b 100644 --- a/source/blender/editors/object/object_bake_api.c +++ b/source/blender/editors/object/object_bake_api.c @@ -158,7 +158,7 @@ static int bake_modal(bContext *C, wmOperator *UNUSED(op), const wmEvent *event) /** * for exec() when there is no render job - * note: this wont check for the escape key being pressed, but doing so isn't thread-safe. + * note: this won't check for the escape key being pressed, but doing so isn't thread-safe. */ static int bake_break(void *UNUSED(rjv)) { @@ -1374,7 +1374,7 @@ static int bake(const BakeAPIRender *bkr, * the cage is supposed to have interpolated normals * between the faces unless the geometry is physically * split. So we create a copy of the low poly mesh without - * the eventual edge split.*/ + * the eventual edge split. */ if (md->type == eModifierType_EdgeSplit) { BLI_remlink(&ob_low_eval->modifiers, md); diff --git a/source/blender/editors/object/object_constraint.c b/source/blender/editors/object/object_constraint.c index 06d6f2b94f3..a7aa6b4d6a4 100644 --- a/source/blender/editors/object/object_constraint.c +++ b/source/blender/editors/object/object_constraint.c @@ -547,7 +547,7 @@ static void test_constraint( else { Curve *cu = ct->tar->data; - /* auto-set 'Path' setting on curve so this works */ + /* auto-set 'Path' setting on curve so this works. */ cu->flag |= CU_PATH; } } @@ -1977,7 +1977,7 @@ static bool get_new_constraint_target( (!only_curve && !only_mesh)) { /* Only use the object & bone if the bone is visible & selected - * since we may have multiple objects in pose mode at once. */ + * since we may have multiple objects in pose mode at once. */ bPoseChannel *pchan = BKE_pose_channel_active_or_first_selected(ob); if (pchan != NULL) { *tar_pchan = pchan; @@ -2100,7 +2100,7 @@ static int constraint_add_exec( } } - /* do type-specific tweaking to the constraint settings */ + /* Do type-specific tweaking to the constraint settings. */ switch (type) { case CONSTRAINT_TYPE_PYTHON: /* FIXME: this code is not really valid anymore */ { diff --git a/source/blender/editors/object/object_data_transfer.c b/source/blender/editors/object/object_data_transfer.c index 22c9d669ff3..7b7970fbfe5 100644 --- a/source/blender/editors/object/object_data_transfer.c +++ b/source/blender/editors/object/object_data_transfer.c @@ -611,23 +611,23 @@ void OBJECT_OT_data_transfer(wmOperatorType *ot) { PropertyRNA *prop; - /* Identifiers.*/ + /* Identifiers. */ ot->name = "Transfer Mesh Data"; ot->idname = "OBJECT_OT_data_transfer"; ot->description = "Transfer data layer(s) (weights, edge sharp, etc.) from active to selected meshes"; - /* API callbacks.*/ + /* API callbacks. */ ot->poll = data_transfer_poll; ot->poll_property = data_transfer_poll_property; ot->invoke = WM_menu_invoke; ot->exec = data_transfer_exec; ot->check = data_transfer_check; - /* Flags.*/ + /* Flags. */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; - /* Properties.*/ + /* Properties. */ prop = RNA_def_boolean(ot->srna, "use_reverse_transfer", false, @@ -886,7 +886,7 @@ void OBJECT_OT_datalayout_transfer(wmOperatorType *ot) /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; - /* Properties.*/ + /* Properties. */ edit_modifier_properties(ot); /* Data type to transfer. */ diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c index c8923bb55c1..36c51bcda7c 100644 --- a/source/blender/editors/object/object_edit.c +++ b/source/blender/editors/object/object_edit.c @@ -105,7 +105,7 @@ #include "CLG_log.h" -/* for menu/popup icons etc etc*/ +/* For menu/popup icons etc etc. */ #include "UI_interface.h" #include "UI_resources.h" @@ -1152,7 +1152,7 @@ void ED_objects_recalculate_paths(bContext *C, Scene *scene, eObjectPathCalcRang Depsgraph *depsgraph; bool free_depsgraph = false; /* For a single frame update it's faster to re-use existing dependency graph and avoid overhead - * of building all the relations and so on for a temporary one. */ + * of building all the relations and so on for a temporary one. */ if (range == OBJECT_PATH_CALC_RANGE_CURRENT_FRAME) { /* NOTE: Dependency graph will be evaluated at all the frames, but we first need to access some * nested pointers, like animation data. */ @@ -1990,7 +1990,7 @@ static int move_to_collection_invoke(bContext *C, wmOperator *op, const wmEvent * Technically we could use #wmOperator.customdata. However there is no free callback * called to an operator that exit with OPERATOR_INTERFACE to launch a menu. * - * So we are left with a memory that will necessarily leak. It's a small leak though.*/ + * So we are left with a memory that will necessarily leak. It's a small leak though. */ if (master_collection_menu == NULL) { master_collection_menu = MEM_callocN(sizeof(MoveToCollectionData), "MoveToCollectionData menu - expected eventual memleak"); diff --git a/source/blender/editors/object/object_hook.c b/source/blender/editors/object/object_hook.c index 7122fd09892..fcee2818b22 100644 --- a/source/blender/editors/object/object_hook.c +++ b/source/blender/editors/object/object_hook.c @@ -772,7 +772,7 @@ void OBJECT_OT_hook_remove(wmOperatorType *ot) /* flags */ /* this operator removes modifier which isn't stored in local undo stack, - * so redoing it from redo panel gives totally weird results */ + * so redoing it from redo panel gives totally weird results. */ ot->flag = /*OPTYPE_REGISTER|*/ OPTYPE_UNDO; /* properties */ @@ -931,7 +931,7 @@ void OBJECT_OT_hook_assign(wmOperatorType *ot) /* flags */ /* this operator changes data stored in modifier which doesn't get pushed to undo stack, - * so redoing it from redo panel gives totally weird results */ + * so redoing it from redo panel gives totally weird results. */ ot->flag = /*OPTYPE_REGISTER|*/ OPTYPE_UNDO; /* properties */ diff --git a/source/blender/editors/object/object_modifier.c b/source/blender/editors/object/object_modifier.c index 5f9301d2b48..5e2a068a579 100644 --- a/source/blender/editors/object/object_modifier.c +++ b/source/blender/editors/object/object_modifier.c @@ -2160,7 +2160,7 @@ static int multires_external_pack_exec(bContext *C, wmOperator *UNUSED(op)) return OPERATOR_CANCELLED; } - /* XXX don't remove.. */ + /* XXX don't remove. */ CustomData_external_remove(&me->ldata, &me->id, CD_MDISPS, me->totloop); return OPERATOR_FINISHED; diff --git a/source/blender/editors/object/object_ops.c b/source/blender/editors/object/object_ops.c index b50fc3c88fd..00ef439c18a 100644 --- a/source/blender/editors/object/object_ops.c +++ b/source/blender/editors/object/object_ops.c @@ -322,7 +322,7 @@ void ED_keymap_object(wmKeyConfig *keyconf) keymap = WM_keymap_ensure(keyconf, "Object Non-modal", 0, 0); /* Object Mode ---------------------------------------------------------------- */ - /* Note: this keymap gets disabled in non-objectmode, */ + /* Note: this keymap gets disabled in non-objectmode. */ keymap = WM_keymap_ensure(keyconf, "Object Mode", 0, 0); keymap->poll = object_mode_poll; } diff --git a/source/blender/editors/object/object_relations.c b/source/blender/editors/object/object_relations.c index cdf12bcb5df..e2b7a079775 100644 --- a/source/blender/editors/object/object_relations.c +++ b/source/blender/editors/object/object_relations.c @@ -1931,7 +1931,7 @@ static void single_object_users( } /* not an especially efficient function, only added so the single user - * button can be functional.*/ + * button can be functional. */ void ED_object_single_user(Main *bmain, Scene *scene, Object *ob) { FOREACH_SCENE_OBJECT_BEGIN (scene, ob_iter) { diff --git a/source/blender/editors/object/object_remesh.c b/source/blender/editors/object/object_remesh.c index 73ebe4e9e36..d3162aa62f0 100644 --- a/source/blender/editors/object/object_remesh.c +++ b/source/blender/editors/object/object_remesh.c @@ -139,6 +139,13 @@ static int voxel_remesh_exec(bContext *C, wmOperator *op) return OPERATOR_CANCELLED; } + if (mesh->totpoly == 0) { + return OPERATOR_CANCELLED; + } + + /* Output mesh will be all smooth or all flat shading. */ + const bool smooth_normals = mesh->mpoly[0].flag & ME_SMOOTH; + float isovalue = 0.0f; if (mesh->flag & ME_REMESH_REPROJECT_VOLUME) { isovalue = mesh->remesh_voxel_size * 0.3f; @@ -185,7 +192,7 @@ static int voxel_remesh_exec(bContext *C, wmOperator *op) BKE_mesh_nomain_to_mesh(new_mesh, mesh, ob, &CD_MASK_MESH, true); - if (mesh->flag & ME_REMESH_SMOOTH_NORMALS) { + if (smooth_normals) { BKE_mesh_smooth_flag_set(ob->data, true); } @@ -581,7 +588,7 @@ static int voxel_size_edit_invoke(bContext *C, wmOperator *op, const wmEvent *ev /* Write the text position into the matrix. */ copy_v3_v3(cd->text_mat[3], text_pos); - /* Scale the text. */ + /* Scale the text. */ float text_pos_word_space[3]; mul_v3_m4v3(text_pos_word_space, active_object->obmat, text_pos); const float pixelsize = ED_view3d_pixel_size(rv3d, text_pos_word_space); diff --git a/source/blender/editors/object/object_select.c b/source/blender/editors/object/object_select.c index 9160190764c..2fcf432bf18 100644 --- a/source/blender/editors/object/object_select.c +++ b/source/blender/editors/object/object_select.c @@ -579,7 +579,7 @@ static bool object_select_all_by_particle(bContext *C, Object *ob) CTX_DATA_BEGIN (C, Base *, base, visible_bases) { if (((base->flag & BASE_SELECTED) == 0) && ((base->flag & BASE_SELECTABLE) != 0)) { - /* loop through other particles*/ + /* Loop through other particles. */ ParticleSystem *psys; for (psys = base->object->particlesystem.first; psys; psys = psys->next) { diff --git a/source/blender/editors/object/object_transform.c b/source/blender/editors/object/object_transform.c index b9a3bc87e19..28c7ba0a774 100644 --- a/source/blender/editors/object/object_transform.c +++ b/source/blender/editors/object/object_transform.c @@ -1255,16 +1255,16 @@ static int object_origin_set_exec(bContext *C, wmOperator *op) } } else if (ob->type == OB_FONT) { - /* get from bb */ + /* Det from bounding-box. */ Curve *cu = ob->data; if (ob->runtime.bb == NULL && (centermode != ORIGIN_TO_CURSOR)) { - /* do nothing*/ + /* Do nothing. */ } else { if (centermode == ORIGIN_TO_CURSOR) { - /* done */ + /* Done. */ } else { /* extra 0.5 is the height o above line */ @@ -1615,6 +1615,7 @@ struct XFormAxisItem { struct XFormAxisData { ViewContext vc; + ViewDepths *depths; struct { float depth; float normal[3]; @@ -1684,8 +1685,8 @@ static void object_transform_axis_target_free_data(wmOperator *op) struct XFormAxisItem *item = xfd->object_data; #ifdef USE_RENDER_OVERRIDE - if (xfd->vc.rv3d->depths) { - xfd->vc.rv3d->depths->damaged = true; + if (xfd->depths) { + ED_view3d_depths_free(xfd->depths); } #endif @@ -1782,13 +1783,14 @@ static int object_transform_axis_target_invoke(bContext *C, wmOperator *op, cons vc.v3d->flag2 |= V3D_HIDE_OVERLAYS; #endif - ED_view3d_depth_override(vc.depsgraph, vc.region, vc.v3d, NULL, V3D_DEPTH_NO_GPENCIL, true); + ViewDepths *depths = NULL; + ED_view3d_depth_override(vc.depsgraph, vc.region, vc.v3d, NULL, V3D_DEPTH_NO_GPENCIL, &depths); #ifdef USE_RENDER_OVERRIDE vc.v3d->flag2 = flag2_prev; #endif - if (vc.rv3d->depths == NULL) { + if (depths == NULL) { BKE_report(op->reports, RPT_WARNING, "Unable to access depth buffer, using view plane"); return OPERATOR_CANCELLED; } @@ -1800,6 +1802,7 @@ static int object_transform_axis_target_invoke(bContext *C, wmOperator *op, cons /* Don't change this at runtime. */ xfd->vc = vc; + xfd->depths = depths; xfd->vc.mval[0] = event->mval[0]; xfd->vc.mval[1] = event->mval[1]; @@ -1863,7 +1866,7 @@ static int object_transform_axis_target_modal(bContext *C, wmOperator *op, const const bool is_translate_init = is_translate && (xfd->is_translate != is_translate); if (event->type == MOUSEMOVE || is_translate_init) { - const ViewDepths *depths = xfd->vc.rv3d->depths; + const ViewDepths *depths = xfd->depths; if (depths && ((uint)event->mval[0] < depths->w) && ((uint)event->mval[1] < depths->h)) { float depth_fl = 1.0f; ED_view3d_depth_read_cached(depths, event->mval, 0, &depth_fl); @@ -1895,7 +1898,7 @@ static int object_transform_axis_target_modal(bContext *C, wmOperator *op, const float normal[3]; bool normal_found = false; - if (ED_view3d_depth_read_cached_normal(&xfd->vc, event->mval, normal)) { + if (ED_view3d_depth_read_cached_normal(region, depths, event->mval, normal)) { normal_found = true; /* cheap attempt to smooth normals out a bit! */ @@ -1905,7 +1908,7 @@ static int object_transform_axis_target_modal(bContext *C, wmOperator *op, const if (x != 0 && y != 0) { const int mval_ofs[2] = {event->mval[0] + x, event->mval[1] + y}; float n[3]; - if (ED_view3d_depth_read_cached_normal(&xfd->vc, mval_ofs, n)) { + if (ED_view3d_depth_read_cached_normal(region, depths, mval_ofs, n)) { add_v3_v3(normal, n); } } diff --git a/source/blender/editors/object/object_vgroup.c b/source/blender/editors/object/object_vgroup.c index 3f40d637188..51a9a3676e7 100644 --- a/source/blender/editors/object/object_vgroup.c +++ b/source/blender/editors/object/object_vgroup.c @@ -516,14 +516,14 @@ static void mesh_defvert_mirror_update_internal(Object *ob, const int def_nr) { if (def_nr == -1) { - /* all vgroups, add groups where needed */ + /* All vgroups, add groups where needed. */ int flip_map_len; int *flip_map = BKE_object_defgroup_flip_map(ob, &flip_map_len, true); BKE_defvert_sync_mapped(dvert_dst, dvert_src, flip_map, flip_map_len, true); MEM_freeN(flip_map); } else { - /* single vgroup */ + /* Single vgroup. */ MDeformWeight *dw = BKE_defvert_ensure_index(dvert_dst, BKE_object_defgroup_flip_index(ob, def_nr, 1)); if (dw) { @@ -4068,7 +4068,7 @@ static int vgroup_do_remap(Object *ob, const char *name_array, wmOperator *op) bDeformGroup *def; int defbase_tot = BLI_listbase_count(&ob->defbase); - /* needs a dummy index at the start*/ + /* Needs a dummy index at the start. */ int *sort_map_update = MEM_mallocN(sizeof(int) * (defbase_tot + 1), "sort vgroups"); int *sort_map = sort_map_update + 1; @@ -4111,7 +4111,7 @@ static int vgroup_do_remap(Object *ob, const char *name_array, wmOperator *op) BKE_object_defgroup_array_get(ob->data, &dvert, &dvert_tot); - /*create as necessary*/ + /* Create as necessary. */ if (dvert) { while (dvert_tot--) { if (dvert->totweight) { @@ -4186,10 +4186,10 @@ static int vertex_group_sort_exec(bContext *C, wmOperator *op) int ret; int sort_type = RNA_enum_get(op->ptr, "sort_type"); - /*init remapping*/ + /* Init remapping. */ name_array = vgroup_init_remap(ob); - /*sort vgroup names*/ + /* Sort vgroup names. */ switch (sort_type) { case SORT_TYPE_NAME: BLI_listbase_sort(&ob->defbase, vgroup_sort_name); @@ -4199,7 +4199,7 @@ static int vertex_group_sort_exec(bContext *C, wmOperator *op) break; } - /*remap vgroup data to map to correct names*/ + /* Remap vgroup data to map to correct names. */ ret = vgroup_do_remap(ob, name_array, op); if (ret != OPERATOR_CANCELLED) { diff --git a/source/blender/editors/physics/dynamicpaint_ops.c b/source/blender/editors/physics/dynamicpaint_ops.c index a761701f60b..56f32ff603c 100644 --- a/source/blender/editors/physics/dynamicpaint_ops.c +++ b/source/blender/editors/physics/dynamicpaint_ops.c @@ -454,7 +454,7 @@ static void dpaint_bake_startjob(void *customdata, short *stop, short *do_update job->start = PIL_check_seconds_timer(); job->success = 1; - G.is_break = false; /* reset BKE_blender_test_break*/ + G.is_break = false; /* XXX annoying hack: needed to prevent data corruption when changing * scene frame in separate threads diff --git a/source/blender/editors/physics/particle_edit.c b/source/blender/editors/physics/particle_edit.c index 97994b65f40..3f15d572cdd 100644 --- a/source/blender/editors/physics/particle_edit.c +++ b/source/blender/editors/physics/particle_edit.c @@ -466,6 +466,7 @@ static int pe_x_mirror(Object *ob) typedef struct PEData { ViewContext vc; + ViewDepths *depths; const bContext *context; Main *bmain; @@ -524,14 +525,12 @@ static void PE_set_view3d_data(bContext *C, PEData *data) ED_view3d_viewcontext_init(C, &data->vc, data->depsgraph); if (!XRAY_ENABLED(data->vc.v3d)) { - if (!(data->vc.v3d->runtime.flag & V3D_RUNTIME_DEPTHBUF_OVERRIDDEN)) { - ED_view3d_depth_override(data->depsgraph, - data->vc.region, - data->vc.v3d, - data->vc.obact, - V3D_DEPTH_OBJECT_ONLY, - true); - } + ED_view3d_depth_override(data->depsgraph, + data->vc.region, + data->vc.v3d, + data->vc.obact, + V3D_DEPTH_OBJECT_ONLY, + &data->depths); } } @@ -570,6 +569,16 @@ static void PE_free_random_generator(PEData *data) } } +static void PE_data_free(PEData *data) +{ + PE_free_random_generator(data); + PE_free_shape_tree(data); + if (data->depths) { + ED_view3d_depths_free(data->depths); + data->depths = NULL; + } +} + /** \} */ /* -------------------------------------------------------------------- */ @@ -579,7 +588,7 @@ static void PE_free_random_generator(PEData *data) static bool key_test_depth(const PEData *data, const float co[3], const int screen_co[2]) { View3D *v3d = data->vc.v3d; - ViewDepths *vd = data->vc.rv3d->depths; + ViewDepths *vd = data->depths; float depth; /* nothing to do */ @@ -1447,7 +1456,7 @@ void recalc_emitter_field(Depsgraph *UNUSED(depsgraph), Object *UNUSED(ob), Part BLI_kdtree_3d_free(edit->emitter_field); totface = mesh->totface; - /*totvert=dm->getNumVerts(dm);*/ /*UNUSED*/ + // totvert = dm->getNumVerts(dm); /* UNUSED */ edit->emitter_cosnos = MEM_callocN(sizeof(float[6]) * totface, "emitter cosnos"); @@ -1555,7 +1564,7 @@ void update_world_cos(Object *ob, PTCacheEdit *edit) } static void update_velocities(PTCacheEdit *edit) { - /*TODO: get frs_sec properly */ + /* TODO: get frs_sec properly. */ float vec1[3], vec2[3], frs_sec, dfra; POINT_P; KEY_K; @@ -1871,15 +1880,13 @@ void PARTICLE_OT_select_all(wmOperatorType *ot) bool PE_mouse_particles(bContext *C, const int mval[2], bool extend, bool deselect, bool toggle) { - PEData data; + Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C); Scene *scene = CTX_data_scene(C); Object *ob = CTX_data_active_object(C); POINT_P; KEY_K; - PE_set_view3d_data(C, &data); - - PTCacheEdit *edit = PE_get_current(data.depsgraph, scene, ob); + PTCacheEdit *edit = PE_get_current(depsgraph, scene, ob); if (!PE_start_edit(edit)) { return false; @@ -1894,6 +1901,8 @@ bool PE_mouse_particles(bContext *C, const int mval[2], bool extend, bool desele } } + PEData data; + PE_set_view3d_data(C, &data); data.mval = mval; data.rad = ED_view3d_select_dist_px(); @@ -1913,6 +1922,8 @@ bool PE_mouse_particles(bContext *C, const int mval[2], bool extend, bool desele WM_event_add_notifier(C, NC_OBJECT | ND_PARTICLE | NA_SELECTED, data.ob); } + PE_data_free(&data); + return true; } @@ -2204,6 +2215,7 @@ static int select_linked_pick_exec(bContext *C, wmOperator *op) for_mouse_hit_keys(&data, select_keys, PSEL_NEAREST); PE_update_selection(data.depsgraph, data.scene, data.ob, 1); WM_event_add_notifier(C, NC_OBJECT | ND_PARTICLE | NA_SELECTED, data.ob); + PE_data_free(&data); return OPERATOR_FINISHED; } @@ -2298,11 +2310,14 @@ bool PE_box_select(bContext *C, const rcti *rect, const int sel_op) for_mouse_hit_keys(&data, select_key_op, PSEL_ALL_KEYS); } - if (data.is_changed) { - PE_update_selection(data.depsgraph, scene, ob, 1); + bool is_changed = data.is_changed; + PE_data_free(&data); + + if (is_changed) { + PE_update_selection(depsgraph, scene, ob, 1); WM_event_add_notifier(C, NC_OBJECT | ND_PARTICLE | NA_SELECTED, ob); } - return data.is_changed; + return is_changed; } /** \} */ @@ -2311,35 +2326,53 @@ bool PE_box_select(bContext *C, const rcti *rect, const int sel_op) /** \name Circle Select Operator * \{ */ -bool PE_circle_select(bContext *C, const int sel_op, const int mval[2], float rad) +static void pe_select_cache_free_generic_userdata(void *data) +{ + PE_data_free(data); + MEM_freeN(data); +} + +static void pe_select_cache_init_with_generic_userdata(bContext *C, wmGenericUserData *wm_userdata) +{ + struct PEData *data = MEM_callocN(sizeof(*data), __func__); + wm_userdata->data = data; + wm_userdata->free_fn = pe_select_cache_free_generic_userdata; + wm_userdata->use_free = true; + PE_set_view3d_data(C, data); +} + +bool PE_circle_select( + bContext *C, wmGenericUserData *wm_userdata, const int sel_op, const int mval[2], float rad) { BLI_assert(ELEM(sel_op, SEL_OP_SET, SEL_OP_ADD, SEL_OP_SUB)); Depsgraph *depsgraph = CTX_data_depsgraph_pointer(C); Scene *scene = CTX_data_scene(C); Object *ob = CTX_data_active_object(C); PTCacheEdit *edit = PE_get_current(depsgraph, scene, ob); - PEData data; if (!PE_start_edit(edit)) { return false; } - const bool select = (sel_op != SEL_OP_SUB); + if (wm_userdata->data == NULL) { + pe_select_cache_init_with_generic_userdata(C, wm_userdata); + } - PE_set_view3d_data(C, &data); - data.mval = mval; - data.rad = rad; - data.select = select; + PEData *data = wm_userdata->data; + data->mval = mval; + data->rad = rad; + data->select = (sel_op != SEL_OP_SUB); if (SEL_OP_USE_PRE_DESELECT(sel_op)) { - data.is_changed = PE_deselect_all_visible_ex(edit); + data->is_changed = PE_deselect_all_visible_ex(edit); } - for_mouse_hit_keys(&data, select_key, 0); - if (data.is_changed) { - PE_update_selection(data.depsgraph, scene, ob, 1); + for_mouse_hit_keys(data, select_key, 0); + + if (data->is_changed) { + PE_update_selection(depsgraph, scene, ob, 1); WM_event_add_notifier(C, NC_OBJECT | ND_PARTICLE | NA_SELECTED, ob); } - return data.is_changed; + return data->is_changed; } /** \} */ @@ -2425,8 +2458,11 @@ int PE_lasso_select(bContext *C, const int mcoords[][2], const int mcoords_len, } } - if (data.is_changed) { - PE_update_selection(data.depsgraph, scene, ob, 1); + bool is_changed = data.is_changed; + PE_data_free(&data); + + if (is_changed) { + PE_update_selection(depsgraph, scene, ob, 1); WM_event_add_notifier(C, NC_OBJECT | ND_PARTICLE | NA_SELECTED, ob); return OPERATOR_FINISHED; } @@ -2967,7 +3003,7 @@ static void remove_tagged_keys(Depsgraph *depsgraph, Object *ob, ParticleSystem LOOP_TAGGED_KEYS { new_totkey--; } - /* we can't have elements with less than two keys*/ + /* We can't have elements with less than two keys. */ if (new_totkey < 2) { point->flag |= PEP_TAG; } @@ -3106,7 +3142,7 @@ static void subdivide_particle(PEData *data, int pa_index) nkey++; } } - /*tip still not copied*/ + /* Tip still not copied. */ memcpy(nkey, key, sizeof(HairKey)); memcpy(nekey, ekey, sizeof(PTCacheEditKey)); @@ -3919,7 +3955,7 @@ static void brush_puff(PEData *data, int point_index, float mouse_distance) /* keep the same distance from the root or we get glitches T35406. */ dist_ensure_v3_v3fl(co, co_root, length_accum); - /* re-use dco to compare before and after translation and add to the offset */ + /* Re-use dco to compare before and after translation and add to the offset. */ copy_v3_v3(dco, key->co); mul_v3_m4v3(key->co, imat, co); @@ -3938,7 +3974,7 @@ static void brush_puff(PEData *data, int point_index, float mouse_distance) /* this is simple but looks bad, adds annoying kinks */ add_v3_v3(key->co, ofs); #else - /* translate (not rotate) the rest of the hair if its not selected */ + /* Translate (not rotate) the rest of the hair if its not selected. */ { /* NOLINTNEXTLINE: readability-redundant-preprocessor */ # if 0 /* kindof works but looks worse than what's below */ @@ -4921,7 +4957,7 @@ static void brush_edit_exit(wmOperator *op) { BrushEdit *bedit = op->customdata; - PE_free_random_generator(&bedit->data); + PE_data_free(&bedit->data); MEM_freeN(bedit); } diff --git a/source/blender/editors/physics/physics_fluid.c b/source/blender/editors/physics/physics_fluid.c index a94a2b9b764..cbab4fbd3d1 100644 --- a/source/blender/editors/physics/physics_fluid.c +++ b/source/blender/editors/physics/physics_fluid.c @@ -403,8 +403,10 @@ static void fluid_bake_startjob(void *customdata, short *stop, short *do_update, BLI_path_join( temp_dir, sizeof(temp_dir), fds->cache_directory, FLUID_DOMAIN_DIR_PARTICLES, NULL); BLI_path_abs(temp_dir, relbase); - BLI_dir_create_recursive( - temp_dir); /* Create 'particles' subdir if it does not exist already */ + + /* Create 'particles' subdir if it does not exist already */ + BLI_dir_create_recursive(temp_dir); + fds->cache_flag &= ~(FLUID_DOMAIN_BAKED_PARTICLES | FLUID_DOMAIN_OUTDATED_PARTICLES); fds->cache_flag |= FLUID_DOMAIN_BAKING_PARTICLES; job->pause_frame = &fds->cache_frame_pause_particles; diff --git a/source/blender/editors/physics/physics_intern.h b/source/blender/editors/physics/physics_intern.h index 4dc3ded9bd7..ef07d73826a 100644 --- a/source/blender/editors/physics/physics_intern.h +++ b/source/blender/editors/physics/physics_intern.h @@ -147,7 +147,7 @@ void RIGIDBODY_OT_mass_calculate(struct wmOperatorType *ot); void RIGIDBODY_OT_constraint_add(struct wmOperatorType *ot); void RIGIDBODY_OT_constraint_remove(struct wmOperatorType *ot); -/*rigidbody_world.c */ +/* rigidbody_world.c */ void RIGIDBODY_OT_world_add(struct wmOperatorType *ot); void RIGIDBODY_OT_world_remove(struct wmOperatorType *ot); void RIGIDBODY_OT_world_export(struct wmOperatorType *ot); diff --git a/source/blender/editors/render/render_internal.c b/source/blender/editors/render/render_internal.c index 0bec509cd7e..d39570857ab 100644 --- a/source/blender/editors/render/render_internal.c +++ b/source/blender/editors/render/render_internal.c @@ -285,7 +285,7 @@ static void screen_render_single_layer_set( scn = (Scene *)BLI_findstring(&mainp->scenes, scene_name, offsetof(ID, name) + 2); if (scn) { - /* camera switch wont have updated */ + /* camera switch won't have updated */ scn->r.cfra = (*scene)->r.cfra; BKE_scene_camera_switch_update(scn); @@ -773,7 +773,7 @@ static void render_endjob(void *rjv) * was locked before running the job. */ WM_set_locked_interface(G_MAIN->wm.first, false); - DEG_on_visible_update(G_MAIN, false); + DEG_tag_on_visible_update(G_MAIN, false); } } @@ -793,7 +793,7 @@ static int render_breakjob(void *rjv) /** * For exec() when there is no render job - * note: this wont check for the escape key being pressed, but doing so isn't thread-safe. + * note: this won't check for the escape key being pressed, but doing so isn't thread-safe. */ static int render_break(void *UNUSED(rjv)) { diff --git a/source/blender/editors/render/render_opengl.c b/source/blender/editors/render/render_opengl.c index 48f937fb4ec..17aaa5aa79d 100644 --- a/source/blender/editors/render/render_opengl.c +++ b/source/blender/editors/render/render_opengl.c @@ -141,7 +141,9 @@ typedef struct OGLRender { wmWindowManager *wm; wmWindow *win; - wmTimer *timer; /* use to check if running modal or not (invoke'd or exec'd)*/ + /** Use to check if running modal or not (invoke'd or exec'd). */ + wmTimer *timer; + void **movie_ctx_arr; TaskPool *task_pool; @@ -461,7 +463,7 @@ static void screen_opengl_render_write(OGLRender *oglrender) static void UNUSED_FUNCTION(addAlphaOverFloat)(float dest[4], const float source[4]) { - /* d = s + (1-alpha_s)d*/ + /* `d = s + (1-alpha_s)d` */ float mul; mul = 1.0f - source[3]; @@ -544,7 +546,7 @@ static void gather_frames_to_render_for_adt(const OGLRender *oglrender, const An continue; } - bool found = false; /* Not interesting, we just want a starting point for the for-loop.*/ + bool found = false; /* Not interesting, we just want a starting point for the for-loop. */ int key_index = BKE_fcurve_bezt_binarysearch_index( fcu->bezt, frame_start, fcu->totvert, &found); for (; key_index < fcu->totvert; key_index++) { @@ -645,7 +647,7 @@ static int gather_frames_to_render_for_id(LibraryIDLinkCallbackData *cb_data) case ID_WM: /* WindowManager */ case ID_LS: /* FreestyleLineStyle */ case ID_PAL: /* Palette */ - case ID_PC: /* PaintCurve */ + case ID_PC: /* PaintCurve */ case ID_CF: /* CacheFile */ case ID_WS: /* WorkSpace */ /* Only follow pointers to specific datablocks, to avoid ending up in diff --git a/source/blender/editors/render/render_preview.c b/source/blender/editors/render/render_preview.c index 0b0009c2a2f..f36ce7408b5 100644 --- a/source/blender/editors/render/render_preview.c +++ b/source/blender/editors/render/render_preview.c @@ -955,7 +955,7 @@ static void shader_preview_texture(ShaderPreview *sp, Tex *tex, Scene *sce, Rend for (int x = 0; x < width; x++) { tex_coord[0] = ((float)x / (float)height) * 2.0f - 1.0f; - /* Evaluate texture at tex_coord .*/ + /* Evaluate texture at tex_coord. */ TexResult texres = {0}; BKE_texture_get_value_ex(sce, tex, tex_coord, &texres, img_pool, color_manage); diff --git a/source/blender/editors/render/render_shading.c b/source/blender/editors/render/render_shading.c index b4cac58db1f..36492359d5c 100644 --- a/source/blender/editors/render/render_shading.c +++ b/source/blender/editors/render/render_shading.c @@ -227,7 +227,7 @@ static int material_slot_remove_exec(bContext *C, wmOperator *op) return OPERATOR_CANCELLED; } - /* Removing material slots in edit mode screws things up, see bug T21822.*/ + /* Removing material slots in edit mode screws things up, see bug T21822. */ if (ob == CTX_data_edit_object(C)) { BKE_report(op->reports, RPT_ERROR, "Unable to remove material slot in edit mode"); return OPERATOR_CANCELLED; diff --git a/source/blender/editors/render/render_update.c b/source/blender/editors/render/render_update.c index 3e8a1bda2f0..80b5623b9c3 100644 --- a/source/blender/editors/render/render_update.c +++ b/source/blender/editors/render/render_update.c @@ -216,7 +216,7 @@ void ED_render_view_layer_changed(Main *bmain, bScreen *screen) /***************************** Updates *********************************** * ED_render_id_flush_update gets called from DEG_id_tag_update, to do * * editor level updates when the ID changes. when these ID blocks are in * - * the dependency graph, we can get rid of the manual dependency checks */ + * the dependency graph, we can get rid of the manual dependency checks. */ static void material_changed(Main *UNUSED(bmain), Material *ma) { diff --git a/source/blender/editors/render/render_view.c b/source/blender/editors/render/render_view.c index eb4a040e891..97ecb67d6cc 100644 --- a/source/blender/editors/render/render_view.c +++ b/source/blender/editors/render/render_view.c @@ -51,9 +51,11 @@ /*********************** utilities for finding areas *************************/ -/* returns biggest area that is not uv/image editor. Note that it uses buttons */ -/* window as the last possible alternative. */ -/* would use BKE_screen_find_big_area(...) but this is too specific */ +/** + * Returns biggest area that is not uv/image editor. Note that it uses buttons + * window as the last possible alternative. + * would use #BKE_screen_find_big_area(...) but this is too specific. + */ static ScrArea *biggest_non_image_area(bContext *C) { bScreen *screen = CTX_wm_screen(C); diff --git a/source/blender/editors/scene/scene_edit.c b/source/blender/editors/scene/scene_edit.c index 2b2a0d10e29..5195bc8303a 100644 --- a/source/blender/editors/scene/scene_edit.c +++ b/source/blender/editors/scene/scene_edit.c @@ -120,7 +120,7 @@ void ED_scene_change_update(Main *bmain, Scene *scene, ViewLayer *layer) BKE_scene_set_background(bmain, scene); DEG_graph_relations_update(depsgraph); - DEG_on_visible_update(bmain, false); + DEG_tag_on_visible_update(bmain, false); ED_render_engine_changed(bmain, false); ED_update_for_newframe(bmain, depsgraph); diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c index 2814a4c9351..175efc5387b 100644 --- a/source/blender/editors/screen/area.c +++ b/source/blender/editors/screen/area.c @@ -1385,7 +1385,7 @@ static void region_rect_recursive( region->flag |= RGN_FLAG_SIZE_CLAMP_Y; } - /* We need to use a test that wont have been previously clamped. */ + /* We need to use a test that won't have been previously clamped. */ rcti winrct_test = { .xmin = region->winrct.xmin, .ymin = region->winrct.ymin, @@ -1461,7 +1461,7 @@ static void region_rect_recursive( } } else if (ELEM(alignment, RGN_ALIGN_VSPLIT, RGN_ALIGN_HSPLIT)) { - /* percentage subdiv*/ + /* Percentage subdiv. */ region->winrct = *remainder; if (alignment == RGN_ALIGN_HSPLIT) { @@ -2387,7 +2387,7 @@ void ED_area_newspace(bContext *C, ScrArea *area, int type, const bool skip_regi * However, add-on install for example, forces the header to the top which shouldn't * be applied back to the previous space type when closing - see: T57724 * - * Newly created windows wont have any space data, use the alignment + * Newly-created windows won't have any space data, use the alignment * the space type defaults to in this case instead * (needed for preferences to have space-type on bottom). */ @@ -3325,10 +3325,10 @@ void ED_region_header_layout(const bContext *C, ARegion *region) maxco += UI_HEADER_OFFSET; } - /* always as last */ + /* Always as last. */ UI_view2d_totRect_set(®ion->v2d, maxco, region->winy); - /* restore view matrix */ + /* Restore view matrix. */ UI_view2d_view_restore(C); } diff --git a/source/blender/editors/screen/screen_context.c b/source/blender/editors/screen/screen_context.c index 627a67358f2..45cf1775ccb 100644 --- a/source/blender/editors/screen/screen_context.c +++ b/source/blender/editors/screen/screen_context.c @@ -874,7 +874,7 @@ static eContextResult screen_ctx_editable_gpencil_strokes(const bContext *C, } } } - /* if not multiedit out of loop */ + /* If not multi-edit out of loop. */ if (!is_multiedit) { break; } diff --git a/source/blender/editors/screen/screen_draw.c b/source/blender/editors/screen/screen_draw.c index 2c45524ef94..dca464bbf22 100644 --- a/source/blender/editors/screen/screen_draw.c +++ b/source/blender/editors/screen/screen_draw.c @@ -244,7 +244,7 @@ void screen_draw_join_highlight(ScrArea *sa1, ScrArea *sa2) return; } - /* Rect of the combined areas.*/ + /* Rect of the combined areas. */ const bool vertical = SCREEN_DIR_IS_VERTICAL(dir); const rctf combined = { .xmin = vertical ? MAX2(sa1->totrct.xmin, sa2->totrct.xmin) : diff --git a/source/blender/editors/screen/screen_edit.c b/source/blender/editors/screen/screen_edit.c index bcfe30a829e..21800536503 100644 --- a/source/blender/editors/screen/screen_edit.c +++ b/source/blender/editors/screen/screen_edit.c @@ -68,7 +68,7 @@ static ScrArea *screen_addarea_ex(ScrAreaMap *area_map, ScrVert *top_left, ScrVert *top_right, ScrVert *bottom_right, - short spacetype) + const eSpace_Type space_type) { ScrArea *area = MEM_callocN(sizeof(ScrArea), "addscrarea"); @@ -76,7 +76,7 @@ static ScrArea *screen_addarea_ex(ScrAreaMap *area_map, area->v2 = top_left; area->v3 = top_right; area->v4 = bottom_right; - area->spacetype = spacetype; + area->spacetype = space_type; BLI_addtail(&area_map->areabase, area); @@ -87,10 +87,10 @@ static ScrArea *screen_addarea(bScreen *screen, ScrVert *left_top, ScrVert *right_top, ScrVert *right_bottom, - short spacetype) + const eSpace_Type space_type) { return screen_addarea_ex( - AREAMAP_FROM_SCREEN(screen), left_bottom, left_top, right_top, right_bottom, spacetype); + AREAMAP_FROM_SCREEN(screen), left_bottom, left_top, right_top, right_bottom, space_type); } static void screen_delarea(bContext *C, bScreen *screen, ScrArea *area) @@ -972,7 +972,7 @@ int ED_screen_area_active(const bContext *C) */ static ScrArea *screen_area_create_with_geometry(ScrAreaMap *area_map, const rcti *rect, - short spacetype) + eSpace_Type space_type) { ScrVert *bottom_left = screen_geom_vertex_add_ex(area_map, rect->xmin, rect->ymin); ScrVert *top_left = screen_geom_vertex_add_ex(area_map, rect->xmin, rect->ymax); @@ -984,7 +984,7 @@ static ScrArea *screen_area_create_with_geometry(ScrAreaMap *area_map, screen_geom_edge_add_ex(area_map, top_right, bottom_right); screen_geom_edge_add_ex(area_map, bottom_right, bottom_left); - return screen_addarea_ex(area_map, bottom_left, top_left, top_right, bottom_right, spacetype); + return screen_addarea_ex(area_map, bottom_left, top_left, top_right, bottom_right, space_type); } static void screen_area_set_geometry_rect(ScrArea *area, const rcti *rect) @@ -1001,7 +1001,7 @@ static void screen_area_set_geometry_rect(ScrArea *area, const rcti *rect) static void screen_global_area_refresh(wmWindow *win, bScreen *screen, - eSpace_Type space_type, + const eSpace_Type space_type, GlobalAreaAlign align, const rcti *rect, const short height_cur, diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c index f0e12ca60e9..159b649ec71 100644 --- a/source/blender/editors/screen/screen_ops.c +++ b/source/blender/editors/screen/screen_ops.c @@ -2117,16 +2117,16 @@ static ScrEdge *area_findsharededge(bScreen *screen, ScrArea *area, ScrArea *sb) ScrVert *sbv3 = sb->v3; ScrVert *sbv4 = sb->v4; - if (sav1 == sbv4 && sav2 == sbv3) { /* area to right of sb = W */ + if (sav1 == sbv4 && sav2 == sbv3) { /* Area to right of sb = W. */ return BKE_screen_find_edge(screen, sav1, sav2); } - if (sav2 == sbv1 && sav3 == sbv4) { /* area to bottom of sb = N */ + if (sav2 == sbv1 && sav3 == sbv4) { /* Area to bottom of sb = N. */ return BKE_screen_find_edge(screen, sav2, sav3); } - if (sav3 == sbv2 && sav4 == sbv1) { /* area to left of sb = E */ + if (sav3 == sbv2 && sav4 == sbv1) { /* Area to left of sb = E. */ return BKE_screen_find_edge(screen, sav3, sav4); } - if (sav1 == sbv2 && sav4 == sbv3) { /* area on top of sb = S*/ + if (sav1 == sbv2 && sav4 == sbv3) { /* Area on top of sb = S. */ return BKE_screen_find_edge(screen, sav1, sav4); } @@ -5598,13 +5598,13 @@ static void SCREEN_OT_workspace_cycle(wmOperatorType *ot) /* called in spacetypes.c */ void ED_operatortypes_screen(void) { - /* generic UI stuff */ + /* Generic UI stuff. */ WM_operatortype_append(SCREEN_OT_actionzone); WM_operatortype_append(SCREEN_OT_repeat_last); WM_operatortype_append(SCREEN_OT_repeat_history); WM_operatortype_append(SCREEN_OT_redo_last); - /* screen tools */ + /* Screen tools. */ WM_operatortype_append(SCREEN_OT_area_move); WM_operatortype_append(SCREEN_OT_area_split); WM_operatortype_append(SCREEN_OT_area_join); @@ -5631,7 +5631,7 @@ void ED_operatortypes_screen(void) WM_operatortype_append(SCREEN_OT_space_context_cycle); WM_operatortype_append(SCREEN_OT_workspace_cycle); - /*frame changes*/ + /* Frame changes. */ WM_operatortype_append(SCREEN_OT_frame_offset); WM_operatortype_append(SCREEN_OT_frame_jump); WM_operatortype_append(SCREEN_OT_keyframe_jump); @@ -5641,7 +5641,7 @@ void ED_operatortypes_screen(void) WM_operatortype_append(SCREEN_OT_animation_play); WM_operatortype_append(SCREEN_OT_animation_cancel); - /* new/delete */ + /* New/delete. */ WM_operatortype_append(SCREEN_OT_new); WM_operatortype_append(SCREEN_OT_delete); } diff --git a/source/blender/editors/sculpt_paint/paint_cursor.c b/source/blender/editors/sculpt_paint/paint_cursor.c index b249056eb7f..2c918033ad5 100644 --- a/source/blender/editors/sculpt_paint/paint_cursor.c +++ b/source/blender/editors/sculpt_paint/paint_cursor.c @@ -940,7 +940,7 @@ static void paint_draw_curve_cursor(Brush *brush, ViewContext *vc) int j; PaintCurvePoint *cp_next = cp + 1; float data[(PAINT_CURVE_NUM_SEGMENTS + 1) * 2]; - /* Use color coding to distinguish handles vs curve segments. */ + /* Use color coding to distinguish handles vs curve segments. */ draw_bezier_handle_lines(pos, selec_col, &cp->bez); draw_tri_point(pos, selec_col, pivot_col, &cp->bez.vec[1][0], 10.0f, cp->bez.f2); draw_rect_point( diff --git a/source/blender/editors/sculpt_paint/paint_image_2d.c b/source/blender/editors/sculpt_paint/paint_image_2d.c index f0923cf3d28..392f39bbb94 100644 --- a/source/blender/editors/sculpt_paint/paint_image_2d.c +++ b/source/blender/editors/sculpt_paint/paint_image_2d.c @@ -745,7 +745,7 @@ static void brush_painter_2d_tex_mapping(ImagePaintState *s, mapping->ymax = (ymax - ymin) / (float)diameter; } else if (mapmode == MTEX_MAP_MODE_3D) { - /* 3D mapping, just mapping to canvas 0..1 */ + /* 3D mapping, just mapping to canvas 0..1. */ mapping->xmin = 2.0f * (ipos[0] * invw - 0.5f); mapping->ymin = 2.0f * (ipos[1] * invh - 0.5f); mapping->xmax = 2.0f * invw; diff --git a/source/blender/editors/sculpt_paint/paint_image_proj.c b/source/blender/editors/sculpt_paint/paint_image_proj.c index 87d9a50aab9..7f01d7f437a 100644 --- a/source/blender/editors/sculpt_paint/paint_image_proj.c +++ b/source/blender/editors/sculpt_paint/paint_image_proj.c @@ -122,7 +122,7 @@ BLI_INLINE uchar f_to_char(const float val) * * When 3 - a brush should have ~9 buckets under it at once * ...this helps for threading while painting as well as - * avoiding initializing pixels that wont touch the brush */ + * avoiding initializing pixels that won't touch the brush */ #define PROJ_BUCKET_BRUSH_DIV 4 #define PROJ_BUCKET_RECT_MIN 4 @@ -391,7 +391,7 @@ typedef struct ProjPaintState { float *cavities; #ifndef PROJ_DEBUG_NOSEAMBLEED - /** store info about faces, if they are initialized etc*/ + /** Store info about faces, if they are initialized etc. */ ushort *faceSeamFlags; /** save the winding of the face in uv space, * helps as an extra validation step for seam detection. */ @@ -576,7 +576,9 @@ static Image *project_paint_face_clone_image(const ProjPaintState *ps, int tri_i return slot ? slot->ima : ps->clone_ima; } -/* fast projection bucket array lookup, use the safe version for bound checking */ +/** + * Fast projection bucket array lookup, use the safe version for bound checking. + */ static int project_bucket_offset(const ProjPaintState *ps, const float projCoSS[2]) { /* If we were not dealing with screen-space 2D coords we could simple do... @@ -957,7 +959,7 @@ static int line_isect_y(const float p1[2], const float p2[2], const float y_leve return ISECT_TRUE_P2; } - /** yuck, horizontal line, we cant do much here. */ + /** yuck, horizontal line, we can't do much here. */ y_diff = fabsf(p1[1] - p2[1]); if (y_diff < 0.000001f) { @@ -991,10 +993,10 @@ static int line_isect_x(const float p1[2], const float p2[2], const float x_leve return ISECT_TRUE_P2; } - /* yuck, horizontal line, we cant do much here */ + /* yuck, horizontal line, we can't do much here */ x_diff = fabsf(p1[0] - p2[0]); - /* yuck, vertical line, we cant do much here */ + /* yuck, vertical line, we can't do much here */ if (x_diff < 0.000001f) { *y_isect = (p1[0] + p2[0]) * 0.5f; return ISECT_TRUE; @@ -1071,7 +1073,7 @@ static bool pixel_bounds_uv(const float uv_quad[4][2], bounds_px->xmax = (int)(ibuf_x * max_uv[0]) + 1; bounds_px->ymax = (int)(ibuf_y * max_uv[1]) + 1; - /*printf("%d %d %d %d\n", min_px[0], min_px[1], max_px[0], max_px[1]);*/ + // printf("%d %d %d %d\n", min_px[0], min_px[1], max_px[0], max_px[1]); /* face uses no UV area when quantized to pixels? */ return (bounds_px->xmin == bounds_px->xmax || bounds_px->ymin == bounds_px->ymax) ? false : true; @@ -1114,7 +1116,7 @@ static bool pixel_bounds_array( bounds_px->ymax); } - /*printf("%d %d %d %d\n", min_px[0], min_px[1], max_px[0], max_px[1]);*/ + // printf("%d %d %d %d\n", min_px[0], min_px[1], max_px[0], max_px[1]); /* face uses no UV area when quantized to pixels? */ return (bounds_px->xmin == bounds_px->xmax || bounds_px->ymin == bounds_px->ymax) ? false : true; @@ -1785,7 +1787,7 @@ static float project_paint_uvpixel_mask(const ProjPaintState *ps, } if (angle_cos <= ps->normal_angle__cos) { - /* outsize the normal limit*/ + /* Outsize the normal limit. */ return 0.0f; } if (angle_cos < ps->normal_angle_inner__cos) { @@ -1889,7 +1891,7 @@ static ProjPixel *project_paint_uvpixel_init(const ProjPaintState *ps, int x_tile, y_tile; int x_round, y_round; int tile_offset; - /* volatile is important here to ensure pending check is not optimized away by compiler*/ + /* Volatile is important here to ensure pending check is not optimized away by compiler. */ volatile int tile_index; ProjPaintImage *projima = tinf->pjima; @@ -2074,7 +2076,7 @@ static bool line_clip_rect2f(const rctf *cliprect, return false; } - /* this is a single point (or close to)*/ + /* This is a single point (or close to). */ if (fabsf(l1[0] - l2[0]) < PROJ_PIXEL_TOLERANCE) { if (BLI_rctf_isect_pt_v(rect, l1)) { copy_v2_v2(l1_clip, l1); @@ -2101,7 +2103,7 @@ static bool line_clip_rect2f(const rctf *cliprect, return false; } - /* this is a single point (or close to)*/ + /* This is a single point (or close to). */ if (fabsf(l1[1] - l2[1]) < PROJ_PIXEL_TOLERANCE) { if (BLI_rctf_isect_pt_v(rect, l1)) { copy_v2_v2(l1_clip, l1); @@ -2689,7 +2691,7 @@ static void project_bucket_clip_face(const bool is_ortho, /* calc center */ float cent[2] = {0.0f, 0.0f}; - /*float up[2] = {0.0f, 1.0f};*/ + // float up[2] = {0.0f, 1.0f}; bool doubles; (*tot) = 0; @@ -2982,7 +2984,7 @@ static void project_paint_face_init(const ProjPaintState *ps, ImBuf *ibuf, ImBuf **tmpibuf) { - /* Projection vars, to get the 3D locations into screen space */ + /* Projection vars, to get the 3D locations into screen space. */ MemArena *arena = ps->arena_mt[thread_index]; LinkNode **bucketPixelNodes = ps->bucketRect + bucket_index; LinkNode *bucketFaceNodes = ps->bucketFaces[bucket_index]; @@ -3024,7 +3026,7 @@ static void project_paint_face_init(const ProjPaintState *ps, rcti bounds_px; /* Variables for getting UV-space bounds. */ - /* bucket bounds in UV space so we can init pixels only for this face, */ + /* Bucket bounds in UV space so we can init pixels only for this face. */ float lt_uv_pxoffset[3][2]; float xhalfpx, yhalfpx; const float ibuf_xf = (float)ibuf->x, ibuf_yf = (float)ibuf->y; @@ -3076,7 +3078,7 @@ static void project_paint_face_init(const ProjPaintState *ps, v2coSS = ps->screenCoords[lt_vtri[1]]; v3coSS = ps->screenCoords[lt_vtri[2]]; - /* This function gives is a concave polyline in UV space from the clipped tri*/ + /* This function gives is a concave polyline in UV space from the clipped tri. */ project_bucket_clip_face(is_ortho, is_flip_object, clip_rect, @@ -3165,7 +3167,7 @@ static void project_paint_face_init(const ProjPaintState *ps, } //#if 0 else if (has_x_isect) { - /* assuming the face is not a bow-tie - we know we cant intersect again on the X */ + /* assuming the face is not a bow-tie - we know we can't intersect again on the X */ break; } //#endif @@ -3252,7 +3254,7 @@ static void project_paint_face_init(const ProjPaintState *ps, uv_image_outset(ps, lt_uv_pxoffset, lt_puv, tri_index, ibuf->x, ibuf->y); } - /* ps->loopSeamUVs cant be modified when threading, now this is done we can unlock. */ + /* ps->loopSeamUVs can't be modified when threading, now this is done we can unlock. */ if (threaded) { /* Other threads could be modifying these vars */ BLI_thread_unlock(LOCK_CUSTOM1); @@ -3305,7 +3307,7 @@ static void project_paint_face_init(const ProjPaintState *ps, interp_v2_v2v2(seam_subsection[3], seam_uvs[0], seam_uvs[1], fac1); /* if the bucket_clip_edges values Z values was kept we could avoid this - * Inset needs to be added so occlusion tests wont hit adjacent faces */ + * Inset needs to be added so occlusion tests won't hit adjacent faces */ interp_v3_v3v3(edge_verts_inset_clip[0], insetCos[fidx1], insetCos[fidx2], fac1); interp_v3_v3v3(edge_verts_inset_clip[1], insetCos[fidx1], insetCos[fidx2], fac2); @@ -3661,7 +3663,7 @@ static void project_paint_delayed_face_init(ProjPaintState *ps, has_x_isect = has_isect = 1; } else if (has_x_isect) { - /* assuming the face is not a bow-tie - we know we cant intersect again on the X */ + /* assuming the face is not a bow-tie - we know we can't intersect again on the X */ break; } } @@ -4441,7 +4443,7 @@ static void project_paint_prepare_all_faces(ProjPaintState *ps, } } - /* build an array of images we use*/ + /* Build an array of images we use. */ if (ps->is_shared_user == false) { project_paint_build_proj_ima(ps, arena, &used_images); } @@ -4529,8 +4531,8 @@ static void project_paint_begin(const bContext *C, reset_threads = true; } - /* really high values could cause problems since it has to allocate a few - * (ps->buckets_x*ps->buckets_y) sized arrays */ + /* Really high values could cause problems since it has to allocate a few + * `(ps->buckets_x * ps->buckets_y)` sized arrays. */ CLAMP(ps->buckets_x, PROJ_BUCKET_RECT_MIN, PROJ_BUCKET_RECT_MAX); CLAMP(ps->buckets_y, PROJ_BUCKET_RECT_MIN, PROJ_BUCKET_RECT_MAX); @@ -4781,7 +4783,7 @@ static bool project_bucket_iter_next(ProjPaintState *ps, BLI_assert(bucket_y >= ps->bucketMin[1] && bucket_y < ps->bucketMax[1]); if (bucket_x >= ps->bucketMin[0] && bucket_x < ps->bucketMax[0]) { - /* use bucket_bounds for project_bucket_isect_circle and project_bucket_init*/ + /* Use bucket_bounds for #project_bucket_isect_circle and #project_bucket_init. */ project_bucket_bounds(ps, bucket_x, bucket_y, bucket_bounds); if ((ps->source != PROJ_SRC_VIEW) || @@ -5367,7 +5369,7 @@ static void do_projectpaint_thread(TaskPool *__restrict UNUSED(pool), void *ph_v dist_sq = len_squared_v2v2(projPixel->projCoSS, pos); - /*if (dist < radius) {*/ /* correct but uses a sqrtf */ + /* Faster alternative to `dist < radius` without a #sqrtf. */ if (dist_sq <= brush_radius_sq) { dist = sqrtf(dist_sq); @@ -5377,7 +5379,7 @@ static void do_projectpaint_thread(TaskPool *__restrict UNUSED(pool), void *ph_v float texrgb[3]; float mask; - /* Extra mask for normal, layer stencil, .. */ + /* Extra mask for normal, layer stencil, etc. */ float custom_mask = ((float)projPixel->mask) * (1.0f / 65535.0f); /* Mask texture. */ @@ -5460,7 +5462,7 @@ static void do_projectpaint_thread(TaskPool *__restrict UNUSED(pool), void *ph_v } /* end copy */ - /* validate undo tile, since we will modify t*/ + /* Validate undo tile, since we will modify it. */ *projPixel->valid = true; last_partial_redraw_cell = last_projIma->partRedrawRect + projPixel->bb_cell_index; @@ -5527,7 +5529,7 @@ static void do_projectpaint_thread(TaskPool *__restrict UNUSED(pool), void *ph_v if (tool == PAINT_TOOL_SMEAR) { - for (node = smearPixels; node; node = node->next) { /* this wont run for a float image */ + for (node = smearPixels; node; node = node->next) { /* this won't run for a float image */ projPixel = node->link; *projPixel->pixel.uint_pt = ((ProjPixelClone *)projPixel)->clonepx.uint; if (lock_alpha) { @@ -5547,7 +5549,7 @@ static void do_projectpaint_thread(TaskPool *__restrict UNUSED(pool), void *ph_v } else if (tool == PAINT_TOOL_SOFTEN) { - for (node = softenPixels; node; node = node->next) { /* this wont run for a float image */ + for (node = softenPixels; node; node = node->next) { /* this won't run for a float image */ projPixel = node->link; *projPixel->pixel.uint_pt = projPixel->newColor.uint; if (lock_alpha) { @@ -5825,7 +5827,7 @@ static void project_state_init(bContext *C, Object *ob, ProjPaintState *ps, int ps->is_maskbrush = (brush->mask_mtex.tex) ? true : false; } else { - /* brush may be NULL*/ + /* Brush may be NULL. */ ps->do_masking = false; ps->is_texbrush = false; ps->is_maskbrush = false; @@ -6481,6 +6483,8 @@ static Image *proj_paint_image_create(wmOperator *op, Main *bmain, bool is_data) alpha = RNA_boolean_get(op->ptr, "alpha"); RNA_string_get(op->ptr, "name", imagename); } + + /* TODO(lukas): Add option for tiled image. */ ima = BKE_image_add_generated(bmain, width, height, @@ -6491,7 +6495,7 @@ static Image *proj_paint_image_create(wmOperator *op, Main *bmain, bool is_data) color, false, is_data, - false); /* TODO(lukas): Add option */ + false); return ima; } diff --git a/source/blender/editors/sculpt_paint/paint_ops.c b/source/blender/editors/sculpt_paint/paint_ops.c index fed89e02e8f..e2b21145c2d 100644 --- a/source/blender/editors/sculpt_paint/paint_ops.c +++ b/source/blender/editors/sculpt_paint/paint_ops.c @@ -62,7 +62,7 @@ /* Brush operators */ static int brush_add_exec(bContext *C, wmOperator *UNUSED(op)) { - /*int type = RNA_enum_get(op->ptr, "type");*/ + // int type = RNA_enum_get(op->ptr, "type"); Paint *paint = BKE_paint_get_active_from_context(C); Brush *br = BKE_paint_brush(paint); Main *bmain = CTX_data_main(C); @@ -97,7 +97,7 @@ static void BRUSH_OT_add(wmOperatorType *ot) static int brush_add_gpencil_exec(bContext *C, wmOperator *UNUSED(op)) { - /*int type = RNA_enum_get(op->ptr, "type");*/ + // int type = RNA_enum_get(op->ptr, "type"); ToolSettings *ts = CTX_data_tool_settings(C); Paint *paint = &ts->gp_paint->paint; Brush *br = BKE_paint_brush(paint); @@ -1385,7 +1385,7 @@ void ED_keymap_paint(wmKeyConfig *keyconf) keymap = WM_keymap_ensure(keyconf, "Weight Paint", 0, 0); keymap->poll = weight_paint_mode_poll; - /*Weight paint's Vertex Selection Mode */ + /* Weight paint's Vertex Selection Mode. */ keymap = WM_keymap_ensure(keyconf, "Paint Vertex Selection (Weight, Vertex)", 0, 0); keymap->poll = vert_paint_poll; diff --git a/source/blender/editors/sculpt_paint/paint_stroke.c b/source/blender/editors/sculpt_paint/paint_stroke.c index e4ff941629f..a8cb05c6d2c 100644 --- a/source/blender/editors/sculpt_paint/paint_stroke.c +++ b/source/blender/editors/sculpt_paint/paint_stroke.c @@ -492,7 +492,7 @@ static void paint_brush_stroke_add_step(bContext *C, * It's strange that only texpaint had these guards. */ #if 0 /* special exception here for too high pressure values on first touch in - * windows for some tablets, then we just skip first touch .. */ + * windows for some tablets, then we just skip first touch. */ if (tablet && (pressure >= 0.99f) && ((pop->s.brush->flag & BRUSH_SPACING_PRESSURE) || BKE_brush_use_alpha_pressure(pop->s.brush) || @@ -1129,7 +1129,7 @@ bool paint_supports_dynamic_tex_coords(Brush *br, ePaintMode mode) #define PAINT_STROKE_MODAL_CANCEL 1 -/* called in paint_ops.c, on each regeneration of keymaps */ +/* Called in paint_ops.c, on each regeneration of key-maps. */ struct wmKeyMap *paint_stroke_modal_keymap(struct wmKeyConfig *keyconf) { static struct EnumPropertyItem modal_items[] = { diff --git a/source/blender/editors/sculpt_paint/paint_vertex.c b/source/blender/editors/sculpt_paint/paint_vertex.c index daccc6f228a..fe36d62b832 100644 --- a/source/blender/editors/sculpt_paint/paint_vertex.c +++ b/source/blender/editors/sculpt_paint/paint_vertex.c @@ -725,7 +725,7 @@ typedef struct WeightPaintInfo { * length of defbase_tot */ const bool *lock_flags; /* boolean array for selected bones, - * length of defbase_tot, cant be const because of how its passed */ + * length of defbase_tot, can't be const because of how it's passed */ const bool *defbase_sel; /* same as WeightPaintData.vgroup_validmap, * only added here for convenience */ @@ -917,7 +917,7 @@ static void do_weight_paint_vertex_single( * 'resist' so you couldn't instantly zero out other weights by painting 1.0 on the active. * * However this gave a problem since applying mirror, then normalize both verts - * the resulting weight wont match on both sides. + * the resulting weight won't match on both sides. * * If this 'resisting', slower normalize is nicer, we could call * do_weight_paint_normalize_all() and only use... @@ -941,13 +941,13 @@ static void do_weight_paint_vertex_single( * - Auto normalize is enabled. * - The group you are painting onto has a L / R version. * - * We want L/R vgroups to have the same weight but this cant be if both are over 0.5, + * We want L/R vgroups to have the same weight but this can't be if both are over 0.5, * We _could_ have special check for that, but this would need its own * normalize function which holds 2 groups from changing at once. * * So! just balance out the 2 weights, it keeps them equal and everything normalized. * - * While it wont hit the desired weight immediately as the user waggles their mouse, + * While it won't hit the desired weight immediately as the user waggles their mouse, * constant painting and re-normalizing will get there. this is also just simpler logic. * - campbell */ dw_mirr->weight = dw->weight = (dw_mirr->weight + dw->weight) * 0.5f; @@ -2750,11 +2750,11 @@ static bool vpaint_stroke_test_start(bContext *C, struct wmOperator *op, const f * if not we can skip face map trickiness */ if (vertex_paint_use_fast_update_check(ob)) { vpd->use_fast_update = true; - /* printf("Fast update!\n");*/ + // printf("Fast update!\n"); } else { vpd->use_fast_update = false; - /* printf("No fast update!\n");*/ + // printf("No fast update!\n"); } /* to keep tracked of modified loops for shared vertex color blending */ diff --git a/source/blender/editors/sculpt_paint/paint_vertex_weight_ops.c b/source/blender/editors/sculpt_paint/paint_vertex_weight_ops.c index 0fafd3589fe..7991987ae1f 100644 --- a/source/blender/editors/sculpt_paint/paint_vertex_weight_ops.c +++ b/source/blender/editors/sculpt_paint/paint_vertex_weight_ops.c @@ -791,7 +791,7 @@ static int paint_weight_gradient_exec(bContext *C, wmOperator *op) wpaint_prev_create( &((WPGradient_vertStoreBase *)gesture->user_data.data)->wpp, me->dvert, me->totvert); - /* on init only, convert face -> vert sel */ + /* On initialization only, convert face -> vert sel. */ if (me->editflag & ME_EDIT_PAINT_FACE_SEL) { BKE_mesh_flush_select_from_polys(me); } diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c index 533de9936b3..d1487acee78 100644 --- a/source/blender/editors/sculpt_paint/sculpt.c +++ b/source/blender/editors/sculpt_paint/sculpt.c @@ -1791,10 +1791,9 @@ void SCULPT_floodfill_add_active( v = SCULPT_active_vertex_get(ss); } else if (radius > 0.0f) { - float radius_squared = (radius == FLT_MAX) ? FLT_MAX : radius * radius; float location[3]; flip_v3_v3(location, SCULPT_active_vertex_co_get(ss), i); - v = SCULPT_nearest_vertex_get(sd, ob, location, radius_squared, false); + v = SCULPT_nearest_vertex_get(sd, ob, location, radius, false); } if (v.i != -1) { diff --git a/source/blender/editors/sculpt_paint/sculpt_intern.h b/source/blender/editors/sculpt_paint/sculpt_intern.h index 92c648672d6..4ddd2e7c8c0 100644 --- a/source/blender/editors/sculpt_paint/sculpt_intern.h +++ b/source/blender/editors/sculpt_paint/sculpt_intern.h @@ -695,7 +695,7 @@ typedef struct SculptUndoNode { SculptUndoType type; - char idname[MAX_ID_NAME]; /* name instead of pointer*/ + char idname[MAX_ID_NAME]; /* Name instead of pointer. */ void *node; /* only during push, not valid afterwards! */ float (*co)[3]; @@ -1064,7 +1064,7 @@ typedef struct StrokeCache { /* Symmetry index between 0 and 7 bit combo 0 is Brush only; * 1 is X mirror; 2 is Y mirror; 3 is XY; 4 is Z; 5 is XZ; 6 is YZ; 7 is XYZ */ int symmetry; - int mirror_symmetry_pass; /* the symmetry pass we are currently on between 0 and 7*/ + int mirror_symmetry_pass; /* The symmetry pass we are currently on between 0 and 7. */ float true_view_normal[3]; float view_normal[3]; diff --git a/source/blender/editors/sculpt_paint/sculpt_uv.c b/source/blender/editors/sculpt_paint/sculpt_uv.c index 219a8303674..771e0e1e47b 100644 --- a/source/blender/editors/sculpt_paint/sculpt_uv.c +++ b/source/blender/editors/sculpt_paint/sculpt_uv.c @@ -92,7 +92,7 @@ typedef struct UVInitialStroke { /* Initial Selection,for grab brushes for instance */ UVInitialStrokeElement *initialSelection; - /* total initially selected UVs*/ + /* Total initially selected UV's. */ int totalInitialSelected; /* initial mouse coordinates */ @@ -101,9 +101,9 @@ typedef struct UVInitialStroke { /* custom data for uv smoothing brush */ typedef struct UvSculptData { - /* Contains the first of each set of coincident uvs. + /* Contains the first of each set of coincident UV's. * These will be used to perform smoothing on and propagate the changes - * to their coincident uvs */ + * to their coincident UV's */ UvAdjacencyElement *uv; /* ...Is what it says */ @@ -121,7 +121,7 @@ typedef struct UvSculptData { /* timer to be used for airbrush-type brush */ wmTimer *timer; - /* to determine quickly adjacent uvs */ + /* to determine quickly adjacent UV's */ UvElementMap *elementMap; /* uvsmooth Paint for fast reference */ @@ -505,7 +505,7 @@ static UvSculptData *uv_sculpt_stroke_init(bContext *C, wmOperator *op, const wm bool do_island_optimization = !(ts->uv_sculpt_settings & UV_SCULPT_ALL_ISLANDS); int island_index = 0; - /* Holds, for each UvElement in elementMap, a pointer to its unique uv.*/ + /* Holds, for each UvElement in elementMap, a pointer to its unique UV. */ int *uniqueUv; data->tool = (RNA_enum_get(op->ptr, "mode") == BRUSH_STROKE_SMOOTH) ? UV_SCULPT_TOOL_RELAX : @@ -550,7 +550,7 @@ static UvSculptData *uv_sculpt_stroke_init(bContext *C, wmOperator *op, const wm island_index = element->island; } - /* Count 'unique' uvs */ + /* Count 'unique' UV's */ for (i = 0; i < data->elementMap->totalUVs; i++) { if (data->elementMap->buf[i].separate && (!do_island_optimization || data->elementMap->buf[i].island == island_index)) { @@ -603,7 +603,7 @@ static UvSculptData *uv_sculpt_stroke_init(bContext *C, wmOperator *op, const wm data->uv[counter].flag = 0; data->uv[counter].uv = luv->uv; } - /* pointer arithmetic to the rescue, as always :)*/ + /* Pointer arithmetic to the rescue, as always :). */ uniqueUv[element - data->elementMap->buf] = counter; } } @@ -627,8 +627,8 @@ static UvSculptData *uv_sculpt_stroke_init(bContext *C, wmOperator *op, const wm offset2 = uniqueUv[itmp2]; edges[counter].flag = 0; - /* using an order policy, sort uvs according to address space. This avoids - * Having two different UvEdges with the same uvs on different positions */ + /* Using an order policy, sort UV's according to address space. + * This avoids having two different UvEdges with the same UV's on different positions. */ if (offset1 < offset2) { edges[counter].uv1 = offset1; edges[counter].uv2 = offset2; @@ -674,7 +674,7 @@ static UvSculptData *uv_sculpt_stroke_init(bContext *C, wmOperator *op, const wm BLI_ghash_free(edgeHash, NULL, NULL); MEM_freeN(edges); - /* transfer boundary edge property to uvs */ + /* transfer boundary edge property to UV's */ if (ts->uv_sculpt_settings & UV_SCULPT_LOCK_BORDERS) { for (i = 0; i < data->totalUvEdges; i++) { if (!data->uvedges[i].flag) { diff --git a/source/blender/editors/space_action/action_data.c b/source/blender/editors/space_action/action_data.c index efa714e315d..9e69b0a72db 100644 --- a/source/blender/editors/space_action/action_data.c +++ b/source/blender/editors/space_action/action_data.c @@ -723,7 +723,7 @@ static NlaStrip *action_layer_get_nlastrip(ListBase *strips, float ctime) return NULL; } -/* Switch NLA Strips/Actions */ +/* Switch NLA Strips/Actions. */ static void action_layer_switch_strip( AnimData *adt, NlaTrack *old_track, NlaStrip *old_strip, NlaTrack *nlt, NlaStrip *strip) { diff --git a/source/blender/editors/space_action/action_draw.c b/source/blender/editors/space_action/action_draw.c index 5036f22fd0e..d305f7504f3 100644 --- a/source/blender/editors/space_action/action_draw.c +++ b/source/blender/editors/space_action/action_draw.c @@ -83,7 +83,7 @@ void draw_channel_names(bContext *C, bAnimContext *ac, ARegion *region) /* need to do a view-sync here, so that the keys area doesn't jump around (it must copy this) */ UI_view2d_sync(NULL, ac->area, v2d, V2D_LOCK_COPY); - /* loop through channels, and set up drawing depending on their type */ + /* Loop through channels, and set up drawing depending on their type. */ { /* first pass: just the standard GL-drawing for backdrop + text */ size_t channel_index = 0; float ymax = ACHANNEL_FIRST_TOP(ac); diff --git a/source/blender/editors/space_action/action_edit.c b/source/blender/editors/space_action/action_edit.c index fea62f0d9c2..ae9d5445e1d 100644 --- a/source/blender/editors/space_action/action_edit.c +++ b/source/blender/editors/space_action/action_edit.c @@ -163,7 +163,7 @@ void ACTION_OT_markers_make_local(wmOperatorType *ot) /* *************************** Calculate Range ************************** */ -/* Get the min/max keyframes*/ +/* Get the min/max keyframes. */ static bool get_keyframe_extents(bAnimContext *ac, float *min, float *max, const short onlySel) { ListBase anim_data = {NULL, NULL}; @@ -1137,7 +1137,7 @@ void ACTION_OT_clean(wmOperatorType *ot) /* ******************** Sample Keyframes Operator *********************** */ -/* Evaluates the curves between each selected keyframe on each frame, and keys the value */ +/* Evaluates the curves between each selected keyframe on each frame, and keys the value. */ static void sample_action_keys(bAnimContext *ac) { ListBase anim_data = {NULL, NULL}; @@ -1149,7 +1149,7 @@ static void sample_action_keys(bAnimContext *ac) ANIMFILTER_FOREDIT /*| ANIMFILTER_CURVESONLY*/ | ANIMFILTER_NODUPLIS); ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype); - /* loop through filtered data and add keys between selected keyframes on every frame */ + /* Loop through filtered data and add keys between selected keyframes on every frame. */ for (ale = anim_data.first; ale; ale = ale->next) { sample_fcurve((FCurve *)ale->key_data); diff --git a/source/blender/editors/space_action/action_select.c b/source/blender/editors/space_action/action_select.c index 98e39520e99..a51d9086dea 100644 --- a/source/blender/editors/space_action/action_select.c +++ b/source/blender/editors/space_action/action_select.c @@ -470,7 +470,7 @@ static void box_select_action(bAnimContext *ac, const rcti rect, short mode, sho filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_LIST_CHANNELS); ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype); - /* get beztriple editing/validation funcs */ + /* Get beztriple editing/validation funcs. */ sel_data.select_cb = ANIM_editkeyframes_select(selectmode); if (ELEM(mode, ACTKEYS_BORDERSEL_FRAMERANGE, ACTKEYS_BORDERSEL_ALLKEYS)) { @@ -708,7 +708,7 @@ static void region_select_action_keys( filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_LIST_CHANNELS); ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype); - /* get beztriple editing/validation funcs */ + /* Get beztriple editing/validation funcs. */ sel_data.select_cb = ANIM_editkeyframes_select(selectmode); sel_data.ok_cb = ANIM_editkeyframes_ok(mode); @@ -1497,7 +1497,7 @@ void ACTION_OT_select_leftright(wmOperatorType *ot) ot->idname = "ACTION_OT_select_leftright"; ot->description = "Select keyframes to the left or the right of the current frame"; - /* api callbacks */ + /* api callbacks */ ot->invoke = actkeys_select_leftright_invoke; ot->exec = actkeys_select_leftright_exec; ot->poll = ED_operator_action_active; @@ -1840,7 +1840,7 @@ static int actkeys_clickselect_exec(bContext *C, wmOperator *op) mval[0] = RNA_int_get(op->ptr, "mouse_x"); mval[1] = RNA_int_get(op->ptr, "mouse_y"); - /* select keyframe(s) based upon mouse position*/ + /* Select keyframe(s) based upon mouse position. */ ret_value = mouse_action_keys( &ac, mval, selectmode, deselect_all, column, channel, wait_to_deselect_others); @@ -1872,12 +1872,13 @@ void ACTION_OT_clickselect(wmOperatorType *ot) /* properties */ WM_operator_properties_generic_select(ot); + /* Key-map: Enable with `Shift`. */ prop = RNA_def_boolean( ot->srna, "extend", 0, "Extend Select", - "Toggle keyframe selection instead of leaving newly selected keyframes only"); /* SHIFTKEY */ + "Toggle keyframe selection instead of leaving newly selected keyframes only"); RNA_def_property_flag(prop, PROP_SKIP_SAVE); prop = RNA_def_boolean(ot->srna, @@ -1887,20 +1888,21 @@ void ACTION_OT_clickselect(wmOperatorType *ot) "Deselect all when nothing under the cursor"); RNA_def_property_flag(prop, PROP_SKIP_SAVE); + /* Key-map: Enable with `Alt`. */ prop = RNA_def_boolean( ot->srna, "column", 0, "Column Select", - "Select all keyframes that occur on the same frame as the one under the mouse"); /* ALTKEY */ + "Select all keyframes that occur on the same frame as the one under the mouse"); RNA_def_property_flag(prop, PROP_SKIP_SAVE); - prop = RNA_def_boolean( - ot->srna, - "channel", - 0, - "Only Channel", - "Select all the keyframes in the channel under the mouse"); /* CTRLKEY + ALTKEY */ + /* Key-map: Enable with `Ctrl-Alt`. */ + prop = RNA_def_boolean(ot->srna, + "channel", + 0, + "Only Channel", + "Select all the keyframes in the channel under the mouse"); RNA_def_property_flag(prop, PROP_SKIP_SAVE); } diff --git a/source/blender/editors/space_buttons/buttons_context.c b/source/blender/editors/space_buttons/buttons_context.c index aeb2c04656e..222d25b7d75 100644 --- a/source/blender/editors/space_buttons/buttons_context.c +++ b/source/blender/editors/space_buttons/buttons_context.c @@ -1220,7 +1220,7 @@ static void buttons_panel_context_draw(const bContext *C, Panel *panel) continue; } - /* Add icon and name .*/ + /* Add icon and name. */ int icon = RNA_struct_ui_icon(ptr->type); char namebuf[128]; char *name = RNA_struct_name_get_alloc(ptr, namebuf, sizeof(namebuf), NULL); @@ -1273,7 +1273,7 @@ ID *buttons_context_id_path(const bContext *C) for (int i = path->len - 1; i >= 0; i--) { PointerRNA *ptr = &path->ptr[i]; - /* pin particle settings instead of system, since only settings are an idblock*/ + /* Pin particle settings instead of system, since only settings are an idblock. */ if (sbuts->mainb == BCONTEXT_PARTICLE && sbuts->flag & SB_PIN_CONTEXT) { if (ptr->type == &RNA_ParticleSystem && ptr->data) { ParticleSystem *psys = ptr->data; @@ -1281,7 +1281,7 @@ ID *buttons_context_id_path(const bContext *C) } } - /* There is no valid image ID panel, Image Empty objects need this workaround.*/ + /* There is no valid image ID panel, Image Empty objects need this workaround. */ if (sbuts->mainb == BCONTEXT_DATA && sbuts->flag & SB_PIN_CONTEXT) { if (ptr->type == &RNA_Image && ptr->data) { continue; diff --git a/source/blender/editors/space_clip/clip_utils.c b/source/blender/editors/space_clip/clip_utils.c index dbf733413e5..7194e78e940 100644 --- a/source/blender/editors/space_clip/clip_utils.c +++ b/source/blender/editors/space_clip/clip_utils.c @@ -398,7 +398,7 @@ void clip_delete_plane_track(bContext *C, MovieClip *clip, MovieTrackingPlaneTra DEG_id_tag_update(&clip->id, 0); } -/* Calculate space clip offset to be centered at the given point. */ +/* Calculate space clip offset to be centered at the given point. */ void clip_view_offset_for_center_to_point( SpaceClip *sc, const float x, const float y, float *r_offset_x, float *r_offset_y) { diff --git a/source/blender/editors/space_console/console_ops.c b/source/blender/editors/space_console/console_ops.c index 05595e0b393..9b4b020b276 100644 --- a/source/blender/editors/space_console/console_ops.c +++ b/source/blender/editors/space_console/console_ops.c @@ -747,7 +747,7 @@ static int console_clear_exec(bContext *C, wmOperator *op) const bool scrollback = RNA_boolean_get(op->ptr, "scrollback"); const bool history = RNA_boolean_get(op->ptr, "history"); - /*ConsoleLine *ci = */ console_history_verify(C); + /* ConsoleLine *ci = */ console_history_verify(C); if (scrollback) { /* Last item in history. */ while (sc->scrollback.first) { diff --git a/source/blender/editors/space_file/file_draw.c b/source/blender/editors/space_file/file_draw.c index 5e09692b041..6e409d2f5a4 100644 --- a/source/blender/editors/space_file/file_draw.c +++ b/source/blender/editors/space_file/file_draw.c @@ -398,7 +398,7 @@ static void file_draw_preview(const SpaceFile *sfile, imb->x, imb->y, GPU_RGBA8, - false, + true, imb->rect, scale, scale, diff --git a/source/blender/editors/space_file/file_ops.c b/source/blender/editors/space_file/file_ops.c index 334e421c837..0584e2ff938 100644 --- a/source/blender/editors/space_file/file_ops.c +++ b/source/blender/editors/space_file/file_ops.c @@ -86,7 +86,7 @@ static FileSelection find_file_mouse_rect(SpaceFile *sfile, BLI_rctf_rcti_copy(&rect_region_fl, rect_region); - /* Okay, manipulating v2d rects here is hacky... */ + /* Okay, manipulating v2d rects here is hacky... */ v2d->mask.ymax -= sfile->layout->offset_top; v2d->cur.ymax -= sfile->layout->offset_top; UI_view2d_region_to_view_rctf(v2d, &rect_region_fl, &rect_view_fl); @@ -1677,7 +1677,7 @@ void file_draw_check_ex(bContext *C, ScrArea *area) if (op->type->check(C, op)) { file_operator_to_sfile(bmain, sfile, op); - /* redraw, else the changed settings wont get updated */ + /* redraw, else the changed settings won't get updated */ ED_area_tag_redraw(area); } } diff --git a/source/blender/editors/space_file/file_panels.c b/source/blender/editors/space_file/file_panels.c index afa85d183d8..7032d55b331 100644 --- a/source/blender/editors/space_file/file_panels.c +++ b/source/blender/editors/space_file/file_panels.c @@ -72,7 +72,7 @@ static void file_panel_operator(const bContext *C, Panel *panel) UI_block_func_set(uiLayoutGetBlock(panel->layout), file_draw_check_cb, NULL, NULL); - /* Hack: temporary hide.*/ + /* Hack: temporary hide. */ const char *hide[] = {"filepath", "files", "directory", "filename"}; for (int i = 0; i < ARRAY_SIZE(hide); i++) { PropertyRNA *prop = RNA_struct_find_property(op->ptr, hide[i]); @@ -84,7 +84,7 @@ static void file_panel_operator(const bContext *C, Panel *panel) uiTemplateOperatorPropertyButs( C, panel->layout, op, UI_BUT_LABEL_ALIGN_NONE, UI_TEMPLATE_OP_PROPS_SHOW_EMPTY); - /* Hack: temporary hide.*/ + /* Hack: temporary hide. */ for (int i = 0; i < ARRAY_SIZE(hide); i++) { PropertyRNA *prop = RNA_struct_find_property(op->ptr, hide[i]); if (prop) { diff --git a/source/blender/editors/space_file/filelist.c b/source/blender/editors/space_file/filelist.c index 37a32164cfc..40a7be0423e 100644 --- a/source/blender/editors/space_file/filelist.c +++ b/source/blender/editors/space_file/filelist.c @@ -785,12 +785,12 @@ static bool is_filtered_hidden(const char *filename, const FileListInternEntry *file) { if ((filename[0] == '.') && (filename[1] == '\0')) { - return true; /* Ignore . */ + return true; /* Ignore. */ } if (filter->flags & FLF_HIDE_PARENT) { if (filename[0] == '.' && filename[1] == '.' && filename[2] == '\0') { - return true; /* Ignore .. */ + return true; /* Ignore. */ } } @@ -1191,7 +1191,7 @@ static int filelist_geticon_ex(const FileDirEntry *file, if (FILENAME_IS_PARENT(file->relpath)) { return is_main ? ICON_FILE_PARENT : ICON_NONE; } - if (typeflag & FILE_TYPE_APPLICATIONBUNDLE) { + if (typeflag & FILE_TYPE_BUNDLE) { return ICON_UGLYPACKAGE; } if (typeflag & FILE_TYPE_BLENDER) { @@ -2519,9 +2519,16 @@ int ED_path_extension_type(const char *path) if (file_is_blend_backup(path)) { return FILE_TYPE_BLENDER_BACKUP; } - if (BLI_path_extension_check(path, ".app")) { - return FILE_TYPE_APPLICATIONBUNDLE; +#ifdef __APPLE__ + if (BLI_path_extension_check_n(path, + /* Application bundle */ + ".app", + /* Safari in-progress/paused download */ + ".download", + NULL)) { + return FILE_TYPE_BUNDLE; } +#endif if (BLI_path_extension_check(path, ".py")) { return FILE_TYPE_PYSCRIPT; } @@ -2815,7 +2822,7 @@ static int filelist_readjob_list_dir(const char *root, entry->attributes = BLI_file_attributes(full_path); if (S_ISDIR(files[i].s.st_mode) #ifdef __APPLE__ - && !(ED_path_extension_type(full_path) & FILE_TYPE_APPLICATIONBUNDLE) + && !(ED_path_extension_type(full_path) & FILE_TYPE_BUNDLE) #endif ) { entry->typeflag = FILE_TYPE_DIR; @@ -2894,7 +2901,8 @@ static int filelist_readjob_list_lib(const char *root, ListBase *entries, const } /* there we go */ - libfiledata = BLO_blendhandle_from_file(dir, NULL); + BlendFileReadReport bf_reports = {.reports = NULL}; + libfiledata = BLO_blendhandle_from_file(dir, &bf_reports); if (libfiledata == NULL) { return nbr_entries; } diff --git a/source/blender/editors/space_graph/graph_buttons.c b/source/blender/editors/space_graph/graph_buttons.c index d88bf8750c2..ec5f443e2dc 100644 --- a/source/blender/editors/space_graph/graph_buttons.c +++ b/source/blender/editors/space_graph/graph_buttons.c @@ -1337,8 +1337,8 @@ static void do_graph_region_modifier_buttons(bContext *C, void *UNUSED(arg), int { switch (event) { case B_FMODIFIER_REDRAW: /* XXX this should send depsgraph updates too */ - WM_event_add_notifier( - C, NC_ANIMATION, NULL); /* XXX need a notifier specially for F-Modifiers */ + /* XXX: need a notifier specially for F-Modifiers */ + WM_event_add_notifier(C, NC_ANIMATION, NULL); break; } } diff --git a/source/blender/editors/space_graph/graph_draw.c b/source/blender/editors/space_graph/graph_draw.c index c5358cdfa5b..0d2a436902a 100644 --- a/source/blender/editors/space_graph/graph_draw.c +++ b/source/blender/editors/space_graph/graph_draw.c @@ -1251,7 +1251,7 @@ static void graph_draw_driver_debug(bAnimContext *ac, ID *id, FCurve *fcu) float x = driver->curval; float y = fcu->curval * unitfac; - /* only draw indicators if the point is in range*/ + /* Only draw indicators if the point is in range. */ if (x >= v2d->cur.xmin) { float co[2]; @@ -1428,7 +1428,7 @@ void graph_draw_channel_names(bContext *C, bAnimContext *ac, ARegion *region) height = ACHANNEL_TOT_HEIGHT(ac, items); v2d->tot.ymin = -height; - /* loop through channels, and set up drawing depending on their type */ + /* Loop through channels, and set up drawing depending on their type. */ { /* first pass: just the standard GL-drawing for backdrop + text */ size_t channel_index = 0; float ymax = ACHANNEL_FIRST_TOP(ac); diff --git a/source/blender/editors/space_graph/graph_edit.c b/source/blender/editors/space_graph/graph_edit.c index a2e812a4ed1..be577e9ab13 100644 --- a/source/blender/editors/space_graph/graph_edit.c +++ b/source/blender/editors/space_graph/graph_edit.c @@ -3007,7 +3007,7 @@ static int graph_driver_delete_invalid_exec(bContext *C, wmOperator *op) WM_report(RPT_INFO, "No drivers deleted"); } - /* Successful or not?*/ + /* Successful or not? */ if (!ok) { return OPERATOR_CANCELLED; } diff --git a/source/blender/editors/space_graph/graph_select.c b/source/blender/editors/space_graph/graph_select.c index 73777568ab1..f5df60454eb 100644 --- a/source/blender/editors/space_graph/graph_select.c +++ b/source/blender/editors/space_graph/graph_select.c @@ -597,7 +597,7 @@ static bool box_select_graphkeys(bAnimContext *ac, initialize_box_select_key_editing_data( sipo, incl_handles, mode, ac, data, &scaled_rectf, &ked, &mapping_flag); - /* Get beztriple editing/validation funcs. */ + /* Get beztriple editing/validation funcs. */ const KeyframeEditFunc select_cb = ANIM_editkeyframes_select(selectmode); const KeyframeEditFunc ok_cb = ANIM_editkeyframes_ok(mode); @@ -1611,7 +1611,7 @@ void GRAPH_OT_select_leftright(wmOperatorType *ot) ot->idname = "GRAPH_OT_select_leftright"; ot->description = "Select keyframes to the left or the right of the current frame"; - /* api callbacks */ + /* api callbacks */ ot->invoke = graphkeys_select_leftright_invoke; ot->exec = graphkeys_select_leftright_exec; ot->poll = graphop_visible_keyframes_poll; @@ -1958,12 +1958,14 @@ void GRAPH_OT_clickselect(wmOperatorType *ot) /* properties */ WM_operator_properties_generic_select(ot); + + /* Key-map: Enable with `Shift`. */ prop = RNA_def_boolean(ot->srna, "extend", 0, "Extend Select", "Toggle keyframe selection instead of leaving newly selected " - "keyframes only"); /* SHIFTKEY */ + "keyframes only"); RNA_def_property_flag(prop, PROP_SKIP_SAVE); prop = RNA_def_boolean(ot->srna, @@ -1973,19 +1975,18 @@ void GRAPH_OT_clickselect(wmOperatorType *ot) "Deselect all when nothing under the cursor"); RNA_def_property_flag(prop, PROP_SKIP_SAVE); + /* Key-map: Enable with `Alt`. */ prop = RNA_def_boolean(ot->srna, "column", 0, "Column Select", "Select all keyframes that occur on the same frame as the one under " - "the mouse"); /* ALTKEY */ + "the mouse"); RNA_def_property_flag(prop, PROP_SKIP_SAVE); - prop = RNA_def_boolean(ot->srna, - "curves", - 0, - "Only Curves", - "Select all the keyframes in the curve"); /* CTRLKEY + ALTKEY */ + /* Key-map: Enable with `Ctrl-Atl`. */ + prop = RNA_def_boolean( + ot->srna, "curves", 0, "Only Curves", "Select all the keyframes in the curve"); RNA_def_property_flag(prop, PROP_SKIP_SAVE); } diff --git a/source/blender/editors/space_graph/graph_slider_ops.c b/source/blender/editors/space_graph/graph_slider_ops.c index 4174e1c63ae..10629caa8b0 100644 --- a/source/blender/editors/space_graph/graph_slider_ops.c +++ b/source/blender/editors/space_graph/graph_slider_ops.c @@ -50,7 +50,7 @@ /* ******************** GRAPH SLIDER OPERATORS ************************* */ /* This file contains a collection of operators to modify keyframes in the graph editor. All * operators are modal and use a slider that allows the user to define a percentage to modify the - * operator.*/ + * operator. */ /* ******************** Decimate Keyframes Operator ************************* */ @@ -91,7 +91,7 @@ typedef struct tDecimateGraphOp { /** A 0-1 value for determining how much we should decimate. */ PropertyRNA *percentage_prop; - /** The original bezt curve data (used for restoring fcurves).*/ + /** The original bezt curve data (used for restoring fcurves). */ ListBase bezt_arr_list; NumInput num; @@ -318,7 +318,7 @@ static int graphkeys_decimate_modal(bContext *C, wmOperator *op, const wmEvent * /* This assumes that we are in "DECIM_RATIO" mode. This is because the error margin is very hard * and finicky to control with this modal mouse grab method. Therefore, it is expected that the * error margin mode is not adjusted by the modal operator but instead tweaked via the redo - * panel.*/ + * panel. */ tDecimateGraphOp *dgo = op->customdata; const bool has_numinput = hasNumInput(&dgo->num); diff --git a/source/blender/editors/space_graph/graph_view.c b/source/blender/editors/space_graph/graph_view.c index cde0dab3503..ca14f7c5942 100644 --- a/source/blender/editors/space_graph/graph_view.c +++ b/source/blender/editors/space_graph/graph_view.c @@ -137,7 +137,7 @@ void get_graph_keyframe_extents(bAnimContext *ac, } } - /* Ensure that the extents are not too extreme that view implodes...*/ + /* Ensure that the extents are not too extreme that view implodes. */ if (foundBounds) { if ((xmin && xmax) && (fabsf(*xmax - *xmin) < 0.001f)) { *xmin -= 0.0005f; @@ -269,7 +269,7 @@ static int graphkeys_viewall(bContext *C, BLI_rctf_scale(&cur_new, 1.1f); /* Take regions into account, that could block the view. - * Marker region is supposed to be larger than the scroll-bar, so prioritize it.*/ + * Marker region is supposed to be larger than the scroll-bar, so prioritize it. */ float pad_top = UI_TIME_SCRUB_MARGIN_Y; float pad_bottom = BLI_listbase_is_empty(ED_context_get_markers(C)) ? V2D_SCROLL_HANDLE_HEIGHT : UI_MARKER_MARGIN_Y; diff --git a/source/blender/editors/space_graph/space_graph.c b/source/blender/editors/space_graph/space_graph.c index 0c6d904de01..32496cb8f1f 100644 --- a/source/blender/editors/space_graph/space_graph.c +++ b/source/blender/editors/space_graph/space_graph.c @@ -588,7 +588,7 @@ static void graph_listener(const wmSpaceTypeListenerParams *params) ED_area_tag_refresh(area); break; case ND_TRANSFORM: - break; /*do nothing*/ + break; /* Do nothing. */ default: /* just redrawing the view will do */ ED_area_tag_redraw(area); @@ -759,7 +759,7 @@ static void graph_refresh(const bContext *C, ScrArea *area) break; } - case SIPO_MODE_DRIVERS: /* drivers only */ + case SIPO_MODE_DRIVERS: /* Drivers only. */ { break; } diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c index 0c34c0cc756..193c35d10a2 100644 --- a/source/blender/editors/space_image/image_ops.c +++ b/source/blender/editors/space_image/image_ops.c @@ -1607,7 +1607,7 @@ static int image_replace_exec(bContext *C, wmOperator *op) RNA_string_get(op->ptr, "filepath", str); - /* we cant do much if the str is longer than FILE_MAX :/ */ + /* we can't do much if the str is longer than FILE_MAX :/ */ BLI_strncpy(sima->image->filepath, str, sizeof(sima->image->filepath)); if (sima->image->source == IMA_SRC_GENERATED) { @@ -3870,7 +3870,7 @@ static void tile_fill_init(PointerRNA *ptr, Image *ima, ImageTile *tile) /* Acquire ibuf to get the default values. * If the specified tile has no ibuf, try acquiring the main tile instead - * (unless the specified tile already was the main tile).*/ + * (unless the specified tile already was the main tile). */ ImBuf *ibuf = BKE_image_acquire_ibuf(ima, &iuser, NULL); if (ibuf == NULL && (tile != NULL) && (tile->tile_number != 1001)) { ibuf = BKE_image_acquire_ibuf(ima, NULL, NULL); diff --git a/source/blender/editors/space_image/image_undo.c b/source/blender/editors/space_image/image_undo.c index feee268c6d3..082f66b57af 100644 --- a/source/blender/editors/space_image/image_undo.c +++ b/source/blender/editors/space_image/image_undo.c @@ -293,8 +293,9 @@ static void ptile_restore_runtime_list(ListBase *paint_tiles) SWAP(uint *, ptile->rect.uint, tmpibuf->rect); } - BKE_image_free_gputextures( - image); /* force OpenGL reload (maybe partial update will operate better?) */ + /* Force OpenGL reload (maybe partial update will operate better?) */ + BKE_image_free_gputextures(image); + if (ibuf->rect_float) { ibuf->userflags |= IB_RECT_INVALID; /* force recreate of char rect */ } @@ -1040,7 +1041,7 @@ ListBase *ED_image_paint_tile_list_get(void) return &us->paint_tiles; } -/* restore painting image to previous state. Used for anchored and drag-dot style brushes*/ +/* Restore painting image to previous state. Used for anchored and drag-dot style brushes. */ void ED_image_undo_restore(UndoStep *us) { ListBase *paint_tiles = &((ImageUndoStep *)us)->paint_tiles; diff --git a/source/blender/editors/space_info/info_report.c b/source/blender/editors/space_info/info_report.c index 7dd8382c8ef..a3da50709df 100644 --- a/source/blender/editors/space_info/info_report.c +++ b/source/blender/editors/space_info/info_report.c @@ -360,7 +360,7 @@ void INFO_OT_report_delete(wmOperatorType *ot) ot->exec = report_delete_exec; /* flags */ - /*ot->flag = OPTYPE_REGISTER;*/ + // ot->flag = OPTYPE_REGISTER; /* properties */ } @@ -404,7 +404,7 @@ void INFO_OT_report_copy(wmOperatorType *ot) ot->exec = report_copy_exec; /* flags */ - /*ot->flag = OPTYPE_REGISTER;*/ + // ot->flag = OPTYPE_REGISTER; /* properties */ } diff --git a/source/blender/editors/space_nla/nla_draw.c b/source/blender/editors/space_nla/nla_draw.c index 7d4011e0812..0fd1a1318e8 100644 --- a/source/blender/editors/space_nla/nla_draw.c +++ b/source/blender/editors/space_nla/nla_draw.c @@ -734,7 +734,7 @@ void draw_nla_main_data(bAnimContext *ac, SpaceNla *snla, ARegion *region) int height = NLACHANNEL_TOT_HEIGHT(ac, items); v2d->tot.ymin = -height; - /* loop through channels, and set up drawing depending on their type */ + /* Loop through channels, and set up drawing depending on their type. */ float ymax = NLACHANNEL_FIRST_TOP(ac); for (bAnimListElem *ale = anim_data.first; ale; ale = ale->next, ymax -= NLACHANNEL_STEP(snla)) { @@ -894,7 +894,7 @@ void draw_nla_channel_list(const bContext *C, bAnimContext *ac, ARegion *region) /* set blending again, as may not be set in previous step */ GPU_blend(GPU_BLEND_ALPHA); - /* loop through channels, and set up drawing depending on their type */ + /* Loop through channels, and set up drawing depending on their type. */ for (ale = anim_data.first; ale; ale = ale->next, ymax -= NLACHANNEL_STEP(snla), channel_index++) { float ymin = ymax - NLACHANNEL_HEIGHT(snla); diff --git a/source/blender/editors/space_nla/nla_edit.c b/source/blender/editors/space_nla/nla_edit.c index dd381cc92fb..3ca3aa15cd3 100644 --- a/source/blender/editors/space_nla/nla_edit.c +++ b/source/blender/editors/space_nla/nla_edit.c @@ -1397,7 +1397,7 @@ static void nlaedit_split_strip_actclip( nstrip->start = splitframe; if ((splitaframe > strip->actstart) && (splitaframe < strip->actend)) { - /* only do this if we're splitting down the middle... */ + /* only do this if we're splitting down the middle... */ strip->actend = splitaframe; nstrip->actstart = splitaframe; } @@ -1412,7 +1412,7 @@ static void nlaedit_split_strip_actclip( /* split a given Meta strip */ static void nlaedit_split_strip_meta(NlaTrack *nlt, NlaStrip *strip) { - /* simply ungroup it for now... */ + /* simply ungroup it for now... */ BKE_nlastrips_clear_metastrip(&nlt->strips, strip); } @@ -1528,7 +1528,7 @@ static int nlaedit_toggle_mute_exec(bContext *C, wmOperator *UNUSED(op)) NlaTrack *nlt = (NlaTrack *)ale->data; NlaStrip *strip; - /* for every selected strip, toggle muting */ + /* For every selected strip, toggle muting. */ for (strip = nlt->strips.first; strip; strip = strip->next) { if (strip->flag & NLASTRIP_FLAG_SELECT) { /* just flip the mute flag for now */ diff --git a/source/blender/editors/space_nla/nla_select.c b/source/blender/editors/space_nla/nla_select.c index 87ad09fe2f9..dc95a01a021 100644 --- a/source/blender/editors/space_nla/nla_select.c +++ b/source/blender/editors/space_nla/nla_select.c @@ -577,7 +577,7 @@ void NLA_OT_select_leftright(wmOperatorType *ot) ot->idname = "NLA_OT_select_leftright"; ot->description = "Select strips to the left or the right of the current frame"; - /* api callbacks */ + /* api callbacks */ ot->invoke = nlaedit_select_leftright_invoke; ot->exec = nlaedit_select_leftright_exec; ot->poll = ED_operator_nla_active; diff --git a/source/blender/editors/space_node/drawnode.cc b/source/blender/editors/space_node/drawnode.cc index 1d4c3b67387..1c7ee9e622f 100644 --- a/source/blender/editors/space_node/drawnode.cc +++ b/source/blender/editors/space_node/drawnode.cc @@ -135,7 +135,7 @@ static void node_buts_mix_rgb(uiLayout *layout, bContext *UNUSED(C), PointerRNA static void node_buts_time(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { #if 0 - /* XXX no context access here .. */ + /* XXX no context access here. */ bNode *node = (bNode*)ptr->data; CurveMapping *cumap = node->storage; @@ -217,7 +217,7 @@ static void node_buts_texture(uiLayout *layout, bContext *UNUSED(C), PointerRNA uiItemR(layout, ptr, "texture", DEFAULT_FLAGS, "", ICON_NONE); if (multi) { - /* Number Drawing not optimal here, better have a list*/ + /* Number Drawing not optimal here, better have a list. */ uiItemR(layout, ptr, "node_output", DEFAULT_FLAGS, "", ICON_NONE); } } @@ -1833,9 +1833,11 @@ static void node_composit_buts_chroma_matte(uiLayout *layout, bContext *UNUSED(C uiItemR(col, ptr, "threshold", DEFAULT_FLAGS, nullptr, ICON_NONE); col = uiLayoutColumn(layout, true); - /*uiItemR(col, ptr, "lift", UI_ITEM_R_SLIDER, nullptr, ICON_NONE); Removed for now */ + /* Removed for now. */ + // uiItemR(col, ptr, "lift", UI_ITEM_R_SLIDER, nullptr, ICON_NONE); uiItemR(col, ptr, "gain", DEFAULT_FLAGS | UI_ITEM_R_SLIDER, nullptr, ICON_NONE); - /*uiItemR(col, ptr, "shadow_adjust", UI_ITEM_R_SLIDER, nullptr, ICON_NONE); Removed for now*/ + /* Removed for now. */ + // uiItemR(col, ptr, "shadow_adjust", UI_ITEM_R_SLIDER, nullptr, ICON_NONE); } static void node_composit_buts_color_matte(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) @@ -3528,7 +3530,7 @@ static void std_node_socket_draw( bNode *node = (bNode *)node_ptr->data; bNodeSocket *sock = (bNodeSocket *)ptr->data; int type = sock->typeinfo->type; - /*int subtype = sock->typeinfo->subtype;*/ + // int subtype = sock->typeinfo->subtype; /* XXX not nice, eventually give this node its own socket type ... */ if (node->type == CMP_NODE_OUTPUT_FILE) { diff --git a/source/blender/editors/space_node/node_edit.cc b/source/blender/editors/space_node/node_edit.cc index d86b069aac3..4bacf319f7c 100644 --- a/source/blender/editors/space_node/node_edit.cc +++ b/source/blender/editors/space_node/node_edit.cc @@ -177,7 +177,7 @@ static int compo_breakjob(void *cjv) { CompoJob *cj = (CompoJob *)cjv; - /* without G.is_break 'ESC' wont quit - which annoys users */ + /* without G.is_break 'ESC' won't quit - which annoys users */ return (*(cj->stop) #ifdef USE_ESC_COMPO || G.is_break @@ -1130,7 +1130,7 @@ static bool cursor_isect_multi_input_socket(const float cursor[2], const bNodeSo { const float node_socket_height = node_socket_calculate_height(socket); rctf multi_socket_rect; - /*.xmax = socket->locx + NODE_SOCKSIZE * 5.5f + /* `.xmax = socket->locx + NODE_SOCKSIZE * 5.5f` * would be the same behavior as for regular sockets. * But keep it smaller because for multi-input socket you * sometimes want to drag the link to the other side, if you may @@ -2310,7 +2310,7 @@ static int ntree_socket_add_exec(bContext *C, wmOperator *op) sock = ntreeInsertSocketInterface( ntree, in_out, active_sock->idname, active_sock->next, active_sock->name); /* XXX this only works for actual sockets, not interface templates! */ - /*nodeSocketCopyValue(sock, &ntree_ptr, active_sock, &ntree_ptr);*/ + // nodeSocketCopyValue(sock, &ntree_ptr, active_sock, &ntree_ptr); } else { /* XXX TODO define default socket type for a tree! */ diff --git a/source/blender/editors/space_node/node_group.cc b/source/blender/editors/space_node/node_group.cc index 851d386ad0d..d7541d8f512 100644 --- a/source/blender/editors/space_node/node_group.cc +++ b/source/blender/editors/space_node/node_group.cc @@ -926,7 +926,7 @@ static void node_group_make_insert_selected(const bContext *C, bNodeTree *ntree, } } - /* expose all unlinked sockets too but only the visible ones*/ + /* Expose all unlinked sockets too but only the visible ones. */ if (expose_visible) { LISTBASE_FOREACH (bNode *, node, &ngroup->nodes) { if (node_group_make_use_node(node, gnode)) { diff --git a/source/blender/editors/space_outliner/outliner_draw.c b/source/blender/editors/space_outliner/outliner_draw.c index 328a787c768..cb61e548d53 100644 --- a/source/blender/editors/space_outliner/outliner_draw.c +++ b/source/blender/editors/space_outliner/outliner_draw.c @@ -3125,7 +3125,7 @@ static void outliner_draw_tree_element(bContext *C, *te_edit = te; } - /* Icons can be ui buts, we don't want it to overlap with restrict .*/ + /* Icons can be UI buts, we don't want it to overlap with restrict. */ if (restrict_column_width > 0) { xmax -= restrict_column_width + UI_UNIT_X; } diff --git a/source/blender/editors/space_outliner/outliner_select.c b/source/blender/editors/space_outliner/outliner_select.c index 50f089f894a..b14a3cdb91d 100644 --- a/source/blender/editors/space_outliner/outliner_select.c +++ b/source/blender/editors/space_outliner/outliner_select.c @@ -1816,7 +1816,7 @@ static TreeElement *outliner_find_rightmost_visible_child(SpaceOutliner *space_o return te; } -/* Find previous visible element in the tree */ +/* Find previous visible element in the tree. */ static TreeElement *outliner_find_previous_element(SpaceOutliner *space_outliner, TreeElement *te) { if (te->prev) { diff --git a/source/blender/editors/space_outliner/outliner_tools.c b/source/blender/editors/space_outliner/outliner_tools.c index f809bb13b42..d59d04b6ac2 100644 --- a/source/blender/editors/space_outliner/outliner_tools.c +++ b/source/blender/editors/space_outliner/outliner_tools.c @@ -86,6 +86,8 @@ #include "UI_resources.h" #include "UI_view2d.h" +#include "../../blender/blenloader/BLO_readfile.h" + #include "RNA_access.h" #include "RNA_define.h" #include "RNA_enum_types.h" @@ -930,8 +932,14 @@ static void id_override_library_resync_fn(bContext *C, te->store_elem->id->tag |= LIB_TAG_DOIT; } - BKE_lib_override_library_resync( - bmain, scene, CTX_data_view_layer(C), id_root, NULL, do_hierarchy_enforce, true, reports); + BKE_lib_override_library_resync(bmain, + scene, + CTX_data_view_layer(C), + id_root, + NULL, + do_hierarchy_enforce, + true, + &(struct BlendFileReadReport){.reports = reports}); WM_event_add_notifier(C, NC_WINDOW, NULL); } diff --git a/source/blender/editors/space_outliner/outliner_tree.c b/source/blender/editors/space_outliner/outliner_tree.c index 90389fc1be2..ae455d957cf 100644 --- a/source/blender/editors/space_outliner/outliner_tree.c +++ b/source/blender/editors/space_outliner/outliner_tree.c @@ -312,12 +312,8 @@ static void outliner_add_object_contents(SpaceOutliner *space_outliner, outliner_add_element(space_outliner, &te->subtree, ob, te, TSE_ANIM_DATA, 0); } - outliner_add_element(space_outliner, - &te->subtree, - ob->poselib, - te, - TSE_SOME_ID, - 0); /* XXX FIXME.. add a special type for this. */ + /* FIXME: add a special type for this. */ + outliner_add_element(space_outliner, &te->subtree, ob->poselib, te, TSE_SOME_ID, 0); if (ob->proxy && !ID_IS_LINKED(ob)) { outliner_add_element(space_outliner, &te->subtree, ob->proxy, te, TSE_PROXY, 0); diff --git a/source/blender/editors/space_outliner/tree/tree_display_libraries.cc b/source/blender/editors/space_outliner/tree/tree_display_libraries.cc index 91b690d35fa..c6b700318dd 100644 --- a/source/blender/editors/space_outliner/tree/tree_display_libraries.cc +++ b/source/blender/editors/space_outliner/tree/tree_display_libraries.cc @@ -138,8 +138,8 @@ TreeElement *TreeDisplayLibraries::add_library_contents(Main &mainvar, } } - /* We always want to create an entry for libraries, even if/when we have no more IDs from - * them. This invalid state is important to show to user as well.*/ + /* We always want to create an entry for libraries, even if/when we have no more IDs from them. + * This invalid state is important to show to user as well. */ if (id != nullptr || is_library) { if (!tenlib) { /* Create library tree element on demand, depending if there are any data-blocks. */ diff --git a/source/blender/editors/space_outliner/tree/tree_element_overrides.cc b/source/blender/editors/space_outliner/tree/tree_element_overrides.cc index c5d254242c6..731beb3956e 100644 --- a/source/blender/editors/space_outliner/tree/tree_element_overrides.cc +++ b/source/blender/editors/space_outliner/tree/tree_element_overrides.cc @@ -94,9 +94,7 @@ void TreeElementOverridesBase::expand(SpaceOutliner &space_outliner) const TreeElementOverridesProperty::TreeElementOverridesProperty(TreeElement &legacy_te, TreeElementOverridesData &override_data) - : AbstractTreeElement(legacy_te), - id_(override_data.id), - override_prop_(override_data.override_property) + : AbstractTreeElement(legacy_te), override_prop_(override_data.override_property) { BLI_assert(legacy_te.store_elem->type == TSE_LIBRARY_OVERRIDE); diff --git a/source/blender/editors/space_outliner/tree/tree_element_overrides.hh b/source/blender/editors/space_outliner/tree/tree_element_overrides.hh index c3caab8e268..0067db6ea56 100644 --- a/source/blender/editors/space_outliner/tree/tree_element_overrides.hh +++ b/source/blender/editors/space_outliner/tree/tree_element_overrides.hh @@ -40,7 +40,6 @@ class TreeElementOverridesBase final : public AbstractTreeElement { }; class TreeElementOverridesProperty final : public AbstractTreeElement { - ID &id_; IDOverrideLibraryProperty &override_prop_; public: diff --git a/source/blender/editors/space_script/space_script.c b/source/blender/editors/space_script/space_script.c index 4ce0e454df8..897af9ae931 100644 --- a/source/blender/editors/space_script/space_script.c +++ b/source/blender/editors/space_script/space_script.c @@ -81,7 +81,7 @@ static void script_free(SpaceLink *sl) SpaceScript *sscript = (SpaceScript *)sl; #ifdef WITH_PYTHON - /*free buttons references*/ + /* Free buttons references. */ if (sscript->but_refs) { sscript->but_refs = NULL; } diff --git a/source/blender/editors/space_sequencer/sequencer_draw.c b/source/blender/editors/space_sequencer/sequencer_draw.c index b6929f12cc0..8341dbe6014 100644 --- a/source/blender/editors/space_sequencer/sequencer_draw.c +++ b/source/blender/editors/space_sequencer/sequencer_draw.c @@ -1056,7 +1056,7 @@ static void draw_seq_fcurve_overlay( continue; } - /* If some frames were skipped above, we need to close the shape. */ + /* If some frames were skipped above, we need to close the shape. */ if (skip) { fcurve_batch_add_verts( vbo, y1, y2, y_height, timeline_frame - eval_step, prev_val, &vert_count); diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c b/source/blender/editors/space_sequencer/sequencer_edit.c index 4c8b44864f9..e17beb228de 100644 --- a/source/blender/editors/space_sequencer/sequencer_edit.c +++ b/source/blender/editors/space_sequencer/sequencer_edit.c @@ -2486,7 +2486,7 @@ static int sequencer_paste_exec(bContext *C, wmOperator *op) min_seq_startdisp = seq->startdisp; } } - /* Paste strips after playhead. */ + /* Paste strips relative to the current-frame. */ ofs = scene->r.cfra - min_seq_startdisp; } @@ -2539,7 +2539,11 @@ void SEQUENCER_OT_paste(wmOperatorType *ot) /* Properties. */ PropertyRNA *prop = RNA_def_boolean( - ot->srna, "keep_offset", false, "Keep Offset", "Keep strip offset to playhead when pasting"); + ot->srna, + "keep_offset", + false, + "Keep Offset", + "Keep strip offset relative to the current frame when pasting"); RNA_def_property_flag(prop, PROP_SKIP_SAVE); } @@ -2825,7 +2829,7 @@ static int sequencer_change_path_exec(bContext *C, wmOperator *op) RNA_END; } - /* Reset these else we wont see all the images. */ + /* Reset these else we won't see all the images. */ seq->anim_startofs = seq->anim_endofs = 0; /* Correct start/end frames so we don't move. diff --git a/source/blender/editors/space_spreadsheet/CMakeLists.txt b/source/blender/editors/space_spreadsheet/CMakeLists.txt index 7e3f3db9bc8..1ea6593588a 100644 --- a/source/blender/editors/space_spreadsheet/CMakeLists.txt +++ b/source/blender/editors/space_spreadsheet/CMakeLists.txt @@ -38,6 +38,8 @@ set(SRC spreadsheet_column.cc spreadsheet_data_source.cc spreadsheet_data_source_geometry.cc + spreadsheet_dataset_draw.cc + spreadsheet_dataset_layout.cc spreadsheet_draw.cc spreadsheet_layout.cc spreadsheet_ops.cc @@ -50,6 +52,8 @@ set(SRC spreadsheet_column_values.hh spreadsheet_data_source.hh spreadsheet_data_source_geometry.hh + spreadsheet_dataset_draw.hh + spreadsheet_dataset_layout.hh spreadsheet_draw.hh spreadsheet_intern.hh spreadsheet_layout.hh diff --git a/source/blender/editors/space_spreadsheet/space_spreadsheet.cc b/source/blender/editors/space_spreadsheet/space_spreadsheet.cc index 8c42f28b5f4..f8654500044 100644 --- a/source/blender/editors/space_spreadsheet/space_spreadsheet.cc +++ b/source/blender/editors/space_spreadsheet/space_spreadsheet.cc @@ -47,6 +47,7 @@ #include "spreadsheet_context.hh" #include "spreadsheet_data_source_geometry.hh" +#include "spreadsheet_dataset_draw.hh" #include "spreadsheet_intern.hh" #include "spreadsheet_layout.hh" #include "spreadsheet_row_filter.hh" @@ -80,6 +81,15 @@ static SpaceLink *spreadsheet_create(const ScrArea *UNUSED(area), const Scene *U } { + /* Dataset Region */ + ARegion *region = (ARegion *)MEM_callocN(sizeof(ARegion), "spreadsheet dataset region"); + BLI_addtail(&spreadsheet_space->regionbase, region); + region->regiontype = RGN_TYPE_CHANNELS; + region->alignment = RGN_ALIGN_LEFT; + region->v2d.scroll = (V2D_SCROLL_RIGHT | V2D_SCROLL_BOTTOM); + } + + { /* Properties region. */ ARegion *region = (ARegion *)MEM_callocN(sizeof(ARegion), "spreadsheet right region"); BLI_addtail(&spreadsheet_space->regionbase, region); @@ -195,7 +205,7 @@ static void spreadsheet_main_region_init(wmWindowManager *wm, ARegion *region) } } -ID *ED_spreadsheet_get_current_id(struct SpaceSpreadsheet *sspreadsheet) +ID *ED_spreadsheet_get_current_id(const struct SpaceSpreadsheet *sspreadsheet) { if (BLI_listbase_is_empty(&sspreadsheet->context_path)) { return nullptr; @@ -263,7 +273,7 @@ static void update_context_path_from_context(const bContext *C) } } -static void update_context_path(const bContext *C) +void spreadsheet_update_context_path(const bContext *C) { SpaceSpreadsheet *sspreadsheet = CTX_wm_space_spreadsheet(C); if (sspreadsheet->flag & SPREADSHEET_FLAG_PINNED) { @@ -274,28 +284,40 @@ static void update_context_path(const bContext *C) } } -static std::unique_ptr<DataSource> get_data_source(const bContext *C) +Object *spreadsheet_get_object_eval(const SpaceSpreadsheet *sspreadsheet, + const Depsgraph *depsgraph) { - Depsgraph *depsgraph = CTX_data_depsgraph_pointer(C); - SpaceSpreadsheet *sspreadsheet = CTX_wm_space_spreadsheet(C); ID *used_id = ED_spreadsheet_get_current_id(sspreadsheet); if (used_id == nullptr) { - return {}; + return nullptr; } const ID_Type id_type = GS(used_id->name); if (id_type != ID_OB) { - return {}; + return nullptr; } Object *object_orig = (Object *)used_id; if (!ELEM(object_orig->type, OB_MESH, OB_POINTCLOUD, OB_VOLUME)) { - return {}; + return nullptr; } + Object *object_eval = DEG_get_evaluated_object(depsgraph, object_orig); if (object_eval == nullptr) { - return {}; + return nullptr; } - return data_source_from_geometry(C, object_eval); + return object_eval; +} + +static std::unique_ptr<DataSource> get_data_source(const bContext *C) +{ + Depsgraph *depsgraph = CTX_data_depsgraph_pointer(C); + SpaceSpreadsheet *sspreadsheet = CTX_wm_space_spreadsheet(C); + + Object *object_eval = spreadsheet_get_object_eval(sspreadsheet, depsgraph); + if (object_eval) { + return data_source_from_geometry(C, object_eval); + } + return {}; } static float get_column_width(const ColumnValues &values) @@ -358,7 +380,7 @@ static void update_visible_columns(ListBase &columns, DataSource &data_source) static void spreadsheet_main_region_draw(const bContext *C, ARegion *region) { SpaceSpreadsheet *sspreadsheet = CTX_wm_space_spreadsheet(C); - update_context_path(C); + spreadsheet_update_context_path(C); std::unique_ptr<DataSource> data_source = get_data_source(C); if (!data_source) { @@ -442,7 +464,7 @@ static void spreadsheet_header_region_init(wmWindowManager *UNUSED(wm), ARegion static void spreadsheet_header_region_draw(const bContext *C, ARegion *region) { - update_context_path(C); + spreadsheet_update_context_path(C); ED_region_header(C, region); } @@ -534,6 +556,59 @@ static void spreadsheet_footer_region_listener(const wmRegionListenerParams *UNU { } +static void spreadsheet_dataset_region_listener(const wmRegionListenerParams *params) +{ + ARegion *region = params->region; + wmNotifier *wmn = params->notifier; + + switch (wmn->category) { + case NC_SCENE: { + switch (wmn->data) { + case ND_FRAME: + ED_region_tag_redraw(region); + break; + } + break; + } + case NC_TEXTURE: + ED_region_tag_redraw(region); + break; + } + + spreadsheet_header_region_listener(params); +} + +static void spreadsheet_dataset_region_init(wmWindowManager *wm, ARegion *region) +{ + region->v2d.scroll |= V2D_SCROLL_RIGHT; + region->v2d.scroll &= ~(V2D_SCROLL_LEFT | V2D_SCROLL_TOP | V2D_SCROLL_BOTTOM); + region->v2d.scroll |= V2D_SCROLL_HORIZONTAL_HIDE; + region->v2d.scroll |= V2D_SCROLL_VERTICAL_HIDE; + + UI_view2d_region_reinit(®ion->v2d, V2D_COMMONVIEW_LIST, region->winx, region->winy); + + wmKeyMap *keymap = WM_keymap_ensure( + wm->defaultconf, "Spreadsheet Generic", SPACE_SPREADSHEET, 0); + WM_event_add_keymap_handler(®ion->handlers, keymap); +} + +static void spreadsheet_dataset_region_draw(const bContext *C, ARegion *region) +{ + spreadsheet_update_context_path(C); + + View2D *v2d = ®ion->v2d; + UI_view2d_view_ortho(v2d); + UI_ThemeClearColor(TH_BACK); + + draw_dataset_in_region(C, region); + + /* reset view matrix */ + UI_view2d_view_restore(C); + + /* scrollers */ + UI_view2d_scrollers_draw(v2d, NULL); +} + static void spreadsheet_sidebar_init(wmWindowManager *wm, ARegion *region) { UI_panel_category_active_set_default(region, "Filters"); @@ -619,5 +694,15 @@ void ED_spacetype_spreadsheet(void) register_row_filter_panels(*art); + /* regions: channels */ + art = (ARegionType *)MEM_callocN(sizeof(ARegionType), "spreadsheet dataset region"); + art->regionid = RGN_TYPE_CHANNELS; + art->prefsizex = 200 + V2D_SCROLL_WIDTH; + art->keymapflag = ED_KEYMAP_UI | ED_KEYMAP_VIEW2D; + art->init = spreadsheet_dataset_region_init; + art->draw = spreadsheet_dataset_region_draw; + art->listener = spreadsheet_dataset_region_listener; + BLI_addhead(&st->regiontypes, art); + BKE_spacetype_register(st); } diff --git a/source/blender/editors/space_spreadsheet/spreadsheet_context.cc b/source/blender/editors/space_spreadsheet/spreadsheet_context.cc index 3eb43338908..af6ab5d1b92 100644 --- a/source/blender/editors/space_spreadsheet/spreadsheet_context.cc +++ b/source/blender/editors/space_spreadsheet/spreadsheet_context.cc @@ -255,11 +255,11 @@ void ED_spreadsheet_context_path_update_tag(SpaceSpreadsheet *sspreadsheet) blender::ed::spreadsheet::spreadsheet_context_update_tag(sspreadsheet); } -uint64_t ED_spreadsheet_context_path_hash(SpaceSpreadsheet *sspreadsheet) +uint64_t ED_spreadsheet_context_path_hash(const SpaceSpreadsheet *sspreadsheet) { BLI_HashMurmur2A mm2; BLI_hash_mm2a_init(&mm2, 1234); - LISTBASE_FOREACH (SpreadsheetContext *, context, &sspreadsheet->context_path) { + LISTBASE_FOREACH (const SpreadsheetContext *, context, &sspreadsheet->context_path) { blender::ed::spreadsheet::spreadsheet_context_hash(context, &mm2); } return BLI_hash_mm2a_end(&mm2); diff --git a/source/blender/editors/space_spreadsheet/spreadsheet_data_source.hh b/source/blender/editors/space_spreadsheet/spreadsheet_data_source.hh index fad1770e621..2ea7fb5809f 100644 --- a/source/blender/editors/space_spreadsheet/spreadsheet_data_source.hh +++ b/source/blender/editors/space_spreadsheet/spreadsheet_data_source.hh @@ -54,7 +54,7 @@ class DataSource { } /** - * Returns true iff the data source has the ability to limit visible rows + * Returns true if the data source has the ability to limit visible rows * by user interface selection status. */ virtual bool has_selection_filter() const diff --git a/source/blender/editors/space_spreadsheet/spreadsheet_data_source_geometry.cc b/source/blender/editors/space_spreadsheet/spreadsheet_data_source_geometry.cc index 77248254d7b..6d244a1bda6 100644 --- a/source/blender/editors/space_spreadsheet/spreadsheet_data_source_geometry.cc +++ b/source/blender/editors/space_spreadsheet/spreadsheet_data_source_geometry.cc @@ -226,15 +226,23 @@ static void get_selected_indices_on_domain(const Mesh &mesh, } } +/** + * Only data sets corresponding to mesh objects in edit mode currently support selection filtering. + */ bool GeometryDataSource::has_selection_filter() const { Object *object_orig = DEG_get_original_object(object_eval_); - if (object_orig->type == OB_MESH) { - if (object_orig->mode == OB_MODE_EDIT) { - return true; - } + if (object_orig->type != OB_MESH) { + return false; } - return false; + if (object_orig->mode != OB_MODE_EDIT) { + return false; + } + if (component_->type() != GEO_COMPONENT_TYPE_MESH) { + return false; + } + + return true; } void GeometryDataSource::apply_selection_filter(MutableSpan<bool> rows_included) const @@ -377,9 +385,9 @@ int InstancesDataSource::tot_rows() const return component_->instances_amount(); } -static GeometrySet get_display_geometry_set(SpaceSpreadsheet *sspreadsheet, - Object *object_eval, - const GeometryComponentType used_component_type) +GeometrySet spreadsheet_get_display_geometry_set(const SpaceSpreadsheet *sspreadsheet, + Object *object_eval, + const GeometryComponentType used_component_type) { GeometrySet geometry_set; if (sspreadsheet->object_eval_state == SPREADSHEET_OBJECT_EVAL_STATE_ORIGINAL) { @@ -462,7 +470,8 @@ std::unique_ptr<DataSource> data_source_from_geometry(const bContext *C, Object SpaceSpreadsheet *sspreadsheet = CTX_wm_space_spreadsheet(C); const AttributeDomain domain = (AttributeDomain)sspreadsheet->attribute_domain; const GeometryComponentType component_type = get_display_component_type(C, object_eval); - GeometrySet geometry_set = get_display_geometry_set(sspreadsheet, object_eval, component_type); + GeometrySet geometry_set = spreadsheet_get_display_geometry_set( + sspreadsheet, object_eval, component_type); if (!geometry_set.has(component_type)) { return {}; diff --git a/source/blender/editors/space_spreadsheet/spreadsheet_dataset_draw.cc b/source/blender/editors/space_spreadsheet/spreadsheet_dataset_draw.cc new file mode 100644 index 00000000000..4f870092caa --- /dev/null +++ b/source/blender/editors/space_spreadsheet/spreadsheet_dataset_draw.cc @@ -0,0 +1,287 @@ +/* + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#include <array> + +#include "DNA_space_types.h" +#include "DNA_windowmanager_types.h" + +#include "BKE_context.h" + +#include "BLF_api.h" + +#include "BLI_rect.h" + +#include "RNA_access.h" + +#include "UI_interface.h" +#include "UI_view2d.h" + +#include "WM_types.h" + +#include "spreadsheet_dataset_draw.hh" +#include "spreadsheet_draw.hh" +#include "spreadsheet_intern.hh" + +static int is_component_row_selected(struct uiBut *but, const void *arg) +{ + SpaceSpreadsheet *sspreadsheet = (SpaceSpreadsheet *)arg; + + GeometryComponentType component = (GeometryComponentType)UI_but_datasetrow_component_get(but); + AttributeDomain domain = (AttributeDomain)UI_but_datasetrow_domain_get(but); + + const bool is_component_selected = (GeometryComponentType) + sspreadsheet->geometry_component_type == component; + const bool is_domain_selected = (AttributeDomain)sspreadsheet->attribute_domain == domain; + bool is_selected = is_component_selected && is_domain_selected; + + if (component == GEO_COMPONENT_TYPE_INSTANCES) { + is_selected = is_component_selected; + } + + return is_selected; +} + +namespace blender::ed::spreadsheet { + +/* -------------------------------------------------------------------- */ +/* Draw Context */ + +class DatasetDrawContext { + std::array<int, 2> mval_; + + public: + const SpaceSpreadsheet *sspreadsheet; + Object *object_eval; + /* Current geometry set, changes per component. */ + GeometrySet current_geometry_set; + + DatasetDrawContext(const bContext *C); + + GeometrySet geometry_set_from_component(GeometryComponentType component); + const std::array<int, 2> &cursor_mval() const; +}; + +DatasetDrawContext::DatasetDrawContext(const bContext *C) + : sspreadsheet(CTX_wm_space_spreadsheet(C)), + object_eval(spreadsheet_get_object_eval(sspreadsheet, CTX_data_depsgraph_pointer(C))) +{ + const wmWindow *win = CTX_wm_window(C); + const ARegion *region = CTX_wm_region(C); + mval_ = {win->eventstate->x - region->winrct.xmin, win->eventstate->y - region->winrct.ymin}; +} + +GeometrySet DatasetDrawContext::geometry_set_from_component(GeometryComponentType component) +{ + return spreadsheet_get_display_geometry_set(sspreadsheet, object_eval, component); +} + +const std::array<int, 2> &DatasetDrawContext::cursor_mval() const +{ + return mval_; +} + +/* -------------------------------------------------------------------- */ +/* Drawer */ + +DatasetRegionDrawer::DatasetRegionDrawer(const ARegion *region, + uiBlock &block, + DatasetDrawContext &draw_context) + : row_height(UI_UNIT_Y), + xmin(region->v2d.cur.xmin), + xmax(region->v2d.cur.xmax), + block(block), + v2d(region->v2d), + draw_context(draw_context) +{ +} + +void DatasetRegionDrawer::draw_hierarchy(const DatasetLayoutHierarchy &layout) +{ + for (const DatasetComponentLayoutInfo &component : layout.components) { + draw_context.current_geometry_set = draw_context.geometry_set_from_component(component.type); + + draw_component_row(component); + + /* Iterate attribute domains, skip unset ones (storage has to be in a enum-based, fixed size + * array so uses optionals to support skipping enum values that shouldn't be displayed for a + * component). */ + for (auto &optional_domain : component.attr_domains) { + if (!optional_domain) { + continue; + } + + const DatasetAttrDomainLayoutInfo &domain_info = *optional_domain; + draw_attribute_domain_row(component, domain_info); + } + } +} + +static int element_count_from_instances(const GeometrySet &geometry_set) +{ + if (geometry_set.has_instances()) { + const InstancesComponent *instances_component = + geometry_set.get_component_for_read<InstancesComponent>(); + return instances_component->instances_amount(); + } + return 0; +} + +static int element_count_from_component_domain(const GeometrySet &geometry_set, + GeometryComponentType component, + AttributeDomain domain) +{ + if (geometry_set.has_mesh() && component == GEO_COMPONENT_TYPE_MESH) { + const MeshComponent *mesh_component = geometry_set.get_component_for_read<MeshComponent>(); + return mesh_component->attribute_domain_size(domain); + } + + if (geometry_set.has_pointcloud() && component == GEO_COMPONENT_TYPE_POINT_CLOUD) { + const PointCloudComponent *point_cloud_component = + geometry_set.get_component_for_read<PointCloudComponent>(); + return point_cloud_component->attribute_domain_size(domain); + } + + if (geometry_set.has_volume() && component == GEO_COMPONENT_TYPE_VOLUME) { + const VolumeComponent *volume_component = + geometry_set.get_component_for_read<VolumeComponent>(); + return volume_component->attribute_domain_size(domain); + } + + if (geometry_set.has_curve() && component == GEO_COMPONENT_TYPE_CURVE) { + const CurveComponent *curve_component = geometry_set.get_component_for_read<CurveComponent>(); + return curve_component->attribute_domain_size(domain); + } + + return 0; +} + +void DatasetRegionDrawer::draw_dataset_row(const int indentation, + const GeometryComponentType component, + const std::optional<AttributeDomain> domain, + BIFIconID icon, + const char *label, + const bool is_active) +{ + + const float row_height = UI_UNIT_Y; + const float padding_x = UI_UNIT_X * 0.25f; + + const rctf rect = {float(xmin) + padding_x, + float(xmax) - V2D_SCROLL_HANDLE_WIDTH, + ymin_offset - row_height, + ymin_offset}; + + char element_count[7]; + if (component == GEO_COMPONENT_TYPE_INSTANCES) { + BLI_str_format_attribute_domain_size( + element_count, element_count_from_instances(draw_context.current_geometry_set)); + } + else { + BLI_str_format_attribute_domain_size( + element_count, + domain ? element_count_from_component_domain( + draw_context.current_geometry_set, component, *domain) : + 0); + } + + std::string label_and_element_count = label; + label_and_element_count += UI_SEP_CHAR; + label_and_element_count += element_count; + + uiBut *bt = uiDefIconTextButO(&block, + UI_BTYPE_DATASETROW, + "SPREADSHEET_OT_change_spreadsheet_data_source", + 0, + icon, + label, + rect.xmin, + rect.ymin, + BLI_rctf_size_x(&rect), + BLI_rctf_size_y(&rect), + NULL); + + UI_but_datasetrow_indentation_set(bt, indentation); + + if (is_active) { + UI_but_hint_drawstr_set(bt, element_count); + UI_but_datasetrow_component_set(bt, component); + if (domain) { + UI_but_datasetrow_domain_set(bt, *domain); + } + UI_but_func_pushed_state_set(bt, &is_component_row_selected, draw_context.sspreadsheet); + + PointerRNA *but_ptr = UI_but_operator_ptr_get((uiBut *)bt); + RNA_int_set(but_ptr, "component_type", component); + if (domain) { + RNA_int_set(but_ptr, "attribute_domain_type", *domain); + } + } + + ymin_offset -= row_height; +} + +void DatasetRegionDrawer::draw_component_row(const DatasetComponentLayoutInfo &component_info) +{ + if (component_info.type == GEO_COMPONENT_TYPE_INSTANCES) { + draw_dataset_row( + 0, component_info.type, std::nullopt, component_info.icon, component_info.label, true); + } + else { + draw_dataset_row( + 0, component_info.type, std::nullopt, component_info.icon, component_info.label, false); + } +} + +void DatasetRegionDrawer::draw_attribute_domain_row( + const DatasetComponentLayoutInfo &component_info, + const DatasetAttrDomainLayoutInfo &domain_info) +{ + draw_dataset_row( + 1, component_info.type, domain_info.type, domain_info.icon, domain_info.label, true); +} + +/* -------------------------------------------------------------------- */ +/* Drawer */ + +void draw_dataset_in_region(const bContext *C, ARegion *region) +{ + DatasetDrawContext draw_context{C}; + if (!draw_context.object_eval) { + /* No object means nothing to display. Keep the region empty. */ + return; + } + + uiBlock *block = UI_block_begin(C, region, __func__, UI_EMBOSS); + + DatasetRegionDrawer drawer{region, *block, draw_context}; + + /* Start with an offset to align buttons to spreadsheet rows. Use spreadsheet drawing info for + * that. */ + drawer.ymin_offset = -SpreadsheetDrawer().top_row_height + drawer.row_height; + + const DatasetLayoutHierarchy hierarchy = dataset_layout_hierarchy(); + drawer.draw_hierarchy(hierarchy); +#ifndef NDEBUG + dataset_layout_hierarchy_sanity_check(hierarchy); +#endif + + UI_block_end(C, block); + UI_view2d_totRect_set(®ion->v2d, region->winx, abs(drawer.ymin_offset)); + UI_block_draw(C, block); +} + +} // namespace blender::ed::spreadsheet diff --git a/source/blender/editors/space_spreadsheet/spreadsheet_dataset_draw.hh b/source/blender/editors/space_spreadsheet/spreadsheet_dataset_draw.hh new file mode 100644 index 00000000000..d9e6d882c2a --- /dev/null +++ b/source/blender/editors/space_spreadsheet/spreadsheet_dataset_draw.hh @@ -0,0 +1,64 @@ +/* + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#pragma once + +#include <array> + +#include "BKE_geometry_set.hh" +#include "UI_interface.h" +#include "spreadsheet_dataset_layout.hh" + +struct ARegion; +struct uiBlock; +struct View2D; +struct bContext; + +namespace blender::ed::spreadsheet { + +class DatasetDrawContext; + +class DatasetRegionDrawer { + public: + const int row_height; + float ymin_offset = 0; + + int xmin; + int xmax; + uiBlock █ + const View2D &v2d; + DatasetDrawContext &draw_context; + + DatasetRegionDrawer(const ARegion *region, uiBlock &block, DatasetDrawContext &draw_context); + + void draw_hierarchy(const DatasetLayoutHierarchy &layout); + + void draw_attribute_domain_row(const DatasetComponentLayoutInfo &component, + const DatasetAttrDomainLayoutInfo &domain_info); + void draw_component_row(const DatasetComponentLayoutInfo &component_info); + + private: + void draw_dataset_row(const int indentation, + const GeometryComponentType component, + const std::optional<AttributeDomain> domain, + const BIFIconID icon, + const char *label, + const bool is_active); +}; + +void draw_dataset_in_region(const bContext *C, ARegion *region); + +} // namespace blender::ed::spreadsheet diff --git a/source/blender/editors/space_spreadsheet/spreadsheet_dataset_layout.cc b/source/blender/editors/space_spreadsheet/spreadsheet_dataset_layout.cc new file mode 100644 index 00000000000..5b5c5ed0b04 --- /dev/null +++ b/source/blender/editors/space_spreadsheet/spreadsheet_dataset_layout.cc @@ -0,0 +1,112 @@ +/* + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#include <optional> + +#include "BLI_span.hh" + +#include "BLT_translation.h" + +#include "spreadsheet_dataset_layout.hh" + +namespace blender::ed::spreadsheet { + +#define ATTR_INFO(type, label, icon) \ + std::optional<DatasetAttrDomainLayoutInfo> \ + { \ + std::in_place, type, label, icon \ + } +#define ATTR_INFO_NONE(type) \ + { \ + std::nullopt \ + } + +/** + * Definition for the component->attribute-domain hierarchy. + * Constructed at compile time. + * + * \warning: Order of attribute-domains matters! It __must__ match the #AttributeDomain definition + * and fill gaps with unset optionals (i.e. `std::nullopt`). Would be nice to use array + * designators for this (which C++ doesn't support). + */ +constexpr DatasetComponentLayoutInfo DATASET_layout_hierarchy[] = { + { + GEO_COMPONENT_TYPE_MESH, + N_("Mesh"), + ICON_MESH_DATA, + { + ATTR_INFO(ATTR_DOMAIN_POINT, N_("Vertex"), ICON_VERTEXSEL), + ATTR_INFO(ATTR_DOMAIN_EDGE, N_("Edge"), ICON_EDGESEL), + ATTR_INFO(ATTR_DOMAIN_FACE, N_("Face"), ICON_FACESEL), + ATTR_INFO(ATTR_DOMAIN_CORNER, N_("Face Corner"), ICON_NODE_CORNER), + }, + }, + { + GEO_COMPONENT_TYPE_CURVE, + N_("Curves"), + ICON_CURVE_DATA, + { + ATTR_INFO(ATTR_DOMAIN_POINT, N_("Control Point"), ICON_CURVE_BEZCIRCLE), + ATTR_INFO_NONE(ATTR_DOMAIN_EDGE), + ATTR_INFO_NONE(ATTR_DOMAIN_CORNER), + ATTR_INFO_NONE(ATTR_DOMAIN_FACE), + ATTR_INFO(ATTR_DOMAIN_CURVE, N_("Spline"), ICON_CURVE_PATH), + }, + }, + { + GEO_COMPONENT_TYPE_POINT_CLOUD, + N_("Point Cloud"), + ICON_POINTCLOUD_DATA, + { + ATTR_INFO(ATTR_DOMAIN_POINT, N_("Point"), ICON_PARTICLE_POINT), + }, + }, + { + GEO_COMPONENT_TYPE_INSTANCES, + N_("Instances"), + ICON_EMPTY_AXIS, + {}, + }, +}; + +#undef ATTR_INFO +#undef ATTR_INFO_LABEL + +DatasetLayoutHierarchy dataset_layout_hierarchy() +{ + return DatasetLayoutHierarchy{ + Span{DATASET_layout_hierarchy, ARRAY_SIZE(DATASET_layout_hierarchy)}}; +} + +#ifndef NDEBUG +/** + * Debug-only sanity check for correct attribute domain initialization (order/indices must + * match AttributeDomain). This doesn't check for all possible missuses, but should catch the most + * likely mistakes. + */ +void dataset_layout_hierarchy_sanity_check(const DatasetLayoutHierarchy &hierarchy) +{ + for (const DatasetComponentLayoutInfo &component : hierarchy.components) { + for (uint i = 0; i < component.attr_domains.size(); i++) { + if (component.attr_domains[i]) { + BLI_assert(component.attr_domains[i]->type == static_cast<AttributeDomain>(i)); + } + } + } +} +#endif + +} // namespace blender::ed::spreadsheet diff --git a/source/blender/editors/space_spreadsheet/spreadsheet_dataset_layout.hh b/source/blender/editors/space_spreadsheet/spreadsheet_dataset_layout.hh new file mode 100644 index 00000000000..d463739a0fa --- /dev/null +++ b/source/blender/editors/space_spreadsheet/spreadsheet_dataset_layout.hh @@ -0,0 +1,68 @@ +/* + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#pragma once + +#include <array> +#include <optional> + +/* Enum definitions... */ +#include "BKE_attribute.h" +#include "BKE_geometry_set.h" + +#include "BLI_span.hh" + +/* More enum definitions... */ +#include "UI_resources.h" + +#pragma once + +namespace blender::ed::spreadsheet { + +struct DatasetAttrDomainLayoutInfo { + AttributeDomain type; + const char *label; + BIFIconID icon; + + constexpr DatasetAttrDomainLayoutInfo(AttributeDomain type, const char *label, BIFIconID icon) + : type(type), label(label), icon(icon) + { + } +}; + +struct DatasetComponentLayoutInfo { + GeometryComponentType type; + const char *label; + BIFIconID icon; + /** Array of attribute-domains. Has to be fixed size based on #AttributeDomain enum, but not all + * values need displaying for all parent components. Hence the optional use. */ + using AttrDomainArray = std::array<std::optional<DatasetAttrDomainLayoutInfo>, ATTR_DOMAIN_NUM>; + const AttrDomainArray attr_domains; +}; + +struct DatasetLayoutHierarchy { + /** The components for display (with layout info like icon and label). Each component stores + * the attribute domains it wants to display (also with layout info like icon and label). */ + const Span<DatasetComponentLayoutInfo> components; +}; + +DatasetLayoutHierarchy dataset_layout_hierarchy(); + +#ifndef NDEBUG +void dataset_layout_hierarchy_sanity_check(const DatasetLayoutHierarchy &hierarchy); +#endif + +} // namespace blender::ed::spreadsheet diff --git a/source/blender/editors/space_spreadsheet/spreadsheet_intern.hh b/source/blender/editors/space_spreadsheet/spreadsheet_intern.hh index 7e3b79a6706..8be5283fd63 100644 --- a/source/blender/editors/space_spreadsheet/spreadsheet_intern.hh +++ b/source/blender/editors/space_spreadsheet/spreadsheet_intern.hh @@ -16,10 +16,23 @@ #pragma once +#include "BKE_geometry_set.hh" + typedef struct SpaceSpreadsheet_Runtime { int visible_rows; int tot_rows; int tot_columns; } SpaceSpreadsheet_Runtime; +struct bContext; + void spreadsheet_operatortypes(void); +void spreadsheet_update_context_path(const bContext *C); +Object *spreadsheet_get_object_eval(const SpaceSpreadsheet *sspreadsheet, + const Depsgraph *depsgraph); + +namespace blender::ed::spreadsheet { +GeometrySet spreadsheet_get_display_geometry_set(const SpaceSpreadsheet *sspreadsheet, + Object *object_eval, + const GeometryComponentType used_component_type); +} diff --git a/source/blender/editors/space_spreadsheet/spreadsheet_ops.cc b/source/blender/editors/space_spreadsheet/spreadsheet_ops.cc index fcbc37346e6..ceb4cd84cde 100644 --- a/source/blender/editors/space_spreadsheet/spreadsheet_ops.cc +++ b/source/blender/editors/space_spreadsheet/spreadsheet_ops.cc @@ -13,6 +13,17 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ +#include "BKE_screen.h" + +#include "DNA_space_types.h" + +#include "ED_screen.h" + +#include "RNA_access.h" +#include "RNA_define.h" + +#include "WM_api.h" +#include "WM_types.h" #include "BLI_listbase.h" @@ -89,8 +100,50 @@ static void SPREADSHEET_OT_remove_row_filter_rule(wmOperatorType *ot) RNA_def_int(ot->srna, "index", 0, 0, INT_MAX, "Index", "", 0, INT_MAX); } +static int select_component_domain_invoke(bContext *C, + wmOperator *op, + const wmEvent *UNUSED(event)) +{ + GeometryComponentType component_type = static_cast<GeometryComponentType>( + RNA_int_get(op->ptr, "component_type")); + AttributeDomain attribute_domain = static_cast<AttributeDomain>( + RNA_int_get(op->ptr, "attribute_domain_type")); + + SpaceSpreadsheet *sspreadsheet = CTX_wm_space_spreadsheet(C); + sspreadsheet->geometry_component_type = component_type; + sspreadsheet->attribute_domain = attribute_domain; + + /* Refresh header and main region. */ + WM_main_add_notifier(NC_SPACE | ND_SPACE_SPREADSHEET, NULL); + + return OPERATOR_FINISHED; +} + +static void SPREADSHEET_OT_change_spreadsheet_data_source(wmOperatorType *ot) +{ + ot->name = "Change Visible Data Source"; + ot->description = "Change visible data source in the spreadsheet"; + ot->idname = "SPREADSHEET_OT_change_spreadsheet_data_source"; + + ot->invoke = select_component_domain_invoke; + + RNA_def_int(ot->srna, "component_type", 0, 0, INT16_MAX, "Component Type", "", 0, INT16_MAX); + RNA_def_int(ot->srna, + "attribute_domain_type", + 0, + 0, + INT16_MAX, + "Attribute Domain Type", + "", + 0, + INT16_MAX); + + ot->flag = OPTYPE_INTERNAL; +} + void spreadsheet_operatortypes() { WM_operatortype_append(SPREADSHEET_OT_add_row_filter_rule); WM_operatortype_append(SPREADSHEET_OT_remove_row_filter_rule); + WM_operatortype_append(SPREADSHEET_OT_change_spreadsheet_data_source); } diff --git a/source/blender/editors/space_statusbar/space_statusbar.c b/source/blender/editors/space_statusbar/space_statusbar.c index 0b4f483c114..bf2a5534e0b 100644 --- a/source/blender/editors/space_statusbar/space_statusbar.c +++ b/source/blender/editors/space_statusbar/space_statusbar.c @@ -39,7 +39,7 @@ #include "WM_message.h" #include "WM_types.h" -/* ******************** default callbacks for statusbar space ******************** */ +/* ******************** default callbacks for statusbar space ******************** */ static SpaceLink *statusbar_create(const ScrArea *UNUSED(area), const Scene *UNUSED(scene)) { diff --git a/source/blender/editors/space_text/text_draw.c b/source/blender/editors/space_text/text_draw.c index 17831c95575..1d8bc427212 100644 --- a/source/blender/editors/space_text/text_draw.c +++ b/source/blender/editors/space_text/text_draw.c @@ -938,7 +938,7 @@ static void calc_text_rcts(SpaceText *st, ARegion *region, rcti *scroll, rcti *b hlstart = barstart + barheight; } else if (lhlend > st->top && lhlstart < st->top && hlstart > barstart) { - /*fill out start */ + /* Fill out start. */ hlstart = barstart; } diff --git a/source/blender/editors/space_text/text_format_pov.c b/source/blender/editors/space_text/text_format_pov.c index a68632c0d56..1200dda7533 100644 --- a/source/blender/editors/space_text/text_format_pov.c +++ b/source/blender/editors/space_text/text_format_pov.c @@ -644,7 +644,7 @@ static int txtfmt_pov_find_specialvar(const char *string) } else if (STR_LITERAL_STARTSWITH(string, "ratio", len)) { i = len; } else if (STR_LITERAL_STARTSWITH(string, "open", len)) { i = len; } else if (STR_LITERAL_STARTSWITH(string, "ior", len)) { i = len; - /* Light Types and options*/ + /* Light Types and options. */ } else if (STR_LITERAL_STARTSWITH(string, "area_light", len)) { i = len; } else if (STR_LITERAL_STARTSWITH(string, "looks_like", len)) { i = len; } else if (STR_LITERAL_STARTSWITH(string, "fade_power", len)) { i = len; @@ -654,7 +654,7 @@ static int txtfmt_pov_find_specialvar(const char *string) } else if (STR_LITERAL_STARTSWITH(string, "point_at", len)) { i = len; } else if (STR_LITERAL_STARTSWITH(string, "falloff", len)) { i = len; } else if (STR_LITERAL_STARTSWITH(string, "radius", len)) { i = len; - /* Camera Types and options*/ + /* Camera Types and options. */ } else if (STR_LITERAL_STARTSWITH(string, "omni_directional_stereo", len)) { i = len; } else if (STR_LITERAL_STARTSWITH(string, "lambert_cylindrical", len)) { i = len; } else if (STR_LITERAL_STARTSWITH(string, "miller_cylindrical", len)) { i = len; diff --git a/source/blender/editors/space_text/text_ops.c b/source/blender/editors/space_text/text_ops.c index 9ec759ce4ae..6ca89250cd7 100644 --- a/source/blender/editors/space_text/text_ops.c +++ b/source/blender/editors/space_text/text_ops.c @@ -2782,8 +2782,7 @@ void TEXT_OT_scroll(wmOperatorType *ot) /* identifiers */ ot->name = "Scroll"; /* don't really see the difference between this and - * scroll_bar. Both do basically the same thing (aside - * from keymaps).*/ + * scroll_bar. Both do basically the same thing (aside from key-maps). */ ot->idname = "TEXT_OT_scroll"; /* api callbacks */ @@ -2889,8 +2888,7 @@ void TEXT_OT_scroll_bar(wmOperatorType *ot) /* identifiers */ ot->name = "Scrollbar"; /* don't really see the difference between this and - * scroll. Both do basically the same thing (aside - * from keymaps).*/ + * scroll. Both do basically the same thing (aside from key-maps). */ ot->idname = "TEXT_OT_scroll_bar"; /* api callbacks */ diff --git a/source/blender/editors/space_view3d/space_view3d.c b/source/blender/editors/space_view3d/space_view3d.c index f17cee8056f..c9f345b3123 100644 --- a/source/blender/editors/space_view3d/space_view3d.c +++ b/source/blender/editors/space_view3d/space_view3d.c @@ -187,7 +187,7 @@ bool ED_view3d_area_user_region(const ScrArea *area, const View3D *v3d, ARegion * view3d_project_short_clip and view3d_project_short_noclip in cases where * these functions are not used during draw_object */ -void ED_view3d_init_mats_rv3d(struct Object *ob, struct RegionView3D *rv3d) +void ED_view3d_init_mats_rv3d(const struct Object *ob, struct RegionView3D *rv3d) { /* local viewmat and persmat, to calculate projections */ mul_m4_m4m4(rv3d->viewmatob, rv3d->viewmat, ob->obmat); @@ -197,7 +197,7 @@ void ED_view3d_init_mats_rv3d(struct Object *ob, struct RegionView3D *rv3d) ED_view3d_clipping_local(rv3d, ob->obmat); } -void ED_view3d_init_mats_rv3d_gl(struct Object *ob, struct RegionView3D *rv3d) +void ED_view3d_init_mats_rv3d_gl(const struct Object *ob, struct RegionView3D *rv3d) { ED_view3d_init_mats_rv3d(ob, rv3d); @@ -786,12 +786,6 @@ static void view3d_main_region_free(ARegion *region) RE_engine_free(rv3d->render_engine); } - if (rv3d->depths) { - if (rv3d->depths->depths) { - MEM_freeN(rv3d->depths->depths); - } - MEM_freeN(rv3d->depths); - } if (rv3d->sms) { MEM_freeN(rv3d->sms); } @@ -815,7 +809,6 @@ static void *view3d_main_region_duplicate(void *poin) new->clipbb = MEM_dupallocN(rv3d->clipbb); } - new->depths = NULL; new->render_engine = NULL; new->sms = NULL; new->smooth_timer = NULL; diff --git a/source/blender/editors/space_view3d/view3d_camera_control.c b/source/blender/editors/space_view3d/view3d_camera_control.c index 0edd6aeb2ca..638c8a49ffd 100644 --- a/source/blender/editors/space_view3d/view3d_camera_control.c +++ b/source/blender/editors/space_view3d/view3d_camera_control.c @@ -140,7 +140,7 @@ struct View3DCameraControl *ED_view3d_cameracontrol_acquire(Depsgraph *depsgraph vctrl->persp_backup = rv3d->persp; vctrl->dist_backup = rv3d->dist; - /* check for flying ortho camera - which we cant support well + /* check for flying ortho camera - which we can't support well * we _could_ also check for an ortho camera but this is easier */ if ((rv3d->persp == RV3D_CAMOB) && (rv3d->is_persp == false)) { ((Camera *)v3d->camera->data)->type = CAM_PERSP; @@ -278,7 +278,7 @@ void ED_view3d_cameracontrol_update(View3DCameraControl *vctrl, mul_m4_m4m4(parent_mat, diff_mat, vctrl->root_parent->obmat); if (object_apply_mat4_with_protect(vctrl->root_parent, parent_mat, false, rv3d, view_mat)) { - /* Calculate again since the view locking changes the matrix. */ + /* Calculate again since the view locking changes the matrix. */ ED_view3d_to_m4(view_mat, rv3d->ofs, rv3d->viewquat, rv3d->dist); } diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c index 0bc19887118..2e46deea0e8 100644 --- a/source/blender/editors/space_view3d/view3d_draw.c +++ b/source/blender/editors/space_view3d/view3d_draw.c @@ -2221,7 +2221,7 @@ int ED_view3d_backbuf_sample_size_clamp(ARegion *region, const float dist) /** \name Z-Depth Utilities * \{ */ -void view3d_update_depths_rect(ARegion *region, ViewDepths *d, rcti *rect) +void view3d_depths_rect_create(ARegion *region, rcti *rect, ViewDepths *r_d) { /* clamp rect by region */ rcti r = { @@ -2242,70 +2242,44 @@ void view3d_update_depths_rect(ARegion *region, ViewDepths *d, rcti *rect) int h = BLI_rcti_size_y(rect); if (w <= 0 || h <= 0) { - if (d->depths) { - MEM_freeN(d->depths); - } - d->depths = NULL; - - d->damaged = false; + r_d->depths = NULL; + return; } - else if (d->w != w || d->h != h || d->x != x || d->y != y || d->depths == NULL) { - d->x = x; - d->y = y; - d->w = w; - d->h = h; - if (d->depths) { - MEM_freeN(d->depths); - } + r_d->x = x; + r_d->y = y; + r_d->w = w; + r_d->h = h; - d->depths = MEM_mallocN(sizeof(float) * d->w * d->h, "View depths Subset"); + r_d->depths = MEM_mallocN(sizeof(float) * w * h, "View depths Subset"); - d->damaged = true; - } - - if (d->damaged) { + { GPUViewport *viewport = WM_draw_region_get_viewport(region); - view3d_opengl_read_Z_pixels(viewport, rect, d->depths); + view3d_opengl_read_Z_pixels(viewport, rect, r_d->depths); /* Range is assumed to be this as they are never changed. */ - d->depth_range[0] = 0.0; - d->depth_range[1] = 1.0; - d->damaged = false; + r_d->depth_range[0] = 0.0; + r_d->depth_range[1] = 1.0; } } /* Note, with nouveau drivers the glReadPixels() is very slow. T24339. */ -static void view3d_depth_cache_update(ARegion *region) +static ViewDepths *view3d_depths_create(ARegion *region) { - RegionView3D *rv3d = region->regiondata; - - /* Create storage for, and, if necessary, copy depth buffer. */ - if (!rv3d->depths) { - rv3d->depths = MEM_callocN(sizeof(ViewDepths), "ViewDepths"); - } - if (rv3d->depths) { - ViewDepths *d = rv3d->depths; - if (d->w != region->winx || d->h != region->winy || !d->depths) { - d->w = region->winx; - d->h = region->winy; - if (d->depths) { - MEM_freeN(d->depths); - } - d->depths = MEM_mallocN(sizeof(float) * d->w * d->h, "View depths"); - d->damaged = true; - } + ViewDepths *d = MEM_callocN(sizeof(ViewDepths), "ViewDepths"); + d->w = region->winx; + d->h = region->winy; + d->depths = MEM_mallocN(sizeof(float) * d->w * d->h, "View depths"); - if (d->damaged) { - GPUViewport *viewport = WM_draw_region_get_viewport(region); - DefaultFramebufferList *fbl = GPU_viewport_framebuffer_list_get(viewport); - GPU_framebuffer_read_depth(fbl->depth_only_fb, 0, 0, d->w, d->h, GPU_DATA_FLOAT, d->depths); + { + GPUViewport *viewport = WM_draw_region_get_viewport(region); + DefaultFramebufferList *fbl = GPU_viewport_framebuffer_list_get(viewport); + GPU_framebuffer_read_depth(fbl->depth_only_fb, 0, 0, d->w, d->h, GPU_DATA_FLOAT, d->depths); - /* Assumed to be this as they are never changed. */ - d->depth_range[0] = 0.0; - d->depth_range[1] = 1.0; - d->damaged = false; - } + /* Assumed to be this as they are never changed. */ + d->depth_range[0] = 0.0; + d->depth_range[1] = 1.0; } + return d; } /* Utility function to find the closest Z value, use for auto-depth. */ @@ -2345,10 +2319,13 @@ void ED_view3d_depth_override(Depsgraph *depsgraph, View3D *v3d, Object *obact, eV3DDepthOverrideMode mode, - bool update_cache) + ViewDepths **r_depths) { if (v3d->runtime.flag & V3D_RUNTIME_DEPTHBUF_OVERRIDDEN) { - return; + /* Force redraw if `r_depths` is required. */ + if (!r_depths || *r_depths != NULL) { + return; + } } struct bThemeState theme_state; Scene *scene = DEG_get_evaluated_scene(depsgraph); @@ -2390,12 +2367,11 @@ void ED_view3d_depth_override(Depsgraph *depsgraph, break; } - if (rv3d->depths != NULL) { - rv3d->depths->damaged = true; - /* TODO: Clear cache? */ - } - if (update_cache) { - view3d_depth_cache_update(region); + if (r_depths) { + if (*r_depths) { + ED_view3d_depths_free(*r_depths); + } + *r_depths = view3d_depths_create(region); } } @@ -2409,6 +2385,14 @@ void ED_view3d_depth_override(Depsgraph *depsgraph, UI_Theme_Restore(&theme_state); } +void ED_view3d_depths_free(ViewDepths *depths) +{ + if (depths->depths) { + MEM_freeN(depths->depths); + } + MEM_freeN(depths); +} + /** \} */ /* -------------------------------------------------------------------- */ diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c index 8b6d0e9ee04..50e9a9fb805 100644 --- a/source/blender/editors/space_view3d/view3d_edit.c +++ b/source/blender/editors/space_view3d/view3d_edit.c @@ -509,7 +509,7 @@ static void viewops_data_create(bContext *C, negate_v3_v3(my_origin, rv3d->ofs); /* ofs is flipped */ /* Set the dist value to be the distance from this 3d point this means you'll - * always be able to zoom into it and panning wont go bad when dist was zero. */ + * always be able to zoom into it and panning won't go bad when dist was zero. */ /* remove dist value */ upvec[0] = upvec[1] = 0; @@ -611,7 +611,7 @@ enum { VIEWROT_MODAL_SWITCH_ROTATE = 6, }; -/* called in transform_ops.c, on each regeneration of keymaps */ +/* Called in transform_ops.c, on each regeneration of key-maps. */ void viewrotate_modal_keymap(wmKeyConfig *keyconf) { static const EnumPropertyItem modal_items[] = { @@ -895,7 +895,7 @@ static void viewrotate_apply(ViewOpsData *vod, const int event_xy[2]) copy_qt_qt(rv3d->viewquat, vod->curr.viewquat); /* check for view snap, - * note: don't apply snap to vod->viewquat so the view wont jam up */ + * note: don't apply snap to vod->viewquat so the view won't jam up */ if (vod->axis_snap) { viewrotate_apply_snap(vod); } @@ -953,7 +953,6 @@ static int viewrotate_modal(bContext *C, wmOperator *op, const wmEvent *event) } } else if (event_code == VIEW_CONFIRM) { - ED_view3d_depth_tag_update(vod->rv3d); use_autokey = true; ret = OPERATOR_FINISHED; } @@ -1014,7 +1013,6 @@ static int viewrotate_invoke(bContext *C, wmOperator *op, const wmEvent *event) } viewrotate_apply(vod, event_xy); - ED_view3d_depth_tag_update(vod->rv3d); viewops_data_free(C, op); @@ -1688,7 +1686,7 @@ void VIEW3D_OT_ndof_all(struct wmOperatorType *ot) /* NOTE: these defines are saved in keymap files, do not change values but just add new ones */ -/* called in transform_ops.c, on each regeneration of keymaps */ +/* Called in transform_ops.c, on each regeneration of key-maps. */ void viewmove_modal_keymap(wmKeyConfig *keyconf) { static const EnumPropertyItem modal_items[] = { @@ -1799,7 +1797,6 @@ static int viewmove_modal(bContext *C, wmOperator *op, const wmEvent *event) } } else if (event_code == VIEW_CONFIRM) { - ED_view3d_depth_tag_update(vod->rv3d); use_autokey = true; ret = OPERATOR_FINISHED; } @@ -1840,7 +1837,6 @@ static int viewmove_invoke(bContext *C, wmOperator *op, const wmEvent *event) if (event->type == MOUSEPAN) { /* invert it, trackpad scroll follows same principle as 2d windows this way */ viewmove_apply(vod, 2 * event->x - event->prevx, 2 * event->y - event->prevy); - ED_view3d_depth_tag_update(vod->rv3d); viewops_data_free(C, op); @@ -1885,8 +1881,8 @@ void VIEW3D_OT_move(wmOperatorType *ot) /** \name View Zoom Operator * \{ */ -/* viewdolly_modal_keymap has an exact copy of this, apply fixes to both */ -/* called in transform_ops.c, on each regeneration of keymaps */ +/* #viewdolly_modal_keymap has an exact copy of this, apply fixes to both. */ +/* Called in transform_ops.c, on each regeneration of key-maps. */ void viewzoom_modal_keymap(wmKeyConfig *keyconf) { static const EnumPropertyItem modal_items[] = { @@ -2254,7 +2250,6 @@ static int viewzoom_modal(bContext *C, wmOperator *op, const wmEvent *event) } } else if (event_code == VIEW_CONFIRM) { - ED_view3d_depth_tag_update(vod->rv3d); use_autokey = true; ret = OPERATOR_FINISHED; } @@ -2341,8 +2336,6 @@ static int viewzoom_exec(bContext *C, wmOperator *op) view3d_boxview_sync(area, region); } - ED_view3d_depth_tag_update(rv3d); - ED_view3d_camera_lock_sync(depsgraph, v3d, rv3d); ED_view3d_camera_lock_autokey(v3d, rv3d, C, false, true); @@ -2398,8 +2391,6 @@ static int viewzoom_invoke(bContext *C, wmOperator *op, const wmEvent *event) (use_cursor_init && (U.uiflag & USER_ZOOM_TO_MOUSEPOS))); ED_view3d_camera_lock_autokey(vod->v3d, vod->rv3d, C, false, true); - ED_view3d_depth_tag_update(vod->rv3d); - viewops_data_free(C, op); return OPERATOR_FINISHED; } @@ -2454,8 +2445,8 @@ void VIEW3D_OT_zoom(wmOperatorType *ot) * which avoids #RegionView3D.dist approaching zero. * \{ */ -/* this is an exact copy of viewzoom_modal_keymap */ -/* called in transform_ops.c, on each regeneration of keymaps */ +/* This is an exact copy of #viewzoom_modal_keymap. */ +/* Called in transform_ops.c, on each regeneration of key-maps. */ void viewdolly_modal_keymap(wmKeyConfig *keyconf) { static const EnumPropertyItem modal_items[] = { @@ -2579,7 +2570,6 @@ static int viewdolly_modal(bContext *C, wmOperator *op, const wmEvent *event) } } else if (event_code == VIEW_CONFIRM) { - ED_view3d_depth_tag_update(vod->rv3d); use_autokey = true; ret = OPERATOR_FINISHED; } @@ -2636,8 +2626,6 @@ static int viewdolly_exec(bContext *C, wmOperator *op) view3d_boxview_sync(area, region); } - ED_view3d_depth_tag_update(rv3d); - ED_view3d_camera_lock_sync(CTX_data_ensure_evaluated_depsgraph(C), v3d, rv3d); ED_region_tag_redraw(region); @@ -2718,7 +2706,6 @@ static int viewdolly_invoke(bContext *C, wmOperator *op, const wmEvent *event) event->prevx; } viewdolly_apply(vod, &event->prevx, (U.uiflag & USER_ZOOM_INVERT) == 0); - ED_view3d_depth_tag_update(vod->rv3d); viewops_data_free(C, op); return OPERATOR_FINISHED; @@ -3629,13 +3616,13 @@ static int view3d_zoom_border_exec(bContext *C, wmOperator *op) ED_view3d_dist_range_get(v3d, dist_range); ED_view3d_depth_override( - CTX_data_ensure_evaluated_depsgraph(C), region, v3d, NULL, V3D_DEPTH_NO_GPENCIL, false); + CTX_data_ensure_evaluated_depsgraph(C), region, v3d, NULL, V3D_DEPTH_NO_GPENCIL, NULL); { /* avoid allocating the whole depth buffer */ ViewDepths depth_temp = {0}; /* avoid view3d_update_depths() for speed. */ - view3d_update_depths_rect(region, &depth_temp, &rect); + view3d_depths_rect_create(region, &rect, &depth_temp); /* find the closest Z pixel */ depth_close = view3d_depth_near(&depth_temp); @@ -3660,7 +3647,7 @@ static int view3d_zoom_border_exec(bContext *C, wmOperator *op) if (rv3d->is_persp) { float p_corner[3]; - /* no depths to use, we cant do anything! */ + /* no depths to use, we can't do anything! */ if (depth_close == FLT_MAX) { BKE_report(op->reports, RPT_ERROR, "Depth too large"); return OPERATOR_CANCELLED; @@ -4433,7 +4420,6 @@ static int viewroll_modal(bContext *C, wmOperator *op, const wmEvent *event) } } else if (event_code == VIEW_CONFIRM) { - ED_view3d_depth_tag_update(vod->rv3d); use_autokey = true; ret = OPERATOR_FINISHED; } @@ -4541,7 +4527,6 @@ static int viewroll_invoke(bContext *C, wmOperator *op, const wmEvent *event) if (event->type == MOUSEROTATE) { vod->init.event_xy[0] = vod->prev.event_xy[0] = event->x; viewroll_apply(vod, event->prevx, event->prevy); - ED_view3d_depth_tag_update(vod->rv3d); viewops_data_free(C, op); return OPERATOR_FINISHED; @@ -4638,7 +4623,6 @@ static int viewpan_invoke(bContext *C, wmOperator *op, const wmEvent *event) viewmove_apply(vod, vod->prev.event_xy[0] + x, vod->prev.event_xy[1] + y); - ED_view3d_depth_tag_update(vod->rv3d); viewops_data_free(C, op); return OPERATOR_FINISHED; diff --git a/source/blender/editors/space_view3d/view3d_fly.c b/source/blender/editors/space_view3d/view3d_fly.c index 2d499cf85c7..91f3388cac9 100644 --- a/source/blender/editors/space_view3d/view3d_fly.c +++ b/source/blender/editors/space_view3d/view3d_fly.c @@ -101,7 +101,7 @@ typedef enum eFlyPanState { FLY_AXISLOCK_STATE_ACTIVE = 2, } eFlyPanState; -/* called in transform_ops.c, on each regeneration of keymaps */ +/* Called in transform_ops.c, on each regeneration of key-maps. */ void fly_modal_keymap(wmKeyConfig *keyconf) { static const EnumPropertyItem modal_items[] = { @@ -610,8 +610,7 @@ static void flyEvent(FlyInfo *fly, const wmEvent *event) fly->pan_view = false; break; - /* implement WASD keys, - * comments only for 'forward '*/ + /* Implement WASD keys, comments only for 'forward'. */ case FLY_MODAL_DIR_FORWARD: if (fly->axis == 2 && fly->speed < 0.0f) { /* reverse direction stops, tap again to continue */ @@ -772,7 +771,7 @@ static int flyApply(bContext *C, FlyInfo *fly, bool is_confirm) float moffset[2]; /* mouse offset from the views center */ float tmp_quat[4]; /* used for rotating the view */ - /* x and y margin are define the safe area where the mouses movement wont rotate the view */ + /* x and y margin defining the safe area where the mouse's movement won't rotate the view */ int xmargin, ymargin; #ifdef NDOF_FLY_DEBUG diff --git a/source/blender/editors/space_view3d/view3d_intern.h b/source/blender/editors/space_view3d/view3d_intern.h index 6f07cb8b44d..0964c2dcbcc 100644 --- a/source/blender/editors/space_view3d/view3d_intern.h +++ b/source/blender/editors/space_view3d/view3d_intern.h @@ -137,7 +137,7 @@ void ED_view3d_draw_depth_loop(struct Depsgraph *depsgraph, struct ARegion *region, View3D *v3d); -void view3d_update_depths_rect(struct ARegion *region, struct ViewDepths *d, struct rcti *rect); +void view3d_depths_rect_create(struct ARegion *region, struct rcti *rect, struct ViewDepths *r_d); float view3d_depth_near(struct ViewDepths *d); /* view3d_select.c */ diff --git a/source/blender/editors/space_view3d/view3d_iterators.c b/source/blender/editors/space_view3d/view3d_iterators.c index bdb2c3874db..2a381bb96cb 100644 --- a/source/blender/editors/space_view3d/view3d_iterators.c +++ b/source/blender/editors/space_view3d/view3d_iterators.c @@ -50,15 +50,179 @@ #include "ED_screen.h" #include "ED_view3d.h" +/* -------------------------------------------------------------------- */ +/** \name Internal Clipping Utilities + * \{ */ + +/** + * Calculate clipping planes to use when #V3D_PROJ_TEST_CLIP_CONTENT is enabled. + * + * Planes are selected from the viewpoint using `clip_flag` + * to detect which planes should be applied (maximum 6). + * + * \return The number of planes written into `planes`. + */ +static int content_planes_from_clip_flag(const ARegion *region, + const Object *ob, + const eV3DProjTest clip_flag, + float planes[6][4]) +{ + BLI_assert(clip_flag & V3D_PROJ_TEST_CLIP_CONTENT); + + float *clip_xmin = NULL, *clip_xmax = NULL; + float *clip_ymin = NULL, *clip_ymax = NULL; + float *clip_zmin = NULL, *clip_zmax = NULL; + + int planes_len = 0; + + /* The order of `planes` has been selected based on the likelihood of points being fully + * outside the plane to increase the chance of an early exit in #clip_segment_v3_plane_n. + * With "near" being most likely and "far" being unlikely. + * + * Otherwise the order of axes in `planes` isn't significant. */ + + if (clip_flag & V3D_PROJ_TEST_CLIP_NEAR) { + clip_zmin = planes[planes_len++]; + } + if (clip_flag & V3D_PROJ_TEST_CLIP_WIN) { + clip_xmin = planes[planes_len++]; + clip_xmax = planes[planes_len++]; + clip_ymin = planes[planes_len++]; + clip_ymax = planes[planes_len++]; + } + if (clip_flag & V3D_PROJ_TEST_CLIP_FAR) { + clip_zmax = planes[planes_len++]; + } + + BLI_assert(planes_len <= 6); + if (planes_len != 0) { + RegionView3D *rv3d = region->regiondata; + float projmat[4][4]; + ED_view3d_ob_project_mat_get(rv3d, ob, projmat); + planes_from_projmat(projmat, clip_xmin, clip_xmax, clip_ymin, clip_ymax, clip_zmin, clip_zmax); + } + return planes_len; +} + +/** + * Edge projection is more involved since part of the edge may be behind the view + * or extend beyond the far limits. In the case of single points, these can be ignored. + * However it just may still be visible on screen, so constrained the edge to planes + * defined by the port to ensure both ends of the edge can be projected, see T32214. + * + * \note This is unrelated to #V3D_PROJ_TEST_CLIP_BB which must be checked separately. + */ +static bool view3d_project_segment_to_screen_with_content_clip_planes( + const ARegion *region, + const float v_a[3], + const float v_b[3], + const eV3DProjTest clip_flag, + const rctf *win_rect, + const float content_planes[][4], + const int content_planes_len, + /* Output. */ + float r_screen_co_a[2], + float r_screen_co_b[2]) +{ + /* Clipping already handled, no need to check in projection. */ + eV3DProjTest clip_flag_nowin = clip_flag & ~V3D_PROJ_TEST_CLIP_WIN; + + const eV3DProjStatus status_a = ED_view3d_project_float_object( + region, v_a, r_screen_co_a, clip_flag_nowin); + const eV3DProjStatus status_b = ED_view3d_project_float_object( + region, v_b, r_screen_co_b, clip_flag_nowin); + + if ((status_a == V3D_PROJ_RET_OK) && (status_b == V3D_PROJ_RET_OK)) { + if (clip_flag & V3D_PROJ_TEST_CLIP_WIN) { + if (!BLI_rctf_isect_segment(win_rect, r_screen_co_a, r_screen_co_b)) { + return false; + } + } + } + else { + if (content_planes_len == 0) { + return false; + } + + /* Both too near, ignore. */ + if ((status_a & V3D_PROJ_TEST_CLIP_NEAR) && (status_b & V3D_PROJ_TEST_CLIP_NEAR)) { + return false; + } + + /* Both too far, ignore. */ + if ((status_a & V3D_PROJ_TEST_CLIP_FAR) && (status_b & V3D_PROJ_TEST_CLIP_FAR)) { + return false; + } + + /* Simple cases have been ruled out, clip by viewport planes, then re-project. */ + float v_a_clip[3], v_b_clip[3]; + if (!clip_segment_v3_plane_n( + v_a, v_b, content_planes, content_planes_len, v_a_clip, v_b_clip)) { + return false; + } + + if ((ED_view3d_project_float_object(region, v_a_clip, r_screen_co_a, clip_flag_nowin) != + V3D_PROJ_RET_OK) || + (ED_view3d_project_float_object(region, v_b_clip, r_screen_co_b, clip_flag_nowin) != + V3D_PROJ_RET_OK)) { + return false; + } + + /* No need for #V3D_PROJ_TEST_CLIP_WIN check here, + * clipping the segment by planes handle this. */ + } + + return true; +} + +/** + * Project an edge, points that fail to project are tagged with #IS_CLIPPED. + */ +static bool view3d_project_segment_to_screen_with_clip_tag(const ARegion *region, + const float v_a[3], + const float v_b[3], + const eV3DProjTest clip_flag, + /* Output. */ + float r_screen_co_a[2], + float r_screen_co_b[2]) +{ + int count = 0; + + if (ED_view3d_project_float_object(region, v_a, r_screen_co_a, clip_flag) == V3D_PROJ_RET_OK) { + count++; + } + else { + r_screen_co_a[0] = IS_CLIPPED; /* weak */ + /* screen_co_a[1]: intentionally don't set this so we get errors on misuse */ + } + + if (ED_view3d_project_float_object(region, v_b, r_screen_co_b, clip_flag) == V3D_PROJ_RET_OK) { + count++; + } + else { + r_screen_co_b[0] = IS_CLIPPED; /* weak */ + /* screen_co_b[1]: intentionally don't set this so we get errors on misuse */ + } + + /* Caller may want to know this value, for now it's not needed. */ + return count != 0; +} + +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Private User Data Structures + * \{ */ + typedef struct foreachScreenObjectVert_userData { - void (*func)(void *userData, MVert *mv, const float screen_co_b[2], int index); + void (*func)(void *userData, MVert *mv, const float screen_co[2], int index); void *userData; ViewContext vc; eV3DProjTest clip_flag; } foreachScreenObjectVert_userData; typedef struct foreachScreenVert_userData { - void (*func)(void *userData, BMVert *eve, const float screen_co_b[2], int index); + void (*func)(void *userData, BMVert *eve, const float screen_co[2], int index); void *userData; ViewContext vc; eV3DProjTest clip_flag; @@ -73,8 +237,16 @@ typedef struct foreachScreenEdge_userData { int index); void *userData; ViewContext vc; - rctf win_rect; /* copy of: vc.region->winx/winy, use for faster tests, minx/y will always be 0 */ eV3DProjTest clip_flag; + + rctf win_rect; /* copy of: vc.region->winx/winy, use for faster tests, minx/y will always be 0 */ + + /** + * Clip plans defined by the the view bounds, + * use when #V3D_PROJ_TEST_CLIP_CONTENT is enabled. + */ + float content_planes[6][4]; + int content_planes_len; } foreachScreenEdge_userData; typedef struct foreachScreenFace_userData { @@ -91,7 +263,11 @@ typedef struct foreachScreenFace_userData { * use the object matrix in the usual way. */ -/* ------------------------------------------------------------------------ */ +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Edit-Mesh: For Each Screen Vertex + * \{ */ static void meshobject_foreachScreenVert__mapFunc(void *userData, int index, @@ -120,6 +296,7 @@ void meshobject_foreachScreenVert( void *userData, eV3DProjTest clip_flag) { + BLI_assert((clip_flag & V3D_PROJ_TEST_CLIP_CONTENT) == 0); foreachScreenObjectVert_userData data; Mesh *me; @@ -150,17 +327,17 @@ static void mesh_foreachScreenVert__mapFunc(void *userData, { foreachScreenVert_userData *data = userData; BMVert *eve = BM_vert_at_index(data->vc.em->bm, index); + if (UNLIKELY(BM_elem_flag_test(eve, BM_ELEM_HIDDEN))) { + return; + } - if (!BM_elem_flag_test(eve, BM_ELEM_HIDDEN)) { - float screen_co[2]; - - if (ED_view3d_project_float_object(data->vc.region, co, screen_co, data->clip_flag) != - V3D_PROJ_RET_OK) { - return; - } - - data->func(data->userData, eve, screen_co, index); + float screen_co[2]; + if (ED_view3d_project_float_object(data->vc.region, co, screen_co, data->clip_flag) != + V3D_PROJ_RET_OK) { + return; } + + data->func(data->userData, eve, screen_co, index); } void mesh_foreachScreenVert( @@ -189,38 +366,37 @@ void mesh_foreachScreenVert( BKE_mesh_foreach_mapped_vert(me, mesh_foreachScreenVert__mapFunc, &data, MESH_FOREACH_NOP); } -/* ------------------------------------------------------------------------ */ +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Edit-Mesh: For Each Screen Mesh Edge + * \{ */ static void mesh_foreachScreenEdge__mapFunc(void *userData, int index, - const float v0co[3], - const float v1co[3]) + const float v_a[3], + const float v_b[3]) { foreachScreenEdge_userData *data = userData; BMEdge *eed = BM_edge_at_index(data->vc.em->bm, index); + if (UNLIKELY(BM_elem_flag_test(eed, BM_ELEM_HIDDEN))) { + return; + } - if (!BM_elem_flag_test(eed, BM_ELEM_HIDDEN)) { - float screen_co_a[2]; - float screen_co_b[2]; - eV3DProjTest clip_flag_nowin = data->clip_flag & ~V3D_PROJ_TEST_CLIP_WIN; - - if (ED_view3d_project_float_object(data->vc.region, v0co, screen_co_a, clip_flag_nowin) != - V3D_PROJ_RET_OK) { - return; - } - if (ED_view3d_project_float_object(data->vc.region, v1co, screen_co_b, clip_flag_nowin) != - V3D_PROJ_RET_OK) { - return; - } - - if (data->clip_flag & V3D_PROJ_TEST_CLIP_WIN) { - if (!BLI_rctf_isect_segment(&data->win_rect, screen_co_a, screen_co_b)) { - return; - } - } - - data->func(data->userData, eed, screen_co_a, screen_co_b, index); + float screen_co_a[2], screen_co_b[2]; + if (!view3d_project_segment_to_screen_with_content_clip_planes(data->vc.region, + v_a, + v_b, + data->clip_flag, + &data->win_rect, + data->content_planes, + data->content_planes_len, + screen_co_a, + screen_co_b)) { + return; } + + data->func(data->userData, eed, screen_co_a, screen_co_b, index); } void mesh_foreachScreenEdge(ViewContext *vc, @@ -254,11 +430,23 @@ void mesh_foreachScreenEdge(ViewContext *vc, ED_view3d_clipping_local(vc->rv3d, vc->obedit->obmat); /* for local clipping lookups */ } + if (clip_flag & V3D_PROJ_TEST_CLIP_CONTENT) { + data.content_planes_len = content_planes_from_clip_flag( + vc->region, vc->obedit, clip_flag, data.content_planes); + } + else { + data.content_planes_len = 0; + } + BM_mesh_elem_table_ensure(vc->em->bm, BM_EDGE); BKE_mesh_foreach_mapped_edge(me, mesh_foreachScreenEdge__mapFunc, &data); } -/* ------------------------------------------------------------------------ */ +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Edit-Mesh: For Each Screen Edge (Bounding Box Clipped) + * \{ */ /** * Only call for bound-box clipping. @@ -266,46 +454,36 @@ void mesh_foreachScreenEdge(ViewContext *vc, */ static void mesh_foreachScreenEdge_clip_bb_segment__mapFunc(void *userData, int index, - const float v0co[3], - const float v1co[3]) + const float v_a[3], + const float v_b[3]) { foreachScreenEdge_userData *data = userData; BMEdge *eed = BM_edge_at_index(data->vc.em->bm, index); + if (UNLIKELY(BM_elem_flag_test(eed, BM_ELEM_HIDDEN))) { + return; + } BLI_assert(data->clip_flag & V3D_PROJ_TEST_CLIP_BB); - if (!BM_elem_flag_test(eed, BM_ELEM_HIDDEN)) { - float v0co_clip[3]; - float v1co_clip[3]; - - if (!clip_segment_v3_plane_n(v0co, v1co, data->vc.rv3d->clip_local, 4, v0co_clip, v1co_clip)) { - return; - } - - float screen_co_a[2]; - float screen_co_b[2]; - - /* Clipping already handled, no need to check in projection. */ - eV3DProjTest clip_flag_nowin = data->clip_flag & - ~(V3D_PROJ_TEST_CLIP_WIN | V3D_PROJ_TEST_CLIP_BB); - - if (ED_view3d_project_float_object(data->vc.region, v0co_clip, screen_co_a, clip_flag_nowin) != - V3D_PROJ_RET_OK) { - return; - } - if (ED_view3d_project_float_object(data->vc.region, v1co_clip, screen_co_b, clip_flag_nowin) != - V3D_PROJ_RET_OK) { - return; - } - - if (data->clip_flag & V3D_PROJ_TEST_CLIP_WIN) { - if (!BLI_rctf_isect_segment(&data->win_rect, screen_co_a, screen_co_b)) { - return; - } - } + float v_a_clip[3], v_b_clip[3]; + if (!clip_segment_v3_plane_n(v_a, v_b, data->vc.rv3d->clip_local, 4, v_a_clip, v_b_clip)) { + return; + } - data->func(data->userData, eed, screen_co_a, screen_co_b, index); + float screen_co_a[2], screen_co_b[2]; + if (!view3d_project_segment_to_screen_with_content_clip_planes(data->vc.region, + v_a_clip, + v_b_clip, + data->clip_flag, + &data->win_rect, + data->content_planes, + data->content_planes_len, + screen_co_a, + screen_co_b)) { + return; } + + data->func(data->userData, eed, screen_co_a, screen_co_b, index); } /** @@ -339,6 +517,14 @@ void mesh_foreachScreenEdge_clip_bb_segment(ViewContext *vc, data.userData = userData; data.clip_flag = clip_flag; + if (clip_flag & V3D_PROJ_TEST_CLIP_CONTENT) { + data.content_planes_len = content_planes_from_clip_flag( + vc->region, vc->obedit, clip_flag, data.content_planes); + } + else { + data.content_planes_len = 0; + } + BM_mesh_elem_table_ensure(vc->em->bm, BM_EDGE); if ((clip_flag & V3D_PROJ_TEST_CLIP_BB) && (vc->rv3d->clipbb != NULL)) { @@ -350,7 +536,11 @@ void mesh_foreachScreenEdge_clip_bb_segment(ViewContext *vc, } } -/* ------------------------------------------------------------------------ */ +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Edit-Mesh: For Each Screen Face Center + * \{ */ static void mesh_foreachScreenFace__mapFunc(void *userData, int index, @@ -359,14 +549,17 @@ static void mesh_foreachScreenFace__mapFunc(void *userData, { foreachScreenFace_userData *data = userData; BMFace *efa = BM_face_at_index(data->vc.em->bm, index); + if (UNLIKELY(BM_elem_flag_test(efa, BM_ELEM_HIDDEN))) { + return; + } - if (!BM_elem_flag_test(efa, BM_ELEM_HIDDEN)) { - float screen_co[2]; - if (ED_view3d_project_float_object(data->vc.region, cent, screen_co, data->clip_flag) == - V3D_PROJ_RET_OK) { - data->func(data->userData, efa, screen_co, index); - } + float screen_co[2]; + if (ED_view3d_project_float_object(data->vc.region, cent, screen_co, data->clip_flag) != + V3D_PROJ_RET_OK) { + return; } + + data->func(data->userData, efa, screen_co, index); } void mesh_foreachScreenFace( @@ -375,6 +568,7 @@ void mesh_foreachScreenFace( void *userData, const eV3DProjTest clip_flag) { + BLI_assert((clip_flag & V3D_PROJ_TEST_CLIP_CONTENT) == 0); foreachScreenFace_userData data; Mesh *me = editbmesh_get_eval_cage_from_orig( @@ -398,7 +592,11 @@ void mesh_foreachScreenFace( } } -/* ------------------------------------------------------------------------ */ +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Edit-Nurbs: For Each Screen Vertex + * \{ */ void nurbs_foreachScreenVert(ViewContext *vc, void (*func)(void *userData, @@ -486,7 +684,11 @@ void nurbs_foreachScreenVert(ViewContext *vc, } } -/* ------------------------------------------------------------------------ */ +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Edit-Meta: For Each Screen Meta-Element + * \{ */ /* ED_view3d_init_mats_rv3d must be called first */ void mball_foreachScreenElem(struct ViewContext *vc, @@ -510,7 +712,11 @@ void mball_foreachScreenElem(struct ViewContext *vc, } } -/* ------------------------------------------------------------------------ */ +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Edit-Lattice: For Each Screen Vertex + * \{ */ void lattice_foreachScreenVert(ViewContext *vc, void (*func)(void *userData, BPoint *bp, const float screen_co[2]), @@ -543,7 +749,11 @@ void lattice_foreachScreenVert(ViewContext *vc, } } -/* ------------------------------------------------------------------------ */ +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Edit-Armature: For Each Screen Bone + * \{ */ /* ED_view3d_init_mats_rv3d must be called first */ void armature_foreachScreenBone(struct ViewContext *vc, @@ -559,39 +769,59 @@ void armature_foreachScreenBone(struct ViewContext *vc, ED_view3d_check_mats_rv3d(vc->rv3d); - for (ebone = arm->edbo->first; ebone; ebone = ebone->next) { - if (EBONE_VISIBLE(arm, ebone)) { - float screen_co_a[2], screen_co_b[2]; - int points_proj_tot = 0; + float content_planes[6][4]; + int content_planes_len; + rctf win_rect; + + if (clip_flag & V3D_PROJ_TEST_CLIP_CONTENT) { + content_planes_len = content_planes_from_clip_flag( + vc->region, vc->obedit, clip_flag, content_planes); + win_rect.xmin = 0; + win_rect.ymin = 0; + win_rect.xmax = vc->region->winx; + win_rect.ymax = vc->region->winy; + } + else { + content_planes_len = 0; + } - /* project head location to screenspace */ - if (ED_view3d_project_float_object(vc->region, ebone->head, screen_co_a, clip_flag) == - V3D_PROJ_RET_OK) { - points_proj_tot++; - } - else { - screen_co_a[0] = IS_CLIPPED; /* weak */ - /* screen_co_a[1]: intentionally don't set this so we get errors on misuse */ - } + for (ebone = arm->edbo->first; ebone; ebone = ebone->next) { + if (!EBONE_VISIBLE(arm, ebone)) { + continue; + } - /* project tail location to screenspace */ - if (ED_view3d_project_float_object(vc->region, ebone->tail, screen_co_b, clip_flag) == - V3D_PROJ_RET_OK) { - points_proj_tot++; - } - else { - screen_co_b[0] = IS_CLIPPED; /* weak */ - /* screen_co_b[1]: intentionally don't set this so we get errors on misuse */ + float screen_co_a[2], screen_co_b[2]; + const float *v_a = ebone->head, *v_b = ebone->tail; + + if (clip_flag & V3D_PROJ_TEST_CLIP_CONTENT) { + if (!view3d_project_segment_to_screen_with_content_clip_planes(vc->region, + v_a, + v_b, + clip_flag, + &win_rect, + content_planes, + content_planes_len, + screen_co_a, + screen_co_b)) { + continue; } - - if (points_proj_tot) { /* at least one point's projection worked */ - func(userData, ebone, screen_co_a, screen_co_b); + } + else { + if (!view3d_project_segment_to_screen_with_clip_tag( + vc->region, v_a, v_b, clip_flag, screen_co_a, screen_co_b)) { + continue; } } + + func(userData, ebone, screen_co_a, screen_co_b); } } -/* ------------------------------------------------------------------------ */ +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Pose: For Each Screen Bone + * \{ */ /* ED_view3d_init_mats_rv3d must be called first */ /* almost _exact_ copy of #armature_foreachScreenBone */ @@ -610,35 +840,53 @@ void pose_foreachScreenBone(struct ViewContext *vc, ED_view3d_check_mats_rv3d(vc->rv3d); + float content_planes[6][4]; + int content_planes_len; + rctf win_rect; + + if (clip_flag & V3D_PROJ_TEST_CLIP_CONTENT) { + content_planes_len = content_planes_from_clip_flag( + vc->region, ob_eval, clip_flag, content_planes); + win_rect.xmin = 0; + win_rect.ymin = 0; + win_rect.xmax = vc->region->winx; + win_rect.ymax = vc->region->winy; + } + else { + content_planes_len = 0; + } + for (pchan = pose->chanbase.first; pchan; pchan = pchan->next) { - if (PBONE_VISIBLE(arm_eval, pchan->bone)) { - bPoseChannel *pchan_eval = BKE_pose_channel_find_name(ob_eval->pose, pchan->name); - float screen_co_a[2], screen_co_b[2]; - int points_proj_tot = 0; - - /* project head location to screenspace */ - if (ED_view3d_project_float_object( - vc->region, pchan_eval->pose_head, screen_co_a, clip_flag) == V3D_PROJ_RET_OK) { - points_proj_tot++; - } - else { - screen_co_a[0] = IS_CLIPPED; /* weak */ - /* screen_co_a[1]: intentionally don't set this so we get errors on misuse */ - } + if (!PBONE_VISIBLE(arm_eval, pchan->bone)) { + continue; + } - /* project tail location to screenspace */ - if (ED_view3d_project_float_object( - vc->region, pchan_eval->pose_tail, screen_co_b, clip_flag) == V3D_PROJ_RET_OK) { - points_proj_tot++; + bPoseChannel *pchan_eval = BKE_pose_channel_find_name(ob_eval->pose, pchan->name); + float screen_co_a[2], screen_co_b[2]; + const float *v_a = pchan_eval->pose_head, *v_b = pchan_eval->pose_tail; + + if (clip_flag & V3D_PROJ_TEST_CLIP_CONTENT) { + if (!view3d_project_segment_to_screen_with_content_clip_planes(vc->region, + v_a, + v_b, + clip_flag, + &win_rect, + content_planes, + content_planes_len, + screen_co_a, + screen_co_b)) { + continue; } - else { - screen_co_b[0] = IS_CLIPPED; /* weak */ - /* screen_co_b[1]: intentionally don't set this so we get errors on misuse */ - } - - if (points_proj_tot) { /* at least one point's projection worked */ - func(userData, pchan, screen_co_a, screen_co_b); + } + else { + if (!view3d_project_segment_to_screen_with_clip_tag( + vc->region, v_a, v_b, clip_flag, screen_co_a, screen_co_b)) { + continue; } } + + func(userData, pchan, screen_co_a, screen_co_b); } } + +/** \} */ diff --git a/source/blender/editors/space_view3d/view3d_placement.c b/source/blender/editors/space_view3d/view3d_placement.c index e602521f6a2..2186cdb3162 100644 --- a/source/blender/editors/space_view3d/view3d_placement.c +++ b/source/blender/editors/space_view3d/view3d_placement.c @@ -584,7 +584,7 @@ static bool calc_bbox(struct InteractivePlaceData *ipd, BoundBox *bounds) delta_a[x_axis] = 0.0f; delta_b[y_axis] = 0.0f; - /* Assign here in case secondary */ + /* Assign here in case secondary. */ fixed_aspect_dimension = max_ff(fabsf(delta_a[y_axis]), fabsf(delta_b[x_axis])); if (ipd->step[0].is_fixed_aspect) { @@ -961,7 +961,7 @@ static void view3d_interactive_add_calc_plane(bContext *C, const float view_axis_dot = fabsf(dot_v3v3(rv3d->viewinv[2], r_matrix_orient[plane_axis])); if (view_axis_dot < eps_view_align) { /* In this case, just project onto the view plane as it's important the location - * is _always_ under the mouse cursor, even if it turns out that wont lie on + * is _always_ under the mouse cursor, even if it turns out that won't lie on * the original 'plane' that's been calculated for us. */ plane_normal = rv3d->viewinv[2]; } @@ -974,7 +974,7 @@ static void view3d_interactive_add_calc_plane(bContext *C, /* Even if the calculation works, it's possible the point found is behind the view, * or very far away (past the far clipping). - * In either case creating objects wont be useful. */ + * In either case creating objects won't be useful. */ if (rv3d->is_persp) { float dir[3]; sub_v3_v3v3(dir, rv3d->viewinv[3], r_co_src); @@ -1196,7 +1196,7 @@ static void view3d_interactive_add_begin(bContext *C, wmOperator *op, const wmEv } else { /* If the user runs this as an operator they should set the 'primitive_type', - * however running from operator search will end up at this point. */ + * however running from operator search will end up at this point. */ ipd->primitive_type = PLACE_PRIMITIVE_TYPE_CUBE; ipd->use_tool = false; } @@ -1830,7 +1830,7 @@ static void gizmo_plane_update_cursor(const bContext *C, /* This ensures the snap gizmo has settings from this tool. * This function call could be moved a more appropriate place, * responding to the setting being changed for example, - * however setting the value isn't expensive, so do it here. */ + * however setting the value isn't expensive, so do it here. */ idp_snap_gizmo_update_snap_elements(scene, snap_to, snap_gizmo); view3d_interactive_add_calc_plane((bContext *)C, diff --git a/source/blender/editors/space_view3d/view3d_project.c b/source/blender/editors/space_view3d/view3d_project.c index 7547f8ee434..49da1764660 100644 --- a/source/blender/editors/space_view3d/view3d_project.c +++ b/source/blender/editors/space_view3d/view3d_project.c @@ -788,7 +788,7 @@ bool ED_view3d_win_to_segment_clipped(struct Depsgraph *depsgraph, /** \name Utility functions for projection * \{ */ -void ED_view3d_ob_project_mat_get(const RegionView3D *rv3d, Object *ob, float r_pmat[4][4]) +void ED_view3d_ob_project_mat_get(const RegionView3D *rv3d, const Object *ob, float r_pmat[4][4]) { float vmat[4][4]; diff --git a/source/blender/editors/space_view3d/view3d_select.c b/source/blender/editors/space_view3d/view3d_select.c index 6a7ee46f719..0e5df3a0cdd 100644 --- a/source/blender/editors/space_view3d/view3d_select.c +++ b/source/blender/editors/space_view3d/view3d_select.c @@ -520,42 +520,16 @@ static void do_lasso_select_pose__do_tag(void *userData, const float screen_co_b[2]) { LassoSelectUserData *data = userData; - bArmature *arm = data->vc->obact->data; - - if (PBONE_SELECTABLE(arm, pchan->bone)) { - bool is_point_done = false; - int points_proj_tot = 0; - - /* project head location to screenspace */ - if (screen_co_a[0] != IS_CLIPPED) { - points_proj_tot++; - if (BLI_rcti_isect_pt(data->rect, UNPACK2(screen_co_a)) && - BLI_lasso_is_point_inside( - data->mcoords, data->mcoords_len, UNPACK2(screen_co_a), INT_MAX)) { - is_point_done = true; - } - } - - /* project tail location to screenspace */ - if (screen_co_b[0] != IS_CLIPPED) { - points_proj_tot++; - if (BLI_rcti_isect_pt(data->rect, UNPACK2(screen_co_b)) && - BLI_lasso_is_point_inside( - data->mcoords, data->mcoords_len, UNPACK2(screen_co_b), INT_MAX)) { - is_point_done = true; - } - } + const bArmature *arm = data->vc->obact->data; + if (!PBONE_SELECTABLE(arm, pchan->bone)) { + return; + } - /* if one of points selected, we skip the bone itself */ - if ((is_point_done == true) || ((is_point_done == false) && (points_proj_tot == 2) && - BLI_lasso_is_edge_inside(data->mcoords, - data->mcoords_len, - UNPACK2(screen_co_a), - UNPACK2(screen_co_b), - INT_MAX))) { - pchan->bone->flag |= BONE_DONE; - } - data->is_changed |= is_point_done; + if (BLI_rctf_isect_segment(data->rect_fl, screen_co_a, screen_co_b) && + BLI_lasso_is_edge_inside( + data->mcoords, data->mcoords_len, UNPACK2(screen_co_a), UNPACK2(screen_co_b), INT_MAX)) { + pchan->bone->flag |= BONE_DONE; + data->is_changed = true; } } static void do_lasso_tag_pose(ViewContext *vc, @@ -580,7 +554,11 @@ static void do_lasso_tag_pose(ViewContext *vc, ED_view3d_init_mats_rv3d(vc_tmp.obact, vc->rv3d); - pose_foreachScreenBone(&vc_tmp, do_lasso_select_pose__do_tag, &data, V3D_PROJ_TEST_CLIP_DEFAULT); + /* Treat bones as clipped segments (no joints). */ + pose_foreachScreenBone(&vc_tmp, + do_lasso_select_pose__do_tag, + &data, + V3D_PROJ_TEST_CLIP_DEFAULT | V3D_PROJ_TEST_CLIP_CONTENT_DEFAULT); } static bool do_lasso_select_objects(ViewContext *vc, @@ -876,11 +854,16 @@ static bool do_lasso_select_mesh(ViewContext *vc, const eV3DProjTest clip_flag = V3D_PROJ_TEST_CLIP_NEAR | (use_zbuf ? 0 : V3D_PROJ_TEST_CLIP_BB); + /* Fully inside. */ mesh_foreachScreenEdge_clip_bb_segment( vc, do_lasso_select_mesh__doSelectEdge_pass0, &data_for_edge, clip_flag); if (data.is_done == false) { - mesh_foreachScreenEdge_clip_bb_segment( - vc, do_lasso_select_mesh__doSelectEdge_pass1, &data_for_edge, clip_flag); + /* Fall back to partially inside. + * Clip content to account for edges partially behind the view. */ + mesh_foreachScreenEdge_clip_bb_segment(vc, + do_lasso_select_mesh__doSelectEdge_pass1, + &data_for_edge, + clip_flag | V3D_PROJ_TEST_CLIP_CONTENT_DEFAULT); } } @@ -1022,46 +1005,76 @@ static void do_lasso_select_armature__doSelectBone(void *userData, const float screen_co_b[2]) { LassoSelectUserData *data = userData; - bArmature *arm = data->vc->obedit->data; - if (EBONE_VISIBLE(arm, ebone)) { - int is_ignore_flag = 0; - int is_inside_flag = 0; - - if (screen_co_a[0] != IS_CLIPPED) { - if (BLI_rcti_isect_pt(data->rect, UNPACK2(screen_co_a)) && - BLI_lasso_is_point_inside( - data->mcoords, data->mcoords_len, UNPACK2(screen_co_a), INT_MAX)) { - is_inside_flag |= BONESEL_ROOT; - } - } - else { - is_ignore_flag |= BONESEL_ROOT; - } + const bArmature *arm = data->vc->obedit->data; + if (!EBONE_VISIBLE(arm, ebone)) { + return; + } - if (screen_co_b[0] != IS_CLIPPED) { - if (BLI_rcti_isect_pt(data->rect, UNPACK2(screen_co_b)) && - BLI_lasso_is_point_inside( - data->mcoords, data->mcoords_len, UNPACK2(screen_co_b), INT_MAX)) { - is_inside_flag |= BONESEL_TIP; - } + int is_ignore_flag = 0; + int is_inside_flag = 0; + + if (screen_co_a[0] != IS_CLIPPED) { + if (BLI_rcti_isect_pt(data->rect, UNPACK2(screen_co_a)) && + BLI_lasso_is_point_inside( + data->mcoords, data->mcoords_len, UNPACK2(screen_co_a), INT_MAX)) { + is_inside_flag |= BONESEL_ROOT; } - else { - is_ignore_flag |= BONESEL_TIP; + } + else { + is_ignore_flag |= BONESEL_ROOT; + } + + if (screen_co_b[0] != IS_CLIPPED) { + if (BLI_rcti_isect_pt(data->rect, UNPACK2(screen_co_b)) && + BLI_lasso_is_point_inside( + data->mcoords, data->mcoords_len, UNPACK2(screen_co_b), INT_MAX)) { + is_inside_flag |= BONESEL_TIP; } + } + else { + is_ignore_flag |= BONESEL_TIP; + } - if (is_ignore_flag == 0) { - if (is_inside_flag == (BONE_ROOTSEL | BONE_TIPSEL) || - BLI_lasso_is_edge_inside(data->mcoords, - data->mcoords_len, - UNPACK2(screen_co_a), - UNPACK2(screen_co_b), - INT_MAX)) { - is_inside_flag |= BONESEL_BONE; - } + if (is_ignore_flag == 0) { + if (is_inside_flag == (BONE_ROOTSEL | BONE_TIPSEL) || + BLI_lasso_is_edge_inside(data->mcoords, + data->mcoords_len, + UNPACK2(screen_co_a), + UNPACK2(screen_co_b), + INT_MAX)) { + is_inside_flag |= BONESEL_BONE; } + } + + ebone->temp.i = is_inside_flag | (is_ignore_flag >> 16); +} +static void do_lasso_select_armature__doSelectBone_clip_content(void *userData, + EditBone *ebone, + const float screen_co_a[2], + const float screen_co_b[2]) +{ + LassoSelectUserData *data = userData; + bArmature *arm = data->vc->obedit->data; + if (!EBONE_VISIBLE(arm, ebone)) { + return; + } + + const int is_ignore_flag = ebone->temp.i << 16; + int is_inside_flag = ebone->temp.i & ~0xFFFF; - ebone->temp.i = is_inside_flag | (is_ignore_flag >> 16); + /* - When #BONESEL_BONE is set, there is nothing to do. + * - When #BONE_ROOTSEL or #BONE_TIPSEL have been set - they take priority over bone selection. + */ + if (is_inside_flag & (BONESEL_BONE | BONE_ROOTSEL | BONE_TIPSEL)) { + return; + } + + if (BLI_lasso_is_edge_inside( + data->mcoords, data->mcoords_len, UNPACK2(screen_co_a), UNPACK2(screen_co_b), INT_MAX)) { + is_inside_flag |= BONESEL_BONE; } + + ebone->temp.i = is_inside_flag | (is_ignore_flag >> 16); } static bool do_lasso_select_armature(ViewContext *vc, @@ -1086,9 +1099,18 @@ static bool do_lasso_select_armature(ViewContext *vc, ED_view3d_init_mats_rv3d(vc->obedit, vc->rv3d); + /* Operate on fully visible (non-clipped) points. */ armature_foreachScreenBone( vc, do_lasso_select_armature__doSelectBone, &data, V3D_PROJ_TEST_CLIP_DEFAULT); + /* Operate on bones as segments clipped to the viewport bounds + * (needed to handle bones with both points outside the view). + * A separate pass is needed since clipped coordinates can't be used for selecting joints. */ + armature_foreachScreenBone(vc, + do_lasso_select_armature__doSelectBone_clip_content, + &data, + V3D_PROJ_TEST_CLIP_DEFAULT | V3D_PROJ_TEST_CLIP_CONTENT_DEFAULT); + data.is_changed |= ED_armature_edit_select_op_from_tagged(vc->obedit->data, sel_op); if (data.is_changed) { @@ -1811,7 +1833,7 @@ static bool bone_mouse_select_menu(bContext *C, continue; } /* We can hit a bone multiple times, so make sure we are not adding an already included bone - * to the list.*/ + * to the list. */ const bool is_duplicate_bone = BLI_gset_haskey(added_bones, bone_ptr); if (!is_duplicate_bone) { @@ -3071,6 +3093,9 @@ struct BoxSelectUserData_ForMeshEdge { struct EditSelectBuf_Cache *esel; uint backbuf_offset; }; +/** + * Pass 0 operates on edges when fully inside. + */ static void do_mesh_box_select__doSelectEdge_pass0( void *userData, BMEdge *eed, const float screen_co_a[2], const float screen_co_b[2], int index) { @@ -3092,6 +3117,9 @@ static void do_mesh_box_select__doSelectEdge_pass0( data->is_changed = true; } } +/** + * Pass 1 operates on edges when partially inside. + */ static void do_mesh_box_select__doSelectEdge_pass1( void *userData, BMEdge *eed, const float screen_co_a[2], const float screen_co_b[2], int index) { @@ -3181,11 +3209,16 @@ static bool do_mesh_box_select(ViewContext *vc, const eV3DProjTest clip_flag = V3D_PROJ_TEST_CLIP_NEAR | (use_zbuf ? 0 : V3D_PROJ_TEST_CLIP_BB); + /* Fully inside. */ mesh_foreachScreenEdge_clip_bb_segment( vc, do_mesh_box_select__doSelectEdge_pass0, &cb_data, clip_flag); if (data.is_done == false) { - mesh_foreachScreenEdge_clip_bb_segment( - vc, do_mesh_box_select__doSelectEdge_pass1, &cb_data, clip_flag); + /* Fall back to partially inside. + * Clip content to account for edges partially behind the view. */ + mesh_foreachScreenEdge_clip_bb_segment(vc, + do_mesh_box_select__doSelectEdge_pass1, + &cb_data, + clip_flag | V3D_PROJ_TEST_CLIP_CONTENT_DEFAULT); } } @@ -3774,7 +3807,10 @@ static bool mesh_circle_select(ViewContext *vc, } else { mesh_foreachScreenEdge_clip_bb_segment( - vc, mesh_circle_doSelectEdge, &data, V3D_PROJ_TEST_CLIP_NEAR | V3D_PROJ_TEST_CLIP_BB); + vc, + mesh_circle_doSelectEdge, + &data, + (V3D_PROJ_TEST_CLIP_NEAR | V3D_PROJ_TEST_CLIP_BB | V3D_PROJ_TEST_CLIP_CONTENT_DEFAULT)); } } @@ -4020,47 +4056,48 @@ static void do_circle_select_pose__doSelectBone(void *userData, { CircleSelectUserData *data = userData; bArmature *arm = data->vc->obact->data; + if (!PBONE_SELECTABLE(arm, pchan->bone)) { + return; + } - if (PBONE_SELECTABLE(arm, pchan->bone)) { - bool is_point_done = false; - int points_proj_tot = 0; + bool is_point_done = false; + int points_proj_tot = 0; - /* project head location to screenspace */ - if (screen_co_a[0] != IS_CLIPPED) { - points_proj_tot++; - if (pchan_circle_doSelectJoint(data, pchan, screen_co_a)) { - is_point_done = true; - } + /* project head location to screenspace */ + if (screen_co_a[0] != IS_CLIPPED) { + points_proj_tot++; + if (pchan_circle_doSelectJoint(data, pchan, screen_co_a)) { + is_point_done = true; } + } - /* project tail location to screenspace */ - if (screen_co_b[0] != IS_CLIPPED) { - points_proj_tot++; - if (pchan_circle_doSelectJoint(data, pchan, screen_co_b)) { - is_point_done = true; - } + /* project tail location to screenspace */ + if (screen_co_b[0] != IS_CLIPPED) { + points_proj_tot++; + if (pchan_circle_doSelectJoint(data, pchan, screen_co_b)) { + is_point_done = true; } + } - /* check if the head and/or tail is in the circle - * - the call to check also does the selection already - */ + /* check if the head and/or tail is in the circle + * - the call to check also does the selection already + */ - /* only if the endpoints didn't get selected, deal with the middle of the bone too - * It works nicer to only do this if the head or tail are not in the circle, - * otherwise there is no way to circle select joints alone */ - if ((is_point_done == false) && (points_proj_tot == 2) && - edge_inside_circle(data->mval_fl, data->radius, screen_co_a, screen_co_b)) { - if (data->select) { - pchan->bone->flag |= BONE_SELECTED; - } - else { - pchan->bone->flag &= ~BONE_SELECTED; - } - data->is_changed = true; + /* only if the endpoints didn't get selected, deal with the middle of the bone too + * It works nicer to only do this if the head or tail are not in the circle, + * otherwise there is no way to circle select joints alone */ + if ((is_point_done == false) && (points_proj_tot == 2) && + edge_inside_circle(data->mval_fl, data->radius, screen_co_a, screen_co_b)) { + if (data->select) { + pchan->bone->flag |= BONE_SELECTED; } - - data->is_changed |= is_point_done; + else { + pchan->bone->flag &= ~BONE_SELECTED; + } + data->is_changed = true; } + + data->is_changed |= is_point_done; } static bool pose_circle_select(ViewContext *vc, const eSelectOp sel_op, @@ -4079,8 +4116,11 @@ static bool pose_circle_select(ViewContext *vc, ED_view3d_init_mats_rv3d(vc->obact, vc->rv3d); /* for foreach's screen/vert projection */ - pose_foreachScreenBone( - vc, do_circle_select_pose__doSelectBone, &data, V3D_PROJ_TEST_CLIP_DEFAULT); + /* Treat bones as clipped segments (no joints). */ + pose_foreachScreenBone(vc, + do_circle_select_pose__doSelectBone, + &data, + V3D_PROJ_TEST_CLIP_DEFAULT | V3D_PROJ_TEST_CLIP_CONTENT_DEFAULT); if (data.is_changed) { ED_pose_bone_select_tag_update(vc->obact); @@ -4122,47 +4162,74 @@ static void do_circle_select_armature__doSelectBone(void *userData, const float screen_co_b[2]) { CircleSelectUserData *data = userData; - bArmature *arm = data->vc->obedit->data; + const bArmature *arm = data->vc->obedit->data; + if (!(data->select ? EBONE_SELECTABLE(arm, ebone) : EBONE_VISIBLE(arm, ebone))) { + return; + } - if (data->select ? EBONE_SELECTABLE(arm, ebone) : EBONE_VISIBLE(arm, ebone)) { - bool is_point_done = false; - int points_proj_tot = 0; + /* When true, ignore in the next pass. */ + ebone->temp.i = false; - /* project head location to screenspace */ - if (screen_co_a[0] != IS_CLIPPED) { - points_proj_tot++; - if (armature_circle_doSelectJoint(data, ebone, screen_co_a, true)) { - is_point_done = true; - } + bool is_point_done = false; + bool is_edge_done = false; + int points_proj_tot = 0; + + /* project head location to screenspace */ + if (screen_co_a[0] != IS_CLIPPED) { + points_proj_tot++; + if (armature_circle_doSelectJoint(data, ebone, screen_co_a, true)) { + is_point_done = true; } + } - /* project tail location to screenspace */ - if (screen_co_b[0] != IS_CLIPPED) { - points_proj_tot++; - if (armature_circle_doSelectJoint(data, ebone, screen_co_b, false)) { - is_point_done = true; - } + /* project tail location to screenspace */ + if (screen_co_b[0] != IS_CLIPPED) { + points_proj_tot++; + if (armature_circle_doSelectJoint(data, ebone, screen_co_b, false)) { + is_point_done = true; } + } - /* check if the head and/or tail is in the circle - * - the call to check also does the selection already - */ + /* check if the head and/or tail is in the circle + * - the call to check also does the selection already + */ - /* only if the endpoints didn't get selected, deal with the middle of the bone too - * It works nicer to only do this if the head or tail are not in the circle, - * otherwise there is no way to circle select joints alone */ - if ((is_point_done == false) && (points_proj_tot == 2) && - edge_inside_circle(data->mval_fl, data->radius, screen_co_a, screen_co_b)) { - if (data->select) { - ebone->flag |= (BONE_SELECTED | BONE_TIPSEL | BONE_ROOTSEL); - } - else { - ebone->flag &= ~(BONE_SELECTED | BONE_TIPSEL | BONE_ROOTSEL); - } - data->is_changed = true; - } + /* only if the endpoints didn't get selected, deal with the middle of the bone too + * It works nicer to only do this if the head or tail are not in the circle, + * otherwise there is no way to circle select joints alone */ + if ((is_point_done == false) && (points_proj_tot == 2) && + edge_inside_circle(data->mval_fl, data->radius, screen_co_a, screen_co_b)) { + SET_FLAG_FROM_TEST(ebone->flag, data->select, BONE_SELECTED | BONE_TIPSEL | BONE_ROOTSEL); + is_edge_done = true; + data->is_changed = true; + } - data->is_changed |= is_point_done; + if (is_point_done || is_edge_done) { + ebone->temp.i = true; + } + + data->is_changed |= is_point_done; +} +static void do_circle_select_armature__doSelectBone_clip_content(void *userData, + struct EditBone *ebone, + const float screen_co_a[2], + const float screen_co_b[2]) +{ + CircleSelectUserData *data = userData; + bArmature *arm = data->vc->obedit->data; + + if (!(data->select ? EBONE_SELECTABLE(arm, ebone) : EBONE_VISIBLE(arm, ebone))) { + return; + } + + /* Set in the first pass, needed so circle select prioritizes joints. */ + if (ebone->temp.i == true) { + return; + } + + if (edge_inside_circle(data->mval_fl, data->radius, screen_co_a, screen_co_b)) { + SET_FLAG_FROM_TEST(ebone->flag, data->select, BONE_SELECTED | BONE_TIPSEL | BONE_ROOTSEL); + data->is_changed = true; } } static bool armature_circle_select(ViewContext *vc, @@ -4183,9 +4250,18 @@ static bool armature_circle_select(ViewContext *vc, ED_view3d_init_mats_rv3d(vc->obedit, vc->rv3d); + /* Operate on fully visible (non-clipped) points. */ armature_foreachScreenBone( vc, do_circle_select_armature__doSelectBone, &data, V3D_PROJ_TEST_CLIP_DEFAULT); + /* Operate on bones as segments clipped to the viewport bounds + * (needed to handle bones with both points outside the view). + * A separate pass is needed since clipped coordinates can't be used for selecting joints. */ + armature_foreachScreenBone(vc, + do_circle_select_armature__doSelectBone_clip_content, + &data, + V3D_PROJ_TEST_CLIP_DEFAULT | V3D_PROJ_TEST_CLIP_CONTENT_DEFAULT); + if (data.is_changed) { ED_armature_edit_sync_selection(arm->edbo); ED_armature_edit_validate_active(arm); @@ -4366,7 +4442,7 @@ static int view3d_circle_select_exec(bContext *C, wmOperator *op) FOREACH_OBJECT_IN_MODE_END; } else if (obact && (obact->mode & OB_MODE_PARTICLE_EDIT)) { - if (PE_circle_select(C, sel_op, mval, (float)radius)) { + if (PE_circle_select(C, wm_userdata, sel_op, mval, (float)radius)) { return OPERATOR_FINISHED; } return OPERATOR_CANCELLED; diff --git a/source/blender/editors/space_view3d/view3d_snap.c b/source/blender/editors/space_view3d/view3d_snap.c index 72c62321e88..6dec3cc818a 100644 --- a/source/blender/editors/space_view3d/view3d_snap.c +++ b/source/blender/editors/space_view3d/view3d_snap.c @@ -155,7 +155,7 @@ static int snap_sel_to_grid_exec(bContext *C, wmOperator *UNUSED(op)) /* Get location of grid point in pose space. */ BKE_armature_loc_pose_to_bone(pchan_eval, vec, vec); - /* adjust location on the original pchan*/ + /* Adjust location on the original pchan. */ bPoseChannel *pchan = BKE_pose_channel_find_name(ob->pose, pchan_eval->name); if ((pchan->protectflag & OB_LOCK_LOCX) == 0) { pchan->loc[0] = vec[0]; diff --git a/source/blender/editors/space_view3d/view3d_utils.c b/source/blender/editors/space_view3d/view3d_utils.c index 8ae5d4a29e9..4f8b0fa4685 100644 --- a/source/blender/editors/space_view3d/view3d_utils.c +++ b/source/blender/editors/space_view3d/view3d_utils.c @@ -260,7 +260,7 @@ bool ED_view3d_context_activate(bContext *C) return false; } - /* bad context switch .. */ + /* Bad context switch. */ CTX_wm_area_set(C, area); CTX_wm_region_set(C, region); @@ -1017,7 +1017,7 @@ static float view_autodist_depth_margin(ARegion *region, const int mval[2], int } ViewDepths depth_temp = {0}; - view3d_update_depths_rect(region, &depth_temp, &rect); + view3d_depths_rect_create(region, &rect, &depth_temp); float depth_close = view3d_depth_near(&depth_temp); MEM_SAFE_FREE(depth_temp.depths); return depth_close; @@ -1044,7 +1044,7 @@ bool ED_view3d_autodist(Depsgraph *depsgraph, bool depth_ok = false; /* Get Z Depths, needed for perspective, nice for ortho */ - ED_view3d_depth_override(depsgraph, region, v3d, NULL, V3D_DEPTH_NO_GPENCIL, false); + ED_view3d_depth_override(depsgraph, region, v3d, NULL, V3D_DEPTH_NO_GPENCIL, NULL); /* Attempt with low margin's first */ int i = 0; @@ -1694,7 +1694,8 @@ bool ED_view3d_depth_read_cached(const ViewDepths *vd, return false; } -bool ED_view3d_depth_read_cached_normal(const ViewContext *vc, +bool ED_view3d_depth_read_cached_normal(const ARegion *region, + const ViewDepths *depths, const int mval[2], float r_normal[3]) { @@ -1705,9 +1706,6 @@ bool ED_view3d_depth_read_cached_normal(const ViewContext *vc, bool depths_valid[9] = {false}; float coords[9][3] = {{0}}; - ARegion *region = vc->region; - const ViewDepths *depths = vc->rv3d->depths; - for (int x = 0, i = 0; x < 2; x++) { for (int y = 0; y < 2; y++) { const int mval_ofs[2] = {mval[0] + (x - 1), mval[1] + (y - 1)}; @@ -1761,11 +1759,4 @@ bool ED_view3d_depth_unproject_v3(const ARegion *region, return ED_view3d_unproject_v3(region, centx, centy, depth, r_location_world); } -void ED_view3d_depth_tag_update(RegionView3D *rv3d) -{ - if (rv3d->depths) { - rv3d->depths->damaged = true; - } -} - /** \} */ diff --git a/source/blender/editors/space_view3d/view3d_view.c b/source/blender/editors/space_view3d/view3d_view.c index f49b94280d6..a2d50c43bd2 100644 --- a/source/blender/editors/space_view3d/view3d_view.c +++ b/source/blender/editors/space_view3d/view3d_view.c @@ -85,7 +85,7 @@ struct SmoothView3DState { }; struct SmoothView3DStore { - /* source*/ + /* Source. */ struct SmoothView3DState src; /* source */ struct SmoothView3DState dst; /* destination */ struct SmoothView3DState org; /* original */ @@ -235,7 +235,7 @@ void ED_view3d_smooth_view_ex( /* grid draw as floor */ if ((RV3D_LOCK_FLAGS(rv3d) & RV3D_LOCK_ROTATION) == 0) { /* use existing if exists, means multiple calls to smooth view - * wont lose the original 'view' setting */ + * won't lose the original 'view' setting */ rv3d->view = RV3D_VIEW_USER; } @@ -244,7 +244,7 @@ void ED_view3d_smooth_view_ex( /* if this is view rotation only * we can decrease the time allowed by * the angle between quats - * this means small rotations wont lag */ + * this means small rotations won't lag */ if (sview->quat && !sview->ofs && !sview->dist) { /* scale the time allowed by the rotation */ /* 180deg == 1.0 */ @@ -1261,7 +1261,7 @@ static bool view3d_localview_init(const Depsgraph *depsgraph, if (local_view_bit == 0) { /* TODO(dfelinto): We can kick one of the other 3D views out of local view - * specially if it is not being used. */ + * specially if it is not being used. */ BKE_report(reports, RPT_ERROR, "No more than 16 local views"); ok = false; } @@ -1517,7 +1517,7 @@ static int localview_remove_from_exec(bContext *C, wmOperator *op) } if (changed) { - DEG_on_visible_update(bmain, false); + DEG_tag_on_visible_update(bmain, false); DEG_id_tag_update(&scene->id, ID_RECALC_SELECT); WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene); WM_event_add_notifier(C, NC_SCENE | ND_OB_ACTIVE, scene); diff --git a/source/blender/editors/space_view3d/view3d_walk.c b/source/blender/editors/space_view3d/view3d_walk.c index ab4cf0c2135..fd99619f9e2 100644 --- a/source/blender/editors/space_view3d/view3d_walk.c +++ b/source/blender/editors/space_view3d/view3d_walk.c @@ -129,7 +129,7 @@ typedef enum eWalkGravityState { WALK_GRAVITY_STATE_ON, } eWalkGravityState; -/* called in transform_ops.c, on each regeneration of keymaps */ +/* Called in transform_ops.c, on each regeneration of key-maps. */ void walk_modal_keymap(wmKeyConfig *keyconf) { static const EnumPropertyItem modal_items[] = { diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c index 17bfc23aea7..b03fb2c370f 100644 --- a/source/blender/editors/transform/transform.c +++ b/source/blender/editors/transform/transform.c @@ -650,7 +650,7 @@ static bool transform_modal_item_poll(const wmOperator *op, int value) return true; } -/* called in transform_ops.c, on each regeneration of keymaps */ +/* Called in transform_ops.c, on each regeneration of key-maps. */ wmKeyMap *transform_modal_keymap(wmKeyConfig *keyconf) { static const EnumPropertyItem modal_items[] = { diff --git a/source/blender/editors/transform/transform.h b/source/blender/editors/transform/transform.h index 2b26ef3b3e4..2df0d86d02b 100644 --- a/source/blender/editors/transform/transform.h +++ b/source/blender/editors/transform/transform.h @@ -423,7 +423,7 @@ typedef struct TransCenterData { * (typically in transform_conversion.c). */ typedef struct TransCustomDataContainer { - /** Owned by the mode (grab, scale, bend... ).*/ + /** Owned by the mode (grab, scale, bend... ). */ union { TransCustomData mode, first_elem; }; diff --git a/source/blender/editors/transform/transform_convert.c b/source/blender/editors/transform/transform_convert.c index 9e285dd2d26..99368a40225 100644 --- a/source/blender/editors/transform/transform_convert.c +++ b/source/blender/editors/transform/transform_convert.c @@ -816,7 +816,7 @@ bool constraints_list_needinv(TransInfo *t, ListBase *list) /* only consider constraint if it is enabled, and has influence on result */ if ((con->flag & CONSTRAINT_DISABLE) == 0 && (con->enforce != 0.0f)) { /* (affirmative) returns for specific constraints here... */ - /* constraints that require this regardless */ + /* constraints that require this regardless. */ if (ELEM(con->type, CONSTRAINT_TYPE_FOLLOWPATH, CONSTRAINT_TYPE_CLAMPTO, diff --git a/source/blender/editors/transform/transform_convert_action.c b/source/blender/editors/transform/transform_convert_action.c index 8204264e105..deb64ca2892 100644 --- a/source/blender/editors/transform/transform_convert_action.c +++ b/source/blender/editors/transform/transform_convert_action.c @@ -191,7 +191,7 @@ static TransData *ActionFCurveToTransData(TransData *td, td->flag |= TD_SELECTED; } - /*set flags to move handles as necessary*/ + /* Set flags to move handles as necessary. */ td->flag |= TD_MOVEHANDLE1 | TD_MOVEHANDLE2; td2d->h1 = bezt->vec[0]; td2d->h2 = bezt->vec[2]; @@ -554,7 +554,7 @@ void createTransActionData(bContext *C, TransInfo *t) /** \name Action Transform Flush * \{ */ -/* This function helps flush transdata written to tempdata into the gp-frames */ +/* This function helps flush transdata written to tempdata into the gp-frames. */ static void flushTransIntFrameActionData(TransInfo *t) { TransDataContainer *tc = TRANS_DATA_CONTAINER_FIRST_SINGLE(t); diff --git a/source/blender/editors/transform/transform_convert_armature.c b/source/blender/editors/transform/transform_convert_armature.c index aaea9d05f84..1f1b1f8db97 100644 --- a/source/blender/editors/transform/transform_convert_armature.c +++ b/source/blender/editors/transform/transform_convert_armature.c @@ -1449,9 +1449,9 @@ void recalcData_pose(TransInfo *t) /* TODO: autokeyframe calls need some setting to specify to add samples * (FPoints) instead of keyframes? */ if ((t->animtimer) && (t->context) && IS_AUTOKEY_ON(t->scene)) { - int targetless_ik = - (t->flag & - T_AUTOIK); /* XXX this currently doesn't work, since flags aren't set yet! */ + + /* XXX: this currently doesn't work, since flags aren't set yet! */ + int targetless_ik = (t->flag & T_AUTOIK); animrecord_check_state(t, ob); autokeyframe_pose(t->context, t->scene, ob, t->mode, targetless_ik); @@ -1610,10 +1610,10 @@ static short apply_targetless_ik(Object *ob) Bone *bone; float mat[4][4]; - /* pose_mat(b) = pose_mat(b-1) * offs_bone * channel * constraint * IK */ - /* we put in channel the entire result of mat = (channel * constraint * IK) */ - /* pose_mat(b) = pose_mat(b-1) * offs_bone * mat */ - /* mat = pose_mat(b) * inv(pose_mat(b-1) * offs_bone ) */ + /* `pose_mat(b) = pose_mat(b-1) * offs_bone * channel * constraint * IK` */ + /* We put in channel the entire result of: `mat = (channel * constraint * IK)` */ + /* `pose_mat(b) = pose_mat(b-1) * offs_bone * mat` */ + /* `mat = pose_mat(b) * inv(pose_mat(b-1) * offs_bone)` */ parchan = chanlist[segcount - 1]; bone = parchan->bone; diff --git a/source/blender/editors/transform/transform_convert_curve.c b/source/blender/editors/transform/transform_convert_curve.c index e57fd85470f..575e0da21a4 100644 --- a/source/blender/editors/transform/transform_convert_curve.c +++ b/source/blender/editors/transform/transform_convert_curve.c @@ -278,7 +278,7 @@ void createTransCurveVerts(TransInfo *t) td->ext = NULL; /* TODO - make points scale */ - if (t->mode == TFM_CURVE_SHRINKFATTEN) { /* || t->mode==TFM_RESIZE) {*/ + if (t->mode == TFM_CURVE_SHRINKFATTEN /* `|| t->mode == TFM_RESIZE` */) { td->val = &(bezt->radius); td->ival = bezt->radius; } @@ -453,7 +453,7 @@ void recalcData_curve(TransInfo *t) if (t->state == TRANS_CANCEL) { while (nu) { - /* Cant do testhandlesNurb here, it messes up the h1 and h2 flags */ + /* Can't do testhandlesNurb here, it messes up the h1 and h2 flags */ BKE_nurb_handles_calc(nu); nu = nu->next; } diff --git a/source/blender/editors/transform/transform_convert_gpencil.c b/source/blender/editors/transform/transform_convert_gpencil.c index 4932a5f8d23..f7b78b10868 100644 --- a/source/blender/editors/transform/transform_convert_gpencil.c +++ b/source/blender/editors/transform/transform_convert_gpencil.c @@ -176,7 +176,7 @@ static void createTransGPencil_curves(bContext *C, } } - /* If not multiedit out of loop. */ + /* If not multi-edit out of loop. */ if (!is_multiedit) { break; } @@ -382,7 +382,7 @@ static void createTransGPencil_curves(bContext *C, } } - /* If not multiedit out of loop. */ + /* If not multi-edit out of loop. */ if (!is_multiedit) { break; } @@ -470,7 +470,7 @@ static void createTransGPencil_strokes(bContext *C, } } } - /* If not multiedit out of loop. */ + /* If not multi-edit out of loop. */ if (!is_multiedit) { break; } @@ -674,7 +674,7 @@ static void createTransGPencil_strokes(bContext *C, } } } - /* if not multiedit out of loop */ + /* If not multi-edit out of loop. */ if (!is_multiedit) { break; } diff --git a/source/blender/editors/transform/transform_convert_mesh.c b/source/blender/editors/transform/transform_convert_mesh.c index 4c674136b6a..58cf82c72d3 100644 --- a/source/blender/editors/transform/transform_convert_mesh.c +++ b/source/blender/editors/transform/transform_convert_mesh.c @@ -27,6 +27,7 @@ #include "MEM_guardedalloc.h" #include "BLI_alloca.h" +#include "BLI_bitmap.h" #include "BLI_linklist_stack.h" #include "BLI_math.h" #include "BLI_memarena.h" @@ -59,16 +60,37 @@ static void tc_mesh_customdata_free_fn(struct TransInfo *t, struct TransCustomDataLayer; static void tc_mesh_customdatacorrect_free(struct TransCustomDataLayer *tcld); +struct TransCustomData_PartialUpdate { + struct BMPartialUpdate *cache; + + /** The size of proportional editing used for #BMPartialUpdate. */ + float prop_size; + /** The size of proportional editing for the last update. */ + float prop_size_prev; +}; + +enum ePartialType { + PARTIAL_NONE = -1, + /** + * Update for all tagged vertices (any kind of deformation). + * Use as a default since it can be used with any kind of deformation. + */ + PARTIAL_TYPE_ALL = 0, + /** + * Update only faces between tagged and non-tagged faces (affine transformations). + * Use when transforming is guaranteed not to change the relative locations of vertices. + * + * This has the advantage that selecting the entire mesh or only isolated elements, + * can skip normal/tessellation updates entirely, so it's worth using when possible. + */ + PARTIAL_TYPE_GROUP = 1, + +}; +#define PARTIAL_TYPE_MAX 2 + struct TransCustomDataMesh { struct TransCustomDataLayer *cd_layer_correct; - struct { - struct BMPartialUpdate *cache; - - /** The size of proportional editing used for `partial_update_cache`. */ - float prop_size; - /** The size of proportional editing for the last update. */ - float prop_size_prev; - } partial_update; + struct TransCustomData_PartialUpdate partial_update[PARTIAL_TYPE_MAX]; }; static struct TransCustomDataMesh *tc_mesh_customdata_ensure(TransDataContainer *tc) @@ -90,8 +112,10 @@ static void tc_mesh_customdata_free(struct TransCustomDataMesh *tcmd) tc_mesh_customdatacorrect_free(tcmd->cd_layer_correct); } - if (tcmd->partial_update.cache != NULL) { - BM_mesh_partial_destroy(tcmd->partial_update.cache); + for (int i = 0; i < ARRAY_SIZE(tcmd->partial_update); i++) { + if (tcmd->partial_update[i].cache != NULL) { + BM_mesh_partial_destroy(tcmd->partial_update[i].cache); + } } MEM_freeN(tcmd); @@ -1676,19 +1700,18 @@ void createTransEditVerts(TransInfo *t) /** \} */ /* -------------------------------------------------------------------- */ -/** \name Recalc Mesh Data +/** \name Recalc Mesh Data (Partial Update) * \{ */ -static bool bm_vert_tag_filter_fn(BMVert *v, void *UNUSED(user_data)) -{ - return BM_elem_flag_test(v, BM_ELEM_TAG); -} - -static BMPartialUpdate *tc_mesh_ensure_partial_update(TransInfo *t, TransDataContainer *tc) +static BMPartialUpdate *tc_mesh_partial_ensure(TransInfo *t, + TransDataContainer *tc, + enum ePartialType partial_type) { struct TransCustomDataMesh *tcmd = tc_mesh_customdata_ensure(tc); - if (tcmd->partial_update.cache) { + struct TransCustomData_PartialUpdate *pupdate = &tcmd->partial_update[partial_type]; + + if (pupdate->cache) { /* Recalculate partial update data when the proportional editing size changes. * @@ -1699,80 +1722,285 @@ static BMPartialUpdate *tc_mesh_ensure_partial_update(TransInfo *t, TransDataCon * Extra logic is needed to account for this situation. */ bool recalc; - if (tcmd->partial_update.prop_size_prev < t->prop_size) { + if (pupdate->prop_size_prev < t->prop_size) { /* Size increase, simply recalculate. */ recalc = true; } - else if (tcmd->partial_update.prop_size_prev > t->prop_size) { + else if (pupdate->prop_size_prev > t->prop_size) { /* Size decreased, first use this partial data since reducing the size will transform * geometry which needs recalculating. */ - tcmd->partial_update.prop_size_prev = t->prop_size; + pupdate->prop_size_prev = t->prop_size; recalc = false; } - else if (tcmd->partial_update.prop_size != t->prop_size) { - BLI_assert(tcmd->partial_update.prop_size > tcmd->partial_update.prop_size_prev); + else if (pupdate->prop_size != t->prop_size) { + BLI_assert(pupdate->prop_size > pupdate->prop_size_prev); recalc = true; } else { - BLI_assert(t->prop_size == tcmd->partial_update.prop_size_prev); + BLI_assert(t->prop_size == pupdate->prop_size_prev); recalc = false; } if (!recalc) { - return tcmd->partial_update.cache; + return pupdate->cache; } - BM_mesh_partial_destroy(tcmd->partial_update.cache); - tcmd->partial_update.cache = NULL; + BM_mesh_partial_destroy(pupdate->cache); + pupdate->cache = NULL; } BMEditMesh *em = BKE_editmesh_from_object(tc->obedit); - BM_mesh_elem_hflag_disable_all(em->bm, BM_VERT, BM_ELEM_TAG, false); + BM_mesh_elem_index_ensure(em->bm, BM_VERT); - int verts_len = 0; - int i; - TransData *td; - for (i = 0, td = tc->data; i < tc->data_len; i++, td++) { - if (td->factor != 0.0f) { - BMVert *v = (BMVert *)td->extra; - BM_elem_flag_enable(v, BM_ELEM_TAG); - verts_len += 1; + /* Only use `verts_group` or `verts_mask`. */ + int *verts_group = NULL; + int verts_group_count = 0; /* Number of non-zero elements in `verts_group`. */ + + BLI_bitmap *verts_mask = NULL; + int verts_mask_count = 0; /* Number of elements enabled in `verts_mask`. */ + + if ((partial_type == PARTIAL_TYPE_GROUP) && + ((t->flag & T_PROP_EDIT) || tc->use_mirror_axis_any)) { + verts_group = MEM_callocN(sizeof(*verts_group) * em->bm->totvert, __func__); + int i; + TransData *td; + for (i = 0, td = tc->data; i < tc->data_len; i++, td++) { + if (td->factor == 0.0f) { + continue; + } + const BMVert *v = (BMVert *)td->extra; + const int v_index = BM_elem_index_get(v); + BLI_assert(verts_group[v_index] == 0); + if (td->factor < 1.0f) { + /* Don't use grouping logic with the factor is under 1.0. */ + verts_group[v_index] = -1; + } + else { + BLI_assert(td->factor == 1.0f); + verts_group[v_index] = 1; + if (tc->use_mirror_axis_any) { + /* Use bits 2-4 for central alignment (don't overlap the first bit). */ + const int flag = td->flag & (TD_MIRROR_EDGE_X | TD_MIRROR_EDGE_Y | TD_MIRROR_EDGE_Z); + verts_group[v_index] |= (flag >> TD_MIRROR_EDGE_AXIS_SHIFT) << 1; + } + } + verts_mask_count += 1; } - } - TransDataMirror *td_mirror = tc->data_mirror; - for (i = 0; i < tc->data_mirror_len; i++, td_mirror++) { - BMVert *v_mirr = (BMVert *)POINTER_OFFSET(td_mirror->loc_src, -offsetof(BMVert, co)); + TransDataMirror *td_mirror = tc->data_mirror; + for (i = 0; i < tc->data_mirror_len; i++, td_mirror++) { + BMVert *v_mirr = (BMVert *)POINTER_OFFSET(td_mirror->loc_src, -offsetof(BMVert, co)); + /* The equality check is to account for the case when topology mirror moves + * the vertex from it's original location to match it's symmetrical position, + * with proportional editing enabled. */ + const int v_mirr_index = BM_elem_index_get(v_mirr); + if (verts_group[v_mirr_index] == 0 && equals_v3v3(td_mirror->loc, td_mirror->iloc)) { + continue; + } - /* The equality check is to account for the case when topology mirror moves - * the vertex from it's original location to match it's symmetrical position, - * with proportional editing enabled. */ - if (BM_elem_flag_test(v_mirr, BM_ELEM_TAG) || !equals_v3v3(td_mirror->loc, td_mirror->iloc)) { BMVert *v_mirr_other = (BMVert *)td_mirror->extra; /* This assert should never fail since there is no overlap * between mirrored vertices and non-mirrored. */ - BLI_assert(!BM_elem_flag_test(v_mirr_other, BM_ELEM_TAG)); - BM_elem_flag_enable(v_mirr_other, BM_ELEM_TAG); - verts_len += 1; + BLI_assert(verts_group[BM_elem_index_get(v_mirr_other)] == 0); + const int v_mirr_other_index = BM_elem_index_get(v_mirr_other); + + if (verts_group[v_mirr_index] == -1) { + verts_group[v_mirr_other_index] = -1; + } + else { + /* Use bits 5-8 for mirror (don't overlap previous bits). */ + const int flag = td_mirror->flag & (TD_MIRROR_X | TD_MIRROR_Y | TD_MIRROR_Z); + verts_group[v_mirr_other_index] |= (flag >> TD_MIRROR_EDGE_AXIS_SHIFT) << 4; + } + verts_mask_count += 1; + } + } + else { + /* See the body of the comments in the previous block for details. */ + verts_mask = BLI_BITMAP_NEW(em->bm->totvert, __func__); + int i; + TransData *td; + for (i = 0, td = tc->data; i < tc->data_len; i++, td++) { + if (td->factor == 0.0f) { + continue; + } + const BMVert *v = (BMVert *)td->extra; + const int v_index = BM_elem_index_get(v); + BLI_assert(!BLI_BITMAP_TEST(verts_mask, v_index)); + BLI_BITMAP_ENABLE(verts_mask, v_index); + verts_mask_count += 1; + } + + TransDataMirror *td_mirror = tc->data_mirror; + for (i = 0; i < tc->data_mirror_len; i++, td_mirror++) { + BMVert *v_mirr = (BMVert *)POINTER_OFFSET(td_mirror->loc_src, -offsetof(BMVert, co)); + if (!BLI_BITMAP_TEST(verts_mask, BM_elem_index_get(v_mirr)) && + equals_v3v3(td_mirror->loc, td_mirror->iloc)) { + continue; + } + + BMVert *v_mirr_other = (BMVert *)td_mirror->extra; + BLI_assert(!BLI_BITMAP_TEST(verts_mask, BM_elem_index_get(v_mirr_other))); + const int v_mirr_other_index = BM_elem_index_get(v_mirr_other); + BLI_BITMAP_ENABLE(verts_mask, v_mirr_other_index); + verts_mask_count += 1; + } + } + + switch (partial_type) { + case PARTIAL_TYPE_ALL: { + pupdate->cache = BM_mesh_partial_create_from_verts(em->bm, + &(BMPartialUpdate_Params){ + .do_tessellate = true, + .do_normals = true, + }, + verts_mask, + verts_mask_count); + break; + } + case PARTIAL_TYPE_GROUP: { + pupdate->cache = + (verts_group ? BM_mesh_partial_create_from_verts_group_multi(em->bm, + &(BMPartialUpdate_Params){ + .do_tessellate = true, + .do_normals = true, + }, + verts_group, + verts_group_count) : + BM_mesh_partial_create_from_verts_group_single(em->bm, + &(BMPartialUpdate_Params){ + .do_tessellate = true, + .do_normals = true, + }, + verts_mask, + verts_mask_count)); + break; + } + case PARTIAL_NONE: { + BLI_assert_unreachable(); } } - tcmd->partial_update.cache = BM_mesh_partial_create_from_verts(em->bm, - &(BMPartialUpdate_Params){ - .do_tessellate = true, - .do_normals = true, - }, - verts_len, - bm_vert_tag_filter_fn, - NULL); + if (verts_group) { + MEM_freeN(verts_group); + } + else { + MEM_freeN(verts_mask); + } - tcmd->partial_update.prop_size_prev = t->prop_size; - tcmd->partial_update.prop_size = t->prop_size; + pupdate->prop_size_prev = t->prop_size; + pupdate->prop_size = t->prop_size; - return tcmd->partial_update.cache; + return pupdate->cache; } +static void tc_mesh_partial_types_calc(TransInfo *t, + enum ePartialType *r_partial_for_looptri, + enum ePartialType *r_partial_for_normals) +{ + /* Calculate the kind of partial updates which can be performed. */ + enum ePartialType partial_for_normals = PARTIAL_NONE; + enum ePartialType partial_for_looptri = PARTIAL_NONE; + + /* Note that operations such as #TFM_CREASE are not handled here + * (if they were, leaving as #PARTIAL_NONE would be appropriate). */ + switch (t->mode) { + case TFM_TRANSLATION: { + partial_for_looptri = PARTIAL_TYPE_GROUP; + partial_for_normals = PARTIAL_TYPE_GROUP; + break; + } + case TFM_ROTATION: { + partial_for_looptri = PARTIAL_TYPE_GROUP; + partial_for_normals = PARTIAL_TYPE_ALL; + break; + } + case TFM_RESIZE: { + partial_for_looptri = PARTIAL_TYPE_GROUP; + partial_for_normals = PARTIAL_TYPE_GROUP; + /* Non-uniform scale needs to recalculate all normals + * since their relative locations change. + * Uniform negative scale can keep normals as-is since the faces are flipped, + * normals remain unchanged. */ + if ((t->con.mode & CON_APPLY) || + (t->values_final[0] != t->values_final[1] || t->values_final[0] != t->values_final[2])) { + partial_for_normals = PARTIAL_TYPE_ALL; + } + break; + } + default: { + partial_for_looptri = PARTIAL_TYPE_ALL; + partial_for_normals = PARTIAL_TYPE_ALL; + break; + } + } + + /* With projection, transform isn't affine. */ + if (activeSnap_with_project(t)) { + if (partial_for_looptri == PARTIAL_TYPE_GROUP) { + partial_for_looptri = PARTIAL_TYPE_ALL; + } + if (partial_for_normals == PARTIAL_TYPE_GROUP) { + partial_for_normals = PARTIAL_TYPE_ALL; + } + } + + *r_partial_for_looptri = partial_for_looptri; + *r_partial_for_normals = partial_for_normals; +} + +static void tc_mesh_partial_update(TransInfo *t, + TransDataContainer *tc, + enum ePartialType partial_for_looptri, + enum ePartialType partial_for_normals) +{ + BMEditMesh *em = BKE_editmesh_from_object(tc->obedit); + + /* Matching. */ + if ((partial_for_looptri == PARTIAL_TYPE_ALL) && (partial_for_normals == PARTIAL_TYPE_ALL)) { + /* The additional cost of generating the partial connectivity data isn't justified + * when all data needs to be updated. + * + * While proportional editing can cause all geometry to need updating with a partial + * selection. It's impractical to calculate this ahead of time. Further, the down side of + * using partial updates when their not needed is negligible. */ + if (em->bm->totvert == em->bm->totvertsel) { + BKE_editmesh_looptri_and_normals_calc(em); + return; + } + } + + /* Not matching. */ + if (partial_for_looptri != PARTIAL_NONE) { + BMPartialUpdate *bmpinfo = tc_mesh_partial_ensure(t, tc, partial_for_looptri); + BKE_editmesh_looptri_calc_with_partial_ex(em, + bmpinfo, + &(const struct BMeshCalcTessellation_Params){ + .face_normals = true, + }); + } + + if (partial_for_normals != PARTIAL_NONE) { + BMPartialUpdate *bmpinfo = tc_mesh_partial_ensure(t, tc, partial_for_normals); + /* While not a large difference, take advantage of existing normals where possible. */ + const bool face_normals = !((partial_for_looptri == PARTIAL_TYPE_ALL) || + ((partial_for_looptri == PARTIAL_TYPE_GROUP) && + (partial_for_normals == PARTIAL_TYPE_GROUP))); + BM_mesh_normals_update_with_partial_ex(em->bm, + bmpinfo, + &(const struct BMeshNormalsUpdate_Params){ + .face_normals = face_normals, + }); + } +} + +/** \} */ + +/* -------------------------------------------------------------------- */ +/** \name Recalc Mesh Data + * \{ */ + static void tc_mesh_transdata_mirror_apply(TransDataContainer *tc) { if (tc->use_mirror_axis_any) { @@ -1831,23 +2059,13 @@ void recalcData_mesh(TransInfo *t) tc_mesh_customdatacorrect_restore(t); } + enum ePartialType partial_for_looptri, partial_for_normals; + tc_mesh_partial_types_calc(t, &partial_for_looptri, &partial_for_normals); + FOREACH_TRANS_DATA_CONTAINER (t, tc) { DEG_id_tag_update(tc->obedit->data, ID_RECALC_GEOMETRY); - BMEditMesh *em = BKE_editmesh_from_object(tc->obedit); - /* The additional cost of generating the partial connectivity data isn't justified - * when all data needs to be updated. - * - * While proportional editing can cause all geometry to need updating with a partial selection. - * It's impractical to calculate this ahead of time. - * Further, the down side of using partial updates when their not needed is negligible. */ - if (em->bm->totvert == em->bm->totvertsel) { - BKE_editmesh_looptri_and_normals_calc(em); - } - else { - BMPartialUpdate *partial_update_cache = tc_mesh_ensure_partial_update(t, tc); - BKE_editmesh_looptri_and_normals_calc_with_partial(em, partial_update_cache); - } + tc_mesh_partial_update(t, tc, partial_for_looptri, partial_for_normals); } } /** \} */ diff --git a/source/blender/editors/transform/transform_convert_sequencer.c b/source/blender/editors/transform/transform_convert_sequencer.c index ffba6308c35..2cb0e3c8589 100644 --- a/source/blender/editors/transform/transform_convert_sequencer.c +++ b/source/blender/editors/transform/transform_convert_sequencer.c @@ -465,7 +465,7 @@ static void freeSeqData(TransInfo *t, TransDataContainer *tc, TransCustomData *c SeqCollection *transformed_strips = seq_transform_collection_from_transdata(tc); - if ((t->state == TRANS_CANCEL)) { + if (t->state == TRANS_CANCEL) { seq_transform_cancel(t, transformed_strips); free_transform_custom_data(custom_data); return; @@ -599,7 +599,7 @@ static void flushTransSeq(TransInfo *t) TransDataContainer *tc = TRANS_DATA_CONTAINER_FIRST_SINGLE(t); - /* flush to 2d vector from internally used 3d vector */ + /* Flush to 2D vector from internally used 3D vector. */ for (a = 0, td = tc->data, td2d = tc->data_2d; a < tc->data_len; a++, td++, td2d++) { tdsq = (TransDataSeq *)td->extra; seq = tdsq->seq; @@ -615,13 +615,13 @@ static void flushTransSeq(TransInfo *t) CLAMP(seq->machine, 1, MAXSEQ); break; - case SEQ_LEFTSEL: /* no vertical transform */ + case SEQ_LEFTSEL: /* No vertical transform. */ SEQ_transform_set_left_handle_frame(seq, new_frame); SEQ_transform_handle_xlimits(seq, tdsq->flag & SEQ_LEFTSEL, tdsq->flag & SEQ_RIGHTSEL); SEQ_transform_fix_single_image_seq_offsets(seq); SEQ_time_update_sequence(t->scene, seq); break; - case SEQ_RIGHTSEL: /* no vertical transform */ + case SEQ_RIGHTSEL: /* No vertical transform. */ SEQ_transform_set_right_handle_frame(seq, new_frame); SEQ_transform_handle_xlimits(seq, tdsq->flag & SEQ_LEFTSEL, tdsq->flag & SEQ_RIGHTSEL); SEQ_transform_fix_single_image_seq_offsets(seq); @@ -696,7 +696,7 @@ void special_aftertrans_update__sequencer(bContext *UNUSED(C), TransInfo *t) return; } /* freeSeqData in transform_conversions.c does this - * keep here so the else at the end wont run... */ + * keep here so the else at the end won't run... */ SpaceSeq *sseq = (SpaceSeq *)t->area->spacedata.first; diff --git a/source/blender/editors/transform/transform_data.h b/source/blender/editors/transform/transform_data.h index 5b01433c96b..59b76c2eec5 100644 --- a/source/blender/editors/transform/transform_data.h +++ b/source/blender/editors/transform/transform_data.h @@ -173,10 +173,12 @@ enum { /** For Graph Editor - curves that can only have int-values * need their keyframes tagged with this. */ TD_INTVALUES = 1 << 11, +#define TD_MIRROR_AXIS_SHIFT 12 /** For editmode mirror. */ TD_MIRROR_X = 1 << 12, TD_MIRROR_Y = 1 << 13, TD_MIRROR_Z = 1 << 14, +#define TD_MIRROR_EDGE_AXIS_SHIFT 12 /** For editmode mirror, clamp axis to 0 */ TD_MIRROR_EDGE_X = 1 << 12, TD_MIRROR_EDGE_Y = 1 << 13, diff --git a/source/blender/editors/transform/transform_generics.c b/source/blender/editors/transform/transform_generics.c index 71c91221fbb..9e048a0ca1d 100644 --- a/source/blender/editors/transform/transform_generics.c +++ b/source/blender/editors/transform/transform_generics.c @@ -353,13 +353,11 @@ void initTransInfo(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *eve t->around = V3D_AROUND_CENTER_BOUNDS; } - BLI_assert(is_zero_v4(t->values_modal_offset)); - bool t_values_set_is_array = false; if (op && (prop = RNA_struct_find_property(op->ptr, "value")) && RNA_property_is_set(op->ptr, prop)) { - float values[4] = {0}; /* in case value isn't length 4, avoid uninitialized memory */ + float values[4] = {0}; /* in case value isn't length 4, avoid uninitialized memory. */ if (RNA_property_array_check(prop)) { RNA_float_get_array(op->ptr, "value", values); t_values_set_is_array = true; @@ -368,7 +366,6 @@ void initTransInfo(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *eve values[0] = RNA_float_get(op->ptr, "value"); } - copy_v4_v4(t->values, values); if (t->flag & T_MODAL) { /* Run before init functions so 'values_modal_offset' can be applied on mouse input. */ copy_v4_v4(t->values_modal_offset, values); diff --git a/source/blender/editors/transform/transform_gizmo_3d.c b/source/blender/editors/transform/transform_gizmo_3d.c index 7a780df0def..080a19cce1f 100644 --- a/source/blender/editors/transform/transform_gizmo_3d.c +++ b/source/blender/editors/transform/transform_gizmo_3d.c @@ -521,7 +521,7 @@ static void protectflag_to_drawflags_pchan(RegionView3D *rv3d, } } -/* for editmode*/ +/* For editmode. */ static void protectflag_to_drawflags_ebone(RegionView3D *rv3d, const EditBone *ebo) { if (ebo->flag & BONE_EDITMODE_LOCKED) { diff --git a/source/blender/editors/transform/transform_gizmo_extrude_3d.c b/source/blender/editors/transform/transform_gizmo_extrude_3d.c index ed6c3eb0255..ca4ed01c0f6 100644 --- a/source/blender/editors/transform/transform_gizmo_extrude_3d.c +++ b/source/blender/editors/transform/transform_gizmo_extrude_3d.c @@ -367,7 +367,7 @@ static void gizmo_mesh_extrude_refresh(const bContext *C, wmGizmoGroup *gzgroup) } } - /* TODO: skip calculating axis which wont be used (above). */ + /* TODO: skip calculating axis which won't be used (above). */ switch (axis_type) { case EXTRUDE_AXIS_NORMAL: for (int i = 0; i < 3; i++) { diff --git a/source/blender/editors/transform/transform_input.c b/source/blender/editors/transform/transform_input.c index 414199badd7..0b46d0b9a13 100644 --- a/source/blender/editors/transform/transform_input.c +++ b/source/blender/editors/transform/transform_input.c @@ -450,17 +450,6 @@ void applyMouseInput(TransInfo *t, MouseInput *mi, const int mval[2], float outp mi->apply(t, mi, mval_db, output); } - if (!is_zero_v3(t->values_modal_offset)) { - float values_ofs[3]; - if (t->con.mode & CON_APPLY) { - mul_v3_m3v3(values_ofs, t->spacemtx, t->values_modal_offset); - } - else { - copy_v3_v3(values_ofs, t->values_modal_offset); - } - add_v3_v3(t->values, values_ofs); - } - if (mi->post) { mi->post(t, output); } diff --git a/source/blender/editors/transform/transform_mode.c b/source/blender/editors/transform/transform_mode.c index 350be247014..6a946994e06 100644 --- a/source/blender/editors/transform/transform_mode.c +++ b/source/blender/editors/transform/transform_mode.c @@ -734,9 +734,25 @@ void ElementRotation_ex(TransInfo *t, /* can be called for texture space translate for example, then opt out */ if (td->ext->quat) { mul_m3_series(fmat, td->smtx, mat, td->mtx); + + if (!is_zero_v3(td->ext->dquat)) { + /* Correct for delta quat */ + float tmp_mat[3][3]; + quat_to_mat3(tmp_mat, td->ext->dquat); + mul_m3_m3m3(fmat, fmat, tmp_mat); + } + mat3_to_quat(quat, fmat); /* Actual transform */ + if (!is_zero_v4(td->ext->dquat)) { + /* Correct back for delta quat. */ + float idquat[4]; + invert_qt_qt_normalized(idquat, td->ext->dquat); + mul_qt_qtqt(quat, idquat, quat); + } + mul_qt_qtqt(td->ext->quat, quat, td->ext->iquat); + /* this function works on end result */ protectedQuaternionBits(td->protectflag, td->ext->quat, td->ext->iquat); } @@ -761,21 +777,28 @@ void ElementRotation_ex(TransInfo *t, td->ext->irotAngle); } else { + /* Calculate the total rotation in eulers. */ float obmat[3][3]; mul_m3_m3m3(totmat, mat, td->mtx); mul_m3_m3m3(smat, td->smtx, totmat); - /* Calculate the total rotation in eulers. */ - add_v3_v3v3(eul, td->ext->irot, td->ext->drot); /* correct for delta rot */ + if (!is_zero_v3(td->ext->drot)) { + /* Correct for delta rot */ + add_eul_euleul(eul, td->ext->irot, td->ext->drot, td->ext->rotOrder); + } + else { + copy_v3_v3(eul, td->ext->irot); + } + eulO_to_mat3(obmat, eul, td->ext->rotOrder); - /* mat = transform, obmat = object rotation */ mul_m3_m3m3(fmat, smat, obmat); - mat3_to_compatible_eulO(eul, td->ext->rot, td->ext->rotOrder, fmat); - /* correct back for delta rot */ - sub_v3_v3v3(eul, eul, td->ext->drot); + if (!is_zero_v3(td->ext->drot)) { + /* Correct back for delta rot. */ + sub_eul_euleul(eul, eul, td->ext->drot, td->ext->rotOrder); + } /* and apply */ protectedRotateBits(td->protectflag, eul, td->ext->irot); diff --git a/source/blender/editors/transform/transform_mode_edge_slide.c b/source/blender/editors/transform/transform_mode_edge_slide.c index d255a7d5660..6134c8a98f5 100644 --- a/source/blender/editors/transform/transform_mode_edge_slide.c +++ b/source/blender/editors/transform/transform_mode_edge_slide.c @@ -375,8 +375,8 @@ static void calcEdgeSlide_mval_range(TransInfo *t, UNUSED_VARS_NDEBUG(sv_table); /* silence warning */ BLI_assert(i == sv_table[BM_elem_index_get(v)]); - /* search cross edges for visible edge to the mouse cursor, - * then use the shared vertex to calculate screen vector*/ + /* Search cross edges for visible edge to the mouse cursor, + * then use the shared vertex to calculate screen vector. */ BM_ITER_ELEM (e, &iter_other, v, BM_EDGES_OF_VERT) { /* screen-space coords */ float sco_a[3], sco_b[3]; @@ -540,7 +540,7 @@ static EdgeSlideData *createEdgeSlideVerts_double_side(TransInfo *t, TransDataCo sld->curr_sv_index = 0; - /*ensure valid selection*/ + /* Ensure valid selection. */ BM_ITER_MESH (v, &iter, bm, BM_VERTS_OF_MESH) { if (BM_elem_flag_test(v, BM_ELEM_SELECT)) { BMIter iter2; @@ -548,7 +548,7 @@ static EdgeSlideData *createEdgeSlideVerts_double_side(TransInfo *t, TransDataCo BM_ITER_ELEM (e, &iter2, v, BM_EDGES_OF_VERT) { if (BM_elem_flag_test(e, BM_ELEM_SELECT)) { /* BMESH_TODO: this is probably very evil, - * set v->e to a selected edge*/ + * set `v->e` to a selected edge. */ v->e = e; numsel++; @@ -640,10 +640,10 @@ static EdgeSlideData *createEdgeSlideVerts_double_side(TransInfo *t, TransDataCo v_first = v; - /*walk along the edge loop*/ + /* Walk along the edge loop. */ e = v->e; - /*first, rewind*/ + /* First, rewind. */ do { e = get_other_edge(v, e); if (!e) { @@ -709,7 +709,7 @@ static EdgeSlideData *createEdgeSlideVerts_double_side(TransInfo *t, TransDataCo STACK_PUSH_RET_PTR(sv_array)) : \ (&sv_array[sv_table[BM_elem_index_get(v)]])) - /*iterate over the loop*/ + /* Iterate over the loop. */ v_first = v; do { bool l_a_ok_prev; @@ -1220,7 +1220,7 @@ void drawEdgeSlide(TransInfo *t) immUniformThemeColorShadeAlpha(TH_EDGE_SELECT, 80, alpha_shade); immBegin(GPU_PRIM_LINES, sld->totsv * 2); - /* TODO(campbell): Loop over all verts */ + /* TODO(campbell): Loop over all verts. */ sv = sld->sv; for (i = 0; i < sld->totsv; i++, sv++) { float a[3], b[3]; diff --git a/source/blender/editors/transform/transform_mode_resize.c b/source/blender/editors/transform/transform_mode_resize.c index 1d7d1369f29..6af16dee9b7 100644 --- a/source/blender/editors/transform/transform_mode_resize.c +++ b/source/blender/editors/transform/transform_mode_resize.c @@ -88,6 +88,7 @@ static void applyResize(TransInfo *t, const int UNUSED(mval[2])) float ratio = t->values[0]; copy_v3_fl(t->values_final, ratio); + add_v3_v3(t->values_final, t->values_modal_offset); transform_snap_increment(t, t->values_final); diff --git a/source/blender/editors/transform/transform_mode_rotate.c b/source/blender/editors/transform/transform_mode_rotate.c index 8350e94e0e8..066cdf20e93 100644 --- a/source/blender/editors/transform/transform_mode_rotate.c +++ b/source/blender/editors/transform/transform_mode_rotate.c @@ -194,7 +194,7 @@ static void applyRotation(TransInfo *t, const int UNUSED(mval[2])) { char str[UI_MAX_DRAW_STR]; float axis_final[3]; - float final = t->values[0]; + float final = t->values[0] + t->values_modal_offset[0]; if ((t->con.mode & CON_APPLY) && t->con.applyRot) { t->con.applyRot(t, NULL, NULL, axis_final, &final); diff --git a/source/blender/editors/transform/transform_mode_translate.c b/source/blender/editors/transform/transform_mode_translate.c index 3088f6a7776..7ee8834c1fe 100644 --- a/source/blender/editors/transform/transform_mode_translate.c +++ b/source/blender/editors/transform/transform_mode_translate.c @@ -52,12 +52,26 @@ /** \name Transform (Translation) * \{ */ +static void translate_dist_to_str(char *r_str, + const int len_max, + const float val, + const UnitSettings *unit) +{ + if (unit) { + BKE_unit_value_as_string( + r_str, len_max, val * unit->scale_length, 4, B_UNIT_LENGTH, unit, false); + } + else { + /* Check range to prevent string buffer overflow. */ + BLI_snprintf(r_str, len_max, IN_RANGE_INCL(val, -1e10f, 1e10f) ? "%.4f" : "%.4e", val); + } +} + static void headerTranslation(TransInfo *t, const float vec[3], char str[UI_MAX_DRAW_STR]) { size_t ofs = 0; - char tvec[NUM_STR_REP_LEN * 3]; - char distvec[NUM_STR_REP_LEN]; - char autoik[NUM_STR_REP_LEN]; + char dvec_str[3][NUM_STR_REP_LEN]; + char dist_str[NUM_STR_REP_LEN]; float dist; UnitSettings *unit = NULL; @@ -66,7 +80,7 @@ static void headerTranslation(TransInfo *t, const float vec[3], char str[UI_MAX_ } if (hasNumInput(&t->num)) { - outputNumInput(&(t->num), tvec, &t->scene->unit); + outputNumInput(&(t->num), dvec_str[0], &t->scene->unit); dist = len_v3(t->num.val); } else { @@ -94,84 +108,37 @@ static void headerTranslation(TransInfo *t, const float vec[3], char str[UI_MAX_ dist = len_v3(dvec); - if (unit) { - for (int i = 0; i < 3; i++) { - BKE_unit_value_as_string(&tvec[NUM_STR_REP_LEN * i], - NUM_STR_REP_LEN, - dvec[i] * unit->scale_length, - 4, - B_UNIT_LENGTH, - unit, - true); - } - } - else { - BLI_snprintf(&tvec[0], NUM_STR_REP_LEN, "%.4f", dvec[0]); - BLI_snprintf(&tvec[NUM_STR_REP_LEN], NUM_STR_REP_LEN, "%.4f", dvec[1]); - BLI_snprintf(&tvec[NUM_STR_REP_LEN * 2], NUM_STR_REP_LEN, "%.4f", dvec[2]); + for (int i = 0; i < 3; i++) { + translate_dist_to_str(dvec_str[i], sizeof(dvec_str[i]), dvec[i], unit); } } - if (unit) { - BKE_unit_value_as_string( - distvec, sizeof(distvec), dist * unit->scale_length, 4, B_UNIT_LENGTH, unit, false); - } - else if (dist > 1e10f || dist < -1e10f) { - /* prevent string buffer overflow */ - BLI_snprintf(distvec, NUM_STR_REP_LEN, "%.4e", dist); - } - else { - BLI_snprintf(distvec, NUM_STR_REP_LEN, "%.4f", dist); - } - - if (t->flag & T_AUTOIK) { - short chainlen = t->settings->autoik_chainlen; - - if (chainlen) { - BLI_snprintf(autoik, NUM_STR_REP_LEN, TIP_("AutoIK-Len: %d"), chainlen); - } - else { - autoik[0] = '\0'; - } - } - else { - autoik[0] = '\0'; - } + translate_dist_to_str(dist_str, sizeof(dist_str), dist, unit); if (t->con.mode & CON_APPLY) { switch (t->num.idx_max) { case 0: - ofs += BLI_snprintf_rlen(str + ofs, - UI_MAX_DRAW_STR - ofs, - "D: %s (%s)%s %s %s", - &tvec[0], - distvec, - t->con.text, - t->proptext, - autoik); + ofs += BLI_snprintf_rlen( + str + ofs, UI_MAX_DRAW_STR - ofs, "D: %s (%s)%s", dvec_str[0], dist_str, t->con.text); break; case 1: ofs += BLI_snprintf_rlen(str + ofs, UI_MAX_DRAW_STR - ofs, - "D: %s D: %s (%s)%s %s %s", - &tvec[0], - &tvec[NUM_STR_REP_LEN], - distvec, - t->con.text, - t->proptext, - autoik); + "D: %s D: %s (%s)%s", + dvec_str[0], + dvec_str[1], + dist_str, + t->con.text); break; case 2: ofs += BLI_snprintf_rlen(str + ofs, UI_MAX_DRAW_STR - ofs, - "D: %s D: %s D: %s (%s)%s %s %s", - &tvec[0], - &tvec[NUM_STR_REP_LEN], - &tvec[NUM_STR_REP_LEN * 2], - distvec, - t->con.text, - t->proptext, - autoik); + "D: %s D: %s D: %s (%s)%s", + dvec_str[0], + dvec_str[1], + dvec_str[2], + dist_str, + t->con.text); break; } } @@ -179,30 +146,42 @@ static void headerTranslation(TransInfo *t, const float vec[3], char str[UI_MAX_ if (t->flag & T_2D_EDIT) { ofs += BLI_snprintf_rlen(str + ofs, UI_MAX_DRAW_STR - ofs, - "Dx: %s Dy: %s (%s)%s %s", - &tvec[0], - &tvec[NUM_STR_REP_LEN], - distvec, - t->con.text, - t->proptext); + "Dx: %s Dy: %s (%s)%s", + dvec_str[0], + dvec_str[1], + dist_str, + t->con.text); } else { ofs += BLI_snprintf_rlen(str + ofs, UI_MAX_DRAW_STR - ofs, - "Dx: %s Dy: %s Dz: %s (%s)%s %s %s", - &tvec[0], - &tvec[NUM_STR_REP_LEN], - &tvec[NUM_STR_REP_LEN * 2], - distvec, - t->con.text, - t->proptext, - autoik); + "Dx: %s Dy: %s Dz: %s (%s)%s", + dvec_str[0], + dvec_str[1], + dvec_str[2], + dist_str, + t->con.text); } } if (t->flag & T_PROP_EDIT_ALL) { - ofs += BLI_snprintf_rlen( - str + ofs, UI_MAX_DRAW_STR - ofs, TIP_(" Proportional size: %.2f"), t->prop_size); + char prop_str[NUM_STR_REP_LEN]; + translate_dist_to_str(prop_str, sizeof(prop_str), t->prop_size, unit); + + ofs += BLI_snprintf_rlen(str + ofs, + UI_MAX_DRAW_STR - ofs, + " %s %s: %s", + TIP_("Proportional Size"), + t->proptext, + prop_str); + } + + if (t->flag & T_AUTOIK) { + short chainlen = t->settings->autoik_chainlen; + if (chainlen) { + ofs += BLI_strncpy_rlen(str + ofs, " ", UI_MAX_DRAW_STR - ofs); + ofs += BLI_snprintf_rlen(str + ofs, UI_MAX_DRAW_STR - ofs, TIP_("AutoIK-Len: %d"), chainlen); + } } if (t->spacetype == SPACE_NODE) { @@ -383,6 +362,11 @@ static void applyTranslation(TransInfo *t, const int UNUSED(mval[2])) } else { copy_v3_v3(global_dir, t->values); + if (!is_zero_v3(t->values_modal_offset)) { + float values_ofs[3]; + mul_v3_m3v3(values_ofs, t->spacemtx, t->values_modal_offset); + add_v3_v3(global_dir, values_ofs); + } t->tsnap.snapElem = 0; applySnapping(t, global_dir); diff --git a/source/blender/editors/transform/transform_ops.c b/source/blender/editors/transform/transform_ops.c index d7bcf8dcf90..2c424d8ace3 100644 --- a/source/blender/editors/transform/transform_ops.c +++ b/source/blender/editors/transform/transform_ops.c @@ -539,7 +539,7 @@ static bool transform_poll_property(const bContext *UNUSED(C), /* Orientation/Constraints. */ { - /* Hide orientation axis if no constraints are set, since it wont be used. */ + /* Hide orientation axis if no constraints are set, since it won't be used. */ PropertyRNA *prop_con = RNA_struct_find_property(op->ptr, "orient_type"); if (!ELEM(prop_con, NULL, prop)) { if (STRPREFIX(prop_id, "constraint")) { diff --git a/source/blender/editors/transform/transform_snap.c b/source/blender/editors/transform/transform_snap.c index bebef049718..4ecb9594325 100644 --- a/source/blender/editors/transform/transform_snap.c +++ b/source/blender/editors/transform/transform_snap.c @@ -61,6 +61,8 @@ #include "transform_convert.h" #include "transform_snap.h" +static bool doForceIncrementSnap(const TransInfo *t); + /* this should be passed as an arg for use in snap functions */ #undef BASACT @@ -133,6 +135,23 @@ bool activeSnap(const TransInfo *t) ((t->modifiers & (MOD_SNAP | MOD_SNAP_INVERT)) == MOD_SNAP_INVERT); } +bool activeSnap_with_project(const TransInfo *t) +{ + if (!t->tsnap.project) { + return false; + } + + if (!activeSnap(t) || (t->flag & T_NO_PROJECT)) { + return false; + } + + if (doForceIncrementSnap(t)) { + return false; + } + + return true; +} + bool transformModeUseSnap(const TransInfo *t) { ToolSettings *ts = t->settings; @@ -299,15 +318,7 @@ eRedrawFlag handleSnapping(TransInfo *t, const wmEvent *event) void applyProject(TransInfo *t) { - if (!t->tsnap.project) { - return; - } - - if (!activeSnap(t) || (t->flag & T_NO_PROJECT)) { - return; - } - - if (doForceIncrementSnap(t)) { + if (!activeSnap_with_project(t)) { return; } diff --git a/source/blender/editors/transform/transform_snap.h b/source/blender/editors/transform/transform_snap.h index c557368ed17..1632b49fbbf 100644 --- a/source/blender/editors/transform/transform_snap.h +++ b/source/blender/editors/transform/transform_snap.h @@ -61,6 +61,8 @@ bool transform_snap_grid(TransInfo *t, float *val); void snapSequenceBounds(TransInfo *t, const int mval[2]); bool activeSnap(const TransInfo *t); +bool activeSnap_with_project(const TransInfo *t); + bool validSnap(const TransInfo *t); void initSnapping(struct TransInfo *t, struct wmOperator *op); diff --git a/source/blender/editors/undo/ed_undo.c b/source/blender/editors/undo/ed_undo.c index 7811509ab40..df4e6f893ec 100644 --- a/source/blender/editors/undo/ed_undo.c +++ b/source/blender/editors/undo/ed_undo.c @@ -492,7 +492,7 @@ bool ED_undo_is_legacy_compatible_for_property(struct bContext *C, ID *id) } /** - * Ideally we wont access the stack directly, + * Ideally we won't access the stack directly, * this is needed for modes which handle undo themselves (bypassing #ED_undo_push). * * Using global isn't great, this just avoids doing inline, @@ -693,9 +693,9 @@ int ED_undo_operator_repeat(bContext *C, wmOperator *op) } if ((WM_operator_repeat_check(C, op)) && (WM_operator_poll(C, op->type)) && - /* note, undo/redo cant run if there are jobs active, + /* note, undo/redo can't run if there are jobs active, * check for screen jobs only so jobs like material/texture/world preview - * (which copy their data), wont stop redo, see T29579], + * (which copy their data), won't stop redo, see T29579], * * note, - WM_operator_check_ui_enabled() jobs test _must_ stay in sync with this */ (WM_jobs_test(wm, scene, WM_JOB_TYPE_ANY) == 0)) { diff --git a/source/blender/editors/undo/memfile_undo.c b/source/blender/editors/undo/memfile_undo.c index 9189adaf4d1..7c6ce56eab0 100644 --- a/source/blender/editors/undo/memfile_undo.c +++ b/source/blender/editors/undo/memfile_undo.c @@ -224,9 +224,21 @@ static void memfile_undosys_step_decode(struct bContext *C, /* Tag depsgraph to update data-block for changes that happened between the * current and the target state, see direct_link_id_restore_recalc(). */ - if (id->recalc) { + if (id->recalc != 0) { DEG_id_tag_update_ex(bmain, id, id->recalc); } + + bNodeTree *nodetree = ntreeFromID(id); + if (nodetree != NULL && nodetree->id.recalc != 0) { + DEG_id_tag_update_ex(bmain, &nodetree->id, nodetree->id.recalc); + } + if (GS(id->name) == ID_SCE) { + Scene *scene = (Scene *)id; + if (scene->master_collection != NULL && scene->master_collection->id.recalc != 0) { + DEG_id_tag_update_ex( + bmain, &scene->master_collection->id, scene->master_collection->id.recalc); + } + } } FOREACH_MAIN_ID_END; diff --git a/source/blender/editors/util/ed_transverts.c b/source/blender/editors/util/ed_transverts.c index c1d0dcdb095..b4a93eb996c 100644 --- a/source/blender/editors/util/ed_transverts.c +++ b/source/blender/editors/util/ed_transverts.c @@ -182,8 +182,8 @@ static void set_mapped_co(void *vuserdata, if (BM_elem_index_get(eve) != TM_INDEX_SKIP) { tv = &tv[BM_elem_index_get(eve)]; - /* be clever, get the closest vertex to the original, - * behaves most logically when the mirror modifier is used for eg T33051*/ + /* Be clever, get the closest vertex to the original, + * behaves most logically when the mirror modifier is used for eg T33051. */ if ((tv->flag & TX_VERT_USE_MAPLOC) == 0) { /* first time */ copy_v3_v3(tv->maploc, co); diff --git a/source/blender/editors/uvedit/uvedit_ops.c b/source/blender/editors/uvedit/uvedit_ops.c index 80fbfd3d28c..2f88e50492f 100644 --- a/source/blender/editors/uvedit/uvedit_ops.c +++ b/source/blender/editors/uvedit/uvedit_ops.c @@ -608,7 +608,7 @@ static void uv_weld_align(bContext *C, eUVWeldAlign tool) /* Projection of point (x, y) over line (x1, y1, x2, y2) along X axis: * new_y = (y2 - y1) / (x2 - x1) * (x - x1) + y1 * Maybe this should be a BLI func? Or is it already existing? - * Could use interp_v2_v2v2, but not sure it's worth it here...*/ + * Could use interp_v2_v2v2, but not sure it's worth it here. */ if (tool_local == UV_STRAIGHTEN_X) { luv->uv[0] = a * (luv->uv[1] - uv_start[1]) + uv_start[0]; } @@ -624,7 +624,7 @@ static void uv_weld_align(bContext *C, eUVWeldAlign tool) } } else { - /* error - not a line, needs 3+ points */ + /* error - not a line, needs 3+ points. */ } if (eve_line) { @@ -632,7 +632,7 @@ static void uv_weld_align(bContext *C, eUVWeldAlign tool) } } else { - /* error - cant find an endpoint */ + /* error - can't find an endpoint. */ } } @@ -1187,15 +1187,15 @@ static bool uv_snap_uvs_to_adjacent_unselected(Scene *scene, Object *obedit) } BM_ITER_MESH (f, &iter, bm, BM_FACES_OF_MESH) { - if (BM_elem_flag_test(f, BM_ELEM_TAG)) { /* face: visible */ + if (BM_elem_flag_test(f, BM_ELEM_TAG)) { /* Face: visible. */ BM_ITER_ELEM (l, &liter, f, BM_LOOPS_OF_FACE) { - if (BM_elem_flag_test(l, BM_ELEM_TAG)) { /* loop: selected*/ + if (BM_elem_flag_test(l, BM_ELEM_TAG)) { /* Loop: selected. */ float uv[2] = {0.0f, 0.0f}; int uv_tot = 0; BM_ITER_ELEM (lsub, &lsubiter, l->v, BM_LOOPS_OF_VERT) { - if (BM_elem_flag_test(lsub->f, BM_ELEM_TAG) && /* face: visible */ - !BM_elem_flag_test(lsub, BM_ELEM_TAG)) /* loop: unselected */ + if (BM_elem_flag_test(lsub->f, BM_ELEM_TAG) && /* Face: visible. */ + !BM_elem_flag_test(lsub, BM_ELEM_TAG)) /* Loop: unselected. */ { luv = BM_ELEM_CD_GET_VOID_P(lsub, cd_loop_uv_offset); add_v2_v2(uv, luv->uv); diff --git a/source/blender/editors/uvedit/uvedit_parametrizer.c b/source/blender/editors/uvedit/uvedit_parametrizer.c index 7d82884760c..eb4ca2e13b2 100644 --- a/source/blender/editors/uvedit/uvedit_parametrizer.c +++ b/source/blender/editors/uvedit/uvedit_parametrizer.c @@ -82,10 +82,10 @@ typedef struct PVert { struct PVert *nextlink; union PVertUnion { - PHashKey key; /* construct */ - int id; /* abf/lscm matrix index */ - float distortion; /* area smoothing */ - HeapNode *heaplink; /* edge collapsing */ + PHashKey key; /* Construct. */ + int id; /* ABF/LSCM matrix index. */ + float distortion; /* Area smoothing. */ + HeapNode *heaplink; /* Edge collapsing. */ } u; struct PEdge *edge; @@ -99,10 +99,10 @@ typedef struct PEdge { struct PEdge *nextlink; union PEdgeUnion { - PHashKey key; /* construct */ - int id; /* abf matrix index */ - HeapNode *heaplink; /* fill holes */ - struct PEdge *nextcollapse; /* simplification */ + PHashKey key; /* Construct. */ + int id; /* ABF matrix index. */ + HeapNode *heaplink; /* Fill holes. */ + struct PEdge *nextcollapse; /* Simplification. */ } u; struct PVert *vert; @@ -118,10 +118,10 @@ typedef struct PFace { struct PFace *nextlink; union PFaceUnion { - PHashKey key; /* construct */ - int chart; /* construct splitting*/ - float area3d; /* stretch */ - int id; /* abf matrix index */ + PHashKey key; /* Construct. */ + int chart; /* Construct splitting. */ + float area3d; /* Stretch. */ + int id; /* ABF matrix index. */ } u; struct PEdge *edge; diff --git a/source/blender/editors/uvedit/uvedit_rip.c b/source/blender/editors/uvedit/uvedit_rip.c index e1b9a287457..631b831411f 100644 --- a/source/blender/editors/uvedit/uvedit_rip.c +++ b/source/blender/editors/uvedit/uvedit_rip.c @@ -572,7 +572,7 @@ static UVRipPairs *uv_rip_pairs_from_loop(BMLoop *l_init, rip->loops = BLI_gset_ptr_new(__func__); /* We can rely on this stack being small, as we're walking down two sides of an edge loop, - * so the stack wont be much larger than the total number of fans at any one vertex. */ + * so the stack won't be much larger than the total number of fans at any one vertex. */ BLI_SMALLSTACK_DECLARE(stack, BMLoop *); /* Needed for cases when we walk onto loops which already have a side assigned, @@ -907,7 +907,7 @@ static int uv_rip_exec(bContext *C, wmOperator *op) float aspx, aspy; { - /* Note that we only want to run this on the */ + /* Note that we only want to run this on the. */ Object *obedit = CTX_data_edit_object(C); ED_uvedit_get_aspect(obedit, &aspx, &aspy); } diff --git a/source/blender/editors/uvedit/uvedit_select.c b/source/blender/editors/uvedit/uvedit_select.c index 39950f9d0c7..0a7cd579a0a 100644 --- a/source/blender/editors/uvedit/uvedit_select.c +++ b/source/blender/editors/uvedit/uvedit_select.c @@ -1296,7 +1296,7 @@ static int uv_select_edgering( l_step = uvedit_loop_find_other_radial_loop_with_visible_face( scene, l_step_opposite, cd_loop_uv_offset); if (l_step == NULL) { - /* Ensure we touch the opposite edge if we cant walk over it. */ + /* Ensure we touch the opposite edge if we can't walk over it. */ l_step = l_step_opposite; } } diff --git a/source/blender/editors/uvedit/uvedit_smart_stitch.c b/source/blender/editors/uvedit/uvedit_smart_stitch.c index 8ebf000baaa..71656784947 100644 --- a/source/blender/editors/uvedit/uvedit_smart_stitch.c +++ b/source/blender/editors/uvedit/uvedit_smart_stitch.c @@ -76,7 +76,7 @@ typedef struct StitchPreviewer { float *preview_polys; /* uvs per polygon. */ uint *uvs_per_polygon; - /*number of preview polygons */ + /* Number of preview polygons. */ uint num_polys; /* preview data. These will be either the previewed vertices or edges * depending on stitch mode settings */ @@ -1069,8 +1069,7 @@ static int stitch_process_data(StitchStateContainer *ssc, } } - /* remember stitchable candidates as places the 'I' button */ - /* will stop at. */ + /* Remember stitchable candidates as places the 'I' button will stop at. */ for (int island_idx = 0; island_idx < state->element_map->totalIslands; island_idx++) { state->island_is_stitchable[island_idx] = island_stitch_data[island_idx].stitchableCandidate ? true : @@ -1818,7 +1817,7 @@ static void stitch_draw(const bContext *UNUSED(C), ARegion *UNUSED(region), void /* Closing line */ GPU_vertbuf_attr_set(vbo_line, pos_id, line_idx++, &stitch_preview->preview_polys[index]); - /* j = uvs_per_polygon[i] - 1*/ + /* `j = uvs_per_polygon[i] - 1` */ GPU_vertbuf_attr_set( vbo_line, pos_id, line_idx++, &stitch_preview->preview_polys[index + j * 2]); @@ -1980,7 +1979,7 @@ static StitchState *stitch_init(bContext *C, counter++; state->uvs[counter] = element; } - /* pointer arithmetic to the rescue, as always :)*/ + /* Pointer arithmetic to the rescue, as always :). */ map[element - state->element_map->buf] = counter; } } @@ -2007,8 +2006,8 @@ static StitchState *stitch_init(bContext *C, all_edges[counter].first = NULL; all_edges[counter].flag = 0; all_edges[counter].element = element; - /* using an order policy, sort uvs according to address space. This avoids - * Having two different UvEdges with the same uvs on different positions */ + /* Using an order policy, sort UV's according to address space. + * This avoids having two different UvEdges with the same UV's on different positions. */ if (offset1 < offset2) { all_edges[counter].uv1 = offset1; all_edges[counter].uv2 = offset2; @@ -2381,9 +2380,9 @@ static int stitch_init_all(bContext *C, wmOperator *op) StitchState *state = ssc->states[ssc->active_object_index]; ssc->static_island %= state->element_map->totalIslands; - /* If the initial active object doesn't have any stitchable islands */ - /* then no active island will be seen in the UI. Make sure we're on */ - /* a stitchable object and island. */ + /* If the initial active object doesn't have any stitchable islands + * then no active island will be seen in the UI. + * Make sure we're on a stitchable object and island. */ if (!state->island_is_stitchable[ssc->static_island]) { goto_next_island(ssc); state = ssc->states[ssc->active_object_index]; diff --git a/source/blender/editors/uvedit/uvedit_unwrap_ops.c b/source/blender/editors/uvedit/uvedit_unwrap_ops.c index e37acad666c..74fb8a3e169 100644 --- a/source/blender/editors/uvedit/uvedit_unwrap_ops.c +++ b/source/blender/editors/uvedit/uvedit_unwrap_ops.c @@ -498,7 +498,7 @@ static ParamHandle *construct_param_handle_subsurfed(const Scene *scene, /* pointers to modifier data for unwrap control */ ModifierData *md; SubsurfModifierData *smd_real; - /* modifier initialization data, will control what type of subdivision will happen*/ + /* Modifier initialization data, will control what type of subdivision will happen. */ SubsurfModifierData smd = {{NULL}}; /* Used to hold subsurfed Mesh */ DerivedMesh *derivedMesh, *initialDerived; @@ -509,7 +509,7 @@ static ParamHandle *construct_param_handle_subsurfed(const Scene *scene, MEdge *subsurfedEdges; MPoly *subsurfedPolys; MLoop *subsurfedLoops; - /* number of vertices and faces for subsurfed mesh*/ + /* Number of vertices and faces for subsurfed mesh. */ int numOfEdges, numOfFaces; /* holds a map to editfaces for every subsurfed MFace. @@ -1367,7 +1367,7 @@ static void uv_map_rotation_matrix_ex(float result[4][4], rotup[2][2] = cosf(upangle) / radius; rotup[0][0] = 1.0f / radius; - /* calculate transforms*/ + /* Calculate transforms. */ mul_m4_series(result, rotup, rotside, viewmatrix, rotobj); } @@ -2906,7 +2906,7 @@ void ED_uvedit_add_simple_uvs(Main *bmain, const Scene *scene, Object *ob) /* select all uv loops first - pack parameters needs this to make sure charts are registered */ ED_uvedit_select_all(bm); uvedit_unwrap_cube_project(bm, 1.0, false, NULL); - /* set the margin really quickly before the packing operation*/ + /* Set the margin really quickly before the packing operation. */ scene->toolsettings->uvcalc_margin = 0.001f; uvedit_pack_islands(scene, ob, bm); BM_mesh_bm_to_me(bmain, NULL, bm, me, (&(struct BMeshToMeshParams){0})); diff --git a/source/blender/freestyle/intern/application/AppCanvas.h b/source/blender/freestyle/intern/application/AppCanvas.h index 1ff7e781ce6..8329192e6d6 100644 --- a/source/blender/freestyle/intern/application/AppCanvas.h +++ b/source/blender/freestyle/intern/application/AppCanvas.h @@ -32,21 +32,21 @@ class AppCanvas : public Canvas { AppCanvas(const AppCanvas &iBrother); virtual ~AppCanvas(); - /*! operations that need to be done before a draw */ + /** operations that need to be done before a draw */ virtual void preDraw(); - /*! operations that need to be done after a draw */ + /** operations that need to be done after a draw */ virtual void postDraw(); - /*! Erases the layers and clears the canvas */ + /** Erases the layers and clears the canvas */ virtual void Erase(); /* init the canvas */ virtual void init(); - /*! Reads a pixel area from the canvas */ + /** Reads a pixel area from the canvas */ virtual void readColorPixels(int x, int y, int w, int h, RGBImage &oImage) const; - /*! Reads a depth pixel area from the canvas */ + /** Reads a depth pixel area from the canvas */ virtual void readDepthPixels(int x, int y, int w, int h, GrayImage &oImage) const; virtual BBox<Vec3r> scene3DBBox() const; @@ -55,7 +55,7 @@ class AppCanvas : public Canvas { virtual void RenderStroke(Stroke *); virtual void update(); - /*! accessors */ + /** accessors */ virtual int width() const; virtual int height() const; virtual BBox<Vec2i> border() const; @@ -67,7 +67,7 @@ class AppCanvas : public Canvas { return _pViewer; } - /*! modifiers */ + /** modifiers */ void setViewer(AppView *iViewer); /* soc */ diff --git a/source/blender/freestyle/intern/application/AppView.h b/source/blender/freestyle/intern/application/AppView.h index 3f07d2794c4..ccb2c61fef5 100644 --- a/source/blender/freestyle/intern/application/AppView.h +++ b/source/blender/freestyle/intern/application/AppView.h @@ -83,7 +83,7 @@ class AppView { float _thickness; public: - /*! Sets the model to draw in the viewer + /** Sets the model to draw in the viewer * iModel * The Root Node of the model */ @@ -97,7 +97,7 @@ class AppView { AddModel(iModel); } - /*! Adds a model for displaying in the viewer */ + /** Adds a model for displaying in the viewer */ inline void AddModel(NodeGroup *iModel) { _ModelRootNode->AddChild(iModel); @@ -226,14 +226,14 @@ class AppView { real zfar(); public: - /*! Core scene drawing */ + /** Core scene drawing */ void DrawScene(SceneVisitor *iRenderer); - /*! 2D Scene Drawing */ + /** 2D Scene Drawing */ void Draw2DScene(SceneVisitor *iRenderer); protected: - /*! fabs or abs */ + /** fabs or abs */ inline int rabs(int x) { return abs(x); diff --git a/source/blender/freestyle/intern/blender_interface/BlenderFileLoader.h b/source/blender/freestyle/intern/blender_interface/BlenderFileLoader.h index 1be2fc3bc99..8fbda2b55f4 100644 --- a/source/blender/freestyle/intern/blender_interface/BlenderFileLoader.h +++ b/source/blender/freestyle/intern/blender_interface/BlenderFileLoader.h @@ -80,28 +80,28 @@ struct LoaderState { class BlenderFileLoader { public: - /*! Builds a MaxFileLoader */ + /** Builds a MaxFileLoader */ BlenderFileLoader(Render *re, ViewLayer *view_layer, Depsgraph *depsgraph); virtual ~BlenderFileLoader(); - /*! Loads the 3D scene and returns a pointer to the scene root node */ + /** Loads the 3D scene and returns a pointer to the scene root node */ NodeGroup *Load(); - /*! Gets the number of read faces */ + /** Gets the number of read faces */ inline unsigned int numFacesRead() { return _numFacesRead; } #if 0 - /*! Gets the smallest edge size read */ + /** Gets the smallest edge size read */ inline real minEdgeSize() { return _minEdgeSize; } #endif - /*! Modifiers */ + /** Modifiers */ inline void setRenderMonitor(RenderMonitor *iRenderMonitor) { _pRenderMonitor = iRenderMonitor; diff --git a/source/blender/freestyle/intern/blender_interface/BlenderStrokeRenderer.h b/source/blender/freestyle/intern/blender_interface/BlenderStrokeRenderer.h index 1b2e57529d6..beee7453b4c 100644 --- a/source/blender/freestyle/intern/blender_interface/BlenderStrokeRenderer.h +++ b/source/blender/freestyle/intern/blender_interface/BlenderStrokeRenderer.h @@ -44,7 +44,7 @@ class BlenderStrokeRenderer : public StrokeRenderer { BlenderStrokeRenderer(Render *re, int render_count); virtual ~BlenderStrokeRenderer(); - /*! Renders a stroke rep */ + /** Renders a stroke rep */ virtual void RenderStrokeRep(StrokeRep *iStrokeRep) const; virtual void RenderStrokeRepBasic(StrokeRep *iStrokeRep) const; diff --git a/source/blender/freestyle/intern/geometry/FastGrid.h b/source/blender/freestyle/intern/geometry/FastGrid.h index ec47f36d644..524725d5464 100644 --- a/source/blender/freestyle/intern/geometry/FastGrid.h +++ b/source/blender/freestyle/intern/geometry/FastGrid.h @@ -25,7 +25,7 @@ namespace Freestyle { -/*! Class to define a regular grid used for ray casting computations +/** Class to define a regular grid used for ray casting computations * We don't use a hashtable here. The grid is explicitly stored for faster computations. * However, this might result in significant increase in memory usage * (compared to the regular grid). @@ -43,13 +43,13 @@ class FastGrid : public Grid { clear(); } - /*! + /** * clears the grid * Deletes all the cells, clears the hashtable, resets size, size of cell, number of cells. */ virtual void clear(); - /*! Sets the different parameters of the grid + /** Sets the different parameters of the grid * orig * The grid origin * size @@ -59,10 +59,10 @@ class FastGrid : public Grid { */ virtual void configure(const Vec3r &orig, const Vec3r &size, unsigned nb); - /*! returns the cell whose coordinates are passed as argument */ + /** returns the cell whose coordinates are passed as argument */ Cell *getCell(const Vec3u &p); - /*! Fills the case p with the cell iCell */ + /** Fills the case p with the cell iCell */ virtual void fillCell(const Vec3u &p, Cell &cell); protected: diff --git a/source/blender/freestyle/intern/geometry/FitCurve.h b/source/blender/freestyle/intern/geometry/FitCurve.h index dc60d67b943..3e99893d66f 100644 --- a/source/blender/freestyle/intern/geometry/FitCurve.h +++ b/source/blender/freestyle/intern/geometry/FitCurve.h @@ -72,7 +72,7 @@ class FitCurveWrapper { public: ~FitCurveWrapper(); - /*! Fits a set of 2D data points to a set of Bezier Curve segments + /** Fits a set of 2D data points to a set of Bezier Curve segments * data * Input data points * oCurve @@ -90,7 +90,7 @@ class FitCurveWrapper { */ void FitCurve(Vector2 *d, int nPts, double error); - /*! Draws a Bezier curve segment + /** Draws a Bezier curve segment * n * degree of curve (=3) * curve diff --git a/source/blender/freestyle/intern/geometry/GeomCleaner.cpp b/source/blender/freestyle/intern/geometry/GeomCleaner.cpp index 7ec18fb2801..349347c1862 100644 --- a/source/blender/freestyle/intern/geometry/GeomCleaner.cpp +++ b/source/blender/freestyle/intern/geometry/GeomCleaner.cpp @@ -180,7 +180,7 @@ void GeomCleaner::SortAndCompressIndexedVertexArray(const float *iVertices, delete[] tmpIndices; } -/*! Defines a hash table used for searching the Cells */ +/** Defines a hash table used for searching the Cells */ struct GeomCleanerHasher { #define _MUL 950706376UL #define _MOD 2147483647UL diff --git a/source/blender/freestyle/intern/geometry/GeomCleaner.h b/source/blender/freestyle/intern/geometry/GeomCleaner.h index 7abbf881548..6ad1f040972 100644 --- a/source/blender/freestyle/intern/geometry/GeomCleaner.h +++ b/source/blender/freestyle/intern/geometry/GeomCleaner.h @@ -42,7 +42,7 @@ class GeomCleaner { { } - /*! Sorts an array of Indexed vertices + /** Sorts an array of Indexed vertices * iVertices * Array of vertices to sort. * It is organized as a float series of vertex coordinates: XYZXYZXYZ... @@ -70,7 +70,7 @@ class GeomCleaner { float **oVertices, unsigned **oIndices); - /*! Compress a SORTED indexed vertex array by eliminating multiple + /** Compress a SORTED indexed vertex array by eliminating multiple * appearing occurrences of a single vertex. * iVertices * The SORTED vertex array to compress. @@ -99,7 +99,7 @@ class GeomCleaner { unsigned *oVSize, unsigned **oIndices); - /*! Sorts and compress an array of indexed vertices. + /** Sorts and compress an array of indexed vertices. * iVertices * The vertex array to sort then compress. It is organized as a float series of * vertex coordinates: XYZXYZXYZ... @@ -127,7 +127,7 @@ class GeomCleaner { unsigned *oVSize, unsigned **oIndices); - /*! Cleans an indexed vertex array. + /** Cleans an indexed vertex array. * (Identical to SortAndCompress except that we use here a hash table to create the new array.) * iVertices * The vertex array to sort then compress. It is organized as a float series of @@ -161,10 +161,10 @@ class GeomCleaner { #endif }; -/*! Binary operators */ +/** Binary operators */ // inline bool operator<(const IndexedVertex& iv1, const IndexedVertex& iv2); -/*! Class Indexed Vertex. Used to represent an indexed vertex by storing the vertex coordinates as +/** Class Indexed Vertex. Used to represent an indexed vertex by storing the vertex coordinates as * well as its index */ class IndexedVertex { private: @@ -182,7 +182,7 @@ class IndexedVertex { _index = iIndex; } - /*! accessors */ + /** accessors */ inline const Vec3f &vector() const { return _Vector; @@ -208,7 +208,7 @@ class IndexedVertex { return _Vector[2]; } - /*! modifiers */ + /** modifiers */ inline void setVector(const Vec3f &iVector) { _Vector = iVector; @@ -219,7 +219,7 @@ class IndexedVertex { _index = iIndex; } - /*! operators */ + /** operators */ IndexedVertex &operator=(const IndexedVertex &iv) { _Vector = iv._Vector; diff --git a/source/blender/freestyle/intern/geometry/GeomUtils.h b/source/blender/freestyle/intern/geometry/GeomUtils.h index 62d57f01264..a3ef88115f2 100644 --- a/source/blender/freestyle/intern/geometry/GeomUtils.h +++ b/source/blender/freestyle/intern/geometry/GeomUtils.h @@ -40,7 +40,7 @@ namespace GeomUtils { // ///////////////////////////////////////////////////////////////////////////// -/*! Computes the distance from a point P to a segment AB */ +/** Computes the distance from a point P to a segment AB */ template<class T> real distPointSegment(const T &P, const T &A, const T &B) { T AB, AP, BP; @@ -97,16 +97,16 @@ intersection_test intersect2dSeg2dSegParametric(const Vec2r &p1, real &u, // I = P3 + u * P3P4 real epsilon = M_EPSILON); -/*! check whether a 2D segment intersect a 2D region or not */ +/** check whether a 2D segment intersect a 2D region or not */ bool intersect2dSeg2dArea(const Vec2r &min, const Vec2r &max, const Vec2r &A, const Vec2r &B); -/*! check whether a 2D segment is included in a 2D region or not */ +/** check whether a 2D segment is included in a 2D region or not */ bool include2dSeg2dArea(const Vec2r &min, const Vec2r &max, const Vec2r &A, const Vec2r &B); -/*! Box-triangle overlap test, adapted from Tomas Akenine-Möller code */ +/** Box-triangle overlap test, adapted from Tomas Akenine-Möller code */ bool overlapTriangleBox(Vec3r &boxcenter, Vec3r &boxhalfsize, Vec3r triverts[3]); -/*! Fast, Minimum Storage Ray-Triangle Intersection, adapted from Tomas Möller and Ben Trumbore +/** Fast, Minimum Storage Ray-Triangle Intersection, adapted from Tomas Möller and Ben Trumbore * code. */ bool intersectRayTriangle(const Vec3r &orig, const Vec3r &dir, @@ -118,7 +118,7 @@ bool intersectRayTriangle(const Vec3r &orig, real &v, // I = (1 - u - v) * v0 + u * v1 + v * v2 const real epsilon = M_EPSILON); // the epsilon to use -/*! Intersection between plane and ray adapted from Graphics Gems, Didier Badouel */ +/** Intersection between plane and ray adapted from Graphics Gems, Didier Badouel */ intersection_test intersectRayPlane(const Vec3r &orig, const Vec3r &dir, // ray origin and direction // plane's normal and offset (plane = { P / P.N + d = 0 }) @@ -127,7 +127,7 @@ intersection_test intersectRayPlane(const Vec3r &orig, real &t, // I = orig + t * dir const real epsilon = M_EPSILON); // the epsilon to use -/*! Intersection Ray-Bounding box (axis aligned). +/** Intersection Ray-Bounding box (axis aligned). * Adapted from Williams et al, "An Efficient Robust Ray-Box Intersection Algorithm", JGT 10:1 * (2005), pp. 49-54. */ @@ -142,7 +142,7 @@ bool intersectRayBBox(const Vec3r &orig, real &tmax, // Imax = orig + tmax * dir is the second intersection real epsilon = M_EPSILON); // the epsilon to use -/*! Checks whether 3D point P lies inside or outside of the triangle ABC */ +/** Checks whether 3D point P lies inside or outside of the triangle ABC */ bool includePointTriangle(const Vec3r &P, const Vec3r &A, const Vec3r &B, const Vec3r &C); void transformVertex(const Vec3r &vert, const Matrix44r &matrix, Vec3r &res); @@ -156,7 +156,7 @@ Vec3r rotateVector(const Matrix44r &mat, const Vec3r &v); // ///////////////////////////////////////////////////////////////////////////// -/*! From world to image +/** From world to image * p * point's coordinates expressed in world coordinates system * q @@ -176,7 +176,7 @@ void fromWorldToImage(const Vec3r &p, const real projection_matrix[4][4], const int viewport[4]); -/*! From world to image +/** From world to image * p * point's coordinates expressed in world coordinates system * q @@ -189,7 +189,7 @@ void fromWorldToImage(const Vec3r &p, */ void fromWorldToImage(const Vec3r &p, Vec3r &q, const real transform[4][4], const int viewport[4]); -/*! Projects from world coordinates to camera coordinates +/** Projects from world coordinates to camera coordinates * Returns the point's coordinates expressed in the camera's * coordinates system. * p @@ -202,7 +202,7 @@ void fromWorldToImage(const Vec3r &p, Vec3r &q, const real transform[4][4], cons */ void fromWorldToCamera(const Vec3r &p, Vec3r &q, const real model_view_matrix[4][4]); -/*! Projects from World Coordinates to retina coordinates +/** Projects from World Coordinates to retina coordinates * Returns the point's coordinates expressed in Retina system. * p * point's coordinates expressed in camera system @@ -214,7 +214,7 @@ void fromWorldToCamera(const Vec3r &p, Vec3r &q, const real model_view_matrix[4] */ void fromCameraToRetina(const Vec3r &p, Vec3r &q, const real projection_matrix[4][4]); -/*! From retina to image. +/** From retina to image. * Returns the coordinates expressed in Image coordinates system. * p * point's coordinates expressed in retina system @@ -225,7 +225,7 @@ void fromCameraToRetina(const Vec3r &p, Vec3r &q, const real projection_matrix[4 */ void fromRetinaToImage(const Vec3r &p, Vec3r &q, const int viewport[4]); -/*! From image to retina +/** From image to retina * p * point's coordinates expressed in image system * q @@ -235,7 +235,7 @@ void fromRetinaToImage(const Vec3r &p, Vec3r &q, const int viewport[4]); */ void fromImageToRetina(const Vec3r &p, Vec3r &q, const int viewport[4]); -/*! computes the coordinates of q in the camera coordinates system, +/** computes the coordinates of q in the camera coordinates system, * using the known z coordinates of the 3D point. * That means that this method does not inverse any matrices, * it only computes X and Y from x,y and Z) @@ -249,7 +249,7 @@ void fromImageToRetina(const Vec3r &p, Vec3r &q, const int viewport[4]); */ void fromRetinaToCamera(const Vec3r &p, Vec3r &q, real focal, const real projection_matrix[4][4]); -/*! Projects from camera coordinates to world coordinates +/** Projects from camera coordinates to world coordinates * Returns the point's coordinates expressed in the world's * coordinates system. * p diff --git a/source/blender/freestyle/intern/geometry/Grid.h b/source/blender/freestyle/intern/geometry/Grid.h index d0d92b62516..e6301063564 100644 --- a/source/blender/freestyle/intern/geometry/Grid.h +++ b/source/blender/freestyle/intern/geometry/Grid.h @@ -114,7 +114,7 @@ class GridVisitor { #endif }; -/*! Gathers all the occluders belonging to the cells traversed by the ray */ +/** Gathers all the occluders belonging to the cells traversed by the ray */ class allOccludersGridVisitor : public GridVisitor { public: allOccludersGridVisitor(OccludersSet &occluders) : GridVisitor(), occluders_(occluders) @@ -137,7 +137,7 @@ class allOccludersGridVisitor : public GridVisitor { OccludersSet &occluders_; }; -/*! Finds the first intersection and breaks. +/** Finds the first intersection and breaks. * The occluder and the intersection information are stored and accessible. */ class firstIntersectionGridVisitor : public GridVisitor { @@ -190,7 +190,7 @@ class firstIntersectionGridVisitor : public GridVisitor { class Grid { public: - /*! Builds a Grid. Must be followed by a call to configure() */ + /** Builds a Grid. Must be followed by a call to configure() */ Grid() { } @@ -200,12 +200,12 @@ class Grid { clear(); } - /*! clears the grid + /** clears the grid * Deletes all the cells, clears the hashtable, resets size, size of cell, number of cells. */ virtual void clear(); - /*! Sets the different parameters of the grid + /** Sets the different parameters of the grid * orig * The grid origin * size @@ -215,7 +215,7 @@ class Grid { */ virtual void configure(const Vec3r &orig, const Vec3r &size, unsigned nb); - /*! returns a vector of integer containing the coordinates of the cell containing the point + /** returns a vector of integer containing the coordinates of the cell containing the point * passed as argument * p * The point for which we're looking the cell @@ -237,13 +237,13 @@ class Grid { } } - /*! Fills the case corresponding to coord with the cell */ + /** Fills the case corresponding to coord with the cell */ virtual void fillCell(const Vec3u &coord, Cell &cell) = 0; - /*! returns the cell whose coordinates are passed as argument */ + /** returns the cell whose coordinates are passed as argument */ virtual Cell *getCell(const Vec3u &coord) = 0; - /*! returns the cell containing the point passed as argument. + /** returns the cell containing the point passed as argument. * If the cell is empty (contains no occluder), NULL is returned: * p * The point for which we're looking the cell @@ -255,7 +255,7 @@ class Grid { return getCell(coord); } - /*! Retrieves the x,y,z coordinates of the origin of the cell whose coordinates (i,j,k) + /** Retrieves the x,y,z coordinates of the origin of the cell whose coordinates (i,j,k) * is passed as argument: * cell_coord * i,j,k integer coordinates for the cell @@ -269,7 +269,7 @@ class Grid { } } - /*! Retrieves the box corresponding to the cell whose coordinates are passed as argument: + /** Retrieves the box corresponding to the cell whose coordinates are passed as argument: * cell_coord * i,j,k integer coordinates for the cell * min_out @@ -283,19 +283,19 @@ class Grid { max_out = min_out + _cell_size; } - /*! inserts a convex polygon occluder + /** inserts a convex polygon occluder * This method is quite coarse insofar as it adds all cells intersecting the polygon bounding * box convex_poly The list of 3D points constituting a convex polygon */ void insertOccluder(Polygon3r *occluder); - /*! Adds an occluder to the list of occluders */ + /** Adds an occluder to the list of occluders */ void addOccluder(Polygon3r *occluder) { _occluders.push_back(occluder); } - /*! Casts a ray between a starting point and an ending point + /** Casts a ray between a starting point and an ending point * Returns the list of occluders contained in the cells intersected by this ray * Starts with a call to InitRay. */ @@ -304,7 +304,7 @@ class Grid { // Prepares to cast ray without generating OccludersSet void initAcceleratedRay(const Vec3r &orig, const Vec3r &end, unsigned timestamp); - /*! Casts an infinite ray (still finishing at the end of the grid) from a starting point and in a + /** Casts an infinite ray (still finishing at the end of the grid) from a starting point and in a * given direction. Returns the list of occluders contained in the cells intersected by this ray * Starts with a call to InitRay. */ @@ -316,22 +316,22 @@ class Grid { // Prepares to cast ray without generating OccludersSet. bool initAcceleratedInfiniteRay(const Vec3r &orig, const Vec3r &dir, unsigned timestamp); - /*! Casts an infinite ray (still finishing at the end of the grid) from a starting point and in a + /** Casts an infinite ray (still finishing at the end of the grid) from a starting point and in a * given direction. Returns the first intersection (occluder,t,u,v) or null. Starts with a call * to InitRay. */ Polygon3r *castRayToFindFirstIntersection( const Vec3r &orig, const Vec3r &dir, double &t, double &u, double &v, unsigned timestamp); - /*! Init all structures and values for computing the cells intersected by this new ray */ + /** Init all structures and values for computing the cells intersected by this new ray */ void initRay(const Vec3r &orig, const Vec3r &end, unsigned timestamp); - /*! Init all structures and values for computing the cells intersected by this infinite ray. + /** Init all structures and values for computing the cells intersected by this infinite ray. * Returns false if the ray doesn't intersect the grid. */ bool initInfiniteRay(const Vec3r &orig, const Vec3r &dir, unsigned timestamp); - /*! Accessors */ + /** Accessors */ inline const Vec3r &getOrigin() const { return _orig; @@ -362,7 +362,7 @@ class Grid { } protected: - /*! Core of castRay and castInfiniteRay, find occluders along the given ray */ + /** Core of castRay and castInfiniteRay, find occluders along the given ray */ inline void castRayInternal(GridVisitor &visitor) { Cell *current_cell = NULL; @@ -383,7 +383,7 @@ class Grid { } while ((!visitor.stop()) && (nextRayCell(_current_cell, _current_cell))); } - /*! returns the cell next to the cell passed as argument. */ + /** returns the cell next to the cell passed as argument. */ bool nextRayCell(Vec3u ¤t_cell, Vec3u &next_cell); unsigned int _timestamp; diff --git a/source/blender/freestyle/intern/geometry/GridHelpers.h b/source/blender/freestyle/intern/geometry/GridHelpers.h index 077688164b4..1eab92be889 100644 --- a/source/blender/freestyle/intern/geometry/GridHelpers.h +++ b/source/blender/freestyle/intern/geometry/GridHelpers.h @@ -38,7 +38,7 @@ namespace Freestyle { namespace GridHelpers { -/*! Computes the distance from a point P to a segment AB */ +/** Computes the distance from a point P to a segment AB */ template<class T> T closestPointToSegment(const T &P, const T &A, const T &B, real &distance) { T AB, AP, BP; diff --git a/source/blender/freestyle/intern/geometry/HashGrid.h b/source/blender/freestyle/intern/geometry/HashGrid.h index 6fb7f2b9cbe..74df4a355d1 100644 --- a/source/blender/freestyle/intern/geometry/HashGrid.h +++ b/source/blender/freestyle/intern/geometry/HashGrid.h @@ -37,7 +37,7 @@ namespace Freestyle { -/*! Defines a hash table used for searching the Cells */ +/** Defines a hash table used for searching the Cells */ struct GridHasher { #define _MUL 950706376UL #define _MOD 2147483647UL @@ -51,7 +51,7 @@ struct GridHasher { #undef _MOD }; -/*! Class to define a regular grid used for ray casting computations */ +/** Class to define a regular grid used for ray casting computations */ class HashGrid : public Grid { public: typedef map<Vec3u, Cell *> GridHashTable; @@ -65,12 +65,12 @@ class HashGrid : public Grid { clear(); } - /*! clears the grid + /** clears the grid * Deletes all the cells, clears the hashtable, resets size, size of cell, number of cells. */ virtual void clear(); - /*! Sets the different parameters of the grid + /** Sets the different parameters of the grid * orig * The grid origin * size @@ -80,7 +80,7 @@ class HashGrid : public Grid { */ virtual void configure(const Vec3r &orig, const Vec3r &size, unsigned nb); - /*! returns the cell whose coordinates are passed as argument */ + /** returns the cell whose coordinates are passed as argument */ virtual Cell *getCell(const Vec3u &p) { Cell *found_cell = NULL; @@ -92,7 +92,7 @@ class HashGrid : public Grid { return found_cell; } - /*! Fills the case p with the cell iCell */ + /** Fills the case p with the cell iCell */ virtual void fillCell(const Vec3u &p, Cell &cell) { _cells[p] = &cell; diff --git a/source/blender/freestyle/intern/geometry/Noise.h b/source/blender/freestyle/intern/geometry/Noise.h index 27a91ded9e2..278444712df 100644 --- a/source/blender/freestyle/intern/geometry/Noise.h +++ b/source/blender/freestyle/intern/geometry/Noise.h @@ -37,33 +37,33 @@ namespace Freestyle { using namespace Geometry; -/*! Class to provide Perlin Noise functionalities */ +/** Class to provide Perlin Noise functionalities */ class Noise { public: - /*! Builds a Noise object */ + /** Builds a Noise object */ Noise(long seed = -1); - /*! Destructor */ + /** Destructor */ ~Noise() { } - /*! Returns a noise value for a 1D element */ + /** Returns a noise value for a 1D element */ float turbulence1(float arg, float freq, float amp, unsigned oct = 4); - /*! Returns a noise value for a 2D element */ + /** Returns a noise value for a 2D element */ float turbulence2(Vec2f &v, float freq, float amp, unsigned oct = 4); - /*! Returns a noise value for a 3D element */ + /** Returns a noise value for a 3D element */ float turbulence3(Vec3f &v, float freq, float amp, unsigned oct = 4); - /*! Returns a smooth noise value for a 1D element */ + /** Returns a smooth noise value for a 1D element */ float smoothNoise1(float arg); - /*! Returns a smooth noise value for a 2D element */ + /** Returns a smooth noise value for a 2D element */ float smoothNoise2(Vec2f &vec); - /*! Returns a smooth noise value for a 3D element */ + /** Returns a smooth noise value for a 3D element */ float smoothNoise3(Vec3f &vec); private: diff --git a/source/blender/freestyle/intern/geometry/Polygon.h b/source/blender/freestyle/intern/geometry/Polygon.h index f6f827fd0f2..34511bf4e34 100644 --- a/source/blender/freestyle/intern/geometry/Polygon.h +++ b/source/blender/freestyle/intern/geometry/Polygon.h @@ -205,7 +205,7 @@ class Polygon3r : public Polygon<Vec3r> { return _normal; } - /*! Check whether the Polygon intersects with the ray or not */ + /** Check whether the Polygon intersects with the ray or not */ inline bool rayIntersect(const Vec3r &orig, const Vec3r &dir, real &t, diff --git a/source/blender/freestyle/intern/geometry/SweepLine.h b/source/blender/freestyle/intern/geometry/SweepLine.h index d7d379d82f2..1beae73b68a 100644 --- a/source/blender/freestyle/intern/geometry/SweepLine.h +++ b/source/blender/freestyle/intern/geometry/SweepLine.h @@ -30,7 +30,7 @@ namespace Freestyle { -/*! Class to define the intersection between two segments*/ +/** Class to define the intersection between two segments. */ template<class Edge> class Intersection { public: template<class EdgeClass> Intersection(EdgeClass *eA, real ta, EdgeClass *eB, real tb) @@ -51,7 +51,7 @@ template<class Edge> class Intersection { userdata = 0; } - /*! returns the parameter giving the intersection, for the edge iEdge */ + /** returns the parameter giving the intersection, for the edge iEdge */ real getParameter(Edge *iEdge) { if (iEdge == EdgeA) { @@ -144,7 +144,7 @@ template<class T, class Point> class Segment { _Intersections.push_back(i); } - /*! Checks for a common vertex with another edge */ + /** Checks for a common vertex with another edge */ inline bool CommonVertex(const Segment<T, Point> &S, Point &CP) { if ((A == S[0]) || (A == S[1])) { @@ -190,7 +190,7 @@ template<class T, class Point> class Segment { # pragma warning(pop) #endif -/*! defines a binary function that can be overload by the user to specify at each condition the +/** defines a binary function that can be overload by the user to specify at each condition the * intersection between 2 edges must be computed */ template<class T1, class T2> struct binary_rule { diff --git a/source/blender/freestyle/intern/image/GaussianFilter.h b/source/blender/freestyle/intern/image/GaussianFilter.h index ff765e619a8..2cb3e7d7ac5 100644 --- a/source/blender/freestyle/intern/image/GaussianFilter.h +++ b/source/blender/freestyle/intern/image/GaussianFilter.h @@ -54,7 +54,7 @@ class GaussianFilter { GaussianFilter &operator=(const GaussianFilter &); virtual ~GaussianFilter(); - /*! Returns the value for pixel x,y of image "map" after a gaussian blur, made using the sigma + /** Returns the value for pixel x,y of image "map" after a gaussian blur, made using the sigma * value. The sigma value determines the mask size (~ 2 x sigma). * \param map: The image we wish to work on. * The Map template must implement the following methods: @@ -70,12 +70,12 @@ class GaussianFilter { */ template<class Map> float getSmoothedPixel(Map *map, int x, int y); - /*! Compute the mask size and returns the REAL mask size ((2*_maskSize)-1) + /** Compute the mask size and returns the REAL mask size ((2*_maskSize)-1) * This method is provided for convenience. */ static int computeMaskSize(float sigma); - /*! accessors */ + /** accessors */ inline float sigma() const { return _sigma; @@ -91,7 +91,7 @@ class GaussianFilter { return _bound; } - /*! modifiers */ + /** modifiers */ void setSigma(float sigma); #if 0 void SetMaskSize(int size) diff --git a/source/blender/freestyle/intern/image/Image.h b/source/blender/freestyle/intern/image/Image.h index 385e243a1a2..21cb435b13a 100644 --- a/source/blender/freestyle/intern/image/Image.h +++ b/source/blender/freestyle/intern/image/Image.h @@ -34,14 +34,14 @@ namespace Freestyle { // /////////////////////////////////////////////////////////////////////////////// -/*! This class allows the storing of part of an image, while allowing a normal access to its pixel +/** This class allows the storing of part of an image, while allowing a normal access to its pixel * values. You can for example only a rectangle of sw*sh, whose lower-left corner is at (ox, oy), * of an image of size w*h, and access these pixels using x,y coordinates specified in the whole * image coordinate system. */ class FrsImage { public: - /*! Default constructor */ + /** Default constructor */ FrsImage() { _storedWidth = 0; @@ -52,7 +52,7 @@ class FrsImage { _Oy = 0; } - /*! Copy constructor */ + /** Copy constructor */ FrsImage(const FrsImage &brother) { _storedWidth = brother._storedWidth; @@ -63,7 +63,7 @@ class FrsImage { _Oy = brother._Oy; } - /*! Builds an FrsImage from its width and height. + /** Builds an FrsImage from its width and height. * The memory is allocated consequently. */ FrsImage(unsigned w, unsigned h) @@ -76,7 +76,7 @@ class FrsImage { _Oy = 0; } - /*! Builds a partial-storing image. + /** Builds a partial-storing image. * \param w: * The width of the complete image * \param h: @@ -100,7 +100,7 @@ class FrsImage { _Oy = oy; } - /*! Operator= */ + /** Operator= */ FrsImage &operator=(const FrsImage &brother) { _width = brother._width; @@ -112,27 +112,27 @@ class FrsImage { return *this; } - /*! Destructor */ + /** Destructor */ virtual ~FrsImage() { } - /*! Returns the width of the complete image */ + /** Returns the width of the complete image */ inline unsigned width() const { return _width; } - /*! Returns the height of the complete image */ + /** Returns the height of the complete image */ inline unsigned height() const { return _height; } - /*! Returns the gray value for pixel x,y */ + /** Returns the gray value for pixel x,y */ virtual float pixel(unsigned x, unsigned y) const = 0; - /*! Sets the array. + /** Sets the array. * \param array: * The array containing the values we wish to store. * Its size is sw*sh. @@ -160,7 +160,7 @@ class FrsImage { unsigned y, bool copy = true) = 0; - /*! Returns the array containing the pixels values. + /** Returns the array containing the pixels values. * Its size is sw*sh, i.e. potentially a smaller rectangular part of the complete image. */ virtual float *getArray() = 0; @@ -206,7 +206,7 @@ class RGBImage : public FrsImage { memcpy(_rgb, rgb, 3 * _width * _height * sizeof(float)); } - /*! Builds an RGB partial image from the useful part buffer. + /** Builds an RGB partial image from the useful part buffer. * \param rgb: * The array of size 3*sw*sh containing the RGB values of the sw*sh pixels we need to stored. * These sw*sh pixels constitute a rectangular part of a bigger @@ -279,7 +279,7 @@ class RGBImage : public FrsImage { return res / 32.0f; } - /*! Sets the RGB array. + /** Sets the RGB array. * copy * If true, the array is copied, otherwise the pointer is copied */ @@ -333,7 +333,7 @@ class GrayImage : public FrsImage { memcpy(_lvl, brother._lvl, _storedWidth * _storedHeight * sizeof(*_lvl)); } - /*! Builds an empty gray image */ + /** Builds an empty gray image */ GrayImage(unsigned w, unsigned h) : FrsImage(w, h) { _lvl = new float[_width * _height]; @@ -345,7 +345,7 @@ class GrayImage : public FrsImage { memcpy(_lvl, lvl, _width * _height * sizeof(*_lvl)); } - /*! Builds a partial image from the useful part buffer. + /** Builds a partial image from the useful part buffer. * \param lvl: * The array of size sw*sh containing the gray values of the sw*sh pixels we need to stored. * These sw*sh pixels constitute a rectangular part of a bigger @@ -391,7 +391,7 @@ class GrayImage : public FrsImage { return _lvl[(y - _Oy) * _storedWidth + (x - _Ox)]; } - /*! Sets the array. + /** Sets the array. * copy * If true, the array is copied, otherwise the pounsigneder is copied */ @@ -418,7 +418,7 @@ class GrayImage : public FrsImage { memcpy(_lvl, lvl, _storedWidth * _storedHeight * sizeof(float)); } - /*! Returns the array containing the gray values. */ + /** Returns the array containing the gray values. */ virtual float *getArray() { return _lvl; diff --git a/source/blender/freestyle/intern/image/ImagePyramid.h b/source/blender/freestyle/intern/image/ImagePyramid.h index 3b4e5eda52a..66df1ec728a 100644 --- a/source/blender/freestyle/intern/image/ImagePyramid.h +++ b/source/blender/freestyle/intern/image/ImagePyramid.h @@ -45,17 +45,17 @@ class ImagePyramid { // ImagePyramid(const GrayImage& level0, unsigned nbLevels); virtual ~ImagePyramid(); - /*! Builds the pyramid. + /** Builds the pyramid. * must be overloaded by inherited classes. * if nbLevels==0, the complete pyramid is built */ virtual void BuildPyramid(const GrayImage &level0, unsigned nbLevels) = 0; - /*! Builds a pyramid without copying the base level */ + /** Builds a pyramid without copying the base level */ virtual void BuildPyramid(GrayImage *level0, unsigned nbLevels) = 0; virtual GrayImage *getLevel(int l); - /*! Returns the pixel x,y using bilinear interpolation. + /** Returns the pixel x,y using bilinear interpolation. * \param x: * the abscissa specified in the finest level coordinate system * \param y: @@ -65,13 +65,13 @@ class ImagePyramid { */ virtual float pixel(int x, int y, int level = 0); - /*! Returns the width of the level-th level image */ + /** Returns the width of the level-th level image */ virtual int width(int level = 0); - /*! Returns the height of the level-th level image */ + /** Returns the height of the level-th level image */ virtual int height(int level = 0); - /*! Returns the number of levels in the pyramid */ + /** Returns the number of levels in the pyramid */ inline int getNumberOfLevels() const { return _levels.size(); diff --git a/source/blender/freestyle/intern/python/BPy_BBox.cpp b/source/blender/freestyle/intern/python/BPy_BBox.cpp index 78431aa6728..509be04ee3f 100644 --- a/source/blender/freestyle/intern/python/BPy_BBox.cpp +++ b/source/blender/freestyle/intern/python/BPy_BBox.cpp @@ -91,7 +91,7 @@ PyTypeObject BBox_Type = { nullptr, /* tp_as_number */ nullptr, /* tp_as_sequence */ nullptr, /* tp_as_mapping */ - nullptr, /* tp_hash */ + nullptr, /* tp_hash */ nullptr, /* tp_call */ nullptr, /* tp_str */ nullptr, /* tp_getattro */ diff --git a/source/blender/freestyle/intern/python/BPy_BBox.h b/source/blender/freestyle/intern/python/BPy_BBox.h index 889dbc62a41..9d81a62bbcc 100644 --- a/source/blender/freestyle/intern/python/BPy_BBox.h +++ b/source/blender/freestyle/intern/python/BPy_BBox.h @@ -39,7 +39,8 @@ extern PyTypeObject BBox_Type; /*---------------------------Python BPy_BBox structure definition----------*/ typedef struct { - PyObject_HEAD Freestyle::BBox<Freestyle::Geometry::Vec3r> *bb; + PyObject_HEAD + Freestyle::BBox<Freestyle::Geometry::Vec3r> *bb; } BPy_BBox; /*---------------------------Python BPy_BBox visible prototypes-----------*/ diff --git a/source/blender/freestyle/intern/python/BPy_BinaryPredicate0D.cpp b/source/blender/freestyle/intern/python/BPy_BinaryPredicate0D.cpp index 652b576852d..6431fd3bcd9 100644 --- a/source/blender/freestyle/intern/python/BPy_BinaryPredicate0D.cpp +++ b/source/blender/freestyle/intern/python/BPy_BinaryPredicate0D.cpp @@ -163,7 +163,7 @@ PyTypeObject BinaryPredicate0D_Type = { nullptr, /* tp_as_number */ nullptr, /* tp_as_sequence */ nullptr, /* tp_as_mapping */ - nullptr, /* tp_hash */ + nullptr, /* tp_hash */ (ternaryfunc)BinaryPredicate0D___call__, /* tp_call */ nullptr, /* tp_str */ nullptr, /* tp_getattro */ diff --git a/source/blender/freestyle/intern/python/BPy_BinaryPredicate0D.h b/source/blender/freestyle/intern/python/BPy_BinaryPredicate0D.h index a368d4cd47e..0d494092388 100644 --- a/source/blender/freestyle/intern/python/BPy_BinaryPredicate0D.h +++ b/source/blender/freestyle/intern/python/BPy_BinaryPredicate0D.h @@ -39,7 +39,8 @@ extern PyTypeObject BinaryPredicate0D_Type; /*---------------------------Python BPy_BinaryPredicate0D structure definition----------*/ typedef struct { - PyObject_HEAD Freestyle::BinaryPredicate0D *bp0D; + PyObject_HEAD + Freestyle::BinaryPredicate0D *bp0D; } BPy_BinaryPredicate0D; /*---------------------------Python BPy_BinaryPredicate0D visible prototypes-----------*/ diff --git a/source/blender/freestyle/intern/python/BPy_BinaryPredicate1D.cpp b/source/blender/freestyle/intern/python/BPy_BinaryPredicate1D.cpp index 37762f1b8b3..a623d359189 100644 --- a/source/blender/freestyle/intern/python/BPy_BinaryPredicate1D.cpp +++ b/source/blender/freestyle/intern/python/BPy_BinaryPredicate1D.cpp @@ -197,7 +197,7 @@ PyTypeObject BinaryPredicate1D_Type = { nullptr, /* tp_as_number */ nullptr, /* tp_as_sequence */ nullptr, /* tp_as_mapping */ - nullptr, /* tp_hash */ + nullptr, /* tp_hash */ (ternaryfunc)BinaryPredicate1D___call__, /* tp_call */ nullptr, /* tp_str */ nullptr, /* tp_getattro */ diff --git a/source/blender/freestyle/intern/python/BPy_BinaryPredicate1D.h b/source/blender/freestyle/intern/python/BPy_BinaryPredicate1D.h index b34fad9e213..3e5ff76b5f9 100644 --- a/source/blender/freestyle/intern/python/BPy_BinaryPredicate1D.h +++ b/source/blender/freestyle/intern/python/BPy_BinaryPredicate1D.h @@ -39,7 +39,8 @@ extern PyTypeObject BinaryPredicate1D_Type; /*---------------------------Python BPy_BinaryPredicate1D structure definition----------*/ typedef struct { - PyObject_HEAD Freestyle::BinaryPredicate1D *bp1D; + PyObject_HEAD + Freestyle::BinaryPredicate1D *bp1D; } BPy_BinaryPredicate1D; /*---------------------------Python BPy_BinaryPredicate1D visible prototypes-----------*/ diff --git a/source/blender/freestyle/intern/python/BPy_FrsMaterial.cpp b/source/blender/freestyle/intern/python/BPy_FrsMaterial.cpp index 48b2ad767d2..deec1fb681d 100644 --- a/source/blender/freestyle/intern/python/BPy_FrsMaterial.cpp +++ b/source/blender/freestyle/intern/python/BPy_FrsMaterial.cpp @@ -548,7 +548,7 @@ PyTypeObject FrsMaterial_Type = { nullptr, /* tp_as_number */ nullptr, /* tp_as_sequence */ nullptr, /* tp_as_mapping */ - (hashfunc)FrsMaterial_hash, /* tp_hash */ + (hashfunc)FrsMaterial_hash, /* tp_hash */ nullptr, /* tp_call */ nullptr, /* tp_str */ nullptr, /* tp_getattro */ diff --git a/source/blender/freestyle/intern/python/BPy_FrsMaterial.h b/source/blender/freestyle/intern/python/BPy_FrsMaterial.h index 084fcef9a62..1104e2d5d77 100644 --- a/source/blender/freestyle/intern/python/BPy_FrsMaterial.h +++ b/source/blender/freestyle/intern/python/BPy_FrsMaterial.h @@ -39,7 +39,8 @@ extern PyTypeObject FrsMaterial_Type; /*---------------------------Python BPy_FrsMaterial structure definition----------*/ typedef struct { - PyObject_HEAD Freestyle::FrsMaterial *m; + PyObject_HEAD + Freestyle::FrsMaterial *m; } BPy_FrsMaterial; /*---------------------------Python BPy_FrsMaterial visible prototypes-----------*/ diff --git a/source/blender/freestyle/intern/python/BPy_FrsNoise.cpp b/source/blender/freestyle/intern/python/BPy_FrsNoise.cpp index 40127064875..4c339a54bb3 100644 --- a/source/blender/freestyle/intern/python/BPy_FrsNoise.cpp +++ b/source/blender/freestyle/intern/python/BPy_FrsNoise.cpp @@ -340,7 +340,7 @@ PyTypeObject FrsNoise_Type = { nullptr, /* tp_as_number */ nullptr, /* tp_as_sequence */ nullptr, /* tp_as_mapping */ - nullptr, /* tp_hash */ + nullptr, /* tp_hash */ nullptr, /* tp_call */ nullptr, /* tp_str */ nullptr, /* tp_getattro */ diff --git a/source/blender/freestyle/intern/python/BPy_FrsNoise.h b/source/blender/freestyle/intern/python/BPy_FrsNoise.h index 0f8f2d3242c..ac53282eb2a 100644 --- a/source/blender/freestyle/intern/python/BPy_FrsNoise.h +++ b/source/blender/freestyle/intern/python/BPy_FrsNoise.h @@ -39,7 +39,8 @@ extern PyTypeObject FrsNoise_Type; /*---------------------------Python BPy_FrsNoise structure definition----------*/ typedef struct { - PyObject_HEAD Freestyle::Noise *n; + PyObject_HEAD + Freestyle::Noise *n; Freestyle::PseudoNoise *pn; } BPy_FrsNoise; diff --git a/source/blender/freestyle/intern/python/BPy_Id.cpp b/source/blender/freestyle/intern/python/BPy_Id.cpp index 752bea16fb1..4b1d7c64fc4 100644 --- a/source/blender/freestyle/intern/python/BPy_Id.cpp +++ b/source/blender/freestyle/intern/python/BPy_Id.cpp @@ -181,7 +181,7 @@ PyTypeObject Id_Type = { nullptr, /* tp_as_number */ nullptr, /* tp_as_sequence */ nullptr, /* tp_as_mapping */ - nullptr, /* tp_hash */ + nullptr, /* tp_hash */ nullptr, /* tp_call */ nullptr, /* tp_str */ nullptr, /* tp_getattro */ diff --git a/source/blender/freestyle/intern/python/BPy_Id.h b/source/blender/freestyle/intern/python/BPy_Id.h index 51a70a391b1..e3c211381ca 100644 --- a/source/blender/freestyle/intern/python/BPy_Id.h +++ b/source/blender/freestyle/intern/python/BPy_Id.h @@ -40,7 +40,8 @@ extern PyTypeObject Id_Type; /*---------------------------Python BPy_Id structure definition----------*/ typedef struct { - PyObject_HEAD Freestyle::Id *id; + PyObject_HEAD + Freestyle::Id *id; } BPy_Id; /*---------------------------Python BPy_Id visible prototypes-----------*/ diff --git a/source/blender/freestyle/intern/python/BPy_IntegrationType.cpp b/source/blender/freestyle/intern/python/BPy_IntegrationType.cpp index 2af019e8fe2..92a03a017c5 100644 --- a/source/blender/freestyle/intern/python/BPy_IntegrationType.cpp +++ b/source/blender/freestyle/intern/python/BPy_IntegrationType.cpp @@ -163,7 +163,7 @@ PyTypeObject IntegrationType_Type = { nullptr, /* tp_as_number */ nullptr, /* tp_as_sequence */ nullptr, /* tp_as_mapping */ - nullptr, /* tp_hash */ + nullptr, /* tp_hash */ nullptr, /* tp_call */ nullptr, /* tp_str */ nullptr, /* tp_getattro */ diff --git a/source/blender/freestyle/intern/python/BPy_Interface0D.cpp b/source/blender/freestyle/intern/python/BPy_Interface0D.cpp index 9a86e61e623..2f2ba070932 100644 --- a/source/blender/freestyle/intern/python/BPy_Interface0D.cpp +++ b/source/blender/freestyle/intern/python/BPy_Interface0D.cpp @@ -323,7 +323,7 @@ PyTypeObject Interface0D_Type = { nullptr, /* tp_as_number */ nullptr, /* tp_as_sequence */ nullptr, /* tp_as_mapping */ - nullptr, /* tp_hash */ + nullptr, /* tp_hash */ nullptr, /* tp_call */ nullptr, /* tp_str */ nullptr, /* tp_getattro */ diff --git a/source/blender/freestyle/intern/python/BPy_Interface0D.h b/source/blender/freestyle/intern/python/BPy_Interface0D.h index 9734378f446..75a7e42e316 100644 --- a/source/blender/freestyle/intern/python/BPy_Interface0D.h +++ b/source/blender/freestyle/intern/python/BPy_Interface0D.h @@ -39,7 +39,8 @@ extern PyTypeObject Interface0D_Type; /*---------------------------Python BPy_Interface0D structure definition----------*/ typedef struct { - PyObject_HEAD Freestyle::Interface0D *if0D; + PyObject_HEAD + Freestyle::Interface0D *if0D; bool borrowed; /* true if *if0D is a borrowed object */ } BPy_Interface0D; diff --git a/source/blender/freestyle/intern/python/BPy_Interface1D.cpp b/source/blender/freestyle/intern/python/BPy_Interface1D.cpp index 61884ee63e5..10deca97273 100644 --- a/source/blender/freestyle/intern/python/BPy_Interface1D.cpp +++ b/source/blender/freestyle/intern/python/BPy_Interface1D.cpp @@ -351,7 +351,7 @@ PyTypeObject Interface1D_Type = { nullptr, /* tp_as_number */ nullptr, /* tp_as_sequence */ nullptr, /* tp_as_mapping */ - nullptr, /* tp_hash */ + nullptr, /* tp_hash */ nullptr, /* tp_call */ nullptr, /* tp_str */ nullptr, /* tp_getattro */ diff --git a/source/blender/freestyle/intern/python/BPy_Interface1D.h b/source/blender/freestyle/intern/python/BPy_Interface1D.h index 4ed562c24f7..ad6bb5aebec 100644 --- a/source/blender/freestyle/intern/python/BPy_Interface1D.h +++ b/source/blender/freestyle/intern/python/BPy_Interface1D.h @@ -39,7 +39,8 @@ extern PyTypeObject Interface1D_Type; /*---------------------------Python BPy_Interface1D structure definition----------*/ typedef struct { - PyObject_HEAD Freestyle::Interface1D *if1D; + PyObject_HEAD + Freestyle::Interface1D *if1D; bool borrowed; /* true if *if1D is a borrowed object */ } BPy_Interface1D; diff --git a/source/blender/freestyle/intern/python/BPy_Iterator.cpp b/source/blender/freestyle/intern/python/BPy_Iterator.cpp index bc6d8032ea2..2f69b8c3256 100644 --- a/source/blender/freestyle/intern/python/BPy_Iterator.cpp +++ b/source/blender/freestyle/intern/python/BPy_Iterator.cpp @@ -238,7 +238,7 @@ PyTypeObject Iterator_Type = { nullptr, /* tp_as_number */ nullptr, /* tp_as_sequence */ nullptr, /* tp_as_mapping */ - nullptr, /* tp_hash */ + nullptr, /* tp_hash */ nullptr, /* tp_call */ nullptr, /* tp_str */ nullptr, /* tp_getattro */ diff --git a/source/blender/freestyle/intern/python/BPy_Iterator.h b/source/blender/freestyle/intern/python/BPy_Iterator.h index 7094384140f..c7f64c3844e 100644 --- a/source/blender/freestyle/intern/python/BPy_Iterator.h +++ b/source/blender/freestyle/intern/python/BPy_Iterator.h @@ -38,7 +38,8 @@ extern PyTypeObject Iterator_Type; /*---------------------------Python BPy_Iterator structure definition----------*/ typedef struct { - PyObject_HEAD Freestyle::Iterator *it; + PyObject_HEAD + Freestyle::Iterator *it; } BPy_Iterator; /*---------------------------Python BPy_Iterator visible prototypes-----------*/ diff --git a/source/blender/freestyle/intern/python/BPy_MediumType.cpp b/source/blender/freestyle/intern/python/BPy_MediumType.cpp index d9d5e683c4f..eeb16433bff 100644 --- a/source/blender/freestyle/intern/python/BPy_MediumType.cpp +++ b/source/blender/freestyle/intern/python/BPy_MediumType.cpp @@ -55,7 +55,7 @@ PyTypeObject MediumType_Type = { nullptr, /* tp_as_number */ nullptr, /* tp_as_sequence */ nullptr, /* tp_as_mapping */ - nullptr, /* tp_hash */ + nullptr, /* tp_hash */ nullptr, /* tp_call */ nullptr, /* tp_str */ nullptr, /* tp_getattro */ diff --git a/source/blender/freestyle/intern/python/BPy_Nature.cpp b/source/blender/freestyle/intern/python/BPy_Nature.cpp index 45335f27619..6fe4789b09b 100644 --- a/source/blender/freestyle/intern/python/BPy_Nature.cpp +++ b/source/blender/freestyle/intern/python/BPy_Nature.cpp @@ -117,7 +117,7 @@ PyTypeObject Nature_Type = { &nature_as_number, /* tp_as_number */ nullptr, /* tp_as_sequence */ nullptr, /* tp_as_mapping */ - nullptr, /* tp_hash */ + nullptr, /* tp_hash */ nullptr, /* tp_call */ nullptr, /* tp_str */ nullptr, /* tp_getattro */ diff --git a/source/blender/freestyle/intern/python/BPy_Operators.cpp b/source/blender/freestyle/intern/python/BPy_Operators.cpp index 004fa118cf6..caf11bb5072 100644 --- a/source/blender/freestyle/intern/python/BPy_Operators.cpp +++ b/source/blender/freestyle/intern/python/BPy_Operators.cpp @@ -780,7 +780,7 @@ PyTypeObject Operators_Type = { nullptr, /* tp_as_number */ nullptr, /* tp_as_sequence */ nullptr, /* tp_as_mapping */ - nullptr, /* tp_hash */ + nullptr, /* tp_hash */ nullptr, /* tp_call */ nullptr, /* tp_str */ nullptr, /* tp_getattro */ diff --git a/source/blender/freestyle/intern/python/BPy_SShape.cpp b/source/blender/freestyle/intern/python/BPy_SShape.cpp index 0ea02d8a3f6..9ab3e634152 100644 --- a/source/blender/freestyle/intern/python/BPy_SShape.cpp +++ b/source/blender/freestyle/intern/python/BPy_SShape.cpp @@ -291,7 +291,7 @@ PyTypeObject SShape_Type = { nullptr, /* tp_as_number */ nullptr, /* tp_as_sequence */ nullptr, /* tp_as_mapping */ - nullptr, /* tp_hash */ + nullptr, /* tp_hash */ nullptr, /* tp_call */ nullptr, /* tp_str */ nullptr, /* tp_getattro */ diff --git a/source/blender/freestyle/intern/python/BPy_SShape.h b/source/blender/freestyle/intern/python/BPy_SShape.h index a6fb090a537..404d0ebc602 100644 --- a/source/blender/freestyle/intern/python/BPy_SShape.h +++ b/source/blender/freestyle/intern/python/BPy_SShape.h @@ -38,7 +38,8 @@ extern PyTypeObject SShape_Type; /*---------------------------Python BPy_SShape structure definition----------*/ typedef struct { - PyObject_HEAD Freestyle::SShape *ss; + PyObject_HEAD + Freestyle::SShape *ss; bool borrowed; /* true if *ss is a borrowed object */ } BPy_SShape; diff --git a/source/blender/freestyle/intern/python/BPy_StrokeAttribute.cpp b/source/blender/freestyle/intern/python/BPy_StrokeAttribute.cpp index 256fa5be290..54117115b95 100644 --- a/source/blender/freestyle/intern/python/BPy_StrokeAttribute.cpp +++ b/source/blender/freestyle/intern/python/BPy_StrokeAttribute.cpp @@ -687,7 +687,7 @@ PyTypeObject StrokeAttribute_Type = { nullptr, /* tp_as_number */ nullptr, /* tp_as_sequence */ nullptr, /* tp_as_mapping */ - nullptr, /* tp_hash */ + nullptr, /* tp_hash */ nullptr, /* tp_call */ nullptr, /* tp_str */ nullptr, /* tp_getattro */ diff --git a/source/blender/freestyle/intern/python/BPy_StrokeAttribute.h b/source/blender/freestyle/intern/python/BPy_StrokeAttribute.h index 9c0a7368dcb..b3280095e1e 100644 --- a/source/blender/freestyle/intern/python/BPy_StrokeAttribute.h +++ b/source/blender/freestyle/intern/python/BPy_StrokeAttribute.h @@ -39,7 +39,8 @@ extern PyTypeObject StrokeAttribute_Type; /*---------------------------Python BPy_StrokeAttribute structure definition----------*/ typedef struct { - PyObject_HEAD Freestyle::StrokeAttribute *sa; + PyObject_HEAD + Freestyle::StrokeAttribute *sa; bool borrowed; /* true if *sa is a borrowed reference */ } BPy_StrokeAttribute; diff --git a/source/blender/freestyle/intern/python/BPy_StrokeShader.cpp b/source/blender/freestyle/intern/python/BPy_StrokeShader.cpp index 9ce91b8a486..69795df9552 100644 --- a/source/blender/freestyle/intern/python/BPy_StrokeShader.cpp +++ b/source/blender/freestyle/intern/python/BPy_StrokeShader.cpp @@ -292,7 +292,7 @@ PyTypeObject StrokeShader_Type = { nullptr, /* tp_as_number */ nullptr, /* tp_as_sequence */ nullptr, /* tp_as_mapping */ - nullptr, /* tp_hash */ + nullptr, /* tp_hash */ nullptr, /* tp_call */ nullptr, /* tp_str */ nullptr, /* tp_getattro */ diff --git a/source/blender/freestyle/intern/python/BPy_StrokeShader.h b/source/blender/freestyle/intern/python/BPy_StrokeShader.h index 74c5df52312..0881c07caf1 100644 --- a/source/blender/freestyle/intern/python/BPy_StrokeShader.h +++ b/source/blender/freestyle/intern/python/BPy_StrokeShader.h @@ -41,7 +41,8 @@ extern PyTypeObject StrokeShader_Type; /*---------------------------Python BPy_StrokeShader structure definition----------*/ typedef struct { - PyObject_HEAD Freestyle::StrokeShader *ss; + PyObject_HEAD + Freestyle::StrokeShader *ss; } BPy_StrokeShader; /*---------------------------Python BPy_StrokeShader visible prototypes-----------*/ diff --git a/source/blender/freestyle/intern/python/BPy_UnaryFunction0D.cpp b/source/blender/freestyle/intern/python/BPy_UnaryFunction0D.cpp index 1bc569860aa..8b5a51ed3fb 100644 --- a/source/blender/freestyle/intern/python/BPy_UnaryFunction0D.cpp +++ b/source/blender/freestyle/intern/python/BPy_UnaryFunction0D.cpp @@ -134,7 +134,7 @@ PyTypeObject UnaryFunction0D_Type = { nullptr, /* tp_as_number */ nullptr, /* tp_as_sequence */ nullptr, /* tp_as_mapping */ - nullptr, /* tp_hash */ + nullptr, /* tp_hash */ nullptr, /* tp_call */ nullptr, /* tp_str */ nullptr, /* tp_getattro */ diff --git a/source/blender/freestyle/intern/python/BPy_UnaryFunction0D.h b/source/blender/freestyle/intern/python/BPy_UnaryFunction0D.h index ef3021faf48..86fd6b39ab8 100644 --- a/source/blender/freestyle/intern/python/BPy_UnaryFunction0D.h +++ b/source/blender/freestyle/intern/python/BPy_UnaryFunction0D.h @@ -39,7 +39,8 @@ extern PyTypeObject UnaryFunction0D_Type; /*---------------------------Python BPy_UnaryFunction0D structure definition----------*/ typedef struct { - PyObject_HEAD PyObject *py_uf0D; + PyObject_HEAD + PyObject *py_uf0D; } BPy_UnaryFunction0D; /*---------------------------Python BPy_UnaryFunction0D visible prototypes-----------*/ diff --git a/source/blender/freestyle/intern/python/BPy_UnaryFunction1D.cpp b/source/blender/freestyle/intern/python/BPy_UnaryFunction1D.cpp index c11640aa136..2464b852f52 100644 --- a/source/blender/freestyle/intern/python/BPy_UnaryFunction1D.cpp +++ b/source/blender/freestyle/intern/python/BPy_UnaryFunction1D.cpp @@ -128,7 +128,7 @@ PyTypeObject UnaryFunction1D_Type = { nullptr, /* tp_as_number */ nullptr, /* tp_as_sequence */ nullptr, /* tp_as_mapping */ - nullptr, /* tp_hash */ + nullptr, /* tp_hash */ nullptr, /* tp_call */ nullptr, /* tp_str */ nullptr, /* tp_getattro */ diff --git a/source/blender/freestyle/intern/python/BPy_UnaryFunction1D.h b/source/blender/freestyle/intern/python/BPy_UnaryFunction1D.h index 4613d58c2b7..12159c79885 100644 --- a/source/blender/freestyle/intern/python/BPy_UnaryFunction1D.h +++ b/source/blender/freestyle/intern/python/BPy_UnaryFunction1D.h @@ -39,7 +39,8 @@ extern PyTypeObject UnaryFunction1D_Type; /*---------------------------Python BPy_UnaryFunction1D structure definition----------*/ typedef struct { - PyObject_HEAD PyObject *py_uf1D; + PyObject_HEAD + PyObject *py_uf1D; } BPy_UnaryFunction1D; /*---------------------------Python BPy_UnaryFunction1D visible prototypes-----------*/ diff --git a/source/blender/freestyle/intern/python/BPy_UnaryPredicate0D.cpp b/source/blender/freestyle/intern/python/BPy_UnaryPredicate0D.cpp index cc9f666fbdd..e8aaf3d7ef3 100644 --- a/source/blender/freestyle/intern/python/BPy_UnaryPredicate0D.cpp +++ b/source/blender/freestyle/intern/python/BPy_UnaryPredicate0D.cpp @@ -177,7 +177,7 @@ PyTypeObject UnaryPredicate0D_Type = { nullptr, /* tp_as_number */ nullptr, /* tp_as_sequence */ nullptr, /* tp_as_mapping */ - nullptr, /* tp_hash */ + nullptr, /* tp_hash */ (ternaryfunc)UnaryPredicate0D___call__, /* tp_call */ nullptr, /* tp_str */ nullptr, /* tp_getattro */ diff --git a/source/blender/freestyle/intern/python/BPy_UnaryPredicate0D.h b/source/blender/freestyle/intern/python/BPy_UnaryPredicate0D.h index 3d45c2fc701..027994568b4 100644 --- a/source/blender/freestyle/intern/python/BPy_UnaryPredicate0D.h +++ b/source/blender/freestyle/intern/python/BPy_UnaryPredicate0D.h @@ -39,7 +39,8 @@ extern PyTypeObject UnaryPredicate0D_Type; /*---------------------------Python BPy_UnaryPredicate0D structure definition----------*/ typedef struct { - PyObject_HEAD Freestyle::UnaryPredicate0D *up0D; + PyObject_HEAD + Freestyle::UnaryPredicate0D *up0D; } BPy_UnaryPredicate0D; /*---------------------------Python BPy_UnaryPredicate0D visible prototypes-----------*/ diff --git a/source/blender/freestyle/intern/python/BPy_UnaryPredicate1D.cpp b/source/blender/freestyle/intern/python/BPy_UnaryPredicate1D.cpp index 41c0acc088c..82b1a04523e 100644 --- a/source/blender/freestyle/intern/python/BPy_UnaryPredicate1D.cpp +++ b/source/blender/freestyle/intern/python/BPy_UnaryPredicate1D.cpp @@ -235,7 +235,7 @@ PyTypeObject UnaryPredicate1D_Type = { nullptr, /* tp_as_number */ nullptr, /* tp_as_sequence */ nullptr, /* tp_as_mapping */ - nullptr, /* tp_hash */ + nullptr, /* tp_hash */ (ternaryfunc)UnaryPredicate1D___call__, /* tp_call */ nullptr, /* tp_str */ nullptr, /* tp_getattro */ diff --git a/source/blender/freestyle/intern/python/BPy_UnaryPredicate1D.h b/source/blender/freestyle/intern/python/BPy_UnaryPredicate1D.h index 0139ed8af77..0f8b00f7f3c 100644 --- a/source/blender/freestyle/intern/python/BPy_UnaryPredicate1D.h +++ b/source/blender/freestyle/intern/python/BPy_UnaryPredicate1D.h @@ -39,7 +39,8 @@ extern PyTypeObject UnaryPredicate1D_Type; /*---------------------------Python BPy_UnaryPredicate1D structure definition----------*/ typedef struct { - PyObject_HEAD Freestyle::UnaryPredicate1D *up1D; + PyObject_HEAD + Freestyle::UnaryPredicate1D *up1D; } BPy_UnaryPredicate1D; /*---------------------------Python BPy_UnaryPredicate1D visible prototypes-----------*/ diff --git a/source/blender/freestyle/intern/python/BPy_ViewMap.cpp b/source/blender/freestyle/intern/python/BPy_ViewMap.cpp index 269959a19c3..cf144b05d0e 100644 --- a/source/blender/freestyle/intern/python/BPy_ViewMap.cpp +++ b/source/blender/freestyle/intern/python/BPy_ViewMap.cpp @@ -194,7 +194,7 @@ PyTypeObject ViewMap_Type = { nullptr, /* tp_as_number */ nullptr, /* tp_as_sequence */ nullptr, /* tp_as_mapping */ - nullptr, /* tp_hash */ + nullptr, /* tp_hash */ nullptr, /* tp_call */ nullptr, /* tp_str */ nullptr, /* tp_getattro */ diff --git a/source/blender/freestyle/intern/python/BPy_ViewMap.h b/source/blender/freestyle/intern/python/BPy_ViewMap.h index 2222b327dc2..ac607957726 100644 --- a/source/blender/freestyle/intern/python/BPy_ViewMap.h +++ b/source/blender/freestyle/intern/python/BPy_ViewMap.h @@ -38,7 +38,8 @@ extern PyTypeObject ViewMap_Type; /*---------------------------Python BPy_ViewMap structure definition----------*/ typedef struct { - PyObject_HEAD Freestyle::ViewMap *vm; + PyObject_HEAD + Freestyle::ViewMap *vm; } BPy_ViewMap; /*---------------------------Python BPy_ViewMap visible prototypes-----------*/ diff --git a/source/blender/freestyle/intern/python/BPy_ViewShape.cpp b/source/blender/freestyle/intern/python/BPy_ViewShape.cpp index dd9d169dac2..6153dde26bd 100644 --- a/source/blender/freestyle/intern/python/BPy_ViewShape.cpp +++ b/source/blender/freestyle/intern/python/BPy_ViewShape.cpp @@ -362,7 +362,7 @@ PyTypeObject ViewShape_Type = { nullptr, /* tp_as_number */ nullptr, /* tp_as_sequence */ nullptr, /* tp_as_mapping */ - nullptr, /* tp_hash */ + nullptr, /* tp_hash */ nullptr, /* tp_call */ nullptr, /* tp_str */ nullptr, /* tp_getattro */ diff --git a/source/blender/freestyle/intern/python/BPy_ViewShape.h b/source/blender/freestyle/intern/python/BPy_ViewShape.h index 8401c4378f0..542e6d179a5 100644 --- a/source/blender/freestyle/intern/python/BPy_ViewShape.h +++ b/source/blender/freestyle/intern/python/BPy_ViewShape.h @@ -40,7 +40,8 @@ extern PyTypeObject ViewShape_Type; /*---------------------------Python BPy_ViewShape structure definition----------*/ typedef struct { - PyObject_HEAD Freestyle::ViewShape *vs; + PyObject_HEAD + Freestyle::ViewShape *vs; bool borrowed; /* true if *vs a borrowed object */ BPy_SShape *py_ss; } BPy_ViewShape; diff --git a/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_FalseBP1D.cpp b/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_FalseBP1D.cpp index ed09025a45e..c66ca1e9f43 100644 --- a/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_FalseBP1D.cpp +++ b/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_FalseBP1D.cpp @@ -69,7 +69,7 @@ PyTypeObject FalseBP1D_Type = { nullptr, /* tp_as_number */ nullptr, /* tp_as_sequence */ nullptr, /* tp_as_mapping */ - nullptr, /* tp_hash */ + nullptr, /* tp_hash */ nullptr, /* tp_call */ nullptr, /* tp_str */ nullptr, /* tp_getattro */ diff --git a/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_Length2DBP1D.cpp b/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_Length2DBP1D.cpp index 9d4f0693af9..6d52e435d3b 100644 --- a/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_Length2DBP1D.cpp +++ b/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_Length2DBP1D.cpp @@ -71,7 +71,7 @@ PyTypeObject Length2DBP1D_Type = { nullptr, /* tp_as_number */ nullptr, /* tp_as_sequence */ nullptr, /* tp_as_mapping */ - nullptr, /* tp_hash */ + nullptr, /* tp_hash */ nullptr, /* tp_call */ nullptr, /* tp_str */ nullptr, /* tp_getattro */ diff --git a/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_SameShapeIdBP1D.cpp b/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_SameShapeIdBP1D.cpp index 372d250c628..93ae6a59ee0 100644 --- a/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_SameShapeIdBP1D.cpp +++ b/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_SameShapeIdBP1D.cpp @@ -70,7 +70,7 @@ PyTypeObject SameShapeIdBP1D_Type = { nullptr, /* tp_as_number */ nullptr, /* tp_as_sequence */ nullptr, /* tp_as_mapping */ - nullptr, /* tp_hash */ + nullptr, /* tp_hash */ nullptr, /* tp_call */ nullptr, /* tp_str */ nullptr, /* tp_getattro */ diff --git a/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_TrueBP1D.cpp b/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_TrueBP1D.cpp index 04bd36738d1..30c3d9f2489 100644 --- a/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_TrueBP1D.cpp +++ b/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_TrueBP1D.cpp @@ -70,7 +70,7 @@ PyTypeObject TrueBP1D_Type = { nullptr, /* tp_as_number */ nullptr, /* tp_as_sequence */ nullptr, /* tp_as_mapping */ - nullptr, /* tp_hash */ + nullptr, /* tp_hash */ nullptr, /* tp_call */ nullptr, /* tp_str */ nullptr, /* tp_getattro */ diff --git a/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_ViewMapGradientNormBP1D.cpp b/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_ViewMapGradientNormBP1D.cpp index 337d0fa3020..7b3b291bb61 100644 --- a/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_ViewMapGradientNormBP1D.cpp +++ b/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_ViewMapGradientNormBP1D.cpp @@ -100,7 +100,7 @@ PyTypeObject ViewMapGradientNormBP1D_Type = { nullptr, /* tp_as_number */ nullptr, /* tp_as_sequence */ nullptr, /* tp_as_mapping */ - nullptr, /* tp_hash */ + nullptr, /* tp_hash */ nullptr, /* tp_call */ nullptr, /* tp_str */ nullptr, /* tp_getattro */ diff --git a/source/blender/freestyle/intern/python/Interface0D/BPy_CurvePoint.cpp b/source/blender/freestyle/intern/python/Interface0D/BPy_CurvePoint.cpp index 2367c3f9cb5..945215d3eea 100644 --- a/source/blender/freestyle/intern/python/Interface0D/BPy_CurvePoint.cpp +++ b/source/blender/freestyle/intern/python/Interface0D/BPy_CurvePoint.cpp @@ -252,7 +252,7 @@ PyTypeObject CurvePoint_Type = { nullptr, /* tp_as_number */ nullptr, /* tp_as_sequence */ nullptr, /* tp_as_mapping */ - nullptr, /* tp_hash */ + nullptr, /* tp_hash */ nullptr, /* tp_call */ nullptr, /* tp_str */ nullptr, /* tp_getattro */ diff --git a/source/blender/freestyle/intern/python/Interface0D/BPy_SVertex.cpp b/source/blender/freestyle/intern/python/Interface0D/BPy_SVertex.cpp index 4f1b57915b2..7d2874e5d85 100644 --- a/source/blender/freestyle/intern/python/Interface0D/BPy_SVertex.cpp +++ b/source/blender/freestyle/intern/python/Interface0D/BPy_SVertex.cpp @@ -465,7 +465,7 @@ PyTypeObject SVertex_Type = { nullptr, /* tp_as_number */ nullptr, /* tp_as_sequence */ nullptr, /* tp_as_mapping */ - nullptr, /* tp_hash */ + nullptr, /* tp_hash */ nullptr, /* tp_call */ nullptr, /* tp_str */ nullptr, /* tp_getattro */ diff --git a/source/blender/freestyle/intern/python/Interface0D/BPy_ViewVertex.cpp b/source/blender/freestyle/intern/python/Interface0D/BPy_ViewVertex.cpp index 600ee37aa55..cd831417577 100644 --- a/source/blender/freestyle/intern/python/Interface0D/BPy_ViewVertex.cpp +++ b/source/blender/freestyle/intern/python/Interface0D/BPy_ViewVertex.cpp @@ -174,7 +174,7 @@ PyTypeObject ViewVertex_Type = { nullptr, /* tp_as_number */ nullptr, /* tp_as_sequence */ nullptr, /* tp_as_mapping */ - nullptr, /* tp_hash */ + nullptr, /* tp_hash */ nullptr, /* tp_call */ nullptr, /* tp_str */ nullptr, /* tp_getattro */ diff --git a/source/blender/freestyle/intern/python/Interface0D/CurvePoint/BPy_StrokeVertex.cpp b/source/blender/freestyle/intern/python/Interface0D/CurvePoint/BPy_StrokeVertex.cpp index 79e537d48c0..6104005464c 100644 --- a/source/blender/freestyle/intern/python/Interface0D/CurvePoint/BPy_StrokeVertex.cpp +++ b/source/blender/freestyle/intern/python/Interface0D/CurvePoint/BPy_StrokeVertex.cpp @@ -371,7 +371,7 @@ PyTypeObject StrokeVertex_Type = { nullptr, /* tp_as_number */ nullptr, /* tp_as_sequence */ nullptr, /* tp_as_mapping */ - nullptr, /* tp_hash */ + nullptr, /* tp_hash */ nullptr, /* tp_call */ nullptr, /* tp_str */ nullptr, /* tp_getattro */ diff --git a/source/blender/freestyle/intern/python/Interface0D/ViewVertex/BPy_NonTVertex.cpp b/source/blender/freestyle/intern/python/Interface0D/ViewVertex/BPy_NonTVertex.cpp index 7b782b513b6..3c0ee9fd9a3 100644 --- a/source/blender/freestyle/intern/python/Interface0D/ViewVertex/BPy_NonTVertex.cpp +++ b/source/blender/freestyle/intern/python/Interface0D/ViewVertex/BPy_NonTVertex.cpp @@ -119,7 +119,7 @@ PyTypeObject NonTVertex_Type = { nullptr, /* tp_as_number */ nullptr, /* tp_as_sequence */ nullptr, /* tp_as_mapping */ - nullptr, /* tp_hash */ + nullptr, /* tp_hash */ nullptr, /* tp_call */ nullptr, /* tp_str */ nullptr, /* tp_getattro */ diff --git a/source/blender/freestyle/intern/python/Interface0D/ViewVertex/BPy_TVertex.cpp b/source/blender/freestyle/intern/python/Interface0D/ViewVertex/BPy_TVertex.cpp index eecede4f1f3..9fe39b3e359 100644 --- a/source/blender/freestyle/intern/python/Interface0D/ViewVertex/BPy_TVertex.cpp +++ b/source/blender/freestyle/intern/python/Interface0D/ViewVertex/BPy_TVertex.cpp @@ -229,7 +229,7 @@ PyTypeObject TVertex_Type = { nullptr, /* tp_as_number */ nullptr, /* tp_as_sequence */ nullptr, /* tp_as_mapping */ - nullptr, /* tp_hash */ + nullptr, /* tp_hash */ nullptr, /* tp_call */ nullptr, /* tp_str */ nullptr, /* tp_getattro */ diff --git a/source/blender/freestyle/intern/python/Interface1D/BPy_FEdge.cpp b/source/blender/freestyle/intern/python/Interface1D/BPy_FEdge.cpp index e8f80f515df..be529953815 100644 --- a/source/blender/freestyle/intern/python/Interface1D/BPy_FEdge.cpp +++ b/source/blender/freestyle/intern/python/Interface1D/BPy_FEdge.cpp @@ -368,7 +368,7 @@ PyTypeObject FEdge_Type = { nullptr, /* tp_as_number */ &BPy_FEdge_as_sequence, /* tp_as_sequence */ nullptr, /* tp_as_mapping */ - nullptr, /* tp_hash */ + nullptr, /* tp_hash */ nullptr, /* tp_call */ nullptr, /* tp_str */ nullptr, /* tp_getattro */ diff --git a/source/blender/freestyle/intern/python/Interface1D/BPy_FrsCurve.cpp b/source/blender/freestyle/intern/python/Interface1D/BPy_FrsCurve.cpp index bf7feb7be27..fe25051b924 100644 --- a/source/blender/freestyle/intern/python/Interface1D/BPy_FrsCurve.cpp +++ b/source/blender/freestyle/intern/python/Interface1D/BPy_FrsCurve.cpp @@ -200,7 +200,7 @@ PyTypeObject FrsCurve_Type = { nullptr, /* tp_as_number */ nullptr, /* tp_as_sequence */ nullptr, /* tp_as_mapping */ - nullptr, /* tp_hash */ + nullptr, /* tp_hash */ nullptr, /* tp_call */ nullptr, /* tp_str */ nullptr, /* tp_getattro */ diff --git a/source/blender/freestyle/intern/python/Interface1D/BPy_Stroke.cpp b/source/blender/freestyle/intern/python/Interface1D/BPy_Stroke.cpp index 8df40087f9b..62641499740 100644 --- a/source/blender/freestyle/intern/python/Interface1D/BPy_Stroke.cpp +++ b/source/blender/freestyle/intern/python/Interface1D/BPy_Stroke.cpp @@ -511,7 +511,7 @@ PyTypeObject Stroke_Type = { nullptr, /* tp_as_number */ &BPy_Stroke_as_sequence, /* tp_as_sequence */ nullptr, /* tp_as_mapping */ - nullptr, /* tp_hash */ + nullptr, /* tp_hash */ nullptr, /* tp_call */ nullptr, /* tp_str */ nullptr, /* tp_getattro */ diff --git a/source/blender/freestyle/intern/python/Interface1D/BPy_ViewEdge.cpp b/source/blender/freestyle/intern/python/Interface1D/BPy_ViewEdge.cpp index eee5dc095a6..dee587407a7 100644 --- a/source/blender/freestyle/intern/python/Interface1D/BPy_ViewEdge.cpp +++ b/source/blender/freestyle/intern/python/Interface1D/BPy_ViewEdge.cpp @@ -396,7 +396,7 @@ PyTypeObject ViewEdge_Type = { nullptr, /* tp_as_number */ nullptr, /* tp_as_sequence */ nullptr, /* tp_as_mapping */ - nullptr, /* tp_hash */ + nullptr, /* tp_hash */ nullptr, /* tp_call */ nullptr, /* tp_str */ nullptr, /* tp_getattro */ diff --git a/source/blender/freestyle/intern/python/Interface1D/Curve/BPy_Chain.cpp b/source/blender/freestyle/intern/python/Interface1D/Curve/BPy_Chain.cpp index 5de2f435469..a1cf5c5146b 100644 --- a/source/blender/freestyle/intern/python/Interface1D/Curve/BPy_Chain.cpp +++ b/source/blender/freestyle/intern/python/Interface1D/Curve/BPy_Chain.cpp @@ -160,7 +160,7 @@ PyTypeObject Chain_Type = { nullptr, /* tp_as_number */ nullptr, /* tp_as_sequence */ nullptr, /* tp_as_mapping */ - nullptr, /* tp_hash */ + nullptr, /* tp_hash */ nullptr, /* tp_call */ nullptr, /* tp_str */ nullptr, /* tp_getattro */ diff --git a/source/blender/freestyle/intern/python/Interface1D/FEdge/BPy_FEdgeSharp.cpp b/source/blender/freestyle/intern/python/Interface1D/FEdge/BPy_FEdgeSharp.cpp index 538e5d3bf85..93958b626bf 100644 --- a/source/blender/freestyle/intern/python/Interface1D/FEdge/BPy_FEdgeSharp.cpp +++ b/source/blender/freestyle/intern/python/Interface1D/FEdge/BPy_FEdgeSharp.cpp @@ -418,7 +418,7 @@ PyTypeObject FEdgeSharp_Type = { nullptr, /* tp_as_number */ nullptr, /* tp_as_sequence */ nullptr, /* tp_as_mapping */ - nullptr, /* tp_hash */ + nullptr, /* tp_hash */ nullptr, /* tp_call */ nullptr, /* tp_str */ nullptr, /* tp_getattro */ diff --git a/source/blender/freestyle/intern/python/Interface1D/FEdge/BPy_FEdgeSmooth.cpp b/source/blender/freestyle/intern/python/Interface1D/FEdge/BPy_FEdgeSmooth.cpp index 8f244fb203d..b4651345297 100644 --- a/source/blender/freestyle/intern/python/Interface1D/FEdge/BPy_FEdgeSmooth.cpp +++ b/source/blender/freestyle/intern/python/Interface1D/FEdge/BPy_FEdgeSmooth.cpp @@ -263,7 +263,7 @@ PyTypeObject FEdgeSmooth_Type = { nullptr, /* tp_as_number */ nullptr, /* tp_as_sequence */ nullptr, /* tp_as_mapping */ - nullptr, /* tp_hash */ + nullptr, /* tp_hash */ nullptr, /* tp_call */ nullptr, /* tp_str */ nullptr, /* tp_getattro */ diff --git a/source/blender/freestyle/intern/python/Iterator/BPy_AdjacencyIterator.cpp b/source/blender/freestyle/intern/python/Iterator/BPy_AdjacencyIterator.cpp index 6945e3f2b51..a7406b080dd 100644 --- a/source/blender/freestyle/intern/python/Iterator/BPy_AdjacencyIterator.cpp +++ b/source/blender/freestyle/intern/python/Iterator/BPy_AdjacencyIterator.cpp @@ -196,7 +196,7 @@ PyTypeObject AdjacencyIterator_Type = { nullptr, /* tp_as_number */ nullptr, /* tp_as_sequence */ nullptr, /* tp_as_mapping */ - nullptr, /* tp_hash */ + nullptr, /* tp_hash */ nullptr, /* tp_call */ nullptr, /* tp_str */ nullptr, /* tp_getattro */ diff --git a/source/blender/freestyle/intern/python/Iterator/BPy_ChainPredicateIterator.cpp b/source/blender/freestyle/intern/python/Iterator/BPy_ChainPredicateIterator.cpp index 94d8952ef42..7c64420a058 100644 --- a/source/blender/freestyle/intern/python/Iterator/BPy_ChainPredicateIterator.cpp +++ b/source/blender/freestyle/intern/python/Iterator/BPy_ChainPredicateIterator.cpp @@ -177,7 +177,7 @@ PyTypeObject ChainPredicateIterator_Type = { nullptr, /* tp_as_number */ nullptr, /* tp_as_sequence */ nullptr, /* tp_as_mapping */ - nullptr, /* tp_hash */ + nullptr, /* tp_hash */ nullptr, /* tp_call */ nullptr, /* tp_str */ nullptr, /* tp_getattro */ diff --git a/source/blender/freestyle/intern/python/Iterator/BPy_ChainSilhouetteIterator.cpp b/source/blender/freestyle/intern/python/Iterator/BPy_ChainSilhouetteIterator.cpp index 36c251bb916..594d4c4fd5e 100644 --- a/source/blender/freestyle/intern/python/Iterator/BPy_ChainSilhouetteIterator.cpp +++ b/source/blender/freestyle/intern/python/Iterator/BPy_ChainSilhouetteIterator.cpp @@ -131,7 +131,7 @@ PyTypeObject ChainSilhouetteIterator_Type = { nullptr, /* tp_as_number */ nullptr, /* tp_as_sequence */ nullptr, /* tp_as_mapping */ - nullptr, /* tp_hash */ + nullptr, /* tp_hash */ nullptr, /* tp_call */ nullptr, /* tp_str */ nullptr, /* tp_getattro */ diff --git a/source/blender/freestyle/intern/python/Iterator/BPy_ChainingIterator.cpp b/source/blender/freestyle/intern/python/Iterator/BPy_ChainingIterator.cpp index 10b3ccdc496..907a411788f 100644 --- a/source/blender/freestyle/intern/python/Iterator/BPy_ChainingIterator.cpp +++ b/source/blender/freestyle/intern/python/Iterator/BPy_ChainingIterator.cpp @@ -265,7 +265,7 @@ PyTypeObject ChainingIterator_Type = { nullptr, /* tp_as_number */ nullptr, /* tp_as_sequence */ nullptr, /* tp_as_mapping */ - nullptr, /* tp_hash */ + nullptr, /* tp_hash */ nullptr, /* tp_call */ nullptr, /* tp_str */ nullptr, /* tp_getattro */ diff --git a/source/blender/freestyle/intern/python/Iterator/BPy_CurvePointIterator.cpp b/source/blender/freestyle/intern/python/Iterator/BPy_CurvePointIterator.cpp index 4c93b8337cf..57172a9006d 100644 --- a/source/blender/freestyle/intern/python/Iterator/BPy_CurvePointIterator.cpp +++ b/source/blender/freestyle/intern/python/Iterator/BPy_CurvePointIterator.cpp @@ -145,7 +145,7 @@ PyTypeObject CurvePointIterator_Type = { nullptr, /* tp_as_number */ nullptr, /* tp_as_sequence */ nullptr, /* tp_as_mapping */ - nullptr, /* tp_hash */ + nullptr, /* tp_hash */ nullptr, /* tp_call */ nullptr, /* tp_str */ nullptr, /* tp_getattro */ diff --git a/source/blender/freestyle/intern/python/Iterator/BPy_Interface0DIterator.cpp b/source/blender/freestyle/intern/python/Iterator/BPy_Interface0DIterator.cpp index 2ac3857375a..2201da36b8a 100644 --- a/source/blender/freestyle/intern/python/Iterator/BPy_Interface0DIterator.cpp +++ b/source/blender/freestyle/intern/python/Iterator/BPy_Interface0DIterator.cpp @@ -220,7 +220,7 @@ PyTypeObject Interface0DIterator_Type = { nullptr, /* tp_as_number */ nullptr, /* tp_as_sequence */ nullptr, /* tp_as_mapping */ - nullptr, /* tp_hash */ + nullptr, /* tp_hash */ nullptr, /* tp_call */ nullptr, /* tp_str */ nullptr, /* tp_getattro */ diff --git a/source/blender/freestyle/intern/python/Iterator/BPy_SVertexIterator.cpp b/source/blender/freestyle/intern/python/Iterator/BPy_SVertexIterator.cpp index ffb90281442..6666d742415 100644 --- a/source/blender/freestyle/intern/python/Iterator/BPy_SVertexIterator.cpp +++ b/source/blender/freestyle/intern/python/Iterator/BPy_SVertexIterator.cpp @@ -172,7 +172,7 @@ PyTypeObject SVertexIterator_Type = { nullptr, /* tp_as_number */ nullptr, /* tp_as_sequence */ nullptr, /* tp_as_mapping */ - nullptr, /* tp_hash */ + nullptr, /* tp_hash */ nullptr, /* tp_call */ nullptr, /* tp_str */ nullptr, /* tp_getattro */ diff --git a/source/blender/freestyle/intern/python/Iterator/BPy_StrokeVertexIterator.cpp b/source/blender/freestyle/intern/python/Iterator/BPy_StrokeVertexIterator.cpp index f94ab4d3b8f..2d0ce0d54c6 100644 --- a/source/blender/freestyle/intern/python/Iterator/BPy_StrokeVertexIterator.cpp +++ b/source/blender/freestyle/intern/python/Iterator/BPy_StrokeVertexIterator.cpp @@ -303,7 +303,7 @@ PyTypeObject StrokeVertexIterator_Type = { nullptr, /* tp_as_number */ nullptr, /* tp_as_sequence */ nullptr, /* tp_as_mapping */ - nullptr, /* tp_hash */ + nullptr, /* tp_hash */ nullptr, /* tp_call */ nullptr, /* tp_str */ nullptr, /* tp_getattro */ diff --git a/source/blender/freestyle/intern/python/Iterator/BPy_ViewEdgeIterator.cpp b/source/blender/freestyle/intern/python/Iterator/BPy_ViewEdgeIterator.cpp index c878178f9ca..391ebae4cdd 100644 --- a/source/blender/freestyle/intern/python/Iterator/BPy_ViewEdgeIterator.cpp +++ b/source/blender/freestyle/intern/python/Iterator/BPy_ViewEdgeIterator.cpp @@ -250,7 +250,7 @@ PyTypeObject ViewEdgeIterator_Type = { nullptr, /* tp_as_number */ nullptr, /* tp_as_sequence */ nullptr, /* tp_as_mapping */ - nullptr, /* tp_hash */ + nullptr, /* tp_hash */ nullptr, /* tp_call */ nullptr, /* tp_str */ nullptr, /* tp_getattro */ diff --git a/source/blender/freestyle/intern/python/Iterator/BPy_orientedViewEdgeIterator.cpp b/source/blender/freestyle/intern/python/Iterator/BPy_orientedViewEdgeIterator.cpp index 5da124ce40a..e33f2c3fd88 100644 --- a/source/blender/freestyle/intern/python/Iterator/BPy_orientedViewEdgeIterator.cpp +++ b/source/blender/freestyle/intern/python/Iterator/BPy_orientedViewEdgeIterator.cpp @@ -154,7 +154,7 @@ PyTypeObject orientedViewEdgeIterator_Type = { nullptr, /* tp_as_number */ nullptr, /* tp_as_sequence */ nullptr, /* tp_as_mapping */ - nullptr, /* tp_hash */ + nullptr, /* tp_hash */ nullptr, /* tp_call */ nullptr, /* tp_str */ nullptr, /* tp_getattro */ diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_BackboneStretcherShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_BackboneStretcherShader.cpp index 2171b7bb2b9..ff0fed08e0f 100644 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_BackboneStretcherShader.cpp +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_BackboneStretcherShader.cpp @@ -81,7 +81,7 @@ PyTypeObject BackboneStretcherShader_Type = { nullptr, /* tp_as_number */ nullptr, /* tp_as_sequence */ nullptr, /* tp_as_mapping */ - nullptr, /* tp_hash */ + nullptr, /* tp_hash */ nullptr, /* tp_call */ nullptr, /* tp_str */ nullptr, /* tp_getattro */ diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_BezierCurveShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_BezierCurveShader.cpp index 69f1814e38e..2a610e375ee 100644 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_BezierCurveShader.cpp +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_BezierCurveShader.cpp @@ -81,7 +81,7 @@ PyTypeObject BezierCurveShader_Type = { nullptr, /* tp_as_number */ nullptr, /* tp_as_sequence */ nullptr, /* tp_as_mapping */ - nullptr, /* tp_hash */ + nullptr, /* tp_hash */ nullptr, /* tp_call */ nullptr, /* tp_str */ nullptr, /* tp_getattro */ diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_BlenderTextureShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_BlenderTextureShader.cpp index 06785ca5617..fcf415a82fd 100644 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_BlenderTextureShader.cpp +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_BlenderTextureShader.cpp @@ -101,7 +101,7 @@ PyTypeObject BlenderTextureShader_Type = { nullptr, /* tp_as_number */ nullptr, /* tp_as_sequence */ nullptr, /* tp_as_mapping */ - nullptr, /* tp_hash */ + nullptr, /* tp_hash */ nullptr, /* tp_call */ nullptr, /* tp_str */ nullptr, /* tp_getattro */ diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_CalligraphicShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_CalligraphicShader.cpp index a5aa5e188ff..ab9aa2ffa94 100644 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_CalligraphicShader.cpp +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_CalligraphicShader.cpp @@ -99,7 +99,7 @@ PyTypeObject CalligraphicShader_Type = { nullptr, /* tp_as_number */ nullptr, /* tp_as_sequence */ nullptr, /* tp_as_mapping */ - nullptr, /* tp_hash */ + nullptr, /* tp_hash */ nullptr, /* tp_call */ nullptr, /* tp_str */ nullptr, /* tp_getattro */ diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_ColorNoiseShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_ColorNoiseShader.cpp index 2642f109acf..05a98c20f52 100644 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_ColorNoiseShader.cpp +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_ColorNoiseShader.cpp @@ -80,7 +80,7 @@ PyTypeObject ColorNoiseShader_Type = { nullptr, /* tp_as_number */ nullptr, /* tp_as_sequence */ nullptr, /* tp_as_mapping */ - nullptr, /* tp_hash */ + nullptr, /* tp_hash */ nullptr, /* tp_call */ nullptr, /* tp_str */ nullptr, /* tp_getattro */ diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_ConstantColorShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_ConstantColorShader.cpp index a1e20542acf..6b19590a169 100644 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_ConstantColorShader.cpp +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_ConstantColorShader.cpp @@ -86,7 +86,7 @@ PyTypeObject ConstantColorShader_Type = { nullptr, /* tp_as_number */ nullptr, /* tp_as_sequence */ nullptr, /* tp_as_mapping */ - nullptr, /* tp_hash */ + nullptr, /* tp_hash */ nullptr, /* tp_call */ nullptr, /* tp_str */ nullptr, /* tp_getattro */ diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_ConstantThicknessShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_ConstantThicknessShader.cpp index 6e338a5f6be..795ec2fb87e 100644 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_ConstantThicknessShader.cpp +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_ConstantThicknessShader.cpp @@ -80,7 +80,7 @@ PyTypeObject ConstantThicknessShader_Type = { nullptr, /* tp_as_number */ nullptr, /* tp_as_sequence */ nullptr, /* tp_as_mapping */ - nullptr, /* tp_hash */ + nullptr, /* tp_hash */ nullptr, /* tp_call */ nullptr, /* tp_str */ nullptr, /* tp_getattro */ diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_ConstrainedIncreasingThicknessShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_ConstrainedIncreasingThicknessShader.cpp index db4b6df6cb4..780f9255b4a 100644 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_ConstrainedIncreasingThicknessShader.cpp +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_ConstrainedIncreasingThicknessShader.cpp @@ -86,7 +86,7 @@ PyTypeObject ConstrainedIncreasingThicknessShader_Type = { nullptr, /* tp_as_number */ nullptr, /* tp_as_sequence */ nullptr, /* tp_as_mapping */ - nullptr, /* tp_hash */ + nullptr, /* tp_hash */ nullptr, /* tp_call */ nullptr, /* tp_str */ nullptr, /* tp_getattro */ diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_GuidingLinesShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_GuidingLinesShader.cpp index 7365c369fb3..3fc16d9d0ea 100644 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_GuidingLinesShader.cpp +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_GuidingLinesShader.cpp @@ -88,7 +88,7 @@ PyTypeObject GuidingLinesShader_Type = { nullptr, /* tp_as_number */ nullptr, /* tp_as_sequence */ nullptr, /* tp_as_mapping */ - nullptr, /* tp_hash */ + nullptr, /* tp_hash */ nullptr, /* tp_call */ nullptr, /* tp_str */ nullptr, /* tp_getattro */ diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_IncreasingColorShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_IncreasingColorShader.cpp index d6f33c3a295..f6ae0330b48 100644 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_IncreasingColorShader.cpp +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_IncreasingColorShader.cpp @@ -108,7 +108,7 @@ PyTypeObject IncreasingColorShader_Type = { nullptr, /* tp_as_number */ nullptr, /* tp_as_sequence */ nullptr, /* tp_as_mapping */ - nullptr, /* tp_hash */ + nullptr, /* tp_hash */ nullptr, /* tp_call */ nullptr, /* tp_str */ nullptr, /* tp_getattro */ diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_IncreasingThicknessShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_IncreasingThicknessShader.cpp index 296d3fb0713..fa60aba34e4 100644 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_IncreasingThicknessShader.cpp +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_IncreasingThicknessShader.cpp @@ -86,7 +86,7 @@ PyTypeObject IncreasingThicknessShader_Type = { nullptr, /* tp_as_number */ nullptr, /* tp_as_sequence */ nullptr, /* tp_as_mapping */ - nullptr, /* tp_hash */ + nullptr, /* tp_hash */ nullptr, /* tp_call */ nullptr, /* tp_str */ nullptr, /* tp_getattro */ diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_PolygonalizationShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_PolygonalizationShader.cpp index 68c14e1151c..2ba49289607 100644 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_PolygonalizationShader.cpp +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_PolygonalizationShader.cpp @@ -87,7 +87,7 @@ PyTypeObject PolygonalizationShader_Type = { nullptr, /* tp_as_number */ nullptr, /* tp_as_sequence */ nullptr, /* tp_as_mapping */ - nullptr, /* tp_hash */ + nullptr, /* tp_hash */ nullptr, /* tp_call */ nullptr, /* tp_str */ nullptr, /* tp_getattro */ diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_SamplingShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_SamplingShader.cpp index e4aeb612cc4..fc50c9f1e02 100644 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_SamplingShader.cpp +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_SamplingShader.cpp @@ -78,7 +78,7 @@ PyTypeObject SamplingShader_Type = { nullptr, /* tp_as_number */ nullptr, /* tp_as_sequence */ nullptr, /* tp_as_mapping */ - nullptr, /* tp_hash */ + nullptr, /* tp_hash */ nullptr, /* tp_call */ nullptr, /* tp_str */ nullptr, /* tp_getattro */ diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_SmoothingShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_SmoothingShader.cpp index 55aee8b8a56..ab39b9ad883 100644 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_SmoothingShader.cpp +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_SmoothingShader.cpp @@ -110,7 +110,7 @@ PyTypeObject SmoothingShader_Type = { nullptr, /* tp_as_number */ nullptr, /* tp_as_sequence */ nullptr, /* tp_as_mapping */ - nullptr, /* tp_hash */ + nullptr, /* tp_hash */ nullptr, /* tp_call */ nullptr, /* tp_str */ nullptr, /* tp_getattro */ diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_SpatialNoiseShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_SpatialNoiseShader.cpp index 85e49b51f47..dabf7b3b9f4 100644 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_SpatialNoiseShader.cpp +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_SpatialNoiseShader.cpp @@ -104,7 +104,7 @@ PyTypeObject SpatialNoiseShader_Type = { nullptr, /* tp_as_number */ nullptr, /* tp_as_sequence */ nullptr, /* tp_as_mapping */ - nullptr, /* tp_hash */ + nullptr, /* tp_hash */ nullptr, /* tp_call */ nullptr, /* tp_str */ nullptr, /* tp_getattro */ diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_StrokeTextureStepShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_StrokeTextureStepShader.cpp index d914b180f6f..7961944af45 100644 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_StrokeTextureStepShader.cpp +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_StrokeTextureStepShader.cpp @@ -80,7 +80,7 @@ PyTypeObject StrokeTextureStepShader_Type = { nullptr, /* tp_as_number */ nullptr, /* tp_as_sequence */ nullptr, /* tp_as_mapping */ - nullptr, /* tp_hash */ + nullptr, /* tp_hash */ nullptr, /* tp_call */ nullptr, /* tp_str */ nullptr, /* tp_getattro */ diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_ThicknessNoiseShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_ThicknessNoiseShader.cpp index db1e634f91e..1a52f76e9dc 100644 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_ThicknessNoiseShader.cpp +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_ThicknessNoiseShader.cpp @@ -82,7 +82,7 @@ PyTypeObject ThicknessNoiseShader_Type = { nullptr, /* tp_as_number */ nullptr, /* tp_as_sequence */ nullptr, /* tp_as_mapping */ - nullptr, /* tp_hash */ + nullptr, /* tp_hash */ nullptr, /* tp_call */ nullptr, /* tp_str */ nullptr, /* tp_getattro */ diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_TipRemoverShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_TipRemoverShader.cpp index ee1ac7697db..6f0146cb07f 100644 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_TipRemoverShader.cpp +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_TipRemoverShader.cpp @@ -79,7 +79,7 @@ PyTypeObject TipRemoverShader_Type = { nullptr, /* tp_as_number */ nullptr, /* tp_as_sequence */ nullptr, /* tp_as_mapping */ - nullptr, /* tp_hash */ + nullptr, /* tp_hash */ nullptr, /* tp_call */ nullptr, /* tp_str */ nullptr, /* tp_getattro */ diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DDouble.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DDouble.cpp index d2f138dc176..1a3a8a09488 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DDouble.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DDouble.cpp @@ -197,7 +197,7 @@ PyTypeObject UnaryFunction0DDouble_Type = { nullptr, /* tp_as_number */ nullptr, /* tp_as_sequence */ nullptr, /* tp_as_mapping */ - nullptr, /* tp_hash */ + nullptr, /* tp_hash */ (ternaryfunc)UnaryFunction0DDouble___call__, /* tp_call */ nullptr, /* tp_str */ nullptr, /* tp_getattro */ diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DEdgeNature.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DEdgeNature.cpp index 6e55b7d9bcc..6d203b81aec 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DEdgeNature.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DEdgeNature.cpp @@ -136,7 +136,7 @@ PyTypeObject UnaryFunction0DEdgeNature_Type = { nullptr, /* tp_as_number */ nullptr, /* tp_as_sequence */ nullptr, /* tp_as_mapping */ - nullptr, /* tp_hash */ + nullptr, /* tp_hash */ (ternaryfunc)UnaryFunction0DEdgeNature___call__, /* tp_call */ nullptr, /* tp_str */ nullptr, /* tp_getattro */ diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DFloat.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DFloat.cpp index 23aece94c39..81363f78151 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DFloat.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DFloat.cpp @@ -173,7 +173,7 @@ PyTypeObject UnaryFunction0DFloat_Type = { nullptr, /* tp_as_number */ nullptr, /* tp_as_sequence */ nullptr, /* tp_as_mapping */ - nullptr, /* tp_hash */ + nullptr, /* tp_hash */ (ternaryfunc)UnaryFunction0DFloat___call__, /* tp_call */ nullptr, /* tp_str */ nullptr, /* tp_getattro */ diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DId.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DId.cpp index 6f904898458..98b21230dfe 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DId.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DId.cpp @@ -132,7 +132,7 @@ PyTypeObject UnaryFunction0DId_Type = { nullptr, /* tp_as_number */ nullptr, /* tp_as_sequence */ nullptr, /* tp_as_mapping */ - nullptr, /* tp_hash */ + nullptr, /* tp_hash */ (ternaryfunc)UnaryFunction0DId___call__, /* tp_call */ nullptr, /* tp_str */ nullptr, /* tp_getattro */ diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DMaterial.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DMaterial.cpp index 92dc5901b5c..db606ee089d 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DMaterial.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DMaterial.cpp @@ -135,7 +135,7 @@ PyTypeObject UnaryFunction0DMaterial_Type = { nullptr, /* tp_as_number */ nullptr, /* tp_as_sequence */ nullptr, /* tp_as_mapping */ - nullptr, /* tp_hash */ + nullptr, /* tp_hash */ (ternaryfunc)UnaryFunction0DMaterial___call__, /* tp_call */ nullptr, /* tp_str */ nullptr, /* tp_getattro */ diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DUnsigned.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DUnsigned.cpp index 829c9d0b7c1..dc0a92488ae 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DUnsigned.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DUnsigned.cpp @@ -136,7 +136,7 @@ PyTypeObject UnaryFunction0DUnsigned_Type = { nullptr, /* tp_as_number */ nullptr, /* tp_as_sequence */ nullptr, /* tp_as_mapping */ - nullptr, /* tp_hash */ + nullptr, /* tp_hash */ (ternaryfunc)UnaryFunction0DUnsigned___call__, /* tp_call */ nullptr, /* tp_str */ nullptr, /* tp_getattro */ diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVec2f.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVec2f.cpp index a7248eebae2..6c5334a1cc2 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVec2f.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVec2f.cpp @@ -141,7 +141,7 @@ PyTypeObject UnaryFunction0DVec2f_Type = { nullptr, /* tp_as_number */ nullptr, /* tp_as_sequence */ nullptr, /* tp_as_mapping */ - nullptr, /* tp_hash */ + nullptr, /* tp_hash */ (ternaryfunc)UnaryFunction0DVec2f___call__, /* tp_call */ nullptr, /* tp_str */ nullptr, /* tp_getattro */ diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVec3f.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVec3f.cpp index 1810648b0b0..67be2f8e09a 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVec3f.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVec3f.cpp @@ -134,7 +134,7 @@ PyTypeObject UnaryFunction0DVec3f_Type = { nullptr, /* tp_as_number */ nullptr, /* tp_as_sequence */ nullptr, /* tp_as_mapping */ - nullptr, /* tp_hash */ + nullptr, /* tp_hash */ (ternaryfunc)UnaryFunction0DVec3f___call__, /* tp_call */ nullptr, /* tp_str */ nullptr, /* tp_getattro */ diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVectorViewShape.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVectorViewShape.cpp index 4c015cec410..1f3986fd4e0 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVectorViewShape.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVectorViewShape.cpp @@ -145,7 +145,7 @@ PyTypeObject UnaryFunction0DVectorViewShape_Type = { nullptr, /* tp_as_number */ nullptr, /* tp_as_sequence */ nullptr, /* tp_as_mapping */ - nullptr, /* tp_hash */ + nullptr, /* tp_hash */ (ternaryfunc)UnaryFunction0DVectorViewShape___call__, /* tp_call */ nullptr, /* tp_str */ nullptr, /* tp_getattro */ diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DViewShape.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DViewShape.cpp index c2f0df9798c..9f2caedde78 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DViewShape.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DViewShape.cpp @@ -143,7 +143,7 @@ PyTypeObject UnaryFunction0DViewShape_Type = { nullptr, /* tp_as_number */ nullptr, /* tp_as_sequence */ nullptr, /* tp_as_mapping */ - nullptr, /* tp_hash */ + nullptr, /* tp_hash */ (ternaryfunc)UnaryFunction0DViewShape___call__, /* tp_call */ nullptr, /* tp_str */ nullptr, /* tp_getattro */ diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Id/BPy_ShapeIdF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Id/BPy_ShapeIdF0D.cpp index 4aed82a14d3..a15cbe08385 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Id/BPy_ShapeIdF0D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Id/BPy_ShapeIdF0D.cpp @@ -84,7 +84,7 @@ PyTypeObject ShapeIdF0D_Type = { nullptr, /* tp_as_number */ nullptr, /* tp_as_sequence */ nullptr, /* tp_as_mapping */ - nullptr, /* tp_hash */ + nullptr, /* tp_hash */ nullptr, /* tp_call */ nullptr, /* tp_str */ nullptr, /* tp_getattro */ diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Material/BPy_MaterialF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Material/BPy_MaterialF0D.cpp index 6b6e06d6efd..d9ba37ff306 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Material/BPy_MaterialF0D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Material/BPy_MaterialF0D.cpp @@ -87,7 +87,7 @@ PyTypeObject MaterialF0D_Type = { nullptr, /* tp_as_number */ nullptr, /* tp_as_sequence */ nullptr, /* tp_as_mapping */ - nullptr, /* tp_hash */ + nullptr, /* tp_hash */ nullptr, /* tp_call */ nullptr, /* tp_str */ nullptr, /* tp_getattro */ diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Nature_EdgeNature/BPy_CurveNatureF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Nature_EdgeNature/BPy_CurveNatureF0D.cpp index c6fb66270f7..df05ce055de 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Nature_EdgeNature/BPy_CurveNatureF0D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Nature_EdgeNature/BPy_CurveNatureF0D.cpp @@ -78,7 +78,7 @@ PyTypeObject CurveNatureF0D_Type = { nullptr, /* tp_as_number */ nullptr, /* tp_as_sequence */ nullptr, /* tp_as_mapping */ - nullptr, /* tp_hash */ + nullptr, /* tp_hash */ nullptr, /* tp_call */ nullptr, /* tp_str */ nullptr, /* tp_getattro */ diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Vec2f/BPy_Normal2DF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Vec2f/BPy_Normal2DF0D.cpp index 66c0243727d..0f32a7f6dda 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Vec2f/BPy_Normal2DF0D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Vec2f/BPy_Normal2DF0D.cpp @@ -80,7 +80,7 @@ PyTypeObject Normal2DF0D_Type = { nullptr, /* tp_as_number */ nullptr, /* tp_as_sequence */ nullptr, /* tp_as_mapping */ - nullptr, /* tp_hash */ + nullptr, /* tp_hash */ nullptr, /* tp_call */ nullptr, /* tp_str */ nullptr, /* tp_getattro */ diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Vec2f/BPy_VertexOrientation2DF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Vec2f/BPy_VertexOrientation2DF0D.cpp index 4ade0e2e995..fe3890a0546 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Vec2f/BPy_VertexOrientation2DF0D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Vec2f/BPy_VertexOrientation2DF0D.cpp @@ -82,7 +82,7 @@ PyTypeObject VertexOrientation2DF0D_Type = { nullptr, /* tp_as_number */ nullptr, /* tp_as_sequence */ nullptr, /* tp_as_mapping */ - nullptr, /* tp_hash */ + nullptr, /* tp_hash */ nullptr, /* tp_call */ nullptr, /* tp_str */ nullptr, /* tp_getattro */ diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Vec3f/BPy_VertexOrientation3DF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Vec3f/BPy_VertexOrientation3DF0D.cpp index f634eaa0327..0e2f9d38e2b 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Vec3f/BPy_VertexOrientation3DF0D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Vec3f/BPy_VertexOrientation3DF0D.cpp @@ -82,7 +82,7 @@ PyTypeObject VertexOrientation3DF0D_Type = { nullptr, /* tp_as_number */ nullptr, /* tp_as_sequence */ nullptr, /* tp_as_mapping */ - nullptr, /* tp_hash */ + nullptr, /* tp_hash */ nullptr, /* tp_call */ nullptr, /* tp_str */ nullptr, /* tp_getattro */ diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_ViewShape/BPy_GetOccludeeF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_ViewShape/BPy_GetOccludeeF0D.cpp index c624e3eb136..3629ac50708 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_ViewShape/BPy_GetOccludeeF0D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_ViewShape/BPy_GetOccludeeF0D.cpp @@ -77,7 +77,7 @@ PyTypeObject GetOccludeeF0D_Type = { nullptr, /* tp_as_number */ nullptr, /* tp_as_sequence */ nullptr, /* tp_as_mapping */ - nullptr, /* tp_hash */ + nullptr, /* tp_hash */ nullptr, /* tp_call */ nullptr, /* tp_str */ nullptr, /* tp_getattro */ diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_ViewShape/BPy_GetShapeF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_ViewShape/BPy_GetShapeF0D.cpp index 8234e7f4351..c1f34befc8b 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_ViewShape/BPy_GetShapeF0D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_ViewShape/BPy_GetShapeF0D.cpp @@ -77,7 +77,7 @@ PyTypeObject GetShapeF0D_Type = { nullptr, /* tp_as_number */ nullptr, /* tp_as_sequence */ nullptr, /* tp_as_mapping */ - nullptr, /* tp_hash */ + nullptr, /* tp_hash */ nullptr, /* tp_call */ nullptr, /* tp_str */ nullptr, /* tp_getattro */ diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_Curvature2DAngleF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_Curvature2DAngleF0D.cpp index 217fe1cb55a..92702c194a7 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_Curvature2DAngleF0D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_Curvature2DAngleF0D.cpp @@ -82,7 +82,7 @@ PyTypeObject Curvature2DAngleF0D_Type = { nullptr, /* tp_as_number */ nullptr, /* tp_as_sequence */ nullptr, /* tp_as_mapping */ - nullptr, /* tp_hash */ + nullptr, /* tp_hash */ nullptr, /* tp_call */ nullptr, /* tp_str */ nullptr, /* tp_getattro */ diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_DensityF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_DensityF0D.cpp index b0777adb311..08b17ff3194 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_DensityF0D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_DensityF0D.cpp @@ -87,7 +87,7 @@ PyTypeObject DensityF0D_Type = { nullptr, /* tp_as_number */ nullptr, /* tp_as_sequence */ nullptr, /* tp_as_mapping */ - nullptr, /* tp_hash */ + nullptr, /* tp_hash */ nullptr, /* tp_call */ nullptr, /* tp_str */ nullptr, /* tp_getattro */ diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetProjectedXF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetProjectedXF0D.cpp index 6c230a1207d..2b2b1c616f0 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetProjectedXF0D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetProjectedXF0D.cpp @@ -77,7 +77,7 @@ PyTypeObject GetProjectedXF0D_Type = { nullptr, /* tp_as_number */ nullptr, /* tp_as_sequence */ nullptr, /* tp_as_mapping */ - nullptr, /* tp_hash */ + nullptr, /* tp_hash */ nullptr, /* tp_call */ nullptr, /* tp_str */ nullptr, /* tp_getattro */ diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetProjectedYF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetProjectedYF0D.cpp index 43913316567..1dc6b43a794 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetProjectedYF0D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetProjectedYF0D.cpp @@ -77,7 +77,7 @@ PyTypeObject GetProjectedYF0D_Type = { nullptr, /* tp_as_number */ nullptr, /* tp_as_sequence */ nullptr, /* tp_as_mapping */ - nullptr, /* tp_hash */ + nullptr, /* tp_hash */ nullptr, /* tp_call */ nullptr, /* tp_str */ nullptr, /* tp_getattro */ diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetProjectedZF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetProjectedZF0D.cpp index a7d1d05c3ca..a3f7d60fc04 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetProjectedZF0D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetProjectedZF0D.cpp @@ -77,7 +77,7 @@ PyTypeObject GetProjectedZF0D_Type = { nullptr, /* tp_as_number */ nullptr, /* tp_as_sequence */ nullptr, /* tp_as_mapping */ - nullptr, /* tp_hash */ + nullptr, /* tp_hash */ nullptr, /* tp_call */ nullptr, /* tp_str */ nullptr, /* tp_getattro */ diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetXF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetXF0D.cpp index 94abd089db1..8c53c1a412e 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetXF0D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetXF0D.cpp @@ -77,7 +77,7 @@ PyTypeObject GetXF0D_Type = { nullptr, /* tp_as_number */ nullptr, /* tp_as_sequence */ nullptr, /* tp_as_mapping */ - nullptr, /* tp_hash */ + nullptr, /* tp_hash */ nullptr, /* tp_call */ nullptr, /* tp_str */ nullptr, /* tp_getattro */ diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetYF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetYF0D.cpp index fc4edb9eb1a..7db4d5ed8b2 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetYF0D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetYF0D.cpp @@ -77,7 +77,7 @@ PyTypeObject GetYF0D_Type = { nullptr, /* tp_as_number */ nullptr, /* tp_as_sequence */ nullptr, /* tp_as_mapping */ - nullptr, /* tp_hash */ + nullptr, /* tp_hash */ nullptr, /* tp_call */ nullptr, /* tp_str */ nullptr, /* tp_getattro */ diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetZF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetZF0D.cpp index 3729f7bcb66..4e7808af2c2 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetZF0D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetZF0D.cpp @@ -77,7 +77,7 @@ PyTypeObject GetZF0D_Type = { nullptr, /* tp_as_number */ nullptr, /* tp_as_sequence */ nullptr, /* tp_as_mapping */ - nullptr, /* tp_hash */ + nullptr, /* tp_hash */ nullptr, /* tp_call */ nullptr, /* tp_str */ nullptr, /* tp_getattro */ diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_LocalAverageDepthF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_LocalAverageDepthF0D.cpp index 64f86653922..fa70590f775 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_LocalAverageDepthF0D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_LocalAverageDepthF0D.cpp @@ -85,7 +85,7 @@ PyTypeObject LocalAverageDepthF0D_Type = { nullptr, /* tp_as_number */ nullptr, /* tp_as_sequence */ nullptr, /* tp_as_mapping */ - nullptr, /* tp_hash */ + nullptr, /* tp_hash */ nullptr, /* tp_call */ nullptr, /* tp_str */ nullptr, /* tp_getattro */ diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_ZDiscontinuityF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_ZDiscontinuityF0D.cpp index 2b2dba80f04..21874ff6516 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_ZDiscontinuityF0D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_ZDiscontinuityF0D.cpp @@ -82,7 +82,7 @@ PyTypeObject ZDiscontinuityF0D_Type = { nullptr, /* tp_as_number */ nullptr, /* tp_as_sequence */ nullptr, /* tp_as_mapping */ - nullptr, /* tp_hash */ + nullptr, /* tp_hash */ nullptr, /* tp_call */ nullptr, /* tp_str */ nullptr, /* tp_getattro */ diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_GetCurvilinearAbscissaF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_GetCurvilinearAbscissaF0D.cpp index 092f78c584c..7d68928461e 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_GetCurvilinearAbscissaF0D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_GetCurvilinearAbscissaF0D.cpp @@ -80,7 +80,7 @@ PyTypeObject GetCurvilinearAbscissaF0D_Type = { nullptr, /* tp_as_number */ nullptr, /* tp_as_sequence */ nullptr, /* tp_as_mapping */ - nullptr, /* tp_hash */ + nullptr, /* tp_hash */ nullptr, /* tp_call */ nullptr, /* tp_str */ nullptr, /* tp_getattro */ diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_GetParameterF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_GetParameterF0D.cpp index 28be409b8fb..43eb89e2583 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_GetParameterF0D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_GetParameterF0D.cpp @@ -76,7 +76,7 @@ PyTypeObject GetParameterF0D_Type = { nullptr, /* tp_as_number */ nullptr, /* tp_as_sequence */ nullptr, /* tp_as_mapping */ - nullptr, /* tp_hash */ + nullptr, /* tp_hash */ nullptr, /* tp_call */ nullptr, /* tp_str */ nullptr, /* tp_getattro */ diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_GetViewMapGradientNormF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_GetViewMapGradientNormF0D.cpp index 3f6667af843..8d89d33c230 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_GetViewMapGradientNormF0D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_GetViewMapGradientNormF0D.cpp @@ -85,7 +85,7 @@ PyTypeObject GetViewMapGradientNormF0D_Type = { nullptr, /* tp_as_number */ nullptr, /* tp_as_sequence */ nullptr, /* tp_as_mapping */ - nullptr, /* tp_hash */ + nullptr, /* tp_hash */ nullptr, /* tp_call */ nullptr, /* tp_str */ nullptr, /* tp_getattro */ diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_ReadCompleteViewMapPixelF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_ReadCompleteViewMapPixelF0D.cpp index 98cd37f5fea..4ddfc3f386b 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_ReadCompleteViewMapPixelF0D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_ReadCompleteViewMapPixelF0D.cpp @@ -83,7 +83,7 @@ PyTypeObject ReadCompleteViewMapPixelF0D_Type = { nullptr, /* tp_as_number */ nullptr, /* tp_as_sequence */ nullptr, /* tp_as_mapping */ - nullptr, /* tp_hash */ + nullptr, /* tp_hash */ nullptr, /* tp_call */ nullptr, /* tp_str */ nullptr, /* tp_getattro */ diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_ReadMapPixelF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_ReadMapPixelF0D.cpp index 07bbcfed102..383970d110f 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_ReadMapPixelF0D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_ReadMapPixelF0D.cpp @@ -84,7 +84,7 @@ PyTypeObject ReadMapPixelF0D_Type = { nullptr, /* tp_as_number */ nullptr, /* tp_as_sequence */ nullptr, /* tp_as_mapping */ - nullptr, /* tp_hash */ + nullptr, /* tp_hash */ nullptr, /* tp_call */ nullptr, /* tp_str */ nullptr, /* tp_getattro */ diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_ReadSteerableViewMapPixelF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_ReadSteerableViewMapPixelF0D.cpp index 4d2da133b5f..9fa3666df01 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_ReadSteerableViewMapPixelF0D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_ReadSteerableViewMapPixelF0D.cpp @@ -87,7 +87,7 @@ PyTypeObject ReadSteerableViewMapPixelF0D_Type = { nullptr, /* tp_as_number */ nullptr, /* tp_as_sequence */ nullptr, /* tp_as_mapping */ - nullptr, /* tp_hash */ + nullptr, /* tp_hash */ nullptr, /* tp_call */ nullptr, /* tp_str */ nullptr, /* tp_getattro */ diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_unsigned_int/BPy_QuantitativeInvisibilityF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_unsigned_int/BPy_QuantitativeInvisibilityF0D.cpp index 30e5ea4a1f8..1ed7311904e 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_unsigned_int/BPy_QuantitativeInvisibilityF0D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_unsigned_int/BPy_QuantitativeInvisibilityF0D.cpp @@ -85,7 +85,7 @@ PyTypeObject QuantitativeInvisibilityF0D_Type = { nullptr, /* tp_as_number */ nullptr, /* tp_as_sequence */ nullptr, /* tp_as_mapping */ - nullptr, /* tp_hash */ + nullptr, /* tp_hash */ nullptr, /* tp_call */ nullptr, /* tp_str */ nullptr, /* tp_getattro */ diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_vector_ViewShape/BPy_GetOccludersF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_vector_ViewShape/BPy_GetOccludersF0D.cpp index a8461e006b0..be68df3e276 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_vector_ViewShape/BPy_GetOccludersF0D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_vector_ViewShape/BPy_GetOccludersF0D.cpp @@ -78,7 +78,7 @@ PyTypeObject GetOccludersF0D_Type = { nullptr, /* tp_as_number */ nullptr, /* tp_as_sequence */ nullptr, /* tp_as_mapping */ - nullptr, /* tp_hash */ + nullptr, /* tp_hash */ nullptr, /* tp_call */ nullptr, /* tp_str */ nullptr, /* tp_getattro */ diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DDouble.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DDouble.cpp index 0ce6e099ed3..b14a208624f 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DDouble.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DDouble.cpp @@ -278,7 +278,7 @@ PyTypeObject UnaryFunction1DDouble_Type = { nullptr, /* tp_as_number */ nullptr, /* tp_as_sequence */ nullptr, /* tp_as_mapping */ - nullptr, /* tp_hash */ + nullptr, /* tp_hash */ (ternaryfunc)UnaryFunction1DDouble___call__, /* tp_call */ nullptr, /* tp_str */ nullptr, /* tp_getattro */ diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DEdgeNature.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DEdgeNature.cpp index 83a502de548..6ef5b79c121 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DEdgeNature.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DEdgeNature.cpp @@ -185,7 +185,7 @@ PyTypeObject UnaryFunction1DEdgeNature_Type = { nullptr, /* tp_as_number */ nullptr, /* tp_as_sequence */ nullptr, /* tp_as_mapping */ - nullptr, /* tp_hash */ + nullptr, /* tp_hash */ (ternaryfunc)UnaryFunction1DEdgeNature___call__, /* tp_call */ nullptr, /* tp_str */ nullptr, /* tp_getattro */ diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DFloat.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DFloat.cpp index 7ba80c58256..461eff54d2d 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DFloat.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DFloat.cpp @@ -174,7 +174,7 @@ PyTypeObject UnaryFunction1DFloat_Type = { nullptr, /* tp_as_number */ nullptr, /* tp_as_sequence */ nullptr, /* tp_as_mapping */ - nullptr, /* tp_hash */ + nullptr, /* tp_hash */ (ternaryfunc)UnaryFunction1DFloat___call__, /* tp_call */ nullptr, /* tp_str */ nullptr, /* tp_getattro */ diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DUnsigned.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DUnsigned.cpp index ed8790fcd89..5a84bfbc776 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DUnsigned.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DUnsigned.cpp @@ -185,7 +185,7 @@ PyTypeObject UnaryFunction1DUnsigned_Type = { nullptr, /* tp_as_number */ nullptr, /* tp_as_sequence */ nullptr, /* tp_as_mapping */ - nullptr, /* tp_hash */ + nullptr, /* tp_hash */ (ternaryfunc)UnaryFunction1DUnsigned___call__, /* tp_call */ nullptr, /* tp_str */ nullptr, /* tp_getattro */ diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVec2f.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVec2f.cpp index 0f288faea4e..e175a3bf2a7 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVec2f.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVec2f.cpp @@ -189,7 +189,7 @@ PyTypeObject UnaryFunction1DVec2f_Type = { nullptr, /* tp_as_number */ nullptr, /* tp_as_sequence */ nullptr, /* tp_as_mapping */ - nullptr, /* tp_hash */ + nullptr, /* tp_hash */ (ternaryfunc)UnaryFunction1DVec2f___call__, /* tp_call */ nullptr, /* tp_str */ nullptr, /* tp_getattro */ diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVec3f.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVec3f.cpp index fbdefd891be..822ac477420 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVec3f.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVec3f.cpp @@ -182,7 +182,7 @@ PyTypeObject UnaryFunction1DVec3f_Type = { nullptr, /* tp_as_number */ nullptr, /* tp_as_sequence */ nullptr, /* tp_as_mapping */ - nullptr, /* tp_hash */ + nullptr, /* tp_hash */ (ternaryfunc)UnaryFunction1DVec3f___call__, /* tp_call */ nullptr, /* tp_str */ nullptr, /* tp_getattro */ diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVectorViewShape.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVectorViewShape.cpp index 09b9e303fa0..13ce8e6fecf 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVectorViewShape.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVectorViewShape.cpp @@ -210,7 +210,7 @@ PyTypeObject UnaryFunction1DVectorViewShape_Type = { nullptr, /* tp_as_number */ nullptr, /* tp_as_sequence */ nullptr, /* tp_as_mapping */ - nullptr, /* tp_hash */ + nullptr, /* tp_hash */ (ternaryfunc)UnaryFunction1DVectorViewShape___call__, /* tp_call */ nullptr, /* tp_str */ nullptr, /* tp_getattro */ diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVoid.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVoid.cpp index 9ab3de8bf79..05d21fc44c9 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVoid.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVoid.cpp @@ -197,7 +197,7 @@ PyTypeObject UnaryFunction1DVoid_Type = { nullptr, /* tp_as_number */ nullptr, /* tp_as_sequence */ nullptr, /* tp_as_mapping */ - nullptr, /* tp_hash */ + nullptr, /* tp_hash */ (ternaryfunc)UnaryFunction1DVoid___call__, /* tp_call */ nullptr, /* tp_str */ nullptr, /* tp_getattro */ diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Nature_EdgeNature/BPy_CurveNatureF1D.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Nature_EdgeNature/BPy_CurveNatureF1D.cpp index 141758bfe48..c2d1370301d 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Nature_EdgeNature/BPy_CurveNatureF1D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Nature_EdgeNature/BPy_CurveNatureF1D.cpp @@ -90,7 +90,7 @@ PyTypeObject CurveNatureF1D_Type = { nullptr, /* tp_as_number */ nullptr, /* tp_as_sequence */ nullptr, /* tp_as_mapping */ - nullptr, /* tp_hash */ + nullptr, /* tp_hash */ nullptr, /* tp_call */ nullptr, /* tp_str */ nullptr, /* tp_getattro */ diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Vec2f/BPy_Normal2DF1D.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Vec2f/BPy_Normal2DF1D.cpp index 7fa596d4bbe..6e8b8b3f54d 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Vec2f/BPy_Normal2DF1D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Vec2f/BPy_Normal2DF1D.cpp @@ -84,7 +84,7 @@ PyTypeObject Normal2DF1D_Type = { nullptr, /* tp_as_number */ nullptr, /* tp_as_sequence */ nullptr, /* tp_as_mapping */ - nullptr, /* tp_hash */ + nullptr, /* tp_hash */ nullptr, /* tp_call */ nullptr, /* tp_str */ nullptr, /* tp_getattro */ diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Vec2f/BPy_Orientation2DF1D.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Vec2f/BPy_Orientation2DF1D.cpp index 69ab07a2829..3fa63188542 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Vec2f/BPy_Orientation2DF1D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Vec2f/BPy_Orientation2DF1D.cpp @@ -84,7 +84,7 @@ PyTypeObject Orientation2DF1D_Type = { nullptr, /* tp_as_number */ nullptr, /* tp_as_sequence */ nullptr, /* tp_as_mapping */ - nullptr, /* tp_hash */ + nullptr, /* tp_hash */ nullptr, /* tp_call */ nullptr, /* tp_str */ nullptr, /* tp_getattro */ diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Vec3f/BPy_Orientation3DF1D.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Vec3f/BPy_Orientation3DF1D.cpp index 9866968e068..af431a9b905 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Vec3f/BPy_Orientation3DF1D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Vec3f/BPy_Orientation3DF1D.cpp @@ -84,7 +84,7 @@ PyTypeObject Orientation3DF1D_Type = { nullptr, /* tp_as_number */ nullptr, /* tp_as_sequence */ nullptr, /* tp_as_mapping */ - nullptr, /* tp_hash */ + nullptr, /* tp_hash */ nullptr, /* tp_call */ nullptr, /* tp_str */ nullptr, /* tp_getattro */ diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_Curvature2DAngleF1D.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_Curvature2DAngleF1D.cpp index 3bd9bf8abce..b9028509c40 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_Curvature2DAngleF1D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_Curvature2DAngleF1D.cpp @@ -85,7 +85,7 @@ PyTypeObject Curvature2DAngleF1D_Type = { nullptr, /* tp_as_number */ nullptr, /* tp_as_sequence */ nullptr, /* tp_as_mapping */ - nullptr, /* tp_hash */ + nullptr, /* tp_hash */ nullptr, /* tp_call */ nullptr, /* tp_str */ nullptr, /* tp_getattro */ diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_DensityF1D.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_DensityF1D.cpp index 12237f6a5e5..a0df70e0324 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_DensityF1D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_DensityF1D.cpp @@ -98,7 +98,7 @@ PyTypeObject DensityF1D_Type = { nullptr, /* tp_as_number */ nullptr, /* tp_as_sequence */ nullptr, /* tp_as_mapping */ - nullptr, /* tp_hash */ + nullptr, /* tp_hash */ nullptr, /* tp_call */ nullptr, /* tp_str */ nullptr, /* tp_getattro */ diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetCompleteViewMapDensityF1D.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetCompleteViewMapDensityF1D.cpp index 49f7c019222..d52714c77c6 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetCompleteViewMapDensityF1D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetCompleteViewMapDensityF1D.cpp @@ -102,7 +102,7 @@ PyTypeObject GetCompleteViewMapDensityF1D_Type = { nullptr, /* tp_as_number */ nullptr, /* tp_as_sequence */ nullptr, /* tp_as_mapping */ - nullptr, /* tp_hash */ + nullptr, /* tp_hash */ nullptr, /* tp_call */ nullptr, /* tp_str */ nullptr, /* tp_getattro */ diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetDirectionalViewMapDensityF1D.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetDirectionalViewMapDensityF1D.cpp index 240e632b433..eeb55878f67 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetDirectionalViewMapDensityF1D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetDirectionalViewMapDensityF1D.cpp @@ -109,7 +109,7 @@ PyTypeObject GetDirectionalViewMapDensityF1D_Type = { nullptr, /* tp_as_number */ nullptr, /* tp_as_sequence */ nullptr, /* tp_as_mapping */ - nullptr, /* tp_hash */ + nullptr, /* tp_hash */ nullptr, /* tp_call */ nullptr, /* tp_str */ nullptr, /* tp_getattro */ diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetProjectedXF1D.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetProjectedXF1D.cpp index ce111f81c9d..062da8a3816 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetProjectedXF1D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetProjectedXF1D.cpp @@ -84,7 +84,7 @@ PyTypeObject GetProjectedXF1D_Type = { nullptr, /* tp_as_number */ nullptr, /* tp_as_sequence */ nullptr, /* tp_as_mapping */ - nullptr, /* tp_hash */ + nullptr, /* tp_hash */ nullptr, /* tp_call */ nullptr, /* tp_str */ nullptr, /* tp_getattro */ diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetProjectedYF1D.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetProjectedYF1D.cpp index 31dc72f8d0d..5bda5c275c1 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetProjectedYF1D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetProjectedYF1D.cpp @@ -84,7 +84,7 @@ PyTypeObject GetProjectedYF1D_Type = { nullptr, /* tp_as_number */ nullptr, /* tp_as_sequence */ nullptr, /* tp_as_mapping */ - nullptr, /* tp_hash */ + nullptr, /* tp_hash */ nullptr, /* tp_call */ nullptr, /* tp_str */ nullptr, /* tp_getattro */ diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetProjectedZF1D.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetProjectedZF1D.cpp index e16a0c01942..9b9d81168f4 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetProjectedZF1D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetProjectedZF1D.cpp @@ -84,7 +84,7 @@ PyTypeObject GetProjectedZF1D_Type = { nullptr, /* tp_as_number */ nullptr, /* tp_as_sequence */ nullptr, /* tp_as_mapping */ - nullptr, /* tp_hash */ + nullptr, /* tp_hash */ nullptr, /* tp_call */ nullptr, /* tp_str */ nullptr, /* tp_getattro */ diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetSteerableViewMapDensityF1D.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetSteerableViewMapDensityF1D.cpp index 78d74bf3399..29251df924f 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetSteerableViewMapDensityF1D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetSteerableViewMapDensityF1D.cpp @@ -99,7 +99,7 @@ PyTypeObject GetSteerableViewMapDensityF1D_Type = { nullptr, /* tp_as_number */ nullptr, /* tp_as_sequence */ nullptr, /* tp_as_mapping */ - nullptr, /* tp_hash */ + nullptr, /* tp_hash */ nullptr, /* tp_call */ nullptr, /* tp_str */ nullptr, /* tp_getattro */ diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetViewMapGradientNormF1D.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetViewMapGradientNormF1D.cpp index a158969c00c..c3b2b23fe28 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetViewMapGradientNormF1D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetViewMapGradientNormF1D.cpp @@ -99,7 +99,7 @@ PyTypeObject GetViewMapGradientNormF1D_Type = { nullptr, /* tp_as_number */ nullptr, /* tp_as_sequence */ nullptr, /* tp_as_mapping */ - nullptr, /* tp_hash */ + nullptr, /* tp_hash */ nullptr, /* tp_call */ nullptr, /* tp_str */ nullptr, /* tp_getattro */ diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetXF1D.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetXF1D.cpp index 9dfb5aa8793..2260dc9ea85 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetXF1D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetXF1D.cpp @@ -84,7 +84,7 @@ PyTypeObject GetXF1D_Type = { nullptr, /* tp_as_number */ nullptr, /* tp_as_sequence */ nullptr, /* tp_as_mapping */ - nullptr, /* tp_hash */ + nullptr, /* tp_hash */ nullptr, /* tp_call */ nullptr, /* tp_str */ nullptr, /* tp_getattro */ diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetYF1D.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetYF1D.cpp index 239079e8472..7c19c3101ef 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetYF1D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetYF1D.cpp @@ -83,7 +83,7 @@ PyTypeObject GetYF1D_Type = { nullptr, /* tp_as_number */ nullptr, /* tp_as_sequence */ nullptr, /* tp_as_mapping */ - nullptr, /* tp_hash */ + nullptr, /* tp_hash */ nullptr, /* tp_call */ nullptr, /* tp_str */ nullptr, /* tp_getattro */ diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetZF1D.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetZF1D.cpp index 8f973adc3f0..43a6632c017 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetZF1D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetZF1D.cpp @@ -84,7 +84,7 @@ PyTypeObject GetZF1D_Type = { nullptr, /* tp_as_number */ nullptr, /* tp_as_sequence */ nullptr, /* tp_as_mapping */ - nullptr, /* tp_hash */ + nullptr, /* tp_hash */ nullptr, /* tp_call */ nullptr, /* tp_str */ nullptr, /* tp_getattro */ diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_LocalAverageDepthF1D.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_LocalAverageDepthF1D.cpp index 53eaf9b9596..15a2e7b7643 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_LocalAverageDepthF1D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_LocalAverageDepthF1D.cpp @@ -94,7 +94,7 @@ PyTypeObject LocalAverageDepthF1D_Type = { nullptr, /* tp_as_number */ nullptr, /* tp_as_sequence */ nullptr, /* tp_as_mapping */ - nullptr, /* tp_hash */ + nullptr, /* tp_hash */ nullptr, /* tp_call */ nullptr, /* tp_str */ nullptr, /* tp_getattro */ diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_ZDiscontinuityF1D.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_ZDiscontinuityF1D.cpp index 8d1d43bc4de..ed7a3212f59 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_ZDiscontinuityF1D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_ZDiscontinuityF1D.cpp @@ -88,7 +88,7 @@ PyTypeObject ZDiscontinuityF1D_Type = { nullptr, /* tp_as_number */ nullptr, /* tp_as_sequence */ nullptr, /* tp_as_mapping */ - nullptr, /* tp_hash */ + nullptr, /* tp_hash */ nullptr, /* tp_call */ nullptr, /* tp_str */ nullptr, /* tp_getattro */ diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_unsigned_int/BPy_QuantitativeInvisibilityF1D.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_unsigned_int/BPy_QuantitativeInvisibilityF1D.cpp index da5140c4459..34c3fa14453 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_unsigned_int/BPy_QuantitativeInvisibilityF1D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_unsigned_int/BPy_QuantitativeInvisibilityF1D.cpp @@ -90,7 +90,7 @@ PyTypeObject QuantitativeInvisibilityF1D_Type = { nullptr, /* tp_as_number */ nullptr, /* tp_as_sequence */ nullptr, /* tp_as_mapping */ - nullptr, /* tp_hash */ + nullptr, /* tp_hash */ nullptr, /* tp_call */ nullptr, /* tp_str */ nullptr, /* tp_getattro */ diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_vector_ViewShape/BPy_GetOccludeeF1D.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_vector_ViewShape/BPy_GetOccludeeF1D.cpp index 57dc15d4a55..74e0b6ea228 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_vector_ViewShape/BPy_GetOccludeeF1D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_vector_ViewShape/BPy_GetOccludeeF1D.cpp @@ -77,7 +77,7 @@ PyTypeObject GetOccludeeF1D_Type = { nullptr, /* tp_as_number */ nullptr, /* tp_as_sequence */ nullptr, /* tp_as_mapping */ - nullptr, /* tp_hash */ + nullptr, /* tp_hash */ nullptr, /* tp_call */ nullptr, /* tp_str */ nullptr, /* tp_getattro */ diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_vector_ViewShape/BPy_GetOccludersF1D.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_vector_ViewShape/BPy_GetOccludersF1D.cpp index ec8556eee96..e32bc4b8f57 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_vector_ViewShape/BPy_GetOccludersF1D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_vector_ViewShape/BPy_GetOccludersF1D.cpp @@ -77,7 +77,7 @@ PyTypeObject GetOccludersF1D_Type = { nullptr, /* tp_as_number */ nullptr, /* tp_as_sequence */ nullptr, /* tp_as_mapping */ - nullptr, /* tp_hash */ + nullptr, /* tp_hash */ nullptr, /* tp_call */ nullptr, /* tp_str */ nullptr, /* tp_getattro */ diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_vector_ViewShape/BPy_GetShapeF1D.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_vector_ViewShape/BPy_GetShapeF1D.cpp index 95e7afe66fe..4a84d70c001 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_vector_ViewShape/BPy_GetShapeF1D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_vector_ViewShape/BPy_GetShapeF1D.cpp @@ -77,7 +77,7 @@ PyTypeObject GetShapeF1D_Type = { nullptr, /* tp_as_number */ nullptr, /* tp_as_sequence */ nullptr, /* tp_as_mapping */ - nullptr, /* tp_hash */ + nullptr, /* tp_hash */ nullptr, /* tp_call */ nullptr, /* tp_str */ nullptr, /* tp_getattro */ diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_void/BPy_ChainingTimeStampF1D.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_void/BPy_ChainingTimeStampF1D.cpp index 906b23d03d2..70411d61cb7 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_void/BPy_ChainingTimeStampF1D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_void/BPy_ChainingTimeStampF1D.cpp @@ -77,7 +77,7 @@ PyTypeObject ChainingTimeStampF1D_Type = { nullptr, /* tp_as_number */ nullptr, /* tp_as_sequence */ nullptr, /* tp_as_mapping */ - nullptr, /* tp_hash */ + nullptr, /* tp_hash */ nullptr, /* tp_call */ nullptr, /* tp_str */ nullptr, /* tp_getattro */ diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_void/BPy_IncrementChainingTimeStampF1D.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_void/BPy_IncrementChainingTimeStampF1D.cpp index 487af7dca70..8e684870225 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_void/BPy_IncrementChainingTimeStampF1D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_void/BPy_IncrementChainingTimeStampF1D.cpp @@ -77,7 +77,7 @@ PyTypeObject IncrementChainingTimeStampF1D_Type = { nullptr, /* tp_as_number */ nullptr, /* tp_as_sequence */ nullptr, /* tp_as_mapping */ - nullptr, /* tp_hash */ + nullptr, /* tp_hash */ nullptr, /* tp_call */ nullptr, /* tp_str */ nullptr, /* tp_getattro */ diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_void/BPy_TimeStampF1D.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_void/BPy_TimeStampF1D.cpp index ba21c98b0b0..0e134407ede 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_void/BPy_TimeStampF1D.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_void/BPy_TimeStampF1D.cpp @@ -75,7 +75,7 @@ PyTypeObject TimeStampF1D_Type = { nullptr, /* tp_as_number */ nullptr, /* tp_as_sequence */ nullptr, /* tp_as_mapping */ - nullptr, /* tp_hash */ + nullptr, /* tp_hash */ nullptr, /* tp_call */ nullptr, /* tp_str */ nullptr, /* tp_getattro */ diff --git a/source/blender/freestyle/intern/python/UnaryPredicate0D/BPy_FalseUP0D.cpp b/source/blender/freestyle/intern/python/UnaryPredicate0D/BPy_FalseUP0D.cpp index 300a9d66f07..67952df1f3e 100644 --- a/source/blender/freestyle/intern/python/UnaryPredicate0D/BPy_FalseUP0D.cpp +++ b/source/blender/freestyle/intern/python/UnaryPredicate0D/BPy_FalseUP0D.cpp @@ -68,7 +68,7 @@ PyTypeObject FalseUP0D_Type = { nullptr, /* tp_as_number */ nullptr, /* tp_as_sequence */ nullptr, /* tp_as_mapping */ - nullptr, /* tp_hash */ + nullptr, /* tp_hash */ nullptr, /* tp_call */ nullptr, /* tp_str */ nullptr, /* tp_getattro */ diff --git a/source/blender/freestyle/intern/python/UnaryPredicate0D/BPy_TrueUP0D.cpp b/source/blender/freestyle/intern/python/UnaryPredicate0D/BPy_TrueUP0D.cpp index 6ff6ad03c1e..51697862d71 100644 --- a/source/blender/freestyle/intern/python/UnaryPredicate0D/BPy_TrueUP0D.cpp +++ b/source/blender/freestyle/intern/python/UnaryPredicate0D/BPy_TrueUP0D.cpp @@ -68,7 +68,7 @@ PyTypeObject TrueUP0D_Type = { nullptr, /* tp_as_number */ nullptr, /* tp_as_sequence */ nullptr, /* tp_as_mapping */ - nullptr, /* tp_hash */ + nullptr, /* tp_hash */ nullptr, /* tp_call */ nullptr, /* tp_str */ nullptr, /* tp_getattro */ diff --git a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_ContourUP1D.cpp b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_ContourUP1D.cpp index b42573c1fbe..ebe62bc2bfd 100644 --- a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_ContourUP1D.cpp +++ b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_ContourUP1D.cpp @@ -69,7 +69,7 @@ PyTypeObject ContourUP1D_Type = { nullptr, /* tp_as_number */ nullptr, /* tp_as_sequence */ nullptr, /* tp_as_mapping */ - nullptr, /* tp_hash */ + nullptr, /* tp_hash */ nullptr, /* tp_call */ nullptr, /* tp_str */ nullptr, /* tp_getattro */ diff --git a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_DensityLowerThanUP1D.cpp b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_DensityLowerThanUP1D.cpp index bcea039087c..daf6841d66f 100644 --- a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_DensityLowerThanUP1D.cpp +++ b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_DensityLowerThanUP1D.cpp @@ -85,7 +85,7 @@ PyTypeObject DensityLowerThanUP1D_Type = { nullptr, /* tp_as_number */ nullptr, /* tp_as_sequence */ nullptr, /* tp_as_mapping */ - nullptr, /* tp_hash */ + nullptr, /* tp_hash */ nullptr, /* tp_call */ nullptr, /* tp_str */ nullptr, /* tp_getattro */ diff --git a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_EqualToChainingTimeStampUP1D.cpp b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_EqualToChainingTimeStampUP1D.cpp index 7ac09d4a644..e40d9703f25 100644 --- a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_EqualToChainingTimeStampUP1D.cpp +++ b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_EqualToChainingTimeStampUP1D.cpp @@ -80,7 +80,7 @@ PyTypeObject EqualToChainingTimeStampUP1D_Type = { nullptr, /* tp_as_number */ nullptr, /* tp_as_sequence */ nullptr, /* tp_as_mapping */ - nullptr, /* tp_hash */ + nullptr, /* tp_hash */ nullptr, /* tp_call */ nullptr, /* tp_str */ nullptr, /* tp_getattro */ diff --git a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_EqualToTimeStampUP1D.cpp b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_EqualToTimeStampUP1D.cpp index af98a277bad..6eddd7ea7b2 100644 --- a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_EqualToTimeStampUP1D.cpp +++ b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_EqualToTimeStampUP1D.cpp @@ -79,7 +79,7 @@ PyTypeObject EqualToTimeStampUP1D_Type = { nullptr, /* tp_as_number */ nullptr, /* tp_as_sequence */ nullptr, /* tp_as_mapping */ - nullptr, /* tp_hash */ + nullptr, /* tp_hash */ nullptr, /* tp_call */ nullptr, /* tp_str */ nullptr, /* tp_getattro */ diff --git a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_ExternalContourUP1D.cpp b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_ExternalContourUP1D.cpp index 4c21d1ea54e..dc552b4d7bb 100644 --- a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_ExternalContourUP1D.cpp +++ b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_ExternalContourUP1D.cpp @@ -73,7 +73,7 @@ PyTypeObject ExternalContourUP1D_Type = { nullptr, /* tp_as_number */ nullptr, /* tp_as_sequence */ nullptr, /* tp_as_mapping */ - nullptr, /* tp_hash */ + nullptr, /* tp_hash */ nullptr, /* tp_call */ nullptr, /* tp_str */ nullptr, /* tp_getattro */ diff --git a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_FalseUP1D.cpp b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_FalseUP1D.cpp index 87c1ea918d0..5ce0a269db4 100644 --- a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_FalseUP1D.cpp +++ b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_FalseUP1D.cpp @@ -68,7 +68,7 @@ PyTypeObject FalseUP1D_Type = { nullptr, /* tp_as_number */ nullptr, /* tp_as_sequence */ nullptr, /* tp_as_mapping */ - nullptr, /* tp_hash */ + nullptr, /* tp_hash */ nullptr, /* tp_call */ nullptr, /* tp_str */ nullptr, /* tp_getattro */ diff --git a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_QuantitativeInvisibilityUP1D.cpp b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_QuantitativeInvisibilityUP1D.cpp index 7fa00295887..728e6b938ab 100644 --- a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_QuantitativeInvisibilityUP1D.cpp +++ b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_QuantitativeInvisibilityUP1D.cpp @@ -84,7 +84,7 @@ PyTypeObject QuantitativeInvisibilityUP1D_Type = { nullptr, /* tp_as_number */ nullptr, /* tp_as_sequence */ nullptr, /* tp_as_mapping */ - nullptr, /* tp_hash */ + nullptr, /* tp_hash */ nullptr, /* tp_call */ nullptr, /* tp_str */ nullptr, /* tp_getattro */ diff --git a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_ShapeUP1D.cpp b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_ShapeUP1D.cpp index 2f097c5a6fe..e51d946a3b9 100644 --- a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_ShapeUP1D.cpp +++ b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_ShapeUP1D.cpp @@ -80,7 +80,7 @@ PyTypeObject ShapeUP1D_Type = { nullptr, /* tp_as_number */ nullptr, /* tp_as_sequence */ nullptr, /* tp_as_mapping */ - nullptr, /* tp_hash */ + nullptr, /* tp_hash */ nullptr, /* tp_call */ nullptr, /* tp_str */ nullptr, /* tp_getattro */ diff --git a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_TrueUP1D.cpp b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_TrueUP1D.cpp index d589f621a4d..af1371e0afc 100644 --- a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_TrueUP1D.cpp +++ b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_TrueUP1D.cpp @@ -68,7 +68,7 @@ PyTypeObject TrueUP1D_Type = { nullptr, /* tp_as_number */ nullptr, /* tp_as_sequence */ nullptr, /* tp_as_mapping */ - nullptr, /* tp_hash */ + nullptr, /* tp_hash */ nullptr, /* tp_call */ nullptr, /* tp_str */ nullptr, /* tp_getattro */ diff --git a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_WithinImageBoundaryUP1D.cpp b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_WithinImageBoundaryUP1D.cpp index 32882ac3c20..8dd5f93bb01 100644 --- a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_WithinImageBoundaryUP1D.cpp +++ b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_WithinImageBoundaryUP1D.cpp @@ -81,7 +81,7 @@ PyTypeObject WithinImageBoundaryUP1D_Type = { nullptr, /* tp_as_number */ nullptr, /* tp_as_sequence */ nullptr, /* tp_as_mapping */ - nullptr, /* tp_hash */ + nullptr, /* tp_hash */ nullptr, /* tp_call */ nullptr, /* tp_str */ nullptr, /* tp_getattro */ diff --git a/source/blender/freestyle/intern/scene_graph/DrawingStyle.h b/source/blender/freestyle/intern/scene_graph/DrawingStyle.h index ca1e2351868..1d96812f3f7 100644 --- a/source/blender/freestyle/intern/scene_graph/DrawingStyle.h +++ b/source/blender/freestyle/intern/scene_graph/DrawingStyle.h @@ -50,7 +50,7 @@ class DrawingStyle { { } - /*! operators */ + /** operators */ inline DrawingStyle &operator=(const DrawingStyle &ds); inline void setStyle(const STYLE iStyle) diff --git a/source/blender/freestyle/intern/scene_graph/FrsMaterial.h b/source/blender/freestyle/intern/scene_graph/FrsMaterial.h index 18d3c8839dd..ecdba75b864 100644 --- a/source/blender/freestyle/intern/scene_graph/FrsMaterial.h +++ b/source/blender/freestyle/intern/scene_graph/FrsMaterial.h @@ -29,13 +29,13 @@ namespace Freestyle { -/*! Class defining a material */ +/** Class defining a material */ class FrsMaterial { public: - /*! Default constructor */ + /** Default constructor */ inline FrsMaterial(); - /*! Builds a Material from its line, diffuse, ambient, specular, emissive + /** Builds a Material from its line, diffuse, ambient, specular, emissive * colors, a shininess coefficient and line color priority. * \param iLine: * A 4 element float-array containing the line color. @@ -60,177 +60,177 @@ class FrsMaterial { const float iShininess, const int iPriority); - /*! Copy constructor */ + /** Copy constructor */ inline FrsMaterial(const FrsMaterial &m); - /*! Destructor */ + /** Destructor */ virtual ~FrsMaterial() { } - /*! Returns the line color as a 4 float array */ + /** Returns the line color as a 4 float array */ inline const float *line() const { return Line; } - /*! Returns the red component of the line color */ + /** Returns the red component of the line color */ inline const float lineR() const { return Line[0]; } - /*! Returns the green component of the line color */ + /** Returns the green component of the line color */ inline const float lineG() const { return Line[1]; } - /*! Returns the blue component of the line color */ + /** Returns the blue component of the line color */ inline const float lineB() const { return Line[2]; } - /*! Returns the alpha component of the line color */ + /** Returns the alpha component of the line color */ inline const float lineA() const { return Line[3]; } - /*! Returns the diffuse color as a 4 float array */ + /** Returns the diffuse color as a 4 float array */ inline const float *diffuse() const { return Diffuse; } - /*! Returns the red component of the diffuse color */ + /** Returns the red component of the diffuse color */ inline const float diffuseR() const { return Diffuse[0]; } - /*! Returns the green component of the diffuse color */ + /** Returns the green component of the diffuse color */ inline const float diffuseG() const { return Diffuse[1]; } - /*! Returns the blue component of the diffuse color */ + /** Returns the blue component of the diffuse color */ inline const float diffuseB() const { return Diffuse[2]; } - /*! Returns the alpha component of the diffuse color */ + /** Returns the alpha component of the diffuse color */ inline const float diffuseA() const { return Diffuse[3]; } - /*! Returns the specular color as a 4 float array */ + /** Returns the specular color as a 4 float array */ inline const float *specular() const { return Specular; } - /*! Returns the red component of the specular color */ + /** Returns the red component of the specular color */ inline const float specularR() const { return Specular[0]; } - /*! Returns the green component of the specular color */ + /** Returns the green component of the specular color */ inline const float specularG() const { return Specular[1]; } - /*! Returns the blue component of the specular color */ + /** Returns the blue component of the specular color */ inline const float specularB() const { return Specular[2]; } - /*! Returns the alpha component of the specular color */ + /** Returns the alpha component of the specular color */ inline const float specularA() const { return Specular[3]; } - /*! Returns the ambient color as a 4 float array */ + /** Returns the ambient color as a 4 float array */ inline const float *ambient() const { return Ambient; } - /*! Returns the red component of the ambient color */ + /** Returns the red component of the ambient color */ inline const float ambientR() const { return Ambient[0]; } - /*! Returns the green component of the ambient color */ + /** Returns the green component of the ambient color */ inline const float ambientG() const { return Ambient[1]; } - /*! Returns the blue component of the ambient color */ + /** Returns the blue component of the ambient color */ inline const float ambientB() const { return Ambient[2]; } - /*! Returns the alpha component of the ambient color */ + /** Returns the alpha component of the ambient color */ inline const float ambientA() const { return Ambient[3]; } - /*! Returns the emissive color as a 4 float array */ + /** Returns the emissive color as a 4 float array */ inline const float *emission() const { return Emission; } - /*! Returns the red component of the emissive color */ + /** Returns the red component of the emissive color */ inline const float emissionR() const { return Emission[0]; } - /*! Returns the green component of the emissive color */ + /** Returns the green component of the emissive color */ inline const float emissionG() const { return Emission[1]; } - /*! Returns the blue component of the emissive color */ + /** Returns the blue component of the emissive color */ inline const float emissionB() const { return Emission[2]; } - /*! Returns the alpha component of the emissive color */ + /** Returns the alpha component of the emissive color */ inline const float emissionA() const { return Emission[3]; } - /*! Returns the shininess coefficient */ + /** Returns the shininess coefficient */ inline const float shininess() const { return Shininess; } - /*! Returns the line color priority */ + /** Returns the line color priority */ inline const int priority() const { return Priority; } - /*! Sets the line color. + /** Sets the line color. * \param r: * Red component * \param g: @@ -242,7 +242,7 @@ class FrsMaterial { */ inline void setLine(const float r, const float g, const float b, const float a); - /*! Sets the diffuse color. + /** Sets the diffuse color. * \param r: * Red component * \param g: @@ -254,7 +254,7 @@ class FrsMaterial { */ inline void setDiffuse(const float r, const float g, const float b, const float a); - /*! Sets the specular color. + /** Sets the specular color. * \param r: * Red component * \param g: @@ -266,7 +266,7 @@ class FrsMaterial { */ inline void setSpecular(const float r, const float g, const float b, const float a); - /*! Sets the ambient color. + /** Sets the ambient color. * \param r: * Red component * \param g: @@ -278,7 +278,7 @@ class FrsMaterial { */ inline void setAmbient(const float r, const float g, const float b, const float a); - /*! Sets the emissive color. + /** Sets the emissive color. * \param r: * Red component * \param g: @@ -290,13 +290,13 @@ class FrsMaterial { */ inline void setEmission(const float r, const float g, const float b, const float a); - /*! Sets the shininess. + /** Sets the shininess. * \param s: * Shininess */ inline void setShininess(const float s); - /*! Sets the line color priority. + /** Sets the line color priority. * \param priority: * Priority */ @@ -308,7 +308,7 @@ class FrsMaterial { inline bool operator==(const FrsMaterial &m) const; private: - /*! Material properties */ + /** Material properties */ float Line[4]; float Diffuse[4]; float Specular[4]; diff --git a/source/blender/freestyle/intern/scene_graph/IndexedFaceSet.h b/source/blender/freestyle/intern/scene_graph/IndexedFaceSet.h index 9d1fc009e37..17f922de467 100644 --- a/source/blender/freestyle/intern/scene_graph/IndexedFaceSet.h +++ b/source/blender/freestyle/intern/scene_graph/IndexedFaceSet.h @@ -33,14 +33,14 @@ namespace Freestyle { class IndexedFaceSet : public Rep { public: - /*! Triangles description style:*/ + /** Triangles description style: */ enum TRIANGLES_STYLE { TRIANGLE_STRIP, TRIANGLE_FAN, TRIANGLES, }; - /*! User-specified face and edge marks for feature edge detection */ + /** User-specified face and edge marks for feature edge detection */ /* XXX Why in hell not use an enum here too? */ typedef unsigned char FaceEdgeMark; static const FaceEdgeMark FACE_MARK = 1 << 0; @@ -48,10 +48,10 @@ class IndexedFaceSet : public Rep { static const FaceEdgeMark EDGE_MARK_V2V3 = 1 << 2; static const FaceEdgeMark EDGE_MARK_V3V1 = 1 << 3; - /*! Builds an empty indexed face set */ + /** Builds an empty indexed face set. */ IndexedFaceSet(); - /*! Builds an indexed face set + /** Builds an indexed face set * iVertices * The array of object vertices 3D coordinates (for all faces). * If iCopy != 0, the array is copied; you must deallocate iVertices. Else you must not. @@ -126,7 +126,7 @@ class IndexedFaceSet : public Rep { unsigned iTISize, unsigned iCopy = 1); - /*! Builds an indexed face set from an other indexed face set */ + /** Builds an indexed face set from an other indexed face set */ IndexedFaceSet(const IndexedFaceSet &iBrother); void swap(IndexedFaceSet &ioOther) @@ -166,18 +166,18 @@ class IndexedFaceSet : public Rep { return *this; } - /*! Destructor + /** Destructor * deallocates all the resources */ virtual ~IndexedFaceSet(); - /*! Accept the corresponding visitor */ + /** Accept the corresponding visitor */ virtual void accept(SceneVisitor &v); - /*! Compute the Bounding Box */ + /** Compute the Bounding Box */ virtual void ComputeBBox(); - /*! Accessors */ + /** Accessors */ virtual const float *vertices() const { return _Vertices; diff --git a/source/blender/freestyle/intern/scene_graph/LineRep.h b/source/blender/freestyle/intern/scene_graph/LineRep.h index 43fd736570f..02725102001 100644 --- a/source/blender/freestyle/intern/scene_graph/LineRep.h +++ b/source/blender/freestyle/intern/scene_graph/LineRep.h @@ -32,10 +32,10 @@ using namespace std; namespace Freestyle { -/*! Base class for all lines objects */ +/** Base class for all lines objects */ class LineRep : public Rep { public: - /*! Line description style */ + /** Line description style */ enum LINES_STYLE { LINES, LINE_STRIP, @@ -47,7 +47,7 @@ class LineRep : public Rep { _width = 0.0f; } - /*! Builds a single line from 2 vertices + /** Builds a single line from 2 vertices * v1 * first vertex * v2 @@ -61,7 +61,7 @@ class LineRep : public Rep { _width = 0.0f; } - /*! Builds a line rep from a vertex chain */ + /** Builds a line rep from a vertex chain */ inline LineRep(const vector<Vec3r> &vertices) : Rep() { _vertices = vertices; @@ -69,7 +69,7 @@ class LineRep : public Rep { _width = 0.0f; } - /*! Builds a line rep from a vertex chain */ + /** Builds a line rep from a vertex chain */ inline LineRep(const list<Vec3r> &vertices) : Rep() { for (list<Vec3r>::const_iterator v = vertices.begin(), end = vertices.end(); v != end; ++v) { @@ -84,7 +84,7 @@ class LineRep : public Rep { _vertices.clear(); } - /*! accessors */ + /** accessors */ inline const LINES_STYLE style() const { return _Style; @@ -100,7 +100,7 @@ class LineRep : public Rep { return _width; } - /*! modifiers */ + /** modifiers */ inline void setStyle(const LINES_STYLE iStyle) { _Style = iStyle; @@ -127,14 +127,14 @@ class LineRep : public Rep { _width = iWidth; } - /*! Accept the corresponding visitor */ + /** Accept the corresponding visitor */ virtual void accept(SceneVisitor &v) { Rep::accept(v); v.visitLineRep(*this); } - /*! Computes the line bounding box.*/ + /** Computes the line bounding box. */ virtual void ComputeBBox(); private: diff --git a/source/blender/freestyle/intern/scene_graph/Node.h b/source/blender/freestyle/intern/scene_graph/Node.h index 07bf186ea39..2907580492d 100644 --- a/source/blender/freestyle/intern/scene_graph/Node.h +++ b/source/blender/freestyle/intern/scene_graph/Node.h @@ -52,7 +52,7 @@ class Node : public BaseObject { { } - /*! Accept the corresponding visitor + /** Accept the corresponding visitor * Each inherited node must overload this method */ virtual void accept(SceneVisitor &v) @@ -60,8 +60,8 @@ class Node : public BaseObject { v.visitNode(*this); } - /*! bounding box management */ - /*! Returns the node bounding box + /** bounding box management */ + /** Returns the node bounding box * If no bounding box exists, an empty bbox is returned */ virtual const BBox<Vec3r> &bbox() const @@ -69,13 +69,13 @@ class Node : public BaseObject { return _BBox; } - /*! Sets the Node bounding box */ + /** Sets the Node bounding box */ virtual void setBBox(const BBox<Vec3r> &iBox) { _BBox = iBox; } - /*! Makes the union of _BBox and iBox */ + /** Makes the union of _BBox and iBox */ virtual void AddBBox(const BBox<Vec3r> &iBox) { if (iBox.empty()) { @@ -90,13 +90,13 @@ class Node : public BaseObject { } } - /*! Updates the BBox */ + /** Updates the BBox */ virtual const BBox<Vec3r> &UpdateBBox() { return _BBox; } - /*! Clears the bounding box */ + /** Clears the bounding box */ virtual void clearBBox() { _BBox.clear(); diff --git a/source/blender/freestyle/intern/scene_graph/NodeCamera.h b/source/blender/freestyle/intern/scene_graph/NodeCamera.h index 9e3f9046e39..0135a30f97c 100644 --- a/source/blender/freestyle/intern/scene_graph/NodeCamera.h +++ b/source/blender/freestyle/intern/scene_graph/NodeCamera.h @@ -43,7 +43,7 @@ class NodeCamera : public Node { GENERIC, } CameraType; - /*! Default matrices: Identity for both projection and modelview. */ + /** Default matrices: Identity for both projection and modelview. */ NodeCamera(CameraType camera_type = GENERIC); #if 0 /* UNUSED, gives warning in gcc */ NodeCamera(const NodeCamera &iBrother); @@ -53,13 +53,13 @@ class NodeCamera : public Node { { } - /*! Accept the corresponding visitor */ + /** Accept the corresponding visitor */ virtual void accept(SceneVisitor &v); - /*! Matrix is copied */ + /** Matrix is copied */ void setModelViewMatrix(double modelview_matrix[16]); - /*! Matrix is copied */ + /** Matrix is copied */ void setProjectionMatrix(double projection_matrix[16]); double *modelViewMatrix() @@ -89,7 +89,7 @@ class NodeOrthographicCamera : public NodeCamera { public: NodeOrthographicCamera(); - /*! Builds a parallel projection matrix a la glOrtho. + /** Builds a parallel projection matrix a la glOrtho. * A 0 0 tx * 0 B 0 ty * 0 0 C tz @@ -155,7 +155,7 @@ class NodePerspectiveCamera : public NodeCamera { public: NodePerspectiveCamera(); - /*! Builds a perspective projection matrix a la gluPerspective. + /** Builds a perspective projection matrix a la gluPerspective. * Given f defined as follows: * fovy * f = cotangent(____) @@ -177,7 +177,7 @@ class NodePerspectiveCamera : public NodeCamera { */ NodePerspectiveCamera(double fovy, double aspect, double zNear, double zFar); - /*! Builds a perspective projection matrix a la glFrustum. + /** Builds a perspective projection matrix a la glFrustum. * ( 2*zNear ) * | __________ 0 A 0 | * | right-left | diff --git a/source/blender/freestyle/intern/scene_graph/NodeDrawingStyle.h b/source/blender/freestyle/intern/scene_graph/NodeDrawingStyle.h index 8bbdaf30bad..38b84c7be3a 100644 --- a/source/blender/freestyle/intern/scene_graph/NodeDrawingStyle.h +++ b/source/blender/freestyle/intern/scene_graph/NodeDrawingStyle.h @@ -48,34 +48,34 @@ class NodeDrawingStyle : public NodeGroup { _DrawingStyle = iDrawingStyle; } - /*! Sets the style. Must be one of FILLED, LINES, POINTS, INVISIBLE. */ + /** Sets the style. Must be one of FILLED, LINES, POINTS, INVISIBLE. */ inline void setStyle(const DrawingStyle::STYLE iStyle) { _DrawingStyle.setStyle(iStyle); } - /*! Sets the line width in the LINES style case */ + /** Sets the line width in the LINES style case */ inline void setLineWidth(const float iLineWidth) { _DrawingStyle.setLineWidth(iLineWidth); } - /*! Sets the Point size in the POINTS style case */ + /** Sets the Point size in the POINTS style case */ inline void setPointSize(const float iPointSize) { _DrawingStyle.setPointSize(iPointSize); } - /*! Enables or disables the lighting. true = enable */ + /** Enables or disables the lighting. true = enable */ inline void setLightingEnabled(const bool iEnableLighting) { _DrawingStyle.setLightingEnabled(iEnableLighting); } - /*! Accept the corresponding visitor */ + /** Accept the corresponding visitor */ virtual void accept(SceneVisitor &v); - /*! accessors */ + /** accessors */ inline DrawingStyle::STYLE style() const { return _DrawingStyle.style(); diff --git a/source/blender/freestyle/intern/scene_graph/NodeGroup.cpp b/source/blender/freestyle/intern/scene_graph/NodeGroup.cpp index 69c33ea02a1..12082ba69a8 100644 --- a/source/blender/freestyle/intern/scene_graph/NodeGroup.cpp +++ b/source/blender/freestyle/intern/scene_graph/NodeGroup.cpp @@ -37,7 +37,7 @@ void NodeGroup::AddChild(Node *iChild) int NodeGroup::destroy() { - /*! Node::destroy makes a release on the object and then returns the reference counter. + /** Node::destroy makes a release on the object and then returns the reference counter. * If the reference counter is equal to 0, that means that nobody else is linking this node * group and that we can destroy the whole underlying tree. Else, one or several Node link this * node group, and we only returns the reference counter decremented by Node::destroy(); diff --git a/source/blender/freestyle/intern/scene_graph/NodeGroup.h b/source/blender/freestyle/intern/scene_graph/NodeGroup.h index 0558e22bed1..f33687d43a3 100644 --- a/source/blender/freestyle/intern/scene_graph/NodeGroup.h +++ b/source/blender/freestyle/intern/scene_graph/NodeGroup.h @@ -42,33 +42,33 @@ class NodeGroup : public Node { { } - /*! Adds a child. Makes a addRef on the iChild reference counter */ + /** Adds a child. Makes a addRef on the iChild reference counter */ virtual void AddChild(Node *iChild); - /*! destroys all the underlying nodes + /** destroys all the underlying nodes * Returns the reference counter after having done a release() */ virtual int destroy(); - /*! Detaches all the children */ + /** Detaches all the children */ virtual void DetachChildren(); - /*! Detached the specified child */ + /** Detached the specified child */ virtual void DetachChild(Node *iChild); - /*! Retrieve children */ + /** Retrieve children */ virtual void RetrieveChildren(vector<Node *> &oNodes); - /*! Renders every children */ + /** Renders every children */ // virtual void Render(Renderer *iRenderer); - /*! Accept the corresponding visitor */ + /** Accept the corresponding visitor */ virtual void accept(SceneVisitor &v); - /*! Updates the BBox */ + /** Updates the BBox */ virtual const BBox<Vec3r> &UpdateBBox(); - /*! Returns the number of children */ + /** Returns the number of children */ virtual int numberOfChildren() { return _Children.size(); diff --git a/source/blender/freestyle/intern/scene_graph/NodeLight.h b/source/blender/freestyle/intern/scene_graph/NodeLight.h index bf8389441b6..1d92a96100c 100644 --- a/source/blender/freestyle/intern/scene_graph/NodeLight.h +++ b/source/blender/freestyle/intern/scene_graph/NodeLight.h @@ -40,10 +40,10 @@ class NodeLight : public Node { { } - /*! Accept the corresponding visitor */ + /** Accept the corresponding visitor */ virtual void accept(SceneVisitor &v); - /*! Accessors for the light properties */ + /** Accessors for the light properties */ inline const float *ambient() const { return Ambient; @@ -78,24 +78,24 @@ class NodeLight : public Node { // Data members // ============ - /*! on=true, the light is on */ + /** on=true, the light is on */ bool on; - /*! The color definition */ + /** The color definition */ float Ambient[4]; float Diffuse[4]; float Specular[4]; - /*! Light position. if w = 0, the light is placed at infinite. */ + /** Light position. if w = 0, the light is placed at infinite. */ float Position[4]; - /*! used to manage the number of lights */ - /*! numberOfLights + /** used to manage the number of lights */ + /** numberOfLights * the number of lights in the scene. * Initially, 0. */ static int numberOfLights; - /*! The current lignt number */ + /** The current lignt number */ int _number; }; diff --git a/source/blender/freestyle/intern/scene_graph/NodeShape.h b/source/blender/freestyle/intern/scene_graph/NodeShape.h index 5f7a24b85d5..59b759dbae0 100644 --- a/source/blender/freestyle/intern/scene_graph/NodeShape.h +++ b/source/blender/freestyle/intern/scene_graph/NodeShape.h @@ -46,7 +46,7 @@ class NodeShape : public Node { virtual ~NodeShape(); - /*! Adds a Rep to the _Shapes list + /** Adds a Rep to the _Shapes list * The delete of the rep is done when it is not used any more by the Scene Manager. * So, it must not be deleted by the caller */ @@ -62,17 +62,17 @@ class NodeShape : public Node { AddBBox(iRep->bbox()); } - /*! Accept the corresponding visitor */ + /** Accept the corresponding visitor */ virtual void accept(SceneVisitor &v); - /*! Sets the shape material */ + /** Sets the shape material */ inline void setFrsMaterial(const FrsMaterial &iMaterial) { _FrsMaterial = iMaterial; } - /*! accessors */ - /*! returns the shape's material */ + /** accessors */ + /** returns the shape's material */ inline FrsMaterial &frs_material() { return _FrsMaterial; @@ -84,10 +84,10 @@ class NodeShape : public Node { } private: - /*! list of shapes */ + /** list of shapes */ vector<Rep *> _Shapes; - /*! Shape Material */ + /** Shape Material */ FrsMaterial _FrsMaterial; }; diff --git a/source/blender/freestyle/intern/scene_graph/NodeTransform.h b/source/blender/freestyle/intern/scene_graph/NodeTransform.h index 9d55046a515..3bb14ef842b 100644 --- a/source/blender/freestyle/intern/scene_graph/NodeTransform.h +++ b/source/blender/freestyle/intern/scene_graph/NodeTransform.h @@ -44,10 +44,10 @@ class NodeTransform : public NodeGroup { { } - /*! multiplies the current matrix by the x, y, z translation matrix. */ + /** multiplies the current matrix by the x, y, z translation matrix. */ void Translate(real x, real y, real z); - /*! multiplies the current matrix by a rotation matrix + /** multiplies the current matrix by a rotation matrix * iAngle * The rotation angle * x, y, z @@ -55,32 +55,32 @@ class NodeTransform : public NodeGroup { */ void Rotate(real iAngle, real x, real y, real z); - /*! multiplies the current matrix by a scaling matrix. + /** multiplies the current matrix by a scaling matrix. * x, y, z * The scaling coefficients with respect to the x,y,z axis */ void Scale(real x, real y, real z); - /*! Multiplies the current matrix by iMatrix */ + /** Multiplies the current matrix by iMatrix */ void MultiplyMatrix(const Matrix44r &iMatrix); - /*! Sets the current matrix to iMatrix */ + /** Sets the current matrix to iMatrix */ void setMatrix(const Matrix44r &iMatrix); - /*! Accept the corresponding visitor */ + /** Accept the corresponding visitor */ virtual void accept(SceneVisitor &v); - /*! Overloads the Node::AddBBox in order to take care about the transformation */ + /** Overloads the Node::AddBBox in order to take care about the transformation */ virtual void AddBBox(const BBox<Vec3r> &iBBox); - /*! Checks whether a matrix contains a scale factor or not. + /** Checks whether a matrix contains a scale factor or not. * Returns true if yes. * M * The matrix to check */ bool isScaled(const Matrix44r &M); - /*! accessors */ + /** accessors */ inline const Matrix44r &matrix() const { return _Matrix; diff --git a/source/blender/freestyle/intern/scene_graph/NodeViewLayer.h b/source/blender/freestyle/intern/scene_graph/NodeViewLayer.h index d52155eb216..75f35eea411 100644 --- a/source/blender/freestyle/intern/scene_graph/NodeViewLayer.h +++ b/source/blender/freestyle/intern/scene_graph/NodeViewLayer.h @@ -49,7 +49,7 @@ class NodeViewLayer : public Node { return _ViewLayer; } - /*! Accept the corresponding visitor */ + /** Accept the corresponding visitor */ virtual void accept(SceneVisitor &v); protected: diff --git a/source/blender/freestyle/intern/scene_graph/OrientedLineRep.h b/source/blender/freestyle/intern/scene_graph/OrientedLineRep.h index c33fd529c69..6aaba1d30d2 100644 --- a/source/blender/freestyle/intern/scene_graph/OrientedLineRep.h +++ b/source/blender/freestyle/intern/scene_graph/OrientedLineRep.h @@ -32,7 +32,7 @@ class OrientedLineRep : public LineRep { OrientedLineRep() : LineRep() { } - /*! Builds a single line from 2 vertices + /** Builds a single line from 2 vertices * v1 * first vertex * v2 @@ -42,12 +42,12 @@ class OrientedLineRep : public LineRep { { } - /*! Builds a line rep from a vertex chain */ + /** Builds a line rep from a vertex chain */ inline OrientedLineRep(const vector<Vec3r> &vertices) : LineRep(vertices) { } - /*! Builds a line rep from a vertex chain */ + /** Builds a line rep from a vertex chain */ inline OrientedLineRep(const list<Vec3r> &vertices) : LineRep(vertices) { } @@ -56,7 +56,7 @@ class OrientedLineRep : public LineRep { { } - /*! Accept the corresponding visitor */ + /** Accept the corresponding visitor */ virtual void accept(SceneVisitor &v); }; diff --git a/source/blender/freestyle/intern/scene_graph/Rep.h b/source/blender/freestyle/intern/scene_graph/Rep.h index dae5272beed..1401e69886a 100644 --- a/source/blender/freestyle/intern/scene_graph/Rep.h +++ b/source/blender/freestyle/intern/scene_graph/Rep.h @@ -102,7 +102,7 @@ class Rep : public BaseObject { } } - /*! Accept the corresponding visitor + /** Accept the corresponding visitor * Must be overload by inherited classes */ virtual void accept(SceneVisitor &v) @@ -113,13 +113,13 @@ class Rep : public BaseObject { v.visitRep(*this); } - /*! Computes the rep bounding box. + /** Computes the rep bounding box. * Each Inherited rep must compute its bbox depending on the way the data are stored. So, each * inherited class must overload this method */ virtual void ComputeBBox() = 0; - /*! Returns the rep bounding box */ + /** Returns the rep bounding box */ virtual const BBox<Vec3f> &bbox() const { return _BBox; @@ -145,7 +145,7 @@ class Rep : public BaseObject { return _FrsMaterial; } - /*! Sets the Rep bounding box */ + /** Sets the Rep bounding box */ virtual void setBBox(const BBox<Vec3f> &iBox) { _BBox = iBox; diff --git a/source/blender/freestyle/intern/scene_graph/TriangleRep.h b/source/blender/freestyle/intern/scene_graph/TriangleRep.h index 4461b38d68b..e3f221567b0 100644 --- a/source/blender/freestyle/intern/scene_graph/TriangleRep.h +++ b/source/blender/freestyle/intern/scene_graph/TriangleRep.h @@ -26,10 +26,10 @@ namespace Freestyle { -/*! Base class for all lines objects */ +/** Base class for all lines objects */ class TriangleRep : public Rep { public: - /*! Line description style */ + /** Line description style */ enum TRIANGLE_STYLE { FILL, LINES, @@ -46,7 +46,7 @@ class TriangleRep : public Rep { _Style = FILL; } - /*! Builds a triangle from 3 vertices + /** Builds a triangle from 3 vertices * v0 * first vertex * v1 @@ -83,7 +83,7 @@ class TriangleRep : public Rep { { } - /*! accessors */ + /** accessors */ inline const TRIANGLE_STYLE style() const { return _Style; @@ -99,7 +99,7 @@ class TriangleRep : public Rep { return _colors[index]; } - /*! modifiers */ + /** modifiers */ inline void setStyle(const TRIANGLE_STYLE iStyle) { _Style = iStyle; @@ -129,14 +129,14 @@ class TriangleRep : public Rep { _colors[2] = c2; } - /*! Accept the corresponding visitor */ + /** Accept the corresponding visitor */ virtual void accept(SceneVisitor &v) { Rep::accept(v); v.visitTriangleRep(*this); } - /*! Computes the triangle bounding box.*/ + /** Computes the triangle bounding box. */ virtual void ComputeBBox(); }; diff --git a/source/blender/freestyle/intern/scene_graph/VertexRep.h b/source/blender/freestyle/intern/scene_graph/VertexRep.h index 278cfa694f7..edcb3405e4e 100644 --- a/source/blender/freestyle/intern/scene_graph/VertexRep.h +++ b/source/blender/freestyle/intern/scene_graph/VertexRep.h @@ -47,17 +47,17 @@ class VertexRep : public Rep { { } - /*! Accept the corresponding visitor */ + /** Accept the corresponding visitor */ virtual void accept(SceneVisitor &v) { Rep::accept(v); v.visitVertexRep(*this); } - /*! Computes the rep bounding box. */ + /** Computes the rep bounding box. */ virtual void ComputeBBox(); - /*! accessors */ + /** accessors */ inline const int vid() const { return _vid; @@ -88,7 +88,7 @@ class VertexRep : public Rep { return _PointSize; } - /*! modifiers */ + /** modifiers */ inline void setVid(int id) { _vid = id; diff --git a/source/blender/freestyle/intern/stroke/AdvancedFunctions0D.h b/source/blender/freestyle/intern/stroke/AdvancedFunctions0D.h index 17e419bed54..212187e598c 100644 --- a/source/blender/freestyle/intern/stroke/AdvancedFunctions0D.h +++ b/source/blender/freestyle/intern/stroke/AdvancedFunctions0D.h @@ -36,13 +36,13 @@ namespace Freestyle { namespace Functions0D { // DensityF0D -/*! Returns the density of the (result) image evaluated at an Interface0D. +/** Returns the density of the (result) image evaluated at an Interface0D. * This density is evaluated using a pixels square window around the evaluation point and * integrating these values using a gaussian. */ class DensityF0D : public UnaryFunction0D<double> { public: - /*! Builds the functor from the gaussian sigma value. + /** Builds the functor from the gaussian sigma value. * \param sigma: * sigma indicates the x value for which the gaussian function is 0.5. * It leads to the window size value. (the larger, the smoother) @@ -52,13 +52,13 @@ class DensityF0D : public UnaryFunction0D<double> { _filter.setSigma((float)sigma); } - /*! Returns the string "DensityF0D" */ + /** Returns the string "DensityF0D" */ string getName() const { return "DensityF0D"; } - /*! The () operator. */ + /** The () operator. */ int operator()(Interface0DIterator &iter); private: @@ -66,7 +66,7 @@ class DensityF0D : public UnaryFunction0D<double> { }; // LocalAverageDepthF0D -/*! Returns the average depth around a point. +/** Returns the average depth around a point. * The result is obtained by querying the depth buffer on a window around that point. */ class LocalAverageDepthF0D : public UnaryFunction0D<double> { @@ -74,31 +74,31 @@ class LocalAverageDepthF0D : public UnaryFunction0D<double> { GaussianFilter _filter; public: - /*! Builds the functor from the size of the mask that will be used. */ + /** Builds the functor from the size of the mask that will be used. */ LocalAverageDepthF0D(real maskSize = 5.0f) : UnaryFunction0D<double>() { _filter.setSigma((float)maskSize / 2.0f); } - /*! Returns the string "LocalAverageDepthF0D" */ + /** Returns the string "LocalAverageDepthF0D" */ string getName() const { return "LocalAverageDepthF0D"; } - /*! the () operator. */ + /** the () operator. */ int operator()(Interface0DIterator &iter); }; // ReadMapPixel -/*! Reads a pixel in a map. */ +/** Reads a pixel in a map. */ class ReadMapPixelF0D : public UnaryFunction0D<float> { private: const char *_mapName; int _level; public: - /*! Builds the functor from name of the + /** Builds the functor from name of the * Map that must be read. * \param iMapName: * The name of the map. @@ -111,25 +111,25 @@ class ReadMapPixelF0D : public UnaryFunction0D<float> { _level = level; } - /*! Returns the string "ReadMapPixelF0D" */ + /** Returns the string "ReadMapPixelF0D" */ string getName() const { return "ReadMapPixelF0D"; } - /*! the () operator. */ + /** the () operator. */ int operator()(Interface0DIterator &iter); }; // ReadSteerableViewMapPixel -/*! Reads a pixel in one of the level of one of the steerable viewmaps. */ +/** Reads a pixel in one of the level of one of the steerable viewmaps. */ class ReadSteerableViewMapPixelF0D : public UnaryFunction0D<float> { private: unsigned _orientation; int _level; public: - /*! Builds the functor + /** Builds the functor * \param nOrientation: * The integer belonging to [0,4] indicating the orientation (E,NE,N,NW) we are interested in. * \param level: @@ -141,24 +141,24 @@ class ReadSteerableViewMapPixelF0D : public UnaryFunction0D<float> { _level = level; } - /*! Returns the string "ReadSteerableViewMapPixelF0D" */ + /** Returns the string "ReadSteerableViewMapPixelF0D" */ string getName() const { return "ReadSteerableViewMapPixelF0D"; } - /*! the () operator. */ + /** the () operator. */ int operator()(Interface0DIterator &iter); }; // ReadCompleteViewMapPixel -/*! Reads a pixel in one of the level of the complete viewmap. */ +/** Reads a pixel in one of the level of the complete viewmap. */ class ReadCompleteViewMapPixelF0D : public UnaryFunction0D<float> { private: int _level; public: - /*! Builds the functor + /** Builds the functor * \param level: * The level of the pyramid from which the pixel must be read. */ @@ -167,25 +167,25 @@ class ReadCompleteViewMapPixelF0D : public UnaryFunction0D<float> { _level = level; } - /*! Returns the string "ReadCompleteViewMapPixelF0D" */ + /** Returns the string "ReadCompleteViewMapPixelF0D" */ string getName() const { return "ReadCompleteViewMapPixelF0D"; } - /*! the () operator. */ + /** the () operator. */ int operator()(Interface0DIterator &iter); }; // GetViewMapGradientNormF0D -/*! Returns the norm of the gradient of the global viewmap density image. */ +/** Returns the norm of the gradient of the global viewmap density image. */ class GetViewMapGradientNormF0D : public UnaryFunction0D<float> { private: int _level; float _step; public: - /*! Builds the functor + /** Builds the functor * \param level: * The level of the pyramid from which the pixel must be read. */ @@ -195,13 +195,13 @@ class GetViewMapGradientNormF0D : public UnaryFunction0D<float> { _step = (float)pow(2.0, _level); } - /*! Returns the string "GetOccludeeF0D" */ + /** Returns the string "GetOccludeeF0D" */ string getName() const { return "GetViewMapGradientNormF0D"; } - /*! the () operator. */ + /** the () operator. */ int operator()(Interface0DIterator &iter); }; diff --git a/source/blender/freestyle/intern/stroke/AdvancedFunctions1D.h b/source/blender/freestyle/intern/stroke/AdvancedFunctions1D.h index 349db393e17..486e0fffcdd 100644 --- a/source/blender/freestyle/intern/stroke/AdvancedFunctions1D.h +++ b/source/blender/freestyle/intern/stroke/AdvancedFunctions1D.h @@ -35,7 +35,7 @@ namespace Freestyle { namespace Functions1D { // DensityF1D -/*! Returns the density evaluated for an Interface1D. +/** Returns the density evaluated for an Interface1D. * The density is evaluated for a set of points along the Interface1D (using the DensityF0D * functor) with a user-defined sampling and then integrated into a single value using a * user-defined integration method. @@ -45,7 +45,7 @@ class DensityF1D : public UnaryFunction1D<double> { float _sampling; public: - /*! Builds the functor. + /** Builds the functor. * \param sigma: * Thesigma used in DensityF0D and determining the window size used in each density query. * \param iType: @@ -61,18 +61,18 @@ class DensityF1D : public UnaryFunction1D<double> { _sampling = sampling; } - /*! Destructor */ + /** Destructor */ virtual ~DensityF1D() { } - /*! Returns the string "DensityF1D"*/ + /** Returns the string "DensityF1D". */ string getName() const { return "DensityF1D"; } - /*! the () operator.*/ + /** the () operator. */ int operator()(Interface1D &inter) { result = integrate( @@ -85,14 +85,14 @@ class DensityF1D : public UnaryFunction1D<double> { }; // LocalAverageDepthF1D -/*! Returns the average depth evaluated for an Interface1D. +/** Returns the average depth evaluated for an Interface1D. * The average depth is evaluated for a set of points along the Interface1D (using the * LocalAverageDepthF0D functor) with a user-defined sampling and then integrated into a single * value using a user-defined integration method. */ class LocalAverageDepthF1D : public UnaryFunction1D<double> { public: - /*! Builds the functor. + /** Builds the functor. * \param sigma: * The sigma used in DensityF0D and determining the window size used in each density query. * \param iType: @@ -103,13 +103,13 @@ class LocalAverageDepthF1D : public UnaryFunction1D<double> { { } - /*! Returns the string "LocalAverageDepthF1D" */ + /** Returns the string "LocalAverageDepthF1D" */ string getName() const { return "LocalAverageDepthF1D"; } - /*! the () operator. */ + /** the () operator. */ int operator()(Interface1D &inter) { result = integrate(_fun, inter.verticesBegin(), inter.verticesEnd(), _integration); @@ -121,14 +121,14 @@ class LocalAverageDepthF1D : public UnaryFunction1D<double> { }; // GetCompleteViewMapDensity -/*! Returns the density evaluated for an Interface1D in the complete viewmap image. +/** Returns the density evaluated for an Interface1D in the complete viewmap image. * The density is evaluated for a set of points along the Interface1D (using the * ReadCompleteViewMapPixelF0D functor) and then integrated into a single value using a * user-defined integration method. */ class GetCompleteViewMapDensityF1D : public UnaryFunction1D<double> { public: - /*! Builds the functor. + /** Builds the functor. * \param level: * The level of the pyramid from which * the pixel must be read. @@ -147,13 +147,13 @@ class GetCompleteViewMapDensityF1D : public UnaryFunction1D<double> { _sampling = sampling; } - /*! Returns the string "GetCompleteViewMapDensityF1D" */ + /** Returns the string "GetCompleteViewMapDensityF1D" */ string getName() const { return "GetCompleteViewMapDensityF1D"; } - /*! the () operator. */ + /** the () operator. */ int operator()(Interface1D &inter); private: @@ -162,7 +162,7 @@ class GetCompleteViewMapDensityF1D : public UnaryFunction1D<double> { }; // GetDirectionalViewMapDensity -/*! Returns the density evaluated for an Interface1D in of the steerable viewmaps image. +/** Returns the density evaluated for an Interface1D in of the steerable viewmaps image. * The direction telling which Directional map to choose is explicitly specified by the user. * The density is evaluated for a set of points along the Interface1D * (using the ReadSteerableViewMapPixelF0D functor) @@ -170,7 +170,7 @@ class GetCompleteViewMapDensityF1D : public UnaryFunction1D<double> { */ class GetDirectionalViewMapDensityF1D : public UnaryFunction1D<double> { public: - /*! Builds the functor. + /** Builds the functor. * \param iOrientation: * The number of the directional map we must work with. * \param level: @@ -191,13 +191,13 @@ class GetDirectionalViewMapDensityF1D : public UnaryFunction1D<double> { _sampling = sampling; } - /*! Returns the string "GetDirectionalViewMapDensityF1D" */ + /** Returns the string "GetDirectionalViewMapDensityF1D" */ string getName() const { return "GetDirectionalViewMapDensityF1D"; } - /*! the () operator. */ + /** the () operator. */ int operator()(Interface1D &inter); private: @@ -206,7 +206,7 @@ class GetDirectionalViewMapDensityF1D : public UnaryFunction1D<double> { }; // GetSteerableViewMapDensityF1D -/*! Returns the density of the viewmap for a given Interface1D. The density of each FEdge is +/** Returns the density of the viewmap for a given Interface1D. The density of each FEdge is * evaluated in the proper steerable ViewMap depending on its orientation. */ class GetSteerableViewMapDensityF1D : public UnaryFunction1D<double> { @@ -215,7 +215,7 @@ class GetSteerableViewMapDensityF1D : public UnaryFunction1D<double> { float _sampling; public: - /*! Builds the functor from the level of the pyramid from which the pixel must be read. + /** Builds the functor from the level of the pyramid from which the pixel must be read. * \param level: * The level of the pyramid from which the pixel must be read. * \param iType: @@ -232,23 +232,23 @@ class GetSteerableViewMapDensityF1D : public UnaryFunction1D<double> { _sampling = sampling; } - /*! Destructor */ + /** Destructor */ virtual ~GetSteerableViewMapDensityF1D() { } - /*! Returns the string "GetSteerableViewMapDensityF1D" */ + /** Returns the string "GetSteerableViewMapDensityF1D" */ string getName() const { return "GetSteerableViewMapDensityF1D"; } - /*! the () operator. */ + /** the () operator. */ int operator()(Interface1D &inter); }; // GetViewMapGradientNormF1D -/*! Returns the density of the viewmap for a given Interface1D. The density of each FEdge is +/** Returns the density of the viewmap for a given Interface1D. The density of each FEdge is * evaluated in the proper steerable ViewMap depending on its orientation. */ class GetViewMapGradientNormF1D : public UnaryFunction1D<double> { @@ -258,7 +258,7 @@ class GetViewMapGradientNormF1D : public UnaryFunction1D<double> { Functions0D::GetViewMapGradientNormF0D _func; public: - /*! Builds the functor from the level of the pyramid from which the pixel must be read. + /** Builds the functor from the level of the pyramid from which the pixel must be read. * \param level: * The level of the pyramid from which the pixel must be read. * \param iType: @@ -275,13 +275,13 @@ class GetViewMapGradientNormF1D : public UnaryFunction1D<double> { _sampling = sampling; } - /*! Returns the string "GetSteerableViewMapDensityF1D" */ + /** Returns the string "GetSteerableViewMapDensityF1D" */ string getName() const { return "GetViewMapGradientNormF1D"; } - /*! the () operator. */ + /** the () operator. */ int operator()(Interface1D &inter); }; diff --git a/source/blender/freestyle/intern/stroke/AdvancedPredicates1D.h b/source/blender/freestyle/intern/stroke/AdvancedPredicates1D.h index 25a5efcce34..d7c501e97ad 100644 --- a/source/blender/freestyle/intern/stroke/AdvancedPredicates1D.h +++ b/source/blender/freestyle/intern/stroke/AdvancedPredicates1D.h @@ -38,12 +38,12 @@ namespace Freestyle { namespace Predicates1D { // DensityLowerThanUP1D -/*! Returns true if the density evaluated for the +/** Returns true if the density evaluated for the * Interface1D is less than a user-defined density value. */ class DensityLowerThanUP1D : public UnaryPredicate1D { public: - /*! Builds the functor. + /** Builds the functor. * \param threshold: * The value of the threshold density. * Any Interface1D having a density lower than this threshold will match. @@ -56,13 +56,13 @@ class DensityLowerThanUP1D : public UnaryPredicate1D { _sigma = sigma; } - /*! Returns the string "DensityLowerThanUP1D" */ + /** Returns the string "DensityLowerThanUP1D" */ string getName() const { return "DensityLowerThanUP1D"; } - /*! The () operator. */ + /** The () operator. */ int operator()(Interface1D &inter) { Functions1D::DensityF1D fun(_sigma); diff --git a/source/blender/freestyle/intern/stroke/AdvancedStrokeShaders.h b/source/blender/freestyle/intern/stroke/AdvancedStrokeShaders.h index 63c7d451599..52cd037a73a 100644 --- a/source/blender/freestyle/intern/stroke/AdvancedStrokeShaders.h +++ b/source/blender/freestyle/intern/stroke/AdvancedStrokeShaders.h @@ -25,14 +25,14 @@ namespace Freestyle { -/*! [ Thickness Shader ]. +/** [ Thickness Shader ]. * Assigns thicknesses to the stroke vertices so that the stroke looks like made with a * calligraphic tool. i.e. The stroke will be the thickest in a main direction, the thinnest in the * direction perpendicular to this one, and an interpolation in between. */ class CalligraphicShader : public StrokeShader { public: - /*! Builds the shader. + /** Builds the shader. * \param iMinThickness: * The minimum thickness in the direction perpendicular to the main direction. * \param iMaxThickness: @@ -47,12 +47,12 @@ class CalligraphicShader : public StrokeShader { const Vec2f &iOrientation, bool clamp); - /*! Destructor. */ + /** Destructor. */ virtual ~CalligraphicShader() { } - /*! The shading method */ + /** The shading method */ virtual int shade(Stroke &ioStroke) const; protected: @@ -62,14 +62,14 @@ class CalligraphicShader : public StrokeShader { bool _clamp; }; -/*! [ Geometry Shader ]. +/** [ Geometry Shader ]. * Spatial Noise stroke shader. * Moves the vertices to make the stroke more noisy. * \see \htmlonly <a href=noise/noise.html>noise/noise.html</a> \endhtmlonly */ class SpatialNoiseShader : public StrokeShader { public: - /*! Builds the shader. + /** Builds the shader. * \param iAmount: * The amplitude of the noise. * \param ixScale: @@ -83,12 +83,12 @@ class SpatialNoiseShader : public StrokeShader { */ SpatialNoiseShader(float iAmount, float ixScale, int nbOctave, bool smooth, bool pureRandom); - /*! Destructor. */ + /** Destructor. */ virtual ~SpatialNoiseShader() { } - /*! The shading method. */ + /** The shading method. */ virtual int shade(Stroke &ioStroke) const; protected: @@ -99,7 +99,7 @@ class SpatialNoiseShader : public StrokeShader { bool _pureRandom; }; -/*! [ Geometry Shader ]. +/** [ Geometry Shader ]. * Smooths the stroke. * (Moves the vertices to make the stroke smoother). * Uses curvature flow to converge towards a curve of constant curvature. The diffusion method we @@ -108,7 +108,7 @@ class SpatialNoiseShader : public StrokeShader { */ class SmoothingShader : public StrokeShader { public: - /*! Builds the shader. + /** Builds the shader. * \param iNbIteration: * The number of iterations. (400) * \param iFactorPoint: @@ -135,12 +135,12 @@ class SmoothingShader : public StrokeShader { real iAnisoCurvature, real icarricatureFactor); - /*! Destructor. */ + /** Destructor. */ virtual ~SmoothingShader() { } - /*! The shading method. */ + /** The shading method. */ virtual int shade(Stroke &ioStroke) const; protected: @@ -213,7 +213,7 @@ class Omitter : public Smoother { real _lengthFlat; }; -/*! Omission shader */ +/** Omission shader */ class OmissionShader : public StrokeShader { public: OmissionShader(real sizeWindow, real thrVari, real thrFlat, real lFlat); diff --git a/source/blender/freestyle/intern/stroke/BasicStrokeShaders.h b/source/blender/freestyle/intern/stroke/BasicStrokeShaders.h index 0ac0aa09cf9..2b578dd963a 100644 --- a/source/blender/freestyle/intern/stroke/BasicStrokeShaders.h +++ b/source/blender/freestyle/intern/stroke/BasicStrokeShaders.h @@ -47,12 +47,12 @@ namespace StrokeShaders { // ////////////////////////////////////////////////////// -/*! [ Thickness Shader ]. +/** [ Thickness Shader ]. * Assigns an absolute constant thickness to every vertices of the Stroke. */ class ConstantThicknessShader : public StrokeShader { public: - /*! Builds the shader. + /** Builds the shader. * \param thickness: * The thickness that must be assigned to the stroke. */ @@ -61,18 +61,18 @@ class ConstantThicknessShader : public StrokeShader { _thickness = thickness; } - /*! Destructor. */ + /** Destructor. */ virtual ~ConstantThicknessShader() { } - /*! Returns the string "ConstantThicknessShader".*/ + /** Returns the string "ConstantThicknessShader". */ virtual string getName() const { return "ConstantThicknessShader"; } - /*! The shading method. */ + /** The shading method. */ virtual int shade(Stroke &stroke) const; private: @@ -106,7 +106,7 @@ class ConstantExternThicknessShader : public StrokeShader { float _thickness; }; -/*! [ Thickness Shader ]. +/** [ Thickness Shader ]. * Assigns thicknesses values such as the thickness increases from a thickness value A to a * thickness value B between the first vertex to the midpoint vertex and then decreases from B to a * A between this midpoint vertex and the last vertex. The thickness is linearly interpolated from @@ -114,7 +114,7 @@ class ConstantExternThicknessShader : public StrokeShader { */ class IncreasingThicknessShader : public StrokeShader { public: - /*! Builds the shader. + /** Builds the shader. * \param iThicknessMin: * The first thickness value. * \param iThicknessMax: @@ -126,7 +126,7 @@ class IncreasingThicknessShader : public StrokeShader { _ThicknessMax = iThicknessMax; } - /*! Destructor.*/ + /** Destructor. */ virtual ~IncreasingThicknessShader() { } @@ -136,7 +136,7 @@ class IncreasingThicknessShader : public StrokeShader { return "IncreasingThicknessShader"; } - /*! The shading method. */ + /** The shading method. */ virtual int shade(Stroke &stroke) const; private: @@ -144,7 +144,7 @@ class IncreasingThicknessShader : public StrokeShader { float _ThicknessMax; }; -/*! [ Thickness shader ]. +/** [ Thickness shader ]. * Same as previous but here we allow the user to control the ratio thickness/length so that we * don't get fat short lines */ @@ -155,7 +155,7 @@ class ConstrainedIncreasingThicknessShader : public StrokeShader { float _ratio; public: - /*! Builds the shader. + /** Builds the shader. * \param iThicknessMin: * The first thickness value. * \param iThicknessMax: @@ -171,7 +171,7 @@ class ConstrainedIncreasingThicknessShader : public StrokeShader { _ratio = iRatio; } - /*! Destructor.*/ + /** Destructor. */ virtual ~ConstrainedIncreasingThicknessShader() { } @@ -181,7 +181,7 @@ class ConstrainedIncreasingThicknessShader : public StrokeShader { return "ConstrainedIncreasingThicknessShader"; } - /*! The shading method. */ + /** The shading method. */ virtual int shade(Stroke &stroke) const; }; @@ -217,7 +217,7 @@ class LengthDependingThicknessShader : public StrokeShader { virtual int shade(Stroke &stroke) const; }; -/*! [ Thickness Shader ]. +/** [ Thickness Shader ]. * Adds some noise to the stroke thickness. * \see \htmlonly <a href=noise/noise.html>noise/noise.html</a>\endhtmlonly */ @@ -229,7 +229,7 @@ class ThicknessNoiseShader : public StrokeShader { public: ThicknessNoiseShader(); - /*! Builds a Thickness Noise Shader + /** Builds a Thickness Noise Shader * \param iAmplitude: * The amplitude of the noise signal * \param iPeriod: @@ -242,7 +242,7 @@ class ThicknessNoiseShader : public StrokeShader { return "ThicknessNoiseShader"; } - /*! The shading method. */ + /** The shading method. */ virtual int shade(Stroke &stroke) const; }; @@ -250,12 +250,12 @@ class ThicknessNoiseShader : public StrokeShader { // Color shaders // ///////////////////////////////////////////////////////// -/*! [ Color Shader ]. +/** [ Color Shader ]. * Assigns a constant color to every vertices of the Stroke. */ class ConstantColorShader : public StrokeShader { public: - /*! Builds the shader from a user-specified color. + /** Builds the shader from a user-specified color. * \param iR: * The red component * \param iG: @@ -278,14 +278,14 @@ class ConstantColorShader : public StrokeShader { return "ConstantColorShader"; } - /*! The shading method. */ + /** The shading method. */ virtual int shade(Stroke &stroke) const; private: float _color[4]; }; -/*! [ Color Shader ]. +/** [ Color Shader ]. * Assigns a varying color to the stroke. * The user specifies 2 colors A and B. The stroke color will change linearly from A to B between * the first and the last vertex. @@ -296,7 +296,7 @@ class IncreasingColorShader : public StrokeShader { float _colorMax[4]; public: - /*! Builds the shader from 2 user-specified colors. + /** Builds the shader from 2 user-specified colors. * \param iRm: * The first color red component * \param iGm: @@ -340,7 +340,7 @@ class IncreasingColorShader : public StrokeShader { return "IncreasingColorShader"; } - /*! The shading method. */ + /** The shading method. */ virtual int shade(Stroke &stroke) const; }; @@ -366,7 +366,7 @@ class MaterialColorShader : public StrokeShader { virtual int shade(Stroke &stroke) const; }; -/*! [ Color Shader ]. +/** [ Color Shader ]. * Shader to add noise to the stroke colors. */ class ColorNoiseShader : public StrokeShader { @@ -377,7 +377,7 @@ class ColorNoiseShader : public StrokeShader { public: ColorNoiseShader(); - /*! Builds a Color Noise Shader + /** Builds a Color Noise Shader * \param iAmplitude: * The amplitude of the noise signal * \param iPeriod: @@ -390,7 +390,7 @@ class ColorNoiseShader : public StrokeShader { return "ColorNoiseShader"; } - /*! The shading method. */ + /** The shading method. */ virtual int shade(Stroke &stroke) const; }; @@ -398,7 +398,7 @@ class ColorNoiseShader : public StrokeShader { // Geometry Shaders // /////////////////////////////////////////////////////////////////////////////// -/*! [ Geometry Shader ]. +/** [ Geometry Shader ]. * Stretches the stroke at its two extremities and following the respective directions: v(1)v(0) * and v(n-1)v(n). */ @@ -407,7 +407,7 @@ class BackboneStretcherShader : public StrokeShader { float _amount; public: - /*! Builds the shader. + /** Builds the shader. * \param iAmount: * The stretching amount value. */ @@ -421,11 +421,11 @@ class BackboneStretcherShader : public StrokeShader { return "BackboneStretcherShader"; } - /*! The shading method */ + /** The shading method */ virtual int shade(Stroke &stroke) const; }; -/*! [ Geometry Shader. ] +/** [ Geometry Shader. ] * Resamples the stroke. * \see Stroke::Resample(float). */ @@ -434,7 +434,7 @@ class SamplingShader : public StrokeShader { float _sampling; public: - /*! Builds the shader. + /** Builds the shader. * \param sampling: * The sampling to use for the stroke resampling */ @@ -448,7 +448,7 @@ class SamplingShader : public StrokeShader { return "SamplingShader"; } - /*! The shading method */ + /** The shading method */ virtual int shade(Stroke &stroke) const; }; @@ -471,7 +471,7 @@ class ExternalContourStretcherShader : public StrokeShader { }; // Bezier curve stroke shader -/*! [ Geometry Shader ]. +/** [ Geometry Shader ]. * Transforms the stroke backbone geometry so that it corresponds to a Bezier Curve approximation * of the original backbone geometry. \see \htmlonly <a * href=bezier/bezier.html>bezier/bezier.html</a> \endhtmlonly @@ -481,7 +481,7 @@ class BezierCurveShader : public StrokeShader { float _error; public: - /*! Builds the shader. + /** Builds the shader. * \param error: * The error we're allowing for the approximation. * This error is the max distance allowed between the new curve and the original geometry. @@ -496,11 +496,11 @@ class BezierCurveShader : public StrokeShader { return "BezierCurveShader"; } - /*! The shading method */ + /** The shading method */ virtual int shade(Stroke &stroke) const; }; -/*! [ Geometry Shader ]. +/** [ Geometry Shader ]. * Shader to modify the Stroke geometry so that it looks more "polygonal". * The basic idea is to start from the minimal stroke approximation consisting in a line joining * the first vertex to the last one and to subdivide using the original stroke vertices until a @@ -511,7 +511,7 @@ class PolygonalizationShader : public StrokeShader { float _error; public: - /*! Builds the shader. + /** Builds the shader. * \param iError: * The error we want our polygonal approximation to have with respect to the original * geometry. The smaller, the closer the new stroke to the original one. @@ -527,11 +527,11 @@ class PolygonalizationShader : public StrokeShader { return "PolygonalizationShader"; } - /*! The shading method */ + /** The shading method */ virtual int shade(Stroke &stroke) const; }; -/*! [ Geometry Shader ]. +/** [ Geometry Shader ]. * Shader to modify the Stroke geometry so that it corresponds to its main direction line. * This shader must be used together with the splitting operator using the curvature criterion. * Indeed, the precision of the approximation will depend on the size of the stroke's pieces. @@ -542,7 +542,7 @@ class GuidingLinesShader : public StrokeShader { float _offset; public: - /*! Builds a Guiding Lines shader + /** Builds a Guiding Lines shader * \param iOffset: * The line that replaces the stroke is initially in the middle of the initial stroke * "bbox". iOffset is the value of the displacement which is applied to this line along its @@ -558,27 +558,27 @@ class GuidingLinesShader : public StrokeShader { return "GuidingLinesShader"; } - /*! The shading method */ + /** The shading method */ virtual int shade(Stroke &stroke) const; }; -/*! [ Geometry Shader ]. +/** [ Geometry Shader ]. * Removes the stroke's extremities. */ class TipRemoverShader : public StrokeShader { public: - /*! Builds the shader. + /** Builds the shader. * \param tipLength: * The length of the piece of stroke we want to remove at each extremity. */ TipRemoverShader(real tipLength); - /*! Destructor. */ + /** Destructor. */ virtual ~TipRemoverShader() { } - /*! The shading method */ + /** The shading method */ virtual string getName() const { return "TipRemoverShader"; @@ -590,7 +590,7 @@ class TipRemoverShader : public StrokeShader { real _tipLength; }; -/*! [ Texture Shader ]. +/** [ Texture Shader ]. * Shader to assign texture to the Stroke material. */ @@ -600,7 +600,7 @@ class BlenderTextureShader : public StrokeShader { bNodeTree *_nodeTree; public: - /*! Builds the shader. + /** Builds the shader. * \param mtex: * The blender texture to use. */ @@ -610,7 +610,7 @@ class BlenderTextureShader : public StrokeShader { _nodeTree = NULL; } - /*! Builds the shader. + /** Builds the shader. * \param nodetree: * A node tree (of new shading nodes) to define textures. */ @@ -625,11 +625,11 @@ class BlenderTextureShader : public StrokeShader { return "BlenderTextureShader"; } - /*! The shading method */ + /** The shading method */ virtual int shade(Stroke &stroke) const; }; -/*! [ Texture Shader ]. +/** [ Texture Shader ]. * Shader to assign texture to the Stroke material. */ @@ -638,7 +638,7 @@ class StrokeTextureStepShader : public StrokeShader { float _step; public: - /*! Builds the shader. + /** Builds the shader. * \param id: * The number of the preset to use. */ @@ -652,7 +652,7 @@ class StrokeTextureStepShader : public StrokeShader { return "StrokeTextureStepShader"; } - /*! The shading method */ + /** The shading method */ virtual int shade(Stroke &stroke) const; }; diff --git a/source/blender/freestyle/intern/stroke/Canvas.h b/source/blender/freestyle/intern/stroke/Canvas.h index 91676946b5d..8d71cd534ec 100644 --- a/source/blender/freestyle/intern/stroke/Canvas.h +++ b/source/blender/freestyle/intern/stroke/Canvas.h @@ -60,12 +60,12 @@ class ImagePyramid; class SteerableViewMap; class StyleModule; -/*! Class to define the canvas on which strokes are drawn. +/** Class to define the canvas on which strokes are drawn. * It's used to store state information about the drawing. */ class Canvas { public: - /*! Returns a pointer on the Canvas instance */ + /** Returns a pointer on the Canvas instance */ static Canvas *getInstance() { return _pInstance; @@ -136,7 +136,7 @@ class Canvas { } /* Maps management */ - /*! Loads an image map. The map will be scaled + /** Loads an image map. The map will be scaled * (without preserving the ratio in order to fit the actual canvas size.). * The image must be a gray values image... * \param iFileName: @@ -152,7 +152,7 @@ class Canvas { unsigned iNbLevels = 4, float iSigma = 1.0f); - /*! Reads a pixel value in a map. + /** Reads a pixel value in a map. * Returns a value between 0 and 1. * \param iMapName: * The name of the map @@ -167,19 +167,19 @@ class Canvas { */ float readMapPixel(const char *iMapName, int level, int x, int y); - /*! Sets the steerable viewmap */ + /** Sets the steerable viewmap */ void loadSteerableViewMap(SteerableViewMap *iSVM) { _steerableViewMap = iSVM; } - /*! Returns the steerable VM */ + /** Returns the steerable VM */ SteerableViewMap *getSteerableViewMap() { return _steerableViewMap; } - /*! accessors */ + /** accessors */ inline const FEdge *selectedFEdge() const { return _SelectedFEdge; @@ -215,13 +215,13 @@ class Canvas { return stroke_count; } - /*! modifiers */ + /** modifiers */ inline void setSelectedFEdge(FEdge *iFEdge) { _SelectedFEdge = iFEdge; } - /*! inserts a shader at pos index+1 */ + /** inserts a shader at pos index+1 */ void PushBackStyleModule(StyleModule *iStyleModule); void InsertStyleModule(unsigned index, StyleModule *iStyleModule); void RemoveStyleModule(unsigned index); diff --git a/source/blender/freestyle/intern/stroke/Chain.h b/source/blender/freestyle/intern/stroke/Chain.h index d5dae5c35ba..bcc6957b714 100644 --- a/source/blender/freestyle/intern/stroke/Chain.h +++ b/source/blender/freestyle/intern/stroke/Chain.h @@ -27,7 +27,7 @@ namespace Freestyle { -/*! Class to represent a 1D elements issued from the chaining process. +/** Class to represent a 1D elements issued from the chaining process. * A Chain is the last step before the Stroke and is used in the Splitting and Creation processes. */ class Chain : public Curve { @@ -38,28 +38,28 @@ class Chain : public Curve { _fedgeB; // the last FEdge of the ViewEdge passed to the last call for push_viewedge_back(). public: - /*! Default constructor. */ + /** Default constructor. */ Chain() : Curve() { _splittingId = 0; _fedgeB = 0; } - /*! Builds a chain from its Id. */ + /** Builds a chain from its Id. */ Chain(const Id &id) : Curve(id) { _splittingId = 0; _fedgeB = 0; } - /*! Copy Constructor */ + /** Copy Constructor */ Chain(const Chain &iBrother) : Curve(iBrother) { _splittingId = iBrother._splittingId; _fedgeB = iBrother._fedgeB; } - /*! Destructor. */ + /** Destructor. */ virtual ~Chain() { // only the last splitted deletes this id @@ -70,13 +70,13 @@ class Chain : public Curve { } } - /*! Returns the string "Chain" */ + /** Returns the string "Chain" */ virtual string getExactTypeName() const { return "Chain"; } - /*! Adds a ViewEdge at the end of the chain + /** Adds a ViewEdge at the end of the chain * \param iViewEdge: * The ViewEdge that must be added. * \param orientation: @@ -84,7 +84,7 @@ class Chain : public Curve { */ void push_viewedge_back(ViewEdge *iViewEdge, bool orientation); - /*! Adds a ViewEdge at the beginning of the chain + /** Adds a ViewEdge at the beginning of the chain * \param iViewEdge: * The ViewEdge that must be added. * \param orientation: diff --git a/source/blender/freestyle/intern/stroke/ChainingIterators.h b/source/blender/freestyle/intern/stroke/ChainingIterators.h index 0a9e7114ecb..93aba258358 100644 --- a/source/blender/freestyle/intern/stroke/ChainingIterators.h +++ b/source/blender/freestyle/intern/stroke/ChainingIterators.h @@ -98,11 +98,11 @@ class AdjacencyIterator : public Iterator { return _internalIterator.isBegin(); } - /*! Returns true if the current ViewEdge is coming towards the iteration vertex. + /** Returns true if the current ViewEdge is coming towards the iteration vertex. * False otherwise. */ bool isIncoming() const; - /*! Returns a *pointer* to the pointed ViewEdge. */ + /** Returns a *pointer* to the pointed ViewEdge. */ virtual ViewEdge *operator*(); virtual ViewEdge *operator->() @@ -140,7 +140,7 @@ class AdjacencyIterator : public Iterator { // /////////////////////////////////////////////////////////// -/*! Base class for chaining iterators. +/** Base class for chaining iterators. * This class is designed to be overloaded in order to describe chaining rules. * It makes the works of chaining rules description easier. * The two main methods that need to overloaded are traverse() and init(). @@ -159,7 +159,7 @@ class ChainingIterator : public ViewEdgeInternal::ViewEdgeIterator { ViewEdge *result; void *py_c_it; - /*! Builds a Chaining Iterator from the first ViewEdge used for iteration and its orientation. + /** Builds a Chaining Iterator from the first ViewEdge used for iteration and its orientation. * \param iRestrictToSelection: * Indicates whether to force the chaining to stay within * the set of selected ViewEdges or not. @@ -183,7 +183,7 @@ class ChainingIterator : public ViewEdgeInternal::ViewEdgeIterator { py_c_it = NULL; } - /*! Copy constructor */ + /** Copy constructor */ ChainingIterator(const ChainingIterator &brother) : ViewEdgeIterator(brother) { _restrictToSelection = brother._restrictToSelection; @@ -192,19 +192,19 @@ class ChainingIterator : public ViewEdgeInternal::ViewEdgeIterator { py_c_it = brother.py_c_it; } - /*! Returns the string "ChainingIterator" */ + /** Returns the string "ChainingIterator" */ virtual string getExactTypeName() const { return "ChainingIterator"; } - /*! Inits the iterator context. + /** Inits the iterator context. * This method is called each time a new chain is started. * It can be used to reset some history information that you might want to keep. */ virtual int init(); - /*! This method iterates over the potential next ViewEdges and returns the one that will be + /** This method iterates over the potential next ViewEdges and returns the one that will be * followed next. returns the next ViewEdge to follow or 0 when the end of the chain is reached. * \param it: * The iterator over the ViewEdges adjacent to the end vertex of the current ViewEdge. @@ -214,11 +214,11 @@ class ChainingIterator : public ViewEdgeInternal::ViewEdgeIterator { virtual int traverse(const AdjacencyIterator &it); /* accessors */ - /*! Returns true if the orientation of the current ViewEdge corresponds to its natural + /** Returns true if the orientation of the current ViewEdge corresponds to its natural * orientation */ // inline bool getOrientation() const {} - /*! Returns the vertex which is the next crossing */ + /** Returns the vertex which is the next crossing */ inline ViewVertex *getVertex() { if (_increment) { @@ -239,13 +239,13 @@ class ChainingIterator : public ViewEdgeInternal::ViewEdgeIterator { } } - /*! Returns true if the current iteration is an incrementation */ + /** Returns true if the current iteration is an incrementation */ inline bool isIncrementing() const { return _increment; } - /* increments.*/ + /* Increments. */ virtual int increment(); virtual int decrement(); }; @@ -255,7 +255,7 @@ class ChainingIterator : public ViewEdgeInternal::ViewEdgeIterator { // /////////////////////////////////////////////////////////// -/*! A ViewEdge Iterator used to follow ViewEdges the most naturally. +/** A ViewEdge Iterator used to follow ViewEdges the most naturally. * For example, it will follow visible ViewEdges of same nature. * As soon, as the nature or the visibility changes, the iteration stops (by setting the pointed * ViewEdge to 0). In the case of an iteration over a set of ViewEdge that are both Silhouette @@ -263,7 +263,7 @@ class ChainingIterator : public ViewEdgeInternal::ViewEdgeIterator { */ class ChainSilhouetteIterator : public ChainingIterator { public: - /*! Builds a ChainSilhouetteIterator from the first ViewEdge used for iteration and its + /** Builds a ChainSilhouetteIterator from the first ViewEdge used for iteration and its * orientation. * \param iRestrictToSelection: * Indicates whether to force the chaining to stay within the set of selected ViewEdges or @@ -282,24 +282,24 @@ class ChainSilhouetteIterator : public ChainingIterator { { } - /*! Copy constructor */ + /** Copy constructor */ ChainSilhouetteIterator(const ChainSilhouetteIterator &brother) : ChainingIterator(brother) { } - /*! Returns the string "ChainSilhouetteIterator" */ + /** Returns the string "ChainSilhouetteIterator" */ virtual string getExactTypeName() const { return "ChainSilhouetteIterator"; } - /*! This method iterates over the potential next ViewEdges and returns the one that will be + /** This method iterates over the potential next ViewEdges and returns the one that will be * followed next. * When reaching the end of a chain, 0 is returned. */ virtual int traverse(const AdjacencyIterator &it); - /*! Inits the iterator context */ + /** Inits the iterator context */ virtual int init() { return 0; @@ -311,7 +311,7 @@ class ChainSilhouetteIterator : public ChainingIterator { // /////////////////////////////////////////////////////////// -/*! A "generic" user-controlled ViewEdge iterator. This iterator is in particular built from a +/** A "generic" user-controlled ViewEdge iterator. This iterator is in particular built from a * unary predicate and a binary predicate. * First, the unary predicate is evaluated for all potential next ViewEdges in order to only * keep the ones respecting a certain constraint. @@ -327,7 +327,7 @@ class ChainPredicateIterator : public ChainingIterator { UnaryPredicate1D *_unary_predicate; // the caller is responsible for the deletion of this object public: - /*! Builds a ChainPredicateIterator from a starting ViewEdge and its orientation. + /** Builds a ChainPredicateIterator from a starting ViewEdge and its orientation. * \param iRestrictToSelection: * Indicates whether to force the chaining to stay * within the set of selected ViewEdges or not. @@ -350,7 +350,7 @@ class ChainPredicateIterator : public ChainingIterator { _unary_predicate = 0; } - /*! Builds a ChainPredicateIterator from a unary predicate, a binary predicate, a starting + /** Builds a ChainPredicateIterator from a unary predicate, a binary predicate, a starting * ViewEdge and its orientation. * \param iRestrictToSelection: * Indicates whether to force the chaining to stay @@ -381,32 +381,32 @@ class ChainPredicateIterator : public ChainingIterator { _binary_predicate = &bpred; } - /*! Copy constructor */ + /** Copy constructor */ ChainPredicateIterator(const ChainPredicateIterator &brother) : ChainingIterator(brother) { _unary_predicate = brother._unary_predicate; _binary_predicate = brother._binary_predicate; } - /*! Destructor. */ + /** Destructor. */ virtual ~ChainPredicateIterator() { _unary_predicate = 0; _binary_predicate = 0; } - /*! Returns the string "ChainPredicateIterator" */ + /** Returns the string "ChainPredicateIterator" */ virtual string getExactTypeName() const { return "ChainPredicateIterator"; } - /*! This method iterates over the potential next ViewEdges and returns the one that will be + /** This method iterates over the potential next ViewEdges and returns the one that will be * followed next. When reaching the end of a chain, 0 is returned. */ virtual int traverse(const AdjacencyIterator &it); - /*! Inits the iterator context */ + /** Inits the iterator context */ virtual int init() { return 0; diff --git a/source/blender/freestyle/intern/stroke/ContextFunctions.h b/source/blender/freestyle/intern/stroke/ContextFunctions.h index 334bdd657c1..4878d2a6c54 100644 --- a/source/blender/freestyle/intern/stroke/ContextFunctions.h +++ b/source/blender/freestyle/intern/stroke/ContextFunctions.h @@ -33,34 +33,34 @@ namespace Freestyle { // Context Functions definitions // /////////////////////////////////////////////////////////// -/*! namespace containing all the Context related functions */ +/** namespace containing all the Context related functions */ namespace ContextFunctions { // GetTimeStamp -/*! Returns the system time stamp */ +/** Returns the system time stamp */ unsigned GetTimeStampCF(); // GetCanvasWidth -/*! Returns the canvas width */ +/** Returns the canvas width */ unsigned GetCanvasWidthCF(); // GetCanvasHeight -/*! Returns the canvas height */ +/** Returns the canvas height */ unsigned GetCanvasHeightCF(); // GetBorder -/*! Returns the border */ +/** Returns the border */ BBox<Vec2i> GetBorderCF(); // Load map -/*! Loads an image map for further reading */ +/** Loads an image map for further reading */ void LoadMapCF(const char *iFileName, const char *iMapName, unsigned iNbLevels = 4, float iSigma = 1.0f); // ReadMapPixel -/*! Reads a pixel in a user-defined map +/** Reads a pixel in a user-defined map * \return the floating value stored for that pixel * \param iMapName: * The name of the map @@ -74,7 +74,7 @@ void LoadMapCF(const char *iFileName, float ReadMapPixelCF(const char *iMapName, int level, unsigned x, unsigned y); // ReadCompleteViewMapPixel -/*! Reads a pixel in the complete view map +/** Reads a pixel in the complete view map * \return the floating value stored for that pixel * \param level: * The level of the pyramid in which we wish to read the pixel @@ -86,7 +86,7 @@ float ReadMapPixelCF(const char *iMapName, int level, unsigned x, unsigned y); float ReadCompleteViewMapPixelCF(int level, unsigned x, unsigned y); // ReadOrientedViewMapPixel -/*! Reads a pixel in one of the oriented view map images +/** Reads a pixel in one of the oriented view map images * \return the floating value stored for that pixel * \param iOrientation: * The number telling which orientation we want to check diff --git a/source/blender/freestyle/intern/stroke/Curve.cpp b/source/blender/freestyle/intern/stroke/Curve.cpp index 768e9efa15d..08d7a0b792a 100644 --- a/source/blender/freestyle/intern/stroke/Curve.cpp +++ b/source/blender/freestyle/intern/stroke/Curve.cpp @@ -573,7 +573,7 @@ Curve::~Curve() } } -/*! iterators access */ +/** iterators access */ Curve::point_iterator Curve::points_begin(float step) { vertex_container::iterator second = _Vertices.begin(); diff --git a/source/blender/freestyle/intern/stroke/Curve.h b/source/blender/freestyle/intern/stroke/Curve.h index f0db45150a9..9a05fcd380b 100644 --- a/source/blender/freestyle/intern/stroke/Curve.h +++ b/source/blender/freestyle/intern/stroke/Curve.h @@ -52,7 +52,7 @@ using namespace Geometry; /* */ /**********************************/ -/*! Class to represent a point of a curve. +/** Class to represent a point of a curve. * A CurvePoint can be any point of a 1D curve (it doesn't have to be a vertex of the curve). * Any Interface1D is built upon ViewEdges, themselves built upon FEdges. Therefore, a curve is * basically a polyline made of a list SVertex. Thus, a CurvePoint is built by linearly @@ -61,56 +61,56 @@ using namespace Geometry; */ class CurvePoint : public Interface0D { public: // Implementation of Interface0D - /*! Returns the string "CurvePoint"*/ + /** Returns the string "CurvePoint". */ virtual string getExactTypeName() const { return "CurvePoint"; } // Data access methods - /*! Returns the 3D X coordinate of the point */ + /** Returns the 3D X coordinate of the point */ virtual real getX() const { return _Point3d.x(); } - /*! Returns the 3D Y coordinate of the point */ + /** Returns the 3D Y coordinate of the point */ virtual real getY() const { return _Point3d.y(); } - /*! Returns the 3D Z coordinate of the point */ + /** Returns the 3D Z coordinate of the point */ virtual real getZ() const { return _Point3d.z(); } - /*! Returns the 3D point. */ + /** Returns the 3D point. */ virtual Vec3r getPoint3D() const { return _Point3d; } - /*! Returns the projected 3D X coordinate of the point */ + /** Returns the projected 3D X coordinate of the point */ virtual real getProjectedX() const { return _Point2d.x(); } - /*! Returns the projected 3D Y coordinate of the point */ + /** Returns the projected 3D Y coordinate of the point */ virtual real getProjectedY() const { return _Point2d.y(); } - /*! Returns the projected 3D Z coordinate of the point */ + /** Returns the projected 3D Z coordinate of the point */ virtual real getProjectedZ() const { return _Point2d.z(); } - /*! Returns the 2D point. */ + /** Returns the 2D point. */ virtual Vec2r getPoint2D() const { return Vec2r(_Point2d.x(), _Point2d.y()); @@ -118,7 +118,7 @@ class CurvePoint : public Interface0D { virtual FEdge *getFEdge(Interface0D &inter); - /*! Returns the CurvePoint's Id */ + /** Returns the CurvePoint's Id */ virtual Id getId() const { Id id; @@ -131,7 +131,7 @@ class CurvePoint : public Interface0D { return id; } - /*! Returns the CurvePoint's Nature */ + /** Returns the CurvePoint's Nature */ virtual Nature::VertexNature getNature() const { Nature::VertexNature nature = Nature::POINT; @@ -144,7 +144,7 @@ class CurvePoint : public Interface0D { return nature; } - /*! Cast the Interface0D in SVertex if it can be. */ + /** Cast the Interface0D in SVertex if it can be. */ virtual SVertex *castToSVertex() { if (_t2d == 0) { @@ -156,7 +156,7 @@ class CurvePoint : public Interface0D { return Interface0D::castToSVertex(); } - /*! Cast the Interface0D in ViewVertex if it can be. */ + /** Cast the Interface0D in ViewVertex if it can be. */ virtual ViewVertex *castToViewVertex() { if (_t2d == 0) { @@ -168,7 +168,7 @@ class CurvePoint : public Interface0D { return Interface0D::castToViewVertex(); } - /*! Cast the Interface0D in NonTVertex if it can be. */ + /** Cast the Interface0D in NonTVertex if it can be. */ virtual NonTVertex *castToNonTVertex() { if (_t2d == 0) { @@ -180,7 +180,7 @@ class CurvePoint : public Interface0D { return Interface0D::castToNonTVertex(); } - /*! Cast the Interface0D in TVertex if it can be. */ + /** Cast the Interface0D in TVertex if it can be. */ virtual TVertex *castToTVertex() { if (_t2d == 0) { @@ -204,10 +204,10 @@ class CurvePoint : public Interface0D { Vec3r _Point3d; public: - /*! Default Constructor. */ + /** Default Constructor. */ CurvePoint(); - /*! Builds a CurvePoint from two SVertex and an interpolation parameter. + /** Builds a CurvePoint from two SVertex and an interpolation parameter. * \param iA: * The first SVertex * \param iB: @@ -217,7 +217,7 @@ class CurvePoint : public Interface0D { */ CurvePoint(SVertex *iA, SVertex *iB, float t); - /*! Builds a CurvePoint from two CurvePoint and an interpolation parameter. + /** Builds a CurvePoint from two CurvePoint and an interpolation parameter. * \param iA: * The first CurvePoint * \param iB: @@ -229,35 +229,35 @@ class CurvePoint : public Interface0D { // CurvePoint(SVertex *iA, SVertex *iB, float t2d, float t3d); - /*! Copy Constructor. */ + /** Copy Constructor. */ CurvePoint(const CurvePoint &iBrother); - /*! Operator = */ + /** Operator = */ CurvePoint &operator=(const CurvePoint &iBrother); - /*! Destructor */ + /** Destructor */ virtual ~CurvePoint() = default; - /*! Operator == */ + /** Operator == */ bool operator==(const CurvePoint &b) { return ((__A == b.__A) && (__B == b.__B) && (_t2d == b._t2d)); } /* accessors */ - /*! Returns the first SVertex upon which the CurvePoint is built. */ + /** Returns the first SVertex upon which the CurvePoint is built. */ inline SVertex *A() { return __A; } - /*! Returns the second SVertex upon which the CurvePoint is built. */ + /** Returns the second SVertex upon which the CurvePoint is built. */ inline SVertex *B() { return __B; } - /*! Returns the interpolation parameter. */ + /** Returns the interpolation parameter. */ inline float t2d() const { return _t2d; @@ -271,19 +271,19 @@ class CurvePoint : public Interface0D { #endif /* modifiers */ - /*! Sets the first SVertex upon which to build the CurvePoint. */ + /** Sets the first SVertex upon which to build the CurvePoint. */ inline void setA(SVertex *iA) { __A = iA; } - /*! Sets the second SVertex upon which to build the CurvePoint. */ + /** Sets the second SVertex upon which to build the CurvePoint. */ inline void setB(SVertex *iB) { __B = iB; } - /*! Sets the 2D interpolation parameter to use. */ + /** Sets the 2D interpolation parameter to use. */ inline void setT2d(float t) { _t2d = t; @@ -339,7 +339,7 @@ class CurvePoint : public Interface0D { } Vec3r curvature2d_as_vector() const; - /*! angle in radians */ + /** angle in radians */ real curvature2d_as_angle() const; real curvatureFredo() const; @@ -368,7 +368,7 @@ class CurvePointIterator; } // end of namespace CurveInternal -/*! Base class for curves made of CurvePoints. +/** Base class for curves made of CurvePoints. * SVertex is the type of the initial curve vertices. * A Chain is a specialization of a Curve. */ @@ -396,7 +396,7 @@ class Curve : public Interface1D { unsigned _nSegments; // number of segments public: - /*! Default Constructor. */ + /** Default Constructor. */ Curve() { _Length = 0; @@ -404,7 +404,7 @@ class Curve : public Interface1D { _nSegments = 0; } - /*! Builds a Curve from its id */ + /** Builds a Curve from its id */ Curve(const Id &id) { _Length = 0; @@ -412,7 +412,7 @@ class Curve : public Interface1D { _nSegments = 0; } - /*! Copy Constructor. */ + /** Copy Constructor. */ Curve(const Curve &iBrother) { _Length = iBrother._Length; @@ -421,10 +421,10 @@ class Curve : public Interface1D { _nSegments = 0; } - /*! Destructor. */ + /** Destructor. */ virtual ~Curve(); - /*! Returns the string "Curve" */ + /** Returns the string "Curve" */ virtual string getExactTypeName() const { return "Curve"; @@ -435,7 +435,7 @@ class Curve : public Interface1D { void computeCurvatureAndOrientation(); #endif - /*! Adds a single vertex (CurvePoint) at the end of the Curve */ + /** Adds a single vertex (CurvePoint) at the end of the Curve */ inline void push_vertex_back(Vertex *iVertex) { if (!_Vertices.empty()) { @@ -447,7 +447,7 @@ class Curve : public Interface1D { _Vertices.push_back(new_vertex); } - /*! Adds a single vertex (SVertex) at the end of the Curve */ + /** Adds a single vertex (SVertex) at the end of the Curve */ inline void push_vertex_back(SVertex *iVertex) { if (!_Vertices.empty()) { @@ -459,7 +459,7 @@ class Curve : public Interface1D { _Vertices.push_back(new_vertex); } - /*! Adds a single vertex (CurvePoint) at the front of the Curve */ + /** Adds a single vertex (CurvePoint) at the front of the Curve */ inline void push_vertex_front(Vertex *iVertex) { if (!_Vertices.empty()) { @@ -471,7 +471,7 @@ class Curve : public Interface1D { _Vertices.push_front(new_vertex); } - /*! Adds a single vertex (SVertex) at the front of the Curve */ + /** Adds a single vertex (SVertex) at the front of the Curve */ inline void push_vertex_front(SVertex *iVertex) { if (!_Vertices.empty()) { @@ -483,25 +483,25 @@ class Curve : public Interface1D { _Vertices.push_front(new_vertex); } - /*! Returns true is the Curve doesn't have any Vertex yet. */ + /** Returns true is the Curve doesn't have any Vertex yet. */ inline bool empty() const { return _Vertices.empty(); } - /*! Returns the 2D length of the Curve. */ + /** Returns the 2D length of the Curve. */ inline real getLength2D() const { return _Length; } - /*! Returns the Id of the 1D element. */ + /** Returns the Id of the 1D element. */ virtual Id getId() const { return _Id; } - /*! Returns the number of segments in the polyline constituting the Curve. */ + /** Returns the number of segments in the polyline constituting the Curve. */ inline unsigned int nSegments() const { return _nSegments; @@ -549,7 +549,7 @@ class Curve : public Interface1D { float local_depth_variance(int iCombination = 0) const; real local_average_density(float sigma = 2.3f, int iCombination = 0) const; Vec3r curvature2d_as_vector(int iCombination = 0) const; - /*! angle in radians */ + /** angle in radians */ real curvature2d_as_angle(int iCombination = 0) const; #endif @@ -573,23 +573,23 @@ class Curve : public Interface1D { CurveInternal::CurvePointIterator curveVerticesEnd(); // Iterators access - /*! Returns an Interface0DIterator pointing onto the first vertex of the Curve and that can + /** Returns an Interface0DIterator pointing onto the first vertex of the Curve and that can * iterate over the \a vertices of the Curve. */ virtual Interface0DIterator verticesBegin(); - /*! Returns an Interface0DIterator pointing after the last vertex of the Curve and that can + /** Returns an Interface0DIterator pointing after the last vertex of the Curve and that can * iterate over the \a vertices of the Curve. */ virtual Interface0DIterator verticesEnd(); - /*! Returns an Interface0DIterator pointing onto the first point of the Curve and that can + /** Returns an Interface0DIterator pointing onto the first point of the Curve and that can * iterate over the \a points of the Curve at any resolution. At each iteration a virtual * temporary CurvePoint is created. */ virtual Interface0DIterator pointsBegin(float t = 0.0f); - /*! Returns an Interface0DIterator pointing after the last point of the Curve and that can + /** Returns an Interface0DIterator pointing after the last point of the Curve and that can * iterate over the \a points of the Curve at any resolution. At each iteration a virtual * temporary CurvePoint is created. */ diff --git a/source/blender/freestyle/intern/stroke/CurveAdvancedIterators.h b/source/blender/freestyle/intern/stroke/CurveAdvancedIterators.h index 1896a674477..5cb5ab69711 100644 --- a/source/blender/freestyle/intern/stroke/CurveAdvancedIterators.h +++ b/source/blender/freestyle/intern/stroke/CurveAdvancedIterators.h @@ -50,7 +50,7 @@ class CurvePoint_nonconst_traits : public Nonconst_traits<CurvePoint *> { /* */ /**********************************/ -/*! iterator on a curve. Allows an iterating outside initial vertices. A CurvePoint is +/** iterator on a curve. Allows an iterating outside initial vertices. A CurvePoint is * instantiated and returned when the iterator is dereferenced. */ template<class Traits> diff --git a/source/blender/freestyle/intern/stroke/CurveIterators.h b/source/blender/freestyle/intern/stroke/CurveIterators.h index 9d1cf33ed80..abbde02979d 100644 --- a/source/blender/freestyle/intern/stroke/CurveIterators.h +++ b/source/blender/freestyle/intern/stroke/CurveIterators.h @@ -28,7 +28,7 @@ namespace Freestyle { namespace CurveInternal { -/*! iterator on a curve. Allows an iterating outside +/** iterator on a curve. Allows an iterating outside * initial vertices. A CurvePoint is instantiated an returned * when the iterator is dereferenced. */ diff --git a/source/blender/freestyle/intern/stroke/Modifiers.h b/source/blender/freestyle/intern/stroke/Modifiers.h index 0aac6f58658..1952659dab7 100644 --- a/source/blender/freestyle/intern/stroke/Modifiers.h +++ b/source/blender/freestyle/intern/stroke/Modifiers.h @@ -35,16 +35,16 @@ namespace Freestyle { * * * ----------------------------------------- */ -/*! Base class for modifiers. +/** Base class for modifiers. * Modifiers are used in the Operators in order to "mark" the processed Interface1D. */ template<class Edge> struct EdgeModifier : public unary_function<Edge, void> { - /*! Default construction */ + /** Default construction */ EdgeModifier() : unary_function<Edge, void>() { } - /*! the () operator */ + /** the () operator */ virtual void operator()(Edge &iEdge) { } @@ -54,14 +54,14 @@ template<class Edge> struct EdgeModifier : public unary_function<Edge, void> { #endif }; -/*! Modifier that sets the time stamp of an Interface1D to the time stamp of the system. */ +/** Modifier that sets the time stamp of an Interface1D to the time stamp of the system. */ template<class Edge> struct TimestampModifier : public EdgeModifier<Edge> { - /*! Default constructor */ + /** Default constructor */ TimestampModifier() : EdgeModifier<Edge>() { } - /*! The () operator. */ + /** The () operator. */ virtual void operator()(Edge &iEdge) { TimeStamp *timestamp = TimeStamp::instance(); diff --git a/source/blender/freestyle/intern/stroke/Operators.h b/source/blender/freestyle/intern/stroke/Operators.h index e721e9fb837..4de331993f7 100644 --- a/source/blender/freestyle/intern/stroke/Operators.h +++ b/source/blender/freestyle/intern/stroke/Operators.h @@ -41,7 +41,7 @@ namespace Freestyle { -/*! Class defining the operators used in a style module. +/** Class defining the operators used in a style module. * There are 4 classes of operators: Selection, Chaining, Splitting and Creating. * All these operators are user controlled in the scripting language through Functors, Predicates * and Shaders that are taken as arguments. @@ -57,12 +57,12 @@ class Operators { // //////////////////////////////////////////////// - /*! Selects the ViewEdges of the ViewMap verifying a specified condition. + /** Selects the ViewEdges of the ViewMap verifying a specified condition. * \param pred: The predicate expressing this condition */ static int select(UnaryPredicate1D &pred); - /*! Builds a set of chains from the current set of ViewEdges. + /** Builds a set of chains from the current set of ViewEdges. * Each ViewEdge of the current list starts a new chain. * The chaining operator then iterates over the ViewEdges * of the ViewMap using the user specified iterator. @@ -80,7 +80,7 @@ class Operators { UnaryPredicate1D &pred, UnaryFunction1D_void &modifier); - /*! Builds a set of chains from the current set of ViewEdges. + /** Builds a set of chains from the current set of ViewEdges. * Each ViewEdge of the current list starts a new chain. The chaining operator then iterates * over the ViewEdges * of the ViewMap using the user specified iterator. @@ -95,7 +95,7 @@ class Operators { */ static int chain(ViewEdgeInternal::ViewEdgeIterator &it, UnaryPredicate1D &pred); - /*! Builds a set of chains from the current set of ViewEdges. + /** Builds a set of chains from the current set of ViewEdges. * Each ViewEdge of the current list potentially starts a new chain. The chaining operator then * iterates over the ViewEdges of the ViewMap using the user specified iterator. * This operator iterates both using the increment and decrement operators and is therefore @@ -111,7 +111,7 @@ class Operators { */ static int bidirectionalChain(ChainingIterator &it, UnaryPredicate1D &pred); - /*! The only difference with the above bidirectional chaining algorithm is that we don't need to + /** The only difference with the above bidirectional chaining algorithm is that we don't need to * pass a stopping criterion. This might be desirable when the stopping criterion is already * contained in the iterator definition. Builds a set of chains from the current set of * ViewEdges. Each ViewEdge of the current list potentially starts a new chain. The chaining @@ -127,7 +127,7 @@ class Operators { */ static int bidirectionalChain(ChainingIterator &it); - /*! Splits each chain of the current set of chains in a sequential way. + /** Splits each chain of the current set of chains in a sequential way. * The points of each chain are processed (with a specified sampling) sequentially. * Each time a user specified starting condition is verified, a new chain begins and ends as * soon as a user-defined stopping predicate is verified. @@ -147,7 +147,7 @@ class Operators { UnaryPredicate0D &stoppingPred, float sampling = 0.0f); - /*! Splits each chain of the current set of chains in a sequential way. + /** Splits each chain of the current set of chains in a sequential way. * The points of each chain are processed (with a specified sampling) sequentially and each time * a user specified condition is verified, the chain is split into two chains. * The resulting set of chains is a partition of the initial chain @@ -160,7 +160,7 @@ class Operators { */ static int sequentialSplit(UnaryPredicate0D &pred, float sampling = 0.0f); - /*! Splits the current set of chains in a recursive way. + /** Splits the current set of chains in a recursive way. * We process the points of each chain (with a specified sampling) to find the point * minimizing a specified function. The chain is split in two at this point and the two new * chains are processed in the same way. The recursivity level is controlled through a @@ -181,7 +181,7 @@ class Operators { UnaryPredicate1D &pred, float sampling = 0); - /*! Splits the current set of chains in a recursive way. + /** Splits the current set of chains in a recursive way. * We process the points of each chain (with a specified sampling) to find the point minimizing * a specified function. The chain is split in two at this point and the two new chains are * processed in the same way. The user can specify a 0D predicate to make a first selection on @@ -210,14 +210,14 @@ class Operators { UnaryPredicate1D &pred, float sampling = 0.0f); - /*! Sorts the current set of chains (or viewedges) + /** Sorts the current set of chains (or viewedges) * according to the comparison predicate given as argument. * \param pred: * The binary predicate used for the comparison */ static int sort(BinaryPredicate1D &pred); - /*! Creates and shades the strokes from the current set of chains. + /** Creates and shades the strokes from the current set of chains. * A predicate can be specified to make a selection pass on the chains. * \param pred: * The predicate that a chain must verify in order to be transform as a stroke diff --git a/source/blender/freestyle/intern/stroke/PSStrokeRenderer.h b/source/blender/freestyle/intern/stroke/PSStrokeRenderer.h index 46bb46ad8b2..349392a4c0e 100644 --- a/source/blender/freestyle/intern/stroke/PSStrokeRenderer.h +++ b/source/blender/freestyle/intern/stroke/PSStrokeRenderer.h @@ -41,7 +41,7 @@ class PSStrokeRenderer : public StrokeRenderer { public: PSStrokeRenderer(const char *iFileName = NULL); - /*! Renders a stroke rep */ + /** Renders a stroke rep */ virtual void RenderStrokeRep(StrokeRep *iStrokeRep) const; virtual void RenderStrokeRepBasic(StrokeRep *iStrokeRep) const; diff --git a/source/blender/freestyle/intern/stroke/Predicates0D.h b/source/blender/freestyle/intern/stroke/Predicates0D.h index 89dbaeb339d..11cbfb1b831 100644 --- a/source/blender/freestyle/intern/stroke/Predicates0D.h +++ b/source/blender/freestyle/intern/stroke/Predicates0D.h @@ -34,7 +34,7 @@ namespace Freestyle { // /////////////////////////////////////////////////////////// -/*! Base class for Unary Predicates that work on Interface0DIterator. +/** Base class for Unary Predicates that work on Interface0DIterator. * A UnaryPredicate0D is a functor that evaluates a condition on a Interface0DIterator and returns * true or false depending on whether this condition is satisfied or not. * The UnaryPredicate0D is used by calling its () operator. @@ -45,24 +45,24 @@ class UnaryPredicate0D { bool result; void *py_up0D; - /*! Default constructor. */ + /** Default constructor. */ UnaryPredicate0D() { py_up0D = 0; } - /*! Destructor. */ + /** Destructor. */ virtual ~UnaryPredicate0D() { } - /*! Returns the string of the name of the UnaryPredicate0D. */ + /** Returns the string of the name of the UnaryPredicate0D. */ virtual string getName() const { return "UnaryPredicate0D"; } - /*! The () operator. Must be overload by inherited classes. + /** The () operator. Must be overload by inherited classes. * \param it: * The Interface0DIterator pointing onto the Interface0D at which we wish to evaluate the * predicate. \return true if the condition is satisfied, false otherwise. @@ -79,7 +79,7 @@ class UnaryPredicate0D { // /////////////////////////////////////////////////////////// -/*! Base class for Binary Predicates working on Interface0D. +/** Base class for Binary Predicates working on Interface0D. * A BinaryPredicate0D is typically an ordering relation between two Interface0D. * It evaluates a relation between 2 Interface0D and returns true or false. * It is used by calling the () operator. @@ -89,24 +89,24 @@ class BinaryPredicate0D { bool result; void *py_bp0D; - /*! Default constructor. */ + /** Default constructor. */ BinaryPredicate0D() { py_bp0D = 0; } - /*! Destructor. */ + /** Destructor. */ virtual ~BinaryPredicate0D() { } - /*! Returns the string of the name of the binary predicate. */ + /** Returns the string of the name of the binary predicate. */ virtual string getName() const { return "BinaryPredicate0D"; } - /*! The () operator. Must be overload by inherited classes. + /** The () operator. Must be overload by inherited classes. * It evaluates a relation between 2 Interface0D. * \param inter1: * The first Interface0D. @@ -129,21 +129,21 @@ class BinaryPredicate0D { namespace Predicates0D { // TrueUP0D -/*! Returns true any time */ +/** Returns true any time */ class TrueUP0D : public UnaryPredicate0D { public: - /*! Default constructor. */ + /** Default constructor. */ TrueUP0D() { } - /*! Returns the string "TrueUP0D"*/ + /** Returns the string "TrueUP0D". */ string getName() const { return "TrueUP0D"; } - /*! The () operator. */ + /** The () operator. */ int operator()(Interface0DIterator &) { result = true; @@ -152,21 +152,21 @@ class TrueUP0D : public UnaryPredicate0D { }; // FalseUP0D -/*! Returns false any time */ +/** Returns false any time */ class FalseUP0D : public UnaryPredicate0D { public: - /*! Default constructor. */ + /** Default constructor. */ FalseUP0D() { } - /*! Returns the string "FalseUP0D"*/ + /** Returns the string "FalseUP0D". */ string getName() const { return "FalseUP0D"; } - /*! The () operator. */ + /** The () operator. */ int operator()(Interface0DIterator &) { result = false; diff --git a/source/blender/freestyle/intern/stroke/Predicates1D.h b/source/blender/freestyle/intern/stroke/Predicates1D.h index c174162b214..e7be9d863dc 100644 --- a/source/blender/freestyle/intern/stroke/Predicates1D.h +++ b/source/blender/freestyle/intern/stroke/Predicates1D.h @@ -41,7 +41,7 @@ namespace Freestyle { // /////////////////////////////////////////////////////////// -/*! Base class for Unary Predicates that work on Interface1D. +/** Base class for Unary Predicates that work on Interface1D. * A UnaryPredicate1D is a functor that evaluates a condition on a Interface1D and returns * true or false depending on whether this condition is satisfied or not. * The UnaryPredicate1D is used by calling its () operator. @@ -52,24 +52,24 @@ class UnaryPredicate1D { bool result; void *py_up1D; - /*! Default constructor. */ + /** Default constructor. */ UnaryPredicate1D() { py_up1D = NULL; } - /*! Destructor. */ + /** Destructor. */ virtual ~UnaryPredicate1D() { } - /*! Returns the string of the name of the UnaryPredicate1D. */ + /** Returns the string of the name of the UnaryPredicate1D. */ virtual string getName() const { return "UnaryPredicate1D"; } - /*! The () operator. Must be overload by inherited classes. + /** The () operator. Must be overload by inherited classes. * \param inter: * The Interface1D on which we wish to evaluate the predicate. * \return true if the condition is satisfied, false otherwise. @@ -86,7 +86,7 @@ class UnaryPredicate1D { // /////////////////////////////////////////////////////////// -/*! Base class for Binary Predicates working on Interface1D. +/** Base class for Binary Predicates working on Interface1D. * A BinaryPredicate1D is typically an ordering relation between two Interface1D. * It evaluates a relation between 2 Interface1D and returns true or false. * It is used by calling the () operator. @@ -96,24 +96,24 @@ class BinaryPredicate1D { bool result; void *py_bp1D; - /*! Default constructor. */ + /** Default constructor. */ BinaryPredicate1D() { py_bp1D = NULL; } - /*! Destructor. */ + /** Destructor. */ virtual ~BinaryPredicate1D() { } - /*! Returns the string of the name of the binary predicate. */ + /** Returns the string of the name of the binary predicate. */ virtual string getName() const { return "BinaryPredicate1D"; } - /*! The () operator. Must be overload by inherited classes. + /** The () operator. Must be overload by inherited classes. * It evaluates a relation between 2 Interface1D. * \param inter1: * The first Interface1D. @@ -136,21 +136,21 @@ class BinaryPredicate1D { namespace Predicates1D { // TrueUP1D -/*! Returns true */ +/** Returns true */ class TrueUP1D : public UnaryPredicate1D { public: - /*! Constructor */ + /** Constructor */ TrueUP1D() { } - /*! Returns the string "TrueUP1D"*/ + /** Returns the string "TrueUP1D". */ string getName() const { return "TrueUP1D"; } - /*! the () operator */ + /** the () operator */ int operator()(Interface1D &) { result = true; @@ -159,21 +159,21 @@ class TrueUP1D : public UnaryPredicate1D { }; // FalseUP1D -/*! Returns false */ +/** Returns false */ class FalseUP1D : public UnaryPredicate1D { public: - /*! Constructor */ + /** Constructor */ FalseUP1D() { } - /*! Returns the string "FalseUP1D"*/ + /** Returns the string "FalseUP1D". */ string getName() const { return "FalseUP1D"; } - /*! the () operator */ + /** the () operator */ int operator()(Interface1D &) { result = false; @@ -182,12 +182,12 @@ class FalseUP1D : public UnaryPredicate1D { }; // QuantitativeInvisibilityUP1D -/*! Returns true if the Quantitative Invisibility evaluated at an Interface1D, using the +/** Returns true if the Quantitative Invisibility evaluated at an Interface1D, using the * QuantitativeInvisibilityF1D functor, equals a certain user-defined value. */ class QuantitativeInvisibilityUP1D : public UnaryPredicate1D { public: - /*! Builds the Predicate. + /** Builds the Predicate. * \param qi: * The Quantitative Invisibility you want the Interface1D to have */ @@ -195,13 +195,13 @@ class QuantitativeInvisibilityUP1D : public UnaryPredicate1D { { } - /*! Returns the string "QuantitativeInvisibilityUP1D" */ + /** Returns the string "QuantitativeInvisibilityUP1D" */ string getName() const { return "QuantitativeInvisibilityUP1D"; } - /*! the () operator */ + /** the () operator */ int operator()(Interface1D &inter) { Functions1D::QuantitativeInvisibilityF1D func; @@ -217,7 +217,7 @@ class QuantitativeInvisibilityUP1D : public UnaryPredicate1D { }; // ContourUP1D -/*! Returns true if the Interface1D is a contour. +/** Returns true if the Interface1D is a contour. * An Interface1D is a contour if it is bordered by a different shape on each of its sides. */ class ContourUP1D : public UnaryPredicate1D { @@ -225,13 +225,13 @@ class ContourUP1D : public UnaryPredicate1D { Functions1D::CurveNatureF1D _getNature; public: - /*! Returns the string "ContourUP1D"*/ + /** Returns the string "ContourUP1D". */ string getName() const { return "ContourUP1D"; } - /*! The () operator. */ + /** The () operator. */ int operator()(Interface1D &inter) { if (_getNature(inter) < 0) { @@ -252,7 +252,7 @@ class ContourUP1D : public UnaryPredicate1D { }; // ExternalContourUP1D -/*! Returns true if the Interface1D is an external contour. +/** Returns true if the Interface1D is an external contour. * An Interface1D is an external contour if it is bordered by no shape on one of its sides. */ class ExternalContourUP1D : public UnaryPredicate1D { @@ -260,13 +260,13 @@ class ExternalContourUP1D : public UnaryPredicate1D { Functions1D::CurveNatureF1D _getNature; public: - /*! Returns the string "ExternalContourUP1D" */ + /** Returns the string "ExternalContourUP1D" */ string getName() const { return "ExternalContourUP1D"; } - /*! The () operator. */ + /** The () operator. */ int operator()(Interface1D &inter) { if (_getNature(inter) < 0) { @@ -289,7 +289,7 @@ class ExternalContourUP1D : public UnaryPredicate1D { }; // EqualToTimeStampUP1D -/*! Returns true if the Interface1D's time stamp is equal to a certain user-defined value. */ +/** Returns true if the Interface1D's time stamp is equal to a certain user-defined value. */ class EqualToTimeStampUP1D : public UnaryPredicate1D { protected: unsigned _timeStamp; @@ -300,13 +300,13 @@ class EqualToTimeStampUP1D : public UnaryPredicate1D { _timeStamp = ts; } - /*! Returns the string "EqualToTimeStampUP1D"*/ + /** Returns the string "EqualToTimeStampUP1D". */ string getName() const { return "EqualToTimeStampUP1D"; } - /*! The () operator. */ + /** The () operator. */ int operator()(Interface1D &inter) { result = (inter.getTimeStamp() == _timeStamp); @@ -315,7 +315,7 @@ class EqualToTimeStampUP1D : public UnaryPredicate1D { }; // EqualToChainingTimeStampUP1D -/*! Returns true if the Interface1D's time stamp is equal to a certain user-defined value. */ +/** Returns true if the Interface1D's time stamp is equal to a certain user-defined value. */ class EqualToChainingTimeStampUP1D : public UnaryPredicate1D { protected: unsigned _timeStamp; @@ -326,13 +326,13 @@ class EqualToChainingTimeStampUP1D : public UnaryPredicate1D { _timeStamp = ts; } - /*! Returns the string "EqualToChainingTimeStampUP1D"*/ + /** Returns the string "EqualToChainingTimeStampUP1D". */ string getName() const { return "EqualToChainingTimeStampUP1D"; } - /*! The () operator. */ + /** The () operator. */ int operator()(Interface1D &inter) { ViewEdge *edge = dynamic_cast<ViewEdge *>(&inter); @@ -346,14 +346,14 @@ class EqualToChainingTimeStampUP1D : public UnaryPredicate1D { }; // ShapeUP1D -/*! Returns true if the shape to which the Interface1D belongs to has the same Id as the one +/** Returns true if the shape to which the Interface1D belongs to has the same Id as the one * specified by the user. */ class ShapeUP1D : public UnaryPredicate1D { private: Id _id; public: - /*! Builds the Predicate. + /** Builds the Predicate. * \param idFirst: * The first Id component. * \param idSecond: @@ -364,13 +364,13 @@ class ShapeUP1D : public UnaryPredicate1D { _id = Id(idFirst, idSecond); } - /*! Returns the string "ShapeUP1D"*/ + /** Returns the string "ShapeUP1D". */ string getName() const { return "ShapeUP1D"; } - /*! The () operator. */ + /** The () operator. */ int operator()(Interface1D &inter) { set<ViewShape *> shapes; @@ -387,13 +387,13 @@ class ShapeUP1D : public UnaryPredicate1D { }; // WithinImageBoundaryUP1D -/*! Returns true if the Interface1D is (partly) within the image boundary. */ +/** Returns true if the Interface1D is (partly) within the image boundary. */ class WithinImageBoundaryUP1D : public UnaryPredicate1D { private: real _xmin, _ymin, _xmax, _ymax; public: - /*! Builds the Predicate. + /** Builds the Predicate. * \param xmin: * The X lower bound of the image boundary. * \param ymin: @@ -408,13 +408,13 @@ class WithinImageBoundaryUP1D : public UnaryPredicate1D { { } - /*! Returns the string "WithinImageBoundaryUP1D" */ + /** Returns the string "WithinImageBoundaryUP1D" */ string getName() const { return "WithinImageBoundaryUP1D"; } - /*! The () operator. */ + /** The () operator. */ int operator()(Interface1D &inter) { // 1st pass: check if a point is within the image boundary. @@ -454,16 +454,16 @@ class WithinImageBoundaryUP1D : public UnaryPredicate1D { /////////////////////////////////////////////////////////// // TrueBP1D -/*! Returns true. */ +/** Returns true. */ class TrueBP1D : public BinaryPredicate1D { public: - /*! Returns the string "TrueBP1D" */ + /** Returns the string "TrueBP1D" */ string getName() const { return "TrueBP1D"; } - /*! The () operator. */ + /** The () operator. */ int operator()(Interface1D & /*i1*/, Interface1D & /*i2*/) { result = true; @@ -472,16 +472,16 @@ class TrueBP1D : public BinaryPredicate1D { }; // FalseBP1D -/*! Returns false. */ +/** Returns false. */ class FalseBP1D : public BinaryPredicate1D { public: - /*! Returns the string "FalseBP1D" */ + /** Returns the string "FalseBP1D" */ string getName() const { return "FalseBP1D"; } - /*! The () operator. */ + /** The () operator. */ int operator()(Interface1D & /*i1*/, Interface1D & /*i2*/) { result = false; @@ -490,17 +490,17 @@ class FalseBP1D : public BinaryPredicate1D { }; // Length2DBP1D -/*! Returns true if the 2D length of the Interface1D i1 is less than the 2D length of the +/** Returns true if the 2D length of the Interface1D i1 is less than the 2D length of the * Interface1D i2. */ class Length2DBP1D : public BinaryPredicate1D { public: - /*! Returns the string "Length2DBP1D" */ + /** Returns the string "Length2DBP1D" */ string getName() const { return "Length2DBP1D"; } - /*! The () operator. */ + /** The () operator. */ int operator()(Interface1D &i1, Interface1D &i2) { result = (i1.getLength2D() > i2.getLength2D()); @@ -509,16 +509,16 @@ class Length2DBP1D : public BinaryPredicate1D { }; // SameShapeIdBP1D -/*! Returns true if the Interface1D i1 and i2 belong to the same shape. */ +/** Returns true if the Interface1D i1 and i2 belong to the same shape. */ class SameShapeIdBP1D : public BinaryPredicate1D { public: - /*! Returns the string "SameShapeIdBP1D" */ + /** Returns the string "SameShapeIdBP1D" */ string getName() const { return "SameShapeIdBP1D"; } - /*! The () operator. */ + /** The () operator. */ int operator()(Interface1D &i1, Interface1D &i2) { set<ViewShape *> shapes1; @@ -542,7 +542,7 @@ class SameShapeIdBP1D : public BinaryPredicate1D { }; // ViewMapGradientNormBP1D -/*! Returns true if the evaluation of the Gradient norm Function is higher for Interface1D i1 than +/** Returns true if the evaluation of the Gradient norm Function is higher for Interface1D i1 than * for i2. */ class ViewMapGradientNormBP1D : public BinaryPredicate1D { private: @@ -554,13 +554,13 @@ class ViewMapGradientNormBP1D : public BinaryPredicate1D { { } - /*! Returns the string "ViewMapGradientNormBP1D" */ + /** Returns the string "ViewMapGradientNormBP1D" */ string getName() const { return "ViewMapGradientNormBP1D"; } - /*! The () operator. */ + /** The () operator. */ int operator()(Interface1D &i1, Interface1D &i2) { if (_func(i1) < 0) { diff --git a/source/blender/freestyle/intern/stroke/Stroke.cpp b/source/blender/freestyle/intern/stroke/Stroke.cpp index 0de3e03d44a..956ba2743d7 100644 --- a/source/blender/freestyle/intern/stroke/Stroke.cpp +++ b/source/blender/freestyle/intern/stroke/Stroke.cpp @@ -625,7 +625,7 @@ int Stroke::Resample(int iNPoints) // add last: ++it; ++next; - if ((it != itend) && (next == itend) /* && (t == 0.0f)*/) { + if ((it != itend) && (next == itend) /* && (t == 0.0f) */) { newVertices.push_back(&(*it)); } @@ -687,7 +687,7 @@ int Stroke::Resample(float iSampling) ++next; } // add last: - if ((it != itend) && (next == itend) /* && (t == 0.0f)*/) { + if ((it != itend) && (next == itend) /* && (t == 0.0f) */) { newVertices.push_back(&(*it)); } diff --git a/source/blender/freestyle/intern/stroke/Stroke.h b/source/blender/freestyle/intern/stroke/Stroke.h index 4a9ed7288c5..209ec86edef 100644 --- a/source/blender/freestyle/intern/stroke/Stroke.h +++ b/source/blender/freestyle/intern/stroke/Stroke.h @@ -52,18 +52,18 @@ namespace Freestyle { // //////////////////////////////////////////////////////// -/*! Class to define an attribute associated to a Stroke Vertex. +/** Class to define an attribute associated to a Stroke Vertex. * This attribute stores the color, alpha and thickness values for a Stroke Vertex. */ class StrokeAttribute { public: - /*! default constructor */ + /** default constructor */ StrokeAttribute(); - /*! Copy constructor */ + /** Copy constructor */ StrokeAttribute(const StrokeAttribute &iBrother); - /*! Builds a stroke vertex attribute from a set of parameters. + /** Builds a stroke vertex attribute from a set of parameters. * \param iRColor: * The Red Component value. * \param iGColor: @@ -84,7 +84,7 @@ class StrokeAttribute { float iRThickness, float iLThickness); - /*! Interpolation constructor. + /** Interpolation constructor. * Builds a StrokeAttribute from two StrokeAttributes and an interpolation parameter. * \param a1: * The first Attribute. @@ -95,15 +95,15 @@ class StrokeAttribute { */ StrokeAttribute(const StrokeAttribute &a1, const StrokeAttribute &a2, float t); - /*! destructor */ + /** destructor */ virtual ~StrokeAttribute(); /* operators */ - /*! operator = */ + /** operator = */ StrokeAttribute &operator=(const StrokeAttribute &iBrother); /* accessors */ - /*! Returns the attribute's color. + /** Returns the attribute's color. * \return The array of 3 floats containing the R,G,B values of the attribute's color. */ inline const float *getColor() const @@ -111,37 +111,37 @@ class StrokeAttribute { return _color; } - /*! Returns the R color component. */ + /** Returns the R color component. */ inline const float getColorR() const { return _color[0]; } - /*! Returns the G color component. */ + /** Returns the G color component. */ inline const float getColorG() const { return _color[1]; } - /*! Returns the B color component. */ + /** Returns the B color component. */ inline const float getColorB() const { return _color[2]; } - /*! Returns the RGB color components. */ + /** Returns the RGB color components. */ inline Vec3f getColorRGB() const { return Vec3f(_color[0], _color[1], _color[2]); } - /*! Returns the alpha color component. */ + /** Returns the alpha color component. */ inline float getAlpha() const { return _alpha; } - /*! Returns the attribute's thickness. + /** Returns the attribute's thickness. * \return an array of 2 floats. the first value is the thickness on the right of the vertex * when following the stroke, the second one is the thickness on the left. */ @@ -150,60 +150,60 @@ class StrokeAttribute { return _thickness; } - /*! Returns the thickness on the right of the vertex when following the stroke. */ + /** Returns the thickness on the right of the vertex when following the stroke. */ inline const float getThicknessR() const { return _thickness[0]; } - /*! Returns the thickness on the left of the vertex when following the stroke. */ + /** Returns the thickness on the left of the vertex when following the stroke. */ inline const float getThicknessL() const { return _thickness[1]; } - /*! Returns the thickness on the right and on the left of the vertex when following the stroke. + /** Returns the thickness on the right and on the left of the vertex when following the stroke. */ inline Vec2f getThicknessRL() const { return Vec2f(_thickness[0], _thickness[1]); } - /*! Returns true if the strokevertex is visible, false otherwise */ + /** Returns true if the strokevertex is visible, false otherwise */ inline bool isVisible() const { return _visible; } - /*! Returns an attribute of type real + /** Returns an attribute of type real * \param iName: * The name of the attribute */ float getAttributeReal(const char *iName) const; - /*! Returns an attribute of type Vec2f + /** Returns an attribute of type Vec2f * \param iName: * The name of the attribute */ Vec2f getAttributeVec2f(const char *iName) const; - /*! Returns an attribute of type Vec3f + /** Returns an attribute of type Vec3f * \param iName: * The name of the attribute */ Vec3f getAttributeVec3f(const char *iName) const; - /*! Checks whether the attribute iName is available */ + /** Checks whether the attribute iName is available */ bool isAttributeAvailableReal(const char *iName) const; - /*! Checks whether the attribute iName is available */ + /** Checks whether the attribute iName is available */ bool isAttributeAvailableVec2f(const char *iName) const; - /*! Checks whether the attribute iName is available */ + /** Checks whether the attribute iName is available */ bool isAttributeAvailableVec3f(const char *iName) const; /* modifiers */ - /*! sets the attribute's color. + /** sets the attribute's color. * \param r: * The new R value. * \param g: @@ -218,7 +218,7 @@ class StrokeAttribute { _color[2] = b; } - /*! sets the attribute's color. + /** sets the attribute's color. * \param iRGB: * The new RGB values. */ @@ -229,7 +229,7 @@ class StrokeAttribute { _color[2] = iRGB[2]; } - /*! sets the attribute's alpha value. + /** sets the attribute's alpha value. * \param alpha: * The new alpha value. */ @@ -238,7 +238,7 @@ class StrokeAttribute { _alpha = alpha; } - /*! sets the attribute's thickness. + /** sets the attribute's thickness. * \param tr: * The thickness on the right of the vertex when following the stroke. * \param tl: @@ -250,7 +250,7 @@ class StrokeAttribute { _thickness[1] = tl; } - /*! sets the attribute's thickness. + /** sets the attribute's thickness. * \param tRL: * The thickness on the right and on the left of the vertex when following the stroke. */ @@ -260,13 +260,13 @@ class StrokeAttribute { _thickness[1] = tRL[1]; } - /*! sets the visible flag. True means visible. */ + /** sets the visible flag. True means visible. */ inline void setVisible(bool iVisible) { _visible = iVisible; } - /*! Adds a user defined attribute of type real + /** Adds a user defined attribute of type real * If there is no attribute of name iName, it is added. * Otherwise, the new value replaces the old one. * \param iName: @@ -276,7 +276,7 @@ class StrokeAttribute { */ void setAttributeReal(const char *iName, float att); - /*! Adds a user defined attribute of type Vec2f + /** Adds a user defined attribute of type Vec2f * If there is no attribute of name iName, it is added. * Otherwise, the new value replaces the old one. * \param iName: @@ -286,7 +286,7 @@ class StrokeAttribute { */ void setAttributeVec2f(const char *iName, const Vec2f &att); - /*! Adds a user defined attribute of type Vec3f + /** Adds a user defined attribute of type Vec3f * If there is no attribute of name iName, it is added. * Otherwise, the new value replaces the old one. * \param iName: @@ -322,10 +322,10 @@ class StrokeAttribute { // //////////////////////////////////////////////////////// -/*! Class to define a stroke vertex. */ +/** Class to define a stroke vertex. */ class StrokeVertex : public CurvePoint { public: // Implementation of Interface0D - /*! Returns the string "StrokeVertex" */ + /** Returns the string "StrokeVertex" */ virtual string getExactTypeName() const { return "StrokeVertex"; @@ -337,129 +337,129 @@ class StrokeVertex : public CurvePoint { float _StrokeLength; // stroke length public: - /*! default constructor */ + /** default constructor */ StrokeVertex(); - /*! Copy constructor */ + /** Copy constructor */ StrokeVertex(const StrokeVertex &iBrother); - /*! Builds a stroke vertex from a SVertex */ + /** Builds a stroke vertex from a SVertex */ StrokeVertex(SVertex *iSVertex); - /*! Builds a stroke vertex from a CurvePoint */ + /** Builds a stroke vertex from a CurvePoint */ StrokeVertex(CurvePoint *iPoint); - /*! Builds Stroke Vertex from 2 stroke vertices and an interpolation parameter*/ + /** Builds Stroke Vertex from 2 stroke vertices and an interpolation parameter. */ StrokeVertex(StrokeVertex *iA, StrokeVertex *iB, float t3); - /*! Builds a stroke from a view vertex and an attribute */ + /** Builds a stroke from a view vertex and an attribute */ StrokeVertex(SVertex *iSVertex, const StrokeAttribute &iAttribute); /* operators */ - /*! operator = */ + /** operator = */ StrokeVertex &operator=(const StrokeVertex &iBrother); /* accessors */ - /*! Returns the 2D point x coordinate */ + /** Returns the 2D point x coordinate */ inline real x() const { return _Point2d[0]; } - /*! Returns the 2D point y coordinate */ + /** Returns the 2D point y coordinate */ inline real y() const { return _Point2d[1]; } - /*! Returns the 2D point coordinates as a Vec2r */ + /** Returns the 2D point coordinates as a Vec2r */ inline Vec2r getPoint() const { return getPoint2D(); } - /*! Returns the ith 2D point coordinate (i=0 or 1)*/ + /** Returns the ith 2D point coordinate (i=0 or 1). */ inline real operator[](const int i) const { return _Point2d[i]; } - /*! Returns the StrokeAttribute for this StrokeVertex */ + /** Returns the StrokeAttribute for this StrokeVertex */ inline const StrokeAttribute &attribute() const { return _Attribute; } - /*! Returns a non-const reference to the StrokeAttribute of this StrokeVertex */ + /** Returns a non-const reference to the StrokeAttribute of this StrokeVertex */ inline StrokeAttribute &attribute() { return _Attribute; } - /*! Returns the curvilinear abscissa */ + /** Returns the curvilinear abscissa */ inline float curvilinearAbscissa() const { return _CurvilignAbscissa; } - /*! Returns the length of the Stroke to which this StrokeVertex belongs */ + /** Returns the length of the Stroke to which this StrokeVertex belongs */ inline float strokeLength() const { return _StrokeLength; } - /*! Returns the curvilinear abscissa of this StrokeVertex in the Stroke */ + /** Returns the curvilinear abscissa of this StrokeVertex in the Stroke */ inline float u() const { return _CurvilignAbscissa / _StrokeLength; } /* modifiers */ - /*! sets the 2D x value */ + /** sets the 2D x value */ inline void setX(real x) { _Point2d[0] = x; } - /*! sets the 2D y value */ + /** sets the 2D y value */ inline void setY(real y) { _Point2d[1] = y; } - /*! sets the 2D x and y values */ + /** sets the 2D x and y values */ inline void setPoint(real x, real y) { _Point2d[0] = x; _Point2d[1] = y; } - /*! sets the 2D x and y values */ + /** sets the 2D x and y values */ inline void setPoint(const Vec2r &p) { _Point2d[0] = p[0]; _Point2d[1] = p[1]; } - /*! Returns a reference to the ith 2D point coordinate (i=0 or 1) */ + /** Returns a reference to the ith 2D point coordinate (i=0 or 1) */ inline real &operator[](const int i) { return _Point2d[i]; } - /*! sets the attribute. */ + /** sets the attribute. */ inline void setAttribute(const StrokeAttribute &iAttribute) { _Attribute = iAttribute; } - /*! sets the curvilinear abscissa of this StrokeVertex in the Stroke */ + /** sets the curvilinear abscissa of this StrokeVertex in the Stroke */ inline void setCurvilinearAbscissa(float iAbscissa) { _CurvilignAbscissa = iAbscissa; } - /*! sets the Stroke's length (it's only a value stored by the Stroke Vertex, it won't change the + /** sets the Stroke's length (it's only a value stored by the Stroke Vertex, it won't change the * real Stroke's length.) */ inline void setStrokeLength(float iLength) @@ -492,7 +492,7 @@ class StrokeVertexIterator; } // end of namespace StrokeInternal -/*! Class to define a stroke. +/** Class to define a stroke. * A stroke is made of a set of 2D vertices (StrokeVertex), regularly spaced out. * This set of vertices defines the stroke's backbone geometry. * Each of these stroke vertices defines the stroke's shape and appearance at this vertex @@ -500,7 +500,7 @@ class StrokeVertexIterator; */ class Stroke : public Interface1D { public: // Implementation of Interface1D - /*! Returns the string "Stroke" */ + /** Returns the string "Stroke" */ virtual string getExactTypeName() const { return "Stroke"; @@ -508,17 +508,17 @@ class Stroke : public Interface1D { // Data access methods - /*! Returns the Id of the Stroke */ + /** Returns the Id of the Stroke */ virtual Id getId() const { return _id; } - /*! The different blending modes available to similate the interaction media-medium. */ + /** The different blending modes available to similate the interaction media-medium. */ typedef enum { - DRY_MEDIUM, /*!< To simulate a dry medium such as Pencil or Charcoal.*/ - HUMID_MEDIUM, /*!< To simulate ink painting (color subtraction blending).*/ - OPAQUE_MEDIUM, /*!< To simulate an opaque medium (oil, spray...).*/ + DRY_MEDIUM, /**< To simulate a dry medium such as Pencil or Charcoal. */ + HUMID_MEDIUM, /**< To simulate ink painting (color subtraction blending). */ + OPAQUE_MEDIUM, /**< To simulate an opaque medium (oil, spray...). */ } MediumType; public: @@ -549,13 +549,13 @@ class Stroke : public Interface1D { Vec2r _extremityOrientations[2]; // the orientations of the first and last extermity public: - /*! default constructor */ + /** default constructor */ Stroke(); - /*! copy constructor */ + /** copy constructor */ Stroke(const Stroke &iBrother); - /*! Builds a stroke from a set of StrokeVertex. + /** Builds a stroke from a set of StrokeVertex. * This constructor is templated by an iterator type. * This iterator type must allow the vertices parsing using the ++ operator. * \param iBegin: @@ -565,14 +565,14 @@ class Stroke : public Interface1D { */ template<class InputVertexIterator> Stroke(InputVertexIterator iBegin, InputVertexIterator iEnd); - /*! Destructor */ + /** Destructor */ virtual ~Stroke(); /* operators */ - /*! operator = */ + /** operator = */ Stroke &operator=(const Stroke &iBrother); - /*! Compute the sampling needed to get iNVertices vertices. + /** Compute the sampling needed to get iNVertices vertices. * If the specified number of vertices is less than the actual number of vertices, the actual * sampling value is returned. (To remove Vertices, use the RemoveVertex() method of this class). * \param iNVertices: @@ -583,7 +583,7 @@ class Stroke : public Interface1D { */ float ComputeSampling(int iNVertices); - /*! Resampling method. + /** Resampling method. * Resamples the curve so that it eventually has iNPoints. That means it is going to add * iNPoints-vertices_size, if vertices_size is the number of points we already have. If * vertices_size >= iNPoints, no resampling is done. @@ -592,7 +592,7 @@ class Stroke : public Interface1D { */ int Resample(int iNPoints); - /*! Resampling method. + /** Resampling method. * Resamples the curve with a given sampling. * If this sampling is < to the actual sampling value, no resampling is done. * \param iSampling: @@ -600,18 +600,18 @@ class Stroke : public Interface1D { */ int Resample(float iSampling); - /*! Removes all vertices from the Stroke. + /** Removes all vertices from the Stroke. */ void RemoveAllVertices(); - /*! Removes the stroke vertex iVertex + /** Removes the stroke vertex iVertex * from the stroke. * The length and curvilinear abscissa are updated * consequently. */ void RemoveVertex(StrokeVertex *iVertex); - /*! Inserts the stroke vertex iVertex in the stroke before next. + /** Inserts the stroke vertex iVertex in the stroke before next. * The length, curvilinear abscissa are updated consequently. * \param iVertex: * The StrokeVertex to insert in the Stroke. @@ -620,7 +620,7 @@ class Stroke : public Interface1D { */ void InsertVertex(StrokeVertex *iVertex, StrokeInternal::StrokeVertexIterator next); - /*! Updates the 2D length of the Stroke */ + /** Updates the 2D length of the Stroke */ void UpdateLength(); /* Render method */ @@ -631,50 +631,50 @@ class Stroke : public Interface1D { /* Iterator definition */ /* accessors */ - /*! Returns the 2D length of the Stroke */ + /** Returns the 2D length of the Stroke */ inline real getLength2D() const { return _Length; } - /*! Returns a reference to the time stamp value of the stroke. */ - /*! Returns the MediumType used for this Stroke. */ + /** Returns a reference to the time stamp value of the stroke. */ + /** Returns the MediumType used for this Stroke. */ inline MediumType getMediumType() const { return _mediumType; } - /*! Returns the id of the texture used to simulate th marks system for this Stroke */ + /** Returns the id of the texture used to simulate th marks system for this Stroke */ inline unsigned int getTextureId() { return _textureId; } - /*! Returns the spacing of texture coordinates along the stroke length */ + /** Returns the spacing of texture coordinates along the stroke length */ inline float getTextureStep() { return _textureStep; } - /*! Returns the texture used at given index to simulate the marks system for this Stroke */ + /** Returns the texture used at given index to simulate the marks system for this Stroke */ inline MTex *getMTex(int idx) { return _mtex[idx]; } - /*! Return the shader node tree to define textures. */ + /** Return the shader node tree to define textures. */ inline bNodeTree *getNodeTree() { return _nodeTree; } - /*! Returns true if this Stroke has textures assigned, false otherwise. */ + /** Returns true if this Stroke has textures assigned, false otherwise. */ inline bool hasTex() const { return (_mtex[0] != NULL) || _nodeTree; } - /*! Returns true if this Stroke uses a texture with tips, false otherwise. */ + /** Returns true if this Stroke uses a texture with tips, false otherwise. */ inline bool hasTips() const { return _tips; @@ -742,34 +742,34 @@ class Stroke : public Interface1D { } /* modifiers */ - /*! sets the Id of the Stroke. */ + /** sets the Id of the Stroke. */ inline void setId(const Id &id) { _id = id; } - /*! sets the 2D length of the Stroke. */ + /** sets the 2D length of the Stroke. */ void setLength(float iLength); - /*! sets the medium type that must be used for this Stroke. */ + /** sets the medium type that must be used for this Stroke. */ inline void setMediumType(MediumType iType) { _mediumType = iType; } - /*! sets the texture id to be used to simulate the marks system for this Stroke. */ + /** sets the texture id to be used to simulate the marks system for this Stroke. */ inline void setTextureId(unsigned int id) { _textureId = id; } - /*! sets the spacing of texture coordinates along the stroke length. */ + /** sets the spacing of texture coordinates along the stroke length. */ inline void setTextureStep(float step) { _textureStep = step; } - /*! assigns a blender texture to the first available slot. */ + /** assigns a blender texture to the first available slot. */ inline int setMTex(MTex *mtex) { for (int a = 0; a < MAX_MTEX; a++) { @@ -781,13 +781,13 @@ class Stroke : public Interface1D { return -1; /* no free slots */ } - /*! assigns a node tree (of new shading nodes) to define textures. */ + /** assigns a node tree (of new shading nodes) to define textures. */ inline void setNodeTree(bNodeTree *iNodeTree) { _nodeTree = iNodeTree; } - /*! sets the flag telling whether this stroke is using a texture with tips or not. */ + /** sets the flag telling whether this stroke is using a texture with tips or not. */ inline void setTips(bool iTips) { _tips = iTips; @@ -836,7 +836,7 @@ class Stroke : public Interface1D { const_vertex_iterator vertices_end() const; vertex_iterator vertices_end(); - /*! Returns a StrokeVertexIterator pointing on the first StrokeVertex of the Stroke. One can + /** Returns a StrokeVertexIterator pointing on the first StrokeVertex of the Stroke. One can * specify a sampling value to re-sample the Stroke on the fly if needed. * * \param t: The resampling value with which we want our Stroke to be resampled. @@ -844,26 +844,26 @@ class Stroke : public Interface1D { */ StrokeInternal::StrokeVertexIterator strokeVerticesBegin(float t = 0.0f); - /*! Returns a StrokeVertexIterator pointing after the last StrokeVertex of the Stroke. */ + /** Returns a StrokeVertexIterator pointing after the last StrokeVertex of the Stroke. */ StrokeInternal::StrokeVertexIterator strokeVerticesEnd(); - /*! Returns the number of StrokeVertex constituting the Stroke. */ + /** Returns the number of StrokeVertex constituting the Stroke. */ inline unsigned int strokeVerticesSize() const { return _Vertices.size(); } - /*! Returns the i-th StrokeVertex constituting the Stroke. */ + /** Returns the i-th StrokeVertex constituting the Stroke. */ inline StrokeVertex &strokeVerticeAt(unsigned int i) { return *(_Vertices.at(i)); } // Iterator access (Interface1D) - /*! Returns an Interface0DIterator pointing on the first StrokeVertex of the Stroke. */ + /** Returns an Interface0DIterator pointing on the first StrokeVertex of the Stroke. */ virtual Interface0DIterator verticesBegin(); - /*! Returns an Interface0DIterator pointing after the last StrokeVertex of the Stroke. */ + /** Returns an Interface0DIterator pointing after the last StrokeVertex of the Stroke. */ virtual Interface0DIterator verticesEnd(); virtual Interface0DIterator pointsBegin(float t = 0.0f); diff --git a/source/blender/freestyle/intern/stroke/StrokeAdvancedIterators.h b/source/blender/freestyle/intern/stroke/StrokeAdvancedIterators.h index 4256cdebe86..0fbf94f609e 100644 --- a/source/blender/freestyle/intern/stroke/StrokeAdvancedIterators.h +++ b/source/blender/freestyle/intern/stroke/StrokeAdvancedIterators.h @@ -158,7 +158,7 @@ class vertex_iterator_base : public IteratorBase<Traits, BidirectionalIteratorTa return &(operator*()); } - /*! accessors */ + /** accessors */ inline vertex_container_iterator it() const { return _it; diff --git a/source/blender/freestyle/intern/stroke/StrokeIterators.h b/source/blender/freestyle/intern/stroke/StrokeIterators.h index d4cbffd535e..20c29b21c22 100644 --- a/source/blender/freestyle/intern/stroke/StrokeIterators.h +++ b/source/blender/freestyle/intern/stroke/StrokeIterators.h @@ -32,7 +32,7 @@ namespace StrokeInternal { // ///////////////////////////////////////////////// -/*! Class defining an iterator designed to iterate over the StrokeVertex of a Stroke. +/** Class defining an iterator designed to iterate over the StrokeVertex of a Stroke. * An instance of a StrokeVertexIterator can only be obtained from a Stroke by calling * strokeVerticesBegin() or strokeVerticesEnd(). It is iterating over the same vertices as an * Interface0DIterator. The difference resides in the object access. Indeed, an Interface0DIterator @@ -46,12 +46,12 @@ namespace StrokeInternal { */ class StrokeVertexIterator : public Interface0DIteratorNested { public: - /*! Default constructor. */ + /** Default constructor. */ StrokeVertexIterator() { } - /*! Copy constructor. */ + /** Copy constructor. */ StrokeVertexIterator(const StrokeVertexIterator &vi) { _it = vi._it; @@ -72,7 +72,7 @@ class StrokeVertexIterator : public Interface0DIteratorNested { { } - /*! Casts this StrokeVertexIterator into an Interface0DIterator. + /** Casts this StrokeVertexIterator into an Interface0DIterator. * Useful for any call to a function of the type UnaryFunction0D. */ inline Interface0DIterator castToInterface0DIterator() const @@ -81,7 +81,7 @@ class StrokeVertexIterator : public Interface0DIteratorNested { return ret; } - /*! operator= + /** operator= * \attention In the scripting language, you must call \code it2 = StrokeVertexIterator(it1) * \endcode instead of \code it2 = it1 \endcode where \a it1 and \a it2 are 2 * StrokeVertexIterator. Otherwise, incrementing \a it1 will also increment \a it2. @@ -94,13 +94,13 @@ class StrokeVertexIterator : public Interface0DIteratorNested { return *this; } - /*! Returns the string "StrokeVertexIterator". */ + /** Returns the string "StrokeVertexIterator". */ virtual string getExactTypeName() const { return "StrokeVertexIterator"; } - /*! Returns a reference to the pointed StrokeVertex. + /** Returns a reference to the pointed StrokeVertex. * In the scripting language, you must call "getObject()"instead. */ virtual StrokeVertex &operator*() @@ -108,7 +108,7 @@ class StrokeVertexIterator : public Interface0DIteratorNested { return **_it; } - /*! Returns a pointer to the pointed StrokeVertex. + /** Returns a pointer to the pointed StrokeVertex. * Can't be called in the scripting language. */ virtual StrokeVertex *operator->() @@ -116,14 +116,14 @@ class StrokeVertexIterator : public Interface0DIteratorNested { return &(operator*()); } - /*! Increments. In the scripting language, call "increment()". */ + /** Increments. In the scripting language, call "increment()". */ virtual StrokeVertexIterator &operator++() { increment(); return *this; } - /*! Increments. In the scripting language, call "increment()". */ + /** Increments. In the scripting language, call "increment()". */ virtual StrokeVertexIterator operator++(int) { StrokeVertexIterator ret(*this); @@ -131,14 +131,14 @@ class StrokeVertexIterator : public Interface0DIteratorNested { return ret; } - /*! Decrements. In the scripting language, call "decrement()". */ + /** Decrements. In the scripting language, call "decrement()". */ virtual StrokeVertexIterator &operator--() { decrement(); return *this; } - /*! Decrements. In the scripting language, call "decrement()". */ + /** Decrements. In the scripting language, call "decrement()". */ virtual StrokeVertexIterator operator--(int) { StrokeVertexIterator ret(*this); @@ -146,27 +146,27 @@ class StrokeVertexIterator : public Interface0DIteratorNested { return ret; } - /*! Increments. */ + /** Increments. */ virtual int increment() { ++_it; return 0; } - /*! Decrements. */ + /** Decrements. */ virtual int decrement() { --_it; return 0; } - /*! Returns true if the pointed StrokeVertex is the first of the Stroke. */ + /** Returns true if the pointed StrokeVertex is the first of the Stroke. */ bool isBegin() const { return _it == _begin; } - /*! Returns true if the pointed StrokeVertex is the final valid StrokeVertex of the Stroke. */ + /** Returns true if the pointed StrokeVertex is the final valid StrokeVertex of the Stroke. */ bool atLast() { if (_it == _end) { @@ -179,13 +179,13 @@ class StrokeVertexIterator : public Interface0DIteratorNested { return result; } - /*! Returns true if the pointed StrokeVertex is after the last StrokeVertex of the Stroke. */ + /** Returns true if the pointed StrokeVertex is after the last StrokeVertex of the Stroke. */ bool isEnd() const { return _it == _end; } - /*! operator == */ + /** operator == */ virtual bool operator==(const Interface0DIteratorNested &it) const { const StrokeVertexIterator *it_exact = dynamic_cast<const StrokeVertexIterator *>(&it); @@ -195,19 +195,19 @@ class StrokeVertexIterator : public Interface0DIteratorNested { return (_it == it_exact->_it); } - /*! Returns the curvilinear abscissa of the current point */ + /** Returns the curvilinear abscissa of the current point */ virtual float t() const { return (*_it)->curvilinearAbscissa(); } - /*! Returns the point's parameter in the stroke */ + /** Returns the point's parameter in the stroke */ virtual float u() const { return (*_it)->u(); } - /*! Cloning method */ + /** Cloning method */ virtual StrokeVertexIterator *copy() const { return new StrokeVertexIterator(*this); diff --git a/source/blender/freestyle/intern/stroke/StrokeLayer.h b/source/blender/freestyle/intern/stroke/StrokeLayer.h index 2101e7732ce..3bcd675d295 100644 --- a/source/blender/freestyle/intern/stroke/StrokeLayer.h +++ b/source/blender/freestyle/intern/stroke/StrokeLayer.h @@ -55,15 +55,15 @@ class StrokeLayer { virtual ~StrokeLayer(); - /*! Render method */ + /** Render method */ void ScaleThickness(float iFactor); void Render(const StrokeRenderer *iRenderer); void RenderBasic(const StrokeRenderer *iRenderer); - /*! clears the layer */ + /** clears the layer */ void clear(); - /*! accessors */ + /** accessors */ inline stroke_container::iterator strokes_begin() { return _strokes.begin(); @@ -84,7 +84,7 @@ class StrokeLayer { return _strokes.empty(); } - /*! modifiers */ + /** modifiers */ inline void setStrokes(stroke_container &iStrokes) { _strokes = iStrokes; diff --git a/source/blender/freestyle/intern/stroke/StrokeRenderer.h b/source/blender/freestyle/intern/stroke/StrokeRenderer.h index d3ed8bde8a3..61b530b9643 100644 --- a/source/blender/freestyle/intern/stroke/StrokeRenderer.h +++ b/source/blender/freestyle/intern/stroke/StrokeRenderer.h @@ -46,7 +46,7 @@ namespace Freestyle { /* */ /**********************************/ -/*! Class to load textures */ +/** Class to load textures */ class TextureManager { public: TextureManager(); @@ -117,13 +117,13 @@ class TextureManager { /* */ /**********************************/ -/*! Class to render a stroke. Creates a triangle strip and stores it strip is lazily created at the +/** Class to render a stroke. Creates a triangle strip and stores it strip is lazily created at the * first rendering */ class StrokeRenderer { public: virtual ~StrokeRenderer(); - /*! Renders a stroke rep */ + /** Renders a stroke rep */ virtual void RenderStrokeRep(StrokeRep *iStrokeRep) const = 0; virtual void RenderStrokeRepBasic(StrokeRep *iStrokeRep) const = 0; diff --git a/source/blender/freestyle/intern/stroke/StrokeRep.h b/source/blender/freestyle/intern/stroke/StrokeRep.h index 09048b8e147..cc889aac364 100644 --- a/source/blender/freestyle/intern/stroke/StrokeRep.h +++ b/source/blender/freestyle/intern/stroke/StrokeRep.h @@ -197,13 +197,13 @@ class StrokeRep { StrokeRep(Stroke *iStroke); virtual ~StrokeRep(); - /*! Creates the strips */ + /** Creates the strips */ virtual void create(); - /*! Renders the stroke using a Renderer */ + /** Renders the stroke using a Renderer */ virtual void Render(const StrokeRenderer *iRenderer); - /*! accessors */ + /** accessors */ inline Stroke::MediumType getMediumType() const { return _strokeType; @@ -249,7 +249,7 @@ class StrokeRep { return _stroke; } - /*! modifiers */ + /** modifiers */ inline void setMediumType(Stroke::MediumType itype) { _strokeType = itype; diff --git a/source/blender/freestyle/intern/stroke/StrokeShader.h b/source/blender/freestyle/intern/stroke/StrokeShader.h index f4984136747..e4a8412d52a 100644 --- a/source/blender/freestyle/intern/stroke/StrokeShader.h +++ b/source/blender/freestyle/intern/stroke/StrokeShader.h @@ -39,7 +39,7 @@ namespace Freestyle { class Stroke; -/*! Base class for Stroke Shaders. +/** Base class for Stroke Shaders. * Any Stroke Shader must inherit from this class and overload the shade() method. * A StrokeShader is designed to modify any Stroke's attribute such as Thickness, Color, * Geometry, Texture, Blending mode... @@ -65,24 +65,24 @@ class StrokeShader { public: void *py_ss; - /*! Default constructor. */ + /** Default constructor. */ StrokeShader() { py_ss = 0; } - /*! Destructor. */ + /** Destructor. */ virtual ~StrokeShader() { } - /*! Returns the string corresponding to the shader's name. */ + /** Returns the string corresponding to the shader's name. */ virtual string getName() const { return "StrokeShader"; } - /*! The shading method. This method must be overloaded by inherited classes. + /** The shading method. This method must be overloaded by inherited classes. * \param ioStroke: * The stroke we wish to shade. this Stroke is modified by the Shader (which typically * modifies the Stroke's attribute's values such as Color, Thickness, Geometry...) diff --git a/source/blender/freestyle/intern/stroke/StrokeTesselator.h b/source/blender/freestyle/intern/stroke/StrokeTesselator.h index 0c1efb873bc..b03db823d18 100644 --- a/source/blender/freestyle/intern/stroke/StrokeTesselator.h +++ b/source/blender/freestyle/intern/stroke/StrokeTesselator.h @@ -43,10 +43,10 @@ class StrokeTesselator { { } - /*! Builds a line rep contained from a Stroke */ + /** Builds a line rep contained from a Stroke */ LineRep *Tesselate(Stroke *iStroke); - /*! Builds a set of lines rep contained under a a NodeShape, itself contained under a NodeGroup + /** Builds a set of lines rep contained under a a NodeShape, itself contained under a NodeGroup * from a set of strokes. */ template<class StrokeIterator> NodeGroup *Tesselate(StrokeIterator begin, StrokeIterator end); diff --git a/source/blender/freestyle/intern/stroke/TextStrokeRenderer.h b/source/blender/freestyle/intern/stroke/TextStrokeRenderer.h index bbc3b5058a3..09c597791a2 100644 --- a/source/blender/freestyle/intern/stroke/TextStrokeRenderer.h +++ b/source/blender/freestyle/intern/stroke/TextStrokeRenderer.h @@ -54,7 +54,7 @@ class TextStrokeRenderer : public StrokeRenderer { public: TextStrokeRenderer(const char *iFileName = NULL); - /*! Renders a stroke rep */ + /** Renders a stroke rep */ virtual void RenderStrokeRep(StrokeRep *iStrokeRep) const; virtual void RenderStrokeRepBasic(StrokeRep *iStrokeRep) const; diff --git a/source/blender/freestyle/intern/system/BaseObject.h b/source/blender/freestyle/intern/system/BaseObject.h index 76d30aa74e2..8a19100a5c6 100644 --- a/source/blender/freestyle/intern/system/BaseObject.h +++ b/source/blender/freestyle/intern/system/BaseObject.h @@ -39,7 +39,7 @@ class BaseObject { { } - /*! At least makes a release on this. + /** At least makes a release on this. * The BaseObject::destroy method must be explicitly called at the end of any overloaded destroy */ virtual int destroy() @@ -47,13 +47,13 @@ class BaseObject { return release(); } - /*! Increments the reference counter */ + /** Increments the reference counter */ inline int addRef() { return ++_ref_counter; } - /*! Decrements the reference counter */ + /** Decrements the reference counter */ inline int release() { if (_ref_counter) { diff --git a/source/blender/freestyle/intern/system/Id.h b/source/blender/freestyle/intern/system/Id.h index f94e044de29..92ce5f28fb1 100644 --- a/source/blender/freestyle/intern/system/Id.h +++ b/source/blender/freestyle/intern/system/Id.h @@ -27,21 +27,21 @@ namespace Freestyle { -/*! Class used to tag any object by an id. +/** Class used to tag any object by an id. * It is made of two unsigned integers. */ class Id { public: typedef unsigned id_type; - /*! Default constructor */ + /** Default constructor */ Id() { _first = 0; _second = 0; } - /*! Builds an Id from an integer. + /** Builds an Id from an integer. * The second number is set to 0. */ Id(id_type id) @@ -50,21 +50,21 @@ class Id { _second = 0; } - /*! Builds the Id from the two numbers */ + /** Builds the Id from the two numbers */ Id(id_type ifirst, id_type isecond) { _first = ifirst; _second = isecond; } - /*! Copy constructor */ + /** Copy constructor */ Id(const Id &iBrother) { _first = iBrother._first; _second = iBrother._second; } - /*! Operator= */ + /** Operator= */ Id &operator=(const Id &iBrother) { _first = iBrother._first; @@ -72,43 +72,43 @@ class Id { return *this; } - /*! Returns the first Id number */ + /** Returns the first Id number */ id_type getFirst() const { return _first; } - /*! Returns the second Id number */ + /** Returns the second Id number */ id_type getSecond() const { return _second; } - /*! Sets the first number constituting the Id */ + /** Sets the first number constituting the Id */ void setFirst(id_type first) { _first = first; } - /*! Sets the second number constituting the Id */ + /** Sets the second number constituting the Id */ void setSecond(id_type second) { _second = second; } - /*! Operator== */ + /** Operator== */ bool operator==(const Id &id) const { return ((_first == id._first) && (_second == id._second)); } - /*! Operator!= */ + /** Operator!= */ bool operator!=(const Id &id) const { return !((*this) == id); } - /*! Operator< */ + /** Operator< */ bool operator<(const Id &id) const { if (_first < id._first) { diff --git a/source/blender/freestyle/intern/system/ProgressBar.h b/source/blender/freestyle/intern/system/ProgressBar.h index d7b02c48359..6919c624545 100644 --- a/source/blender/freestyle/intern/system/ProgressBar.h +++ b/source/blender/freestyle/intern/system/ProgressBar.h @@ -64,7 +64,7 @@ class ProgressBar { _label = s; } - /*! accessors */ + /** accessors */ inline unsigned int getTotalSteps() const { return _numtotalsteps; diff --git a/source/blender/freestyle/intern/view_map/FEdgeXDetector.h b/source/blender/freestyle/intern/view_map/FEdgeXDetector.h index 2373451f47c..1a96cf3deea 100644 --- a/source/blender/freestyle/intern/view_map/FEdgeXDetector.h +++ b/source/blender/freestyle/intern/view_map/FEdgeXDetector.h @@ -42,7 +42,7 @@ namespace Freestyle { using namespace Geometry; -/*! This class takes as input a WXEdge structure and fills it */ +/** This class takes as input a WXEdge structure and fills it */ class FEdgeXDetector { public: FEdgeXDetector() @@ -69,7 +69,7 @@ class FEdgeXDetector { { } - /*! Process shapes from a WingedEdge containing a list of WShapes */ + /** Process shapes from a WingedEdge containing a list of WShapes */ virtual void processShapes(WingedEdge &); // GENERAL STUFF @@ -86,7 +86,7 @@ class FEdgeXDetector { virtual void processCreaseShape(WXShape *iWShape); virtual void ProcessCreaseEdge(WXEdge *iEdge); - /*! Sets the minimum angle for detecting crease edges + /** Sets the minimum angle for detecting crease edges * \param angle: * The angular threshold in degrees (between 0 and 180) for detecting crease edges. An edge is * considered a crease edge if the angle between two faces sharing the edge is smaller than the @@ -121,7 +121,7 @@ class FEdgeXDetector { virtual void ProcessSuggestiveContourFace(WXFace *iFace); virtual void postProcessSuggestiveContourShape(WXShape *iShape); virtual void postProcessSuggestiveContourFace(WXFace *iFace); - /*! Sets the minimal derivative of the radial curvature for suggestive contours + /** Sets the minimal derivative of the radial curvature for suggestive contours * \param dkr: * The minimal derivative of the radial curvature */ @@ -144,7 +144,7 @@ class FEdgeXDetector { // EVERYBODY virtual void buildSmoothEdges(WXShape *iShape); - /*! Sets the current viewpoint */ + /** Sets the current viewpoint */ inline void setViewpoint(const Vec3f &ivp) { _Viewpoint = ivp; @@ -186,7 +186,7 @@ class FEdgeXDetector { } } - /*! Sets the radius of the geodesic sphere around each vertex (for the curvature computation) + /** Sets the radius of the geodesic sphere around each vertex (for the curvature computation) * \param r: * The radius of the sphere expressed as a ratio of the mean edge size */ diff --git a/source/blender/freestyle/intern/view_map/Functions0D.h b/source/blender/freestyle/intern/view_map/Functions0D.h index 0364069b631..7409e1737a4 100644 --- a/source/blender/freestyle/intern/view_map/Functions0D.h +++ b/source/blender/freestyle/intern/view_map/Functions0D.h @@ -52,7 +52,7 @@ using namespace Geometry; // /////////////////////////////////////////////////////////// -/*! Base class for Unary Functions (functors) working on Interface0DIterator. +/** Base class for Unary Functions (functors) working on Interface0DIterator. * A unary function will be used by calling its operator() on an Interface0DIterator. * \attention In the scripting language, there exists several prototypes depending on the returned * value type. For example, you would inherit from a UnaryFunction0DDouble if you wish to define a @@ -74,27 +74,27 @@ template<class T> class UnaryFunction0D { T result; void *py_uf0D; - /*! The type of the value returned by the functor. */ + /** The type of the value returned by the functor. */ typedef T ReturnedValueType; - /*! Default constructor. */ + /** Default constructor. */ UnaryFunction0D() { py_uf0D = NULL; } - /*! Destructor; */ + /** Destructor; */ virtual ~UnaryFunction0D() { } - /*! Returns the string "UnaryFunction0D" */ + /** Returns the string "UnaryFunction0D" */ virtual string getName() const { return "UnaryFunction0D"; } - /*! The operator (). + /** The operator (). * \param iter: * An Interface0DIterator pointing onto the point at which we wish to evaluate the function. * \return the result of the function of type T. @@ -139,16 +139,16 @@ class ViewShape; namespace Functions0D { // GetXF0D -/*! Returns the X 3D coordinate of an Interface0D. */ +/** Returns the X 3D coordinate of an Interface0D. */ class GetXF0D : public UnaryFunction0D<double> { public: - /*! Returns the string "GetXF0D" */ + /** Returns the string "GetXF0D" */ string getName() const { return "GetXF0D"; } - /*! the () operator. */ + /** the () operator. */ int operator()(Interface0DIterator &iter) { result = iter->getX(); @@ -157,16 +157,16 @@ class GetXF0D : public UnaryFunction0D<double> { }; // GetYF0D -/*! Returns the Y 3D coordinate of an Interface0D. */ +/** Returns the Y 3D coordinate of an Interface0D. */ class GetYF0D : public UnaryFunction0D<double> { public: - /*! Returns the string "GetYF0D" */ + /** Returns the string "GetYF0D" */ string getName() const { return "GetYF0D"; } - /*! the () operator. */ + /** the () operator. */ int operator()(Interface0DIterator &iter) { result = iter->getY(); @@ -175,16 +175,16 @@ class GetYF0D : public UnaryFunction0D<double> { }; // GetZF0D -/*! Returns the Z 3D coordinate of an Interface0D. */ +/** Returns the Z 3D coordinate of an Interface0D. */ class GetZF0D : public UnaryFunction0D<double> { public: - /*! Returns the string "GetZF0D" */ + /** Returns the string "GetZF0D" */ string getName() const { return "GetZF0D"; } - /*! the () operator. */ + /** the () operator. */ int operator()(Interface0DIterator &iter) { result = iter->getZ(); @@ -193,16 +193,16 @@ class GetZF0D : public UnaryFunction0D<double> { }; // GetProjectedXF0D -/*! Returns the X 3D projected coordinate of an Interface0D. */ +/** Returns the X 3D projected coordinate of an Interface0D. */ class GetProjectedXF0D : public UnaryFunction0D<double> { public: - /*! Returns the string "GetProjectedXF0D" */ + /** Returns the string "GetProjectedXF0D" */ string getName() const { return "GetProjectedXF0D"; } - /*! the () operator. */ + /** the () operator. */ int operator()(Interface0DIterator &iter) { result = iter->getProjectedX(); @@ -211,16 +211,16 @@ class GetProjectedXF0D : public UnaryFunction0D<double> { }; // GetProjectedYF0D -/*! Returns the Y projected 3D coordinate of an Interface0D. */ +/** Returns the Y projected 3D coordinate of an Interface0D. */ class GetProjectedYF0D : public UnaryFunction0D<double> { public: - /*! Returns the string "GetProjectedYF0D" */ + /** Returns the string "GetProjectedYF0D" */ string getName() const { return "GetProjectedYF0D"; } - /*! the () operator. */ + /** the () operator. */ int operator()(Interface0DIterator &iter) { result = iter->getProjectedY(); @@ -229,16 +229,16 @@ class GetProjectedYF0D : public UnaryFunction0D<double> { }; // GetProjectedZF0D -/*! Returns the Z projected 3D coordinate of an Interface0D. */ +/** Returns the Z projected 3D coordinate of an Interface0D. */ class GetProjectedZF0D : public UnaryFunction0D<double> { public: - /*! Returns the string "GetProjectedZF0D" */ + /** Returns the string "GetProjectedZF0D" */ string getName() const { return "GetProjectedZF0D"; } - /*! the () operator. */ + /** the () operator. */ int operator()(Interface0DIterator &iter) { result = iter->getProjectedZ(); @@ -247,16 +247,16 @@ class GetProjectedZF0D : public UnaryFunction0D<double> { }; // GetCurvilinearAbscissaF0D -/*! Returns the curvilinear abscissa of an Interface0D in the context of its 1D element. */ +/** Returns the curvilinear abscissa of an Interface0D in the context of its 1D element. */ class GetCurvilinearAbscissaF0D : public UnaryFunction0D<float> { public: - /*! Returns the string "GetCurvilinearAbscissaF0D" */ + /** Returns the string "GetCurvilinearAbscissaF0D" */ string getName() const { return "GetCurvilinearAbscissaF0D"; } - /*! the () operator. */ + /** the () operator. */ int operator()(Interface0DIterator &iter) { result = iter.t(); @@ -265,16 +265,16 @@ class GetCurvilinearAbscissaF0D : public UnaryFunction0D<float> { }; // GetParameterF0D -/*! Returns the parameter of an Interface0D in the context of its 1D element. */ +/** Returns the parameter of an Interface0D in the context of its 1D element. */ class GetParameterF0D : public UnaryFunction0D<float> { public: - /*! Returns the string "GetCurvilinearAbscissaF0D" */ + /** Returns the string "GetCurvilinearAbscissaF0D" */ string getName() const { return "GetParameterF0D"; } - /*! the () operator. */ + /** the () operator. */ int operator()(Interface0DIterator &iter) { result = iter.u(); @@ -283,93 +283,93 @@ class GetParameterF0D : public UnaryFunction0D<float> { }; // VertexOrientation2DF0D -/*! Returns a Vec2r giving the 2D oriented tangent to the 1D element to which the +/** Returns a Vec2r giving the 2D oriented tangent to the 1D element to which the * Interface0DIterator& belongs to and evaluated at the Interface0D pointed by this * Interface0DIterator&. */ class VertexOrientation2DF0D : public UnaryFunction0D<Vec2f> { public: - /*! Returns the string "VertexOrientation2DF0D" */ + /** Returns the string "VertexOrientation2DF0D" */ string getName() const { return "VertexOrientation2DF0D"; } - /*! the () operator. */ + /** the () operator. */ int operator()(Interface0DIterator &iter); }; // VertexOrientation3DF0D -/*! Returns a Vec3r giving the 3D oriented tangent to the 1D element to which the +/** Returns a Vec3r giving the 3D oriented tangent to the 1D element to which the * Interface0DIterator& belongs to and evaluated at the Interface0D pointed by this * Interface0DIterator&. */ class VertexOrientation3DF0D : public UnaryFunction0D<Vec3f> { public: - /*! Returns the string "VertexOrientation3DF0D" */ + /** Returns the string "VertexOrientation3DF0D" */ string getName() const { return "VertexOrientation3DF0D"; } - /*! the () operator. */ + /** the () operator. */ int operator()(Interface0DIterator &iter); }; // Curvature2DAngleF0D -/*! Returns a real giving the 2D curvature (as an angle) of the 1D element to which the +/** Returns a real giving the 2D curvature (as an angle) of the 1D element to which the * Interface0DIterator& belongs to and evaluated at the Interface0D pointed by this * Interface0DIterator&. */ class Curvature2DAngleF0D : public UnaryFunction0D<double> { public: - /*! Returns the string "Curvature2DAngleF0D" */ + /** Returns the string "Curvature2DAngleF0D" */ string getName() const { return "Curvature2DAngleF0D"; } - /*! the () operator. */ + /** the () operator. */ int operator()(Interface0DIterator &iter); }; // ZDiscontinuity -/*! Returns a real giving the distance between and Interface0D and the shape that lies behind +/** Returns a real giving the distance between and Interface0D and the shape that lies behind * (occludee). This distance is evaluated in the camera space and normalized between 0 and 1. * Therefore, if no object is occluded by the shape to which the Interface0D belongs to, 1 is * returned. */ class ZDiscontinuityF0D : public UnaryFunction0D<double> { public: - /*! Returns the string "ZDiscontinuityF0D" */ + /** Returns the string "ZDiscontinuityF0D" */ string getName() const { return "ZDiscontinuityF0D"; } - /*! the () operator. */ + /** the () operator. */ int operator()(Interface0DIterator &iter); }; // Normal2DF0D -/*! Returns a Vec2f giving the normalized 2D normal to the 1D element to which the +/** Returns a Vec2f giving the normalized 2D normal to the 1D element to which the * Interface0DIterator& belongs to and evaluated at the Interface0D pointed by this * Interface0DIterator&. */ class Normal2DF0D : public UnaryFunction0D<Vec2f> { public: - /*! Returns the string "Normal2DF0D" */ + /** Returns the string "Normal2DF0D" */ string getName() const { return "Normal2DF0D"; } - /*! the () operator. */ + /** the () operator. */ int operator()(Interface0DIterator &iter); }; // MaterialF0D -/*! Returns the material of the object evaluated at the Interface0D. +/** Returns the material of the object evaluated at the Interface0D. * This evaluation can be ambiguous (in the case of a TVertex for example. * This functor tries to remove this ambiguity using the context offered by the 1D element to * which the Interface0DIterator& belongs to and by arbitrary choosing the material of the face @@ -379,18 +379,18 @@ class Normal2DF0D : public UnaryFunction0D<Vec2f> { */ class MaterialF0D : public UnaryFunction0D<FrsMaterial> { public: - /*! Returns the string "MaterialF0D" */ + /** Returns the string "MaterialF0D" */ string getName() const { return "MaterialF0D"; } - /*! the () operator. */ + /** the () operator. */ int operator()(Interface0DIterator &iter); }; // ShapeIdF0D -/*! Returns the Id of the Shape the Interface0D belongs to. +/** Returns the Id of the Shape the Interface0D belongs to. * This evaluation can be ambiguous (in the case of a TVertex for example). * This functor tries to remove this ambiguity using the context offered by the 1D element to * which the Interface0DIterator& belongs to. However, there still can be problematic cases, and @@ -399,18 +399,18 @@ class MaterialF0D : public UnaryFunction0D<FrsMaterial> { */ class ShapeIdF0D : public UnaryFunction0D<Id> { public: - /*! Returns the string "ShapeIdF0D" */ + /** Returns the string "ShapeIdF0D" */ string getName() const { return "ShapeIdF0D"; } - /*! the () operator. */ + /** the () operator. */ int operator()(Interface0DIterator &iter); }; // QiF0D -/*! Returns the quantitative invisibility of this Interface0D. +/** Returns the quantitative invisibility of this Interface0D. * This evaluation can be ambiguous (in the case of a TVertex for example). * This functor tries to remove this ambiguity using the context offered by the 1D element to * which the Interface0DIterator& belongs to. However, there still can be problematic cases, and @@ -419,69 +419,69 @@ class ShapeIdF0D : public UnaryFunction0D<Id> { */ class QuantitativeInvisibilityF0D : public UnaryFunction0D<unsigned int> { public: - /*! Returns the string "QuantitativeInvisibilityF0D" */ + /** Returns the string "QuantitativeInvisibilityF0D" */ string getName() const { return "QuantitativeInvisibilityF0D"; } - /*! the () operator. */ + /** the () operator. */ int operator()(Interface0DIterator &iter); }; // CurveNatureF0D -/*! Returns the Nature::EdgeNature of the 1D element the Interface0DIterator& belongs to. */ +/** Returns the Nature::EdgeNature of the 1D element the Interface0DIterator& belongs to. */ class CurveNatureF0D : public UnaryFunction0D<Nature::EdgeNature> { public: - /*! Returns the string "QuantitativeInvisibilityF0D" */ + /** Returns the string "QuantitativeInvisibilityF0D" */ string getName() const { return "CurveNatureF0D"; } - /*! the () operator. */ + /** the () operator. */ int operator()(Interface0DIterator &iter); }; // GetShapeF0D -/*! Returns the ViewShape* containing the Interface0D */ +/** Returns the ViewShape* containing the Interface0D */ class GetShapeF0D : public UnaryFunction0D<ViewShape *> { public: - /*! Returns the string "GetShapeF0D" */ + /** Returns the string "GetShapeF0D" */ string getName() const { return "GetShapeF0D"; } - /*! the () operator. */ + /** the () operator. */ int operator()(Interface0DIterator &iter); }; // GetOccludersF0D -/*! Returns a vector containing the ViewShape* occluding the Interface0D */ +/** Returns a vector containing the ViewShape* occluding the Interface0D */ class GetOccludersF0D : public UnaryFunction0D<std::vector<ViewShape *>> { public: - /*! Returns the string "GetOccludersF0D" */ + /** Returns the string "GetOccludersF0D" */ string getName() const { return "GetOccludersF0D"; } - /*! the () operator. */ + /** the () operator. */ int operator()(Interface0DIterator &iter); }; // GetOccludeeF0D -/*! Returns the ViewShape* "occluded" by the Interface0D */ +/** Returns the ViewShape* "occluded" by the Interface0D */ class GetOccludeeF0D : public UnaryFunction0D<ViewShape *> { public: - /*! Returns the string "GetOccludeeF0D" */ + /** Returns the string "GetOccludeeF0D" */ string getName() const { return "GetOccludeeF0D"; } - /*! the () operator. */ + /** the () operator. */ int operator()(Interface0DIterator &iter); }; diff --git a/source/blender/freestyle/intern/view_map/Functions1D.h b/source/blender/freestyle/intern/view_map/Functions1D.h index 9cf5527ee19..e45bc459bf0 100644 --- a/source/blender/freestyle/intern/view_map/Functions1D.h +++ b/source/blender/freestyle/intern/view_map/Functions1D.h @@ -42,7 +42,7 @@ namespace Freestyle { // /////////////////////////////////////////////////////////// -/*! Base class for Unary Functions (functors) working on Interface1D. +/** Base class for Unary Functions (functors) working on Interface1D. * A unary function will be used by calling its operator() on an Interface1D. * \attention In the scripting language, there exists several prototypes depending on the returned * value type. For example, you would inherit from a UnaryFunction1DDouble if you wish to define a @@ -61,16 +61,16 @@ template<class T> class UnaryFunction1D { T result; void *py_uf1D; - /*! The type of the value returned by the functor. */ + /** The type of the value returned by the functor. */ typedef T ReturnedValueType; - /*! Default constructor */ + /** Default constructor */ UnaryFunction1D() { _integration = MEAN; } - /*! Builds a UnaryFunction1D from an integration type. + /** Builds a UnaryFunction1D from an integration type. * \param iType: * In case the result for the Interface1D would be obtained by evaluating a 0D function over * the different Interface0D of the Interface1D, \a iType tells which integration method to use. @@ -81,18 +81,18 @@ template<class T> class UnaryFunction1D { _integration = iType; } - /*! destructor. */ + /** destructor. */ virtual ~UnaryFunction1D() { } - /*! returns the string "UnaryFunction1D". */ + /** returns the string "UnaryFunction1D". */ virtual string getName() const { return "UnaryFunction1D"; } - /*! The operator (). + /** The operator (). * \param inter: * The Interface1D on which we wish to evaluate the function. * \return the result of the function of type T. @@ -103,13 +103,13 @@ template<class T> class UnaryFunction1D { return Director_BPy_UnaryFunction1D___call__(this, py_uf1D, inter); } - /*! Sets the integration method */ + /** Sets the integration method */ void setIntegrationType(IntegrationType integration) { _integration = integration; } - /*! Returns the integration method. */ + /** Returns the integration method. */ IntegrationType getIntegrationType() const { return _integration; @@ -178,13 +178,13 @@ class UnaryFunction1D_void { namespace Functions1D { // GetXF1D -/*! Returns the X 3D coordinate of an Interface1D. */ +/** Returns the X 3D coordinate of an Interface1D. */ class GetXF1D : public UnaryFunction1D<double> { private: Functions0D::GetXF0D _func; public: - /*! Builds the functor. + /** Builds the functor. * \param iType: * The integration method used to compute a single value from a set of values. */ @@ -192,24 +192,24 @@ class GetXF1D : public UnaryFunction1D<double> { { } - /*! Returns the string "GetXF1D" */ + /** Returns the string "GetXF1D" */ string getName() const { return "GetXF1D"; } - /*! the () operator. */ + /** the () operator. */ int operator()(Interface1D &inter); }; // GetYF1D -/*! Returns the Y 3D coordinate of an Interface1D. */ +/** Returns the Y 3D coordinate of an Interface1D. */ class GetYF1D : public UnaryFunction1D<double> { private: Functions0D::GetYF0D _func; public: - /*! Builds the functor. + /** Builds the functor. * \param iType: * The integration method used to compute a single value from a set of values. */ @@ -217,24 +217,24 @@ class GetYF1D : public UnaryFunction1D<double> { { } - /*! Returns the string "GetYF1D" */ + /** Returns the string "GetYF1D" */ string getName() const { return "GetYF1D"; } - /*! the () operator. */ + /** the () operator. */ int operator()(Interface1D &inter); }; // GetZF1D -/*! Returns the Z 3D coordinate of an Interface1D. */ +/** Returns the Z 3D coordinate of an Interface1D. */ class GetZF1D : public UnaryFunction1D<double> { private: Functions0D::GetZF0D _func; public: - /*! Builds the functor. + /** Builds the functor. * \param iType: * The integration method used to compute a single value from a set of values. */ @@ -242,24 +242,24 @@ class GetZF1D : public UnaryFunction1D<double> { { } - /*! Returns the string "GetZF1D" */ + /** Returns the string "GetZF1D" */ string getName() const { return "GetZF1D"; } - /*! the () operator. */ + /** the () operator. */ int operator()(Interface1D &inter); }; // GetProjectedXF1D -/*! Returns the projected X 3D coordinate of an Interface1D. */ +/** Returns the projected X 3D coordinate of an Interface1D. */ class GetProjectedXF1D : public UnaryFunction1D<double> { private: Functions0D::GetProjectedXF0D _func; public: - /*! Builds the functor. + /** Builds the functor. * \param iType: * The integration method used to compute a single value from a set of values. */ @@ -267,24 +267,24 @@ class GetProjectedXF1D : public UnaryFunction1D<double> { { } - /*! Returns the string "GetProjectedXF1D" */ + /** Returns the string "GetProjectedXF1D" */ string getName() const { return "GetProjectedXF1D"; } - /*! the () operator. */ + /** the () operator. */ int operator()(Interface1D &inter); }; // GetProjectedYF1D -/*! Returns the projected Y 3D coordinate of an Interface1D. */ +/** Returns the projected Y 3D coordinate of an Interface1D. */ class GetProjectedYF1D : public UnaryFunction1D<double> { private: Functions0D::GetProjectedYF0D _func; public: - /*! Builds the functor. + /** Builds the functor. * \param iType: * The integration method used to compute a single value from a set of values. */ @@ -292,24 +292,24 @@ class GetProjectedYF1D : public UnaryFunction1D<double> { { } - /*! Returns the string "GetProjectedYF1D" */ + /** Returns the string "GetProjectedYF1D" */ string getName() const { return "GetProjectedYF1D"; } - /*! the () operator. */ + /** the () operator. */ int operator()(Interface1D &inter); }; // GetProjectedZF1D -/*! Returns the projected Z 3D coordinate of an Interface1D. */ +/** Returns the projected Z 3D coordinate of an Interface1D. */ class GetProjectedZF1D : public UnaryFunction1D<double> { private: Functions0D::GetProjectedZF0D _func; public: - /*! Builds the functor. + /** Builds the functor. * \param iType: * The integration method used to compute a single value from a set of values. */ @@ -317,24 +317,24 @@ class GetProjectedZF1D : public UnaryFunction1D<double> { { } - /*! Returns the string "GetProjectedZF1D" */ + /** Returns the string "GetProjectedZF1D" */ string getName() const { return "GetProjectedZF1D"; } - /*! the () operator. */ + /** the () operator. */ int operator()(Interface1D &inter); }; // Orientation2DF1D -/*! Returns the 2D orientation as a Vec2f*/ +/** Returns the 2D orientation as a #Vec2f. */ class Orientation2DF1D : public UnaryFunction1D<Vec2f> { private: Functions0D::VertexOrientation2DF0D _func; public: - /*! Builds the functor. + /** Builds the functor. * \param iType: * The integration method used to compute a single value from a set of values. */ @@ -342,24 +342,24 @@ class Orientation2DF1D : public UnaryFunction1D<Vec2f> { { } - /*! Returns the string "Orientation2DF1D" */ + /** Returns the string "Orientation2DF1D" */ string getName() const { return "Orientation2DF1D"; } - /*! the () operator. */ + /** the () operator. */ int operator()(Interface1D &inter); }; // Orientation3DF1D -/*! Returns the 3D orientation as a Vec3f. */ +/** Returns the 3D orientation as a Vec3f. */ class Orientation3DF1D : public UnaryFunction1D<Vec3f> { private: Functions0D::VertexOrientation3DF0D _func; public: - /*! Builds the functor. + /** Builds the functor. * \param iType: * The integration method used to compute a single value from a set of values. */ @@ -367,18 +367,18 @@ class Orientation3DF1D : public UnaryFunction1D<Vec3f> { { } - /*! Returns the string "Orientation3DF1D" */ + /** Returns the string "Orientation3DF1D" */ string getName() const { return "Orientation3DF1D"; } - /*! the () operator. */ + /** the () operator. */ int operator()(Interface1D &inter); }; // ZDiscontinuityF1D -/*! Returns a real giving the distance between and Interface1D and the shape that lies behind +/** Returns a real giving the distance between and Interface1D and the shape that lies behind * (occludee). This distance is evaluated in the camera space and normalized between 0 and 1. * Therefore, if no object is occluded by the shape to which the Interface1D belongs to, 1 is * returned. @@ -388,7 +388,7 @@ class ZDiscontinuityF1D : public UnaryFunction1D<double> { Functions0D::ZDiscontinuityF0D _func; public: - /*! Builds the functor. + /** Builds the functor. * \param iType: * The integration method used to compute a single value from a set of values. */ @@ -396,18 +396,18 @@ class ZDiscontinuityF1D : public UnaryFunction1D<double> { { } - /*! Returns the string "ZDiscontinuityF1D" */ + /** Returns the string "ZDiscontinuityF1D" */ string getName() const { return "ZDiscontinuityF1D"; } - /*! the () operator. */ + /** the () operator. */ int operator()(Interface1D &inter); }; // QuantitativeInvisibilityF1D -/*! Returns the Quantitative Invisibility of an Interface1D element. +/** Returns the Quantitative Invisibility of an Interface1D element. * If the Interface1D is a ViewEdge, then there is no ambiguity concerning the result. But, if the * Interface1D results of a chaining (chain, stroke), then it might be made of several 1D elements * of different Quantitative Invisibilities. @@ -417,7 +417,7 @@ class QuantitativeInvisibilityF1D : public UnaryFunction1D<unsigned> { Functions0D::QuantitativeInvisibilityF0D _func; public: - /*! Builds the functor. + /** Builds the functor. * \param iType: * The integration method used to compute a single value from a set of values. */ @@ -425,18 +425,18 @@ class QuantitativeInvisibilityF1D : public UnaryFunction1D<unsigned> { { } - /*! Returns the string "QuantitativeInvisibilityF1D" */ + /** Returns the string "QuantitativeInvisibilityF1D" */ string getName() const { return "QuantitativeInvisibilityF1D"; } - /*! the () operator. */ + /** the () operator. */ int operator()(Interface1D &inter); }; // CurveNatureF1D -/*! Returns the nature of the Interface1D (silhouette, ridge, crease...). +/** Returns the nature of the Interface1D (silhouette, ridge, crease...). * Except if the Interface1D is a ViewEdge, this result might be ambiguous. * Indeed, the Interface1D might result from the gathering of several 1D elements, each one being * of a different nature. An integration method, such as the MEAN, might give, in this case, @@ -447,7 +447,7 @@ class CurveNatureF1D : public UnaryFunction1D<Nature::EdgeNature> { Functions0D::CurveNatureF0D _func; public: - /*! Builds the functor. + /** Builds the functor. * \param iType: * The integration method used to compute a single value from a set of values. */ @@ -455,63 +455,63 @@ class CurveNatureF1D : public UnaryFunction1D<Nature::EdgeNature> { { } - /*! Returns the string "CurveNatureF1D" */ + /** Returns the string "CurveNatureF1D" */ string getName() const { return "CurveNatureF1D"; } - /*! the () operator. */ + /** the () operator. */ int operator()(Interface1D &inter); }; // TimeStampF1D -/*! Returns the time stamp of the Interface1D. */ +/** Returns the time stamp of the Interface1D. */ class TimeStampF1D : public UnaryFunction1D_void { public: - /*! Returns the string "TimeStampF1D" */ + /** Returns the string "TimeStampF1D" */ string getName() const { return "TimeStampF1D"; } - /*! the () operator. */ + /** the () operator. */ int operator()(Interface1D &inter); }; // IncrementChainingTimeStampF1D -/*! Increments the chaining time stamp of the Interface1D. */ +/** Increments the chaining time stamp of the Interface1D. */ class IncrementChainingTimeStampF1D : public UnaryFunction1D_void { public: - /*! Returns the string "IncrementChainingTimeStampF1D" */ + /** Returns the string "IncrementChainingTimeStampF1D" */ string getName() const { return "IncrementChainingTimeStampF1D"; } - /*! the () operator. */ + /** the () operator. */ int operator()(Interface1D &inter); }; // ChainingTimeStampF1D -/*! Sets the chaining time stamp of the Interface1D. */ +/** Sets the chaining time stamp of the Interface1D. */ class ChainingTimeStampF1D : public UnaryFunction1D_void { public: - /*! Returns the string "ChainingTimeStampF1D" */ + /** Returns the string "ChainingTimeStampF1D" */ string getName() const { return "ChainingTimeStampF1D"; } - /*! the () operator. */ + /** the () operator. */ int operator()(Interface1D &inter); }; // Curvature2DAngleF1D -/*! Returns the 2D curvature as an angle for an Interface1D. */ +/** Returns the 2D curvature as an angle for an Interface1D. */ class Curvature2DAngleF1D : public UnaryFunction1D<double> { public: - /*! Builds the functor. + /** Builds the functor. * \param iType: * The integration method used to compute a single value from a set of values. */ @@ -519,13 +519,13 @@ class Curvature2DAngleF1D : public UnaryFunction1D<double> { { } - /*! Returns the string "Curvature2DAngleF1D" */ + /** Returns the string "Curvature2DAngleF1D" */ string getName() const { return "Curvature2DAngleF1D"; } - /*! the () operator.*/ + /** the () operator. */ int operator()(Interface1D &inter) { result = integrate(_fun, inter.verticesBegin(), inter.verticesEnd(), _integration); @@ -537,10 +537,10 @@ class Curvature2DAngleF1D : public UnaryFunction1D<double> { }; // Normal2DF1D -/*! Returns the 2D normal for an interface 1D. */ +/** Returns the 2D normal for an interface 1D. */ class Normal2DF1D : public UnaryFunction1D<Vec2f> { public: - /*! Builds the functor. + /** Builds the functor. * \param iType: * The integration method used to compute a single value from a set of values. */ @@ -548,13 +548,13 @@ class Normal2DF1D : public UnaryFunction1D<Vec2f> { { } - /*! Returns the string "Normal2DF1D" */ + /** Returns the string "Normal2DF1D" */ string getName() const { return "Normal2DF1D"; } - /*! the () operator.*/ + /** the () operator. */ int operator()(Interface1D &inter) { result = integrate(_fun, inter.verticesBegin(), inter.verticesEnd(), _integration); @@ -566,59 +566,59 @@ class Normal2DF1D : public UnaryFunction1D<Vec2f> { }; // GetShapeF1D -/*! Returns list of shapes covered by this Interface1D. */ +/** Returns list of shapes covered by this Interface1D. */ class GetShapeF1D : public UnaryFunction1D<std::vector<ViewShape *>> { public: - /*! Builds the functor. */ + /** Builds the functor. */ GetShapeF1D() : UnaryFunction1D<std::vector<ViewShape *>>() { } - /*! Returns the string "GetShapeF1D" */ + /** Returns the string "GetShapeF1D" */ string getName() const { return "GetShapeF1D"; } - /*! the () operator. */ + /** the () operator. */ int operator()(Interface1D &inter); }; // GetOccludersF1D -/*! Returns list of occluding shapes covered by this Interface1D. */ +/** Returns list of occluding shapes covered by this Interface1D. */ class GetOccludersF1D : public UnaryFunction1D<std::vector<ViewShape *>> { public: - /*! Builds the functor. */ + /** Builds the functor. */ GetOccludersF1D() : UnaryFunction1D<std::vector<ViewShape *>>() { } - /*! Returns the string "GetOccludersF1D" */ + /** Returns the string "GetOccludersF1D" */ string getName() const { return "GetOccludersF1D"; } - /*! the () operator. */ + /** the () operator. */ int operator()(Interface1D &inter); }; // GetOccludeeF1D -/*! Returns list of occluded shapes covered by this Interface1D. */ +/** Returns list of occluded shapes covered by this Interface1D. */ class GetOccludeeF1D : public UnaryFunction1D<std::vector<ViewShape *>> { public: - /*! Builds the functor. */ + /** Builds the functor. */ GetOccludeeF1D() : UnaryFunction1D<std::vector<ViewShape *>>() { } - /*! Returns the string "GetOccludeeF1D" */ + /** Returns the string "GetOccludeeF1D" */ string getName() const { return "GetOccludeeF1D"; } - /*! the () operator. */ + /** the () operator. */ int operator()(Interface1D &inter); }; diff --git a/source/blender/freestyle/intern/view_map/Interface0D.h b/source/blender/freestyle/intern/view_map/Interface0D.h index 6b4682cc862..065319578e5 100644 --- a/source/blender/freestyle/intern/view_map/Interface0D.h +++ b/source/blender/freestyle/intern/view_map/Interface0D.h @@ -51,18 +51,18 @@ class ViewVertex; class NonTVertex; class TVertex; -/*! Base class for any 0D element. */ +/** Base class for any 0D element. */ class Interface0D { public: - /*! Default constructor */ + /** Default constructor */ Interface0D() { } - /*! Destructor */ + /** Destructor */ virtual ~Interface0D(){}; - /*! Returns the string "Interface0D". */ + /** Returns the string "Interface0D". */ virtual string getExactTypeName() const { return "Interface0D"; @@ -70,50 +70,50 @@ class Interface0D { // Data access methods - /*! Returns the 3D x coordinate of the point. */ + /** Returns the 3D x coordinate of the point. */ virtual real getX() const; - /*! Returns the 3D y coordinate of the point. */ + /** Returns the 3D y coordinate of the point. */ virtual real getY() const; - /*! Returns the 3D z coordinate of the point. */ + /** Returns the 3D z coordinate of the point. */ virtual real getZ() const; - /*! Returns the 3D point. */ + /** Returns the 3D point. */ virtual Geometry::Vec3r getPoint3D() const; - /*! Returns the 2D x coordinate of the point. */ + /** Returns the 2D x coordinate of the point. */ virtual real getProjectedX() const; - /*! Returns the 2D y coordinate of the point. */ + /** Returns the 2D y coordinate of the point. */ virtual real getProjectedY() const; - /*! Returns the 2D z coordinate of the point. */ + /** Returns the 2D z coordinate of the point. */ virtual real getProjectedZ() const; - /*! Returns the 2D point. */ + /** Returns the 2D point. */ virtual Geometry::Vec2r getPoint2D() const; - /*! Returns the FEdge that lies between this Interface0D and the Interface0D given as argument. + /** Returns the FEdge that lies between this Interface0D and the Interface0D given as argument. */ virtual FEdge *getFEdge(Interface0D &); - /*! Returns the Id of the point. */ + /** Returns the Id of the point. */ virtual Id getId() const; - /*! Returns the nature of the point. */ + /** Returns the nature of the point. */ virtual Nature::VertexNature getNature() const; - /*! Cast the Interface0D in SVertex if it can be. */ + /** Cast the Interface0D in SVertex if it can be. */ virtual SVertex *castToSVertex(); - /*! Cast the Interface0D in ViewVertex if it can be. */ + /** Cast the Interface0D in ViewVertex if it can be. */ virtual ViewVertex *castToViewVertex(); - /*! Cast the Interface0D in NonTVertex if it can be. */ + /** Cast the Interface0D in NonTVertex if it can be. */ virtual NonTVertex *castToNonTVertex(); - /*! Cast the Interface0D in TVertex if it can be. */ + /** Cast the Interface0D in TVertex if it can be. */ virtual TVertex *castToTVertex(); #ifdef WITH_CXX_GUARDEDALLOC @@ -159,10 +159,10 @@ class Interface0DIteratorNested : public Iterator { return !(*this == it); } - /*! Returns the curvilinear abscissa */ + /** Returns the curvilinear abscissa */ virtual float t() const = 0; - /*! Returns the point parameter 0<u<1 */ + /** Returns the point parameter 0<u<1 */ virtual float u() const = 0; virtual Interface0DIteratorNested *copy() const = 0; @@ -173,7 +173,7 @@ class Interface0DIteratorNested : public Iterator { // ////////////////////////////////////////////////// -/*! Class defining an iterator over Interface0D elements. +/** Class defining an iterator over Interface0D elements. * An instance of this iterator is always obtained from a 1D element. * \attention In the scripting language, you must call \code it2 = Interface0DIterator(it1) * \endcode instead of \code it2 = it1 \endcode where \a it1 and \a it2 are 2 Interface0DIterator. @@ -186,13 +186,13 @@ class Interface0DIterator : public Iterator { _iterator = it; } - /*! Copy constructor */ + /** Copy constructor */ Interface0DIterator(const Interface0DIterator &it) { _iterator = it._iterator->copy(); } - /*! Destructor */ + /** Destructor */ virtual ~Interface0DIterator() { if (_iterator) { @@ -200,7 +200,7 @@ class Interface0DIterator : public Iterator { } } - /*! Operator = + /** Operator = * \attention In the scripting language, you must call \code it2 = Interface0DIterator(it1) * \endcode instead of \code it2 = it1 \endcode where \a it1 and \a it2 are 2 * Interface0DIterator. Otherwise, incrementing \a it1 will also increment \a it2. @@ -214,7 +214,7 @@ class Interface0DIterator : public Iterator { return *this; } - /*! Returns the string "Interface0DIterator". */ + /** Returns the string "Interface0DIterator". */ virtual string getExactTypeName() const { if (!_iterator) { @@ -225,7 +225,7 @@ class Interface0DIterator : public Iterator { // FIXME test it != 0 (exceptions ?) - /*! Returns a reference to the pointed Interface0D. + /** Returns a reference to the pointed Interface0D. * In the scripting language, you must call "getObject()" instead using this operator. */ Interface0D &operator*() @@ -233,7 +233,7 @@ class Interface0DIterator : public Iterator { return _iterator->operator*(); } - /*! Returns a pointer to the pointed Interface0D. + /** Returns a pointer to the pointed Interface0D. * Can't be called in the scripting language. */ Interface0D *operator->() @@ -241,14 +241,14 @@ class Interface0DIterator : public Iterator { return &(operator*()); } - /*! Increments. In the scripting language, call "increment()". */ + /** Increments. In the scripting language, call "increment()". */ Interface0DIterator &operator++() { _iterator->increment(); return *this; } - /*! Increments. In the scripting language, call "increment()". */ + /** Increments. In the scripting language, call "increment()". */ Interface0DIterator operator++(int) { Interface0DIterator ret(*this); @@ -256,14 +256,14 @@ class Interface0DIterator : public Iterator { return ret; } - /*! Decrements. In the scripting language, call "decrement()". */ + /** Decrements. In the scripting language, call "decrement()". */ Interface0DIterator &operator--() { _iterator->decrement(); return *this; } - /*! Decrements. In the scripting language, call "decrement()". */ + /** Decrements. In the scripting language, call "decrement()". */ Interface0DIterator operator--(int) { Interface0DIterator ret(*this); @@ -271,19 +271,19 @@ class Interface0DIterator : public Iterator { return ret; } - /*! Increments. */ + /** Increments. */ virtual int increment() { return _iterator->increment(); } - /*! Decrements. */ + /** Decrements. */ virtual int decrement() { return _iterator->decrement(); } - /*! Returns true if the pointed Interface0D is the first of the 1D element containing the points + /** Returns true if the pointed Interface0D is the first of the 1D element containing the points * over which we're iterating. */ virtual bool isBegin() const @@ -291,14 +291,14 @@ class Interface0DIterator : public Iterator { return _iterator->isBegin(); } - /*! Returns true if the pointed Interface0D is after the after the last point of the 1D element + /** Returns true if the pointed Interface0D is after the after the last point of the 1D element * we're iterating from. */ virtual bool isEnd() const { return _iterator->isEnd(); } - /*! Returns true when the iterator is pointing to the final valid element. */ + /** Returns true when the iterator is pointing to the final valid element. */ virtual bool atLast() const { if (_iterator->isEnd()) { @@ -311,25 +311,25 @@ class Interface0DIterator : public Iterator { return result; } - /*! operator == . */ + /** operator == . */ bool operator==(const Interface0DIterator &it) const { return _iterator->operator==(*(it._iterator)); } - /*! operator != . */ + /** operator != . */ bool operator!=(const Interface0DIterator &it) const { return !(*this == it); } - /*! Returns the curvilinear abscissa. */ + /** Returns the curvilinear abscissa. */ inline float t() const { return _iterator->t(); } - /*! Returns the point parameter in the curve 0<=u<=1. */ + /** Returns the point parameter in the curve 0<=u<=1. */ inline float u() const { return _iterator->u(); diff --git a/source/blender/freestyle/intern/view_map/Interface1D.h b/source/blender/freestyle/intern/view_map/Interface1D.h index 778deb20a60..75ad71a373d 100644 --- a/source/blender/freestyle/intern/view_map/Interface1D.h +++ b/source/blender/freestyle/intern/view_map/Interface1D.h @@ -41,23 +41,23 @@ using namespace std; namespace Freestyle { // Integration method -/*! The different integration methods that can be invoked to integrate into a single value the set +/** The different integration methods that can be invoked to integrate into a single value the set * of values obtained from each 0D element of a 1D element. */ typedef enum { - MEAN, /*!< The value computed for the 1D element is the mean of the values obtained for the 0D - elements.*/ - MIN, /*!< The value computed for the 1D element is the minimum of the values obtained for the 0D - elements.*/ - MAX, /*!< The value computed for the 1D element is the maximum of the values obtained for the 0D - elements.*/ - FIRST, /*!< The value computed for the 1D element is the first of the values obtained for the 0D - elements.*/ - LAST, /*!< The value computed for the 1D element is the last of the values obtained for the 0D - elements.*/ + MEAN, /**< The value computed for the 1D element is the mean of the values obtained for the 0D + elements. */ + MIN, /**< The value computed for the 1D element is the minimum of the values obtained for the 0D + elements. */ + MAX, /**< The value computed for the 1D element is the maximum of the values obtained for the 0D + elements. */ + FIRST, /**< The value computed for the 1D element is the first of the values obtained for the 0D + elements. */ + LAST, /**< The value computed for the 1D element is the last of the values obtained for the 0D + elements. */ } IntegrationType; -/*! Returns a single value from a set of values evaluated at each 0D element of this 1D element. +/** Returns a single value from a set of values evaluated at each 0D element of this 1D element. * \param fun: * The UnaryFunction0D used to compute a value at each Interface0D. * \param it: @@ -127,19 +127,19 @@ T integrate(UnaryFunction0D<T> &fun, // ////////////////////////////////////////////////// -/*! Base class for any 1D element. */ +/** Base class for any 1D element. */ class Interface1D { public: - /*! Default constructor */ + /** Default constructor */ Interface1D() { _timeStamp = 0; } - /*! Destructor */ + /** Destructor */ virtual ~Interface1D(){}; - /*! Returns the string "Interface1D". */ + /** Returns the string "Interface1D". */ virtual string getExactTypeName() const { return "Interface1D"; @@ -147,13 +147,13 @@ class Interface1D { // Iterator access - /*! Returns an iterator over the Interface1D vertices, pointing to the first vertex. */ + /** Returns an iterator over the Interface1D vertices, pointing to the first vertex. */ virtual Interface0DIterator verticesBegin(); - /*! Returns an iterator over the Interface1D vertices, pointing after the last vertex. */ + /** Returns an iterator over the Interface1D vertices, pointing after the last vertex. */ virtual Interface0DIterator verticesEnd(); - /*! Returns an iterator over the Interface1D points, pointing to the first point. The difference + /** Returns an iterator over the Interface1D points, pointing to the first point. The difference * with verticesBegin() is that here we can iterate over points of the 1D element at a any given * sampling. Indeed, for each iteration, a virtual point is created. * @@ -161,7 +161,7 @@ class Interface1D { */ virtual Interface0DIterator pointsBegin(float t = 0.0f); - /*! Returns an iterator over the Interface1D points, pointing after the last point. The + /** Returns an iterator over the Interface1D points, pointing after the last point. The * difference with verticesEnd() is that here we can iterate over points of the 1D element at a * any given sampling. Indeed, for each iteration, a virtual point is created. * @@ -171,23 +171,23 @@ class Interface1D { // Data access methods - /*! Returns the 2D length of the 1D element. */ + /** Returns the 2D length of the 1D element. */ virtual real getLength2D() const; - /*! Returns the Id of the 1D element. */ + /** Returns the Id of the 1D element. */ virtual Id getId() const; // FIXME: ce truc n'a rien a faire la...(c une requete complexe qui doit etre ds les Function1D) - /*! Returns the nature of the 1D element. */ + /** Returns the nature of the 1D element. */ virtual Nature::EdgeNature getNature() const; - /*! Returns the time stamp of the 1D element. Mainly used for selection. */ + /** Returns the time stamp of the 1D element. Mainly used for selection. */ virtual unsigned getTimeStamp() const { return _timeStamp; } - /*! Sets the time stamp for the 1D element. */ + /** Sets the time stamp for the 1D element. */ inline void setTimeStamp(unsigned iTimeStamp) { _timeStamp = iTimeStamp; diff --git a/source/blender/freestyle/intern/view_map/Silhouette.h b/source/blender/freestyle/intern/view_map/Silhouette.h index 5a59f488b51..0ec9144595c 100644 --- a/source/blender/freestyle/intern/view_map/Silhouette.h +++ b/source/blender/freestyle/intern/view_map/Silhouette.h @@ -66,86 +66,86 @@ class FEdge; class ViewVertex; class SShape; -/*! Class to define a vertex of the embedding. */ +/** Class to define a vertex of the embedding. */ class SVertex : public Interface0D { public: // Implementation of Interface0D - /*! Returns the string "SVertex" .*/ + /** Returns the string "SVertex". */ virtual string getExactTypeName() const { return "SVertex"; } // Data access methods - /*! Returns the 3D x coordinate of the vertex .*/ + /** Returns the 3D x coordinate of the vertex. */ virtual real getX() const { return _Point3D.x(); } - /*! Returns the 3D y coordinate of the vertex .*/ + /** Returns the 3D y coordinate of the vertex. */ virtual real getY() const { return _Point3D.y(); } - /*! Returns the 3D z coordinate of the vertex .*/ + /** Returns the 3D z coordinate of the vertex. */ virtual real getZ() const { return _Point3D.z(); } - /*! Returns the 3D point. */ + /** Returns the 3D point. */ virtual Vec3r getPoint3D() const { return _Point3D; } - /*! Returns the projected 3D x coordinate of the vertex .*/ + /** Returns the projected 3D x coordinate of the vertex. */ virtual real getProjectedX() const { return _Point2D.x(); } - /*! Returns the projected 3D y coordinate of the vertex .*/ + /** Returns the projected 3D y coordinate of the vertex. */ virtual real getProjectedY() const { return _Point2D.y(); } - /*! Returns the projected 3D z coordinate of the vertex .*/ + /** Returns the projected 3D z coordinate of the vertex. */ virtual real getProjectedZ() const { return _Point2D.z(); } - /*! Returns the 2D point. */ + /** Returns the 2D point. */ virtual Vec2r getPoint2D() const { return Vec2r(_Point2D.x(), _Point2D.y()); } - /*! Returns the FEdge that lies between this Svertex and the Interface0D given as argument. */ + /** Returns the FEdge that lies between this Svertex and the Interface0D given as argument. */ virtual FEdge *getFEdge(Interface0D &); - /*! Returns the Id of the vertex .*/ + /** Returns the Id of the vertex. */ virtual Id getId() const { return _Id; } - /*! Returns the nature of the vertex .*/ + /** Returns the nature of the vertex. */ virtual Nature::VertexNature getNature() const; - /*! Cast the Interface0D in SVertex if it can be. */ + /** Cast the Interface0D in SVertex if it can be. */ virtual SVertex *castToSVertex(); - /*! Cast the Interface0D in ViewVertex if it can be. */ + /** Cast the Interface0D in ViewVertex if it can be. */ virtual ViewVertex *castToViewVertex(); - /*! Cast the Interface0D in NonTVertex if it can be. */ + /** Cast the Interface0D in NonTVertex if it can be. */ virtual NonTVertex *castToNonTVertex(); - /*! Cast the Interface0D in TVertex if it can be. */ + /** Cast the Interface0D in TVertex if it can be. */ virtual TVertex *castToTVertex(); public: @@ -166,12 +166,12 @@ class SVertex : public Interface0D { CurvatureInfo *_curvature_info; public: - /*! A field that can be used by the user to store any data. + /** A field that can be used by the user to store any data. * This field must be reset afterwards using ResetUserData(). */ void *userdata; - /*! Default constructor.*/ + /** Default constructor. */ inline SVertex() { _Id = 0; @@ -181,7 +181,7 @@ class SVertex : public Interface0D { _curvature_info = 0; } - /*! Builds a SVertex from 3D coordinates and an Id. */ + /** Builds a SVertex from 3D coordinates and an Id. */ inline SVertex(const Vec3r &iPoint3D, const Id &id) { _Point3D = iPoint3D; @@ -192,7 +192,7 @@ class SVertex : public Interface0D { _curvature_info = 0; } - /*! Copy constructor. */ + /** Copy constructor. */ inline SVertex(SVertex &iBrother) { _Id = iBrother._Id; @@ -212,7 +212,7 @@ class SVertex : public Interface0D { userdata = 0; } - /*! Destructor. */ + /** Destructor. */ virtual ~SVertex() { if (_curvature_info) { @@ -220,14 +220,14 @@ class SVertex : public Interface0D { } } - /*! Cloning method. */ + /** Cloning method. */ virtual SVertex *duplicate() { SVertex *clone = new SVertex(*this); return clone; } - /*! operator == */ + /** operator == */ virtual bool operator==(const SVertex &iBrother) { return ((_Point2D == iBrother._Point2D) && (_Point3D == iBrother._Point3D)); @@ -244,7 +244,7 @@ class SVertex : public Interface0D { return _Point2D; } - /*! Returns the set of normals for this Vertex. + /** Returns the set of normals for this Vertex. * In a smooth surface, a vertex has exactly one normal. * In a sharp surface, a vertex can have any number of normals. */ @@ -253,7 +253,7 @@ class SVertex : public Interface0D { return _Normals; } - /*! Returns the number of different normals for this vertex. */ + /** Returns the number of different normals for this vertex. */ inline unsigned normalsSize() const { return _Normals.size(); @@ -284,7 +284,7 @@ class SVertex : public Interface0D { return _Point2D[2]; } - /*! If this SVertex is also a ViewVertex, this method returns a pointer onto this ViewVertex. + /** If this SVertex is also a ViewVertex, this method returns a pointer onto this ViewVertex. * 0 is returned otherwise. */ inline ViewVertex *viewvertex() @@ -292,20 +292,20 @@ class SVertex : public Interface0D { return _pViewVertex; } - /*! modifiers */ - /*! Sets the 3D coordinates of the SVertex. */ + /** modifiers */ + /** Sets the 3D coordinates of the SVertex. */ inline void setPoint3D(const Vec3r &iPoint3D) { _Point3D = iPoint3D; } - /*! Sets the 3D projected coordinates of the SVertex. */ + /** Sets the 3D projected coordinates of the SVertex. */ inline void setPoint2D(const Vec3r &iPoint2D) { _Point2D = iPoint2D; } - /*! Adds a normal to the Svertex's set of normals. If the same normal is already in the set, + /** Adds a normal to the Svertex's set of normals. If the same normal is already in the set, * nothing changes. */ inline void AddNormal(const Vec3r &iNormal) { @@ -326,7 +326,7 @@ class SVertex : public Interface0D { } #if 0 - /* Fredo's normal and curvature*/ + /* Fredo's normal and curvature. */ void setCurvatureFredo(real c) { _curvatureFredo = c; @@ -348,7 +348,7 @@ class SVertex : public Interface0D { } #endif - /*! Sets the Id */ + /** Sets the Id */ inline void setId(const Id &id) { _Id = id; @@ -369,13 +369,13 @@ class SVertex : public Interface0D { _pViewVertex = iViewVertex; } - /*! Add an FEdge to the list of edges emanating from this SVertex. */ + /** Add an FEdge to the list of edges emanating from this SVertex. */ inline void AddFEdge(FEdge *iFEdge) { _FEdges.push_back(iFEdge); } - /*! Remove an FEdge from the list of edges emanating from this SVertex. */ + /** Remove an FEdge from the list of edges emanating from this SVertex. */ inline void RemoveFEdge(FEdge *iFEdge) { for (vector<FEdge *>::iterator fe = _FEdges.begin(), fend = _FEdges.end(); fe != fend; fe++) { @@ -447,7 +447,7 @@ class SVertex : public Interface0D { inline Vec3r orientation2d() const; inline Vec3r orientation3d() const; inline Vec3r curvature2d_as_vector() const; - /*! angle in radians */ + /** angle in radians */ inline real curvature2d_as_angle() const; #endif @@ -466,7 +466,7 @@ class SVertex : public Interface0D { class ViewEdge; -/*! Base Class for feature edges. +/** Base Class for feature edges. * This FEdge can represent a silhouette, a crease, a ridge/valley, a border or a suggestive * contour. For silhouettes, the FEdge is oriented such as, the visible face lies on the left of * the edge. For borders, the FEdge is oriented such as, the face lies on the left of the edge. An @@ -476,7 +476,7 @@ class ViewEdge; */ class FEdge : public Interface1D { public: // Implementation of Interface0D - /*! Returns the string "FEdge". */ + /** Returns the string "FEdge". */ virtual string getExactTypeName() const { return "FEdge"; @@ -484,7 +484,7 @@ class FEdge : public Interface1D { // Data access methods - /*! Returns the 2D length of the FEdge. */ + /** Returns the 2D length of the FEdge. */ virtual real getLength2D() const { if (!_VertexA || !_VertexB) { @@ -493,7 +493,7 @@ class FEdge : public Interface1D { return (_VertexB->getPoint2D() - _VertexA->getPoint2D()).norm(); } - /*! Returns the Id of the FEdge. */ + /** Returns the Id of the FEdge. */ virtual Id getId() const { return _Id; @@ -533,12 +533,12 @@ class FEdge : public Interface1D { bool _isTemporary; public: - /*! A field that can be used by the user to store any data. + /** A field that can be used by the user to store any data. * This field must be reset afterwards using ResetUserData(). */ void *userdata; - /*! Default constructor */ + /** Default constructor */ inline FEdge() { userdata = NULL; @@ -555,7 +555,7 @@ class FEdge : public Interface1D { _isTemporary = false; } - /*! Builds an FEdge going from vA to vB. */ + /** Builds an FEdge going from vA to vB. */ inline FEdge(SVertex *vA, SVertex *vB) { userdata = NULL; @@ -572,7 +572,7 @@ class FEdge : public Interface1D { _isTemporary = false; } - /*! Copy constructor */ + /** Copy constructor */ inline FEdge(FEdge &iBrother) { _VertexA = iBrother.vertexA(); @@ -594,12 +594,12 @@ class FEdge : public Interface1D { userdata = 0; } - /*! Destructor */ + /** Destructor */ virtual ~FEdge() { } - /*! Cloning method. */ + /** Cloning method. */ virtual FEdge *duplicate() { FEdge *clone = new FEdge(*this); @@ -607,31 +607,31 @@ class FEdge : public Interface1D { } /* accessors */ - /*! Returns the first SVertex. */ + /** Returns the first SVertex. */ inline SVertex *vertexA() { return _VertexA; } - /*! Returns the second SVertex. */ + /** Returns the second SVertex. */ inline SVertex *vertexB() { return _VertexB; } - /*! Returns the first SVertex if i=0, the second SVertex if i=1. */ + /** Returns the first SVertex if i=0, the second SVertex if i=1. */ inline SVertex *operator[](const unsigned short int &i) const { return (i % 2 == 0) ? _VertexA : _VertexB; } - /*! Returns the nature of the FEdge. */ + /** Returns the nature of the FEdge. */ inline Nature::EdgeNature getNature() const { return _Nature; } - /*! Returns the FEdge following this one in the ViewEdge. + /** Returns the FEdge following this one in the ViewEdge. * If this FEdge is the last of the ViewEdge, 0 is returned. */ inline FEdge *nextEdge() @@ -639,7 +639,7 @@ class FEdge : public Interface1D { return _NextEdge; } - /*! Returns the Edge preceding this one in the ViewEdge. + /** Returns the Edge preceding this one in the ViewEdge. * If this FEdge is the first one of the ViewEdge, 0 is returned. */ inline FEdge *previousEdge() @@ -668,7 +668,7 @@ class FEdge : public Interface1D { } #endif - /*! Returns a pointer to the ViewEdge to which this FEdge belongs to. */ + /** Returns a pointer to the ViewEdge to which this FEdge belongs to. */ inline ViewEdge *viewedge() const { return _ViewEdge; @@ -716,7 +716,7 @@ class FEdge : public Interface1D { return _occludeeEmpty; } - /*! Returns true if this FEdge is a smooth FEdge. */ + /** Returns true if this FEdge is a smooth FEdge. */ inline bool isSmooth() const { return _isSmooth; @@ -733,37 +733,37 @@ class FEdge : public Interface1D { } /* modifiers */ - /*! Sets the first SVertex. */ + /** Sets the first SVertex. */ inline void setVertexA(SVertex *vA) { _VertexA = vA; } - /*! Sets the second SVertex. */ + /** Sets the second SVertex. */ inline void setVertexB(SVertex *vB) { _VertexB = vB; } - /*! Sets the FEdge Id . */ + /** Sets the FEdge Id . */ inline void setId(const Id &id) { _Id = id; } - /*! Sets the pointer to the next FEdge. */ + /** Sets the pointer to the next FEdge. */ inline void setNextEdge(FEdge *iEdge) { _NextEdge = iEdge; } - /*! Sets the pointer to the previous FEdge. */ + /** Sets the pointer to the previous FEdge. */ inline void setPreviousEdge(FEdge *iEdge) { _PreviousEdge = iEdge; } - /*! Sets the nature of this FEdge. */ + /** Sets the nature of this FEdge. */ inline void setNature(Nature::EdgeNature iNature) { _Nature = iNature; @@ -776,7 +776,7 @@ class FEdge : public Interface1D { } #endif - /*! Sets the ViewEdge to which this FEdge belongs to. */ + /** Sets the ViewEdge to which this FEdge belongs to. */ inline void setViewEdge(ViewEdge *iViewEdge) { _ViewEdge = iViewEdge; @@ -814,7 +814,7 @@ class FEdge : public Interface1D { _occludeeEmpty = iempty; } - /*! Sets the flag telling whether this FEdge is smooth or sharp. + /** Sets the flag telling whether this FEdge is smooth or sharp. * true for Smooth, false for Sharp. */ inline void setSmooth(bool iFlag) @@ -941,18 +941,18 @@ class FEdge : public Interface1D { inline Vec3r curvature2d_as_vector(int iCombination = 0) const; - /* angle in degrees*/ + /* Angle in degrees. */ inline real curvature2d_as_angle(int iCombination = 0) const; #endif // Iterator access (Interface1D) - /*! Returns an iterator over the 2 (!) SVertex pointing to the first SVertex. */ + /** Returns an iterator over the 2 (!) SVertex pointing to the first SVertex. */ virtual inline Interface0DIterator verticesBegin(); - /*! Returns an iterator over the 2 (!) SVertex pointing after the last SVertex. */ + /** Returns an iterator over the 2 (!) SVertex pointing after the last SVertex. */ virtual inline Interface0DIterator verticesEnd(); - /*! Returns an iterator over the FEdge points, pointing to the first point. The difference with + /** Returns an iterator over the FEdge points, pointing to the first point. The difference with * verticesBegin() is that here we can iterate over points of the FEdge at a any given sampling. * Indeed, for each iteration, a virtual point is created. * \param t: @@ -960,7 +960,7 @@ class FEdge : public Interface1D { */ virtual inline Interface0DIterator pointsBegin(float t = 0.0f); - /*! Returns an iterator over the FEdge points, pointing after the last point. The difference with + /** Returns an iterator over the FEdge points, pointing after the last point. The difference with * verticesEnd() is that here we can iterate over points of the FEdge at a any given sampling. * Indeed, for each iteration, a virtual point is created. * \param t: @@ -1138,7 +1138,7 @@ Interface0DIterator FEdge::pointsEnd(float /*t*/) return verticesEnd(); } -/*! Class defining a sharp FEdge. A Sharp FEdge corresponds to an initial edge of the input mesh. +/** Class defining a sharp FEdge. A Sharp FEdge corresponds to an initial edge of the input mesh. * It can be a silhouette, a crease or a border. If it is a crease edge, then it is bordered * by two faces of the mesh. Face a lies on its right whereas Face b lies on its left. * If it is a border edge, then it doesn't have any face on its right, and thus Face a = 0. @@ -1153,27 +1153,27 @@ class FEdgeSharp : public FEdge { bool _bFaceMark; public: - /*! Returns the string "FEdgeSharp" . */ + /** Returns the string "FEdgeSharp" . */ virtual string getExactTypeName() const { return "FEdgeSharp"; } - /*! Default constructor. */ + /** Default constructor. */ inline FEdgeSharp() : FEdge() { _aFrsMaterialIndex = _bFrsMaterialIndex = 0; _aFaceMark = _bFaceMark = false; } - /*! Builds an FEdgeSharp going from vA to vB. */ + /** Builds an FEdgeSharp going from vA to vB. */ inline FEdgeSharp(SVertex *vA, SVertex *vB) : FEdge(vA, vB) { _aFrsMaterialIndex = _bFrsMaterialIndex = 0; _aFaceMark = _bFaceMark = false; } - /*! Copy constructor. */ + /** Copy constructor. */ inline FEdgeSharp(FEdgeSharp &iBrother) : FEdge(iBrother) { _aNormal = iBrother._aNormal; @@ -1184,19 +1184,19 @@ class FEdgeSharp : public FEdge { _bFaceMark = iBrother._bFaceMark; } - /*! Destructor. */ + /** Destructor. */ virtual ~FEdgeSharp() { } - /*! Cloning method. */ + /** Cloning method. */ virtual FEdge *duplicate() { FEdge *clone = new FEdgeSharp(*this); return clone; } - /*! Returns the normal to the face lying on the right of the FEdge. If this FEdge is a border, + /** Returns the normal to the face lying on the right of the FEdge. If this FEdge is a border, * it has no Face on its right and therefore, no normal. */ inline const Vec3r &normalA() @@ -1204,13 +1204,13 @@ class FEdgeSharp : public FEdge { return _aNormal; } - /*! Returns the normal to the face lying on the left of the FEdge. */ + /** Returns the normal to the face lying on the left of the FEdge. */ inline const Vec3r &normalB() { return _bNormal; } - /*! Returns the index of the material of the face lying on the + /** Returns the index of the material of the face lying on the * right of the FEdge. If this FEdge is a border, * it has no Face on its right and therefore, no material. */ @@ -1219,21 +1219,21 @@ class FEdgeSharp : public FEdge { return _aFrsMaterialIndex; } - /*! Returns the material of the face lying on the right of the FEdge. If this FEdge is a border, + /** Returns the material of the face lying on the right of the FEdge. If this FEdge is a border, * it has no Face on its right and therefore, no material. */ const FrsMaterial &aFrsMaterial() const; - /*! Returns the index of the material of the face lying on the left of the FEdge. */ + /** Returns the index of the material of the face lying on the left of the FEdge. */ inline unsigned bFrsMaterialIndex() const { return _bFrsMaterialIndex; } - /*! Returns the material of the face lying on the left of the FEdge. */ + /** Returns the material of the face lying on the left of the FEdge. */ const FrsMaterial &bFrsMaterial() const; - /*! Returns the face mark of the face lying on the right of the FEdge. + /** Returns the face mark of the face lying on the right of the FEdge. * If this FEdge is a border, it has no Face on its right and thus false is returned. */ inline bool aFaceMark() const @@ -1241,43 +1241,43 @@ class FEdgeSharp : public FEdge { return _aFaceMark; } - /*! Returns the face mark of the face lying on the left of the FEdge. */ + /** Returns the face mark of the face lying on the left of the FEdge. */ inline bool bFaceMark() const { return _bFaceMark; } - /*! Sets the normal to the face lying on the right of the FEdge. */ + /** Sets the normal to the face lying on the right of the FEdge. */ inline void setNormalA(const Vec3r &iNormal) { _aNormal = iNormal; } - /*! Sets the normal to the face lying on the left of the FEdge. */ + /** Sets the normal to the face lying on the left of the FEdge. */ inline void setNormalB(const Vec3r &iNormal) { _bNormal = iNormal; } - /*! Sets the index of the material lying on the right of the FEdge.*/ + /** Sets the index of the material lying on the right of the FEdge. */ inline void setaFrsMaterialIndex(unsigned i) { _aFrsMaterialIndex = i; } - /*! Sets the index of the material lying on the left of the FEdge.*/ + /** Sets the index of the material lying on the left of the FEdge. */ inline void setbFrsMaterialIndex(unsigned i) { _bFrsMaterialIndex = i; } - /*! Sets the face mark of the face lying on the right of the FEdge. */ + /** Sets the face mark of the face lying on the right of the FEdge. */ inline void setaFaceMark(bool iFaceMark) { _aFaceMark = iFaceMark; } - /*! Sets the face mark of the face lying on the left of the FEdge. */ + /** Sets the face mark of the face lying on the left of the FEdge. */ inline void setbFaceMark(bool iFaceMark) { _bFaceMark = iFaceMark; @@ -1288,7 +1288,7 @@ class FEdgeSharp : public FEdge { #endif }; -/*! Class defining a smooth edge. This kind of edge typically runs across a face of the input mesh. +/** Class defining a smooth edge. This kind of edge typically runs across a face of the input mesh. * It can be a silhouette, a ridge or valley, a suggestive contour. */ class FEdgeSmooth : public FEdge { @@ -1305,13 +1305,13 @@ class FEdgeSmooth : public FEdge { bool _FaceMark; public: - /*! Returns the string "FEdgeSmooth" . */ + /** Returns the string "FEdgeSmooth" . */ virtual string getExactTypeName() const { return "FEdgeSmooth"; } - /*! Default constructor. */ + /** Default constructor. */ inline FEdgeSmooth() : FEdge() { _Face = NULL; @@ -1320,7 +1320,7 @@ class FEdgeSmooth : public FEdge { _isSmooth = true; } - /*! Builds an FEdgeSmooth going from vA to vB. */ + /** Builds an FEdgeSmooth going from vA to vB. */ inline FEdgeSmooth(SVertex *vA, SVertex *vB) : FEdge(vA, vB) { _Face = NULL; @@ -1329,7 +1329,7 @@ class FEdgeSmooth : public FEdge { _isSmooth = true; } - /*! Copy constructor. */ + /** Copy constructor. */ inline FEdgeSmooth(FEdgeSmooth &iBrother) : FEdge(iBrother) { _Normal = iBrother._Normal; @@ -1339,12 +1339,12 @@ class FEdgeSmooth : public FEdge { _isSmooth = true; } - /*! Destructor. */ + /** Destructor. */ virtual ~FEdgeSmooth() { } - /*! Cloning method. */ + /** Cloning method. */ virtual FEdge *duplicate() { FEdge *clone = new FEdgeSmooth(*this); @@ -1356,25 +1356,25 @@ class FEdgeSmooth : public FEdge { return _Face; } - /*! Returns the face mark of the face it is running across. */ + /** Returns the face mark of the face it is running across. */ inline bool faceMark() const { return _FaceMark; } - /*! Returns the normal to the Face it is running across. */ + /** Returns the normal to the Face it is running across. */ inline const Vec3r &normal() { return _Normal; } - /*! Returns the index of the material of the face it is running across. */ + /** Returns the index of the material of the face it is running across. */ inline unsigned frs_materialIndex() const { return _FrsMaterialIndex; } - /*! Returns the material of the face it is running across. */ + /** Returns the material of the face it is running across. */ const FrsMaterial &frs_material() const; inline void setFace(void *iFace) @@ -1382,19 +1382,19 @@ class FEdgeSmooth : public FEdge { _Face = iFace; } - /*! Sets the face mark of the face it is running across. */ + /** Sets the face mark of the face it is running across. */ inline void setFaceMark(bool iFaceMark) { _FaceMark = iFaceMark; } - /*! Sets the normal to the Face it is running across. */ + /** Sets the normal to the Face it is running across. */ inline void setNormal(const Vec3r &iNormal) { _Normal = iNormal; } - /*! Sets the index of the material of the face it is running across. */ + /** Sets the index of the material of the face it is running across. */ inline void setFrsMaterialIndex(unsigned i) { _FrsMaterialIndex = i; @@ -1413,7 +1413,7 @@ class FEdgeSmooth : public FEdge { /* */ /**********************************/ -/*! Class to define a feature shape. It is the gathering of feature elements from an identified +/** Class to define a feature shape. It is the gathering of feature elements from an identified * input shape */ class SShape { private: @@ -1431,12 +1431,12 @@ class SShape { ViewShape *_ViewShape; public: - /*! A field that can be used by the user to store any data. + /** A field that can be used by the user to store any data. * This field must be reset afterwards using ResetUserData(). */ void *userdata; // added by E.T. - /*! Default constructor */ + /** Default constructor */ inline SShape() { userdata = NULL; @@ -1444,7 +1444,7 @@ class SShape { _ViewShape = NULL; } - /*! Copy constructor */ + /** Copy constructor */ inline SShape(SShape &iBrother) { userdata = NULL; @@ -1528,14 +1528,14 @@ class SShape { } } - /*! Cloning method. */ + /** Cloning method. */ virtual SShape *duplicate() { SShape *clone = new SShape(*this); return clone; } - /*! Destructor. */ + /** Destructor. */ virtual inline ~SShape() { vector<SVertex *>::iterator sv, svend; @@ -1561,13 +1561,13 @@ class SShape { } } - /*! Adds a FEdge to the list of FEdges. */ + /** Adds a FEdge to the list of FEdges. */ inline void AddEdge(FEdge *iEdge) { _edgesList.push_back(iEdge); } - /*! Adds a SVertex to the list of SVertex of this Shape. + /** Adds a SVertex to the list of SVertex of this Shape. * The SShape attribute of the SVertex is also set to 'this'. */ inline void AddNewVertex(SVertex *iv) @@ -1589,7 +1589,7 @@ class SShape { return Ia; } - /*! Splits an edge into several edges. + /** Splits an edge into several edges. * The edge's vertices are passed rather than the edge itself. This way, all feature edges * (SILHOUETTE, CREASE, BORDER) are split in the same time. The processed edges are flagged as * done (using the user-data flag).One single new vertex is created whereas several split edges @@ -1773,13 +1773,13 @@ class SShape { return newEdge; } - /*! Sets the Bounding Box of the Shape */ + /** Sets the Bounding Box of the Shape */ inline void setBBox(const BBox<Vec3r> &iBBox) { _BBox = iBBox; } - /*! Compute the bbox of the sshape */ + /** Compute the bbox of the sshape */ inline void ComputeBBox() { if (0 == _verticesList.size()) { @@ -1853,13 +1853,13 @@ class SShape { } /* accessors */ - /*! Returns the list of SVertex of the Shape. */ + /** Returns the list of SVertex of the Shape. */ inline vector<SVertex *> &getVertexList() { return _verticesList; } - /*! Returns the list of FEdges of the Shape. */ + /** Returns the list of FEdges of the Shape. */ inline vector<FEdge *> &getEdgeList() { return _edgesList; @@ -1870,19 +1870,19 @@ class SShape { return _chains; } - /*! Returns the bounding box of the shape. */ + /** Returns the bounding box of the shape. */ inline const BBox<Vec3r> &bbox() { return _BBox; } - /*! Returns the ith material of the shape. */ + /** Returns the ith material of the shape. */ inline const FrsMaterial &frs_material(unsigned i) const { return _FrsMaterials[i]; } - /*! Returns the list of materials of the Shape. */ + /** Returns the list of materials of the Shape. */ inline const vector<FrsMaterial> &frs_materials() const { return _FrsMaterials; @@ -1898,44 +1898,44 @@ class SShape { return _importance; } - /*! Returns the Id of the Shape. */ + /** Returns the Id of the Shape. */ inline Id getId() const { return _Id; } - /*! Returns the name of the Shape. */ + /** Returns the name of the Shape. */ inline const string &getName() const { return _Name; } - /*! Returns the library path of the Shape. */ + /** Returns the library path of the Shape. */ inline const string &getLibraryPath() const { return _LibraryPath; } /* Modififers */ - /*! Sets the Id of the shape.*/ + /** Sets the Id of the shape. */ inline void setId(Id id) { _Id = id; } - /*! Sets the name of the shape.*/ + /** Sets the name of the shape. */ inline void setName(const string &name) { _Name = name; } - /*! Sets the library path of the shape.*/ + /** Sets the library path of the shape. */ inline void setLibraryPath(const string &path) { _LibraryPath = path; } - /*! Sets the list of materials for the shape */ + /** Sets the list of materials for the shape */ inline void setFrsMaterials(const vector<FrsMaterial> &iMaterials) { _FrsMaterials = iMaterials; diff --git a/source/blender/freestyle/intern/view_map/SilhouetteGeomEngine.h b/source/blender/freestyle/intern/view_map/SilhouetteGeomEngine.h index 124ef35e5b9..25b2eacd507 100644 --- a/source/blender/freestyle/intern/view_map/SilhouetteGeomEngine.h +++ b/source/blender/freestyle/intern/view_map/SilhouetteGeomEngine.h @@ -68,7 +68,7 @@ class SilhouetteGeomEngine { static SilhouetteGeomEngine *_pInstance; public: - /*! retrieves an instance on the singleton */ + /** retrieves an instance on the singleton */ static SilhouetteGeomEngine *getInstance() { if (_pInstance == NULL) { @@ -77,13 +77,13 @@ class SilhouetteGeomEngine { return _pInstance; } - /*! Sets the current viewpoint */ + /** Sets the current viewpoint */ static inline void setViewpoint(const Vec3r &ivp) { _Viewpoint = ivp; } - /*! Sets the current transformation + /** Sets the current transformation * iModelViewMatrix * The 4x4 model view matrix, in column major order (openGL like). * iProjection matrix @@ -98,13 +98,13 @@ class SilhouetteGeomEngine { const int iViewport[4], real iFocal); - /*! Sets the current znear and zfar */ + /** Sets the current znear and zfar */ static void setFrustum(real iZNear, real iZFar); /* accessors */ static void retrieveViewport(int viewport[4]); - /*! Projects the silhouette in camera coordinates + /** Projects the silhouette in camera coordinates * This method modifies the ioEdges passed as argument. * ioVertices * The vertices to project. It is modified during the operation. @@ -112,7 +112,7 @@ class SilhouetteGeomEngine { static void ProjectSilhouette(std::vector<SVertex *> &ioVertices); static void ProjectSilhouette(SVertex *ioVertex); - /*! transforms the parameter t defining a 2D intersection for edge fe in order to obtain + /** transforms the parameter t defining a 2D intersection for edge fe in order to obtain * the parameter giving the corresponding 3D intersection. * Returns the 3D parameter * fe @@ -122,10 +122,10 @@ class SilhouetteGeomEngine { */ static real ImageToWorldParameter(FEdge *fe, real t); - /*! From world to image */ + /** From world to image */ static Vec3r WorldToImage(const Vec3r &M); - /*! From camera to image */ + /** From camera to image */ static Vec3r CameraToImage(const Vec3r &M); #ifdef WITH_CXX_GUARDEDALLOC diff --git a/source/blender/freestyle/intern/view_map/SphericalGrid.h b/source/blender/freestyle/intern/view_map/SphericalGrid.h index efa3530cb2a..ae052ff3e12 100644 --- a/source/blender/freestyle/intern/view_map/SphericalGrid.h +++ b/source/blender/freestyle/intern/view_map/SphericalGrid.h @@ -87,7 +87,7 @@ class SphericalGrid { }; public: - /*! Iterator needs to allow the user to avoid full 3D comparison in two cases: + /** Iterator needs to allow the user to avoid full 3D comparison in two cases: * * (1) Where (*current)->deepest < target[2], where the occluder is unambiguously in front of * the target point. diff --git a/source/blender/freestyle/intern/view_map/SteerableViewMap.h b/source/blender/freestyle/intern/view_map/SteerableViewMap.h index e03400dbbc0..d007a08c3fd 100644 --- a/source/blender/freestyle/intern/view_map/SteerableViewMap.h +++ b/source/blender/freestyle/intern/view_map/SteerableViewMap.h @@ -42,7 +42,7 @@ class FEdge; class ImagePyramid; class GrayImage; -/*! This class checks for every FEdge in which steerable it belongs and stores the mapping +/** This class checks for every FEdge in which steerable it belongs and stores the mapping * allowing to retrieve this information from the FEdge Id. */ class SteerableViewMap { @@ -62,31 +62,31 @@ class SteerableViewMap { SteerableViewMap(const SteerableViewMap &iBrother); virtual ~SteerableViewMap(); - /*! Resets everything */ + /** Resets everything */ virtual void Reset(); - /*! Adds a FEdge to steerable VM. + /** Adds a FEdge to steerable VM. * Returns the nbOrientations weights corresponding to the FEdge contributions to the * nbOrientations directional maps. */ double *AddFEdge(FEdge *iFEdge); - /*! Compute the weight of direction dir for orientation iNOrientation */ + /** Compute the weight of direction dir for orientation iNOrientation */ double ComputeWeight(const Vec2d &dir, unsigned iNOrientation); - /*! Returns the number of the SVM to which a direction belongs to. + /** Returns the number of the SVM to which a direction belongs to. * \param dir: * The direction */ unsigned getSVMNumber(Vec2f dir); - /*! Returns the number of the SVM to which a FEdge belongs most. + /** Returns the number of the SVM to which a FEdge belongs most. * \param id: * The First element of the Id struct of the FEdge we're interested in. */ unsigned getSVMNumber(unsigned id); - /*! Builds _nbOrientations+1 pyramids of images from the _nbOrientations+1 base images of the + /** Builds _nbOrientations+1 pyramids of images from the _nbOrientations+1 base images of the * steerable viewmap. * \param steerableBases: * The _nbOrientations+1 images constituting the basis for the steerable pyramid. @@ -105,7 +105,7 @@ class SteerableViewMap { unsigned iNbLevels = 4, float iSigma = 1.0f); - /*! Reads a pixel value in one of the VewMap density steerable pyramids. + /** Reads a pixel value in one of the VewMap density steerable pyramids. * Returns a value between 0 and 1. * \param iOrientation: * the number telling which orientation we need to check. @@ -126,23 +126,23 @@ class SteerableViewMap { */ float readSteerableViewMapPixel(unsigned iOrientation, int iLevel, int x, int y); - /*! Reads a pixel in the one of the level of the pyramid containing the images + /** Reads a pixel in the one of the level of the pyramid containing the images * of the complete ViewMap. * Returns a value between 0 and 1. * Equivalent to : readSteerableViewMapPixel(nbOrientations, x, y) */ float readCompleteViewMapPixel(int iLevel, int x, int y); - /*! Returns the number of levels in the pyramids */ + /** Returns the number of levels in the pyramids */ unsigned int getNumberOfPyramidLevels() const; - /*! Returns the number of orientations */ + /** Returns the number of orientations */ unsigned int getNumberOfOrientations() const { return _nbOrientations; } - /*! for debug purposes */ + /** for debug purposes */ void saveSteerableViewMap() const; protected: diff --git a/source/blender/freestyle/intern/view_map/ViewEdgeXBuilder.cpp b/source/blender/freestyle/intern/view_map/ViewEdgeXBuilder.cpp index 8d5955fc0ae..24c56572803 100644 --- a/source/blender/freestyle/intern/view_map/ViewEdgeXBuilder.cpp +++ b/source/blender/freestyle/intern/view_map/ViewEdgeXBuilder.cpp @@ -601,7 +601,7 @@ OWXEdge ViewEdgeXBuilder::FindNextWEdge(const OWXEdge &iEdge) } if (((WXVertex *)v)->isFeature()) { - return nullptr; /* XXX eeek? NULL? OWXEdge(NULL, true/false)?*/ + return nullptr; /* XXX eeek? NULL? OWXEdge(NULL, true/false)? */ } int faceMarks = retrieveFaceMarks(iEdge.e); diff --git a/source/blender/freestyle/intern/view_map/ViewEdgeXBuilder.h b/source/blender/freestyle/intern/view_map/ViewEdgeXBuilder.h index 1fce4f4a965..d181348b3da 100644 --- a/source/blender/freestyle/intern/view_map/ViewEdgeXBuilder.h +++ b/source/blender/freestyle/intern/view_map/ViewEdgeXBuilder.h @@ -53,7 +53,7 @@ using namespace Geometry; class SVertex; -/*! Defines a hash table used for searching the SVertex */ +/** Defines a hash table used for searching the SVertex */ struct SVertexHasher { #define _MUL 950706376UL #define _MOD 2147483647UL @@ -81,7 +81,7 @@ typedef map<Vec3r, SVertex *> SVertexMap; class WXFaceLayer; -/*! class to describe an oriented smooth edge */ +/** class to describe an oriented smooth edge */ class OWXFaceLayer { public: WXFaceLayer *fl; @@ -123,7 +123,7 @@ class OWXFaceLayer { class WXEdge; -/*! class to describe an oriented sharp edge */ +/** class to describe an oriented sharp edge */ class OWXEdge { public: WXEdge *e; @@ -190,7 +190,7 @@ class ViewEdgeXBuilder { { } - /*! Builds a view shape from a WXShape in which the feature edges are flagged + /** Builds a view shape from a WXShape in which the feature edges are flagged * Builds chains of feature edges (so ViewEdges) from a WXShape * iWShape * The Winged Edge structure in which all silhouette edges and vertices are flagged. @@ -212,14 +212,14 @@ class ViewEdgeXBuilder { std::vector<FEdge *> &ioFEdges, std::vector<SVertex *> &ioSVertices); - /*! Builds a smooth view edge, starting the face iFace. */ + /** Builds a smooth view edge, starting the face iFace. */ ViewEdge *BuildSmoothViewEdge(const OWXFaceLayer &iFaceLayer); - /*! Makes a sharp viewedge */ + /** Makes a sharp viewedge. */ ViewEdge *BuildSharpViewEdge(const OWXEdge &iWEdge); public: - /*! accessors */ + /** accessors */ inline int currentViewId() const { return _currentViewId; @@ -235,7 +235,7 @@ class ViewEdgeXBuilder { return _currentSVertexId; } - /*! modifiers */ + /** modifiers */ inline void setCurrentViewId(int id) { _currentViewId = id; @@ -252,18 +252,18 @@ class ViewEdgeXBuilder { } protected: - /*! Init the view edges building */ + /** Init the view edges building */ virtual void Init(ViewShape *oVShape); // SMOOTH // - /*! checks whether a face has already been processed or not */ + /** checks whether a face has already been processed or not */ bool stopSmoothViewEdge(WXFaceLayer *iFaceLayer); OWXFaceLayer FindNextFaceLayer(const OWXFaceLayer &iFaceLayer); OWXFaceLayer FindPreviousFaceLayer(const OWXFaceLayer &iFaceLayer); FEdge *BuildSmoothFEdge(FEdge *feprevious, const OWXFaceLayer &ifl); // SHARP // - /*! checks whether a WEdge has already been processed or not */ + /** checks whether a WEdge has already been processed or not */ bool stopSharpViewEdge(WXEdge *iEdge); int retrieveFaceMarks(WXEdge *iEdge); OWXEdge FindNextWEdge(const OWXEdge &iEdge); @@ -271,11 +271,11 @@ class ViewEdgeXBuilder { FEdge *BuildSharpFEdge(FEdge *feprevious, const OWXEdge &iwe); // GENERAL // - /*! Instantiate a SVertex */ + /** Instantiate a SVertex */ SVertex *MakeSVertex(Vec3r &iPoint); - /*! Instantiate a SVertex if it hasn't been already created */ + /** Instantiate a SVertex if it hasn't been already created */ SVertex *MakeSVertex(Vec3r &iPoint, bool shared); - /*! instantiate a ViewVertex from a SVertex, if it doesn't exist yet */ + /** instantiate a ViewVertex from a SVertex, if it doesn't exist yet */ ViewVertex *MakeViewVertex(SVertex *iSVertex); // oldtmp values diff --git a/source/blender/freestyle/intern/view_map/ViewMap.cpp b/source/blender/freestyle/intern/view_map/ViewMap.cpp index 13ee2851c6c..f1b00724793 100644 --- a/source/blender/freestyle/intern/view_map/ViewMap.cpp +++ b/source/blender/freestyle/intern/view_map/ViewMap.cpp @@ -432,7 +432,7 @@ void TVertex::Replace(ViewEdge *iOld, ViewEdge *iNew) } } -/*! iterators access */ +/** iterators access */ ViewVertex::edge_iterator TVertex::edges_begin() { // return edge_iterator(_FrontEdgeA, _FrontEdgeB, _BackEdgeA, _BackEdgeB, _FrontEdgeA); @@ -584,7 +584,7 @@ void NonTVertex::AddIncomingViewEdge(ViewEdge *iVEdge) } } -/*! iterators access */ +/** iterators access */ ViewVertex::edge_iterator NonTVertex::edges_begin() { return edge_iterator(_ViewEdges.begin(), _ViewEdges.end(), _ViewEdges.begin()); diff --git a/source/blender/freestyle/intern/view_map/ViewMap.h b/source/blender/freestyle/intern/view_map/ViewMap.h index 47a2e98418a..bd7edad7642 100644 --- a/source/blender/freestyle/intern/view_map/ViewMap.h +++ b/source/blender/freestyle/intern/view_map/ViewMap.h @@ -56,7 +56,7 @@ class ViewEdge; class ViewShape; class TVertex; -/*! Class defining the ViewMap.*/ +/** Class defining the ViewMap. */ class ViewMap { public: typedef vector<ViewEdge *> viewedges_container; @@ -79,29 +79,29 @@ class ViewMap { id_to_index_map _shapeIdToIndex; public: - /*! A field that can be used by the user to store any data. + /** A field that can be used by the user to store any data. * This field must be reset afterwards using ResetUserData(). */ void *userdata; - /*! Default constructor. */ + /** Default constructor. */ ViewMap() { _pInstance = this; userdata = NULL; } - /*! Destructor. */ + /** Destructor. */ virtual ~ViewMap(); - /*! Gets the viewedge the nearest to the 2D position specified as argument */ + /** Gets the viewedge the nearest to the 2D position specified as argument */ const ViewEdge *getClosestViewEdge(real x, real y) const; - /*! Gets the Fedge the nearest to the 2D position specified as argument */ + /** Gets the Fedge the nearest to the 2D position specified as argument */ const FEdge *getClosestFEdge(real x, real y) const; /* accessors */ - /*! The ViewMap is a singleton class. This static method returns the instance of the ViewMap. */ + /** The ViewMap is a singleton class. This static method returns the instance of the ViewMap. */ static inline ViewMap *getInstance() { return _pInstance; @@ -160,7 +160,7 @@ class ViewMap { return _shapeIdToIndex; } - /*! Returns the scene 3D bounding box. */ + /** Returns the scene 3D bounding box. */ inline BBox<Vec3r> getScene3dBBox() const { return _scene3DBBox; @@ -189,7 +189,7 @@ class ViewMap { _SVertices.push_back(iSVertex); } - /*! Sets the scene 3D bounding box. */ + /** Sets the scene 3D bounding box. */ inline void setScene3dBBox(const BBox<Vec3r> &bbox) { _scene3DBBox = bbox; @@ -259,7 +259,7 @@ class orientedViewEdgeIterator; } // namespace ViewVertexInternal -/*! Class to define a view vertex. +/** Class to define a view vertex. * A view vertex is a feature vertex corresponding to a point of the image graph, where the * characteristics of an edge might change (nature, visibility, ...). A ViewVertex can be of two * kinds: a TVertex when it corresponds to the intersection between two ViewEdges or a NonTVertex @@ -269,7 +269,7 @@ class orientedViewEdgeIterator; */ class ViewVertex : public Interface0D { public: // Implementation of Interface0D - /*! Returns the string "ViewVertex". */ + /** Returns the string "ViewVertex". */ virtual string getExactTypeName() const { return "ViewVertex"; @@ -290,12 +290,12 @@ class ViewVertex : public Interface0D { Nature::VertexNature _Nature; public: - /*! A field that can be used by the user to store any data. + /** A field that can be used by the user to store any data. * This field must be reset afterwards using ResetUserData(). */ void *userdata; - /*! Default constructor.*/ + /** Default constructor. */ inline ViewVertex() { userdata = NULL; @@ -309,7 +309,7 @@ class ViewVertex : public Interface0D { } protected: - /*! Copy constructor. */ + /** Copy constructor. */ inline ViewVertex(ViewVertex &iBrother) { _Nature = iBrother._Nature; @@ -317,24 +317,24 @@ class ViewVertex : public Interface0D { userdata = NULL; } - /*! Cloning method. */ + /** Cloning method. */ virtual ViewVertex *duplicate() = 0; public: - /*! Destructor. */ + /** Destructor. */ virtual ~ViewVertex() { } /* accessors */ - /*! Returns the nature of the vertex .*/ + /** Returns the nature of the vertex. */ virtual Nature::VertexNature getNature() const { return _Nature; } /* modifiers */ - /*! Sets the nature of the vertex. */ + /** Sets the nature of the vertex. */ inline void setNature(Nature::VertexNature iNature) { _Nature = iNature; @@ -357,18 +357,18 @@ class ViewVertex : public Interface0D { virtual const_edge_iterator edges_iterator(ViewEdge *iEdge) const = 0; // Iterator access - /*! Returns an iterator over the ViewEdges that goes to or comes from this ViewVertex pointing to + /** Returns an iterator over the ViewEdges that goes to or comes from this ViewVertex pointing to * the first ViewEdge of the list. The orientedViewEdgeIterator allows to iterate in CCW order * over these ViewEdges and to get the orientation for each ViewEdge (incoming/outgoing). */ virtual ViewVertexInternal::orientedViewEdgeIterator edgesBegin() = 0; - /*! Returns an orientedViewEdgeIterator over the ViewEdges around this ViewVertex, pointing after + /** Returns an orientedViewEdgeIterator over the ViewEdges around this ViewVertex, pointing after * the last ViewEdge. */ virtual ViewVertexInternal::orientedViewEdgeIterator edgesEnd() = 0; - /*! Returns an orientedViewEdgeIterator pointing to the ViewEdge given as argument. */ + /** Returns an orientedViewEdgeIterator pointing to the ViewEdge given as argument. */ virtual ViewVertexInternal::orientedViewEdgeIterator edgesIterator(ViewEdge *iEdge) = 0; #ifdef WITH_CXX_GUARDEDALLOC @@ -384,7 +384,7 @@ class ViewVertex : public Interface0D { /* */ /**********************************/ -/*! class to define a T vertex, i.e. an intersection between two edges. +/** class to define a T vertex, i.e. an intersection between two edges. * It points towards 2 SVertex and 4 View edges. * Among these ViewEdges, 2 are front and 2 are back. * Basically the front edge hides part of the back edge. @@ -395,7 +395,7 @@ class TVertex : public ViewVertex { typedef vector<directedViewEdge *> edge_pointers_container; public: // Implementation of Interface0D - /*! Returns the string "TVertex". */ + /** Returns the string "TVertex". */ virtual string getExactTypeName() const { return "TVertex"; @@ -421,20 +421,20 @@ class TVertex : public ViewVertex { return _FrontSVertex->point3D().z(); } - /*! Returns the 3D point. */ + /** Returns the 3D point. */ virtual Vec3r getPoint3D() const { cerr << "Warning: getPoint3D() undefined for this point" << endl; return _FrontSVertex->getPoint3D(); } - /*! Returns the projected 3D x coordinate of the vertex. */ + /** Returns the projected 3D x coordinate of the vertex. */ virtual real getProjectedX() const { return _FrontSVertex->point2D().x(); } - /*! Returns the projected 3D y coordinate of the vertex. */ + /** Returns the projected 3D y coordinate of the vertex. */ virtual real getProjectedY() const { return _FrontSVertex->point2D().y(); @@ -445,26 +445,26 @@ class TVertex : public ViewVertex { return _FrontSVertex->point2D().z(); } - /*! Returns the 2D point. */ + /** Returns the 2D point. */ virtual Vec2r getPoint2D() const { return _FrontSVertex->getPoint2D(); } - /*! Returns the Id of the TVertex. */ + /** Returns the Id of the TVertex. */ virtual Id getId() const { return _Id; } - /*! Cast the Interface0D in SVertex if it can be. */ + /** Cast the Interface0D in SVertex if it can be. */ // it can't virtual ViewVertex *castToViewVertex() { return this; } - /*! Cast the Interface0D in TVertex if it can be. */ + /** Cast the Interface0D in TVertex if it can be. */ virtual TVertex *castToTVertex() { return this; @@ -483,7 +483,7 @@ class TVertex : public ViewVertex { _sortedEdges; // the list of the four ViewEdges, ordered in CCW order (in the image plan) public: - /*! Default constructor.*/ + /** Default constructor. */ inline TVertex() : ViewVertex(Nature::T_VERTEX) { _FrontSVertex = NULL; @@ -507,7 +507,7 @@ class TVertex : public ViewVertex { } protected: - /*! Copy constructor. */ + /** Copy constructor. */ inline TVertex(TVertex &iBrother) : ViewVertex(iBrother) { _FrontSVertex = iBrother._FrontSVertex; @@ -519,7 +519,7 @@ class TVertex : public ViewVertex { _sortedEdges = iBrother._sortedEdges; } - /*! Cloning method. */ + /** Cloning method. */ virtual ViewVertex *duplicate() { TVertex *clone = new TVertex(*this); @@ -528,13 +528,13 @@ class TVertex : public ViewVertex { public: /* accessors */ - /*! Returns the SVertex that is closer to the viewpoint. */ + /** Returns the SVertex that is closer to the viewpoint. */ inline SVertex *frontSVertex() { return _FrontSVertex; } - /*! Returns the SVertex that is further away from the viewpoint. */ + /** Returns the SVertex that is further away from the viewpoint. */ inline SVertex *backSVertex() { return _BackSVertex; @@ -561,14 +561,14 @@ class TVertex : public ViewVertex { } /* modifiers */ - /*! Sets the SVertex that is closer to the viewpoint. */ + /** Sets the SVertex that is closer to the viewpoint. */ inline void setFrontSVertex(SVertex *iFrontSVertex) { _FrontSVertex = iFrontSVertex; _FrontSVertex->setViewVertex(this); } - /*! Sets the SVertex that is further away from the viewpoint. */ + /** Sets the SVertex that is further away from the viewpoint. */ inline void setBackSVertex(SVertex *iBackSVertex) { _BackSVertex = iBackSVertex; @@ -580,13 +580,13 @@ class TVertex : public ViewVertex { void setBackEdgeA(ViewEdge *iBackEdgeA, bool incoming = true); void setBackEdgeB(ViewEdge *iBackEdgeB, bool incoming = true); - /*! Sets the Id. */ + /** Sets the Id. */ inline void setId(const Id &iId) { _Id = iId; } - /*! Returns the SVertex (among the 2) belonging to the FEdge iFEdge */ + /** Returns the SVertex (among the 2) belonging to the FEdge iFEdge */ inline SVertex *getSVertex(FEdge *iFEdge) { const vector<FEdge *> &vfEdges = _FrontSVertex->fedges(); @@ -608,7 +608,7 @@ class TVertex : public ViewVertex { virtual void Replace(ViewEdge *iOld, ViewEdge *iNew); - /*! returns the mate edge of iEdgeA. + /** returns the mate edge of iEdgeA. * For example, if iEdgeA is frontEdgeA, then frontEdgeB is returned. If iEdgeA is frontEdgeB * then frontEdgeA is returned. Same for back edges */ @@ -637,18 +637,18 @@ class TVertex : public ViewVertex { virtual edge_iterator edges_iterator(ViewEdge *iEdge); virtual const_edge_iterator edges_iterator(ViewEdge *iEdge) const; - /*! Returns an iterator over the ViewEdges that goes to or comes from this ViewVertex pointing to + /** Returns an iterator over the ViewEdges that goes to or comes from this ViewVertex pointing to * the first ViewEdge of the list. The orientedViewEdgeIterator allows to iterate in CCW order * over these ViewEdges and to get the orientation for each ViewEdge (incoming/outgoing). */ virtual ViewVertexInternal::orientedViewEdgeIterator edgesBegin(); - /*! Returns an orientedViewEdgeIterator over the ViewEdges around this ViewVertex, pointing after + /** Returns an orientedViewEdgeIterator over the ViewEdges around this ViewVertex, pointing after * the last ViewEdge. */ virtual ViewVertexInternal::orientedViewEdgeIterator edgesEnd(); - /*! Returns an orientedViewEdgeIterator pointing to the ViewEdge given as argument. */ + /** Returns an orientedViewEdgeIterator pointing to the ViewEdge given as argument. */ virtual ViewVertexInternal::orientedViewEdgeIterator edgesIterator(ViewEdge *iEdge); #ifdef WITH_CXX_GUARDEDALLOC @@ -665,7 +665,7 @@ class TVertex : public ViewVertex { /**********************************/ // (non T vertex) -/*! View vertex for corners, cusps, etc... +/** View vertex for corners, cusps, etc... * Associated to a single SVertex. * Can be associated to 2 or several view edges */ @@ -674,80 +674,80 @@ class NonTVertex : public ViewVertex { typedef vector<directedViewEdge> edges_container; public: // Implementation of Interface0D - /*! Returns the string "ViewVertex". */ + /** Returns the string "ViewVertex". */ virtual string getExactTypeName() const { return "NonTVertex"; } // Data access methods - /*! Returns the 3D x coordinate of the vertex. */ + /** Returns the 3D x coordinate of the vertex. */ virtual real getX() const { return _SVertex->point3D().x(); } - /*! Returns the 3D y coordinate of the vertex. */ + /** Returns the 3D y coordinate of the vertex. */ virtual real getY() const { return _SVertex->point3D().y(); } - /*! Returns the 3D z coordinate of the vertex. */ + /** Returns the 3D z coordinate of the vertex. */ virtual real getZ() const { return _SVertex->point3D().z(); } - /*! Returns the 3D point. */ + /** Returns the 3D point. */ virtual Vec3r getPoint3D() const { return _SVertex->getPoint3D(); } - /*! Returns the projected 3D x coordinate of the vertex. */ + /** Returns the projected 3D x coordinate of the vertex. */ virtual real getProjectedX() const { return _SVertex->point2D().x(); } - /*! Returns the projected 3D y coordinate of the vertex. */ + /** Returns the projected 3D y coordinate of the vertex. */ virtual real getProjectedY() const { return _SVertex->point2D().y(); } - /*! Returns the projected 3D z coordinate of the vertex. */ + /** Returns the projected 3D z coordinate of the vertex. */ virtual real getProjectedZ() const { return _SVertex->point2D().z(); } - /*! Returns the 2D point. */ + /** Returns the 2D point. */ virtual Vec2r getPoint2D() const { return _SVertex->getPoint2D(); } - /*! Returns the Id of the vertex. */ + /** Returns the Id of the vertex. */ virtual Id getId() const { return _SVertex->getId(); } - /*! Cast the Interface0D in SVertex if it can be. */ + /** Cast the Interface0D in SVertex if it can be. */ virtual SVertex *castToSVertex() { return _SVertex; } - /*! Cast the Interface0D in ViewVertex if it can be. */ + /** Cast the Interface0D in ViewVertex if it can be. */ virtual ViewVertex *castToViewVertex() { return this; } - /*! Cast the Interface0D in NonTVertex if it can be. */ + /** Cast the Interface0D in NonTVertex if it can be. */ virtual NonTVertex *castToNonTVertex() { return this; @@ -758,13 +758,13 @@ class NonTVertex : public ViewVertex { edges_container _ViewEdges; public: - /*! Default constructor.*/ + /** Default constructor. */ inline NonTVertex() : ViewVertex(Nature::NON_T_VERTEX) { _SVertex = NULL; } - /*! Builds a NonTVertex from a SVertex. */ + /** Builds a NonTVertex from a SVertex. */ inline NonTVertex(SVertex *iSVertex) : ViewVertex(Nature::NON_T_VERTEX) { _SVertex = iSVertex; @@ -772,7 +772,7 @@ class NonTVertex : public ViewVertex { } protected: - /*! Copy constructor. */ + /** Copy constructor. */ inline NonTVertex(NonTVertex &iBrother) : ViewVertex(iBrother) { _SVertex = iBrother._SVertex; @@ -780,7 +780,7 @@ class NonTVertex : public ViewVertex { _ViewEdges = iBrother._ViewEdges; } - /*! Cloning method. */ + /** Cloning method. */ virtual ViewVertex *duplicate() { NonTVertex *clone = new NonTVertex(*this); @@ -788,13 +788,13 @@ class NonTVertex : public ViewVertex { } public: - /*! destructor. */ + /** destructor. */ virtual ~NonTVertex() { } /* accessors */ - /*! Returns the SVertex on top of which this NonTVertex is built. */ + /** Returns the SVertex on top of which this NonTVertex is built. */ inline SVertex *svertex() { return _SVertex; @@ -806,7 +806,7 @@ class NonTVertex : public ViewVertex { } /* modifiers */ - /*! Sets the SVertex on top of which this NonTVertex is built. */ + /** Sets the SVertex on top of which this NonTVertex is built. */ inline void setSVertex(SVertex *iSVertex) { _SVertex = iSVertex; @@ -857,18 +857,18 @@ class NonTVertex : public ViewVertex { virtual edge_iterator edges_iterator(ViewEdge *iEdge); virtual const_edge_iterator edges_iterator(ViewEdge *iEdge) const; - /*! Returns an iterator over the ViewEdges that goes to or comes from this ViewVertex pointing to + /** Returns an iterator over the ViewEdges that goes to or comes from this ViewVertex pointing to * the first ViewEdge of the list. The orientedViewEdgeIterator allows to iterate in CCW order * over these ViewEdges and to get the orientation for each ViewEdge (incoming/outgoing). */ virtual ViewVertexInternal::orientedViewEdgeIterator edgesBegin(); - /*! Returns an orientedViewEdgeIterator over the ViewEdges around this ViewVertex, pointing after + /** Returns an orientedViewEdgeIterator over the ViewEdges around this ViewVertex, pointing after * the last ViewEdge. */ virtual ViewVertexInternal::orientedViewEdgeIterator edgesEnd(); - /*! Returns an orientedViewEdgeIterator pointing to the ViewEdge given as argument. */ + /** Returns an orientedViewEdgeIterator pointing to the ViewEdge given as argument. */ virtual ViewVertexInternal::orientedViewEdgeIterator edgesIterator(ViewEdge *iEdge); #ifdef WITH_CXX_GUARDEDALLOC @@ -902,25 +902,25 @@ template<class Traits> class vertex_iterator_base; } // end of namespace ViewEdgeInternal -/*! Class defining a ViewEdge. A ViewEdge in an edge of the image graph. it connects two +/** Class defining a ViewEdge. A ViewEdge in an edge of the image graph. it connects two * ViewVertex. It is made by connecting a set of FEdges. */ class ViewEdge : public Interface1D { public: // Implementation of Interface0D - /*! Returns the string "ViewEdge". */ + /** Returns the string "ViewEdge". */ virtual string getExactTypeName() const { return "ViewEdge"; } // Data access methods - /*! Returns the Id of the vertex. */ + /** Returns the Id of the vertex. */ virtual Id getId() const { return _Id; } - /*! Returns the nature of the ViewEdge. */ + /** Returns the nature of the ViewEdge. */ virtual Nature::EdgeNature getNature() const { return _Nature; @@ -960,12 +960,12 @@ class ViewEdge : public Interface1D { Id *_splittingId; public: - /*! A field that can be used by the user to store any data. + /** A field that can be used by the user to store any data. * This field must be reset afterwards using ResetUserData(). */ void *userdata; - /*! Default constructor. */ + /** Default constructor. */ inline ViewEdge() { __A = NULL; @@ -1028,7 +1028,7 @@ class ViewEdge : public Interface1D { } // soc protected: - /*! Copy constructor. */ + /** Copy constructor. */ inline ViewEdge(ViewEdge &iBrother) { __A = iBrother.__A; @@ -1047,7 +1047,7 @@ class ViewEdge : public Interface1D { userdata = NULL; } - /*! Cloning method. */ + /** Cloning method. */ virtual ViewEdge *duplicate() { ViewEdge *clone = new ViewEdge(*this); @@ -1055,7 +1055,7 @@ class ViewEdge : public Interface1D { } public: - /*! Destructor. */ + /** Destructor. */ virtual ~ViewEdge() { #if 0 @@ -1073,37 +1073,37 @@ class ViewEdge : public Interface1D { } /* accessors */ - /*! Returns the first ViewVertex. */ + /** Returns the first ViewVertex. */ inline ViewVertex *A() { return __A; } - /*! Returns the second ViewVertex. */ + /** Returns the second ViewVertex. */ inline ViewVertex *B() { return __B; } - /*! Returns the first FEdge that constitutes this ViewEdge. */ + /** Returns the first FEdge that constitutes this ViewEdge. */ inline FEdge *fedgeA() { return _FEdgeA; } - /*! Returns the last FEdge that constitutes this ViewEdge. */ + /** Returns the last FEdge that constitutes this ViewEdge. */ inline FEdge *fedgeB() { return _FEdgeB; } - /*! Returns the ViewShape to which this ViewEdge belongs to .*/ + /** Returns the ViewShape to which this ViewEdge belongs to. */ inline ViewShape *viewShape() { return _Shape; } - /*! Returns the shape that is occluded by the ViewShape to which this ViewEdge belongs to. If no + /** Returns the shape that is occluded by the ViewShape to which this ViewEdge belongs to. If no * object is occluded, NULL is returned. \return The occluded ViewShape. */ inline ViewShape *aShape() @@ -1111,7 +1111,7 @@ class ViewEdge : public Interface1D { return _aShape; } - /*! Tells whether this ViewEdge forms a closed loop or not. */ + /** Tells whether this ViewEdge forms a closed loop or not. */ inline bool isClosed() { if (!__B) { @@ -1120,7 +1120,7 @@ class ViewEdge : public Interface1D { return false; } - /*! Returns the time stamp of this ViewEdge. */ + /** Returns the time stamp of this ViewEdge. */ inline unsigned getChainingTimeStamp() { return _ChainingTimeStamp; @@ -1152,64 +1152,64 @@ class ViewEdge : public Interface1D { } /* modifiers */ - /*! Sets the first ViewVertex of the ViewEdge. */ + /** Sets the first ViewVertex of the ViewEdge. */ inline void setA(ViewVertex *iA) { __A = iA; } - /*! Sets the last ViewVertex of the ViewEdge. */ + /** Sets the last ViewVertex of the ViewEdge. */ inline void setB(ViewVertex *iB) { __B = iB; } - /*! Sets the nature of the ViewEdge. */ + /** Sets the nature of the ViewEdge. */ inline void setNature(Nature::EdgeNature iNature) { _Nature = iNature; } - /*! Sets the first FEdge of the ViewEdge. */ + /** Sets the first FEdge of the ViewEdge. */ inline void setFEdgeA(FEdge *iFEdge) { _FEdgeA = iFEdge; } - /*! Sets the last FEdge of the ViewEdge. */ + /** Sets the last FEdge of the ViewEdge. */ inline void setFEdgeB(FEdge *iFEdge) { _FEdgeB = iFEdge; } - /*! Sets the ViewShape to which this ViewEdge belongs to.*/ + /** Sets the ViewShape to which this ViewEdge belongs to. */ inline void setShape(ViewShape *iVShape) { _Shape = iVShape; } - /*! Sets the ViewEdge id. */ + /** Sets the ViewEdge id. */ inline void setId(const Id &id) { _Id = id; } - /*! Sets Viewedge to this for all embedded fedges */ + /** Sets Viewedge to this for all embedded fedges */ void UpdateFEdges(); - /*! Sets the occluded ViewShape */ + /** Sets the occluded ViewShape */ inline void setaShape(ViewShape *iShape) { _aShape = iShape; } - /*! Sets the quantitative invisibility value. */ + /** Sets the quantitative invisibility value. */ inline void setQI(int qi) { _qi = qi; } - /*! Sets the time stamp value. */ + /** Sets the time stamp value. */ inline void setChainingTimeStamp(unsigned ts) { _ChainingTimeStamp = ts; @@ -1279,7 +1279,7 @@ class ViewEdge : public Interface1D { float viewedge_length() const; #endif - /*! Returns the 2D length of the Viewedge. */ + /** Returns the 2D length of the Viewedge. */ real getLength2D() const; #if 0 @@ -1366,24 +1366,24 @@ class ViewEdge : public Interface1D { vertex_iterator vertices_end(); // Iterator access (Interface1D) - /*! Returns an Interface0DIterator to iterate over the SVertex constituting the embedding of this + /** Returns an Interface0DIterator to iterate over the SVertex constituting the embedding of this * ViewEdge. The returned Interface0DIterator points to the first SVertex of the ViewEdge. */ virtual Interface0DIterator verticesBegin(); - /*! Returns an Interface0DIterator to iterate over the SVertex constituting the embedding of this + /** Returns an Interface0DIterator to iterate over the SVertex constituting the embedding of this * ViewEdge. The returned Interface0DIterator points after the last SVertex of the ViewEdge. */ virtual Interface0DIterator verticesEnd(); - /*! Returns an Interface0DIterator to iterate over the points of this ViewEdge at a given + /** Returns an Interface0DIterator to iterate over the points of this ViewEdge at a given * resolution. The returned Interface0DIterator points on the first Point of the ViewEdge. * \param t: * the sampling value. */ virtual Interface0DIterator pointsBegin(float t = 0.0f); - /*! Returns an Interface0DIterator to iterate over the points of this ViewEdge at a given + /** Returns an Interface0DIterator to iterate over the points of this ViewEdge at a given * resolution. The returned Interface0DIterator points after the last Point of the ViewEdge. * \param t: * the sampling value. @@ -1403,7 +1403,7 @@ class ViewEdge : public Interface1D { /* */ /**********************************/ -/*! Class gathering the elements of the ViewMap (ViewVertex, ViewEdge) that are issued from the +/** Class gathering the elements of the ViewMap (ViewVertex, ViewEdge) that are issued from the * same input shape. */ class ViewShape { private: @@ -1412,19 +1412,19 @@ class ViewShape { SShape *_SShape; public: - /*! A field that can be used by the user to store any data. + /** A field that can be used by the user to store any data. * This field must be reset afterwards using ResetUserData(). */ void *userdata; - /*! Default constructor.*/ + /** Default constructor. */ inline ViewShape() { userdata = NULL; _SShape = NULL; } - /*! Builds a ViewShape from a SShape. */ + /** Builds a ViewShape from a SShape. */ inline ViewShape(SShape *iSShape) { userdata = NULL; @@ -1432,7 +1432,7 @@ class ViewShape { //_SShape->setViewShape(this); } - /*! Copy constructor. */ + /** Copy constructor. */ inline ViewShape(ViewShape &iBrother) { userdata = NULL; @@ -1519,14 +1519,14 @@ class ViewShape { } } - /*! Cloning method. */ + /** Cloning method. */ virtual ViewShape *duplicate() { ViewShape *clone = new ViewShape(*this); return clone; } - /*! Destructor. */ + /** Destructor. */ virtual ~ViewShape(); /* splits a view edge into several view edges. @@ -1545,75 +1545,75 @@ class ViewShape { vector<ViewEdge *> &ioNewViewEdges); /* accessors */ - /*! Returns the SShape on top of which this ViewShape is built. */ + /** Returns the SShape on top of which this ViewShape is built. */ inline SShape *sshape() { return _SShape; } - /*! Returns the SShape on top of which this ViewShape is built. */ + /** Returns the SShape on top of which this ViewShape is built. */ inline const SShape *sshape() const { return _SShape; } - /*! Returns the list of ViewVertex contained in this ViewShape. */ + /** Returns the list of ViewVertex contained in this ViewShape. */ inline vector<ViewVertex *> &vertices() { return _Vertices; } - /*! Returns the list of ViewEdge contained in this ViewShape. */ + /** Returns the list of ViewEdge contained in this ViewShape. */ inline vector<ViewEdge *> &edges() { return _Edges; } - /*! Returns the ViewShape id. */ + /** Returns the ViewShape id. */ inline Id getId() const { return _SShape->getId(); } - /*! Returns the ViewShape name. */ + /** Returns the ViewShape name. */ inline const string &getName() const { return _SShape->getName(); } - /*! Returns the ViewShape library path. */ + /** Returns the ViewShape library path. */ inline const string &getLibraryPath() const { return _SShape->getLibraryPath(); } /* modifiers */ - /*! Sets the SShape on top of which the ViewShape is built. */ + /** Sets the SShape on top of which the ViewShape is built. */ inline void setSShape(SShape *iSShape) { _SShape = iSShape; } - /*! Sets the list of ViewVertex contained in this ViewShape. */ + /** Sets the list of ViewVertex contained in this ViewShape. */ inline void setVertices(const vector<ViewVertex *> &iVertices) { _Vertices = iVertices; } - /*! Sets the list of ViewEdge contained in this ViewShape. */ + /** Sets the list of ViewEdge contained in this ViewShape. */ inline void setEdges(const vector<ViewEdge *> &iEdges) { _Edges = iEdges; } - /*! Adds a ViewVertex to the list. */ + /** Adds a ViewVertex to the list. */ inline void AddVertex(ViewVertex *iVertex) { _Vertices.push_back(iVertex); //_SShape->AddNewVertex(iVertex->svertex()); } - /*! Adds a ViewEdge to the list */ + /** Adds a ViewEdge to the list */ inline void AddEdge(ViewEdge *iEdge) { _Edges.push_back(iEdge); diff --git a/source/blender/freestyle/intern/view_map/ViewMapAdvancedIterators.h b/source/blender/freestyle/intern/view_map/ViewMapAdvancedIterators.h index 5cb52b6a0f3..b33bc4f281f 100644 --- a/source/blender/freestyle/intern/view_map/ViewMapAdvancedIterators.h +++ b/source/blender/freestyle/intern/view_map/ViewMapAdvancedIterators.h @@ -363,9 +363,9 @@ class edge_iterator_base : public IteratorBase<Traits, InputIteratorTag_Traits> namespace ViewEdgeInternal { -/*!----------------------*/ -/*! Iterators definition */ -/*!----------------------*/ +/**----------------------*/ +/** Iterators definition */ +/**----------------------*/ template<class Traits> class edge_iterator_base : public IteratorBase<Traits, BidirectionalIteratorTag_Traits> { public: diff --git a/source/blender/freestyle/intern/view_map/ViewMapBuilder.h b/source/blender/freestyle/intern/view_map/ViewMapBuilder.h index 6d919f5561a..4f26ec82eb6 100644 --- a/source/blender/freestyle/intern/view_map/ViewMapBuilder.h +++ b/source/blender/freestyle/intern/view_map/ViewMapBuilder.h @@ -107,28 +107,28 @@ class ViewMapBuilder { } /* Build Grid for ray casting */ - /*! Build non-culled Grid in camera space for ray casting */ + /** Build non-culled Grid in camera space for ray casting */ void BuildGrid(WingedEdge &we, const BBox<Vec3r> &bbox, unsigned int sceneNumFaces); - /*! Compute Shapes from a WingedEdge containing a list of WShapes */ + /** Compute Shapes from a WingedEdge containing a list of WShapes */ void computeInitialViewEdges(WingedEdge &); - /*! Compute Cusps */ + /** Compute Cusps */ void computeCusps(ViewMap *ioViewMap); - /*! Detects cusps (for a single ViewEdge) among SVertices and builds a ViewVertex on top of each + /** Detects cusps (for a single ViewEdge) among SVertices and builds a ViewVertex on top of each * cusp SVertex We use a hysteresis approach to avoid noise. */ void DetectCusps(ViewEdge *ioEdge); - /*! Sets the current viewpoint */ + /** Sets the current viewpoint */ inline void setViewpoint(const Vec3r &ivp) { _viewpoint = ivp; SilhouetteGeomEngine::setViewpoint(ivp); } - /*! Sets the current transformation + /** Sets the current transformation * iModelViewMatrix * The 4x4 model view matrix, in column major order (openGL like). * iProjection matrix @@ -153,7 +153,7 @@ class ViewMapBuilder { SilhouetteGeomEngine::setFrustum(iZnear, iZfar); } - /*! Builds the scene view map returns the list the view map + /** Builds the scene view map returns the list the view map * it is up to the caller to delete this ViewMap * iWRoot * The root group node containing the WEdge structured scene @@ -169,7 +169,7 @@ class ViewMapBuilder { real occluderProscenium[4], bool extensiveFEdgeSearch = true); - /*! computes the intersection between all 2D feature edges of the scene. + /** computes the intersection between all 2D feature edges of the scene. * ioViewMap * The view map. It is modified by the method. * The list of all features edges of the scene. @@ -181,7 +181,7 @@ class ViewMapBuilder { intersection_algo iAlgo = sweep_line, real epsilon = 1.0e-06); - /*! Computes the 2D scene silhouette edges visibility + /** Computes the 2D scene silhouette edges visibility * iGrid * For the Ray Casting algorithm. */ @@ -197,9 +197,9 @@ class ViewMapBuilder { _Grid = iGrid; } - /*! accessors */ + /** accessors */ - /*! Modifiers */ + /** Modifiers */ inline void setProgressBar(ProgressBar *iProgressBar) { _pProgressBar = iProgressBar; @@ -216,10 +216,10 @@ class ViewMapBuilder { } protected: - /*! Computes intersections on all edges of the scene using a sweep line algorithm */ + /** Computes intersections on all edges of the scene using a sweep line algorithm */ void ComputeSweepLineIntersections(ViewMap *ioViewMap, real epsilon = 1.0e-6); - /*! Computes the 2D scene silhouette edges visibility using a ray casting. On each edge, a ray is + /** Computes the 2D scene silhouette edges visibility using a ray casting. On each edge, a ray is * cast to check its quantitative invisibility. The list of occluders are each time stored in the * tested edge. ioViewMap The view map. The 2D scene silhouette edges as FEdges. These edges have * already been splitted at their intersections points. Thus, these edges do not intersect @@ -242,7 +242,7 @@ class ViewMapBuilder { bool cull, GridDensityProviderFactory &factory); - /*! Compute the visibility for the FEdge fe. + /** Compute the visibility for the FEdge fe. * The occluders are added to fe occluders list. * fe * The FEdge diff --git a/source/blender/freestyle/intern/view_map/ViewMapIterators.h b/source/blender/freestyle/intern/view_map/ViewMapIterators.h index 9956d47469d..1df78e71d9d 100644 --- a/source/blender/freestyle/intern/view_map/ViewMapIterators.h +++ b/source/blender/freestyle/intern/view_map/ViewMapIterators.h @@ -45,7 +45,7 @@ namespace Freestyle { namespace ViewVertexInternal { -/*! Class representing an iterator over oriented ViewEdges around a ViewVertex. This iterator +/** Class representing an iterator over oriented ViewEdges around a ViewVertex. This iterator * allows a CCW iteration (in the image plane). An instance of an orientedViewEdgeIterator can only * be obtained from a ViewVertex by calling edgesBegin() or edgesEnd(). */ @@ -73,7 +73,7 @@ class orientedViewEdgeIterator : public Iterator { edges_container::iterator _nontvertex_iter; public: - /*! Default constructor */ + /** Default constructor */ inline orientedViewEdgeIterator() { } @@ -83,7 +83,7 @@ class orientedViewEdgeIterator : public Iterator { _Nature = iNature; } - /*! Copy constructor */ + /** Copy constructor */ orientedViewEdgeIterator(const orientedViewEdgeIterator &iBrother) { _Nature = iBrother._Nature; @@ -125,7 +125,7 @@ class orientedViewEdgeIterator : public Iterator { } public: - /*! Tells whether the ViewEdge pointed by this iterator is the first one of the iteration list or + /** Tells whether the ViewEdge pointed by this iterator is the first one of the iteration list or * not. */ virtual bool isBegin() const { @@ -137,7 +137,7 @@ class orientedViewEdgeIterator : public Iterator { } } - /*! Tells whether the ViewEdge pointed by this iterator is after the last one of the iteration + /** Tells whether the ViewEdge pointed by this iterator is after the last one of the iteration * list or not. */ virtual bool isEnd() const { @@ -150,7 +150,7 @@ class orientedViewEdgeIterator : public Iterator { } // operators - /*! Increments. In the scripting language, call "increment()". */ + /** Increments. In the scripting language, call "increment()". */ // operator corresponding to ++i virtual orientedViewEdgeIterator &operator++() { @@ -168,7 +168,7 @@ class orientedViewEdgeIterator : public Iterator { } // comparibility - /*! operator != */ + /** operator != */ virtual bool operator!=(const orientedViewEdgeIterator &b) const { if (_Nature & Nature::T_VERTEX) { @@ -179,14 +179,14 @@ class orientedViewEdgeIterator : public Iterator { } } - /*! operator == */ + /** operator == */ virtual bool operator==(const orientedViewEdgeIterator &b) const { return !(*this != b); } // dereferencing - /*! Returns a reference to the pointed orientedViewEdge. + /** Returns a reference to the pointed orientedViewEdge. * In the scripting language, you must call "getObject()" instead. */ virtual ViewVertex::directedViewEdge &operator*() const @@ -199,7 +199,7 @@ class orientedViewEdgeIterator : public Iterator { return (*_nontvertex_iter); } } - /*! Returns a pointer to the pointed orientedViewEdge. + /** Returns a pointer to the pointed orientedViewEdge. * Can't be called in the scripting language. */ virtual ViewVertex::directedViewEdge *operator->() const @@ -208,7 +208,7 @@ class orientedViewEdgeIterator : public Iterator { } public: - /*! increments.*/ + /** increments. */ virtual inline int increment() { if (_Nature & Nature::T_VERTEX) { @@ -415,14 +415,14 @@ class SVertexIterator : public Interface0DIteratorNested { // /////////////////////////////////////////////////////////// -/*! Base class for iterators over ViewEdges of the ViewMap Graph. +/** Base class for iterators over ViewEdges of the ViewMap Graph. * Basically the "increment()" operator of this class should be able to take the decision of * "where" (on which ViewEdge) to go when pointing on a given ViewEdge. * ::Caution::: the dereferencing operator returns a *pointer* to the pointed ViewEdge. */ class ViewEdgeIterator : public Iterator { public: - /*! Builds a ViewEdgeIterator from a starting ViewEdge and its orientation. + /** Builds a ViewEdgeIterator from a starting ViewEdge and its orientation. * \param begin: * The ViewEdge from where to start the iteration. * \param orientation: @@ -437,7 +437,7 @@ class ViewEdgeIterator : public Iterator { _begin = begin; } - /*! Copy constructor */ + /** Copy constructor */ ViewEdgeIterator(const ViewEdgeIterator &it) { _orientation = it._orientation; @@ -449,55 +449,55 @@ class ViewEdgeIterator : public Iterator { { } - /*! Returns the string "ViewEdgeIterator" */ + /** Returns the string "ViewEdgeIterator" */ virtual string getExactTypeName() const { return "ViewEdgeIterator"; } - /*! Returns the current pointed ViewEdge. */ + /** Returns the current pointed ViewEdge. */ ViewEdge *getCurrentEdge() { return _edge; } - /*! Sets the current pointed ViewEdge. */ + /** Sets the current pointed ViewEdge. */ void setCurrentEdge(ViewEdge *edge) { _edge = edge; } - /*! Returns the first ViewEdge used for the iteration. */ + /** Returns the first ViewEdge used for the iteration. */ ViewEdge *getBegin() { return _begin; } - /*! Sets the first ViewEdge used for the iteration. */ + /** Sets the first ViewEdge used for the iteration. */ void setBegin(ViewEdge *begin) { _begin = begin; } - /*! Gets the orientation of the pointed ViewEdge in the iteration. */ + /** Gets the orientation of the pointed ViewEdge in the iteration. */ bool getOrientation() const { return _orientation; } - /*! Sets the orientation of the pointed ViewEdge in the iteration. */ + /** Sets the orientation of the pointed ViewEdge in the iteration. */ void setOrientation(bool orientation) { _orientation = orientation; } - /*! Changes the current orientation. */ + /** Changes the current orientation. */ void changeOrientation() { _orientation = !_orientation; } - /*! Returns a *pointer* to the pointed ViewEdge. */ + /** Returns a *pointer* to the pointed ViewEdge. */ virtual ViewEdge *operator*() { return _edge; @@ -508,14 +508,14 @@ class ViewEdgeIterator : public Iterator { return operator*(); } - /*! Increments. In the scripting language, call "increment()". */ + /** Increments. In the scripting language, call "increment()". */ virtual ViewEdgeIterator &operator++() { increment(); return *this; } - /*! Increments. In the scripting language, call "increment()". */ + /** Increments. In the scripting language, call "increment()". */ virtual ViewEdgeIterator operator++(int) { ViewEdgeIterator tmp(*this); @@ -523,21 +523,21 @@ class ViewEdgeIterator : public Iterator { return tmp; } - /*! increments. */ + /** increments. */ virtual int increment() { cerr << "Warning: method increment() not implemented" << endl; return 0; } - /*! Decrements. In the scripting language, call "decrement()". */ + /** Decrements. In the scripting language, call "decrement()". */ virtual ViewEdgeIterator &operator--() { decrement(); return *this; } - /*! Decrements. In the scripting language, call "decrement()". */ + /** Decrements. In the scripting language, call "decrement()". */ virtual ViewEdgeIterator operator--(int) { ViewEdgeIterator tmp(*this); @@ -545,32 +545,32 @@ class ViewEdgeIterator : public Iterator { return tmp; } - /*! decrements. */ + /** decrements. */ virtual int decrement() { cerr << "Warning: method decrement() not implemented" << endl; return 0; } - /*! Returns true if the pointed ViewEdge is the first one used for the iteration. */ + /** Returns true if the pointed ViewEdge is the first one used for the iteration. */ virtual bool isBegin() const { return _edge == _begin; } - /*! Returns true if the pointed ViewEdge* equals 0. */ + /** Returns true if the pointed ViewEdge* equals 0. */ virtual bool isEnd() const { return !_edge; } - /*! operator == */ + /** operator == */ virtual bool operator==(ViewEdgeIterator &it) const { return _edge == it._edge; } - /*! operator != */ + /** operator != */ virtual bool operator!=(ViewEdgeIterator &it) const { return !(*this == it); diff --git a/source/blender/freestyle/intern/view_map/ViewMapTesselator.h b/source/blender/freestyle/intern/view_map/ViewMapTesselator.h index c6690b1d9dc..ff709879e74 100644 --- a/source/blender/freestyle/intern/view_map/ViewMapTesselator.h +++ b/source/blender/freestyle/intern/view_map/ViewMapTesselator.h @@ -56,17 +56,17 @@ class ViewMapTesselator { { } - /*! Builds a set of lines rep contained under a a NodeShape, itself contained under a NodeGroup + /** Builds a set of lines rep contained under a a NodeShape, itself contained under a NodeGroup * from a ViewMap */ NodeGroup *Tesselate(ViewMap *iViewMap); - /*! Builds a set of lines rep contained under a a NodeShape, itself contained under a NodeGroup + /** Builds a set of lines rep contained under a a NodeShape, itself contained under a NodeGroup * from a set of view edges */ template<class ViewEdgesIterator> NodeGroup *Tesselate(ViewEdgesIterator begin, ViewEdgesIterator end); - /*! Builds a set of lines rep contained among a NodeShape, from a WShape */ + /** Builds a set of lines rep contained among a NodeShape, from a WShape */ NodeGroup *Tesselate(WShape *iWShape); inline void setNature(Nature::EdgeNature iNature) @@ -103,7 +103,7 @@ class ViewMapTesselator { #endif }; -/*! Class to tesselate the 2D projected silhouette */ +/** Class to tesselate the 2D projected silhouette */ class ViewMapTesselator2D : public ViewMapTesselator { public: inline ViewMapTesselator2D() : ViewMapTesselator() @@ -124,7 +124,7 @@ class ViewMapTesselator2D : public ViewMapTesselator { #endif }; -/*! Class to tesselate the 3D silhouette */ +/** Class to tesselate the 3D silhouette */ class ViewMapTesselator3D : public ViewMapTesselator { public: inline ViewMapTesselator3D() : ViewMapTesselator() diff --git a/source/blender/freestyle/intern/winged_edge/Curvature.cpp b/source/blender/freestyle/intern/winged_edge/Curvature.cpp index 1984aceb51c..62d767fd2a1 100644 --- a/source/blender/freestyle/intern/winged_edge/Curvature.cpp +++ b/source/blender/freestyle/intern/winged_edge/Curvature.cpp @@ -104,7 +104,7 @@ static real angle_from_cotan(WVertex *vo, WVertex *v1, WVertex *v2) return (fabs(atan2(denom, udotv))); } -/*! gts_vertex_mean_curvature_normal: +/** gts_vertex_mean_curvature_normal: * \param v: a #WVertex. * \param s: a #GtsSurface. * \param Kh: the Mean Curvature Normal at \a v. @@ -175,7 +175,7 @@ bool gts_vertex_mean_curvature_normal(WVertex *v, Vec3r &Kh) return true; } -/*! gts_vertex_gaussian_curvature: +/** gts_vertex_gaussian_curvature: * \param v: a #WVertex. * \param s: a #GtsSurface. * \param Kg: the Discrete Gaussian Curvature approximation at \a v. @@ -226,7 +226,7 @@ bool gts_vertex_gaussian_curvature(WVertex *v, real *Kg) return true; } -/*! gts_vertex_principal_curvatures: +/** gts_vertex_principal_curvatures: * @Kh: mean curvature. * @Kg: Gaussian curvature. * @K1: first principal curvature. @@ -279,7 +279,7 @@ static void eigenvector(real a, real b, real c, Vec3r e) e[2] = 0.0; } -/*! gts_vertex_principal_directions: +/** gts_vertex_principal_directions: * \param v: a #WVertex. * \param s: a #GtsSurface. * \param Kh: mean curvature normal (a #Vec3r). diff --git a/source/blender/freestyle/intern/winged_edge/Nature.h b/source/blender/freestyle/intern/winged_edge/Nature.h index 68323d7122c..996161abee2 100644 --- a/source/blender/freestyle/intern/winged_edge/Nature.h +++ b/source/blender/freestyle/intern/winged_edge/Nature.h @@ -23,44 +23,44 @@ namespace Freestyle { -/*! Namespace gathering the different possible natures of 0D and 1D elements of the ViewMap */ +/** Namespace gathering the different possible natures of 0D and 1D elements of the ViewMap */ namespace Nature { /* XXX Why not using enums??? */ /* In order to optimize for space (enum is int) - T.K. */ typedef unsigned short VertexNature; -/*! true for any 0D element */ +/** true for any 0D element */ static const VertexNature POINT = 0; // 0 -/*! true for SVertex */ +/** true for SVertex */ static const VertexNature S_VERTEX = (1 << 0); // 1 -/*! true for ViewVertex */ +/** true for ViewVertex */ static const VertexNature VIEW_VERTEX = (1 << 1); // 2 -/*! true for NonTVertex */ +/** true for NonTVertex */ static const VertexNature NON_T_VERTEX = (1 << 2); // 4 -/*! true for TVertex */ +/** true for TVertex */ static const VertexNature T_VERTEX = (1 << 3); // 8 -/*! true for CUSP */ +/** true for CUSP */ static const VertexNature CUSP = (1 << 4); // 16 typedef unsigned short EdgeNature; -/*! true for non feature edges (always false for 1D elements of the ViewMap) */ +/** true for non feature edges (always false for 1D elements of the ViewMap) */ static const EdgeNature NO_FEATURE = 0; // 0 -/*! true for silhouettes */ +/** true for silhouettes */ static const EdgeNature SILHOUETTE = (1 << 0); // 1 -/*! true for borders */ +/** true for borders */ static const EdgeNature BORDER = (1 << 1); // 2 -/*! true for creases */ +/** true for creases */ static const EdgeNature CREASE = (1 << 2); // 4 -/*! true for ridges */ +/** true for ridges */ static const EdgeNature RIDGE = (1 << 3); // 8 -/*! true for valleys */ +/** true for valleys */ static const EdgeNature VALLEY = (1 << 4); // 16 -/*! true for suggestive contours */ +/** true for suggestive contours */ static const EdgeNature SUGGESTIVE_CONTOUR = (1 << 5); // 32 -/*! true for material boundaries */ +/** true for material boundaries */ static const EdgeNature MATERIAL_BOUNDARY = (1 << 6); // 64 -/*! true for user-defined edge marks */ +/** true for user-defined edge marks */ static const EdgeNature EDGE_MARK = (1 << 7); // 128 } // end of namespace Nature diff --git a/source/blender/freestyle/intern/winged_edge/WEdge.cpp b/source/blender/freestyle/intern/winged_edge/WEdge.cpp index 0811fe336b7..356b641a254 100644 --- a/source/blender/freestyle/intern/winged_edge/WEdge.cpp +++ b/source/blender/freestyle/intern/winged_edge/WEdge.cpp @@ -25,7 +25,7 @@ namespace Freestyle { -/*! Temporary structures */ +/** Temporary structures */ class vertexdata { public: WVertex *_copy; diff --git a/source/blender/freestyle/intern/winged_edge/WEdge.h b/source/blender/freestyle/intern/winged_edge/WEdge.h index 42a8e62990f..2a2c8754454 100644 --- a/source/blender/freestyle/intern/winged_edge/WEdge.h +++ b/source/blender/freestyle/intern/winged_edge/WEdge.h @@ -76,14 +76,14 @@ class WVertex { _Border = -1; } - /*! Copy constructor */ + /** Copy constructor */ WVertex(WVertex &iBrother); virtual WVertex *duplicate(); virtual ~WVertex() { } - /*! accessors */ + /** accessors */ inline Vec3f &GetVertex() { return _Vertex; @@ -111,7 +111,7 @@ class WVertex { bool isBoundary(); - /*! modifiers */ + /** modifiers */ inline void setVertex(const Vec3f &v) { _Vertex = v; @@ -147,7 +147,7 @@ class WVertex { } } - /*! Adds an edge to the edges list */ + /** Adds an edge to the edges list */ void AddEdge(WEdge *iEdge); virtual void ResetUserData() @@ -156,7 +156,7 @@ class WVertex { } public: - /*! Iterator to iterate over a vertex incoming edges in the CCW order*/ + /** Iterator to iterate over a vertex incoming edges in the CCW order. */ #if defined(__GNUC__) && (__GNUC__ < 3) class incoming_edge_iterator : public input_iterator<WOEdge *, ptrdiff_t> #else @@ -247,7 +247,7 @@ class WVertex { #endif }; - /*! Iterator to iterate over a vertex faces in the CCW order */ + /** Iterator to iterate over a vertex faces in the CCW order */ #if defined(__GNUC__) && (__GNUC__ < 3) class face_iterator : public input_iterator<WFace *, ptrdiff_t> #else @@ -336,7 +336,7 @@ class WVertex { }; public: - /*! iterators access */ + /** iterators access */ virtual incoming_edge_iterator incoming_edges_begin(); virtual incoming_edge_iterator incoming_edges_end(); @@ -404,11 +404,11 @@ class WOEdge { virtual ~WOEdge(){}; // soc - /*! copy constructor */ + /** copy constructor */ WOEdge(WOEdge &iBrother); virtual WOEdge *duplicate(); - /*! accessors */ + /** accessors */ #if 0 inline WOEdge *GetaCWEdge() { @@ -466,7 +466,7 @@ class WOEdge { return _angle; } - /*! modifiers */ + /** modifiers */ #if 0 inline void SetaCWEdge(WOEdge *pe) { @@ -520,7 +520,7 @@ class WOEdge { _pOwner = pe; } - /*! Retrieves the list of edges in CW order */ + /** Retrieves the list of edges in CW order */ inline void RetrieveCWOrderedEdges(vector<WEdge *> &oEdges); WOEdge *twin(); @@ -579,7 +579,7 @@ class WEdge { userdata = NULL; } - /*! Copy constructor */ + /** Copy constructor */ WEdge(WEdge &iBrother); virtual WEdge *duplicate(); @@ -596,7 +596,7 @@ class WEdge { } } - /*! checks whether two WEdge have a common vertex. + /** checks whether two WEdge have a common vertex. * Returns a pointer on the common vertex if it exists, NULL otherwise. */ static inline WVertex *CommonVertex(WEdge *iEdge1, WEdge *iEdge2) @@ -619,7 +619,7 @@ class WEdge { return NULL; } - /*! accessors */ + /** accessors */ inline WOEdge *GetaOEdge() { return _paOEdge; @@ -675,7 +675,7 @@ class WEdge { } } - /*! modifiers */ + /** modifiers */ inline void setaOEdge(WOEdge *iEdge) { _paOEdge = iEdge; @@ -754,14 +754,14 @@ class WFace { _FrsMaterialIndex = 0; } - /*! copy constructor */ + /** copy constructor */ WFace(WFace &iBrother); virtual WFace *duplicate(); virtual ~WFace() { } - /*! accessors */ + /** accessors */ inline const vector<WOEdge *> &getEdgeList() { return _OEdgeList; @@ -794,7 +794,7 @@ class WFace { const FrsMaterial &frs_material(); - /*! The vertex of index i corresponds to the a vertex of the edge of index i */ + /** The vertex of index i corresponds to the a vertex of the edge of index i */ inline WVertex *GetVertex(unsigned int index) { #if 0 @@ -805,7 +805,7 @@ class WFace { return _OEdgeList[index]->GetaVertex(); } - /*! returns the index at which iVertex is stored in the array. + /** returns the index at which iVertex is stored in the array. * returns -1 if iVertex doesn't belong to the face. */ inline int GetIndex(WVertex *iVertex) @@ -868,19 +868,19 @@ class WFace { return _VerticesTexCoords; } - /*! Returns the normal of the vertex of index index */ + /** Returns the normal of the vertex of index index */ inline Vec3f &GetVertexNormal(int index) { return _VerticesNormals[index]; } - /*! Returns the tex coords of the vertex of index index */ + /** Returns the tex coords of the vertex of index index */ inline Vec2f &GetVertexTexCoords(int index) { return _VerticesTexCoords[index]; } - /*! Returns the normal of the vertex iVertex for that face */ + /** Returns the normal of the vertex iVertex for that face */ inline Vec3f &GetVertexNormal(WVertex *iVertex) { int i = 0; @@ -933,7 +933,7 @@ class WFace { return _OEdgeList.size(); } - /*! Returns true if the face has one ot its edge which is a border edge */ + /** Returns true if the face has one ot its edge which is a border edge */ inline bool isBorder() const { for (vector<WOEdge *>::const_iterator woe = _OEdgeList.begin(), woeend = _OEdgeList.end(); @@ -946,7 +946,7 @@ class WFace { return false; } - /*! modifiers */ + /** modifiers */ inline void setEdgeList(const vector<WOEdge *> &iEdgeList) { _OEdgeList = iEdgeList; @@ -982,13 +982,13 @@ class WFace { _Mark = iMark; } - /*! designed to build a specialized WEdge for use in MakeEdge */ + /** designed to build a specialized WEdge for use in MakeEdge */ virtual WEdge *instanciateEdge() const { return new WEdge; } - /*! Builds an oriented edge + /** Builds an oriented edge * Returns the built edge. * v1, v2 * Vertices at the edge's extremities @@ -996,18 +996,18 @@ class WFace { */ virtual WOEdge *MakeEdge(WVertex *v1, WVertex *v2); - /*! Adds an edge to the edges list */ + /** Adds an edge to the edges list */ inline void AddEdge(WOEdge *iEdge) { _OEdgeList.push_back(iEdge); } - /*! For triangles, returns the edge opposite to the vertex in e. + /** For triangles, returns the edge opposite to the vertex in e. * returns false if the face is not a triangle or if the vertex is not found */ bool getOppositeEdge(const WVertex *v, WOEdge *&e); - /*! compute the area of the face */ + /** compute the area of the face */ float getArea(); WShape *getShape(); @@ -1057,7 +1057,7 @@ class WShape { _SceneCurrentId++; } - /*! copy constructor */ + /** copy constructor */ WShape(WShape &iBrother); virtual WShape *duplicate(); @@ -1088,7 +1088,7 @@ class WShape { } } - /*! accessors */ + /** accessors */ inline vector<WEdge *> &getEdgeList() { return _EdgeList; @@ -1144,7 +1144,7 @@ class WShape { return _LibraryPath; } - /*! modifiers */ + /** modifiers */ static inline void setCurrentId(const unsigned id) { _SceneCurrentId = id; @@ -1198,13 +1198,13 @@ class WShape { _LibraryPath = path; } - /*! designed to build a specialized WFace for use in MakeFace */ + /** designed to build a specialized WFace for use in MakeFace */ virtual WFace *instanciateFace() const { return new WFace; } - /*! adds a new face to the shape + /** adds a new face to the shape * returns the built face. * iVertexList * List of face's vertices. These vertices are not added to the WShape vertex list; they are @@ -1217,7 +1217,7 @@ class WShape { vector<bool> &iFaceEdgeMarksList, unsigned iMaterialIndex); - /*! adds a new face to the shape. The difference with the previous method is that this one is + /** adds a new face to the shape. The difference with the previous method is that this one is * designed to build a WingedEdge structure for which there are per vertex normals, opposed to * per face normals. returns the built face. iVertexList List of face's vertices. These vertices * are not added to the WShape vertex list; they are supposed to be already stored when calling @@ -1309,7 +1309,7 @@ class WShape { #endif protected: - /*! + /** * Builds the face passed as argument (which as already been allocated) * - iVertexList * List of face's vertices. These vertices are not added to the WShape vertex list; diff --git a/source/blender/freestyle/intern/winged_edge/WFillGrid.h b/source/blender/freestyle/intern/winged_edge/WFillGrid.h index 095a58675c0..9398a63333f 100644 --- a/source/blender/freestyle/intern/winged_edge/WFillGrid.h +++ b/source/blender/freestyle/intern/winged_edge/WFillGrid.h @@ -47,7 +47,7 @@ class WFillGrid { void fillGrid(); - /*! Accessors */ + /** Accessors */ WingedEdge *getWingedEdge() { return _winged_edge; @@ -58,7 +58,7 @@ class WFillGrid { return _grid; } - /*! Modifiers */ + /** Modifiers */ void setWingedEdge(WingedEdge *winged_edge) { if (winged_edge) { diff --git a/source/blender/freestyle/intern/winged_edge/WSFillGrid.h b/source/blender/freestyle/intern/winged_edge/WSFillGrid.h index 5393f57d2cd..d4e7f3ca76b 100644 --- a/source/blender/freestyle/intern/winged_edge/WSFillGrid.h +++ b/source/blender/freestyle/intern/winged_edge/WSFillGrid.h @@ -43,7 +43,7 @@ class WSFillGrid { void fillGrid(); - /*! Accessors */ + /** Accessors */ WingedEdge *getWingedEdge() { return _winged_edge; @@ -54,7 +54,7 @@ class WSFillGrid { return _grid; } - /*! Modifiers */ + /** Modifiers */ void setWingedEdge(WingedEdge *winged_edge) { if (winged_edge) { diff --git a/source/blender/freestyle/intern/winged_edge/WXEdge.h b/source/blender/freestyle/intern/winged_edge/WXEdge.h index 8fe99f9bb93..f95913c23f3 100644 --- a/source/blender/freestyle/intern/winged_edge/WXEdge.h +++ b/source/blender/freestyle/intern/winged_edge/WXEdge.h @@ -52,7 +52,7 @@ class WXVertex : public WVertex { _curvatures = NULL; } - /*! Copy constructor */ + /** Copy constructor */ WXVertex(WXVertex &iBrother) : WVertex(iBrother) { _curvatures = new CurvatureInfo(*iBrother._curvatures); @@ -135,7 +135,7 @@ class WXEdge : public WEdge { _order = 0; } - /*! Copy constructor */ + /** Copy constructor */ inline WXEdge(WXEdge &iBrother) : WEdge(iBrother) { _nature = iBrother.nature(); @@ -159,7 +159,7 @@ class WXEdge : public WEdge { _nature = _nature & ~Nature::SUGGESTIVE_CONTOUR; } - /*! accessors */ + /** accessors */ inline WXNature nature() { return _nature; @@ -175,7 +175,7 @@ class WXEdge : public WEdge { return _order; } - /*! modifiers */ + /** modifiers */ inline void setFront(bool iFront) { _front = iFront; @@ -209,7 +209,7 @@ class WXEdge : public WEdge { * * **********************************/ -/*! Class to store a smooth edge (i.e Hertzman & Zorin smooth silhouette edges) */ +/** Class to store a smooth edge (i.e Hertzman & Zorin smooth silhouette edges) */ class WXSmoothEdge { public: typedef unsigned short Configuration; @@ -278,7 +278,7 @@ class WXSmoothEdge { return _config; } - /*! modifiers */ + /** modifiers */ inline void setWOeA(WOEdge *iwoea) { _woea = iwoea; @@ -439,15 +439,15 @@ class WXFaceLayer { } } - /*! If one of the face layer vertex has a DotP equal to 0, this method returns the vertex where + /** If one of the face layer vertex has a DotP equal to 0, this method returns the vertex where * it happens */ unsigned int Get0VertexIndex() const; - /*! In case one of the edge of the triangle is a smooth edge, this method allows to retrieve the + /** In case one of the edge of the triangle is a smooth edge, this method allows to retrieve the * concerned edge */ unsigned int GetSmoothEdgeIndex() const; - /*! retrieves the edges of the triangle for which the signs are different (a null value is not + /** retrieves the edges of the triangle for which the signs are different (a null value is not * considered) for the dotp values at each edge extremity */ void RetrieveCuspEdgesIndices(vector<int> &oCuspEdges); @@ -512,7 +512,7 @@ class WXFace : public WFace { _front = false; } - /*! Copy constructor */ + /** Copy constructor */ WXFace(WXFace &iBrother) : WFace(iBrother) { _center = iBrother.center(); @@ -545,13 +545,13 @@ class WXFace : public WFace { } } - /*! designed to build a specialized WEdge for use in MakeEdge */ + /** designed to build a specialized WEdge for use in MakeEdge */ virtual WEdge *instanciateEdge() const { return new WXEdge; } - /*! accessors */ + /** accessors */ inline Vec3f ¢er() { return _center; @@ -590,7 +590,7 @@ class WXFace : public WFace { return _SmoothLayers; } - /*! retrieve the smooth edges that match the Nature given as argument */ + /** retrieve the smooth edges that match the Nature given as argument */ void retrieveSmoothEdges(WXNature iNature, vector<WXSmoothEdge *> &oSmoothEdges) { for (vector<WXFaceLayer *>::iterator wxf = _SmoothLayers.begin(), wxfend = _SmoothLayers.end(); @@ -624,7 +624,7 @@ class WXFace : public WFace { } } - /*! modifiers */ + /** modifiers */ inline void setCenter(const Vec3f &iCenter) { _center = iCenter; @@ -674,7 +674,7 @@ class WXFace : public WFace { _SmoothLayers = layersToKeep; } - /*! Clears everything */ + /** Clears everything */ inline void Clear() { for (vector<WXFaceLayer *>::iterator wxf = _SmoothLayers.begin(), wxfend = _SmoothLayers.end(); @@ -724,7 +724,7 @@ class WXShape : public WShape { _computeViewIndependent = true; } - /*! copy constructor */ + /** copy constructor */ inline WXShape(WXShape &iBrother) : WShape(iBrother) { _computeViewIndependent = iBrother._computeViewIndependent; @@ -750,13 +750,13 @@ class WXShape : public WShape { _computeViewIndependent = iFlag; } - /*! designed to build a specialized WFace for use in MakeFace */ + /** designed to build a specialized WFace for use in MakeFace */ virtual WFace *instanciateFace() const { return new WXFace; } - /*! + /** * Adds a new face to the shape returns the built face. * - iVertexList * List of face's vertices. @@ -768,7 +768,7 @@ class WXShape : public WShape { vector<bool> &iFaceEdgeMarksList, unsigned iMaterialIndex); - /*! + /** * Adds a new face to the shape. * The difference with the previous method is that this one is designed to build a WingedEdge * structure for which there are per vertex normals, opposed to per face normals. @@ -792,7 +792,7 @@ class WXShape : public WShape { vector<bool> &iFaceEdgeMarksList, unsigned iMaterialIndex); - /*! Reset all edges and vertices flags (which might have been set up on a previous pass) */ + /** Reset all edges and vertices flags (which might have been set up on a previous pass) */ virtual void Reset() { // Reset Edges @@ -807,7 +807,7 @@ class WXShape : public WShape { ((WXFace *)(*wf))->Reset(); } } - /*! accessors */ + /** accessors */ #ifdef WITH_CXX_GUARDEDALLOC MEM_CXX_CLASS_ALLOC_FUNCS("Freestyle:WXShape") diff --git a/source/blender/functions/FN_generic_virtual_array.hh b/source/blender/functions/FN_generic_virtual_array.hh index 5fdc7c3f337..27c7a13029c 100644 --- a/source/blender/functions/FN_generic_virtual_array.hh +++ b/source/blender/functions/FN_generic_virtual_array.hh @@ -832,7 +832,7 @@ template<typename T> class GVArray_Typed { } /* Support implicit cast to the typed virtual array for convenience when `varray->typed<T>()` is - * used within an expression. */ + * used within an expression. */ operator const VArray<T> &() const { return *varray_; diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c b/source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c index f0aae7e4498..b87ed9e431a 100644 --- a/source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c +++ b/source/blender/gpencil_modifiers/intern/MOD_gpencillineart.c @@ -305,6 +305,7 @@ static void panel_draw(const bContext *UNUSED(C), Panel *panel) uiLayout *col = uiLayoutColumnWithHeading(layout, true, IFACE_("Edge Types")); uiItemR(col, ptr, "use_contour", 0, IFACE_("Contour"), ICON_NONE); + uiItemR(col, ptr, "use_floating", 0, IFACE_("Floating"), ICON_NONE); uiItemR(col, ptr, "use_material", 0, IFACE_("Material Borders"), ICON_NONE); uiItemR(col, ptr, "use_edge_mark", 0, IFACE_("Edge Marks"), ICON_NONE); uiItemR(col, ptr, "use_intersection", 0, IFACE_("Intersections"), ICON_NONE); @@ -312,7 +313,7 @@ static void panel_draw(const bContext *UNUSED(C), Panel *panel) uiLayout *sub = uiLayoutRowWithHeading(col, false, IFACE_("Crease")); uiItemR(sub, ptr, "use_crease", 0, "", ICON_NONE); uiLayout *entry = uiLayoutRow(sub, false); - uiLayoutSetActive(entry, RNA_boolean_get(ptr, "use_crease") || is_first); + uiLayoutSetEnabled(entry, RNA_boolean_get(ptr, "use_crease") || is_first); if (use_cache && !is_first) { uiItemL(entry, IFACE_("Angle Cached"), ICON_INFO); } @@ -368,6 +369,7 @@ static void options_panel_draw(const bContext *UNUSED(C), Panel *panel) uiItemR(col, ptr, "use_edge_overlap", 0, IFACE_("Overlapping Edges As Contour"), ICON_NONE); uiItemR(col, ptr, "use_object_instances", 0, NULL, ICON_NONE); uiItemR(col, ptr, "use_clip_plane_boundaries", 0, NULL, ICON_NONE); + uiItemR(col, ptr, "allow_overlap_edge_types", 0, NULL, ICON_NONE); } static void style_panel_draw(const bContext *UNUSED(C), Panel *panel) @@ -430,7 +432,7 @@ static void transparency_panel_draw(const bContext *UNUSED(C), Panel *panel) uiLayoutSetPropSep(layout, true); - uiLayoutSetActive(layout, RNA_boolean_get(ptr, "use_transparency")); + uiLayoutSetEnabled(layout, RNA_boolean_get(ptr, "use_transparency")); uiLayout *row = uiLayoutRow(layout, true); uiLayoutSetPropDecorate(row, false); @@ -447,6 +449,51 @@ static void transparency_panel_draw(const bContext *UNUSED(C), Panel *panel) uiItemR(col, ptr, "use_transparency_match", 0, IFACE_("Match All Masks"), ICON_NONE); } +static void face_mark_panel_draw_header(const bContext *UNUSED(C), Panel *panel) +{ + uiLayout *layout = panel->layout; + PointerRNA ob_ptr; + PointerRNA *ptr = gpencil_modifier_panel_get_property_pointers(panel, &ob_ptr); + + const bool is_baked = RNA_boolean_get(ptr, "is_baked"); + const bool use_cache = RNA_boolean_get(ptr, "use_cache"); + const bool is_first = BKE_gpencil_is_first_lineart_in_stack(ob_ptr.data, ptr->data); + + if (!use_cache || is_first) { + uiLayoutSetEnabled(layout, !is_baked); + uiItemR(layout, ptr, "use_face_mark", 0, IFACE_("Face Mark Filtering"), ICON_NONE); + } + else { + uiItemL(layout, IFACE_("Face Mark Filtering"), ICON_NONE); + } +} + +static void face_mark_panel_draw(const bContext *UNUSED(C), Panel *panel) +{ + uiLayout *layout = panel->layout; + PointerRNA ob_ptr; + PointerRNA *ptr = gpencil_modifier_panel_get_property_pointers(panel, &ob_ptr); + + const bool is_baked = RNA_boolean_get(ptr, "is_baked"); + const bool use_mark = RNA_boolean_get(ptr, "use_face_mark"); + const bool use_cache = RNA_boolean_get(ptr, "use_cache"); + const bool is_first = BKE_gpencil_is_first_lineart_in_stack(ob_ptr.data, ptr->data); + + uiLayoutSetEnabled(layout, !is_baked); + + if (use_cache && !is_first) { + uiItemL(layout, "Cached from the first line art modifier.", ICON_INFO); + return; + } + + uiLayoutSetPropSep(layout, true); + + uiLayoutSetActive(layout, use_mark); + + uiItemR(layout, ptr, "use_face_mark_invert", 0, NULL, ICON_NONE); + uiItemR(layout, ptr, "use_face_mark_boundaries", 0, NULL, ICON_NONE); +} + static void chaining_panel_draw(const bContext *UNUSED(C), Panel *panel) { PointerRNA ob_ptr; @@ -457,6 +504,7 @@ static void chaining_panel_draw(const bContext *UNUSED(C), Panel *panel) const bool is_baked = RNA_boolean_get(ptr, "is_baked"); const bool use_cache = RNA_boolean_get(ptr, "use_cache"); const bool is_first = BKE_gpencil_is_first_lineart_in_stack(ob_ptr.data, ptr->data); + const bool is_geom = RNA_boolean_get(ptr, "chain_geometry_space"); uiLayoutSetPropSep(layout, true); uiLayoutSetEnabled(layout, !is_baked); @@ -469,8 +517,16 @@ static void chaining_panel_draw(const bContext *UNUSED(C), Panel *panel) uiLayout *col = uiLayoutColumnWithHeading(layout, true, IFACE_("Chain")); uiItemR(col, ptr, "use_fuzzy_intersections", 0, NULL, ICON_NONE); uiItemR(col, ptr, "use_fuzzy_all", 0, NULL, ICON_NONE); + uiItemR(col, ptr, "chain_floating_edges", 0, IFACE_("Floating Edges"), ICON_NONE); + uiItemR(col, ptr, "floating_as_contour", 0, NULL, ICON_NONE); + uiItemR(col, ptr, "chain_geometry_space", 0, NULL, ICON_NONE); - uiItemR(layout, ptr, "chaining_image_threshold", 0, NULL, ICON_NONE); + uiItemR(layout, + ptr, + "chaining_image_threshold", + 0, + is_geom ? IFACE_("Geometry Threshold") : NULL, + ICON_NONE); uiItemR(layout, ptr, "split_angle", UI_ITEM_R_SLIDER, NULL, ICON_NONE); } @@ -556,6 +612,8 @@ static void panelRegister(ARegionType *region_type) transparency_panel_draw, occlusion_panel); gpencil_modifier_subpanel_register( + region_type, "face_mark", "", face_mark_panel_draw_header, face_mark_panel_draw, panel_type); + gpencil_modifier_subpanel_register( region_type, "chaining", "Chaining", NULL, chaining_panel_draw, panel_type); gpencil_modifier_subpanel_register( region_type, "vgroup", "Vertex Weight Transfer", NULL, vgroup_panel_draw, panel_type); diff --git a/source/blender/gpencil_modifiers/intern/lineart/MOD_lineart.h b/source/blender/gpencil_modifiers/intern/lineart/MOD_lineart.h index b6175762bbe..d78cd862383 100644 --- a/source/blender/gpencil_modifiers/intern/lineart/MOD_lineart.h +++ b/source/blender/gpencil_modifiers/intern/lineart/MOD_lineart.h @@ -189,7 +189,7 @@ typedef struct LineartEdgeChainItem { /** For restoring position to 3d space */ float gpos[3]; float normal[3]; - char line_type; + unsigned char line_type; char occlusion; unsigned char transparency_mask; size_t index; @@ -267,6 +267,7 @@ typedef struct LineartRenderBuffer { ListBase crease; ListBase material; ListBase edge_mark; + ListBase floating; ListBase chains; @@ -287,11 +288,20 @@ typedef struct LineartRenderBuffer { bool use_material; bool use_edge_marks; bool use_intersections; + bool use_floating; bool fuzzy_intersections; bool fuzzy_everything; bool allow_boundaries; bool allow_overlapping_edges; + bool allow_duplicated_types; bool remove_doubles; + bool floating_as_contour; + bool chain_floating_edges; + bool chain_geometry_space; + + bool filter_face_mark; + bool filter_face_mark_invert; + bool filter_face_mark_boundaries; /* Keep an copy of these data so when line art is running it's self-contained. */ bool cam_is_persp; @@ -358,11 +368,10 @@ typedef struct LineartRenderTaskInfo { ListBase crease; ListBase material; ListBase edge_mark; + ListBase floating; } LineartRenderTaskInfo; -struct BMesh; - typedef struct LineartObjectInfo { struct LineartObjectInfo *next; struct Object *original_ob; @@ -370,14 +379,14 @@ typedef struct LineartObjectInfo { double model_view_proj[4][4]; double model_view[4][4]; double normal[4][4]; - LineartElementLinkNode *v_reln; + LineartElementLinkNode *v_eln; int usage; int global_i_offset; bool free_use_mesh; /* Threads will add lines inside here, when all threads are done, we combine those into the - * ones in LineartRenderBuffer. */ + * ones in LineartRenderBuffer. */ ListBase contour; ListBase intersection; ListBase crease; diff --git a/source/blender/gpencil_modifiers/intern/lineart/lineart_chain.c b/source/blender/gpencil_modifiers/intern/lineart/lineart_chain.c index f90fbaf4ccf..37ee93b5f0f 100644 --- a/source/blender/gpencil_modifiers/intern/lineart/lineart_chain.c +++ b/source/blender/gpencil_modifiers/intern/lineart/lineart_chain.c @@ -587,7 +587,7 @@ void MOD_lineart_chain_split_for_fixed_occlusion(LineartRenderBuffer *rb) } else { /* Set the same occlusion level for the end vertex, so when further connection is needed - * the backwards occlusion info is also correct. */ + * the backwards occlusion info is also correct. */ eci->occlusion = fixed_occ; eci->transparency_mask = fixed_mask; /* No need to split at the last point anyway. */ @@ -729,7 +729,8 @@ static LineartChainRegisterEntry *lineart_chain_get_closest_cre(LineartRenderBuf } } - float new_len = len_v2v2(cre->eci->pos, eci->pos); + float new_len = rb->chain_geometry_space ? len_v3v3(cre->eci->gpos, eci->gpos) : + len_v2v2(cre->eci->pos, eci->pos); if (new_len < dist) { closest_cre = cre; dist = new_len; @@ -800,6 +801,10 @@ void MOD_lineart_chain_connect(LineartRenderBuffer *rb) } BLI_addtail(&rb->chains, ec); + if (ec->type == LRT_EDGE_FLAG_FLOATING && (!rb->chain_floating_edges)) { + continue; + } + occlusion = ec->level; transparency_mask = ec->transparency_mask; @@ -926,7 +931,7 @@ void MOD_lineart_chain_split_angle(LineartRenderBuffer *rb, float angle_threshol angle = angle_v2v2v2(prev_rlci->pos, eci->pos, next_rlci->pos); } else { - break; /* No need to split at the last point anyway.*/ + break; /* No need to split at the last point anyway. */ } if (angle < angle_threshold_rad) { new_rlc = lineart_chain_create(rb); diff --git a/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c b/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c index 0b7e50e29a6..2c171692002 100644 --- a/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c +++ b/source/blender/gpencil_modifiers/intern/lineart/lineart_cpu.c @@ -43,6 +43,7 @@ #include "BKE_gpencil_modifier.h" #include "BKE_material.h" #include "BKE_mesh.h" +#include "BKE_object.h" #include "BKE_pointcache.h" #include "BKE_scene.h" #include "DEG_depsgraph_query.h" @@ -429,6 +430,7 @@ static int lineart_occlusion_make_task_info(LineartRenderBuffer *rb, LineartRend LRT_ASSIGN_OCCLUSION_TASK(crease); LRT_ASSIGN_OCCLUSION_TASK(material); LRT_ASSIGN_OCCLUSION_TASK(edge_mark); + LRT_ASSIGN_OCCLUSION_TASK(floating); #undef LRT_ASSIGN_OCCLUSION_TASK @@ -463,6 +465,10 @@ static void lineart_occlusion_worker(TaskPool *__restrict UNUSED(pool), LineartR for (eip = rti->edge_mark.first; eip && eip != rti->edge_mark.last; eip = eip->next) { lineart_occlusion_single_line(rb, eip, rti->thread_id); } + + for (eip = rti->floating.first; eip && eip != rti->floating.last; eip = eip->next) { + lineart_occlusion_single_line(rb, eip, rti->thread_id); + } } } @@ -485,6 +491,7 @@ static void lineart_main_occlusion_begin(LineartRenderBuffer *rb) rb->intersection.last = rb->intersection.first; rb->material.last = rb->material.first; rb->edge_mark.last = rb->edge_mark.first; + rb->floating.last = rb->floating.first; TaskPool *tp = BLI_task_pool_create(NULL, TASK_PRIORITY_HIGH); @@ -719,6 +726,7 @@ static void lineart_triangle_post(LineartTriangle *tri, LineartTriangle *orig) /* Just re-assign normal and set cull flag. */ copy_v3_v3_db(tri->gn, orig->gn); tri->flags = LRT_CULL_GENERATED; + tri->transparency_mask = orig->transparency_mask; } static void lineart_triangle_set_cull_flag(LineartTriangle *tri, uchar flag) @@ -734,6 +742,16 @@ static bool lineart_edge_match(LineartTriangle *tri, LineartEdge *e, int v1, int (tri->v[v2] == e->v1 && tri->v[v1] == e->v2)); } +static void lineart_discard_duplicated_edges(LineartEdge *old_e, int v1id, int v2id) +{ + LineartEdge *e = old_e; + e++; + while (e->v1_obindex == v1id && e->v2_obindex == v2id) { + e->flags |= LRT_EDGE_FLAG_CHAIN_PICKED; + e++; + } +} + /** * Does near-plane cut on 1 triangle only. When cutting with far-plane, the camera vectors gets * reversed by the caller so don't need to implement one in a different direction. @@ -799,6 +817,7 @@ static void lineart_triangle_cull_single(LineartRenderBuffer *rb, old_e = ta->e[e_num]; \ new_flag = old_e->flags; \ old_e->flags = LRT_EDGE_FLAG_CHAIN_PICKED; \ + lineart_discard_duplicated_edges(old_e, old_e->v1_obindex, old_e->v2_obindex); \ INCREASE_EDGE \ e->v1 = (v1_link); \ e->v2 = (v2_link); \ @@ -819,12 +838,15 @@ static void lineart_triangle_cull_single(LineartRenderBuffer *rb, #define REMOVE_TRIANGLE_EDGE \ if (ta->e[0]) { \ ta->e[0]->flags = LRT_EDGE_FLAG_CHAIN_PICKED; \ + lineart_discard_duplicated_edges(ta->e[0], ta->e[0]->v1_obindex, ta->e[0]->v2_obindex); \ } \ if (ta->e[1]) { \ ta->e[1]->flags = LRT_EDGE_FLAG_CHAIN_PICKED; \ + lineart_discard_duplicated_edges(ta->e[1], ta->e[1]->v1_obindex, ta->e[1]->v2_obindex); \ } \ if (ta->e[2]) { \ ta->e[2]->flags = LRT_EDGE_FLAG_CHAIN_PICKED; \ + lineart_discard_duplicated_edges(ta->e[2], ta->e[2]->v1_obindex, ta->e[2]->v2_obindex); \ } switch (in0 + in1 + in2) { @@ -1251,7 +1273,7 @@ static void lineart_main_cull_triangles(LineartRenderBuffer *rb, bool clip_far) } #define LRT_CULL_DECIDE_INSIDE \ - /* These three represents points that are in the clipping range or not*/ \ + /* These three represents points that are in the clipping range or not. */ \ in0 = 0, in1 = 0, in2 = 0; \ if (clip_far) { \ /* Point outside far plane. */ \ @@ -1372,6 +1394,24 @@ static void lineart_main_perspective_division(LineartRenderBuffer *rb) } } +static void lineart_main_discard_out_of_frame_edges(LineartRenderBuffer *rb) +{ + LineartEdge *e; + int i; + +#define LRT_VERT_OUT_OF_BOUND(v) \ + (v && (v->fbcoord[0] < -1 || v->fbcoord[0] > 1 || v->fbcoord[1] < -1 || v->fbcoord[1] > 1)) + + LISTBASE_FOREACH (LineartElementLinkNode *, eln, &rb->line_buffer_pointers) { + e = (LineartEdge *)eln->pointer; + for (i = 0; i < eln->element_count; i++) { + if ((LRT_VERT_OUT_OF_BOUND(e[i].v1) && LRT_VERT_OUT_OF_BOUND(e[i].v2))) { + e[i].flags = LRT_EDGE_FLAG_CHAIN_PICKED; + } + } + } +} + /** * Transform a single vert to it's viewing position. */ @@ -1398,23 +1438,57 @@ static LineartTriangle *lineart_triangle_from_index(LineartRenderBuffer *rb, return (LineartTriangle *)b; } -static char lineart_identify_feature_line(LineartRenderBuffer *rb, - BMEdge *e, - LineartTriangle *rt_array, - LineartVert *rv_array, - float crease_threshold, - bool no_crease, - bool count_freestyle, - BMesh *bm_if_freestyle) +static uint16_t lineart_identify_feature_line(LineartRenderBuffer *rb, + BMEdge *e, + LineartTriangle *rt_array, + LineartVert *rv_array, + float crease_threshold, + bool no_crease, + bool use_freestyle_edge, + bool use_freestyle_face, + BMesh *bm_if_freestyle) { BMLoop *ll, *lr = NULL; + ll = e->l; if (ll) { lr = e->l->radial_next; } - if (ll == lr || !lr) { - return LRT_EDGE_FLAG_CONTOUR; + FreestyleEdge *fel, *fer; + bool face_mark_filtered = false; + uint16_t edge_flag_result = 0; + + if (use_freestyle_face && rb->filter_face_mark) { + fel = CustomData_bmesh_get(&bm_if_freestyle->pdata, ll->f->head.data, CD_FREESTYLE_FACE); + if (ll != lr && lr) { + fer = CustomData_bmesh_get(&bm_if_freestyle->pdata, lr->f->head.data, CD_FREESTYLE_FACE); + } + else { + /* Handles mesh boundary case */ + fer = fel; + } + if (rb->filter_face_mark_boundaries ^ rb->filter_face_mark_invert) { + if ((fel->flag & FREESTYLE_FACE_MARK) || (fer->flag & FREESTYLE_FACE_MARK)) { + face_mark_filtered = true; + } + } + else { + if ((fel->flag & FREESTYLE_FACE_MARK) && (fer->flag & FREESTYLE_FACE_MARK) && (fer != fel)) { + face_mark_filtered = true; + } + } + if (rb->filter_face_mark_invert) { + face_mark_filtered = !face_mark_filtered; + } + if (!face_mark_filtered) { + return 0; + } + } + + /* Mesh boundary */ + if (!lr || ll == lr) { + return (edge_flag_result | LRT_EDGE_FLAG_CONTOUR); } LineartTriangle *tri1, *tri2; @@ -1430,7 +1504,6 @@ static char lineart_identify_feature_line(LineartRenderBuffer *rb, double *view_vector = vv; double dot_1 = 0, dot_2 = 0; double result; - FreestyleEdge *fe; if (rb->cam_is_persp) { sub_v3_v3v3_db(view_vector, l->gloc, rb->camera_pos); @@ -1443,24 +1516,25 @@ static char lineart_identify_feature_line(LineartRenderBuffer *rb, dot_2 = dot_v3v3_db(view_vector, tri2->gn); if ((result = dot_1 * dot_2) <= 0 && (dot_1 + dot_2)) { - return LRT_EDGE_FLAG_CONTOUR; + edge_flag_result |= LRT_EDGE_FLAG_CONTOUR; } if (rb->use_crease && (dot_v3v3_db(tri1->gn, tri2->gn) < crease_threshold)) { if (!no_crease) { - return LRT_EDGE_FLAG_CREASE; + edge_flag_result |= LRT_EDGE_FLAG_CREASE; } } - else if (rb->use_material && (ll->f->mat_nr != lr->f->mat_nr)) { - return LRT_EDGE_FLAG_MATERIAL; + if (rb->use_material && (ll->f->mat_nr != lr->f->mat_nr)) { + edge_flag_result |= LRT_EDGE_FLAG_MATERIAL; } - else if (count_freestyle && rb->use_edge_marks) { + if (use_freestyle_edge && rb->use_edge_marks) { + FreestyleEdge *fe; fe = CustomData_bmesh_get(&bm_if_freestyle->edata, e->head.data, CD_FREESTYLE_EDGE); if (fe->flag & FREESTYLE_EDGE_MARK) { - return LRT_EDGE_FLAG_EDGE_MARK; + edge_flag_result |= LRT_EDGE_FLAG_EDGE_MARK; } } - return 0; + return edge_flag_result; } static void lineart_add_edge_to_list(LineartRenderBuffer *rb, LineartEdge *e) @@ -1508,6 +1582,9 @@ static void lineart_add_edge_to_list_thread(LineartObjectInfo *obi, LineartEdge case LRT_EDGE_FLAG_INTERSECTION: LRT_ASSIGN_EDGE(intersection); break; + case LRT_EDGE_FLAG_FLOATING: + LRT_ASSIGN_EDGE(floating); + break; } #undef LRT_ASSIGN_EDGE } @@ -1524,6 +1601,7 @@ static void lineart_finalize_object_edge_list(LineartRenderBuffer *rb, LineartOb LRT_OBI_TO_RB(material); LRT_OBI_TO_RB(edge_mark); LRT_OBI_TO_RB(intersection); + LRT_OBI_TO_RB(floating); #undef LRT_OBI_TO_RB } @@ -1542,6 +1620,17 @@ static void lineart_triangle_adjacent_assign(LineartTriangle *tri, } } +static int lineart_edge_type_duplication_count(char eflag) +{ + int count = 0; + /* See eLineartEdgeFlag for details. */ + for (int i = 0; i < LRT_EDGE_FLAG_FLOATING; i++) { + if (eflag & (1 << i)) { + count++; + } + } + return count; +} static void lineart_geometry_object_load(LineartObjectInfo *obi, LineartRenderBuffer *rb) { BMesh *bm; @@ -1561,7 +1650,8 @@ static void lineart_geometry_object_load(LineartObjectInfo *obi, LineartRenderBu LineartEdgeSegment *o_la_s; LineartTriangle *ort; Object *orig_ob; - int CanFindFreestyle = 0; + bool can_find_freestyle_edge = false; + bool can_find_freestyle_face = false; int i; float use_crease = 0; @@ -1618,11 +1708,15 @@ static void lineart_geometry_object_load(LineartObjectInfo *obi, LineartRenderBu BM_mesh_elem_index_ensure(bm, BM_VERT | BM_EDGE | BM_FACE); if (CustomData_has_layer(&bm->edata, CD_FREESTYLE_EDGE)) { - CanFindFreestyle = 1; + can_find_freestyle_edge = 1; + } + if (CustomData_has_layer(&bm->pdata, CD_FREESTYLE_FACE)) { + can_find_freestyle_face = true; } - /* Only allocate memory for verts and tris as we don't know how many lines we will generate - * yet. */ + /* If we allow duplicated edges, one edge should get added multiple times if is has been + * classified as more than one edge type. This is so we can create multiple different line type + * chains containing the same edge. */ orv = lineart_mem_acquire_thread(&rb->render_data_pool, sizeof(LineartVert) * bm->totvert); ort = lineart_mem_acquire_thread(&rb->render_data_pool, bm->totface * rb->triangle_size); @@ -1635,7 +1729,7 @@ static void lineart_geometry_object_load(LineartObjectInfo *obi, LineartRenderBu eln->element_count = bm->totvert; eln->object_ref = orig_ob; - obi->v_reln = eln; + obi->v_eln = eln; if (orig_ob->lineart.flags & OBJECT_LRT_OWN_CREASE) { use_crease = cosf(M_PI - orig_ob->lineart.crease_threshold); @@ -1720,11 +1814,19 @@ static void lineart_geometry_object_load(LineartObjectInfo *obi, LineartRenderBu e = BM_edge_at_index(bm, i); /* Because e->head.hflag is char, so line type flags should not exceed positive 7 bits. */ - char eflag = lineart_identify_feature_line( - rb, e, ort, orv, use_crease, orig_ob->type == OB_FONT, CanFindFreestyle, bm); + char eflag = lineart_identify_feature_line(rb, + e, + ort, + orv, + use_crease, + orig_ob->type == OB_FONT, + can_find_freestyle_edge, + can_find_freestyle_face, + bm); if (eflag) { - /* Only allocate for feature lines (instead of all lines) to save memory. */ - allocate_la_e++; + /* Only allocate for feature lines (instead of all lines) to save memory. + * If allow duplicated edges, one edge gets added multiple times if it has multiple types. */ + allocate_la_e += rb->allow_duplicated_types ? lineart_edge_type_duplication_count(eflag) : 1; } /* Here we just use bm's flag for when loading actual lines, then we don't need to call * lineart_identify_feature_line() again, e->head.hflag deleted after loading anyway. Always @@ -1752,30 +1854,50 @@ static void lineart_geometry_object_load(LineartObjectInfo *obi, LineartRenderBu continue; } - la_e->v1 = &orv[BM_elem_index_get(e->v1)]; - la_e->v2 = &orv[BM_elem_index_get(e->v2)]; - la_e->v1_obindex = la_e->v1->index; - la_e->v2_obindex = la_e->v2->index; - if (e->l) { - int findex = BM_elem_index_get(e->l->f); - la_e->t1 = lineart_triangle_from_index(rb, ort, findex); - lineart_triangle_adjacent_assign(la_e->t1, &orta[findex], la_e); - if (e->l->radial_next && e->l->radial_next != e->l) { - findex = BM_elem_index_get(e->l->radial_next->f); - la_e->t2 = lineart_triangle_from_index(rb, ort, findex); - lineart_triangle_adjacent_assign(la_e->t2, &orta[findex], la_e); + bool edge_added = false; + + /* See eLineartEdgeFlag for details. */ + for (int flag_bit = 0; flag_bit < LRT_EDGE_FLAG_FLOATING; flag_bit++) { + char use_type = 1 << flag_bit; + if (!(use_type & e->head.hflag)) { + continue; + } + + la_e->v1 = &orv[BM_elem_index_get(e->v1)]; + la_e->v2 = &orv[BM_elem_index_get(e->v2)]; + la_e->v1_obindex = la_e->v1->index; + la_e->v2_obindex = la_e->v2->index; + if (e->l) { + int findex = BM_elem_index_get(e->l->f); + la_e->t1 = lineart_triangle_from_index(rb, ort, findex); + if (!edge_added) { + lineart_triangle_adjacent_assign(la_e->t1, &orta[findex], la_e); + } + if (e->l->radial_next && e->l->radial_next != e->l) { + findex = BM_elem_index_get(e->l->radial_next->f); + la_e->t2 = lineart_triangle_from_index(rb, ort, findex); + if (!edge_added) { + lineart_triangle_adjacent_assign(la_e->t2, &orta[findex], la_e); + } + } + } + la_e->flags = use_type; + la_e->object_ref = orig_ob; + BLI_addtail(&la_e->segments, la_s); + if (usage == OBJECT_LRT_INHERIT || usage == OBJECT_LRT_INCLUDE || + usage == OBJECT_LRT_NO_INTERSECTION) { + lineart_add_edge_to_list_thread(obi, la_e); } - } - la_e->flags = e->head.hflag; - la_e->object_ref = orig_ob; - BLI_addtail(&la_e->segments, la_s); - if (usage == OBJECT_LRT_INHERIT || usage == OBJECT_LRT_INCLUDE || - usage == OBJECT_LRT_NO_INTERSECTION) { - lineart_add_edge_to_list_thread(obi, la_e); - } - la_e++; - la_s++; + edge_added = true; + + la_e++; + la_s++; + + if (!rb->allow_duplicated_types) { + break; + } + } } /* always free bm as it's a copy from before threading */ @@ -1785,9 +1907,8 @@ static void lineart_geometry_object_load(LineartObjectInfo *obi, LineartRenderBu static void lineart_object_load_worker(TaskPool *__restrict UNUSED(pool), LineartObjectLoadTaskInfo *olti) { - LineartRenderBuffer *rb = olti->rb; for (LineartObjectInfo *obi = olti->pending; obi; obi = obi->next) { - lineart_geometry_object_load(obi, rb); + lineart_geometry_object_load(obi, olti->rb); } } @@ -1886,6 +2007,41 @@ static void lineart_geometry_load_assign_thread(LineartObjectLoadTaskInfo *olti_ use_olti->pending = obi; } +static bool lineart_geometry_check_visible(double (*model_view_proj)[4], Object *use_ob) +{ + BoundBox *bb = BKE_object_boundbox_get(use_ob); + if (!bb) { + /* For lights and empty stuff there will be no bbox. */ + return false; + } + + double co[8][4]; + double tmp[3]; + for (int i = 0; i < 8; i++) { + copy_v3db_v3fl(co[i], bb->vec[i]); + copy_v3_v3_db(tmp, co[i]); + mul_v4_m4v3_db(co[i], model_view_proj, tmp); + } + + bool cond[6] = {true, true, true, true, true, true}; + /* Because for a point to be inside clip space, it must satisfy `-Wc <= XYCc <= Wc`, here if all + * verts falls to the same side of the clip space border, we know it's outside view. */ + for (int i = 0; i < 8; i++) { + cond[0] &= (co[i][0] < -co[i][3]); + cond[1] &= (co[i][0] > co[i][3]); + cond[2] &= (co[i][1] < -co[i][3]); + cond[3] &= (co[i][1] > co[i][3]); + cond[4] &= (co[i][2] < -co[i][3]); + cond[5] &= (co[i][2] > co[i][3]); + } + for (int i = 0; i < 6; i++) { + if (cond[i]) { + return false; + } + } + return true; +} + static void lineart_main_load_geometries( Depsgraph *depsgraph, Scene *scene, @@ -1895,7 +2051,6 @@ static void lineart_main_load_geometries( { double proj[4][4], view[4][4], result[4][4]; float inv[4][4]; - Camera *cam = camera->data; float sensor = BKE_camera_sensor_size(cam->sensor_fit, cam->sensor_x, cam->sensor_y); int fit = BKE_camera_sensor_fit(cam->sensor_fit, rb->w, rb->h); @@ -1906,6 +2061,7 @@ static void lineart_main_load_geometries( if (G.debug_value == 4000) { t_start = PIL_check_seconds_timer(); } + int bound_box_discard_count = 0; if (cam->type == CAM_PERSP) { if (fit == CAMERA_SENSOR_FIT_VERT && asp > 1) { @@ -1957,16 +2113,27 @@ static void lineart_main_load_geometries( } Object *use_ob = DEG_get_evaluated_object(depsgraph, ob); + /* Prepare the matrix used for transforming this specific object (instance). This has to be + * done before mesh boundbox check because the function needs that. */ + mul_m4db_m4db_m4fl_uniq(obi->model_view_proj, rb->view_projection, ob->obmat); + mul_m4db_m4db_m4fl_uniq(obi->model_view, rb->view, ob->obmat); - if (!(use_ob->type == OB_MESH || use_ob->type == OB_MBALL || use_ob->type == OB_CURVE || - use_ob->type == OB_SURF || use_ob->type == OB_FONT)) { + if (!ELEM(use_ob->type, OB_MESH, OB_MBALL, OB_CURVE, OB_SURF, OB_FONT)) { continue; } + + if (!lineart_geometry_check_visible(obi->model_view_proj, use_ob)) { + if (G.debug_value == 4000) { + bound_box_discard_count++; + } + continue; + } + if (use_ob->type == OB_MESH) { use_mesh = use_ob->data; } else { - use_mesh = BKE_mesh_new_from_object(NULL, use_ob, false, true); + use_mesh = BKE_mesh_new_from_object(depsgraph, use_ob, true, true); } /* In case we still can not get any mesh geometry data from the object */ @@ -1978,9 +2145,7 @@ static void lineart_main_load_geometries( obi->free_use_mesh = true; } - /* Prepare the matrix used for transforming this specific object (instance). */ - mul_m4db_m4db_m4fl_uniq(obi->model_view_proj, rb->view_projection, ob->obmat); - mul_m4db_m4db_m4fl_uniq(obi->model_view, rb->view, ob->obmat); + /* Make normal matrix. */ float imat[4][4]; invert_m4_m4(imat, ob->obmat); transpose_m4(imat); @@ -2008,11 +2173,11 @@ static void lineart_main_load_geometries( for (int i = 0; i < thread_count; i++) { for (LineartObjectInfo *obi = olti[i].pending; obi; obi = obi->next) { - if (!obi->v_reln) { + if (!obi->v_eln) { continue; } - LineartVert *v = (LineartVert *)obi->v_reln->pointer; - int v_count = obi->v_reln->element_count; + LineartVert *v = (LineartVert *)obi->v_eln->pointer; + int v_count = obi->v_eln->element_count; for (int vi = 0; vi < v_count; vi++) { v[vi].index += global_i; } @@ -2024,6 +2189,7 @@ static void lineart_main_load_geometries( if (G.debug_value == 4000) { double t_elapsed = PIL_check_seconds_timer() - t_start; printf("Line art loading time: %lf\n", t_elapsed); + printf("Discarded %d object from bound box check\n", bound_box_discard_count); } } @@ -2084,7 +2250,7 @@ static bool lineart_edge_from_triangle(const LineartTriangle *tri, } /* Sorting three intersection points from min to max, - * the order for each intersection is set in lst[0] to lst[2].*/ + * the order for each intersection is set in `lst[0]` to `lst[2]`. */ #define INTERSECT_SORT_MIN_TO_MAX_3(ia, ib, ic, lst) \ { \ lst[0] = LRT_MIN3_INDEX(ia, ib, ic); \ @@ -2682,7 +2848,7 @@ static void lineart_triangle_intersect_in_bounding_area(LineartRenderBuffer *rb, double *G0 = tri->v[0]->gloc, *G1 = tri->v[1]->gloc, *G2 = tri->v[2]->gloc; - /* If this is not the smallest subdiv bounding area.*/ + /* If this is not the smallest subdiv bounding area. */ if (ba->child) { lineart_triangle_intersect_in_bounding_area(rb, tri, &ba->child[0]); lineart_triangle_intersect_in_bounding_area(rb, tri, &ba->child[1]); @@ -2759,6 +2925,7 @@ static void lineart_destroy_render_data(LineartRenderBuffer *rb) memset(&rb->intersection, 0, sizeof(ListBase)); memset(&rb->edge_mark, 0, sizeof(ListBase)); memset(&rb->material, 0, sizeof(ListBase)); + memset(&rb->floating, 0, sizeof(ListBase)); BLI_listbase_clear(&rb->chains); BLI_listbase_clear(&rb->wasted_cuts); @@ -2855,10 +3022,15 @@ static LineartRenderBuffer *lineart_create_render_buffer(Scene *scene, rb->fuzzy_everything = (lmd->calculation_flags & LRT_EVERYTHING_AS_CONTOUR) != 0; rb->allow_boundaries = (lmd->calculation_flags & LRT_ALLOW_CLIPPING_BOUNDARIES) != 0; rb->remove_doubles = (lmd->calculation_flags & LRT_REMOVE_DOUBLES) != 0; + rb->floating_as_contour = (lmd->calculation_flags & LRT_FLOATING_AS_CONTOUR) != 0; + rb->chain_floating_edges = (lmd->calculation_flags & LRT_CHAIN_FLOATING_EDGES) != 0; + rb->chain_geometry_space = (lmd->calculation_flags & LRT_CHAIN_GEOMETRY_SPACE) != 0; /* See lineart_edge_from_triangle() for how this option may impact performance. */ rb->allow_overlapping_edges = (lmd->calculation_flags & LRT_ALLOW_OVERLAPPING_EDGES) != 0; + rb->allow_duplicated_types = (lmd->calculation_flags & LRT_ALLOW_OVERLAP_EDGE_TYPES) != 0; + int16_t edge_types = lmd->edge_types_override; rb->use_contour = (edge_types & LRT_EDGE_FLAG_CONTOUR) != 0; @@ -2866,6 +3038,12 @@ static LineartRenderBuffer *lineart_create_render_buffer(Scene *scene, rb->use_material = (edge_types & LRT_EDGE_FLAG_MATERIAL) != 0; rb->use_edge_marks = (edge_types & LRT_EDGE_FLAG_EDGE_MARK) != 0; rb->use_intersections = (edge_types & LRT_EDGE_FLAG_INTERSECTION) != 0; + rb->use_floating = (edge_types & LRT_EDGE_FLAG_FLOATING) != 0; + + rb->filter_face_mark_invert = (lmd->calculation_flags & LRT_FILTER_FACE_MARK_INVERT) != 0; + rb->filter_face_mark = (lmd->calculation_flags & LRT_FILTER_FACE_MARK) != 0; + rb->filter_face_mark_boundaries = (lmd->calculation_flags & LRT_FILTER_FACE_MARK_BOUNDARIES) != + 0; rb->chain_data_pool = &lc->chain_data_pool; @@ -3912,6 +4090,8 @@ bool MOD_lineart_compute_feature_lines(Depsgraph *depsgraph, /* Do the perspective division after clipping is done. */ lineart_main_perspective_division(rb); + lineart_main_discard_out_of_frame_edges(rb); + /* Triangle intersections are done here during sequential adding of them. Only after this, * triangles and lines are all linked with acceleration structure, and the 2D occlusion stage * can do its job. */ @@ -3924,7 +4104,7 @@ bool MOD_lineart_compute_feature_lines(Depsgraph *depsgraph, /* "intersection_only" is preserved for being called in a standalone fashion. * If so the data will already be available at the stage. Otherwise we do the occlusion and - * chaining etc.*/ + * chaining etc. */ if (!intersections_only) { @@ -3977,6 +4157,7 @@ static int UNUSED_FUNCTION(lineart_rb_edge_types)(LineartRenderBuffer *rb) types |= rb->use_material ? LRT_EDGE_FLAG_MATERIAL : 0; types |= rb->use_edge_marks ? LRT_EDGE_FLAG_EDGE_MARK : 0; types |= rb->use_intersections ? LRT_EDGE_FLAG_INTERSECTION : 0; + types |= rb->use_floating ? LRT_EDGE_FLAG_FLOATING : 0; return types; } diff --git a/source/blender/gpencil_modifiers/intern/lineart/lineart_intern.h b/source/blender/gpencil_modifiers/intern/lineart/lineart_intern.h index e457d4a83a0..9d109320f09 100644 --- a/source/blender/gpencil_modifiers/intern/lineart/lineart_intern.h +++ b/source/blender/gpencil_modifiers/intern/lineart/lineart_intern.h @@ -98,6 +98,9 @@ void lineart_count_and_print_render_buffer_memory(struct LineartRenderBuffer *rb if (!e) { \ e = rb->intersection.first; \ } \ + if (!e) { \ + e = rb->floating.first; \ + } \ for (current_head = &rb->contour.first; e; e = next_e) { \ next_e = e->next; @@ -115,6 +118,9 @@ void lineart_count_and_print_render_buffer_memory(struct LineartRenderBuffer *rb else if (current_head == &rb->edge_mark.first) { \ current_head = &rb->intersection.first; \ } \ + else if (current_head == &rb->intersection.first) { \ + current_head = &rb->floating.first; \ + } \ else { \ break; \ } \ diff --git a/source/blender/gpu/GPU_viewport.h b/source/blender/gpu/GPU_viewport.h index 095e17f344e..8b2a14a1a96 100644 --- a/source/blender/gpu/GPU_viewport.h +++ b/source/blender/gpu/GPU_viewport.h @@ -43,7 +43,7 @@ typedef struct GPUViewport GPUViewport; struct GPUFrameBuffer; -/* Contains memory pools information */ +/* Contains memory pools information. */ typedef struct ViewportMemoryPool { struct BLI_memblock *commands; struct BLI_memblock *commands_small; @@ -62,21 +62,21 @@ typedef struct ViewportMemoryPool { uint ubo_len; } ViewportMemoryPool; -/* All FramebufferLists are just the same pointers with different names */ +/* All FramebufferLists are just the same pointers with different names. */ typedef struct FramebufferList { - struct GPUFrameBuffer *framebuffers[0]; + struct GPUFrameBuffer *framebuffers[1]; } FramebufferList; typedef struct TextureList { - struct GPUTexture *textures[0]; + struct GPUTexture *textures[1]; } TextureList; typedef struct PassList { - struct DRWPass *passes[0]; + struct DRWPass *passes[1]; } PassList; typedef struct StorageList { - void *storage[0]; /* custom structs from the engine */ + void *storage[1]; /* Custom structs from the engine. */ } StorageList; typedef struct ViewportEngineData { @@ -90,10 +90,10 @@ typedef struct ViewportEngineData { TextureList *txl_stereo; StorageList *stl_stereo; - /* we may want to put this elsewhere */ + /* We may want to put this elsewhere. */ struct DRWTextStore *text_draw_cache; - /* Profiling data */ + /* Profiling data. */ double init_time; double render_time; double background_time; @@ -141,7 +141,7 @@ void GPU_viewport_size_get(const GPUViewport *viewport, int size[2]); void GPU_viewport_size_set(GPUViewport *viewport, const int size[2]); void GPU_viewport_active_view_set(GPUViewport *viewport, int view); -/* Profiling */ +/* Profiling. */ double *GPU_viewport_cache_time_get(GPUViewport *viewport); void GPU_viewport_tag_update(GPUViewport *viewport); @@ -149,7 +149,7 @@ bool GPU_viewport_do_update(GPUViewport *viewport); GPUTexture *GPU_viewport_color_texture(GPUViewport *viewport, int view); -/* Texture pool */ +/* Texture pool. */ GPUTexture *GPU_viewport_texture_pool_query( GPUViewport *viewport, void *engine, int width, int height, int format); diff --git a/source/blender/gpu/intern/gpu_index_buffer_private.hh b/source/blender/gpu/intern/gpu_index_buffer_private.hh index e8a47417604..ed7dd830c8c 100644 --- a/source/blender/gpu/intern/gpu_index_buffer_private.hh +++ b/source/blender/gpu/intern/gpu_index_buffer_private.hh @@ -51,7 +51,7 @@ class IndexBuf { protected: /** Type of indices used inside this buffer. */ GPUIndexBufType index_type_ = GPU_INDEX_U32; - /** Offset in this buffer to the first index to render. Is 0 if not a subrange. */ + /** Offset in this buffer to the first index to render. Is 0 if not a subrange. */ uint32_t index_start_ = 0; /** Number of indices to render. */ uint32_t index_len_ = 0; diff --git a/source/blender/gpu/intern/gpu_select_pick.c b/source/blender/gpu/intern/gpu_select_pick.c index 89c94fd3ba5..7fb704c29dd 100644 --- a/source/blender/gpu/intern/gpu_select_pick.c +++ b/source/blender/gpu/intern/gpu_select_pick.c @@ -55,7 +55,7 @@ * SubRectStride */ -/* For looping over a sub-region of a rect, could be moved into 'rct.c'*/ +/* For looping over a sub-region of a rect, could be moved into 'rct.c'. */ typedef struct SubRectStride { uint start; /* start here */ uint span; /* read these */ @@ -230,7 +230,7 @@ typedef struct GPUPickState { /* cache on initialization */ uint (*buffer)[4]; - /* buffer size (stores number of integers, for actual size multiply by sizeof integer)*/ + /* Buffer size (stores number of integers, for actual size multiply by sizeof integer). */ uint bufsize; /* mode of operation */ char mode; @@ -484,7 +484,7 @@ bool gpu_select_pick_load_id(uint id, bool end) GPUFrameBuffer *fb = GPU_framebuffer_active_get(); GPU_framebuffer_read_depth( fb, UNPACK4(ps->gl.clip_readpixels), GPU_DATA_UINT, ps->gl.rect_depth_test->buf); - /* perform initial check since most cases the array remains unchanged */ + /* Perform initial check since most cases the array remains unchanged. */ bool do_pass = false; if (g_pick_state.mode == GPU_SELECT_PICK_ALL) { diff --git a/source/blender/gpu/intern/gpu_select_sample_query.cc b/source/blender/gpu/intern/gpu_select_sample_query.cc index 5d8689c0d6a..fc755568687 100644 --- a/source/blender/gpu/intern/gpu_select_sample_query.cc +++ b/source/blender/gpu/intern/gpu_select_sample_query.cc @@ -48,17 +48,17 @@ using namespace blender; using namespace blender::gpu; struct GPUSelectQueryState { - /* Tracks whether a query has been issued so that gpu_load_id can end the previous one */ + /* Tracks whether a query has been issued so that gpu_load_id can end the previous one. */ bool query_issued; /* GPU queries abstraction. Contains an array of queries. */ QueryPool *queries; /* Array holding the id corresponding id to each query. */ Vector<uint> *ids; - /* cache on initialization */ + /* Cache on initialization. */ uint (*buffer)[4]; - /* buffer size (stores number of integers, for actual size multiply by sizeof integer)*/ + /* Buffer size (stores number of integers, for actual size multiply by sizeof integer). */ uint bufsize; - /* mode of operation */ + /* Mode of operation. */ char mode; uint index; int oldhits; diff --git a/source/blender/gpu/intern/gpu_texture.cc b/source/blender/gpu/intern/gpu_texture.cc index 997064e82a2..de5a9f95b65 100644 --- a/source/blender/gpu/intern/gpu_texture.cc +++ b/source/blender/gpu/intern/gpu_texture.cc @@ -400,7 +400,7 @@ void GPU_texture_update(GPUTexture *tex, eGPUDataFormat data_format, const void } /* Makes data interpretation aware of the source layout. - * Skipping pixels correctly when changing rows when doing partial update.*/ + * Skipping pixels correctly when changing rows when doing partial update. */ void GPU_unpack_row_length_set(uint len) { Context::get()->state_manager->texture_unpack_row_length_set(len); diff --git a/source/blender/gpu/intern/gpu_vertex_buffer.cc b/source/blender/gpu/intern/gpu_vertex_buffer.cc index 3ecbb740a0c..2c21d2bf9af 100644 --- a/source/blender/gpu/intern/gpu_vertex_buffer.cc +++ b/source/blender/gpu/intern/gpu_vertex_buffer.cc @@ -229,7 +229,7 @@ void GPU_vertbuf_attr_fill(GPUVertBuf *verts_, uint a_idx, const void *data) GPU_vertbuf_attr_fill_stride(verts_, a_idx, stride, data); } -/** Fills a whole vertex (all attributes). Data must match packed layout. */ +/** Fills a whole vertex (all attributes). Data must match packed layout. */ void GPU_vertbuf_vert_set(GPUVertBuf *verts_, uint v_idx, const void *data) { VertBuf *verts = unwrap(verts_); diff --git a/source/blender/gpu/intern/gpu_vertex_format.cc b/source/blender/gpu/intern/gpu_vertex_format.cc index 8498da11507..78a119bcec8 100644 --- a/source/blender/gpu/intern/gpu_vertex_format.cc +++ b/source/blender/gpu/intern/gpu_vertex_format.cc @@ -284,7 +284,7 @@ void GPU_vertformat_safe_attr_name(const char *attr_name, char *r_safe_name, uin data[i] = attr_name[i]; } /* We use a hash to identify each data layer based on its name. - * NOTE: This is still prone to hash collision but the risks are very low.*/ + * NOTE: This is still prone to hash collision but the risks are very low. */ /* Start hashing after the first 2 chars. */ *(uint *)&data[4] = BLI_ghashutil_strhash_p_murmur(attr_name + 4); } @@ -306,7 +306,8 @@ void GPU_vertformat_safe_attr_name(const char *attr_name, char *r_safe_name, uin #endif } -/* Make attribute layout non-interleaved. +/** + * Make attribute layout non-interleaved. * Warning! This does not change data layout! * Use direct buffer access to fill the data. * This is for advanced usage. @@ -314,11 +315,11 @@ void GPU_vertformat_safe_attr_name(const char *attr_name, char *r_safe_name, uin * De-interleaved data means all attribute data for each attribute * is stored continuously like this: * 000011112222 - * instead of : + * instead of: * 012012012012 * - * Note this is per attribute de-interleaving, NOT per component. - * */ + * \note This is per attribute de-interleaving, NOT per component. + */ void GPU_vertformat_deinterleave(GPUVertFormat *format) { /* Ideally we should change the stride and offset here. This would allow diff --git a/source/blender/gpu/intern/gpu_viewport.c b/source/blender/gpu/intern/gpu_viewport.c index c118145ebd6..ddf31b6ffa7 100644 --- a/source/blender/gpu/intern/gpu_viewport.c +++ b/source/blender/gpu/intern/gpu_viewport.c @@ -284,7 +284,7 @@ static void gpu_viewport_engines_data_free(GPUViewport *viewport) MEM_freeN(data); - /* Mark as unused*/ + /* Mark as unused. */ viewport->engine_data[i].handle = NULL; } diff --git a/source/blender/gpu/opengl/gl_framebuffer.cc b/source/blender/gpu/opengl/gl_framebuffer.cc index 920dac407d7..e87b22985bd 100644 --- a/source/blender/gpu/opengl/gl_framebuffer.cc +++ b/source/blender/gpu/opengl/gl_framebuffer.cc @@ -86,7 +86,7 @@ GLFrameBuffer::~GLFrameBuffer() /* Restore default frame-buffer if this frame-buffer was bound. */ if (context_->active_fb == this && context_->back_left != this) { /* If this assert triggers it means the frame-buffer is being freed while in use by another - * context which, by the way, is TOTALLY UNSAFE!!! */ + * context which, by the way, is TOTALLY UNSAFE! */ BLI_assert(context_ == Context::get()); GPU_framebuffer_restore(); } diff --git a/source/blender/gpu/opengl/gl_immediate.cc b/source/blender/gpu/opengl/gl_immediate.cc index 63e3162944d..2f7fa5a78fc 100644 --- a/source/blender/gpu/opengl/gl_immediate.cc +++ b/source/blender/gpu/opengl/gl_immediate.cc @@ -155,7 +155,7 @@ void GLImmediate::end() GLContext::get()->state_manager->apply_state(); /* We convert the offset in vertex offset from the buffer's start. - * This works because we added some padding to align the first vertex vertex. */ + * This works because we added some padding to align the first vertex vertex. */ uint v_first = buffer_offset() / vertex_format.stride; GLVertArray::update_bindings( vao_id_, v_first, &vertex_format, reinterpret_cast<Shader *>(shader)->interface); diff --git a/source/blender/gpu/opengl/gl_texture.cc b/source/blender/gpu/opengl/gl_texture.cc index e2478a9976c..ddc45a6a904 100644 --- a/source/blender/gpu/opengl/gl_texture.cc +++ b/source/blender/gpu/opengl/gl_texture.cc @@ -79,7 +79,7 @@ bool GLTexture::init_internal() target_ = to_gl_target(type_); - /* We need to bind once to define the texture type. */ + /* We need to bind once to define the texture type. */ GLContext::state_manager_active_get()->texture_bind_temp(this); if (!this->proxy_check(0)) { @@ -106,7 +106,7 @@ bool GLTexture::init_internal(GPUVertBuf *vbo) GLVertBuf *gl_vbo = static_cast<GLVertBuf *>(unwrap(vbo)); target_ = to_gl_target(type_); - /* We need to bind once to define the texture type. */ + /* We need to bind once to define the texture type. */ GLContext::state_manager_active_get()->texture_bind_temp(this); GLenum internal_format = to_gl_internal_format(format_); diff --git a/source/blender/gpu/opengl/gl_texture.hh b/source/blender/gpu/opengl/gl_texture.hh index 9da27056269..dc048ea05c0 100644 --- a/source/blender/gpu/opengl/gl_texture.hh +++ b/source/blender/gpu/opengl/gl_texture.hh @@ -44,7 +44,7 @@ class GLTexture : public Texture { /** All samplers states. */ static GLuint samplers_[GPU_SAMPLER_MAX]; - /** Target to bind the texture to (GL_TEXTURE_1D, GL_TEXTURE_2D, etc...)*/ + /** Target to bind the texture to (#GL_TEXTURE_1D, #GL_TEXTURE_2D, etc...). */ GLenum target_ = -1; /** opengl identifier for texture. */ GLuint tex_id_ = 0; diff --git a/source/blender/gpu/shaders/gpu_shader_2D_widget_base_frag.glsl b/source/blender/gpu/shaders/gpu_shader_2D_widget_base_frag.glsl index 21c7f79a57c..6dd0201535d 100644 --- a/source/blender/gpu/shaders/gpu_shader_2D_widget_base_frag.glsl +++ b/source/blender/gpu/shaders/gpu_shader_2D_widget_base_frag.glsl @@ -36,6 +36,9 @@ vec3 compute_masks(vec2 uv) corner_rad = right_half ? outRoundCorners.y : outRoundCorners.x; } + /* Fade emboss at the border. */ + float emboss_size = upper_half ? 0.0 : min(1.0, uv_sdf.x / (corner_rad * ratio)); + /* Signed distance field from the corner (in pixel). * inner_sdf is sharp and outer_sdf is rounded. */ uv_sdf -= corner_rad; @@ -43,9 +46,6 @@ vec3 compute_masks(vec2 uv) float outer_sdf = -length(min(uv_sdf, 0.0)); float sdf = inner_sdf + outer_sdf + corner_rad; - /* Fade emboss at the border. */ - float emboss_size = clamp((upper_half) ? 0.0 : (uv.x / corner_rad), 0.0, 1.0); - /* Clamp line width to be at least 1px wide. This can happen if the projection matrix * has been scaled (i.e: Node editor)... */ float line_width = (lineWidth > 0.0) ? max(fwidth(uv.y), lineWidth) : 0.0; diff --git a/source/blender/gpu/shaders/gpu_shader_gpencil_stroke_geom.glsl b/source/blender/gpu/shaders/gpu_shader_gpencil_stroke_geom.glsl index da6e6502e62..b937323f62a 100644 --- a/source/blender/gpu/shaders/gpu_shader_gpencil_stroke_geom.glsl +++ b/source/blender/gpu/shaders/gpu_shader_gpencil_stroke_geom.glsl @@ -170,7 +170,7 @@ void main(void) length_b = finalThickness[2]; } - /* generate the start endcap (alpha < 0 used as endcap flag)*/ + /* Generate the start end-cap (alpha < 0 used as end-cap flag). */ float extend = (fill_stroke > 0) ? 2 : 1; if ((caps_start != GPENCIL_FLATCAP) && is_equal(P0, P2)) { mTexCoord = vec2(1, 0.5); @@ -211,7 +211,7 @@ void main(void) gl_Position = vec4((sp2 - length_b * miter_b) / Viewport, getZdepth(P2), 1.0); EmitVertex(); - /* generate the end endcap (alpha < 0 used as endcap flag)*/ + /* Generate the end end-cap (alpha < 0 used as end-cap flag). */ if ((caps_end != GPENCIL_FLATCAP) && is_equal(P1, P3)) { mTexCoord = vec2(0, 1); mColor = vec4(finalColor[2].rgb, finalColor[2].a * -1.0); diff --git a/source/blender/ikplugin/intern/iksolver_plugin.c b/source/blender/ikplugin/intern/iksolver_plugin.c index f569634defc..051bc193a42 100644 --- a/source/blender/ikplugin/intern/iksolver_plugin.c +++ b/source/blender/ikplugin/intern/iksolver_plugin.c @@ -149,7 +149,7 @@ static void initialize_posetree(struct Object *UNUSED(ob), bPoseChannel *pchan_t tree->iterations = MAX2(data->iterations, tree->iterations); tree->stretch = tree->stretch && !(data->flag & CONSTRAINT_IK_STRETCH); - /* skip common pose channels and add remaining*/ + /* Skip common pose channels and add remaining. */ size = MIN2(segcount, tree->totchannel); a = t = 0; while (a < size && t < tree->totchannel) { diff --git a/source/blender/ikplugin/intern/itasc_plugin.cpp b/source/blender/ikplugin/intern/itasc_plugin.cpp index eb31b0e9f87..b9411f6dd2d 100644 --- a/source/blender/ikplugin/intern/itasc_plugin.cpp +++ b/source/blender/ikplugin/intern/itasc_plugin.cpp @@ -315,7 +315,7 @@ static int initialize_chain(Object *ob, bPoseChannel *pchan_tip, bConstraint *co tree->iterations = MAX2(data->iterations, tree->iterations); tree->stretch = tree->stretch && !(data->flag & CONSTRAINT_IK_STRETCH); - /* skip common pose channels and add remaining*/ + /* Skip common pose channels and add remaining. */ size = MIN2(segcount, tree->totchannel); a = t = 0; while (a < size && t < tree->totchannel) { diff --git a/source/blender/imbuf/IMB_imbuf.h b/source/blender/imbuf/IMB_imbuf.h index 69a80d6e0d3..2cfce7b1ba0 100644 --- a/source/blender/imbuf/IMB_imbuf.h +++ b/source/blender/imbuf/IMB_imbuf.h @@ -299,17 +299,22 @@ void IMB_rectblend_threaded(struct ImBuf *dbuf, typedef enum IMB_Timecode_Type { /** Don't use time-code files at all. */ IMB_TC_NONE = 0, - /** use images in the order as they are recorded + /** + * Use images in the order as they are recorded * (currently, this is the only one implemented - * and is a sane default) */ + * and is a sane default). + */ IMB_TC_RECORD_RUN = 1, - /** Use global timestamp written by recording - * device (prosumer camcorders e.g. can do that). */ + /** + * Use global timestamp written by recording + * device (prosumer camcorders e.g. can do that). + */ IMB_TC_FREE_RUN = 2, - /** Interpolate a global timestamp using the + /** + * Interpolate a global timestamp using the * record date and time written by recording - * device (*every* consumer camcorder can do - * that :) )*/ + * device (*every* consumer camcorder can do that). + */ IMB_TC_INTERPOLATED_REC_DATE_FREE_RUN = 4, IMB_TC_RECORD_RUN_NO_GAPS = 8, IMB_TC_MAX_SLOT = 4, diff --git a/source/blender/imbuf/intern/cineon/logImageCore.c b/source/blender/imbuf/intern/cineon/logImageCore.c index 2d42609fdf5..73bcb8d7ebc 100644 --- a/source/blender/imbuf/intern/cineon/logImageCore.c +++ b/source/blender/imbuf/intern/cineon/logImageCore.c @@ -486,7 +486,7 @@ int logImageGetDataRGBA(LogImageFile *logImage, float *data, int dataIsLinearRGB } } - /* only one element, easy case, no need to do anything */ + /* Only one element, easy case, no need to do anything. */ if (logImage->numElements == 1) { returnValue = convertLogElementToRGBA( elementData[0], data, logImage, logImage->element[0], dataIsLinearRGB); diff --git a/source/blender/imbuf/intern/dds/ColorBlock.cpp b/source/blender/imbuf/intern/dds/ColorBlock.cpp index a05c7e2a70d..6974e0bf99d 100644 --- a/source/blender/imbuf/intern/dds/ColorBlock.cpp +++ b/source/blender/imbuf/intern/dds/ColorBlock.cpp @@ -113,9 +113,8 @@ void ColorBlock::init(uint w, uint h, const float *data, uint x, uint y) const uint idx = ((y + by) * w + x + bx); Color32 &c = color(e, i); - c.r = uint8(255 * CLAMP(data[idx + 0 * srcPlane], - 0.0f, - 1.0f)); /* @@ Is this the right way to quantize floats to bytes? */ + /* @@ Is this the right way to quantize floats to bytes? */ + c.r = uint8(255 * CLAMP(data[idx + 0 * srcPlane], 0.0f, 1.0f)); c.g = uint8(255 * CLAMP(data[idx + 1 * srcPlane], 0.0f, 1.0f)); c.b = uint8(255 * CLAMP(data[idx + 2 * srcPlane], 0.0f, 1.0f)); c.a = uint8(255 * CLAMP(data[idx + 3 * srcPlane], 0.0f, 1.0f)); @@ -155,7 +154,7 @@ void ColorBlock::swizzle(uint x, uint y, uint z, uint w) } /** Returns true if the block has a single color. */ -bool ColorBlock::isSingleColor(Color32 mask /*= Color32(0xFF, 0xFF, 0xFF, 0x00)*/) const +bool ColorBlock::isSingleColor(Color32 mask /*= Color32(0xFF, 0xFF, 0xFF, 0x00) */) const { uint u = m_color[0].u & mask.u; diff --git a/source/blender/imbuf/intern/dds/DirectDrawSurface.h b/source/blender/imbuf/intern/dds/DirectDrawSurface.h index b63d705dadf..381fa51f75c 100644 --- a/source/blender/imbuf/intern/dds/DirectDrawSurface.h +++ b/source/blender/imbuf/intern/dds/DirectDrawSurface.h @@ -120,7 +120,7 @@ struct DDSHeader { void setHasAlphaFlag(bool b); void setUserVersion(int version); - /*void swapBytes();*/ + // void swapBytes(); bool hasDX10Header() const; uint signature() const; diff --git a/source/blender/imbuf/intern/divers.c b/source/blender/imbuf/intern/divers.c index 47712456014..e6f42da1597 100644 --- a/source/blender/imbuf/intern/divers.c +++ b/source/blender/imbuf/intern/divers.c @@ -366,7 +366,7 @@ void IMB_buffer_byte_from_float_mask(uchar *rect_to, } } -/* byte to float pixels, input and output 4-channel RGBA */ +/* Byte to float pixels, input and output 4-channel RGBA. */ void IMB_buffer_float_from_byte(float *rect_to, const uchar *rect_from, int profile_to, diff --git a/source/blender/imbuf/intern/imageprocess.c b/source/blender/imbuf/intern/imageprocess.c index e2d469ab5a3..804c9c3eb89 100644 --- a/source/blender/imbuf/intern/imageprocess.c +++ b/source/blender/imbuf/intern/imageprocess.c @@ -181,7 +181,7 @@ void bilinear_interpolation_color_wrap( return; } - /* wrap interpolation pixels - main difference from bilinear_interpolation_color */ + /* Wrap interpolation pixels - main difference from #bilinear_interpolation_color. */ if (x1 < 0) { x1 = in->x + x1; } @@ -324,7 +324,7 @@ void nearest_interpolation_color_wrap( x = x % in->x; y = y % in->y; - /* wrap interpolation pixels - main difference from nearest_interpolation_color */ + /* Wrap interpolation pixels - main difference from #nearest_interpolation_color. */ if (x < 0) { x += in->x; } diff --git a/source/blender/imbuf/intern/indexer.c b/source/blender/imbuf/intern/indexer.c index a530acb15b0..71137a408d2 100644 --- a/source/blender/imbuf/intern/indexer.c +++ b/source/blender/imbuf/intern/indexer.c @@ -1118,7 +1118,7 @@ static AviMovie *alloc_proxy_output_avi( AviFormat format; double framerate; AviMovie *avi; - /* it doesn't really matter for proxies, but sane defaults help anyways...*/ + /* It doesn't really matter for proxies, but sane defaults help anyways. */ short frs_sec = 25; float frs_sec_base = 1.0; diff --git a/source/blender/imbuf/intern/iris.c b/source/blender/imbuf/intern/iris.c index 547af472d73..e62473fb8c7 100644 --- a/source/blender/imbuf/intern/iris.c +++ b/source/blender/imbuf/intern/iris.c @@ -237,10 +237,10 @@ static void test_endian_zbuf(struct ImBuf *ibuf) } } -/* from misc_util: flip the bytes from x */ +/* From misc_util: flip the bytes from x. */ #define GS(x) (((uchar *)(x))[0] << 8 | ((uchar *)(x))[1]) -/* this one is only def-ed once, strangely... */ +/* This one is only def-ed once, strangely... */ #define GSS(x) (((uchar *)(x))[1] << 8 | ((uchar *)(x))[0]) bool imb_is_a_iris(const uchar *mem, size_t size) diff --git a/source/blender/imbuf/intern/jp2.c b/source/blender/imbuf/intern/jp2.c index cf27557d043..117e0d97b2e 100644 --- a/source/blender/imbuf/intern/jp2.c +++ b/source/blender/imbuf/intern/jp2.c @@ -41,15 +41,15 @@ static const char J2K_HEAD[] = {0xFF, 0x4F, 0xFF, 0x51, 0x00}; /* We only need this because of how the presets are set */ /* this typedef is copied from 'openjpeg-1.5.0/applications/codec/image_to_j2k.c' */ typedef struct img_folder { - /** The directory path of the folder containing input images*/ + /** The directory path of the folder containing input images. */ char *imgdirpath; - /** Output format*/ + /** Output format. */ char *out_format; - /** Enable option*/ + /** Enable option. */ char set_imgdir; - /** Enable Cod Format for output*/ + /** Enable Cod Format for output. */ char set_out_format; - /** User specified rate stored in case of cinema option*/ + /** User specified rate stored in case of cinema option. */ float *rates; } img_fol_t; @@ -647,10 +647,10 @@ BLI_INLINE int DOWNSAMPLE_FLOAT_TO_16BIT(const float _val) /* ****************************** COPIED FROM image_to_j2k.c */ /* ----------------------------------------------------------------------- */ -#define CINEMA_24_CS 1302083 /*Codestream length for 24fps*/ -#define CINEMA_48_CS 651041 /*Codestream length for 48fps*/ -#define COMP_24_CS 1041666 /*Maximum size per color component for 2K & 4K @ 24fps*/ -#define COMP_48_CS 520833 /*Maximum size per color component for 2K @ 48fps*/ +#define CINEMA_24_CS 1302083 /* Codestream length for 24fps. */ +#define CINEMA_48_CS 651041 /* Codestream length for 48fps. */ +#define COMP_24_CS 1041666 /* Maximum size per color component for 2K & 4K @ 24fps. */ +#define COMP_48_CS 520833 /* Maximum size per color component for 2K @ 48fps. */ static int init_4K_poc(opj_poc_t *POC, int numres) { @@ -677,22 +677,22 @@ static void cinema_parameters(opj_cparameters_t *parameters) parameters->cp_tdx = 1; parameters->cp_tdy = 1; - /*Tile part*/ + /* Tile part. */ parameters->tp_flag = 'C'; parameters->tp_on = 1; - /*Tile and Image shall be at (0, 0)*/ + /* Tile and Image shall be at (0, 0). */ parameters->cp_tx0 = 0; parameters->cp_ty0 = 0; parameters->image_offset_x0 = 0; parameters->image_offset_y0 = 0; - /*Codeblock size = 32 * 32*/ + /* Codeblock size = 32 * 32. */ parameters->cblockw_init = 32; parameters->cblockh_init = 32; parameters->csty |= 0x01; - /*The progression order shall be CPRL*/ + /* The progression order shall be CPRL. */ parameters->prog_order = OPJ_CPRL; /* No ROI */ @@ -1118,7 +1118,7 @@ static opj_image_t *ibuftoimage(ImBuf *ibuf, opj_cparameters_t *parameters) } } else { - /* just use rect*/ + /* Just use rect. */ switch (prec) { case 8: if (numcomps == 4) { @@ -1223,7 +1223,7 @@ bool imb_save_jp2_stream(struct ImBuf *ibuf, opj_stream_t *stream, int UNUSED(fl /* compression ratio */ /* invert range, from 10-100, 100-1 - * where jpeg see's 1 and highest quality (lossless) and 100 is very low quality*/ + * Where jpeg see's 1 and highest quality (lossless) and 100 is very low quality. */ parameters.tcp_rates[0] = ((100 - quality) / 90.0f * 99.0f) + 1; parameters.tcp_numlayers = 1; /* only one resolution */ diff --git a/source/blender/imbuf/intern/openexr/openexr_api.cpp b/source/blender/imbuf/intern/openexr/openexr_api.cpp index 382d86f2645..ab578e25b94 100644 --- a/source/blender/imbuf/intern/openexr/openexr_api.cpp +++ b/source/blender/imbuf/intern/openexr/openexr_api.cpp @@ -930,7 +930,7 @@ void IMB_exrtile_begin_write( exr_printf("%s %-6s %-22s \"%s\"\n", "p", "view", "name", "internal_name"); exr_printf("---------------------------------------------------------------\n"); - /* assign channels */ + /* Assign channels. */ for (echan = (ExrChannel *)data->channels.first; echan; echan = echan->next) { /* Tiles are expected to be saved with full float currently. */ BLI_assert(echan->use_half_float == 0); diff --git a/source/blender/imbuf/intern/targa.c b/source/blender/imbuf/intern/targa.c index d7cefbbd077..2a7a189dd2b 100644 --- a/source/blender/imbuf/intern/targa.c +++ b/source/blender/imbuf/intern/targa.c @@ -427,7 +427,7 @@ static void complete_partial_load(struct ImBuf *ibuf, unsigned int *rect) printf("decodetarga: incomplete file, %.1f%% missing\n", 100 * ((float)size / (ibuf->x * ibuf->y))); - /* not essential but makes displaying partially rendered TGA's less ugly */ + /* Not essential but makes displaying partially rendered TGA's less ugly. */ memset(rect, 0, size); } else { @@ -465,7 +465,7 @@ static void decodetarga(struct ImBuf *ibuf, const unsigned char *mem, size_t mem } if (count >= 128) { - /*if (count == 128) printf("TARGA: 128 in file !\n");*/ + // if (count == 128) printf("TARGA: 128 in file !\n"); count -= 127; if (psize & 2) { @@ -475,14 +475,14 @@ static void decodetarga(struct ImBuf *ibuf, const unsigned char *mem, size_t mem cp[1] = mem[0]; cp[2] = mem[1]; cp[3] = mem[2]; - /*col = (mem[3] << 24) + (mem[0] << 16) + (mem[1] << 8) + mem[2];*/ + // col = (mem[3] << 24) + (mem[0] << 16) + (mem[1] << 8) + mem[2]; mem += 4; } else { cp[1] = mem[0]; cp[2] = mem[1]; cp[3] = mem[2]; - /*col = 0xff000000 + (mem[0] << 16) + (mem[1] << 8) + mem[2];*/ + // col = 0xff000000 + (mem[0] << 16) + (mem[1] << 8) + mem[2]; mem += 3; } } @@ -517,14 +517,14 @@ static void decodetarga(struct ImBuf *ibuf, const unsigned char *mem, size_t mem cp[1] = mem[0]; cp[2] = mem[1]; cp[3] = mem[2]; - /*col = (mem[3] << 24) + (mem[0] << 16) + (mem[1] << 8) + mem[2];*/ + // col = (mem[3] << 24) + (mem[0] << 16) + (mem[1] << 8) + mem[2]; mem += 4; } else { cp[1] = mem[0]; cp[2] = mem[1]; cp[3] = mem[2]; - /*col = 0xff000000 + (mem[0] << 16) + (mem[1] << 8) + mem[2];*/ + // col = 0xff000000 + (mem[0] << 16) + (mem[1] << 8) + mem[2]; mem += 3; } } @@ -594,7 +594,7 @@ static void ldtarga(struct ImBuf *ibuf, const unsigned char *mem, size_t mem_siz cp[1] = mem[0]; cp[2] = mem[1]; cp[3] = mem[2]; - /*col = (mem[3] << 24) + (mem[0] << 16) + (mem[1] << 8) + mem[2];*/ + // col = (mem[3] << 24) + (mem[0] << 16) + (mem[1] << 8) + mem[2]; mem += 4; } else { @@ -602,7 +602,7 @@ static void ldtarga(struct ImBuf *ibuf, const unsigned char *mem, size_t mem_siz cp[1] = mem[0]; cp[2] = mem[1]; cp[3] = mem[2]; - /*col = 0xff000000 + (mem[0] << 16) + (mem[1] << 8) + mem[2];*/ + // col = 0xff000000 + (mem[0] << 16) + (mem[1] << 8) + mem[2]; mem += 3; } } @@ -663,8 +663,8 @@ ImBuf *imb_loadtarga(const unsigned char *mem, cp[1] = cp[2] = 0; if (tga.mapsize) { - /* load color map */ - /*mincol = tga.maporig;*/ /*UNUSED*/ + /* Load color map. */ + // mincol = tga.maporig; /* UNUSED */ cmap_max = tga.mapsize; cmap = MEM_callocN(sizeof(unsigned int) * cmap_max, "targa cmap"); @@ -701,7 +701,7 @@ ImBuf *imb_loadtarga(const unsigned char *mem, } ibuf->planes = size; - if (tga.mapbits != 32) { /* set alpha bits */ + if (tga.mapbits != 32) { /* Set alpha bits. */ cmap[0] &= BIG_LONG(0x00ffffffl); } } diff --git a/source/blender/imbuf/intern/thumbs.c b/source/blender/imbuf/intern/thumbs.c index 7b4bf704096..db80d168e53 100644 --- a/source/blender/imbuf/intern/thumbs.c +++ b/source/blender/imbuf/intern/thumbs.c @@ -88,7 +88,7 @@ static bool get_thumb_dir(char *dir, ThumbSize size) const char *subdir; #ifdef WIN32 wchar_t dir_16[MAX_PATH]; - /* yes, applications shouldn't store data there, but so does GIMP :)*/ + /* Yes, applications shouldn't store data there, but so does GIMP :). */ SHGetSpecialFolderPathW(0, dir_16, CSIDL_PROFILE, 0); conv_utf_16_to_8(dir_16, dir, FILE_MAX); s += strlen(dir); @@ -144,8 +144,8 @@ static bool get_thumb_dir(char *dir, ThumbSize size) * \{ */ typedef enum { - UNSAFE_ALL = 0x1, /* Escape all unsafe characters */ - UNSAFE_ALLOW_PLUS = 0x2, /* Allows '+' */ + UNSAFE_ALL = 0x1, /* Escape all unsafe characters. */ + UNSAFE_ALLOW_PLUS = 0x2, /* Allows '+' */ UNSAFE_PATH = 0x8, /* Allows '/', '&', '=', ':', '@', '+', '$' and ',' */ UNSAFE_HOST = 0x10, /* Allows '/' and ':' and '@' */ UNSAFE_SLASHES = 0x20, /* Allows all characters except for '/' and '%' */ diff --git a/source/blender/imbuf/intern/thumbs_blend.c b/source/blender/imbuf/intern/thumbs_blend.c index b7b31b3e56a..eb518828913 100644 --- a/source/blender/imbuf/intern/thumbs_blend.c +++ b/source/blender/imbuf/intern/thumbs_blend.c @@ -47,7 +47,8 @@ ImBuf *IMB_thumb_load_blend(const char *blen_path, const char *blen_group, const if (blen_group && blen_id) { LinkNode *ln, *names, *lp, *previews = NULL; - struct BlendHandle *libfiledata = BLO_blendhandle_from_file(blen_path, NULL); + BlendFileReadReport bf_reports = {.reports = NULL}; + struct BlendHandle *libfiledata = BLO_blendhandle_from_file(blen_path, &bf_reports); int idcode = BKE_idtype_idcode_from_name(blen_group); int i, nprevs, nnames; diff --git a/source/blender/io/alembic/intern/abc_reader_object.cc b/source/blender/io/alembic/intern/abc_reader_object.cc index d428d98fdb9..00b73d29c5c 100644 --- a/source/blender/io/alembic/intern/abc_reader_object.cc +++ b/source/blender/io/alembic/intern/abc_reader_object.cc @@ -210,7 +210,7 @@ void AbcObjectReader::setupObjectTransform(const float time) Alembic::AbcGeom::IXform AbcObjectReader::xform() { - /* Check that we have an empty object (locator, bone head/tail...). */ + /* Check that we have an empty object (locator, bone head/tail...). */ if (IXform::matches(m_iobject.getMetaData())) { try { return IXform(m_iobject, Alembic::AbcGeom::kWrapExisting); diff --git a/source/blender/io/alembic/intern/alembic_capi.cc b/source/blender/io/alembic/intern/alembic_capi.cc index ad5a258f80c..e8d70bf3edb 100644 --- a/source/blender/io/alembic/intern/alembic_capi.cc +++ b/source/blender/io/alembic/intern/alembic_capi.cc @@ -737,7 +737,7 @@ void ABC_get_transform(CacheReader *reader, float r_mat_world[4][4], float time, /* Convert from the local matrix we obtain from Alembic to world coordinates * for Blender. This conversion is done here rather than by Blender due to * work around the non-standard interpretation of CONSTRAINT_SPACE_LOCAL in - * BKE_constraint_mat_convertspace(). */ + * BKE_constraint_mat_convertspace(). */ Object *object = abc_reader->object(); if (object->parent == nullptr) { /* No parent, so local space is the same as world space. */ diff --git a/source/blender/io/collada/ArmatureImporter.cpp b/source/blender/io/collada/ArmatureImporter.cpp index 5c3d6be589a..f36b9aacd8b 100644 --- a/source/blender/io/collada/ArmatureImporter.cpp +++ b/source/blender/io/collada/ArmatureImporter.cpp @@ -325,7 +325,7 @@ void ArmatureImporter::connect_bone_chains(bArmature *armature, BoneExtended *pbe = extended_bones[parentbone->name]; if (dominant_child != nullptr) { - /* Found a valid chain. Now connect current bone with that chain.*/ + /* Found a valid chain. Now connect current bone with that chain. */ EditBone *pebone = bc_get_edit_bone(armature, parentbone->name); EditBone *cebone = bc_get_edit_bone(armature, dominant_child->get_name()); if (pebone && !(cebone->flag & BONE_CONNECTED)) { @@ -341,7 +341,7 @@ void ArmatureImporter::connect_bone_chains(bArmature *armature, if (len_squared_v3(vec) > MINIMUM_BONE_LENGTH) { copy_v3_v3(pebone->tail, cebone->head); - pbe->set_tail(pebone->tail); /* to make fix_leafbone happy ...*/ + pbe->set_tail(pebone->tail); /* To make fix_leafbone happy. */ if (pbe && pbe->get_chain_length() >= this->import_settings->min_chain_length) { BoneExtended *cbe = extended_bones[cebone->name]; diff --git a/source/blender/io/collada/BCAnimationCurve.cpp b/source/blender/io/collada/BCAnimationCurve.cpp index 5065accf554..0e31e522ec4 100644 --- a/source/blender/io/collada/BCAnimationCurve.cpp +++ b/source/blender/io/collada/BCAnimationCurve.cpp @@ -314,7 +314,7 @@ void BCAnimationCurve::clean_handles() fcurve = get_edit_fcurve(); } - /* Keep old bezt data for copy)*/ + /* Keep old bezt data for copy). */ BezTriple *old_bezts = fcurve->bezt; int totvert = fcurve->totvert; fcurve->bezt = nullptr; diff --git a/source/blender/io/collada/BCAnimationSampler.cpp b/source/blender/io/collada/BCAnimationSampler.cpp index b2a9027380e..02a4e1f3167 100644 --- a/source/blender/io/collada/BCAnimationSampler.cpp +++ b/source/blender/io/collada/BCAnimationSampler.cpp @@ -488,7 +488,7 @@ void BCAnimationSampler::initialize_curves(BCAnimationCurveMap &curves, Object * } } - /* Add curves on Object->material actions*/ + /* Add curves on Object->material actions. */ object_type = BC_ANIMATION_TYPE_MATERIAL; for (int a = 0; a < ob->totcol; a++) { /* Export Material parameter animations. */ @@ -574,7 +574,7 @@ BCSample &BCSampleFrameContainer::add(Object *ob, int frame_index) /* Below are the getters which we need to export the data */ /* ====================================================== */ -/* Return either the BCSampleFrame or NULL if frame does not exist*/ +/* Return either the BCSampleFrame or NULL if frame does not exist. */ BCSampleFrame *BCSampleFrameContainer::get_frame(int frame_index) { BCSampleFrameMap::iterator it = sample_frames.find(frame_index); diff --git a/source/blender/io/collada/BCAnimationSampler.h b/source/blender/io/collada/BCAnimationSampler.h index 52c0c8aa29e..19b1bc35264 100644 --- a/source/blender/io/collada/BCAnimationSampler.h +++ b/source/blender/io/collada/BCAnimationSampler.h @@ -88,7 +88,7 @@ class BCSampleFrame { BCSample &add(Object *ob); - /* Following methods return NULL if object is not in the sampleMap*/ + /* Following methods return NULL if object is not in the sampleMap. */ const BCSample *get_sample(Object *ob) const; const BCMatrix *get_sample_matrix(Object *ob) const; const BCMatrix *get_sample_matrix(Object *ob, Bone *bone) const; diff --git a/source/blender/io/collada/BCMath.cpp b/source/blender/io/collada/BCMath.cpp index 0521fda5fb1..51c86ee53f2 100644 --- a/source/blender/io/collada/BCMath.cpp +++ b/source/blender/io/collada/BCMath.cpp @@ -67,8 +67,9 @@ BCMatrix::BCMatrix(BC_global_forward_axis global_forward_axis, BC_global_up_axis mat3_from_axis_conversion( BC_DEFAULT_FORWARD, BC_DEFAULT_UP, global_forward_axis, global_up_axis, mrot); - transpose_m3( - mrot); /* TODO: Verify that mat3_from_axis_conversion() returns a transposed matrix */ + /* TODO: Verify that `mat3_from_axis_conversion()` returns a transposed matrix */ + transpose_m3(mrot); + copy_m4_m3(mat, mrot); set_transform(mat); } diff --git a/source/blender/io/collada/DocumentImporter.h b/source/blender/io/collada/DocumentImporter.h index a6ed014a33c..8e553f1ce7a 100644 --- a/source/blender/io/collada/DocumentImporter.h +++ b/source/blender/io/collada/DocumentImporter.h @@ -77,11 +77,13 @@ class DocumentImporter : COLLADAFW::IWriter { */ void cancel(const COLLADAFW::String &errorMessage); - /** This is the method called. The writer hast to prepare to receive data.*/ + /** This is the method called. The writer hast to prepare to receive data. */ void start(); - /** This method is called after the last write* method. No other methods will be called after - * this.*/ + /** + * This method is called after the last write* method. + * No other methods will be called after this. + */ void finish(); bool writeGlobalAsset(const COLLADAFW::FileInfo *); diff --git a/source/blender/io/collada/GeometryExporter.cpp b/source/blender/io/collada/GeometryExporter.cpp index def7caabf32..382bb8a6e36 100644 --- a/source/blender/io/collada/GeometryExporter.cpp +++ b/source/blender/io/collada/GeometryExporter.cpp @@ -589,7 +589,7 @@ void GeometryExporter::createTexcoordsSource(std::string geom_id, Mesh *me) bool operator<(const Normal &a, const Normal &b) { - /* only needed to sort normal vectors and find() them later in a map.*/ + /* Only needed to sort normal vectors and find() them later in a map. */ return a.x < b.x || (a.x == b.x && (a.y < b.y || (a.y == b.y && a.z < b.z))); } diff --git a/source/blender/io/collada/MeshImporter.cpp b/source/blender/io/collada/MeshImporter.cpp index 172f9a468b4..a33256f9a59 100644 --- a/source/blender/io/collada/MeshImporter.cpp +++ b/source/blender/io/collada/MeshImporter.cpp @@ -573,7 +573,7 @@ void MeshImporter::mesh_add_edges(Mesh *mesh, int len) totedge = mesh->totedge + len; - /* update customdata */ + /* Update custom-data. */ CustomData_copy(&mesh->edata, &edata, CD_MASK_MESH.emask, CD_DEFAULT, totedge); CustomData_copy_data(&mesh->edata, &edata, 0, 0, mesh->totedge); diff --git a/source/blender/io/collada/SkinInfo.cpp b/source/blender/io/collada/SkinInfo.cpp index 12dee388a58..c2f17174d75 100644 --- a/source/blender/io/collada/SkinInfo.cpp +++ b/source/blender/io/collada/SkinInfo.cpp @@ -231,7 +231,7 @@ void SkinInfo::link_armature(bContext *C, amd->object = ob_arm; #if 1 - /* XXX Why do we enforce objects to be children of Armatures if they weren't so before ?*/ + /* XXX Why do we enforce objects to be children of Armatures if they weren't so before? */ if (!BKE_object_is_child_recursive(ob_arm, ob)) { bc_set_parent(ob, ob_arm, C); } diff --git a/source/blender/io/collada/collada_utils.cpp b/source/blender/io/collada/collada_utils.cpp index ceeffe070df..beb1b7308a6 100644 --- a/source/blender/io/collada/collada_utils.cpp +++ b/source/blender/io/collada/collada_utils.cpp @@ -636,7 +636,7 @@ void BoneExtended::set_bone_layers(std::string layerString, std::vector<std::str while (ss >> layer) { - /* Blender uses numbers to specify layers*/ + /* Blender uses numbers to specify layers. */ if (isInteger(layer)) { pos = atoi(layer.c_str()); if (pos >= 0 && pos < 32) { @@ -645,10 +645,10 @@ void BoneExtended::set_bone_layers(std::string layerString, std::vector<std::str } } - /* layer uses labels (not supported by blender). Map to layer numbers:*/ + /* Layer uses labels (not supported by blender). Map to layer numbers: */ pos = find(layer_labels.begin(), layer_labels.end(), layer) - layer_labels.begin(); if (pos >= layer_labels.size()) { - layer_labels.push_back(layer); /* remember layer number for future usage*/ + layer_labels.push_back(layer); /* Remember layer number for future usage. */ } if (pos > 31) { diff --git a/source/blender/io/gpencil/intern/gpencil_io_base.cc b/source/blender/io/gpencil/intern/gpencil_io_base.cc index a2c1b8f5af6..6c369382e0d 100644 --- a/source/blender/io/gpencil/intern/gpencil_io_base.cc +++ b/source/blender/io/gpencil/intern/gpencil_io_base.cc @@ -91,7 +91,7 @@ void GpencilIO::prepare_camera_params(Scene *scene, const GpencilIOParams *ipara BKE_camera_params_init(¶ms); BKE_camera_params_from_object(¶ms, cam_ob); - /* Compute matrix, viewplane, .. */ + /* Compute matrix, view-plane, etc. */ RenderData *rd = &scene_->r; BKE_camera_params_compute_viewplane(¶ms, rd->xsch, rd->ysch, rd->xasp, rd->yasp); BKE_camera_params_compute_matrix(¶ms); diff --git a/source/blender/io/gpencil/intern/gpencil_io_export_svg.cc b/source/blender/io/gpencil/intern/gpencil_io_export_svg.cc index 438263167ca..a9745415d40 100644 --- a/source/blender/io/gpencil/intern/gpencil_io_export_svg.cc +++ b/source/blender/io/gpencil/intern/gpencil_io_export_svg.cc @@ -295,7 +295,7 @@ void GpencilExporterSVG::export_stroke_to_path(bGPDlayer *gpl, const float2 screen_co = gpencil_3D_point_to_2D(&pt.x); txt.append(std::to_string(screen_co.x) + "," + std::to_string(screen_co.y)); } - /* Close patch (cyclic)*/ + /* Close patch (cyclic). */ if (gps->flag & GP_STROKE_CYCLIC) { txt.append("z"); } diff --git a/source/blender/io/gpencil/intern/gpencil_io_export_svg.hh b/source/blender/io/gpencil/intern/gpencil_io_export_svg.hh index 3bff31f20bf..6d8a0c2f6ac 100644 --- a/source/blender/io/gpencil/intern/gpencil_io_export_svg.hh +++ b/source/blender/io/gpencil/intern/gpencil_io_export_svg.hh @@ -62,7 +62,7 @@ class GpencilExporterSVG : public GpencilExporter { pugi::xml_document main_doc_; /* Main document node. */ pugi::xml_node main_node_; - /** Frame node */ + /** Frame node. */ pugi::xml_node frame_node_; void create_document_header(); void export_gpencil_layers(); diff --git a/source/blender/io/usd/intern/usd_writer_mesh.cc b/source/blender/io/usd/intern/usd_writer_mesh.cc index 17c41e0edc1..54316e56867 100644 --- a/source/blender/io/usd/intern/usd_writer_mesh.cc +++ b/source/blender/io/usd/intern/usd_writer_mesh.cc @@ -165,7 +165,7 @@ void USDGenericMeshWriter::write_mesh(HierarchyContext &context, Mesh *mesh) /* The material path will be of the form </_materials/{material name}>, which is outside the * sub-tree pointed to by ref_path. As a result, the referenced data is not allowed to point * out of its own sub-tree. It does work when we override the material with exactly the same - * path, though.*/ + * path, though. */ if (usd_export_context_.export_params.export_materials) { assign_materials(context, usd_mesh, usd_mesh_data.face_groups); } diff --git a/source/blender/makesdna/DNA_ID.h b/source/blender/makesdna/DNA_ID.h index dd262f78f6b..15a4f8817fd 100644 --- a/source/blender/makesdna/DNA_ID.h +++ b/source/blender/makesdna/DNA_ID.h @@ -79,8 +79,8 @@ typedef struct IDProperty { /** Note, alignment for 64 bits. */ IDPropertyData data; - /* array length, also (this is important!) string length + 1. - * the idea is to be able to reuse array realloc functions on strings.*/ + /* Array length, also (this is important!) string length + 1. + * the idea is to be able to reuse array realloc functions on strings. */ int len; /* Strings and arrays are both buffered, though the buffer isn't saved. */ @@ -141,7 +141,7 @@ enum { IDP_FLAG_GHOST = 1 << 7, }; -/* add any future new id property types here.*/ +/* add any future new id property types here. */ /* Static ID override structs. */ @@ -454,6 +454,10 @@ typedef struct PreviewImage { #define ID_TYPE_IS_COW(_id_type) \ (!ELEM(_id_type, ID_LI, ID_IP, ID_SCR, ID_VF, ID_BR, ID_WM, ID_PAL, ID_PC, ID_WS, ID_IM)) +/* Check whether data-block type requires copy-on-write from #ID_RECALC_PARAMETERS. + * Keep in sync with #BKE_id_eval_properties_copy. */ +#define ID_TYPE_SUPPORTS_PARAMS_WITHOUT_COW(id_type) ELEM(id_type, ID_ME) + #ifdef GS # undef GS #endif @@ -602,10 +606,18 @@ typedef enum IDRecalcFlag { * * When object of armature type gets tagged with this flag, its pose is * re-evaluated. + * * When object of other type is tagged with this flag it makes the modifier * stack to be re-evaluated. + * * When object data type (mesh, curve, ...) gets tagged with this flag it * makes all objects which shares this data-block to be updated. + * + * Note that the evaluation depends on the object-mode. + * So edit-mesh data for example only reevaluate with the updated edit-mesh. + * When geometry in the original ID has been modified #ID_RECALC_GEOMETRY_ALL_MODES + * must be used instead. + * * When a collection gets tagged with this flag, all objects depending on the geometry and * transforms on any of the objects in the collection are updated. */ ID_RECALC_GEOMETRY = (1 << 1), @@ -665,6 +677,10 @@ typedef enum IDRecalcFlag { ID_RECALC_AUDIO = (1 << 20), + /* NOTE: This triggers copy on write for types that require it. + * Exceptions to this can be added using #ID_TYPE_SUPPORTS_PARAMS_WITHOUT_COW, + * this has the advantage that large arrays stored in the idea data don't + * have to be copied on every update. */ ID_RECALC_PARAMETERS = (1 << 21), /* Input has changed and datablock is to be reload from disk. @@ -689,6 +705,11 @@ typedef enum IDRecalcFlag { * all dependent objects. */ ID_RECALC_ANIMATION_NO_FLUSH = ID_RECALC_COPY_ON_WRITE, + /* Ensure geometry of object and edit modes are both up-to-date in the evaluated data-block. + * Example usage is when mesh validation modifies the non-edit-mode data, + * which we want to be copied over to the evaluated data-block. */ + ID_RECALC_GEOMETRY_ALL_MODES = ID_RECALC_GEOMETRY | ID_RECALC_COPY_ON_WRITE, + /*************************************************************************** * Aggregate flags, use only for checks on runtime. * Do NOT use those for tagging. */ diff --git a/source/blender/makesdna/DNA_ID_enums.h b/source/blender/makesdna/DNA_ID_enums.h index 04cbf51dd62..45faf9e7f57 100644 --- a/source/blender/makesdna/DNA_ID_enums.h +++ b/source/blender/makesdna/DNA_ID_enums.h @@ -43,7 +43,7 @@ enum eIconSizes { /* big endian */ # define MAKE_ID2(c, d) ((c) << 8 | (d)) #else -/* little endian */ +/* little endian */ # define MAKE_ID2(c, d) ((d) << 8 | (c)) #endif @@ -86,7 +86,7 @@ typedef enum ID_Type { ID_MSK = MAKE_ID2('M', 'S'), /* Mask */ ID_LS = MAKE_ID2('L', 'S'), /* FreestyleLineStyle */ ID_PAL = MAKE_ID2('P', 'L'), /* Palette */ - ID_PC = MAKE_ID2('P', 'C'), /* PaintCurve */ + ID_PC = MAKE_ID2('P', 'C'), /* PaintCurve */ ID_CF = MAKE_ID2('C', 'F'), /* CacheFile */ ID_WS = MAKE_ID2('W', 'S'), /* WorkSpace */ ID_LP = MAKE_ID2('L', 'P'), /* LightProbe */ diff --git a/source/blender/makesdna/DNA_action_types.h b/source/blender/makesdna/DNA_action_types.h index a5ed870ee78..b6ffefb55e0 100644 --- a/source/blender/makesdna/DNA_action_types.h +++ b/source/blender/makesdna/DNA_action_types.h @@ -861,7 +861,7 @@ typedef enum eSAction_Flag { SACTION_NOTRANSKEYCULL = (1 << 4), /* don't include keyframes that are out of view */ // SACTION_HORIZOPTIMISEON = (1 << 5), // XXX deprecated... old irrelevant trick - /* show pose-markers (local to action) in Action Editor mode */ + /* show pose-markers (local to action) in Action Editor mode. */ SACTION_POSEMARKERS_SHOW = (1 << 6), /* don't draw action channels using group colors (where applicable) */ /* SACTION_NODRAWGCOLORS = (1 << 7), DEPRECATED */ diff --git a/source/blender/makesdna/DNA_anim_types.h b/source/blender/makesdna/DNA_anim_types.h index dffb3588de4..c02035be4ac 100644 --- a/source/blender/makesdna/DNA_anim_types.h +++ b/source/blender/makesdna/DNA_anim_types.h @@ -324,7 +324,7 @@ typedef struct DriverTarget { * (for vars where DTAR_FLAG_STRUCT_REF is used) - MAX_ID_NAME-2. */ char pchan_name[64]; - /** Transform channel index (for DVAR_TYPE_TRANSFORM_CHAN.)*/ + /** Transform channel index (for #DVAR_TYPE_TRANSFORM_CHAN). */ short transChan; /** Rotation channel calculation type. */ @@ -543,7 +543,7 @@ typedef enum eDriver_Types { /** Driver flags. */ typedef enum eDriver_Flags { - /** Driver has invalid settings (internal flag) */ + /** Driver has invalid settings (internal flag). */ DRIVER_FLAG_INVALID = (1 << 0), DRIVER_FLAG_DEPRECATED = (1 << 1), /** Driver does replace value, but overrides (for layering of animation over driver) */ @@ -647,15 +647,15 @@ typedef struct FCurve { /* user-editable flags/settings */ typedef enum eFCurve_Flags { - /** curve/keyframes are visible in editor */ + /** Curve/keyframes are visible in editor */ FCURVE_VISIBLE = (1 << 0), - /** curve is selected for editing */ + /** Curve is selected for editing. */ FCURVE_SELECTED = (1 << 1), - /** curve is active one */ + /** Curve is active one. */ FCURVE_ACTIVE = (1 << 2), - /** keyframes (beztriples) cannot be edited */ + /** Keyframes (beztriples) cannot be edited. */ FCURVE_PROTECTED = (1 << 3), - /** fcurve will not be evaluated for the next round */ + /** FCurve will not be evaluated for the next round. */ FCURVE_MUTED = (1 << 4), /** fcurve uses 'auto-handles', which stay horizontal... */ @@ -677,9 +677,9 @@ typedef enum eFCurve_Flags { /* extrapolation modes (only simple value 'extending') */ typedef enum eFCurve_Extend { - /** just extend min/max keyframe value */ + /** Just extend min/max keyframe value. */ FCURVE_EXTRAPOLATE_CONSTANT = 0, - /** just extend gradient of segment between first segment keyframes */ + /** Just extend gradient of segment between first segment keyframes. */ FCURVE_EXTRAPOLATE_LINEAR, } eFCurve_Extend; diff --git a/source/blender/makesdna/DNA_armature_types.h b/source/blender/makesdna/DNA_armature_types.h index 3d83d0d2f6f..f397b7f27b4 100644 --- a/source/blender/makesdna/DNA_armature_types.h +++ b/source/blender/makesdna/DNA_armature_types.h @@ -170,15 +170,15 @@ typedef enum eArmature_Flag { ARM_FLAG_UNUSED_7 = (1 << 7), ARM_MIRROR_EDIT = (1 << 8), ARM_FLAG_UNUSED_9 = (1 << 9), - /** made option negative, for backwards compat */ + /** Made option negative, for backwards compatibility. */ ARM_NO_CUSTOM = (1 << 10), - /** draw custom colors */ + /** Draw custom colors. */ ARM_COL_CUSTOM = (1 << 11), - /** when ghosting, only show selected bones (this should belong to ghostflag instead) */ + /** When ghosting, only show selected bones (this should belong to ghostflag instead). */ ARM_FLAG_UNUSED_12 = (1 << 12), /* cleared */ - /** dopesheet channel is expanded */ + /** Dope-sheet channel is expanded */ ARM_DS_EXPAND = (1 << 13), - /** other objects are used for visualizing various states (hack for efficient updates) */ + /** Other objects are used for visualizing various states (hack for efficient updates). */ ARM_HAS_VIZ_DEPS = (1 << 14), } eArmature_Flag; @@ -221,7 +221,7 @@ typedef enum eBone_Flag { BONE_TIPSEL = (1 << 2), /** Used instead of BONE_SELECTED during transform (clear before use) */ BONE_TRANSFORM = (1 << 3), - /** when bone has a parent, connect head of bone to parent's tail*/ + /** When bone has a parent, connect head of bone to parent's tail. */ BONE_CONNECTED = (1 << 4), /* 32 used to be quatrot, was always set in files, do not reuse unless you clear it always */ /** hidden Bones when drawing PoseChannels */ diff --git a/source/blender/makesdna/DNA_boid_types.h b/source/blender/makesdna/DNA_boid_types.h index 540446ccd9d..02a4d87498a 100644 --- a/source/blender/makesdna/DNA_boid_types.h +++ b/source/blender/makesdna/DNA_boid_types.h @@ -43,7 +43,7 @@ typedef enum eBoidRuleType { eBoidRuleType_Flock = 5, /** follow a boid or assigned object */ eBoidRuleType_FollowLeader = 6, - /** maintain speed, flight level or wander*/ + /** Maintain speed, flight level or wander. */ eBoidRuleType_AverageSpeed = 7, /** go to closest enemy and attack when in range */ eBoidRuleType_Fight = 8, diff --git a/source/blender/makesdna/DNA_brush_defaults.h b/source/blender/makesdna/DNA_brush_defaults.h index f1b083001cb..83d1bde2b11 100644 --- a/source/blender/makesdna/DNA_brush_defaults.h +++ b/source/blender/makesdna/DNA_brush_defaults.h @@ -94,7 +94,7 @@ .cursor_overlay_alpha = 33, \ .overlay_flags = 0, \ \ - /* brush appearance */ \ + /* Brush appearance. */ \ \ /* add mode color is light red */ \ .add_col = {1.0, 0.39, 0.39, 0.9}, \ diff --git a/source/blender/makesdna/DNA_brush_enums.h b/source/blender/makesdna/DNA_brush_enums.h index 5b8b429115a..d7b028dc7f1 100644 --- a/source/blender/makesdna/DNA_brush_enums.h +++ b/source/blender/makesdna/DNA_brush_enums.h @@ -25,7 +25,7 @@ extern "C" { #endif /* BrushGpencilSettings->preset_type. - * Use a range for each group and not continuous values.*/ + * Use a range for each group and not continuous values. */ typedef enum eGPBrush_Presets { GP_BRUSH_PRESET_UNKNOWN = 0, diff --git a/source/blender/makesdna/DNA_camera_types.h b/source/blender/makesdna/DNA_camera_types.h index 73a55edf05f..32ebcade76d 100644 --- a/source/blender/makesdna/DNA_camera_types.h +++ b/source/blender/makesdna/DNA_camera_types.h @@ -202,8 +202,10 @@ enum { CAM_BGIMG_FLAG_FOREGROUND = (1 << 4), /* Camera framing options */ - CAM_BGIMG_FLAG_CAMERA_ASPECT = (1 << 5), /* don't stretch to fit the camera view */ - CAM_BGIMG_FLAG_CAMERA_CROP = (1 << 6), /* crop out the image */ + /** Don't stretch to fit the camera view. */ + CAM_BGIMG_FLAG_CAMERA_ASPECT = (1 << 5), + /** Crop out the image. */ + CAM_BGIMG_FLAG_CAMERA_CROP = (1 << 6), /* Axis flip options */ CAM_BGIMG_FLAG_FLIP_X = (1 << 7), @@ -211,7 +213,7 @@ enum { }; /* CameraBGImage->source */ -/* may want to use 1 for select ?*/ +/* may want to use 1 for select? */ enum { CAM_BGIMG_SOURCE_IMAGE = 0, CAM_BGIMG_SOURCE_MOVIE = 1, diff --git a/source/blender/makesdna/DNA_cloth_types.h b/source/blender/makesdna/DNA_cloth_types.h index aae29e5fddc..e2eea5e5422 100644 --- a/source/blender/makesdna/DNA_cloth_types.h +++ b/source/blender/makesdna/DNA_cloth_types.h @@ -141,7 +141,7 @@ typedef struct ClothSimSettings { short solver_type; /** Vertex group for scaling bending stiffness. */ short vgroup_bend; - /** Optional vertexgroup name for assigning weight..*/ + /** Optional vertexgroup name for assigning weight. */ short vgroup_mass; /** Vertex group for scaling structural stiffness. */ short vgroup_struct; @@ -184,7 +184,7 @@ typedef struct ClothSimSettings { } ClothSimSettings; -/* SIMULATION FLAGS: goal flags,.. */ +/* SIMULATION FLAGS: goal flags, etc. */ /* These are the bits used in SimSettings.flags. */ typedef enum { /** Object is only collision object, no cloth simulation is done. */ diff --git a/source/blender/makesdna/DNA_constraint_types.h b/source/blender/makesdna/DNA_constraint_types.h index a94bc4625df..1e4fd2a70f2 100644 --- a/source/blender/makesdna/DNA_constraint_types.h +++ b/source/blender/makesdna/DNA_constraint_types.h @@ -51,9 +51,9 @@ typedef struct bConstraint { /** Constraint data (a valid constraint type). */ void *data; - /** Constraint type. */ + /** Constraint type. */ short type; - /** Flag - General Settings. */ + /** Flag - General Settings. */ short flag; /** Space that owner should be evaluated in. */ @@ -89,7 +89,7 @@ typedef struct bConstraint { float rot_error; } bConstraint; -/* Multiple-target constraints --------------------- */ +/* Multiple-target constraints --------------------- */ /* This struct defines a constraint target. * It is used during constraint solving regardless of how many targets the @@ -257,7 +257,7 @@ typedef struct bArmatureConstraint { ListBase targets; } bArmatureConstraint; -/* Single-target subobject constraints --------------------- */ +/* Single-target subobject constraints --------------------- */ /* Track To Constraint */ typedef struct bTrackToConstraint { @@ -517,7 +517,7 @@ typedef struct bPivotConstraint { short flag; } bPivotConstraint; -/* transform limiting constraints - zero target ---------------------------- */ +/* transform limiting constraints - zero target ---------------------------- */ /* Limit Location Constraint */ typedef struct bLocLimitConstraint { float xmin, xmax; @@ -721,7 +721,7 @@ typedef enum eBConstraint_Flags { CONSTRAINT_BBONE_SHAPE = (1 << 10), /* That constraint has been inserted in local override (i.e. it can be fully edited!). */ CONSTRAINT_OVERRIDE_LIBRARY_LOCAL = (1 << 11), - /* use full transformation (not just segment locations) - only set at runtime */ + /* use full transformation (not just segment locations) - only set at runtime. */ CONSTRAINT_BBONE_SHAPE_FULL = (1 << 12), } eBConstraint_Flags; @@ -1065,7 +1065,7 @@ typedef enum eTransformLimits_Flags2 { LIMIT_TRANSFORM = (1 << 1), } eTransformLimits_Flags2; -/* transform limiting constraints -> flag (own flags) */ +/* transform limiting constraints -> flag (own flags). */ typedef enum eTransformLimits_Flags { LIMIT_XMIN = (1 << 0), LIMIT_XMAX = (1 << 1), @@ -1075,7 +1075,7 @@ typedef enum eTransformLimits_Flags { LIMIT_ZMAX = (1 << 5), } eTransformLimits_Flags; -/* limit rotation constraint -> flag (own flags) */ +/* limit rotation constraint -> flag (own flags). */ typedef enum eRotLimit_Flags { LIMIT_XROT = (1 << 0), LIMIT_YROT = (1 << 1), diff --git a/source/blender/makesdna/DNA_curveprofile_types.h b/source/blender/makesdna/DNA_curveprofile_types.h index 450155a32e1..7c76251adc3 100644 --- a/source/blender/makesdna/DNA_curveprofile_types.h +++ b/source/blender/makesdna/DNA_curveprofile_types.h @@ -72,7 +72,7 @@ typedef struct CurveProfile { short segments_len; /** Preset to use when reset. */ int preset; - /** Sequence of points defining the shape of the curve. */ + /** Sequence of points defining the shape of the curve. */ CurveProfilePoint *path; /** Display and evaluation table at higher resolution for curves. */ CurveProfilePoint *table; diff --git a/source/blender/makesdna/DNA_customdata_types.h b/source/blender/makesdna/DNA_customdata_types.h index 973cf033305..0414128f6d0 100644 --- a/source/blender/makesdna/DNA_customdata_types.h +++ b/source/blender/makesdna/DNA_customdata_types.h @@ -72,7 +72,7 @@ typedef struct CustomData { CustomDataLayer *layers; /** * runtime only! - maps types to indices of first layer of that type, - * MUST be >= CD_NUMTYPES, but we cant use a define here. + * MUST be >= CD_NUMTYPES, but we can't use a define here. * Correct size is ensured in CustomData_update_typemap assert(). */ int typemap[52]; diff --git a/source/blender/makesdna/DNA_dynamicpaint_types.h b/source/blender/makesdna/DNA_dynamicpaint_types.h index e3dcd283efa..5f3c54a0482 100644 --- a/source/blender/makesdna/DNA_dynamicpaint_types.h +++ b/source/blender/makesdna/DNA_dynamicpaint_types.h @@ -156,7 +156,7 @@ typedef struct DynamicPaintSurface { /* canvas flags */ enum { - /** surface is already baking, so it wont get updated (loop) */ + /** surface is already baking, so it won't get updated (loop) */ MOD_DPAINT_BAKING = 1 << 1, }; diff --git a/source/blender/makesdna/DNA_effect_types.h b/source/blender/makesdna/DNA_effect_types.h index 307a212a139..3de13169616 100644 --- a/source/blender/makesdna/DNA_effect_types.h +++ b/source/blender/makesdna/DNA_effect_types.h @@ -27,30 +27,30 @@ extern "C" { #endif -/* don't forget, new effects also in writefile.c for dna!!! */ +/* Don't forget, new effects also in writefile.c for DNA! */ #define PAF_MAXMULT 4 -/* paf->flag (keep bit 0 free for compatibility) */ +/* paf->flag (keep bit 0 free for compatibility). */ #define PAF_BSPLINE 2 #define PAF_STATIC 4 #define PAF_FACE 8 #define PAF_ANIMATED 16 -/* show particles before they're emitted*/ +/* show particles before they're emitted. */ #define PAF_UNBORN 32 -/* emit only from faces*/ +/* Emit only from faces. */ #define PAF_OFACE 64 -/* show emitter (don't hide actual mesh)*/ +/* show emitter (don't hide actual mesh). */ #define PAF_SHOWE 128 -/* true random emit from faces (not just ordered jitter)*/ +/* true random emit from faces (not just ordered jitter). */ #define PAF_TRAND 256 -/* even distribution in face emission based on face areas*/ +/* even distribution in face emission based on face areas. */ #define PAF_EDISTR 512 -/*show particles after they've died*/ +/* Show particles after they've died. */ #define PAF_DIED 2048 -/*paf->flag2 for pos/neg paf->flag2neg*/ -#define PAF_TEXTIME 1 /*texture timing*/ +/* `paf->flag2` for pos/neg `paf->flag2neg`. */ +#define PAF_TEXTIME 1 /* Texture timing. */ /* eff->type */ #define EFF_BUILD 0 diff --git a/source/blender/makesdna/DNA_fluid_types.h b/source/blender/makesdna/DNA_fluid_types.h index e787b44e557..5e36c5673a4 100644 --- a/source/blender/makesdna/DNA_fluid_types.h +++ b/source/blender/makesdna/DNA_fluid_types.h @@ -289,7 +289,7 @@ enum { #define FLUID_NAME_PARTICLES "fluid_particles" #define FLUID_NAME_GUIDING "fluid_guiding" -/* Fluid object names.*/ +/* Fluid object names. */ #define FLUID_NAME_FLAGS "flags" /* == OpenVDB grid attribute name. */ #define FLUID_NAME_VELOCITY "velocity" /* == OpenVDB grid attribute name. */ #define FLUID_NAME_VEL "vel" @@ -813,8 +813,8 @@ typedef struct FluidFlowSettings { char uvlayer_name[64]; short vgroup_density; - short type; /* Smoke, flames, both, outflow, liquid. */ - short behavior; /* Inflow, outflow, static. */ + short type; /* Smoke, flames, both, outflow, liquid. */ + short behavior; /* Inflow, outflow, static. */ short source; short texture_type; short _pad3[3]; diff --git a/source/blender/makesdna/DNA_genfile.h b/source/blender/makesdna/DNA_genfile.h index 74d668a1081..57bfe281c8e 100644 --- a/source/blender/makesdna/DNA_genfile.h +++ b/source/blender/makesdna/DNA_genfile.h @@ -90,7 +90,7 @@ struct SDNA *DNA_sdna_from_data(const void *data, const char **r_error_message); void DNA_sdna_free(struct SDNA *sdna); -/* Access for current Blender versions SDNA*/ +/* Access for current Blender versions SDNA. */ void DNA_sdna_current_init(void); /* borrowed reference */ const struct SDNA *DNA_sdna_current_get(void); diff --git a/source/blender/makesdna/DNA_gpencil_modifier_types.h b/source/blender/makesdna/DNA_gpencil_modifier_types.h index 3977ad326da..f12d5e44a3c 100644 --- a/source/blender/makesdna/DNA_gpencil_modifier_types.h +++ b/source/blender/makesdna/DNA_gpencil_modifier_types.h @@ -873,9 +873,11 @@ typedef enum eLineartGpencilModifierSource { LRT_SOURCE_SCENE = 2, } eLineartGpencilModifierSource; +/* This enum is for modifier internal state only. */ typedef enum eLineArtGPencilModifierFlags { - LRT_GPENCIL_INVERT_SOURCE_VGROUP = (1 << 0), - LRT_GPENCIL_MATCH_OUTPUT_VGROUP = (1 << 1), + /* These two moved to #eLineartMainFlags to keep consistent with flag variable purpose. */ + /* LRT_GPENCIL_INVERT_SOURCE_VGROUP = (1 << 0), */ + /* LRT_GPENCIL_MATCH_OUTPUT_VGROUP = (1 << 1), */ LRT_GPENCIL_BINARY_WEIGHTS = (1 << 2) /* Deprecated, this is removed for lack of use case. */, LRT_GPENCIL_IS_BAKED = (1 << 3), LRT_GPENCIL_USE_CACHE = (1 << 4), @@ -925,13 +927,13 @@ typedef struct LineartGpencilModifierData { /** `0..PI` angle, for splitting strokes at sharp points. */ float angle_splitting_threshold; - /* CPU mode */ + /* Doubles as geometry threshold when geometry space chaining is enabled */ float chaining_image_threshold; /* Ported from SceneLineArt flags. */ int calculation_flags; - /* Additional Switches. */ + /* eLineArtGPencilModifierFlags, modifier internal state. */ int flags; /* Runtime data. */ diff --git a/source/blender/makesdna/DNA_gpencil_types.h b/source/blender/makesdna/DNA_gpencil_types.h index 6b7b89e91fa..d0ae50d09ef 100644 --- a/source/blender/makesdna/DNA_gpencil_types.h +++ b/source/blender/makesdna/DNA_gpencil_types.h @@ -309,7 +309,7 @@ typedef struct bGPDstroke { float uv_translation[2]; float uv_scale; - /** Stroke selection index.*/ + /** Stroke selection index. */ int select_index; char _pad4[4]; @@ -557,7 +557,7 @@ typedef enum eGPDlayer_Flag { /* Unlock color */ GP_LAYER_UNLOCK_COLOR = (1 << 12), /* Mask Layer */ - GP_LAYER_USE_MASK = (1 << 13), /*TODO: DEPRECATED */ + GP_LAYER_USE_MASK = (1 << 13), /* TODO: DEPRECATED */ /* Ruler Layer */ GP_LAYER_IS_RULER = (1 << 14), /* Disable masks in viewlayer render */ @@ -614,7 +614,7 @@ typedef struct bGPdata_Runtime { /** Vertex Color applied to Fill (while drawing). */ float vert_color_fill[4]; - /** Arrow points for stroke corners **/ + /** Arrow points for stroke corners. */ float arrow_start[8]; float arrow_end[8]; /* Arrow style for each corner */ diff --git a/source/blender/makesdna/DNA_ipo_types.h b/source/blender/makesdna/DNA_ipo_types.h index c5e207c4e20..0552c449819 100644 --- a/source/blender/makesdna/DNA_ipo_types.h +++ b/source/blender/makesdna/DNA_ipo_types.h @@ -432,10 +432,10 @@ typedef struct Ipo { #define PART_TOTNAM 25 #define PART_EMIT_FREQ 1 -/* #define PART_EMIT_LIFE 2 */ /*UNUSED*/ +// #define PART_EMIT_LIFE 2 /* UNUSED */ #define PART_EMIT_VEL 3 #define PART_EMIT_AVE 4 -/* #define PART_EMIT_SIZE 5 */ /*UNUSED*/ +// #define PART_EMIT_SIZE 5 /* UNUSED */ #define PART_AVE 6 #define PART_SIZE 7 @@ -511,7 +511,7 @@ typedef struct Ipo { /* ---------- IPO Drivers ----------- */ -/* offset in driver->name for finding second posechannel for rot-diff */ +/* Offset in driver->name for finding second posechannel for rot-diff. */ #define DRIVER_NAME_OFFS 32 /* driver->type */ diff --git a/source/blender/makesdna/DNA_key_types.h b/source/blender/makesdna/DNA_key_types.h index 9789d0d3520..228a1024721 100644 --- a/source/blender/makesdna/DNA_key_types.h +++ b/source/blender/makesdna/DNA_key_types.h @@ -46,10 +46,10 @@ typedef struct KeyBlock { * so this value increments by 0.1f per frame. */ float pos; - /** influence (typically [0 - 1] but can be more), (Key->type == KEY_RELATIVE) only.*/ + /** influence (typically [0 - 1] but can be more), `(Key->type == KEY_RELATIVE)` only. */ float curval; - /** interpolation type (Key->type == KEY_NORMAL) only. */ + /** Interpolation type `(Key->type == KEY_NORMAL)` only. */ short type; char _pad1[2]; @@ -62,7 +62,7 @@ typedef struct KeyBlock { /** for meshes only, match the unique number with the customdata layer */ int uid; - /** array of shape key values, size is (Key->elemsize * KeyBlock->totelem) */ + /** array of shape key values, size is `(Key->elemsize * KeyBlock->totelem)` */ void *data; /** MAX_NAME (unique name, user assigned) */ char name[64]; @@ -81,7 +81,7 @@ typedef struct Key { struct AnimData *adt; /** - * commonly called 'Basis', (Key->type == KEY_RELATIVE) only. + * commonly called 'Basis', `(Key->type == KEY_RELATIVE)` only. * Looks like this is _always_ 'key->block.first', * perhaps later on it could be defined as some other KeyBlock - campbell */ diff --git a/source/blender/makesdna/DNA_lightprobe_types.h b/source/blender/makesdna/DNA_lightprobe_types.h index 48e3c44e2c9..038de8e49cc 100644 --- a/source/blender/makesdna/DNA_lightprobe_types.h +++ b/source/blender/makesdna/DNA_lightprobe_types.h @@ -106,7 +106,7 @@ enum { LIGHTPROBE_DISP_REFLECTIVE = 3, }; -/* Probe->parallax && Probe->attenuation_type*/ +/* Probe->parallax && Probe->attenuation_type. */ enum { LIGHTPROBE_SHAPE_ELIPSOID = 0, LIGHTPROBE_SHAPE_BOX = 1, diff --git a/source/blender/makesdna/DNA_lineart_types.h b/source/blender/makesdna/DNA_lineart_types.h index 860a6579bf7..3a3af622dd5 100644 --- a/source/blender/makesdna/DNA_lineart_types.h +++ b/source/blender/makesdna/DNA_lineart_types.h @@ -39,6 +39,7 @@ * Edge flags and usage flags are used by with scene/object/gpencil modifier bits, and those values * needs to stay consistent throughout. */ +/* These flags are used for 1 time calculation, not stroke selection afterwards. */ typedef enum eLineartMainFlags { LRT_INTERSECTION_AS_CONTOUR = (1 << 0), LRT_EVERYTHING_AS_CONTOUR = (1 << 1), @@ -46,6 +47,15 @@ typedef enum eLineartMainFlags { LRT_ALLOW_OVERLAPPING_EDGES = (1 << 3), LRT_ALLOW_CLIPPING_BOUNDARIES = (1 << 4), LRT_REMOVE_DOUBLES = (1 << 5), + LRT_FLOATING_AS_CONTOUR = (1 << 6), + LRT_GPENCIL_INVERT_SOURCE_VGROUP = (1 << 7), + LRT_GPENCIL_MATCH_OUTPUT_VGROUP = (1 << 8), + LRT_FILTER_FACE_MARK = (1 << 9), + LRT_FILTER_FACE_MARK_INVERT = (1 << 10), + LRT_FILTER_FACE_MARK_BOUNDARIES = (1 << 11), + LRT_CHAIN_FLOATING_EDGES = (1 << 12), + LRT_CHAIN_GEOMETRY_SPACE = (1 << 13), + LRT_ALLOW_OVERLAP_EDGE_TYPES = (1 << 14), } eLineartMainFlags; typedef enum eLineartEdgeFlag { diff --git a/source/blender/makesdna/DNA_material_types.h b/source/blender/makesdna/DNA_material_types.h index 55d5ea202f7..5bc8370a159 100644 --- a/source/blender/makesdna/DNA_material_types.h +++ b/source/blender/makesdna/DNA_material_types.h @@ -40,7 +40,7 @@ struct Image; struct Ipo; struct bNodeTree; -/* WATCH IT: change type? also make changes in ipo.h */ +/* WATCH IT: change type? also make changes in ipo.h */ typedef struct TexPaintSlot { /** Image to be painted on. */ diff --git a/source/blender/makesdna/DNA_mesh_types.h b/source/blender/makesdna/DNA_mesh_types.h index 3eb5920dfe6..144e4594c98 100644 --- a/source/blender/makesdna/DNA_mesh_types.h +++ b/source/blender/makesdna/DNA_mesh_types.h @@ -141,7 +141,7 @@ typedef struct Mesh { struct MSelect *mselect; /* BMESH ONLY */ - /*new face structures*/ + /* New face structures. */ struct MPoly *mpoly; struct MLoop *mloop; struct MLoopUV *mloopuv; @@ -276,7 +276,7 @@ enum { #define ME_USING_MIRROR_X_VERTEX_GROUPS(_me) \ (((_me)->editflag & ME_EDIT_MIRROR_VERTEX_GROUPS) && ((_me)->symmetry & ME_SYMMETRY_X)) -/* We cant have both flags enabled at once, +/* We can't have both flags enabled at once, * flags defined in DNA_scene_types.h */ #define ME_EDIT_PAINT_SEL_MODE(_me) \ (((_me)->editflag & ME_EDIT_PAINT_FACE_SEL) ? \ @@ -296,7 +296,7 @@ enum { ME_REMESH_REPROJECT_VERTEX_COLORS = 1 << 8, ME_DS_EXPAND = 1 << 9, ME_SCULPT_DYNAMIC_TOPOLOGY = 1 << 10, - ME_REMESH_SMOOTH_NORMALS = 1 << 11, + ME_FLAG_UNUSED_8 = 1 << 11, /* cleared */ ME_REMESH_REPROJECT_PAINT_MASK = 1 << 12, ME_REMESH_FIX_POLES = 1 << 13, ME_REMESH_REPROJECT_VOLUME = 1 << 14, diff --git a/source/blender/makesdna/DNA_meshdata_types.h b/source/blender/makesdna/DNA_meshdata_types.h index eb31f7a72ad..3c134ebb06c 100644 --- a/source/blender/makesdna/DNA_meshdata_types.h +++ b/source/blender/makesdna/DNA_meshdata_types.h @@ -130,7 +130,7 @@ typedef struct MLoop { /** * Optionally store the order of selected elements. - * This wont always be set since only some selection operations have an order. + * This won't always be set since only some selection operations have an order. * * Typically accessed from #Mesh.mselect */ diff --git a/source/blender/makesdna/DNA_meta_types.h b/source/blender/makesdna/DNA_meta_types.h index a991f654b09..d257363b6ef 100644 --- a/source/blender/makesdna/DNA_meta_types.h +++ b/source/blender/makesdna/DNA_meta_types.h @@ -106,7 +106,7 @@ typedef struct MetaBall { float thresh; /* used in editmode */ - /*ListBase edit_elems;*/ + // ListBase edit_elems; MetaElem *lastelem; void *batch_cache; diff --git a/source/blender/makesdna/DNA_modifier_types.h b/source/blender/makesdna/DNA_modifier_types.h index 17a42d70a75..c797ddbc925 100644 --- a/source/blender/makesdna/DNA_modifier_types.h +++ b/source/blender/makesdna/DNA_modifier_types.h @@ -217,7 +217,7 @@ typedef struct LatticeModifierData { char _pad[2]; } LatticeModifierData; -/*Lattice modifier flags */ +/* Lattice modifier flags. */ enum { MOD_LATTICE_INVERT_VGROUP = (1 << 0), }; @@ -299,13 +299,13 @@ enum { typedef struct ArrayModifierData { ModifierData modifier; - /* the object with which to cap the start of the array */ + /* the object with which to cap the start of the array. */ struct Object *start_cap; - /* the object with which to cap the end of the array */ + /* the object with which to cap the end of the array. */ struct Object *end_cap; - /* the curve object to use for MOD_ARR_FITCURVE */ + /* the curve object to use for MOD_ARR_FITCURVE. */ struct Object *curve_ob; - /* the object to use for object offset */ + /* the object to use for object offset. */ struct Object *offset_ob; /* a constant duplicate offset; * 1 means the duplicates are 1 unit apart diff --git a/source/blender/makesdna/DNA_object_fluidsim_types.h b/source/blender/makesdna/DNA_object_fluidsim_types.h index b8848ccc458..1198983c898 100644 --- a/source/blender/makesdna/DNA_object_fluidsim_types.h +++ b/source/blender/makesdna/DNA_object_fluidsim_types.h @@ -44,7 +44,7 @@ typedef struct FluidsimSettings { char _pad1[4]; /* domain, fluid or obstacle */ short type; - /* display advanced options in fluid sim tab (on=1, off=0)*/ + /* Display advanced options in fluid sim tab (on=1, off=0). */ short show_advancedoptions; /* domain object settings */ diff --git a/source/blender/makesdna/DNA_object_force_types.h b/source/blender/makesdna/DNA_object_force_types.h index 3d8418fb734..fcaac4ded76 100644 --- a/source/blender/makesdna/DNA_object_force_types.h +++ b/source/blender/makesdna/DNA_object_force_types.h @@ -279,7 +279,7 @@ typedef struct SoftBody { /* ---------------------------------------------------- */ float secondspring; - /* self collision*/ + /* Self collision. */ /** Fixed collision ball size if > 0. */ float colball; /** Cooling down collision response. */ @@ -319,7 +319,7 @@ typedef struct SoftBody { /* pd->flag: various settings */ #define PFIELD_USEMAX (1 << 0) -/*#define PDEFLE_DEFORM (1 << 1)*/ /*UNUSED*/ +// #define PDEFLE_DEFORM (1 << 1) /* UNUSED */ /** TODO: do_versions for below */ #define PFIELD_GUIDE_PATH_ADD (1 << 2) /** used for do_versions */ diff --git a/source/blender/makesdna/DNA_object_types.h b/source/blender/makesdna/DNA_object_types.h index 9951bdefbbb..8d861647bd2 100644 --- a/source/blender/makesdna/DNA_object_types.h +++ b/source/blender/makesdna/DNA_object_types.h @@ -66,7 +66,7 @@ typedef struct bDeformGroup { char flag, _pad0[7]; } bDeformGroup; -/* Face Maps*/ +/* Face Maps. */ typedef struct bFaceMap { struct bFaceMap *next, *prev; /** MAX_VGROUP_NAME. */ @@ -476,7 +476,7 @@ typedef struct ObHook { /* **************** OBJECT ********************* */ -/* used many places... should be specialized */ +/* used many places, should be specialized. */ #define SELECT 1 #define OBJECT_ACTIVE_MODIFIER_NONE -1 @@ -608,9 +608,9 @@ enum { /* OB_DRAWIMAGE = 1 << 4, */ /* UNUSED */ /* for solid+wire display */ OB_DRAWWIRE = 1 << 5, - /* for overdraw s*/ + /* For overdrawing. */ OB_DRAW_IN_FRONT = 1 << 6, - /* enable transparent draw */ + /* Enable transparent draw. */ OB_DRAWTRANSP = 1 << 7, OB_DRAW_ALL_EDGES = 1 << 8, /* only for meshes currently */ OB_DRAW_NO_SHADOW_CAST = 1 << 9, @@ -646,9 +646,9 @@ enum { OB_BOUND_SPHERE = 1, OB_BOUND_CYLINDER = 2, OB_BOUND_CONE = 3, - /* OB_BOUND_TRIANGLE_MESH = 4, */ /* UNUSED */ - /* OB_BOUND_CONVEX_HULL = 5, */ /* UNUSED */ - /* OB_BOUND_DYN_MESH = 6, */ /*UNUSED*/ + // OB_BOUND_TRIANGLE_MESH = 4, /* UNUSED */ + // OB_BOUND_CONVEX_HULL = 5, /* UNUSED */ + // OB_BOUND_DYN_MESH = 6, /* UNUSED */ OB_BOUND_CAPSULE = 7, }; diff --git a/source/blender/makesdna/DNA_particle_types.h b/source/blender/makesdna/DNA_particle_types.h index 30b1fbe09d3..0253de9f9d1 100644 --- a/source/blender/makesdna/DNA_particle_types.h +++ b/source/blender/makesdna/DNA_particle_types.h @@ -157,7 +157,7 @@ typedef struct ParticleData { } ParticleData; typedef struct SPHFluidSettings { - /*Particle Fluid*/ + /* Particle Fluid. */ float radius, spring_k, rest_length; float plasticity_constant, yield_ratio; float plasticity_balance, yield_balance; @@ -479,8 +479,8 @@ enum { #define PART_HAIR_REGROW 16 /* regrow hair for each frame */ -#define PART_UNBORN 32 /*show unborn particles*/ -#define PART_DIED 64 /*show died particles*/ +#define PART_UNBORN 32 /* Show unborn particles. */ +#define PART_DIED 64 /* Show died particles. */ #define PART_TRAND 128 #define PART_EDISTR 256 /* particle/face from face areas */ @@ -508,7 +508,7 @@ enum { #define PART_CHILD_EFFECT (1 << 27) #define PART_CHILD_LONG_HAIR (1 << 28) -/* #define PART_CHILD_RENDER (1 << 29) */ /*UNUSED*/ +// #define PART_CHILD_RENDER (1 << 29) /* UNUSED */ #define PART_CHILD_GUIDE (1 << 30) #define PART_SELF_EFFECT (1 << 22) @@ -565,7 +565,7 @@ typedef enum eParticleShapeFlag { #define PART_TIME_AUTOSF 1 /* Automatic subframes */ /* part->draw_as */ -/* part->ren_as*/ +/* part->ren_as */ #define PART_DRAW_NOT 0 #define PART_DRAW_DOT 1 #define PART_DRAW_HALO 1 diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h index 3d7ead62649..041dc4a535a 100644 --- a/source/blender/makesdna/DNA_scene_types.h +++ b/source/blender/makesdna/DNA_scene_types.h @@ -241,7 +241,8 @@ typedef struct SceneRenderLayer { #define SCE_LAY_FRS (1 << 6) #define SCE_LAY_AO (1 << 7) #define SCE_LAY_VOLUMES (1 << 8) -/* flags between (1 << 8) and (1 << 15) are set to 1 already, for future options */ +#define SCE_LAY_MOTION_BLUR (1 << 9) +/* flags between (1 << 9) and (1 << 15) are set to 1 already, for future options */ #define SCE_LAY_ALL_Z (1 << 15) /* #define SCE_LAY_XOR (1 << 16) */ /* UNUSED */ @@ -699,7 +700,8 @@ typedef struct RenderData { float frs_sec_base; /** - * Value used to define filter size for all filter options */ + * Value used to define filter size for all filter options. + */ float gauss; /* color management settings - color profiles, gamma correction, etc */ @@ -2260,7 +2262,7 @@ enum { #define UVCALC_NO_ASPECT_CORRECT (1 << 1) /** Adjust UV's while transforming with Vert or Edge Slide. */ #define UVCALC_TRANSFORM_CORRECT_SLIDE (1 << 2) -/** Use mesh data after subsurf to compute UVs*/ +/** Use mesh data after subsurf to compute UV's. */ #define UVCALC_USESUBSURF (1 << 3) /** adjust UV's while transforming to avoid distortion */ #define UVCALC_TRANSFORM_CORRECT (1 << 4) diff --git a/source/blender/makesdna/DNA_screen_types.h b/source/blender/makesdna/DNA_screen_types.h index 8d3ac3a7814..ce25f8e40b7 100644 --- a/source/blender/makesdna/DNA_screen_types.h +++ b/source/blender/makesdna/DNA_screen_types.h @@ -567,8 +567,8 @@ enum { PNL_SELECT = (1 << 0), PNL_UNUSED_1 = (1 << 1), /* Cleared */ PNL_CLOSED = (1 << 2), - /* PNL_TABBED = (1 << 3), */ /*UNUSED*/ - /* PNL_OVERLAP = (1 << 4), */ /*UNUSED*/ + // PNL_TABBED = (1 << 3), /* UNUSED */ + // PNL_OVERLAP = (1 << 4), /* UNUSED */ PNL_PIN = (1 << 5), PNL_POPOVER = (1 << 6), /** The panel has been drag-drop reordered and the instanced panel list needs to be rebuilt. */ diff --git a/source/blender/makesdna/DNA_sequence_types.h b/source/blender/makesdna/DNA_sequence_types.h index 59b153397c1..1bd4c9233e3 100644 --- a/source/blender/makesdna/DNA_sequence_types.h +++ b/source/blender/makesdna/DNA_sequence_types.h @@ -545,8 +545,8 @@ enum { /* convenience define for all selection flags */ #define SEQ_ALLSEL (SELECT + SEQ_LEFTSEL + SEQ_RIGHTSEL) -/* deprecated, don't use a flag anymore*/ -/*#define SEQ_ACTIVE 1048576*/ +/* Deprecated, don't use a flag anymore. */ +// #define SEQ_ACTIVE 1048576 #define SEQ_COLOR_BALANCE_INVERSE_GAIN 1 #define SEQ_COLOR_BALANCE_INVERSE_GAMMA 2 diff --git a/source/blender/makesdna/DNA_shader_fx_types.h b/source/blender/makesdna/DNA_shader_fx_types.h index 84b80310918..01e3b3a5230 100644 --- a/source/blender/makesdna/DNA_shader_fx_types.h +++ b/source/blender/makesdna/DNA_shader_fx_types.h @@ -93,7 +93,7 @@ typedef struct BlurShaderFxData { int flag; /** Number of samples. */ int samples; - /** Rotation of blur effect. */ + /** Rotation of blur effect. */ float rotation; char _pad[4]; @@ -149,7 +149,7 @@ typedef struct GlowShaderFxData { int mode; float blur[2]; int samples; - /** Rotation of effect. */ + /** Rotation of effect. */ float rotation; /** Blend modes. */ int blend_mode; diff --git a/source/blender/makesdna/DNA_space_types.h b/source/blender/makesdna/DNA_space_types.h index 7804ece9769..9a66d16610d 100644 --- a/source/blender/makesdna/DNA_space_types.h +++ b/source/blender/makesdna/DNA_space_types.h @@ -1019,7 +1019,7 @@ typedef enum eFileSel_File_Types { FILE_TYPE_COLLADA = (1 << 13), /** from filter_glob operator property */ FILE_TYPE_OPERATOR = (1 << 14), - FILE_TYPE_APPLICATIONBUNDLE = (1 << 15), + FILE_TYPE_BUNDLE = (1 << 15), FILE_TYPE_ALEMBIC = (1 << 16), /** For all kinds of recognized import/export formats. No need for specialized types. */ FILE_TYPE_OBJECT_IO = (1 << 17), @@ -1806,8 +1806,8 @@ typedef enum eSpaceClip_Flag { /* SpaceClip.mode */ typedef enum eSpaceClip_Mode { SC_MODE_TRACKING = 0, - /*SC_MODE_RECONSTRUCTION = 1,*/ /* DEPRECATED */ - /*SC_MODE_DISTORTION = 2,*/ /* DEPRECATED */ + // SC_MODE_RECONSTRUCTION = 1, /* DEPRECATED */ + // SC_MODE_DISTORTION = 2, /* DEPRECATED */ SC_MODE_MASKEDIT = 3, } eSpaceClip_Mode; diff --git a/source/blender/makesdna/DNA_tracking_types.h b/source/blender/makesdna/DNA_tracking_types.h index 0e673aaec66..fb2d985d353 100644 --- a/source/blender/makesdna/DNA_tracking_types.h +++ b/source/blender/makesdna/DNA_tracking_types.h @@ -78,9 +78,9 @@ typedef struct MovieTrackingCamera { float nuke_k1, nuke_k2; /* Brown-Conrady distortion model coefficients */ - /** Brown-Conrady radial distortion **/ + /** Brown-Conrady radial distortion. */ float brown_k1, brown_k2, brown_k3, brown_k4; - /** Brown-Conrady tangential distortion **/ + /** Brown-Conrady tangential distortion. */ float brown_p1, brown_p2; } MovieTrackingCamera; diff --git a/source/blender/makesdna/DNA_userdef_types.h b/source/blender/makesdna/DNA_userdef_types.h index 61d2c04d98b..7abd960c467 100644 --- a/source/blender/makesdna/DNA_userdef_types.h +++ b/source/blender/makesdna/DNA_userdef_types.h @@ -496,7 +496,7 @@ typedef struct bTheme { /* 20 sets of bone colors for this theme */ ThemeWireColor tarm[20]; - /*ThemeWireColor tobj[20];*/ + // ThemeWireColor tobj[20]; /* See COLLECTION_COLOR_TOT for the number of collection colors. */ ThemeCollectionColor collection_color[8]; @@ -1146,8 +1146,10 @@ typedef enum eAutokey_Mode { /* AUTOKEY_ON is a bitflag */ AUTOKEY_ON = 1, - /** AUTOKEY_ON + 2**n... (i.e. AUTOKEY_MODE_NORMAL = AUTOKEY_ON + 2) - * to preserve setting, even when autokey turned off */ + /** + * AUTOKEY_ON + 2**n... (i.e. AUTOKEY_MODE_NORMAL = AUTOKEY_ON + 2) + * to preserve setting, even when auto-key turned off. + */ AUTOKEY_MODE_NORMAL = 3, AUTOKEY_MODE_EDITKEYS = 5, } eAutokey_Mode; diff --git a/source/blender/makesdna/DNA_view3d_types.h b/source/blender/makesdna/DNA_view3d_types.h index fa738c647bb..80de5ae3b7c 100644 --- a/source/blender/makesdna/DNA_view3d_types.h +++ b/source/blender/makesdna/DNA_view3d_types.h @@ -72,7 +72,6 @@ typedef struct RegionView3D { /** Allocated backup of its self while in localview. */ struct RegionView3D *localvd; struct RenderEngine *render_engine; - struct ViewDepths *depths; /** Animated smooth view. */ struct SmoothView3DStore *sms; @@ -102,7 +101,7 @@ typedef struct RegionView3D { /** Viewport zoom on the camera frame, see BKE_screen_view3d_zoom_to_fac. */ float camzoom; /** - * Check if persp/ortho view, since 'persp' cant be used for this since + * Check if persp/ortho view, since 'persp' can't be used for this since * it can have cameras assigned as well. (only set in #view3d_winmatrix_set) */ char is_persp; @@ -549,7 +548,7 @@ enum { V3D_OVERLAY_EDIT_INDICES = (1 << 19), /* Deprecated. */ - /* V3D_OVERLAY_EDIT_CU_HANDLES = (1 << 20), */ + // V3D_OVERLAY_EDIT_CU_HANDLES = (1 << 20), V3D_OVERLAY_EDIT_CU_NORMALS = (1 << 21), }; diff --git a/source/blender/makesdna/intern/dna_genfile.c b/source/blender/makesdna/intern/dna_genfile.c index a23c9087ffc..2a4bf53702f 100644 --- a/source/blender/makesdna/intern/dna_genfile.c +++ b/source/blender/makesdna/intern/dna_genfile.c @@ -855,7 +855,7 @@ static void cast_pointer_64_to_32(const int array_len, uint32_t *new_data) { /* WARNING: 32-bit Blender trying to load file saved by 64-bit Blender, - * pointers may lose uniqueness on truncation! (Hopefully this wont + * pointers may lose uniqueness on truncation! (Hopefully this won't * happen unless/until we ever get to multi-gigabyte .blend files...) */ for (int a = 0; a < array_len; a++) { new_data[a] = old_data[a] >> 3; diff --git a/source/blender/makesdna/intern/makesdna.c b/source/blender/makesdna/intern/makesdna.c index 85bcc94c335..24cfc1d84f6 100644 --- a/source/blender/makesdna/intern/makesdna.c +++ b/source/blender/makesdna/intern/makesdna.c @@ -60,8 +60,8 @@ #define SDNA_MAX_FILENAME_LENGTH 255 -/* Included the path relative from /source/blender/ here, so we can move */ -/* headers around with more freedom. */ +/* Included the path relative from /source/blender/ here, + * so we can move headers around with more freedom. */ static const char *includefiles[] = { /* if you add files here, please add them at the end * of makesdna.c (this file) as well */ @@ -361,7 +361,7 @@ static int add_type(const char *str, int size) } if (strchr(str, '*')) { /* note: this is valid C syntax but we can't parse, complain! - * `struct SomeStruct* some_var;` <-- correct but we cant handle right now. */ + * `struct SomeStruct* some_var;` <-- correct but we can't handle right now. */ return -1; } @@ -506,7 +506,7 @@ static int add_name(const char *str) buf[i + 2] = ')'; buf[i + 3] = 0; } - /* now proceed with buf*/ + /* Now proceed with buf. */ DEBUG_PRINTF(3, "\t\t\t\t\tProposing fp name %s\n", buf); name = buf; } @@ -725,7 +725,7 @@ static int convert_include(const char *filename) const int strct = add_type(md1, 0); if (strct == -1) { - fprintf(stderr, "File '%s' contains struct we cant parse \"%s\"\n", filename, md1); + fprintf(stderr, "File '%s' contains struct we can't parse \"%s\"\n", filename, md1); return 1; } @@ -1212,8 +1212,8 @@ static int make_structDNA(const char *base_directory, add_type("ushort", 2); /* SDNA_TYPE_USHORT */ add_type("int", 4); /* SDNA_TYPE_INT */ - /* note, long isn't supported, - * these are place-holders to maintain alignment with eSDNA_Type*/ + /* NOTE: long isn't supported, + * these are place-holders to maintain alignment with #eSDNA_Type. */ add_type("long", 4); /* SDNA_TYPE_LONG */ add_type("ulong", 4); /* SDNA_TYPE_ULONG */ @@ -1227,17 +1227,17 @@ static int make_structDNA(const char *base_directory, /* the defines above shouldn't be output in the padding file... */ const int firststruct = types_len; - /* add all include files defined in the global array */ - /* Since the internal file+path name buffer has limited length, I do a */ - /* little test first... */ - /* Mind the breaking condition here! */ + /* Add all include files defined in the global array. + * Since the internal file+path name buffer has limited length, + * I do a little test first... + * Mind the breaking condition here! */ DEBUG_PRINTF(0, "\tStart of header scan:\n"); int header_count = 0; for (int i = 0; *(includefiles[i]) != '\0'; i++) { header_count++; - /* str contains filenames. Since we now include paths, I stretched */ - /* it a bit. Hope this is enough :) -nzc- */ + /* NOTE(nzc): `str` contains filenames. + * Since we now include paths, I stretched it a bit. Hope this is enough :). */ char str[SDNA_MAX_FILENAME_LENGTH]; sprintf(str, "%s%s", base_directory, includefiles[i]); DEBUG_PRINTF(0, "\t|-- Converting %s\n", str); diff --git a/source/blender/makesrna/RNA_types.h b/source/blender/makesrna/RNA_types.h index 8e1cfafcc42..96604b8a5fe 100644 --- a/source/blender/makesrna/RNA_types.h +++ b/source/blender/makesrna/RNA_types.h @@ -255,7 +255,7 @@ typedef enum PropertyFlag { * Currently only used for UI, this is similar to PROP_NEVER_NULL * except that the value may be NULL at times, used for ObData, where an Empty's will be NULL * but setting NULL on a mesh object is not possible. - * So, if its not NULL, setting NULL cant be done! + * So if it's not NULL, setting NULL can't be done! */ PROP_NEVER_UNLINK = (1 << 25), @@ -555,7 +555,7 @@ typedef struct ParameterList { typedef struct ParameterIterator { struct ParameterList *parms; - /* PointerRNA funcptr; */ /*UNUSED*/ + // PointerRNA funcptr; /* UNUSED */ void *data; int size, offset; diff --git a/source/blender/makesrna/intern/makesrna.c b/source/blender/makesrna/intern/makesrna.c index 7a9cfa79324..5bf16baa1e8 100644 --- a/source/blender/makesrna/intern/makesrna.c +++ b/source/blender/makesrna/intern/makesrna.c @@ -114,7 +114,7 @@ static void rna_generate_static_parameter_prototypes(FILE *f, static int replace_if_different(const char *tmpfile, const char *dep_files[]) { - /* return 0; */ /* use for testing had edited rna */ + /* return 0; */ /* use for testing had edited rna */ #define REN_IF_DIFF \ { \ @@ -641,7 +641,7 @@ static char *rna_def_property_get_func( return NULL; } - /* typecheck, */ + /* Type check. */ if (dp->dnatype && *dp->dnatype) { if (prop->type == PROP_FLOAT) { @@ -3083,7 +3083,7 @@ static void rna_auto_types(void) PropertyDefRNA *dp; for (ds = DefRNA.structs.first; ds; ds = ds->cont.next) { - /* DNA name for Screen is patched in 2.5, we do the reverse here .. */ + /* DNA name for Screen is patched in 2.5, we do the reverse here. */ if (ds->dnaname) { if (STREQ(ds->dnaname, "Screen")) { ds->dnaname = "bScreen"; @@ -4229,7 +4229,7 @@ static void rna_generate_struct(BlenderRNA *UNUSED(brna), StructRNA *srna, FILE } fprintf(f, "\t"); rna_print_c_string(f, srna->identifier); - fprintf(f, ", NULL, NULL"); /* PyType - Cant initialize here */ + fprintf(f, ", NULL, NULL"); /* PyType - Can't initialize here */ fprintf(f, ", %d, NULL, ", srna->flag); rna_print_c_string(f, srna->name); fprintf(f, ",\n\t"); diff --git a/source/blender/makesrna/intern/rna_access.c b/source/blender/makesrna/intern/rna_access.c index 948fef1b51e..6f1f75bd46e 100644 --- a/source/blender/makesrna/intern/rna_access.c +++ b/source/blender/makesrna/intern/rna_access.c @@ -226,7 +226,7 @@ void RNA_pointer_recast(PointerRNA *ptr, PointerRNA *r_ptr) { StructRNA *base; PointerRNA t_ptr; - *r_ptr = *ptr; /* initialize as the same in case cant recast */ + *r_ptr = *ptr; /* initialize as the same in case can't recast */ for (base = ptr->type->base; base; base = base->base) { t_ptr = rna_pointer_inherit_refine(ptr, base, ptr->data); @@ -3681,7 +3681,7 @@ PointerRNA RNA_property_pointer_get(PointerRNA *ptr, PropertyRNA *prop) } if (prop->flag & PROP_IDPROPERTY) { /* XXX temporary hack to add it automatically, reading should - * never do any write ops, to ensure thread safety etc .. */ + * never do any write ops, to ensure thread safety etc. */ RNA_property_pointer_add(ptr, prop); return RNA_property_pointer_get(ptr, prop); } @@ -3766,16 +3766,16 @@ void RNA_property_pointer_set(PointerRNA *ptr, PointerRNA RNA_property_pointer_get_default(PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop)) { - /*PointerPropertyRNA *pprop = (PointerPropertyRNA *)prop; */ + // PointerPropertyRNA *pprop = (PointerPropertyRNA *)prop; - /* BLI_assert(RNA_property_type(prop) == PROP_POINTER); */ + // BLI_assert(RNA_property_type(prop) == PROP_POINTER); return PointerRNA_NULL; /* FIXME: there has to be a way... */ } void RNA_property_pointer_add(PointerRNA *ptr, PropertyRNA *prop) { - /*IDProperty *idprop;*/ + // IDProperty *idprop; BLI_assert(RNA_property_type(prop) == PROP_POINTER); @@ -3960,7 +3960,7 @@ static bool property_collection_liboverride_editable(PointerRNA *ptr, if (!is_liboverride) { /* We return True also for linked data, as it allows tricks like py scripts 'overriding' data - * of those.*/ + * of those. */ return true; } @@ -4005,7 +4005,7 @@ void RNA_property_collection_add(PointerRNA *ptr, PropertyRNA *prop, PointerRNA item->flag |= IDP_FLAG_OVERRIDELIBRARY_LOCAL; } IDP_AppendArray(idprop, item); - /* IDP_AppendArray does a shallow copy (memcpy), only free memory */ + /* IDP_AppendArray does a shallow copy (memcpy), only free memory. */ /* IDP_FreePropertyContent(item); */ MEM_freeN(item); rna_idproperty_touch(idprop); @@ -4565,8 +4565,8 @@ static int rna_raw_access(ReportList *reports, return 1; } - /* could also be faster with non-matching types, - * for now we just do slower loop .. */ + /* Could also be faster with non-matching types, + * for now we just do slower loop. */ } } @@ -5184,7 +5184,7 @@ static bool rna_path_parse_array_index(const char **path, /* location.x || scale.X, single dimension arrays only */ token = rna_path_token(path, fixedbuf, sizeof(fixedbuf), 0); if (token == NULL) { - /* invalid syntax blah.. */ + /* invalid syntax blah. */ return false; } temp_index = RNA_property_array_item_index(prop, *token); @@ -6869,7 +6869,7 @@ char *RNA_pointer_as_string_keywords_ex(bContext *C, if (as_function && RNA_property_type(prop) == PROP_POINTER) { /* don't expand pointers for functions */ if (flag & PROP_NEVER_NULL) { - /* we cant really do the right thing here. arg=arg?, hrmf! */ + /* we can't really do the right thing here. arg=arg?, hrmf! */ buf = BLI_strdup(arg_name); } else { @@ -7375,7 +7375,7 @@ int RNA_parameter_list_ret_count(ParameterList *parms) void RNA_parameter_list_begin(ParameterList *parms, ParameterIterator *iter) { /* may be useful but unused now */ - /* RNA_pointer_create(NULL, &RNA_Function, parms->func, &iter->funcptr); */ /*UNUSED*/ + // RNA_pointer_create(NULL, &RNA_Function, parms->func, &iter->funcptr); /* UNUSED */ iter->parms = parms; iter->parm = parms->func->cont.properties.first; @@ -8184,7 +8184,7 @@ void _RNA_warning(const char *format, ...) vprintf(format, args); va_end(args); - /* gcc macro adds '\n', but cant use for other compilers */ + /* gcc macro adds '\n', but can't use for other compilers */ #ifndef __GNUC__ fputc('\n', stdout); #endif diff --git a/source/blender/makesrna/intern/rna_animation.c b/source/blender/makesrna/intern/rna_animation.c index 10f86fe2671..52c25bae45a 100644 --- a/source/blender/makesrna/intern/rna_animation.c +++ b/source/blender/makesrna/intern/rna_animation.c @@ -337,7 +337,7 @@ static StructRNA *rna_KeyingSetInfo_register(Main *bmain, RNA_struct_blender_type_set(ksi->rna_ext.srna, ksi); /* set callbacks */ - /* NOTE: we really should have all of these... */ + /* NOTE: we really should have all of these... */ ksi->poll = (have_function[0]) ? RKS_POLL_rna_internal : NULL; ksi->iter = (have_function[1]) ? RKS_ITER_rna_internal : NULL; ksi->generate = (have_function[2]) ? RKS_GEN_rna_internal : NULL; @@ -1146,7 +1146,7 @@ static void rna_def_keyingset(BlenderRNA *brna) RNA_def_property_string_maxlength(prop, RNA_DYN_DESCR_MAX); /* else it uses the pointer size! */ RNA_def_property_ui_text(prop, "Description", "A short description of the keying set"); - /* KeyingSetInfo (Type Info) for Builtin Sets only */ + /* KeyingSetInfo (Type Info) for Builtin Sets only. */ prop = RNA_def_property(srna, "type_info", PROP_POINTER, PROP_NONE); RNA_def_property_struct_type(prop, "KeyingSetInfo"); RNA_def_property_pointer_funcs(prop, "rna_KeyingSet_typeinfo_get", NULL, NULL, NULL); diff --git a/source/blender/makesrna/intern/rna_animation_api.c b/source/blender/makesrna/intern/rna_animation_api.c index 95b89e7efe4..fba523c9f89 100644 --- a/source/blender/makesrna/intern/rna_animation_api.c +++ b/source/blender/makesrna/intern/rna_animation_api.c @@ -70,7 +70,7 @@ static float rna_AnimData_nla_tweak_strip_time_to_scene(AnimData *adt, float fra void RNA_api_keyingset(StructRNA *srna) { FunctionRNA *func; - /*PropertyRNA *parm; */ + // PropertyRNA *parm; /* validate relative Keying Set (used to ensure paths are ok for context) */ func = RNA_def_function(srna, "refresh", "rna_KeyingSet_context_refresh"); diff --git a/source/blender/makesrna/intern/rna_armature.c b/source/blender/makesrna/intern/rna_armature.c index f07aae0bb15..b3b0d7d13f7 100644 --- a/source/blender/makesrna/intern/rna_armature.c +++ b/source/blender/makesrna/intern/rna_armature.c @@ -1358,7 +1358,7 @@ static void rna_def_edit_bone(BlenderRNA *brna) /* calculated and read only, not actual data access */ prop = RNA_def_property(srna, "matrix", PROP_FLOAT, PROP_MATRIX); - /*RNA_def_property_float_sdna(prop, NULL, ""); */ /* doesn't access any real data */ + /* RNA_def_property_float_sdna(prop, NULL, ""); */ /* Doesn't access any real data. */ RNA_def_property_multi_array(prop, 2, rna_matrix_dimsize_4x4); // RNA_def_property_clear_flag(prop, PROP_EDITABLE); RNA_def_property_flag(prop, PROP_THICK_WRAP); /* no reference to original data */ @@ -1438,7 +1438,7 @@ static void rna_def_armature_edit_bones(BlenderRNA *brna, PropertyRNA *cprop) func = RNA_def_function(srna, "remove", "rna_Armature_edit_bone_remove"); RNA_def_function_flag(func, FUNC_USE_REPORTS); RNA_def_function_ui_description(func, "Remove an existing bone from the armature"); - /* target to remove*/ + /* Target to remove. */ parm = RNA_def_pointer(func, "bone", "EditBone", "", "EditBone to remove"); RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR); RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0); diff --git a/source/blender/makesrna/intern/rna_boid.c b/source/blender/makesrna/intern/rna_boid.c index 3e3452af713..40a64ffccd1 100644 --- a/source/blender/makesrna/intern/rna_boid.c +++ b/source/blender/makesrna/intern/rna_boid.c @@ -491,10 +491,12 @@ static void rna_def_boidrule(BlenderRNA *brna) RNA_def_property_ui_text(prop, "On Land", "Use rule when boid is on land"); RNA_def_property_update(prop, 0, "rna_Boids_reset"); - /*prop = RNA_def_property(srna, "show_expanded", PROP_BOOLEAN, PROP_NONE); */ - /*RNA_def_property_flag(prop, PROP_NO_DEG_UPDATE);*/ - /*RNA_def_property_boolean_sdna(prop, NULL, "mode", eModifierMode_Expanded); */ - /*RNA_def_property_ui_text(prop, "Expanded", "Set modifier expanded in the user interface"); */ +# if 0 + prop = RNA_def_property(srna, "show_expanded", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_flag(prop, PROP_NO_DEG_UPDATE); + RNA_def_property_boolean_sdna(prop, NULL, "mode", eModifierMode_Expanded); + RNA_def_property_ui_text(prop, "Expanded", "Set modifier expanded in the user interface"); +# endif /* types */ rna_def_boidrule_goal(brna); diff --git a/source/blender/makesrna/intern/rna_camera.c b/source/blender/makesrna/intern/rna_camera.c index f48a781cfab..d218f92e639 100644 --- a/source/blender/makesrna/intern/rna_camera.c +++ b/source/blender/makesrna/intern/rna_camera.c @@ -758,7 +758,7 @@ void RNA_def_camera(BlenderRNA *brna) rna_def_camera_background_image(brna); rna_def_camera_background_images(brna, prop); - /* Nested Data */ + /* Nested Data. */ RNA_define_animate_sdna(true); /* *** Animated *** */ diff --git a/source/blender/makesrna/intern/rna_color.c b/source/blender/makesrna/intern/rna_color.c index 54f9a93d90a..39a44d7568a 100644 --- a/source/blender/makesrna/intern/rna_color.c +++ b/source/blender/makesrna/intern/rna_color.c @@ -1206,7 +1206,7 @@ static void rna_def_colormanage(BlenderRNA *brna) {0, NULL, 0, NULL, NULL}, }; - /* ** Display Settings ** */ + /* ** Display Settings ** */ srna = RNA_def_struct(brna, "ColorManagedDisplaySettings", NULL); RNA_def_struct_path_func(srna, "rna_ColorManagedDisplaySettings_path"); RNA_def_struct_ui_text( @@ -1222,7 +1222,7 @@ static void rna_def_colormanage(BlenderRNA *brna) RNA_def_property_update( prop, NC_WINDOW, "rna_ColorManagedDisplaySettings_display_device_update"); - /* ** View Settings ** */ + /* ** View Settings ** */ srna = RNA_def_struct(brna, "ColorManagedViewSettings", NULL); RNA_def_struct_path_func(srna, "rna_ColorManagedViewSettings_path"); RNA_def_struct_ui_text(srna, @@ -1276,7 +1276,7 @@ static void rna_def_colormanage(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Use Curves", "Use RGB curved for pre-display transformation"); RNA_def_property_update(prop, NC_WINDOW, "rna_ColorManagement_update"); - /* ** Colorspace ** */ + /* ** Colorspace ** */ srna = RNA_def_struct(brna, "ColorManagedInputColorspaceSettings", NULL); RNA_def_struct_path_func(srna, "rna_ColorManagedInputColorspaceSettings_path"); RNA_def_struct_ui_text( diff --git a/source/blender/makesrna/intern/rna_constraint.c b/source/blender/makesrna/intern/rna_constraint.c index b363dcd4ba9..d79f2c4d13f 100644 --- a/source/blender/makesrna/intern/rna_constraint.c +++ b/source/blender/makesrna/intern/rna_constraint.c @@ -914,7 +914,7 @@ static void rna_def_constrainttarget(BlenderRNA *brna) RNA_def_property_update( prop, NC_OBJECT | ND_CONSTRAINT, "rna_ConstraintTarget_dependency_update"); - /* space, flag and type still to do */ + /* space, flag and type still to do. */ RNA_define_lib_overridable(false); } @@ -2975,7 +2975,7 @@ static void rna_def_constraint_spline_ik(BlenderRNA *brna) /* direct access to bindings */ /* NOTE: only to be used by experienced users */ prop = RNA_def_property(srna, "joint_bindings", PROP_FLOAT, PROP_FACTOR); - RNA_def_property_array(prop, 32); /* XXX this is the maximum value allowed - why? */ + RNA_def_property_array(prop, 32); /* XXX this is the maximum value allowed - why? */ RNA_def_property_flag(prop, PROP_DYNAMIC); RNA_def_property_dynamic_array_funcs(prop, "rna_SplineIKConstraint_joint_bindings_get_length"); RNA_def_property_float_funcs(prop, diff --git a/source/blender/makesrna/intern/rna_curve.c b/source/blender/makesrna/intern/rna_curve.c index dd7d50a80ba..299cd2504a8 100644 --- a/source/blender/makesrna/intern/rna_curve.c +++ b/source/blender/makesrna/intern/rna_curve.c @@ -183,7 +183,7 @@ static const EnumPropertyItem curve2d_fill_mode_items[] = { # include "ED_curve.h" /* for BKE_curve_nurbs_get */ -/* highly irritating but from RNA we cant know this */ +/* highly irritating but from RNA we can't know this */ static Nurb *curve_nurb_from_point(Curve *cu, const void *point, int *nu_index, int *pt_index) { ListBase *nurbs = BKE_curve_nurbs_get(cu); @@ -1418,7 +1418,7 @@ static void rna_def_text(BlenderRNA *brna) static void rna_def_curve_spline_points(BlenderRNA *brna, PropertyRNA *cprop) { StructRNA *srna; - /*PropertyRNA *prop; */ + // PropertyRNA *prop; FunctionRNA *func; PropertyRNA *parm; @@ -1448,7 +1448,7 @@ static void rna_def_curve_spline_points(BlenderRNA *brna, PropertyRNA *cprop) static void rna_def_curve_spline_bezpoints(BlenderRNA *brna, PropertyRNA *cprop) { StructRNA *srna; - /*PropertyRNA *prop; */ + // PropertyRNA *prop; FunctionRNA *func; PropertyRNA *parm; @@ -1954,14 +1954,14 @@ static void rna_def_curve_nurb(BlenderRNA *brna) RNA_def_property_update(prop, 0, "rna_Curve_update_data"); prop = RNA_def_property(srna, "point_count_u", PROP_INT, PROP_UNSIGNED); - RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* editing this needs knot recalc*/ + RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* Editing this needs knot recalc. */ RNA_def_property_int_sdna(prop, NULL, "pntsu"); RNA_def_property_ui_text( prop, "Points U", "Total number points for the curve or surface in the U direction"); RNA_def_property_update(prop, 0, "rna_Curve_update_data"); prop = RNA_def_property(srna, "point_count_v", PROP_INT, PROP_UNSIGNED); - RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* editing this needs knot recalc*/ + RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* Editing this needs knot recalc. */ RNA_def_property_int_sdna(prop, NULL, "pntsv"); RNA_def_property_ui_text( prop, "Points V", "Total number points for the surface on the V direction"); @@ -2074,7 +2074,7 @@ static void rna_def_curve_nurb(BlenderRNA *brna) prop = RNA_def_property(srna, "character_index", PROP_INT, PROP_UNSIGNED); RNA_def_property_int_sdna(prop, NULL, "charidx"); - RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* editing this needs knot recalc*/ + RNA_def_property_clear_flag(prop, PROP_EDITABLE); /* Editing this needs knot recalc. */ RNA_def_property_ui_text(prop, "Character Index", "Location of this character in the text data (only for text curves)"); diff --git a/source/blender/makesrna/intern/rna_define.c b/source/blender/makesrna/intern/rna_define.c index 9b9d561603b..0c6c3fd9b0a 100644 --- a/source/blender/makesrna/intern/rna_define.c +++ b/source/blender/makesrna/intern/rna_define.c @@ -783,7 +783,7 @@ void RNA_struct_free_extension(StructRNA *srna, ExtensionRNA *rna_ext) rna_ext->free(rna_ext->data); /* decref's the PyObject that the srna owns */ RNA_struct_blender_type_set(srna, NULL); /* this gets accessed again - XXX fixme */ - /* NULL the srna's value so RNA_struct_free wont complain of a leak */ + /* NULL the srna's value so RNA_struct_free won't complain of a leak */ RNA_struct_py_type_set(srna, NULL); #else @@ -1053,7 +1053,7 @@ StructRNA *RNA_def_struct(BlenderRNA *brna, const char *identifier, const char * if (from) { /* find struct to derive from */ - /* Inline RNA_struct_find(...) because it wont link from here. */ + /* Inline RNA_struct_find(...) because it won't link from here. */ srnafrom = BLI_ghash_lookup(brna->structs_map, from); if (!srnafrom) { CLOG_ERROR(&LOG, "struct %s not found to define %s.", from, identifier); @@ -1281,7 +1281,7 @@ PropertyRNA *RNA_def_property(StructOrFunctionRNA *cont_, int type, int subtype) { - /*StructRNA *srna = DefRNA.laststruct;*/ /* invalid for python defined props */ + // StructRNA *srna = DefRNA.laststruct; /* Invalid for Python defined props. */ ContainerRNA *cont = cont_; ContainerDefRNA *dcont; PropertyDefRNA *dprop = NULL; @@ -1351,7 +1351,7 @@ PropertyRNA *RNA_def_property(StructOrFunctionRNA *cont_, iprop->hardmin = (subtype == PROP_UNSIGNED) ? 0 : INT_MIN; iprop->hardmax = INT_MAX; - iprop->softmin = (subtype == PROP_UNSIGNED) ? 0 : -10000; /* rather arbitrary .. */ + iprop->softmin = (subtype == PROP_UNSIGNED) ? 0 : -10000; /* rather arbitrary. */ iprop->softmax = 10000; iprop->step = 1; break; @@ -1371,7 +1371,7 @@ PropertyRNA *RNA_def_property(StructOrFunctionRNA *cont_, fprop->softmax = fprop->hardmax = 1.0f; } else { - fprop->softmin = (subtype == PROP_UNSIGNED) ? 0.0f : -10000.0f; /* rather arbitrary .. */ + fprop->softmin = (subtype == PROP_UNSIGNED) ? 0.0f : -10000.0f; /* rather arbitrary. */ fprop->softmax = 10000.0f; } fprop->step = 10; @@ -1670,7 +1670,7 @@ void RNA_def_property_multi_array(PropertyRNA *prop, int dimension, const int le memset(prop->arraylength, 0, sizeof(prop->arraylength)); } - /* TODO make sure arraylength values are sane */ + /* TODO: make sure `arraylength` values are sane. */ } void RNA_def_property_ui_text(PropertyRNA *prop, const char *name, const char *description) @@ -2416,7 +2416,7 @@ void RNA_def_property_int_sdna(PropertyRNA *prop, const char *structname, const } } - /* SDNA doesn't pass us unsigned unfortunately .. */ + /* SDNA doesn't pass us unsigned unfortunately. */ if (dp->dnatype && STREQ(dp->dnatype, "char")) { iprop->hardmin = iprop->softmin = CHAR_MIN; iprop->hardmax = iprop->softmax = CHAR_MAX; @@ -2429,7 +2429,7 @@ void RNA_def_property_int_sdna(PropertyRNA *prop, const char *structname, const iprop->hardmin = INT_MIN; iprop->hardmax = INT_MAX; - iprop->softmin = -10000; /* rather arbitrary .. */ + iprop->softmin = -10000; /* rather arbitrary. */ iprop->softmax = 10000; } else if (dp->dnatype && STREQ(dp->dnatype, "int8_t")) { diff --git a/source/blender/makesrna/intern/rna_dynamicpaint.c b/source/blender/makesrna/intern/rna_dynamicpaint.c index 83df997b3d4..0dfd7d74c25 100644 --- a/source/blender/makesrna/intern/rna_dynamicpaint.c +++ b/source/blender/makesrna/intern/rna_dynamicpaint.c @@ -226,7 +226,7 @@ static bool rna_DynamicPaint_is_cache_user_get(PointerRNA *ptr) return (surface->format != MOD_DPAINT_SURFACE_F_IMAGESEQ) ? 1 : 0; } -/* does output layer exist*/ +/* Does output layer exist. */ static bool rna_DynamicPaint_is_output_exists(DynamicPaintSurface *surface, Object *ob, int index) { return dynamicPaint_outputLayerExists(surface, ob, index); diff --git a/source/blender/makesrna/intern/rna_fcurve.c b/source/blender/makesrna/intern/rna_fcurve.c index 1b89d866aba..2383bc607a0 100644 --- a/source/blender/makesrna/intern/rna_fcurve.c +++ b/source/blender/makesrna/intern/rna_fcurve.c @@ -61,8 +61,8 @@ const EnumPropertyItem rna_enum_fmodifier_type_items[] = { "Reshape F-Curve values, e.g. change amplitude of movements"}, {FMODIFIER_TYPE_CYCLES, "CYCLES", 0, "Cycles", "Cyclic extend/repeat keyframe sequence"}, {FMODIFIER_TYPE_NOISE, "NOISE", 0, "Noise", "Add pseudo-random noise on top of F-Curves"}, - /*{FMODIFIER_TYPE_FILTER, "FILTER", 0, "Filter", ""},*/ /* FIXME: not implemented yet! */ - /*{FMODIFIER_TYPE_PYTHON, "PYTHON", 0, "Python", ""},*/ /* FIXME: not implemented yet! */ + // {FMODIFIER_TYPE_FILTER, "FILTER", 0, "Filter", ""}, /* FIXME: not implemented yet! */ + // {FMODIFIER_TYPE_PYTHON, "PYTHON", 0, "Python", ""}, /* FIXME: not implemented yet! */ {FMODIFIER_TYPE_LIMITS, "LIMITS", 0, @@ -263,8 +263,8 @@ static void rna_DriverTarget_update_data(Main *bmain, Scene *scene, PointerRNA * fcu->flag &= ~FCURVE_DISABLED; if (driver) { - /* FIXME: need to be able to search targets for required one... */ - /*BLI_findindex(&driver->targets, ptr->data) != -1) */ + /* FIXME: need to be able to search targets for required one. */ + // BLI_findindex(&driver->targets, ptr->data) != -1) RNA_pointer_create(ptr->owner_id, &RNA_Driver, driver, &driverptr); rna_ChannelDriver_update_data(bmain, scene, &driverptr); } @@ -543,8 +543,8 @@ static void rna_FCurve_group_set(PointerRNA *ptr, return; } else if (value.data && (pid != vid)) { - /* id's differ, cant do this, should raise an error */ - printf("ERROR: ID's differ - ptr=%p vs value=%p\n", pid, vid); + /* ids differ, can't do this, should raise an error */ + printf("ERROR: IDs differ - ptr=%p vs value=%p\n", pid, vid); return; } @@ -584,7 +584,7 @@ static void rna_FCurve_group_set(PointerRNA *ptr, action_groups_remove_channel(act, fcu); /* add the F-Curve back to the action now in the right place */ - /* TODO: make the api function handle the case where there isn't any group to assign to */ + /* TODO: make the api function handle the case where there isn't any group to assign to. */ if (value.data) { /* add to its group using API function, which makes sure everything goes ok */ action_groups_add_channel(act, value.data, fcu); @@ -1449,7 +1449,7 @@ static void rna_def_fmodifier_cycles(BlenderRNA *brna) static void rna_def_fmodifier_python(BlenderRNA *brna) { StructRNA *srna; - /*PropertyRNA *prop; */ + // PropertyRNA *prop; srna = RNA_def_struct(brna, "FModifierPython", "FModifier"); RNA_def_struct_ui_text( diff --git a/source/blender/makesrna/intern/rna_gpencil.c b/source/blender/makesrna/intern/rna_gpencil.c index 19ed5f960cf..21e905cfd2a 100644 --- a/source/blender/makesrna/intern/rna_gpencil.c +++ b/source/blender/makesrna/intern/rna_gpencil.c @@ -1995,7 +1995,7 @@ static void rna_def_gpencil_layer(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Opacity", "Layer Opacity"); RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update"); - /* layer channel color (grease pencil) */ + /* Layer channel color (grease pencil). */ prop = RNA_def_property(srna, "channel_color", PROP_FLOAT, PROP_COLOR_GAMMA); RNA_def_property_float_sdna(prop, NULL, "color"); RNA_def_property_array(prop, 3); diff --git a/source/blender/makesrna/intern/rna_gpencil_modifier.c b/source/blender/makesrna/intern/rna_gpencil_modifier.c index e2cee2836b1..34ec4fbec92 100644 --- a/source/blender/makesrna/intern/rna_gpencil_modifier.c +++ b/source/blender/makesrna/intern/rna_gpencil_modifier.c @@ -2801,7 +2801,7 @@ static void rna_def_modifier_gpencillineart(BlenderRNA *brna) RNA_def_property_float_sdna(prop, NULL, "angle_splitting_threshold"); RNA_def_property_ui_text( prop, "Angle Splitting", "Angle in screen space below which a stroke is split in two"); - /* Don't allow value very close to PI, or we get a lot of small segments.*/ + /* Don't allow value very close to PI, or we get a lot of small segments. */ RNA_def_property_ui_range(prop, 0.0f, DEG2RAD(179.5f), 0.01f, 1); RNA_def_property_range(prop, 0.0f, DEG2RAD(180.0f)); RNA_def_property_update(prop, NC_SCENE, "rna_GpencilModifier_update"); @@ -2812,6 +2812,38 @@ static void rna_def_modifier_gpencillineart(BlenderRNA *brna) prop, "Remove Doubles", "Remove doubles from the source geometry before generating stokes"); RNA_def_property_update(prop, NC_SCENE, "rna_GpencilModifier_update"); + prop = RNA_def_property(srna, "floating_as_contour", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "calculation_flags", LRT_FLOATING_AS_CONTOUR); + RNA_def_property_ui_text(prop, "Floating As Contour", "Floating edges will have contour type"); + RNA_def_property_update(prop, NC_SCENE, "rna_GpencilModifier_update"); + + prop = RNA_def_property(srna, "invert_source_vertex_group", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "calculation_flags", LRT_GPENCIL_INVERT_SOURCE_VGROUP); + RNA_def_property_ui_text(prop, "Invert Vertex Group", "Invert source vertex group values"); + RNA_def_property_update(prop, 0, "rna_GpencilModifier_update"); + + prop = RNA_def_property(srna, "use_output_vertex_group_match_by_name", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "calculation_flags", LRT_GPENCIL_MATCH_OUTPUT_VGROUP); + RNA_def_property_ui_text(prop, "Match Output", "Match output vertex group based on name"); + RNA_def_property_update(prop, 0, "rna_GpencilModifier_update"); + + prop = RNA_def_property(srna, "use_face_mark", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "calculation_flags", LRT_FILTER_FACE_MARK); + RNA_def_property_ui_text( + prop, "Filter Face Marks", "Filter feature lines using freestyle face marks"); + RNA_def_property_update(prop, 0, "rna_GpencilModifier_update"); + + prop = RNA_def_property(srna, "use_face_mark_invert", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "calculation_flags", LRT_FILTER_FACE_MARK_INVERT); + RNA_def_property_ui_text(prop, "Invert", "Invert face mark filtering"); + RNA_def_property_update(prop, 0, "rna_GpencilModifier_update"); + + prop = RNA_def_property(srna, "use_face_mark_boundaries", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "calculation_flags", LRT_FILTER_FACE_MARK_BOUNDARIES); + RNA_def_property_ui_text( + prop, "Boundaries", "Filtering feature lines on face mark boundaries as well"); + RNA_def_property_update(prop, 0, "rna_GpencilModifier_update"); + prop = RNA_def_property(srna, "chaining_image_threshold", PROP_FLOAT, PROP_DISTANCE); RNA_def_property_ui_text( prop, @@ -2821,6 +2853,26 @@ static void rna_def_modifier_gpencillineart(BlenderRNA *brna) RNA_def_property_range(prop, 0.0f, 0.3f); RNA_def_property_update(prop, NC_SCENE, "rna_GpencilModifier_update"); + prop = RNA_def_property(srna, "chain_floating_edges", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "calculation_flags", LRT_CHAIN_FLOATING_EDGES); + RNA_def_property_ui_text( + prop, "Chain Floating Edges", "Allow floating edges to be chained together"); + RNA_def_property_update(prop, 0, "rna_GpencilModifier_update"); + + prop = RNA_def_property(srna, "chain_geometry_space", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "calculation_flags", LRT_CHAIN_GEOMETRY_SPACE); + RNA_def_property_ui_text( + prop, "Use Geometry Space", "Use geometry distance for chaining instead of image space"); + RNA_def_property_update(prop, 0, "rna_GpencilModifier_update"); + + prop = RNA_def_property(srna, "allow_overlap_edge_types", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "calculation_flags", LRT_ALLOW_OVERLAP_EDGE_TYPES); + RNA_def_property_ui_text(prop, + "Overlapping Edge Types", + "Allow an edge to have multiple overlapping types. This will create an " + "individual stroke for each overlapping type"); + RNA_def_property_update(prop, 0, "rna_GpencilModifier_update"); + prop = RNA_def_property(srna, "source_type", PROP_ENUM, PROP_NONE); RNA_def_property_enum_items(prop, modifier_lineart_source_type); RNA_def_property_ui_text(prop, "Source Type", "Line art stroke source type"); @@ -2846,6 +2898,11 @@ static void rna_def_modifier_gpencillineart(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Use Contour", "Generate strokes from contours lines"); RNA_def_property_update(prop, 0, "rna_GpencilModifier_update"); + prop = RNA_def_property(srna, "use_floating", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "edge_types", LRT_EDGE_FLAG_FLOATING); + RNA_def_property_ui_text(prop, "Use Floating", "Generate strokes from floating edges"); + RNA_def_property_update(prop, 0, "rna_GpencilModifier_update"); + prop = RNA_def_property(srna, "use_crease", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "edge_types", LRT_EDGE_FLAG_CREASE); RNA_def_property_ui_text(prop, "Use Crease", "Generate strokes from creased edges"); @@ -2915,16 +2972,6 @@ static void rna_def_modifier_gpencillineart(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Vertex Group", "Vertex group name for selected strokes"); RNA_def_property_update(prop, 0, "rna_GpencilModifier_update"); - prop = RNA_def_property(srna, "invert_source_vertex_group", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flags", LRT_GPENCIL_INVERT_SOURCE_VGROUP); - RNA_def_property_ui_text(prop, "Invert Vertex Group", "Invert source vertex group values"); - RNA_def_property_update(prop, 0, "rna_GpencilModifier_update"); - - prop = RNA_def_property(srna, "use_output_vertex_group_match_by_name", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flags", LRT_GPENCIL_MATCH_OUTPUT_VGROUP); - RNA_def_property_ui_text(prop, "Match Output", "Match output vertex group based on name"); - RNA_def_property_update(prop, 0, "rna_GpencilModifier_update"); - prop = RNA_def_property(srna, "is_baked", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flags", LRT_GPENCIL_IS_BAKED); RNA_def_property_ui_text(prop, "Is Baked", "This modifier has baked data"); diff --git a/source/blender/makesrna/intern/rna_image.c b/source/blender/makesrna/intern/rna_image.c index b3272f44826..c058ab6cfcc 100644 --- a/source/blender/makesrna/intern/rna_image.c +++ b/source/blender/makesrna/intern/rna_image.c @@ -1092,7 +1092,7 @@ static void rna_def_image(BlenderRNA *brna) 0, 0, "Size", - "Width and height in pixels, zero when image data cant be loaded", + "Width and height in pixels, zero when image data can't be loaded", 0, 0); RNA_def_property_subtype(prop, PROP_PIXEL); diff --git a/source/blender/makesrna/intern/rna_layer.c b/source/blender/makesrna/intern/rna_layer.c index 7fce9b1f908..b4253ab9236 100644 --- a/source/blender/makesrna/intern/rna_layer.c +++ b/source/blender/makesrna/intern/rna_layer.c @@ -604,7 +604,7 @@ void RNA_def_view_layer(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Dependency Graph", "Dependencies in the scene data"); RNA_def_property_pointer_funcs(prop, "rna_ViewLayer_depsgraph_get", NULL, NULL, NULL); - /* Nested Data */ + /* Nested Data. */ /* *** Non-Animated *** */ RNA_define_animate_sdna(false); rna_def_layer_collection(brna); diff --git a/source/blender/makesrna/intern/rna_mask.c b/source/blender/makesrna/intern/rna_mask.c index db3e5195c79..24bc5504a58 100644 --- a/source/blender/makesrna/intern/rna_mask.c +++ b/source/blender/makesrna/intern/rna_mask.c @@ -396,7 +396,7 @@ static void rna_MaskSplinePoint_handle_right_type_set(PointerRNA *ptr, int value BKE_mask_calc_handle_point(spline, point); } -/* ** API ** */ +/* ** API ** */ static MaskLayer *rna_Mask_layers_new(Mask *mask, const char *name) { @@ -1008,7 +1008,7 @@ static void rna_def_mask_layer(BlenderRNA *brna) RNA_def_property_ui_icon(prop, ICON_RESTRICT_RENDER_OFF, -1); RNA_def_property_update(prop, NC_MASK | NA_EDITED, NULL); - /* select (for dopesheet)*/ + /* Select (for dope-sheet). */ prop = RNA_def_property(srna, "select", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", MASK_LAYERFLAG_SELECT); RNA_def_property_ui_text(prop, "Select", "Layer is selected for editing in the Dope Sheet"); diff --git a/source/blender/makesrna/intern/rna_mesh.c b/source/blender/makesrna/intern/rna_mesh.c index 2f29a55f387..81cf1447604 100644 --- a/source/blender/makesrna/intern/rna_mesh.c +++ b/source/blender/makesrna/intern/rna_mesh.c @@ -16,7 +16,7 @@ /* note: the original vertex color stuff is now just used for * getting info on the layers themselves, accessing the data is - * done through the (not yet written) mpoly interfaces.*/ + * done through the (not yet written) mpoly interfaces. */ /** \file * \ingroup RNA @@ -239,6 +239,19 @@ static void rna_Mesh_update_data_legacy_deg_tag_all(Main *UNUSED(bmain), WM_main_add_notifier(NC_GEOM | ND_DATA, id); } +static void rna_Mesh_update_geom_and_params(Main *UNUSED(bmain), + Scene *UNUSED(scene), + PointerRNA *ptr) +{ + ID *id = ptr->owner_id; + if (id->us <= 0) { /* See note in section heading. */ + return; + } + + DEG_id_tag_update(id, ID_RECALC_GEOMETRY | ID_RECALC_PARAMETERS); + WM_main_add_notifier(NC_GEOM | ND_DATA, id); +} + static void rna_Mesh_update_data_edit_weight(Main *bmain, Scene *scene, PointerRNA *ptr) { BKE_mesh_batch_cache_dirty_tag(rna_mesh(ptr), BKE_MESH_BATCH_DIRTY_ALL); @@ -1072,7 +1085,7 @@ static int rna_MeshPoly_vertices_get_length(PointerRNA *ptr, int length[RNA_MAX_ { MPoly *mp = (MPoly *)ptr->data; /* note, raw access uses dummy item, this _could_ crash, - * watch out for this, mface uses it but it cant work here. */ + * watch out for this, mface uses it but it can't work here. */ return (length[0] = mp->totloop); } @@ -2450,7 +2463,7 @@ static void rna_def_mesh_loops(BlenderRNA *brna, PropertyRNA *cprop) { StructRNA *srna; - /*PropertyRNA *prop;*/ + // PropertyRNA *prop; FunctionRNA *func; PropertyRNA *parm; @@ -3260,11 +3273,6 @@ static void rna_def_mesh(BlenderRNA *brna) "generating triangles. A value greater than 0 disables Fix Poles"); RNA_def_property_update(prop, 0, "rna_Mesh_update_draw"); - prop = RNA_def_property(srna, "use_remesh_smooth_normals", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_sdna(prop, NULL, "flag", ME_REMESH_SMOOTH_NORMALS); - RNA_def_property_ui_text(prop, "Smooth Normals", "Smooth the normals of the remesher result"); - RNA_def_property_update(prop, 0, "rna_Mesh_update_draw"); - prop = RNA_def_property(srna, "use_remesh_fix_poles", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", ME_REMESH_FIX_POLES); RNA_def_property_ui_text(prop, "Fix Poles", "Produces less poles and a better topology flow"); @@ -3338,7 +3346,7 @@ static void rna_def_mesh(BlenderRNA *brna) "Auto Smooth", "Auto smooth (based on smooth/sharp faces/edges and angle between faces), " "or use custom split normals data if available"); - RNA_def_property_update(prop, 0, "rna_Mesh_update_data_legacy_deg_tag_all"); + RNA_def_property_update(prop, 0, "rna_Mesh_update_geom_and_params"); prop = RNA_def_property(srna, "auto_smooth_angle", PROP_FLOAT, PROP_ANGLE); RNA_def_property_float_sdna(prop, NULL, "smoothresh"); @@ -3347,7 +3355,7 @@ static void rna_def_mesh(BlenderRNA *brna) "Auto Smooth Angle", "Maximum angle between face normals that will be considered as smooth " "(unused if custom split normals data are available)"); - RNA_def_property_update(prop, 0, "rna_Mesh_update_data_legacy_deg_tag_all"); + RNA_def_property_update(prop, 0, "rna_Mesh_update_geom_and_params"); RNA_define_verify_sdna(false); prop = RNA_def_property(srna, "has_custom_normals", PROP_BOOLEAN, PROP_NONE); @@ -3378,7 +3386,7 @@ static void rna_def_mesh(BlenderRNA *brna) prop, "Auto Texture Space", "Adjust active object's texture space automatically when transforming object"); - RNA_def_property_update(prop, 0, "rna_Mesh_update_data_legacy_deg_tag_all"); + RNA_def_property_update(prop, 0, "rna_Mesh_update_geom_and_params"); # if 0 prop = RNA_def_property(srna, "texspace_location", PROP_FLOAT, PROP_TRANSLATION); diff --git a/source/blender/makesrna/intern/rna_mesh_api.c b/source/blender/makesrna/intern/rna_mesh_api.c index 2b0582cae9a..8128bdb83a0 100644 --- a/source/blender/makesrna/intern/rna_mesh_api.c +++ b/source/blender/makesrna/intern/rna_mesh_api.c @@ -208,7 +208,7 @@ static void rna_Mesh_clear_geometry(Mesh *mesh) { BKE_mesh_clear_geometry(mesh); - DEG_id_tag_update(&mesh->id, ID_RECALC_GEOMETRY); + DEG_id_tag_update(&mesh->id, ID_RECALC_GEOMETRY_ALL_MODES); WM_main_add_notifier(NC_GEOM | ND_DATA, mesh); } diff --git a/source/blender/makesrna/intern/rna_movieclip.c b/source/blender/makesrna/intern/rna_movieclip.c index f8fa2aab5e7..a32ed49ae1e 100644 --- a/source/blender/makesrna/intern/rna_movieclip.c +++ b/source/blender/makesrna/intern/rna_movieclip.c @@ -354,7 +354,7 @@ static void rna_def_movieclip(BlenderRNA *brna) 0, 0, "Size", - "Width and height in pixels, zero when image data cant be loaded", + "Width and height in pixels, zero when image data can't be loaded", 0, 0); RNA_def_property_int_funcs(prop, "rna_MovieClip_size_get", NULL, NULL); diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c index 8ad739b5c1a..a208e520d02 100644 --- a/source/blender/makesrna/intern/rna_object.c +++ b/source/blender/makesrna/intern/rna_object.c @@ -1882,7 +1882,7 @@ bool rna_Object_greasepencil_modifiers_override_apply(Main *bmain, GpencilModifierData *mod_dst = ED_object_gpencil_modifier_add( NULL, bmain, NULL, ob_dst, mod_src->name, mod_src->type); - BLI_remlink(&ob_dst->modifiers, mod_dst); + BLI_remlink(&ob_dst->greasepencil_modifiers, mod_dst); /* This handles NULL anchor as expected by adding at head of list. */ BLI_insertlinkafter(&ob_dst->greasepencil_modifiers, mod_anchor, mod_dst); @@ -1999,8 +1999,8 @@ static void rna_VertexGroup_vertex_add(ID *id, } while (index_len--) { - ED_vgroup_vert_add( - ob, def, *index++, weight, assignmode); /* XXX, not efficient calling within loop*/ + /* XXX: not efficient calling within loop. */ + ED_vgroup_vert_add(ob, def, *index++, weight, assignmode); } DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY); diff --git a/source/blender/makesrna/intern/rna_object_api.c b/source/blender/makesrna/intern/rna_object_api.c index e463323c6dc..4608b0c1bac 100644 --- a/source/blender/makesrna/intern/rna_object_api.c +++ b/source/blender/makesrna/intern/rna_object_api.c @@ -362,7 +362,7 @@ static void rna_Object_calc_matrix_camera(Object *ob, BKE_camera_params_init(¶ms); BKE_camera_params_from_object(¶ms, ob_eval); - /* compute matrix, viewplane, .. */ + /* Compute matrix, view-plane, etc. */ BKE_camera_params_compute_viewplane(¶ms, width, height, scalex, scaley); BKE_camera_params_compute_matrix(¶ms); @@ -508,7 +508,7 @@ static void rna_Mesh_assign_verts_to_group( create_dverts(&me->id); } - /* loop list adding verts to group */ + /* Loop list adding verts to group. */ for (i = 0; i < totindex; i++) { if (i < 0 || i >= me->totvert) { BKE_report(reports, RPT_ERROR, "Bad vertex index in list"); @@ -575,8 +575,10 @@ static void rna_Object_ray_cast(Object *ob, /* Test BoundBox first (efficiency) */ BoundBox *bb = BKE_object_boundbox_get(ob); float distmin; - normalize_v3( - direction); /* Needed for valid distance check from isect_ray_aabb_v3_simple() call. */ + + /* Needed for valid distance check from #isect_ray_aabb_v3_simple() call. */ + normalize_v3(direction); + if (!bb || (isect_ray_aabb_v3_simple(origin, direction, bb->vec[0], bb->vec[6], &distmin, NULL) && distmin <= distance)) { diff --git a/source/blender/makesrna/intern/rna_object_force.c b/source/blender/makesrna/intern/rna_object_force.c index eb7da0d0ce2..30baf01e952 100644 --- a/source/blender/makesrna/intern/rna_object_force.c +++ b/source/blender/makesrna/intern/rna_object_force.c @@ -287,7 +287,7 @@ static void rna_Cache_idname_change(Main *UNUSED(bmain), Scene *UNUSED(scene), P pid2 = pid; } else if (cache->name[0] != '\0' && STREQ(cache->name, pid->cache->name)) { - /*TODO: report "name exists" to user */ + /* TODO: report "name exists" to user. */ BLI_strncpy(cache->name, cache->prev_name, sizeof(cache->name)); use_new_name = false; } @@ -2047,10 +2047,10 @@ static void rna_def_softbody(BlenderRNA *brna) prop, "Estimate Transforms", "Store the estimated transforms in the soft body settings"); /***********************************************************************************/ - /* these are not exactly settings, but reading calculated results*/ - /* but i did not want to start a new property struct */ - /* so rather rename this from SoftBodySettings to SoftBody */ - /* translation */ + /* These are not exactly settings, but reading calculated results + * but i did not want to start a new property struct + * so rather rename this from SoftBodySettings to SoftBody + * translation. */ prop = RNA_def_property(srna, "location_mass_center", PROP_FLOAT, PROP_TRANSLATION); RNA_def_property_float_sdna(prop, NULL, "lcom"); RNA_def_property_ui_text(prop, "Center of Mass", "Location of center of mass"); diff --git a/source/blender/makesrna/intern/rna_particle.c b/source/blender/makesrna/intern/rna_particle.c index 7ff2a82a465..9ab685fa462 100644 --- a/source/blender/makesrna/intern/rna_particle.c +++ b/source/blender/makesrna/intern/rna_particle.c @@ -970,9 +970,11 @@ static void rna_PartSettings_start_set(struct PointerRNA *ptr, float value) settings->end = value; } - /*if (settings->type==PART_REACTOR && value < 1.0) */ - /* value = 1.0; */ - /*else */ +# if 0 + if (settings->type==PART_REACTOR && value < 1.0) + value = 1.0; + else +# endif if (value < MINAFRAMEF) { value = MINAFRAMEF; } @@ -1359,9 +1361,11 @@ static const EnumPropertyItem *rna_Particle_from_itemf(bContext *UNUSED(C), PropertyRNA *UNUSED(prop), bool *UNUSED(r_free)) { - /*if (part->type==PART_REACTOR) */ - /* return part_reactor_from_items; */ - /*else */ +# if 0 + if (part->type == PART_REACTOR) { + return part_reactor_from_items; + } +# endif return part_from_items; } @@ -1760,17 +1764,17 @@ static void rna_def_particle_key(BlenderRNA *brna) static void rna_def_child_particle(BlenderRNA *brna) { StructRNA *srna; - /*PropertyRNA *prop; */ + // PropertyRNA *prop; srna = RNA_def_struct(brna, "ChildParticle", NULL); RNA_def_struct_ui_text( srna, "Child Particle", "Child particle interpolated from simulated or edited particles"); - /* int num, parent; */ /* num is face index on the final derived mesh */ + /* int num, parent; */ /* num is face index on the final derived mesh */ - /* int pa[4]; */ /* nearest particles to the child, used for the interpolation */ - /* float w[4]; */ /* interpolation weights for the above particles */ - /* float fuv[4], foffset; */ /* face vertex weights and offset */ + /* int pa[4]; */ /* nearest particles to the child, used for the interpolation */ + /* float w[4]; */ /* interpolation weights for the above particles */ + /* float fuv[4], foffset; */ /* face vertex weights and offset */ /* float rand[3]; */ } @@ -1840,8 +1844,8 @@ static void rna_def_particle(BlenderRNA *brna) RNA_def_property_struct_type(prop, "ParticleKey"); RNA_def_property_ui_text(prop, "Keyed States", ""); /* */ - /* float fuv[4], foffset; */ /* coordinates on face/edge number "num" and depth along*/ - /* */ /* face normal for volume emission */ + /* float fuv[4], foffset; */ /* Coordinates on face/edge number "num" and depth along. */ + /* Face normal for volume emission. */ prop = RNA_def_property(srna, "birth_time", PROP_FLOAT, PROP_TIME); RNA_def_property_float_sdna(prop, NULL, "time"); @@ -2426,7 +2430,7 @@ static void rna_def_particle_settings(BlenderRNA *brna) {0, NULL, 0, NULL, NULL}, }; - /*TODO: names, tooltips */ + /* TODO: names, tool-tips. */ static const EnumPropertyItem integrator_type_items[] = { {PART_INT_EULER, "EULER", 0, "Euler", ""}, {PART_INT_VERLET, "VERLET", 0, "Verlet", ""}, @@ -2659,7 +2663,7 @@ static void rna_def_particle_settings(BlenderRNA *brna) RNA_def_property_ui_text(prop, "React On", "The event of target particles to react on"); RNA_def_property_update(prop, 0, "rna_Particle_reset"); - /*draw flag*/ + /* Draw flag. */ prop = RNA_def_property(srna, "show_guide_hairs", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "draw", PART_DRAW_GUIDE_HAIRS); RNA_def_property_ui_text(prop, "Guide Hairs", "Show guide hairs"); @@ -2806,9 +2810,9 @@ static void rna_def_particle_settings(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Random Bending Stiffness", "Random stiffness of hairs"); RNA_def_property_update(prop, 0, "rna_Particle_cloth_update"); - /*TODO: not found in UI, readonly? */ + /* TODO: not found in UI, read-only? */ prop = RNA_def_property(srna, "keys_step", PROP_INT, PROP_NONE); - RNA_def_property_range(prop, 0, SHRT_MAX); /*TODO:min,max */ + RNA_def_property_range(prop, 0, SHRT_MAX); /* TODO: min,max. */ RNA_def_property_ui_text(prop, "Keys Step", ""); /* adaptive path rendering */ @@ -2870,7 +2874,7 @@ static void rna_def_particle_settings(BlenderRNA *brna) /* general values */ prop = RNA_def_property(srna, "frame_start", PROP_FLOAT, PROP_TIME); - RNA_def_property_float_sdna(prop, NULL, "sta"); /*optional if prop names are the same */ + RNA_def_property_float_sdna(prop, NULL, "sta"); /* Optional if prop names are the same. */ RNA_def_property_range(prop, MINAFRAMEF, MAXFRAMEF); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_float_funcs(prop, NULL, "rna_PartSettings_start_set", NULL); @@ -2959,7 +2963,7 @@ static void rna_def_particle_settings(BlenderRNA *brna) RNA_def_property_update(prop, 0, "rna_Particle_reset"); prop = RNA_def_property( - srna, "userjit", PROP_INT, PROP_UNSIGNED); /*TODO: can we get a better name for userjit? */ + srna, "userjit", PROP_INT, PROP_UNSIGNED); /* TODO: can we get a better name for userjit? */ RNA_def_property_int_sdna(prop, NULL, "userjit"); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_range(prop, 0, 1000); @@ -2992,7 +2996,7 @@ static void rna_def_particle_settings(BlenderRNA *brna) /* initial velocity factors */ prop = RNA_def_property(srna, "normal_factor", PROP_FLOAT, PROP_VELOCITY); - RNA_def_property_float_sdna(prop, NULL, "normfac"); /*optional if prop names are the same */ + RNA_def_property_float_sdna(prop, NULL, "normfac"); /* Optional if prop names are the same. */ RNA_def_property_range(prop, -1000.0f, 1000.0f); RNA_def_property_ui_range(prop, 0, 100, 1, 3); RNA_def_property_ui_text( @@ -3008,7 +3012,7 @@ static void rna_def_particle_settings(BlenderRNA *brna) RNA_def_property_update(prop, 0, "rna_Particle_reset"); prop = RNA_def_property(srna, "factor_random", PROP_FLOAT, PROP_NONE); - RNA_def_property_float_sdna(prop, NULL, "randfac"); /*optional if prop names are the same */ + RNA_def_property_float_sdna(prop, NULL, "randfac"); /* Optional if prop names are the same. */ RNA_def_property_range(prop, 0.0f, 200.0f); RNA_def_property_ui_range(prop, 0, 100, 1, 3); RNA_def_property_ui_text(prop, "Random", "Give the starting velocity a random variation"); @@ -3149,7 +3153,7 @@ static void rna_def_particle_settings(BlenderRNA *brna) /* children */ prop = RNA_def_property(srna, "child_nbr", PROP_INT, PROP_NONE); - RNA_def_property_int_sdna(prop, NULL, "child_nbr"); /*optional if prop names are the same */ + RNA_def_property_int_sdna(prop, NULL, "child_nbr"); /* Optional if prop names are the same. */ RNA_def_property_range(prop, 0, 100000); RNA_def_property_ui_range(prop, 0, 1000, 1, -1); RNA_def_property_ui_text(prop, "Children Per Parent", "Number of children per parent"); diff --git a/source/blender/makesrna/intern/rna_pose.c b/source/blender/makesrna/intern/rna_pose.c index b8bb4f58dcd..bb4939a010b 100644 --- a/source/blender/makesrna/intern/rna_pose.c +++ b/source/blender/makesrna/intern/rna_pose.c @@ -620,8 +620,8 @@ static void rna_PoseChannel_constraints_remove( ED_object_constraint_update(bmain, ob); - BKE_constraints_active_set(&pchan->constraints, - NULL); /* XXX, is this really needed? - Campbell */ + /* XXX(Campbell): is this really needed? */ + BKE_constraints_active_set(&pchan->constraints, NULL); WM_main_add_notifier(NC_OBJECT | ND_CONSTRAINT | NA_REMOVED, id); @@ -932,7 +932,7 @@ static void rna_def_bone_group(BlenderRNA *brna) RNA_def_property_string_funcs(prop, NULL, NULL, "rna_BoneGroup_name_set"); RNA_def_struct_name_property(srna, prop); - /* TODO: add some runtime-collections stuff to access grouped bones */ + /* TODO: add some runtime-collections stuff to access grouped bones. */ /* color set */ rna_def_actionbone_group_common(srna, NC_OBJECT | ND_POSE, "rna_Pose_update"); diff --git a/source/blender/makesrna/intern/rna_render.c b/source/blender/makesrna/intern/rna_render.c index 6715941ae2a..4fe61df9387 100644 --- a/source/blender/makesrna/intern/rna_render.c +++ b/source/blender/makesrna/intern/rna_render.c @@ -858,6 +858,7 @@ static void rna_def_render_engine(BlenderRNA *brna) prop = RNA_def_property(srna, "bl_use_image_save", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_negative_sdna(prop, NULL, "type->flag", RE_USE_NO_IMAGE_SAVE); + RNA_def_property_boolean_default(prop, true); RNA_def_property_flag(prop, PROP_REGISTER_OPTIONAL); RNA_def_property_ui_text( prop, diff --git a/source/blender/makesrna/intern/rna_rna.c b/source/blender/makesrna/intern/rna_rna.c index 9e7d0f99dfa..899c3397361 100644 --- a/source/blender/makesrna/intern/rna_rna.c +++ b/source/blender/makesrna/intern/rna_rna.c @@ -36,7 +36,7 @@ /** \name Generic Enum's * \{ */ -/* Reuse for dynamic types */ +/* Reuse for dynamic types. */ const EnumPropertyItem DummyRNA_NULL_items[] = { {0, NULL, 0, NULL, NULL}, }; @@ -951,7 +951,7 @@ static int rna_enum_check_separator(CollectionPropertyIterator *UNUSED(iter), vo static void rna_EnumProperty_items_begin(CollectionPropertyIterator *iter, PointerRNA *ptr) { PropertyRNA *prop = (PropertyRNA *)ptr->data; - /* EnumPropertyRNA *eprop; */ /* UNUSED */ + /* EnumPropertyRNA *eprop; */ /* UNUSED */ const EnumPropertyItem *item = NULL; int totitem; bool free; @@ -2966,7 +2966,7 @@ static void rna_def_function(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Description", "Description of the Function's purpose"); prop = RNA_def_property(srna, "parameters", PROP_COLLECTION, PROP_NONE); - /*RNA_def_property_clear_flag(prop, PROP_EDITABLE);*/ + // RNA_def_property_clear_flag(prop, PROP_EDITABLE); RNA_def_property_struct_type(prop, "Property"); RNA_def_property_collection_funcs(prop, "rna_Function_parameters_begin", @@ -3270,7 +3270,7 @@ void RNA_def_rna(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - /* Struct*/ + /* Struct */ rna_def_struct(brna); /* Property */ diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index 7f23d9bc754..ceeec13b09d 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -3351,7 +3351,7 @@ static void rna_def_tool_settings(BlenderRNA *brna) RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, NULL); /* Annotations - 3D View Stroke Placement */ - /* XXX: Do we need to decouple the stroke_endpoints setting too? */ + /* XXX: Do we need to decouple the stroke_endpoints setting too? */ prop = RNA_def_property(srna, "annotation_stroke_placement_view3d", PROP_ENUM, PROP_NONE); RNA_def_property_enum_bitflag_sdna(prop, NULL, "annotate_v3d_align"); RNA_def_property_enum_items(prop, annotation_stroke_placement_items); @@ -4204,6 +4204,17 @@ void rna_def_view_layer_common(BlenderRNA *brna, StructRNA *srna, const bool sce RNA_def_property_clear_flag(prop, PROP_EDITABLE); } + prop = RNA_def_property(srna, "use_motion_blur", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "layflag", SCE_LAY_MOTION_BLUR); + RNA_def_property_ui_text( + prop, "Motion Blur", "Render motion blur in this Layer, if enabled in the scene"); + if (scene) { + RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL); + } + else { + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + } + /* passes */ prop = RNA_def_property(srna, "use_pass_combined", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "passflag", SCE_PASS_COMBINED); @@ -5762,7 +5773,7 @@ static void rna_def_scene_ffmpeg_settings(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Lossless Output", "Use lossless output for video streams"); RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, NULL); - /* FFMPEG Audio*/ + /* FFMPEG Audio. */ prop = RNA_def_property(srna, "audio_codec", PROP_ENUM, PROP_NONE); RNA_def_property_enum_bitflag_sdna(prop, NULL, "audio_codec"); RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); @@ -6624,7 +6635,7 @@ static void rna_def_scene_render_data(BlenderRNA *brna) RNA_def_property_struct_type(prop, "BakeSettings"); RNA_def_property_ui_text(prop, "Bake Data", ""); - /* Nestled Data */ + /* Nestled Data. */ /* *** Non-Animated *** */ RNA_define_animate_sdna(false); rna_def_bake_data(brna); @@ -7940,7 +7951,7 @@ void RNA_def_scene(BlenderRNA *brna) RNA_def_property_struct_type(prop, "SceneGpencil"); RNA_def_property_ui_text(prop, "Grease Pencil", "Grease Pencil settings for the scene"); - /* Nestled Data */ + /* Nestled Data. */ /* *** Non-Animated *** */ RNA_define_animate_sdna(false); rna_def_tool_settings(brna); diff --git a/source/blender/makesrna/intern/rna_scene_api.c b/source/blender/makesrna/intern/rna_scene_api.c index c49b41867a8..caecd9a07d8 100644 --- a/source/blender/makesrna/intern/rna_scene_api.c +++ b/source/blender/makesrna/intern/rna_scene_api.c @@ -89,7 +89,7 @@ static void rna_Scene_frame_set(Scene *scene, Main *bmain, int frame, float subf /* don't do notifier when we're rendering, avoid some viewport crashes * redrawing while the data is being modified for render */ if (!G.is_rendering) { - /* cant use NC_SCENE|ND_FRAME because this causes wm_event_do_notifiers to call + /* can't use NC_SCENE|ND_FRAME because this causes wm_event_do_notifiers to call * BKE_scene_graph_update_for_newframe which will lose any un-keyed changes T24690. */ /* WM_main_add_notifier(NC_SCENE|ND_FRAME, scene); */ diff --git a/source/blender/makesrna/intern/rna_screen.c b/source/blender/makesrna/intern/rna_screen.c index fba1d3cda9a..90029bd14a1 100644 --- a/source/blender/makesrna/intern/rna_screen.c +++ b/source/blender/makesrna/intern/rna_screen.c @@ -169,7 +169,7 @@ static void rna_Area_type_update(bContext *C, PointerRNA *ptr) /* It is possible that new layers becomes visible. */ if (area->spacetype == SPACE_VIEW3D) { - DEG_on_visible_update(CTX_data_main(C), false); + DEG_tag_on_visible_update(CTX_data_main(C), false); } CTX_wm_window_set(C, prevwin); @@ -234,7 +234,7 @@ static int rna_Area_ui_type_get(PointerRNA *ptr) * the area type is changing. * So manually do the lookup in those cases, but do not actually change area->type * since that prevents a proper exit when the area type is changing. - * Logic copied from `ED_area_init()`.*/ + * Logic copied from `ED_area_init()`. */ SpaceType *type = area->type; if (type == NULL || area_changing) { type = BKE_spacetype_from_id(area_type); @@ -288,7 +288,7 @@ static PointerRNA rna_Region_data_get(PointerRNA *ptr) if (region->regiondata != NULL) { if (region->regiontype == RGN_TYPE_WINDOW) { - /* We could make this static, it wont change at run-time. */ + /* We could make this static, it won't change at run-time. */ SpaceType *st = BKE_spacetype_from_id(SPACE_VIEW3D); if (region->type == BKE_regiontype_from_id(st, region->regiontype)) { PointerRNA newptr; diff --git a/source/blender/makesrna/intern/rna_sound.c b/source/blender/makesrna/intern/rna_sound.c index c5a53d4522d..9dc64fc950c 100644 --- a/source/blender/makesrna/intern/rna_sound.c +++ b/source/blender/makesrna/intern/rna_sound.c @@ -60,7 +60,7 @@ static void rna_def_sound(BlenderRNA *brna) srna, "Sound", "Sound data-block referencing an external or packed sound file"); RNA_def_struct_ui_icon(srna, ICON_SOUND); - /*rna_def_ipo_common(srna); */ + // rna_def_ipo_common(srna); prop = RNA_def_property(srna, "filepath", PROP_STRING, PROP_FILEPATH); RNA_def_property_string_sdna(prop, NULL, "filepath"); diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c index 036f93f43eb..40316d4661f 100644 --- a/source/blender/makesrna/intern/rna_space.c +++ b/source/blender/makesrna/intern/rna_space.c @@ -776,6 +776,20 @@ static void rna_Space_show_region_toolbar_update(bContext *C, PointerRNA *ptr) rna_Space_bool_from_region_flag_update_by_type(C, ptr, RGN_TYPE_TOOLS, RGN_FLAG_HIDDEN); } +/* Channels Region. */ +static bool rna_Space_show_region_channels_get(PointerRNA *ptr) +{ + return !rna_Space_bool_from_region_flag_get_by_type(ptr, RGN_TYPE_CHANNELS, RGN_FLAG_HIDDEN); +} +static void rna_Space_show_region_channels_set(PointerRNA *ptr, bool value) +{ + rna_Space_bool_from_region_flag_set_by_type(ptr, RGN_TYPE_CHANNELS, RGN_FLAG_HIDDEN, !value); +} +static void rna_Space_show_region_channels_update(bContext *C, PointerRNA *ptr) +{ + rna_Space_bool_from_region_flag_update_by_type(C, ptr, RGN_TYPE_CHANNELS, RGN_FLAG_HIDDEN); +} + /* UI Region */ static bool rna_Space_show_region_ui_get(PointerRNA *ptr) { @@ -895,8 +909,8 @@ static void rna_SpaceView3D_use_local_camera_set(PointerRNA *ptr, bool value) if (!value) { Scene *scene = ED_screen_scene_find(screen, G_MAIN->wm.first); /* NULL if the screen isn't in an active window (happens when setting from Python). - * This could be moved to the update function, in that case the scene wont relate to the screen - * so keep it working this way. */ + * This could be moved to the update function, in that case the scene won't relate to the + * screen so keep it working this way. */ if (scene != NULL) { v3d->camera = scene->camera; } @@ -924,7 +938,7 @@ static PointerRNA rna_SpaceView3D_region_3d_get(PointerRNA *ptr) void *regiondata = NULL; if (area) { ListBase *regionbase = (area->spacedata.first == v3d) ? &area->regionbase : &v3d->regionbase; - ARegion *region = regionbase->last; /* always last in list, weak .. */ + ARegion *region = regionbase->last; /* always last in list, weak. */ regiondata = region->regiondata; } @@ -3214,6 +3228,10 @@ static void rna_def_space_generic_show_region_toggles(StructRNA *srna, int regio region_type_mask &= ~(1 << RGN_TYPE_TOOLS); DEF_SHOW_REGION_PROPERTY(show_region_toolbar, "Toolbar", ""); } + if (region_type_mask & (1 << RGN_TYPE_CHANNELS)) { + region_type_mask &= ~(1 << RGN_TYPE_CHANNELS); + DEF_SHOW_REGION_PROPERTY(show_region_channels, "Channels", ""); + } if (region_type_mask & (1 << RGN_TYPE_UI)) { region_type_mask &= ~(1 << RGN_TYPE_UI); DEF_SHOW_REGION_PROPERTY(show_region_ui, "Sidebar", ""); @@ -4966,7 +4984,7 @@ static void rna_def_space_view3d(BlenderRNA *brna) prop = RNA_def_property(srna, "view_location", PROP_FLOAT, PROP_TRANSLATION); # if 0 - RNA_def_property_float_sdna(prop, NULL, "ofs"); /* cant use because its negated */ + RNA_def_property_float_sdna(prop, NULL, "ofs"); /* can't use because it's negated */ # else RNA_def_property_array(prop, 3); RNA_def_property_float_funcs( @@ -4977,7 +4995,7 @@ static void rna_def_space_view3d(BlenderRNA *brna) RNA_def_property_update(prop, NC_WINDOW, NULL); prop = RNA_def_property( - srna, "view_rotation", PROP_FLOAT, PROP_QUATERNION); /* cant use because its inverted */ + srna, "view_rotation", PROP_FLOAT, PROP_QUATERNION); /* can't use because it's inverted */ # if 0 RNA_def_property_float_sdna(prop, NULL, "viewquat"); # else @@ -7560,6 +7578,9 @@ static void rna_def_space_spreadsheet_context(BlenderRNA *brna) RNA_def_property_enum_items(prop, spreadsheet_context_type_items); RNA_def_property_ui_text(prop, "Type", "Type of the context"); RNA_def_property_clear_flag(prop, PROP_EDITABLE); + + rna_def_space_generic_show_region_toggles(srna, + (1 << RGN_TYPE_CHANNELS) | (1 << RGN_TYPE_FOOTER)); } static void rna_def_space_spreadsheet_context_object(BlenderRNA *brna) @@ -7674,7 +7695,8 @@ static void rna_def_space_spreadsheet(BlenderRNA *brna) srna = RNA_def_struct(brna, "SpaceSpreadsheet", "Space"); RNA_def_struct_ui_text(srna, "Space Spreadsheet", "Spreadsheet space data"); - rna_def_space_generic_show_region_toggles(srna, (1 << RGN_TYPE_UI) | (1 << RGN_TYPE_FOOTER)); + rna_def_space_generic_show_region_toggles( + srna, (1 << RGN_TYPE_UI) | (1 << RGN_TYPE_CHANNELS) | (1 << RGN_TYPE_FOOTER)); prop = RNA_def_property(srna, "is_pinned", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_sdna(prop, NULL, "flag", SPREADSHEET_FLAG_PINNED); diff --git a/source/blender/makesrna/intern/rna_texture.c b/source/blender/makesrna/intern/rna_texture.c index d8a8d64e639..128f1cb1e21 100644 --- a/source/blender/makesrna/intern/rna_texture.c +++ b/source/blender/makesrna/intern/rna_texture.c @@ -1659,7 +1659,7 @@ static void rna_def_texture(BlenderRNA *brna) rna_def_texture_musgrave(brna); rna_def_texture_voronoi(brna); rna_def_texture_distorted_noise(brna); - /* XXX add more types here .. */ + /* XXX add more types here. */ RNA_api_texture(srna); } diff --git a/source/blender/makesrna/intern/rna_texture_api.c b/source/blender/makesrna/intern/rna_texture_api.c index 13b561f9dd6..42b3e4420c1 100644 --- a/source/blender/makesrna/intern/rna_texture_api.c +++ b/source/blender/makesrna/intern/rna_texture_api.c @@ -42,7 +42,7 @@ static void texture_evaluate(struct Tex *tex, float value[3], float r_color[4]) { TexResult texres = {0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0, NULL}; - /* TODO(sergey): always use color management now. */ + /* TODO(sergey): always use color management now. */ multitex_ext(tex, value, NULL, NULL, 1, &texres, 0, NULL, true, false); r_color[0] = texres.tr; diff --git a/source/blender/makesrna/intern/rna_ui_api.c b/source/blender/makesrna/intern/rna_ui_api.c index f128719db19..dc973a9c75c 100644 --- a/source/blender/makesrna/intern/rna_ui_api.c +++ b/source/blender/makesrna/intern/rna_ui_api.c @@ -1018,7 +1018,8 @@ void RNA_api_ui_layout(StructRNA *srna) func = RNA_def_function(srna, "operator_menu_enum", "rna_uiItemMenuEnumO"); RNA_def_function_flag(func, FUNC_USE_CONTEXT); - api_ui_item_op(func); /* cant use api_ui_item_op_common because property must come right after */ + /* Can't use #api_ui_item_op_common because property must come right after. */ + api_ui_item_op(func); parm = RNA_def_string(func, "property", NULL, 0, "", "Identifier of property in operator"); RNA_def_parameter_flags(parm, 0, PARM_REQUIRED); api_ui_item_common(func); diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c index 4d45d1d6d63..3b7af07479c 100644 --- a/source/blender/makesrna/intern/rna_userdef.c +++ b/source/blender/makesrna/intern/rna_userdef.c @@ -826,7 +826,7 @@ static PointerRNA rna_Addon_preferences_get(PointerRNA *ptr) if (apt) { if (addon->prop == NULL) { IDPropertyTemplate val = {0}; - addon->prop = IDP_New(IDP_GROUP, &val, addon->module); /* name is unimportant */ + addon->prop = IDP_New(IDP_GROUP, &val, addon->module); /* name is unimportant. */ } return rna_pointer_inherit_refine(ptr, apt->rna_ext.srna, addon->prop); } @@ -2275,7 +2275,7 @@ static void rna_def_userdef_theme_space_view3d(BlenderRNA *brna) rna_def_userdef_theme_spaces_edge(srna); rna_def_userdef_theme_spaces_face(srna); - /* Mesh Object specific curves*/ + /* Mesh Object specific curves. */ rna_def_userdef_theme_spaces_curves(srna, true, true, true, false); @@ -2320,7 +2320,7 @@ static void rna_def_userdef_theme_space_view3d(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Split Normal", ""); RNA_def_property_update(prop, 0, "rna_userdef_update"); - /* Armature Object specific */ + /* Armature Object specific. */ prop = RNA_def_property(srna, "bone_pose", PROP_FLOAT, PROP_COLOR_GAMMA); RNA_def_property_array(prop, 3); @@ -2486,7 +2486,7 @@ static void rna_def_userdef_theme_space_file(BlenderRNA *brna) StructRNA *srna; PropertyRNA *prop; - /* space_file */ + /* space_file */ srna = RNA_def_struct(brna, "ThemeFileBrowser", NULL); RNA_def_struct_sdna(srna, "ThemeSpace"); @@ -3864,6 +3864,7 @@ static void rna_def_userdef_theme_space_spreadsheet(BlenderRNA *brna) RNA_def_property_update(prop, 0, "rna_userdef_theme_update"); rna_def_userdef_theme_spaces_main(srna); + rna_def_userdef_theme_spaces_list_main(srna); } static void rna_def_userdef_themes(BlenderRNA *brna) @@ -4509,7 +4510,7 @@ static void rna_def_userdef_view(BlenderRNA *brna) RNA_def_struct_clear_flag(srna, STRUCT_UNDO); RNA_def_struct_ui_text(srna, "View & Controls", "Preferences related to viewing data"); - /* View */ + /* View. */ prop = RNA_def_property(srna, "ui_scale", PROP_FLOAT, PROP_NONE); RNA_def_property_ui_text( prop, "UI Scale", "Changes the size of the fonts and widgets in the interface"); @@ -6135,7 +6136,7 @@ static void rna_def_userdef_filepaths(BlenderRNA *brna) "Tabs as Spaces", "Automatically convert all new tabs into spaces for new and loaded text files"); - /* Directories */ + /* Directories. */ prop = RNA_def_property(srna, "font_directory", PROP_STRING, PROP_DIRPATH); RNA_def_property_string_sdna(prop, NULL, "fontdir"); @@ -6199,7 +6200,7 @@ static void rna_def_userdef_filepaths(BlenderRNA *brna) RNA_def_property_ui_text( prop, "Animation Player Preset", "Preset configs for external animation players"); - /* Autosave */ + /* Autosave. */ prop = RNA_def_property(srna, "save_version", PROP_INT, PROP_NONE); RNA_def_property_int_sdna(prop, NULL, "versions"); diff --git a/source/blender/makesrna/intern/rna_wm.c b/source/blender/makesrna/intern/rna_wm.c index 2b1a5f7fde1..a563541b968 100644 --- a/source/blender/makesrna/intern/rna_wm.c +++ b/source/blender/makesrna/intern/rna_wm.c @@ -751,7 +751,7 @@ static void rna_Window_scene_update(bContext *C, PointerRNA *ptr) Main *bmain = CTX_data_main(C); wmWindow *win = ptr->data; - /* exception: must use context so notifier gets to the right window */ + /* Exception: must use context so notifier gets to the right window. */ if (win->new_scene) { # ifdef WITH_PYTHON BPy_BEGIN_ALLOW_THREADS; @@ -892,7 +892,7 @@ static PointerRNA rna_KeyMapItem_properties_get(PointerRNA *ptr) return *(kmi->ptr); } - /*return rna_pointer_inherit_refine(ptr, &RNA_OperatorProperties, op->properties); */ + // return rna_pointer_inherit_refine(ptr, &RNA_OperatorProperties, op->properties); return PointerRNA_NULL; } diff --git a/source/blender/makesrna/rna_cleanup/rna_cleaner.py b/source/blender/makesrna/rna_cleanup/rna_cleaner.py index eaeca562e47..61622f281a6 100755 --- a/source/blender/makesrna/rna_cleanup/rna_cleaner.py +++ b/source/blender/makesrna/rna_cleanup/rna_cleaner.py @@ -288,7 +288,7 @@ def write_files(basename, props_list, props_length_max): f_py.write("rna_api = [\n%s]\n" % py) f_rna.write("rna_api = [\n%s]\n" % rna) - # write useful py script, wont hurt + # write useful py script, won't hurt f_py.write("\n'''\n") f_py.write("for p_note, p_changed, p_class, p_from, p_to, p_check, p_type, p_desc in rna_api:\n") f_py.write(" print(p_to)\n") diff --git a/source/blender/modifiers/intern/MOD_array.c b/source/blender/modifiers/intern/MOD_array.c index 93a9e76ffe4..c5e3833aa4a 100644 --- a/source/blender/modifiers/intern/MOD_array.c +++ b/source/blender/modifiers/intern/MOD_array.c @@ -121,7 +121,7 @@ BLI_INLINE float sum_v3(const float v[3]) typedef struct SortVertsElem { int vertex_num; /* The original index of the vertex, prior to sorting */ float co[3]; /* Its coordinates */ - float sum_co; /* sum_v3(co), just so we don't do the sum many times. */ + float sum_co; /* `sum_v3(co)`: just so we don't do the sum many times. */ } SortVertsElem; static int svert_sum_cmp(const void *e1, const void *e2) diff --git a/source/blender/modifiers/intern/MOD_edgesplit.c b/source/blender/modifiers/intern/MOD_edgesplit.c index 6a04181605c..2e3a1743e7c 100644 --- a/source/blender/modifiers/intern/MOD_edgesplit.c +++ b/source/blender/modifiers/intern/MOD_edgesplit.c @@ -90,7 +90,7 @@ Mesh *doEdgeSplit(const Mesh *mesh, EdgeSplitModifierData *emd) UNLIKELY(l1 != l2->radial_next) || /* O° angle setting, we want to split on all edges. */ do_split_all || - /* 2 face edge - check angle*/ + /* 2 face edge - check angle. */ (dot_v3v3(l1->f->no, l2->f->no) < threshold)) { BM_elem_flag_enable(e, BM_ELEM_TAG); } diff --git a/source/blender/modifiers/intern/MOD_explode.c b/source/blender/modifiers/intern/MOD_explode.c index 28fe4376d2c..4e53243d820 100644 --- a/source/blender/modifiers/intern/MOD_explode.c +++ b/source/blender/modifiers/intern/MOD_explode.c @@ -1048,7 +1048,7 @@ static Mesh *explodeMesh(ExplodeModifierData *emd, } BLI_edgehashIterator_free(ehi); - /*map new vertices to faces*/ + /* Map new vertices to faces. */ for (i = 0, u = 0; i < totface; i++) { MFace source; int orig_v4; diff --git a/source/blender/modifiers/intern/MOD_laplaciansmooth.c b/source/blender/modifiers/intern/MOD_laplaciansmooth.c index 78e0bf3fa8f..63495c4104e 100644 --- a/source/blender/modifiers/intern/MOD_laplaciansmooth.c +++ b/source/blender/modifiers/intern/MOD_laplaciansmooth.c @@ -57,18 +57,18 @@ struct BLaplacianSystem { float *eweights; /* Length weights per Edge */ float (*fweights)[3]; /* Cotangent weights per face */ - float *ring_areas; /* Total area per ring*/ - float *vlengths; /* Total sum of lengths(edges) per vertice*/ - float *vweights; /* Total sum of weights per vertice*/ - int numEdges; /* Number of edges*/ - int numLoops; /* Number of edges*/ - int numPolys; /* Number of faces*/ - int numVerts; /* Number of verts*/ - short *numNeFa; /* Number of neighbors faces around vertice*/ - short *numNeEd; /* Number of neighbors Edges around vertice*/ - short *zerola; /* Is zero area or length*/ - - /* Pointers to data*/ + float *ring_areas; /* Total area per ring. */ + float *vlengths; /* Total sum of lengths(edges) per vertex. */ + float *vweights; /* Total sum of weights per vertex. */ + int numEdges; /* Number of edges. */ + int numLoops; /* Number of edges. */ + int numPolys; /* Number of faces. */ + int numVerts; /* Number of verts. */ + short *numNeFa; /* Number of neighbors faces around vertice. */ + short *numNeEd; /* Number of neighbors Edges around vertice. */ + short *zerola; /* Is zero area or length. */ + + /* Pointers to data. */ float (*vertexCos)[3]; const MPoly *mpoly; const MLoop *mloop; @@ -299,7 +299,7 @@ static void fill_laplacian_matrix(LaplacianSystem *sys) for (; l_next != l_term; l_prev = l_curr, l_curr = l_next, l_next++) { const uint l_curr_index = l_curr - sys->mloop; - /* Is ring if number of faces == number of edges around vertice*/ + /* Is ring if number of faces == number of edges around vertice. */ if (sys->numNeEd[l_curr->v] == sys->numNeFa[l_curr->v] && sys->zerola[l_curr->v] == 0) { EIG_linear_solver_matrix_add(sys->context, l_curr->v, diff --git a/source/blender/modifiers/intern/MOD_meshcache.c b/source/blender/modifiers/intern/MOD_meshcache.c index 361454120ca..6ec3277ee7a 100644 --- a/source/blender/modifiers/intern/MOD_meshcache.c +++ b/source/blender/modifiers/intern/MOD_meshcache.c @@ -198,11 +198,11 @@ static void meshcache_do(MeshCacheModifierData *mcmd, me->mloop, me->totvert, - (const float(*)[3])vertexCos_Source, /* from the original Mesh*/ + (const float(*)[3])vertexCos_Source, /* From the original Mesh. */ (const float(*)[3])vertexCos_Real, /* the input we've been given (shape keys!) */ - (const float(*)[3])vertexCos, /* the result of this modifier */ - vertexCos_New /* the result of this function */ + (const float(*)[3])vertexCos, /* The result of this modifier. */ + vertexCos_New /* The result of this function. */ ); /* write the corrected locations back into the result */ diff --git a/source/blender/modifiers/intern/MOD_meshdeform.c b/source/blender/modifiers/intern/MOD_meshdeform.c index 8e1e03570b5..c997cd7377f 100644 --- a/source/blender/modifiers/intern/MOD_meshdeform.c +++ b/source/blender/modifiers/intern/MOD_meshdeform.c @@ -383,7 +383,7 @@ static void meshdeformModifier_do(ModifierData *md, /* bind weights if needed */ if (!mmd->bindcagecos) { - /* progress bar redraw can make this recursive .. */ + /* progress bar redraw can make this recursive. */ if (!DEG_is_active(ctx->depsgraph)) { BKE_modifier_set_error(ob, md, "Attempt to bind from inactive dependency graph"); goto finally; diff --git a/source/blender/modifiers/intern/MOD_nodes.cc b/source/blender/modifiers/intern/MOD_nodes.cc index 8fa80025790..5daecef1946 100644 --- a/source/blender/modifiers/intern/MOD_nodes.cc +++ b/source/blender/modifiers/intern/MOD_nodes.cc @@ -1106,7 +1106,7 @@ static void modifyGeometrySet(ModifierData *md, /* Drawing the properties manually with #uiItemR instead of #uiDefAutoButsRNA allows using * the node socket identifier for the property names, since they are unique, but also having - * the correct label displayed in the UI. */ + * the correct label displayed in the UI. */ static void draw_property_for_socket(uiLayout *layout, PointerRNA *bmain_ptr, PointerRNA *md_ptr, diff --git a/source/blender/modifiers/intern/MOD_nodes_evaluator.cc b/source/blender/modifiers/intern/MOD_nodes_evaluator.cc index 01eebfea333..980607db839 100644 --- a/source/blender/modifiers/intern/MOD_nodes_evaluator.cc +++ b/source/blender/modifiers/intern/MOD_nodes_evaluator.cc @@ -1041,13 +1041,14 @@ class GeometryNodesEvaluator { this->load_unlinked_input_value(locked_node, input_socket, input_state, origin_socket); locked_node.node_state.missing_required_inputs -= 1; this->schedule_node(locked_node); - return; } - /* The value has not been computed yet, so when it will be forwarded by another node, this - * node will be triggered. */ - will_be_triggered_by_other_node = true; + else { + /* The value has not been computed yet, so when it will be forwarded by another node, this + * node will be triggered. */ + will_be_triggered_by_other_node = true; - locked_node.delayed_required_outputs.append(DOutputSocket(origin_socket)); + locked_node.delayed_required_outputs.append(DOutputSocket(origin_socket)); + } } /* If this node will be triggered by another node, we don't have to schedule it now. */ if (!will_be_triggered_by_other_node) { @@ -1455,9 +1456,11 @@ Vector<GMutablePointer> NodeParamsProvider::extract_multi_input(StringRef identi Vector<GMutablePointer> ret_values; socket.foreach_origin_socket([&](DSocket origin) { - for (const MultiInputValueItem &item : multi_value.items) { - if (item.origin == origin) { + for (MultiInputValueItem &item : multi_value.items) { + if (item.origin == origin && item.value != nullptr) { ret_values.append({*input_state.type, item.value}); + /* Make sure we do not use the same value again if two values have the same origin. */ + item.value = nullptr; return; } } diff --git a/source/blender/modifiers/intern/MOD_particleinstance.c b/source/blender/modifiers/intern/MOD_particleinstance.c index 60c5667472e..62ac9d4452d 100644 --- a/source/blender/modifiers/intern/MOD_particleinstance.c +++ b/source/blender/modifiers/intern/MOD_particleinstance.c @@ -383,7 +383,7 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, Mesh * vert_part_value[vindex] = p_random; } - /*change orientation based on object trackflag*/ + /* Change orientation based on object trackflag. */ copy_v3_v3(temp_co, mv->co); mv->co[axis] = temp_co[track]; mv->co[(axis + 1) % 3] = temp_co[(track + 1) % 3]; @@ -490,7 +490,7 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, Mesh * mul_m4_v3(spacemat, mv->co); } - /* create edges and adjust edge vertex indices*/ + /* Create edges and adjust edge vertex indices. */ CustomData_copy_data(&mesh->edata, &result->edata, 0, p_skip * totedge, totedge); MEdge *me = &result->medge[p_skip * totedge]; for (k = 0; k < totedge; k++, me++) { diff --git a/source/blender/modifiers/intern/MOD_screw.c b/source/blender/modifiers/intern/MOD_screw.c index b236e0896b7..b90bf91dcb8 100644 --- a/source/blender/modifiers/intern/MOD_screw.c +++ b/source/blender/modifiers/intern/MOD_screw.c @@ -341,7 +341,6 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, Mesh * #endif } else { - /* exis char is used by i_rotate*/ axis_char = (char)(axis_char + ltmd->axis); /* 'X' + axis */ /* useful to be able to use the axis vec in some cases still */ @@ -518,7 +517,7 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, Mesh * } } else { - /*printf("\n\n\n\n\nStarting Modifier\n");*/ + // printf("\n\n\n\n\nStarting Modifier\n"); /* set edge users */ med_new = medge_new; mv_new = mvert_new; @@ -539,7 +538,7 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, Mesh * vc->dist = vc->co[other_axis_1] * vc->co[other_axis_1] + vc->co[other_axis_2] * vc->co[other_axis_2]; - /* printf("location %f %f %f -- %f\n", vc->co[0], vc->co[1], vc->co[2], vc->dist);*/ + // printf("location %f %f %f -- %f\n", vc->co[0], vc->co[1], vc->co[2], vc->dist); } } else { @@ -556,7 +555,7 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, Mesh * vc->dist = vc->co[other_axis_1] * vc->co[other_axis_1] + vc->co[other_axis_2] * vc->co[other_axis_2]; - /* printf("location %f %f %f -- %f\n", vc->co[0], vc->co[1], vc->co[2], vc->dist);*/ + // printf("location %f %f %f -- %f\n", vc->co[0], vc->co[1], vc->co[2], vc->dist); } } @@ -606,43 +605,43 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, Mesh * /* compiler complains if not initialized, but it should be initialized below */ bool ed_loop_flip = false; - /*printf("Loop on connected vert: %i\n", i);*/ + // printf("Loop on connected vert: %i\n", i); for (j = 0; j < 2; j++) { - /*printf("\tSide: %i\n", j);*/ + // printf("\tSide: %i\n", j); screwvert_iter_init(<_iter, vert_connect, i, j); if (j == 1) { screwvert_iter_step(<_iter); } while (lt_iter.v_poin) { - /*printf("\t\tVERT: %i\n", lt_iter.v);*/ + // printf("\t\tVERT: %i\n", lt_iter.v); if (lt_iter.v_poin->flag) { - /*printf("\t\t\tBreaking Found end\n");*/ + // printf("\t\t\tBreaking Found end\n"); // endpoints[0] = endpoints[1] = SV_UNUSED; ed_loop_closed = 1; /* circle */ break; } lt_iter.v_poin->flag = 1; vc_tot_linked++; - /*printf("Testing 2 floats %f : %f\n", fl, lt_iter.v_poin->dist);*/ + // printf("Testing 2 floats %f : %f\n", fl, lt_iter.v_poin->dist); if (fl <= lt_iter.v_poin->dist) { fl = lt_iter.v_poin->dist; v_best = lt_iter.v; - /*printf("\t\t\tVERT BEST: %i\n", v_best);*/ + // printf("\t\t\tVERT BEST: %i\n", v_best); } screwvert_iter_step(<_iter); if (!lt_iter.v_poin) { - /*printf("\t\t\tFound End Also Num %i\n", j);*/ - /*endpoints[j] = lt_iter.v_other;*/ /* other is still valid */ + // printf("\t\t\tFound End Also Num %i\n", j); + // endpoints[j] = lt_iter.v_other; /* other is still valid */ break; } } } - /* now we have a collection of used edges. flip their edges the right way*/ - /*if (v_best != SV_UNUSED) - */ + /* Now we have a collection of used edges. flip their edges the right way. */ + /* if (v_best != SV_UNUSED) - */ - /*printf("Done Looking - vc_tot_linked: %i\n", vc_tot_linked);*/ + // printf("Done Looking - vc_tot_linked: %i\n", vc_tot_linked); if (vc_tot_linked > 1) { float vf_1, vf_2, vf_best; @@ -654,8 +653,8 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, Mesh * /* edge connects on each side! */ if (SV_IS_VALID(vc_tmp->v[0]) && SV_IS_VALID(vc_tmp->v[1])) { - /*printf("Verts on each side (%i %i)\n", vc_tmp->v[0], vc_tmp->v[1]);*/ - /* find out which is higher */ + // printf("Verts on each side (%i %i)\n", vc_tmp->v[0], vc_tmp->v[1]); + /* Find out which is higher. */ vf_1 = tmpf1[ltmd->axis]; vf_2 = tmpf2[ltmd->axis]; @@ -682,8 +681,8 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, Mesh * } } } - else if (SV_IS_VALID(vc_tmp->v[0])) { /*vertex only connected on 1 side */ - /*printf("Verts on ONE side (%i %i)\n", vc_tmp->v[0], vc_tmp->v[1]);*/ + else if (SV_IS_VALID(vc_tmp->v[0])) { /* Vertex only connected on 1 side. */ + // printf("Verts on ONE side (%i %i)\n", vc_tmp->v[0], vc_tmp->v[1]); if (tmpf1[ltmd->axis] < vc_tmp->co[ltmd->axis]) { /* best is above */ ed_loop_flip = 1; } @@ -697,7 +696,7 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, Mesh * } #endif - /*printf("flip direction %i\n", ed_loop_flip);*/ + // printf("flip direction %i\n", ed_loop_flip); /* Switch the flip option if set * NOTE: flip is now done at face level so copying group slices is easier. */ @@ -713,10 +712,10 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, Mesh * /* if its closed, we only need 1 loop */ for (j = ed_loop_closed; j < 2; j++) { - /*printf("Ordering Side J %i\n", j);*/ + // printf("Ordering Side J %i\n", j); screwvert_iter_init(<_iter, vert_connect, v_best, j); - /*printf("\n\nStarting - Loop\n");*/ + // printf("\n\nStarting - Loop\n"); lt_iter.v_poin->flag = 1; /* so a non loop will traverse the other side */ /* If this is the vert off the best vert and @@ -727,13 +726,13 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, Mesh * } while (lt_iter.v_poin && lt_iter.v_poin->flag != 2) { - /*printf("\tOrdering Vert V %i\n", lt_iter.v);*/ + // printf("\tOrdering Vert V %i\n", lt_iter.v); lt_iter.v_poin->flag = 2; if (lt_iter.e) { if (lt_iter.v == lt_iter.e->v1) { if (ed_loop_flip == 0) { - /*printf("\t\t\tFlipping 0\n");*/ + // printf("\t\t\tFlipping 0\n"); SWAP(uint, lt_iter.e->v1, lt_iter.e->v2); } #if 0 @@ -744,7 +743,7 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, Mesh * } else if (lt_iter.v == lt_iter.e->v2) { if (ed_loop_flip == 1) { - /*printf("\t\t\tFlipping 1\n");*/ + // printf("\t\t\tFlipping 1\n"); SWAP(uint, lt_iter.e->v1, lt_iter.e->v2); } #if 0 diff --git a/source/blender/modifiers/intern/MOD_simpledeform.c b/source/blender/modifiers/intern/MOD_simpledeform.c index db01dec4d19..39ebc415021 100644 --- a/source/blender/modifiers/intern/MOD_simpledeform.c +++ b/source/blender/modifiers/intern/MOD_simpledeform.c @@ -263,28 +263,24 @@ static void simple_helper(void *__restrict userdata, copy_v3_v3_map(dcut_remap, dcut, axis_map); switch (curr_deform_data->mode) { case MOD_SIMPLEDEFORM_MODE_TWIST: - simpleDeform_twist(curr_deform_data->smd_factor, - curr_deform_data->deform_axis, - dcut_remap, - co_remap); /* apply deform */ + /* Apply deform. */ + simpleDeform_twist( + curr_deform_data->smd_factor, curr_deform_data->deform_axis, dcut_remap, co_remap); break; case MOD_SIMPLEDEFORM_MODE_BEND: - simpleDeform_bend(curr_deform_data->smd_factor, - curr_deform_data->deform_axis, - dcut_remap, - co_remap); /* apply deform */ + /* Apply deform. */ + simpleDeform_bend( + curr_deform_data->smd_factor, curr_deform_data->deform_axis, dcut_remap, co_remap); break; case MOD_SIMPLEDEFORM_MODE_TAPER: - simpleDeform_taper(curr_deform_data->smd_factor, - curr_deform_data->deform_axis, - dcut_remap, - co_remap); /* apply deform */ + /* Apply deform. */ + simpleDeform_taper( + curr_deform_data->smd_factor, curr_deform_data->deform_axis, dcut_remap, co_remap); break; case MOD_SIMPLEDEFORM_MODE_STRETCH: - simpleDeform_stretch(curr_deform_data->smd_factor, - curr_deform_data->deform_axis, - dcut_remap, - co_remap); /* apply deform */ + /* Apply deform. */ + simpleDeform_stretch( + curr_deform_data->smd_factor, curr_deform_data->deform_axis, dcut_remap, co_remap); break; default: return; /* No simple-deform mode? */ diff --git a/source/blender/modifiers/intern/MOD_solidify_extrude.c b/source/blender/modifiers/intern/MOD_solidify_extrude.c index a77a6e595ad..95fb87bb54c 100644 --- a/source/blender/modifiers/intern/MOD_solidify_extrude.c +++ b/source/blender/modifiers/intern/MOD_solidify_extrude.c @@ -199,7 +199,7 @@ Mesh *MOD_solidify_extrude_modifyMesh(ModifierData *md, const ModifierEvalContex const uint numLoops = (uint)mesh->totloop; uint newLoops = 0, newPolys = 0, newEdges = 0, newVerts = 0, rimVerts = 0; - /* only use material offsets if we have 2 or more materials */ + /* Only use material offsets if we have 2 or more materials. */ const short mat_nr_max = ctx->object->totcol > 1 ? ctx->object->totcol - 1 : 0; const short mat_ofs = mat_nr_max ? smd->mat_ofs : 0; const short mat_ofs_rim = mat_nr_max ? smd->mat_ofs_rim : 0; @@ -424,7 +424,7 @@ Mesh *MOD_solidify_extrude_modifyMesh(ModifierData *md, const ModifierEvalContex CustomData_copy_data(&mesh->pdata, &result->pdata, 0, 0, (int)numPolys); } - /* initializes: (i_end, do_shell_align, mv) */ + /* initializes: (i_end, do_shell_align, mv). */ #define INIT_VERT_ARRAY_OFFSETS(test) \ if (((ofs_new >= ofs_orig) == do_flip) == test) { \ i_end = numVerts; \ diff --git a/source/blender/modifiers/intern/MOD_subsurf.c b/source/blender/modifiers/intern/MOD_subsurf.c index 4dc45ad0324..ce427281db3 100644 --- a/source/blender/modifiers/intern/MOD_subsurf.c +++ b/source/blender/modifiers/intern/MOD_subsurf.c @@ -351,7 +351,7 @@ static bool get_show_adaptive_options(const bContext *C, Panel *panel) return false; } - /* Don't show adaptive options if regular subdivision used*/ + /* Don't show adaptive options if regular subdivision used. */ if (!RNA_boolean_get(ptr, "use_limit_surface")) { return false; } diff --git a/source/blender/modifiers/intern/MOD_surfacedeform.c b/source/blender/modifiers/intern/MOD_surfacedeform.c index 0cc68c2c4a3..dd011a293ee 100644 --- a/source/blender/modifiers/intern/MOD_surfacedeform.c +++ b/source/blender/modifiers/intern/MOD_surfacedeform.c @@ -675,7 +675,7 @@ BLI_INLINE SDefBindWeightData *computeBindWeights(SDefBindCalcData *const data, inf_weight_flags |= MOD_SDEF_INFINITE_WEIGHT_DIST_PROJ; } else { - /* Compute angles between the point and the edge mid vectors. */ + /* Compute angles between the point and the edge mid vectors. */ float cent_point_vec[2], point_angles[2]; sub_v2_v2v2(cent_point_vec, bpoly->point_v2, bpoly->centroid_v2); diff --git a/source/blender/modifiers/intern/MOD_ui_common.c b/source/blender/modifiers/intern/MOD_ui_common.c index 0be5c164089..09fa7e9c8ac 100644 --- a/source/blender/modifiers/intern/MOD_ui_common.c +++ b/source/blender/modifiers/intern/MOD_ui_common.c @@ -346,7 +346,7 @@ static void modifier_panel_header(const bContext *C, Panel *panel) else if (ELEM(ob->type, OB_CURVE, OB_SURF, OB_FONT)) { /* Some modifiers can work with pre-tessellated curves only. */ if (ELEM(md->type, eModifierType_Hook, eModifierType_Softbody, eModifierType_MeshDeform)) { - /* Add button (appearing to be ON) and add tip why this cant be changed. */ + /* Add button (appearing to be ON) and add tip why this can't be changed. */ sub = uiLayoutRow(row, true); uiBlock *block = uiLayoutGetBlock(sub); static int apply_on_spline_always_on_hack = eModifierMode_ApplyOnSpline; diff --git a/source/blender/modifiers/intern/MOD_uvproject.c b/source/blender/modifiers/intern/MOD_uvproject.c index 724d1370a47..9f86727ce0a 100644 --- a/source/blender/modifiers/intern/MOD_uvproject.c +++ b/source/blender/modifiers/intern/MOD_uvproject.c @@ -169,7 +169,7 @@ static Mesh *uvprojectModifier_do(UVProjectModifierData *umd, BKE_camera_params_init(¶ms); BKE_camera_params_from_object(¶ms, projectors[i].ob); - /* compute matrix, viewplane, .. */ + /* Compute matrix, view-plane, etc. */ BKE_camera_params_compute_viewplane(¶ms, 1, 1, aspx, aspy); /* scale the view-plane */ diff --git a/source/blender/modifiers/intern/MOD_wave.c b/source/blender/modifiers/intern/MOD_wave.c index c6bab89247e..cf4c195c66d 100644 --- a/source/blender/modifiers/intern/MOD_wave.c +++ b/source/blender/modifiers/intern/MOD_wave.c @@ -271,7 +271,7 @@ static void waveModifier_do(WaveModifierData *md, amplit = amplit * wmd->narrow; amplit = (float)(1.0f / expf(amplit * amplit) - minfac); - /*apply texture*/ + /* Apply texture. */ if (tex_co) { Scene *scene = DEG_get_evaluated_scene(ctx->depsgraph); TexResult texres; @@ -280,7 +280,7 @@ static void waveModifier_do(WaveModifierData *md, amplit *= texres.tin; } - /*apply weight & falloff */ + /* Apply weight & falloff. */ amplit *= def_weight * falloff_fac; if (mvert) { diff --git a/source/blender/nodes/NOD_node_tree_ref.hh b/source/blender/nodes/NOD_node_tree_ref.hh index b028fc28bbc..4f2565cbbaf 100644 --- a/source/blender/nodes/NOD_node_tree_ref.hh +++ b/source/blender/nodes/NOD_node_tree_ref.hh @@ -146,7 +146,7 @@ class InputSocketRef final : public SocketRef { void foreach_logical_origin(FunctionRef<void(const OutputSocketRef &)> origin_fn, FunctionRef<void(const SocketRef &)> skipped_fn, bool only_follow_first_input_link, - Vector<const InputSocketRef *> &handled_sockets) const; + Vector<const InputSocketRef *> &seen_sockets_stack) const; }; class OutputSocketRef final : public SocketRef { @@ -159,7 +159,7 @@ class OutputSocketRef final : public SocketRef { private: void foreach_logical_target(FunctionRef<void(const InputSocketRef &)> target_fn, FunctionRef<void(const SocketRef &)> skipped_fn, - Vector<const OutputSocketRef *> &handled_sockets) const; + Vector<const OutputSocketRef *> &seen_sockets_stack) const; }; class NodeRef : NonCopyable, NonMovable { diff --git a/source/blender/nodes/composite/nodes/node_composite_channelMatte.c b/source/blender/nodes/composite/nodes/node_composite_channelMatte.c index 29d6335e685..9912c10b368 100644 --- a/source/blender/nodes/composite/nodes/node_composite_channelMatte.c +++ b/source/blender/nodes/composite/nodes/node_composite_channelMatte.c @@ -44,10 +44,10 @@ static void node_composit_init_channel_matte(bNodeTree *UNUSED(ntree), bNode *no c->t3 = 0.0f; c->fsize = 0.0f; c->fstrength = 0.0f; - c->algorithm = 1; /*max channel limiting */ - c->channel = 1; /* limit by red */ - node->custom1 = 1; /* RGB channel */ - node->custom2 = 2; /* Green Channel */ + c->algorithm = 1; /* Max channel limiting. */ + c->channel = 1; /* Limit by red. */ + node->custom1 = 1; /* RGB channel. */ + node->custom2 = 2; /* Green Channel. */ } void register_node_type_cmp_channel_matte(void) diff --git a/source/blender/nodes/composite/nodes/node_composite_levels.c b/source/blender/nodes/composite/nodes/node_composite_levels.c index 5e7a61377fb..7c70ccf412a 100644 --- a/source/blender/nodes/composite/nodes/node_composite_levels.c +++ b/source/blender/nodes/composite/nodes/node_composite_levels.c @@ -37,7 +37,7 @@ static bNodeSocketTemplate cmp_node_view_levels_out[] = { static void node_composit_init_view_levels(bNodeTree *UNUSED(ntree), bNode *node) { - node->custom1 = 1; /*All channels*/ + node->custom1 = 1; /* All channels. */ } void register_node_type_cmp_view_levels(void) diff --git a/source/blender/nodes/composite/nodes/node_composite_rotate.c b/source/blender/nodes/composite/nodes/node_composite_rotate.c index b1ed09966c0..7dd39d5eaa1 100644 --- a/source/blender/nodes/composite/nodes/node_composite_rotate.c +++ b/source/blender/nodes/composite/nodes/node_composite_rotate.c @@ -37,7 +37,7 @@ static bNodeSocketTemplate cmp_node_rotate_out[] = { static void node_composit_init_rotate(bNodeTree *UNUSED(ntree), bNode *node) { - node->custom1 = 1; /* Bilinear Filter*/ + node->custom1 = 1; /* Bilinear Filter. */ } void register_node_type_cmp_rotate(void) diff --git a/source/blender/nodes/geometry/nodes/node_geo_curve_resample.cc b/source/blender/nodes/geometry/nodes/node_geo_curve_resample.cc index e879ec624c0..fc65d1754e9 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_curve_resample.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_curve_resample.cc @@ -94,16 +94,16 @@ static SplinePtr resample_spline(const Spline &input_spline, const int count) Array<float> uniform_samples = input_spline.sample_uniform_index_factors(count); - input_spline.sample_based_on_index_factors<float3>( + input_spline.sample_with_index_factors<float3>( input_spline.evaluated_positions(), uniform_samples, output_spline->positions()); - input_spline.sample_based_on_index_factors<float>( - input_spline.interpolate_to_evaluated_points(input_spline.radii()), + input_spline.sample_with_index_factors<float>( + input_spline.interpolate_to_evaluated(input_spline.radii()), uniform_samples, output_spline->radii()); - input_spline.sample_based_on_index_factors<float>( - input_spline.interpolate_to_evaluated_points(input_spline.tilts()), + input_spline.sample_with_index_factors<float>( + input_spline.interpolate_to_evaluated(input_spline.tilts()), uniform_samples, output_spline->tilts()); @@ -123,8 +123,8 @@ static SplinePtr resample_spline(const Spline &input_spline, const int count) return false; } - input_spline.sample_based_on_index_factors( - *input_spline.interpolate_to_evaluated_points(*input_attribute), + input_spline.sample_with_index_factors( + *input_spline.interpolate_to_evaluated(*input_attribute), uniform_samples, *output_attribute); @@ -138,19 +138,28 @@ static SplinePtr resample_spline(const Spline &input_spline, const int count) static std::unique_ptr<CurveEval> resample_curve(const CurveEval &input_curve, const SampleModeParam &mode_param) { - std::unique_ptr<CurveEval> output_curve = std::make_unique<CurveEval>(); + Span<SplinePtr> input_splines = input_curve.splines(); - for (const SplinePtr &spline : input_curve.splines()) { - if (mode_param.mode == GEO_NODE_CURVE_SAMPLE_COUNT) { - BLI_assert(mode_param.count); - output_curve->add_spline(resample_spline(*spline, *mode_param.count)); - } - else if (mode_param.mode == GEO_NODE_CURVE_SAMPLE_LENGTH) { - BLI_assert(mode_param.length); - const float length = spline->length(); - const int count = std::max(int(length / *mode_param.length), 1); - output_curve->add_spline(resample_spline(*spline, count)); - } + std::unique_ptr<CurveEval> output_curve = std::make_unique<CurveEval>(); + output_curve->resize(input_splines.size()); + MutableSpan<SplinePtr> output_splines = output_curve->splines(); + + if (mode_param.mode == GEO_NODE_CURVE_SAMPLE_COUNT) { + threading::parallel_for(input_splines.index_range(), 128, [&](IndexRange range) { + for (const int i : range) { + BLI_assert(mode_param.count); + output_splines[i] = resample_spline(*input_splines[i], *mode_param.count); + } + }); + } + else if (mode_param.mode == GEO_NODE_CURVE_SAMPLE_LENGTH) { + threading::parallel_for(input_splines.index_range(), 128, [&](IndexRange range) { + for (const int i : range) { + const float length = input_splines[i]->length(); + const int count = std::max(int(length / *mode_param.length), 1); + output_splines[i] = resample_spline(*input_splines[i], count); + } + }); } output_curve->attributes = input_curve.attributes; diff --git a/source/blender/nodes/geometry/nodes/node_geo_curve_subdivide.cc b/source/blender/nodes/geometry/nodes/node_geo_curve_subdivide.cc index fdb01fa07cf..3de2604cd0a 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_curve_subdivide.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_curve_subdivide.cc @@ -329,7 +329,7 @@ static SplinePtr subdivide_spline(const Spline &spline, * point facilitates subdividing in parallel later. */ Array<int> offsets = get_subdivided_offsets(spline, cuts, spline_offset); const int result_size = offsets.last() + int(!spline.is_cyclic()); - SplinePtr new_spline = spline.copy_settings(); + SplinePtr new_spline = spline.copy_only_settings(); new_spline->resize(result_size); subdivide_builtin_attributes(spline, offsets, *new_spline); subdivide_dynamic_attributes(spline, offsets, *new_spline); diff --git a/source/blender/nodes/geometry/nodes/node_geo_curve_to_mesh.cc b/source/blender/nodes/geometry/nodes/node_geo_curve_to_mesh.cc index b6f04352929..c0d817385e2 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_curve_to_mesh.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_curve_to_mesh.cc @@ -16,7 +16,7 @@ #include "BLI_array.hh" #include "BLI_float4x4.hh" -#include "BLI_timeit.hh" +#include "BLI_task.hh" #include "DNA_mesh_types.h" #include "DNA_meshdata_types.h" @@ -47,8 +47,8 @@ static void vert_extrude_to_mesh_data(const Spline &spline, const float3 profile_vert, MutableSpan<MVert> r_verts, MutableSpan<MEdge> r_edges, - int &vert_offset, - int &edge_offset) + int vert_offset, + int edge_offset) { Span<float3> positions = spline.evaluated_positions(); @@ -85,10 +85,10 @@ static void spline_extrude_to_mesh_data(const Spline &spline, MutableSpan<MEdge> r_edges, MutableSpan<MLoop> r_loops, MutableSpan<MPoly> r_polys, - int &vert_offset, - int &edge_offset, - int &loop_offset, - int &poly_offset) + int vert_offset, + int edge_offset, + int loop_offset, + int poly_offset) { const int spline_vert_len = spline.evaluated_points_size(); const int spline_edge_len = spline.evaluated_edges_size(); @@ -181,7 +181,7 @@ static void spline_extrude_to_mesh_data(const Spline &spline, Span<float3> normals = spline.evaluated_normals(); Span<float3> profile_positions = profile_spline.evaluated_positions(); - GVArray_Typed<float> radii = spline.interpolate_to_evaluated_points(spline.radii()); + GVArray_Typed<float> radii = spline.interpolate_to_evaluated(spline.radii()); for (const int i_ring : IndexRange(spline_vert_len)) { float4x4 point_matrix = float4x4::from_normalized_axis_data( positions[i_ring], normals[i_ring], tangents[i_ring]); @@ -207,63 +207,114 @@ static void spline_extrude_to_mesh_data(const Spline &spline, } } -static Mesh *curve_to_mesh_calculate(const CurveEval &curve, const CurveEval &profile_curve) +static inline int spline_extrude_vert_size(const Spline &curve, const Spline &profile) { - int profile_vert_total = 0; - int profile_edge_total = 0; - for (const SplinePtr &profile_spline : profile_curve.splines()) { - profile_vert_total += profile_spline->evaluated_points_size(); - profile_edge_total += profile_spline->evaluated_edges_size(); - } + return curve.evaluated_points_size() * profile.evaluated_points_size(); +} - int vert_total = 0; - int edge_total = 0; - int poly_total = 0; - for (const SplinePtr &spline : curve.splines()) { - const int spline_vert_len = spline->evaluated_points_size(); - const int spline_edge_len = spline->evaluated_edges_size(); - vert_total += spline_vert_len * profile_vert_total; - poly_total += spline_edge_len * profile_edge_total; - - /* Add the ring edges, with one ring for every curve vertex, and the edge loops - * that run along the length of the curve, starting on the first profile. */ - edge_total += profile_edge_total * spline_vert_len + profile_vert_total * spline_edge_len; - } - const int corner_total = poly_total * 4; +static inline int spline_extrude_edge_size(const Spline &curve, const Spline &profile) +{ + /* Add the ring edges, with one ring for every curve vertex, and the edge loops + * that run along the length of the curve, starting on the first profile. */ + return curve.evaluated_points_size() * profile.evaluated_edges_size() + + curve.evaluated_edges_size() * profile.evaluated_points_size(); +} - if (vert_total == 0) { - return nullptr; - } +static inline int spline_extrude_loop_size(const Spline &curve, const Spline &profile) +{ + return curve.evaluated_edges_size() * profile.evaluated_edges_size() * 4; +} - Mesh *mesh = BKE_mesh_new_nomain(vert_total, edge_total, 0, corner_total, poly_total); - BKE_id_material_eval_ensure_default_slot(&mesh->id); - MutableSpan<MVert> verts{mesh->mvert, mesh->totvert}; - MutableSpan<MEdge> edges{mesh->medge, mesh->totedge}; - MutableSpan<MLoop> loops{mesh->mloop, mesh->totloop}; - MutableSpan<MPoly> polys{mesh->mpoly, mesh->totpoly}; - mesh->flag |= ME_AUTOSMOOTH; - mesh->smoothresh = DEG2RADF(180.0f); +static inline int spline_extrude_poly_size(const Spline &curve, const Spline &profile) +{ + return curve.evaluated_edges_size() * profile.evaluated_edges_size(); +} +struct ResultOffsets { + Array<int> vert; + Array<int> edge; + Array<int> loop; + Array<int> poly; +}; +static ResultOffsets calculate_result_offsets(Span<SplinePtr> profiles, Span<SplinePtr> curves) +{ + const int total = profiles.size() * curves.size(); + Array<int> vert(total + 1); + Array<int> edge(total + 1); + Array<int> loop(total + 1); + Array<int> poly(total + 1); + + int mesh_index = 0; int vert_offset = 0; int edge_offset = 0; int loop_offset = 0; int poly_offset = 0; - for (const SplinePtr &spline : curve.splines()) { - for (const SplinePtr &profile_spline : profile_curve.splines()) { - spline_extrude_to_mesh_data(*spline, - *profile_spline, - verts, - edges, - loops, - polys, - vert_offset, - edge_offset, - loop_offset, - poly_offset); + for (const int i_spline : curves.index_range()) { + for (const int i_profile : profiles.index_range()) { + vert[mesh_index] = vert_offset; + edge[mesh_index] = edge_offset; + loop[mesh_index] = loop_offset; + poly[mesh_index] = poly_offset; + vert_offset += spline_extrude_vert_size(*curves[i_spline], *profiles[i_profile]); + edge_offset += spline_extrude_edge_size(*curves[i_spline], *profiles[i_profile]); + loop_offset += spline_extrude_loop_size(*curves[i_spline], *profiles[i_profile]); + poly_offset += spline_extrude_poly_size(*curves[i_spline], *profiles[i_profile]); + mesh_index++; } } + vert.last() = vert_offset; + edge.last() = edge_offset; + loop.last() = loop_offset; + poly.last() = poly_offset; + + return {std::move(vert), std::move(edge), std::move(loop), std::move(poly)}; +} + +/** + * \note Normal calculation is by far the slowest part of calculations relating to the result mesh. + * Although it would be a sensible decision to use the better topology information available while + * generating the mesh to also generate the normals, that work may wasted if the output mesh is + * changed anyway in a way that affects the normals. So currently this code uses the safer / + * simpler solution of not calculating normals. + */ +static Mesh *curve_to_mesh_calculate(const CurveEval &curve, const CurveEval &profile) +{ + Span<SplinePtr> profiles = profile.splines(); + Span<SplinePtr> curves = curve.splines(); + + const ResultOffsets offsets = calculate_result_offsets(profiles, curves); + if (offsets.vert.last() == 0) { + return nullptr; + } - BKE_mesh_calc_normals(mesh); + Mesh *mesh = BKE_mesh_new_nomain( + offsets.vert.last(), offsets.edge.last(), 0, offsets.loop.last(), offsets.poly.last()); + BKE_id_material_eval_ensure_default_slot(&mesh->id); + mesh->flag |= ME_AUTOSMOOTH; + mesh->smoothresh = DEG2RADF(180.0f); + mesh->runtime.cd_dirty_vert |= CD_MASK_NORMAL; + mesh->runtime.cd_dirty_poly |= CD_MASK_NORMAL; + + threading::parallel_for(curves.index_range(), 128, [&](IndexRange curves_range) { + for (const int i_spline : curves_range) { + const int spline_start_index = i_spline * profiles.size(); + threading::parallel_for(profiles.index_range(), 128, [&](IndexRange profiles_range) { + for (const int i_profile : profiles_range) { + const int i_mesh = spline_start_index + i_profile; + spline_extrude_to_mesh_data(*curves[i_spline], + *profiles[i_profile], + {mesh->mvert, mesh->totvert}, + {mesh->medge, mesh->totedge}, + {mesh->mloop, mesh->totloop}, + {mesh->mpoly, mesh->totpoly}, + offsets.vert[i_mesh], + offsets.edge[i_mesh], + offsets.loop[i_mesh], + offsets.poly[i_mesh]); + } + }); + } + }); return mesh; } diff --git a/source/blender/nodes/geometry/nodes/node_geo_curve_to_points.cc b/source/blender/nodes/geometry/nodes/node_geo_curve_to_points.cc index 26ff1dbe9dc..2725c625913 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_curve_to_points.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_curve_to_points.cc @@ -186,7 +186,7 @@ static ResultAttributes create_point_attributes(PointCloudComponent &points, /** * TODO: For non-poly splines, this has double copies that could be avoided as part - * of a general look at optimizing uses of #interpolate_to_evaluated_points. + * of a general look at optimizing uses of #Spline::interpolate_to_evaluated. */ static void copy_evaluated_point_attributes(Span<SplinePtr> splines, Span<int> offsets, @@ -199,10 +199,8 @@ static void copy_evaluated_point_attributes(Span<SplinePtr> splines, const int size = offsets[i + 1] - offsets[i]; data.positions.slice(offset, size).copy_from(spline.evaluated_positions()); - spline.interpolate_to_evaluated_points(spline.radii()) - ->materialize(data.radii.slice(offset, size)); - spline.interpolate_to_evaluated_points(spline.tilts()) - ->materialize(data.tilts.slice(offset, size)); + spline.interpolate_to_evaluated(spline.radii())->materialize(data.radii.slice(offset, size)); + spline.interpolate_to_evaluated(spline.tilts())->materialize(data.tilts.slice(offset, size)); for (const Map<std::string, GMutableSpan>::Item &item : data.point_attributes.items()) { const StringRef name = item.key; @@ -211,7 +209,7 @@ static void copy_evaluated_point_attributes(Span<SplinePtr> splines, BLI_assert(spline.attributes.get_for_read(name)); GSpan spline_span = *spline.attributes.get_for_read(name); - spline.interpolate_to_evaluated_points(spline_span) + spline.interpolate_to_evaluated(spline_span) ->materialize(point_span.slice(offset, size).data()); } @@ -236,18 +234,16 @@ static void copy_uniform_sample_point_attributes(Span<SplinePtr> splines, const Array<float> uniform_samples = spline.sample_uniform_index_factors(size); - spline.sample_based_on_index_factors<float3>( + spline.sample_with_index_factors<float3>( spline.evaluated_positions(), uniform_samples, data.positions.slice(offset, size)); - spline.sample_based_on_index_factors<float>( - spline.interpolate_to_evaluated_points(spline.radii()), - uniform_samples, - data.radii.slice(offset, size)); + spline.sample_with_index_factors<float>(spline.interpolate_to_evaluated(spline.radii()), + uniform_samples, + data.radii.slice(offset, size)); - spline.sample_based_on_index_factors<float>( - spline.interpolate_to_evaluated_points(spline.tilts()), - uniform_samples, - data.tilts.slice(offset, size)); + spline.sample_with_index_factors<float>(spline.interpolate_to_evaluated(spline.tilts()), + uniform_samples, + data.tilts.slice(offset, size)); for (const Map<std::string, GMutableSpan>::Item &item : data.point_attributes.items()) { const StringRef name = item.key; @@ -256,18 +252,18 @@ static void copy_uniform_sample_point_attributes(Span<SplinePtr> splines, BLI_assert(spline.attributes.get_for_read(name)); GSpan spline_span = *spline.attributes.get_for_read(name); - spline.sample_based_on_index_factors(*spline.interpolate_to_evaluated_points(spline_span), - uniform_samples, - point_span.slice(offset, size)); + spline.sample_with_index_factors(*spline.interpolate_to_evaluated(spline_span), + uniform_samples, + point_span.slice(offset, size)); } - spline.sample_based_on_index_factors<float3>( + spline.sample_with_index_factors<float3>( spline.evaluated_tangents(), uniform_samples, data.tangents.slice(offset, size)); for (float3 &tangent : data.tangents) { tangent.normalize(); } - spline.sample_based_on_index_factors<float3>( + spline.sample_with_index_factors<float3>( spline.evaluated_normals(), uniform_samples, data.normals.slice(offset, size)); for (float3 &normals : data.normals) { normals.normalize(); diff --git a/source/blender/nodes/geometry/nodes/node_geo_delete_geometry.cc b/source/blender/nodes/geometry/nodes/node_geo_delete_geometry.cc index 910adc467d6..b1da2dcd3c4 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_delete_geometry.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_delete_geometry.cc @@ -120,7 +120,7 @@ static void copy_dynamic_attributes(const CustomDataAttributes &src, static SplinePtr spline_delete(const Spline &spline, const IndexMask mask) { - SplinePtr new_spline = spline.copy_settings(); + SplinePtr new_spline = spline.copy_only_settings(); new_spline->resize(mask.size()); spline_copy_builtin_attributes(spline, *new_spline, mask); diff --git a/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_cube.cc b/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_cube.cc index 5cc4f7dd064..9f7858e3ef7 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_cube.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_cube.cc @@ -43,6 +43,7 @@ Mesh *create_cube_mesh(const float size) const BMeshCreateParams bmcp = {true}; const BMAllocTemplate allocsize = {8, 12, 24, 6}; BMesh *bm = BM_mesh_create(&allocsize, &bmcp); + BM_data_layer_add_named(bm, &bm->ldata, CD_MLOOPUV, nullptr); BMO_op_callf(bm, BMO_FLAG_DEFAULTS, diff --git a/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_ico_sphere.cc b/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_ico_sphere.cc index 540d0d2a35f..6e85c0c1af1 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_ico_sphere.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_ico_sphere.cc @@ -26,7 +26,7 @@ static bNodeSocketTemplate geo_node_mesh_primitive_ico_sphere_in[] = { {SOCK_FLOAT, N_("Radius"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, FLT_MAX, PROP_DISTANCE}, - {SOCK_INT, N_("Subdivisions"), 1, 0, 0, 0, 0, 7}, + {SOCK_INT, N_("Subdivisions"), 1, 0, 0, 0, 1, 7}, {-1, ""}, }; @@ -44,6 +44,7 @@ static Mesh *create_ico_sphere_mesh(const int subdivisions, const float radius) const BMeshCreateParams bmcp = {true}; const BMAllocTemplate allocsize = {0, 0, 0, 0}; BMesh *bm = BM_mesh_create(&allocsize, &bmcp); + BM_data_layer_add_named(bm, &bm->ldata, CD_MLOOPUV, nullptr); BMO_op_callf(bm, BMO_FLAG_DEFAULTS, diff --git a/source/blender/nodes/intern/derived_node_tree.cc b/source/blender/nodes/intern/derived_node_tree.cc index 9a3eb574bcd..3d5557d4049 100644 --- a/source/blender/nodes/intern/derived_node_tree.cc +++ b/source/blender/nodes/intern/derived_node_tree.cc @@ -230,7 +230,7 @@ void DInputSocket::foreach_origin_socket(FunctionRef<void(DSocket)> origin_fn) c /* Calls `target_fn` for every "real" target socket. "Real" means that reroutes, muted nodes * and node groups are handled by this function. Target sockets are on the nodes that use the value * from this socket. The `skipped_fn` function is called for sockets that have been skipped during - * the search for target sockets (e.g. reroutes). */ + * the search for target sockets (e.g. reroutes). */ void DOutputSocket::foreach_target_socket(FunctionRef<void(DInputSocket)> target_fn, FunctionRef<void(DSocket)> skipped_fn) const { diff --git a/source/blender/nodes/intern/node_tree_ref.cc b/source/blender/nodes/intern/node_tree_ref.cc index 154ee716153..bed4d60382d 100644 --- a/source/blender/nodes/intern/node_tree_ref.cc +++ b/source/blender/nodes/intern/node_tree_ref.cc @@ -176,12 +176,12 @@ void NodeTreeRef::create_linked_socket_caches() /* Find logically linked sockets. */ Vector<const SocketRef *> logically_linked_sockets; Vector<const SocketRef *> logically_linked_skipped_sockets; - Vector<const InputSocketRef *> handled_sockets; + Vector<const InputSocketRef *> seen_sockets_stack; socket->foreach_logical_origin( [&](const OutputSocketRef &origin) { logically_linked_sockets.append(&origin); }, [&](const SocketRef &socket) { logically_linked_skipped_sockets.append(&socket); }, false, - handled_sockets); + seen_sockets_stack); if (logically_linked_sockets == directly_linked_sockets) { socket->logically_linked_sockets_ = socket->directly_linked_sockets_; } @@ -222,16 +222,17 @@ void NodeTreeRef::create_linked_socket_caches() } } -void InputSocketRef::foreach_logical_origin(FunctionRef<void(const OutputSocketRef &)> origin_fn, - FunctionRef<void(const SocketRef &)> skipped_fn, - bool only_follow_first_input_link, - Vector<const InputSocketRef *> &handled_sockets) const +void InputSocketRef::foreach_logical_origin( + FunctionRef<void(const OutputSocketRef &)> origin_fn, + FunctionRef<void(const SocketRef &)> skipped_fn, + bool only_follow_first_input_link, + Vector<const InputSocketRef *> &seen_sockets_stack) const { /* Protect against loops. */ - if (handled_sockets.contains(this)) { + if (seen_sockets_stack.contains(this)) { return; } - handled_sockets.append(this); + seen_sockets_stack.append(this); Span<const LinkRef *> links_to_check = this->directly_linked_links(); if (only_follow_first_input_link) { @@ -251,7 +252,7 @@ void InputSocketRef::foreach_logical_origin(FunctionRef<void(const OutputSocketR const OutputSocketRef &reroute_output = origin_node.output(0); skipped_fn.call_safe(reroute_input); skipped_fn.call_safe(reroute_output); - reroute_input.foreach_logical_origin(origin_fn, skipped_fn, false, handled_sockets); + reroute_input.foreach_logical_origin(origin_fn, skipped_fn, false, seen_sockets_stack); } else if (origin_node.is_muted()) { for (const InternalLinkRef *internal_link : origin_node.internal_links()) { @@ -259,7 +260,7 @@ void InputSocketRef::foreach_logical_origin(FunctionRef<void(const OutputSocketR const InputSocketRef &mute_input = internal_link->from(); skipped_fn.call_safe(origin); skipped_fn.call_safe(mute_input); - mute_input.foreach_logical_origin(origin_fn, skipped_fn, true, handled_sockets); + mute_input.foreach_logical_origin(origin_fn, skipped_fn, true, seen_sockets_stack); break; } } @@ -268,18 +269,20 @@ void InputSocketRef::foreach_logical_origin(FunctionRef<void(const OutputSocketR origin_fn(origin); } } + + seen_sockets_stack.pop_last(); } void OutputSocketRef::foreach_logical_target( FunctionRef<void(const InputSocketRef &)> target_fn, FunctionRef<void(const SocketRef &)> skipped_fn, - Vector<const OutputSocketRef *> &handled_sockets) const + Vector<const OutputSocketRef *> &seen_sockets_stack) const { /* Protect against loops. */ - if (handled_sockets.contains(this)) { + if (seen_sockets_stack.contains(this)) { return; } - handled_sockets.append(this); + seen_sockets_stack.append(this); for (const LinkRef *link : this->directly_linked_links()) { if (link->is_muted()) { @@ -294,7 +297,7 @@ void OutputSocketRef::foreach_logical_target( const OutputSocketRef &reroute_output = target_node.output(0); skipped_fn.call_safe(target); skipped_fn.call_safe(reroute_output); - reroute_output.foreach_logical_target(target_fn, skipped_fn, handled_sockets); + reroute_output.foreach_logical_target(target_fn, skipped_fn, seen_sockets_stack); } else if (target_node.is_muted()) { skipped_fn.call_safe(target); @@ -309,7 +312,7 @@ void OutputSocketRef::foreach_logical_target( const OutputSocketRef &mute_output = internal_link->to(); skipped_fn.call_safe(target); skipped_fn.call_safe(mute_output); - mute_output.foreach_logical_target(target_fn, skipped_fn, handled_sockets); + mute_output.foreach_logical_target(target_fn, skipped_fn, seen_sockets_stack); } } } @@ -317,6 +320,8 @@ void OutputSocketRef::foreach_logical_target( target_fn(target); } } + + seen_sockets_stack.pop_last(); } namespace { @@ -336,7 +341,7 @@ static std::unique_ptr<SocketIndexByIdentifierMap> create_identifier_map(const L return map; } -/* This function is not threadsafe. */ +/* This function is not threadsafe. */ static SocketByIdentifierMap get_or_create_identifier_map( const bNode &node, const ListBase &sockets, const bNodeSocketTemplate *sockets_template) { diff --git a/source/blender/nodes/shader/node_shader_tree.c b/source/blender/nodes/shader/node_shader_tree.c index 5ec982c4e7f..e23e2ac3b9d 100644 --- a/source/blender/nodes/shader/node_shader_tree.c +++ b/source/blender/nodes/shader/node_shader_tree.c @@ -398,7 +398,7 @@ static void ntree_shader_groups_expand_inputs(bNodeTree *localtree) if (socket->link != NULL && !(socket->link->flag & NODE_LINK_MUTED)) { bNodeLink *link = socket->link; /* Fix the case where the socket is actually converting the data. (see T71374) - * We only do the case of lossy conversion to float.*/ + * We only do the case of lossy conversion to float. */ if ((socket->type == SOCK_FLOAT) && (link->fromsock->type != link->tosock->type)) { if (link->fromsock->type == SOCK_RGBA) { bNode *tmp = nodeAddStaticNode(NULL, localtree, SH_NODE_RGBTOBW); diff --git a/source/blender/nodes/shader/nodes/node_shader_hair_info.c b/source/blender/nodes/shader/nodes/node_shader_hair_info.c index fe1361e0d78..843185befb6 100644 --- a/source/blender/nodes/shader/nodes/node_shader_hair_info.c +++ b/source/blender/nodes/shader/nodes/node_shader_hair_info.c @@ -24,7 +24,7 @@ static bNodeSocketTemplate outputs[] = { {SOCK_FLOAT, N_("Intercept"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, {SOCK_FLOAT, N_("Thickness"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, {SOCK_VECTOR, N_("Tangent Normal"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, - /*{ SOCK_FLOAT, 0, N_("Fade"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f},*/ + // { SOCK_FLOAT, 0, N_("Fade"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, {SOCK_FLOAT, N_("Random")}, {-1, ""}, }; diff --git a/source/blender/python/bmesh/bmesh_py_ops.c b/source/blender/python/bmesh/bmesh_py_ops.c index b23891ca1fe..01914992f3e 100644 --- a/source/blender/python/bmesh/bmesh_py_ops.c +++ b/source/blender/python/bmesh/bmesh_py_ops.c @@ -228,12 +228,12 @@ static PyTypeObject bmesh_op_Type = { NULL, /* allocfunc tp_alloc; */ NULL, /* newfunc tp_new; */ /* Low-level free-memory routine */ - NULL, /* freefunc tp_free; */ + NULL, /* freefunc tp_free; */ /* For PyObject_IS_GC */ - NULL, /* inquiry tp_is_gc; */ + NULL, /* inquiry tp_is_gc; */ NULL, /* PyObject *tp_bases; */ /* method resolution order */ - NULL, /* PyObject *tp_mro; */ + NULL, /* PyObject *tp_mro; */ NULL, /* PyObject *tp_cache; */ NULL, /* PyObject *tp_subclasses; */ NULL, /* PyObject *tp_weaklist; */ diff --git a/source/blender/python/bmesh/bmesh_py_ops_call.h b/source/blender/python/bmesh/bmesh_py_ops_call.h index 6d9ceec73f6..1c7a35788d2 100644 --- a/source/blender/python/bmesh/bmesh_py_ops_call.h +++ b/source/blender/python/bmesh/bmesh_py_ops_call.h @@ -24,8 +24,8 @@ #pragma once typedef struct { - PyObject_HEAD /* required python macro */ - const char *opname; + PyObject_HEAD /* Required Python macro. */ + const char *opname; } BPy_BMeshOpFunc; PyObject *BPy_BMO_call(BPy_BMeshOpFunc *self, PyObject *args, PyObject *kw); diff --git a/source/blender/python/bmesh/bmesh_py_types.c b/source/blender/python/bmesh/bmesh_py_types.c index b5c2a2047a1..ec999c01493 100644 --- a/source/blender/python/bmesh/bmesh_py_types.c +++ b/source/blender/python/bmesh/bmesh_py_types.c @@ -1060,7 +1060,7 @@ static PyObject *bpy_bmesh_to_mesh(BPy_BMesh *self, PyObject *args) /* we could have the user do this but if they forget blender can easy crash * since the references arrays for the objects derived meshes are now invalid */ - DEG_id_tag_update(&me->id, ID_RECALC_GEOMETRY); + DEG_id_tag_update(&me->id, ID_RECALC_GEOMETRY_ALL_MODES); Py_RETURN_NONE; } @@ -1182,7 +1182,7 @@ PyDoc_STRVAR( "\n" " Custom-data layers are only copied from ``mesh`` on initialization.\n" " Further calls will copy custom-data to matching layers, layers missing on the target " - "mesh wont be added.\n"); + "mesh won't be added.\n"); static PyObject *bpy_bmesh_from_mesh(BPy_BMesh *self, PyObject *args, PyObject *kw) { static const char *kwlist[] = {"mesh", "face_normals", "use_shape_key", "shape_key_index", NULL}; @@ -2502,7 +2502,7 @@ PyDoc_STRVAR( "\n" " Running this on sequences besides :class:`BMesh.verts`, :class:`BMesh.edges`, " ":class:`BMesh.faces`\n" - " works but wont result in each element having a valid index, instead its order in the " + " works but won't result in each element having a valid index, instead its order in the " "sequence will be set.\n"); static PyObject *bpy_bmelemseq_index_update(BPy_BMElemSeq *self) { @@ -3022,8 +3022,8 @@ static struct PyMethodDef bpy_bmfaceseq_methods[] = { static struct PyMethodDef bpy_bmloopseq_methods[] = { /* odd function, initializes index values */ - /* no: index_update() function since we cant iterate over loops */ - /* no: sort() function since we cant iterate over loops */ + /* no: index_update() function since we can't iterate over loops */ + /* no: sort() function since we can't iterate over loops */ {NULL, NULL, 0, NULL}, }; diff --git a/source/blender/python/bmesh/bmesh_py_types_customdata.c b/source/blender/python/bmesh/bmesh_py_types_customdata.c index 78c43d18609..ff06cf43026 100644 --- a/source/blender/python/bmesh/bmesh_py_types_customdata.c +++ b/source/blender/python/bmesh/bmesh_py_types_customdata.c @@ -78,7 +78,7 @@ static CustomDataLayer *bpy_bmlayeritem_get(BPy_BMLayerItem *self) /* getseters * ========= */ -/* used for many different types */ +/* used for many different types. */ PyDoc_STRVAR(bpy_bmlayeraccess_collection__float_doc, "Generic float custom-data layer.\n\ntype: :class:`BMLayerCollection`"); diff --git a/source/blender/python/bmesh/bmesh_py_types_meshdata.c b/source/blender/python/bmesh/bmesh_py_types_meshdata.c index 84267a83a44..d9a82f52be0 100644 --- a/source/blender/python/bmesh/bmesh_py_types_meshdata.c +++ b/source/blender/python/bmesh/bmesh_py_types_meshdata.c @@ -97,7 +97,7 @@ static int bpy_bmloopuv_flag_set(BPy_BMLoopUV *self, PyObject *value, void *flag } static PyGetSetDef bpy_bmloopuv_getseters[] = { - /* attributes match rna_def_mloopuv */ + /* attributes match rna_def_mloopuv. */ {"uv", (getter)bpy_bmloopuv_uv_get, (setter)bpy_bmloopuv_uv_set, bpy_bmloopuv_uv_doc, NULL}, {"pin_uv", (getter)bpy_bmloopuv_flag_get, @@ -207,7 +207,7 @@ static int bpy_bmvertskin_flag_set(BPy_BMVertSkin *self, PyObject *value, void * } static PyGetSetDef bpy_bmvertskin_getseters[] = { - /* attributes match rna_mesh_gen */ + /* attributes match rna_mesh_gen. */ {"radius", (getter)bpy_bmvertskin_radius_get, (setter)bpy_bmvertskin_radius_set, diff --git a/source/blender/python/generic/bgl.c b/source/blender/python/generic/bgl.c index e9a58288c5e..22bea8f0273 100644 --- a/source/blender/python/generic/bgl.c +++ b/source/blender/python/generic/bgl.c @@ -41,7 +41,7 @@ /** \name Local utility defines for wrapping OpenGL * \{ */ -/*@ By golly George! It looks like fancy pants macro time!!! */ +/* By golly George! It looks like fancy pants macro time! */ /* TYPE_str is the string to pass to Py_ArgParse (for the format) */ /* TYPE_var is the name to pass to the GL function */ @@ -161,7 +161,7 @@ typedef struct BufferOrOffset { # define buffer_def(number) Buffer *bgl_buffer##number #endif -/*@The standard GL typedefs are used as prototypes, we can't +/* The standard GL typedefs are used as prototypes, we can't * use the GL type directly because Py_ArgParse expects normal * C types. * @@ -505,13 +505,13 @@ static bool compare_dimensions(int ndim, const int *dim1, const Py_ssize_t *dim2 * \{ */ static PySequenceMethods Buffer_SeqMethods = { - (lenfunc)Buffer_len, /*sq_length */ - (binaryfunc)NULL, /*sq_concat */ - (ssizeargfunc)NULL, /*sq_repeat */ - (ssizeargfunc)Buffer_item, /*sq_item */ - (ssizessizeargfunc)NULL, /*sq_slice, deprecated, handled in Buffer_item */ - (ssizeobjargproc)Buffer_ass_item, /*sq_ass_item */ - (ssizessizeobjargproc)NULL, /*sq_ass_slice, deprecated handled in Buffer_ass_item */ + (lenfunc)Buffer_len, /* sq_length */ + (binaryfunc)NULL, /* sq_concat */ + (ssizeargfunc)NULL, /* sq_repeat */ + (ssizeargfunc)Buffer_item, /* sq_item */ + (ssizessizeargfunc)NULL, /* sq_slice, deprecated, handled in Buffer_item */ + (ssizeobjargproc)Buffer_ass_item, /* sq_ass_item */ + (ssizessizeobjargproc)NULL, /* sq_ass_slice, deprecated handled in Buffer_ass_item */ (objobjproc)NULL, /* sq_contains */ (binaryfunc)NULL, /* sq_inplace_concat */ (ssizeargfunc)NULL, /* sq_inplace_repeat */ @@ -582,17 +582,17 @@ static PyGetSetDef Buffer_getseters[] = { }; PyTypeObject BGL_bufferType = { - PyVarObject_HEAD_INIT(NULL, 0) "bgl.Buffer", /*tp_name */ - sizeof(Buffer), /*tp_basicsize */ - 0, /*tp_itemsize */ - (destructor)Buffer_dealloc, /*tp_dealloc */ - (printfunc)NULL, /*tp_print */ - NULL, /*tp_getattr */ - NULL, /*tp_setattr */ - NULL, /*tp_compare */ - (reprfunc)Buffer_repr, /*tp_repr */ - NULL, /*tp_as_number */ - &Buffer_SeqMethods, /*tp_as_sequence */ + PyVarObject_HEAD_INIT(NULL, 0) "bgl.Buffer", /* tp_name */ + sizeof(Buffer), /* tp_basicsize */ + 0, /* tp_itemsize */ + (destructor)Buffer_dealloc, /* tp_dealloc */ + (printfunc)NULL, /* tp_print */ + NULL, /* tp_getattr */ + NULL, /* tp_setattr */ + NULL, /* tp_compare */ + (reprfunc)Buffer_repr, /* tp_repr */ + NULL, /* tp_as_number */ + &Buffer_SeqMethods, /* tp_as_sequence */ &Buffer_AsMapping, /* PyMappingMethods *tp_as_mapping; */ /* More standard operations (here for binary compatibility) */ diff --git a/source/blender/python/generic/idprop_py_api.c b/source/blender/python/generic/idprop_py_api.c index cebc72d99d1..df6a55fdb9f 100644 --- a/source/blender/python/generic/idprop_py_api.c +++ b/source/blender/python/generic/idprop_py_api.c @@ -611,8 +611,8 @@ static IDProperty *idp_from_PyMapping(const char *name, PyObject *ob) keys = PyMapping_Keys(ob); vals = PyMapping_Values(ob); - /* we allocate the group first; if we hit any invalid data, - * we can delete it easily enough.*/ + /* We allocate the group first; if we hit any invalid data, + * we can delete it easily enough. */ prop = IDP_New(IDP_GROUP, &val, name); len = PyMapping_Length(ob); for (i = 0; i < len; i++) { @@ -1284,8 +1284,8 @@ static PyObject *BPy_IDGroup_pop(BPy_IDProperty *self, PyObject *args) pyform = BPy_IDGroup_MapDataToPy(idprop); if (pyform == NULL) { /* ok something bad happened with the #PyObject, - * so don't remove the prop from the group. if pyform is - * NULL, then it already should have raised an exception.*/ + * so don't remove the prop from the group. if `pyform is + * NULL, then it already should have raised an exception. */ return NULL; } @@ -1305,7 +1305,7 @@ static void BPy_IDGroup_CorrectListLen(IDProperty *prop, PyObject *seq, int len, PyList_SET_ITEM(seq, j, Py_INCREF_RET(Py_None)); } - /*set correct group length*/ + /* Set correct group length. */ prop->len = len; } @@ -1326,8 +1326,8 @@ PyObject *BPy_Wrap_GetKeys(IDProperty *prop) if (i != prop->len) { /* if the loop didn't finish, we know the length is wrong */ BPy_IDGroup_CorrectListLen(prop, list, i, __func__); - Py_DECREF(list); /*free the list*/ - /*call self again*/ + Py_DECREF(list); /* Free the list. */ + /* Call self again. */ return BPy_Wrap_GetKeys(prop); } @@ -1346,8 +1346,8 @@ PyObject *BPy_Wrap_GetValues(ID *id, IDProperty *prop) if (i != prop->len) { BPy_IDGroup_CorrectListLen(prop, list, i, __func__); - Py_DECREF(list); /*free the list*/ - /*call self again*/ + Py_DECREF(list); /* Free the list. */ + /* Call self again. */ return BPy_Wrap_GetValues(id, prop); } @@ -1369,8 +1369,8 @@ PyObject *BPy_Wrap_GetItems(ID *id, IDProperty *prop) if (i != prop->len) { BPy_IDGroup_CorrectListLen(prop, seq, i, __func__); - Py_DECREF(seq); /*free the list*/ - /*call self again*/ + Py_DECREF(seq); /* Free the list. */ + /* Call self again. */ return BPy_Wrap_GetItems(id, prop); } @@ -1557,9 +1557,9 @@ static PySequenceMethods BPy_IDGroup_Seq = { }; static PyMappingMethods BPy_IDGroup_Mapping = { - (lenfunc)BPy_IDGroup_Map_Len, /*inquiry mp_length */ - (binaryfunc)BPy_IDGroup_Map_GetItem, /*binaryfunc mp_subscript */ - (objobjargproc)BPy_IDGroup_Map_SetItem, /*objobjargproc mp_ass_subscript */ + (lenfunc)BPy_IDGroup_Map_Len, /* inquiry mp_length */ + (binaryfunc)BPy_IDGroup_Map_GetItem, /* binaryfunc mp_subscript */ + (objobjargproc)BPy_IDGroup_Map_SetItem, /* objobjargproc mp_ass_subscript */ }; PyTypeObject BPy_IDGroup_Type = { @@ -2040,12 +2040,12 @@ PyTypeObject BPy_IDArray_Type = { NULL, /* allocfunc tp_alloc; */ NULL, /* newfunc tp_new; */ /* Low-level free-memory routine */ - NULL, /* freefunc tp_free; */ + NULL, /* freefunc tp_free; */ /* For PyObject_IS_GC */ - NULL, /* inquiry tp_is_gc; */ + NULL, /* inquiry tp_is_gc; */ NULL, /* PyObject *tp_bases; */ /* method resolution order */ - NULL, /* PyObject *tp_mro; */ + NULL, /* PyObject *tp_mro; */ NULL, /* PyObject *tp_cache; */ NULL, /* PyObject *tp_subclasses; */ NULL, /* PyObject *tp_weaklist; */ diff --git a/source/blender/python/generic/imbuf_py_api.c b/source/blender/python/generic/imbuf_py_api.c index 53e22314ec4..793b980295c 100644 --- a/source/blender/python/generic/imbuf_py_api.c +++ b/source/blender/python/generic/imbuf_py_api.c @@ -495,15 +495,16 @@ static PyObject *M_imbuf_load(PyObject *UNUSED(self), PyObject *args, PyObject * return Py_ImBuf_CreatePyObject(ibuf); } -PyDoc_STRVAR(M_imbuf_write_doc, - ".. function:: write(image, filepath)\n" - "\n" - " Write an image.\n" - "\n" - " :arg image: the image to write.\n" - " :type image: :class:`ImBuf`\n" - " :arg filepath: the filepath of the image.\n" - " :type filepath: string\n"); +PyDoc_STRVAR( + M_imbuf_write_doc, + ".. function:: write(image, filepath=image.filepath)\n" + "\n" + " Write an image.\n" + "\n" + " :arg image: the image to write.\n" + " :type image: :class:`ImBuf`\n" + " :arg filepath: Optional filepath of the image (fallback to the images file path).\n" + " :type filepath: string\n"); static PyObject *M_imbuf_write(PyObject *UNUSED(self), PyObject *args, PyObject *kw) { Py_ImBuf *py_imb; diff --git a/source/blender/python/generic/py_capi_utils.c b/source/blender/python/generic/py_capi_utils.c index 9824d5f17c4..127380feec1 100644 --- a/source/blender/python/generic/py_capi_utils.c +++ b/source/blender/python/generic/py_capi_utils.c @@ -523,7 +523,7 @@ PyObject *PyC_FrozenSetFromStrings(const char **strings) /** * Similar to #PyErr_Format(), * - * Implementation - we cant actually prepend the existing exception, + * Implementation - we can't actually prepend the existing exception, * because it could have _any_ arguments given to it, so instead we get its * ``__str__`` output and raise our own exception including it. */ @@ -846,7 +846,7 @@ PyObject *PyC_DefaultNameSpace(const char *filename) PyModule_AddStringConstant(mod_main, "__name__", "__main__"); if (filename) { /* __file__ mainly for nice UI'ness - * note: this wont map to a real file when executing text-blocks and buttons. */ + * note: this won't map to a real file when executing text-blocks and buttons. */ PyModule_AddObject(mod_main, "__file__", PyC_UnicodeFromByte(filename)); } PyModule_AddObject(mod_main, "__builtins__", builtins); diff --git a/source/blender/python/gpu/gpu_py_buffer.c b/source/blender/python/gpu/gpu_py_buffer.c index e36e3b42617..5c004459b44 100644 --- a/source/blender/python/gpu/gpu_py_buffer.c +++ b/source/blender/python/gpu/gpu_py_buffer.c @@ -577,12 +577,12 @@ static PyGetSetDef pygpu_buffer_getseters[] = { }; static PySequenceMethods pygpu_buffer__tp_as_sequence = { - (lenfunc)pygpu_buffer__sq_length, /*sq_length */ - (binaryfunc)NULL, /*sq_concat */ - (ssizeargfunc)NULL, /*sq_repeat */ - (ssizeargfunc)pygpu_buffer__sq_item, /*sq_item */ - (ssizessizeargfunc)NULL, /*sq_slice, deprecated, handled in pygpu_buffer__sq_item */ - (ssizeobjargproc)pygpu_buffer__sq_ass_item, /*sq_ass_item */ + (lenfunc)pygpu_buffer__sq_length, /* sq_length */ + (binaryfunc)NULL, /* sq_concat */ + (ssizeargfunc)NULL, /* sq_repeat */ + (ssizeargfunc)pygpu_buffer__sq_item, /* sq_item */ + (ssizessizeargfunc)NULL, /* sq_slice, deprecated, handled in pygpu_buffer__sq_item */ + (ssizeobjargproc)pygpu_buffer__sq_ass_item, /* sq_ass_item */ (ssizessizeobjargproc)NULL, /* sq_ass_slice, deprecated handled in pygpu_buffer__sq_ass_item */ (objobjproc)NULL, /* sq_contains */ (binaryfunc)NULL, /* sq_inplace_concat */ diff --git a/source/blender/python/gpu/gpu_py_framebuffer.c b/source/blender/python/gpu/gpu_py_framebuffer.c index 0efc0713538..2f081fcfd8c 100644 --- a/source/blender/python/gpu/gpu_py_framebuffer.c +++ b/source/blender/python/gpu/gpu_py_framebuffer.c @@ -130,8 +130,8 @@ static bool pygpu_framebuffer_stack_pop_and_restore_or_error(GPUFrameBuffer *fb) * \{ */ typedef struct { - PyObject_HEAD /* required python macro */ - BPyGPUFrameBuffer *py_fb; + PyObject_HEAD /* Required Python macro. */ + BPyGPUFrameBuffer *py_fb; int level; } PyFrameBufferStackContext; diff --git a/source/blender/python/gpu/gpu_py_framebuffer.h b/source/blender/python/gpu/gpu_py_framebuffer.h index 6727328518c..4b44436f5cf 100644 --- a/source/blender/python/gpu/gpu_py_framebuffer.h +++ b/source/blender/python/gpu/gpu_py_framebuffer.h @@ -27,7 +27,8 @@ extern PyTypeObject BPyGPUFrameBuffer_Type; #define BPyGPUFrameBuffer_Check(v) (Py_TYPE(v) == &BPyGPUFrameBuffer_Type) typedef struct BPyGPUFrameBuffer { - PyObject_HEAD struct GPUFrameBuffer *fb; + PyObject_HEAD + struct GPUFrameBuffer *fb; #ifndef GPU_NO_USE_PY_REFERENCES bool shared_reference; diff --git a/source/blender/python/gpu/gpu_py_matrix.c b/source/blender/python/gpu/gpu_py_matrix.c index b00a13d5be8..b379600d33c 100644 --- a/source/blender/python/gpu/gpu_py_matrix.c +++ b/source/blender/python/gpu/gpu_py_matrix.c @@ -152,8 +152,8 @@ static PyObject *pygpu_matrix_pop_projection(PyObject *UNUSED(self)) * \{ */ typedef struct { - PyObject_HEAD /* required python macro */ - int type; + PyObject_HEAD /* Required Python macro. */ + int type; int level; } BPyGPU_MatrixStackContext; diff --git a/source/blender/python/gpu/gpu_py_offscreen.c b/source/blender/python/gpu/gpu_py_offscreen.c index 0d29bc98a31..0a8b294ea41 100644 --- a/source/blender/python/gpu/gpu_py_offscreen.c +++ b/source/blender/python/gpu/gpu_py_offscreen.c @@ -97,8 +97,8 @@ static int pygpu_offscreen_valid_check(BPyGPUOffScreen *py_ofs) * \{ */ typedef struct { - PyObject_HEAD /* required python macro */ - BPyGPUOffScreen *py_offscreen; + PyObject_HEAD /* Required Python macro. */ + BPyGPUOffScreen *py_offscreen; int level; bool is_explicitly_bound; /* Bound by "bind" method. */ } OffScreenStackContext; diff --git a/source/blender/python/gpu/gpu_py_offscreen.h b/source/blender/python/gpu/gpu_py_offscreen.h index f551730cf54..309735a6202 100644 --- a/source/blender/python/gpu/gpu_py_offscreen.h +++ b/source/blender/python/gpu/gpu_py_offscreen.h @@ -27,7 +27,8 @@ extern PyTypeObject BPyGPUOffScreen_Type; #define BPyGPUOffScreen_Check(v) (Py_TYPE(v) == &BPyGPUOffScreen_Type) typedef struct BPyGPUOffScreen { - PyObject_HEAD struct GPUOffScreen *ofs; + PyObject_HEAD + struct GPUOffScreen *ofs; } BPyGPUOffScreen; PyObject *BPyGPUOffScreen_CreatePyObject(struct GPUOffScreen *ofs) ATTR_NONNULL(1); diff --git a/source/blender/python/gpu/gpu_py_texture.h b/source/blender/python/gpu/gpu_py_texture.h index 3eaaa3411bd..8423d0e6804 100644 --- a/source/blender/python/gpu/gpu_py_texture.h +++ b/source/blender/python/gpu/gpu_py_texture.h @@ -27,7 +27,8 @@ extern PyTypeObject BPyGPUTexture_Type; #define BPyGPUTexture_Check(v) (Py_TYPE(v) == &BPyGPUTexture_Type) typedef struct BPyGPUTexture { - PyObject_HEAD struct GPUTexture *tex; + PyObject_HEAD + struct GPUTexture *tex; } BPyGPUTexture; int bpygpu_ParseTexture(PyObject *o, void *p); diff --git a/source/blender/python/gpu/gpu_py_uniformbuffer.h b/source/blender/python/gpu/gpu_py_uniformbuffer.h index a13c33ae78a..75d6d5e2160 100644 --- a/source/blender/python/gpu/gpu_py_uniformbuffer.h +++ b/source/blender/python/gpu/gpu_py_uniformbuffer.h @@ -27,7 +27,8 @@ extern PyTypeObject BPyGPUUniformBuf_Type; #define BPyGPUUniformBuf_Check(v) (Py_TYPE(v) == &BPyGPUUniformBuf_Type) typedef struct BPyGPUUniformBuf { - PyObject_HEAD struct GPUUniformBuf *ubo; + PyObject_HEAD + struct GPUUniformBuf *ubo; } BPyGPUUniformBuf; PyObject *BPyGPUUniformBuf_CreatePyObject(struct GPUUniformBuf *ubo) ATTR_NONNULL(1); diff --git a/source/blender/python/intern/bpy.c b/source/blender/python/intern/bpy.c index dc9b8b52821..30a61067c9e 100644 --- a/source/blender/python/intern/bpy.c +++ b/source/blender/python/intern/bpy.c @@ -403,7 +403,7 @@ void BPy_init_modules(struct bContext *C) Py_DECREF(py_modpath); } else { - printf("bpy: couldn't find 'scripts/modules', blender probably wont start.\n"); + printf("bpy: couldn't find 'scripts/modules', blender probably won't start.\n"); } /* stand alone utility modules not related to blender directly */ IDProp_Init_Types(); /* not actually a submodule, just types */ diff --git a/source/blender/python/intern/bpy_app_translations.c b/source/blender/python/intern/bpy_app_translations.c index d00f205ddc0..478ae61aecd 100644 --- a/source/blender/python/intern/bpy_app_translations.c +++ b/source/blender/python/intern/bpy_app_translations.c @@ -51,8 +51,8 @@ typedef struct { PyObject_HEAD - /** The string used to separate context from actual message in PY_TRANSLATE RNA props. */ - const char *context_separator; + /** The string used to separate context from actual message in PY_TRANSLATE RNA props. */ + const char *context_separator; /** A "named tuple" (StructSequence actually...) containing all C-defined contexts. */ PyObject *contexts; /** A readonly mapping {C context id: python id} (actually, a MappingProxy). */ @@ -855,12 +855,12 @@ static PyTypeObject BlenderAppTranslationsType = { /* newfunc tp_new; */ (newfunc)app_translations_new, /* Low-level free-memory routine */ - app_translations_free, /* freefunc tp_free; */ + app_translations_free, /* freefunc tp_free; */ /* For PyObject_IS_GC */ - NULL, /* inquiry tp_is_gc; */ + NULL, /* inquiry tp_is_gc; */ NULL, /* PyObject *tp_bases; */ /* method resolution order */ - NULL, /* PyObject *tp_mro; */ + NULL, /* PyObject *tp_mro; */ NULL, /* PyObject *tp_cache; */ NULL, /* PyObject *tp_subclasses; */ NULL, /* PyObject *tp_weaklist; */ diff --git a/source/blender/python/intern/bpy_driver.c b/source/blender/python/intern/bpy_driver.c index 5102aa17250..a7b99f211c2 100644 --- a/source/blender/python/intern/bpy_driver.c +++ b/source/blender/python/intern/bpy_driver.c @@ -86,7 +86,7 @@ int bpy_pydriver_create_dict(void) bpy_pydriver_Dict = d; - /* import some modules: builtins, bpy, math, (Blender.noise)*/ + /* Import some modules: builtins, bpy, math, `Blender.noise`. */ PyDict_SetItemString(d, "__builtins__", PyEval_GetBuiltins()); mod = PyImport_ImportModule("math"); @@ -654,7 +654,7 @@ float BPY_driver_exec(struct PathResolvedRNA *anim_rna, } #endif - /* decref the driver vars first... */ + /* decref the driver vars first. */ Py_DECREF(driver_vars); /* process the result */ diff --git a/source/blender/python/intern/bpy_interface.c b/source/blender/python/intern/bpy_interface.c index f95e655d0c6..832af9e8460 100644 --- a/source/blender/python/intern/bpy_interface.c +++ b/source/blender/python/intern/bpy_interface.c @@ -154,8 +154,8 @@ void bpy_context_clear(bContext *UNUSED(C), const PyGILState_STATE *gilstate) fprintf(stderr, "ERROR: Python context internal state bug. this should not happen!\n"); } else if (py_call_level == 0) { - /* XXX - Calling classes currently wont store the context :\, - * cant set NULL because of this. but this is very flakey still. */ + /* XXX - Calling classes currently won't store the context :\, + * can't set NULL because of this. but this is very flakey still. */ #if 0 BPY_context_set(NULL); #endif @@ -338,7 +338,7 @@ void BPY_python_start(bContext *C, int argc, const char **argv) { #ifndef WITH_PYTHON_MODULE - /* #PyPreConfig (early-configuration). */ + /* #PyPreConfig (early-configuration). */ { PyPreConfig preconfig; PyStatus status; @@ -785,8 +785,8 @@ static struct PyModuleDef bpy_proxy_def = { typedef struct { PyObject_HEAD - /* Type-specific fields go here. */ - PyObject *mod; + /* Type-specific fields go here. */ + PyObject *mod; } dealloc_obj; /* call once __file__ is set */ @@ -825,7 +825,7 @@ static void dealloc_obj_dealloc(PyObject *self) { bpy_module_delay_init(((dealloc_obj *)self)->mod); - /* Note, for subclassed PyObjects we cant just call PyObject_DEL() directly or it will crash */ + /* Note, for subclassed PyObjects we can't just call PyObject_DEL() directly or it will crash */ dealloc_obj_Type.tp_free(self); } @@ -838,7 +838,7 @@ PyMODINIT_FUNC PyInit_bpy(void) /* Problem: * 1) this init function is expected to have a private member defined - 'md_def' * but this is only set for C defined modules (not py packages) - * so we cant return 'bpy_package_py' as is. + * so we can't return 'bpy_package_py' as is. * * 2) there is a 'bpy' C module for python to load which is basically all of blender, * and there is scripts/bpy/__init__.py, diff --git a/source/blender/python/intern/bpy_interface_run.c b/source/blender/python/intern/bpy_interface_run.c index f7272a87a17..f7d6a33c904 100644 --- a/source/blender/python/intern/bpy_interface_run.c +++ b/source/blender/python/intern/bpy_interface_run.c @@ -74,7 +74,8 @@ static void bpy_text_filename_get(char *fn, const Main *bmain, size_t fn_len, co /* bad!, we should never do this, but currently only safe way I could find to keep namespace. * from being cleared. - campbell */ typedef struct { - PyObject_HEAD PyObject *md_dict; + PyObject_HEAD + PyObject *md_dict; /* omit other values, we only want the dict. */ } PyModuleObject; #endif diff --git a/source/blender/python/intern/bpy_library_load.c b/source/blender/python/intern/bpy_library_load.c index 7a688b8c77d..28a97c3fa3b 100644 --- a/source/blender/python/intern/bpy_library_load.c +++ b/source/blender/python/intern/bpy_library_load.c @@ -61,9 +61,9 @@ #endif typedef struct { - PyObject_HEAD /* required python macro */ - /* collection iterator specific parts */ - char relpath[FILE_MAX]; + PyObject_HEAD /* Required Python macro. */ + /* Collection iterator specific parts. */ + char relpath[FILE_MAX]; char abspath[FILE_MAX]; /* absolute path */ BlendHandle *blo_handle; int flag; @@ -159,12 +159,12 @@ static PyTypeObject bpy_lib_Type = { NULL, /* allocfunc tp_alloc; */ NULL, /* newfunc tp_new; */ /* Low-level free-memory routine */ - NULL, /* freefunc tp_free; */ + NULL, /* freefunc tp_free; */ /* For PyObject_IS_GC */ - NULL, /* inquiry tp_is_gc; */ + NULL, /* inquiry tp_is_gc; */ NULL, /* PyObject *tp_bases; */ /* method resolution order */ - NULL, /* PyObject *tp_mro; */ + NULL, /* PyObject *tp_mro; */ NULL, /* PyObject *tp_cache; */ NULL, /* PyObject *tp_subclasses; */ NULL, /* PyObject *tp_weaklist; */ @@ -257,8 +257,9 @@ static PyObject *bpy_lib_enter(BPy_Library *self) ReportList reports; BKE_reports_init(&reports, RPT_STORE); + BlendFileReadReport bf_reports = {.reports = &reports}; - self->blo_handle = BLO_blendhandle_from_file(self->abspath, &reports); + self->blo_handle = BLO_blendhandle_from_file(self->abspath, &bf_reports); if (self->blo_handle == NULL) { if (BPy_reports_to_error(&reports, PyExc_IOError, true) != -1) { diff --git a/source/blender/python/intern/bpy_operator.c b/source/blender/python/intern/bpy_operator.c index 4a5e2552598..055dd624ea8 100644 --- a/source/blender/python/intern/bpy_operator.c +++ b/source/blender/python/intern/bpy_operator.c @@ -87,7 +87,7 @@ static PyObject *pyop_poll(PyObject *UNUSED(self), PyObject *args) bContext *C = BPY_context_get(); if (C == NULL) { - PyErr_SetString(PyExc_RuntimeError, "Context is None, cant poll any operators"); + PyErr_SetString(PyExc_RuntimeError, "Context is None, can't poll any operators"); return NULL; } @@ -174,7 +174,7 @@ static PyObject *pyop_call(PyObject *UNUSED(self), PyObject *args) bContext *C = BPY_context_get(); if (C == NULL) { - PyErr_SetString(PyExc_RuntimeError, "Context is None, cant poll any operators"); + PyErr_SetString(PyExc_RuntimeError, "Context is None, can't poll any operators"); return NULL; } @@ -367,7 +367,7 @@ static PyObject *pyop_as_string(PyObject *UNUSED(self), PyObject *args) if (C == NULL) { PyErr_SetString(PyExc_RuntimeError, - "Context is None, cant get the string representation of this object."); + "Context is None, can't get the string representation of this object."); return NULL; } diff --git a/source/blender/python/intern/bpy_operator.h b/source/blender/python/intern/bpy_operator.h index 3cb335d5d9a..453b3c3d6d4 100644 --- a/source/blender/python/intern/bpy_operator.h +++ b/source/blender/python/intern/bpy_operator.h @@ -29,7 +29,7 @@ extern PyTypeObject pyop_base_Type; #define BPy_OperatorBase_Check(v) (PyObject_TypeCheck(v, &pyop_base_Type)) typedef struct { - PyObject_HEAD /* required python macro */ + PyObject_HEAD /* Required Python macro. */ } BPy_OperatorBase; PyObject *BPY_operator_module(void); diff --git a/source/blender/python/intern/bpy_props.c b/source/blender/python/intern/bpy_props.c index 6ad80f9160b..0d451a8dd7f 100644 --- a/source/blender/python/intern/bpy_props.c +++ b/source/blender/python/intern/bpy_props.c @@ -210,7 +210,7 @@ static const EnumPropertyItem property_subtype_array_items[] = { /** * Store #PyObject data for a dynamically defined property. * Currently this is only used to store call-back functions. - * Properties that don't use custom-callbacks wont allocate this struct. + * Properties that don't use custom callbacks won't allocate this struct. * * Memory/Reference Management * --------------------------- @@ -2264,7 +2264,7 @@ static void bpy_prop_callback_assign_enum(struct PropertyRNA *prop, } \ (void)0 -/* terse macros for error checks shared between all funcs cant use function +/* terse macros for error checks shared between all funcs can't use function * calls because of static strings passed to pyrna_set_to_enum_bitfield */ #define BPY_PROPDEF_CHECK(_func, _property_flag_items, _property_flag_override_items) \ if (UNLIKELY(id_len >= MAX_IDPROP_NAME)) { \ diff --git a/source/blender/python/intern/bpy_props.h b/source/blender/python/intern/bpy_props.h index d467166f354..bc7f0cfe416 100644 --- a/source/blender/python/intern/bpy_props.h +++ b/source/blender/python/intern/bpy_props.h @@ -33,8 +33,8 @@ StructRNA *pointer_type_from_py(PyObject *value, const char *error_prefix); typedef struct { PyObject_HEAD - /* This isn't GC tracked, it's a function from `bpy.props` so it's not going away. */ - void *fn; + /* This isn't GC tracked, it's a function from `bpy.props` so it's not going away. */ + void *fn; PyObject *kw; } BPy_PropDeferred; diff --git a/source/blender/python/intern/bpy_rna.c b/source/blender/python/intern/bpy_rna.c index fb1cb823964..a3c5d4e9d66 100644 --- a/source/blender/python/intern/bpy_rna.c +++ b/source/blender/python/intern/bpy_rna.c @@ -1647,7 +1647,7 @@ int pyrna_pydict_to_props(PointerRNA *ptr, break; } - item = PyDict_GetItemString(kw, arg_name); /* Wont set an error. */ + item = PyDict_GetItemString(kw, arg_name); /* Won't set an error. */ if (item == NULL) { if (all_args) { @@ -6224,7 +6224,7 @@ static PyObject *pyrna_func_call(BPy_FunctionRNA *self, PyObject *args, PyObject err = -1; break; } - /* PyDict_GetItemString wont raise an error. */ + /* PyDict_GetItemString won't raise an error. */ continue; } @@ -6459,11 +6459,11 @@ PyTypeObject pyrna_struct_meta_idprop_Type = { NULL, /* PyMappingMethods *tp_as_mapping; */ /* More standard operations (here for binary compatibility) */ - NULL, /* hashfunc tp_hash; */ - NULL, /* ternaryfunc tp_call; */ - NULL, /* reprfunc tp_str; */ - NULL /*(getattrofunc) pyrna_struct_meta_idprop_getattro*/, /* getattrofunc tp_getattro; */ - (setattrofunc)pyrna_struct_meta_idprop_setattro, /* setattrofunc tp_setattro; */ + NULL, /* hashfunc tp_hash; */ + NULL, /* ternaryfunc tp_call; */ + NULL, /* reprfunc tp_str; */ + NULL /* (getattrofunc) pyrna_struct_meta_idprop_getattro */, /* getattrofunc tp_getattro; */ + (setattrofunc)pyrna_struct_meta_idprop_setattro, /* setattrofunc tp_setattro; */ /* Functions to access object as input/output buffer */ NULL, /* PyBufferProcs *tp_as_buffer; */ @@ -6508,12 +6508,12 @@ PyTypeObject pyrna_struct_meta_idprop_Type = { NULL, /* allocfunc tp_alloc; */ NULL, /* newfunc tp_new; */ /* Low-level free-memory routine */ - NULL, /* freefunc tp_free; */ + NULL, /* freefunc tp_free; */ /* For PyObject_IS_GC */ - NULL, /* inquiry tp_is_gc; */ + NULL, /* inquiry tp_is_gc; */ NULL, /* PyObject *tp_bases; */ /* method resolution order */ - NULL, /* PyObject *tp_mro; */ + NULL, /* PyObject *tp_mro; */ NULL, /* PyObject *tp_cache; */ NULL, /* PyObject *tp_subclasses; */ NULL, /* PyObject *tp_weaklist; */ @@ -6601,12 +6601,12 @@ PyTypeObject pyrna_struct_Type = { NULL, /* allocfunc tp_alloc; */ pyrna_struct_new, /* newfunc tp_new; */ /* Low-level free-memory routine */ - NULL, /* freefunc tp_free; */ + NULL, /* freefunc tp_free; */ /* For PyObject_IS_GC */ - NULL, /* inquiry tp_is_gc; */ + NULL, /* inquiry tp_is_gc; */ NULL, /* PyObject *tp_bases; */ /* method resolution order */ - NULL, /* PyObject *tp_mro; */ + NULL, /* PyObject *tp_mro; */ NULL, /* PyObject *tp_cache; */ NULL, /* PyObject *tp_subclasses; */ NULL, /* PyObject *tp_weaklist; */ @@ -6686,12 +6686,12 @@ PyTypeObject pyrna_prop_Type = { NULL, /* allocfunc tp_alloc; */ pyrna_prop_new, /* newfunc tp_new; */ /* Low-level free-memory routine */ - NULL, /* freefunc tp_free; */ + NULL, /* freefunc tp_free; */ /* For PyObject_IS_GC */ - NULL, /* inquiry tp_is_gc; */ + NULL, /* inquiry tp_is_gc; */ NULL, /* PyObject *tp_bases; */ /* method resolution order */ - NULL, /* PyObject *tp_mro; */ + NULL, /* PyObject *tp_mro; */ NULL, /* PyObject *tp_cache; */ NULL, /* PyObject *tp_subclasses; */ NULL, /* PyObject *tp_weaklist; */ @@ -6769,12 +6769,12 @@ PyTypeObject pyrna_prop_array_Type = { NULL, /* allocfunc tp_alloc; */ NULL, /* newfunc tp_new; */ /* Low-level free-memory routine */ - NULL, /* freefunc tp_free; */ + NULL, /* freefunc tp_free; */ /* For PyObject_IS_GC */ - NULL, /* inquiry tp_is_gc; */ + NULL, /* inquiry tp_is_gc; */ NULL, /* PyObject *tp_bases; */ /* method resolution order */ - NULL, /* PyObject *tp_mro; */ + NULL, /* PyObject *tp_mro; */ NULL, /* PyObject *tp_cache; */ NULL, /* PyObject *tp_subclasses; */ NULL, /* PyObject *tp_weaklist; */ @@ -6854,12 +6854,12 @@ PyTypeObject pyrna_prop_collection_Type = { NULL, /* allocfunc tp_alloc; */ NULL, /* newfunc tp_new; */ /* Low-level free-memory routine */ - NULL, /* freefunc tp_free; */ + NULL, /* freefunc tp_free; */ /* For PyObject_IS_GC */ - NULL, /* inquiry tp_is_gc; */ + NULL, /* inquiry tp_is_gc; */ NULL, /* PyObject *tp_bases; */ /* method resolution order */ - NULL, /* PyObject *tp_mro; */ + NULL, /* PyObject *tp_mro; */ NULL, /* PyObject *tp_cache; */ NULL, /* PyObject *tp_subclasses; */ NULL, /* PyObject *tp_weaklist; */ @@ -6940,12 +6940,12 @@ static PyTypeObject pyrna_prop_collection_idprop_Type = { NULL, /* allocfunc tp_alloc; */ NULL, /* newfunc tp_new; */ /* Low-level free-memory routine */ - NULL, /* freefunc tp_free; */ + NULL, /* freefunc tp_free; */ /* For PyObject_IS_GC */ - NULL, /* inquiry tp_is_gc; */ + NULL, /* inquiry tp_is_gc; */ NULL, /* PyObject *tp_bases; */ /* method resolution order */ - NULL, /* PyObject *tp_mro; */ + NULL, /* PyObject *tp_mro; */ NULL, /* PyObject *tp_cache; */ NULL, /* PyObject *tp_subclasses; */ NULL, /* PyObject *tp_weaklist; */ @@ -7025,12 +7025,12 @@ PyTypeObject pyrna_func_Type = { NULL, /* allocfunc tp_alloc; */ NULL, /* newfunc tp_new; */ /* Low-level free-memory routine */ - NULL, /* freefunc tp_free; */ + NULL, /* freefunc tp_free; */ /* For PyObject_IS_GC */ - NULL, /* inquiry tp_is_gc; */ + NULL, /* inquiry tp_is_gc; */ NULL, /* PyObject *tp_bases; */ /* method resolution order */ - NULL, /* PyObject *tp_mro; */ + NULL, /* PyObject *tp_mro; */ NULL, /* PyObject *tp_cache; */ NULL, /* PyObject *tp_subclasses; */ NULL, /* PyObject *tp_weaklist; */ @@ -7121,12 +7121,12 @@ static PyTypeObject pyrna_prop_collection_iter_Type = { NULL, /* allocfunc tp_alloc; */ NULL, /* newfunc tp_new; */ /* Low-level free-memory routine */ - NULL, /* freefunc tp_free; */ + NULL, /* freefunc tp_free; */ /* For PyObject_IS_GC */ - NULL, /* inquiry tp_is_gc; */ + NULL, /* inquiry tp_is_gc; */ NULL, /* PyObject *tp_bases; */ /* method resolution order */ - NULL, /* PyObject *tp_mro; */ + NULL, /* PyObject *tp_mro; */ NULL, /* PyObject *tp_cache; */ NULL, /* PyObject *tp_subclasses; */ NULL, /* PyObject *tp_weaklist; */ @@ -7165,8 +7165,8 @@ static PyObject *pyrna_prop_collection_iter_next(BPy_PropertyCollectionIterRNA * if (pyrna) { /* Unlikely, but may fail. */ if ((PyObject *)pyrna != Py_None) { /* hold a reference to the iterator since it may have - * allocated memory 'pyrna' needs. eg: introspecting dynamic enum's */ - /* TODO, we could have an api call to know if this is + * allocated memory 'pyrna' needs. eg: introspecting dynamic enum's. */ + /* TODO: we could have an api call to know if this is * needed since most collections don't */ pyrna_struct_reference_set(pyrna, (PyObject *)self); } @@ -7835,7 +7835,7 @@ StructRNA *pyrna_struct_as_srna(PyObject *self, const bool parent, const char *e BPy_StructRNA *py_srna = NULL; StructRNA *srna; - /* Unfortunately PyObject_GetAttrString wont look up this types tp_dict first :/ */ + /* Unfortunately PyObject_GetAttrString won't look up this types tp_dict first :/ */ if (PyType_Check(self)) { py_srna = (BPy_StructRNA *)PyDict_GetItem(((PyTypeObject *)self)->tp_dict, bpy_intern_str_bl_rna); @@ -7884,9 +7884,11 @@ StructRNA *pyrna_struct_as_srna(PyObject *self, const bool parent, const char *e } /* Orphan functions, not sure where they should go. */ -/* Get the srna for methods attached to types. */ -/* - * Caller needs to raise error.*/ +/** + * Get the SRNA for methods attached to types. + * + * Caller needs to raise error. + */ StructRNA *srna_from_self(PyObject *self, const char *error_prefix) { @@ -8029,7 +8031,7 @@ static int pyrna_deferred_register_class_from_type_hints(StructRNA *srna, PyType } } else { - /* Should never happen, an error wont have been raised, so raise one. */ + /* Should never happen, an error won't have been raised, so raise one. */ PyErr_Format(PyExc_TypeError, "typing.get_type_hints returned: %.200s, expected dict\n", Py_TYPE(annotations_dict)->tp_name); @@ -8256,9 +8258,9 @@ static int bpy_class_validate_recursive(PointerRNA *dummyptr, if (func_arg_count >= 0) { /* -1 if we don't care. */ arg_count = ((PyCodeObject *)PyFunction_GET_CODE(item))->co_argcount; - /* note, the number of args we check for and the number of args we give to + /* NOTE: the number of args we check for and the number of args we give to * '@staticmethods' are different (quirk of Python), - * this is why rna_function_arg_count() doesn't return the value -1*/ + * this is why rna_function_arg_count() doesn't return the value -1. */ if (is_staticmethod) { func_arg_count++; func_arg_min_count++; @@ -8437,7 +8439,7 @@ static int bpy_class_call(bContext *C, PointerRNA *ptr, FunctionRNA *func, Param else if (py_srna == NULL) { py_class_instance = NULL; } - else if (py_srna == Py_None) { /* Probably wont ever happen, but possible. */ + else if (py_srna == Py_None) { /* Probably won't ever happen, but possible. */ Py_DECREF(py_srna); py_class_instance = NULL; } @@ -8667,7 +8669,7 @@ static int bpy_class_call(bContext *C, PointerRNA *ptr, FunctionRNA *func, Param if (err != 0) { ReportList *reports; - /* Alert the user, else they wont know unless they see the console. */ + /* Alert the user, else they won't know unless they see the console. */ if ((!is_staticmethod) && (!is_classmethod) && (ptr->data) && (RNA_struct_is_a(ptr->type, &RNA_Operator)) && (is_valid_wm == (CTX_wm_manager(C) != NULL))) { @@ -8675,7 +8677,7 @@ static int bpy_class_call(bContext *C, PointerRNA *ptr, FunctionRNA *func, Param reports = op->reports; } else { - /* Wont alert users, but they can view in 'info' space. */ + /* Won't alert users, but they can view in 'info' space. */ reports = CTX_wm_reports(C); } diff --git a/source/blender/python/intern/bpy_rna.h b/source/blender/python/intern/bpy_rna.h index e891f5c1fc1..75534c05d6c 100644 --- a/source/blender/python/intern/bpy_rna.h +++ b/source/blender/python/intern/bpy_rna.h @@ -110,17 +110,17 @@ extern PyTypeObject pyrna_func_Type; /* 'in_weakreflist' MUST be aligned */ typedef struct { - PyObject_HEAD /* required python macro */ + PyObject_HEAD /* Required Python macro. */ #ifdef USE_WEAKREFS - PyObject *in_weakreflist; + PyObject *in_weakreflist; #endif PointerRNA ptr; } BPy_DummyPointerRNA; typedef struct { - PyObject_HEAD /* required python macro */ + PyObject_HEAD /* Required Python macro. */ #ifdef USE_WEAKREFS - PyObject *in_weakreflist; + PyObject *in_weakreflist; #endif PointerRNA ptr; #ifdef USE_PYRNA_STRUCT_REFERENCE @@ -135,18 +135,18 @@ typedef struct { } BPy_StructRNA; typedef struct { - PyObject_HEAD /* required python macro */ + PyObject_HEAD /* Required Python macro. */ #ifdef USE_WEAKREFS - PyObject *in_weakreflist; + PyObject *in_weakreflist; #endif PointerRNA ptr; PropertyRNA *prop; } BPy_PropertyRNA; typedef struct { - PyObject_HEAD /* required python macro */ + PyObject_HEAD /* Required Python macro. */ #ifdef USE_WEAKREFS - PyObject *in_weakreflist; + PyObject *in_weakreflist; #endif PointerRNA ptr; PropertyRNA *prop; @@ -159,9 +159,9 @@ typedef struct { } BPy_PropertyArrayRNA; typedef struct { - PyObject_HEAD /* required python macro */ + PyObject_HEAD /* Required Python macro. */ #ifdef USE_WEAKREFS - PyObject *in_weakreflist; + PyObject *in_weakreflist; #endif /* collection iterator specific parts */ @@ -169,9 +169,9 @@ typedef struct { } BPy_PropertyCollectionIterRNA; typedef struct { - PyObject_HEAD /* required python macro */ + PyObject_HEAD /* Required Python macro. */ #ifdef USE_WEAKREFS - PyObject *in_weakreflist; + PyObject *in_weakreflist; #endif PointerRNA ptr; FunctionRNA *func; @@ -183,7 +183,7 @@ StructRNA *pyrna_struct_as_srna(PyObject *self, const bool parent, const char *e void BPY_rna_init(void); PyObject *BPY_rna_module(void); void BPY_update_rna_module(void); -/*PyObject *BPY_rna_doc(void);*/ +// PyObject *BPY_rna_doc(void); PyObject *BPY_rna_types(void); PyObject *pyrna_struct_CreatePyObject(PointerRNA *ptr); diff --git a/source/blender/python/intern/bpy_rna_array.c b/source/blender/python/intern/bpy_rna_array.c index cb3fe9cb600..aafc787b6fc 100644 --- a/source/blender/python/intern/bpy_rna_array.c +++ b/source/blender/python/intern/bpy_rna_array.c @@ -536,11 +536,11 @@ static int py_to_array(PyObject *seq, RNA_SetArrayFunc rna_set_array, const char *error_prefix) { - /*int totdim, dim_size[MAX_ARRAY_DIMENSION];*/ + // int totdim, dim_size[MAX_ARRAY_DIMENSION]; int totitem; char *data = NULL; - /*totdim = RNA_property_array_dimension(ptr, prop, dim_size);*/ /*UNUSED*/ + // totdim = RNA_property_array_dimension(ptr, prop, dim_size); /* UNUSED */ if (validate_array(seq, ptr, prop, 0, check_item_type, item_type_str, &totitem, error_prefix) == -1) { diff --git a/source/blender/python/intern/bpy_rna_data.c b/source/blender/python/intern/bpy_rna_data.c index daab1631e8e..639999b69d4 100644 --- a/source/blender/python/intern/bpy_rna_data.c +++ b/source/blender/python/intern/bpy_rna_data.c @@ -40,8 +40,8 @@ #include "bpy_rna_data.h" typedef struct { - PyObject_HEAD /* required python macro */ - BPy_StructRNA *data_rna; + PyObject_HEAD /* Required Python macro. */ + BPy_StructRNA *data_rna; char filepath[1024]; } BPy_DataContext; @@ -141,12 +141,12 @@ static PyTypeObject bpy_rna_data_context_Type = { NULL, /* allocfunc tp_alloc; */ NULL, /* newfunc tp_new; */ /* Low-level free-memory routine */ - NULL, /* freefunc tp_free; */ + NULL, /* freefunc tp_free; */ /* For PyObject_IS_GC */ - NULL, /* inquiry tp_is_gc; */ + NULL, /* inquiry tp_is_gc; */ NULL, /* PyObject *tp_bases; */ /* method resolution order */ - NULL, /* PyObject *tp_mro; */ + NULL, /* PyObject *tp_mro; */ NULL, /* PyObject *tp_cache; */ NULL, /* PyObject *tp_subclasses; */ NULL, /* PyObject *tp_weaklist; */ diff --git a/source/blender/python/mathutils/mathutils_Color.h b/source/blender/python/mathutils/mathutils_Color.h index c966bf1e3b2..40de26f01ea 100644 --- a/source/blender/python/mathutils/mathutils_Color.h +++ b/source/blender/python/mathutils/mathutils_Color.h @@ -31,7 +31,7 @@ typedef struct { /* struct data contains a pointer to the actual data that the * object uses. It can use either PyMem allocated data (which will * be stored in py_data) or be a wrapper for data allocated through - * blender (stored in blend_data). This is an either/or struct not both*/ + * Blender (stored in blend_data). This is an either/or struct not both. */ /* prototypes */ PyObject *Color_CreatePyObject(const float col[3], diff --git a/source/blender/python/mathutils/mathutils_Euler.c b/source/blender/python/mathutils/mathutils_Euler.c index b6a0183d04e..4e1b31b6371 100644 --- a/source/blender/python/mathutils/mathutils_Euler.c +++ b/source/blender/python/mathutils/mathutils_Euler.c @@ -619,9 +619,9 @@ static PySequenceMethods Euler_SeqMethods = { (binaryfunc)NULL, /* sq_concat */ (ssizeargfunc)NULL, /* sq_repeat */ (ssizeargfunc)Euler_item, /* sq_item */ - (ssizessizeargfunc)NULL, /* sq_slice, deprecated */ + (ssizessizeargfunc)NULL, /* sq_slice (deprecated) */ (ssizeobjargproc)Euler_ass_item, /* sq_ass_item */ - (ssizessizeobjargproc)NULL, /* sq_ass_slice, deprecated */ + (ssizessizeobjargproc)NULL, /* sq_ass_slice (deprecated) */ (objobjproc)NULL, /* sq_contains */ (binaryfunc)NULL, /* sq_inplace_concat */ (ssizeargfunc)NULL, /* sq_inplace_repeat */ diff --git a/source/blender/python/mathutils/mathutils_Matrix.c b/source/blender/python/mathutils/mathutils_Matrix.c index 5d38a3692c3..3dde0177648 100644 --- a/source/blender/python/mathutils/mathutils_Matrix.c +++ b/source/blender/python/mathutils/mathutils_Matrix.c @@ -340,7 +340,7 @@ Mathutils_Callback mathutils_matrix_translation_cb = { mathutils_matrix_translation_set_index, }; -/* matrix column callbacks, this is so you can do matrix.translation = Vector() */ +/* matrix column callbacks, this is so you can do `matrix.translation = Vector()`. */ /* ----------------------------------mathutils.Matrix() ----------------- */ /* mat is a 1D array of floats - row[0][0], row[0][1], row[1][0], etc. */ @@ -373,7 +373,7 @@ static PyObject *Matrix_new(PyTypeObject *type, PyObject *args, PyObject *kwds) Py_XDECREF(item); if (num_col >= 2 && num_col <= 4) { - /* sane row & col size, new matrix and assign as slice */ + /* Sane row & col size, new matrix and assign as slice. */ PyObject *matrix = Matrix_CreatePyObject(NULL, num_col, num_row, type); if (Matrix_ass_slice((MatrixObject *)matrix, 0, INT_MAX, arg) == 0) { return matrix; @@ -1339,7 +1339,7 @@ static PyObject *Matrix_to_euler(MatrixObject *self, PyObject *args) copy_v3_v3(eul_compatf, eul_compat->eul); } - /*must be 3-4 cols, 3-4 rows, square matrix */ + /* Must be 3-4 cols, 3-4 rows, square matrix. */ if (self->num_row == 3 && self->num_col == 3) { copy_m3_m3(mat, (const float(*)[3])self->matrix); } @@ -1539,7 +1539,7 @@ static PyObject *Matrix_to_scale(MatrixObject *self) return NULL; } - /*must be 3-4 cols, 3-4 rows, square matrix */ + /* Must be 3-4 cols, 3-4 rows, square matrix. */ if ((self->num_row < 3) || (self->num_col < 3)) { PyErr_SetString(PyExc_ValueError, "Matrix.to_scale(): " @@ -2430,7 +2430,7 @@ static int Matrix_ass_item_col(MatrixObject *self, int col, PyObject *value) } /*----------------------------object[z:y]------------------------ - * sequence slice (get)*/ + * Sequence slice (get). */ static PyObject *Matrix_slice(MatrixObject *self, int begin, int end) { @@ -2456,7 +2456,7 @@ static PyObject *Matrix_slice(MatrixObject *self, int begin, int end) return tuple; } /*----------------------------object[z:y]------------------------ - * sequence slice (set)*/ + * Sequence slice (set). */ static int Matrix_ass_slice(MatrixObject *self, int begin, int end, PyObject *value) { PyObject *value_fast; @@ -2510,7 +2510,7 @@ static int Matrix_ass_slice(MatrixObject *self, int begin, int end, PyObject *va Py_DECREF(value_fast); - /*parsed well - now set in matrix*/ + /* Parsed well - now set in matrix. */ memcpy(self->matrix, mat, self->num_col * self->num_row * sizeof(float)); (void)BaseMath_WriteCallback(self); @@ -2628,7 +2628,7 @@ static PyObject *Matrix_mul(PyObject *m1, PyObject *m2) return Matrix_CreatePyObject(mat, mat2->num_col, mat1->num_row, Py_TYPE(mat1)); } if (mat2) { - /*FLOAT/INT * MATRIX */ + /* FLOAT/INT * MATRIX */ if (((scalar = PyFloat_AsDouble(m1)) == -1.0f && PyErr_Occurred()) == 0) { return matrix_mul_float(mat2, scalar); } @@ -2968,7 +2968,7 @@ static PyObject *Matrix_translation_get(MatrixObject *self, void *UNUSED(closure return NULL; } - /*must be 4x4 square matrix*/ + /* Must be 4x4 square matrix. */ if (self->num_row != 4 || self->num_col != 4) { PyErr_SetString(PyExc_AttributeError, "Matrix.translation: " @@ -2990,7 +2990,7 @@ static int Matrix_translation_set(MatrixObject *self, PyObject *value, void *UNU return -1; } - /*must be 4x4 square matrix*/ + /* Must be 4x4 square matrix. */ if (self->num_row != 4 || self->num_col != 4) { PyErr_SetString(PyExc_AttributeError, "Matrix.translation: " @@ -3034,7 +3034,7 @@ static PyObject *Matrix_median_scale_get(MatrixObject *self, void *UNUSED(closur return NULL; } - /*must be 3-4 cols, 3-4 rows, square matrix*/ + /* Must be 3-4 cols, 3-4 rows, square matrix. */ if ((self->num_row < 3) || (self->num_col < 3)) { PyErr_SetString(PyExc_AttributeError, "Matrix.median_scale: " @@ -3056,7 +3056,7 @@ static PyObject *Matrix_is_negative_get(MatrixObject *self, void *UNUSED(closure return NULL; } - /*must be 3-4 cols, 3-4 rows, square matrix*/ + /* Must be 3-4 cols, 3-4 rows, square matrix. */ if (self->num_row == 4 && self->num_col == 4) { return PyBool_FromLong(is_negative_m4((const float(*)[4])self->matrix)); } @@ -3078,7 +3078,7 @@ static PyObject *Matrix_is_orthogonal_get(MatrixObject *self, void *UNUSED(closu return NULL; } - /*must be 3-4 cols, 3-4 rows, square matrix*/ + /* Must be 3-4 cols, 3-4 rows, square matrix. */ if (self->num_row == 4 && self->num_col == 4) { return PyBool_FromLong(is_orthonormal_m4((const float(*)[4])self->matrix)); } @@ -3101,7 +3101,7 @@ static PyObject *Matrix_is_orthogonal_axis_vectors_get(MatrixObject *self, void return NULL; } - /*must be 3-4 cols, 3-4 rows, square matrix*/ + /* Must be 3-4 cols, 3-4 rows, square matrix. */ if (self->num_row == 4 && self->num_col == 4) { return PyBool_FromLong(is_orthogonal_m4((const float(*)[4])self->matrix)); } @@ -3154,15 +3154,15 @@ static PyGetSetDef Matrix_getseters[] = { /*-----------------------METHOD DEFINITIONS ----------------------*/ static struct PyMethodDef Matrix_methods[] = { - /* derived values */ + /* Derived values. */ {"determinant", (PyCFunction)Matrix_determinant, METH_NOARGS, Matrix_determinant_doc}, {"decompose", (PyCFunction)Matrix_decompose, METH_NOARGS, Matrix_decompose_doc}, - /* in place only */ + /* In place only. */ {"zero", (PyCFunction)Matrix_zero, METH_NOARGS, Matrix_zero_doc}, {"identity", (PyCFunction)Matrix_identity, METH_NOARGS, Matrix_identity_doc}, - /* operate on original or copy */ + /* Operate on original or copy. */ {"transpose", (PyCFunction)Matrix_transpose, METH_NOARGS, Matrix_transpose_doc}, {"transposed", (PyCFunction)Matrix_transposed, METH_NOARGS, Matrix_transposed_doc}, {"normalize", (PyCFunction)Matrix_normalize, METH_NOARGS, Matrix_normalize_doc}, @@ -3176,26 +3176,26 @@ static struct PyMethodDef Matrix_methods[] = { {"to_2x2", (PyCFunction)Matrix_to_2x2, METH_NOARGS, Matrix_to_2x2_doc}, {"to_3x3", (PyCFunction)Matrix_to_3x3, METH_NOARGS, Matrix_to_3x3_doc}, {"to_4x4", (PyCFunction)Matrix_to_4x4, METH_NOARGS, Matrix_to_4x4_doc}, - /* TODO. {"resize_3x3", (PyCFunction) Matrix_resize3x3, METH_NOARGS, Matrix_resize3x3_doc}, */ + /* TODO: {"resize_3x3", (PyCFunction) Matrix_resize3x3, METH_NOARGS, Matrix_resize3x3_doc}, */ {"resize_4x4", (PyCFunction)Matrix_resize_4x4, METH_NOARGS, Matrix_resize_4x4_doc}, {"rotate", (PyCFunction)Matrix_rotate, METH_O, Matrix_rotate_doc}, - /* return converted representation */ + /* Return converted representation. */ {"to_euler", (PyCFunction)Matrix_to_euler, METH_VARARGS, Matrix_to_euler_doc}, {"to_quaternion", (PyCFunction)Matrix_to_quaternion, METH_NOARGS, Matrix_to_quaternion_doc}, {"to_scale", (PyCFunction)Matrix_to_scale, METH_NOARGS, Matrix_to_scale_doc}, {"to_translation", (PyCFunction)Matrix_to_translation, METH_NOARGS, Matrix_to_translation_doc}, - /* operation between 2 or more types */ + /* Operation between 2 or more types. */ {"lerp", (PyCFunction)Matrix_lerp, METH_VARARGS, Matrix_lerp_doc}, {"copy", (PyCFunction)Matrix_copy, METH_NOARGS, Matrix_copy_doc}, {"__copy__", (PyCFunction)Matrix_copy, METH_NOARGS, Matrix_copy_doc}, {"__deepcopy__", (PyCFunction)Matrix_deepcopy, METH_VARARGS, Matrix_copy_doc}, - /* base-math methods */ + /* Base-math methods. */ {"freeze", (PyCFunction)BaseMathObject_freeze, METH_NOARGS, BaseMathObject_freeze_doc}, - /* class methods */ + /* Class methods. */ {"Identity", (PyCFunction)C_Matrix_Identity, METH_VARARGS | METH_CLASS, C_Matrix_Identity_doc}, {"Rotation", (PyCFunction)C_Matrix_Rotation, METH_VARARGS | METH_CLASS, C_Matrix_Rotation_doc}, {"Scale", (PyCFunction)C_Matrix_Scale, METH_VARARGS | METH_CLASS, C_Matrix_Scale_doc}, @@ -3313,7 +3313,7 @@ PyObject *Matrix_CreatePyObject(const float *mat, self->cb_user = NULL; self->cb_type = self->cb_subtype = 0; - if (mat) { /*if a float array passed*/ + if (mat) { /* If a float array passed. */ memcpy(self->matrix, mat, num_col * num_row * sizeof(float)); } else if (num_col == num_row) { @@ -3478,8 +3478,8 @@ int Matrix_Parse4x4(PyObject *o, void *p) * special type for alternate access */ typedef struct { - PyObject_HEAD /* required python macro */ - MatrixObject *matrix_user; + PyObject_HEAD /* Required Python macro. */ + MatrixObject *matrix_user; eMatrixAccess_t type; } MatrixAccessObject; @@ -3655,7 +3655,7 @@ PyTypeObject matrix_access_Type = { NULL, /*tp_compare*/ NULL, /*tp_repr*/ NULL, /*tp_as_number*/ - NULL /*&MatrixAccess_SeqMethods*/ /* TODO */, /*tp_as_sequence*/ + NULL /* &MatrixAccess_SeqMethods */ /* TODO */, /*tp_as_sequence*/ &MatrixAccess_AsMapping, /*tp_as_mapping*/ NULL, /*tp_hash*/ NULL, /*tp_call*/ diff --git a/source/blender/python/mathutils/mathutils_Quaternion.c b/source/blender/python/mathutils/mathutils_Quaternion.c index 3bc60190d56..88aa1f146e2 100644 --- a/source/blender/python/mathutils/mathutils_Quaternion.c +++ b/source/blender/python/mathutils/mathutils_Quaternion.c @@ -1113,7 +1113,7 @@ static PyObject *Quaternion_imatmul(PyObject *q1, PyObject *q2) } /* -obj - * returns the negative of this object*/ + * Returns the negative of this object. */ static PyObject *Quaternion_neg(QuaternionObject *self) { float tquat[QUAT_SIZE]; @@ -1407,11 +1407,11 @@ static void quat__axis_angle_sanitize(float axis[3], float *angle) /* -----------------------METHOD DEFINITIONS ---------------------- */ static struct PyMethodDef Quaternion_methods[] = { - /* in place only */ + /* In place only. */ {"identity", (PyCFunction)Quaternion_identity, METH_NOARGS, Quaternion_identity_doc}, {"negate", (PyCFunction)Quaternion_negate, METH_NOARGS, Quaternion_negate_doc}, - /* operate on original or copy */ + /* Operate on original or copy. */ {"conjugate", (PyCFunction)Quaternion_conjugate, METH_NOARGS, Quaternion_conjugate_doc}, {"conjugated", (PyCFunction)Quaternion_conjugated, METH_NOARGS, Quaternion_conjugated_doc}, @@ -1421,7 +1421,7 @@ static struct PyMethodDef Quaternion_methods[] = { {"normalize", (PyCFunction)Quaternion_normalize, METH_NOARGS, Quaternion_normalize_doc}, {"normalized", (PyCFunction)Quaternion_normalized, METH_NOARGS, Quaternion_normalized_doc}, - /* return converted representation */ + /* Return converted representation. */ {"to_euler", (PyCFunction)Quaternion_to_euler, METH_VARARGS, Quaternion_to_euler_doc}, {"to_matrix", (PyCFunction)Quaternion_to_matrix, METH_NOARGS, Quaternion_to_matrix_doc}, {"to_axis_angle", @@ -1437,7 +1437,7 @@ static struct PyMethodDef Quaternion_methods[] = { METH_NOARGS, Quaternion_to_exponential_map_doc}, - /* operation between 2 or more types */ + /* Operation between 2 or more types. */ {"cross", (PyCFunction)Quaternion_cross, METH_O, Quaternion_cross_doc}, {"dot", (PyCFunction)Quaternion_dot, METH_O, Quaternion_dot_doc}, {"rotation_difference", @@ -1451,7 +1451,7 @@ static struct PyMethodDef Quaternion_methods[] = { METH_O, Quaternion_make_compatible_doc}, - /* base-math methods */ + /* Base-math methods. */ {"freeze", (PyCFunction)BaseMathObject_freeze, METH_NOARGS, BaseMathObject_freeze_doc}, {"copy", (PyCFunction)Quaternion_copy, METH_NOARGS, Quaternion_copy_doc}, diff --git a/source/blender/python/mathutils/mathutils_Vector.c b/source/blender/python/mathutils/mathutils_Vector.c index 1766c7dea66..a9cb125f715 100644 --- a/source/blender/python/mathutils/mathutils_Vector.c +++ b/source/blender/python/mathutils/mathutils_Vector.c @@ -1509,7 +1509,7 @@ static int Vector_ass_slice(VectorObject *self, int begin, int end, PyObject *se return -1; } - /*parsed well - now set in vector*/ + /* Parsed well - now set in vector. */ memcpy(self->vec + begin, vec, size * sizeof(float)); PyMem_Free(vec); @@ -1543,7 +1543,7 @@ static PyObject *Vector_add(PyObject *v1, PyObject *v2) return NULL; } - /*VECTOR + VECTOR*/ + /* VECTOR + VECTOR. */ if (vec1->size != vec2->size) { PyErr_SetString(PyExc_AttributeError, "Vector addition: " @@ -1882,7 +1882,7 @@ static PyObject *Vector_matmul(PyObject *v1, PyObject *v2) return NULL; } - /*dot product*/ + /* Dot product. */ return PyFloat_FromDouble(dot_vn_vn(vec1->vec, vec2->vec, vec1->size)); } if (vec1) { @@ -2007,7 +2007,7 @@ static PyObject *Vector_idiv(PyObject *v1, PyObject *v2) } /* -obj - * returns the negative of this object*/ + * Returns the negative of this object. */ static PyObject *Vector_neg(VectorObject *self) { float *tvec; @@ -2300,7 +2300,7 @@ static int Vector_length_set(VectorObject *self, PyObject *value) dot = dot_vn_vn(self->vec, self->vec, self->size); if (!dot) { - /* cant sqrt zero */ + /* can't sqrt zero */ return 0; } @@ -2974,11 +2974,11 @@ static struct PyMethodDef Vector_methods[] = { {"Linspace", (PyCFunction)C_Vector_Linspace, METH_VARARGS | METH_CLASS, C_Vector_Linspace_doc}, {"Repeat", (PyCFunction)C_Vector_Repeat, METH_VARARGS | METH_CLASS, C_Vector_Repeat_doc}, - /* in place only */ + /* In place only. */ {"zero", (PyCFunction)Vector_zero, METH_NOARGS, Vector_zero_doc}, {"negate", (PyCFunction)Vector_negate, METH_NOARGS, Vector_negate_doc}, - /* operate on original or copy */ + /* Operate on original or copy. */ {"normalize", (PyCFunction)Vector_normalize, METH_NOARGS, Vector_normalize_doc}, {"normalized", (PyCFunction)Vector_normalized, METH_NOARGS, Vector_normalized_doc}, @@ -2994,7 +2994,7 @@ static struct PyMethodDef Vector_methods[] = { {"to_track_quat", (PyCFunction)Vector_to_track_quat, METH_VARARGS, Vector_to_track_quat_doc}, {"orthogonal", (PyCFunction)Vector_orthogonal, METH_NOARGS, Vector_orthogonal_doc}, - /* operation between 2 or more types */ + /* Operation between 2 or more types. */ {"reflect", (PyCFunction)Vector_reflect, METH_O, Vector_reflect_doc}, {"cross", (PyCFunction)Vector_cross, METH_O, Vector_cross_doc}, {"dot", (PyCFunction)Vector_dot, METH_O, Vector_dot_doc}, @@ -3009,7 +3009,7 @@ static struct PyMethodDef Vector_methods[] = { {"slerp", (PyCFunction)Vector_slerp, METH_VARARGS, Vector_slerp_doc}, {"rotate", (PyCFunction)Vector_rotate, METH_O, Vector_rotate_doc}, - /* base-math methods */ + /* Base-math methods. */ {"freeze", (PyCFunction)BaseMathObject_freeze, METH_NOARGS, BaseMathObject_freeze_doc}, {"copy", (PyCFunction)Vector_copy, METH_NOARGS, Vector_copy_doc}, @@ -3105,12 +3105,12 @@ PyTypeObject vector_Type = { NULL, /* allocfunc tp_alloc; */ Vector_new, /* newfunc tp_new; */ /* Low-level free-memory routine */ - NULL, /* freefunc tp_free; */ + NULL, /* freefunc tp_free; */ /* For PyObject_IS_GC */ - NULL, /* inquiry tp_is_gc; */ + NULL, /* inquiry tp_is_gc; */ NULL, /* PyObject *tp_bases; */ /* method resolution order */ - NULL, /* PyObject *tp_mro; */ + NULL, /* PyObject *tp_mro; */ NULL, /* PyObject *tp_cache; */ NULL, /* PyObject *tp_subclasses; */ NULL, /* PyObject *tp_weaklist; */ diff --git a/source/blender/python/mathutils/mathutils_bvhtree.c b/source/blender/python/mathutils/mathutils_bvhtree.c index b00dbacad15..80919e014d5 100644 --- a/source/blender/python/mathutils/mathutils_bvhtree.c +++ b/source/blender/python/mathutils/mathutils_bvhtree.c @@ -93,7 +93,8 @@ static const char PY_BVH_TREE_TYPE_DEFAULT = 4; static const char PY_BVH_AXIS_DEFAULT = 6; typedef struct { - PyObject_HEAD BVHTree *tree; + PyObject_HEAD + BVHTree *tree; float epsilon; float (*coords)[3]; diff --git a/source/blender/python/mathutils/mathutils_geometry.c b/source/blender/python/mathutils/mathutils_geometry.c index 1304447be65..3b1a6524ed9 100644 --- a/source/blender/python/mathutils/mathutils_geometry.c +++ b/source/blender/python/mathutils/mathutils_geometry.c @@ -1213,7 +1213,7 @@ PyDoc_STRVAR(M_Geometry_tessellate_polygon_doc, /* PolyFill function, uses Blenders scanfill to fill multiple poly lines */ static PyObject *M_Geometry_tessellate_polygon(PyObject *UNUSED(self), PyObject *polyLineSeq) { - PyObject *tri_list; /*return this list of tri's */ + PyObject *tri_list; /* Return this list of tri's */ PyObject *polyLine, *polyVec; int i, len_polylines, len_polypoints; bool list_parse_error = false; @@ -1222,7 +1222,7 @@ static PyObject *M_Geometry_tessellate_polygon(PyObject *UNUSED(self), PyObject /* Display #ListBase. */ ListBase dispbase = {NULL, NULL}; DispList *dl; - float *fp; /*pointer to the array of malloced dl->verts to set the points from the vectors */ + float *fp; /* Pointer to the array of malloced dl->verts to set the points from the vectors. */ int totpoints = 0; if (!PySequence_Check(polyLineSeq)) { diff --git a/source/blender/python/mathutils/mathutils_kdtree.c b/source/blender/python/mathutils/mathutils_kdtree.c index 1ff574fefa8..95a3b6dc20b 100644 --- a/source/blender/python/mathutils/mathutils_kdtree.c +++ b/source/blender/python/mathutils/mathutils_kdtree.c @@ -37,7 +37,8 @@ #include "BLI_strict_flags.h" typedef struct { - PyObject_HEAD KDTree_3d *obj; + PyObject_HEAD + KDTree_3d *obj; uint maxsize; uint count; uint count_balance; /* size when we last balanced */ diff --git a/source/blender/python/mathutils/mathutils_noise.c b/source/blender/python/mathutils/mathutils_noise.c index c24960f2d04..707fd40e9d0 100644 --- a/source/blender/python/mathutils/mathutils_noise.c +++ b/source/blender/python/mathutils/mathutils_noise.c @@ -93,7 +93,7 @@ #define MIXBITS(u, v) (((u)&UMASK) | ((v)&LMASK)) #define TWIST(u, v) ((MIXBITS(u, v) >> 1) ^ ((v)&1UL ? MATRIX_A : 0UL)) -static ulong state[N]; /* the array for the state vector */ +static ulong state[N]; /* The array for the state vector. */ static int left = 1; static int initf = 0; static ulong *next; @@ -106,10 +106,10 @@ static void init_genrand(ulong s) state[0] = s & 0xffffffffUL; for (j = 1; j < N; j++) { state[j] = (1812433253UL * (state[j - 1] ^ (state[j - 1] >> 30)) + j); - /* See Knuth TAOCP Vol2. 3rd Ed. P.106 for multiplier. */ - /* In the previous versions, MSBs of the seed affect */ - /* only MSBs of the array state[]. */ - /* 2002/01/09 modified by Makoto Matsumoto */ + /* See Knuth TAOCP Vol2. 3rd Ed. P.106 for multiplier. + * In the previous versions, MSBs of the seed affect + * only MSBs of the array state[]. + * 2002/01/09 modified by Makoto Matsumoto. */ state[j] &= 0xffffffffUL; /* for >32 bit machines */ } left = 1; @@ -230,7 +230,7 @@ static PyC_FlagSet bpy_noise_metrics[] = { {0, NULL}, }; -/* Fills an array of length size with random numbers in the range (-1, 1)*/ +/* Fills an array of length size with random numbers in the range (-1, 1). */ static void rand_vn(float *array_tar, const int size) { float *array_pt = array_tar + (size - 1); diff --git a/source/blender/render/intern/bake.c b/source/blender/render/intern/bake.c index b4776bec2db..2370ed913b2 100644 --- a/source/blender/render/intern/bake.c +++ b/source/blender/render/intern/bake.c @@ -924,7 +924,7 @@ void RE_bake_normal_world_to_tangent(const BakePixel pixel_array[], sign = (signs[0] * u + signs[1] * v + signs[2] * w) < 0 ? (-1.0f) : 1.0f; /* binormal */ - /* B = sign * cross(N, T) */ + /* `B = sign * cross(N, T)` */ cross_v3_v3v3(binormal, normal, tangent); mul_v3_fl(binormal, sign); diff --git a/source/blender/render/intern/initrender.c b/source/blender/render/intern/initrender.c index 3494aa06833..3148625c866 100644 --- a/source/blender/render/intern/initrender.c +++ b/source/blender/render/intern/initrender.c @@ -191,7 +191,7 @@ void RE_SetCamera(Render *re, Object *cam_ob) BKE_camera_params_from_object(¶ms, cam_ob); BKE_camera_multiview_params(&re->r, ¶ms, cam_ob, re->viewname); - /* compute matrix, viewplane, .. */ + /* Compute matrix, view-plane, etc. */ BKE_camera_params_compute_viewplane(¶ms, re->winx, re->winy, re->r.xasp, re->r.yasp); BKE_camera_params_compute_matrix(¶ms); @@ -272,7 +272,7 @@ void RE_parts_init(Render *re) re->parts = BLI_ghash_new( BLI_ghashutil_inthash_v4_p, BLI_ghashutil_inthash_v4_cmp, "render parts"); - /* just for readable code.. */ + /* Just for readable code. */ xminb = re->disprect.xmin; yminb = re->disprect.ymin; xmaxb = re->disprect.xmax; diff --git a/source/blender/render/intern/multires_bake.c b/source/blender/render/intern/multires_bake.c index cba4628b63a..0452be68822 100644 --- a/source/blender/render/intern/multires_bake.c +++ b/source/blender/render/intern/multires_bake.c @@ -200,7 +200,7 @@ static void flush_pixel(const MResolvePixelData *data, const int x, const int y) from_tang[2][r] = no0[r] * u + no1[r] * v + no2[r] * w; } - cross_v3_v3v3(from_tang[1], from_tang[2], from_tang[0]); /* B = sign * cross(N, T) */ + cross_v3_v3v3(from_tang[1], from_tang[2], from_tang[0]); /* `B = sign * cross(N, T)` */ mul_v3_fl(from_tang[1], sign); invert_m3_m3(to_tang, from_tang); } @@ -328,7 +328,7 @@ static void bake_rasterize(const MBakeRast *bake_rast, yhi_beg = (int)ceilf(tmi); yhi = (int)ceilf(thi); - /*if (fTmi>ceilf(fTlo))*/ + // if (fTmi>ceilf(fTlo)) rasterize_half(bake_rast, slo, tlo, smi, tmi, slo, tlo, shi, thi, ylo, yhi_beg, is_mid_right); rasterize_half(bake_rast, smi, tmi, shi, thi, slo, tlo, shi, thi, yhi_beg, yhi, is_mid_right); } diff --git a/source/blender/render/intern/pipeline.c b/source/blender/render/intern/pipeline.c index 20f868ca86f..d3ea27c6bb0 100644 --- a/source/blender/render/intern/pipeline.c +++ b/source/blender/render/intern/pipeline.c @@ -2840,7 +2840,7 @@ RenderPass *RE_create_gp_pass(RenderResult *rr, const char *layername, const cha rl->recty = rr->recty; } - /* clear previous pass if exist or the new image will be over previous one*/ + /* Clear previous pass if exist or the new image will be over previous one. */ RenderPass *rp = RE_pass_find_by_name(rl, RE_PASSNAME_COMBINED, viewname); if (rp) { if (rp->rect) { diff --git a/source/blender/render/intern/render_result.c b/source/blender/render/intern/render_result.c index 74c96392d48..83ed302ea46 100644 --- a/source/blender/render/intern/render_result.c +++ b/source/blender/render/intern/render_result.c @@ -363,7 +363,7 @@ RenderResult *render_result_new( } \ } while (false) - /* a renderlayer should always have a Combined pass*/ + /* A renderlayer should always have a Combined pass. */ render_layer_add_pass(rr, rl, 4, "Combined", view, "RGBA"); if (view_layer->passflag & SCE_PASS_Z) { diff --git a/source/blender/render/intern/texture_image.c b/source/blender/render/intern/texture_image.c index 0299315beaf..9f6980a5b0a 100644 --- a/source/blender/render/intern/texture_image.c +++ b/source/blender/render/intern/texture_image.c @@ -930,7 +930,7 @@ static void feline_eval(TexResult *texr, ImBuf *ibuf, float fx, float fy, afdata #else const float wt = EWA_WTS[(int)(n * n * D)]; #endif - /*const int out =*/ibuf_get_color_clip_bilerp( + /* `const int out =` */ ibuf_get_color_clip_bilerp( tc, ibuf, ibuf->x * u, ibuf->y * v, AFD->intpol, AFD->extflag); /* TXF alpha: clip |= out; * TXF alpha: cw += out ? 0.0f : wt; */ @@ -945,8 +945,8 @@ static void feline_eval(TexResult *texr, ImBuf *ibuf, float fx, float fy, afdata texr->tr *= d; texr->tg *= d; texr->tb *= d; - /* clipping can be ignored if alpha used, texr->ta already includes filtered edge */ - texr->ta = texr->talpha ? texr->ta * d : 1.0f; // TXF alpha: (clip ? cw*d : 1.0f); + /* Clipping can be ignored if alpha used, `texr->ta` already includes filtered edge */ + texr->ta = texr->talpha ? texr->ta * d : 1.0f; /* TXF alpha: `(clip ? cw*d : 1.0f);` */ } #undef EWA_MAXIDX @@ -957,7 +957,7 @@ static void alpha_clip_aniso( rctf rf; /* TXF alpha: we're doing the same alpha-clip here as box-sample, but I'm doubting - * if this is actually correct for the all the filtering algorithms .. */ + * if this is actually correct for the all the filtering algorithms. */ if (!(extflag == TXC_REPT || extflag == TXC_EXTD)) { rf.xmin = minx * (ibuf->x); @@ -1744,7 +1744,7 @@ int imagewraposa(Tex *tex, } } - /* choice: */ + /* Choice: */ if (tex->imaflag & TEX_MIPMAP) { ImBuf *previbuf, *curibuf; float bumpscale; diff --git a/source/blender/render/intern/texture_pointdensity.c b/source/blender/render/intern/texture_pointdensity.c index 4254f6b0aa6..c0ff00d4f59 100644 --- a/source/blender/render/intern/texture_pointdensity.c +++ b/source/blender/render/intern/texture_pointdensity.c @@ -170,7 +170,7 @@ static void pointdensity_cache_psys( ParticleSimulationData sim = {NULL}; ParticleData *pa = NULL; float cfra = BKE_scene_frame_get(scene); - int i /*, childexists*/ /* UNUSED */; + int i /*, Childexists*/ /* UNUSED */; int total_particles; int data_used; float *data_vel, *data_life; diff --git a/source/blender/sequencer/intern/clipboard.c b/source/blender/sequencer/intern/clipboard.c index 29cb749bc99..e3f82dd4bb0 100644 --- a/source/blender/sequencer/intern/clipboard.c +++ b/source/blender/sequencer/intern/clipboard.c @@ -100,7 +100,7 @@ static void seqclipboard_ptr_restore(Main *bmain, ID **id_pt) id_restore = (ID_PT)->newid; } else { - /* the pointer of the same name still exists */ + /* The pointer of the same name still exists. */ id_restore = BLI_findstring(lb, (ID_PT)->name + 2, offsetof(ID, name) + 2); } diff --git a/source/blender/sequencer/intern/effects.c b/source/blender/sequencer/intern/effects.c index d41a2c19d55..1f518a69395 100644 --- a/source/blender/sequencer/intern/effects.c +++ b/source/blender/sequencer/intern/effects.c @@ -2414,19 +2414,19 @@ static void transform_image(int x, for (int yi = start_line; yi < start_line + total_lines; yi++) { for (int xi = 0; xi < x; xi++) { - /* translate point */ + /* Translate point. */ float xt = xi - translate_x; float yt = yi - translate_y; - /* rotate point with center ref */ + /* Rotate point with center ref. */ float xr = c * xt + s * yt; float yr = -s * xt + c * yt; - /* scale point with center ref */ + /* Scale point with center ref. */ xt = xr / scale_x; yt = yr / scale_y; - /* undo reference center point */ + /* Undo reference center point. */ xt += (x / 2.0f); yt += (y / 2.0f); @@ -2651,7 +2651,7 @@ static void RVBlurBitmap2_float(float *map, int width, int height, float blur, i swap = temp; temp = map; /* map = swap; */ /* UNUSED */ - /* Tidy up */ + /* Tidy up. */ MEM_freeN(filter); MEM_freeN(temp); } @@ -3214,7 +3214,7 @@ void seq_effect_speed_rebuild_map(Scene *scene, Sequence *seq, bool force) else { /* if there is no fcurve, use value as simple multiplier */ if (!fcu) { - fallback_fac = seq->speed_fader; /* same as speed_factor in rna*/ + fallback_fac = seq->speed_fader; /* Same as speed_factor in RNA. */ } } diff --git a/source/blender/sequencer/intern/modifier.c b/source/blender/sequencer/intern/modifier.c index b6f56025e6b..75c7d599be5 100644 --- a/source/blender/sequencer/intern/modifier.c +++ b/source/blender/sequencer/intern/modifier.c @@ -1438,7 +1438,7 @@ ImBuf *SEQ_modifier_apply_stack(const SeqRenderData *context, if (smd->mask_time == SEQUENCE_MASK_TIME_RELATIVE) { frame_offset = seq->start; } - else /*if (smd->mask_time == SEQUENCE_MASK_TIME_ABSOLUTE)*/ { + else /* if (smd->mask_time == SEQUENCE_MASK_TIME_ABSOLUTE) */ { frame_offset = smd->mask_id ? ((Mask *)smd->mask_id)->sfra : 0; } diff --git a/source/blender/sequencer/intern/prefetch.c b/source/blender/sequencer/intern/prefetch.c index 4317fa3a850..b7dabda4a34 100644 --- a/source/blender/sequencer/intern/prefetch.c +++ b/source/blender/sequencer/intern/prefetch.c @@ -260,7 +260,7 @@ static void seq_prefetch_update_area(PrefetchJob *pfjob) void SEQ_prefetch_stop_all(void) { - /*TODO(Richard): Use wm_jobs for prefetch, or pass main. */ + /* TODO(Richard): Use wm_jobs for prefetch, or pass main. */ for (Scene *scene = G.main->scenes.first; scene; scene = scene->id.next) { SEQ_prefetch_stop(scene); } @@ -533,7 +533,7 @@ static PrefetchJob *seq_prefetch_start_ex(const SeqRenderData *context, float cf return pfjob; } -/* Start or resume prefetching*/ +/* Start or resume prefetching. */ void seq_prefetch_start(const SeqRenderData *context, float timeline_frame) { Scene *scene = context->scene; diff --git a/source/blender/sequencer/intern/render.c b/source/blender/sequencer/intern/render.c index 76623599864..16adc392b3b 100644 --- a/source/blender/sequencer/intern/render.c +++ b/source/blender/sequencer/intern/render.c @@ -273,11 +273,11 @@ static bool seq_is_effect_of(const Sequence *seq_effect, const Sequence *possibl /* Check if seq must be rendered. This depends on whole stack in some cases, not only seq itself. * Order of applying these conditions is important. */ -static bool must_render_strip(const Sequence *seq, SeqCollection *strips_under_playhead) +static bool must_render_strip(const Sequence *seq, SeqCollection *strips_at_timeline_frame) { bool seq_have_effect_in_stack = false; Sequence *seq_iter; - SEQ_ITERATOR_FOREACH (seq_iter, strips_under_playhead) { + SEQ_ITERATOR_FOREACH (seq_iter, strips_at_timeline_frame) { /* Strips is below another strip with replace blending are not rendered. */ if (seq_iter->blend_mode == SEQ_BLEND_REPLACE && seq->machine < seq_iter->machine) { return false; @@ -335,7 +335,7 @@ static void collection_filter_rendered_strips(SeqCollection *collection) Sequence *seq; /* Remove sound strips and muted strips from collection, because these are not rendered. - * Function must_render_strip() don't have to check for these strips anymore. */ + * Function #must_render_strip() don't have to check for these strips anymore. */ SEQ_ITERATOR_FOREACH (seq, collection) { if (seq->type == SEQ_TYPE_SOUND_RAM || (seq->flag & SEQ_MUTE) != 0) { SEQ_collection_remove_strip(seq, collection); diff --git a/source/blender/sequencer/intern/strip_time.c b/source/blender/sequencer/intern/strip_time.c index 65756006fa9..e5eb0b3f00f 100644 --- a/source/blender/sequencer/intern/strip_time.c +++ b/source/blender/sequencer/intern/strip_time.c @@ -60,7 +60,7 @@ float seq_give_frame_index(Sequence *seq, float timeline_frame) } if (seq->flag & SEQ_REVERSE_FRAMES) { - /*reverse frame in this sequence */ + /* Reverse frame in this sequence. */ if (timeline_frame <= sta) { frame_index = end - sta; } @@ -223,7 +223,7 @@ void SEQ_time_update_sequence(Scene *scene, Sequence *seq) seq->start = seq->startdisp = seq->seq1->startdisp; seq->enddisp = seq->seq1->enddisp; } - /* we cant help if strips don't overlap, it wont give useful results. + /* we can't help if strips don't overlap, it won't give useful results. * but at least ensure 'len' is never negative which causes bad bugs elsewhere. */ if (seq->enddisp < seq->startdisp) { /* simple start/end swap */ diff --git a/source/blender/sequencer/intern/strip_transform.c b/source/blender/sequencer/intern/strip_transform.c index 095d3b2fa9d..20cbe933b2f 100644 --- a/source/blender/sequencer/intern/strip_transform.c +++ b/source/blender/sequencer/intern/strip_transform.c @@ -135,7 +135,7 @@ bool SEQ_transform_seqbase_isolated_sel_check(ListBase *seqbase) /** * Use to impose limits when dragging/extending - so impossible situations don't happen. - * Cant use the #SEQ_LEFTSEL and #SEQ_LEFTSEL directly because the strip may be in a meta-strip. + * Can't use the #SEQ_LEFTSEL and #SEQ_LEFTSEL directly because the strip may be in a meta-strip. */ void SEQ_transform_handle_xlimits(Sequence *seq, int leftflag, int rightflag) { diff --git a/source/blender/simulation/intern/SIM_mass_spring.cpp b/source/blender/simulation/intern/SIM_mass_spring.cpp index ce626498e8e..cf654ebff07 100644 --- a/source/blender/simulation/intern/SIM_mass_spring.cpp +++ b/source/blender/simulation/intern/SIM_mass_spring.cpp @@ -277,10 +277,12 @@ static void cloth_setup_constraints(ClothModifierData *clmd) } } -/* computes where the cloth would be if it were subject to perfectly stiff edges +/** + * Computes where the cloth would be if it were subject to perfectly stiff edges * (edge distance constraints) in a lagrangian solver. then add forces to help * guide the implicit solver to that state. this function is called after - * collisions*/ + * collisions. + */ static int UNUSED_FUNCTION(cloth_calc_helper_forces)(Object *UNUSED(ob), ClothModifierData *clmd, float (*initial_cos)[3], @@ -352,7 +354,7 @@ static int UNUSED_FUNCTION(cloth_calc_helper_forces)(Object *UNUSED(ob), for (i = 0; i < cloth->mvert_num; i++, cv++) { float vec[3]; - /*compute forces*/ + /* Compute forces. */ sub_v3_v3v3(vec, cos[i], cv->tx); mul_v3_fl(vec, cv->mass * dt * 20.0f); add_v3_v3(cv->tv, vec); @@ -625,7 +627,7 @@ static void cloth_calc_force( #endif /* handle pressure forces (making sure that this never gets computed for hair). */ if ((parms->flags & CLOTH_SIMSETTINGS_FLAG_PRESSURE) && (clmd->hairdata == nullptr)) { - /* The difference in pressure between the inside and outside of the mesh.*/ + /* The difference in pressure between the inside and outside of the mesh. */ float pressure_difference = 0.0f; float volume_factor = 1.0f; diff --git a/source/blender/simulation/intern/hair_volume.cpp b/source/blender/simulation/intern/hair_volume.cpp index 08af2344bc4..d954d9b5fff 100644 --- a/source/blender/simulation/intern/hair_volume.cpp +++ b/source/blender/simulation/intern/hair_volume.cpp @@ -722,7 +722,7 @@ bool SIM_hair_volume_solve_divergence(HairGrid *grid, const float flowfac = grid->cellsize; const float inv_flowfac = 1.0f / grid->cellsize; - /*const int num_cells = hair_grid_size(grid->res);*/ + // const int num_cells = hair_grid_size(grid->res); const int res[3] = {grid->res[0], grid->res[1], grid->res[2]}; const int resA[3] = {grid->res[0] + 2, grid->res[1] + 2, grid->res[2] + 2}; @@ -891,7 +891,7 @@ bool SIM_hair_volume_solve_divergence(HairGrid *grid, neighbor_hi_index[neighbors_hi++] = u + strideA2; } - /*int liquid_neighbors = neighbors_lo + neighbors_hi;*/ + // int liquid_neighbors = neighbors_lo + neighbors_hi; non_solid_neighbors = 6; for (n = 0; n < neighbors_lo; n++) { diff --git a/source/blender/simulation/intern/implicit_blender.c b/source/blender/simulation/intern/implicit_blender.c index cf092d7716a..4c01fd3aee0 100644 --- a/source/blender/simulation/intern/implicit_blender.c +++ b/source/blender/simulation/intern/implicit_blender.c @@ -168,7 +168,7 @@ DO_INLINE void zero_lfvector(float (*to)[3], unsigned int verts) { memset(to, 0.0f, verts * sizeof(lfVector)); } -/* multiply long vector with scalar*/ +/* Multiply long vector with scalar. */ DO_INLINE void mul_lfvectorS(float (*to)[3], float (*fLongVector)[3], float scalar, @@ -180,7 +180,7 @@ DO_INLINE void mul_lfvectorS(float (*to)[3], mul_fvector_S(to[i], fLongVector[i], scalar); } } -/* multiply long vector with scalar*/ +/* Multiply long vector with scalar. */ /* A -= B * float */ DO_INLINE void submul_lfvectorS(float (*to)[3], float (*fLongVector)[3], @@ -613,7 +613,7 @@ DO_INLINE void initdiag_bfmatrix(fmatrix3x3 *matrix, float m3[3][3]) } } -/* SPARSE SYMMETRIC multiply big matrix with long vector*/ +/* SPARSE SYMMETRIC multiply big matrix with long vector. */ /* STATUS: verified */ DO_INLINE void mul_bfmatrix_lfvector(float (*to)[3], fmatrix3x3 *from, lfVector *fLongVector) { @@ -644,7 +644,7 @@ DO_INLINE void mul_bfmatrix_lfvector(float (*to)[3], fmatrix3x3 *from, lfVector del_lfvector(temp); } -/* SPARSE SYMMETRIC sub big matrix with big matrix*/ +/* SPARSE SYMMETRIC sub big matrix with big matrix. */ /* A -= B * float + C * float --> for big matrix */ /* VERIFIED */ DO_INLINE void subadd_bfmatrixS_bfmatrixS( diff --git a/source/blender/windowmanager/WM_api.h b/source/blender/windowmanager/WM_api.h index 3525502a6dc..f3c4cb93e7d 100644 --- a/source/blender/windowmanager/WM_api.h +++ b/source/blender/windowmanager/WM_api.h @@ -999,9 +999,9 @@ void WM_xr_action_binding_destroy(wmXrData *xr, unsigned int count_interaction_paths, const char **interaction_paths); -bool WM_xr_active_action_set_set( - wmXrData *xr, const char *action_set_name); /* If action_set_name is NULL, then - * all action sets will be treated as active. */ +/* If action_set_name is NULL, then all action sets will be treated as active. */ +bool WM_xr_active_action_set_set(wmXrData *xr, const char *action_set_name); + bool WM_xr_controller_pose_action_set(wmXrData *xr, const char *action_set_name, const char *action_name); diff --git a/source/blender/windowmanager/WM_toolsystem.h b/source/blender/windowmanager/WM_toolsystem.h index d2e2b9c8f3b..018165634f2 100644 --- a/source/blender/windowmanager/WM_toolsystem.h +++ b/source/blender/windowmanager/WM_toolsystem.h @@ -38,7 +38,7 @@ struct wmMsgSubscribeKey; struct wmMsgSubscribeValue; struct wmOperatorType; -/* wm_toolsystem.c */ +/* wm_toolsystem.c */ #define WM_TOOLSYSTEM_SPACE_MASK \ ((1 << SPACE_IMAGE) | (1 << SPACE_NODE) | (1 << SPACE_VIEW3D) | (1 << SPACE_SEQ)) diff --git a/source/blender/windowmanager/WM_types.h b/source/blender/windowmanager/WM_types.h index 0b26f3c54ae..e83e36d7a9b 100644 --- a/source/blender/windowmanager/WM_types.h +++ b/source/blender/windowmanager/WM_types.h @@ -232,7 +232,7 @@ typedef enum eOperatorPropTags { #define KM_ALT2 64 #define KM_OSKEY2 128 -/* KM_MOD_ flags for wmKeyMapItem and wmEvent.alt/shift/oskey/ctrl */ +/* KM_MOD_ flags for `wmKeyMapItem` and `wmEvent.alt/shift/oskey/ctrl`. */ /* note that KM_ANY and KM_NOTHING are used with these defines too */ #define KM_MOD_FIRST 1 #define KM_MOD_SECOND 2 @@ -326,7 +326,7 @@ typedef struct wmNotifier { #define ND_LAYOUTDELETE (2 << 16) #define ND_ANIMPLAY (4 << 16) #define ND_GPENCIL (5 << 16) -#define ND_EDITOR_CHANGED (6 << 16) /*sent to new editors after switching to them*/ +#define ND_EDITOR_CHANGED (6 << 16) /* Sent to new editors after switching to them. */ #define ND_LAYOUTSET (7 << 16) #define ND_SKETCH (8 << 16) #define ND_WORKSPACE_SET (9 << 16) @@ -407,7 +407,7 @@ typedef struct wmNotifier { #define ND_GPENCIL_EDITMODE (85 << 16) /* NC_GEOM Geometry */ -/* Mesh, Curve, MetaBall, Armature, .. */ +/* Mesh, Curve, MetaBall, Armature, etc. */ #define ND_SELECT (90 << 16) #define ND_DATA (91 << 16) #define ND_VERTEX_GROUP (92 << 16) @@ -433,7 +433,8 @@ typedef struct wmNotifier { #define ND_SPACE_NLA (16 << 16) #define ND_SPACE_SEQUENCER (17 << 16) #define ND_SPACE_NODE_VIEW (18 << 16) -#define ND_SPACE_CHANGED (19 << 16) /*sent to a new editor type after it's replaced an old one*/ +/* Sent to a new editor type after it's replaced an old one. */ +#define ND_SPACE_CHANGED (19 << 16) #define ND_SPACE_CLIP (20 << 16) #define ND_SPACE_FILE_PREVIEW (21 << 16) #define ND_SPACE_SPREADSHEET (22 << 16) diff --git a/source/blender/windowmanager/gizmo/WM_gizmo_types.h b/source/blender/windowmanager/gizmo/WM_gizmo_types.h index fd7f9c2de7c..9a993e1f8d7 100644 --- a/source/blender/windowmanager/gizmo/WM_gizmo_types.h +++ b/source/blender/windowmanager/gizmo/WM_gizmo_types.h @@ -191,7 +191,7 @@ typedef enum eWM_GizmoFlagMapTypeUpdateFlag { typedef enum { /* Drag with extra precision (Shift). */ WM_GIZMO_TWEAK_PRECISE = (1 << 0), - /* Drag with snap enabled (Ctrl). */ + /* Drag with snap enabled (Ctrl). */ WM_GIZMO_TWEAK_SNAP = (1 << 1), } eWM_GizmoFlagTweak; @@ -301,7 +301,7 @@ typedef struct wmGizmoProperty { PropertyRNA *prop; int index; - /* Optional functions for converting to/from RNA */ + /* Optional functions for converting to/from RNA. */ struct { wmGizmoPropertyFnGet value_get_fn; wmGizmoPropertyFnSet value_set_fn; @@ -341,7 +341,7 @@ typedef struct wmGizmoType { const char *idname; /* MAX_NAME */ /** Set to 'sizeof(wmGizmo)' or larger for instances of this type, - * use so we can cant to other types without the hassle of a custom-data pointer. */ + * use so we can cast to other types without the hassle of a custom-data pointer. */ uint struct_size; /** Initialize struct (calloc'd 'struct_size' region). */ diff --git a/source/blender/windowmanager/gizmo/intern/wm_gizmo_target_props.c b/source/blender/windowmanager/gizmo/intern/wm_gizmo_target_props.c index 7cb1a0bdf4b..63e833d73c3 100644 --- a/source/blender/windowmanager/gizmo/intern/wm_gizmo_target_props.c +++ b/source/blender/windowmanager/gizmo/intern/wm_gizmo_target_props.c @@ -312,9 +312,10 @@ void WM_gizmo_do_msg_notify_tag_refresh(bContext *UNUSED(C), ARegion *region = msg_val->owner; wmGizmoMap *gzmap = msg_val->user_data; - ED_region_tag_redraw( - region); /* Could possibly avoid a full redraw and only tag for editor overlays - * redraw in some cases, see #ED_region_tag_redraw_editor_overlays(). */ + /* Could possibly avoid a full redraw and only tag for editor overlays + * redraw in some cases, see #ED_region_tag_redraw_editor_overlays(). */ + ED_region_tag_redraw(region); + WM_gizmomap_tag_refresh(gzmap); } diff --git a/source/blender/windowmanager/intern/wm.c b/source/blender/windowmanager/intern/wm.c index 46e47ae95c4..6dd3e4186c4 100644 --- a/source/blender/windowmanager/intern/wm.c +++ b/source/blender/windowmanager/intern/wm.c @@ -153,7 +153,7 @@ static void window_manager_blend_read_data(BlendDataReader *reader, ID *id) if (win->workspace_hook != NULL) { /* We need to restore a pointer to this later when reading workspaces, * so store in global oldnew-map. - * Note that this is only needed for versioning of older .blend files now.. */ + * Note that this is only needed for versioning of older .blend files now. */ BLO_read_data_globmap_add(reader, hook, win->workspace_hook); /* Cleanup pointers to data outside of this data-block scope. */ win->workspace_hook->act_layout = NULL; diff --git a/source/blender/windowmanager/intern/wm_dragdrop.c b/source/blender/windowmanager/intern/wm_dragdrop.c index fc62d0c6e06..e899cbb22b9 100644 --- a/source/blender/windowmanager/intern/wm_dragdrop.c +++ b/source/blender/windowmanager/intern/wm_dragdrop.c @@ -154,7 +154,7 @@ wmDrag *WM_event_start_drag( switch (type) { case WM_DRAG_PATH: BLI_strncpy(drag->path, poin, FILE_MAX); - /* As the path is being copied, free it immediately as `drag` wont "own" the data. */ + /* As the path is being copied, free it immediately as `drag` won't "own" the data. */ if (flags & WM_DRAG_FREE_DATA) { MEM_freeN(poin); } @@ -518,7 +518,7 @@ void wm_drags_draw(bContext *C, wmWindow *win, rcti *rect) rect->ymin = rect->ymax = cursory; } - /* Should we support multi-line drag draws? Maybe not, more types mixed wont work well. */ + /* Should we support multi-line drag draws? Maybe not, more types mixed won't work well. */ GPU_blend(GPU_BLEND_ALPHA); LISTBASE_FOREACH (wmDrag *, drag, &wm->drags) { const uchar text_col[] = {255, 255, 255, 255}; diff --git a/source/blender/windowmanager/intern/wm_event_query.c b/source/blender/windowmanager/intern/wm_event_query.c index 0050c834a56..905b0f7b128 100644 --- a/source/blender/windowmanager/intern/wm_event_query.c +++ b/source/blender/windowmanager/intern/wm_event_query.c @@ -218,7 +218,7 @@ bool WM_event_type_mask_test(const int event_type, const enum eEventType_Mask ma /** \name Event Motion Queries * \{ */ -/* for modal callbacks, check configuration for how to interpret exit with tweaks */ +/* for modal callbacks, check configuration for how to interpret exit with tweaks. */ bool WM_event_is_modal_tweak_exit(const wmEvent *event, int tweak_event) { /* if the release-confirm userpref setting is enabled, diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c index 43d4859945d..a0fd53685bc 100644 --- a/source/blender/windowmanager/intern/wm_event_system.c +++ b/source/blender/windowmanager/intern/wm_event_system.c @@ -380,8 +380,7 @@ void wm_event_do_depsgraph(bContext *C, bool is_after_open_file) */ Depsgraph *depsgraph = BKE_scene_ensure_depsgraph(bmain, scene, view_layer); if (is_after_open_file) { - DEG_graph_relations_update(depsgraph); - DEG_graph_on_visible_update(bmain, depsgraph, true); + DEG_graph_tag_on_visible_update(depsgraph, true); } DEG_make_active(depsgraph); BKE_scene_graph_update_tagged(depsgraph, bmain); @@ -3494,7 +3493,7 @@ void wm_event_do_handlers(bContext *C) } /* If press was handled, we don't want to do click. This way - * press in tool keymap can override click in editor keymap.*/ + * press in tool key-map can override click in editor key-map. */ if (ISMOUSE_BUTTON(event->type) && event->val == KM_PRESS && !wm_action_not_handled(action)) { win->event_queue_check_click = false; diff --git a/source/blender/windowmanager/intern/wm_files.c b/source/blender/windowmanager/intern/wm_files.c index 0aff2c00644..6230b240d11 100644 --- a/source/blender/windowmanager/intern/wm_files.c +++ b/source/blender/windowmanager/intern/wm_files.c @@ -52,12 +52,15 @@ #include "BLI_blenlib.h" #include "BLI_fileops_types.h" #include "BLI_linklist.h" +#include "BLI_math.h" #include "BLI_system.h" #include "BLI_threads.h" #include "BLI_timer.h" #include "BLI_utildefines.h" #include BLI_SYSTEM_PID_H +#include "PIL_time.h" + #include "BLT_translation.h" #include "BLF_api.h" @@ -733,6 +736,97 @@ static void wm_file_read_post(bContext *C, /** \name Read Main Blend-File API * \{ */ +static void file_read_reports_finalize(BlendFileReadReport *bf_reports) +{ + double duration_whole_minutes, duration_whole_seconds; + double duration_libraries_minutes, duration_libraries_seconds; + double duration_lib_override_minutes, duration_lib_override_seconds; + double duration_lib_override_resync_minutes, duration_lib_override_resync_seconds; + double duration_lib_override_recursive_resync_minutes, + duration_lib_override_recursive_resync_seconds; + + BLI_math_time_seconds_decompose(bf_reports->duration.whole, + NULL, + NULL, + &duration_whole_minutes, + &duration_whole_seconds, + NULL); + BLI_math_time_seconds_decompose(bf_reports->duration.libraries, + NULL, + NULL, + &duration_libraries_minutes, + &duration_libraries_seconds, + NULL); + BLI_math_time_seconds_decompose(bf_reports->duration.lib_overrides, + NULL, + NULL, + &duration_lib_override_minutes, + &duration_lib_override_seconds, + NULL); + BLI_math_time_seconds_decompose(bf_reports->duration.lib_overrides_resync, + NULL, + NULL, + &duration_lib_override_resync_minutes, + &duration_lib_override_resync_seconds, + NULL); + BLI_math_time_seconds_decompose(bf_reports->duration.lib_overrides_recursive_resync, + NULL, + NULL, + &duration_lib_override_recursive_resync_minutes, + &duration_lib_override_recursive_resync_seconds, + NULL); + + CLOG_INFO( + &LOG, 0, "Blender file read in %.0fm%.2fs", duration_whole_minutes, duration_whole_seconds); + CLOG_INFO(&LOG, + 0, + " * Loading libraries: %.0fm%.2fs", + duration_libraries_minutes, + duration_libraries_seconds); + CLOG_INFO(&LOG, + 0, + " * Applying overrides: %.0fm%.2fs", + duration_lib_override_minutes, + duration_lib_override_seconds); + CLOG_INFO(&LOG, + 0, + " * Resyncing overrides: %.0fm%.2fs (%d root overrides), including recursive " + "resyncs: %.0fm%.2fs)", + duration_lib_override_resync_minutes, + duration_lib_override_resync_seconds, + bf_reports->count.resynced_lib_overrides, + duration_lib_override_recursive_resync_minutes, + duration_lib_override_recursive_resync_seconds); + if (bf_reports->resynced_lib_overrides_libraries_count != 0) { + for (LinkNode *node_lib = bf_reports->resynced_lib_overrides_libraries; node_lib != NULL; + node_lib = node_lib->next) { + Library *library = node_lib->link; + BKE_reportf( + bf_reports->reports, RPT_INFO, "Library %s needs overrides resync.", library->filepath); + } + } + if (bf_reports->count.missing_libraries != 0 || bf_reports->count.missing_linked_id != 0) { + BKE_reportf(bf_reports->reports, + RPT_WARNING, + "%d libraries and %d linked data-blocks are missing, please check the " + "Info and Outliner editors for details", + bf_reports->count.missing_libraries, + bf_reports->count.missing_linked_id); + } + if (bf_reports->resynced_lib_overrides_libraries_count != 0) { + BKE_reportf(bf_reports->reports, + RPT_WARNING, + "%d libraries have overrides needing resync (auto resynced in %.0fm%.2fs), " + "please check the Info editor for details", + bf_reports->resynced_lib_overrides_libraries_count, + duration_lib_override_recursive_resync_minutes, + duration_lib_override_recursive_resync_seconds); + } + + BLI_linklist_free(bf_reports->resynced_lib_overrides_libraries, NULL); + bf_reports->resynced_lib_overrides_libraries = NULL; +} + bool WM_file_read(bContext *C, const char *filepath, ReportList *reports) { /* assume automated tasks with background, don't write recent file list */ @@ -763,7 +857,9 @@ bool WM_file_read(bContext *C, const char *filepath, ReportList *reports) .skip_flags = BLO_READ_SKIP_USERDEF, }; - struct BlendFileData *bfd = BKE_blendfile_read(filepath, ¶ms, reports); + BlendFileReadReport bf_reports = {.reports = reports, + .duration.whole = PIL_check_seconds_timer()}; + struct BlendFileData *bfd = BKE_blendfile_read(filepath, ¶ms, &bf_reports); if (bfd != NULL) { wm_file_read_pre(C, use_data, use_userdef); @@ -773,10 +869,10 @@ bool WM_file_read(bContext *C, const char *filepath, ReportList *reports) wm_window_match_init(C, &wmbase); /* This flag is initialized by the operator but overwritten on read. - * need to re-enable it here else drivers + registered scripts wont work. */ + * need to re-enable it here else drivers and registered scripts won't work. */ const int G_f_orig = G.f; - BKE_blendfile_read_setup(C, bfd, ¶ms, reports); + BKE_blendfile_read_setup(C, bfd, ¶ms, &bf_reports); if (G.f != G_f_orig) { const int flags_keep = G_FLAG_ALL_RUNTIME; @@ -807,6 +903,9 @@ bool WM_file_read(bContext *C, const char *filepath, ReportList *reports) wm_file_read_post(C, false, false, use_data, use_userdef, false); + bf_reports.duration.whole = PIL_check_seconds_timer() - bf_reports.duration.whole; + file_read_reports_finalize(&bf_reports); + success = true; } } @@ -1086,11 +1185,12 @@ void wm_homefile_read(bContext *C, .is_startup = true, .skip_flags = skip_flags | BLO_READ_SKIP_USERDEF, }; + BlendFileReadReport bf_reports = {.reports = reports}; + struct BlendFileData *bfd = BKE_blendfile_read(filepath_startup, ¶ms, &bf_reports); - struct BlendFileData *bfd = BKE_blendfile_read(filepath_startup, ¶ms, NULL); if (bfd != NULL) { BKE_blendfile_read_setup_ex( - C, bfd, ¶ms, NULL, update_defaults && use_data, app_template); + C, bfd, ¶ms, &bf_reports, update_defaults && use_data, app_template); success = true; } } @@ -1120,7 +1220,7 @@ void wm_homefile_read(bContext *C, struct BlendFileData *bfd = BKE_blendfile_read_from_memory( datatoc_startup_blend, datatoc_startup_blend_size, ¶ms, NULL); if (bfd != NULL) { - BKE_blendfile_read_setup_ex(C, bfd, ¶ms, NULL, true, NULL); + BKE_blendfile_read_setup_ex(C, bfd, ¶ms, &(BlendFileReadReport){NULL}, true, NULL); success = true; } @@ -1583,7 +1683,7 @@ static bool wm_file_write(bContext *C, BKE_callback_exec_null(bmain, BKE_CB_EVT_SAVE_POST); - /* run this function after because the file cant be written before the blend is */ + /* run this function after because the file can't be written before the blend is */ if (ibuf_thumb) { IMB_thumb_delete(filepath, THB_FAIL); /* without this a failed thumb overrides */ ibuf_thumb = IMB_thumb_create(filepath, THB_LARGE, THB_SOURCE_BLEND, ibuf_thumb); @@ -1778,7 +1878,7 @@ void wm_open_init_use_scripts(wmOperator *op, bool use_prefs) if (!RNA_property_is_set(op->ptr, prop)) { /* use G_FLAG_SCRIPT_AUTOEXEC rather than the userpref because this means if * the flag has been disabled from the command line, then opening - * from the menu wont enable this setting. */ + * from the menu won't enable this setting. */ bool value = use_prefs ? ((U.flag & USER_SCRIPT_AUTOEXEC_DISABLE) == 0) : ((G.f & G_FLAG_SCRIPT_AUTOEXEC) != 0); @@ -1836,7 +1936,7 @@ static int wm_homefile_write_exec(bContext *C, wmOperator *op) &(const struct BlendFileWriteParams){ /* Make all paths absolute when saving the startup file. * On load the `G.relbase_valid` will be false so the paths - * wont have a base for resolving the relative paths. */ + * won't have a base for resolving the relative paths. */ .remap_mode = BLO_WRITE_PATH_REMAP_ABSOLUTE, /* Don't apply any path changes to the current blend file. */ .use_save_as_copy = true, diff --git a/source/blender/windowmanager/intern/wm_files_link.c b/source/blender/windowmanager/intern/wm_files_link.c index e467dcd243e..fec5a516688 100644 --- a/source/blender/windowmanager/intern/wm_files_link.c +++ b/source/blender/windowmanager/intern/wm_files_link.c @@ -239,12 +239,14 @@ static void wm_link_do(WMLinkAppendData *lapp_data, for (lib_idx = 0, liblink = lapp_data->libraries.list; liblink; lib_idx++, liblink = liblink->next) { char *libname = liblink->link; + BlendFileReadReport bf_reports = {.reports = reports}; if (STREQ(libname, BLO_EMBEDDED_STARTUP_BLEND)) { - bh = BLO_blendhandle_from_memory(datatoc_startup_blend, datatoc_startup_blend_size); + bh = BLO_blendhandle_from_memory( + datatoc_startup_blend, datatoc_startup_blend_size, &bf_reports); } else { - bh = BLO_blendhandle_from_file(libname, reports); + bh = BLO_blendhandle_from_file(libname, &bf_reports); } if (bh == NULL) { @@ -521,7 +523,7 @@ static int wm_link_append_exec(bContext *C, wmOperator *op) wm_link_append_data_free(lapp_data); - /* important we unset, otherwise these object wont + /* important we unset, otherwise these object won't * link into other scenes from this blend file */ BKE_main_id_tag_all(bmain, LIB_TAG_PRE_EXISTING, false); @@ -1008,7 +1010,7 @@ static void lib_relocate_do(Main *bmain, BKE_main_lib_objects_recalc_all(bmain); IMB_colormanagement_check_file_config(bmain); - /* important we unset, otherwise these object wont + /* important we unset, otherwise these object won't * link into other scenes from this blend file */ BKE_main_id_tag_all(bmain, LIB_TAG_PRE_EXISTING, false); diff --git a/source/blender/windowmanager/intern/wm_init_exit.c b/source/blender/windowmanager/intern/wm_init_exit.c index 15f0978f87d..48ab76317b5 100644 --- a/source/blender/windowmanager/intern/wm_init_exit.c +++ b/source/blender/windowmanager/intern/wm_init_exit.c @@ -272,7 +272,7 @@ void WM_init(bContext *C, int argc, const char **argv) * for scripts that do background processing with preview icons. */ BKE_icons_init(BIFICONID_LAST); - /* reports cant be initialized before the wm, + /* reports can't be initialized before the wm, * but keep before file reading, since that may report errors */ wm_init_reports(C); @@ -331,7 +331,7 @@ void WM_init(bContext *C, int argc, const char **argv) * startup.blend because it may contain PyDrivers. It also needs to be after * initializing space types and other internal data. * - * However cant redo this at the moment. Solution is to load python + * However can't redo this at the moment. Solution is to load python * before wm_homefile_read() or make py-drivers check if python is running. * Will try fix when the crash can be repeated. - campbell. */ diff --git a/source/blender/windowmanager/intern/wm_keymap.c b/source/blender/windowmanager/intern/wm_keymap.c index 0a157e63b09..69b3660038d 100644 --- a/source/blender/windowmanager/intern/wm_keymap.c +++ b/source/blender/windowmanager/intern/wm_keymap.c @@ -1787,7 +1787,7 @@ void WM_keyconfig_update(wmWindowManager *wm) } if (wm_keymap_update_flag & WM_KEYMAP_UPDATE_OPERATORTYPE) { - /* an operatortype has been removed, this wont happen often + /* an operatortype has been removed, this won't happen often * but when it does we have to check _every_ keymap item */ ListBase *keymaps_lb[] = { &U.user_keymaps, diff --git a/source/blender/windowmanager/intern/wm_keymap_utils.c b/source/blender/windowmanager/intern/wm_keymap_utils.c index 865889e7e64..b0b4f0f5904 100644 --- a/source/blender/windowmanager/intern/wm_keymap_utils.c +++ b/source/blender/windowmanager/intern/wm_keymap_utils.c @@ -247,7 +247,7 @@ wmKeyMap *WM_keymap_guess_opname(const bContext *C, const char *opname) else if (STRPREFIX(opname, "MARKER_OT")) { km = WM_keymap_find_all(wm, "Markers", 0, 0); } - /* Import/Export*/ + /* Import/Export */ else if (STRPREFIX(opname, "IMPORT_") || STRPREFIX(opname, "EXPORT_")) { km = WM_keymap_find_all(wm, "Window", 0, 0); } diff --git a/source/blender/windowmanager/intern/wm_operator_type.c b/source/blender/windowmanager/intern/wm_operator_type.c index f33db7d50b5..e17d5a9ae70 100644 --- a/source/blender/windowmanager/intern/wm_operator_type.c +++ b/source/blender/windowmanager/intern/wm_operator_type.c @@ -229,7 +229,7 @@ void wm_operatortype_free(void) void WM_operatortype_props_advanced_begin(wmOperatorType *ot) { if (ot_prop_basic_count == -1) { - /* Don't do anything if _begin was called before, but not _end */ + /* Don't do anything if _begin was called before, but not _end. */ ot_prop_basic_count = RNA_struct_count_properties(ot->srna); } } @@ -343,7 +343,7 @@ static int wm_macro_exec(bContext *C, wmOperator *op) } } else { - CLOG_WARN(WM_LOG_OPERATORS, "'%s' cant exec macro", opm->type->idname); + CLOG_WARN(WM_LOG_OPERATORS, "'%s' can't exec macro", opm->type->idname); } } diff --git a/source/blender/windowmanager/intern/wm_operators.c b/source/blender/windowmanager/intern/wm_operators.c index 9175eb2dbf7..a2d783afc32 100644 --- a/source/blender/windowmanager/intern/wm_operators.c +++ b/source/blender/windowmanager/intern/wm_operators.c @@ -53,7 +53,7 @@ #include "BLI_blenlib.h" #include "BLI_dial_2d.h" -#include "BLI_dynstr.h" /*for WM_operator_pystring */ +#include "BLI_dynstr.h" /* For #WM_operator_pystring. */ #include "BLI_math.h" #include "BLI_utildefines.h" @@ -323,16 +323,16 @@ bool WM_operator_pystring_abbreviate(char *str, int str_len_max) if (parens_len > str_len_max) { const char *comma_first = strchr(parens_start, ','); - /* truncate after the first comma */ + /* Truncate after the first comma. */ if (comma_first) { const char end_str[] = " ... )"; const int end_str_len = sizeof(end_str) - 1; - /* leave a place for the first argument*/ + /* Leave a place for the first argument. */ const int new_str_len = (comma_first - parens_start) + 1; if (str_len >= new_str_len + parens_start_pos + end_str_len + 1) { - /* append " ... )" to the string after the comma */ + /* Append " ... )" to the string after the comma. */ memcpy(str + new_str_len + parens_start_pos, end_str, end_str_len + 1); return true; @@ -1346,7 +1346,7 @@ static void dialog_exec_cb(bContext *C, void *arg1, void *arg2) wmOperator *op; { /* Execute will free the operator. - * In this case, wm_operator_ui_popup_cancel wont run. */ + * In this case, wm_operator_ui_popup_cancel won't run. */ wmOpPopUp *data = arg1; op = data->op; MEM_freeN(data); @@ -2885,7 +2885,7 @@ static int radial_control_modal(bContext *C, wmOperator *op, const wmEvent *even } } - /* calculate new value and apply snapping */ + /* Calculate new value and apply snapping. */ switch (rc->subtype) { case PROP_NONE: case PROP_DISTANCE: diff --git a/source/blender/windowmanager/intern/wm_platform_support.c b/source/blender/windowmanager/intern/wm_platform_support.c index 45618e9d6d3..54fc454ee65 100644 --- a/source/blender/windowmanager/intern/wm_platform_support.c +++ b/source/blender/windowmanager/intern/wm_platform_support.c @@ -123,7 +123,7 @@ bool WM_platform_support_perform_checks() const char *platform_key = GPU_platform_support_level_key(); /* Check if previous check matches the current check. Don't update the approval when running in - * `background`. this could have been triggered by installing add-ons via installers. */ + * `background`. this could have been triggered by installing add-ons via installers. */ if (support_level != GPU_SUPPORT_LEVEL_UNSUPPORTED && !G.factory_startup && wm_platform_support_check_approval(platform_key, !G.background)) { /* If it matches the user has confirmed and wishes to use it. */ diff --git a/source/blender/windowmanager/intern/wm_window.c b/source/blender/windowmanager/intern/wm_window.c index 6aedfb10dde..1c745ba4c79 100644 --- a/source/blender/windowmanager/intern/wm_window.c +++ b/source/blender/windowmanager/intern/wm_window.c @@ -136,7 +136,7 @@ static void wm_window_set_drawable(wmWindowManager *wm, wmWindow *win, bool acti static bool wm_window_timer(const bContext *C); /* XXX this one should correctly check for apple top header... - * done for Cocoa : returns window contents (and not frame) max size*/ + * done for Cocoa : returns window contents (and not frame) max size. */ void wm_get_screensize(int *r_width, int *r_height) { unsigned int uiwidth; @@ -188,7 +188,7 @@ static void wm_ghostwindow_destroy(wmWindowManager *wm, wmWindow *win) GHOST_ActivateWindowDrawingContext(win->ghostwin); GPU_context_active_set(win->gpuctx); - /* Delete local gpu context. */ + /* Delete local GPU context. */ GPU_context_discard(win->gpuctx); GHOST_DisposeWindow(g_system, win->ghostwin); @@ -440,8 +440,8 @@ void wm_window_close(bContext *C, wmWindowManager *wm, wmWindow *win) void wm_window_title(wmWindowManager *wm, wmWindow *win) { if (WM_window_is_temp_screen(win)) { - /* nothing to do for 'temp' windows, - * because WM_window_open always sets window title */ + /* Nothing to do for 'temp' windows, + * because #WM_window_open always sets window title. */ } else if (win->ghostwin) { /* this is set to 1 if you don't have startup.blend open */ @@ -2080,7 +2080,7 @@ void WM_init_tablet_api(void) if (g_system) { switch (U.tablet_api) { case USER_TABLET_NATIVE: - GHOST_SetTabletAPI(g_system, GHOST_kTabletNative); + GHOST_SetTabletAPI(g_system, GHOST_kTabletWinPointer); break; case USER_TABLET_WINTAB: GHOST_SetTabletAPI(g_system, GHOST_kTabletWintab); diff --git a/source/blender/windowmanager/wm_event_types.h b/source/blender/windowmanager/wm_event_types.h index 223f6cf543d..ccb6e47e7e3 100644 --- a/source/blender/windowmanager/wm_event_types.h +++ b/source/blender/windowmanager/wm_event_types.h @@ -395,7 +395,7 @@ enum { ((ISKEYBOARD(event_type) || ISMOUSE(event_type) || ISNDOF(event_type)) && \ (ISKEYMODIFIER(event_type) == false)) -/* internal helpers*/ +/* Internal helpers. */ #define _VA_IS_EVENT_MOD2(v, a) (CHECK_TYPE_INLINE(v, wmEvent *), ((v)->a)) #define _VA_IS_EVENT_MOD3(v, a, b) (_VA_IS_EVENT_MOD2(v, a) || ((v)->b)) #define _VA_IS_EVENT_MOD4(v, a, b, c) (_VA_IS_EVENT_MOD3(v, a, b) || ((v)->c)) |