diff options
author | Jacques Lucke <jacques@blender.org> | 2022-01-10 19:27:48 +0300 |
---|---|---|
committer | Jacques Lucke <jacques@blender.org> | 2022-01-10 19:27:48 +0300 |
commit | 38f5fcc94d2dc5e51b153bb8da2347a6068c8a98 (patch) | |
tree | 5a33763144c0c634238e119ef5034dd19ac39788 /source/blender | |
parent | 32e8381e0e4b97e6acbaa145dc222ca1bdbbac11 (diff) | |
parent | 39ba82f25d1532526fbf5f1be2faa4f327d3a51e (diff) |
Merge branch 'master' into temp-scale-elements-node-test
Diffstat (limited to 'source/blender')
581 files changed, 5648 insertions, 6033 deletions
diff --git a/source/blender/blenfont/BLF_api.h b/source/blender/blenfont/BLF_api.h index bd1fa4ce4e5..76a6135baaf 100644 --- a/source/blender/blenfont/BLF_api.h +++ b/source/blender/blenfont/BLF_api.h @@ -124,7 +124,7 @@ int BLF_draw_mono(int fontid, const char *str, size_t str_len, int cwidth) ATTR_ typedef bool (*BLF_GlyphBoundsFn)(const char *str, const size_t str_step_ofs, const struct rcti *glyph_step_bounds, - const int glyph_advance_x, + int glyph_advance_x, const struct rctf *glyph_bounds, const int glyph_bearing[2], void *user_data); @@ -298,9 +298,9 @@ void BLF_dir_free(char **dirs, int count) ATTR_NONNULL(); void BLF_thumb_preview(const char *filename, const char **draw_str, const char **i18n_draw_str, - const unsigned char draw_str_lines, + unsigned char draw_str_lines, const float font_color[4], - const int font_size, + int font_size, unsigned char *buf, int w, int h, @@ -326,8 +326,8 @@ int BLF_set_default(void); /* blf_font_default.c */ -int BLF_load_default(const bool unique); -int BLF_load_mono_default(const bool unique); +int BLF_load_default(bool unique); +int BLF_load_mono_default(bool unique); #ifdef DEBUG void BLF_state_print(int fontid); diff --git a/source/blender/blenfont/intern/blf_internal.h b/source/blender/blenfont/intern/blf_internal.h index 02e4a896a31..23e42ec777f 100644 --- a/source/blender/blenfont/intern/blf_internal.h +++ b/source/blender/blenfont/intern/blf_internal.h @@ -123,7 +123,7 @@ void blf_font_boundbox_foreach_glyph(struct FontBLF *font, bool (*user_fn)(const char *str, const size_t str_step_ofs, const struct rcti *glyph_step_bounds, - const int glyph_advance_x, + int glyph_advance_x, const struct rctf *glyph_bounds, const int glyph_bearing[2], void *user_data), diff --git a/source/blender/blenkernel/BKE_DerivedMesh.h b/source/blender/blenkernel/BKE_DerivedMesh.h index 932ef234342..c5171371afc 100644 --- a/source/blender/blenkernel/BKE_DerivedMesh.h +++ b/source/blender/blenkernel/BKE_DerivedMesh.h @@ -376,7 +376,7 @@ void DM_interp_vert_data(struct DerivedMesh *source, int count, int dest_index); -void mesh_get_mapped_verts_coords(struct Mesh *me_eval, float (*r_cos)[3], const int totcos); +void mesh_get_mapped_verts_coords(struct Mesh *me_eval, float (*r_cos)[3], int totcos); /** * Same as above but won't use render settings. diff --git a/source/blender/blenkernel/BKE_anim_data.h b/source/blender/blenkernel/BKE_anim_data.h index bee8bde989c..81c49917b63 100644 --- a/source/blender/blenkernel/BKE_anim_data.h +++ b/source/blender/blenkernel/BKE_anim_data.h @@ -117,9 +117,7 @@ bool BKE_animdata_copy_id(struct Main *bmain, struct ID *id_to, struct ID *id_fr */ void BKE_animdata_copy_id_action(struct Main *bmain, struct ID *id); -void BKE_animdata_duplicate_id_action(struct Main *bmain, - struct ID *id, - const uint duplicate_flags); +void BKE_animdata_duplicate_id_action(struct Main *bmain, struct ID *id, uint duplicate_flags); /* Merge copies of data from source AnimData block */ typedef enum eAnimData_MergeCopy_Modes { diff --git a/source/blender/blenkernel/BKE_appdir.h b/source/blender/blenkernel/BKE_appdir.h index dd589282bdd..e92909fb3ca 100644 --- a/source/blender/blenkernel/BKE_appdir.h +++ b/source/blender/blenkernel/BKE_appdir.h @@ -88,26 +88,21 @@ bool BKE_appdir_folder_caches(char *r_path, size_t path_len); * this may contain path separators but must resolve to a directory, checked with #BLI_is_dir. * \return The path if found, NULL string if not. */ -bool BKE_appdir_folder_id_ex(const int folder_id, - const char *subfolder, - char *path, - size_t path_len); -const char *BKE_appdir_folder_id(const int folder_id, const char *subfolder); +bool BKE_appdir_folder_id_ex(int folder_id, const char *subfolder, char *path, size_t path_len); +const char *BKE_appdir_folder_id(int folder_id, const char *subfolder); /** * Returns the path to a folder in the user area, creating it if it doesn't exist. */ -const char *BKE_appdir_folder_id_create(const int folder_id, const char *subfolder); +const char *BKE_appdir_folder_id_create(int folder_id, const char *subfolder); /** * Returns the path to a folder in the user area without checking that it actually exists first. */ -const char *BKE_appdir_folder_id_user_notest(const int folder_id, const char *subfolder); +const char *BKE_appdir_folder_id_user_notest(int folder_id, const char *subfolder); /** * Returns the path of the top-level version-specific local, user or system directory. * If check_is_dir, then the result will be NULL if the directory doesn't exist. */ -const char *BKE_appdir_folder_id_version(const int folder_id, - const int version, - const bool check_is_dir); +const char *BKE_appdir_folder_id_version(int folder_id, int version, bool check_is_dir); /** * Check if this is an install with user files kept together @@ -146,8 +141,8 @@ bool BKE_appdir_font_folder_default(char *dir); */ bool BKE_appdir_program_python_search(char *fullpath, const size_t fullpath_len, - const int version_major, - const int version_minor); + int version_major, + int version_minor); /** * Initialize path to temporary directory. diff --git a/source/blender/blenkernel/BKE_asset_library.hh b/source/blender/blenkernel/BKE_asset_library.hh index 15f7991e75e..37e2ad38a29 100644 --- a/source/blender/blenkernel/BKE_asset_library.hh +++ b/source/blender/blenkernel/BKE_asset_library.hh @@ -63,7 +63,7 @@ struct AssetLibrary { void on_blend_save_handler_register(); void on_blend_save_handler_unregister(); - void on_blend_save_post(struct Main *, struct PointerRNA **pointers, const int num_pointers); + void on_blend_save_post(struct Main *, struct PointerRNA **pointers, int num_pointers); private: bCallbackFuncStore on_save_callback_store_{}; diff --git a/source/blender/blenkernel/BKE_attribute.h b/source/blender/blenkernel/BKE_attribute.h index 1e2dcf09b64..db8f3759bf8 100644 --- a/source/blender/blenkernel/BKE_attribute.h +++ b/source/blender/blenkernel/BKE_attribute.h @@ -54,19 +54,16 @@ typedef enum AttributeDomain { bool BKE_id_attributes_supported(struct ID *id); -struct CustomDataLayer *BKE_id_attribute_new(struct ID *id, - const char *name, - const int type, - const AttributeDomain domain, - struct ReportList *reports); +struct CustomDataLayer *BKE_id_attribute_new( + struct ID *id, const char *name, int type, AttributeDomain domain, struct ReportList *reports); bool BKE_id_attribute_remove(struct ID *id, struct CustomDataLayer *layer, struct ReportList *reports); struct CustomDataLayer *BKE_id_attribute_find(const struct ID *id, const char *name, - const int type, - const AttributeDomain domain); + int type, + AttributeDomain domain); AttributeDomain BKE_id_attribute_domain(struct ID *id, struct CustomDataLayer *layer); int BKE_id_attribute_data_length(struct ID *id, struct CustomDataLayer *layer); diff --git a/source/blender/blenkernel/BKE_attribute_access.hh b/source/blender/blenkernel/BKE_attribute_access.hh index 114d9e1e0d7..f69ba79e23f 100644 --- a/source/blender/blenkernel/BKE_attribute_access.hh +++ b/source/blender/blenkernel/BKE_attribute_access.hh @@ -264,7 +264,7 @@ class OutputAttribute { OutputAttribute(GVMutableArray varray, AttributeDomain domain, SaveFn save, - const bool ignore_old_values); + bool ignore_old_values); ~OutputAttribute(); @@ -387,7 +387,7 @@ class CustomDataAttributes { CustomDataAttributes(CustomDataAttributes &&other); CustomDataAttributes &operator=(const CustomDataAttributes &other); - void reallocate(const int size); + void reallocate(int size); void clear(); @@ -423,8 +423,7 @@ class CustomDataAttributes { */ void reorder(Span<AttributeIDRef> new_order); - bool foreach_attribute(const AttributeForeachCallback callback, - const AttributeDomain domain) const; + bool foreach_attribute(const AttributeForeachCallback callback, AttributeDomain domain) const; }; /* -------------------------------------------------------------------- */ diff --git a/source/blender/blenkernel/BKE_attribute_math.hh b/source/blender/blenkernel/BKE_attribute_math.hh index 2ce41e95b65..802c744972c 100644 --- a/source/blender/blenkernel/BKE_attribute_math.hh +++ b/source/blender/blenkernel/BKE_attribute_math.hh @@ -141,7 +141,7 @@ inline ColorGeometry4f mix3(const float3 &weights, * This is just basic linear interpolation. * \{ */ -template<typename T> T mix2(const float factor, const T &a, const T &b); +template<typename T> T mix2(float factor, const T &a, const T &b); template<> inline bool mix2(const float factor, const bool &a, const bool &b) { @@ -287,7 +287,7 @@ class ColorGeometryMixer { public: ColorGeometryMixer(MutableSpan<ColorGeometry4f> buffer, ColorGeometry4f default_color = ColorGeometry4f(0.0f, 0.0f, 0.0f, 1.0f)); - void mix_in(const int64_t index, const ColorGeometry4f &color, const float weight = 1.0f); + void mix_in(int64_t index, const ColorGeometry4f &color, float weight = 1.0f); void finalize(); }; diff --git a/source/blender/blenkernel/BKE_blender_copybuffer.h b/source/blender/blenkernel/BKE_blender_copybuffer.h index abfb37ef959..d1faf88a90c 100644 --- a/source/blender/blenkernel/BKE_blender_copybuffer.h +++ b/source/blender/blenkernel/BKE_blender_copybuffer.h @@ -63,7 +63,7 @@ bool BKE_copybuffer_copy_end(struct Main *bmain_src, bool BKE_copybuffer_read(struct Main *bmain_dst, const char *libname, struct ReportList *reports, - const uint64_t id_types_mask); + uint64_t id_types_mask); /** * Paste data-blocks from the given .blend file 'buffer' (i.e. append them). * @@ -80,9 +80,9 @@ bool BKE_copybuffer_read(struct Main *bmain_dst, */ int BKE_copybuffer_paste(struct bContext *C, const char *libname, - const int flag, + int flag, struct ReportList *reports, - const uint64_t id_types_mask); + uint64_t id_types_mask); #ifdef __cplusplus } diff --git a/source/blender/blenkernel/BKE_blender_undo.h b/source/blender/blenkernel/BKE_blender_undo.h index 1febe75b6f2..d60d048ee5f 100644 --- a/source/blender/blenkernel/BKE_blender_undo.h +++ b/source/blender/blenkernel/BKE_blender_undo.h @@ -34,8 +34,8 @@ enum eUndoStepDir; struct MemFileUndoData *BKE_memfile_undo_encode(struct Main *bmain, struct MemFileUndoData *mfu_prev); bool BKE_memfile_undo_decode(struct MemFileUndoData *mfu, - const enum eUndoStepDir undo_direction, - const bool use_old_bmain_data, + enum eUndoStepDir undo_direction, + bool use_old_bmain_data, struct bContext *C); void BKE_memfile_undo_free(struct MemFileUndoData *mfu); diff --git a/source/blender/blenkernel/BKE_blendfile.h b/source/blender/blenkernel/BKE_blendfile.h index b3211b1dbbc..db86d4685b7 100644 --- a/source/blender/blenkernel/BKE_blendfile.h +++ b/source/blender/blenkernel/BKE_blendfile.h @@ -46,7 +46,7 @@ void BKE_blendfile_read_setup_ex(struct bContext *C, const struct BlendFileReadParams *params, struct BlendFileReadReport *reports, /* Extra args. */ - const bool startup_update_defaults, + bool startup_update_defaults, const char *startup_app_template); void BKE_blendfile_read_setup(struct bContext *C, @@ -127,8 +127,8 @@ void BKE_blendfile_write_partial_begin(struct Main *bmain_src); */ bool BKE_blendfile_write_partial(struct Main *bmain_src, const char *filepath, - const int write_flags, - const int remap_mode, + int write_flags, + int remap_mode, struct ReportList *reports); void BKE_blendfile_write_partial_end(struct Main *bmain_src); diff --git a/source/blender/blenkernel/BKE_blendfile_link_append.h b/source/blender/blenkernel/BKE_blendfile_link_append.h index aaa31352316..04521cc8939 100644 --- a/source/blender/blenkernel/BKE_blendfile_link_append.h +++ b/source/blender/blenkernel/BKE_blendfile_link_append.h @@ -54,8 +54,8 @@ void BKE_blendfile_link_append_context_free(struct BlendfileLinkAppendContext *l * \param do_set: Set the given \a flag if true, clear it otherwise. */ void BKE_blendfile_link_append_context_flag_set(struct BlendfileLinkAppendContext *lapp_context, - const int flag, - const bool do_set); + int flag, + bool do_set); /** * Store reference to a Blender's embedded memfile into the context. @@ -98,7 +98,7 @@ void BKE_blendfile_link_append_context_library_add(struct BlendfileLinkAppendCon struct BlendfileLinkAppendContextItem *BKE_blendfile_link_append_context_item_add( struct BlendfileLinkAppendContext *lapp_context, const char *idname, - const short idcode, + short idcode, void *userdata); #define BLENDFILE_LINK_APPEND_INVALID -1 @@ -119,8 +119,8 @@ struct BlendfileLinkAppendContextItem *BKE_blendfile_link_append_context_item_ad int BKE_blendfile_link_append_context_item_idtypes_from_library_add( struct BlendfileLinkAppendContext *lapp_context, struct ReportList *reports, - const uint64_t id_types_filter, - const int library_index); + uint64_t id_types_filter, + int library_index); /** * Enable search of the given \a item into the library stored at given index in the link/append @@ -129,7 +129,7 @@ int BKE_blendfile_link_append_context_item_idtypes_from_library_add( void BKE_blendfile_link_append_context_item_library_index_enable( struct BlendfileLinkAppendContext *lapp_context, struct BlendfileLinkAppendContextItem *item, - const int library_index); + int library_index); /** * Check if given link/append context is empty (has no items to process) or not. */ @@ -175,7 +175,7 @@ typedef bool (*BKE_BlendfileLinkAppendContexteItemFunction)( void BKE_blendfile_link_append_context_item_foreach( struct BlendfileLinkAppendContext *lapp_context, BKE_BlendfileLinkAppendContexteItemFunction callback_function, - const eBlendfileLinkAppendForeachItemFlag flag, + eBlendfileLinkAppendForeachItemFlag flag, void *userdata); /** @@ -215,7 +215,7 @@ void BKE_blendfile_link(struct BlendfileLinkAppendContext *lapp_context, void BKE_blendfile_library_relocate(struct BlendfileLinkAppendContext *lapp_context, struct ReportList *reports, struct Library *library, - const bool do_reload); + bool do_reload); #ifdef __cplusplus } diff --git a/source/blender/blenkernel/BKE_bpath.h b/source/blender/blenkernel/BKE_bpath.h index bc9e3f01e96..ccbd0d4cbe4 100644 --- a/source/blender/blenkernel/BKE_bpath.h +++ b/source/blender/blenkernel/BKE_bpath.h @@ -171,7 +171,7 @@ void BKE_bpath_missing_files_check(struct Main *bmain, struct ReportList *report void BKE_bpath_missing_files_find(struct Main *bmain, const char *searchpath, struct ReportList *reports, - const bool find_all); + bool find_all); /** Rebase all relative file paths in given \a bmain from \a basedir_src to \a basedir_dst. */ void BKE_bpath_relative_rebase(struct Main *bmain, @@ -193,16 +193,14 @@ void BKE_bpath_absolute_convert(struct Main *bmain, * * \return An opaque handle to pass to #BKE_bpath_list_restore and #BKE_bpath_list_free. */ -void *BKE_bpath_list_backup(struct Main *bmain, const eBPathForeachFlag flag); +void *BKE_bpath_list_backup(struct Main *bmain, eBPathForeachFlag flag); /** Restore the temp backup of paths from \a path_list_handle into all IDs in given \a bmain. * * \note This function assumes that the data in given Main did not change (no * addition/deletion/re-ordering of IDs, or their file paths) since the call to * #BKE_bpath_list_backup that generated the given \a path_list_handle. */ -void BKE_bpath_list_restore(struct Main *bmain, - const eBPathForeachFlag flag, - void *path_list_handle); +void BKE_bpath_list_restore(struct Main *bmain, eBPathForeachFlag flag, void *path_list_handle); /** Free the temp backup of paths in \a path_list_handle. * diff --git a/source/blender/blenkernel/BKE_brush.h b/source/blender/blenkernel/BKE_brush.h index bf672507c13..ee5ab905d70 100644 --- a/source/blender/blenkernel/BKE_brush.h +++ b/source/blender/blenkernel/BKE_brush.h @@ -50,7 +50,7 @@ void BKE_brush_system_exit(void); * \note Resulting brush will have two users: one as a fake user, * another is assumed to be used by the caller. */ -struct Brush *BKE_brush_add(struct Main *bmain, const char *name, const eObjectMode ob_mode); +struct Brush *BKE_brush_add(struct Main *bmain, const char *name, eObjectMode ob_mode); /** * Add a new gp-brush. */ @@ -66,35 +66,27 @@ bool BKE_brush_delete(struct Main *bmain, struct Brush *brush); * Add grease pencil settings. */ void BKE_brush_init_gpencil_settings(struct Brush *brush); -struct Brush *BKE_brush_first_search(struct Main *bmain, const eObjectMode ob_mode); +struct Brush *BKE_brush_first_search(struct Main *bmain, eObjectMode ob_mode); void BKE_brush_sculpt_reset(struct Brush *brush); /** * Create a set of grease pencil Drawing presets. */ -void BKE_brush_gpencil_paint_presets(struct Main *bmain, - struct ToolSettings *ts, - const bool reset); +void BKE_brush_gpencil_paint_presets(struct Main *bmain, struct ToolSettings *ts, bool reset); /** * Create a set of grease pencil Vertex Paint presets. */ -void BKE_brush_gpencil_vertex_presets(struct Main *bmain, - struct ToolSettings *ts, - const bool reset); +void BKE_brush_gpencil_vertex_presets(struct Main *bmain, struct ToolSettings *ts, bool reset); /** * Create a set of grease pencil Sculpt Paint presets. */ -void BKE_brush_gpencil_sculpt_presets(struct Main *bmain, - struct ToolSettings *ts, - const bool reset); +void BKE_brush_gpencil_sculpt_presets(struct Main *bmain, struct ToolSettings *ts, bool reset); /** * Create a set of grease pencil Weight Paint presets. */ -void BKE_brush_gpencil_weight_presets(struct Main *bmain, - struct ToolSettings *ts, - const bool reset); -void BKE_gpencil_brush_preset_set(struct Main *bmain, struct Brush *brush, const short type); +void BKE_brush_gpencil_weight_presets(struct Main *bmain, struct ToolSettings *ts, bool reset); +void BKE_gpencil_brush_preset_set(struct Main *bmain, struct Brush *brush, short type); void BKE_brush_jitter_pos(const struct Scene *scene, struct Brush *brush, @@ -130,12 +122,12 @@ float BKE_brush_sample_tex_3d(const struct Scene *scene, const struct Brush *br, const float point[3], float rgba[4], - const int thread, + int thread, struct ImagePool *pool); float BKE_brush_sample_masktex(const struct Scene *scene, struct Brush *br, const float point[2], - const int thread, + int thread, struct ImagePool *pool); /* Texture. */ diff --git a/source/blender/blenkernel/BKE_bvhutils.h b/source/blender/blenkernel/BKE_bvhutils.h index 45c3a8ec159..42c8a5dae5d 100644 --- a/source/blender/blenkernel/BKE_bvhutils.h +++ b/source/blender/blenkernel/BKE_bvhutils.h @@ -141,8 +141,8 @@ BVHTree *bvhtree_from_editmesh_verts_ex(BVHTreeFromEditMesh *data, */ BVHTree *bvhtree_from_mesh_verts_ex(struct BVHTreeFromMesh *data, const struct MVert *vert, - const int verts_num, - const bool vert_allocated, + int verts_num, + bool vert_allocated, const BLI_bitmap *verts_mask, int verts_num_active, float epsilon, @@ -179,10 +179,10 @@ BVHTree *bvhtree_from_editmesh_edges_ex(BVHTreeFromEditMesh *data, */ BVHTree *bvhtree_from_mesh_edges_ex(struct BVHTreeFromMesh *data, const struct MVert *vert, - const bool vert_allocated, + bool vert_allocated, const struct MEdge *edge, - const int edges_num, - const bool edge_allocated, + int edges_num, + bool edge_allocated, const BLI_bitmap *edges_mask, int edges_num_active, float epsilon, @@ -203,10 +203,10 @@ BVHTree *bvhtree_from_mesh_edges_ex(struct BVHTreeFromMesh *data, */ BVHTree *bvhtree_from_mesh_faces_ex(struct BVHTreeFromMesh *data, const struct MVert *vert, - const bool vert_allocated, + bool vert_allocated, const struct MFace *face, - const int numFaces, - const bool face_allocated, + int numFaces, + bool face_allocated, const BLI_bitmap *faces_mask, int faces_num_active, float epsilon, @@ -240,12 +240,12 @@ BVHTree *bvhtree_from_editmesh_looptri_ex(BVHTreeFromEditMesh *data, */ BVHTree *bvhtree_from_mesh_looptri_ex(struct BVHTreeFromMesh *data, const struct MVert *vert, - const bool vert_allocated, + bool vert_allocated, const struct MLoop *mloop, - const bool loop_allocated, + bool loop_allocated, const struct MLoopTri *looptri, - const int looptri_num, - const bool looptri_allocated, + int looptri_num, + bool looptri_allocated, const BLI_bitmap *mask, int looptri_num_active, float epsilon, @@ -264,14 +264,14 @@ BVHTree *bvhtree_from_mesh_looptri_ex(struct BVHTreeFromMesh *data, BVHTree *BKE_bvhtree_from_mesh_get(struct BVHTreeFromMesh *data, const struct Mesh *mesh, const BVHCacheType bvh_cache_type, - const int tree_type); + int tree_type); /** * Builds or queries a BVH-cache for the cache BVH-tree of the request type. */ BVHTree *BKE_bvhtree_from_editmesh_get(BVHTreeFromEditMesh *data, struct BMEditMesh *em, - const int tree_type, + int tree_type, const BVHCacheType bvh_cache_type, struct BVHCache **bvh_cache_p, ThreadMutex *mesh_eval_mutex); @@ -288,14 +288,11 @@ void free_bvhtree_from_mesh(struct BVHTreeFromMesh *data); /** * Math functions used by callbacks */ -float bvhtree_ray_tri_intersection(const BVHTreeRay *ray, - const float m_dist, - const float v0[3], - const float v1[3], - const float v2[3]); +float bvhtree_ray_tri_intersection( + const BVHTreeRay *ray, float m_dist, const float v0[3], const float v1[3], const float v2[3]); float bvhtree_sphereray_tri_intersection(const BVHTreeRay *ray, float radius, - const float m_dist, + float m_dist, const float v0[3], const float v1[3], const float v2[3]); @@ -310,7 +307,7 @@ typedef struct BVHTreeFromPointCloud { BVHTree *BKE_bvhtree_from_pointcloud_get(struct BVHTreeFromPointCloud *data, const struct PointCloud *pointcloud, - const int tree_type); + int tree_type); void free_bvhtree_from_pointcloud(struct BVHTreeFromPointCloud *data); diff --git a/source/blender/blenkernel/BKE_callbacks.h b/source/blender/blenkernel/BKE_callbacks.h index c125b081b49..2e4923ff3d2 100644 --- a/source/blender/blenkernel/BKE_callbacks.h +++ b/source/blender/blenkernel/BKE_callbacks.h @@ -114,14 +114,14 @@ typedef enum { typedef struct bCallbackFuncStore { struct bCallbackFuncStore *next, *prev; - void (*func)(struct Main *, struct PointerRNA **, const int num_pointers, void *arg); + void (*func)(struct Main *, struct PointerRNA **, int num_pointers, void *arg); void *arg; short alloc; } bCallbackFuncStore; void BKE_callback_exec(struct Main *bmain, struct PointerRNA **pointers, - const int num_pointers, + int num_pointers, eCbEvent evt); void BKE_callback_exec_null(struct Main *bmain, eCbEvent evt); void BKE_callback_exec_id(struct Main *bmain, struct ID *id, eCbEvent evt); diff --git a/source/blender/blenkernel/BKE_camera.h b/source/blender/blenkernel/BKE_camera.h index 45bfef82302..ee78621c11f 100644 --- a/source/blender/blenkernel/BKE_camera.h +++ b/source/blender/blenkernel/BKE_camera.h @@ -110,8 +110,8 @@ void BKE_camera_params_compute_matrix(CameraParams *params); void BKE_camera_view_frame_ex(const struct Scene *scene, const struct Camera *camera, - const float drawsize, - const bool do_clip, + float drawsize, + bool do_clip, const float scale[3], float r_asp[2], float r_shift[2], @@ -151,7 +151,7 @@ struct Object *BKE_camera_multiview_render(const struct Scene *scene, */ void BKE_camera_multiview_view_matrix(const struct RenderData *rd, const struct Object *camera, - const bool is_left, + bool is_left, float r_viewmat[4][4]); void BKE_camera_multiview_model_matrix(const struct RenderData *rd, const struct Object *camera, diff --git a/source/blender/blenkernel/BKE_collection.h b/source/blender/blenkernel/BKE_collection.h index 7dfda7b5121..402bffea91d 100644 --- a/source/blender/blenkernel/BKE_collection.h +++ b/source/blender/blenkernel/BKE_collection.h @@ -102,8 +102,8 @@ bool BKE_collection_delete(struct Main *bmain, struct Collection *collection, bo struct Collection *BKE_collection_duplicate(struct Main *bmain, struct Collection *parent, struct Collection *collection, - const uint duplicate_flags, - const uint duplicate_options); + uint duplicate_flags, + uint duplicate_options); /* Master Collection for Scene */ @@ -144,7 +144,7 @@ void BKE_collection_object_add_from(struct Main *bmain, bool BKE_collection_object_remove(struct Main *bmain, struct Collection *collection, struct Object *object, - const bool free_us); + bool free_us); /** * Move object from a collection into another * @@ -162,7 +162,7 @@ void BKE_collection_object_move(struct Main *bmain, bool BKE_scene_collections_object_remove(struct Main *bmain, struct Scene *scene, struct Object *object, - const bool free_us); + bool free_us); /** * Check all collections in \a bmain (including embedded ones in scenes) for CollectionObject with @@ -218,7 +218,7 @@ struct Base *BKE_collection_or_layer_objects(const struct ViewLayer *view_layer, * * The index is calculated from top to bottom counting the children before the siblings. */ -struct Collection *BKE_collection_from_index(struct Scene *scene, const int index); +struct Collection *BKE_collection_from_index(struct Scene *scene, int index); /** * The automatic/fallback name of a new collection. */ diff --git a/source/blender/blenkernel/BKE_collision.h b/source/blender/blenkernel/BKE_collision.h index 71929d1797c..d4c5c03ea79 100644 --- a/source/blender/blenkernel/BKE_collision.h +++ b/source/blender/blenkernel/BKE_collision.h @@ -122,9 +122,9 @@ void bvhtree_update_from_mvert(struct BVHTree *bvhtree, * \param step: is limited from 0 (frame start position) to 1 (frame end position). */ void collision_move_object(struct CollisionModifierData *collmd, - const float step, - const float prevstep, - const bool moving_bvh); + float step, + float prevstep, + bool moving_bvh); void collision_get_collider_velocity(float vel_old[3], float vel_new[3], diff --git a/source/blender/blenkernel/BKE_colorband.h b/source/blender/blenkernel/BKE_colorband.h index 0f46ced8b06..554b0f36b60 100644 --- a/source/blender/blenkernel/BKE_colorband.h +++ b/source/blender/blenkernel/BKE_colorband.h @@ -34,7 +34,7 @@ struct ColorBand; void BKE_colorband_init(struct ColorBand *coba, bool rangetype); void BKE_colorband_init_from_table_rgba(struct ColorBand *coba, const float (*array)[4], - const int array_len, + int array_len, bool filter_sample); struct ColorBand *BKE_colorband_add(bool rangetype); bool BKE_colorband_evaluate(const struct ColorBand *coba, float in, float out[4]); diff --git a/source/blender/blenkernel/BKE_colortools.h b/source/blender/blenkernel/BKE_colortools.h index 17fb48cdd27..5ded49106da 100644 --- a/source/blender/blenkernel/BKE_colortools.h +++ b/source/blender/blenkernel/BKE_colortools.h @@ -67,7 +67,7 @@ void BKE_curvemap_reset(struct CurveMap *cuma, const struct rctf *clipr, int pre /** * Removes with flag set. */ -void BKE_curvemap_remove(struct CurveMap *cuma, const short flag); +void BKE_curvemap_remove(struct CurveMap *cuma, short flag); /** * Remove specified point. */ @@ -81,7 +81,7 @@ void BKE_curvemap_handle_set(struct CurveMap *cuma, int type); /** * \note only does current curvemap!. */ -void BKE_curvemapping_changed(struct CurveMapping *cumap, const bool rem_doubles); +void BKE_curvemapping_changed(struct CurveMapping *cumap, bool rem_doubles); void BKE_curvemapping_changed_all(struct CurveMapping *cumap); /** diff --git a/source/blender/blenkernel/BKE_context.h b/source/blender/blenkernel/BKE_context.h index f50270ed4e7..18c1848b737 100644 --- a/source/blender/blenkernel/BKE_context.h +++ b/source/blender/blenkernel/BKE_context.h @@ -253,10 +253,7 @@ ListBase CTX_data_collection_get(const bContext *C, const char *member); * \param use_rna: Use Include the properties from 'RNA_Context'. * \param use_all: Don't skip values (currently only "scene"). */ -ListBase CTX_data_dir_get_ex(const bContext *C, - const bool use_store, - const bool use_rna, - const bool use_all); +ListBase CTX_data_dir_get_ex(const bContext *C, bool use_store, bool use_rna, bool use_all); ListBase CTX_data_dir_get(const bContext *C); int /*eContextResult*/ CTX_data_get( const bContext *C, const char *member, PointerRNA *r_ptr, ListBase *r_lb, short *r_type); @@ -320,7 +317,7 @@ struct ToolSettings *CTX_data_tool_settings(const bContext *C); const char *CTX_data_mode_string(const bContext *C); enum eContextObjectMode CTX_data_mode_enum_ex(const struct Object *obedit, const struct Object *ob, - const eObjectMode object_mode); + eObjectMode object_mode); enum eContextObjectMode CTX_data_mode_enum(const bContext *C); void CTX_data_main_set(bContext *C, struct Main *bmain); diff --git a/source/blender/blenkernel/BKE_crazyspace.h b/source/blender/blenkernel/BKE_crazyspace.h index f5266ed7a10..c00e397f552 100644 --- a/source/blender/blenkernel/BKE_crazyspace.h +++ b/source/blender/blenkernel/BKE_crazyspace.h @@ -43,7 +43,7 @@ void BKE_crazyspace_set_quats_editmesh(struct BMEditMesh *em, float (*origcos)[3], float (*mappedcos)[3], float (*quats)[4], - const bool use_select); + bool use_select); void BKE_crazyspace_set_quats_mesh(struct Mesh *me, float (*origcos)[3], float (*mappedcos)[3], diff --git a/source/blender/blenkernel/BKE_cryptomatte.h b/source/blender/blenkernel/BKE_cryptomatte.h index 329046ad494..64fbb00b143 100644 --- a/source/blender/blenkernel/BKE_cryptomatte.h +++ b/source/blender/blenkernel/BKE_cryptomatte.h @@ -59,7 +59,7 @@ float BKE_cryptomatte_hash_to_float(uint32_t cryptomatte_hash); * Find an ID in the given main that matches the given encoded float. */ bool BKE_cryptomatte_find_name(const struct CryptomatteSession *session, - const float encoded_hash, + float encoded_hash, char *r_name, int name_len); diff --git a/source/blender/blenkernel/BKE_cryptomatte.hh b/source/blender/blenkernel/BKE_cryptomatte.hh index 08536ecccbd..aa82166aa70 100644 --- a/source/blender/blenkernel/BKE_cryptomatte.hh +++ b/source/blender/blenkernel/BKE_cryptomatte.hh @@ -70,7 +70,7 @@ struct CryptomatteHash { uint32_t hash; CryptomatteHash(uint32_t hash); - CryptomatteHash(const char *name, const int name_len); + CryptomatteHash(const char *name, int name_len); static CryptomatteHash from_hex_encoded(blender::StringRef hex_encoded); std::string hex_encoded() const; diff --git a/source/blender/blenkernel/BKE_curve.h b/source/blender/blenkernel/BKE_curve.h index 713ee8cac01..25d49544330 100644 --- a/source/blender/blenkernel/BKE_curve.h +++ b/source/blender/blenkernel/BKE_curve.h @@ -90,7 +90,7 @@ typedef struct CVKeyIndex { * Frees edit-curve entirely. */ void BKE_curve_editfont_free(struct Curve *cu); -void BKE_curve_init(struct Curve *cu, const short curve_type); +void BKE_curve_init(struct Curve *cu, short curve_type); struct Curve *BKE_curve_add(struct Main *bmain, const char *name, int type); short BKE_curve_type_get(const struct Curve *cu); void BKE_curve_type_test(struct Object *ob); @@ -106,23 +106,17 @@ void BKE_curve_texspace_ensure(struct Curve *cu); bool BKE_curve_minmax(struct Curve *cu, bool use_radius, float min[3], float max[3]); bool BKE_curve_center_median(struct Curve *cu, float cent[3]); bool BKE_curve_center_bounds(struct Curve *cu, float cent[3]); -void BKE_curve_transform_ex(struct Curve *cu, - const float mat[4][4], - const bool do_keys, - const bool do_props, - const float unit_scale); -void BKE_curve_transform(struct Curve *cu, - const float mat[4][4], - const bool do_keys, - const bool do_props); -void BKE_curve_translate(struct Curve *cu, const float offset[3], const bool do_keys); +void BKE_curve_transform_ex( + struct Curve *cu, const float mat[4][4], bool do_keys, bool do_props, float unit_scale); +void BKE_curve_transform(struct Curve *cu, const float mat[4][4], bool do_keys, bool do_props); +void BKE_curve_translate(struct Curve *cu, const float offset[3], bool do_keys); void BKE_curve_material_index_remove(struct Curve *cu, int index); bool BKE_curve_material_index_used(const struct Curve *cu, int index); void BKE_curve_material_index_clear(struct Curve *cu); bool BKE_curve_material_index_validate(struct Curve *cu); void BKE_curve_material_remap(struct Curve *cu, const unsigned int *remap, unsigned int remap_len); -void BKE_curve_smooth_flag_set(struct Curve *cu, const bool use_smooth); +void BKE_curve_smooth_flag_set(struct Curve *cu, bool use_smooth); /** * \return edit-nurbs or normal nurbs list. @@ -155,11 +149,11 @@ void BKE_curve_nurbs_vert_coords_get(const struct ListBase *lb, void BKE_curve_nurbs_vert_coords_apply_with_mat4(struct ListBase *lb, const float (*vert_coords)[3], const float mat[4][4], - const bool constrain_2d); + bool constrain_2d); void BKE_curve_nurbs_vert_coords_apply(struct ListBase *lb, const float (*vert_coords)[3], - const bool constrain_2d); + bool constrain_2d); float (*BKE_curve_nurbs_key_vert_coords_alloc(const struct ListBase *lb, float *key, @@ -202,7 +196,7 @@ void BKE_curve_correct_bezpart(const float v1[2], float v2[2], float v3[2], cons /* ** Nurbs ** */ -bool BKE_nurbList_index_get_co(struct ListBase *editnurb, const int index, float r_co[3]); +bool BKE_nurbList_index_get_co(struct ListBase *editnurb, int index, float r_co[3]); int BKE_nurbList_verts_count(const struct ListBase *nurb); int BKE_nurbList_verts_count_without_handles(const struct ListBase *nurb); @@ -218,10 +212,8 @@ void BKE_nurbList_duplicate(struct ListBase *lb1, const struct ListBase *lb2); * - 5: Set align, like 3 but no toggle. * - 6: Clear align (setting #HD_FREE), like 3 but no toggle. */ -void BKE_nurbList_handles_set(struct ListBase *editnurb, const char code); -void BKE_nurbList_handles_recalculate(struct ListBase *editnurb, - const bool calc_length, - const uint8_t flag); +void BKE_nurbList_handles_set(struct ListBase *editnurb, char code); +void BKE_nurbList_handles_recalculate(struct ListBase *editnurb, bool calc_length, uint8_t flag); void BKE_nurbList_handles_autocalc(ListBase *editnurb, uint8_t flag); void BKE_nurbList_flag_set(ListBase *editnurb, uint8_t flag, bool set); @@ -266,10 +258,10 @@ void BKE_nurb_makeCurve(const struct Nurb *nu, /** * Calculate the length for arrays filled in by #BKE_curve_calc_coords_axis. */ -unsigned int BKE_curve_calc_coords_axis_len(const unsigned int bezt_array_len, - const unsigned int resolu, - const bool is_cyclic, - const bool use_cyclic_duplicate_endpoint); +unsigned int BKE_curve_calc_coords_axis_len(unsigned int bezt_array_len, + unsigned int resolu, + bool is_cyclic, + bool use_cyclic_duplicate_endpoint); /** * Calculate an array for the entire curve (cyclic or non-cyclic). * \note Call for each axis. @@ -277,13 +269,13 @@ unsigned int BKE_curve_calc_coords_axis_len(const unsigned int bezt_array_len, * \param use_cyclic_duplicate_endpoint: Duplicate values at the beginning & end of the array. */ void BKE_curve_calc_coords_axis(const struct BezTriple *bezt_array, - const unsigned int bezt_array_len, - const unsigned int resolu, - const bool is_cyclic, - const bool use_cyclic_duplicate_endpoint, + unsigned int bezt_array_len, + unsigned int resolu, + bool is_cyclic, + bool use_cyclic_duplicate_endpoint, /* array params */ - const unsigned int axis, - const unsigned int stride, + unsigned int axis, + unsigned int stride, float *r_points); void BKE_nurb_knot_calc_u(struct Nurb *nu); @@ -301,10 +293,7 @@ void BKE_nurb_direction_switch(struct Nurb *nu); /** * \note caller must ensure active vertex remains valid. */ -bool BKE_nurb_type_convert(struct Nurb *nu, - const short type, - const bool use_handles, - const char **r_err_msg); +bool BKE_nurb_type_convert(struct Nurb *nu, short type, bool use_handles, const char **r_err_msg); /** * Be sure to call #BKE_nurb_knot_calc_u / #BKE_nurb_knot_calc_v after this. @@ -333,8 +322,8 @@ void BKE_nurb_bpoint_calc_plane(struct Nurb *nu, struct BPoint *bp, float r_plan void BKE_nurb_handle_calc(struct BezTriple *bezt, struct BezTriple *prev, struct BezTriple *next, - const bool is_fcurve, - const char smoothing); + bool is_fcurve, + char smoothing); /** * Variant of #BKE_nurb_handle_calc() that allows calculating based on a different select flag. * @@ -345,9 +334,9 @@ void BKE_nurb_handle_calc(struct BezTriple *bezt, void BKE_nurb_handle_calc_ex(struct BezTriple *bezt, struct BezTriple *prev, struct BezTriple *next, - const eBezTriple_Flag__Alias handle_sel_flag, - const bool is_fcurve, - const char smoothing); + eBezTriple_Flag__Alias handle_sel_flag, + bool is_fcurve, + char smoothing); /** * Similar to #BKE_nurb_handle_calc but for curves and figures out the previous and next for us. */ @@ -371,10 +360,10 @@ void BKE_nurb_handles_autocalc(struct Nurb *nu, uint8_t flag); * handles if the key is selected. */ void BKE_nurb_bezt_handle_test(struct BezTriple *bezt, - const eBezTriple_Flag__Alias sel_flag, - const bool use_handle, - const bool use_around_local); -void BKE_nurb_handles_test(struct Nurb *nu, const bool use_handles, const bool use_around_local); + eBezTriple_Flag__Alias sel_flag, + bool use_handle, + bool use_around_local); +void BKE_nurb_handles_test(struct Nurb *nu, bool use_handles, bool use_around_local); /* **** Depsgraph evaluation **** */ @@ -398,18 +387,18 @@ extern void (*BKE_curve_batch_cache_free_cb)(struct Curve *cu); * \{ */ unsigned int BKE_curve_decimate_bezt_array(struct BezTriple *bezt_array, - const unsigned int bezt_array_len, - const unsigned int resolu, - const bool is_cyclic, - const char flag_test, - const char flag_set, - const float error_sq_max, - const unsigned int error_target_len); + unsigned int bezt_array_len, + unsigned int resolu, + bool is_cyclic, + char flag_test, + char flag_set, + float error_sq_max, + unsigned int error_target_len); void BKE_curve_decimate_nurb(struct Nurb *nu, - const unsigned int resolu, - const float error_sq_max, - const unsigned int error_target_len); + unsigned int resolu, + float error_sq_max, + unsigned int error_target_len); /** \} */ @@ -420,19 +409,19 @@ void BKE_curve_decimate_nurb(struct Nurb *nu, void BKE_curve_deform_coords(const struct Object *ob_curve, const struct Object *ob_target, float (*vert_coords)[3], - const int vert_coords_len, + int vert_coords_len, const struct MDeformVert *dvert, - const int defgrp_index, - const short flag, - const short defaxis); + int defgrp_index, + short flag, + short defaxis); void BKE_curve_deform_coords_with_editmesh(const struct Object *ob_curve, const struct Object *ob_target, float (*vert_coords)[3], - const int vert_coords_len, - const int defgrp_index, - const short flag, - const short defaxis, + int vert_coords_len, + int defgrp_index, + short flag, + short defaxis, struct BMEditMesh *em_target); /** @@ -445,7 +434,7 @@ void BKE_curve_deform_co(const struct Object *ob_curve, const struct Object *ob_target, const float orco[3], float vec[3], - const int no_rot_axis, + int no_rot_axis, float r_mat[3][3]); /** \} */ diff --git a/source/blender/blenkernel/BKE_curveprofile.h b/source/blender/blenkernel/BKE_curveprofile.h index ee8bf99a216..aa79f29760d 100644 --- a/source/blender/blenkernel/BKE_curveprofile.h +++ b/source/blender/blenkernel/BKE_curveprofile.h @@ -62,8 +62,8 @@ struct CurveProfile *BKE_curveprofile_copy(const struct CurveProfile *profile); * \return Whether the handle moved from its start position. */ bool BKE_curveprofile_move_handle(struct CurveProfilePoint *point, - const bool handle_1, - const bool snap, + bool handle_1, + bool snap, const float delta[2]); /** @@ -76,7 +76,7 @@ bool BKE_curveprofile_move_handle(struct CurveProfilePoint *point, */ bool BKE_curveprofile_move_point(struct CurveProfile *profile, struct CurveProfilePoint *point, - const bool snap, + bool snap, const float delta[2]); /** @@ -92,7 +92,7 @@ bool BKE_curveprofile_remove_point(struct CurveProfile *profile, struct CurvePro * * \note Requires #BKE_curveprofile_update call after. */ -void BKE_curveprofile_remove_by_flag(struct CurveProfile *profile, const short flag); +void BKE_curveprofile_remove_by_flag(struct CurveProfile *profile, short flag); /** * Adds a new point at the specified location. The choice for which points to place the new vertex @@ -151,7 +151,7 @@ enum { * \param update_flags: Bit-field with fields defined in header file. * Controls removing doubles and clipping. */ -void BKE_curveprofile_update(struct CurveProfile *profile, const int update_flags); +void BKE_curveprofile_update(struct CurveProfile *profile, int update_flags); /** * Does a single evaluation along the profile's path. diff --git a/source/blender/blenkernel/BKE_customdata.h b/source/blender/blenkernel/BKE_customdata.h index 68d29235469..b5b6296a0fa 100644 --- a/source/blender/blenkernel/BKE_customdata.h +++ b/source/blender/blenkernel/BKE_customdata.h @@ -84,7 +84,7 @@ void customData_mask_layers__print(const struct CustomData_MeshMasks *mask); typedef void (*cd_interp)( const void **sources, const float *weights, const float *sub_weights, int count, void *dest); typedef void (*cd_copy)(const void *source, void *dest, int count); -typedef bool (*cd_validate)(void *item, const uint totitems, const bool do_fixes); +typedef bool (*cd_validate)(void *item, uint totitems, bool do_fixes); /** * Update mask_dst with layers defined in mask_src (equivalent to a bit-wise OR). @@ -131,7 +131,7 @@ void CustomData_data_copy_value(int type, const void *source, void *dest); * 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); + int type, const void *source, void *dest, int mixmode, float mixfactor); /** * Compares if data1 is equal to data2. type is a valid CustomData type @@ -187,7 +187,7 @@ bool CustomData_bmesh_merge(const struct CustomData *source, CustomDataMask mask, eCDAllocType alloctype, struct BMesh *bm, - const char htype); + char htype); /** * NULL's all members and resets the #CustomData.typemap. @@ -268,22 +268,17 @@ int CustomData_number_of_layers_typemask(const struct CustomData *data, CustomDa * Duplicate data of a layer with flag NOFREE, and remove that flag. * \return the layer data. */ -void *CustomData_duplicate_referenced_layer(struct CustomData *data, - const int type, - const int totelem); +void *CustomData_duplicate_referenced_layer(struct CustomData *data, int type, int totelem); void *CustomData_duplicate_referenced_layer_n(struct CustomData *data, - const int type, - const int n, - const int totelem); + int type, + int n, + int totelem); void *CustomData_duplicate_referenced_layer_named(struct CustomData *data, - const int type, + int type, const char *name, - const int totelem); + int totelem); void *CustomData_duplicate_referenced_layer_anonymous( - CustomData *data, - const int type, - const struct AnonymousAttributeID *anonymous_id, - const int totelem); + CustomData *data, int type, const struct AnonymousAttributeID *anonymous_id, int totelem); bool CustomData_is_referenced_layer(struct CustomData *data, int type); /** @@ -394,7 +389,7 @@ void CustomData_swap_corners(struct CustomData *data, int index, const int *corn /** * Swap two items of given custom data, in all available layers. */ -void CustomData_swap(struct CustomData *data, const int index_a, const int index_b); +void CustomData_swap(struct CustomData *data, int index_a, int index_b); /** * Gets a pointer to the data element at index from the first layer of type. @@ -544,7 +539,7 @@ bool CustomData_layertype_is_dynamic(int type); /** * \return Maximum number of layers of given \a type, -1 means 'no limit'. */ -int CustomData_layertype_layers_max(const int type); +int CustomData_layertype_layers_max(int type); /** * Make sure the name of layer at index is unique. @@ -577,7 +572,7 @@ void CustomData_bmesh_update_active_layers(struct CustomData *fdata, struct Cust */ void CustomData_bmesh_do_versions_update_active_layers(struct CustomData *fdata, struct CustomData *ldata); -void CustomData_bmesh_init_pool(struct CustomData *data, int totelem, const char htype); +void CustomData_bmesh_init_pool(struct CustomData *data, int totelem, char htype); #ifndef NDEBUG /** @@ -595,9 +590,7 @@ bool CustomData_from_bmeshpoly_test(CustomData *fdata, CustomData *ldata, bool f * * \return True if some errors were found. */ -bool CustomData_layer_validate(struct CustomDataLayer *layer, - const uint totitems, - const bool do_fixes); +bool CustomData_layer_validate(struct CustomDataLayer *layer, uint totitems, bool do_fixes); void CustomData_layers__print(struct CustomData *data); /* External file storage */ @@ -627,8 +620,8 @@ typedef void (*cd_datatransfer_interp)(const struct CustomDataTransferLayerMap * void *dest, const void **sources, const float *weights, - const int count, - const float mix_factor); + int count, + float mix_factor); /** * Fake CD_LAYERS (those are actually 'real' data stored directly into elements' structs, diff --git a/source/blender/blenkernel/BKE_data_transfer.h b/source/blender/blenkernel/BKE_data_transfer.h index a4218ec564b..42cf2256e8c 100644 --- a/source/blender/blenkernel/BKE_data_transfer.h +++ b/source/blender/blenkernel/BKE_data_transfer.h @@ -63,19 +63,19 @@ enum { DT_TYPE_POLY_ALL = DT_TYPE_UV | DT_TYPE_SHARP_FACE | DT_TYPE_FREESTYLE_FACE, }; -void BKE_object_data_transfer_dttypes_to_cdmask(const int dtdata_types, +void BKE_object_data_transfer_dttypes_to_cdmask(int dtdata_types, struct CustomData_MeshMasks *r_data_masks); /** * Check what can do each layer type * (if it is actually handled by transfer-data, if it supports advanced mixing. */ -bool BKE_object_data_transfer_get_dttypes_capacity(const int dtdata_types, +bool BKE_object_data_transfer_get_dttypes_capacity(int dtdata_types, bool *r_advanced_mixing, bool *r_threshold); -int BKE_object_data_transfer_get_dttypes_item_types(const int dtdata_types); +int BKE_object_data_transfer_get_dttypes_item_types(int dtdata_types); -int BKE_object_data_transfer_dttype_to_cdtype(const int dtdata_type); -int BKE_object_data_transfer_dttype_to_srcdst_index(const int dtdata_type); +int BKE_object_data_transfer_dttype_to_cdtype(int dtdata_type); +int BKE_object_data_transfer_dttype_to_srcdst_index(int dtdata_type); #define DT_DATATYPE_IS_VERT(_dt) \ ELEM(_dt, DT_TYPE_MDEFORMVERT, DT_TYPE_SHAPEKEY, DT_TYPE_SKIN, DT_TYPE_BWEIGHT_VERT) @@ -136,8 +136,8 @@ void BKE_object_data_transfer_layout(struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob_src, struct Object *ob_dst, - const int data_types, - const bool use_delete, + int data_types, + bool use_delete, const int fromlayers_select[DT_MULTILAYER_INDEX_MAX], const int tolayers_select[DT_MULTILAYER_INDEX_MAX]); @@ -145,46 +145,46 @@ bool BKE_object_data_transfer_mesh(struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob_src, struct Object *ob_dst, - const int data_types, - const bool use_create, - const int map_vert_mode, - const int map_edge_mode, - const int map_loop_mode, - const int map_poly_mode, + int data_types, + bool use_create, + int map_vert_mode, + int map_edge_mode, + int map_loop_mode, + int map_poly_mode, struct SpaceTransform *space_transform, - const bool auto_transform, - const float max_distance, - const float ray_radius, - const float islands_handling_precision, + bool auto_transform, + float max_distance, + float ray_radius, + float islands_handling_precision, const int fromlayers_select[DT_MULTILAYER_INDEX_MAX], const int tolayers_select[DT_MULTILAYER_INDEX_MAX], - const int mix_mode, - const float mix_factor, + int mix_mode, + float mix_factor, const char *vgroup_name, - const bool invert_vgroup, + bool invert_vgroup, struct ReportList *reports); bool BKE_object_data_transfer_ex(struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob_src, struct Object *ob_dst, struct Mesh *me_dst, - const int data_types, + int data_types, bool use_create, - const int map_vert_mode, - const int map_edge_mode, - const int map_loop_mode, - const int map_poly_mode, + int map_vert_mode, + int map_edge_mode, + int map_loop_mode, + int map_poly_mode, struct SpaceTransform *space_transform, - const bool auto_transform, - const float max_distance, - const float ray_radius, - const float islands_handling_precision, + bool auto_transform, + float max_distance, + float ray_radius, + float islands_handling_precision, const int fromlayers_select[DT_MULTILAYER_INDEX_MAX], const int tolayers_select[DT_MULTILAYER_INDEX_MAX], - const int mix_mode, - const float mix_factor, + int mix_mode, + float mix_factor, const char *vgroup_name, - const bool invert_vgroup, + bool invert_vgroup, struct ReportList *reports); #ifdef __cplusplus diff --git a/source/blender/blenkernel/BKE_deform.h b/source/blender/blenkernel/BKE_deform.h index 9870d43b5c2..ca0ca03f099 100644 --- a/source/blender/blenkernel/BKE_deform.h +++ b/source/blender/blenkernel/BKE_deform.h @@ -51,7 +51,7 @@ int BKE_object_defgroup_active_index_get(const struct Object *ob); /** * \note For historical reasons, the index starts at 1 rather than 0. */ -void BKE_object_defgroup_active_index_set(struct Object *ob, const int new_index); +void BKE_object_defgroup_active_index_set(struct Object *ob, int new_index); const struct ListBase *BKE_id_defgroup_list_get(const struct ID *id); struct ListBase *BKE_id_defgroup_list_get_mutable(struct ID *id); @@ -68,33 +68,31 @@ struct bDeformGroup *BKE_object_defgroup_find_name(const struct Object *ob, cons /** * \note caller must free. */ -int *BKE_object_defgroup_flip_map(const struct Object *ob, - int *flip_map_len, - const bool use_default); +int *BKE_object_defgroup_flip_map(const struct Object *ob, int *flip_map_len, bool use_default); /** * \note caller must free. */ int *BKE_object_defgroup_flip_map_single(const struct Object *ob, int *flip_map_len, - const bool use_default, + bool use_default, int defgroup); -int BKE_object_defgroup_flip_index(const struct Object *ob, int index, const bool use_default); +int BKE_object_defgroup_flip_index(const struct Object *ob, int index, bool use_default); int BKE_object_defgroup_name_index(const struct Object *ob, const char *name); void BKE_object_defgroup_unique_name(struct bDeformGroup *dg, struct Object *ob); -struct MDeformWeight *BKE_defvert_find_index(const struct MDeformVert *dv, const int defgroup); +struct MDeformWeight *BKE_defvert_find_index(const struct MDeformVert *dv, int defgroup); /** * Ensures that `dv` has a deform weight entry for the specified defweight group. * * \note this function is mirrored in editmesh_tools.c, for use for edit-vertices. */ -struct MDeformWeight *BKE_defvert_ensure_index(struct MDeformVert *dv, const int defgroup); +struct MDeformWeight *BKE_defvert_ensure_index(struct MDeformVert *dv, int defgroup); /** * Adds the given vertex to the specified vertex group, with given weight. * * \warning this does NOT check for existing, assume caller already knows its not there. */ -void BKE_defvert_add_index_notest(struct MDeformVert *dv, int defgroup, const float weight); +void BKE_defvert_add_index_notest(struct MDeformVert *dv, int defgroup, float weight); /** * Removes the given vertex from the vertex group. * @@ -110,13 +108,13 @@ int BKE_defvert_find_shared(const struct MDeformVert *dvert_a, const struct MDef /** * \return true if has no weights. */ -bool BKE_defvert_is_weight_zero(const struct MDeformVert *dvert, const int defgroup_tot); +bool BKE_defvert_is_weight_zero(const struct MDeformVert *dvert, int defgroup_tot); void BKE_defvert_array_free_elems(struct MDeformVert *dvert, int totvert); void BKE_defvert_array_free(struct MDeformVert *dvert, int totvert); void BKE_defvert_array_copy(struct MDeformVert *dst, const struct MDeformVert *src, int totvert); -float BKE_defvert_find_weight(const struct MDeformVert *dvert, const int defgroup); +float BKE_defvert_find_weight(const struct MDeformVert *dvert, int defgroup); /** * Take care with this the rationale is: * - if the object has no vertex group. act like vertex group isn't set and return 1.0. @@ -124,9 +122,7 @@ float BKE_defvert_find_weight(const struct MDeformVert *dvert, const int defgrou * * This is a bit confusing, just saves some checks from the caller. */ -float BKE_defvert_array_find_weight_safe(const struct MDeformVert *dvert, - const int index, - const int defgroup); +float BKE_defvert_array_find_weight_safe(const struct MDeformVert *dvert, int index, int defgroup); /** * \return The total weight in all groups marked in the selection mask. @@ -180,7 +176,7 @@ void BKE_defvert_copy(struct MDeformVert *dvert_dst, const struct MDeformVert *d void BKE_defvert_copy_subset(struct MDeformVert *dvert_dst, const struct MDeformVert *dvert_src, const bool *vgroup_subset, - const int vgroup_tot); + int vgroup_tot); /** * Overwrite weights filtered by vgroup_subset and with mirroring specified by the flip map * - do nothing if neither are set. @@ -189,101 +185,96 @@ void BKE_defvert_copy_subset(struct MDeformVert *dvert_dst, void BKE_defvert_mirror_subset(struct MDeformVert *dvert_dst, const struct MDeformVert *dvert_src, const bool *vgroup_subset, - const int vgroup_tot, + int vgroup_tot, const int *flip_map, - const int flip_map_len); + int flip_map_len); /** * Copy an index from one #MDeformVert to another. * - do nothing if neither are set. * - add destination weight if needed. */ void BKE_defvert_copy_index(struct MDeformVert *dvert_dst, - const int defgroup_dst, + int defgroup_dst, const struct MDeformVert *dvert_src, - const int defgroup_src); + int defgroup_src); /** * Only sync over matching weights, don't add or remove groups * warning, loop within loop. */ void BKE_defvert_sync(struct MDeformVert *dvert_dst, const struct MDeformVert *dvert_src, - const bool use_ensure); + bool use_ensure); /** * be sure all flip_map values are valid */ void BKE_defvert_sync_mapped(struct MDeformVert *dvert_dst, const struct MDeformVert *dvert_src, const int *flip_map, - const int flip_map_len, - const bool use_ensure); + int flip_map_len, + bool use_ensure); /** * be sure all flip_map values are valid */ -void BKE_defvert_remap(struct MDeformVert *dvert, const int *map, const int map_len); -void BKE_defvert_flip(struct MDeformVert *dvert, const int *flip_map, const int flip_map_len); -void BKE_defvert_flip_merged(struct MDeformVert *dvert, - const int *flip_map, - const int flip_map_len); +void BKE_defvert_remap(struct MDeformVert *dvert, const int *map, int map_len); +void BKE_defvert_flip(struct MDeformVert *dvert, const int *flip_map, int flip_map_len); +void BKE_defvert_flip_merged(struct MDeformVert *dvert, const int *flip_map, int flip_map_len); void BKE_defvert_normalize(struct MDeformVert *dvert); /** * Same as #BKE_defvert_normalize but takes a bool array. */ void BKE_defvert_normalize_subset(struct MDeformVert *dvert, const bool *vgroup_subset, - const int vgroup_tot); + int vgroup_tot); /** * Same as BKE_defvert_normalize() if the locked vgroup is not a member of the subset */ void BKE_defvert_normalize_lock_single(struct MDeformVert *dvert, const bool *vgroup_subset, - const int vgroup_tot, - const uint def_nr_lock); + int vgroup_tot, + uint def_nr_lock); /** * Same as BKE_defvert_normalize() if no locked vgroup is a member of the subset */ void BKE_defvert_normalize_lock_map(struct MDeformVert *dvert, const bool *vgroup_subset, - const int vgroup_tot, + int vgroup_tot, const bool *lock_flags, - const int defbase_tot); + int defbase_tot); /* Utilities to 'extract' a given vgroup into a simple float array, * for verts, but also edges/polys/loops. */ -void BKE_defvert_extract_vgroup_to_vertweights(struct MDeformVert *dvert, - const int defgroup, - const int num_verts, - float *r_weights, - const bool invert_vgroup); +void BKE_defvert_extract_vgroup_to_vertweights( + struct MDeformVert *dvert, int defgroup, int num_verts, float *r_weights, bool invert_vgroup); /** * The following three make basic interpolation, * using temp vert_weights array to avoid looking up same weight several times. */ void BKE_defvert_extract_vgroup_to_edgeweights(struct MDeformVert *dvert, - const int defgroup, - const int num_verts, + int defgroup, + int num_verts, struct MEdge *edges, - const int num_edges, + int num_edges, float *r_weights, - const bool invert_vgroup); + bool invert_vgroup); void BKE_defvert_extract_vgroup_to_loopweights(struct MDeformVert *dvert, - const int defgroup, - const int num_verts, + int defgroup, + int num_verts, struct MLoop *loops, - const int num_loops, + int num_loops, float *r_weights, - const bool invert_vgroup); + bool invert_vgroup); void BKE_defvert_extract_vgroup_to_polyweights(struct MDeformVert *dvert, - const int defgroup, - const int num_verts, + int defgroup, + int num_verts, struct MLoop *loops, - const int num_loops, + int num_loops, struct MPoly *polys, - const int num_polys, + int num_polys, float *r_weights, - const bool invert_vgroup); + bool invert_vgroup); -void BKE_defvert_weight_to_rgb(float r_rgb[3], const float weight); +void BKE_defvert_weight_to_rgb(float r_rgb[3], float weight); void BKE_defvert_blend_write(struct BlendWriter *writer, int count, struct MDeformVert *dvlist); void BKE_defvert_blend_read(struct BlendDataReader *reader, diff --git a/source/blender/blenkernel/BKE_displist.h b/source/blender/blenkernel/BKE_displist.h index db1217465d7..6467ad36989 100644 --- a/source/blender/blenkernel/BKE_displist.h +++ b/source/blender/blenkernel/BKE_displist.h @@ -86,7 +86,7 @@ void BKE_displist_free(struct ListBase *lb); void BKE_displist_make_curveTypes(struct Depsgraph *depsgraph, const struct Scene *scene, struct Object *ob, - const bool for_render); + bool for_render); void BKE_displist_make_mball(struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob); void BKE_curve_calc_modifiers_pre(struct Depsgraph *depsgraph, @@ -94,7 +94,7 @@ void BKE_curve_calc_modifiers_pre(struct Depsgraph *depsgraph, struct Object *ob, struct ListBase *source_nurb, struct ListBase *target_nurb, - const bool for_render); + bool for_render); bool BKE_displist_surfindex_get( const struct DispList *dl, int a, int *b, int *p1, int *p2, int *p3, int *p4); @@ -107,7 +107,7 @@ bool BKE_displist_surfindex_get( void BKE_displist_fill(const struct ListBase *dispbase, struct ListBase *to, const float normal_proj[3], - const bool flip_normal); + bool flip_normal); float BKE_displist_calc_taper(struct Depsgraph *depsgraph, const struct Scene *scene, diff --git a/source/blender/blenkernel/BKE_editmesh_bvh.h b/source/blender/blenkernel/BKE_editmesh_bvh.h index fc274b4ffd1..b4368ff363b 100644 --- a/source/blender/blenkernel/BKE_editmesh_bvh.h +++ b/source/blender/blenkernel/BKE_editmesh_bvh.h @@ -42,13 +42,13 @@ typedef bool (*BMBVHTree_FaceFilter)(struct BMFace *f, void *userdata); BMBVHTree *BKE_bmbvh_new_from_editmesh(struct BMEditMesh *em, int flag, const float (*cos_cage)[3], - const bool cos_cage_free); + bool cos_cage_free); BMBVHTree *BKE_bmbvh_new_ex(struct BMesh *bm, struct BMLoop *(*looptris)[3], int looptris_tot, int flag, const float (*cos_cage)[3], - const bool cos_cage_free, + bool cos_cage_free, bool (*test_fn)(struct BMFace *, void *user_data), void *user_data); BMBVHTree *BKE_bmbvh_new(struct BMesh *bm, @@ -56,14 +56,14 @@ BMBVHTree *BKE_bmbvh_new(struct BMesh *bm, int looptris_tot, int flag, const float (*cos_cage)[3], - const bool cos_cage_free); + bool cos_cage_free); void BKE_bmbvh_free(BMBVHTree *tree); struct BVHTree *BKE_bmbvh_tree_get(BMBVHTree *tree); struct BMFace *BKE_bmbvh_ray_cast(BMBVHTree *tree, const float co[3], const float dir[3], - const float radius, + float radius, float *r_dist, float r_hitout[3], float r_cagehit[3]); @@ -71,7 +71,7 @@ struct BMFace *BKE_bmbvh_ray_cast(BMBVHTree *tree, struct BMFace *BKE_bmbvh_ray_cast_filter(BMBVHTree *tree, const float co[3], const float dir[3], - const float radius, + float radius, float *r_dist, float r_hitout[3], float r_cagehit[3], @@ -81,12 +81,8 @@ struct BMFace *BKE_bmbvh_ray_cast_filter(BMBVHTree *tree, /** * Find a vert closest to co in a sphere of radius dist_max. */ -struct BMVert *BKE_bmbvh_find_vert_closest(BMBVHTree *tree, - const float co[3], - const float dist_max); -struct BMFace *BKE_bmbvh_find_face_closest(BMBVHTree *tree, - const float co[3], - const float dist_max); +struct BMVert *BKE_bmbvh_find_vert_closest(BMBVHTree *tree, const float co[3], float dist_max); +struct BMFace *BKE_bmbvh_find_face_closest(BMBVHTree *tree, const float co[3], float dist_max); /** * Overlap indices reference the looptri's. diff --git a/source/blender/blenkernel/BKE_editmesh_tangent.h b/source/blender/blenkernel/BKE_editmesh_tangent.h index b76db11348e..3b0569b869a 100644 --- a/source/blender/blenkernel/BKE_editmesh_tangent.h +++ b/source/blender/blenkernel/BKE_editmesh_tangent.h @@ -39,7 +39,7 @@ void BKE_editmesh_loop_tangent_calc(BMEditMesh *em, const float (*loop_normals)[3], const float (*vert_orco)[3], CustomData *dm_loopdata_out, - const uint dm_loopdata_out_len, + uint dm_loopdata_out_len, short *tangent_mask_curr_p); #ifdef __cplusplus diff --git a/source/blender/blenkernel/BKE_fluid.h b/source/blender/blenkernel/BKE_fluid.h index 7bafcf00ce8..88df8e52dca 100644 --- a/source/blender/blenkernel/BKE_fluid.h +++ b/source/blender/blenkernel/BKE_fluid.h @@ -49,7 +49,7 @@ void BKE_fluid_modifier_reset(struct FluidModifierData *fmd); void BKE_fluid_modifier_create_type_data(struct FluidModifierData *fmd); void BKE_fluid_modifier_copy(const struct FluidModifierData *fmd, struct FluidModifierData *tfmd, - const int flag); + int flag); bool BKE_fluid_reallocate_fluid(struct FluidDomainSettings *fds, int res[3], int free_old); void BKE_fluid_reallocate_copy_fluid(struct FluidDomainSettings *fds, @@ -76,8 +76,8 @@ void BKE_fluid_particle_system_create(struct Main *bmain, const char *pset_name, const char *parts_name, const char *psys_name, - const int psys_type); -void BKE_fluid_particle_system_destroy(struct Object *ob, const int particle_type); + int psys_type); +void BKE_fluid_particle_system_destroy(struct Object *ob, int particle_type); void BKE_fluid_cache_startframe_set(struct FluidDomainSettings *settings, int value); void BKE_fluid_cache_endframe_set(struct FluidDomainSettings *settings, int value); diff --git a/source/blender/blenkernel/BKE_freestyle.h b/source/blender/blenkernel/BKE_freestyle.h index ee3517f5b43..3a4301aad6d 100644 --- a/source/blender/blenkernel/BKE_freestyle.h +++ b/source/blender/blenkernel/BKE_freestyle.h @@ -38,10 +38,10 @@ typedef struct FreestyleSettings FreestyleSettings; /* FreestyleConfig */ void BKE_freestyle_config_init(struct FreestyleConfig *config); -void BKE_freestyle_config_free(struct FreestyleConfig *config, const bool do_id_user); +void BKE_freestyle_config_free(struct FreestyleConfig *config, bool do_id_user); void BKE_freestyle_config_copy(struct FreestyleConfig *new_config, const struct FreestyleConfig *config, - const int flag); + int flag); /* FreestyleConfig.modules */ struct FreestyleModuleConfig *BKE_freestyle_module_add(struct FreestyleConfig *config); diff --git a/source/blender/blenkernel/BKE_geometry_set.hh b/source/blender/blenkernel/BKE_geometry_set.hh index 88e45baad15..a429aecd828 100644 --- a/source/blender/blenkernel/BKE_geometry_set.hh +++ b/source/blender/blenkernel/BKE_geometry_set.hh @@ -109,11 +109,11 @@ class GeometryComponent { * \note Conceptually this function is static, the result is always the same for different * instances of the same geometry component type. */ - bool attribute_domain_supported(const AttributeDomain domain) const; + bool attribute_domain_supported(AttributeDomain domain) const; /** * Return the length of a specific domain, or 0 if the domain is not supported. */ - virtual int attribute_domain_size(const AttributeDomain domain) const; + virtual int attribute_domain_size(AttributeDomain domain) const; /** * Return true if the attribute name corresponds to a built-in attribute with a hardcoded domain @@ -165,7 +165,7 @@ class GeometryComponent { /** Returns true when the attribute has been created. */ bool attribute_try_create(const blender::bke::AttributeIDRef &attribute_id, - const AttributeDomain domain, + AttributeDomain domain, const CustomDataType data_type, const AttributeInit &initializer); @@ -191,7 +191,7 @@ class GeometryComponent { * interpolated or converted. */ blender::fn::GVArray attribute_try_get_for_read(const blender::bke::AttributeIDRef &attribute_id, - const AttributeDomain domain, + AttributeDomain domain, const CustomDataType data_type) const; /** @@ -200,7 +200,7 @@ class GeometryComponent { * interpolated. */ blender::fn::GVArray attribute_try_get_for_read(const blender::bke::AttributeIDRef &attribute_id, - const AttributeDomain domain) const; + AttributeDomain domain) const; /** * Get a virtual array that refers to the data of an attribute converted to the given data type. @@ -216,7 +216,7 @@ class GeometryComponent { * contain a default value. This never returns null. */ blender::fn::GVArray attribute_get_for_read(const blender::bke::AttributeIDRef &attribute_id, - const AttributeDomain domain, + AttributeDomain domain, const CustomDataType data_type, const void *default_value = nullptr) const; /* Use instead of the method above when the type is known at compile time for type safety. */ @@ -243,7 +243,7 @@ class GeometryComponent { */ blender::bke::OutputAttribute attribute_try_get_for_output( const blender::bke::AttributeIDRef &attribute_id, - const AttributeDomain domain, + AttributeDomain domain, const CustomDataType data_type, const void *default_value = nullptr); /* Use instead of the method above when the type is known at compile time for type safety. */ @@ -266,7 +266,7 @@ class GeometryComponent { */ blender::bke::OutputAttribute attribute_try_get_for_output_only( const blender::bke::AttributeIDRef &attribute_id, - const AttributeDomain domain, + AttributeDomain domain, const CustomDataType data_type); /* Use instead of the method above when the type is known at compile time for type safety. */ template<typename T> @@ -281,10 +281,9 @@ class GeometryComponent { private: virtual const blender::bke::ComponentAttributeProviders *get_attribute_providers() const; - virtual blender::fn::GVArray attribute_try_adapt_domain_impl( - const blender::fn::GVArray &varray, - const AttributeDomain from_domain, - const AttributeDomain to_domain) const; + virtual blender::fn::GVArray attribute_try_adapt_domain_impl(const blender::fn::GVArray &varray, + AttributeDomain from_domain, + AttributeDomain to_domain) const; }; template<typename T> @@ -570,7 +569,7 @@ class MeshComponent : public GeometryComponent { */ Mesh *get_for_write(); - int attribute_domain_size(const AttributeDomain domain) const final; + int attribute_domain_size(AttributeDomain domain) const final; bool is_empty() const final; @@ -582,10 +581,9 @@ class MeshComponent : public GeometryComponent { private: const blender::bke::ComponentAttributeProviders *get_attribute_providers() const final; - blender::fn::GVArray attribute_try_adapt_domain_impl( - const blender::fn::GVArray &varray, - const AttributeDomain from_domain, - const AttributeDomain to_domain) const final; + blender::fn::GVArray attribute_try_adapt_domain_impl(const blender::fn::GVArray &varray, + AttributeDomain from_domain, + AttributeDomain to_domain) const final; }; /** @@ -634,7 +632,7 @@ class PointCloudComponent : public GeometryComponent { */ PointCloud *get_for_write(); - int attribute_domain_size(const AttributeDomain domain) const final; + int attribute_domain_size(AttributeDomain domain) const final; bool is_empty() const final; @@ -684,7 +682,7 @@ class CurveComponent : public GeometryComponent { const CurveEval *get_for_read() const; CurveEval *get_for_write(); - int attribute_domain_size(const AttributeDomain domain) const final; + int attribute_domain_size(AttributeDomain domain) const final; bool is_empty() const final; @@ -702,10 +700,9 @@ class CurveComponent : public GeometryComponent { private: const blender::bke::ComponentAttributeProviders *get_attribute_providers() const final; - blender::fn::GVArray attribute_try_adapt_domain_impl( - const blender::fn::GVArray &varray, - const AttributeDomain from_domain, - const AttributeDomain to_domain) const final; + blender::fn::GVArray attribute_try_adapt_domain_impl(const blender::fn::GVArray &varray, + AttributeDomain from_domain, + AttributeDomain to_domain) const final; }; /** @@ -912,7 +909,7 @@ class InstancesComponent : public GeometryComponent { * changed. This is a function on the component rather than each reference to ensure `const` * correctness for that reason. */ - GeometrySet &geometry_set_from_reference(const int reference_index); + GeometrySet &geometry_set_from_reference(int reference_index); blender::Span<int> instance_reference_handles() const; blender::MutableSpan<int> instance_reference_handles(); @@ -933,7 +930,7 @@ class InstancesComponent : public GeometryComponent { blender::bke::CustomDataAttributes &attributes(); const blender::bke::CustomDataAttributes &attributes() const; - int attribute_domain_size(const AttributeDomain domain) const final; + int attribute_domain_size(AttributeDomain domain) const final; void foreach_referenced_geometry( blender::FunctionRef<void(const GeometrySet &geometry_set)> callback) const; @@ -1027,7 +1024,7 @@ class GeometryFieldInput : public fn::FieldInput { ResourceScope &scope) const override; virtual GVArray get_varray_for_context(const GeometryComponent &component, - const AttributeDomain domain, + AttributeDomain domain, IndexMask mask) const = 0; }; @@ -1055,7 +1052,7 @@ class AttributeFieldInput : public GeometryFieldInput { } GVArray get_varray_for_context(const GeometryComponent &component, - const AttributeDomain domain, + AttributeDomain domain, IndexMask mask) const override; std::string socket_inspection_name() const override; @@ -1072,7 +1069,7 @@ class IDAttributeFieldInput : public GeometryFieldInput { } GVArray get_varray_for_context(const GeometryComponent &component, - const AttributeDomain domain, + AttributeDomain domain, IndexMask mask) const override; std::string socket_inspection_name() const override; @@ -1111,7 +1108,7 @@ class AnonymousAttributeFieldInput : public GeometryFieldInput { } GVArray get_varray_for_context(const GeometryComponent &component, - const AttributeDomain domain, + AttributeDomain domain, IndexMask mask) const override; std::string socket_inspection_name() const override; diff --git a/source/blender/blenkernel/BKE_gpencil.h b/source/blender/blenkernel/BKE_gpencil.h index a483d482bd5..885d0c2fd90 100644 --- a/source/blender/blenkernel/BKE_gpencil.h +++ b/source/blender/blenkernel/BKE_gpencil.h @@ -151,8 +151,8 @@ struct bGPDframe *BKE_gpencil_frame_addcopy(struct bGPDlayer *gpl, int cframe); */ struct bGPDlayer *BKE_gpencil_layer_addnew(struct bGPdata *gpd, const char *name, - const bool setactive, - const bool add_to_header); + bool setactive, + bool add_to_header); /** * Add a new grease pencil data-block. * \param bmain: Main pointer @@ -166,16 +166,15 @@ struct bGPdata *BKE_gpencil_data_addnew(struct Main *bmain, const char name[]); * \param gpf_src: Source grease pencil frame * \return Pointer to new frame */ -struct bGPDframe *BKE_gpencil_frame_duplicate(const struct bGPDframe *gpf_src, - const bool dup_strokes); +struct bGPDframe *BKE_gpencil_frame_duplicate(const struct bGPDframe *gpf_src, bool dup_strokes); /** * Make a copy of a given gpencil layer. * \param gpl_src: Source grease pencil layer * \return Pointer to new layer */ struct bGPDlayer *BKE_gpencil_layer_duplicate(const struct bGPDlayer *gpl_src, - const bool dup_frames, - const bool dup_strokes); + bool dup_frames, + bool dup_strokes); /** * Make a copy of a given gpencil layer settings. */ @@ -199,8 +198,8 @@ struct bGPDcurve *BKE_gpencil_stroke_curve_duplicate(struct bGPDcurve *gpc_src); * \return Pointer to new stroke. */ struct bGPDstroke *BKE_gpencil_stroke_duplicate(struct bGPDstroke *gps_src, - const bool dup_points, - const bool dup_curve); + bool dup_points, + bool dup_curve); /** * Make a copy of a given gpencil data-block. @@ -252,9 +251,9 @@ void BKE_gpencil_material_remap(struct bGPdata *gpd, * \return True if done. */ bool BKE_gpencil_merge_materials_table_get(struct Object *ob, - const float hue_threshold, - const float sat_threshold, - const float val_threshold, + float hue_threshold, + float sat_threshold, + float val_threshold, struct GHash *r_mat_table); /** * Merge similar materials @@ -266,9 +265,9 @@ bool BKE_gpencil_merge_materials_table_get(struct Object *ob, * \return True if done */ bool BKE_gpencil_merge_materials(struct Object *ob, - const float hue_threshold, - const float sat_threshold, - const float val_threshold, + float hue_threshold, + float sat_threshold, + float val_threshold, int *r_removed); /* statistics functions */ @@ -296,7 +295,7 @@ struct bGPDstroke *BKE_gpencil_stroke_new(int mat_idx, int totpoints, short thic * \return Pointer to new stroke */ struct bGPDstroke *BKE_gpencil_stroke_add( - struct bGPDframe *gpf, int mat_idx, int totpoints, short thickness, const bool insert_at_head); + struct bGPDframe *gpf, int mat_idx, int totpoints, short thickness, bool insert_at_head); /** * Add a stroke and copy the temporary drawing color value @@ -314,7 +313,7 @@ struct bGPDstroke *BKE_gpencil_stroke_add_existing_style(struct bGPDframe *gpf, int totpoints, short thickness); -struct bGPDcurve *BKE_gpencil_stroke_editcurve_new(const int tot_curve_points); +struct bGPDcurve *BKE_gpencil_stroke_editcurve_new(int tot_curve_points); /* Stroke and Fill - Alpha Visibility Threshold */ #define GPENCIL_ALPHA_OPACITY_THRESH 0.001f @@ -398,7 +397,7 @@ void BKE_gpencil_layer_delete(struct bGPdata *gpd, struct bGPDlayer *gpl); * \param gpd: Grease pencil data-block * \param unlock: Unlock flag */ -void BKE_gpencil_layer_autolock_set(struct bGPdata *gpd, const bool unlock); +void BKE_gpencil_layer_autolock_set(struct bGPdata *gpd, bool unlock); /** * Add grease pencil mask layer. @@ -641,11 +640,8 @@ void BKE_gpencil_palette_ensure(struct Main *bmain, struct Scene *scene); * \param mask: Mask * \return True if done */ -bool BKE_gpencil_from_image(struct SpaceImage *sima, - struct bGPdata *gpd, - struct bGPDframe *gpf, - const float size, - const bool mask); +bool BKE_gpencil_from_image( + struct SpaceImage *sima, struct bGPdata *gpd, struct bGPDframe *gpf, float size, bool mask); /* Iterators */ /** diff --git a/source/blender/blenkernel/BKE_gpencil_curve.h b/source/blender/blenkernel/BKE_gpencil_curve.h index 044e2ff2336..5c5f96c17f1 100644 --- a/source/blender/blenkernel/BKE_gpencil_curve.h +++ b/source/blender/blenkernel/BKE_gpencil_curve.h @@ -50,17 +50,17 @@ void BKE_gpencil_convert_curve(struct Main *bmain, struct Scene *scene, struct Object *ob_gp, struct Object *ob_cu, - const bool use_collections, - const float scale_thickness, - const float sample); + bool use_collections, + float scale_thickness, + float sample); /** * Creates a bGPDcurve by doing a cubic curve fitting on the grease pencil stroke points. */ struct bGPDcurve *BKE_gpencil_stroke_editcurve_generate(struct bGPDstroke *gps, - const float error_threshold, - const float corner_angle, - const float stroke_radius); + float error_threshold, + float corner_angle, + float stroke_radius); /** * Updates the edit-curve for a stroke. Frees the old curve if one exists and generates a new one. */ @@ -85,13 +85,13 @@ void BKE_gpencil_strokes_selected_sync_selection_editcurve(struct bGPdata *gpd); * Recalculate stroke points with the edit-curve of the stroke. */ void BKE_gpencil_stroke_update_geometry_from_editcurve(struct bGPDstroke *gps, - const uint resolution, - const bool is_adaptive); + uint resolution, + bool is_adaptive); /** * Recalculate the handles of the edit curve of a grease pencil stroke. */ void BKE_gpencil_editcurve_recalculate_handles(struct bGPDstroke *gps); -void BKE_gpencil_editcurve_subdivide(struct bGPDstroke *gps, const int cuts); +void BKE_gpencil_editcurve_subdivide(struct bGPDstroke *gps, int cuts); #ifdef __cplusplus } diff --git a/source/blender/blenkernel/BKE_gpencil_geom.h b/source/blender/blenkernel/BKE_gpencil_geom.h index 4b9671c7881..24b820b06cc 100644 --- a/source/blender/blenkernel/BKE_gpencil_geom.h +++ b/source/blender/blenkernel/BKE_gpencil_geom.h @@ -57,7 +57,7 @@ bool BKE_gpencil_data_minmax(const struct bGPdata *gpd, float r_min[3], float r_ * \return True if it was possible to calculate */ bool BKE_gpencil_stroke_minmax(const struct bGPDstroke *gps, - const bool use_select, + bool use_select, float r_min[3], float r_max[3]); @@ -136,8 +136,8 @@ bool BKE_gpencil_stroke_trim(struct bGPdata *gpd, struct bGPDstroke *gps); void BKE_gpencil_stroke_merge_distance(struct bGPdata *gpd, struct bGPDframe *gpf, struct bGPDstroke *gps, - const float threshold, - const bool use_unselected); + float threshold, + bool use_unselected); /** * Get points of stroke always flat to view not affected @@ -167,7 +167,7 @@ void BKE_gpencil_stroke_2d_flat_ref(const struct bGPDspoint *ref_points, const struct bGPDspoint *points, int totpoints, float (*points2d)[2], - const float scale, + float scale, int *r_direction); /** * Triangulate stroke to generate data for filling areas. @@ -227,8 +227,8 @@ void BKE_gpencil_point_coords_apply_with_mat4(struct bGPdata *gpd, */ bool BKE_gpencil_stroke_sample(struct bGPdata *gpd, struct bGPDstroke *gps, - const float dist, - const bool select); + float dist, + bool select); /** * Apply smooth position to stroke point. * \param gps: Stroke to smooth @@ -236,10 +236,7 @@ bool BKE_gpencil_stroke_sample(struct bGPdata *gpd, * \param inf: Amount of smoothing to apply * \param smooth_caps: Apply smooth to stroke extremes */ -bool BKE_gpencil_stroke_smooth_point(struct bGPDstroke *gps, - int i, - float inf, - const bool smooth_caps); +bool BKE_gpencil_stroke_smooth_point(struct bGPDstroke *gps, int i, float inf, bool smooth_caps); /** * Apply smooth strength to stroke point. * \param gps: Stroke to smooth @@ -276,7 +273,7 @@ bool BKE_gpencil_stroke_close(struct bGPDstroke *gps); void BKE_gpencil_dissolve_points(struct bGPdata *gpd, struct bGPDframe *gpf, struct bGPDstroke *gps, - const short tag); + short tag); /** * Backbone stretch similar to Freestyle. @@ -288,23 +285,21 @@ void BKE_gpencil_dissolve_points(struct bGPdata *gpd, * \param extra_point_count: When follow_curvature is true, use this amount of extra points. */ bool BKE_gpencil_stroke_stretch(struct bGPDstroke *gps, - const float dist, - const float overshoot_fac, - const short mode, - const bool follow_curvature, - const int extra_point_count, - const float segment_influence, - const float max_angle, - const bool invert_curvature); + float dist, + float overshoot_fac, + short mode, + bool follow_curvature, + int extra_point_count, + float segment_influence, + float max_angle, + bool invert_curvature); /** * Trim stroke to needed segments. * \param gps: Target stroke. * \param index_from: the index of the first point to be used in the trimmed result. * \param index_to: the index of the last point to be used in the trimmed result. */ -bool BKE_gpencil_stroke_trim_points(struct bGPDstroke *gps, - const int index_from, - const int index_to); +bool BKE_gpencil_stroke_trim_points(struct bGPDstroke *gps, int index_from, int index_to); /** * Split the given stroke into several new strokes, partitioning * it based on whether the stroke points have a particular flag @@ -315,9 +310,9 @@ struct bGPDstroke *BKE_gpencil_stroke_delete_tagged_points(struct bGPdata *gpd, struct bGPDstroke *gps, struct bGPDstroke *next_stroke, int tag_flags, - const bool select, - const bool flat_cap, - const int limit); + bool select, + bool flat_cap, + int limit); void BKE_gpencil_curve_delete_tagged_points(struct bGPdata *gpd, struct bGPDframe *gpf, struct bGPDstroke *gps, @@ -341,7 +336,7 @@ void BKE_gpencil_stroke_flip(struct bGPDstroke *gps); bool BKE_gpencil_stroke_split(struct bGPdata *gpd, struct bGPDframe *gpf, struct bGPDstroke *gps, - const int before_index, + int before_index, struct bGPDstroke **remaining_gps); /** * Shrink the stroke by length. @@ -349,7 +344,7 @@ bool BKE_gpencil_stroke_split(struct bGPdata *gpd, * \param dist: delta length * \param mode: 1->Start, 2->End */ -bool BKE_gpencil_stroke_shrink(struct bGPDstroke *gps, const float dist, const short mode); +bool BKE_gpencil_stroke_shrink(struct bGPDstroke *gps, float dist, short mode); /** * Calculate grease pencil stroke length. @@ -360,8 +355,8 @@ bool BKE_gpencil_stroke_shrink(struct bGPDstroke *gps, const float dist, const s float BKE_gpencil_stroke_length(const struct bGPDstroke *gps, bool use_3d); /** Calculate grease pencil stroke length between points. */ float BKE_gpencil_stroke_segment_length(const struct bGPDstroke *gps, - const int start_index, - const int end_index, + int start_index, + int end_index, bool use_3d); /** @@ -375,9 +370,9 @@ void BKE_gpencil_stroke_set_random_color(struct bGPDstroke *gps); */ void BKE_gpencil_stroke_join(struct bGPDstroke *gps_a, struct bGPDstroke *gps_b, - const bool leave_gaps, - const bool fit_thickness, - const bool smooth); + bool leave_gaps, + bool fit_thickness, + bool smooth); /** * Copy the stroke of the frame to all frames selected (except current). */ @@ -385,7 +380,7 @@ void BKE_gpencil_stroke_copy_to_keyframes(struct bGPdata *gpd, struct bGPDlayer *gpl, struct bGPDframe *gpf, struct bGPDstroke *gps, - const bool tail); + bool tail); /** * Convert a mesh object to grease pencil stroke. @@ -408,14 +403,14 @@ bool BKE_gpencil_convert_mesh(struct Main *bmain, struct Scene *scene, struct Object *ob_gp, struct Object *ob_mesh, - const float angle, - const int thickness, - const float offset, + float angle, + int thickness, + float offset, const float matrix[4][4], - const int frame_offset, - const bool use_seams, - const bool use_faces, - const bool use_vgroups); + int frame_offset, + bool use_seams, + bool use_faces, + bool use_vgroups); /** * Subdivide the grease pencil stroke so the number of points is target_number. @@ -428,8 +423,8 @@ bool BKE_gpencil_convert_mesh(struct Main *bmain, */ void BKE_gpencil_stroke_uniform_subdivide(struct bGPdata *gpd, struct bGPDstroke *gps, - const uint32_t target_number, - const bool select); + uint32_t target_number, + bool select); /** * Stroke to view space @@ -458,7 +453,7 @@ struct bGPDstroke *BKE_gpencil_stroke_perimeter_from_view(struct RegionView3D *r struct bGPdata *gpd, const struct bGPDlayer *gpl, struct bGPDstroke *gps, - const int subdivisions, + int subdivisions, const float diff_mat[4][4]); /** * Get average pressure. diff --git a/source/blender/blenkernel/BKE_gpencil_modifier.h b/source/blender/blenkernel/BKE_gpencil_modifier.h index 6c8edf598f1..6df13df1c01 100644 --- a/source/blender/blenkernel/BKE_gpencil_modifier.h +++ b/source/blender/blenkernel/BKE_gpencil_modifier.h @@ -207,7 +207,7 @@ typedef struct GpencilModifierTypeInfo { */ void (*updateDepsgraph)(struct GpencilModifierData *md, const struct ModifierUpdateDepsgraphContext *ctx, - const int mode); + int mode); /** * Should return true if the modifier needs to be recalculated on time @@ -279,7 +279,7 @@ struct GpencilModifierData *BKE_gpencil_modifier_new(int type); * \param md: Modifier data. * \param flag: Flags. */ -void BKE_gpencil_modifier_free_ex(struct GpencilModifierData *md, const int flag); +void BKE_gpencil_modifier_free_ex(struct GpencilModifierData *md, int flag); /** * Free grease pencil modifier data * \param md: Modifier data. @@ -324,7 +324,7 @@ void BKE_gpencil_modifier_copydata(struct GpencilModifierData *md, */ void BKE_gpencil_modifier_copydata_ex(struct GpencilModifierData *md, struct GpencilModifierData *target, - const int flag); + int flag); /** * Set grease pencil modifier error. * \param md: Modifier data. @@ -403,7 +403,7 @@ GpencilLineartLimitInfo BKE_gpencil_get_lineart_modifier_limits(const struct Obj void BKE_gpencil_set_lineart_modifier_limits(struct GpencilModifierData *md, const struct GpencilLineartLimitInfo *info, - const bool is_first_lineart); + bool is_first_lineart); bool BKE_gpencil_is_first_lineart_in_stack(const struct Object *ob, const struct GpencilModifierData *md); @@ -457,8 +457,8 @@ int BKE_gpencil_time_modifier_cfra(struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob, struct bGPDlayer *gpl, - const int cfra, - const bool is_render); + int cfra, + bool is_render); void BKE_gpencil_modifier_blend_write(struct BlendWriter *writer, struct ListBase *modbase); void BKE_gpencil_modifier_blend_read_data(struct BlendDataReader *reader, struct ListBase *lb); diff --git a/source/blender/blenkernel/BKE_icons.h b/source/blender/blenkernel/BKE_icons.h index c96a37e0d09..a65cdcd23af 100644 --- a/source/blender/blenkernel/BKE_icons.h +++ b/source/blender/blenkernel/BKE_icons.h @@ -123,13 +123,13 @@ struct ImBuf *BKE_icon_imbuf_get_buffer(int icon_id) ATTR_WARN_UNUSED_RESULT; /** * Retrieve icon for id. */ -struct Icon *BKE_icon_get(const int icon_id); +struct Icon *BKE_icon_get(int icon_id); /** * Set icon for id if not already defined. * Used for inserting the internal icons. */ -void BKE_icon_set(const int icon_id, struct Icon *icon); +void BKE_icon_set(int icon_id, struct Icon *icon); /** * Remove icon and free data if library object becomes invalid. @@ -139,13 +139,13 @@ void BKE_icon_id_delete(struct ID *id); /** * Remove icon and free data. */ -bool BKE_icon_delete(const int icon_id); -bool BKE_icon_delete_unmanaged(const int icon_id); +bool BKE_icon_delete(int icon_id); +bool BKE_icon_delete_unmanaged(int icon_id); /** * Report changes - icon needs to be recalculated. */ -void BKE_icon_changed(const int icon_id); +void BKE_icon_changed(int icon_id); /** * Free all icons. @@ -220,16 +220,16 @@ struct PreviewImage *BKE_previewimg_id_ensure(struct ID *id); * Handle deferred (lazy) loading/generation of preview image, if needed. * For now, only used with file thumbnails. */ -void BKE_previewimg_ensure(struct PreviewImage *prv, const int size); +void BKE_previewimg_ensure(struct PreviewImage *prv, int size); /** * Create an #ImBuf holding a copy of the preview image buffer in \a prv. * \note The returned image buffer has to be free'd (#IMB_freeImBuf()). */ -struct ImBuf *BKE_previewimg_to_imbuf(struct PreviewImage *prv, const int size); +struct ImBuf *BKE_previewimg_to_imbuf(struct PreviewImage *prv, int size); -void BKE_previewimg_finish(struct PreviewImage *prv, const int size); -bool BKE_previewimg_is_finished(const struct PreviewImage *prv, const int size); +void BKE_previewimg_finish(struct PreviewImage *prv, int size); +bool BKE_previewimg_is_finished(const struct PreviewImage *prv, int size); struct PreviewImage *BKE_previewimg_cached_get(const char *name); @@ -244,7 +244,7 @@ struct PreviewImage *BKE_previewimg_cached_ensure(const char *name); */ struct PreviewImage *BKE_previewimg_cached_thumbnail_read(const char *name, const char *path, - const int source, + int source, bool force_update); void BKE_previewimg_cached_release(const char *name); @@ -259,8 +259,8 @@ struct Icon_Geom *BKE_icon_geom_from_memory(uchar *data, size_t data_len); struct Icon_Geom *BKE_icon_geom_from_file(const char *filename); struct ImBuf *BKE_icon_geom_rasterize(const struct Icon_Geom *geom, - const unsigned int size_x, - const unsigned int size_y); + unsigned int size_x, + unsigned int size_y); void BKE_icon_geom_invert_lightness(struct Icon_Geom *geom); int BKE_icon_ensure_studio_light(struct StudioLight *sl, int id_type); diff --git a/source/blender/blenkernel/BKE_idprop.h b/source/blender/blenkernel/BKE_idprop.h index 1fb3636e9fd..b0b981e49f0 100644 --- a/source/blender/blenkernel/BKE_idprop.h +++ b/source/blender/blenkernel/BKE_idprop.h @@ -62,7 +62,7 @@ typedef union IDPropertyTemplate { */ struct IDProperty *IDP_NewIDPArray(const char *name) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(); struct IDProperty *IDP_CopyIDPArray(const struct IDProperty *array, - const int flag) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(); + int flag) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(); /** * Shallow copies item. @@ -102,7 +102,7 @@ void IDP_FreeString(struct IDProperty *prop) ATTR_NONNULL(); typedef void (*IDPWalkFunc)(void *userData, struct IDProperty *idp); -void IDP_AssignID(struct IDProperty *prop, struct ID *id, const int flag); +void IDP_AssignID(struct IDProperty *prop, struct ID *id, int flag); /*-------- Group Functions -------*/ @@ -113,9 +113,8 @@ void IDP_AssignID(struct IDProperty *prop, struct ID *id, const int flag); * \note Use for syncing proxies. */ void IDP_SyncGroupValues(struct IDProperty *dest, const struct IDProperty *src) ATTR_NONNULL(); -void IDP_SyncGroupTypes(struct IDProperty *dest, - const struct IDProperty *src, - const bool do_arraylen) ATTR_NONNULL(); +void IDP_SyncGroupTypes(struct IDProperty *dest, const struct IDProperty *src, bool do_arraylen) + ATTR_NONNULL(); /** * Replaces all properties with the same name in a destination group from a source group. */ @@ -132,7 +131,7 @@ void IDP_ReplaceInGroup_ex(struct IDProperty *group, * If a property is missing in \a dest, add it. * Do it recursively. */ -void IDP_MergeGroup(struct IDProperty *dest, const struct IDProperty *src, const bool do_overwrite) +void IDP_MergeGroup(struct IDProperty *dest, const struct IDProperty *src, bool do_overwrite) ATTR_NONNULL(); /** * If a property is missing in \a dest, add it. @@ -140,8 +139,8 @@ void IDP_MergeGroup(struct IDProperty *dest, const struct IDProperty *src, const */ void IDP_MergeGroup_ex(struct IDProperty *dest, const struct IDProperty *src, - const bool do_overwrite, - const int flag) ATTR_NONNULL(); + bool do_overwrite, + int flag) ATTR_NONNULL(); /** * This function has a sanity check to make sure ID properties with the same name don't * get added to the group. @@ -180,8 +179,7 @@ struct IDProperty *IDP_GetPropertyFromGroup(const struct IDProperty *prop, */ struct IDProperty *IDP_GetPropertyTypeFromGroup(const struct IDProperty *prop, const char *name, - const char type) ATTR_WARN_UNUSED_RESULT - ATTR_NONNULL(); + char type) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(); /*-------- Main Functions --------*/ /** @@ -190,13 +188,12 @@ struct IDProperty *IDP_GetPropertyTypeFromGroup(const struct IDProperty *prop, * \param create_if_needed: Set to create the group property and attach it to id if it doesn't * exist; otherwise the function will return NULL if there's no Group property attached to the ID. */ -struct IDProperty *IDP_GetProperties(struct ID *id, - const bool create_if_needed) ATTR_WARN_UNUSED_RESULT +struct IDProperty *IDP_GetProperties(struct ID *id, bool create_if_needed) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(); struct IDProperty *IDP_CopyProperty(const struct IDProperty *prop) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(); struct IDProperty *IDP_CopyProperty_ex(const struct IDProperty *prop, - const int flag) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(); + int flag) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(); /** * Copy content from source #IDProperty into destination one, * freeing destination property's content first. @@ -208,7 +205,7 @@ void IDP_CopyPropertyContent(struct IDProperty *dst, struct IDProperty *src) ATT */ bool IDP_EqualsProperties_ex(struct IDProperty *prop1, struct IDProperty *prop2, - const bool is_strict) ATTR_WARN_UNUSED_RESULT; + bool is_strict) ATTR_WARN_UNUSED_RESULT; bool IDP_EqualsProperties(struct IDProperty *prop1, struct IDProperty *prop2) ATTR_WARN_UNUSED_RESULT; @@ -240,7 +237,7 @@ bool IDP_EqualsProperties(struct IDProperty *prop1, * IDP_AddToGroup or MEM_freeN the property, doing anything else might result in * a memory leak. */ -struct IDProperty *IDP_New(const char type, +struct IDProperty *IDP_New(char type, const IDPropertyTemplate *val, const char *name) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(); @@ -248,9 +245,9 @@ struct IDProperty *IDP_New(const char type, * \note This will free allocated data, all child properties of arrays and groups, and unlink IDs! * But it does not free the actual #IDProperty struct itself. */ -void IDP_FreePropertyContent_ex(struct IDProperty *prop, const bool do_id_user); +void IDP_FreePropertyContent_ex(struct IDProperty *prop, bool do_id_user); void IDP_FreePropertyContent(struct IDProperty *prop); -void IDP_FreeProperty_ex(struct IDProperty *prop, const bool do_id_user); +void IDP_FreeProperty_ex(struct IDProperty *prop, bool do_id_user); void IDP_FreeProperty(struct IDProperty *prop); void IDP_ClearProperty(struct IDProperty *prop); @@ -319,7 +316,7 @@ typedef void (*IDPForeachPropertyCallback)(struct IDProperty *id_property, void * IDP_TYPE_FILTER_ enum in DNA_ID.h. */ void IDP_foreach_property(struct IDProperty *id_property_root, - const int type_filter, + int type_filter, IDPForeachPropertyCallback callback, void *user_data); diff --git a/source/blender/blenkernel/BKE_idtype.h b/source/blender/blenkernel/BKE_idtype.h index 8cd5d2a2361..f83675fbb7e 100644 --- a/source/blender/blenkernel/BKE_idtype.h +++ b/source/blender/blenkernel/BKE_idtype.h @@ -78,12 +78,12 @@ typedef void (*IDTypeInitDataFunction)(struct ID *id); typedef void (*IDTypeCopyDataFunction)(struct Main *bmain, struct ID *id_dst, const struct ID *id_src, - const int flag); + int flag); typedef void (*IDTypeFreeDataFunction)(struct ID *id); /** \param flags: See BKE_lib_id.h's LIB_ID_MAKELOCAL_... flags. */ -typedef void (*IDTypeMakeLocalFunction)(struct Main *bmain, struct ID *id, const int flags); +typedef void (*IDTypeMakeLocalFunction)(struct Main *bmain, struct ID *id, int flags); typedef void (*IDTypeForeachIDFunction)(struct ID *id, struct LibraryForeachIDData *data); @@ -292,7 +292,7 @@ extern IDTypeInfo IDType_ID_LINK_PLACEHOLDER; void BKE_idtype_init(void); /* General helpers. */ -const struct IDTypeInfo *BKE_idtype_get_info_from_idcode(const short id_code); +const struct IDTypeInfo *BKE_idtype_get_info_from_idcode(short id_code); const struct IDTypeInfo *BKE_idtype_get_info_from_id(const struct ID *id); /** @@ -301,21 +301,21 @@ const struct IDTypeInfo *BKE_idtype_get_info_from_id(const struct ID *id); * \param idcode: The code to convert. * \return A static string representing the name of the code. */ -const char *BKE_idtype_idcode_to_name(const short idcode); +const char *BKE_idtype_idcode_to_name(short idcode); /** * Convert an \a idcode into a name (plural). * * \param idcode: The code to convert. * \return A static string representing the name of the code. */ -const char *BKE_idtype_idcode_to_name_plural(const short idcode); +const char *BKE_idtype_idcode_to_name_plural(short idcode); /** * Convert an \a idcode into its translations' context. * * \param idcode: The code to convert. * \return A static string representing the i18n context of the code. */ -const char *BKE_idtype_idcode_to_translation_context(const short idcode); +const char *BKE_idtype_idcode_to_translation_context(short idcode); /** * Return if the ID code is a valid ID code. @@ -323,7 +323,7 @@ const char *BKE_idtype_idcode_to_translation_context(const short idcode); * \param idcode: The code to check. * \return Boolean, 0 when invalid. */ -bool BKE_idtype_idcode_is_valid(const short idcode); +bool BKE_idtype_idcode_is_valid(short idcode); /** * Check if an ID type is linkable. @@ -331,21 +331,21 @@ bool BKE_idtype_idcode_is_valid(const short idcode); * \param idcode: The IDType code to check. * \return Boolean, false when non linkable, true otherwise. */ -bool BKE_idtype_idcode_is_linkable(const short idcode); +bool BKE_idtype_idcode_is_linkable(short idcode); /** * Check if an ID type is only appendable. * * \param idcode: The IDType code to check. * \return Boolean, false when also linkable, true when only appendable. */ -bool BKE_idtype_idcode_is_only_appendable(const short idcode); +bool BKE_idtype_idcode_is_only_appendable(short idcode); /** * Check if an ID type can try to reuse and existing matching local one when being appended again. * * \param idcode: The IDType code to check. * \return Boolean, false when it cannot be re-used, true otherwise. */ -bool BKE_idtype_idcode_append_is_reusable(const short idcode); +bool BKE_idtype_idcode_append_is_reusable(short idcode); /* Macro currently, since any linkable IDtype should be localizable. */ #define BKE_idtype_idcode_is_localizable BKE_idtype_idcode_is_linkable @@ -360,20 +360,20 @@ short BKE_idtype_idcode_from_name(const char *idtype_name); /** * Convert an \a idcode into an \a idfilter (e.g. #ID_OB -> #FILTER_ID_OB). */ -uint64_t BKE_idtype_idcode_to_idfilter(const short idcode); +uint64_t BKE_idtype_idcode_to_idfilter(short idcode); /** * Convert an \a idfilter into an \a idcode (e.g. #FILTER_ID_OB -> #ID_OB). */ -short BKE_idtype_idcode_from_idfilter(const uint64_t idfilter); +short BKE_idtype_idcode_from_idfilter(uint64_t idfilter); /** * Convert an \a idcode into an index (e.g. #ID_OB -> #INDEX_ID_OB). */ -int BKE_idtype_idcode_to_index(const short idcode); +int BKE_idtype_idcode_to_index(short idcode); /** * Get an \a idcode from an index (e.g. #INDEX_ID_OB -> #ID_OB). */ -short BKE_idtype_idcode_from_index(const int index); +short BKE_idtype_idcode_from_index(int index); /** * Return an ID code and steps the index forward 1. diff --git a/source/blender/blenkernel/BKE_image.h b/source/blender/blenkernel/BKE_image.h index 0709d05c0d1..7b87189a13f 100644 --- a/source/blender/blenkernel/BKE_image.h +++ b/source/blender/blenkernel/BKE_image.h @@ -113,35 +113,35 @@ int BKE_imbuf_write(struct ImBuf *ibuf, const char *name, const struct ImageForm int BKE_imbuf_write_as(struct ImBuf *ibuf, const char *name, struct ImageFormatData *imf, - const bool save_copy); + bool save_copy); void BKE_image_path_from_imformat(char *string, const char *base, const char *relbase, int frame, const struct ImageFormatData *im_format, - const bool use_ext, - const bool use_frames, + bool use_ext, + bool use_frames, const char *suffix); void BKE_image_path_from_imtype(char *string, const char *base, const char *relbase, int frame, - const char imtype, - const bool use_ext, - const bool use_frames, + char imtype, + bool use_ext, + bool use_frames, const char *suffix); int BKE_image_path_ensure_ext_from_imformat(char *string, const struct ImageFormatData *im_format); -int BKE_image_path_ensure_ext_from_imtype(char *string, const char imtype); -char BKE_image_ftype_to_imtype(const int ftype, const struct ImbFormatOptions *options); -int BKE_image_imtype_to_ftype(const char imtype, struct ImbFormatOptions *r_options); +int BKE_image_path_ensure_ext_from_imtype(char *string, char imtype); +char BKE_image_ftype_to_imtype(int ftype, const struct ImbFormatOptions *options); +int BKE_image_imtype_to_ftype(char imtype, struct ImbFormatOptions *r_options); -bool BKE_imtype_is_movie(const char imtype); -bool BKE_imtype_supports_zbuf(const char imtype); -bool BKE_imtype_supports_compress(const char imtype); -bool BKE_imtype_supports_quality(const char imtype); -bool BKE_imtype_requires_linear_float(const char imtype); -char BKE_imtype_valid_channels(const char imtype, bool write_file); -char BKE_imtype_valid_depths(const char imtype); +bool BKE_imtype_is_movie(char imtype); +bool BKE_imtype_supports_zbuf(char imtype); +bool BKE_imtype_supports_compress(char imtype); +bool BKE_imtype_supports_quality(char imtype); +bool BKE_imtype_requires_linear_float(char imtype); +char BKE_imtype_valid_channels(char imtype, bool write_file); +char BKE_imtype_valid_depths(char imtype); /** * String is from command line `--render-format` argument, @@ -241,9 +241,9 @@ struct Image *BKE_image_add_generated(struct Main *bmain, int floatbuf, short gen_type, const float color[4], - const bool stereo3d, - const bool is_data, - const bool tiled); + bool stereo3d, + bool is_data, + bool tiled); /** * Create an image from ibuf. The reference-count of ibuf is increased, * caller should take care to drop its reference by calling #IMB_freeImBuf if needed. @@ -334,7 +334,7 @@ void BKE_image_backup_render(struct Scene *scene, struct Image *ima, bool free_c bool BKE_image_save_openexr_multiview(struct Image *ima, struct ImBuf *ibuf, const char *filepath, - const int flags); + int flags); /** * Goes over all textures that use images. @@ -436,6 +436,7 @@ typedef enum { /** * Ensures that `filename` contains a UDIM token if we find a supported format pattern. + * \note This must only be the name component (without slashes). */ void BKE_image_ensure_tile_token(char *filename); diff --git a/source/blender/blenkernel/BKE_key.h b/source/blender/blenkernel/BKE_key.h index becf6bae5ca..07e816558df 100644 --- a/source/blender/blenkernel/BKE_key.h +++ b/source/blender/blenkernel/BKE_key.h @@ -68,16 +68,16 @@ float *BKE_key_evaluate_object(struct Object *ob, int *r_totelem); /** * \param shape_index: The index to use or all (when -1). */ -int BKE_keyblock_element_count_from_shape(const struct Key *key, const int shape_index); +int BKE_keyblock_element_count_from_shape(const struct Key *key, int shape_index); int BKE_keyblock_element_count(const struct Key *key); /** * \param shape_index: The index to use or all (when -1). */ -size_t BKE_keyblock_element_calc_size_from_shape(const struct Key *key, const int shape_index); +size_t BKE_keyblock_element_calc_size_from_shape(const struct Key *key, int shape_index); size_t BKE_keyblock_element_calc_size(const struct Key *key); -bool BKE_key_idtype_support(const short id_type); +bool BKE_key_idtype_support(short id_type); struct Key **BKE_key_from_id_p(struct ID *id); struct Key *BKE_key_from_id(struct ID *id); @@ -98,7 +98,7 @@ struct KeyBlock *BKE_keyblock_add(struct Key *key, const char *name); * \param name: Optional name for the new keyblock. * \param do_force: always use ctime even for relative keys. */ -struct KeyBlock *BKE_keyblock_add_ctime(struct Key *key, const char *name, const bool do_force); +struct KeyBlock *BKE_keyblock_add_ctime(struct Key *key, const char *name, bool do_force); /** * Get the appropriate #KeyBlock given an index. */ @@ -179,7 +179,7 @@ bool BKE_keyblock_move(struct Object *ob, int org_index, int new_index); /** * Check if given key-block (as index) is used as basis by others in given key. */ -bool BKE_keyblock_is_basis(struct Key *key, const int index); +bool BKE_keyblock_is_basis(struct Key *key, int index); /* -------------------------------------------------------------------- */ /** \name Key-Block Data Access @@ -188,16 +188,14 @@ bool BKE_keyblock_is_basis(struct Key *key, const int index); /** * \param shape_index: The index to use or all (when -1). */ -void BKE_keyblock_data_get_from_shape(const struct Key *key, - float (*arr)[3], - const int shape_index); +void BKE_keyblock_data_get_from_shape(const struct Key *key, float (*arr)[3], int shape_index); void BKE_keyblock_data_get(const struct Key *key, float (*arr)[3]); /** * Set the data to all key-blocks (or shape_index if != -1). */ void BKE_keyblock_data_set_with_mat4(struct Key *key, - const int shape_index, + int shape_index, const float (*coords)[3], const float mat[4][4]); /** @@ -206,13 +204,13 @@ void BKE_keyblock_data_set_with_mat4(struct Key *key, */ void BKE_keyblock_curve_data_set_with_mat4(struct Key *key, const struct ListBase *nurb, - const int shape_index, + int shape_index, const void *data, const float mat[4][4]); /** * Set the data for all key-blocks (or shape_index if != -1). */ -void BKE_keyblock_data_set(struct Key *key, const int shape_index, const void *data); +void BKE_keyblock_data_set(struct Key *key, int shape_index, const void *data); /** \} */ diff --git a/source/blender/blenkernel/BKE_lattice.h b/source/blender/blenkernel/BKE_lattice.h index bf03e99bbc3..35260aa3852 100644 --- a/source/blender/blenkernel/BKE_lattice.h +++ b/source/blender/blenkernel/BKE_lattice.h @@ -69,15 +69,11 @@ void BKE_lattice_transform(struct Lattice *lt, const float mat[4][4], bool do_ke bool BKE_lattice_is_any_selected(const struct Lattice *lt); -int BKE_lattice_index_from_uvw(struct Lattice *lt, const int u, const int v, const int w); -void BKE_lattice_index_to_uvw(struct Lattice *lt, const int index, int *r_u, int *r_v, int *r_w); -int BKE_lattice_index_flip( - struct Lattice *lt, const int index, const bool flip_u, const bool flip_v, const bool flip_w); -void BKE_lattice_bitmap_from_flag(struct Lattice *lt, - unsigned int *bitmap, - const uint8_t flag, - const bool clear, - const bool respecthide); +int BKE_lattice_index_from_uvw(struct Lattice *lt, int u, int v, int w); +void BKE_lattice_index_to_uvw(struct Lattice *lt, int index, int *r_u, int *r_v, int *r_w); +int BKE_lattice_index_flip(struct Lattice *lt, int index, bool flip_u, bool flip_v, bool flip_w); +void BKE_lattice_bitmap_from_flag( + struct Lattice *lt, unsigned int *bitmap, uint8_t flag, bool clear, bool respecthide); /* **** Depsgraph evaluation **** */ @@ -110,27 +106,27 @@ void BKE_lattice_deform_data_destroy(struct LatticeDeformData *lattice_deform_da void BKE_lattice_deform_coords(const struct Object *ob_lattice, const struct Object *ob_target, float (*vert_coords)[3], - const int vert_coords_len, - const short flag, + int vert_coords_len, + short flag, const char *defgrp_name, float fac); void BKE_lattice_deform_coords_with_mesh(const struct Object *ob_lattice, const struct Object *ob_target, float (*vert_coords)[3], - const int vert_coords_len, - const short flag, + int vert_coords_len, + short flag, const char *defgrp_name, - const float fac, + float fac, const struct Mesh *me_target); void BKE_lattice_deform_coords_with_editmesh(const struct Object *ob_lattice, const struct Object *ob_target, float (*vert_coords)[3], - const int vert_coords_len, - const short flag, + int vert_coords_len, + short flag, const char *defgrp_name, - const float fac, + float fac, struct BMEditMesh *em_target); /** \} */ diff --git a/source/blender/blenkernel/BKE_layer.h b/source/blender/blenkernel/BKE_layer.h index b2fa464aedc..bc2249b93b9 100644 --- a/source/blender/blenkernel/BKE_layer.h +++ b/source/blender/blenkernel/BKE_layer.h @@ -71,7 +71,7 @@ struct ViewLayer *BKE_view_layer_find(const struct Scene *scene, const char *lay struct ViewLayer *BKE_view_layer_add(struct Scene *scene, const char *name, struct ViewLayer *view_layer_source, - const int type); + int type); /* DEPRECATED */ /** @@ -85,12 +85,12 @@ void BKE_view_layer_free(struct ViewLayer *view_layer); /** * Free (or release) any data used by this #ViewLayer. */ -void BKE_view_layer_free_ex(struct ViewLayer *view_layer, const bool do_id_user); +void BKE_view_layer_free_ex(struct ViewLayer *view_layer, bool do_id_user); /** * Tag all the selected objects of a render-layer. */ -void BKE_view_layer_selected_objects_tag(struct ViewLayer *view_layer, const int tag); +void BKE_view_layer_selected_objects_tag(struct ViewLayer *view_layer, int tag); /** * Fallback for when a Scene has no camera to use. @@ -119,7 +119,7 @@ void BKE_view_layer_copy_data(struct Scene *scene_dst, const struct Scene *scene_src, struct ViewLayer *view_layer_dst, const struct ViewLayer *view_layer_src, - const int flag); + int flag); void BKE_view_layer_rename(struct Main *bmain, struct Scene *scene, @@ -148,8 +148,7 @@ int BKE_layer_collection_count(const struct ViewLayer *view_layer); /** * Get the collection for a given index. */ -struct LayerCollection *BKE_layer_collection_from_index(struct ViewLayer *view_layer, - const int index); +struct LayerCollection *BKE_layer_collection_from_index(struct ViewLayer *view_layer, int index); /** * \return -1 if not found. */ @@ -242,9 +241,9 @@ void BKE_layer_collection_isolate_local(struct ViewLayer *view_layer, */ void BKE_layer_collection_set_visible(struct ViewLayer *view_layer, struct LayerCollection *lc, - const bool visible, - const bool hierarchy); -void BKE_layer_collection_set_flag(struct LayerCollection *lc, const int flag, const bool value); + bool visible, + bool hierarchy); +void BKE_layer_collection_set_flag(struct LayerCollection *lc, int flag, bool value); /* Evaluation. */ diff --git a/source/blender/blenkernel/BKE_lib_id.h b/source/blender/blenkernel/BKE_lib_id.h index 34339c4ff9f..1d905ad85b1 100644 --- a/source/blender/blenkernel/BKE_lib_id.h +++ b/source/blender/blenkernel/BKE_lib_id.h @@ -77,7 +77,7 @@ void *BKE_libblock_alloc_notest(short type) ATTR_WARN_UNUSED_RESULT; * The user count is set to 1, all other content (apart from name and links) being * initialized to zero. */ -void *BKE_libblock_alloc(struct Main *bmain, short type, const char *name, const int flag) +void *BKE_libblock_alloc(struct Main *bmain, short type, const char *name, int flag) ATTR_WARN_UNUSED_RESULT; /** * Initialize an ID of given type, such that it has valid 'empty' data. @@ -114,14 +114,14 @@ void BKE_lib_libblock_session_uuid_renew(struct ID *id); * * \param name: can be NULL, in which case we get default name for this ID type. */ -void *BKE_id_new(struct Main *bmain, const short type, const char *name); +void *BKE_id_new(struct Main *bmain, short type, const char *name); /** * Generic helper to create a new temporary empty data-block of given type, * *outside* of any Main database. * * \param name: can be NULL, in which case we get default name for this ID type. */ -void *BKE_id_new_nomain(const short type, const char *name); +void *BKE_id_new_nomain(short type, const char *name); /** * New ID creation/copying options. @@ -202,7 +202,7 @@ enum { void BKE_libblock_copy_ex(struct Main *bmain, const struct ID *id, struct ID **r_newid, - const int orig_flag); + int orig_flag); /** * Used everywhere in blenkernel. */ @@ -220,7 +220,7 @@ void BKE_libblock_rename(struct Main *bmain, struct ID *id, const char *name) AT void BLI_libblock_ensure_unique_name(struct Main *bmain, const char *name) ATTR_NONNULL(); struct ID *BKE_libblock_find_name(struct Main *bmain, - const short type, + short type, const char *name) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(); struct ID *BKE_libblock_find_session_uuid(struct Main *bmain, short type, uint32_t session_uuid); /** @@ -267,8 +267,8 @@ enum { LIB_ID_FREE_NO_UI_USER = 1 << 9, }; -void BKE_libblock_free_datablock(struct ID *id, const int flag) ATTR_NONNULL(); -void BKE_libblock_free_data(struct ID *id, const bool do_id_user) ATTR_NONNULL(); +void BKE_libblock_free_datablock(struct ID *id, int flag) ATTR_NONNULL(); +void BKE_libblock_free_data(struct ID *id, bool do_id_user) ATTR_NONNULL(); /** * In most cases #BKE_id_free_ex handles this, when lower level functions are called directly @@ -295,7 +295,7 @@ void BKE_libblock_free_data_py(struct ID *id); * \param use_flag_from_idtag: Still use freeing info flags from given #ID datablock, * even if some overriding ones are passed in \a flag parameter. */ -void BKE_id_free_ex(struct Main *bmain, void *idv, int flag, const bool use_flag_from_idtag); +void BKE_id_free_ex(struct Main *bmain, void *idv, int flag, bool use_flag_from_idtag); /** * Complete ID freeing, should be usable in most cases (even for out-of-Main IDs). * @@ -385,7 +385,7 @@ enum { /** * Generic 'make local' function, works for most of data-block types. */ -void BKE_lib_id_make_local_generic(struct Main *bmain, struct ID *id, const int flags); +void BKE_lib_id_make_local_generic(struct Main *bmain, struct ID *id, int flags); /** * Calls the appropriate make_local method for the block, unless test is set. * @@ -395,7 +395,7 @@ void BKE_lib_id_make_local_generic(struct Main *bmain, struct ID *id, const int * it needs specific handling. * \return true is the ID has successfully been made local. */ -bool BKE_lib_id_make_local(struct Main *bmain, struct ID *id, const int flags); +bool BKE_lib_id_make_local(struct Main *bmain, struct ID *id, int flags); /** * \note Does *not* set #ID.newid pointer. */ @@ -431,18 +431,15 @@ struct ID *BKE_id_copy(struct Main *bmain, const struct ID *id); * (leave to zero for default, full copy). * \return NULL when copying that ID type is not supported, the new copy otherwise. */ -struct ID *BKE_id_copy_ex(struct Main *bmain, - const struct ID *id, - struct ID **r_newid, - const int flag); +struct ID *BKE_id_copy_ex(struct Main *bmain, const struct ID *id, struct ID **r_newid, int flag); /** * Invokes the appropriate copy method for the block and returns the result in * newid, unless test. Returns true if the block can be copied. */ struct ID *BKE_id_copy_for_duplicate(struct Main *bmain, struct ID *id, - const uint duplicate_flags, - const int copy_flags); + uint duplicate_flags, + int copy_flags); /** * Does a mere memory swap over the whole IDs data (including type-specific memory). @@ -474,7 +471,7 @@ void id_sort_by_name(struct ListBase *lb, struct ID *id, struct ID *id_sorting_h * Expand ID usages of given id as 'extern' (and no more indirect) linked data. * Used by ID copy/make_local functions. */ -void BKE_lib_id_expand_local(struct Main *bmain, struct ID *id, const int flags); +void BKE_lib_id_expand_local(struct Main *bmain, struct ID *id, int flags); /** * Ensures given ID has a unique name in given listbase. @@ -489,48 +486,45 @@ void BKE_lib_id_expand_local(struct Main *bmain, struct ID *id, const int flags) bool BKE_id_new_name_validate(struct ListBase *lb, struct ID *id, const char *name, - const bool do_linked_data) ATTR_NONNULL(1, 2); + bool do_linked_data) ATTR_NONNULL(1, 2); /** * Pull an ID out of a library (make it local). Only call this for IDs that * don't have other library users. * * \param flags: Same set of `LIB_ID_MAKELOCAL_` flags as passed to #BKE_lib_id_make_local. */ -void BKE_lib_id_clear_library_data(struct Main *bmain, struct ID *id, const int flags); +void BKE_lib_id_clear_library_data(struct Main *bmain, struct ID *id, int flags); /** * Clear or set given tags for all ids of given type in `bmain` (runtime tags). * * \note Affect whole Main database. */ -void BKE_main_id_tag_idcode(struct Main *mainvar, - const short type, - const int tag, - const bool value); +void BKE_main_id_tag_idcode(struct Main *mainvar, short type, int tag, bool value); /** * Clear or set given tags for all ids in listbase (runtime tags). */ -void BKE_main_id_tag_listbase(struct ListBase *lb, const int tag, const bool value); +void BKE_main_id_tag_listbase(struct ListBase *lb, int tag, bool value); /** * Clear or set given tags for all ids in bmain (runtime tags). */ -void BKE_main_id_tag_all(struct Main *mainvar, const int tag, const bool value); +void BKE_main_id_tag_all(struct Main *mainvar, int tag, bool value); /** * Clear or set given flags for all ids in listbase (persistent flags). */ -void BKE_main_id_flag_listbase(struct ListBase *lb, const int flag, const bool value); +void BKE_main_id_flag_listbase(struct ListBase *lb, int flag, bool value); /** * Clear or set given flags for all ids in bmain (persistent flags). */ -void BKE_main_id_flag_all(struct Main *bmain, const int flag, const bool value); +void BKE_main_id_flag_all(struct Main *bmain, int flag, bool value); /** * Next to indirect usage in `readfile.c/writefile.c` also in `editobject.c`, `scene.c`. */ void BKE_main_id_newptr_and_tag_clear(struct Main *bmain); -void BKE_main_id_refcount_recompute(struct Main *bmain, const bool do_linked_only); +void BKE_main_id_refcount_recompute(struct Main *bmain, bool do_linked_only); void BKE_main_lib_objects_recalc_all(struct Main *bmain); @@ -567,7 +561,7 @@ void BKE_id_full_name_get(char name[MAX_ID_FULL_NAME], const struct ID *id, char */ void BKE_id_full_name_ui_prefix_get(char name[MAX_ID_FULL_NAME_UI], const struct ID *id, - const bool add_lib_hint, + bool add_lib_hint, char separator_char, int *r_prefix_len); @@ -591,8 +585,8 @@ char *BKE_id_to_unique_string_key(const struct ID *id); void BKE_library_make_local(struct Main *bmain, const struct Library *lib, struct GHash *old_to_new_ids, - const bool untagged_only, - const bool set_fake); + bool untagged_only, + bool set_fake); void BKE_id_tag_set_atomic(struct ID *id, int tag); void BKE_id_tag_clear_atomic(struct ID *id, int tag); diff --git a/source/blender/blenkernel/BKE_lib_override.h b/source/blender/blenkernel/BKE_lib_override.h index fa3f355c5dd..16156824f8e 100644 --- a/source/blender/blenkernel/BKE_lib_override.h +++ b/source/blender/blenkernel/BKE_lib_override.h @@ -65,17 +65,15 @@ struct IDOverrideLibrary *BKE_lib_override_library_init(struct ID *local_id, /** * Shallow or deep copy of a whole override from \a src_id to \a dst_id. */ -void BKE_lib_override_library_copy(struct ID *dst_id, - const struct ID *src_id, - const bool do_full_copy); +void BKE_lib_override_library_copy(struct ID *dst_id, const struct ID *src_id, bool do_full_copy); /** * Clear any overriding data from given \a override. */ -void BKE_lib_override_library_clear(struct IDOverrideLibrary *override, const bool do_id_user); +void BKE_lib_override_library_clear(struct IDOverrideLibrary *override, bool do_id_user); /** * Free given \a override. */ -void BKE_lib_override_library_free(struct IDOverrideLibrary **override, const bool do_id_user); +void BKE_lib_override_library_free(struct IDOverrideLibrary **override, bool do_id_user); /** * Check if given ID has some override rules that actually indicate the user edited it. @@ -90,7 +88,7 @@ bool BKE_lib_override_library_is_user_edited(struct ID *id); */ struct ID *BKE_lib_override_library_create_from_id(struct Main *bmain, struct ID *reference_id, - const bool do_tagged_remap); + bool do_tagged_remap); /** * Create overridden local copies of all tagged data-blocks in given Main. * @@ -112,7 +110,7 @@ struct ID *BKE_lib_override_library_create_from_id(struct Main *bmain, */ bool BKE_lib_override_library_create_from_tag(struct Main *bmain, const struct Library *reference_library, - const bool do_no_main); + bool do_no_main); /** * Advanced 'smart' function to create fully functional overrides. * @@ -166,9 +164,9 @@ void BKE_lib_override_library_main_proxy_convert(struct Main *bmain, * Advanced 'smart' function to resync, re-create fully functional overrides up-to-date with linked * data, from an existing override hierarchy. * - * \param id_root: The root liboverride ID to resync from. * \param view_layer: the active view layer to search instantiated collections in, can be NULL (in * which case \a scene's master collection children hierarchy is used instead). + * \param id_root: The root liboverride ID to resync from. * \return true if override was successfully resynced. */ bool BKE_lib_override_library_resync(struct Main *bmain, @@ -176,8 +174,7 @@ bool BKE_lib_override_library_resync(struct Main *bmain, struct ViewLayer *view_layer, struct ID *id_root, struct Collection *override_resync_residual_storage, - const bool do_hierarchy_enforce, - const bool do_post_process, + bool do_hierarchy_enforce, struct BlendFileReadReport *reports); /** * Detect and handle required resync of overrides data, when relations between reference linked IDs @@ -253,21 +250,21 @@ struct IDOverrideLibraryPropertyOperation *BKE_lib_override_library_property_ope struct IDOverrideLibraryProperty *override_property, const char *subitem_refname, const char *subitem_locname, - const int subitem_refindex, - const int subitem_locindex, - const bool strict, + int subitem_refindex, + int subitem_locindex, + bool strict, bool *r_strict); /** * Find override property operation from given sub-item(s), or create it if it does not exist. */ struct IDOverrideLibraryPropertyOperation *BKE_lib_override_library_property_operation_get( struct IDOverrideLibraryProperty *override_property, - const short operation, + short operation, const char *subitem_refname, const char *subitem_locname, - const int subitem_refindex, - const int subitem_locindex, - const bool strict, + int subitem_refindex, + int subitem_locindex, + bool strict, bool *r_strict, bool *r_created); /** @@ -341,7 +338,7 @@ bool BKE_lib_override_library_operations_create(struct Main *bmain, struct ID *l /** * Check all overrides from given \a bmain and create/update overriding operations as needed. */ -bool BKE_lib_override_library_main_operations_create(struct Main *bmain, const bool force_auto); +bool BKE_lib_override_library_main_operations_create(struct Main *bmain, bool force_auto); /** * Reset all overrides in given \a id_root, while preserving ID relations. @@ -356,18 +353,18 @@ void BKE_lib_override_library_id_hierarchy_reset(struct Main *bmain, struct ID * * Set or clear given tag in all operations in that override property data. */ void BKE_lib_override_library_operations_tag(struct IDOverrideLibraryProperty *override_property, - const short tag, - const bool do_set); + short tag, + bool do_set); /** * Set or clear given tag in all properties and operations in that override data. */ void BKE_lib_override_library_properties_tag(struct IDOverrideLibrary *override, - const short tag, - const bool do_set); + short tag, + bool do_set); /** * Set or clear given tag in all properties and operations in that Main's ID override data. */ -void BKE_lib_override_library_main_tag(struct Main *bmain, const short tag, const bool do_set); +void BKE_lib_override_library_main_tag(struct Main *bmain, short tag, bool do_set); /** * Remove all tagged-as-unused properties and operations from that ID override data. diff --git a/source/blender/blenkernel/BKE_lib_query.h b/source/blender/blenkernel/BKE_lib_query.h index 91f72cc0762..d853cb16b13 100644 --- a/source/blender/blenkernel/BKE_lib_query.h +++ b/source/blender/blenkernel/BKE_lib_query.h @@ -153,8 +153,8 @@ void BKE_lib_query_foreachid_process(struct LibraryForeachIDData *data, int cb_flag); int BKE_lib_query_foreachid_process_flags_get(struct LibraryForeachIDData *data); int BKE_lib_query_foreachid_process_callback_flag_override(struct LibraryForeachIDData *data, - const int cb_flag, - const bool do_replace); + int cb_flag, + bool do_replace); #define BKE_LIB_FOREACHID_PROCESS_ID(_data, _id, _cb_flag) \ { \ @@ -202,7 +202,7 @@ void BKE_library_foreach_ID_link( /** * Re-usable function, use when replacing ID's. */ -void BKE_library_update_ID_link_user(struct ID *id_dst, struct ID *id_src, const int cb_flag); +void BKE_library_update_ID_link_user(struct ID *id_dst, struct ID *id_src, int cb_flag); /** * Return the number of times given \a id_user uses/references \a id_used. @@ -222,7 +222,7 @@ int BKE_library_ID_use_ID(struct ID *id_user, struct ID *id_used); * This is a 'simplified' abstract version of #BKE_library_foreach_ID_link() above, * quite useful to reduce useless iterations in some cases. */ -bool BKE_library_id_can_use_idtype(struct ID *id_owner, const short id_type_used); +bool BKE_library_id_can_use_idtype(struct ID *id_owner, short id_type_used); /** * Check whether given ID is used locally (i.e. by another non-linked ID). @@ -257,10 +257,10 @@ void BKE_library_ID_test_usages(struct Main *bmain, * #INDEX_ID_NULL item. */ void BKE_lib_query_unused_ids_tag(struct Main *bmain, - const int tag, - const bool do_local_ids, - const bool do_linked_ids, - const bool do_tag_recursive, + int tag, + bool do_local_ids, + bool do_linked_ids, + bool do_tag_recursive, int *r_num_tagged); /** @@ -272,7 +272,7 @@ void BKE_lib_query_unused_ids_tag(struct Main *bmain, * \param do_init_tag: if \a true, all linked data are checked, if \a false, * only linked data-blocks already tagged with #LIB_TAG_DOIT are checked. */ -void BKE_library_unused_linked_data_set_tag(struct Main *bmain, const bool do_init_tag); +void BKE_library_unused_linked_data_set_tag(struct Main *bmain, bool do_init_tag); /** * Untag linked data blocks used by other untagged linked data-blocks. * Used to detect data-blocks that we can forcefully make local diff --git a/source/blender/blenkernel/BKE_lib_remap.h b/source/blender/blenkernel/BKE_lib_remap.h index 9c8caa0266b..d8842dbce7f 100644 --- a/source/blender/blenkernel/BKE_lib_remap.h +++ b/source/blender/blenkernel/BKE_lib_remap.h @@ -104,11 +104,9 @@ enum { * \note Requiring new_id to be non-null, this *may* not be the case ultimately, * but makes things simpler for now. */ -void BKE_libblock_remap_locked(struct Main *bmain, - void *old_idv, - void *new_idv, - const short remap_flags) ATTR_NONNULL(1, 2); -void BKE_libblock_remap(struct Main *bmain, void *old_idv, void *new_idv, const short remap_flags) +void BKE_libblock_remap_locked(struct Main *bmain, void *old_idv, void *new_idv, short remap_flags) + ATTR_NONNULL(1, 2); +void BKE_libblock_remap(struct Main *bmain, void *old_idv, void *new_idv, short remap_flags) ATTR_NONNULL(1, 2); /** @@ -120,8 +118,8 @@ void BKE_libblock_remap(struct Main *bmain, void *old_idv, void *new_idv, const */ void BKE_libblock_unlink(struct Main *bmain, void *idv, - const bool do_flag_never_null, - const bool do_skip_indirect) ATTR_NONNULL(); + bool do_flag_never_null, + bool do_skip_indirect) ATTR_NONNULL(); /** * Similar to libblock_remap, but only affects IDs used by given \a idv ID. @@ -133,7 +131,7 @@ void BKE_libblock_relink_ex(struct Main *bmain, void *idv, void *old_idv, void *new_idv, - const short remap_flags) ATTR_NONNULL(1, 2); + short remap_flags) ATTR_NONNULL(1, 2); /** * Remaps ID usages of given ID to their `id->newid` pointer if not None, and proceeds recursively @@ -144,7 +142,7 @@ void BKE_libblock_relink_ex(struct Main *bmain, * Very specific usage, not sure we'll keep it on the long run, * currently only used in Object/Collection duplication code. */ -void BKE_libblock_relink_to_newid(struct Main *bmain, struct ID *id, const int remap_flag) +void BKE_libblock_relink_to_newid(struct Main *bmain, struct ID *id, int remap_flag) ATTR_NONNULL(); typedef void (*BKE_library_free_notifier_reference_cb)(const void *); diff --git a/source/blender/blenkernel/BKE_lightprobe.h b/source/blender/blenkernel/BKE_lightprobe.h index 764914ee315..59c5d32c03e 100644 --- a/source/blender/blenkernel/BKE_lightprobe.h +++ b/source/blender/blenkernel/BKE_lightprobe.h @@ -31,7 +31,7 @@ extern "C" { struct LightProbe; struct Main; -void BKE_lightprobe_type_set(struct LightProbe *probe, const short lightprobe_type); +void BKE_lightprobe_type_set(struct LightProbe *probe, short lightprobe_type); void *BKE_lightprobe_add(struct Main *bmain, const char *name); #ifdef __cplusplus diff --git a/source/blender/blenkernel/BKE_linestyle.h b/source/blender/blenkernel/BKE_linestyle.h index eb17ff78688..94a5fde5468 100644 --- a/source/blender/blenkernel/BKE_linestyle.h +++ b/source/blender/blenkernel/BKE_linestyle.h @@ -60,16 +60,16 @@ LineStyleModifier *BKE_linestyle_geometry_modifier_add(FreestyleLineStyle *lines LineStyleModifier *BKE_linestyle_color_modifier_copy(FreestyleLineStyle *linestyle, const LineStyleModifier *m, - const int flag); + int flag); LineStyleModifier *BKE_linestyle_alpha_modifier_copy(FreestyleLineStyle *linestyle, const LineStyleModifier *m, - const int flag); + int flag); LineStyleModifier *BKE_linestyle_thickness_modifier_copy(FreestyleLineStyle *linestyle, const LineStyleModifier *m, - const int flag); + int flag); LineStyleModifier *BKE_linestyle_geometry_modifier_copy(FreestyleLineStyle *linestyle, const LineStyleModifier *m, - const int flag); + int flag); int BKE_linestyle_color_modifier_remove(FreestyleLineStyle *linestyle, LineStyleModifier *modifier); @@ -101,7 +101,7 @@ void BKE_linestyle_modifier_list_color_ramps(FreestyleLineStyle *linestyle, List char *BKE_linestyle_path_to_color_ramp(FreestyleLineStyle *linestyle, struct ColorBand *color_ramp); -bool BKE_linestyle_use_textures(FreestyleLineStyle *linestyle, const bool use_shading_nodes); +bool BKE_linestyle_use_textures(FreestyleLineStyle *linestyle, bool use_shading_nodes); void BKE_linestyle_default_shader(const struct bContext *C, FreestyleLineStyle *linestyle); diff --git a/source/blender/blenkernel/BKE_main.h b/source/blender/blenkernel/BKE_main.h index 41ef5e3f5ba..b7f675e4e97 100644 --- a/source/blender/blenkernel/BKE_main.h +++ b/source/blender/blenkernel/BKE_main.h @@ -212,12 +212,10 @@ void BKE_main_lock(struct Main *bmain); void BKE_main_unlock(struct Main *bmain); /** Generate the mappings between used IDs and their users, and vice-versa. */ -void BKE_main_relations_create(struct Main *bmain, const short flag); +void BKE_main_relations_create(struct Main *bmain, short flag); void BKE_main_relations_free(struct Main *bmain); /** Set or clear given `tag` in all relation entries of given `bmain`. */ -void BKE_main_relations_tag_set(struct Main *bmain, - const eMainIDRelationsEntryTags tag, - const bool value); +void BKE_main_relations_tag_set(struct Main *bmain, eMainIDRelationsEntryTags tag, bool value); /** * Create a #GSet storing all IDs present in given \a bmain, by their pointers. diff --git a/source/blender/blenkernel/BKE_main_idmap.h b/source/blender/blenkernel/BKE_main_idmap.h index 13ddcaa93ba..16b0c710357 100644 --- a/source/blender/blenkernel/BKE_main_idmap.h +++ b/source/blender/blenkernel/BKE_main_idmap.h @@ -56,9 +56,9 @@ enum { * \param old_bmain: If not NULL, its IDs will be added the valid references set. */ struct IDNameLib_Map *BKE_main_idmap_create(struct Main *bmain, - const bool create_valid_ids_set, + bool create_valid_ids_set, struct Main *old_bmain, - const int idmap_types) ATTR_WARN_UNUSED_RESULT + int idmap_types) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1); void BKE_main_idmap_destroy(struct IDNameLib_Map *id_map) ATTR_NONNULL(); @@ -78,8 +78,7 @@ struct ID *BKE_main_idmap_lookup_id(struct IDNameLib_Map *id_map, ATTR_NONNULL(1, 2); struct ID *BKE_main_idmap_lookup_uuid(struct IDNameLib_Map *id_map, - const uint session_uuid) ATTR_WARN_UNUSED_RESULT - ATTR_NONNULL(1); + uint session_uuid) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1); #ifdef __cplusplus } diff --git a/source/blender/blenkernel/BKE_mask.h b/source/blender/blenkernel/BKE_mask.h index 2a2b080217c..e17f7eb4e85 100644 --- a/source/blender/blenkernel/BKE_mask.h +++ b/source/blender/blenkernel/BKE_mask.h @@ -115,7 +115,7 @@ float BKE_mask_spline_project_co(struct MaskSpline *spline, struct MaskSplinePoint *point, float start_u, const float co[2], - const eMaskSign sign); + eMaskSign sign); /** \} */ @@ -144,18 +144,16 @@ void BKE_mask_point_normal(struct MaskSpline *spline, float n[2]); float BKE_mask_point_weight_scalar(struct MaskSpline *spline, struct MaskSplinePoint *point, - const float u); -float BKE_mask_point_weight(struct MaskSpline *spline, - struct MaskSplinePoint *point, - const float u); + float u); +float BKE_mask_point_weight(struct MaskSpline *spline, struct MaskSplinePoint *point, float u); struct MaskSplinePointUW *BKE_mask_point_sort_uw(struct MaskSplinePoint *point, struct MaskSplinePointUW *uw); void BKE_mask_point_add_uw(struct MaskSplinePoint *point, float u, float w); -void BKE_mask_point_select_set(struct MaskSplinePoint *point, const bool do_select); +void BKE_mask_point_select_set(struct MaskSplinePoint *point, bool do_select); void BKE_mask_point_select_set_handle(struct MaskSplinePoint *point, - const eMaskWhichHandle which_handle, - const bool do_select); + eMaskWhichHandle which_handle, + bool do_select); /** \} */ @@ -193,12 +191,12 @@ void BKE_mask_coord_to_image(struct Image *image, /** \name Parenting * \{ */ -void BKE_mask_evaluate(struct Mask *mask, const float ctime, const bool do_newframe); -void BKE_mask_layer_evaluate(struct MaskLayer *masklay, const float ctime, const bool do_newframe); +void BKE_mask_evaluate(struct Mask *mask, float ctime, bool do_newframe); +void BKE_mask_layer_evaluate(struct MaskLayer *masklay, float ctime, bool do_newframe); void BKE_mask_parent_init(struct MaskParent *parent); void BKE_mask_calc_handle_adjacent_interp(struct MaskSpline *spline, struct MaskSplinePoint *point, - const float u); + float u); /** * Calculates the tangent of a point by its previous and next * (ignoring handles - as if its a poly line). @@ -214,7 +212,7 @@ void BKE_mask_calc_handle_point(struct MaskSpline *spline, struct MaskSplinePoin */ void BKE_mask_calc_handle_point_auto(struct MaskSpline *spline, struct MaskSplinePoint *point, - const bool do_recalc_length); + bool do_recalc_length); void BKE_mask_get_handle_point_adjacent(struct MaskSpline *spline, struct MaskSplinePoint *point, struct MaskSplinePoint **r_point_prev, @@ -247,22 +245,21 @@ void BKE_mask_layer_shape_to_mask(struct MaskLayer *masklay, struct MaskLayerSha void BKE_mask_layer_shape_to_mask_interp(struct MaskLayer *masklay, struct MaskLayerShape *masklay_shape_a, struct MaskLayerShape *masklay_shape_b, - const float fac); -struct MaskLayerShape *BKE_mask_layer_shape_find_frame(struct MaskLayer *masklay, const int frame); + float fac); +struct MaskLayerShape *BKE_mask_layer_shape_find_frame(struct MaskLayer *masklay, int frame); /** * When returning 2 - the frame isn't found but before/after frames are. */ int BKE_mask_layer_shape_find_frame_range(struct MaskLayer *masklay, - const float frame, + float frame, struct MaskLayerShape **r_masklay_shape_a, struct MaskLayerShape **r_masklay_shape_b); /** * \note Does *not* add to the list. */ -struct MaskLayerShape *BKE_mask_layer_shape_alloc(struct MaskLayer *masklay, const int frame); +struct MaskLayerShape *BKE_mask_layer_shape_alloc(struct MaskLayer *masklay, int frame); void BKE_mask_layer_shape_free(struct MaskLayerShape *masklay_shape); -struct MaskLayerShape *BKE_mask_layer_shape_verify_frame(struct MaskLayer *masklay, - const int frame); +struct MaskLayerShape *BKE_mask_layer_shape_verify_frame(struct MaskLayer *masklay, int frame); struct MaskLayerShape *BKE_mask_layer_shape_duplicate(struct MaskLayerShape *masklay_shape); void BKE_mask_layer_shape_unlink(struct MaskLayer *masklay, struct MaskLayerShape *masklay_shape); void BKE_mask_layer_shape_sort(struct MaskLayer *masklay); @@ -354,15 +351,14 @@ void BKE_mask_clipboard_paste_to_layer(struct Main *bmain, struct MaskLayer *mas unsigned int BKE_mask_spline_resolution(struct MaskSpline *spline, int width, int height); unsigned int BKE_mask_spline_feather_resolution(struct MaskSpline *spline, int width, int height); -int BKE_mask_spline_differentiate_calc_total(const struct MaskSpline *spline, - const unsigned int resol); +int BKE_mask_spline_differentiate_calc_total(const struct MaskSpline *spline, unsigned int resol); float (*BKE_mask_spline_differentiate_with_resolution(struct MaskSpline *spline, - const unsigned int resol, + unsigned int resol, unsigned int *r_tot_diff_point))[2]; void BKE_mask_spline_feather_collapse_inner_loops(struct MaskSpline *spline, float (*feather_points)[2], - const unsigned int tot_feather_point); + unsigned int tot_feather_point); float (*BKE_mask_spline_differentiate( struct MaskSpline *spline, int width, int height, unsigned int *r_tot_diff_point))[2]; /** @@ -371,8 +367,8 @@ float (*BKE_mask_spline_differentiate( */ float (*BKE_mask_spline_feather_differentiated_points_with_resolution( struct MaskSpline *spline, - const unsigned int resol, - const bool do_feather_isect, + unsigned int resol, + bool do_feather_isect, unsigned int *r_tot_feather_point))[2]; /* *** mask point functions which involve evaluation *** */ @@ -393,8 +389,8 @@ float *BKE_mask_point_segment_feather_diff(struct MaskSpline *spline, int height, unsigned int *tot_feather_point); -void BKE_mask_layer_evaluate_animation(struct MaskLayer *masklay, const float ctime); -void BKE_mask_layer_evaluate_deform(struct MaskLayer *masklay, const float ctime); +void BKE_mask_layer_evaluate_animation(struct MaskLayer *masklay, float ctime); +void BKE_mask_layer_evaluate_deform(struct MaskLayer *masklay, float ctime); void BKE_mask_eval_animation(struct Depsgraph *depsgraph, struct Mask *mask); void BKE_mask_eval_update(struct Depsgraph *depsgraph, struct Mask *mask); @@ -414,19 +410,19 @@ MaskRasterHandle *BKE_maskrasterize_handle_new(void); void BKE_maskrasterize_handle_free(MaskRasterHandle *mr_handle); void BKE_maskrasterize_handle_init(MaskRasterHandle *mr_handle, struct Mask *mask, - const int width, - const int height, - const bool do_aspect_correct, - const bool do_mask_aa, - const bool do_feather); + int width, + int height, + bool do_aspect_correct, + bool do_mask_aa, + bool do_feather); float BKE_maskrasterize_handle_sample(MaskRasterHandle *mr_handle, const float xy[2]); /** * \brief Rasterize a buffer from a single mask (threaded execution). */ void BKE_maskrasterize_buffer(MaskRasterHandle *mr_handle, - const unsigned int width, - const unsigned int height, + unsigned int width, + unsigned int height, float *buffer); /** \} */ diff --git a/source/blender/blenkernel/BKE_material.h b/source/blender/blenkernel/BKE_material.h index 5f9007c79b0..11746f445e4 100644 --- a/source/blender/blenkernel/BKE_material.h +++ b/source/blender/blenkernel/BKE_material.h @@ -51,7 +51,7 @@ void BKE_object_materials_test(struct Main *bmain, struct Object *ob, struct ID void BKE_objects_materials_test_all(struct Main *bmain, struct ID *id); void BKE_object_material_resize(struct Main *bmain, struct Object *ob, - const short totcol, + short totcol, bool do_id_user); void BKE_object_material_remap(struct Object *ob, const unsigned int *remap); /** @@ -110,7 +110,7 @@ void BKE_object_material_array_assign(struct Main *bmain, struct Object *ob, struct Material ***matar, int totcol, - const bool to_object_only); + bool to_object_only); short BKE_object_material_slot_find_index(struct Object *ob, struct Material *ma); bool BKE_object_material_slot_add(struct Main *bmain, struct Object *ob); @@ -172,7 +172,7 @@ void BKE_id_material_eval_ensure_default_slot(struct ID *id); * \param col: new value. * \param fac: Zero for is no change. */ -void ramp_blend(int type, float r_col[3], const float fac, const float col[3]); +void ramp_blend(int type, float r_col[3], float fac, const float col[3]); /** \} */ diff --git a/source/blender/blenkernel/BKE_mball.h b/source/blender/blenkernel/BKE_mball.h index 895fe5a28f9..fb72b361a0a 100644 --- a/source/blender/blenkernel/BKE_mball.h +++ b/source/blender/blenkernel/BKE_mball.h @@ -82,18 +82,15 @@ float *BKE_mball_make_orco(struct Object *ob, struct ListBase *dispbase); * meta-ball, because this meta-ball influence polygonization of meta-balls. */ void BKE_mball_properties_copy(struct Scene *scene, struct Object *active_object); -bool BKE_mball_minmax_ex(const struct MetaBall *mb, - float min[3], - float max[3], - const float obmat[4][4], - const short flag); +bool BKE_mball_minmax_ex( + const struct MetaBall *mb, float min[3], float max[3], const float obmat[4][4], short flag); /* Basic vertex data functions. */ bool BKE_mball_minmax(const struct MetaBall *mb, float min[3], float max[3]); bool BKE_mball_center_median(const struct MetaBall *mb, float r_cent[3]); bool BKE_mball_center_bounds(const struct MetaBall *mb, float r_cent[3]); -void BKE_mball_transform(struct MetaBall *mb, const float mat[4][4], const bool do_props); +void BKE_mball_transform(struct MetaBall *mb, const float mat[4][4], bool do_props); void BKE_mball_translate(struct MetaBall *mb, const float offset[3]); /** @@ -101,7 +98,7 @@ void BKE_mball_translate(struct MetaBall *mb, const float offset[3]); * * \note don't do context manipulation here (rna uses). */ -struct MetaElem *BKE_mball_element_add(struct MetaBall *mb, const int type); +struct MetaElem *BKE_mball_element_add(struct MetaBall *mb, int type); /* *** select funcs *** */ diff --git a/source/blender/blenkernel/BKE_mesh.h b/source/blender/blenkernel/BKE_mesh.h index 2ccd317e3e4..5f3fcb535b2 100644 --- a/source/blender/blenkernel/BKE_mesh.h +++ b/source/blender/blenkernel/BKE_mesh.h @@ -74,7 +74,7 @@ struct BMesh *BKE_mesh_to_bmesh_ex(const struct Mesh *me, const struct BMeshFromMeshParams *convert_params); struct BMesh *BKE_mesh_to_bmesh(struct Mesh *me, struct Object *ob, - const bool add_key_index, + bool add_key_index, const struct BMeshCreateParams *params); struct Mesh *BKE_mesh_from_bmesh_nomain(struct BMesh *bm, @@ -130,7 +130,7 @@ void BKE_mesh_copy_parameters_for_eval(struct Mesh *me_dst, const struct Mesh *m * when a new mesh is based on an existing mesh. */ void BKE_mesh_copy_parameters(struct Mesh *me_dst, const struct Mesh *me_src); -void BKE_mesh_update_customdata_pointers(struct Mesh *me, const bool do_ensure_tess_cd); +void BKE_mesh_update_customdata_pointers(struct Mesh *me, bool do_ensure_tess_cd); void BKE_mesh_ensure_skin_customdata(struct Mesh *me); struct Mesh *BKE_mesh_new_nomain( @@ -189,7 +189,7 @@ void BKE_mesh_assign_object(struct Main *bmain, struct Object *ob, struct Mesh * void BKE_mesh_from_metaball(struct ListBase *lb, struct Mesh *me); void BKE_mesh_to_curve_nurblist(const struct Mesh *me, struct ListBase *nurblist, - const int edge_users_test); + int edge_users_test); void BKE_mesh_to_curve(struct Main *bmain, struct Depsgraph *depsgraph, struct Scene *scene, @@ -208,7 +208,7 @@ void BKE_mesh_material_index_remove(struct Mesh *me, short index); bool BKE_mesh_material_index_used(struct Mesh *me, short index); void BKE_mesh_material_index_clear(struct Mesh *me); void BKE_mesh_material_remap(struct Mesh *me, const unsigned int *remap, unsigned int remap_len); -void BKE_mesh_smooth_flag_set(struct Mesh *me, const bool use_smooth); +void BKE_mesh_smooth_flag_set(struct Mesh *me, bool use_smooth); /** * Needed after converting a mesh with subsurf optimal display to mesh. @@ -254,8 +254,8 @@ void BKE_mesh_split_faces(struct Mesh *mesh, bool free_loop_normals); */ struct Mesh *BKE_mesh_new_from_object(struct Depsgraph *depsgraph, struct Object *object, - const bool preserve_all_data_layers, - const bool preserve_origindex); + bool preserve_all_data_layers, + bool preserve_origindex); /** * This is a version of BKE_mesh_new_from_object() which stores mesh in the given main database. @@ -276,8 +276,8 @@ struct Mesh *BKE_mesh_create_derived_for_modifier(struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob_eval, struct ModifierData *md_eval, - const bool use_virtual_modifiers, - const bool build_shapekey_layers); + bool use_virtual_modifiers, + bool build_shapekey_layers); /** * Copies a nomain-Mesh into an existing Mesh. @@ -294,7 +294,7 @@ void BKE_mesh_nomain_to_meshkey(struct Mesh *mesh_src, struct Mesh *mesh_dst, st /* basic vertex data functions */ bool BKE_mesh_minmax(const struct Mesh *me, float r_min[3], float r_max[3]); void BKE_mesh_transform(struct Mesh *me, const float mat[4][4], bool do_keys); -void BKE_mesh_translate(struct Mesh *me, const float offset[3], const bool do_keys); +void BKE_mesh_translate(struct Mesh *me, const float offset[3], bool do_keys); void BKE_mesh_tessface_ensure(struct Mesh *mesh); void BKE_mesh_tessface_clear(struct Mesh *mesh); @@ -344,7 +344,7 @@ int BKE_mesh_tessface_calc_ex(struct CustomData *fdata, int totface, int totloop, int totpoly, - const bool do_face_nor_copy); + bool do_face_nor_copy); void BKE_mesh_tessface_calc(struct Mesh *mesh); /** @@ -410,7 +410,7 @@ void BKE_mesh_loop_manifold_fan_around_vert_next(const struct MLoop *mloops, const struct MPoly *mpolys, const int *loop_to_poly, const int *e2lfan_curr, - const uint mv_pivot_index, + uint mv_pivot_index, const struct MLoop **r_mlfan_curr, int *r_mlfan_curr_index, int *r_mlfan_vert_index, @@ -423,15 +423,15 @@ void BKE_mesh_loop_manifold_fan_around_vert_next(const struct MLoop *mloops, * to keep same shading as with auto-smooth! */ void BKE_edges_sharp_from_angle_set(const struct MVert *mverts, - const int numVerts, + int numVerts, struct MEdge *medges, - const int numEdges, + int numEdges, struct MLoop *mloops, - const int numLoops, + int numLoops, struct MPoly *mpolys, const float (*polynors)[3], - const int numPolys, - const float split_angle); + int numPolys, + float split_angle); /** * References a contiguous loop-fan with normal offset vars. @@ -484,9 +484,7 @@ enum { }; /* Low-level custom normals functions. */ -void BKE_lnor_spacearr_init(MLoopNorSpaceArray *lnors_spacearr, - const int numLoops, - const char data_type); +void BKE_lnor_spacearr_init(MLoopNorSpaceArray *lnors_spacearr, int numLoops, char data_type); void BKE_lnor_spacearr_clear(MLoopNorSpaceArray *lnors_spacearr); void BKE_lnor_spacearr_free(MLoopNorSpaceArray *lnors_spacearr); @@ -528,9 +526,9 @@ void BKE_lnor_space_define(MLoopNorSpace *lnor_space, */ void BKE_lnor_space_add_loop(MLoopNorSpaceArray *lnors_spacearr, MLoopNorSpace *lnor_space, - const int ml_index, + int ml_index, void *bm_loop, - const bool is_single); + bool is_single); void BKE_lnor_space_custom_data_to_normal(MLoopNorSpace *lnor_space, const short clnor_data[2], float r_custom_lnor[3]); @@ -546,42 +544,42 @@ void BKE_lnor_space_custom_normal_to_data(MLoopNorSpace *lnor_space, * (splitting edges). */ void BKE_mesh_normals_loop_split(const struct MVert *mverts, - const int numVerts, + int numVerts, struct MEdge *medges, - const int numEdges, + int numEdges, struct MLoop *mloops, float (*r_loopnors)[3], - const int numLoops, + int numLoops, struct MPoly *mpolys, const float (*polynors)[3], - const int numPolys, - const bool use_split_normals, - const float split_angle, + int numPolys, + bool use_split_normals, + float split_angle, MLoopNorSpaceArray *r_lnors_spacearr, short (*clnors_data)[2], int *r_loop_to_poly); void BKE_mesh_normals_loop_custom_set(const struct MVert *mverts, - const int numVerts, + int numVerts, struct MEdge *medges, - const int numEdges, + int numEdges, struct MLoop *mloops, float (*r_custom_loopnors)[3], - const int numLoops, + int numLoops, struct MPoly *mpolys, const float (*polynors)[3], - const int numPolys, + int numPolys, short (*r_clnors_data)[2]); void BKE_mesh_normals_loop_custom_from_vertices_set(const struct MVert *mverts, float (*r_custom_vertnors)[3], - const int numVerts, + int numVerts, struct MEdge *medges, - const int numEdges, + int numEdges, struct MLoop *mloops, - const int numLoops, + int numLoops, struct MPoly *mpolys, const float (*polynors)[3], - const int numPolys, + int numPolys, short (*r_clnors_data)[2]); /** @@ -590,9 +588,9 @@ void BKE_mesh_normals_loop_custom_from_vertices_set(const struct MVert *mverts, * \param clnors: The computed custom loop normals. * \param r_vert_clnors: The (already allocated) array where to store averaged per-vertex normals. */ -void BKE_mesh_normals_loop_to_vertex(const int numVerts, +void BKE_mesh_normals_loop_to_vertex(int numVerts, const struct MLoop *mloops, - const int numLoops, + int numLoops, const float (*clnors)[3], float (*r_vert_clnors)[3]); @@ -682,9 +680,9 @@ bool BKE_mesh_center_of_volume(const struct Mesh *me, float r_cent[3]); * \param r_center: Center of mass. */ void BKE_mesh_calc_volume(const struct MVert *mverts, - const int mverts_num, + int mverts_num, const struct MLoopTri *mlooptri, - const int looptri_num, + int looptri_num, const struct MLoop *mloop, float *r_volume, float r_center[3]); @@ -724,7 +722,7 @@ void BKE_mesh_convert_mfaces_to_mpolys_ex(struct ID *id, * Flip a single MLoop's #MDisps structure, * low level function to be called from face-flipping code which re-arranged the mdisps themselves. */ -void BKE_mesh_mdisp_flip(struct MDisps *md, const bool use_loop_mdisp_flip); +void BKE_mesh_mdisp_flip(struct MDisps *md, bool use_loop_mdisp_flip); /** * Flip (invert winding of) the given \a mpoly, i.e. reverse order of its loops @@ -739,7 +737,7 @@ void BKE_mesh_polygon_flip_ex(struct MPoly *mpoly, struct CustomData *ldata, float (*lnors)[3], struct MDisps *mdisp, - const bool use_loop_mdisp_flip); + bool use_loop_mdisp_flip); void BKE_mesh_polygon_flip(struct MPoly *mpoly, struct MLoop *mloop, struct CustomData *ldata); /** * Flip (invert winding of) all polygons (used to inverse their normals). @@ -792,8 +790,8 @@ enum { */ struct Mesh *BKE_mesh_merge_verts(struct Mesh *mesh, const int *vtargetmap, - const int tot_vtargetmap, - const int merge_mode); + int tot_vtargetmap, + int merge_mode); /* Flush flags. */ @@ -803,35 +801,35 @@ struct Mesh *BKE_mesh_merge_verts(struct Mesh *mesh, void BKE_mesh_flush_hidden_from_verts_ex(const struct MVert *mvert, const struct MLoop *mloop, struct MEdge *medge, - const int totedge, + int totedge, struct MPoly *mpoly, - const int totpoly); + int totpoly); void BKE_mesh_flush_hidden_from_verts(struct Mesh *me); void BKE_mesh_flush_hidden_from_polys_ex(struct MVert *mvert, const struct MLoop *mloop, struct MEdge *medge, - const int totedge, + int totedge, const struct MPoly *mpoly, - const int totpoly); + int totpoly); void BKE_mesh_flush_hidden_from_polys(struct Mesh *me); /** * simple poly -> vert/edge selection. */ void BKE_mesh_flush_select_from_polys_ex(struct MVert *mvert, - const int totvert, + int totvert, const struct MLoop *mloop, struct MEdge *medge, - const int totedge, + int totedge, const struct MPoly *mpoly, - const int totpoly); + int totpoly); void BKE_mesh_flush_select_from_polys(struct Mesh *me); void BKE_mesh_flush_select_from_verts_ex(const struct MVert *mvert, - const int totvert, + int totvert, const struct MLoop *mloop, struct MEdge *medge, - const int totedge, + int totedge, struct MPoly *mpoly, - const int totpoly); + int totpoly); void BKE_mesh_flush_select_from_verts(struct Mesh *me); /* spatial evaluation */ @@ -847,9 +845,9 @@ void BKE_mesh_flush_select_from_verts(struct Mesh *me); * \param vert_cos_new: resulting coords. */ void BKE_mesh_calc_relative_deform(const struct MPoly *mpoly, - const int totpoly, + int totpoly, const struct MLoop *mloop, - const int totvert, + int totvert, const float (*vert_cos_src)[3], const float (*vert_cos_dst)[3], @@ -864,7 +862,7 @@ void BKE_mesh_calc_relative_deform(const struct MPoly *mpoly, * * \returns true if a change is made. */ -bool BKE_mesh_validate(struct Mesh *me, const bool do_verbose, const bool cddata_check_mask); +bool BKE_mesh_validate(struct Mesh *me, bool do_verbose, bool cddata_check_mask); /** * Checks if a Mesh is valid without any modification. This is always verbose. * \returns True if the mesh is valid. @@ -903,24 +901,24 @@ bool BKE_mesh_validate_arrays(struct Mesh *me, struct MPoly *mpolys, unsigned int totpoly, struct MDeformVert *dverts, /* assume totvert length */ - const bool do_verbose, - const bool do_fixes, + bool do_verbose, + bool do_fixes, bool *r_change); /** * \returns is_valid. */ bool BKE_mesh_validate_all_customdata(struct CustomData *vdata, - const uint totvert, + uint totvert, struct CustomData *edata, - const uint totedge, + uint totedge, struct CustomData *ldata, - const uint totloop, + uint totloop, struct CustomData *pdata, - const uint totpoly, - const bool check_meshmask, - const bool do_verbose, - const bool do_fixes, + uint totpoly, + bool check_meshmask, + bool do_verbose, + bool do_fixes, bool *r_change); void BKE_mesh_strip_loose_faces(struct Mesh *me); @@ -938,12 +936,12 @@ void BKE_mesh_strip_loose_edges(struct Mesh *me); * If the mesh is from a very old blender version, * convert mface->edcode to edge drawflags */ -void BKE_mesh_calc_edges_legacy(struct Mesh *me, const bool use_old); +void BKE_mesh_calc_edges_legacy(struct Mesh *me, bool use_old); void BKE_mesh_calc_edges_loose(struct Mesh *mesh); /** * Calculate edges from polygons. */ -void BKE_mesh_calc_edges(struct Mesh *mesh, bool keep_existing_edges, const bool select_new_edges); +void BKE_mesh_calc_edges(struct Mesh *mesh, bool keep_existing_edges, bool select_new_edges); /** * Calculate/create edges from tessface data * @@ -953,7 +951,7 @@ void BKE_mesh_calc_edges_tessface(struct Mesh *mesh); /* In DerivedMesh.cc */ void BKE_mesh_wrapper_deferred_finalize(struct Mesh *me_eval, - const CustomData_MeshMasks *cd_mask_finalize); + const struct CustomData_MeshMasks *cd_mask_finalize); /* **** Depsgraph evaluation **** */ diff --git a/source/blender/blenkernel/BKE_mesh_boolean_convert.hh b/source/blender/blenkernel/BKE_mesh_boolean_convert.hh index a7a7529f217..5a743999803 100644 --- a/source/blender/blenkernel/BKE_mesh_boolean_convert.hh +++ b/source/blender/blenkernel/BKE_mesh_boolean_convert.hh @@ -46,8 +46,8 @@ Mesh *direct_mesh_boolean(blender::Span<const Mesh *> meshes, blender::Span<const float4x4 *> obmats, const float4x4 &target_transform, blender::Span<blender::Array<short>> material_remaps, - const bool use_self, - const bool hole_tolerant, - const int boolean_mode); + bool use_self, + bool hole_tolerant, + int boolean_mode); } // namespace blender::meshintersect diff --git a/source/blender/blenkernel/BKE_mesh_fair.h b/source/blender/blenkernel/BKE_mesh_fair.h index 2d5c85d4129..c4c1af054f0 100644 --- a/source/blender/blenkernel/BKE_mesh_fair.h +++ b/source/blender/blenkernel/BKE_mesh_fair.h @@ -42,14 +42,14 @@ typedef enum eMeshFairingDepth { * the vertex should be modified by fairing. */ void BKE_bmesh_prefair_and_fair_vertices(struct BMesh *bm, bool *affect_vertices, - const eMeshFairingDepth depth); + eMeshFairingDepth depth); /* This function can optionally use the MVert coordinates of deform_mverts to read and write the * fairing result. When NULL, the function will use mesh->mverts directly. */ void BKE_mesh_prefair_and_fair_vertices(struct Mesh *mesh, struct MVert *deform_mverts, bool *affect_vertices, - const eMeshFairingDepth depth); + eMeshFairingDepth depth); #ifdef __cplusplus } diff --git a/source/blender/blenkernel/BKE_mesh_iterators.h b/source/blender/blenkernel/BKE_mesh_iterators.h index 83f0228dc76..d20849557c1 100644 --- a/source/blender/blenkernel/BKE_mesh_iterators.h +++ b/source/blender/blenkernel/BKE_mesh_iterators.h @@ -68,9 +68,7 @@ void BKE_mesh_foreach_mapped_subdiv_face_center( void *userData, MeshForeachFlag flag); -void BKE_mesh_foreach_mapped_vert_coords_get(struct Mesh *me_eval, - float (*r_cos)[3], - const int totcos); +void BKE_mesh_foreach_mapped_vert_coords_get(struct Mesh *me_eval, float (*r_cos)[3], int totcos); #ifdef __cplusplus } diff --git a/source/blender/blenkernel/BKE_mesh_mapping.h b/source/blender/blenkernel/BKE_mesh_mapping.h index acc1628de1d..48669278e23 100644 --- a/source/blender/blenkernel/BKE_mesh_mapping.h +++ b/source/blender/blenkernel/BKE_mesh_mapping.h @@ -100,8 +100,8 @@ UvVertMap *BKE_mesh_uv_vert_map_create(const struct MPoly *mpoly, unsigned int totpoly, unsigned int totvert, const float limit[2], - const bool selected, - const bool use_winding); + bool selected, + bool use_winding); UvMapVert *BKE_mesh_uv_vert_map_get_vert(UvVertMap *vmap, unsigned int v); void BKE_mesh_uv_vert_map_free(UvVertMap *vmap); @@ -137,11 +137,11 @@ void BKE_mesh_vert_loop_map_create(MeshElemMap **r_map, void BKE_mesh_vert_looptri_map_create(MeshElemMap **r_map, int **r_mem, const struct MVert *mvert, - const int totvert, + int totvert, const struct MLoopTri *mlooptri, - const int totlooptri, + int totlooptri, const struct MLoop *mloop, - const int totloop); + int totloop); /** * Generates a map where the key is the vertex and the value * is a list of edges that use that vertex as an endpoint. @@ -163,11 +163,11 @@ void BKE_mesh_vert_edge_vert_map_create( void BKE_mesh_edge_loop_map_create(MeshElemMap **r_map, int **r_mem, const struct MEdge *medge, - const int totedge, + int totedge, const struct MPoly *mpoly, - const int totpoly, + int totpoly, const struct MLoop *mloop, - const int totloop); + int totloop); /** * Generates a map where the key is the edge and the value * is a list of polygons that use that edge. @@ -176,11 +176,11 @@ void BKE_mesh_edge_loop_map_create(MeshElemMap **r_map, void BKE_mesh_edge_poly_map_create(MeshElemMap **r_map, int **r_mem, const struct MEdge *medge, - const int totedge, + int totedge, const struct MPoly *mpoly, - const int totpoly, + int totpoly, const struct MLoop *mloop, - const int totloop); + int totloop); /** * This function creates a map so the source-data (vert/edge/loop/poly) * can loop over the destination data (using the destination arrays origindex). @@ -195,11 +195,8 @@ void BKE_mesh_edge_poly_map_create(MeshElemMap **r_map, * `totfinal` could be `tottessface` and `final_origindex` its ORIGINDEX custom-data. * This would allow an MPoly to loop over its tessfaces. */ -void BKE_mesh_origindex_map_create(MeshElemMap **r_map, - int **r_mem, - const int totsource, - const int *final_origindex, - const int totfinal); +void BKE_mesh_origindex_map_create( + MeshElemMap **r_map, int **r_mem, int totsource, const int *final_origindex, int totfinal); /** * A version of #BKE_mesh_origindex_map_create that takes a looptri array. * Making a poly -> looptri map. @@ -207,9 +204,9 @@ void BKE_mesh_origindex_map_create(MeshElemMap **r_map, void BKE_mesh_origindex_map_create_looptri(MeshElemMap **r_map, int **r_mem, const struct MPoly *mpoly, - const int mpoly_num, + int mpoly_num, const struct MLoopTri *looptri, - const int looptri_num); + int looptri_num); /* islands */ @@ -239,28 +236,28 @@ typedef struct MeshIslandStore { } MeshIslandStore; void BKE_mesh_loop_islands_init(MeshIslandStore *island_store, - const short item_type, - const int items_num, - const short island_type, - const short innercut_type); + short item_type, + int items_num, + short island_type, + short innercut_type); void BKE_mesh_loop_islands_clear(MeshIslandStore *island_store); void BKE_mesh_loop_islands_free(MeshIslandStore *island_store); void BKE_mesh_loop_islands_add(MeshIslandStore *island_store, - const int item_num, + int item_num, const int *items_indices, - const int num_island_items, + int num_island_items, int *island_item_indices, - const int num_innercut_items, + int num_innercut_items, int *innercut_item_indices); typedef bool (*MeshRemapIslandsCalc)(struct MVert *verts, - const int totvert, + int totvert, struct MEdge *edges, - const int totedge, + int totedge, struct MPoly *polys, - const int totpoly, + int totpoly, struct MLoop *loops, - const int totloop, + int totloop, struct MeshIslandStore *r_island_store); /* Above vert/UV mapping stuff does not do what we need here, but does things we do not need here. @@ -271,13 +268,13 @@ typedef bool (*MeshRemapIslandsCalc)(struct MVert *verts, * not some UV layers coordinates. */ bool BKE_mesh_calc_islands_loop_poly_edgeseam(struct MVert *verts, - const int totvert, + int totvert, struct MEdge *edges, - const int totedge, + int totedge, struct MPoly *polys, - const int totpoly, + int totpoly, struct MLoop *loops, - const int totloop, + int totloop, MeshIslandStore *r_island_store); /** @@ -294,13 +291,13 @@ bool BKE_mesh_calc_islands_loop_poly_edgeseam(struct MVert *verts, * those loops are supposed to be really quick to do. */ bool BKE_mesh_calc_islands_loop_poly_uvmap(struct MVert *verts, - const int totvert, + int totvert, struct MEdge *edges, - const int totedge, + int totedge, struct MPoly *polys, - const int totpoly, + int totpoly, struct MLoop *loops, - const int totloop, + int totloop, const struct MLoopUV *luvs, MeshIslandStore *r_island_store); @@ -313,13 +310,13 @@ bool BKE_mesh_calc_islands_loop_poly_uvmap(struct MVert *verts, * Note it's callers's responsibility to MEM_freeN returned array. */ int *BKE_mesh_calc_smoothgroups(const struct MEdge *medge, - const int totedge, + int totedge, const struct MPoly *mpoly, - const int totpoly, + int totpoly, const struct MLoop *mloop, - const int totloop, + int totloop, int *r_totgroup, - const bool use_bitflags); + bool use_bitflags); /* use on looptri vertex values */ #define BKE_MESH_TESSTRI_VINDEX_ORDER(_tri, _v) \ diff --git a/source/blender/blenkernel/BKE_mesh_mirror.h b/source/blender/blenkernel/BKE_mesh_mirror.h index abb8e4d3e44..c77974d6cc1 100644 --- a/source/blender/blenkernel/BKE_mesh_mirror.h +++ b/source/blender/blenkernel/BKE_mesh_mirror.h @@ -40,19 +40,18 @@ struct Mesh *BKE_mesh_mirror_bisect_on_mirror_plane_for_modifier(struct MirrorMo void BKE_mesh_mirror_apply_mirror_on_axis(struct Main *bmain, struct Mesh *mesh, - const int axis, - const float dist); + int axis, + float dist); /** * \warning This should _not_ be used to modify original meshes since * it doesn't handle shape-keys, use #BKE_mesh_mirror_apply_mirror_on_axis instead. */ -struct Mesh *BKE_mesh_mirror_apply_mirror_on_axis_for_modifier( - struct MirrorModifierData *mmd, - struct Object *ob, - const struct Mesh *mesh, - const int axis, - const bool use_correct_order_on_merge); +struct Mesh *BKE_mesh_mirror_apply_mirror_on_axis_for_modifier(struct MirrorModifierData *mmd, + struct Object *ob, + const struct Mesh *mesh, + int axis, + bool use_correct_order_on_merge); #ifdef __cplusplus } diff --git a/source/blender/blenkernel/BKE_mesh_remap.h b/source/blender/blenkernel/BKE_mesh_remap.h index c33b3800aa4..84abeac0d13 100644 --- a/source/blender/blenkernel/BKE_mesh_remap.h +++ b/source/blender/blenkernel/BKE_mesh_remap.h @@ -50,10 +50,10 @@ typedef struct MeshPairRemap { } MeshPairRemap; /* Helpers! */ -void BKE_mesh_remap_init(MeshPairRemap *map, const int items_num); +void BKE_mesh_remap_init(MeshPairRemap *map, int items_num); void BKE_mesh_remap_free(MeshPairRemap *map); -void BKE_mesh_remap_item_define_invalid(MeshPairRemap *map, const int index); +void BKE_mesh_remap_item_define_invalid(MeshPairRemap *map, int index); /* TODO: * Add other 'from/to' mapping sources, like e.g. using an UVMap, etc. @@ -155,10 +155,10 @@ enum { }; void BKE_mesh_remap_calc_source_cddata_masks_from_map_modes( - const int vert_mode, - const int edge_mode, - const int loop_mode, - const int poly_mode, + int vert_mode, + int edge_mode, + int loop_mode, + int poly_mode, struct CustomData_MeshMasks *cddata_mask); /** @@ -173,73 +173,73 @@ void BKE_mesh_remap_calc_source_cddata_masks_from_map_modes( */ float BKE_mesh_remap_calc_difference_from_mesh(const struct SpaceTransform *space_transform, const struct MVert *verts_dst, - const int numverts_dst, + int numverts_dst, struct Mesh *me_src); /** * Set r_space_transform so that best bbox of dst matches best bbox of src. */ void BKE_mesh_remap_find_best_match_from_mesh(const struct MVert *verts_dst, - const int numverts_dst, + int numverts_dst, struct Mesh *me_src, struct SpaceTransform *r_space_transform); -void BKE_mesh_remap_calc_verts_from_mesh(const int mode, +void BKE_mesh_remap_calc_verts_from_mesh(int mode, const struct SpaceTransform *space_transform, - const float max_dist, - const float ray_radius, + float max_dist, + float ray_radius, const struct MVert *verts_dst, - const int numverts_dst, - const bool dirty_nors_dst, + int numverts_dst, + bool dirty_nors_dst, struct Mesh *me_src, MeshPairRemap *r_map); -void BKE_mesh_remap_calc_edges_from_mesh(const int mode, +void BKE_mesh_remap_calc_edges_from_mesh(int mode, const struct SpaceTransform *space_transform, - const float max_dist, - const float ray_radius, + float max_dist, + float ray_radius, const struct MVert *verts_dst, - const int numverts_dst, + int numverts_dst, const struct MEdge *edges_dst, - const int numedges_dst, - const bool dirty_nors_dst, + int numedges_dst, + bool dirty_nors_dst, struct Mesh *me_src, MeshPairRemap *r_map); -void BKE_mesh_remap_calc_loops_from_mesh(const int mode, +void BKE_mesh_remap_calc_loops_from_mesh(int mode, const struct SpaceTransform *space_transform, - const float max_dist, - const float ray_radius, + float max_dist, + float ray_radius, struct MVert *verts_dst, - const int numverts_dst, + int numverts_dst, struct MEdge *edges_dst, - const int numedges_dst, + int numedges_dst, struct MLoop *loops_dst, - const int numloops_dst, + int numloops_dst, struct MPoly *polys_dst, - const int numpolys_dst, + int numpolys_dst, struct CustomData *ldata_dst, struct CustomData *pdata_dst, - const bool use_split_nors_dst, - const float split_angle_dst, - const bool dirty_nors_dst, + bool use_split_nors_dst, + float split_angle_dst, + bool dirty_nors_dst, struct Mesh *me_src, MeshRemapIslandsCalc gen_islands_src, - const float islands_precision_src, + float islands_precision_src, struct MeshPairRemap *r_map); -void BKE_mesh_remap_calc_polys_from_mesh(const int mode, +void BKE_mesh_remap_calc_polys_from_mesh(int mode, const struct SpaceTransform *space_transform, - const float max_dist, - const float ray_radius, + float max_dist, + float ray_radius, struct MVert *verts_dst, - const int numverts_dst, + int numverts_dst, struct MLoop *loops_dst, - const int numloops_dst, + int numloops_dst, struct MPoly *polys_dst, - const int numpolys_dst, + int numpolys_dst, struct CustomData *pdata_dst, - const bool dirty_nors_dst, + bool dirty_nors_dst, struct Mesh *me_src, struct MeshPairRemap *r_map); diff --git a/source/blender/blenkernel/BKE_mesh_runtime.h b/source/blender/blenkernel/BKE_mesh_runtime.h index 764241e7f92..75544bf4075 100644 --- a/source/blender/blenkernel/BKE_mesh_runtime.h +++ b/source/blender/blenkernel/BKE_mesh_runtime.h @@ -56,7 +56,7 @@ void BKE_mesh_runtime_free_data(struct Mesh *mesh); * However, keep all the flags which defines what the mesh is (for example, that * it's deformed only, or that its custom data layers are out of date.) */ -void BKE_mesh_runtime_reset_on_copy(struct Mesh *mesh, const int flag); +void BKE_mesh_runtime_reset_on_copy(struct Mesh *mesh, int flag); int BKE_mesh_runtime_looptri_len(const struct Mesh *mesh); void BKE_mesh_runtime_looptri_recalc(struct Mesh *mesh); /** diff --git a/source/blender/blenkernel/BKE_mesh_sample.hh b/source/blender/blenkernel/BKE_mesh_sample.hh index 17f8e766724..238b6f4dcae 100644 --- a/source/blender/blenkernel/BKE_mesh_sample.hh +++ b/source/blender/blenkernel/BKE_mesh_sample.hh @@ -89,8 +89,8 @@ class MeshAttributeInterpolator { const Span<int> looptri_indices); void sample_data(const GVArray &src, - const AttributeDomain domain, - const eAttributeMapMode mode, + AttributeDomain domain, + eAttributeMapMode mode, const GMutableSpan dst); void sample_attribute(const ReadAttributeLookup &src_attribute, diff --git a/source/blender/blenkernel/BKE_mesh_tangent.h b/source/blender/blenkernel/BKE_mesh_tangent.h index 39d4072085c..8a7562ea3fb 100644 --- a/source/blender/blenkernel/BKE_mesh_tangent.h +++ b/source/blender/blenkernel/BKE_mesh_tangent.h @@ -32,14 +32,14 @@ struct ReportList; * NOTE: * The mesh should be made of only tris and quads! */ void BKE_mesh_calc_loop_tangent_single_ex(const struct MVert *mverts, - const int numVerts, + int numVerts, const struct MLoop *mloops, float (*r_looptangent)[4], float (*loopnors)[3], const struct MLoopUV *loopuv, - const int numLoops, + int numLoops, const struct MPoly *mpolys, - const int numPolys, + int numPolys, struct ReportList *reports); /** * Wrapper around BKE_mesh_calc_loop_tangent_single_ex, which takes care of most boiling code. @@ -57,10 +57,10 @@ void BKE_mesh_calc_loop_tangent_single(struct Mesh *mesh, */ void BKE_mesh_calc_loop_tangent_ex(const struct MVert *mvert, const struct MPoly *mpoly, - const uint mpoly_len, + uint mpoly_len, const struct MLoop *mloop, const struct MLoopTri *looptri, - const uint looptri_len, + uint looptri_len, struct CustomData *loopdata, bool calc_active_tangent, @@ -71,7 +71,7 @@ void BKE_mesh_calc_loop_tangent_ex(const struct MVert *mvert, const float (*vert_orco)[3], /* result */ struct CustomData *loopdata_out, - const uint loopdata_out_len, + uint loopdata_out_len, short *tangent_mask_curr_p); void BKE_mesh_calc_loop_tangents(struct Mesh *me_eval, diff --git a/source/blender/blenkernel/BKE_modifier.h b/source/blender/blenkernel/BKE_modifier.h index 278189633a6..80889813b34 100644 --- a/source/blender/blenkernel/BKE_modifier.h +++ b/source/blender/blenkernel/BKE_modifier.h @@ -184,7 +184,7 @@ typedef struct ModifierTypeInfo { * * \param flag: Copying options (see BKE_lib_id.h's LIB_ID_COPY_... flags for more). */ - void (*copyData)(const struct ModifierData *md, struct ModifierData *target, const int flag); + void (*copyData)(const struct ModifierData *md, struct ModifierData *target, int flag); /********************* Deform modifier functions *********************/ @@ -322,7 +322,7 @@ typedef struct ModifierTypeInfo { * * The dag_eval_mode should be of type eEvaluationMode. */ - bool (*dependsOnTime)(struct Scene *scene, struct ModifierData *md, const int dag_eval_mode); + bool (*dependsOnTime)(struct Scene *scene, struct ModifierData *md, int dag_eval_mode); /** * True when a deform modifier uses normals, the requiredDataMask @@ -415,7 +415,7 @@ void BKE_modifier_panel_expand(struct ModifierData *md); */ struct ModifierData *BKE_modifier_new(int type); -void BKE_modifier_free_ex(struct ModifierData *md, const int flag); +void BKE_modifier_free_ex(struct ModifierData *md, int flag); void BKE_modifier_free(struct ModifierData *md); /** * Use instead of `BLI_remlink` when the object's active modifier should change. @@ -432,11 +432,9 @@ bool BKE_modifier_unique_name(struct ListBase *modifiers, struct ModifierData *m */ void BKE_modifier_copydata_generic(const struct ModifierData *md, struct ModifierData *md_dst, - const int flag); + int flag); void BKE_modifier_copydata(struct ModifierData *md, struct ModifierData *target); -void BKE_modifier_copydata_ex(struct ModifierData *md, - struct ModifierData *target, - const int flag); +void BKE_modifier_copydata_ex(struct ModifierData *md, struct ModifierData *target, int flag); bool BKE_modifier_depends_ontime(struct Scene *scene, struct ModifierData *md, int dag_eval_mode); bool BKE_modifier_supports_mapping(struct ModifierData *md); bool BKE_modifier_supports_cage(struct Scene *scene, struct ModifierData *md); @@ -604,7 +602,7 @@ void BKE_modifier_deform_vertsEM(ModifierData *md, * (i.e. mesh topology remains the same as original one, a.k.a. 'cage' mesh). */ struct Mesh *BKE_modifier_get_evaluated_mesh_from_evaluated_object(struct Object *ob_eval, - const bool get_cage_mesh); + bool get_cage_mesh); void BKE_modifier_check_uuids_unique_and_report(const struct Object *object); diff --git a/source/blender/blenkernel/BKE_multires.h b/source/blender/blenkernel/BKE_multires.h index c83022c4658..504771fa733 100644 --- a/source/blender/blenkernel/BKE_multires.h +++ b/source/blender/blenkernel/BKE_multires.h @@ -167,7 +167,7 @@ void multiresModifier_ensure_external_read(struct Mesh *mesh, /**** interpolation stuff ****/ /* Adapted from `sculptmode.c` */ -void old_mdisps_bilinear(float out[3], float (*disps)[3], const int st, float u, float v); +void old_mdisps_bilinear(float out[3], float (*disps)[3], int st, float u, float v); /** * Find per-corner coordinate with given per-face UV coord. */ @@ -175,9 +175,9 @@ int mdisp_rot_face_to_crn(struct MVert *mvert, struct MPoly *mpoly, struct MLoop *mloop, const struct MLoopTri *lt, - const int face_side, - const float u, - const float v, + int face_side, + float u, + float v, float *x, float *y); @@ -187,7 +187,7 @@ bool multiresModifier_reshapeFromVertcos(struct Depsgraph *depsgraph, struct Object *object, struct MultiresModifierData *mmd, const float (*vert_coords)[3], - const int num_vert_coords); + int num_vert_coords); /** * Returns truth on success, false otherwise. * @@ -202,7 +202,7 @@ bool multiresModifier_reshapeFromDeformModifier(struct Depsgraph *depsgraph, struct Object *ob, struct MultiresModifierData *mmd, struct ModifierData *deform_md); -bool multiresModifier_reshapeFromCCG(const int tot_level, +bool multiresModifier_reshapeFromCCG(int tot_level, struct Mesh *coarse_mesh, struct SubdivCCG *subdiv_ccg); @@ -216,7 +216,7 @@ typedef enum eMultiresSubdivideModeType { void multiresModifier_subdivide(struct Object *object, struct MultiresModifierData *mmd, - const eMultiresSubdivideModeType mode); + eMultiresSubdivideModeType mode); void multires_subdivide_create_tangent_displacement_linear_grids(struct Object *object, struct MultiresModifierData *mmd); @@ -226,8 +226,8 @@ void multires_subdivide_create_tangent_displacement_linear_grids(struct Object * */ void multiresModifier_subdivide_to_level(struct Object *object, struct MultiresModifierData *mmd, - const int top_level, - const eMultiresSubdivideModeType mode); + int top_level, + eMultiresSubdivideModeType mode); /* Subdivision integration, defined in multires_subdiv.c */ @@ -242,9 +242,9 @@ void BKE_multires_subdiv_mesh_settings_init(struct SubdivToMeshSettings *mesh_se const struct Scene *scene, const struct Object *object, const struct MultiresModifierData *mmd, - const bool use_render_params, - const bool ignore_simplify, - const bool ignore_control_edges); + bool use_render_params, + bool ignore_simplify, + bool ignore_control_edges); /* General helpers. */ @@ -257,7 +257,7 @@ void BKE_multires_subdiv_mesh_settings_init(struct SubdivToMeshSettings *mesh_se BLI_INLINE void BKE_multires_construct_tangent_matrix(float tangent_matrix[3][3], const float dPdu[3], const float dPdv[3], - const int corner); + int corner); /* Versioning. */ diff --git a/source/blender/blenkernel/BKE_node.h b/source/blender/blenkernel/BKE_node.h index b47d120196d..c109ac99c88 100644 --- a/source/blender/blenkernel/BKE_node.h +++ b/source/blender/blenkernel/BKE_node.h @@ -357,22 +357,11 @@ typedef struct bNodeType { #define NODE_CLASS_OP_VECTOR 4 #define NODE_CLASS_OP_FILTER 5 #define NODE_CLASS_GROUP 6 -// #define NODE_CLASS_FILE 7 #define NODE_CLASS_CONVERTER 8 #define NODE_CLASS_MATTE 9 #define NODE_CLASS_DISTORT 10 -// #define NODE_CLASS_OP_DYNAMIC 11 /* deprecated */ #define NODE_CLASS_PATTERN 12 #define NODE_CLASS_TEXTURE 13 -// #define NODE_CLASS_EXECUTION 14 -// #define NODE_CLASS_GETDATA 15 -// #define NODE_CLASS_SETDATA 16 -// #define NODE_CLASS_MATH 17 -// #define NODE_CLASS_MATH_VECTOR 18 -// #define NODE_CLASS_MATH_ROTATION 19 -// #define NODE_CLASS_PARTICLES 25 -// #define NODE_CLASS_TRANSFORM 30 -// #define NODE_CLASS_COMBINE 31 #define NODE_CLASS_SCRIPT 32 #define NODE_CLASS_INTERFACE 33 #define NODE_CLASS_SHADER 40 @@ -481,7 +470,7 @@ void ntreeFreeTree(struct bNodeTree *ntree); void ntreeFreeEmbeddedTree(struct bNodeTree *ntree); struct bNodeTree *ntreeCopyTree_ex(const struct bNodeTree *ntree, struct Main *bmain, - const bool do_id_user); + bool do_id_user); struct bNodeTree *ntreeCopyTree(struct Main *bmain, const struct bNodeTree *ntree); /** @@ -499,7 +488,6 @@ struct bNodeTree *ntreeFromID(struct ID *id); void ntreeFreeLocalNode(struct bNodeTree *ntree, struct bNode *node); void ntreeFreeLocalTree(struct bNodeTree *ntree); struct bNode *ntreeFindType(const struct bNodeTree *ntree, int type); -bool ntreeHasType(const struct bNodeTree *ntree, int type); bool ntreeHasTree(const struct bNodeTree *ntree, const struct bNodeTree *lookup); void ntreeUpdateAllNew(struct Main *main); void ntreeUpdateAllUsers(struct Main *main, struct ID *id); @@ -518,7 +506,7 @@ void ntreeSetOutput(struct bNodeTree *ntree); void ntreeFreeCache(struct bNodeTree *ntree); -void ntreeNodeFlagSet(const bNodeTree *ntree, const int flag, const bool enable); +void ntreeNodeFlagSet(const bNodeTree *ntree, int flag, bool enable); /** * Returns localized tree for execution in threads. */ @@ -634,13 +622,6 @@ struct bNodeSocket *nodeAddSocket(struct bNodeTree *ntree, const char *idname, const char *identifier, const char *name); -struct bNodeSocket *nodeInsertSocket(struct bNodeTree *ntree, - struct bNode *node, - eNodeSocketInOut in_out, - const char *idname, - struct bNodeSocket *next_sock, - const char *identifier, - const char *name); struct bNodeSocket *nodeAddStaticSocket(struct bNodeTree *ntree, struct bNode *node, eNodeSocketInOut in_out, @@ -648,14 +629,6 @@ struct bNodeSocket *nodeAddStaticSocket(struct bNodeTree *ntree, int subtype, const char *identifier, const char *name); -struct bNodeSocket *nodeInsertStaticSocket(struct bNodeTree *ntree, - struct bNode *node, - eNodeSocketInOut in_out, - int type, - int subtype, - struct bNodeSocket *next_sock, - const char *identifier, - const char *name); void nodeRemoveSocket(struct bNodeTree *ntree, struct bNode *node, struct bNodeSocket *sock); void nodeRemoveSocketEx(struct bNodeTree *ntree, struct bNode *node, @@ -709,8 +682,6 @@ bNode *node_copy(bNodeTree *dst_tree, const bNode &src_node, int flag, bool uniq #endif -bNode *BKE_node_copy(bNodeTree *dst_tree, const bNode *src_node, int flag, bool unique_name); - /** * Also used via RNA API, so we check for proper input output direction. */ @@ -770,7 +741,7 @@ void nodeChainIter(const bNodeTree *ntree, const bNode *node_start, bool (*callback)(bNode *, bNode *, void *, const bool), void *userdata, - const bool reversed); + bool reversed); /** * Iterate over a chain of nodes, starting with \a node_start, executing * \a callback for each node (which can return false to end iterator). @@ -941,7 +912,6 @@ bNodePreview *BKE_node_preview_verify( bNodePreview *BKE_node_preview_copy(struct bNodePreview *preview); void BKE_node_preview_free(struct bNodePreview *preview); void BKE_node_preview_init_tree(struct bNodeTree *ntree, int xsize, int ysize); -void BKE_node_preview_free_tree(struct bNodeTree *ntree); void BKE_node_preview_remove_unused(struct bNodeTree *ntree); void BKE_node_preview_clear(struct bNodePreview *preview); void BKE_node_preview_clear_tree(struct bNodeTree *ntree); @@ -1103,20 +1073,13 @@ bool BKE_node_tree_iter_step(struct NodeTreeIterStore *ntreeiter, /** \name Node Tree */ -void BKE_nodetree_remove_layer_n(struct bNodeTree *ntree, - struct Scene *scene, - const int layer_index); +void BKE_nodetree_remove_layer_n(struct bNodeTree *ntree, struct Scene *scene, int layer_index); /* -------------------------------------------------------------------- */ /** \name Shader Nodes * \{ */ /* NOTE: types are needed to restore callbacks, don't change values. */ -/* range 1 - 100 is reserved for common nodes */ -/* using toolbox, we add node groups by assuming the values below - * don't exceed NODE_GROUP_MENU for now. */ - -//#define SH_NODE_OUTPUT 1 //#define SH_NODE_MATERIAL 100 #define SH_NODE_RGB 101 @@ -1222,11 +1185,6 @@ void BKE_nodetree_remove_layer_n(struct bNodeTree *ntree, #define SH_NODE_VECTOR_ROTATE 708 #define SH_NODE_CURVE_FLOAT 709 -/* custom defines options for Material node */ -// #define SH_NODE_MAT_DIFF 1 -// #define SH_NODE_MAT_SPEC 2 -// #define SH_NODE_MAT_NEG 4 - /* API */ struct bNodeTreeExec *ntreeShaderBeginExecTree(struct bNodeTree *ntree); @@ -1260,36 +1218,6 @@ void ntreeGPUMaterialNodes(struct bNodeTree *localtree, /* output socket defines */ #define RRES_OUT_IMAGE 0 #define RRES_OUT_ALPHA 1 -// #define RRES_OUT_Z 2 -// #define RRES_OUT_NORMAL 3 -// #define RRES_OUT_UV 4 -// #define RRES_OUT_VEC 5 -// #define RRES_OUT_RGBA 6 -#define RRES_OUT_DIFF 7 -// #define RRES_OUT_SPEC 8 -// #define RRES_OUT_SHADOW 9 -// #define RRES_OUT_AO 10 -// #define RRES_OUT_REFLECT 11 -// #define RRES_OUT_REFRACT 12 -// #define RRES_OUT_INDIRECT 13 -// #define RRES_OUT_INDEXOB 14 -// #define RRES_OUT_INDEXMA 15 -// #define RRES_OUT_MIST 16 -// #define RRES_OUT_EMIT 17 -// #define RRES_OUT_ENV 18 -// #define RRES_OUT_DIFF_DIRECT 19 -// #define RRES_OUT_DIFF_INDIRECT 20 -// #define RRES_OUT_DIFF_COLOR 21 -// #define RRES_OUT_GLOSSY_DIRECT 22 -// #define RRES_OUT_GLOSSY_INDIRECT 23 -// #define RRES_OUT_GLOSSY_COLOR 24 -// #define RRES_OUT_TRANSM_DIRECT 25 -// #define RRES_OUT_TRANSM_INDIRECT 26 -// #define RRES_OUT_TRANSM_COLOR 27 -// #define RRES_OUT_SUBSURFACE_DIRECT 28 -// #define RRES_OUT_SUBSURFACE_INDIRECT 29 -// #define RRES_OUT_SUBSURFACE_COLOR 30 -// #define RRES_OUT_DEBUG 31 /* NOTE: types are needed to restore callbacks, don't change values. */ #define CMP_NODE_VIEWER 201 @@ -1390,6 +1318,7 @@ void ntreeGPUMaterialNodes(struct bNodeTree *localtree, #define CMP_NODE_EXPOSURE 325 #define CMP_NODE_CRYPTOMATTE 326 #define CMP_NODE_POSTERIZE 327 +#define CMP_NODE_CONVERT_COLOR_SPACE 328 /* channel toggles */ #define CMP_CHAN_RGB 1 @@ -1550,7 +1479,7 @@ int ntreeTexExecTree(struct bNodeTree *ntree, float dxt[3], float dyt[3], int osatex, - const short thread, + short thread, const struct Tex *tex, short which_output, int cfra, @@ -1741,15 +1670,6 @@ int ntreeTexExecTree(struct bNodeTree *ntree, void BKE_node_system_init(void); void BKE_node_system_exit(void); -/* -------------------------------------------------------------------- */ -/* evaluation support, */ - -struct Depsgraph; - -void BKE_nodetree_shading_params_eval(struct Depsgraph *depsgraph, - struct bNodeTree *ntree_dst, - const struct bNodeTree *ntree_src); - extern struct bNodeType NodeTypeUndefined; extern struct bNodeSocketType NodeSocketTypeUndefined; diff --git a/source/blender/blenkernel/BKE_object.h b/source/blender/blenkernel/BKE_object.h index ffb5481f324..da8dba0c86b 100644 --- a/source/blender/blenkernel/BKE_object.h +++ b/source/blender/blenkernel/BKE_object.h @@ -67,11 +67,9 @@ void BKE_object_workob_calc_parent(struct Depsgraph *depsgraph, struct Object *workob); void BKE_object_transform_copy(struct Object *ob_tar, const struct Object *ob_src); -void BKE_object_copy_softbody(struct Object *ob_dst, const struct Object *ob_src, const int flag); -struct ParticleSystem *BKE_object_copy_particlesystem(struct ParticleSystem *psys, const int flag); -void BKE_object_copy_particlesystems(struct Object *ob_dst, - const struct Object *ob_src, - const int flag); +void BKE_object_copy_softbody(struct Object *ob_dst, const struct Object *ob_src, int flag); +struct ParticleSystem *BKE_object_copy_particlesystem(struct ParticleSystem *psys, int flag); +void BKE_object_copy_particlesystems(struct Object *ob_dst, const struct Object *ob_src, int flag); void BKE_object_free_particlesystems(struct Object *ob); void BKE_object_free_softbody(struct Object *ob); void BKE_object_free_curve_cache(struct Object *ob); @@ -140,11 +138,11 @@ bool BKE_object_copy_gpencil_modifier(struct Object *ob_dst, struct GpencilModif */ bool BKE_object_modifier_stack_copy(struct Object *ob_dst, const struct Object *ob_src, - const bool do_copy_all, - const int flag_subdata); + bool do_copy_all, + int flag_subdata); void BKE_object_link_modifiers(struct Object *ob_dst, const struct Object *ob_src); -void BKE_object_free_modifiers(struct Object *ob, const int flag); -void BKE_object_free_shaderfx(struct Object *ob, const int flag); +void BKE_object_free_modifiers(struct Object *ob, int flag); +void BKE_object_free_shaderfx(struct Object *ob, int flag); /** * Proxy rule: @@ -187,7 +185,7 @@ typedef enum eObjectVisibilityResult { /** * Return which parts of the object are visible, as evaluated by depsgraph. */ -int BKE_object_visibility(const struct Object *ob, const int dag_eval_mode); +int BKE_object_visibility(const struct Object *ob, int dag_eval_mode); /** * More general add: creates minimum required data, but without vertices etc. @@ -268,7 +266,7 @@ struct Object *BKE_object_duplicate(struct Main *bmain, /** * Use with newly created objects to set their size (used to apply scene-scale). */ -void BKE_object_obdata_size_init(struct Object *ob, const float size); +void BKE_object_obdata_size_init(struct Object *ob, float size); void BKE_object_scale_to_mat3(struct Object *ob, float r_mat[3][3]); void BKE_object_rot_to_mat3(const struct Object *ob, float r_mat[3][3], bool use_drot); @@ -289,12 +287,12 @@ void BKE_object_apply_mat4_ex(struct Object *ob, const float mat[4][4], struct Object *parent, const float parentinv[4][4], - const bool use_compat); + bool use_compat); /** See #BKE_object_apply_mat4_ex */ void BKE_object_apply_mat4(struct Object *ob, const float mat[4][4], - const bool use_compat, - const bool use_parent); + bool use_compat, + bool use_parent); void BKE_object_matrix_local_get(struct Object *ob, float r_mat[4][4]); bool BKE_object_pose_context_check(const struct Object *ob); @@ -379,20 +377,20 @@ void BKE_object_dimensions_set_ex(struct Object *ob, const float ob_obmat_orig[4][4]); void BKE_object_dimensions_set(struct Object *ob, const float value[3], int axis_mask); -void BKE_object_empty_draw_type_set(struct Object *ob, const int value); +void BKE_object_empty_draw_type_set(struct Object *ob, int value); /** * Use this to temporally disable/enable bound-box. */ -void BKE_object_boundbox_flag(struct Object *ob, int flag, const bool set); +void BKE_object_boundbox_flag(struct Object *ob, int flag, bool set); void BKE_object_boundbox_calc_from_mesh(struct Object *ob, const struct Mesh *me_eval); bool BKE_object_boundbox_calc_from_evaluated_geometry(struct Object *ob); -void BKE_object_minmax(struct Object *ob, float r_min[3], float r_max[3], const bool use_hidden); +void BKE_object_minmax(struct Object *ob, float r_min[3], float r_max[3], bool use_hidden); bool BKE_object_minmax_dupli(struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob, float r_min[3], float r_max[3], - const bool use_hidden); + bool use_hidden); /** * Sometimes min-max isn't enough, we need to loop over each point. @@ -423,7 +421,7 @@ void BKE_object_tfm_protected_backup(const struct Object *ob, ObjectTfmProtected void BKE_object_tfm_protected_restore(struct Object *ob, const ObjectTfmProtectedChannels *obtfm, - const short protectflag); + short protectflag); void BKE_object_tfm_copy(struct Object *object_dst, const struct Object *object_src); @@ -471,10 +469,10 @@ void BKE_object_select_update(struct Depsgraph *depsgraph, struct Object *object void BKE_object_eval_eval_base_flags(struct Depsgraph *depsgraph, struct Scene *scene, - const int view_layer_index, + int view_layer_index, struct Object *object, int base_index, - const bool is_from_set); + bool is_from_set); void BKE_object_handle_data_update(struct Depsgraph *depsgraph, struct Scene *scene, @@ -504,7 +502,7 @@ void BKE_object_handle_update_ex(struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob, struct RigidBodyWorld *rbw, - const bool do_proxy_update); + bool do_proxy_update); void BKE_object_sculpt_data_create(struct Object *ob); @@ -544,7 +542,7 @@ void BKE_object_delete_ptcache(struct Object *ob, int index); struct KeyBlock *BKE_object_shapekey_insert(struct Main *bmain, struct Object *ob, const char *name, - const bool from_mix); + bool from_mix); bool BKE_object_shapekey_remove(struct Main *bmain, struct Object *ob, struct KeyBlock *kb); bool BKE_object_shapekey_free(struct Main *bmain, struct Object *ob); @@ -594,7 +592,7 @@ void BKE_object_runtime_reset(struct Object *object); /** * Reset all pointers which we don't want to be shared when copying the object. */ -void BKE_object_runtime_reset_on_copy(struct Object *object, const int flag); +void BKE_object_runtime_reset_on_copy(struct Object *object, int flag); /** * The function frees memory used by the runtime data, but not the runtime field itself. * diff --git a/source/blender/blenkernel/BKE_object_deform.h b/source/blender/blenkernel/BKE_object_deform.h index ddbf5178ab0..fe7a9ddc633 100644 --- a/source/blender/blenkernel/BKE_object_deform.h +++ b/source/blender/blenkernel/BKE_object_deform.h @@ -68,16 +68,14 @@ struct MDeformVert *BKE_object_defgroup_data_create(struct ID *id); * \param use_selection: Only operate on selection. * \return True if any vertex was removed, false otherwise. */ -bool BKE_object_defgroup_clear(struct Object *ob, - struct bDeformGroup *dg, - const bool use_selection); +bool BKE_object_defgroup_clear(struct Object *ob, struct bDeformGroup *dg, bool use_selection); /** * Remove all verts (or only selected ones) from all vgroups. Work in Object and Edit modes. * * \param use_selection: Only operate on selection. * \return True if any vertex was removed, false otherwise. */ -bool BKE_object_defgroup_clear_all(struct Object *ob, const bool use_selection); +bool BKE_object_defgroup_clear_all(struct Object *ob, bool use_selection); /** * Remove given vgroup from object. Work in Object and Edit modes. @@ -120,7 +118,7 @@ bool *BKE_object_defgroup_subset_from_select_type(struct Object *ob, * Store indices from the defgroup_validmap (faster lookups in some cases). */ void BKE_object_defgroup_subset_to_index_array(const bool *defgroup_validmap, - const int defgroup_tot, + int defgroup_tot, int *r_defgroup_subset_map); /* ********** */ @@ -129,8 +127,8 @@ void BKE_object_defgroup_subset_to_index_array(const bool *defgroup_validmap, * Gets the status of "flag" for each #bDeformGroup * in the object data's vertex group list and returns an array containing them */ -bool *BKE_object_defgroup_lock_flags_get(struct Object *ob, const int defbase_tot); -bool *BKE_object_defgroup_validmap_get(struct Object *ob, const int defbase_tot); +bool *BKE_object_defgroup_lock_flags_get(struct Object *ob, int defbase_tot); +bool *BKE_object_defgroup_validmap_get(struct Object *ob, int defbase_tot); /** * Returns total selected vgroups, * `wpi.defbase_sel` is assumed malloc'd, all values are set. diff --git a/source/blender/blenkernel/BKE_ocean.h b/source/blender/blenkernel/BKE_ocean.h index 4388190221d..f598fb09773 100644 --- a/source/blender/blenkernel/BKE_ocean.h +++ b/source/blender/blenkernel/BKE_ocean.h @@ -73,13 +73,13 @@ typedef struct OceanCache { struct Ocean *BKE_ocean_add(void); void BKE_ocean_free_data(struct Ocean *oc); void BKE_ocean_free(struct Ocean *oc); -bool BKE_ocean_ensure(struct OceanModifierData *omd, const int resolution); +bool BKE_ocean_ensure(struct OceanModifierData *omd, int resolution); /** * Return true if the ocean data is valid and can be used. */ bool BKE_ocean_init_from_modifier(struct Ocean *ocean, struct OceanModifierData const *omd, - const int resolution); + int resolution); /** * Return true if the ocean is valid and can be used. @@ -162,12 +162,12 @@ void BKE_ocean_free_modifier_cache(struct OceanModifierData *omd); * Model is intended for large area 'fully developed' sea, where winds have been steadily blowing * for days over an area that includes hundreds of wavelengths on a side. */ -float BLI_ocean_spectrum_piersonmoskowitz(const struct Ocean *oc, const float kx, const float kz); +float BLI_ocean_spectrum_piersonmoskowitz(const struct Ocean *oc, float kx, float kz); /** * TMA extends the JONSWAP spectrum. * This spectral model is best suited to shallow water. */ -float BLI_ocean_spectrum_texelmarsenarsloe(const struct Ocean *oc, const float kx, const float kz); +float BLI_ocean_spectrum_texelmarsenarsloe(const struct Ocean *oc, float kx, float kz); /** * Hasselmann et al, 1973. This model extends the Pierson-Moskowitz model with a peak sharpening * function This enhancement is an artificial construct to address the problem that the wave @@ -176,7 +176,7 @@ float BLI_ocean_spectrum_texelmarsenarsloe(const struct Ocean *oc, const float k * The fetch parameter represents the distance from a lee shore, * called the fetch, or the distance over which the wind blows with constant velocity. */ -float BLI_ocean_spectrum_jonswap(const struct Ocean *oc, const float kx, const float kz); +float BLI_ocean_spectrum_jonswap(const struct Ocean *oc, float kx, float kz); #ifdef __cplusplus } diff --git a/source/blender/blenkernel/BKE_packedFile.h b/source/blender/blenkernel/BKE_packedFile.h index e3deff9d8fa..87a46f5f888 100644 --- a/source/blender/blenkernel/BKE_packedFile.h +++ b/source/blender/blenkernel/BKE_packedFile.h @@ -120,7 +120,7 @@ int BKE_packedfile_write_to_file(struct ReportList *reports, const char *ref_file_name, const char *filename, struct PackedFile *pf, - const bool guimode); + bool guimode); /* Free. */ diff --git a/source/blender/blenkernel/BKE_paint.h b/source/blender/blenkernel/BKE_paint.h index 40e3ab74fac..acae80b7a2b 100644 --- a/source/blender/blenkernel/BKE_paint.h +++ b/source/blender/blenkernel/BKE_paint.h @@ -148,14 +148,14 @@ bool BKE_palette_is_empty(const struct Palette *palette); void BKE_palette_color_remove(struct Palette *palette, struct PaletteColor *color); void BKE_palette_clear(struct Palette *palette); -void BKE_palette_sort_hsv(struct tPaletteColorHSV *color_array, const int totcol); -void BKE_palette_sort_svh(struct tPaletteColorHSV *color_array, const int totcol); -void BKE_palette_sort_vhs(struct tPaletteColorHSV *color_array, const int totcol); -void BKE_palette_sort_luminance(struct tPaletteColorHSV *color_array, const int totcol); +void BKE_palette_sort_hsv(struct tPaletteColorHSV *color_array, int totcol); +void BKE_palette_sort_svh(struct tPaletteColorHSV *color_array, int totcol); +void BKE_palette_sort_vhs(struct tPaletteColorHSV *color_array, int totcol); +void BKE_palette_sort_luminance(struct tPaletteColorHSV *color_array, int totcol); bool BKE_palette_from_hash(struct Main *bmain, struct GHash *color_table, const char *name, - const bool linear); + bool linear); /* Paint curves. */ @@ -172,7 +172,7 @@ void BKE_paint_free(struct Paint *p); * #id_us_plus(), rather than if we were copying between 2 existing scenes where a matching * value should decrease the existing user count as with #paint_brush_set() */ -void BKE_paint_copy(struct Paint *src, struct Paint *tar, const int flag); +void BKE_paint_copy(struct Paint *src, struct Paint *tar, int flag); void BKE_paint_runtime_init(const struct ToolSettings *ts, struct Paint *paint); @@ -183,7 +183,7 @@ bool BKE_paint_ensure_from_paintmode(struct Scene *sce, ePaintMode mode); struct Paint *BKE_paint_get_active_from_paintmode(struct Scene *sce, ePaintMode mode); const struct EnumPropertyItem *BKE_paint_get_tool_enum_from_paintmode(ePaintMode mode); const char *BKE_paint_get_tool_prop_id_from_paintmode(ePaintMode mode); -uint BKE_paint_get_brush_tool_offset_from_paintmode(const ePaintMode mode); +uint BKE_paint_get_brush_tool_offset_from_paintmode(ePaintMode mode); struct Paint *BKE_paint_get_active(struct Scene *sce, struct ViewLayer *view_layer); struct Paint *BKE_paint_get_active_from_context(const struct bContext *C); ePaintMode BKE_paintmode_get_active_from_context(const struct bContext *C); @@ -193,7 +193,7 @@ void BKE_paint_brush_set(struct Paint *paint, struct Brush *br); struct Palette *BKE_paint_palette(struct Paint *paint); void BKE_paint_palette_set(struct Paint *p, struct Palette *palette); void BKE_paint_curve_set(struct Brush *br, struct PaintCurve *pc); -void BKE_paint_curve_clamp_endpoint_add_index(struct PaintCurve *pc, const int add_index); +void BKE_paint_curve_clamp_endpoint_add_index(struct PaintCurve *pc, int add_index); /** * Return true when in vertex/weight/texture paint + face-select mode? @@ -231,7 +231,7 @@ bool paint_is_bmesh_face_hidden(struct BMFace *f); float paint_grid_paint_mask(const struct GridPaintMask *gpm, uint level, uint x, uint y); -void BKE_paint_face_set_overlay_color_get(const int face_set, const int seed, uchar r_color[4]); +void BKE_paint_face_set_overlay_color_get(int face_set, int seed, uchar r_color[4]); /* Stroke related. */ diff --git a/source/blender/blenkernel/BKE_particle.h b/source/blender/blenkernel/BKE_particle.h index 972cba2d132..1e71e158c10 100644 --- a/source/blender/blenkernel/BKE_particle.h +++ b/source/blender/blenkernel/BKE_particle.h @@ -294,10 +294,8 @@ int count_particles_mod(struct ParticleSystem *psys, int totgr, int cur); int psys_get_child_number(struct Scene *scene, struct ParticleSystem *psys, - const bool use_render_params); -int psys_get_tot_child(struct Scene *scene, - struct ParticleSystem *psys, - const bool use_render_params); + bool use_render_params); +int psys_get_tot_child(struct Scene *scene, struct ParticleSystem *psys, bool use_render_params); /** * Get object's active particle system safely. @@ -329,9 +327,7 @@ struct ParticleSystem *psys_eval_get(struct Depsgraph *depsgraph, struct ParticleSystem *psys); bool psys_in_edit_mode(struct Depsgraph *depsgraph, const struct ParticleSystem *psys); -bool psys_check_enabled(struct Object *ob, - struct ParticleSystem *psys, - const bool use_render_params); +bool psys_check_enabled(struct Object *ob, struct ParticleSystem *psys, bool use_render_params); bool psys_check_edited(struct ParticleSystem *psys); void psys_find_group_weights(struct ParticleSettings *part); @@ -392,7 +388,7 @@ void object_remove_particle_system(struct Main *bmain, struct ParticleSettings *BKE_particlesettings_add(struct Main *bmain, const char *name); void psys_reset(struct ParticleSystem *psys, int mode); -void psys_find_parents(struct ParticleSimulationData *sim, const bool use_render_params); +void psys_find_parents(struct ParticleSimulationData *sim, bool use_render_params); void psys_unique_name(struct Object *object, struct ParticleSystem *psys, const char *defname); @@ -402,19 +398,17 @@ void psys_unique_name(struct Object *object, struct ParticleSystem *psys, const * - Makes child strands possible and creates them too into the cache. * - Cached path data is also used to determine cut position for the edit-mode tool. */ -void psys_cache_paths(struct ParticleSimulationData *sim, - float cfra, - const bool use_render_params); +void psys_cache_paths(struct ParticleSimulationData *sim, float cfra, bool use_render_params); void psys_cache_edit_paths(struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob, struct PTCacheEdit *edit, float cfra, - const bool use_render_params); + bool use_render_params); void psys_cache_child_paths(struct ParticleSimulationData *sim, float cfra, - const bool editupdate, - const bool use_render_params); + bool editupdate, + bool use_render_params); int do_guides(struct Depsgraph *depsgraph, struct ParticleSettings *part, struct ListBase *effectors, @@ -438,7 +432,7 @@ float psys_get_child_size(struct ParticleSystem *psys, void psys_get_particle_on_path(struct ParticleSimulationData *sim, int pa_num, struct ParticleKey *state, - const bool vel); + bool vel); /** * Gets particle's state at a time. * \return true if particle exists and can be seen and false if not. @@ -446,7 +440,7 @@ void psys_get_particle_on_path(struct ParticleSimulationData *sim, bool psys_get_particle_state(struct ParticleSimulationData *sim, int p, struct ParticleKey *state, - const bool always); + bool always); /* Child paths. */ @@ -539,7 +533,7 @@ void particle_system_update(struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob, struct ParticleSystem *psys, - const bool use_render_params); + bool use_render_params); /** * Callback format for performing operations on ID-pointers for particle systems. @@ -678,8 +672,7 @@ void reset_particle(struct ParticleSimulationData *sim, float dtime, float cfra); -float psys_get_current_display_percentage(struct ParticleSystem *psys, - const bool use_render_params); +float psys_get_current_display_percentage(struct ParticleSystem *psys, bool use_render_params); /* psys_reset */ #define PSYS_RESET_ALL 1 diff --git a/source/blender/blenkernel/BKE_pbvh.h b/source/blender/blenkernel/BKE_pbvh.h index 5e7a9883de6..692c935ae5f 100644 --- a/source/blender/blenkernel/BKE_pbvh.h +++ b/source/blender/blenkernel/BKE_pbvh.h @@ -137,8 +137,8 @@ void BKE_pbvh_build_bmesh(PBVH *pbvh, struct BMesh *bm, bool smooth_shading, struct BMLog *log, - const int cd_vert_node_offset, - const int cd_face_node_offset); + int cd_vert_node_offset, + int cd_face_node_offset); void BKE_pbvh_free(PBVH *pbvh); /* Hierarchical Search in the BVH, two methods: @@ -279,8 +279,8 @@ bool BKE_pbvh_bmesh_update_topology(PBVH *pbvh, const float center[3], const float view_normal[3], float radius, - const bool use_frontface, - const bool use_projected); + bool use_frontface, + bool use_projected); /* Node Access */ @@ -361,7 +361,7 @@ void BKE_pbvh_respect_hide_set(PBVH *pbvh, bool respect_hide); /* Vertex Deformer. */ float (*BKE_pbvh_vert_coords_alloc(struct PBVH *pbvh))[3]; -void BKE_pbvh_vert_coords_apply(struct PBVH *pbvh, const float (*vertCos)[3], const int totvert); +void BKE_pbvh_vert_coords_apply(struct PBVH *pbvh, const float (*vertCos)[3], int totvert); bool BKE_pbvh_is_deformed(struct PBVH *pbvh); /* Vertex Iterator. */ diff --git a/source/blender/blenkernel/BKE_pointcache.h b/source/blender/blenkernel/BKE_pointcache.h index 47d3d83f8bb..0749b9d6d49 100644 --- a/source/blender/blenkernel/BKE_pointcache.h +++ b/source/blender/blenkernel/BKE_pointcache.h @@ -363,7 +363,7 @@ void BKE_ptcache_free_list(struct ListBase *ptcaches); /* returns first point cache */ struct PointCache *BKE_ptcache_copy_list(struct ListBase *ptcaches_new, const struct ListBase *ptcaches_old, - const int flag); + int flag); /********************** Baking *********************/ diff --git a/source/blender/blenkernel/BKE_pointcloud.h b/source/blender/blenkernel/BKE_pointcloud.h index 57b0127088c..d330ea41e6a 100644 --- a/source/blender/blenkernel/BKE_pointcloud.h +++ b/source/blender/blenkernel/BKE_pointcloud.h @@ -38,7 +38,7 @@ extern const char *POINTCLOUD_ATTR_RADIUS; void *BKE_pointcloud_add(struct Main *bmain, const char *name); void *BKE_pointcloud_add_default(struct Main *bmain, const char *name); -struct PointCloud *BKE_pointcloud_new_nomain(const int totpoint); +struct PointCloud *BKE_pointcloud_new_nomain(int totpoint); struct BoundBox *BKE_pointcloud_boundbox_get(struct Object *ob); bool BKE_pointcloud_minmax(const struct PointCloud *pointcloud, float r_min[3], float r_max[3]); diff --git a/source/blender/blenkernel/BKE_rigidbody.h b/source/blender/blenkernel/BKE_rigidbody.h index 1c9bad7fbe8..68f2319106e 100644 --- a/source/blender/blenkernel/BKE_rigidbody.h +++ b/source/blender/blenkernel/BKE_rigidbody.h @@ -60,7 +60,7 @@ void BKE_rigidbody_free_constraint(struct Object *ob); void BKE_rigidbody_object_copy(struct Main *bmain, struct Object *ob_dst, const struct Object *ob_src, - const int flag); + int flag); /** \} */ @@ -122,7 +122,7 @@ void BKE_rigidbody_main_collection_object_add(struct Main *bmain, /** * Copy. */ -struct RigidBodyWorld *BKE_rigidbody_world_copy(struct RigidBodyWorld *rbw, const int flag); +struct RigidBodyWorld *BKE_rigidbody_world_copy(struct RigidBodyWorld *rbw, int flag); void BKE_rigidbody_world_groups_relink(struct RigidBodyWorld *rbw); /** @@ -167,11 +167,11 @@ void BKE_rigidbody_ensure_local_object(struct Main *bmain, struct Object *ob); void BKE_rigidbody_remove_object(struct Main *bmain, struct Scene *scene, struct Object *ob, - const bool free_us); + bool free_us); void BKE_rigidbody_remove_constraint(struct Main *bmain, struct Scene *scene, struct Object *ob, - const bool free_us); + bool free_us); /** \} */ diff --git a/source/blender/blenkernel/BKE_scene.h b/source/blender/blenkernel/BKE_scene.h index 4792921fec7..8610bc09a92 100644 --- a/source/blender/blenkernel/BKE_scene.h +++ b/source/blender/blenkernel/BKE_scene.h @@ -83,7 +83,7 @@ struct Scene *BKE_scene_add(struct Main *bmain, const char *name); void BKE_scene_remove_rigidbody_object(struct Main *bmain, struct Scene *scene, struct Object *ob, - const bool free_us); + bool free_us); /** * Check if there is any instance of the object in the scene. @@ -141,7 +141,7 @@ struct Scene *BKE_scene_set_name(struct Main *bmain, const char *name); /** * \param flag: copying options (see BKE_lib_id.h's `LIB_ID_COPY_...` flags for more). */ -struct ToolSettings *BKE_toolsettings_copy(struct ToolSettings *toolsettings, const int flag); +struct ToolSettings *BKE_toolsettings_copy(struct ToolSettings *toolsettings, int flag); void BKE_toolsettings_free(struct ToolSettings *toolsettings); struct Scene *BKE_scene_duplicate(struct Main *bmain, struct Scene *sce, eSceneCopyMethod type); @@ -181,7 +181,7 @@ float BKE_scene_ctime_get(const struct Scene *scene); * Convert integer frame number to fractional frame number taking into account * sub-frames and time remapping. */ -float BKE_scene_frame_to_ctime(const struct Scene *scene, const int frame); +float BKE_scene_frame_to_ctime(const struct Scene *scene, int frame); /** * Get current fractional frame based on frame and sub-frame. @@ -220,7 +220,7 @@ void BKE_scene_graph_update_for_newframe(struct Depsgraph *depsgraph); /** * Applies changes right away, does all sets too. */ -void BKE_scene_graph_update_for_newframe_ex(struct Depsgraph *depsgraph, const bool clear_recalc); +void BKE_scene_graph_update_for_newframe_ex(struct Depsgraph *depsgraph, bool clear_recalc); /** * Ensures given scene/view_layer pair has a valid, up-to-date depsgraph. @@ -275,7 +275,7 @@ int BKE_render_preview_pixel_size(const struct RenderData *r); * Apply the needed correction factor to value, based on unit_type * (only length-related are affected currently) and `unit->scale_length`. */ -double BKE_scene_unit_scale(const struct UnitSettings *unit, const int unit_type, double value); +double BKE_scene_unit_scale(const struct UnitSettings *unit, int unit_type, double value); /* Multi-view. */ @@ -295,9 +295,8 @@ bool BKE_scene_multiview_is_render_view_first(const struct RenderData *rd, const bool BKE_scene_multiview_is_render_view_last(const struct RenderData *rd, const char *viewname); int BKE_scene_multiview_num_views_get(const struct RenderData *rd); struct SceneRenderView *BKE_scene_multiview_render_view_findindex(const struct RenderData *rd, - const int view_id); -const char *BKE_scene_multiview_render_view_name_get(const struct RenderData *rd, - const int view_id); + int view_id); +const char *BKE_scene_multiview_render_view_name_get(const struct RenderData *rd, int view_id); int BKE_scene_multiview_view_id_get(const struct RenderData *rd, const char *viewname); void BKE_scene_multiview_filepath_get(struct SceneRenderView *srv, const char *filepath, @@ -313,7 +312,7 @@ void BKE_scene_multiview_view_filepath_get(const struct RenderData *rd, const char *view, char *r_filepath); const char *BKE_scene_multiview_view_suffix_get(const struct RenderData *rd, const char *viewname); -const char *BKE_scene_multiview_view_id_suffix_get(const struct RenderData *rd, const int view_id); +const char *BKE_scene_multiview_view_id_suffix_get(const struct RenderData *rd, int view_id); void BKE_scene_multiview_view_prefix_get(struct Scene *scene, const char *name, char *r_prefix, @@ -349,7 +348,7 @@ void BKE_scene_undo_depsgraphs_restore(struct Main *bmain, struct GHash *depsgra void BKE_scene_transform_orientation_remove(struct Scene *scene, struct TransformOrientation *orientation); struct TransformOrientation *BKE_scene_transform_orientation_find(const struct Scene *scene, - const int index); + int index); /** * \return the index that \a orientation has within \a scene's transform-orientation list * or -1 if not found. diff --git a/source/blender/blenkernel/BKE_screen.h b/source/blender/blenkernel/BKE_screen.h index 3d8b48e5192..63f6fca2a9d 100644 --- a/source/blender/blenkernel/BKE_screen.h +++ b/source/blender/blenkernel/BKE_screen.h @@ -465,19 +465,18 @@ void BKE_region_callback_refresh_tag_gizmomap_set(void (*callback)(struct wmGizm */ struct ARegion *BKE_area_find_region_type(const struct ScrArea *area, int type); struct ARegion *BKE_area_find_region_active_win(struct ScrArea *area); -struct ARegion *BKE_area_find_region_xy(struct ScrArea *area, - const int regiontype, - const int xy[2]) ATTR_NONNULL(3); +struct ARegion *BKE_area_find_region_xy(struct ScrArea *area, int regiontype, const int xy[2]) + ATTR_NONNULL(3); /** * \note This is only for screen level regions (typically menus/popups). */ struct ARegion *BKE_screen_find_region_xy(struct bScreen *screen, - const int regiontype, + int regiontype, const int xy[2]) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1, 3); struct ARegion *BKE_screen_find_main_region_at_xy(struct bScreen *screen, - const int space_type, + int space_type, const int xy[2]) ATTR_NONNULL(1, 3); /** * \note Ideally we can get the area from the context, @@ -490,15 +489,12 @@ struct ScrArea *BKE_screen_find_area_from_space(struct bScreen *screen, * \note Using this function is generally a last resort, you really want to be * using the context when you can - campbell */ -struct ScrArea *BKE_screen_find_big_area(struct bScreen *screen, - const int spacetype, - const short min); +struct ScrArea *BKE_screen_find_big_area(struct bScreen *screen, int spacetype, short min); struct ScrArea *BKE_screen_area_map_find_area_xy(const struct ScrAreaMap *areamap, - const int spacetype, + int spacetype, const int xy[2]) ATTR_NONNULL(1, 3); -struct ScrArea *BKE_screen_find_area_xy(struct bScreen *screen, - const int spacetype, - const int xy[2]) ATTR_NONNULL(1, 3); +struct ScrArea *BKE_screen_find_area_xy(struct bScreen *screen, int spacetype, const int xy[2]) + ATTR_NONNULL(1, 3); void BKE_screen_gizmo_tag_refresh(struct bScreen *screen); diff --git a/source/blender/blenkernel/BKE_shader_fx.h b/source/blender/blenkernel/BKE_shader_fx.h index a82112ff967..432b334a676 100644 --- a/source/blender/blenkernel/BKE_shader_fx.h +++ b/source/blender/blenkernel/BKE_shader_fx.h @@ -164,7 +164,7 @@ void BKE_shaderfxType_panel_id(ShaderFxType type, char *r_idname); void BKE_shaderfx_panel_expand(struct ShaderFxData *fx); const ShaderFxTypeInfo *BKE_shaderfx_get_info(ShaderFxType type); struct ShaderFxData *BKE_shaderfx_new(int type); -void BKE_shaderfx_free_ex(struct ShaderFxData *fx, const int flag); +void BKE_shaderfx_free_ex(struct ShaderFxData *fx, int flag); void BKE_shaderfx_free(struct ShaderFxData *fx); /** * Check unique name. @@ -183,9 +183,7 @@ struct ShaderFxData *BKE_shaderfx_findby_type(struct Object *ob, ShaderFxType ty struct ShaderFxData *BKE_shaderfx_findby_name(struct Object *ob, const char *name); void BKE_shaderfx_copydata_generic(const struct ShaderFxData *fx_src, struct ShaderFxData *fx_dst); void BKE_shaderfx_copydata(struct ShaderFxData *fx, struct ShaderFxData *target); -void BKE_shaderfx_copydata_ex(struct ShaderFxData *fx, - struct ShaderFxData *target, - const int flag); +void BKE_shaderfx_copydata_ex(struct ShaderFxData *fx, struct ShaderFxData *target, int flag); void BKE_shaderfx_copy(struct ListBase *dst, const struct ListBase *src); void BKE_shaderfx_foreach_ID_link(struct Object *ob, ShaderFxIDWalkFunc walk, void *userData); diff --git a/source/blender/blenkernel/BKE_shrinkwrap.h b/source/blender/blenkernel/BKE_shrinkwrap.h index 088b270bfed..55940d6ba57 100644 --- a/source/blender/blenkernel/BKE_shrinkwrap.h +++ b/source/blender/blenkernel/BKE_shrinkwrap.h @@ -121,14 +121,14 @@ void shrinkwrapModifier_deform(struct ShrinkwrapModifierData *smd, struct Object *ob, struct Mesh *mesh, struct MDeformVert *dvert, - const int defgrp_index, + int defgrp_index, float (*vertexCos)[3], int numVerts); /* Implementation of the Shrinkwrap Grease Pencil modifier. */ void shrinkwrapGpencilModifier_deform(struct ShrinkwrapGpencilModifierData *mmd, struct Object *ob, struct MDeformVert *dvert, - const int defgrp_index, + int defgrp_index, float (*vertexCos)[3], int numVerts); @@ -166,7 +166,7 @@ void BKE_shrinkwrap_remesh_target_project(struct Mesh *src_me, bool BKE_shrinkwrap_project_normal(char options, const float vert[3], const float dir[3], - const float ray_radius, + float ray_radius, const struct SpaceTransform *transf, struct ShrinkwrapTreeData *tree, BVHTreeRayHit *hit); diff --git a/source/blender/blenkernel/BKE_spline.hh b/source/blender/blenkernel/BKE_spline.hh index 3413bdbfa69..2c14880978f 100644 --- a/source/blender/blenkernel/BKE_spline.hh +++ b/source/blender/blenkernel/BKE_spline.hh @@ -127,9 +127,9 @@ class Spline { virtual int size() const = 0; int segments_size() const; bool is_cyclic() const; - void set_cyclic(const bool value); + void set_cyclic(bool value); - virtual void resize(const int size) = 0; + virtual void resize(int size) = 0; virtual blender::MutableSpan<blender::float3> positions() = 0; virtual blender::Span<blender::float3> positions() const = 0; virtual blender::MutableSpan<float> radii() = 0; @@ -175,7 +175,7 @@ class Spline { */ blender::Span<blender::float3> evaluated_normals() const; - void bounds_min_max(blender::float3 &min, blender::float3 &max, const bool use_evaluated) const; + void bounds_min_max(blender::float3 &min, blender::float3 &max, bool use_evaluated) const; struct LookupResult { /** @@ -202,20 +202,20 @@ class Spline { * factor between them, which can be used to look up any attribute on the evaluated points. * \note This does not support extrapolation. */ - LookupResult lookup_evaluated_factor(const float factor) const; + LookupResult lookup_evaluated_factor(float factor) const; /** * The same as #lookup_evaluated_factor, but looks up a length directly instead of * a portion of the total. */ - LookupResult lookup_evaluated_length(const float length) const; + LookupResult lookup_evaluated_length(float length) const; /** * Return an array of evenly spaced samples along the length of the spline. The samples are * indices and factors to the next index encoded in floats. The logic for converting from the * float values to interpolation data is in #lookup_data_from_index_factor. */ - blender::Array<float> sample_uniform_index_factors(const int samples_size) const; - LookupResult lookup_data_from_index_factor(const float index_factor) const; + blender::Array<float> sample_uniform_index_factors(int samples_size) const; + LookupResult lookup_data_from_index_factor(float index_factor) const; /** * Sample any input data with a value for each evaluated point (already interpolated to evaluated @@ -328,9 +328,9 @@ class BezierSpline final : public Spline { int size() const final; int resolution() const; - void set_resolution(const int value); + void set_resolution(int value); - void resize(const int size) final; + void resize(int size) final; blender::MutableSpan<blender::float3> positions() final; blender::Span<blender::float3> positions() const final; blender::MutableSpan<float> radii() final; @@ -370,14 +370,14 @@ class BezierSpline final : public Spline { * Set positions for the right handle of the control point, ensuring that * aligned handles stay aligned. Has no effect for auto and vector type handles. */ - void set_handle_position_right(const int index, const blender::float3 &value); + void set_handle_position_right(int index, const blender::float3 &value); /** * Set positions for the left handle of the control point, ensuring that * aligned handles stay aligned. Has no effect for auto and vector type handles. */ - void set_handle_position_left(const int index, const blender::float3 &value); + void set_handle_position_left(int index, const blender::float3 &value); - bool point_is_sharp(const int index) const; + bool point_is_sharp(int index) const; void mark_cache_invalid() final; int evaluated_points_size() const final; @@ -414,18 +414,18 @@ class BezierSpline final : public Spline { * to interpolate data from control points to evaluated points between them. The next control * point index result will not overflow the size of the control point vectors. */ - InterpolationData interpolation_data_from_index_factor(const float index_factor) const; + InterpolationData interpolation_data_from_index_factor(float index_factor) const; virtual blender::fn::GVArray interpolate_to_evaluated( const blender::fn::GVArray &src) const override; - void evaluate_segment(const int index, - const int next_index, + void evaluate_segment(int index, + int next_index, blender::MutableSpan<blender::float3> positions) const; /** * \warning This functional assumes that the spline has more than one point. */ - bool segment_is_vector(const int start_index) const; + bool segment_is_vector(int start_index) const; /** See comment and diagram for #calculate_segment_insertion. */ struct InsertResult { @@ -454,9 +454,7 @@ class BezierSpline final : public Spline { * point_prev point_next * </pre> */ - InsertResult calculate_segment_insertion(const int index, - const int next_index, - const float parameter); + InsertResult calculate_segment_insertion(int index, int next_index, float parameter); private: /** @@ -552,14 +550,14 @@ class NURBSpline final : public Spline { int size() const final; int resolution() const; - void set_resolution(const int value); + void set_resolution(int value); uint8_t order() const; - void set_order(const uint8_t value); + void set_order(uint8_t value); bool check_valid_size_and_order() const; int knots_size() const; - void resize(const int size) final; + void resize(int size) final; blender::MutableSpan<blender::float3> positions() final; blender::Span<blender::float3> positions() const final; blender::MutableSpan<float> radii() final; @@ -615,7 +613,7 @@ class PolySpline final : public Spline { int size() const final; - void resize(const int size) final; + void resize(int size) final; blender::MutableSpan<blender::float3> positions() final; blender::Span<blender::float3> positions() const final; blender::MutableSpan<float> radii() final; @@ -676,7 +674,7 @@ struct CurveEval { */ bool has_spline_with_type(const Spline::Type type) const; - void resize(const int size); + void resize(int size); /** * \warning Call #reallocate on the spline's attributes after adding all splines. */ @@ -686,7 +684,7 @@ struct CurveEval { void translate(const blender::float3 &translation); void transform(const blender::float4x4 &matrix); - bool bounds_min_max(blender::float3 &min, blender::float3 &max, const bool use_evaluated) const; + bool bounds_min_max(blender::float3 &min, blender::float3 &max, bool use_evaluated) const; /** * Return the start indices for each of the curve spline's control points, if they were part diff --git a/source/blender/blenkernel/BKE_subdiv.h b/source/blender/blenkernel/BKE_subdiv.h index 169a4337f6a..0237661cd16 100644 --- a/source/blender/blenkernel/BKE_subdiv.h +++ b/source/blender/blenkernel/BKE_subdiv.h @@ -151,9 +151,9 @@ typedef struct SubdivDisplacement { * Averaging of displacement for vertices created for over coarse vertices * and edges is done by subdiv code. */ void (*eval_displacement)(struct SubdivDisplacement *displacement, - const int ptex_face_index, - const float u, - const float v, + int ptex_face_index, + float u, + float v, const float dPdu[3], const float dPdv[3], float r_D[3]); @@ -275,35 +275,35 @@ int *BKE_subdiv_face_ptex_offset_get(Subdiv *subdiv); /* For a given (ptex_u, ptex_v) within a ptex face get corresponding * (grid_u, grid_v) within a grid. */ -BLI_INLINE void BKE_subdiv_ptex_face_uv_to_grid_uv(const float ptex_u, - const float ptex_v, +BLI_INLINE void BKE_subdiv_ptex_face_uv_to_grid_uv(float ptex_u, + float ptex_v, float *r_grid_u, float *r_grid_v); /* Inverse of above. */ -BLI_INLINE void BKE_subdiv_grid_uv_to_ptex_face_uv(const float grid_u, - const float grid_v, +BLI_INLINE void BKE_subdiv_grid_uv_to_ptex_face_uv(float grid_u, + float grid_v, float *r_ptex_u, float *r_ptex_v); /* For a given subdivision level (which is NOT refinement level) get size of * CCG grid (number of grid points on a side). */ -BLI_INLINE int BKE_subdiv_grid_size_from_level(const int level); +BLI_INLINE int BKE_subdiv_grid_size_from_level(int level); /* Simplified version of mdisp_rot_face_to_crn, only handles quad and * works in normalized coordinates. * * NOTE: Output coordinates are in ptex coordinates. */ -BLI_INLINE int BKE_subdiv_rotate_quad_to_corner(const float quad_u, - const float quad_v, +BLI_INLINE int BKE_subdiv_rotate_quad_to_corner(float quad_u, + float quad_v, float *r_corner_u, float *r_corner_v); /* Converts (u, v) coordinate from within a grid to a quad coordinate in * normalized ptex coordinates. */ BLI_INLINE void BKE_subdiv_rotate_grid_to_quad( - const int corner, const float grid_u, const float grid_v, float *r_quad_u, float *r_quad_v); + int corner, float grid_u, float grid_v, float *r_quad_u, float *r_quad_v); /* Convert Blender edge crease value to OpenSubdiv sharpness. */ BLI_INLINE float BKE_subdiv_edge_crease_to_sharpness_f(float edge_crease); diff --git a/source/blender/blenkernel/BKE_subdiv_ccg.h b/source/blender/blenkernel/BKE_subdiv_ccg.h index b7d4ab8d8ed..b3aa966e0d0 100644 --- a/source/blender/blenkernel/BKE_subdiv_ccg.h +++ b/source/blender/blenkernel/BKE_subdiv_ccg.h @@ -46,9 +46,9 @@ struct Subdiv; /* Functor which evaluates mask value at a given (u, v) of given ptex face. */ typedef struct SubdivCCGMaskEvaluator { float (*eval_mask)(struct SubdivCCGMaskEvaluator *mask_evaluator, - const int ptex_face_index, - const float u, - const float v); + int ptex_face_index, + float u, + float v); /* Free the data, not the evaluator itself. */ void (*free)(struct SubdivCCGMaskEvaluator *mask_evaluator); @@ -67,8 +67,7 @@ bool BKE_subdiv_ccg_mask_init_from_paint(SubdivCCGMaskEvaluator *mask_evaluator, /* Functor which evaluates material and flags of a given coarse face. */ typedef struct SubdivCCGMaterialFlagsEvaluator { DMFlagMat (*eval_material_flags)( - struct SubdivCCGMaterialFlagsEvaluator *material_flags_evaluator, - const int coarse_face_index); + struct SubdivCCGMaterialFlagsEvaluator *material_flags_evaluator, int coarse_face_index); /* Free the data, not the evaluator itself. */ void (*free)(struct SubdivCCGMaterialFlagsEvaluator *material_flags_evaluator); @@ -307,10 +306,10 @@ bool BKE_subdiv_ccg_check_coord_valid(const SubdivCCG *subdiv_ccg, const SubdivC * the current vertex are added at the end of the coords array. */ void BKE_subdiv_ccg_neighbor_coords_get(const SubdivCCG *subdiv_ccg, const SubdivCCGCoord *coord, - const bool include_duplicates, + bool include_duplicates, SubdivCCGNeighbors *r_neighbors); -int BKE_subdiv_ccg_grid_to_face_index(const SubdivCCG *subdiv_ccg, const int grid_index); +int BKE_subdiv_ccg_grid_to_face_index(const SubdivCCG *subdiv_ccg, int grid_index); void BKE_subdiv_ccg_eval_limit_point(const SubdivCCG *subdiv_ccg, const SubdivCCGCoord *coord, float r_point[3]); diff --git a/source/blender/blenkernel/BKE_subdiv_eval.h b/source/blender/blenkernel/BKE_subdiv_eval.h index 177d5f386a8..052d25693c4 100644 --- a/source/blender/blenkernel/BKE_subdiv_eval.h +++ b/source/blender/blenkernel/BKE_subdiv_eval.h @@ -65,33 +65,25 @@ void BKE_subdiv_eval_init_displacement(struct Subdiv *subdiv); /* Evaluate point at a limit surface, with optional derivatives and normal. */ void BKE_subdiv_eval_limit_point( - struct Subdiv *subdiv, const int ptex_face_index, const float u, const float v, float r_P[3]); + struct Subdiv *subdiv, int ptex_face_index, float u, float v, float r_P[3]); void BKE_subdiv_eval_limit_point_and_derivatives(struct Subdiv *subdiv, - const int ptex_face_index, - const float u, - const float v, + int ptex_face_index, + float u, + float v, float r_P[3], float r_dPdu[3], float r_dPdv[3]); -void BKE_subdiv_eval_limit_point_and_normal(struct Subdiv *subdiv, - const int ptex_face_index, - const float u, - const float v, - float r_P[3], - float r_N[3]); -void BKE_subdiv_eval_limit_point_and_short_normal(struct Subdiv *subdiv, - const int ptex_face_index, - const float u, - const float v, - float r_P[3], - short r_N[3]); +void BKE_subdiv_eval_limit_point_and_normal( + struct Subdiv *subdiv, int ptex_face_index, float u, float v, float r_P[3], float r_N[3]); +void BKE_subdiv_eval_limit_point_and_short_normal( + struct Subdiv *subdiv, int ptex_face_index, float u, float v, float r_P[3], short r_N[3]); /* Evaluate face-varying layer (such as UV). */ void BKE_subdiv_eval_face_varying(struct Subdiv *subdiv, - const int face_varying_channel, - const int ptex_face_index, - const float u, - const float v, + int face_varying_channel, + int ptex_face_index, + float u, + float v, float r_face_varying[2]); /* NOTE: Expects derivatives to be correct. @@ -101,16 +93,16 @@ void BKE_subdiv_eval_face_varying(struct Subdiv *subdiv, * Would be nice to have displacement evaluation function which does not require * knowing derivatives ahead of a time. */ void BKE_subdiv_eval_displacement(struct Subdiv *subdiv, - const int ptex_face_index, - const float u, - const float v, + int ptex_face_index, + float u, + float v, const float dPdu[3], const float dPdv[3], float r_D[3]); /* Evaluate point on a limit surface with displacement applied to it. */ void BKE_subdiv_eval_final_point( - struct Subdiv *subdiv, const int ptex_face_index, const float u, const float v, float r_P[3]); + struct Subdiv *subdiv, int ptex_face_index, float u, float v, float r_P[3]); /* Patch queries at given resolution. * @@ -119,41 +111,41 @@ void BKE_subdiv_eval_final_point( * goes as u in rows, v in columns. */ void BKE_subdiv_eval_limit_patch_resolution_point(struct Subdiv *subdiv, - const int ptex_face_index, - const int resolution, + int ptex_face_index, + int resolution, void *buffer, - const int offset, - const int stride); + int offset, + int stride); void BKE_subdiv_eval_limit_patch_resolution_point_and_derivatives(struct Subdiv *subdiv, - const int ptex_face_index, - const int resolution, + int ptex_face_index, + int resolution, void *point_buffer, - const int point_offset, - const int point_stride, + int point_offset, + int point_stride, void *du_buffer, - const int du_offset, - const int du_stride, + int du_offset, + int du_stride, void *dv_buffer, - const int dv_offset, - const int dv_stride); + int dv_offset, + int dv_stride); void BKE_subdiv_eval_limit_patch_resolution_point_and_normal(struct Subdiv *subdiv, - const int ptex_face_index, - const int resolution, + int ptex_face_index, + int resolution, void *point_buffer, - const int point_offset, - const int point_stride, + int point_offset, + int point_stride, void *normal_buffer, - const int normal_offset, - const int normal_stride); + int normal_offset, + int normal_stride); void BKE_subdiv_eval_limit_patch_resolution_point_and_short_normal(struct Subdiv *subdiv, - const int ptex_face_index, - const int resolution, + int ptex_face_index, + int resolution, void *point_buffer, - const int point_offset, - const int point_stride, + int point_offset, + int point_stride, void *normal_buffer, - const int normal_offset, - const int normal_stride); + int normal_offset, + int normal_stride); #ifdef __cplusplus } diff --git a/source/blender/blenkernel/BKE_subdiv_foreach.h b/source/blender/blenkernel/BKE_subdiv_foreach.h index f63e23917ef..7d9a589666a 100644 --- a/source/blender/blenkernel/BKE_subdiv_foreach.h +++ b/source/blender/blenkernel/BKE_subdiv_foreach.h @@ -35,77 +35,77 @@ struct SubdivForeachContext; struct SubdivToMeshSettings; typedef bool (*SubdivForeachTopologyInformationCb)(const struct SubdivForeachContext *context, - const int num_vertices, - const int num_edges, - const int num_loops, - const int num_polygons, + int num_vertices, + int num_edges, + int num_loops, + int num_polygons, const int *subdiv_polygon_offset); typedef void (*SubdivForeachVertexFromCornerCb)(const struct SubdivForeachContext *context, void *tls, - const int ptex_face_index, - const float u, - const float v, - const int coarse_vertex_index, - const int coarse_poly_index, - const int coarse_corner, - const int subdiv_vertex_index); + int ptex_face_index, + float u, + float v, + int coarse_vertex_index, + int coarse_poly_index, + int coarse_corner, + int subdiv_vertex_index); typedef void (*SubdivForeachVertexFromEdgeCb)(const struct SubdivForeachContext *context, void *tls, - const int ptex_face_index, - const float u, - const float v, - const int coarse_edge_index, - const int coarse_poly_index, - const int coarse_corner, - const int subdiv_vertex_index); + int ptex_face_index, + float u, + float v, + int coarse_edge_index, + int coarse_poly_index, + int coarse_corner, + int subdiv_vertex_index); typedef void (*SubdivForeachVertexInnerCb)(const struct SubdivForeachContext *context, void *tls, - const int ptex_face_index, - const float u, - const float v, - const int coarse_poly_index, - const int coarse_corner, - const int subdiv_vertex_index); + int ptex_face_index, + float u, + float v, + int coarse_poly_index, + int coarse_corner, + int subdiv_vertex_index); typedef void (*SubdivForeachEdgeCb)(const struct SubdivForeachContext *context, void *tls, - const int coarse_edge_index, - const int subdiv_edge_index, - const int subdiv_v1, - const int subdiv_v2); + int coarse_edge_index, + int subdiv_edge_index, + int subdiv_v1, + int subdiv_v2); typedef void (*SubdivForeachLoopCb)(const struct SubdivForeachContext *context, void *tls, - const int ptex_face_index, - const float u, - const float v, - const int coarse_loop_index, - const int coarse_poly_index, - const int coarse_corner, - const int subdiv_loop_index, - const int subdiv_vertex_index, - const int subdiv_edge_index); + int ptex_face_index, + float u, + float v, + int coarse_loop_index, + int coarse_poly_index, + int coarse_corner, + int subdiv_loop_index, + int subdiv_vertex_index, + int subdiv_edge_index); typedef void (*SubdivForeachPolygonCb)(const struct SubdivForeachContext *context, void *tls, - const int coarse_poly_index, - const int subdiv_poly_index, - const int start_loop_index, - const int num_loops); + int coarse_poly_index, + int subdiv_poly_index, + int start_loop_index, + int num_loops); typedef void (*SubdivForeachLooseCb)(const struct SubdivForeachContext *context, void *tls, - const int coarse_vertex_index, - const int subdiv_vertex_index); + int coarse_vertex_index, + int subdiv_vertex_index); typedef void (*SubdivForeachVertexOfLooseEdgeCb)(const struct SubdivForeachContext *context, void *tls, - const int coarse_edge_index, - const float u, - const int subdiv_vertex_index); + int coarse_edge_index, + float u, + int subdiv_vertex_index); typedef struct SubdivForeachContext { /* Is called when topology information becomes available. diff --git a/source/blender/blenkernel/BKE_subdiv_modifier.h b/source/blender/blenkernel/BKE_subdiv_modifier.h index 94068613101..e8672b6baa8 100644 --- a/source/blender/blenkernel/BKE_subdiv_modifier.h +++ b/source/blender/blenkernel/BKE_subdiv_modifier.h @@ -38,7 +38,7 @@ struct SubsurfModifierData; void BKE_subsurf_modifier_subdiv_settings_init(struct SubdivSettings *settings, const struct SubsurfModifierData *smd, - const bool use_render_params); + bool use_render_params); /* If skip_check_is_last is true, we assume that the modifier passed is the last enabled modifier * in the stack. */ @@ -50,7 +50,7 @@ bool BKE_subsurf_modifier_can_do_gpu_subdiv_ex(const struct Scene *scene, bool BKE_subsurf_modifier_can_do_gpu_subdiv(const struct Scene *scene, const struct Object *ob, - const int required_mode); + int required_mode); extern void (*BKE_subsurf_modifier_free_gpu_cache_cb)(struct Subdiv *subdiv); @@ -58,7 +58,7 @@ struct Subdiv *BKE_subsurf_modifier_subdiv_descriptor_ensure( const struct SubsurfModifierData *smd, const struct SubdivSettings *subdiv_settings, const struct Mesh *mesh, - const bool for_draw_code); + bool for_draw_code); struct SubsurfRuntimeData *BKE_subsurf_modifier_ensure_runtime(struct SubsurfModifierData *smd); diff --git a/source/blender/blenkernel/BKE_text.h b/source/blender/blenkernel/BKE_text.h index a979ba6d2cc..7415cb90ff2 100644 --- a/source/blender/blenkernel/BKE_text.h +++ b/source/blender/blenkernel/BKE_text.h @@ -52,7 +52,7 @@ bool BKE_text_reload(struct Text *text); struct Text *BKE_text_load_ex(struct Main *bmain, const char *file, const char *relpath, - const bool is_internal); + bool is_internal); /** * Load a text file. * @@ -73,25 +73,25 @@ void BKE_text_file_modified_ignore(struct Text *text); char *txt_to_buf(struct Text *text, int *r_buf_strlen); void txt_clean_text(struct Text *text); -void txt_order_cursors(struct Text *text, const bool reverse); +void txt_order_cursors(struct Text *text, bool reverse); int txt_find_string(struct Text *text, const char *findstr, int wrap, int match_case); bool txt_has_sel(const struct Text *text); int txt_get_span(struct TextLine *from, struct TextLine *to); -void txt_move_up(struct Text *text, const bool sel); -void txt_move_down(struct Text *text, const bool sel); -void txt_move_left(struct Text *text, const bool sel); -void txt_move_right(struct Text *text, const bool sel); -void txt_jump_left(struct Text *text, const bool sel, const bool use_init_step); -void txt_jump_right(struct Text *text, const bool sel, const bool use_init_step); -void txt_move_bof(struct Text *text, const bool sel); -void txt_move_eof(struct Text *text, const bool sel); -void txt_move_bol(struct Text *text, const bool sel); -void txt_move_eol(struct Text *text, const bool sel); -void txt_move_toline(struct Text *text, unsigned int line, const bool sel); +void txt_move_up(struct Text *text, bool sel); +void txt_move_down(struct Text *text, bool sel); +void txt_move_left(struct Text *text, bool sel); +void txt_move_right(struct Text *text, bool sel); +void txt_jump_left(struct Text *text, bool sel, bool use_init_step); +void txt_jump_right(struct Text *text, bool sel, bool use_init_step); +void txt_move_bof(struct Text *text, bool sel); +void txt_move_eof(struct Text *text, bool sel); +void txt_move_bol(struct Text *text, bool sel); +void txt_move_eol(struct Text *text, bool sel); +void txt_move_toline(struct Text *text, unsigned int line, bool sel); /** * Moves to a certain byte in a line, not a certain utf8-character. */ -void txt_move_to(struct Text *text, unsigned int line, unsigned int ch, const bool sel); +void txt_move_to(struct Text *text, unsigned int line, unsigned int ch, bool sel); void txt_pop_sel(struct Text *text); void txt_delete_char(struct Text *text); void txt_delete_word(struct Text *text); @@ -117,7 +117,7 @@ bool txt_unindent(struct Text *text); void txt_comment(struct Text *text); void txt_indent(struct Text *text); bool txt_uncomment(struct Text *text); -void txt_move_lines(struct Text *text, const int direction); +void txt_move_lines(struct Text *text, int direction); void txt_duplicate_line(struct Text *text); int txt_setcurr_tab_spaces(struct Text *text, int space); bool txt_cursor_is_line_start(const struct Text *text); @@ -129,17 +129,17 @@ int txt_calc_tab_right(struct TextLine *tl, int ch); /** * 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); -bool text_check_identifier(const char ch); -bool text_check_identifier_nodigit(const char ch); -bool text_check_whitespace(const char ch); +int text_check_bracket(char ch); +bool text_check_delim(char ch); +bool text_check_digit(char ch); +bool text_check_identifier(char ch); +bool text_check_identifier_nodigit(char ch); +bool text_check_whitespace(char ch); int text_find_identifier_start(const char *str, int i); /* EVIL: defined in `bpy_interface.c`. */ -extern int text_check_identifier_unicode(const unsigned int ch); -extern int text_check_identifier_nodigit_unicode(const unsigned int ch); +extern int text_check_identifier_unicode(unsigned int ch); +extern int text_check_identifier_nodigit_unicode(unsigned int ch); enum { TXT_MOVE_LINE_UP = -1, diff --git a/source/blender/blenkernel/BKE_text_suggestions.h b/source/blender/blenkernel/BKE_text_suggestions.h index 7561e1d1d08..482141c1032 100644 --- a/source/blender/blenkernel/BKE_text_suggestions.h +++ b/source/blender/blenkernel/BKE_text_suggestions.h @@ -66,7 +66,7 @@ short texttool_text_is_active(struct Text *text); /* Suggestions */ void texttool_suggest_add(const char *name, char type); -void texttool_suggest_prefix(const char *prefix, const int prefix_len); +void texttool_suggest_prefix(const char *prefix, int prefix_len); void texttool_suggest_clear(void); SuggItem *texttool_suggest_first(void); SuggItem *texttool_suggest_last(void); diff --git a/source/blender/blenkernel/BKE_texture.h b/source/blender/blenkernel/BKE_texture.h index 380b5cf035c..2683ab00fa4 100644 --- a/source/blender/blenkernel/BKE_texture.h +++ b/source/blender/blenkernel/BKE_texture.h @@ -82,7 +82,7 @@ void BKE_texture_pointdensity_init_data(struct PointDensity *pd); void BKE_texture_pointdensity_free_data(struct PointDensity *pd); void BKE_texture_pointdensity_free(struct PointDensity *pd); struct PointDensity *BKE_texture_pointdensity_add(void); -struct PointDensity *BKE_texture_pointdensity_copy(const struct PointDensity *pd, const int flag); +struct PointDensity *BKE_texture_pointdensity_copy(const struct PointDensity *pd, int flag); bool BKE_texture_dependsOnTime(const struct Tex *texture); /** diff --git a/source/blender/blenkernel/BKE_tracking.h b/source/blender/blenkernel/BKE_tracking.h index 9caf5d31765..7769215d616 100644 --- a/source/blender/blenkernel/BKE_tracking.h +++ b/source/blender/blenkernel/BKE_tracking.h @@ -58,7 +58,7 @@ void BKE_tracking_free(struct MovieTracking *tracking); */ void BKE_tracking_copy(struct MovieTracking *tracking_dst, const struct MovieTracking *tracking_src, - const int flag); + int flag); /** * Initialize motion tracking settings to default values, @@ -177,7 +177,7 @@ void BKE_tracking_track_first_last_frame_get(const struct MovieTrackingTrack *tr * Find the minimum starting frame and maximum ending frame within given set of tracks. */ void BKE_tracking_tracks_first_last_frame_minmax(/*const*/ struct MovieTrackingTrack **tracks, - const int num_tracks, + int num_tracks, int *r_first_frame, int *r_last_frame); @@ -236,7 +236,7 @@ void BKE_tracking_tracks_join(struct MovieTracking *tracking, void BKE_tracking_tracks_average(struct MovieTrackingTrack *dst_track, /*const*/ struct MovieTrackingTrack **src_tracks, - const int num_src_tracks); + int num_src_tracks); struct MovieTrackingTrack *BKE_tracking_track_get_named(struct MovieTracking *tracking, struct MovieTrackingObject *object, @@ -301,7 +301,7 @@ struct MovieTrackingMarker *BKE_tracking_marker_ensure(struct MovieTrackingTrack * \returns truth if the result is usable. */ bool BKE_tracking_marker_get_interpolated(struct MovieTrackingTrack *track, - const int framenr, + int framenr, struct MovieTrackingMarker *r_marker); void BKE_tracking_marker_pattern_minmax(const struct MovieTrackingMarker *marker, @@ -525,7 +525,7 @@ void BKE_tracking_refine_marker(struct MovieClip *clip, struct AutoTrackContext *BKE_autotrack_context_new(struct MovieClip *clip, struct MovieClipUser *user, - const bool is_backwards); + bool is_backwards); bool BKE_autotrack_context_step(struct AutoTrackContext *context); void BKE_autotrack_context_sync(struct AutoTrackContext *context); void BKE_autotrack_context_sync_user(struct AutoTrackContext *context, struct MovieClipUser *user); diff --git a/source/blender/blenkernel/BKE_undo_system.h b/source/blender/blenkernel/BKE_undo_system.h index 44893a6f030..88a9ac9d0bf 100644 --- a/source/blender/blenkernel/BKE_undo_system.h +++ b/source/blender/blenkernel/BKE_undo_system.h @@ -133,7 +133,7 @@ typedef struct UndoType { bool (*step_encode)(struct bContext *C, struct Main *bmain, UndoStep *us); void (*step_decode)( - struct bContext *C, struct Main *bmain, UndoStep *us, const eUndoStepDir dir, bool is_final); + struct bContext *C, struct Main *bmain, UndoStep *us, eUndoStepDir dir, bool is_final); /** * \note When freeing all steps, @@ -263,7 +263,7 @@ bool BKE_undosys_step_load_data_ex(UndoStack *ustack, struct bContext *C, UndoStep *us_target, UndoStep *us_reference, - const bool use_skip); + bool use_skip); /** * Undo/Redo until the given `us_target` step becomes the active (currently loaded) one. */ @@ -272,7 +272,7 @@ bool BKE_undosys_step_load_data(UndoStack *ustack, struct bContext *C, UndoStep * Undo/Redo until the step matching given `index` in the undo stack becomes the active * (currently loaded) one. */ -void BKE_undosys_step_load_from_index(UndoStack *ustack, struct bContext *C, const int index); +void BKE_undosys_step_load_from_index(UndoStack *ustack, struct bContext *C, int index); /** * Undo until `us_target` step becomes the active (currently loaded) one. diff --git a/source/blender/blenkernel/BKE_vfont.h b/source/blender/blenkernel/BKE_vfont.h index cd1b30b9358..d0a44ce4e47 100644 --- a/source/blender/blenkernel/BKE_vfont.h +++ b/source/blender/blenkernel/BKE_vfont.h @@ -96,7 +96,7 @@ void BKE_vfont_build_char(struct Curve *cu, float ofsy, float rot, int charidx, - const float fsize); + float fsize); int BKE_vfont_select_get(struct Object *ob, int *r_start, int *r_end); void BKE_vfont_select_clamp(struct Object *ob); diff --git a/source/blender/blenkernel/BKE_vfontdata.h b/source/blender/blenkernel/BKE_vfontdata.h index 692857b0458..01ca59828fc 100644 --- a/source/blender/blenkernel/BKE_vfontdata.h +++ b/source/blender/blenkernel/BKE_vfontdata.h @@ -56,7 +56,7 @@ typedef struct VChar { * \retval A new #VFontData structure, or NULL if unable to load. */ VFontData *BKE_vfontdata_from_freetypefont(struct PackedFile *pf); -VFontData *BKE_vfontdata_copy(const VFontData *vfont_src, const int flag); +VFontData *BKE_vfontdata_copy(const VFontData *vfont_src, int flag); VChar *BKE_vfontdata_char_from_freetypefont(struct VFont *vfont, unsigned long character); VChar *BKE_vfontdata_char_copy(const VChar *vchar_src); diff --git a/source/blender/blenkernel/BKE_volume.h b/source/blender/blenkernel/BKE_volume.h index f4f00844b8d..2b551a76d73 100644 --- a/source/blender/blenkernel/BKE_volume.h +++ b/source/blender/blenkernel/BKE_volume.h @@ -189,7 +189,7 @@ openvdb::GridBase::ConstPtr BKE_volume_grid_openvdb_for_read(const struct Volume const struct VolumeGrid *grid); openvdb::GridBase::Ptr BKE_volume_grid_openvdb_for_write(const struct Volume *volume, struct VolumeGrid *grid, - const bool clear); + bool clear); VolumeGridType BKE_volume_grid_type_openvdb(const openvdb::GridBase &grid); @@ -229,9 +229,7 @@ auto BKE_volume_grid_type_operation(const VolumeGridType grid_type, OpType &&op) } openvdb::GridBase::Ptr BKE_volume_grid_create_with_changed_resolution( - const VolumeGridType grid_type, - const openvdb::GridBase &old_grid, - const float resolution_factor); + const VolumeGridType grid_type, const openvdb::GridBase &old_grid, float resolution_factor); # endif #endif diff --git a/source/blender/blenkernel/BKE_volume_to_mesh.hh b/source/blender/blenkernel/BKE_volume_to_mesh.hh index dd8ae7ea554..b99ae625042 100644 --- a/source/blender/blenkernel/BKE_volume_to_mesh.hh +++ b/source/blender/blenkernel/BKE_volume_to_mesh.hh @@ -53,20 +53,20 @@ struct OpenVDBMeshData { struct Mesh *volume_to_mesh(const openvdb::GridBase &grid, const VolumeToMeshResolution &resolution, - const float threshold, - const float adaptivity); + float threshold, + float adaptivity); struct OpenVDBMeshData volume_to_mesh_data(const openvdb::GridBase &grid, const VolumeToMeshResolution &resolution, - const float threshold, - const float adaptivity); + float threshold, + float adaptivity); void fill_mesh_from_openvdb_data(const Span<openvdb::Vec3s> vdb_verts, const Span<openvdb::Vec3I> vdb_tris, const Span<openvdb::Vec4I> vdb_quads, - const int vert_offset, - const int poly_offset, - const int loop_offset, + int vert_offset, + int poly_offset, + int loop_offset, MutableSpan<MVert> verts, MutableSpan<MPoly> polys, MutableSpan<MLoop> loops); diff --git a/source/blender/blenkernel/BKE_workspace.h b/source/blender/blenkernel/BKE_workspace.h index ff4e21732c4..0f609be67de 100644 --- a/source/blender/blenkernel/BKE_workspace.h +++ b/source/blender/blenkernel/BKE_workspace.h @@ -45,7 +45,7 @@ struct WorkSpace *BKE_workspace_add(struct Main *bmain, const char *name); void BKE_workspace_remove(struct Main *bmain, struct WorkSpace *workspace); struct WorkSpaceInstanceHook *BKE_workspace_instance_hook_create(const struct Main *bmain, - const int winid); + int winid); void BKE_workspace_instance_hook_free(const struct Main *bmain, struct WorkSpaceInstanceHook *hook); @@ -97,7 +97,7 @@ struct WorkSpaceLayout *BKE_workspace_layout_iter_circular( struct WorkSpaceLayout *start, bool (*callback)(const struct WorkSpaceLayout *layout, void *arg), void *arg, - const bool iter_backward); + bool iter_backward); void BKE_workspace_tool_remove(struct WorkSpace *workspace, struct bToolRef *tref) ATTR_NONNULL(1, 2); @@ -132,13 +132,13 @@ struct WorkSpaceLayout *BKE_workspace_active_layout_get(const struct WorkSpaceIn * #WorkSpaceInstanceHook.act_layout should only be modified directly to update the layout pointer. */ void BKE_workspace_active_layout_set(struct WorkSpaceInstanceHook *hook, - const int winid, + int winid, struct WorkSpace *workspace, struct WorkSpaceLayout *layout) SETTER_ATTRS; struct bScreen *BKE_workspace_active_screen_get(const struct WorkSpaceInstanceHook *hook) GETTER_ATTRS; void BKE_workspace_active_screen_set(struct WorkSpaceInstanceHook *hook, - const int winid, + int winid, struct WorkSpace *workspace, struct bScreen *screen) SETTER_ATTRS; diff --git a/source/blender/blenkernel/BKE_writeavi.h b/source/blender/blenkernel/BKE_writeavi.h index d2a5100ffad..c20de4df901 100644 --- a/source/blender/blenkernel/BKE_writeavi.h +++ b/source/blender/blenkernel/BKE_writeavi.h @@ -63,7 +63,7 @@ typedef struct bMovieHandle { void (*context_free)(void *context_v); } bMovieHandle; -bMovieHandle *BKE_movie_handle_get(const char imtype); +bMovieHandle *BKE_movie_handle_get(char imtype); /** * \note Similar to #BKE_image_path_from_imformat() diff --git a/source/blender/blenkernel/intern/attribute_access_intern.hh b/source/blender/blenkernel/intern/attribute_access_intern.hh index b77d7010efa..2cd128081eb 100644 --- a/source/blender/blenkernel/intern/attribute_access_intern.hh +++ b/source/blender/blenkernel/intern/attribute_access_intern.hh @@ -161,7 +161,7 @@ class CustomDataAttributeProvider final : public DynamicAttributesProvider { bool try_create(GeometryComponent &component, const AttributeIDRef &attribute_id, - const AttributeDomain domain, + AttributeDomain domain, const CustomDataType data_type, const AttributeInit &initializer) const final; @@ -185,8 +185,8 @@ class CustomDataAttributeProvider final : public DynamicAttributesProvider { */ class NamedLegacyCustomDataProvider final : public DynamicAttributesProvider { private: - using AsReadAttribute = GVArray (*)(const void *data, const int domain_size); - using AsWriteAttribute = GVMutableArray (*)(void *data, const int domain_size); + using AsReadAttribute = GVArray (*)(const void *data, int domain_size); + using AsWriteAttribute = GVMutableArray (*)(void *data, int domain_size); const AttributeDomain domain_; const CustomDataType attribute_type_; const CustomDataType stored_type_; @@ -229,8 +229,8 @@ class NamedLegacyCustomDataProvider final : public DynamicAttributesProvider { * if the stored type is the same as the attribute type. */ class BuiltinCustomDataLayerProvider final : public BuiltinAttributeProvider { - using AsReadAttribute = GVArray (*)(const void *data, const int domain_size); - using AsWriteAttribute = GVMutableArray (*)(void *data, const int domain_size); + using AsReadAttribute = GVArray (*)(const void *data, int domain_size); + using AsWriteAttribute = GVMutableArray (*)(void *data, int domain_size); using UpdateOnRead = void (*)(const GeometryComponent &component); using UpdateOnWrite = void (*)(GeometryComponent &component); const CustomDataType stored_type_; diff --git a/source/blender/blenkernel/intern/constraint.c b/source/blender/blenkernel/intern/constraint.c index 312feae4665..2a5afb6be9a 100644 --- a/source/blender/blenkernel/intern/constraint.c +++ b/source/blender/blenkernel/intern/constraint.c @@ -34,6 +34,7 @@ #include "BLI_blenlib.h" #include "BLI_kdopbvh.h" +#include "BLI_listbase.h" #include "BLI_math.h" #include "BLI_string_utils.h" #include "BLI_utildefines.h" @@ -5676,13 +5677,19 @@ bool BKE_constraint_apply_for_object(Depsgraph *depsgraph, const float ctime = BKE_scene_frame_get(scene); - bConstraint *new_con = BKE_constraint_duplicate_ex(con, 0, !ID_IS_LINKED(ob)); + /* Do this all in the evaluated domain (e.g. shrinkwrap needs to access evaluated constraint + * target mesh). */ + Scene *scene_eval = DEG_get_evaluated_scene(depsgraph); + Object *ob_eval = DEG_get_evaluated_object(depsgraph, ob); + bConstraint *con_eval = BKE_constraints_find_name(&ob_eval->constraints, con->name); + + bConstraint *new_con = BKE_constraint_duplicate_ex(con_eval, 0, !ID_IS_LINKED(ob)); ListBase single_con = {new_con, new_con}; bConstraintOb *cob = BKE_constraints_make_evalob( - depsgraph, scene, ob, NULL, CONSTRAINT_OBTYPE_OBJECT); + depsgraph, scene_eval, ob_eval, NULL, CONSTRAINT_OBTYPE_OBJECT); /* Undo the effect of the current constraint stack evaluation. */ - mul_m4_m4m4(cob->matrix, ob->constinv, cob->matrix); + mul_m4_m4m4(cob->matrix, ob_eval->constinv, cob->matrix); /* Evaluate single constraint. */ BKE_constraints_solve(depsgraph, &single_con, cob, ctime); @@ -5695,7 +5702,7 @@ bool BKE_constraint_apply_for_object(Depsgraph *depsgraph, BLI_freelinkN(&single_con, new_con); /* Apply transform from matrix. */ - BKE_object_apply_mat4(ob, ob->obmat, true, true); + BKE_object_apply_mat4(ob, ob_eval->obmat, true, true); return true; } @@ -5722,18 +5729,25 @@ bool BKE_constraint_apply_for_pose( const float ctime = BKE_scene_frame_get(scene); - bConstraint *new_con = BKE_constraint_duplicate_ex(con, 0, !ID_IS_LINKED(ob)); + /* Do this all in the evaluated domain (e.g. shrinkwrap needs to access evaluated constraint + * target mesh). */ + Scene *scene_eval = DEG_get_evaluated_scene(depsgraph); + Object *ob_eval = DEG_get_evaluated_object(depsgraph, ob); + bPoseChannel *pchan_eval = BKE_pose_channel_find_name(ob_eval->pose, pchan->name); + bConstraint *con_eval = BKE_constraints_find_name(&pchan_eval->constraints, con->name); + + bConstraint *new_con = BKE_constraint_duplicate_ex(con_eval, 0, !ID_IS_LINKED(ob)); ListBase single_con; single_con.first = new_con; single_con.last = new_con; float vec[3]; - copy_v3_v3(vec, pchan->pose_mat[3]); + copy_v3_v3(vec, pchan_eval->pose_mat[3]); bConstraintOb *cob = BKE_constraints_make_evalob( - depsgraph, scene, ob, pchan, CONSTRAINT_OBTYPE_BONE); + depsgraph, scene_eval, ob_eval, pchan_eval, CONSTRAINT_OBTYPE_BONE); /* Undo the effects of currently applied constraints. */ - mul_m4_m4m4(cob->matrix, pchan->constinv, cob->matrix); + mul_m4_m4m4(cob->matrix, pchan_eval->constinv, cob->matrix); /* Evaluate single constraint. */ BKE_constraints_solve(depsgraph, &single_con, cob, ctime); BKE_constraints_clear_evalob(cob); @@ -5744,12 +5758,12 @@ bool BKE_constraint_apply_for_pose( /* Prevent constraints breaking a chain. */ if (pchan->bone->flag & BONE_CONNECTED) { - copy_v3_v3(pchan->pose_mat[3], vec); + copy_v3_v3(pchan_eval->pose_mat[3], vec); } /* Apply transform from matrix. */ float mat[4][4]; - BKE_armature_mat_pose_to_bone(pchan, pchan->pose_mat, mat); + BKE_armature_mat_pose_to_bone(pchan, pchan_eval->pose_mat, mat); BKE_pchan_apply_mat4(pchan, mat, true); return true; diff --git a/source/blender/blenkernel/intern/data_transfer_intern.h b/source/blender/blenkernel/intern/data_transfer_intern.h index 5510f699197..e5218415df9 100644 --- a/source/blender/blenkernel/intern/data_transfer_intern.h +++ b/source/blender/blenkernel/intern/data_transfer_intern.h @@ -33,43 +33,40 @@ struct CustomData; struct CustomDataTransferLayerMap; struct ListBase; -float data_transfer_interp_float_do(const int mix_mode, - const float val_dst, - const float val_src, - const float mix_factor); +float data_transfer_interp_float_do(int mix_mode, float val_dst, float val_src, float mix_factor); void data_transfer_layersmapping_add_item(struct ListBase *r_map, - const int data_type, - const int mix_mode, - const float mix_factor, + int data_type, + int mix_mode, + float mix_factor, const float *mix_weights, const void *data_src, void *data_dst, - const int data_src_n, - const int data_dst_n, + int data_src_n, + int data_dst_n, const size_t elem_size, const size_t data_size, const size_t data_offset, - const uint64_t data_flag, + uint64_t data_flag, cd_datatransfer_interp interp, void *interp_data); /* Type-specific. */ bool data_transfer_layersmapping_vgroups(struct ListBase *r_map, - const int mix_mode, - const float mix_factor, + int mix_mode, + float mix_factor, const float *mix_weights, - const int num_elem_dst, - const bool use_create, - const bool use_delete, + int num_elem_dst, + bool use_create, + bool use_delete, struct Object *ob_src, struct Object *ob_dst, struct CustomData *cd_src, struct CustomData *cd_dst, - const bool use_dupref_dst, - const int fromlayers, - const int tolayers); + bool use_dupref_dst, + int fromlayers, + int tolayers); /* Defined in customdata.c */ @@ -80,8 +77,8 @@ void customdata_data_transfer_interp_normal_normals(const CustomDataTransferLaye void *data_dst, const void **sources, const float *weights, - const int count, - const float mix_factor); + int count, + float mix_factor); #ifdef __cplusplus } diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c index 2d4366846aa..4899c3671aa 100644 --- a/source/blender/blenkernel/intern/image.c +++ b/source/blender/blenkernel/intern/image.c @@ -4062,9 +4062,8 @@ bool BKE_image_fill_tile(struct Image *ima, void BKE_image_ensure_tile_token(char *filename) { - if (filename == NULL) { - return; - } + BLI_assert_msg(BLI_path_slash_find(filename) == NULL, + "Only the file-name component should be used!"); /* Is there a '<' character in the filename? Assume tokens already present. */ if (strstr(filename, "<") != NULL) { diff --git a/source/blender/blenkernel/intern/lib_override.c b/source/blender/blenkernel/intern/lib_override.c index 011b7a4924d..38ce8ea88b9 100644 --- a/source/blender/blenkernel/intern/lib_override.c +++ b/source/blender/blenkernel/intern/lib_override.c @@ -376,7 +376,6 @@ bool BKE_lib_override_library_create_from_tag(Main *bmain, * existing linked IDs usages. */ if (success) { for (todo_id_iter = todo_ids.first; todo_id_iter != NULL; todo_id_iter = todo_id_iter->next) { - ID *other_id; reference_id = todo_id_iter->data; ID *local_id = reference_id->newid; @@ -394,6 +393,7 @@ bool BKE_lib_override_library_create_from_tag(Main *bmain, * remapped to use newly created overriding IDs, if needed. */ ID *id; FOREACH_MAIN_ID_BEGIN (bmain, id) { + ID *other_id; /* In case we created new overrides as 'no main', they are not accessible directly in this * loop, but we can get to them through their reference's `newid` pointer. */ if (do_no_main && id->lib == reference_id->lib && id->newid != NULL) { @@ -1121,14 +1121,14 @@ void BKE_lib_override_library_main_proxy_convert(Main *bmain, BlendFileReadRepor } } -bool BKE_lib_override_library_resync(Main *bmain, - Scene *scene, - ViewLayer *view_layer, - ID *id_root, - Collection *override_resync_residual_storage, - const bool do_hierarchy_enforce, - const bool do_post_process, - BlendFileReadReport *reports) +static bool lib_override_library_resync(Main *bmain, + Scene *scene, + ViewLayer *view_layer, + ID *id_root, + Collection *override_resync_residual_storage, + const bool do_hierarchy_enforce, + const bool do_post_process, + BlendFileReadReport *reports) { BLI_assert(ID_IS_OVERRIDE_LIBRARY_REAL(id_root)); @@ -1499,6 +1499,26 @@ bool BKE_lib_override_library_resync(Main *bmain, return success; } +bool BKE_lib_override_library_resync(Main *bmain, + Scene *scene, + ViewLayer *view_layer, + ID *id_root, + Collection *override_resync_residual_storage, + const bool do_hierarchy_enforce, + BlendFileReadReport *reports) +{ + const bool success = lib_override_library_resync(bmain, + scene, + view_layer, + id_root, + override_resync_residual_storage, + do_hierarchy_enforce, + true, + reports); + + return success; +} + /* Also tag ancestors overrides for resync. * * WARNING: Expects `bmain` to have valid relation data. @@ -1733,6 +1753,10 @@ static void lib_override_library_main_resync_on_library_indirect_level( continue; } + if (ID_IS_LINKED(id)) { + id->lib->tag |= LIBRARY_TAG_RESYNC_REQUIRED; + } + /* We cannot resync a scene that is currently active. */ if (id == &scene->id) { id->tag &= ~LIB_TAG_LIB_OVERRIDE_NEED_RESYNC; @@ -1759,7 +1783,7 @@ static void lib_override_library_main_resync_on_library_indirect_level( do_continue = true; CLOG_INFO(&LOG, 2, "Resyncing %s (%p)...", id->name, library); - const bool success = BKE_lib_override_library_resync( + const bool success = 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) { @@ -1889,6 +1913,16 @@ void BKE_lib_override_library_main_resync(Main *bmain, if (BKE_collection_is_empty(override_resync_residual_storage)) { BKE_collection_delete(bmain, override_resync_residual_storage, true); } + + LISTBASE_FOREACH (Library *, library, &bmain->libraries) { + if (library->tag & LIBRARY_TAG_RESYNC_REQUIRED) { + CLOG_INFO(&LOG, + 2, + "library '%s' contains some linked overrides that required recursive resync, " + "consider updating it", + library->filepath); + } + } } void BKE_lib_override_library_delete(Main *bmain, ID *id_root) diff --git a/source/blender/blenkernel/intern/multires_reshape.h b/source/blender/blenkernel/intern/multires_reshape.h index db419418998..8a37d0ea785 100644 --- a/source/blender/blenkernel/intern/multires_reshape.h +++ b/source/blender/blenkernel/intern/multires_reshape.h @@ -225,8 +225,8 @@ GridCoord multires_reshape_ptex_coord_to_grid(const MultiresReshapeContext *resh * Is calculated for the given surface derivatives at a given base face corner. */ void multires_reshape_tangent_matrix_for_corner(const MultiresReshapeContext *reshape_context, - const int face_index, - const int corner, + int face_index, + int corner, const float dPdu[3], const float dPdv[3], float r_tangent_matrix[3][3]); @@ -266,7 +266,7 @@ void multires_reshape_evaluate_limit_at_grid(const MultiresReshapeContext *resha /** * Make sure custom data is allocated for the given level. */ -void multires_reshape_ensure_grids(struct Mesh *mesh, const int level); +void multires_reshape_ensure_grids(struct Mesh *mesh, int level); /* -------------------------------------------------------------------- * Functions specific to reshaping from a set of vertices in a object position. @@ -283,7 +283,7 @@ void multires_reshape_ensure_grids(struct Mesh *mesh, const int level); bool multires_reshape_assign_final_coords_from_vertcos( const MultiresReshapeContext *reshape_context, const float (*vert_coords)[3], - const int num_vert_coords); + int num_vert_coords); /* -------------------------------------------------------------------- * Functions specific to reshaping from CCG. @@ -338,7 +338,7 @@ void multires_reshape_smooth_object_grids_with_details( * Makes it so surface on top level looks smooth. Details are not preserved */ void multires_reshape_smooth_object_grids(const MultiresReshapeContext *reshape_context, - const enum eMultiresSubdivideModeType mode); + enum eMultiresSubdivideModeType mode); /* -------------------------------------------------------------------- * Displacement, space conversion. diff --git a/source/blender/blenkernel/intern/node.cc b/source/blender/blenkernel/intern/node.cc index 8e111b94890..1f31eea4e86 100644 --- a/source/blender/blenkernel/intern/node.cc +++ b/source/blender/blenkernel/intern/node.cc @@ -1700,23 +1700,6 @@ bNodeSocket *nodeAddSocket(bNodeTree *ntree, return sock; } -bNodeSocket *nodeInsertSocket(bNodeTree *ntree, - bNode *node, - eNodeSocketInOut in_out, - const char *idname, - bNodeSocket *next_sock, - const char *identifier, - const char *name) -{ - ListBase *lb = (in_out == SOCK_IN ? &node->inputs : &node->outputs); - bNodeSocket *sock = make_socket(ntree, node, in_out, lb, idname, identifier, name); - - BLI_remlink(lb, sock); /* does nothing for new socket */ - BLI_insertlinkbefore(lb, next_sock, sock); - - return sock; -} - bool nodeIsStaticSocketType(const struct bNodeSocketType *stype) { /* @@ -1933,27 +1916,6 @@ bNodeSocket *nodeAddStaticSocket(bNodeTree *ntree, return sock; } -bNodeSocket *nodeInsertStaticSocket(bNodeTree *ntree, - bNode *node, - eNodeSocketInOut in_out, - int type, - int subtype, - bNodeSocket *next_sock, - const char *identifier, - const char *name) -{ - const char *idname = nodeStaticSocketType(type, subtype); - - if (!idname) { - CLOG_ERROR(&LOG, "static node socket type %d undefined", type); - return nullptr; - } - - bNodeSocket *sock = nodeInsertSocket(ntree, node, in_out, idname, next_sock, identifier, name); - sock->type = type; - return sock; -} - static void node_socket_free(bNodeSocket *sock, const bool do_id_user) { if (sock->prop) { @@ -1985,6 +1947,14 @@ void nodeRemoveSocketEx(struct bNodeTree *ntree, } } + LISTBASE_FOREACH_MUTABLE (bNodeLink *, link, &node->internal_links) { + if (link->fromsock == sock || link->tosock == sock) { + BLI_remlink(&node->internal_links, link); + MEM_freeN(link); + BKE_ntree_update_tag_node_internal_link(ntree, node); + } + } + /* this is fast, this way we don't need an in_out argument */ BLI_remlink(&node->inputs, sock); BLI_remlink(&node->outputs, sock); @@ -2305,14 +2275,6 @@ bNode *node_copy(bNodeTree *dst_tree, } // namespace blender::bke -bNode *BKE_node_copy(bNodeTree *dst_tree, - const bNode *src_node, - const int flag, - const bool unique_name) -{ - return blender::bke::node_copy(dst_tree, *src_node, flag, unique_name); -} - static int node_count_links(const bNodeTree *ntree, const bNodeSocket *socket) { int count = 0; @@ -2872,18 +2834,6 @@ void BKE_node_preview_remove_unused(bNodeTree *ntree) (bNodeInstanceValueFP)BKE_node_preview_free); } -void BKE_node_preview_free_tree(bNodeTree *ntree) -{ - if (!ntree) { - return; - } - - if (ntree->previews) { - BKE_node_instance_hash_free(ntree->previews, (bNodeInstanceValueFP)BKE_node_preview_free); - ntree->previews = nullptr; - } -} - void BKE_node_preview_clear(bNodePreview *preview) { if (preview && preview->rect) { @@ -3587,11 +3537,6 @@ bNode *ntreeFindType(const bNodeTree *ntree, int type) return nullptr; } -bool ntreeHasType(const bNodeTree *ntree, int type) -{ - return ntreeFindType(ntree, type) != nullptr; -} - bool ntreeHasTree(const bNodeTree *ntree, const bNodeTree *lookup) { if (ntree == lookup) { @@ -4637,6 +4582,7 @@ static void registerCompositNodes() register_node_type_cmp_denoise(); register_node_type_cmp_antialiasing(); + register_node_type_cmp_convert_color_space(); register_node_type_cmp_valtorgb(); register_node_type_cmp_rgbtobw(); register_node_type_cmp_setalpha(); diff --git a/source/blender/blenkernel/intern/subdiv_mesh.c b/source/blender/blenkernel/intern/subdiv_mesh.c index 9630b30a21e..5bf519e5f70 100644 --- a/source/blender/blenkernel/intern/subdiv_mesh.c +++ b/source/blender/blenkernel/intern/subdiv_mesh.c @@ -1118,7 +1118,7 @@ static void subdiv_mesh_vertex_of_loose_edge(const struct SubdivForeachContext * find_edge_neighbors(ctx, coarse_edge, neighbors); /* Interpolate custom data when not an end point. * This data has already been copied from the original vertex by #subdiv_mesh_vertex_loose. */ - if (u != 0.0 && u != 1.0) { + if (!ELEM(u, 0.0, 1.0)) { subdiv_mesh_vertex_of_loose_edge_interpolate(ctx, coarse_edge, u, subdiv_vertex_index); } /* Interpolate coordinate. */ diff --git a/source/blender/blenlib/BLI_any.hh b/source/blender/blenlib/BLI_any.hh index 0fc5de5540f..7ffc323adf6 100644 --- a/source/blender/blenlib/BLI_any.hh +++ b/source/blender/blenlib/BLI_any.hh @@ -209,7 +209,7 @@ class Any { /** * Constructs a new #Any that contains the given value. */ - template<typename T, typename X = std::enable_if_t<!is_same_any_v<T>, void>> + template<typename T, BLI_ENABLE_IF((!is_same_any_v<T>))> Any(T &&value) : Any(std::in_place_type<T>, std::forward<T>(value)) { } diff --git a/source/blender/blenlib/BLI_array.h b/source/blender/blenlib/BLI_array.h index 5b15bb979f5..85fa07d8563 100644 --- a/source/blender/blenlib/BLI_array.h +++ b/source/blender/blenlib/BLI_array.h @@ -53,9 +53,9 @@ */ void _bli_array_grow_func(void **arr_p, const void *arr_static, - const int sizeof_arr_p, - const int arr_len, - const int num, + int sizeof_arr_p, + int arr_len, + int num, const char *alloc_str); /* -------------------------------------------------------------------- */ diff --git a/source/blender/blenlib/BLI_array.hh b/source/blender/blenlib/BLI_array.hh index 32588b7450d..80464499634 100644 --- a/source/blender/blenlib/BLI_array.hh +++ b/source/blender/blenlib/BLI_array.hh @@ -100,7 +100,7 @@ class Array { /** * Create a new array that contains copies of all values. */ - template<typename U, typename std::enable_if_t<std::is_convertible_v<U, T>> * = nullptr> + template<typename U, BLI_ENABLE_IF((std::is_convertible_v<U, T>))> Array(Span<U> values, Allocator allocator = {}) : Array(NoExceptConstructor(), allocator) { const int64_t size = values.size(); @@ -112,7 +112,7 @@ class Array { /** * Create a new array that contains copies of all values. */ - template<typename U, typename std::enable_if_t<std::is_convertible_v<U, T>> * = nullptr> + template<typename U, BLI_ENABLE_IF((std::is_convertible_v<U, T>))> Array(const std::initializer_list<U> &values, Allocator allocator = {}) : Array(Span<U>(values), allocator) { @@ -230,13 +230,13 @@ class Array { return MutableSpan<T>(data_, size_); } - template<typename U, typename std::enable_if_t<is_span_convertible_pointer_v<T, U>> * = nullptr> + template<typename U, BLI_ENABLE_IF((is_span_convertible_pointer_v<T, U>))> operator Span<U>() const { return Span<U>(data_, size_); } - template<typename U, typename std::enable_if_t<is_span_convertible_pointer_v<T, U>> * = nullptr> + template<typename U, BLI_ENABLE_IF((is_span_convertible_pointer_v<T, U>))> operator MutableSpan<U>() { return MutableSpan<U>(data_, size_); diff --git a/source/blender/blenlib/BLI_array_store_utils.h b/source/blender/blenlib/BLI_array_store_utils.h index 771f4f962a7..01d7f8804ab 100644 --- a/source/blender/blenlib/BLI_array_store_utils.h +++ b/source/blender/blenlib/BLI_array_store_utils.h @@ -32,10 +32,10 @@ struct BArrayStore_AtSize { }; BArrayStore *BLI_array_store_at_size_ensure(struct BArrayStore_AtSize *bs_stride, - const int stride, - const int chunk_size); + int stride, + int chunk_size); -BArrayStore *BLI_array_store_at_size_get(struct BArrayStore_AtSize *bs_stride, const int stride); +BArrayStore *BLI_array_store_at_size_get(struct BArrayStore_AtSize *bs_stride, int stride); void BLI_array_store_at_size_clear(struct BArrayStore_AtSize *bs_stride); diff --git a/source/blender/blenlib/BLI_array_utils.h b/source/blender/blenlib/BLI_array_utils.h index eb14b030bf9..50fc2ce909b 100644 --- a/source/blender/blenlib/BLI_array_utils.h +++ b/source/blender/blenlib/BLI_array_utils.h @@ -52,7 +52,7 @@ void _bli_array_wrap(void *arr, uint arr_len, size_t arr_stride, int dir); * Access via #BLI_array_wrap */ void _bli_array_permute( - void *arr, const uint arr_len, const size_t arr_stride, const uint *order, void *arr_temp); + void *arr, uint arr_len, const size_t arr_stride, const uint *order, void *arr_temp); #define BLI_array_permute(arr, arr_len, order) \ _bli_array_permute(arr, arr_len, sizeof(*(arr)), order, NULL) #define BLI_array_permute_ex(arr, arr_len, order, arr_temp) \ diff --git a/source/blender/blenlib/BLI_assert.h b/source/blender/blenlib/BLI_assert.h index e32a19cfc25..ad5e2b29766 100644 --- a/source/blender/blenlib/BLI_assert.h +++ b/source/blender/blenlib/BLI_assert.h @@ -31,11 +31,11 @@ extern "C" { /* Utility functions. */ -void _BLI_assert_print_pos(const char *file, const int line, const char *function, const char *id); +void _BLI_assert_print_pos(const char *file, int line, const char *function, const char *id); void _BLI_assert_print_extra(const char *str); void _BLI_assert_print_backtrace(void); void _BLI_assert_abort(void); -void _BLI_assert_unreachable_print(const char *file, const int line, const char *function); +void _BLI_assert_unreachable_print(const char *file, int line, const char *function); #ifdef _MSC_VER # include <crtdbg.h> /* for _STATIC_ASSERT */ diff --git a/source/blender/blenlib/BLI_astar.h b/source/blender/blenlib/BLI_astar.h index a1d4e28dad9..26b45f1ebe6 100644 --- a/source/blender/blenlib/BLI_astar.h +++ b/source/blender/blenlib/BLI_astar.h @@ -82,7 +82,7 @@ typedef struct BLI_AStarGraph { * \param custom_data: an opaque pointer attached to this link, * available e.g. to cost callback function. */ -void BLI_astar_node_init(BLI_AStarGraph *as_graph, const int node_index, void *custom_data); +void BLI_astar_node_init(BLI_AStarGraph *as_graph, int node_index, void *custom_data); /** * Add a link between two nodes of our A* graph. * @@ -91,15 +91,12 @@ void BLI_astar_node_init(BLI_AStarGraph *as_graph, const int node_index, void *c * \param custom_data: An opaque pointer attached to this link, * available e.g. to cost callback function. */ -void BLI_astar_node_link_add(BLI_AStarGraph *as_graph, - const int node1_index, - const int node2_index, - const float cost, - void *custom_data); +void BLI_astar_node_link_add( + BLI_AStarGraph *as_graph, int node1_index, int node2_index, float cost, void *custom_data); /** * \return The index of the other node of given link. */ -int BLI_astar_node_link_other_node(BLI_AStarGNLink *lnk, const int idx); +int BLI_astar_node_link_other_node(BLI_AStarGNLink *lnk, int idx); /** * Initialize a solution data for given A* graph. Does not compute anything! @@ -138,9 +135,9 @@ void BLI_astar_solution_free(BLI_AStarSolution *as_solution); typedef float (*astar_f_cost)(BLI_AStarGraph *as_graph, BLI_AStarSolution *as_solution, BLI_AStarGNLink *link, - const int node_idx_curr, - const int node_idx_next, - const int node_idx_dst); + int node_idx_curr, + int node_idx_next, + int node_idx_dst); /** * Initialize an A* graph. Total number of nodes must be known. @@ -150,7 +147,7 @@ typedef float (*astar_f_cost)(BLI_AStarGraph *as_graph, * \param custom_data: an opaque pointer attached to this link, * available e.g. to cost callback function. */ -void BLI_astar_graph_init(BLI_AStarGraph *as_graph, const int node_num, void *custom_data); +void BLI_astar_graph_init(BLI_AStarGraph *as_graph, int node_num, void *custom_data); void BLI_astar_graph_free(BLI_AStarGraph *as_graph); /** * Solve a path in given graph, using given 'cost' callback function. @@ -161,11 +158,11 @@ void BLI_astar_graph_free(BLI_AStarGraph *as_graph); * \return true if a path was found, false otherwise. */ bool BLI_astar_graph_solve(BLI_AStarGraph *as_graph, - const int node_index_src, - const int node_index_dst, + int node_index_src, + int node_index_dst, astar_f_cost f_cost_cb, BLI_AStarSolution *r_solution, - const int max_steps); + int max_steps); #ifdef __cplusplus } diff --git a/source/blender/blenlib/BLI_bitmap_draw_2d.h b/source/blender/blenlib/BLI_bitmap_draw_2d.h index 1b9ff2162e3..3831ed3c9e7 100644 --- a/source/blender/blenlib/BLI_bitmap_draw_2d.h +++ b/source/blender/blenlib/BLI_bitmap_draw_2d.h @@ -55,12 +55,12 @@ void BLI_bitmap_draw_2d_tri_v2i(const int p1[2], * } while (++x != x_end); * \endcode */ -void BLI_bitmap_draw_2d_poly_v2i_n(const int xmin, - const int ymin, - const int xmax, - const int ymax, +void BLI_bitmap_draw_2d_poly_v2i_n(int xmin, + int ymin, + int xmax, + int ymax, const int verts[][2], - const int verts_len, + int verts_len, void (*callback)(int x, int x_end, int y, void *), void *user_data); diff --git a/source/blender/blenlib/BLI_boxpack_2d.h b/source/blender/blenlib/BLI_boxpack_2d.h index e743424db59..eee1a0d3d41 100644 --- a/source/blender/blenlib/BLI_boxpack_2d.h +++ b/source/blender/blenlib/BLI_boxpack_2d.h @@ -58,7 +58,7 @@ typedef struct BoxPack { * \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 unsigned int len, float *r_tot_x, float *r_tot_y); +void BLI_box_pack_2d(BoxPack *boxarray, unsigned int len, float *r_tot_x, float *r_tot_y); typedef struct FixedSizeBoxPack { struct FixedSizeBoxPack *next, *prev; diff --git a/source/blender/blenlib/BLI_convexhull_2d.h b/source/blender/blenlib/BLI_convexhull_2d.h index 44758fb3880..77f3eedec95 100644 --- a/source/blender/blenlib/BLI_convexhull_2d.h +++ b/source/blender/blenlib/BLI_convexhull_2d.h @@ -32,7 +32,7 @@ extern "C" { * \param r_points: An array of the convex hull vertex indices (max is n). * \returns the number of points in r_points. */ -int BLI_convexhull_2d_sorted(const float (*points)[2], const int n, int r_points[]); +int BLI_convexhull_2d_sorted(const float (*points)[2], int n, int r_points[]); /** * A.M. Andrew's monotone chain 2D convex hull algorithm. * @@ -43,7 +43,7 @@ int BLI_convexhull_2d_sorted(const float (*points)[2], const int n, int r_points * even though the final result will be no more than \a n in size. * \returns the number of points in r_points. */ -int BLI_convexhull_2d(const float (*points)[2], const int n, int r_points[]); +int BLI_convexhull_2d(const float (*points)[2], int n, int r_points[]); /** * \return The best angle for fitting the convex hull to an axis aligned bounding box. diff --git a/source/blender/blenlib/BLI_edgehash.h b/source/blender/blenlib/BLI_edgehash.h index b0f71655c19..26eb8ab7665 100644 --- a/source/blender/blenlib/BLI_edgehash.h +++ b/source/blender/blenlib/BLI_edgehash.h @@ -54,7 +54,7 @@ enum { EDGEHASH_FLAG_ALLOW_DUPES = (1 << 0), }; -EdgeHash *BLI_edgehash_new_ex(const char *info, const unsigned int nentries_reserve); +EdgeHash *BLI_edgehash_new_ex(const char *info, unsigned int nentries_reserve); EdgeHash *BLI_edgehash_new(const char *info) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT; void BLI_edgehash_free(EdgeHash *eh, EdgeHashFreeFP free_value); void BLI_edgehash_print(EdgeHash *eh); @@ -138,7 +138,7 @@ int BLI_edgehash_len(const EdgeHash *eh) ATTR_WARN_UNUSED_RESULT; /** * Remove all edges from hash. */ -void BLI_edgehash_clear_ex(EdgeHash *eh, EdgeHashFreeFP free_value, const uint reserve); +void BLI_edgehash_clear_ex(EdgeHash *eh, EdgeHashFreeFP free_value, uint reserve); /** * Wraps #BLI_edgehash_clear_ex with zero entries reserved. */ @@ -207,8 +207,8 @@ typedef struct EdgeSetIterator { uint index; } EdgeSetIterator; -EdgeSet *BLI_edgeset_new_ex(const char *info, const unsigned int nentries_reserve) - ATTR_MALLOC ATTR_WARN_UNUSED_RESULT; +EdgeSet *BLI_edgeset_new_ex(const char *info, + unsigned int nentries_reserve) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT; EdgeSet *BLI_edgeset_new(const char *info) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT; int BLI_edgeset_len(const EdgeSet *es) ATTR_WARN_UNUSED_RESULT; /** diff --git a/source/blender/blenlib/BLI_endian_switch.h b/source/blender/blenlib/BLI_endian_switch.h index e6ccbe4629a..c8257483616 100644 --- a/source/blender/blenlib/BLI_endian_switch.h +++ b/source/blender/blenlib/BLI_endian_switch.h @@ -42,14 +42,14 @@ BLI_INLINE void BLI_endian_switch_double(double *val) ATTR_NONNULL(1); /* endian_switch.c */ -void BLI_endian_switch_int16_array(short *val, const int size) ATTR_NONNULL(1); -void BLI_endian_switch_uint16_array(unsigned short *val, const int size) ATTR_NONNULL(1); -void BLI_endian_switch_int32_array(int *val, const int size) ATTR_NONNULL(1); -void BLI_endian_switch_uint32_array(unsigned int *val, const int size) ATTR_NONNULL(1); -void BLI_endian_switch_float_array(float *val, const int size) ATTR_NONNULL(1); -void BLI_endian_switch_int64_array(int64_t *val, const int size) ATTR_NONNULL(1); -void BLI_endian_switch_uint64_array(uint64_t *val, const int size) ATTR_NONNULL(1); -void BLI_endian_switch_double_array(double *val, const int size) ATTR_NONNULL(1); +void BLI_endian_switch_int16_array(short *val, int size) ATTR_NONNULL(1); +void BLI_endian_switch_uint16_array(unsigned short *val, int size) ATTR_NONNULL(1); +void BLI_endian_switch_int32_array(int *val, int size) ATTR_NONNULL(1); +void BLI_endian_switch_uint32_array(unsigned int *val, int size) ATTR_NONNULL(1); +void BLI_endian_switch_float_array(float *val, int size) ATTR_NONNULL(1); +void BLI_endian_switch_int64_array(int64_t *val, int size) ATTR_NONNULL(1); +void BLI_endian_switch_uint64_array(uint64_t *val, int size) ATTR_NONNULL(1); +void BLI_endian_switch_double_array(double *val, int size) ATTR_NONNULL(1); #ifdef __cplusplus } diff --git a/source/blender/blenlib/BLI_fileops.h b/source/blender/blenlib/BLI_fileops.h index 2ef9b8f6c36..0022823b3de 100644 --- a/source/blender/blenlib/BLI_fileops.h +++ b/source/blender/blenlib/BLI_fileops.h @@ -181,7 +181,7 @@ void BLI_filelist_entry_duplicate(struct direntry *dst, const struct direntry *s */ void BLI_filelist_duplicate(struct direntry **dest_filelist, struct direntry *const src_filelist, - const unsigned int nrentries); + unsigned int nrentries); /** * Frees storage for a single direntry, not the direntry itself. */ @@ -189,20 +189,20 @@ void BLI_filelist_entry_free(struct direntry *entry); /** * Frees storage for an array of #direntry, including the array itself. */ -void BLI_filelist_free(struct direntry *filelist, const unsigned int nrentries); +void BLI_filelist_free(struct direntry *filelist, unsigned int nrentries); /** * Convert given entry's size into human-readable strings. */ void BLI_filelist_entry_size_to_string(const struct stat *st, - const uint64_t sz, - const bool compact, + uint64_t sz, + bool compact, char r_size[FILELIST_DIRENTRY_SIZE_LEN]); /** * Convert given entry's modes into human-readable strings. */ void BLI_filelist_entry_mode_to_string(const struct stat *st, - const bool compact, + bool compact, char r_mode1[FILELIST_DIRENTRY_MODE_LEN], char r_mode2[FILELIST_DIRENTRY_MODE_LEN], char r_mode3[FILELIST_DIRENTRY_MODE_LEN]); @@ -210,7 +210,7 @@ void BLI_filelist_entry_mode_to_string(const struct stat *st, * Convert given entry's owner into human-readable strings. */ void BLI_filelist_entry_owner_to_string(const struct stat *st, - const bool compact, + bool compact, char r_owner[FILELIST_DIRENTRY_OWNER_LEN]); /** * Convert given entry's time into human-readable strings. @@ -219,8 +219,8 @@ void BLI_filelist_entry_owner_to_string(const struct stat *st, * \param r_is_yesterday: optional, returns true if the date matches yesterday's. */ void BLI_filelist_entry_datetime_to_string(const struct stat *st, - const int64_t ts, - const bool compact, + int64_t ts, + bool compact, char r_time[FILELIST_DIRENTRY_TIME_LEN], char r_date[FILELIST_DIRENTRY_DATE_LEN], bool *r_is_today, diff --git a/source/blender/blenlib/BLI_function_ref.hh b/source/blender/blenlib/BLI_function_ref.hh index 71be7d7f029..c762756b474 100644 --- a/source/blender/blenlib/BLI_function_ref.hh +++ b/source/blender/blenlib/BLI_function_ref.hh @@ -80,6 +80,8 @@ * */ +#include "BLI_memory_utils.hh" + namespace blender { template<typename Function> class FunctionRef; @@ -125,8 +127,8 @@ template<typename Ret, typename... Params> class FunctionRef<Ret(Params...)> { * another lambda. */ template<typename Callable, - std::enable_if_t<!std::is_same_v<std::remove_cv_t<std::remove_reference_t<Callable>>, - FunctionRef>> * = nullptr> + BLI_ENABLE_IF(( + !std::is_same_v<std::remove_cv_t<std::remove_reference_t<Callable>>, FunctionRef>))> FunctionRef(Callable &&callable) : callback_(callback_fn<typename std::remove_reference_t<Callable>>), callable_(reinterpret_cast<intptr_t>(&callable)) diff --git a/source/blender/blenlib/BLI_ghash.h b/source/blender/blenlib/BLI_ghash.h index fca705535a3..1c5adb8ee82 100644 --- a/source/blender/blenlib/BLI_ghash.h +++ b/source/blender/blenlib/BLI_ghash.h @@ -99,7 +99,7 @@ enum { GHash *BLI_ghash_new_ex(GHashHashFP hashfp, GHashCmpFP cmpfp, const char *info, - const unsigned int nentries_reserve) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT; + unsigned int nentries_reserve) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT; /** * Wraps #BLI_ghash_new_ex with zero entries reserved. */ @@ -124,7 +124,7 @@ void BLI_ghash_free(GHash *gh, GHashKeyFreeFP keyfreefp, GHashValFreeFP valfreef /** * Reserve given amount of entries (resize \a gh accordingly if needed). */ -void BLI_ghash_reserve(GHash *gh, const unsigned int nentries_reserve); +void BLI_ghash_reserve(GHash *gh, unsigned int nentries_reserve); /** * Insert a key/value pair into the \a gh. * @@ -226,7 +226,7 @@ void BLI_ghash_clear(GHash *gh, GHashKeyFreeFP keyfreefp, GHashValFreeFP valfree void BLI_ghash_clear_ex(GHash *gh, GHashKeyFreeFP keyfreefp, GHashValFreeFP valfreefp, - const unsigned int nentries_reserve); + unsigned int nentries_reserve); /** * Remove \a key from \a gh, returning the value or NULL if the key wasn't found. * @@ -372,7 +372,7 @@ typedef GHashIterState GSetIterState; GSet *BLI_gset_new_ex(GSetHashFP hashfp, GSetCmpFP cmpfp, const char *info, - const unsigned int nentries_reserve) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT; + unsigned int nentries_reserve) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT; GSet *BLI_gset_new(GSetHashFP hashfp, GSetCmpFP cmpfp, const char *info) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT; @@ -428,7 +428,7 @@ bool BLI_gset_haskey(const GSet *gs, const void *key) ATTR_WARN_UNUSED_RESULT; bool BLI_gset_pop(GSet *gs, GSetIterState *state, void **r_key) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(); bool BLI_gset_remove(GSet *gs, const void *key, GSetKeyFreeFP keyfreefp); -void BLI_gset_clear_ex(GSet *gs, GSetKeyFreeFP keyfreefp, const unsigned int nentries_reserve); +void BLI_gset_clear_ex(GSet *gs, GSetKeyFreeFP keyfreefp, unsigned int nentries_reserve); void BLI_gset_clear(GSet *gs, GSetKeyFreeFP keyfreefp); /* When set's are used for key & value. */ @@ -630,30 +630,30 @@ void BLI_ghashutil_pairfree(void *ptr); * Wrapper GHash Creation Functions */ -GHash *BLI_ghash_ptr_new_ex(const char *info, const unsigned int nentries_reserve) - ATTR_MALLOC ATTR_WARN_UNUSED_RESULT; +GHash *BLI_ghash_ptr_new_ex(const char *info, + unsigned int nentries_reserve) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT; GHash *BLI_ghash_ptr_new(const char *info) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT; -GHash *BLI_ghash_str_new_ex(const char *info, const unsigned int nentries_reserve) - ATTR_MALLOC ATTR_WARN_UNUSED_RESULT; +GHash *BLI_ghash_str_new_ex(const char *info, + unsigned int nentries_reserve) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT; GHash *BLI_ghash_str_new(const char *info) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT; -GHash *BLI_ghash_int_new_ex(const char *info, const unsigned int nentries_reserve) - ATTR_MALLOC ATTR_WARN_UNUSED_RESULT; +GHash *BLI_ghash_int_new_ex(const char *info, + unsigned int nentries_reserve) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT; GHash *BLI_ghash_int_new(const char *info) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT; -GHash *BLI_ghash_pair_new_ex(const char *info, const unsigned int nentries_reserve) - ATTR_MALLOC ATTR_WARN_UNUSED_RESULT; +GHash *BLI_ghash_pair_new_ex(const char *info, + unsigned int nentries_reserve) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT; GHash *BLI_ghash_pair_new(const char *info) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT; GSet *BLI_gset_ptr_new_ex(const char *info, - const unsigned int nentries_reserve) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT; + unsigned int nentries_reserve) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT; GSet *BLI_gset_ptr_new(const char *info); GSet *BLI_gset_str_new_ex(const char *info, - const unsigned int nentries_reserve) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT; + unsigned int nentries_reserve) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT; GSet *BLI_gset_str_new(const char *info); -GSet *BLI_gset_pair_new_ex(const char *info, const unsigned int nentries_reserve) - ATTR_MALLOC ATTR_WARN_UNUSED_RESULT; +GSet *BLI_gset_pair_new_ex(const char *info, + unsigned int nentries_reserve) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT; GSet *BLI_gset_pair_new(const char *info) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT; GSet *BLI_gset_int_new_ex(const char *info, - const unsigned int nentries_reserve) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT; + unsigned int nentries_reserve) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT; GSet *BLI_gset_int_new(const char *info) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT; /** \} */ diff --git a/source/blender/blenlib/BLI_kdopbvh.h b/source/blender/blenlib/BLI_kdopbvh.h index 2f41be369c1..cee9ec4c0a8 100644 --- a/source/blender/blenlib/BLI_kdopbvh.h +++ b/source/blender/blenlib/BLI_kdopbvh.h @@ -137,7 +137,7 @@ typedef void (*BVHTree_NearestProjectedCallback)(void *userdata, int index, const struct DistProjectedAABBPrecalc *precalc, const float (*clip_plane)[4], - const int clip_plane_len, + int clip_plane_len, BVHTreeNearest *nearest); /* callbacks to BLI_bvhtree_walk_dfs */ @@ -200,8 +200,8 @@ BVHTreeOverlap *BLI_bvhtree_overlap_ex(const BVHTree *tree1, uint *r_overlap_tot, BVHTree_OverlapCallback callback, void *userdata, - const uint max_interactions, - const int flag); + uint max_interactions, + int flag); BVHTreeOverlap *BLI_bvhtree_overlap(const BVHTree *tree1, const BVHTree *tree2, unsigned int *r_overlap_tot, @@ -248,7 +248,7 @@ int BLI_bvhtree_find_nearest(BVHTree *tree, */ int BLI_bvhtree_find_nearest_first(BVHTree *tree, const float co[3], - const float dist_sq, + float dist_sq, BVHTree_NearestPointCallback callback, void *userdata); diff --git a/source/blender/blenlib/BLI_kdtree_impl.h b/source/blender/blenlib/BLI_kdtree_impl.h index 35dbf141c92..b15ae4a8a24 100644 --- a/source/blender/blenlib/BLI_kdtree_impl.h +++ b/source/blender/blenlib/BLI_kdtree_impl.h @@ -47,12 +47,12 @@ int BLI_kdtree_nd_(find_nearest)(const KDTree *tree, int BLI_kdtree_nd_(find_nearest_n)(const KDTree *tree, const float co[KD_DIMS], KDTreeNearest *r_nearest, - const uint nearest_len_capacity) ATTR_NONNULL(1, 2, 3); + uint nearest_len_capacity) ATTR_NONNULL(1, 2, 3); int BLI_kdtree_nd_(range_search)(const KDTree *tree, const float co[KD_DIMS], KDTreeNearest **r_nearest, - const float range) ATTR_NONNULL(1, 2) ATTR_WARN_UNUSED_RESULT; + float range) ATTR_NONNULL(1, 2) ATTR_WARN_UNUSED_RESULT; int BLI_kdtree_nd_(find_nearest_cb)( const KDTree *tree, @@ -68,7 +68,7 @@ void BLI_kdtree_nd_(range_search_cb)( void *user_data); int BLI_kdtree_nd_(calc_duplicates_fast)(const KDTree *tree, - const float range, + float range, bool use_index_order, int *doubles); @@ -79,7 +79,7 @@ int BLI_kdtree_nd_(find_nearest_n_with_len_squared_cb)( const KDTree *tree, const float co[KD_DIMS], KDTreeNearest *r_nearest, - const uint nearest_len_capacity, + uint nearest_len_capacity, float (*len_sq_fn)(const float co_search[KD_DIMS], const float co_test[KD_DIMS], const void *user_data), @@ -88,7 +88,7 @@ int BLI_kdtree_nd_(range_search_with_len_squared_cb)( const KDTree *tree, const float co[KD_DIMS], KDTreeNearest **r_nearest, - const float range, + float range, float (*len_sq_fn)(const float co_search[KD_DIMS], const float co_test[KD_DIMS], const void *user_data), diff --git a/source/blender/blenlib/BLI_lasso_2d.h b/source/blender/blenlib/BLI_lasso_2d.h index 5f034bfdc1d..2e4a2ed22b4 100644 --- a/source/blender/blenlib/BLI_lasso_2d.h +++ b/source/blender/blenlib/BLI_lasso_2d.h @@ -29,22 +29,19 @@ extern "C" { struct rcti; -void BLI_lasso_boundbox(struct rcti *rect, const int mcoords[][2], const unsigned int mcoords_len); -bool BLI_lasso_is_point_inside(const int mcoords[][2], - const unsigned int mcoords_len, - const int sx, - const int sy, - const int error_value); +void BLI_lasso_boundbox(struct rcti *rect, const int mcoords[][2], unsigned int mcoords_len); +bool BLI_lasso_is_point_inside( + const int mcoords[][2], unsigned int mcoords_len, int sx, int sy, int error_value); /** * Edge version for lasso select. We assume bound-box check was done. */ bool BLI_lasso_is_edge_inside(const int mcoords[][2], - const unsigned int mcoords_len, + unsigned int mcoords_len, int x0, int y0, int x1, int y1, - const int error_value); + int error_value); #ifdef __cplusplus } diff --git a/source/blender/blenlib/BLI_listbase.h b/source/blender/blenlib/BLI_listbase.h index a2a6e958213..64852b95ae4 100644 --- a/source/blender/blenlib/BLI_listbase.h +++ b/source/blender/blenlib/BLI_listbase.h @@ -44,7 +44,7 @@ int BLI_findindex(const struct ListBase *listbase, const void *vlink) ATTR_WARN_ */ int BLI_findstringindex(const struct ListBase *listbase, const char *id, - const int offset) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1); + int offset) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1); /** * Return a ListBase representing the entire list the given Link is in. @@ -64,21 +64,21 @@ void *BLI_findlink(const struct ListBase *listbase, int number) ATTR_WARN_UNUSED */ void *BLI_findstring(const struct ListBase *listbase, const char *id, - const int offset) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1); + int offset) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1); /** * Finds the first element of \a listbase which contains a pointer to the * null-terminated string \a id at the specified offset, returning NULL if not found. */ void *BLI_findstring_ptr(const struct ListBase *listbase, const char *id, - const int offset) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1); + int offset) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1); /** * Finds the first element of listbase which contains the specified pointer value * at the specified offset, returning NULL if not found. */ void *BLI_findptr(const struct ListBase *listbase, const void *ptr, - const int offset) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1); + int offset) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1); /** * Finds the first element of listbase which contains the specified bytes * at the specified offset, returning NULL if not found. @@ -86,7 +86,7 @@ void *BLI_findptr(const struct ListBase *listbase, void *BLI_listbase_bytes_find(const ListBase *listbase, const void *bytes, const size_t bytes_size, - const int offset) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1, 2); + int offset) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1, 2); /** * Find the first item in the list that matches the given string, or the given index as fallback. * @@ -97,7 +97,7 @@ void *BLI_listbase_bytes_find(const ListBase *listbase, void *BLI_listbase_string_or_index_find(const struct ListBase *listbase, const char *string, const size_t string_offset, - const int index) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1); + int index) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1); /* Find backwards. */ @@ -112,21 +112,21 @@ void *BLI_rfindlink(const struct ListBase *listbase, int number) ATTR_WARN_UNUSE */ void *BLI_rfindstring(const struct ListBase *listbase, const char *id, - const int offset) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1); + int offset) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1); /** * Finds the last element of \a listbase which contains a pointer to the * null-terminated string \a id at the specified offset, returning NULL if not found. */ void *BLI_rfindstring_ptr(const struct ListBase *listbase, const char *id, - const int offset) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1); + int offset) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1); /** * Finds the last element of listbase which contains the specified pointer value * at the specified offset, returning NULL if not found. */ void *BLI_rfindptr(const struct ListBase *listbase, const void *ptr, - const int offset) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1); + int offset) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1); /** * Finds the last element of listbase which contains the specified bytes * at the specified offset, returning NULL if not found. @@ -134,7 +134,7 @@ void *BLI_rfindptr(const struct ListBase *listbase, void *BLI_listbase_bytes_rfind(const ListBase *listbase, const void *bytes, const size_t bytes_size, - const int offset) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1, 2); + int offset) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1, 2); /** * Removes and disposes of the entire contents of \a listbase using guardedalloc. @@ -221,7 +221,7 @@ void BLI_freelist(struct ListBase *listbase) ATTR_NONNULL(1); * \note Use to avoid redundant looping. */ int BLI_listbase_count_at_most(const struct ListBase *listbase, - const int count_max) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1); + int count_max) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1); /** * Returns the number of elements in \a listbase. */ diff --git a/source/blender/blenlib/BLI_math_base.h b/source/blender/blenlib/BLI_math_base.h index 6c82bd89e64..f6462233106 100644 --- a/source/blender/blenlib/BLI_math_base.h +++ b/source/blender/blenlib/BLI_math_base.h @@ -183,7 +183,7 @@ MINLINE size_t clamp_z(size_t value, size_t min, size_t max); * * \param max_diff: the maximum absolute difference. */ -MINLINE int compare_ff(float a, float b, const float max_diff); +MINLINE int compare_ff(float a, float b, float max_diff); /** * Almost-equal for IEEE floats, using their integer representation * (mixing ULP and absolute difference methods). @@ -195,10 +195,8 @@ MINLINE int compare_ff(float a, float b, const float max_diff); * * \see https://randomascii.wordpress.com/2012/02/25/comparing-floating-point-numbers-2012-edition/ */ -MINLINE int compare_ff_relative(float a, float b, const float max_diff, const int max_ulps); -MINLINE bool compare_threshold_relative(const float value1, - const float value2, - const float thresh); +MINLINE int compare_ff_relative(float a, float b, float max_diff, int max_ulps); +MINLINE bool compare_threshold_relative(float value1, float value2, float thresh); MINLINE float signf(float f); MINLINE int signum_i_ex(float a, float eps); @@ -213,13 +211,13 @@ MINLINE float power_of_2(float f); * Returns number of (base ten) *significant* digits of integer part of given float * (negative in case of decimal-only floats, 0.01 returns -1 e.g.). */ -MINLINE int integer_digits_f(const float f); +MINLINE int integer_digits_f(float f); /** * Returns number of (base ten) *significant* digits of integer part of given double * (negative in case of decimal-only floats, 0.01 returns -1 e.g.). */ -MINLINE int integer_digits_d(const double d); -MINLINE int integer_digits_i(const int i); +MINLINE int integer_digits_d(double d); +MINLINE int integer_digits_i(int i); /* These don't really fit anywhere but were being copied about a lot. */ diff --git a/source/blender/blenlib/BLI_math_color.h b/source/blender/blenlib/BLI_math_color.h index 32424f37676..0798acbb790 100644 --- a/source/blender/blenlib/BLI_math_color.h +++ b/source/blender/blenlib/BLI_math_color.h @@ -107,7 +107,7 @@ MINLINE void linearrgb_to_srgb_v4(float srgb[4], const float linear[4]); MINLINE void srgb_to_linearrgb_predivide_v4(float linear[4], const float srgb[4]); MINLINE void linearrgb_to_srgb_predivide_v4(float srgb[4], const float linear[4]); -MINLINE unsigned short to_srgb_table_lookup(const float f); +MINLINE unsigned short to_srgb_table_lookup(float f); MINLINE void linearrgb_to_srgb_ushort4(unsigned short srgb[4], const float linear[4]); MINLINE void srgb_to_linearrgb_uchar4(float linear[4], const unsigned char srgb[4]); MINLINE void srgb_to_linearrgb_uchar4_predivide(float linear[4], const unsigned char srgb[4]); @@ -182,7 +182,7 @@ void rgba_float_to_uchar(unsigned char r_col[4], const float col_f[4]); MINLINE float rgb_to_grayscale(const float rgb[3]); MINLINE unsigned char rgb_to_grayscale_byte(const unsigned char rgb[3]); -MINLINE int compare_rgb_uchar(const unsigned char a[3], const unsigned char b[3], const int limit); +MINLINE int compare_rgb_uchar(const unsigned char a[3], const unsigned char b[3], int limit); /** * Return triangle noise in [-0.5..1.5] range. @@ -197,19 +197,12 @@ MINLINE void float_to_byte_dither_v3( #define rgba_float_args_set_ch(col, r, g, b, a) \ rgba_float_args_set(col, (r) / 255.0f, (g) / 255.0f, (b) / 255.0f, (a) / 255.0f) -MINLINE void rgba_uchar_args_set(unsigned char col[4], - const unsigned char r, - const unsigned char g, - const unsigned char b, - const unsigned char a); -MINLINE void rgba_float_args_set( - float col[4], const float r, const float g, const float b, const float a); -MINLINE void rgba_uchar_args_test_set(unsigned char col[4], - const unsigned char r, - const unsigned char g, - const unsigned char b, - const unsigned char a); -MINLINE void cpack_cpy_3ub(unsigned char r_col[3], const unsigned int pack); +MINLINE void rgba_uchar_args_set( + unsigned char col[4], unsigned char r, unsigned char g, unsigned char b, unsigned char a); +MINLINE void rgba_float_args_set(float col[4], float r, float g, float b, float a); +MINLINE void rgba_uchar_args_test_set( + unsigned char col[4], unsigned char r, unsigned char g, unsigned char b, unsigned char a); +MINLINE void cpack_cpy_3ub(unsigned char r_col[3], unsigned int pack); void blackbody_temperature_to_rgb_table(float *r_table, int width, float min, float max); void wavelength_to_xyz_table(float *r_table, int width); diff --git a/source/blender/blenlib/BLI_math_geom.h b/source/blender/blenlib/BLI_math_geom.h index c2a5ffafa64..6d7159f73c6 100644 --- a/source/blender/blenlib/BLI_math_geom.h +++ b/source/blender/blenlib/BLI_math_geom.h @@ -372,8 +372,8 @@ void closest_on_tri_to_point_v3( float ray_point_factor_v3_ex(const float p[3], const float ray_origin[3], const float ray_direction[3], - const float epsilon, - const float fallback); + float epsilon, + float fallback); float ray_point_factor_v3(const float p[3], const float ray_origin[3], const float ray_direction[3]); @@ -385,18 +385,12 @@ float ray_point_factor_v3(const float p[3], * \param epsilon: avoid approaching divide-by-zero. * Passing a zero will just check for nonzero division. */ -float line_point_factor_v3_ex(const float p[3], - const float l1[3], - const float l2[3], - const float epsilon, - const float fallback); +float line_point_factor_v3_ex( + const float p[3], const float l1[3], const float l2[3], float epsilon, float fallback); float line_point_factor_v3(const float p[3], const float l1[3], const float l2[3]); -float line_point_factor_v2_ex(const float p[2], - const float l1[2], - const float l2[2], - const float epsilon, - const float fallback); +float line_point_factor_v2_ex( + const float p[2], const float l1[2], const float l2[2], float epsilon, float fallback); float line_point_factor_v2(const float p[2], const float l1[2], const float l2[2]); /** @@ -411,7 +405,7 @@ float line_plane_factor_v3(const float plane_co[3], * Ensure the distance between these points is no greater than 'dist'. * If it is, scale them both into the center. */ -void limit_dist_v3(float v1[3], float v2[3], const float dist); +void limit_dist_v3(float v1[3], float v2[3], float dist); /** \} */ @@ -462,7 +456,7 @@ int isect_seg_seg_v2_point_ex(const float v0[2], const float v1[2], const float v2[2], const float v3[2], - const float endpoint_bias, + float endpoint_bias, float vi[2]); int isect_seg_seg_v2_point( const float v0[2], const float v1[2], const float v2[2], const float v3[2], float vi[2]); @@ -504,13 +498,13 @@ int isect_seg_seg_v2_lambda_mu_db(const double v1[2], int isect_line_sphere_v3(const float l1[3], const float l2[3], const float sp[3], - const float r, + float r, float r_p1[3], float r_p2[3]); int isect_line_sphere_v2(const float l1[2], const float l2[2], const float sp[2], - const float r, + float r, float r_p1[2], float r_p2[2]); @@ -531,7 +525,7 @@ int isect_line_line_epsilon_v3(const float v1[3], const float v4[3], float i1[3], float i2[3], - const float epsilon); + float epsilon); int isect_line_line_v3(const float v1[3], const float v2[3], const float v3[3], @@ -558,7 +552,7 @@ bool isect_ray_ray_epsilon_v3(const float ray_origin_a[3], const float ray_direction_a[3], const float ray_origin_b[3], const float ray_direction_b[3], - const float epsilon, + float epsilon, float *r_lambda_a, float *r_lambda_b); bool isect_ray_ray_v3(const float ray_origin_a[3], @@ -578,7 +572,7 @@ bool isect_ray_plane_v3(const float ray_origin[3], const float ray_direction[3], const float plane[4], float *r_lambda, - const bool clip); + bool clip); /** * Check if a point is behind all planes. @@ -588,7 +582,7 @@ bool isect_point_planes_v3(float (*planes)[4], int totplane, const float p[3]); * Check if a point is in front all planes. * Same as isect_point_planes_v3 but with planes facing the opposite direction. */ -bool isect_point_planes_v3_negated(const float (*planes)[4], const int totplane, const float p[3]); +bool isect_point_planes_v3_negated(const float (*planes)[4], int totplane, const float p[3]); /** * Intersect line/plane. @@ -649,9 +643,9 @@ bool isect_plane_plane_v3(const float plane_a[4], */ bool isect_planes_v3_fn( const float planes[][4], - const int planes_len, - const float eps_coplanar, - const float eps_isect, + int planes_len, + float eps_coplanar, + float eps_isect, void (*callback_fn)(const float co[3], int i, int j, int k, void *user_data), void *user_data); @@ -678,8 +672,8 @@ bool isect_line_segment_tri_epsilon_v3(const float p1[3], const float v2[3], float *r_lambda, float r_uv[2], - const float epsilon); -bool isect_axial_line_segment_tri_v3(const int axis, + float epsilon); +bool isect_axial_line_segment_tri_v3(int axis, const float p1[3], const float p2[3], const float v0[3], @@ -705,7 +699,7 @@ bool isect_ray_tri_threshold_v3(const float ray_origin[3], const float v2[3], float *r_lambda, float r_uv[2], - const float threshold); + float threshold); bool isect_ray_tri_epsilon_v3(const float ray_origin[3], const float ray_direction[3], const float v0[3], @@ -713,7 +707,7 @@ bool isect_ray_tri_epsilon_v3(const float ray_origin[3], const float v2[3], float *r_lambda, float r_uv[2], - const float epsilon); + float epsilon); /** * Intersect two triangles. * @@ -793,12 +787,12 @@ bool isect_ray_line_v3(const float ray_origin[3], bool isect_point_poly_v2(const float pt[2], const float verts[][2], - const unsigned int nr, - const bool use_holes); + unsigned int nr, + bool use_holes); bool isect_point_poly_v2_int(const int pt[2], const int verts[][2], - const unsigned int nr, - const bool use_holes); + unsigned int nr, + bool use_holes); /** * Point in quad - only convex quads. @@ -823,8 +817,7 @@ bool isect_point_tri_v2_cw(const float pt[2], * x1,y1-- x2,y1 * \endcode */ -int isect_point_tri_v2_int( - const int x1, const int y1, const int x2, const int y2, const int a, const int b); +int isect_point_tri_v2_int(int x1, int y1, int x2, int y2, int a, int b); bool isect_point_tri_prism_v3(const float p[3], const float v1[3], const float v2[3], @@ -890,13 +883,13 @@ bool isect_ray_aabb_v3_simple(const float orig[3], * - ISECT_AABB_PLANE_IN_FRONT_ALL (2): AABB is completely in front of all planes; */ int isect_aabb_planes_v3(const float (*planes)[4], - const int totplane, + int totplane, const float bbmin[3], const float bbmax[3]); bool isect_sweeping_sphere_tri_v3(const float p1[3], const float p2[3], - const float radius, + float radius, const float v0[3], const float v1[3], const float v2[3], @@ -908,7 +901,7 @@ bool clip_segment_v3_plane( bool clip_segment_v3_plane_n(const float p1[3], const float p2[3], const float plane_array[][4], - const int plane_tot, + int plane_tot, float r_p1[3], float r_p2[3]); @@ -928,8 +921,8 @@ void interp_weights_quad_v3(float w[4], const float v3[3], const float v4[3], const float co[3]); -void interp_weights_poly_v3(float w[], float v[][3], const int n, const float co[3]); -void interp_weights_poly_v2(float w[], float v[][2], const int n, const float co[2]); +void interp_weights_poly_v3(float w[], float v[][3], int n, const float co[3]); +void interp_weights_poly_v2(float w[], float v[][2], int n, const float co[2]); /** `(x1, v1)(t1=0)------(x2, v2)(t2=1), 0<t<1 --> (x, v)(t)`. */ void interp_cubic_v3(float x[3], @@ -938,13 +931,13 @@ void interp_cubic_v3(float x[3], const float v1[3], const float x2[3], const float v2[3], - const float t); + float t); /** * Given an array with some invalid values this function interpolates valid values * replacing the invalid ones. */ -int interp_sparse_array(float *array, const int list_size, const float skipval); +int interp_sparse_array(float *array, int list_size, float skipval); /** * Given 2 triangles in 3D space, and a point in relation to the first triangle. @@ -1081,34 +1074,34 @@ void polarview_m4(float mat[4][4], float dist, float azimuth, float incidence, f * Matches `glFrustum` result. */ void perspective_m4(float mat[4][4], - const float left, - const float right, - const float bottom, - const float top, - const float nearClip, - const float farClip); + float left, + float right, + float bottom, + float top, + float nearClip, + float farClip); void perspective_m4_fov(float mat[4][4], - const float angle_left, - const float angle_right, - const float angle_up, - const float angle_down, - const float nearClip, - const float farClip); + float angle_left, + float angle_right, + float angle_up, + float angle_down, + float nearClip, + float farClip); /** * Matches `glOrtho` result. */ void orthographic_m4(float mat[4][4], - const float left, - const float right, - const float bottom, - const float top, - const float nearClip, - const float farClip); + float left, + float right, + float bottom, + float top, + float nearClip, + float farClip); /** * Translate a matrix created by orthographic_m4 or perspective_m4 in XY coords * (used to jitter the view). */ -void window_translate_m4(float winmat[4][4], float perspmat[4][4], const float x, const float y); +void window_translate_m4(float winmat[4][4], float perspmat[4][4], float x, float y); /** * Frustum planes extraction from a projection matrix @@ -1149,10 +1142,10 @@ void projmat_dimensions_db(const float winmat[4][4], */ void projmat_from_subregion(const float projmat[4][4], const int win_size[2], - const int x_min, - const int x_max, - const int y_min, - const int y_max, + int x_min, + int x_max, + int y_min, + int y_max, float r_projmat[4][4]); int box_clip_bounds_m4(float boundbox[2][3], const float bounds[4], float winmat[4][4]); @@ -1164,13 +1157,13 @@ void box_minmax_bounds_m4(float min[3], float max[3], float boundbox[2][3], floa /** \name Mapping * \{ */ -void map_to_tube(float *r_u, float *r_v, const float x, const float y, const float z); -void map_to_sphere(float *r_u, float *r_v, const float x, const float y, const float z); +void map_to_tube(float *r_u, float *r_v, float x, float y, float z); +void map_to_sphere(float *r_u, float *r_v, float x, float y, float z); void map_to_plane_v2_v3v3(float r_co[2], const float co[3], const float no[3]); void map_to_plane_axis_angle_v2_v3v3fl(float r_co[2], const float co[3], const float axis[3], - const float angle); + float angle); /** \} */ @@ -1200,11 +1193,8 @@ void accumulate_vertex_normals_v3(float n1[3], * Add weighted face normal component into normals of the face vertices. * Caller must pass pre-allocated vdiffs of nverts length. */ -void accumulate_vertex_normals_poly_v3(float **vertnos, - const float polyno[3], - const float **vertcos, - float vdiffs[][3], - const int nverts); +void accumulate_vertex_normals_poly_v3( + float **vertnos, const float polyno[3], const float **vertcos, float vdiffs[][3], int nverts); /** \} */ @@ -1246,7 +1236,7 @@ void tangent_from_uv_v3(const float uv1[2], * * pointers may be NULL if not needed */ -void vcloud_estimate_transform_v3(const int list_size, +void vcloud_estimate_transform_v3(int list_size, const float (*pos)[3], const float *weight, const float (*rpos)[3], @@ -1269,14 +1259,14 @@ void vcloud_estimate_transform_v3(const int list_size, MINLINE void zero_sh(float r[9]); MINLINE void copy_sh_sh(float r[9], const float a[9]); -MINLINE void mul_sh_fl(float r[9], const float f); +MINLINE void mul_sh_fl(float r[9], float f); MINLINE void add_sh_shsh(float r[9], const float a[9], const float b[9]); MINLINE float dot_shsh(const float a[9], const float b[9]); MINLINE float eval_shv3(float r[9], const float v[3]); MINLINE float diffuse_shv3(const float r[9], const float v[3]); -MINLINE void vec_fac_to_sh(float r[9], const float v[3], const float f); -MINLINE void madd_sh_shfl(float r[9], const float sh[9], const float f); +MINLINE void vec_fac_to_sh(float r[9], const float v[3], float f); +MINLINE void madd_sh_shfl(float r[9], const float sh[9], float f); /** \} */ @@ -1349,7 +1339,7 @@ MINLINE int min_axis_v3(const float vec[3]); * (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); +MINLINE int poly_to_tri_count(int poly_count, int corner_count); /** * Useful to calculate an even width shell, by taking the angle between 2 planes. @@ -1357,7 +1347,7 @@ MINLINE int poly_to_tri_count(const int poly_count, const int corner_count); * no angle between planes is 1.0, as the angle between the 2 planes approaches 180d * the distance gets very high, 180d would be inf, but this case isn't valid. */ -MINLINE float shell_angle_to_dist(const float angle); +MINLINE float shell_angle_to_dist(float angle); /** * Equivalent to `shell_angle_to_dist(angle_normalized_v3v3(a, b))`. */ @@ -1406,7 +1396,7 @@ float cubic_tangent_factor_circle_v3(const float tan_l[3], const float tan_r[3]) * From "Dart Throwing on Surfaces", EGSR 2009. Section 7, Geodesic Dart Throwing. */ float geodesic_distance_propagate_across_triangle( - const float v0[3], const float v1[3], const float v2[3], const float dist1, const float dist2); + const float v0[3], const float v1[3], const float v2[3], float dist1, float dist2); /** \} */ diff --git a/source/blender/blenlib/BLI_math_interp.h b/source/blender/blenlib/BLI_math_interp.h index 7179de12066..0af250064f6 100644 --- a/source/blender/blenlib/BLI_math_interp.h +++ b/source/blender/blenlib/BLI_math_interp.h @@ -81,10 +81,10 @@ void BLI_ewa_imp2radangle( * TODO(sergey): Consider making this function inlined, so the pixel read callback * could also be inlined in order to avoid per-pixel function calls. */ -void BLI_ewa_filter(const int width, - const int height, - const bool intpol, - const bool use_alpha, +void BLI_ewa_filter(int width, + int height, + bool intpol, + bool use_alpha, const float uv[2], const float du[2], const float dv[2], diff --git a/source/blender/blenlib/BLI_math_matrix.h b/source/blender/blenlib/BLI_math_matrix.h index 90b74e2f504..65d654bc930 100644 --- a/source/blender/blenlib/BLI_math_matrix.h +++ b/source/blender/blenlib/BLI_math_matrix.h @@ -79,8 +79,8 @@ void shuffle_m4(float R[4][4], const int index[4]); void add_m3_m3m3(float R[3][3], const float A[3][3], const float B[3][3]); void add_m4_m4m4(float R[4][4], const float A[4][4], const float B[4][4]); -void madd_m3_m3m3fl(float R[3][3], const float A[3][3], const float B[3][3], const float f); -void madd_m4_m4m4fl(float R[4][4], const float A[4][4], const float B[4][4], const float f); +void madd_m3_m3m3fl(float R[3][3], const float A[3][3], const float B[3][3], float f); +void madd_m4_m4m4fl(float R[4][4], const float A[4][4], const float B[4][4], float f); void sub_m3_m3m3(float R[3][3], const float A[3][3], const float B[3][3]); void sub_m4_m4m4(float R[4][4], const float A[4][4], const float B[4][4]); @@ -252,8 +252,8 @@ void negate_m3(float R[3][3]); void negate_mat3_m4(float R[4][4]); void negate_m4(float R[4][4]); -bool invert_m3_ex(float m[3][3], const float epsilon); -bool invert_m3_m3_ex(float m1[3][3], const float m2[3][3], const float epsilon); +bool invert_m3_ex(float m[3][3], float epsilon); +bool invert_m3_m3_ex(float m1[3][3], const float m2[3][3], float epsilon); bool invert_m3(float R[3][3]); bool invert_m3_m3(float R[3][3], const float A[3][3]); @@ -343,8 +343,8 @@ void orthogonalize_m3_stable(float R[3][3], int axis, bool normalize); */ void orthogonalize_m4_stable(float R[4][4], int axis, bool normalize); -bool orthogonalize_m3_zero_axes(float R[3][3], const float unit_length); -bool orthogonalize_m4_zero_axes(float R[4][4], const float unit_length); +bool orthogonalize_m3_zero_axes(float R[3][3], float unit_length); +bool orthogonalize_m4_zero_axes(float R[4][4], float unit_length); bool is_orthogonal_m3(const float mat[3][3]); bool is_orthogonal_m4(const float mat[4][4]); @@ -443,7 +443,7 @@ void translate_m4(float mat[4][4], float tx, float ty, float tz); * #axis_angle_to_mat4_single, #axis_angle_to_mat3_single, #angle_to_mat2 * (axis & angle args are compatible). */ -void rotate_m4(float mat[4][4], const char axis, const float angle); +void rotate_m4(float mat[4][4], char axis, float angle); /** Scale a matrix in-place. */ void rescale_m4(float mat[4][4], const float scale[3]); /** @@ -487,7 +487,7 @@ void loc_eul_size_to_mat4(float R[4][4], * Matrices are made in the order: `scale * rot * loc` */ void loc_eulO_size_to_mat4( - float R[4][4], const float loc[3], const float eul[3], const float size[3], const short order); + float R[4][4], const float loc[3], const float eul[3], const float size[3], short order); /** * Make a 4x4 matrix out of 3 transform components. * Matrices are made in the order: `scale * rot * loc` @@ -496,20 +496,11 @@ void loc_quat_size_to_mat4(float R[4][4], const float loc[3], const float quat[4], const float size[3]); -void loc_axisangle_size_to_mat4(float R[4][4], - const float loc[3], - const float axis[3], - const float angle, - const float size[3]); - -void blend_m3_m3m3(float out[3][3], - const float dst[3][3], - const float src[3][3], - const float srcweight); -void blend_m4_m4m4(float out[4][4], - const float dst[4][4], - const float src[4][4], - const float srcweight); +void loc_axisangle_size_to_mat4( + float R[4][4], const float loc[3], const float axis[3], float angle, const float size[3]); + +void blend_m3_m3m3(float out[3][3], const float dst[3][3], const float src[3][3], float srcweight); +void blend_m4_m4m4(float out[4][4], const float dst[4][4], const float src[4][4], float srcweight); /** * A polar-decomposition-based interpolation between matrix A and matrix B. @@ -527,7 +518,7 @@ void blend_m4_m4m4(float out[4][4], * \param B: Input matrix which is totally effective with `t = 1.0`. * \param t: Interpolation factor. */ -void interp_m3_m3m3(float R[3][3], const float A[3][3], const float B[3][3], const float t); +void interp_m3_m3m3(float R[3][3], const float A[3][3], const float B[3][3], float t); /** * Complete transform matrix interpolation, * based on polar-decomposition-based interpolation from #interp_m3_m3m3. @@ -537,7 +528,7 @@ void interp_m3_m3m3(float R[3][3], const float A[3][3], const float B[3][3], con * \param B: Input matrix which is totally effective with `t = 1.0`. * \param t: Interpolation factor. */ -void interp_m4_m4m4(float R[4][4], const float A[4][4], const float B[4][4], const float t); +void interp_m4_m4m4(float R[4][4], const float A[4][4], const float B[4][4], float t); bool is_negative_m3(const float mat[3][3]); bool is_negative_m4(const float mat[4][4]); diff --git a/source/blender/blenlib/BLI_math_rotation.h b/source/blender/blenlib/BLI_math_rotation.h index 8106251684d..c27cf71ce5f 100644 --- a/source/blender/blenlib/BLI_math_rotation.h +++ b/source/blender/blenlib/BLI_math_rotation.h @@ -83,12 +83,12 @@ void mul_qt_v3(const float q[4], float r[3]); /** * Simple multiply. */ -void mul_qt_fl(float q[4], const float f); +void mul_qt_fl(float q[4], float f); /** * Raise a unit quaternion to the specified power. */ -void pow_qt_fl_normalized(float q[4], const float f); +void pow_qt_fl_normalized(float q[4], float f); void sub_qt_qtqt(float q[4], const float a[4], const float b[4]); @@ -120,9 +120,9 @@ bool is_zero_qt(const float q[4]); * \param cosom: dot product from normalized vectors/quats. * \param r_w: calculated weights. */ -void interp_dot_slerp(const float t, const float cosom, float r_w[2]); -void interp_qt_qtqt(float q[4], const float a[4], const float b[4], const float t); -void add_qt_qtqt(float q[4], const float a[4], const float b[4], const float t); +void interp_dot_slerp(float t, float cosom, float r_w[2]); +void interp_qt_qtqt(float q[4], const float a[4], const float b[4], float t); +void add_qt_qtqt(float q[4], const float a[4], const float b[4], float t); /* Conversion. */ @@ -152,7 +152,7 @@ void tri_to_quat_ex(float quat[4], * \return the length of the normal, use to test for degenerate triangles. */ float tri_to_quat(float q[4], const float a[3], const float b[3], const float c[3]); -void vec_to_quat(float q[4], const float vec[3], short axis, const short upflag); +void vec_to_quat(float q[4], const float vec[3], short axis, short upflag); /** * Calculate a rotation matrix from 2 normalized vectors. * \note `v1` and `v2` must be normalized. @@ -205,12 +205,12 @@ void print_qt(const char *str, const float q[4]); /* Conversion. */ -void axis_angle_normalized_to_quat(float r[4], const float axis[3], const float angle); -void axis_angle_to_quat(float r[4], const float axis[3], const float angle); +void axis_angle_normalized_to_quat(float r[4], const float axis[3], float angle); +void axis_angle_to_quat(float r[4], const float axis[3], float angle); /** * Axis angle to 3x3 matrix - safer version (normalization of axis performed). */ -void axis_angle_to_mat3(float R[3][3], const float axis[3], const float angle); +void axis_angle_to_mat3(float R[3][3], const float axis[3], float angle); /** * axis angle to 3x3 matrix * @@ -222,13 +222,13 @@ void axis_angle_to_mat3(float R[3][3], const float axis[3], const float angle); */ void axis_angle_normalized_to_mat3_ex(float mat[3][3], const float axis[3], - const float angle_sin, - const float angle_cos); -void axis_angle_normalized_to_mat3(float R[3][3], const float axis[3], const float angle); + float angle_sin, + float angle_cos); +void axis_angle_normalized_to_mat3(float R[3][3], const float axis[3], float angle); /** * Axis angle to 4x4 matrix - safer version (normalization of axis performed). */ -void axis_angle_to_mat4(float R[4][4], const float axis[3], const float angle); +void axis_angle_to_mat4(float R[4][4], const float axis[3], float angle); /** * 3x3 matrix to axis angle. @@ -248,17 +248,17 @@ void mat4_to_axis_angle(float axis[3], float *angle, const float M[4][4]); */ void quat_to_axis_angle(float axis[3], float *angle, const float q[4]); -void angle_to_mat2(float R[2][2], const float angle); +void angle_to_mat2(float R[2][2], float angle); /** * Create a 3x3 rotation matrix from a single axis. */ -void axis_angle_to_mat3_single(float R[3][3], const char axis, const float angle); +void axis_angle_to_mat3_single(float R[3][3], char axis, float angle); /** * Create a 4x4 rotation matrix from a single axis. */ -void axis_angle_to_mat4_single(float R[4][4], const char axis, const float angle); +void axis_angle_to_mat4_single(float R[4][4], char axis, float angle); -void axis_angle_to_quat_single(float q[4], const char axis, const float angle); +void axis_angle_to_quat_single(float q[4], char axis, float angle); /** \} */ @@ -289,14 +289,14 @@ void quat_to_eul(float eul[3], const float quat[4]); void mat3_normalized_to_compatible_eul(float eul[3], const float old[3], float mat[3][3]); void mat3_to_compatible_eul(float eul[3], const float old[3], float mat[3][3]); void quat_to_compatible_eul(float eul[3], const float oldrot[3], const float quat[4]); -void rotate_eul(float eul[3], const char axis, const float angle); +void rotate_eul(float eul[3], char axis, float angle); /* Order independent. */ void compatible_eul(float eul[3], const float old[3]); -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); +void add_eul_euleul(float r_eul[3], float a[3], float b[3], short order); +void sub_eul_euleul(float r_eul[3], float a[3], float b[3], short order); /** \} */ @@ -321,67 +321,58 @@ typedef enum eEulerRotationOrders { /** * Construct quaternion from Euler angles (in radians). */ -void eulO_to_quat(float quat[4], const float eul[3], const short order); +void eulO_to_quat(float quat[4], const float eul[3], short order); /** * Construct 3x3 matrix from Euler angles (in radians). */ -void eulO_to_mat3(float mat[3][3], const float eul[3], const short order); +void eulO_to_mat3(float mat[3][3], const float eul[3], short order); /** * Construct 4x4 matrix from Euler angles (in radians). */ -void eulO_to_mat4(float mat[4][4], const float eul[3], const short order); +void eulO_to_mat4(float mat[4][4], const float eul[3], short order); /** * Euler Rotation to Axis Angle. */ -void eulO_to_axis_angle(float axis[3], float *angle, const float eul[3], const short order); +void eulO_to_axis_angle(float axis[3], float *angle, const float eul[3], short order); /** * The matrix is written to as 3 axis vectors. */ -void eulO_to_gimbal_axis(float gmat[3][3], const float eul[3], const short order); +void eulO_to_gimbal_axis(float gmat[3][3], const float eul[3], short order); /** * Convert 3x3 matrix to Euler angles (in radians). */ -void mat3_normalized_to_eulO(float eul[3], const short order, const float mat[3][3]); +void mat3_normalized_to_eulO(float eul[3], short order, const float mat[3][3]); /** * Convert 4x4 matrix to Euler angles (in radians). */ -void mat4_normalized_to_eulO(float eul[3], const short order, const float mat[4][4]); -void mat3_to_eulO(float eul[3], const short order, const float mat[3][3]); -void mat4_to_eulO(float eul[3], const short order, const float mat[4][4]); +void mat4_normalized_to_eulO(float eul[3], short order, const float mat[4][4]); +void mat3_to_eulO(float eul[3], short order, const float mat[3][3]); +void mat4_to_eulO(float eul[3], short order, const float mat[4][4]); /** * Convert quaternion to Euler angles (in radians). */ -void quat_to_eulO(float eul[3], const short order, const float quat[4]); +void quat_to_eulO(float eul[3], short order, const float quat[4]); /** * Axis Angle to Euler Rotation. */ -void axis_angle_to_eulO(float eul[3], const short order, const float axis[3], const float angle); +void axis_angle_to_eulO(float eul[3], short order, const float axis[3], float angle); /* Uses 2 methods to retrieve eulers, and picks the closest. */ void mat3_normalized_to_compatible_eulO(float eul[3], const float old[3], - const short order, + short order, const float mat[3][3]); void mat4_normalized_to_compatible_eulO(float eul[3], const float old[3], - const short order, + short order, const float mat[4][4]); -void mat3_to_compatible_eulO(float eul[3], - const float old[3], - const short order, - const float mat[3][3]); -void mat4_to_compatible_eulO(float eul[3], - const float old[3], - const short order, - const float mat[4][4]); -void quat_to_compatible_eulO(float eul[3], - const float old[3], - const short order, - const float quat[4]); - -void rotate_eulO(float eul[3], const short order, char axis, float angle); +void mat3_to_compatible_eulO(float eul[3], const float old[3], short order, const float mat[3][3]); +void mat4_to_compatible_eulO(float eul[3], const float old[3], short order, const float mat[4][4]); +void quat_to_compatible_eulO(float eul[3], const float old[3], short order, const float quat[4]); + +void rotate_eulO(float eul[3], short order, char axis, float angle); /** \} */ diff --git a/source/blender/blenlib/BLI_math_solvers.h b/source/blender/blenlib/BLI_math_solvers.h index 32d4577899c..ca413d2b49c 100644 --- a/source/blender/blenlib/BLI_math_solvers.h +++ b/source/blender/blenlib/BLI_math_solvers.h @@ -77,7 +77,7 @@ void BLI_svd_m3(const float m3[3][3], float r_U[3][3], float r_S[3], float r_V[3 * \return true if success */ bool BLI_tridiagonal_solve( - const float *a, const float *b, const float *c, const float *d, float *r_x, const int count); + const float *a, const float *b, const float *c, const float *d, float *r_x, int count); /** * \brief Solve a possibly cyclic tridiagonal system using the Sherman-Morrison formula. * @@ -85,7 +85,7 @@ bool BLI_tridiagonal_solve( * \return true if success */ bool BLI_tridiagonal_solve_cyclic( - const float *a, const float *b, const float *c, const float *d, float *r_x, const int count); + const float *a, const float *b, const float *c, const float *d, float *r_x, int count); /** * Generic 3 variable Newton's method solver. diff --git a/source/blender/blenlib/BLI_math_statistics.h b/source/blender/blenlib/BLI_math_statistics.h index e4524b49f3f..586c82a8844 100644 --- a/source/blender/blenlib/BLI_math_statistics.h +++ b/source/blender/blenlib/BLI_math_statistics.h @@ -51,11 +51,11 @@ extern "C" { * (i.e. get 'sample variance' instead of 'population variance'). * \return r_covmat the computed covariance matrix. */ -void BLI_covariance_m_vn_ex(const int n, +void BLI_covariance_m_vn_ex(int n, const float *cos_vn, - const int nbr_cos_vn, + int nbr_cos_vn, const float *center, - const bool use_sample_correction, + bool use_sample_correction, float *r_covmat); /** * \brief Compute the covariance matrix of given set of 3D coordinates. @@ -66,8 +66,8 @@ void BLI_covariance_m_vn_ex(const int n, * \return r_center the computed center (mean) of 3D points (may be NULL). */ void BLI_covariance_m3_v3n(const float (*cos_v3)[3], - const int nbr_cos_v3, - const bool use_sample_correction, + int nbr_cos_v3, + bool use_sample_correction, float r_covmat[3][3], float r_center[3]); diff --git a/source/blender/blenlib/BLI_math_vector.h b/source/blender/blenlib/BLI_math_vector.h index 61090e30f7b..5e997d94acf 100644 --- a/source/blender/blenlib/BLI_math_vector.h +++ b/source/blender/blenlib/BLI_math_vector.h @@ -64,9 +64,9 @@ MINLINE void copy_v2_v2_uchar(unsigned char r[2], const unsigned char a[2]); MINLINE void copy_v3_v3_uchar(unsigned char r[3], const unsigned char a[3]); MINLINE void copy_v4_v4_uchar(unsigned char r[4], const unsigned char a[4]); -MINLINE void copy_v2_uchar(unsigned char r[2], const unsigned char a); -MINLINE void copy_v3_uchar(unsigned char r[3], const unsigned char a); -MINLINE void copy_v4_uchar(unsigned char r[4], const unsigned char a); +MINLINE void copy_v2_uchar(unsigned char r[2], unsigned char a); +MINLINE void copy_v3_uchar(unsigned char r[3], unsigned char a); +MINLINE void copy_v4_uchar(unsigned char r[4], unsigned char a); /* char */ @@ -303,18 +303,18 @@ MINLINE float len_v3v3(const float a[3], const float b[3]) ATTR_WARN_UNUSED_RESU MINLINE double len_v3_db(const double a[3]) ATTR_WARN_UNUSED_RESULT; MINLINE double len_squared_v3_db(const double v[3]) ATTR_WARN_UNUSED_RESULT; -MINLINE float normalize_v2_length(float r[2], const float unit_scale); +MINLINE float normalize_v2_length(float r[2], float unit_scale); /** * \note any vectors containing `nan` will be zeroed out. */ -MINLINE float normalize_v2_v2_length(float r[2], const float a[2], const float unit_scale); -MINLINE float normalize_v3_length(float r[3], const float unit_scale); +MINLINE float normalize_v2_v2_length(float r[2], const float a[2], float unit_scale); +MINLINE float normalize_v3_length(float r[3], float unit_scale); /** * \note any vectors containing `nan` will be zeroed out. */ -MINLINE float normalize_v3_v3_length(float r[3], const float a[3], const float unit_scale); -MINLINE double normalize_v3_length_db(double n[3], const double unit_scale); -MINLINE double normalize_v3_v3_length_db(double r[3], const double a[3], const double unit_scale); +MINLINE float normalize_v3_v3_length(float r[3], const float a[3], float unit_scale); +MINLINE double normalize_v3_length_db(double n[3], double unit_scale); +MINLINE double normalize_v3_v3_length_db(double r[3], const double a[3], double unit_scale); MINLINE float normalize_v2(float r[2]); MINLINE float normalize_v2_v2(float r[2], const float a[2]); @@ -329,16 +329,16 @@ MINLINE double normalize_v3_db(double n[3]); /** \name Interpolation * \{ */ -void interp_v2_v2v2(float r[2], const float a[2], const float b[2], const float t); -void interp_v2_v2v2_db(double target[2], const double a[2], const double b[2], const double t); +void interp_v2_v2v2(float r[2], const float a[2], const float b[2], float t); +void interp_v2_v2v2_db(double target[2], const double a[2], const double b[2], double t); /** * Weight 3 2D vectors, * 'w' must be unit length but is not a vector, just 3 weights. */ void interp_v2_v2v2v2( float r[2], const float a[2], const float b[2], const float c[2], const float t[3]); -void interp_v3_v3v3(float r[3], const float a[3], const float b[3], const float t); -void interp_v3_v3v3_db(double target[3], const double a[3], const double b[3], const double t); +void interp_v3_v3v3(float r[3], const float a[3], const float b[3], float t); +void interp_v3_v3v3_db(double target[3], const double a[3], const double b[3], double t); /** * Weight 3 vectors, * 'w' must be unit length but is not a vector, just 3 weights. @@ -355,7 +355,7 @@ void interp_v3_v3v3v3v3(float p[3], const float v3[3], const float v4[3], const float w[4]); -void interp_v4_v4v4(float r[4], const float a[4], const float b[4], const float t); +void interp_v4_v4v4(float r[4], const float a[4], const float b[4], float t); void interp_v4_v4v4v4( float p[4], const float v1[4], const float v2[4], const float v3[4], const float w[3]); void interp_v4_v4v4v4v4(float p[4], @@ -373,34 +373,34 @@ void interp_v3_v3v3v3_uv( * * \return success */ -bool interp_v3_v3v3_slerp(float target[3], const float a[3], const float b[3], const float t) +bool interp_v3_v3v3_slerp(float target[3], const float a[3], const float b[3], float t) ATTR_WARN_UNUSED_RESULT; -bool interp_v2_v2v2_slerp(float target[2], const float a[2], const float b[2], const float t) +bool interp_v2_v2v2_slerp(float target[2], const float a[2], const float b[2], float t) ATTR_WARN_UNUSED_RESULT; /** * Same as #interp_v3_v3v3_slerp but uses fallback values for opposite vectors. */ -void interp_v3_v3v3_slerp_safe(float target[3], const float a[3], const float b[3], const float t); -void interp_v2_v2v2_slerp_safe(float target[2], const float a[2], const float b[2], const float t); +void interp_v3_v3v3_slerp_safe(float target[3], const float a[3], const float b[3], float t); +void interp_v2_v2v2_slerp_safe(float target[2], const float a[2], const float b[2], float t); void interp_v2_v2v2v2v2_cubic(float p[2], const float v1[2], const float v2[2], const float v3[2], const float v4[2], - const float u); + float u); -void interp_v3_v3v3_char(char target[3], const char a[3], const char b[3], const float t); +void interp_v3_v3v3_char(char target[3], const char a[3], const char b[3], float t); void interp_v3_v3v3_uchar(unsigned char target[3], const unsigned char a[3], const unsigned char b[3], - const float t); -void interp_v4_v4v4_char(char target[4], const char a[4], const char b[4], const float t); + float t); +void interp_v4_v4v4_char(char target[4], const char a[4], const char b[4], float t); void interp_v4_v4v4_uchar(unsigned char target[4], const unsigned char a[4], const unsigned char b[4], - const float t); + float t); void mid_v3_v3v3(float r[3], const float a[3], const float b[3]); void mid_v2_v2v2(float r[2], const float a[2], const float b[2]); @@ -408,7 +408,7 @@ void mid_v3_v3v3v3(float v[3], const float v1[3], const float v2[3], const float void mid_v2_v2v2v2(float v[2], const float v1[2], const float v2[2], const float v3[2]); void mid_v3_v3v3v3v3( float v[3], const float v1[3], const float v2[3], const float v3[3], const float v4[3]); -void mid_v3_v3_array(float r[3], const float (*vec_arr)[3], const unsigned int nbr); +void mid_v3_v3_array(float r[3], const float (*vec_arr)[3], unsigned int nbr); /** * Specialized function for calculating normals. @@ -461,36 +461,24 @@ MINLINE bool equals_v2v2_int(const int v1[2], const int v2[2]) ATTR_WARN_UNUSED_ MINLINE bool equals_v3v3_int(const int v1[3], const int v2[3]) ATTR_WARN_UNUSED_RESULT; MINLINE bool equals_v4v4_int(const int v1[4], const int v2[4]) ATTR_WARN_UNUSED_RESULT; -MINLINE bool compare_v2v2(const float a[2], - const float b[2], - const float limit) ATTR_WARN_UNUSED_RESULT; -MINLINE bool compare_v3v3(const float a[3], - const float b[3], - const float limit) ATTR_WARN_UNUSED_RESULT; -MINLINE bool compare_v4v4(const float a[4], - const float b[4], - const float limit) ATTR_WARN_UNUSED_RESULT; - -MINLINE bool compare_v2v2_relative(const float a[2], - const float b[2], - const float limit, - const int max_ulps) ATTR_WARN_UNUSED_RESULT; -MINLINE bool compare_v3v3_relative(const float a[3], - const float b[3], - const float limit, - const int max_ulps) ATTR_WARN_UNUSED_RESULT; -MINLINE bool compare_v4v4_relative(const float a[4], - const float b[4], - const float limit, - const int max_ulps) ATTR_WARN_UNUSED_RESULT; +MINLINE bool compare_v2v2(const float a[2], const float b[2], float limit) ATTR_WARN_UNUSED_RESULT; +MINLINE bool compare_v3v3(const float a[3], const float b[3], float limit) ATTR_WARN_UNUSED_RESULT; +MINLINE bool compare_v4v4(const float a[4], const float b[4], float limit) ATTR_WARN_UNUSED_RESULT; + +MINLINE bool compare_v2v2_relative(const float a[2], const float b[2], float limit, int max_ulps) + ATTR_WARN_UNUSED_RESULT; +MINLINE bool compare_v3v3_relative(const float a[3], const float b[3], float limit, int max_ulps) + ATTR_WARN_UNUSED_RESULT; +MINLINE bool compare_v4v4_relative(const float a[4], const float b[4], float limit, int max_ulps) + ATTR_WARN_UNUSED_RESULT; MINLINE bool compare_len_v3v3(const float a[3], const float b[3], - const float limit) ATTR_WARN_UNUSED_RESULT; + float limit) ATTR_WARN_UNUSED_RESULT; MINLINE bool compare_size_v3v3(const float a[3], const float b[3], - const float limit) ATTR_WARN_UNUSED_RESULT; + float limit) ATTR_WARN_UNUSED_RESULT; /** * <pre> @@ -658,16 +646,13 @@ void bisect_v3_v3v3v3(float r[3], const float a[3], const float b[3], const floa /** * Rotate a point \a p by \a angle around origin (0, 0) */ -void rotate_v2_v2fl(float r[2], const float p[2], const float angle); -void rotate_v3_v3v3fl(float r[3], const float p[3], const float axis[3], const float angle); +void rotate_v2_v2fl(float r[2], const float p[2], float angle); +void rotate_v3_v3v3fl(float r[3], const float p[3], const float axis[3], float angle); /** * Rotate a point \a p by \a angle around an arbitrary unit length \a axis. * http://local.wasp.uwa.edu.au/~pbourke/geometry/ */ -void rotate_normalized_v3_v3v3fl(float out[3], - const float p[3], - const float axis[3], - const float angle); +void rotate_normalized_v3_v3v3fl(float out[3], const float p[3], const float axis[3], float angle); /** \} */ @@ -678,7 +663,7 @@ void rotate_normalized_v3_v3v3fl(float out[3], void print_v2(const char *str, const float v[2]); void print_v3(const char *str, const float v[3]); void print_v4(const char *str, const float v[4]); -void print_vn(const char *str, const float v[], const int n); +void print_vn(const char *str, const float v[], int n); #define print_v2_id(v) print_v2(STRINGIFY(v), v) #define print_v3_id(v) print_v3(STRINGIFY(v), v) @@ -697,14 +682,14 @@ void minmax_v2v2_v2(float min[2], float max[2], const float vec[2]); void minmax_v3v3_v3_array(float r_min[3], float r_max[3], const float (*vec_arr)[3], int nbr); /** ensure \a v1 is \a dist from \a v2 */ -void dist_ensure_v3_v3fl(float v1[3], const float v2[3], const float dist); -void dist_ensure_v2_v2fl(float v1[2], const float v2[2], const float dist); +void dist_ensure_v3_v3fl(float v1[3], const float v2[3], float dist); +void dist_ensure_v2_v2fl(float v1[2], const float v2[2], float dist); void axis_sort_v3(const float axis_values[3], int r_axis_order[3]); -MINLINE void clamp_v2(float vec[2], const float min, const float max); -MINLINE void clamp_v3(float vec[3], const float min, const float max); -MINLINE void clamp_v4(float vec[4], const float min, const float max); +MINLINE void clamp_v2(float vec[2], float min, float max); +MINLINE void clamp_v3(float vec[3], float min, float max); +MINLINE void clamp_v4(float vec[4], float min, float max); MINLINE void clamp_v2_v2v2(float vec[2], const float min[2], const float max[2]); MINLINE void clamp_v3_v3v3(float vec[3], const float min[3], const float max[3]); MINLINE void clamp_v4_v4v4(float vec[4], const float min[4], const float max[4]); @@ -721,57 +706,42 @@ MINLINE void clamp_v4_v4v4(float vec[4], const float min[4], const float max[4]) double dot_vn_vn(const float *array_src_a, const float *array_src_b, - const int size) ATTR_WARN_UNUSED_RESULT; -double len_squared_vn(const float *array, const int size) ATTR_WARN_UNUSED_RESULT; -float normalize_vn_vn(float *array_tar, const float *array_src, const int size); -float normalize_vn(float *array_tar, const int size); -void range_vn_i(int *array_tar, const int size, const int start); -void range_vn_u(unsigned int *array_tar, const int size, const unsigned int start); -void range_vn_fl(float *array_tar, const int size, const float start, const float step); -void negate_vn(float *array_tar, const int size); -void negate_vn_vn(float *array_tar, const float *array_src, const int size); -void mul_vn_vn(float *array_tar, const float *array_src, const int size); -void mul_vn_vnvn(float *array_tar, - const float *array_src_a, - const float *array_src_b, - const int size); -void mul_vn_fl(float *array_tar, const int size, const float f); -void mul_vn_vn_fl(float *array_tar, const float *array_src, const int size, const float f); -void add_vn_vn(float *array_tar, const float *array_src, const int size); -void add_vn_vnvn(float *array_tar, - const float *array_src_a, - const float *array_src_b, - const int size); -void madd_vn_vn(float *array_tar, const float *array_src, const float f, const int size); -void madd_vn_vnvn(float *array_tar, - const float *array_src_a, - const float *array_src_b, - const float f, - const int size); -void sub_vn_vn(float *array_tar, const float *array_src, const int size); -void sub_vn_vnvn(float *array_tar, - const float *array_src_a, - const float *array_src_b, - const int size); -void msub_vn_vn(float *array_tar, const float *array_src, const float f, const int size); -void msub_vn_vnvn(float *array_tar, - const float *array_src_a, - const float *array_src_b, - const float f, - const int size); -void interp_vn_vn(float *array_tar, const float *array_src, const float t, const int size); -void copy_vn_i(int *array_tar, const int size, const int val); -void copy_vn_short(short *array_tar, const int size, const short val); -void copy_vn_ushort(unsigned short *array_tar, const int size, const unsigned short val); -void copy_vn_uchar(unsigned char *array_tar, const int size, const unsigned char val); -void copy_vn_fl(float *array_tar, const int size, const float val); - -void add_vn_vn_d(double *array_tar, const double *array_src, const int size); + int size) ATTR_WARN_UNUSED_RESULT; +double len_squared_vn(const float *array, int size) ATTR_WARN_UNUSED_RESULT; +float normalize_vn_vn(float *array_tar, const float *array_src, int size); +float normalize_vn(float *array_tar, int size); +void range_vn_i(int *array_tar, int size, int start); +void range_vn_u(unsigned int *array_tar, int size, unsigned int start); +void range_vn_fl(float *array_tar, int size, float start, float step); +void negate_vn(float *array_tar, int size); +void negate_vn_vn(float *array_tar, const float *array_src, int size); +void mul_vn_vn(float *array_tar, const float *array_src, int size); +void mul_vn_vnvn(float *array_tar, const float *array_src_a, const float *array_src_b, int size); +void mul_vn_fl(float *array_tar, int size, float f); +void mul_vn_vn_fl(float *array_tar, const float *array_src, int size, float f); +void add_vn_vn(float *array_tar, const float *array_src, int size); +void add_vn_vnvn(float *array_tar, const float *array_src_a, const float *array_src_b, int size); +void madd_vn_vn(float *array_tar, const float *array_src, float f, int size); +void madd_vn_vnvn( + float *array_tar, const float *array_src_a, const float *array_src_b, float f, int size); +void sub_vn_vn(float *array_tar, const float *array_src, int size); +void sub_vn_vnvn(float *array_tar, const float *array_src_a, const float *array_src_b, int size); +void msub_vn_vn(float *array_tar, const float *array_src, float f, int size); +void msub_vn_vnvn( + float *array_tar, const float *array_src_a, const float *array_src_b, float f, int size); +void interp_vn_vn(float *array_tar, const float *array_src, float t, int size); +void copy_vn_i(int *array_tar, int size, int val); +void copy_vn_short(short *array_tar, int size, short val); +void copy_vn_ushort(unsigned short *array_tar, int size, unsigned short val); +void copy_vn_uchar(unsigned char *array_tar, int size, unsigned char val); +void copy_vn_fl(float *array_tar, int size, float val); + +void add_vn_vn_d(double *array_tar, const double *array_src, int size); void add_vn_vnvn_d(double *array_tar, const double *array_src_a, const double *array_src_b, - const int size); -void mul_vn_db(double *array_tar, const int size, const double f); + int size); +void mul_vn_db(double *array_tar, int size, double f); /** \} */ diff --git a/source/blender/blenlib/BLI_memory_utils.hh b/source/blender/blenlib/BLI_memory_utils.hh index 9a5be79b61e..37691017c12 100644 --- a/source/blender/blenlib/BLI_memory_utils.hh +++ b/source/blender/blenlib/BLI_memory_utils.hh @@ -557,4 +557,13 @@ Container &move_assign_container(Container &dst, Container &&src) noexcept( return dst; } +/** + * Utility macro that wraps `std::enable_if` to make it a bit easier to use and less verbose for + * SFINAE in common cases. + * + * \note Often one has to invoke this macro with double parenthesis. That's because the condition + * often contains a comma and angle brackets are not recognized as parenthesis by the preprocessor. + */ +#define BLI_ENABLE_IF(condition) typename std::enable_if_t<condition> * = nullptr + } // namespace blender diff --git a/source/blender/blenlib/BLI_mempool.h b/source/blender/blenlib/BLI_mempool.h index a3cf2a77646..d1999a468b8 100644 --- a/source/blender/blenlib/BLI_mempool.h +++ b/source/blender/blenlib/BLI_mempool.h @@ -56,7 +56,7 @@ void BLI_mempool_free(BLI_mempool *pool, void *addr) ATTR_NONNULL(1, 2); * \param pool: The pool to clear. * \param totelem_reserve: Optionally reserve how many items should be kept from clearing. */ -void BLI_mempool_clear_ex(BLI_mempool *pool, const int totelem_reserve) ATTR_NONNULL(1); +void BLI_mempool_clear_ex(BLI_mempool *pool, int totelem_reserve) ATTR_NONNULL(1); /** * Wrap #BLI_mempool_clear_ex with no reserve set. */ diff --git a/source/blender/blenlib/BLI_mesh_intersect.hh b/source/blender/blenlib/BLI_mesh_intersect.hh index 4aaed814bba..71a8abb822f 100644 --- a/source/blender/blenlib/BLI_mesh_intersect.hh +++ b/source/blender/blenlib/BLI_mesh_intersect.hh @@ -91,7 +91,7 @@ struct Plane { Plane() = default; Plane(const mpq3 &norm_exact, const mpq_class &d_exact); - Plane(const double3 &norm, const double d); + Plane(const double3 &norm, double d); /** Test equality on the exact fields. */ bool operator==(const Plane &other) const; diff --git a/source/blender/blenlib/BLI_noise.hh b/source/blender/blenlib/BLI_noise.hh index 44af2c44f00..4f68ef17ca2 100644 --- a/source/blender/blenlib/BLI_noise.hh +++ b/source/blender/blenlib/BLI_noise.hh @@ -133,12 +133,8 @@ float3 perlin_float3_fractal_distorted(float4 position, * \param octaves: number of frequencies in the fBm. * \param offset: raises the terrain from `sea level'. */ -float musgrave_ridged_multi_fractal(const float co, - const float H, - const float lacunarity, - const float octaves, - const float offset, - const float gain); +float musgrave_ridged_multi_fractal( + float co, float H, float lacunarity, float octaves, float offset, float gain); /** * 2D Ridged Multi-fractal Terrain * @@ -147,12 +143,8 @@ float musgrave_ridged_multi_fractal(const float co, * \param octaves: number of frequencies in the fBm. * \param offset: raises the terrain from `sea level'. */ -float musgrave_ridged_multi_fractal(const float2 co, - const float H, - const float lacunarity, - const float octaves, - const float offset, - const float gain); +float musgrave_ridged_multi_fractal( + const float2 co, float H, float lacunarity, float octaves, float offset, float gain); /** * 3D Ridged Multi-fractal Terrain * @@ -161,12 +153,8 @@ float musgrave_ridged_multi_fractal(const float2 co, * \param octaves: number of frequencies in the fBm. * \param offset: raises the terrain from `sea level'. */ -float musgrave_ridged_multi_fractal(const float3 co, - const float H, - const float lacunarity, - const float octaves, - const float offset, - const float gain); +float musgrave_ridged_multi_fractal( + const float3 co, float H, float lacunarity, float octaves, float offset, float gain); /** * 4D Ridged Multi-fractal Terrain * @@ -175,12 +163,8 @@ float musgrave_ridged_multi_fractal(const float3 co, * \param octaves: number of frequencies in the fBm. * \param offset: raises the terrain from `sea level'. */ -float musgrave_ridged_multi_fractal(const float4 co, - const float H, - const float lacunarity, - const float octaves, - const float offset, - const float gain); +float musgrave_ridged_multi_fractal( + const float4 co, float H, float lacunarity, float octaves, float offset, float gain); /** * 1D Hybrid Additive/Multiplicative Multi-fractal Terrain @@ -190,12 +174,8 @@ float musgrave_ridged_multi_fractal(const float4 co, * \param octaves: number of frequencies in the fBm. * \param offset: raises the terrain from `sea level'. */ -float musgrave_hybrid_multi_fractal(const float co, - const float H, - const float lacunarity, - const float octaves, - const float offset, - const float gain); +float musgrave_hybrid_multi_fractal( + float co, float H, float lacunarity, float octaves, float offset, float gain); /** * 2D Hybrid Additive/Multiplicative Multi-fractal Terrain * @@ -204,12 +184,8 @@ float musgrave_hybrid_multi_fractal(const float co, * \param octaves: number of frequencies in the fBm. * \param offset: raises the terrain from `sea level'. */ -float musgrave_hybrid_multi_fractal(const float2 co, - const float H, - const float lacunarity, - const float octaves, - const float offset, - const float gain); +float musgrave_hybrid_multi_fractal( + const float2 co, float H, float lacunarity, float octaves, float offset, float gain); /** * 3D Hybrid Additive/Multiplicative Multi-fractal Terrain * @@ -218,12 +194,8 @@ float musgrave_hybrid_multi_fractal(const float2 co, * \param octaves: number of frequencies in the fBm. * \param offset: raises the terrain from `sea level'. */ -float musgrave_hybrid_multi_fractal(const float3 co, - const float H, - const float lacunarity, - const float octaves, - const float offset, - const float gain); +float musgrave_hybrid_multi_fractal( + const float3 co, float H, float lacunarity, float octaves, float offset, float gain); /** * 4D Hybrid Additive/Multiplicative Multi-fractal Terrain * @@ -232,12 +204,8 @@ float musgrave_hybrid_multi_fractal(const float3 co, * \param octaves: number of frequencies in the fBm. * \param offset: raises the terrain from `sea level'. */ -float musgrave_hybrid_multi_fractal(const float4 co, - const float H, - const float lacunarity, - const float octaves, - const float offset, - const float gain); +float musgrave_hybrid_multi_fractal( + const float4 co, float H, float lacunarity, float octaves, float offset, float gain); /** * 1D Musgrave fBm @@ -246,7 +214,7 @@ float musgrave_hybrid_multi_fractal(const float4 co, * \param lacunarity: gap between successive frequencies. * \param octaves: number of frequencies in the fBm. */ -float musgrave_fBm(const float co, const float H, const float lacunarity, const float octaves); +float musgrave_fBm(float co, float H, float lacunarity, float octaves); /** * 2D Musgrave fBm @@ -255,7 +223,7 @@ float musgrave_fBm(const float co, const float H, const float lacunarity, const * \param lacunarity: gap between successive frequencies. * \param octaves: number of frequencies in the fBm. */ -float musgrave_fBm(const float2 co, const float H, const float lacunarity, const float octaves); +float musgrave_fBm(const float2 co, float H, float lacunarity, float octaves); /** * 3D Musgrave fBm * @@ -263,7 +231,7 @@ float musgrave_fBm(const float2 co, const float H, const float lacunarity, const * \param lacunarity: gap between successive frequencies. * \param octaves: number of frequencies in the fBm. */ -float musgrave_fBm(const float3 co, const float H, const float lacunarity, const float octaves); +float musgrave_fBm(const float3 co, float H, float lacunarity, float octaves); /** * 4D Musgrave fBm * @@ -271,7 +239,7 @@ float musgrave_fBm(const float3 co, const float H, const float lacunarity, const * \param lacunarity: gap between successive frequencies. * \param octaves: number of frequencies in the fBm. */ -float musgrave_fBm(const float4 co, const float H, const float lacunarity, const float octaves); +float musgrave_fBm(const float4 co, float H, float lacunarity, float octaves); /** * 1D Musgrave Multi-fractal @@ -280,10 +248,7 @@ float musgrave_fBm(const float4 co, const float H, const float lacunarity, const * \param lacunarity: gap between successive frequencies. * \param octaves: number of frequencies in the fBm. */ -float musgrave_multi_fractal(const float co, - const float H, - const float lacunarity, - const float octaves); +float musgrave_multi_fractal(float co, float H, float lacunarity, float octaves); /** * 2D Musgrave Multi-fractal * @@ -291,10 +256,7 @@ float musgrave_multi_fractal(const float co, * \param lacunarity: gap between successive frequencies. * \param octaves: number of frequencies in the fBm. */ -float musgrave_multi_fractal(const float2 co, - const float H, - const float lacunarity, - const float octaves); +float musgrave_multi_fractal(const float2 co, float H, float lacunarity, float octaves); /** * 3D Musgrave Multi-fractal * @@ -302,10 +264,7 @@ float musgrave_multi_fractal(const float2 co, * \param lacunarity: gap between successive frequencies. * \param octaves: number of frequencies in the fBm. */ -float musgrave_multi_fractal(const float3 co, - const float H, - const float lacunarity, - const float octaves); +float musgrave_multi_fractal(const float3 co, float H, float lacunarity, float octaves); /** * 4D Musgrave Multi-fractal * @@ -313,10 +272,7 @@ float musgrave_multi_fractal(const float3 co, * \param lacunarity: gap between successive frequencies. * \param octaves: number of frequencies in the fBm. */ -float musgrave_multi_fractal(const float4 co, - const float H, - const float lacunarity, - const float octaves); +float musgrave_multi_fractal(const float4 co, float H, float lacunarity, float octaves); /** * 1D Musgrave Heterogeneous Terrain @@ -326,11 +282,7 @@ float musgrave_multi_fractal(const float4 co, * \param octaves: number of frequencies in the fBm. * \param offset: raises the terrain from `sea level'. */ -float musgrave_hetero_terrain(const float co, - const float H, - const float lacunarity, - const float octaves, - const float offset); +float musgrave_hetero_terrain(float co, float H, float lacunarity, float octaves, float offset); /** * 2D Musgrave Heterogeneous Terrain * @@ -339,11 +291,8 @@ float musgrave_hetero_terrain(const float co, * \param octaves: number of frequencies in the fBm. * \param offset: raises the terrain from `sea level'. */ -float musgrave_hetero_terrain(const float2 co, - const float H, - const float lacunarity, - const float octaves, - const float offset); +float musgrave_hetero_terrain( + const float2 co, float H, float lacunarity, float octaves, float offset); /** * 3D Musgrave Heterogeneous Terrain * @@ -352,11 +301,8 @@ float musgrave_hetero_terrain(const float2 co, * \param octaves: number of frequencies in the fBm. * \param offset: raises the terrain from `sea level'. */ -float musgrave_hetero_terrain(const float3 co, - const float H, - const float lacunarity, - const float octaves, - const float offset); +float musgrave_hetero_terrain( + const float3 co, float H, float lacunarity, float octaves, float offset); /** * 4D Musgrave Heterogeneous Terrain * @@ -365,11 +311,8 @@ float musgrave_hetero_terrain(const float3 co, * \param octaves: number of frequencies in the fBm. * \param offset: raises the terrain from `sea level'. */ -float musgrave_hetero_terrain(const float4 co, - const float H, - const float lacunarity, - const float octaves, - const float offset); +float musgrave_hetero_terrain( + const float4 co, float H, float lacunarity, float octaves, float offset); /** \} */ @@ -377,93 +320,87 @@ float musgrave_hetero_terrain(const float4 co, /** \name Voronoi Noise * \{ */ -void voronoi_f1( - const float w, const float randomness, float *r_distance, float3 *r_color, float *r_w); -void voronoi_smooth_f1(const float w, - const float smoothness, - const float randomness, - float *r_distance, - float3 *r_color, - float *r_w); -void voronoi_f2( - const float w, const float randomness, float *r_distance, float3 *r_color, float *r_w); -void voronoi_distance_to_edge(const float w, const float randomness, float *r_distance); -void voronoi_n_sphere_radius(const float w, const float randomness, float *r_radius); +void voronoi_f1(float w, float randomness, float *r_distance, float3 *r_color, float *r_w); +void voronoi_smooth_f1( + float w, float smoothness, float randomness, float *r_distance, float3 *r_color, float *r_w); +void voronoi_f2(float w, float randomness, float *r_distance, float3 *r_color, float *r_w); +void voronoi_distance_to_edge(float w, float randomness, float *r_distance); +void voronoi_n_sphere_radius(float w, float randomness, float *r_radius); void voronoi_f1(const float2 coord, - const float exponent, - const float randomness, - const int metric, + float exponent, + float randomness, + int metric, float *r_distance, float3 *r_color, float2 *r_position); void voronoi_smooth_f1(const float2 coord, - const float smoothness, - const float exponent, - const float randomness, - const int metric, + float smoothness, + float exponent, + float randomness, + int metric, float *r_distance, float3 *r_color, float2 *r_position); void voronoi_f2(const float2 coord, - const float exponent, - const float randomness, - const int metric, + float exponent, + float randomness, + int metric, float *r_distance, float3 *r_color, float2 *r_position); -void voronoi_distance_to_edge(const float2 coord, const float randomness, float *r_distance); -void voronoi_n_sphere_radius(const float2 coord, const float randomness, float *r_radius); +void voronoi_distance_to_edge(const float2 coord, float randomness, float *r_distance); +void voronoi_n_sphere_radius(const float2 coord, float randomness, float *r_radius); void voronoi_f1(const float3 coord, - const float exponent, - const float randomness, - const int metric, + float exponent, + float randomness, + int metric, float *r_distance, float3 *r_color, float3 *r_position); void voronoi_smooth_f1(const float3 coord, - const float smoothness, - const float exponent, - const float randomness, - const int metric, + float smoothness, + float exponent, + float randomness, + int metric, float *r_distance, float3 *r_color, float3 *r_position); void voronoi_f2(const float3 coord, - const float exponent, - const float randomness, - const int metric, + float exponent, + float randomness, + int metric, float *r_distance, float3 *r_color, float3 *r_position); -void voronoi_distance_to_edge(const float3 coord, const float randomness, float *r_distance); -void voronoi_n_sphere_radius(const float3 coord, const float randomness, float *r_radius); +void voronoi_distance_to_edge(const float3 coord, float randomness, float *r_distance); +void voronoi_n_sphere_radius(const float3 coord, float randomness, float *r_radius); void voronoi_f1(const float4 coord, - const float exponent, - const float randomness, - const int metric, + float exponent, + float randomness, + int metric, float *r_distance, float3 *r_color, float4 *r_position); void voronoi_smooth_f1(const float4 coord, - const float smoothness, - const float exponent, - const float randomness, - const int metric, + float smoothness, + float exponent, + float randomness, + int metric, float *r_distance, float3 *r_color, float4 *r_position); void voronoi_f2(const float4 coord, - const float exponent, - const float randomness, - const int metric, + float exponent, + float randomness, + int metric, float *r_distance, float3 *r_color, float4 *r_position); -void voronoi_distance_to_edge(const float4 coord, const float randomness, float *r_distance); -void voronoi_n_sphere_radius(const float4 coord, const float randomness, float *r_radius); +void voronoi_distance_to_edge(const float4 coord, float randomness, float *r_distance); +void voronoi_n_sphere_radius(const float4 coord, float randomness, float *r_radius); /** \} */ diff --git a/source/blender/blenlib/BLI_path_util.h b/source/blender/blenlib/BLI_path_util.h index 70eb80e7763..16f479cb3b8 100644 --- a/source/blender/blenlib/BLI_path_util.h +++ b/source/blender/blenlib/BLI_path_util.h @@ -133,7 +133,7 @@ const char *BLI_path_basename(const char *path) ATTR_NONNULL() ATTR_WARN_UNUSED_ * Ignores multiple slashes at any point in the path (including start/end). */ bool BLI_path_name_at_index(const char *__restrict path, - const int index, + int index, int *__restrict r_offset, int *__restrict r_len) ATTR_NONNULL() ATTR_WARN_UNUSED_RESULT; @@ -142,7 +142,11 @@ bool BLI_path_contains(const char *container_path, const char *containee_path) ATTR_WARN_UNUSED_RESULT; /** - * Returns pointer to the rightmost path separator in string. + * \return pointer to the leftmost path separator in string (or NULL when not found). + */ +const char *BLI_path_slash_find(const char *string) ATTR_NONNULL() ATTR_WARN_UNUSED_RESULT; +/** + * \return pointer to the rightmost path separator in string (or NULL when not found). */ const char *BLI_path_slash_rfind(const char *string) ATTR_NONNULL() ATTR_WARN_UNUSED_RESULT; /** @@ -155,10 +159,6 @@ int BLI_path_slash_ensure(char *string) ATTR_NONNULL(); */ void BLI_path_slash_rstrip(char *string) ATTR_NONNULL(); /** - * Returns pointer to the leftmost path separator in string. Not actually used anywhere. - */ -const char *BLI_path_slash_find(const char *string) ATTR_NONNULL() ATTR_WARN_UNUSED_RESULT; -/** * Changes to the path separators to the native ones for this OS. */ void BLI_path_slash_native(char *path) ATTR_NONNULL(); diff --git a/source/blender/blenlib/BLI_polyfill_2d.h b/source/blender/blenlib/BLI_polyfill_2d.h index d16c102ec86..25a624ba005 100644 --- a/source/blender/blenlib/BLI_polyfill_2d.h +++ b/source/blender/blenlib/BLI_polyfill_2d.h @@ -30,8 +30,8 @@ struct MemArena; * A version of #BLI_polyfill_calc that uses a memory arena to avoid re-allocations. */ void BLI_polyfill_calc_arena(const float (*coords)[2], - const unsigned int coords_tot, - const int coords_sign, + unsigned int coords_tot, + int coords_sign, unsigned int (*r_tris)[3], struct MemArena *arena); @@ -50,8 +50,8 @@ void BLI_polyfill_calc_arena(const float (*coords)[2], * even in the case of degenerate input (self intersecting polygons, zero area ears... etc). */ void BLI_polyfill_calc(const float (*coords)[2], - const unsigned int coords_tot, - const int coords_sign, + unsigned int coords_tot, + int coords_sign, unsigned int (*r_tris)[3]); /* default size of polyfill arena */ diff --git a/source/blender/blenlib/BLI_polyfill_2d_beautify.h b/source/blender/blenlib/BLI_polyfill_2d_beautify.h index b0b97336a3b..3a94ef46aca 100644 --- a/source/blender/blenlib/BLI_polyfill_2d_beautify.h +++ b/source/blender/blenlib/BLI_polyfill_2d_beautify.h @@ -34,7 +34,7 @@ struct MemArena; * are ignored since the edges won't share 2 faces. */ void BLI_polyfill_beautify(const float (*coords)[2], - const unsigned int coords_tot, + unsigned int coords_tot, unsigned int (*tris)[3], /* structs for reuse */ @@ -60,7 +60,7 @@ float BLI_polyfill_beautify_quad_rotate_calc_ex(const float v1[2], const float v2[2], const float v3[2], const float v4[2], - const bool lock_degenerate, + bool lock_degenerate, float *r_area); #define BLI_polyfill_beautify_quad_rotate_calc(v1, v2, v3, v4) \ BLI_polyfill_beautify_quad_rotate_calc_ex(v1, v2, v3, v4, false, NULL) diff --git a/source/blender/blenlib/BLI_quadric.h b/source/blender/blenlib/BLI_quadric.h index 450653a20ea..03642023986 100644 --- a/source/blender/blenlib/BLI_quadric.h +++ b/source/blender/blenlib/BLI_quadric.h @@ -42,12 +42,12 @@ void BLI_quadric_clear(Quadric *q); void BLI_quadric_add_qu_qu(Quadric *a, const Quadric *b); void BLI_quadric_add_qu_ququ(Quadric *r, const Quadric *a, const Quadric *b); -void BLI_quadric_mul(Quadric *a, const double scalar); +void BLI_quadric_mul(Quadric *a, double scalar); /* Solve. */ double BLI_quadric_evaluate(const Quadric *q, const double v[3]); -bool BLI_quadric_optimize(const Quadric *q, double v[3], const double epsilon); +bool BLI_quadric_optimize(const Quadric *q, double v[3], double epsilon); #ifdef __cplusplus } diff --git a/source/blender/blenlib/BLI_rect.h b/source/blender/blenlib/BLI_rect.h index f4b1d051d16..b8906a97977 100644 --- a/source/blender/blenlib/BLI_rect.h +++ b/source/blender/blenlib/BLI_rect.h @@ -101,16 +101,13 @@ void BLI_rctf_pad(struct rctf *rect, float pad_x, float pad_y); void BLI_rctf_resize(struct rctf *rect, float x, float y); void BLI_rctf_resize_x(struct rctf *rect, float x); void BLI_rctf_resize_y(struct rctf *rect, float y); -void BLI_rcti_scale(rcti *rect, const float scale); -void BLI_rctf_scale(rctf *rect, const float scale); -void BLI_rctf_pad_y(struct rctf *rect, - const float boundary_size, - const float pad_min, - const float pad_max); +void BLI_rcti_scale(rcti *rect, float scale); +void BLI_rctf_scale(rctf *rect, float scale); +void BLI_rctf_pad_y(struct rctf *rect, float boundary_size, float pad_min, float pad_max); void BLI_rctf_interp(struct rctf *rect, const struct rctf *rect_a, const struct rctf *rect_b, - const float fac); + float fac); // void BLI_rcti_interp(struct rctf *rect, struct rctf *rect_a, struct rctf *rect_b, float fac); bool BLI_rctf_clamp_pt_v(const struct rctf *rect, float xy[2]); bool BLI_rcti_clamp_pt_v(const struct rcti *rect, int xy[2]); @@ -124,7 +121,7 @@ bool BLI_rcti_clamp_pt_v(const struct rcti *rect, int xy[2]); */ bool BLI_rctf_clamp(struct rctf *rect, const struct rctf *rect_bounds, float r_xy[2]); bool BLI_rcti_clamp(struct rcti *rect, const struct rcti *rect_bounds, int r_xy[2]); -bool BLI_rctf_compare(const struct rctf *rect_a, const struct rctf *rect_b, const float limit); +bool BLI_rctf_compare(const struct rctf *rect_a, const struct rctf *rect_b, float limit); bool BLI_rcti_compare(const struct rcti *rect_a, const struct rcti *rect_b); bool BLI_rctf_isect(const struct rctf *src1, const struct rctf *src2, struct rctf *dest); bool BLI_rcti_isect(const struct rcti *src1, const struct rcti *src2, struct rcti *dest); @@ -132,28 +129,28 @@ bool BLI_rctf_isect_rect_x(const struct rctf *src1, const struct rctf *src2, flo bool BLI_rctf_isect_rect_y(const struct rctf *src1, const struct rctf *src2, float range_y[2]); bool BLI_rcti_isect_rect_x(const struct rcti *src1, const struct rcti *src2, int range_x[2]); bool BLI_rcti_isect_rect_y(const struct rcti *src1, const struct rcti *src2, int range_y[2]); -bool BLI_rcti_isect_x(const rcti *rect, const int x); -bool BLI_rcti_isect_y(const rcti *rect, const int y); -bool BLI_rcti_isect_pt(const struct rcti *rect, const int x, const int y); +bool BLI_rcti_isect_x(const rcti *rect, int x); +bool BLI_rcti_isect_y(const rcti *rect, int y); +bool BLI_rcti_isect_pt(const struct rcti *rect, int x, int y); bool BLI_rcti_isect_pt_v(const struct rcti *rect, const int xy[2]); -bool BLI_rctf_isect_x(const rctf *rect, const float x); -bool BLI_rctf_isect_y(const rctf *rect, const float y); -bool BLI_rctf_isect_pt(const struct rctf *rect, const float x, const float y); +bool BLI_rctf_isect_x(const rctf *rect, float x); +bool BLI_rctf_isect_y(const rctf *rect, float y); +bool BLI_rctf_isect_pt(const struct rctf *rect, float x, float y); bool BLI_rctf_isect_pt_v(const struct rctf *rect, const float xy[2]); /** * \returns shortest distance from \a rect to x (0 if inside) */ -int BLI_rcti_length_x(const rcti *rect, const int x); +int BLI_rcti_length_x(const rcti *rect, int x); /** * \returns shortest distance from \a rect to y (0 if inside) */ -int BLI_rcti_length_y(const rcti *rect, const int y); -float BLI_rctf_length_x(const rctf *rect, const float x); -float BLI_rctf_length_y(const rctf *rect, const float y); +int BLI_rcti_length_y(const rcti *rect, int y); +float BLI_rctf_length_x(const rctf *rect, float x); +float BLI_rctf_length_y(const rctf *rect, float y); bool BLI_rcti_isect_segment(const struct rcti *rect, const int s1[2], const int s2[2]); bool BLI_rctf_isect_segment(const struct rctf *rect, const float s1[2], const float s2[2]); -bool BLI_rcti_isect_circle(const struct rcti *rect, const float xy[2], const float radius); -bool BLI_rctf_isect_circle(const struct rctf *rect, const float xy[2], const float radius); +bool BLI_rcti_isect_circle(const struct rcti *rect, const float xy[2], float radius); +bool BLI_rctf_isect_circle(const struct rctf *rect, const float xy[2], float radius); bool BLI_rcti_inside_rcti(const rcti *rct_a, const rcti *rct_b); /** * is \a rct_b inside \a rct_a @@ -169,7 +166,7 @@ void BLI_rcti_rctf_copy_round(struct rcti *dst, const struct rctf *src); /** * Expand the rectangle to fit a rotated \a src. */ -void BLI_rctf_rotate_expand(rctf *dst, const rctf *src, const float angle); +void BLI_rctf_rotate_expand(rctf *dst, const rctf *src, float angle); void print_rctf(const char *str, const struct rctf *rect); void print_rcti(const char *str, const struct rcti *rect); diff --git a/source/blender/blenlib/BLI_scanfill.h b/source/blender/blenlib/BLI_scanfill.h index ec7fa8f27a0..eca3c00017c 100644 --- a/source/blender/blenlib/BLI_scanfill.h +++ b/source/blender/blenlib/BLI_scanfill.h @@ -114,10 +114,8 @@ enum { BLI_SCANFILL_CALC_LOOSE = (1 << 4), }; void BLI_scanfill_begin(ScanFillContext *sf_ctx); -unsigned int BLI_scanfill_calc(ScanFillContext *sf_ctx, const int flag); -unsigned int BLI_scanfill_calc_ex(ScanFillContext *sf_ctx, - const int flag, - const float nor_proj[3]); +unsigned int BLI_scanfill_calc(ScanFillContext *sf_ctx, int flag); +unsigned int BLI_scanfill_calc_ex(ScanFillContext *sf_ctx, int flag, const float nor_proj[3]); void BLI_scanfill_end(ScanFillContext *sf_ctx); void BLI_scanfill_begin_arena(ScanFillContext *sf_ctx, struct MemArena *arena); diff --git a/source/blender/blenlib/BLI_smallhash.h b/source/blender/blenlib/BLI_smallhash.h index 76009810eb9..9c274d25fba 100644 --- a/source/blender/blenlib/BLI_smallhash.h +++ b/source/blender/blenlib/BLI_smallhash.h @@ -53,7 +53,7 @@ typedef struct { unsigned int i; } SmallHashIter; -void BLI_smallhash_init_ex(SmallHash *sh, const unsigned int nentries_reserve) ATTR_NONNULL(1); +void BLI_smallhash_init_ex(SmallHash *sh, unsigned int nentries_reserve) ATTR_NONNULL(1); void BLI_smallhash_init(SmallHash *sh) ATTR_NONNULL(1); /** * \note does *not* free *sh itself! only the direct data! diff --git a/source/blender/blenlib/BLI_span.hh b/source/blender/blenlib/BLI_span.hh index 5e69e28dbb1..b4497977815 100644 --- a/source/blender/blenlib/BLI_span.hh +++ b/source/blender/blenlib/BLI_span.hh @@ -109,7 +109,7 @@ template<typename T> class Span { BLI_assert(size >= 0); } - template<typename U, typename std::enable_if_t<is_span_convertible_pointer_v<U, T>> * = nullptr> + template<typename U, BLI_ENABLE_IF((is_span_convertible_pointer_v<U, T>))> constexpr Span(const U *start, int64_t size) : data_(static_cast<const T *>(start)), size_(size) { BLI_assert(size >= 0); @@ -144,7 +144,7 @@ template<typename T> class Span { * Support implicit conversions like the one below: * Span<T *> -> Span<const T *> */ - template<typename U, typename std::enable_if_t<is_span_convertible_pointer_v<U, T>> * = nullptr> + template<typename U, BLI_ENABLE_IF((is_span_convertible_pointer_v<U, T>))> constexpr Span(Span<U> span) : data_(static_cast<const T *>(span.data())), size_(span.size()) { } @@ -501,7 +501,7 @@ template<typename T> class MutableSpan { * Support implicit conversions like the one below: * MutableSpan<T *> -> MutableSpan<const T *> */ - template<typename U, typename std::enable_if_t<is_span_convertible_pointer_v<U, T>> * = nullptr> + template<typename U, BLI_ENABLE_IF((is_span_convertible_pointer_v<U, T>))> constexpr MutableSpan(MutableSpan<U> span) : data_(static_cast<T *>(span.data())), size_(span.size()) { @@ -512,7 +512,7 @@ template<typename T> class MutableSpan { return Span<T>(data_, size_); } - template<typename U, typename std::enable_if_t<is_span_convertible_pointer_v<T, U>> * = nullptr> + template<typename U, BLI_ENABLE_IF((is_span_convertible_pointer_v<T, U>))> constexpr operator Span<U>() const { return Span<U>(static_cast<const U *>(data_), size_); diff --git a/source/blender/blenlib/BLI_string.h b/source/blender/blenlib/BLI_string.h index 91cc7b23a5f..a82e97914db 100644 --- a/source/blender/blenlib/BLI_string.h +++ b/source/blender/blenlib/BLI_string.h @@ -89,7 +89,7 @@ char *BLI_strncpy(char *__restrict dst, const char *__restrict src, const size_t */ char *BLI_strncpy_ensure_pad(char *__restrict dst, const char *__restrict src, - const char pad, + char pad, size_t maxncpy) ATTR_NONNULL(); /** @@ -306,8 +306,7 @@ size_t BLI_str_format_uint64_grouped(char dst[16], uint64_t num) ATTR_NONNULL(); * \param bytes: Number to format. * \param base_10: Calculate using base 10 (GB, MB, ...) or 2 (GiB, MiB, ...). */ -void BLI_str_format_byte_unit(char dst[15], long long int bytes, const bool base_10) - ATTR_NONNULL(); +void BLI_str_format_byte_unit(char dst[15], long long int bytes, bool base_10) ATTR_NONNULL(); /** * Format a count to up to 6 places (plus '\0' terminator) string using long number * names abbreviations. Used to produce a compact representation of large numbers. @@ -354,9 +353,8 @@ int BLI_strcasecmp_natural(const char *s1, const char *s2) ATTR_WARN_UNUSED_RESU * Like strcmp, but will ignore any heading/trailing pad char for comparison. * So e.g. if pad is '*', '*world' and 'world*' will compare equal. */ -int BLI_strcmp_ignore_pad(const char *str1, - const char *str2, - const char pad) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(); +int BLI_strcmp_ignore_pad(const char *str1, const char *str2, char pad) ATTR_WARN_UNUSED_RESULT + ATTR_NONNULL(); /** * Determine the length of a fixed-size string. @@ -378,7 +376,7 @@ void BLI_str_rstrip(char *str) ATTR_NONNULL(); * \param pad: * \return The number of zeros stripped. */ -int BLI_str_rstrip_float_zero(char *str, const char pad) ATTR_NONNULL(); +int BLI_str_rstrip_float_zero(char *str, char pad) ATTR_NONNULL(); /** * Return index of a string in a string array. @@ -390,7 +388,7 @@ int BLI_str_rstrip_float_zero(char *str, const char pad) ATTR_NONNULL(); */ int BLI_str_index_in_array_n(const char *__restrict str, const char **__restrict str_array, - const int str_array_len) ATTR_NONNULL(); + int str_array_len) ATTR_NONNULL(); /** * Return index of a string in a string array. * @@ -461,14 +459,14 @@ size_t BLI_str_partition_ex(const char *str, const char delim[], const char **sep, const char **suf, - const bool from_right) ATTR_NONNULL(1, 3, 4, 5); + bool from_right) ATTR_NONNULL(1, 3, 4, 5); -int BLI_string_max_possible_word_count(const int str_len); +int BLI_string_max_possible_word_count(int str_len); bool BLI_string_has_word_prefix(const char *haystack, const char *needle, size_t needle_len); bool BLI_string_all_words_matched(const char *name, const char *str, int (*words)[2], - const int words_len); + int words_len); /** * Find the ranges needed to split \a str into its individual words. @@ -482,7 +480,7 @@ bool BLI_string_all_words_matched(const char *name, */ int BLI_string_find_split_words(const char *str, const size_t len, - const char delim, + char delim, int r_words[][2], int words_max) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(); diff --git a/source/blender/blenlib/BLI_string_ref.hh b/source/blender/blenlib/BLI_string_ref.hh index dc73208350f..3769e711a50 100644 --- a/source/blender/blenlib/BLI_string_ref.hh +++ b/source/blender/blenlib/BLI_string_ref.hh @@ -64,7 +64,7 @@ class StringRefBase { const char *data_; int64_t size_; - constexpr StringRefBase(const char *data, const int64_t size); + constexpr StringRefBase(const char *data, int64_t size); public: /* Similar to string_view::npos, but signed. */ @@ -84,12 +84,12 @@ class StringRefBase { constexpr IndexRange index_range() const; void unsafe_copy(char *dst) const; - void copy(char *dst, const int64_t dst_size) const; + void copy(char *dst, int64_t dst_size) const; template<size_t N> void copy(char (&dst)[N]) const; constexpr bool startswith(StringRef prefix) const; constexpr bool endswith(StringRef suffix) const; - constexpr StringRef substr(int64_t start, const int64_t size) const; + constexpr StringRef substr(int64_t start, int64_t size) const; constexpr const char &front() const; constexpr const char &back() const; @@ -123,11 +123,11 @@ class StringRefNull : public StringRefBase { public: constexpr StringRefNull(); - constexpr StringRefNull(const char *str, const int64_t size); + constexpr StringRefNull(const char *str, int64_t size); StringRefNull(const char *str); StringRefNull(const std::string &str); - constexpr char operator[](const int64_t index) const; + constexpr char operator[](int64_t index) const; constexpr const char *c_str() const; }; @@ -139,14 +139,14 @@ class StringRef : public StringRefBase { constexpr StringRef(); constexpr StringRef(StringRefNull other); constexpr StringRef(const char *str); - constexpr StringRef(const char *str, const int64_t length); + constexpr StringRef(const char *str, int64_t length); constexpr StringRef(const char *begin, const char *one_after_end); constexpr StringRef(std::string_view view); StringRef(const std::string &str); - constexpr StringRef drop_prefix(const int64_t n) const; + constexpr StringRef drop_prefix(int64_t n) const; constexpr StringRef drop_known_prefix(StringRef prefix) const; - constexpr StringRef drop_suffix(const int64_t n) const; + constexpr StringRef drop_suffix(int64_t n) const; constexpr char operator[](int64_t index) const; }; diff --git a/source/blender/blenlib/BLI_string_utf8.h b/source/blender/blenlib/BLI_string_utf8.h index 72bddb322db..82622d442fb 100644 --- a/source/blender/blenlib/BLI_string_utf8.h +++ b/source/blender/blenlib/BLI_string_utf8.h @@ -202,8 +202,7 @@ size_t BLI_str_partition_ex_utf8(const char *str, const unsigned int delim[], const char **sep, const char **suf, - const bool from_right) ATTR_WARN_UNUSED_RESULT - ATTR_NONNULL(1, 3, 4, 5); + bool from_right) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1, 3, 4, 5); int BLI_str_utf8_offset_to_index(const char *str, int offset) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1); diff --git a/source/blender/blenlib/BLI_string_utils.h b/source/blender/blenlib/BLI_string_utils.h index ce4d0afb933..fd3918ff217 100644 --- a/source/blender/blenlib/BLI_string_utils.h +++ b/source/blender/blenlib/BLI_string_utils.h @@ -50,7 +50,7 @@ typedef bool (*UniquenameCheckCallback)(void *arg, const char *name); * \param delim: Delimiter character`. * \return Length of \a left. */ -size_t BLI_split_name_num(char *left, int *nr, const char *name, const char delim); +size_t BLI_split_name_num(char *left, int *nr, const char *name, char delim); bool BLI_string_is_decimal(const char *string) ATTR_NONNULL(); /** @@ -126,7 +126,7 @@ char *BLI_string_join_array_by_sep_char_with_tableN(char sep, */ size_t BLI_string_flip_side_name(char *r_name, const char *from_name, - const bool strip_number, + bool strip_number, const size_t name_len); /** diff --git a/source/blender/blenlib/BLI_task.h b/source/blender/blenlib/BLI_task.h index 616237bc261..e487f8acd98 100644 --- a/source/blender/blenlib/BLI_task.h +++ b/source/blender/blenlib/BLI_task.h @@ -157,7 +157,7 @@ typedef struct TaskParallelTLS { } TaskParallelTLS; typedef void (*TaskParallelRangeFunc)(void *__restrict userdata, - const int iter, + int iter, const TaskParallelTLS *__restrict tls); typedef void (*TaskParallelInitFunc)(const void *__restrict userdata, void *__restrict chunk); @@ -210,8 +210,8 @@ typedef struct TaskParallelSettings { BLI_INLINE void BLI_parallel_range_settings_defaults(TaskParallelSettings *settings); -void BLI_task_parallel_range(const int start, - const int stop, +void BLI_task_parallel_range(int start, + int stop, void *userdata, TaskParallelRangeFunc func, const TaskParallelSettings *settings); @@ -262,8 +262,8 @@ typedef void (*TaskParallelIteratorFunc)(void *__restrict userdata, void BLI_task_parallel_iterator(void *userdata, TaskParallelIteratorIterFunc iter_func, void *init_item, - const int init_index, - const int tot_items, + int init_index, + int tot_items, TaskParallelIteratorFunc func, const TaskParallelSettings *settings); diff --git a/source/blender/blenlib/BLI_threads.h b/source/blender/blenlib/BLI_threads.h index 7bae16f25ef..60ed5f0544a 100644 --- a/source/blender/blenlib/BLI_threads.h +++ b/source/blender/blenlib/BLI_threads.h @@ -167,7 +167,7 @@ typedef pthread_cond_t ThreadCondition; void BLI_condition_init(ThreadCondition *cond); void BLI_condition_wait(ThreadCondition *cond, ThreadMutex *mutex); -void BLI_condition_wait_global_mutex(ThreadCondition *cond, const int type); +void BLI_condition_wait_global_mutex(ThreadCondition *cond, int type); void BLI_condition_notify_one(ThreadCondition *cond); void BLI_condition_notify_all(ThreadCondition *cond); void BLI_condition_end(ThreadCondition *cond); @@ -210,13 +210,6 @@ void BLI_thread_queue_nowait(ThreadQueue *queue); # define BLI_thread_local_set(name, value) name = value #endif /* defined(__APPLE__) */ -/* **** Special functions to help performance on crazy NUMA setups. **** */ - -/* Make sure process/thread is using NUMA node with fast memory access. */ - -void BLI_thread_put_process_on_fast_node(void); -void BLI_thread_put_thread_on_fast_node(void); - #ifdef __cplusplus } #endif diff --git a/source/blender/blenlib/BLI_timecode.h b/source/blender/blenlib/BLI_timecode.h index 4eec8aef245..f0349e289ac 100644 --- a/source/blender/blenlib/BLI_timecode.h +++ b/source/blender/blenlib/BLI_timecode.h @@ -43,10 +43,10 @@ extern "C" { */ size_t BLI_timecode_string_from_time(char *str, const size_t maxncpy, - const int brevity_level, - const float time_seconds, - const double fps, - const short timecode_style) ATTR_NONNULL(); + int brevity_level, + float time_seconds, + double fps, + short timecode_style) ATTR_NONNULL(); /** * Generate time string and store in \a str @@ -56,9 +56,8 @@ size_t BLI_timecode_string_from_time(char *str, * \param time_seconds: time total time in seconds * \return length of \a str */ -size_t BLI_timecode_string_from_time_simple(char *str, - const size_t maxncpy, - const double time_seconds) ATTR_NONNULL(); +size_t BLI_timecode_string_from_time_simple(char *str, const size_t maxncpy, double time_seconds) + ATTR_NONNULL(); /** * Generate time string and store in \a str @@ -74,8 +73,8 @@ size_t BLI_timecode_string_from_time_simple(char *str, */ size_t BLI_timecode_string_from_time_seconds(char *str, const size_t maxncpy, - const int brevity_level, - const float time_seconds) ATTR_NONNULL(); + int brevity_level, + float time_seconds) ATTR_NONNULL(); #ifdef __cplusplus } diff --git a/source/blender/blenlib/BLI_vector.hh b/source/blender/blenlib/BLI_vector.hh index 4ac48f259cf..1b10a4c0897 100644 --- a/source/blender/blenlib/BLI_vector.hh +++ b/source/blender/blenlib/BLI_vector.hh @@ -163,7 +163,7 @@ class Vector { /** * Create a vector from a span. The values in the vector are copy constructed. */ - template<typename U, typename std::enable_if_t<std::is_convertible_v<U, T>> * = nullptr> + template<typename U, BLI_ENABLE_IF((std::is_convertible_v<U, T>))> Vector(Span<U> values, Allocator allocator = {}) : Vector(NoExceptConstructor(), allocator) { const int64_t size = values.size(); @@ -178,7 +178,7 @@ class Vector { * This allows you to write code like: * Vector<int> vec = {3, 4, 5}; */ - template<typename U, typename std::enable_if_t<std::is_convertible_v<U, T>> * = nullptr> + template<typename U, BLI_ENABLE_IF((std::is_convertible_v<U, T>))> Vector(const std::initializer_list<U> &values) : Vector(Span<U>(values)) { } @@ -187,9 +187,7 @@ class Vector { { } - template<typename U, - size_t N, - typename std::enable_if_t<std::is_convertible_v<U, T>> * = nullptr> + template<typename U, size_t N, BLI_ENABLE_IF((std::is_convertible_v<U, T>))> Vector(const std::array<U, N> &values) : Vector(Span(values)) { } @@ -197,7 +195,7 @@ class Vector { template<typename InputIt, /* This constructor should not be called with e.g. Vector(3, 10), because that is * expected to produce the vector (10, 10, 10). */ - typename std::enable_if_t<!std::is_convertible_v<InputIt, int>> * = nullptr> + BLI_ENABLE_IF((!std::is_convertible_v<InputIt, int>))> Vector(InputIt first, InputIt last, Allocator allocator = {}) : Vector(NoExceptConstructor(), allocator) { @@ -326,13 +324,13 @@ class Vector { return MutableSpan<T>(begin_, this->size()); } - template<typename U, typename std::enable_if_t<is_span_convertible_pointer_v<T, U>> * = nullptr> + template<typename U, BLI_ENABLE_IF((is_span_convertible_pointer_v<T, U>))> operator Span<U>() const { return Span<U>(begin_, this->size()); } - template<typename U, typename std::enable_if_t<is_span_convertible_pointer_v<T, U>> * = nullptr> + template<typename U, BLI_ENABLE_IF((is_span_convertible_pointer_v<T, U>))> operator MutableSpan<U>() { return MutableSpan<U>(begin_, this->size()); diff --git a/source/blender/blenlib/BLI_virtual_array.hh b/source/blender/blenlib/BLI_virtual_array.hh index 86ac95e2c77..231ce1bdd67 100644 --- a/source/blender/blenlib/BLI_virtual_array.hh +++ b/source/blender/blenlib/BLI_virtual_array.hh @@ -79,7 +79,7 @@ template<typename T> class VArrayImpl { * Get the element at #index. This does not return a reference, because the value may be computed * on the fly. */ - virtual T get(const int64_t index) const = 0; + virtual T get(int64_t index) const = 0; /** * Return true when the virtual array is a plain array internally. @@ -202,7 +202,7 @@ template<typename T> class VMutableArrayImpl : public VArrayImpl<T> { /** * Assign the provided #value to the #index. */ - virtual void set(const int64_t index, T value) = 0; + virtual void set(int64_t index, T value) = 0; /** * Copy all elements from the provided span into the virtual array. diff --git a/source/blender/blenlib/BLI_virtual_vector_array.hh b/source/blender/blenlib/BLI_virtual_vector_array.hh index 7672a76d5de..7960c6b1420 100644 --- a/source/blender/blenlib/BLI_virtual_vector_array.hh +++ b/source/blender/blenlib/BLI_virtual_vector_array.hh @@ -82,9 +82,9 @@ template<typename T> class VVectorArray { } protected: - virtual int64_t get_vector_size_impl(const int64_t index) const = 0; + virtual int64_t get_vector_size_impl(int64_t index) const = 0; - virtual T get_vector_element_impl(const int64_t index, const int64_t index_in_vetor) const = 0; + virtual T get_vector_element_impl(int64_t index, int64_t index_in_vetor) const = 0; virtual bool is_single_vector_impl() const { diff --git a/source/blender/blenlib/BLI_winstuff.h b/source/blender/blenlib/BLI_winstuff.h index 568734ee8a7..2ea557e971a 100644 --- a/source/blender/blenlib/BLI_winstuff.h +++ b/source/blender/blenlib/BLI_winstuff.h @@ -106,7 +106,7 @@ const char *dirname(char *path); /* Windows utility functions. */ -bool BLI_windows_register_blend_extension(const bool background); +bool BLI_windows_register_blend_extension(bool background); void BLI_windows_get_default_root_dir(char root_dir[4]); int BLI_windows_get_executable_dir(char *str); diff --git a/source/blender/blenlib/CMakeLists.txt b/source/blender/blenlib/CMakeLists.txt index 0db0d9a67b3..3958fd8e2d2 100644 --- a/source/blender/blenlib/CMakeLists.txt +++ b/source/blender/blenlib/CMakeLists.txt @@ -25,7 +25,6 @@ set(INC ../../../intern/atomic ../../../intern/eigen ../../../intern/guardedalloc - ../../../intern/numaapi/include ../../../extern/wcwidth ../../../extern/json/include ) @@ -334,7 +333,6 @@ set(SRC set(LIB bf_intern_eigen bf_intern_guardedalloc - bf_intern_numaapi extern_wcwidth ${ZLIB_LIBRARIES} diff --git a/source/blender/blenlib/intern/kdtree_impl.h b/source/blender/blenlib/intern/kdtree_impl.h index 0b47be1f7ea..c0e740b39b3 100644 --- a/source/blender/blenlib/intern/kdtree_impl.h +++ b/source/blender/blenlib/intern/kdtree_impl.h @@ -594,7 +594,7 @@ int BLI_kdtree_nd_(find_nearest_n_with_len_squared_cb)( int BLI_kdtree_nd_(find_nearest_n)(const KDTree *tree, const float co[KD_DIMS], KDTreeNearest r_nearest[], - const uint nearest_len_capacity) + uint nearest_len_capacity) { return BLI_kdtree_nd_(find_nearest_n_with_len_squared_cb)( tree, co, r_nearest, nearest_len_capacity, NULL, NULL); @@ -726,7 +726,7 @@ int BLI_kdtree_nd_(range_search_with_len_squared_cb)( int BLI_kdtree_nd_(range_search)(const KDTree *tree, const float co[KD_DIMS], KDTreeNearest **r_nearest, - const float range) + float range) { return BLI_kdtree_nd_(range_search_with_len_squared_cb)(tree, co, r_nearest, range, NULL, NULL); } diff --git a/source/blender/blenlib/intern/threads.cc b/source/blender/blenlib/intern/threads.cc index 3589c952409..f131a464650 100644 --- a/source/blender/blenlib/intern/threads.cc +++ b/source/blender/blenlib/intern/threads.cc @@ -52,7 +52,6 @@ #endif #include "atomic_ops.h" -#include "numaapi.h" #if defined(__APPLE__) && defined(_OPENMP) && (__GNUC__ == 4) && (__GNUC_MINOR__ == 2) && \ !defined(__clang__) @@ -125,7 +124,6 @@ static pthread_mutex_t _colormanage_lock = PTHREAD_MUTEX_INITIALIZER; static pthread_mutex_t _fftw_lock = PTHREAD_MUTEX_INITIALIZER; static pthread_mutex_t _view3d_lock = PTHREAD_MUTEX_INITIALIZER; static pthread_t mainid; -static bool is_numa_available = false; static unsigned int thread_levels = 0; /* threads can be invoked inside threads */ static int num_threads_override = 0; @@ -143,9 +141,6 @@ struct ThreadSlot { void BLI_threadapi_init() { mainid = pthread_self(); - if (numaAPI_Initialize() == NUMAAPI_SUCCESS) { - is_numa_available = true; - } } void BLI_threadapi_exit() @@ -807,110 +802,3 @@ void BLI_thread_queue_wait_finish(ThreadQueue *queue) pthread_mutex_unlock(&queue->mutex); } - -/* **** Special functions to help performance on crazy NUMA setups. **** */ - -#if 0 /* UNUSED */ -static bool check_is_threadripper2_alike_topology(){ - /* NOTE: We hope operating system does not support CPU hot-swap to - * a different brand. And that SMP of different types is also not - * encouraged by the system. */ - static bool is_initialized = false; - static bool is_threadripper2 = false; - if (is_initialized) { - return is_threadripper2; - } - is_initialized = true; - char *cpu_brand = BLI_cpu_brand_string(); - if (cpu_brand == nullptr) { - return false; - } - if (strstr(cpu_brand, "Threadripper")) { - /* NOTE: We consider all Thread-rippers having similar topology to - * the second one. This is because we are trying to utilize NUMA node - * 0 as much as possible. This node does exist on earlier versions of - * thread-ripper and setting affinity to it should not have negative - * effect. - * This allows us to avoid per-model check, making the code more - * reliable for the CPUs which are not yet released. - */ - if (strstr(cpu_brand, "2990WX") || strstr(cpu_brand, "2950X")) { - is_threadripper2 = true; - } - } - /* NOTE: While all dies of EPYC has memory controller, only two f them - * has access to a lower-indexed DDR slots. Those dies are same as on - * Threadripper2 with the memory controller. - * Now, it is rather likely that reasonable amount of users don't max - * up their DR slots, making it only two dies connected to a DDR slot - * with actual memory in it. */ - if (strstr(cpu_brand, "EPYC")) { - /* NOTE: Similarly to Thread-ripper we do not do model check. */ - is_threadripper2 = true; - } - MEM_freeN(cpu_brand); - return is_threadripper2; -} - -static void threadripper_put_process_on_fast_node(){ - if (!is_numa_available) { - return; - } - /* NOTE: Technically, we can use NUMA nodes 0 and 2 and using both of - * them in the affinity mask will allow OS to schedule threads more - * flexible,possibly increasing overall performance when multiple apps - * are crunching numbers. - * - * However, if scene fits into memory adjacent to a single die we don't - * want OS to re-schedule the process to another die since that will make - * it further away from memory allocated for .blend file. */ - /* NOTE: Even if NUMA is available in the API but is disabled in BIOS on - * this workstation we still process here. If NUMA is disabled it will be a - * single node, so our action is no-visible-changes, but allows to keep - * things simple and unified. */ - numaAPI_RunProcessOnNode(0); -} - -static void threadripper_put_thread_on_fast_node(){ - if (!is_numa_available) { - return; - } - /* NOTE: This is where things becomes more interesting. On the one hand - * we can use nodes 0 and 2 and allow operating system to do balancing - * of processes/threads for the maximum performance when multiple apps - * are running. - * On another hand, however, we probably want to use same node as the - * main thread since that's where the memory of .blend file is likely - * to be allocated. - * Since the main thread is currently on node 0, we also put thread on - * same node. */ - /* See additional note about NUMA disabled in BIOS above. */ - numaAPI_RunThreadOnNode(0); -} -#endif /* UNUSED */ - -void BLI_thread_put_process_on_fast_node() -{ - /* Disabled for now since this causes only 16 threads to be used on a - * thread-ripper for computations like sculpting and fluid sim. The problem - * is that all threads created as children from this thread will inherit - * the NUMA node and so will end up on the same node. This can be fixed - * case-by-case by assigning the NUMA node for every child thread, however - * this is difficult for external libraries and OpenMP, and out of our - * control for plugins like external renderers. */ -#if 0 - if (check_is_threadripper2_alike_topology()) { - threadripper_put_process_on_fast_node(); - } -#endif -} - -void BLI_thread_put_thread_on_fast_node() -{ - /* Disabled for now, see comment above. */ -#if 0 - if (check_is_threadripper2_alike_topology()) { - threadripper_put_thread_on_fast_node(); - } -#endif -} diff --git a/source/blender/blenlib/tests/BLI_any_test.cc b/source/blender/blenlib/tests/BLI_any_test.cc index 226088cf3c7..436a1d5fa4a 100644 --- a/source/blender/blenlib/tests/BLI_any_test.cc +++ b/source/blender/blenlib/tests/BLI_any_test.cc @@ -9,7 +9,7 @@ namespace blender::tests { TEST(any, DefaultConstructor) { - Any a; + Any<> a; EXPECT_FALSE(a.has_value()); } @@ -24,11 +24,11 @@ TEST(any, AssignInt) a = 10; EXPECT_EQ(value, 10); - Any b = a; + Any<> b = a; EXPECT_TRUE(b.has_value()); EXPECT_EQ(b.get<int>(), 10); - Any c = std::move(a); + Any<> c = std::move(a); EXPECT_TRUE(c); EXPECT_EQ(c.get<int>(), 10); @@ -48,11 +48,11 @@ TEST(any, AssignMap) map.add(4, 2); EXPECT_EQ((a.get<Map<int, int>>().lookup(4)), 2); - Any b = a; + Any<> b = a; EXPECT_TRUE(b); EXPECT_EQ((b.get<Map<int, int>>().lookup(4)), 2); - Any c = std::move(a); + Any<> c = std::move(a); c = c; EXPECT_TRUE(b); EXPECT_EQ((c.get<Map<int, int>>().lookup(4)), 2); @@ -64,9 +64,9 @@ TEST(any, AssignAny) { Any<> a = 5; Any<> b = std::string("hello"); - Any c; + Any<> c; - Any z; + Any<> z; EXPECT_FALSE(z.has_value()); z = a; diff --git a/source/blender/blenloader/BLO_readfile.h b/source/blender/blenloader/BLO_readfile.h index 567886e4d54..c4c3b42cb63 100644 --- a/source/blender/blenloader/BLO_readfile.h +++ b/source/blender/blenloader/BLO_readfile.h @@ -233,7 +233,7 @@ BlendHandle *BLO_blendhandle_from_memory(const void *mem, struct LinkNode *BLO_blendhandle_get_datablock_names(BlendHandle *bh, int ofblocktype, - const bool use_assets_only, + bool use_assets_only, int *r_tot_names); /** * Gets the names and asset-data (if ID is an asset) of data-blocks in a file of a certain type. @@ -246,8 +246,10 @@ struct LinkNode *BLO_blendhandle_get_datablock_names(BlendHandle *bh, * \return A BLI_linklist of `BLODataBlockInfo *`. * The links and #BLODataBlockInfo.asset_data should be freed with MEM_freeN. */ -struct LinkNode * /*BLODataBlockInfo */ BLO_blendhandle_get_datablock_info( - BlendHandle *bh, int ofblocktype, const bool use_assets_only, int *r_tot_info_items); +struct LinkNode * /*BLODataBlockInfo */ BLO_blendhandle_get_datablock_info(BlendHandle *bh, + int ofblocktype, + bool use_assets_only, + int *r_tot_info_items); /** * Gets the previews of all the data-blocks in a file of a certain type * (e.g. all the scene previews in a file). @@ -367,12 +369,12 @@ typedef struct LibraryLink_Params { void BLO_library_link_params_init(struct LibraryLink_Params *params, struct Main *bmain, - const int flag, - const int id_tag_extra); + int flag, + int id_tag_extra); void BLO_library_link_params_init_with_context(struct LibraryLink_Params *params, struct Main *bmain, - const int flag, - const int id_tag_extra, + int flag, + int id_tag_extra, struct Scene *scene, struct ViewLayer *view_layer, const struct View3D *v3d); @@ -400,7 +402,7 @@ struct Main *BLO_library_link_begin(BlendHandle **bh, */ struct ID *BLO_library_link_named_part(struct Main *mainl, BlendHandle **bh, - const short idcode, + short idcode, const char *name, const struct LibraryLink_Params *params); /** @@ -435,7 +437,7 @@ typedef struct TempLibraryContext { TempLibraryContext *BLO_library_temp_load_id(struct Main *real_main, const char *blend_file_path, - const short idcode, + short idcode, const char *idname, struct ReportList *reports); void BLO_library_temp_free(TempLibraryContext *temp_lib_ctx); diff --git a/source/blender/blenloader/BLO_writefile.h b/source/blender/blenloader/BLO_writefile.h index 9bc3714ff38..072f86b48d6 100644 --- a/source/blender/blenloader/BLO_writefile.h +++ b/source/blender/blenloader/BLO_writefile.h @@ -69,7 +69,7 @@ struct BlendFileWriteParams { */ extern bool BLO_write_file(struct Main *mainvar, const char *filepath, - const int write_flags, + int write_flags, const struct BlendFileWriteParams *params, struct ReportList *reports); diff --git a/source/blender/blenloader/intern/readfile.h b/source/blender/blenloader/intern/readfile.h index 3b5be3dd013..21b0354b097 100644 --- a/source/blender/blenloader/intern/readfile.h +++ b/source/blender/blenloader/intern/readfile.h @@ -200,7 +200,7 @@ struct AssetMetaData *blo_bhead_id_asset_data_address(const FileData *fd, const * * \attention ONLY USE THIS KIND OF VERSIONING WHEN `dna_rename_defs.h` ISN'T SUFFICIENT. */ -void blo_do_versions_dna(struct SDNA *sdna, const int versionfile, const int subversionfile); +void blo_do_versions_dna(struct SDNA *sdna, int versionfile, int subversionfile); void blo_do_versions_oldnewmap_insert(struct OldNewMap *onm, const void *oldaddr, diff --git a/source/blender/blenloader/intern/versioning_300.c b/source/blender/blenloader/intern/versioning_300.c index 5a93e81d2b1..152684db8f1 100644 --- a/source/blender/blenloader/intern/versioning_300.c +++ b/source/blender/blenloader/intern/versioning_300.c @@ -45,6 +45,8 @@ #include "DNA_listBase.h" #include "DNA_material_types.h" #include "DNA_modifier_types.h" +#include "DNA_screen_types.h" +#include "DNA_space_types.h" #include "DNA_text_types.h" #include "DNA_workspace_types.h" @@ -822,7 +824,8 @@ void do_versions_after_linking_300(Main *bmain, ReportList *UNUSED(reports)) /* Ensure tiled image sources contain a UDIM token. */ LISTBASE_FOREACH (Image *, ima, &bmain->images) { if (ima->source == IMA_SRC_TILED) { - BKE_image_ensure_tile_token(ima->filepath); + char *filename = (char *)BLI_path_basename(ima->filepath); + BKE_image_ensure_tile_token(filename); } } } @@ -2526,5 +2529,19 @@ void blo_do_versions_300(FileData *fd, Library *UNUSED(lib), Main *bmain) } } } + + /* Initialize the bone wireframe opacity setting. */ + if (!DNA_struct_elem_find(fd->filesdna, "View3DOverlay", "float", "bone_wire_alpha")) { + for (bScreen *screen = bmain->screens.first; screen; screen = screen->id.next) { + LISTBASE_FOREACH (ScrArea *, area, &screen->areabase) { + LISTBASE_FOREACH (SpaceLink *, sl, &area->spacedata) { + if (sl->spacetype == SPACE_VIEW3D) { + View3D *v3d = (View3D *)sl; + v3d->overlay.bone_wire_alpha = 1.0f; + } + } + } + } + } } } diff --git a/source/blender/blenloader/intern/versioning_common.h b/source/blender/blenloader/intern/versioning_common.h index 9e13cc45103..ea850a052ae 100644 --- a/source/blender/blenloader/intern/versioning_common.h +++ b/source/blender/blenloader/intern/versioning_common.h @@ -39,21 +39,18 @@ struct ARegion *do_versions_add_region_if_not_found(struct ListBase *regionbase, * * \return the ID (if found). */ -ID *do_versions_rename_id(Main *bmain, - const short id_type, - const char *name_src, - const char *name_dst); +ID *do_versions_rename_id(Main *bmain, short id_type, const char *name_src, const char *name_dst); void version_node_socket_name(struct bNodeTree *ntree, - const int node_type, + int node_type, const char *old_name, const char *new_name); void version_node_input_socket_name(struct bNodeTree *ntree, - const int node_type, + int node_type, const char *old_name, const char *new_name); void version_node_output_socket_name(struct bNodeTree *ntree, - const int node_type, + int node_type, const char *old_name, const char *new_name); @@ -85,7 +82,7 @@ void version_node_socket_index_animdata( /** * Replace the ID name of all nodes in the tree with the given type with the new name. */ -void version_node_id(struct bNodeTree *ntree, const int node_type, const char *new_name); +void version_node_id(struct bNodeTree *ntree, int node_type, const char *new_name); /** * Convert `SocketName.001` unique name format to `SocketName_001`. Previously both were used. diff --git a/source/blender/bmesh/intern/bmesh_construct.h b/source/blender/bmesh/intern/bmesh_construct.h index 692f3b403b5..7b25a5b5a2a 100644 --- a/source/blender/bmesh/intern/bmesh_construct.h +++ b/source/blender/bmesh/intern/bmesh_construct.h @@ -30,19 +30,19 @@ struct Mesh; * * \returns false if any verts aren't found. */ -bool BM_verts_from_edges(BMVert **vert_arr, BMEdge **edge_arr, const int len); +bool BM_verts_from_edges(BMVert **vert_arr, BMEdge **edge_arr, int len); /** * Fill in an edge array from a vertex array (connected polygon loop). * * \returns false if any edges aren't found. */ -bool BM_edges_from_verts(BMEdge **edge_arr, BMVert **vert_arr, const int len); +bool BM_edges_from_verts(BMEdge **edge_arr, BMVert **vert_arr, int len); /** * Fill in an edge array from a vertex array (connected polygon loop). * Creating edges as-needed. */ -void BM_edges_from_verts_ensure(BMesh *bm, BMEdge **edge_arr, BMVert **vert_arr, const int len); +void BM_edges_from_verts_ensure(BMesh *bm, BMEdge **edge_arr, BMVert **vert_arr, int len); /** * Makes an NGon from an un-ordered set of verts. @@ -82,7 +82,7 @@ BMFace *BM_face_create_quad_tri(BMesh *bm, BMVert *v3, BMVert *v4, const BMFace *f_example, - const eBMCreateFlag create_flag); + eBMCreateFlag create_flag); /** * \brief copies face loop data from shared adjacent faces. @@ -114,9 +114,9 @@ BMFace *BM_face_create_ngon(BMesh *bm, BMVert *v1, BMVert *v2, BMEdge **edges, - const int len, + int len, const BMFace *f_example, - const eBMCreateFlag create_flag); + eBMCreateFlag create_flag); /** * Create an ngon from an array of sorted verts * @@ -127,11 +127,11 @@ BMFace *BM_face_create_ngon(BMesh *bm, */ BMFace *BM_face_create_ngon_verts(BMesh *bm, BMVert **vert_arr, - const int len, + int len, const BMFace *f_example, - const eBMCreateFlag create_flag, - const bool calc_winding, - const bool create_edges); + eBMCreateFlag create_flag, + bool calc_winding, + bool create_edges); /** * Copies attributes, e.g. customdata, header flags, etc, from one element @@ -141,8 +141,8 @@ void BM_elem_attrs_copy_ex(BMesh *bm_src, BMesh *bm_dst, const void *ele_src_v, void *ele_dst_v, - const char hflag_mask, - const uint64_t cd_mask_exclude); + char hflag_mask, + uint64_t cd_mask_exclude); void BM_elem_attrs_copy(BMesh *bm_src, BMesh *bm_dst, const void *ele_src_v, void *ele_dst_v); void BM_elem_select_copy(BMesh *bm_dst, void *ele_dst_v, const void *ele_src_v); @@ -163,14 +163,14 @@ void BM_mesh_copy_init_customdata(BMesh *bm_dst, */ void BM_mesh_copy_init_customdata_all_layers(BMesh *bm_dst, BMesh *bm_src, - const char htype, + char htype, const struct BMAllocTemplate *allocsize); BMesh *BM_mesh_copy(BMesh *bm_old); -char BM_face_flag_from_mflag(const char mflag); -char BM_edge_flag_from_mflag(const short mflag); +char BM_face_flag_from_mflag(char mflag); +char BM_edge_flag_from_mflag(short mflag); /* ME -> BM */ -char BM_vert_flag_from_mflag(const char mflag); +char BM_vert_flag_from_mflag(char mflag); char BM_face_flag_to_mflag(BMFace *f); short BM_edge_flag_to_mflag(BMEdge *e); /* BM -> ME */ diff --git a/source/blender/bmesh/intern/bmesh_core.h b/source/blender/bmesh/intern/bmesh_core.h index cd0e1754cd1..a885df51bd3 100644 --- a/source/blender/bmesh/intern/bmesh_core.h +++ b/source/blender/bmesh/intern/bmesh_core.h @@ -20,8 +20,7 @@ * \ingroup bmesh */ -BMFace *BM_face_copy( - BMesh *bm_dst, BMesh *bm_src, BMFace *f, const bool copy_verts, const bool copy_edges); +BMFace *BM_face_copy(BMesh *bm_dst, BMesh *bm_src, BMFace *f, bool copy_verts, bool copy_edges); typedef enum eBMCreateFlag { BM_CREATE_NOP = 0, @@ -41,7 +40,7 @@ typedef enum eBMCreateFlag { BMVert *BM_vert_create(BMesh *bm, const float co[3], const BMVert *v_example, - const eBMCreateFlag create_flag); + eBMCreateFlag create_flag); /** * \brief Main function for creating a new edge. * @@ -50,7 +49,7 @@ BMVert *BM_vert_create(BMesh *bm, * you should call with \a no_double = true. */ BMEdge *BM_edge_create( - BMesh *bm, BMVert *v1, BMVert *v2, const BMEdge *e_example, const eBMCreateFlag create_flag); + BMesh *bm, BMVert *v1, BMVert *v2, const BMEdge *e_example, eBMCreateFlag create_flag); /** * Main face creation function * @@ -63,18 +62,18 @@ BMEdge *BM_edge_create( BMFace *BM_face_create(BMesh *bm, BMVert **verts, BMEdge **edges, - const int len, + int len, const BMFace *f_example, - const eBMCreateFlag create_flag); + eBMCreateFlag create_flag); /** * Wrapper for #BM_face_create when you don't have an edge array */ BMFace *BM_face_create_verts(BMesh *bm, BMVert **vert_arr, - const int len, + int len, const BMFace *f_example, - const eBMCreateFlag create_flag, - const bool create_edges); + eBMCreateFlag create_flag, + bool create_edges); /** * Kills all edges associated with \a f, along with any other faces containing those edges. @@ -147,8 +146,8 @@ bool BM_vert_splice_check_double(BMVert *v_a, BMVert *v_b); */ void bmesh_kernel_loop_reverse(BMesh *bm, BMFace *f, - const int cd_loop_mdisp_offset, - const bool use_loop_mdisp_flip); + int cd_loop_mdisp_offset, + bool use_loop_mdisp_flip); /** * Avoid calling this where possible, @@ -171,7 +170,7 @@ void bmesh_face_swap_data(BMFace *f_a, BMFace *f_b); * \note this is a generic, flexible join faces function, * almost everything uses this, including #BM_faces_join_pair */ -BMFace *BM_faces_join(BMesh *bm, BMFace **faces, int totface, const bool do_del); +BMFace *BM_faces_join(BMesh *bm, BMFace **faces, int totface, bool do_del); /** * High level function which wraps both #bmesh_kernel_vert_separate and #bmesh_kernel_edge_separate */ @@ -179,18 +178,14 @@ void BM_vert_separate(BMesh *bm, BMVert *v, BMEdge **e_in, int e_in_len, - const bool copy_select, + bool copy_select, BMVert ***r_vout, int *r_vout_len); /** * A version of #BM_vert_separate which takes a flag. */ -void BM_vert_separate_hflag(BMesh *bm, - BMVert *v, - const char hflag, - const bool copy_select, - BMVert ***r_vout, - int *r_vout_len); +void BM_vert_separate_hflag( + BMesh *bm, BMVert *v, char hflag, bool copy_select, BMVert ***r_vout, int *r_vout_len); void BM_vert_separate_tested_edges( BMesh *bm, BMVert *v_dst, BMVert *v_src, bool (*testfn)(BMEdge *, void *arg), void *arg); @@ -211,7 +206,7 @@ void BM_vert_separate_tested_edges( * \return Success */ void bmesh_kernel_vert_separate( - BMesh *bm, BMVert *v, BMVert ***r_vout, int *r_vout_len, const bool copy_select); + BMesh *bm, BMVert *v, BMVert ***r_vout, int *r_vout_len, bool copy_select); /** * \brief Separate Edge * @@ -223,7 +218,7 @@ void bmesh_kernel_vert_separate( * \note Does nothing if \a l_sep is already the only loop in the * edge radial. */ -void bmesh_kernel_edge_separate(BMesh *bm, BMEdge *e, BMLoop *l_sep, const bool copy_select); +void bmesh_kernel_edge_separate(BMesh *bm, BMEdge *e, BMLoop *l_sep, bool copy_select); /** * \brief Split Face Make Edge (SFME) @@ -272,7 +267,7 @@ BMFace *bmesh_kernel_split_face_make_edge(BMesh *bm, ListBase *holes, #endif BMEdge *example, - const bool no_double); + bool no_double); /** * \brief Split Edge Make Vert (SEMV) @@ -326,10 +321,10 @@ BMVert *bmesh_kernel_split_edge_make_vert(BMesh *bm, BMVert *tv, BMEdge *e, BMEd BMEdge *bmesh_kernel_join_edge_kill_vert(BMesh *bm, BMEdge *e_kill, BMVert *v_kill, - const bool do_del, - const bool check_edge_exists, - const bool kill_degenerate_faces, - const bool kill_duplicate_faces); + bool do_del, + bool check_edge_exists, + bool kill_degenerate_faces, + bool kill_duplicate_faces); /** * \brief Join Vert Kill Edge (JVKE) * @@ -351,9 +346,9 @@ BMEdge *bmesh_kernel_join_edge_kill_vert(BMesh *bm, BMVert *bmesh_kernel_join_vert_kill_edge(BMesh *bm, BMEdge *e_kill, BMVert *v_kill, - const bool do_del, - const bool check_edge_exists, - const bool kill_degenerate_faces); + bool do_del, + bool check_edge_exists, + bool kill_degenerate_faces); /** * \brief Join Face Kill Edge (JFKE) * diff --git a/source/blender/bmesh/intern/bmesh_delete.h b/source/blender/bmesh/intern/bmesh_delete.h index 18e278a99fd..068c35f6dc7 100644 --- a/source/blender/bmesh/intern/bmesh_delete.h +++ b/source/blender/bmesh/intern/bmesh_delete.h @@ -20,16 +20,16 @@ * \ingroup bmesh */ -void BMO_mesh_delete_oflag_tagged(BMesh *bm, const short oflag, const char htype); -void BM_mesh_delete_hflag_tagged(BMesh *bm, const char hflag, const char htype); +void BMO_mesh_delete_oflag_tagged(BMesh *bm, short oflag, char htype); +void BM_mesh_delete_hflag_tagged(BMesh *bm, char hflag, char htype); /** * \warning oflag applies to different types in some contexts, * not just the type being removed. */ -void BMO_mesh_delete_oflag_context(BMesh *bm, const short oflag, const int type); +void BMO_mesh_delete_oflag_context(BMesh *bm, short oflag, int type); /** * \warning oflag applies to different types in some contexts, * not just the type being removed. */ -void BM_mesh_delete_hflag_context(BMesh *bm, const char hflag, const int type); +void BM_mesh_delete_hflag_context(BMesh *bm, char hflag, int type); diff --git a/source/blender/bmesh/intern/bmesh_edgeloop.h b/source/blender/bmesh/intern/bmesh_edgeloop.h index 58b0d92fb72..9dc1e64dd46 100644 --- a/source/blender/bmesh/intern/bmesh_edgeloop.h +++ b/source/blender/bmesh/intern/bmesh_edgeloop.h @@ -48,16 +48,14 @@ void BM_mesh_edgeloops_calc_normal(BMesh *bm, struct ListBase *eloops); void BM_mesh_edgeloops_calc_normal_aligned(BMesh *bm, struct ListBase *eloops, const float no_align[3]); -void BM_mesh_edgeloops_calc_order(BMesh *bm, ListBase *eloops, const bool use_normals); +void BM_mesh_edgeloops_calc_order(BMesh *bm, ListBase *eloops, bool use_normals); /** * Copy a single edge-loop. * \return new edge-loops. */ struct BMEdgeLoopStore *BM_edgeloop_copy(struct BMEdgeLoopStore *el_store); -struct BMEdgeLoopStore *BM_edgeloop_from_verts(BMVert **v_arr, - const int v_arr_tot, - bool is_closed); +struct BMEdgeLoopStore *BM_edgeloop_from_verts(BMVert **v_arr, int v_arr_tot, bool is_closed); void BM_edgeloop_free(struct BMEdgeLoopStore *el_store); bool BM_edgeloop_is_closed(struct BMEdgeLoopStore *el_store); diff --git a/source/blender/bmesh/intern/bmesh_interp.h b/source/blender/bmesh/intern/bmesh_interp.h index d1a73509a4a..bf5b5bd09f4 100644 --- a/source/blender/bmesh/intern/bmesh_interp.h +++ b/source/blender/bmesh/intern/bmesh_interp.h @@ -28,7 +28,7 @@ void BM_loop_interp_multires_ex(BMesh *bm, const BMFace *f_src, const float f_dst_center[3], const float f_src_center[3], - const int cd_loop_mdisp_offset); + int cd_loop_mdisp_offset); /** * Project the multi-resolution grid in target onto f_src's set of multi-resolution grids. */ @@ -39,7 +39,7 @@ void BM_face_interp_multires_ex(BMesh *bm, const BMFace *f_src, const float f_dst_center[3], const float f_src_center[3], - const int cd_loop_mdisp_offset); + int cd_loop_mdisp_offset); void BM_face_interp_multires(BMesh *bm, BMFace *f_dst, const BMFace *f_src); void BM_vert_interp_from_face(BMesh *bm, BMVert *v_dst, const BMFace *f_src); @@ -52,7 +52,7 @@ void BM_vert_interp_from_face(BMesh *bm, BMVert *v_dst, const BMFace *f_src); * \note This is an exact match to #BM_data_interp_from_edges. */ void BM_data_interp_from_verts( - BMesh *bm, const BMVert *v_src_1, const BMVert *v_src_2, BMVert *v_dst, const float fac); + BMesh *bm, const BMVert *v_src_1, const BMVert *v_src_2, BMVert *v_dst, float fac); /** * \brief Data, Interpolate From Edges * @@ -61,19 +61,15 @@ void BM_data_interp_from_verts( * \note This is an exact match to #BM_data_interp_from_verts. */ void BM_data_interp_from_edges( - BMesh *bm, const BMEdge *e_src_1, const BMEdge *e_src_2, BMEdge *e_dst, const float fac); + BMesh *bm, const BMEdge *e_src_1, const BMEdge *e_src_2, BMEdge *e_dst, float fac); /** * \brief Data Face-Vert Edge Interpolate * * Walks around the faces of \a e and interpolates * the loop data between two sources. */ -void BM_data_interp_face_vert_edge(BMesh *bm, - const BMVert *v_src_1, - const BMVert *v_src_2, - BMVert *v, - BMEdge *e, - const float fac); +void BM_data_interp_face_vert_edge( + BMesh *bm, const BMVert *v_src_1, const BMVert *v_src_2, BMVert *v, BMEdge *e, float fac); void BM_data_layer_add(BMesh *bm, CustomData *data, int type); void BM_data_layer_add_named(BMesh *bm, CustomData *data, int type, const char *name); void BM_data_layer_free(BMesh *bm, CustomData *data, int type); @@ -81,7 +77,7 @@ void BM_data_layer_free_n(BMesh *bm, CustomData *data, int type, int n); void BM_data_layer_copy(BMesh *bm, CustomData *data, int type, int src_n, int dst_n); float BM_elem_float_data_get(CustomData *cd, void *element, int type); -void BM_elem_float_data_set(CustomData *cd, void *element, int type, const float val); +void BM_elem_float_data_set(CustomData *cd, void *element, int type, float val); /** * \brief Data Interpolate From Face @@ -93,19 +89,19 @@ void BM_elem_float_data_set(CustomData *cd, void *element, int type, const float void BM_face_interp_from_face_ex(BMesh *bm, BMFace *f_dst, const BMFace *f_src, - const bool do_vertex, + bool do_vertex, const void **blocks, const void **blocks_v, float (*cos_2d)[2], float axis_mat[3][3]); -void BM_face_interp_from_face(BMesh *bm, BMFace *f_dst, const BMFace *f_src, const bool do_vertex); +void BM_face_interp_from_face(BMesh *bm, BMFace *f_dst, const BMFace *f_src, bool do_vertex); /** * Projects a single loop, target, onto f_src for custom-data interpolation. * multi-resolution is handled. * \param do_vertex: When true the target's vert data will also get interpolated. */ void BM_loop_interp_from_face( - BMesh *bm, BMLoop *l_dst, const BMFace *f_src, const bool do_vertex, const bool do_multires); + BMesh *bm, BMLoop *l_dst, const BMFace *f_src, bool do_vertex, bool do_multires); /** * Smooths boundaries between multi-res grids, @@ -114,16 +110,16 @@ void BM_loop_interp_from_face( void BM_face_multires_bounds_smooth(BMesh *bm, BMFace *f); struct LinkNode *BM_vert_loop_groups_data_layer_create( - BMesh *bm, BMVert *v, const int layer_n, const float *loop_weights, struct MemArena *arena); + BMesh *bm, BMVert *v, int layer_n, const float *loop_weights, struct MemArena *arena); /** * Take existing custom data and merge each fan's data. */ -void BM_vert_loop_groups_data_layer_merge(BMesh *bm, struct LinkNode *groups, const int layer_n); +void BM_vert_loop_groups_data_layer_merge(BMesh *bm, struct LinkNode *groups, int layer_n); /** * A version of #BM_vert_loop_groups_data_layer_merge * that takes an array of loop-weights (aligned with #BM_LOOPS_OF_VERT iterator). */ void BM_vert_loop_groups_data_layer_merge_weights(BMesh *bm, struct LinkNode *groups, - const int layer_n, + int layer_n, const float *loop_weights); diff --git a/source/blender/bmesh/intern/bmesh_iterators.h b/source/blender/bmesh/intern/bmesh_iterators.h index 12b3581b0a1..1c9b322ef75 100644 --- a/source/blender/bmesh/intern/bmesh_iterators.h +++ b/source/blender/bmesh/intern/bmesh_iterators.h @@ -188,14 +188,14 @@ typedef struct BMIter { /** * \note Use #BM_vert_at_index / #BM_edge_at_index / #BM_face_at_index for mesh arrays. */ -void *BM_iter_at_index(BMesh *bm, const char itype, void *data, int index) ATTR_WARN_UNUSED_RESULT; +void *BM_iter_at_index(BMesh *bm, char itype, void *data, int index) ATTR_WARN_UNUSED_RESULT; /** * \brief Iterator as Array * * Sometimes its convenient to get the iterator as an array * to avoid multiple calls to #BM_iter_at_index. */ -int BM_iter_as_array(BMesh *bm, const char itype, void *data, void **array, const int len); +int BM_iter_as_array(BMesh *bm, char itype, void *data, void **array, int len); /** * \brief Iterator as Array * @@ -207,7 +207,7 @@ int BM_iter_as_array(BMesh *bm, const char itype, void *data, void **array, cons * Caller needs to free the array. */ void *BM_iter_as_arrayN(BMesh *bm, - const char itype, + char itype, void *data, int *r_len, void **stack_array, @@ -219,18 +219,18 @@ void *BM_iter_as_arrayN(BMesh *bm, */ int BMO_iter_as_array(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name, - const char restrictmask, + char restrictmask, void **array, - const int len); + int len); void *BMO_iter_as_arrayN(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name, - const char restrictmask, + char restrictmask, int *r_len, /* optional args to avoid an alloc (normally stack array) */ void **stack_array, int stack_array_size); -int BM_iter_mesh_bitmap_from_filter(const char itype, +int BM_iter_mesh_bitmap_from_filter(char itype, BMesh *bm, uint *bitmap, bool (*test_fn)(BMElem *, void *user_data), @@ -248,24 +248,23 @@ int BM_iter_mesh_bitmap_from_filter_tessface(BMesh *bm, * * Counts how many flagged / unflagged items are found in this element. */ -int BM_iter_elem_count_flag(const char itype, void *data, const char hflag, const bool value); +int BM_iter_elem_count_flag(char itype, void *data, char hflag, bool value); /** * \brief Elem Iter Tool Flag Count * * Counts how many flagged / unflagged items are found in this element. */ -int BMO_iter_elem_count_flag( - BMesh *bm, const char itype, void *data, const short oflag, const bool value); +int BMO_iter_elem_count_flag(BMesh *bm, char itype, void *data, short oflag, bool value); /** * Utility function. */ -int BM_iter_mesh_count(const char itype, BMesh *bm); +int BM_iter_mesh_count(char itype, BMesh *bm); /** * \brief Mesh Iter Flag Count * * Counts how many flagged / unflagged items are found in this mesh. */ -int BM_iter_mesh_count_flag(const char itype, BMesh *bm, const char hflag, const bool value); +int BM_iter_mesh_count_flag(char itype, BMesh *bm, char hflag, bool value); /* private for bmesh_iterators_inline.c */ diff --git a/source/blender/bmesh/intern/bmesh_log.h b/source/blender/bmesh/intern/bmesh_log.h index c6df87168ee..1cc860beed1 100644 --- a/source/blender/bmesh/intern/bmesh_log.h +++ b/source/blender/bmesh/intern/bmesh_log.h @@ -119,7 +119,7 @@ void BM_log_redo(BMesh *bm, BMLog *log); * state so that a subsequent redo operation will restore the newer * vertex state. */ -void BM_log_vert_before_modified(BMLog *log, struct BMVert *v, const int cd_vert_mask_offset); +void BM_log_vert_before_modified(BMLog *log, struct BMVert *v, int cd_vert_mask_offset); /* Log a new vertex as added to the BMesh */ /* Log a new vertex as added to the BMesh @@ -128,7 +128,7 @@ void BM_log_vert_before_modified(BMLog *log, struct BMVert *v, const int cd_vert * of added vertices, with the key being its ID and the value * containing everything needed to reconstruct that vertex. */ -void BM_log_vert_added(BMLog *log, struct BMVert *v, const int cd_vert_mask_offset); +void BM_log_vert_added(BMLog *log, struct BMVert *v, int cd_vert_mask_offset); /* Log a face before it is modified */ /* Log a face before it is modified @@ -164,7 +164,7 @@ void BM_log_face_added(BMLog *log, struct BMFace *f); * If there's a move record for the vertex, that's used as the * vertices original location, then the move record is deleted. */ -void BM_log_vert_removed(BMLog *log, struct BMVert *v, const int cd_vert_mask_offset); +void BM_log_vert_removed(BMLog *log, struct BMVert *v, int cd_vert_mask_offset); /* Log a face as removed from the BMesh */ /* Log a face as removed from the BMesh diff --git a/source/blender/bmesh/intern/bmesh_marking.h b/source/blender/bmesh/intern/bmesh_marking.h index 72b520cc72c..01c3291b525 100644 --- a/source/blender/bmesh/intern/bmesh_marking.h +++ b/source/blender/bmesh/intern/bmesh_marking.h @@ -39,10 +39,10 @@ typedef enum eBMSelectionFlushFLags { /* Geometry hiding code. */ #define BM_elem_hide_set(bm, ele, hide) _bm_elem_hide_set(bm, &(ele)->head, hide) -void _bm_elem_hide_set(BMesh *bm, BMHeader *head, const bool hide); -void BM_vert_hide_set(BMVert *v, const bool hide); -void BM_edge_hide_set(BMEdge *e, const bool hide); -void BM_face_hide_set(BMFace *f, const bool hide); +void _bm_elem_hide_set(BMesh *bm, BMHeader *head, bool hide); +void BM_vert_hide_set(BMVert *v, bool hide); +void BM_edge_hide_set(BMEdge *e, bool hide); +void BM_face_hide_set(BMFace *f, bool hide); /* Selection code. */ @@ -50,29 +50,15 @@ void BM_face_hide_set(BMFace *f, const bool hide); * \note use BM_elem_flag_test(ele, BM_ELEM_SELECT) to test selection * \note by design, this will not touch the editselection history stuff */ -void BM_elem_select_set(BMesh *bm, BMElem *ele, const bool select); - -void BM_mesh_elem_hflag_enable_test(BMesh *bm, - const char htype, - const char hflag, - const bool respecthide, - const bool overwrite, - const char hflag_test); -void BM_mesh_elem_hflag_disable_test(BMesh *bm, - const char htype, - const char hflag, - const bool respecthide, - const bool overwrite, - const char hflag_test); - -void BM_mesh_elem_hflag_enable_all(BMesh *bm, - const char htype, - const char hflag, - const bool respecthide); -void BM_mesh_elem_hflag_disable_all(BMesh *bm, - const char htype, - const char hflag, - const bool respecthide); +void BM_elem_select_set(BMesh *bm, BMElem *ele, bool select); + +void BM_mesh_elem_hflag_enable_test( + BMesh *bm, char htype, char hflag, bool respecthide, bool overwrite, char hflag_test); +void BM_mesh_elem_hflag_disable_test( + BMesh *bm, char htype, char hflag, bool respecthide, bool overwrite, char hflag_test); + +void BM_mesh_elem_hflag_enable_all(BMesh *bm, char htype, char hflag, bool respecthide); +void BM_mesh_elem_hflag_disable_all(BMesh *bm, char htype, char hflag, bool respecthide); /* Individual element select functions, #BM_elem_select_set is a shortcut for these * that automatically detects which one to use. */ @@ -83,25 +69,25 @@ void BM_mesh_elem_hflag_disable_all(BMesh *bm, * Changes selection state of a single vertex * in a mesh */ -void BM_vert_select_set(BMesh *bm, BMVert *v, const bool select); +void BM_vert_select_set(BMesh *bm, BMVert *v, bool select); /** * \brief Select Edge * * Changes selection state of a single edge in a mesh. */ -void BM_edge_select_set(BMesh *bm, BMEdge *e, const bool select); +void BM_edge_select_set(BMesh *bm, BMEdge *e, bool select); /** * \brief Select Face * * Changes selection state of a single * face in a mesh. */ -void BM_face_select_set(BMesh *bm, BMFace *f, const bool select); +void BM_face_select_set(BMesh *bm, BMFace *f, bool select); /* Lower level functions which don't do flushing. */ -void BM_edge_select_set_noflush(BMesh *bm, BMEdge *e, const bool select); -void BM_face_select_set_noflush(BMesh *bm, BMFace *f, const bool select); +void BM_edge_select_set_noflush(BMesh *bm, BMEdge *e, bool select); +void BM_face_select_set_noflush(BMesh *bm, BMFace *f, bool select); /** * \brief Select Mode Clean @@ -111,7 +97,7 @@ void BM_face_select_set_noflush(BMesh *bm, BMFace *f, const bool select); * * \note this could be made a part of #BM_mesh_select_mode_flush_ex */ -void BM_mesh_select_mode_clean_ex(BMesh *bm, const short selectmode); +void BM_mesh_select_mode_clean_ex(BMesh *bm, short selectmode); void BM_mesh_select_mode_clean(BMesh *bm); /** @@ -128,7 +114,7 @@ void BM_mesh_select_mode_set(BMesh *bm, int selectmode); * (ie: all verts of an edge selects the edge and so on). * This should only be called by system and not tool authors. */ -void BM_mesh_select_mode_flush_ex(BMesh *bm, const short selectmode, eBMSelectionFlushFLags flags); +void BM_mesh_select_mode_flush_ex(BMesh *bm, short selectmode, eBMSelectionFlushFLags flags); void BM_mesh_select_mode_flush(BMesh *bm); /** @@ -140,19 +126,13 @@ void BM_mesh_deselect_flush(BMesh *bm); */ void BM_mesh_select_flush(BMesh *bm); -int BM_mesh_elem_hflag_count_enabled(BMesh *bm, - const char htype, - const char hflag, - const bool respecthide); -int BM_mesh_elem_hflag_count_disabled(BMesh *bm, - const char htype, - const char hflag, - const bool respecthide); +int BM_mesh_elem_hflag_count_enabled(BMesh *bm, char htype, char hflag, bool respecthide); +int BM_mesh_elem_hflag_count_disabled(BMesh *bm, char htype, char hflag, bool respecthide); /* Edit selection stuff. */ void BM_mesh_active_face_set(BMesh *bm, BMFace *f); -BMFace *BM_mesh_active_face_get(BMesh *bm, const bool is_sloppy, const bool is_selected); +BMFace *BM_mesh_active_face_get(BMesh *bm, bool is_sloppy, bool is_selected); BMEdge *BM_mesh_active_edge_get(BMesh *bm); BMVert *BM_mesh_active_vert_get(BMesh *bm); BMElem *BM_mesh_active_elem_get(BMesh *bm); @@ -211,7 +191,7 @@ struct GHash *BM_select_history_map_create(BMesh *bm); * Map arguments may all be the same pointer. */ void BM_select_history_merge_from_targetmap( - BMesh *bm, GHash *vert_map, GHash *edge_map, GHash *face_map, const bool use_chain); + BMesh *bm, GHash *vert_map, GHash *edge_map, GHash *face_map, bool use_chain); #define BM_SELECT_HISTORY_BACKUP(bm) \ { \ diff --git a/source/blender/bmesh/intern/bmesh_mesh.h b/source/blender/bmesh/intern/bmesh_mesh.h index e00461ba571..94615d558fa 100644 --- a/source/blender/bmesh/intern/bmesh_mesh.h +++ b/source/blender/bmesh/intern/bmesh_mesh.h @@ -74,14 +74,14 @@ void BM_mesh_clear(BMesh *bm); * the editing operations are done. These are called by the tools/operator * API for each time a tool is executed. */ -void bmesh_edit_begin(BMesh *bm, const BMOpTypeFlag type_flag); +void bmesh_edit_begin(BMesh *bm, BMOpTypeFlag type_flag); /** * \brief BMesh End Edit */ -void bmesh_edit_end(BMesh *bm, const BMOpTypeFlag type_flag); +void bmesh_edit_end(BMesh *bm, BMOpTypeFlag type_flag); -void BM_mesh_elem_index_ensure_ex(BMesh *bm, const char htype, int elem_offset[4]); -void BM_mesh_elem_index_ensure(BMesh *bm, const char htype); +void BM_mesh_elem_index_ensure_ex(BMesh *bm, char htype, int elem_offset[4]); +void BM_mesh_elem_index_ensure(BMesh *bm, char htype); /** * Array checking/setting macros. * @@ -109,10 +109,10 @@ bool BM_mesh_elem_table_check(BMesh *bm); */ void BM_mesh_toolflags_set(BMesh *bm, bool use_toolflags); -void BM_mesh_elem_table_ensure(BMesh *bm, const char htype); +void BM_mesh_elem_table_ensure(BMesh *bm, char htype); /* use BM_mesh_elem_table_ensure where possible to avoid full rebuild */ -void BM_mesh_elem_table_init(BMesh *bm, const char htype); -void BM_mesh_elem_table_free(BMesh *bm, const char htype); +void BM_mesh_elem_table_init(BMesh *bm, char htype); +void BM_mesh_elem_table_free(BMesh *bm, char htype); BLI_INLINE BMVert *BM_vert_at_index(BMesh *bm, const int index) { @@ -133,26 +133,26 @@ BLI_INLINE BMFace *BM_face_at_index(BMesh *bm, const int index) return bm->ftable[index]; } -BMVert *BM_vert_at_index_find(BMesh *bm, const int index); -BMEdge *BM_edge_at_index_find(BMesh *bm, const int index); -BMFace *BM_face_at_index_find(BMesh *bm, const int index); -BMLoop *BM_loop_at_index_find(BMesh *bm, const int index); +BMVert *BM_vert_at_index_find(BMesh *bm, int index); +BMEdge *BM_edge_at_index_find(BMesh *bm, int index); +BMFace *BM_face_at_index_find(BMesh *bm, int index); +BMLoop *BM_loop_at_index_find(BMesh *bm, int index); /** * Use lookup table when available, else use slower find functions. * * \note Try to use #BM_mesh_elem_table_ensure instead. */ -BMVert *BM_vert_at_index_find_or_table(BMesh *bm, const int index); -BMEdge *BM_edge_at_index_find_or_table(BMesh *bm, const int index); -BMFace *BM_face_at_index_find_or_table(BMesh *bm, const int index); +BMVert *BM_vert_at_index_find_or_table(BMesh *bm, int index); +BMEdge *BM_edge_at_index_find_or_table(BMesh *bm, int index); +BMFace *BM_face_at_index_find_or_table(BMesh *bm, int index); // XXX /** * Return the amount of element of type 'type' in a given bmesh. */ -int BM_mesh_elem_count(BMesh *bm, const char htype); +int BM_mesh_elem_count(BMesh *bm, char htype); /** * Remaps the vertices, edges and/or faces of the bmesh as indicated by vert/edge/face_idx arrays diff --git a/source/blender/bmesh/intern/bmesh_mesh_convert.h b/source/blender/bmesh/intern/bmesh_mesh_convert.h index ea114487285..07ffc8b43df 100644 --- a/source/blender/bmesh/intern/bmesh_mesh_convert.h +++ b/source/blender/bmesh/intern/bmesh_mesh_convert.h @@ -29,8 +29,8 @@ struct CustomData_MeshMasks; struct Main; struct Mesh; -void BM_mesh_cd_flag_ensure(BMesh *bm, struct Mesh *mesh, const char cd_flag); -void BM_mesh_cd_flag_apply(BMesh *bm, const char cd_flag); +void BM_mesh_cd_flag_ensure(BMesh *bm, struct Mesh *mesh, char cd_flag); +void BM_mesh_cd_flag_apply(BMesh *bm, char cd_flag); char BM_mesh_cd_flag_from_bmesh(BMesh *bm); struct BMeshFromMeshParams { diff --git a/source/blender/bmesh/intern/bmesh_mesh_normals.h b/source/blender/bmesh/intern/bmesh_mesh_normals.h index a2e64b1dc9b..d9b9a88b10d 100644 --- a/source/blender/bmesh/intern/bmesh_mesh_normals.h +++ b/source/blender/bmesh/intern/bmesh_mesh_normals.h @@ -67,13 +67,13 @@ void BM_loops_calc_normal_vcos(BMesh *bm, const float (*vcos)[3], const float (*vnos)[3], const float (*fnos)[3], - const bool use_split_normals, - const float split_angle, + bool use_split_normals, + float split_angle, float (*r_lnos)[3], struct MLoopNorSpaceArray *r_lnors_spacearr, short (*clnors_data)[2], - const int cd_loop_clnors_offset, - const bool do_rebuild); + int cd_loop_clnors_offset, + bool do_rebuild); /** * Check whether given loop is part of an unknown-so-far cyclic smooth fan, or not. @@ -82,21 +82,21 @@ void BM_loops_calc_normal_vcos(BMesh *bm, */ bool BM_loop_check_cyclic_smooth_fan(BMLoop *l_curr); void BM_lnorspacearr_store(BMesh *bm, float (*r_lnors)[3]); -void BM_lnorspace_invalidate(BMesh *bm, const bool do_invalidate_all); +void BM_lnorspace_invalidate(BMesh *bm, bool do_invalidate_all); void BM_lnorspace_rebuild(BMesh *bm, bool preserve_clnor); /** * \warning This function sets #BM_ELEM_TAG on loops & edges via #bm_mesh_loops_calc_normals, * take care to run this before setting up tags. */ void BM_lnorspace_update(BMesh *bm); -void BM_normals_loops_edges_tag(BMesh *bm, const bool do_edges); +void BM_normals_loops_edges_tag(BMesh *bm, bool do_edges); #ifndef NDEBUG void BM_lnorspace_err(BMesh *bm); #endif /* Loop Generics */ struct BMLoopNorEditDataArray *BM_loop_normal_editdata_array_init(BMesh *bm, - const bool do_all_loops_of_vert); + bool do_all_loops_of_vert); void BM_loop_normal_editdata_array_free(struct BMLoopNorEditDataArray *lnors_ed_arr); /** @@ -112,4 +112,4 @@ void BM_custom_loop_normals_from_vector_layer(struct BMesh *bm, bool add_sharp_e * Used when defining an empty custom loop normals data layer, * to keep same shading as with auto-smooth! */ -void BM_edges_sharp_from_angle_set(BMesh *bm, const float split_angle); +void BM_edges_sharp_from_angle_set(BMesh *bm, float split_angle); diff --git a/source/blender/bmesh/intern/bmesh_mesh_partial_update.h b/source/blender/bmesh/intern/bmesh_mesh_partial_update.h index 57f57053606..a280acb4624 100644 --- a/source/blender/bmesh/intern/bmesh_mesh_partial_update.h +++ b/source/blender/bmesh/intern/bmesh_mesh_partial_update.h @@ -59,7 +59,7 @@ typedef struct BMPartialUpdate { BMPartialUpdate *BM_mesh_partial_create_from_verts(BMesh *bm, const BMPartialUpdate_Params *params, const unsigned int *verts_mask, - const int verts_mask_count) + int verts_mask_count) ATTR_NONNULL(1, 2, 3) ATTR_WARN_UNUSED_RESULT; /** @@ -71,7 +71,7 @@ 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; + int verts_mask_count) ATTR_NONNULL(1, 2, 3) ATTR_WARN_UNUSED_RESULT; /** * All Connected, operate on all faces that have vertices in the same group. @@ -93,9 +93,7 @@ BMPartialUpdate *BM_mesh_partial_create_from_verts_group_single( * \param verts_group_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) ATTR_NONNULL(1, 2, 3) ATTR_WARN_UNUSED_RESULT; + BMesh *bm, const BMPartialUpdate_Params *params, const int *verts_group, 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_mods.h b/source/blender/bmesh/intern/bmesh_mods.h index f4a5a0bce33..4e8a8a14a6a 100644 --- a/source/blender/bmesh/intern/bmesh_mods.h +++ b/source/blender/bmesh/intern/bmesh_mods.h @@ -65,7 +65,7 @@ bool BM_disk_dissolve(BMesh *bm, BMVert *v); * * \return The combined face or NULL on failure. */ -BMFace *BM_faces_join_pair(BMesh *bm, BMLoop *l_a, BMLoop *l_b, const bool do_del); +BMFace *BM_faces_join_pair(BMesh *bm, BMLoop *l_a, BMLoop *l_b, bool do_del); /** see: bmesh_polygon_edgenet.h for #BM_face_split_edgenet */ @@ -87,13 +87,8 @@ BMFace *BM_faces_join_pair(BMesh *bm, BMLoop *l_a, BMLoop *l_b, const bool do_de * if the split is successful (and the original face will be the other side). * NULL if the split fails. */ -BMFace *BM_face_split(BMesh *bm, - BMFace *f, - BMLoop *l_a, - BMLoop *l_b, - BMLoop **r_l, - BMEdge *example, - const bool no_double); +BMFace *BM_face_split( + BMesh *bm, BMFace *f, BMLoop *l_a, BMLoop *l_b, BMLoop **r_l, BMEdge *example, bool no_double); /** * \brief Face Split with intermediate points @@ -149,10 +144,10 @@ BMEdge *BM_vert_collapse_faces(BMesh *bm, BMEdge *e_kill, BMVert *v_kill, float fac, - const bool do_del, - const bool join_faces, - const bool kill_degenerate_faces, - const bool kill_duplicate_faces); + bool do_del, + bool join_faces, + bool kill_degenerate_faces, + bool kill_duplicate_faces); /** * \brief Vert Collapse Faces * @@ -163,18 +158,15 @@ BMEdge *BM_vert_collapse_faces(BMesh *bm, BMEdge *BM_vert_collapse_edge(BMesh *bm, BMEdge *e_kill, BMVert *v_kill, - const bool do_del, - const bool kill_degenerate_faces, - const bool kill_duplicate_faces); + bool do_del, + bool kill_degenerate_faces, + bool kill_duplicate_faces); /** * Collapse and edge into a single vertex. */ -BMVert *BM_edge_collapse(BMesh *bm, - BMEdge *e_kill, - BMVert *v_kill, - const bool do_del, - const bool kill_degenerate_faces); +BMVert *BM_edge_collapse( + BMesh *bm, BMEdge *e_kill, BMVert *v_kill, bool do_del, bool kill_degenerate_faces); /** * \brief Edge Split @@ -227,7 +219,7 @@ bool BM_face_validate(BMFace *face, FILE *err); * * \note #BM_edge_rotate_check must have already run. */ -void BM_edge_calc_rotate(BMEdge *e, const bool ccw, BMLoop **r_l1, BMLoop **r_l2); +void BM_edge_calc_rotate(BMEdge *e, bool ccw, BMLoop **r_l1, BMLoop **r_l2); /** * \brief Check if Rotate Edge is OK * @@ -262,7 +254,7 @@ bool BM_edge_rotate_check_beauty(BMEdge *e, BMLoop *l1, BMLoop *l2); * * \see header definition for \a check_flag enum. */ -BMEdge *BM_edge_rotate(BMesh *bm, BMEdge *e, const bool ccw, const short check_flag); +BMEdge *BM_edge_rotate(BMesh *bm, BMEdge *e, bool ccw, short check_flag); /** Flags for #BM_edge_rotate */ enum { diff --git a/source/blender/bmesh/intern/bmesh_operator_api.h b/source/blender/bmesh/intern/bmesh_operator_api.h index de974587311..ef3c2cf8f17 100644 --- a/source/blender/bmesh/intern/bmesh_operator_api.h +++ b/source/blender/bmesh/intern/bmesh_operator_api.h @@ -185,12 +185,12 @@ BLI_INLINE BMFlagLayer *BMO_elem_flag_from_header(BMHeader *ele_head) _bmo_elem_flag_set(bm, _BMO_CAST_F(e)->oflags, oflag, val) #define BMO_face_flag_toggle(bm, e, oflag) _bmo_elem_flag_toggle(bm, _BMO_CAST_F(e)->oflags, oflag) -BLI_INLINE short _bmo_elem_flag_test(BMesh *bm, const BMFlagLayer *oflags, const short oflag); -BLI_INLINE bool _bmo_elem_flag_test_bool(BMesh *bm, const BMFlagLayer *oflags, const short oflag); -BLI_INLINE void _bmo_elem_flag_enable(BMesh *bm, BMFlagLayer *oflags, const short oflag); -BLI_INLINE void _bmo_elem_flag_disable(BMesh *bm, BMFlagLayer *oflags, const short oflag); -BLI_INLINE void _bmo_elem_flag_set(BMesh *bm, BMFlagLayer *oflags, const short oflag, int val); -BLI_INLINE void _bmo_elem_flag_toggle(BMesh *bm, BMFlagLayer *oflags, const short oflag); +BLI_INLINE short _bmo_elem_flag_test(BMesh *bm, const BMFlagLayer *oflags, short oflag); +BLI_INLINE bool _bmo_elem_flag_test_bool(BMesh *bm, const BMFlagLayer *oflags, short oflag); +BLI_INLINE void _bmo_elem_flag_enable(BMesh *bm, BMFlagLayer *oflags, short oflag); +BLI_INLINE void _bmo_elem_flag_disable(BMesh *bm, BMFlagLayer *oflags, short oflag); +BLI_INLINE void _bmo_elem_flag_set(BMesh *bm, BMFlagLayer *oflags, short oflag, int val); +BLI_INLINE void _bmo_elem_flag_toggle(BMesh *bm, BMFlagLayer *oflags, short oflag); /* slot type arrays are terminated by the last member * having a slot type of 0 */ @@ -353,7 +353,7 @@ typedef struct BMOpDefine { * * Initializes an operator structure to a certain type */ -void BMO_op_init(BMesh *bm, BMOperator *op, const int flag, const char *opname); +void BMO_op_init(BMesh *bm, BMOperator *op, int flag, const char *opname); /** * \brief BMESH OPSTACK EXEC OP @@ -379,13 +379,13 @@ void BMO_op_finish(BMesh *bm, BMOperator *op); * Count the number of elements with the specified flag enabled. * type can be a bit-mask of #BM_FACE, #BM_EDGE, or #BM_FACE. */ -int BMO_mesh_enabled_flag_count(BMesh *bm, const char htype, const short oflag); +int BMO_mesh_enabled_flag_count(BMesh *bm, char htype, short oflag); /** * Count the number of elements with the specified flag disabled. * type can be a bit-mask of #BM_FACE, #BM_EDGE, or #BM_FACE. */ -int BMO_mesh_disabled_flag_count(BMesh *bm, const char htype, const short oflag); +int BMO_mesh_disabled_flag_count(BMesh *bm, char htype, short oflag); /** * \brief BMESH OPSTACK PUSH @@ -462,20 +462,20 @@ void BMO_pop(BMesh *bm); * \{ */ /** Executes an operator. */ -bool BMO_op_callf(BMesh *bm, const int flag, const char *fmt, ...); +bool BMO_op_callf(BMesh *bm, int flag, const char *fmt, ...); /** * Initializes, but doesn't execute an operator. this is so you can * gain access to the outputs of the operator. note that you have * to execute/finish (BMO_op_exec and BMO_op_finish) yourself. */ -bool BMO_op_initf(BMesh *bm, BMOperator *op, const int flag, const char *fmt, ...); +bool BMO_op_initf(BMesh *bm, BMOperator *op, int flag, const char *fmt, ...); /** * A `va_list` version, used to implement the above two functions, * plus #EDBM_op_callf in editmesh_utils.c. */ -bool BMO_op_vinitf(BMesh *bm, BMOperator *op, const int flag, const char *fmt, va_list vlist); +bool BMO_op_vinitf(BMesh *bm, BMOperator *op, int flag, const char *fmt, va_list vlist); /** \} */ @@ -549,20 +549,18 @@ typedef enum { BMO_DELIM_UV = 1 << 4, } BMO_Delimit; -void BMO_op_flag_enable(BMesh *bm, BMOperator *op, const int op_flag); -void BMO_op_flag_disable(BMesh *bm, BMOperator *op, const int op_flag); +void BMO_op_flag_enable(BMesh *bm, BMOperator *op, int op_flag); +void BMO_op_flag_disable(BMesh *bm, BMOperator *op, int op_flag); /* -------------------------------------------------------------------- */ /** \name BMesh Operator Slot Get/Set * \{ */ -void BMO_slot_float_set(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], - const char *slot_name, - const float f); +void BMO_slot_float_set(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name, float f); float BMO_slot_float_get(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name); -void BMO_slot_int_set(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name, const int i); +void BMO_slot_int_set(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name, int i); int BMO_slot_int_get(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name); -void BMO_slot_bool_set(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name, const bool i); +void BMO_slot_bool_set(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name, bool i); bool BMO_slot_bool_get(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name); /** * Return a copy of the element buffer. @@ -602,13 +600,13 @@ void BMO_slot_mat3_get(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], /** \} */ -void BMO_mesh_flag_disable_all(BMesh *bm, BMOperator *op, const char htype, const short oflag); +void BMO_mesh_flag_disable_all(BMesh *bm, BMOperator *op, char htype, short oflag); void BMO_mesh_selected_remap(BMesh *bm, BMOpSlot *slot_vert_map, BMOpSlot *slot_edge_map, BMOpSlot *slot_face_map, - const bool check_select); + bool check_select); /** * Copies the values from another slot to the end of the output slot. @@ -633,8 +631,8 @@ void BMO_slot_buffer_from_enabled_flag(BMesh *bm, BMOperator *op, BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name, - const char htype, - const short oflag); + char htype, + short oflag); /** * Puts every element of type 'type' (which is a bit-mask) without tool flag 'flag', into a slot. @@ -643,8 +641,8 @@ void BMO_slot_buffer_from_disabled_flag(BMesh *bm, BMOperator *op, BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name, - const char htype, - const short oflag); + char htype, + short oflag); /** * \brief BMO_FLAG_BUFFER @@ -654,8 +652,8 @@ void BMO_slot_buffer_from_disabled_flag(BMesh *bm, void BMO_slot_buffer_flag_enable(BMesh *bm, BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name, - const char htype, - const short oflag); + char htype, + short oflag); /** * \brief BMO_FLAG_BUFFER * @@ -664,8 +662,8 @@ void BMO_slot_buffer_flag_enable(BMesh *bm, void BMO_slot_buffer_flag_disable(BMesh *bm, BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name, - const char htype, - const short oflag); + char htype, + short oflag); /** * \brief BMO_FLAG_BUFFER @@ -676,9 +674,9 @@ void BMO_slot_buffer_flag_disable(BMesh *bm, void BMO_slot_buffer_hflag_enable(BMesh *bm, BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name, - const char htype, - const char hflag, - const bool do_flush); + char htype, + char hflag, + bool do_flush); /** * \brief BMO_FLAG_BUFFER * @@ -688,9 +686,9 @@ void BMO_slot_buffer_hflag_enable(BMesh *bm, void BMO_slot_buffer_hflag_disable(BMesh *bm, BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name, - const char htype, - const char hflag, - const bool do_flush); + char htype, + char hflag, + bool do_flush); /** * Puts every element of type 'type' (which is a bit-mask) with header flag 'flag', into a slot. @@ -700,8 +698,8 @@ void BMO_slot_buffer_from_enabled_hflag(BMesh *bm, BMOperator *op, BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name, - const char htype, - const char hflag); + char htype, + char hflag); /** * Puts every element of type 'type' (which is a bit-mask) without header flag 'flag', into a slot. * \note ignores hidden elements (e.g. elements with header flag BM_ELEM_HIDDEN set). @@ -710,8 +708,8 @@ void BMO_slot_buffer_from_disabled_hflag(BMesh *bm, BMOperator *op, BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name, - const char htype, - const char hflag); + char htype, + char hflag); void BMO_slot_buffer_from_array(BMOperator *op, BMOpSlot *slot, @@ -739,13 +737,13 @@ void BMO_slot_map_insert(BMOperator *op, BMOpSlot *slot, const void *element, co void BMO_slot_map_to_flag(BMesh *bm, BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name, - const char htype, - const short oflag); + char htype, + short oflag); void *BMO_slot_buffer_alloc(BMOperator *op, BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name, - const int len); + int len); /** * \brief BMO_ALL_TO_SLOT @@ -756,7 +754,7 @@ void BMO_slot_buffer_from_all(BMesh *bm, BMOperator *op, BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name, - const char htype); + char htype); /** * This part of the API is used to iterate over element buffer or @@ -815,7 +813,7 @@ void *BMO_slot_buffer_get_first(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char void *BMO_iter_new(BMOIter *iter, BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name, - const char restrictmask); + char restrictmask); void *BMO_iter_step(BMOIter *iter); /** diff --git a/source/blender/bmesh/intern/bmesh_operators.h b/source/blender/bmesh/intern/bmesh_operators.h index 83f2c402c35..e5ede75f737 100644 --- a/source/blender/bmesh/intern/bmesh_operators.h +++ b/source/blender/bmesh/intern/bmesh_operators.h @@ -156,19 +156,19 @@ extern const int bmo_opdefines_total; /*------specific operator helper functions-------*/ void BM_mesh_esubdivide(BMesh *bm, - const char edge_hflag, - const float smooth, - const short smooth_falloff, - const bool use_smooth_even, - const float fractal, - const float along_normal, - const int numcuts, - const int seltype, - const int cornertype, - const short use_single_edge, - const short use_grid_fill, - const short use_only_quads, - const int seed); + char edge_hflag, + float smooth, + short smooth_falloff, + bool use_smooth_even, + float fractal, + float along_normal, + int numcuts, + int seltype, + int cornertype, + short use_single_edge, + short use_grid_fill, + short use_only_quads, + int seed); /** * Fills first available UV-map with grid-like UV's for all faces with `oflag` set. @@ -178,18 +178,15 @@ void BM_mesh_esubdivide(BMesh *bm, * \param y_segments: The y-resolution of the grid * \param oflag: The flag to check faces with. */ -void BM_mesh_calc_uvs_grid(BMesh *bm, - const uint x_segments, - const uint y_segments, - const short oflag, - const int cd_loop_uv_offset); +void BM_mesh_calc_uvs_grid( + BMesh *bm, uint x_segments, uint y_segments, short oflag, int cd_loop_uv_offset); /** * Fills first available UV-map with spherical projected UVs for all faces with `oflag` set. * * \param bm: The BMesh to operate on * \param oflag: The flag to check faces with. */ -void BM_mesh_calc_uvs_sphere(BMesh *bm, const short oflag, const int cd_loop_uv_offset); +void BM_mesh_calc_uvs_sphere(BMesh *bm, short oflag, int cd_loop_uv_offset); /** * Fills first available UV-map with 2D projected UVs for all faces with `oflag` set. * @@ -198,11 +195,8 @@ void BM_mesh_calc_uvs_sphere(BMesh *bm, const short oflag, const int cd_loop_uv_ * \param radius: The size of the circle. * \param oflag: The flag to check faces with. */ -void BM_mesh_calc_uvs_circle(BMesh *bm, - float mat[4][4], - const float radius, - const short oflag, - const int cd_loop_uv_offset); +void BM_mesh_calc_uvs_circle( + BMesh *bm, float mat[4][4], float radius, short oflag, int cd_loop_uv_offset); /** * Fills first available UV-map with cylinder/cone-like UVs for all faces with `oflag` set. * @@ -216,12 +210,12 @@ void BM_mesh_calc_uvs_circle(BMesh *bm, */ void BM_mesh_calc_uvs_cone(BMesh *bm, float mat[4][4], - const float radius_top, - const float radius_bottom, - const int segments, - const bool cap_ends, - const short oflag, - const int cd_loop_uv_offset); + float radius_top, + float radius_bottom, + int segments, + bool cap_ends, + short oflag, + int cd_loop_uv_offset); /** * Fills first available UV-map with cube-like UVs for all faces with `oflag` set. * @@ -231,6 +225,6 @@ void BM_mesh_calc_uvs_cone(BMesh *bm, * \param bm: The BMesh to operate on. * \param oflag: The flag to check faces with. */ -void BM_mesh_calc_uvs_cube(BMesh *bm, const short oflag); +void BM_mesh_calc_uvs_cube(BMesh *bm, short oflag); #include "intern/bmesh_operator_api_inline.h" diff --git a/source/blender/bmesh/intern/bmesh_polygon.h b/source/blender/bmesh/intern/bmesh_polygon.h index e4545e610a0..2123410c738 100644 --- a/source/blender/bmesh/intern/bmesh_polygon.h +++ b/source/blender/bmesh/intern/bmesh_polygon.h @@ -35,7 +35,7 @@ struct Heap; * \param r_index: Store triangle triples, indices into \a r_loops, `((f->len - 2) * 3)` */ void BM_face_calc_tessellation(const BMFace *f, - const bool use_fixed_quad, + bool use_fixed_quad, BMLoop **r_loops, uint (*r_index)[3]); /** @@ -164,7 +164,7 @@ void BM_face_normal_update(BMFace *f) ATTR_NONNULL(); */ void BM_edge_normals_update(BMEdge *e) ATTR_NONNULL(); -bool BM_vert_calc_normal_ex(const BMVert *v, const char hflag, float r_no[3]); +bool BM_vert_calc_normal_ex(const BMVert *v, char hflag, float r_no[3]); bool BM_vert_calc_normal(const BMVert *v, float r_no[3]); /** * update a vert normal (but not the faces incident on it) @@ -180,8 +180,8 @@ void BM_vert_normal_update_all(BMVert *v) ATTR_NONNULL(); */ void BM_face_normal_flip_ex(BMesh *bm, BMFace *f, - const int cd_loop_mdisp_offset, - const bool use_loop_mdisp_flip) ATTR_NONNULL(); + int cd_loop_mdisp_offset, + bool use_loop_mdisp_flip) ATTR_NONNULL(); void BM_face_normal_flip(BMesh *bm, BMFace *f) ATTR_NONNULL(); /** * BM POINT IN FACE @@ -226,9 +226,9 @@ void BM_face_triangulate(BMesh *bm, BMEdge **r_edges_new, int *r_edges_new_tot, struct LinkNode **r_faces_double, - const int quad_method, - const int ngon_method, - const bool use_tag, + int quad_method, + int ngon_method, + bool use_tag, struct MemArena *pf_arena, struct Heap *pf_heap) ATTR_NONNULL(1, 2); diff --git a/source/blender/bmesh/intern/bmesh_polygon_edgenet.h b/source/blender/bmesh/intern/bmesh_polygon_edgenet.h index a25f38a84b3..626df9fb46a 100644 --- a/source/blender/bmesh/intern/bmesh_polygon_edgenet.h +++ b/source/blender/bmesh/intern/bmesh_polygon_edgenet.h @@ -31,7 +31,7 @@ bool BM_face_split_edgenet(BMesh *bm, BMFace *f, BMEdge **edge_net, - const int edge_net_len, + int edge_net_len, BMFace ***r_face_arr, int *r_face_arr_len); @@ -46,7 +46,7 @@ bool BM_face_split_edgenet(BMesh *bm, bool BM_face_split_edgenet_connect_islands(BMesh *bm, BMFace *f, BMEdge **edge_net_init, - const uint edge_net_init_len, + uint edge_net_init_len, bool use_partial_connect, struct MemArena *mem_arena, BMEdge ***r_edge_net_new, diff --git a/source/blender/bmesh/intern/bmesh_private.h b/source/blender/bmesh/intern/bmesh_private.h index e7e8b7107e5..977142578ca 100644 --- a/source/blender/bmesh/intern/bmesh_private.h +++ b/source/blender/bmesh/intern/bmesh_private.h @@ -40,7 +40,7 @@ * BMESH_TODO, when this raises an error the output is incredibly confusing. * need to have some nice way to print/debug what the heck's going on. */ -int bmesh_elem_check(void *element, const char htype); +int bmesh_elem_check(void *element, char htype); # define BM_CHECK_ELEMENT(el) \ { \ if (bmesh_elem_check(el, ((BMHeader *)el)->htype)) { \ @@ -56,7 +56,7 @@ int bmesh_elem_check(void *element, const char htype); #endif int bmesh_radial_length(const BMLoop *l); -int bmesh_disk_count_at_most(const BMVert *v, const int count_max); +int bmesh_disk_count_at_most(const BMVert *v, int count_max); int bmesh_disk_count(const BMVert *v); /** @@ -98,7 +98,7 @@ enum { * Rotates a polygon so that its * normal is pointing towards the mesh Z axis */ -void poly_rotate_plane(const float normal[3], float (*verts)[3], const uint nverts); +void poly_rotate_plane(const float normal[3], float (*verts)[3], uint nverts); /* include the rest of our private declarations */ #include "bmesh_structure.h" diff --git a/source/blender/bmesh/intern/bmesh_query.h b/source/blender/bmesh/intern/bmesh_query.h index 48a1d100c72..63ce95a19d3 100644 --- a/source/blender/bmesh/intern/bmesh_query.h +++ b/source/blender/bmesh/intern/bmesh_query.h @@ -226,7 +226,7 @@ bool BM_vert_pair_share_face_check_cb(BMVert *v_a, ATTR_NONNULL(1, 2, 3); BMFace *BM_vert_pair_shared_face_cb(BMVert *v_a, BMVert *v_b, - const bool allow_adjacent, + bool allow_adjacent, bool (*callback)(BMFace *, BMLoop *, BMLoop *, void *userdata), void *user_data, BMLoop **r_l_a, @@ -234,11 +234,8 @@ BMFace *BM_vert_pair_shared_face_cb(BMVert *v_a, /** * Given 2 verts, find the smallest face they share and give back both loops. */ -BMFace *BM_vert_pair_share_face_by_len(BMVert *v_a, - BMVert *v_b, - BMLoop **r_l_a, - BMLoop **r_l_b, - const bool allow_adjacent) ATTR_NONNULL(); +BMFace *BM_vert_pair_share_face_by_len( + BMVert *v_a, BMVert *v_b, BMLoop **r_l_a, BMLoop **r_l_b, bool allow_adjacent) ATTR_NONNULL(); /** * Given 2 verts, * find a face they share that has the lowest angle across these verts and give back both loops. @@ -246,22 +243,16 @@ BMFace *BM_vert_pair_share_face_by_len(BMVert *v_a, * This can be better than #BM_vert_pair_share_face_by_len * because concave splits are ranked lowest. */ -BMFace *BM_vert_pair_share_face_by_angle(BMVert *v_a, - BMVert *v_b, - BMLoop **r_l_a, - BMLoop **r_l_b, - const bool allow_adjacent) ATTR_NONNULL(); +BMFace *BM_vert_pair_share_face_by_angle( + BMVert *v_a, BMVert *v_b, BMLoop **r_l_a, BMLoop **r_l_b, bool allow_adjacent) ATTR_NONNULL(); -BMFace *BM_edge_pair_share_face_by_len(BMEdge *e_a, - BMEdge *e_b, - BMLoop **r_l_a, - BMLoop **r_l_b, - const bool allow_adjacent) ATTR_NONNULL(); +BMFace *BM_edge_pair_share_face_by_len( + BMEdge *e_a, BMEdge *e_b, BMLoop **r_l_a, BMLoop **r_l_b, bool allow_adjacent) ATTR_NONNULL(); int BM_vert_edge_count_nonwire(const BMVert *v) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(); #define BM_vert_edge_count_is_equal(v, n) (BM_vert_edge_count_at_most(v, (n) + 1) == n) #define BM_vert_edge_count_is_over(v, n) (BM_vert_edge_count_at_most(v, (n) + 1) == (n) + 1) -int BM_vert_edge_count_at_most(const BMVert *v, const int count_max) ATTR_WARN_UNUSED_RESULT +int BM_vert_edge_count_at_most(const BMVert *v, int count_max) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(); /** * Returns the number of edges around this vertex. @@ -269,7 +260,7 @@ int BM_vert_edge_count_at_most(const BMVert *v, const int count_max) ATTR_WARN_U int BM_vert_edge_count(const BMVert *v) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(); #define BM_edge_face_count_is_equal(e, n) (BM_edge_face_count_at_most(e, (n) + 1) == n) #define BM_edge_face_count_is_over(e, n) (BM_edge_face_count_at_most(e, (n) + 1) == (n) + 1) -int BM_edge_face_count_at_most(const BMEdge *e, const int count_max) ATTR_WARN_UNUSED_RESULT +int BM_edge_face_count_at_most(const BMEdge *e, int count_max) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(); /** * Returns the number of faces around this edge @@ -346,9 +337,8 @@ bool BM_edge_is_convex(const BMEdge *e) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(); * \return true when loop customdata is contiguous. */ bool BM_edge_is_contiguous_loop_cd(const BMEdge *e, - const int cd_loop_type, - const int cd_loop_offset) ATTR_WARN_UNUSED_RESULT - ATTR_NONNULL(); + int cd_loop_type, + int cd_loop_offset) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(); /** * The number of loops connected to this loop (not including disconnected regions). @@ -383,11 +373,11 @@ float BM_loop_point_side_of_edge_test(const BMLoop *l, const float co[3]) ATTR_W /** * \return The previous loop, over \a eps_sq distance from \a l (or \a NULL if l_stop is reached). */ -BMLoop *BM_loop_find_prev_nodouble(BMLoop *l, BMLoop *l_stop, const float eps_sq); +BMLoop *BM_loop_find_prev_nodouble(BMLoop *l, BMLoop *l_stop, float eps_sq); /** * \return The next loop, over \a eps_sq distance from \a l (or \a NULL if l_stop is reached). */ -BMLoop *BM_loop_find_next_nodouble(BMLoop *l, BMLoop *l_stop, const float eps_sq); +BMLoop *BM_loop_find_next_nodouble(BMLoop *l, BMLoop *l_stop, float eps_sq); /** * Calculates the angle between the previous and next loops @@ -421,7 +411,7 @@ float BM_loop_calc_face_normal_safe(const BMLoop *l, float r_normal[3]) ATTR_NON * \param epsilon_sq: Value to avoid numeric errors (1e-5f works well). * \param r_normal: Resulting normal. */ -float BM_loop_calc_face_normal_safe_ex(const BMLoop *l, const float epsilon_sq, float r_normal[3]) +float BM_loop_calc_face_normal_safe_ex(const BMLoop *l, float epsilon_sq, float r_normal[3]) ATTR_NONNULL(); /** * A version of BM_loop_calc_face_normal_safe_ex which takes vertex coordinates. @@ -429,7 +419,7 @@ float BM_loop_calc_face_normal_safe_ex(const BMLoop *l, const float epsilon_sq, float BM_loop_calc_face_normal_safe_vcos_ex(const BMLoop *l, const float normal_fallback[3], float const (*vertexCos)[3], - const float epsilon_sq, + float epsilon_sq, float r_normal[3]) ATTR_NONNULL(); float BM_loop_calc_face_normal_safe_vcos(const BMLoop *l, const float normal_fallback[3], @@ -464,7 +454,7 @@ void BM_loop_calc_face_tangent(const BMLoop *l, float r_tangent[3]); * * \return angle in radians */ -float BM_edge_calc_face_angle_ex(const BMEdge *e, const float fallback) ATTR_WARN_UNUSED_RESULT +float BM_edge_calc_face_angle_ex(const BMEdge *e, float fallback) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(); float BM_edge_calc_face_angle(const BMEdge *e) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(); /** @@ -475,8 +465,7 @@ float BM_edge_calc_face_angle(const BMEdge *e) ATTR_WARN_UNUSED_RESULT ATTR_NONN * * \return angle in radians */ -float BM_edge_calc_face_angle_signed_ex(const BMEdge *e, - const float fallback) ATTR_WARN_UNUSED_RESULT +float BM_edge_calc_face_angle_signed_ex(const BMEdge *e, float fallback) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(); /** * \brief BMESH EDGE/FACE ANGLE @@ -488,8 +477,7 @@ float BM_edge_calc_face_angle_signed_ex(const BMEdge *e, */ float BM_edge_calc_face_angle_with_imat3_ex(const BMEdge *e, const float imat3[3][3], - const float fallback) ATTR_WARN_UNUSED_RESULT - ATTR_NONNULL(); + float fallback) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(); float BM_edge_calc_face_angle_with_imat3(const BMEdge *e, const float imat3[3][3]) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(); @@ -516,7 +504,7 @@ float BM_vert_calc_edge_angle(const BMVert *v) ATTR_WARN_UNUSED_RESULT ATTR_NONN * * \returns the angle in radians */ -float BM_vert_calc_edge_angle_ex(const BMVert *v, const float fallback) ATTR_WARN_UNUSED_RESULT +float BM_vert_calc_edge_angle_ex(const BMVert *v, float fallback) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(); /** * \note this isn't optimal to run on an array of verts, @@ -527,7 +515,7 @@ float BM_vert_calc_shell_factor(const BMVert *v) ATTR_WARN_UNUSED_RESULT ATTR_NO * uses 'hflag' faces, but falls back to all if none found. */ float BM_vert_calc_shell_factor_ex(const BMVert *v, const float no[3], - const char hflag) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(); + char hflag) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(); /** * \note quite an obscure function. * used in bmesh operators that have a relative scale options, @@ -595,7 +583,7 @@ bool BM_face_exists_multi_edge(BMEdge **earr, int len) ATTR_WARN_UNUSED_RESULT A * \param len: \a varr array length. * \return The face or NULL. */ -BMFace *BM_face_exists_overlap(BMVert **varr, const int len) ATTR_WARN_UNUSED_RESULT; +BMFace *BM_face_exists_overlap(BMVert **varr, int len) ATTR_WARN_UNUSED_RESULT; /** * Given a set of vertices (varr), find out if * there is a face that uses vertices only from this list @@ -604,8 +592,7 @@ BMFace *BM_face_exists_overlap(BMVert **varr, const int len) ATTR_WARN_UNUSED_RE * \param varr: Array of unordered verts. * \param len: varr array length. */ -bool BM_face_exists_overlap_subset(BMVert **varr, const int len) ATTR_WARN_UNUSED_RESULT - ATTR_NONNULL(); +bool BM_face_exists_overlap_subset(BMVert **varr, int len) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(); /** * Returns the number of faces that are adjacent to both f1 and f2, @@ -704,27 +691,26 @@ void BM_edge_ordered_verts_ex(const BMEdge *edge, const BMLoop *edge_loop) ATTR_NONNULL(); bool BM_vert_is_all_edge_flag_test(const BMVert *v, - const char hflag, - const bool respect_hide) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(); + char hflag, + bool respect_hide) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(); bool BM_vert_is_all_face_flag_test(const BMVert *v, - const char hflag, - const bool respect_hide) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(); + char hflag, + bool respect_hide) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(); bool BM_edge_is_all_face_flag_test(const BMEdge *e, - const char hflag, - const bool respect_hide) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(); + char hflag, + bool respect_hide) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(); /* convenience functions for checking flags */ -bool BM_edge_is_any_vert_flag_test(const BMEdge *e, const char hflag) ATTR_WARN_UNUSED_RESULT +bool BM_edge_is_any_vert_flag_test(const BMEdge *e, char hflag) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(); -bool BM_edge_is_any_face_flag_test(const BMEdge *e, const char hflag) ATTR_WARN_UNUSED_RESULT +bool BM_edge_is_any_face_flag_test(const BMEdge *e, char hflag) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(); -bool BM_face_is_any_vert_flag_test(const BMFace *f, const char hflag) ATTR_WARN_UNUSED_RESULT +bool BM_face_is_any_vert_flag_test(const BMFace *f, char hflag) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(); -bool BM_face_is_any_edge_flag_test(const BMFace *f, const char hflag) ATTR_WARN_UNUSED_RESULT +bool BM_face_is_any_edge_flag_test(const BMFace *f, char hflag) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(); -bool BM_edge_is_any_face_len_test(const BMEdge *e, const int len) ATTR_WARN_UNUSED_RESULT - ATTR_NONNULL(); +bool BM_edge_is_any_face_len_test(const BMEdge *e, int len) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(); /** * Use within assert's to check normals are valid. @@ -755,8 +741,8 @@ int BM_mesh_calc_face_groups(BMesh *bm, BMLoopFilterFunc filter_fn, BMLoopPairFilterFunc filter_pair_fn, void *user_data, - const char hflag_test, - const char htype_step) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1, 2, 3); + char hflag_test, + char htype_step) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1, 2, 3); /** * Calculate isolated groups of edges with optional filtering. * @@ -780,7 +766,7 @@ int BM_mesh_calc_edge_groups(BMesh *bm, int (**r_group_index)[2], BMVertFilterFunc filter_fn, void *user_data, - const char hflag_test) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1, 2, 3); + char hflag_test) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1, 2, 3); /** * This is an alternative to #BM_mesh_calc_edge_groups. @@ -797,6 +783,6 @@ int BM_mesh_calc_edge_groups_as_arrays(BMesh *bm, ATTR_NONNULL(1, 2, 3, 4, 5); /* Not really any good place to put this. */ -float bmesh_subd_falloff_calc(const int falloff, float val) ATTR_WARN_UNUSED_RESULT; +float bmesh_subd_falloff_calc(int falloff, float val) ATTR_WARN_UNUSED_RESULT; #include "bmesh_query_inline.h" diff --git a/source/blender/bmesh/intern/bmesh_query_uv.h b/source/blender/bmesh/intern/bmesh_query_uv.h index d63b8e5e701..4399f8b4c4d 100644 --- a/source/blender/bmesh/intern/bmesh_query_uv.h +++ b/source/blender/bmesh/intern/bmesh_query_uv.h @@ -21,10 +21,9 @@ */ float BM_loop_uv_calc_edge_length_squared(const BMLoop *l, - const int cd_loop_uv_offset) ATTR_WARN_UNUSED_RESULT + int cd_loop_uv_offset) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(); -float BM_loop_uv_calc_edge_length(const BMLoop *l, - const int cd_loop_uv_offset) ATTR_WARN_UNUSED_RESULT +float BM_loop_uv_calc_edge_length(const BMLoop *l, int cd_loop_uv_offset) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(); /** @@ -37,24 +36,24 @@ float BM_loop_uv_calc_edge_length(const BMLoop *l, */ void BM_face_uv_calc_center_median_weighted(const BMFace *f, const float aspect[2], - const int cd_loop_uv_offset, + int cd_loop_uv_offset, float r_cent[2]) ATTR_NONNULL(); -void BM_face_uv_calc_center_median(const BMFace *f, const int cd_loop_uv_offset, float r_cent[2]) +void BM_face_uv_calc_center_median(const BMFace *f, int cd_loop_uv_offset, float r_cent[2]) ATTR_NONNULL(); /** * Calculate the UV cross product (use the sign to check the winding). */ -float BM_face_uv_calc_cross(const BMFace *f, const int cd_loop_uv_offset) ATTR_WARN_UNUSED_RESULT +float BM_face_uv_calc_cross(const BMFace *f, int cd_loop_uv_offset) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(); -void BM_face_uv_minmax(const BMFace *f, float min[2], float max[2], const int cd_loop_uv_offset); -void BM_face_uv_transform(BMFace *f, const float matrix[2][2], const int cd_loop_uv_offset); +void BM_face_uv_minmax(const BMFace *f, float min[2], float max[2], int cd_loop_uv_offset); +void BM_face_uv_transform(BMFace *f, const float matrix[2][2], int cd_loop_uv_offset); bool BM_loop_uv_share_edge_check_with_limit(BMLoop *l_a, BMLoop *l_b, const float limit[2], - const int cd_loop_uv_offset) ATTR_WARN_UNUSED_RESULT + int cd_loop_uv_offset) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(); /** @@ -62,13 +61,12 @@ bool BM_loop_uv_share_edge_check_with_limit(BMLoop *l_a, */ bool BM_loop_uv_share_edge_check(BMLoop *l_a, BMLoop *l_b, - const int cd_loop_uv_offset) ATTR_WARN_UNUSED_RESULT - ATTR_NONNULL(); + int cd_loop_uv_offset) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(); /** * Check if two loops that share a vertex also have the same UV coordinates. */ -bool BM_edge_uv_share_vert_check(BMEdge *e, BMLoop *l_a, BMLoop *l_b, const int cd_loop_uv_offset) +bool BM_edge_uv_share_vert_check(BMEdge *e, BMLoop *l_a, BMLoop *l_b, int cd_loop_uv_offset) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(); /** @@ -76,13 +74,11 @@ bool BM_edge_uv_share_vert_check(BMEdge *e, BMLoop *l_a, BMLoop *l_b, const int */ bool BM_loop_uv_share_vert_check(BMLoop *l_a, BMLoop *l_b, - const int cd_loop_uv_offset) ATTR_WARN_UNUSED_RESULT - ATTR_NONNULL(); + int cd_loop_uv_offset) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(); /** * Check if the point is inside the UV face. */ bool BM_face_uv_point_inside_test(const BMFace *f, const float co[2], - const int cd_loop_uv_offset) ATTR_WARN_UNUSED_RESULT - ATTR_NONNULL(); + int cd_loop_uv_offset) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(); diff --git a/source/blender/bmesh/intern/bmesh_structure.h b/source/blender/bmesh/intern/bmesh_structure.h index e2e26a69d44..8a9c1f114f9 100644 --- a/source/blender/bmesh/intern/bmesh_structure.h +++ b/source/blender/bmesh/intern/bmesh_structure.h @@ -47,7 +47,7 @@ BLI_INLINE BMEdge *bmesh_disk_edge_next(const BMEdge *e, const BMVert *v) ATTR_W ATTR_NONNULL(); BLI_INLINE BMEdge *bmesh_disk_edge_prev(const BMEdge *e, const BMVert *v) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(); -int bmesh_disk_facevert_count_at_most(const BMVert *v, const int count_max) ATTR_WARN_UNUSED_RESULT +int bmesh_disk_facevert_count_at_most(const BMVert *v, int count_max) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(); /** * \brief DISK COUNT FACE VERT @@ -106,8 +106,7 @@ void bmesh_radial_loop_unlink(BMLoop *l) ATTR_NONNULL(); int bmesh_radial_facevert_count_at_most(const BMLoop *l, const BMVert *v, - const int count_max) ATTR_WARN_UNUSED_RESULT - ATTR_NONNULL(); + int count_max) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(); /** * \brief RADIAL COUNT FACE VERT * diff --git a/source/blender/bmesh/tools/bmesh_beautify.h b/source/blender/bmesh/tools/bmesh_beautify.h index 2e7950118c1..a61ae55c3b0 100644 --- a/source/blender/bmesh/tools/bmesh_beautify.h +++ b/source/blender/bmesh/tools/bmesh_beautify.h @@ -32,11 +32,11 @@ enum { */ void BM_mesh_beautify_fill(BMesh *bm, BMEdge **edge_array, - const int edge_array_len, - const short flag, - const short method, - const short oflag_edge, - const short oflag_face); + int edge_array_len, + short flag, + short method, + short oflag_edge, + short oflag_face); /** * Assuming we have 2 triangles sharing an edge (2 - 4), @@ -48,5 +48,5 @@ float BM_verts_calc_rotate_beauty(const BMVert *v1, const BMVert *v2, const BMVert *v3, const BMVert *v4, - const short flag, - const short method); + short flag, + short method); diff --git a/source/blender/bmesh/tools/bmesh_bevel.h b/source/blender/bmesh/tools/bmesh_bevel.h index 03c10ee9f80..56533e83c39 100644 --- a/source/blender/bmesh/tools/bmesh_bevel.h +++ b/source/blender/bmesh/tools/bmesh_bevel.h @@ -36,25 +36,25 @@ struct MDeformVert; * \warning all tagged edges _must_ be manifold. */ void BM_mesh_bevel(BMesh *bm, - const float offset, - const int offset_type, - const int profile_type, - const int segments, - const float profile, - const bool affect_type, - const bool use_weights, - const bool limit_offset, + float offset, + int offset_type, + int profile_type, + int segments, + float profile, + bool affect_type, + bool use_weights, + bool limit_offset, const struct MDeformVert *dvert, - const int vertex_group, - const int mat, - const bool loop_slide, - const bool mark_seam, - const bool mark_sharp, - const bool harden_normals, - const int face_strength_mode, - const int miter_outer, - const int miter_inner, - const float spread, - const float smoothresh, + int vertex_group, + int mat, + bool loop_slide, + bool mark_seam, + bool mark_sharp, + bool harden_normals, + int face_strength_mode, + int miter_outer, + int miter_inner, + float spread, + float smoothresh, const struct CurveProfile *custom_profile, - const int vmesh_method); + int vmesh_method); diff --git a/source/blender/bmesh/tools/bmesh_bisect_plane.h b/source/blender/bmesh/tools/bmesh_bisect_plane.h index 120935296b7..d3c1c6f4c62 100644 --- a/source/blender/bmesh/tools/bmesh_bisect_plane.h +++ b/source/blender/bmesh/tools/bmesh_bisect_plane.h @@ -27,8 +27,8 @@ */ void BM_mesh_bisect_plane(BMesh *bm, const float plane[4], - const bool use_snap_center, - const bool use_tag, - const short oflag_center, - const short oflag_new, - const float eps); + bool use_snap_center, + bool use_tag, + short oflag_center, + short oflag_new, + float eps); diff --git a/source/blender/bmesh/tools/bmesh_boolean.h b/source/blender/bmesh/tools/bmesh_boolean.h index 4dacc7b1095..f97f49a7470 100644 --- a/source/blender/bmesh/tools/bmesh_boolean.h +++ b/source/blender/bmesh/tools/bmesh_boolean.h @@ -26,14 +26,14 @@ extern "C" { bool BM_mesh_boolean(BMesh *bm, struct BMLoop *(*looptris)[3], - const int looptris_tot, + int looptris_tot, int (*test_fn)(BMFace *f, void *user_data), void *user_data, - const int nshapes, - const bool use_self, - const bool keep_hidden, - const bool hole_tolerant, - const int boolean_mode); + int nshapes, + bool use_self, + bool keep_hidden, + bool hole_tolerant, + int boolean_mode); /** * Perform a Knife Intersection operation on the mesh `bm`. @@ -47,14 +47,14 @@ bool BM_mesh_boolean(BMesh *bm, */ bool BM_mesh_boolean_knife(BMesh *bm, struct BMLoop *(*looptris)[3], - const int looptris_tot, + int looptris_tot, int (*test_fn)(BMFace *f, void *user_data), void *user_data, - const int nshapes, - const bool use_self, - const bool use_separate_all, - const bool hole_tolerant, - const bool keep_hidden); + int nshapes, + bool use_self, + bool use_separate_all, + bool hole_tolerant, + bool keep_hidden); #ifdef __cplusplus } diff --git a/source/blender/bmesh/tools/bmesh_decimate.h b/source/blender/bmesh/tools/bmesh_decimate.h index 1de241a1326..336b653d462 100644 --- a/source/blender/bmesh/tools/bmesh_decimate.h +++ b/source/blender/bmesh/tools/bmesh_decimate.h @@ -35,28 +35,28 @@ * - Face normals are not maintained at all. */ void BM_mesh_decimate_collapse(BMesh *bm, - const float factor, + float factor, float *vweights, float vweight_factor, - const bool do_triangulate, - const int symmetry_axis, - const float symmetry_eps); + bool do_triangulate, + int symmetry_axis, + float symmetry_eps); /** * \param tag_only: so we can call this from an operator */ -void BM_mesh_decimate_unsubdivide_ex(BMesh *bm, const int iterations, const bool tag_only); -void BM_mesh_decimate_unsubdivide(BMesh *bm, const int iterations); +void BM_mesh_decimate_unsubdivide_ex(BMesh *bm, int iterations, bool tag_only); +void BM_mesh_decimate_unsubdivide(BMesh *bm, int iterations); void BM_mesh_decimate_dissolve_ex(BMesh *bm, - const float angle_limit, - const bool do_dissolve_boundaries, + float angle_limit, + bool do_dissolve_boundaries, BMO_Delimit delimit, BMVert **vinput_arr, - const int vinput_len, + int vinput_len, BMEdge **einput_arr, - const int einput_len, - const short oflag_out); + int einput_len, + short oflag_out); void BM_mesh_decimate_dissolve(BMesh *bm, - const float angle_limit, - const bool do_dissolve_boundaries, + float angle_limit, + bool do_dissolve_boundaries, const BMO_Delimit delimit); diff --git a/source/blender/bmesh/tools/bmesh_edgenet.h b/source/blender/bmesh/tools/bmesh_edgenet.h index 20edb30442c..60e9d9acff1 100644 --- a/source/blender/bmesh/tools/bmesh_edgenet.h +++ b/source/blender/bmesh/tools/bmesh_edgenet.h @@ -29,4 +29,4 @@ * \param bm: The mesh to operate on. * \param use_edge_tag: Only fill tagged edges. */ -void BM_mesh_edgenet(BMesh *bm, const bool use_edge_tag, const bool use_new_face_tag); +void BM_mesh_edgenet(BMesh *bm, bool use_edge_tag, bool use_new_face_tag); diff --git a/source/blender/bmesh/tools/bmesh_edgesplit.h b/source/blender/bmesh/tools/bmesh_edgesplit.h index bcbb3ab7857..dd835ba335c 100644 --- a/source/blender/bmesh/tools/bmesh_edgesplit.h +++ b/source/blender/bmesh/tools/bmesh_edgesplit.h @@ -29,10 +29,7 @@ extern "C" { * \param tag_only: Only split tagged edges. * \param copy_select: Copy selection history. */ -void BM_mesh_edgesplit(BMesh *bm, - const bool use_verts, - const bool tag_only, - const bool copy_select); +void BM_mesh_edgesplit(BMesh *bm, bool use_verts, bool tag_only, bool copy_select); #ifdef __cplusplus } diff --git a/source/blender/bmesh/tools/bmesh_intersect.h b/source/blender/bmesh/tools/bmesh_intersect.h index a6c91715f31..4fc6460a35f 100644 --- a/source/blender/bmesh/tools/bmesh_intersect.h +++ b/source/blender/bmesh/tools/bmesh_intersect.h @@ -34,17 +34,17 @@ extern "C" { */ bool BM_mesh_intersect(BMesh *bm, struct BMLoop *(*looptris)[3], - const int looptris_tot, + int looptris_tot, int (*test_fn)(BMFace *f, void *user_data), void *user_data, - const bool use_self, - const bool use_separate, - const bool use_dissolve, - const bool use_island_connect, - const bool use_partial_connect, - const bool use_edge_tag, - const int boolean_mode, - const float eps); + bool use_self, + bool use_separate, + bool use_dissolve, + bool use_island_connect, + bool use_partial_connect, + bool use_edge_tag, + int boolean_mode, + float eps); enum { BMESH_ISECT_BOOLEAN_NONE = -1, diff --git a/source/blender/bmesh/tools/bmesh_intersect_edges.h b/source/blender/bmesh/tools/bmesh_intersect_edges.h index 2736b7a52f9..cd7293c4a0b 100644 --- a/source/blender/bmesh/tools/bmesh_intersect_edges.h +++ b/source/blender/bmesh/tools/bmesh_intersect_edges.h @@ -21,4 +21,4 @@ #pragma once bool BM_mesh_intersect_edges( - BMesh *bm, const char hflag, const float dist, const bool split_faces, GHash *r_targetmap); + BMesh *bm, char hflag, float dist, bool split_faces, GHash *r_targetmap); diff --git a/source/blender/bmesh/tools/bmesh_path_region_uv.h b/source/blender/bmesh/tools/bmesh_path_region_uv.h index 5767c5384e5..2f29ef2a36e 100644 --- a/source/blender/bmesh/tools/bmesh_path_region_uv.h +++ b/source/blender/bmesh/tools/bmesh_path_region_uv.h @@ -23,7 +23,7 @@ struct LinkNode *BM_mesh_calc_path_uv_region_vert(BMesh *bm, BMElem *ele_src, BMElem *ele_dst, - const uint cd_loop_uv_offset, + uint cd_loop_uv_offset, bool (*filter_fn)(BMLoop *, void *user_data), void *user_data) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1, 2, 3); @@ -31,7 +31,7 @@ struct LinkNode *BM_mesh_calc_path_uv_region_vert(BMesh *bm, struct LinkNode *BM_mesh_calc_path_uv_region_edge(BMesh *bm, BMElem *ele_src, BMElem *ele_dst, - const uint cd_loop_uv_offset, + uint cd_loop_uv_offset, bool (*filter_fn)(BMLoop *, void *user_data), void *user_data) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1, 2, 3); @@ -39,7 +39,7 @@ struct LinkNode *BM_mesh_calc_path_uv_region_edge(BMesh *bm, struct LinkNode *BM_mesh_calc_path_uv_region_face(BMesh *bm, BMElem *ele_src, BMElem *ele_dst, - const uint cd_loop_uv_offset, + uint cd_loop_uv_offset, bool (*filter_fn)(BMFace *, void *user_data), void *user_data) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1, 2, 3); diff --git a/source/blender/bmesh/tools/bmesh_triangulate.h b/source/blender/bmesh/tools/bmesh_triangulate.h index f45f94f15d8..0d78b6a74b4 100644 --- a/source/blender/bmesh/tools/bmesh_triangulate.h +++ b/source/blender/bmesh/tools/bmesh_triangulate.h @@ -23,10 +23,10 @@ #pragma once void BM_mesh_triangulate(BMesh *bm, - const int quad_method, - const int ngon_method, - const int min_vertices, - const bool tag_only, + int quad_method, + int ngon_method, + int min_vertices, + bool tag_only, BMOperator *op, BMOpSlot *slot_facemap_out, BMOpSlot *slot_facemap_double_out); diff --git a/source/blender/bmesh/tools/bmesh_wireframe.h b/source/blender/bmesh/tools/bmesh_wireframe.h index 5b64a16435f..8e523780a67 100644 --- a/source/blender/bmesh/tools/bmesh_wireframe.h +++ b/source/blender/bmesh/tools/bmesh_wireframe.h @@ -29,17 +29,17 @@ * \note Behavior matches MOD_solidify.c */ void BM_mesh_wireframe(BMesh *bm, - const float offset, - const float offset_fac, - const float offset_fac_vg, - const bool use_replace, - const bool use_boundary, - const bool use_even_offset, - const bool use_relative_offset, - const bool use_crease, - const float crease_weight, - const int defgrp_index, - const bool defgrp_invert, - const short mat_offset, - const short mat_max, - const bool use_tag); + float offset, + float offset_fac, + float offset_fac_vg, + bool use_replace, + bool use_boundary, + bool use_even_offset, + bool use_relative_offset, + bool use_crease, + float crease_weight, + int defgrp_index, + bool defgrp_invert, + short mat_offset, + short mat_max, + bool use_tag); diff --git a/source/blender/compositor/CMakeLists.txt b/source/blender/compositor/CMakeLists.txt index 10e385e0187..f59fd885871 100644 --- a/source/blender/compositor/CMakeLists.txt +++ b/source/blender/compositor/CMakeLists.txt @@ -39,6 +39,7 @@ set(INC ../../../extern/clew/include ../../../intern/atomic ../../../intern/guardedalloc + ../../../intern/clog ) set(INC_SYS @@ -242,6 +243,8 @@ set(SRC nodes/COM_ColorToBWNode.h nodes/COM_ConvertAlphaNode.cc nodes/COM_ConvertAlphaNode.h + nodes/COM_ConvertColorSpaceNode.cc + nodes/COM_ConvertColorSpaceNode.h nodes/COM_GammaNode.cc nodes/COM_GammaNode.h nodes/COM_HueSaturationValueCorrectNode.cc @@ -567,6 +570,8 @@ set(SRC operations/COM_DotproductOperation.cc operations/COM_DotproductOperation.h + operations/COM_ConvertColorSpaceOperation.cc + operations/COM_ConvertColorSpaceOperation.h # Matte operation operations/COM_BoxMaskOperation.cc diff --git a/source/blender/compositor/intern/COM_Converter.cc b/source/blender/compositor/intern/COM_Converter.cc index 0af4ff7d98d..1b98a04cf96 100644 --- a/source/blender/compositor/intern/COM_Converter.cc +++ b/source/blender/compositor/intern/COM_Converter.cc @@ -46,6 +46,7 @@ #include "COM_CombineColorNode.h" #include "COM_CompositorNode.h" #include "COM_ConvertAlphaNode.h" +#include "COM_ConvertColorSpaceNode.h" #include "COM_ConvertOperation.h" #include "COM_Converter.h" #include "COM_CornerPinNode.h" @@ -426,6 +427,9 @@ Node *COM_convert_bnode(bNode *b_node) case CMP_NODE_POSTERIZE: node = new PosterizeNode(b_node); break; + case CMP_NODE_CONVERT_COLOR_SPACE: + node = new ConvertColorSpaceNode(b_node); + break; } return node; } diff --git a/source/blender/compositor/intern/COM_ExecutionGroup.h b/source/blender/compositor/intern/COM_ExecutionGroup.h index 430cde89a3b..d37bfe29306 100644 --- a/source/blender/compositor/intern/COM_ExecutionGroup.h +++ b/source/blender/compositor/intern/COM_ExecutionGroup.h @@ -175,9 +175,7 @@ class ExecutionGroup { /** * \brief Determine the rect (minx, maxx, miny, maxy) of a chunk at a position. */ - void determine_chunk_rect(rcti *r_rect, - const unsigned int x_chunk, - const unsigned int y_chunk) const; + void determine_chunk_rect(rcti *r_rect, unsigned int x_chunk, unsigned int y_chunk) const; /** * \brief determine the number of chunks, based on the chunk_size, width and height. @@ -197,7 +195,7 @@ class ExecutionGroup { * true: package(s) are scheduled * false: scheduling is deferred (depending workpackages are scheduled) */ - bool schedule_chunk_when_possible(ExecutionSystem *graph, const int chunk_x, const int chunk_y); + bool schedule_chunk_when_possible(ExecutionSystem *graph, int chunk_x, int chunk_y); /** * \brief try to schedule a specific area. @@ -374,7 +372,7 @@ class ExecutionGroup { /** * \brief Determine the rect (minx, maxx, miny, maxy) of a chunk. */ - void determine_chunk_rect(rcti *r_rect, const unsigned int chunk_number) const; + void determine_chunk_rect(rcti *r_rect, unsigned int chunk_number) const; void set_chunksize(int chunksize) { diff --git a/source/blender/compositor/intern/COM_FullFrameExecutionModel.h b/source/blender/compositor/intern/COM_FullFrameExecutionModel.h index ce724a6b934..6d3a5fba53a 100644 --- a/source/blender/compositor/intern/COM_FullFrameExecutionModel.h +++ b/source/blender/compositor/intern/COM_FullFrameExecutionModel.h @@ -75,10 +75,8 @@ class FullFrameExecutionModel : public ExecutionModel { * Returns input buffers with an offset relative to given output coordinates. * Returned memory buffers must be deleted. */ - Vector<MemoryBuffer *> get_input_buffers(NodeOperation *op, - const int output_x, - const int output_y); - MemoryBuffer *create_operation_buffer(NodeOperation *op, const int output_x, const int output_y); + Vector<MemoryBuffer *> get_input_buffers(NodeOperation *op, int output_x, int output_y); + MemoryBuffer *create_operation_buffer(NodeOperation *op, int output_x, int output_y); void render_operation(NodeOperation *op); void operation_finished(NodeOperation *operation); diff --git a/source/blender/compositor/intern/COM_MemoryBuffer.cc b/source/blender/compositor/intern/COM_MemoryBuffer.cc index ae925f796ee..dcc279e3b88 100644 --- a/source/blender/compositor/intern/COM_MemoryBuffer.cc +++ b/source/blender/compositor/intern/COM_MemoryBuffer.cc @@ -289,6 +289,23 @@ void MemoryBuffer::copy_from(const uchar *src, } } +void MemoryBuffer::apply_processor(ColormanageProcessor &processor, const rcti area) +{ + const int width = BLI_rcti_size_x(&area); + const int height = BLI_rcti_size_y(&area); + float *out = get_elem(area.xmin, area.ymin); + /* If area allows continuous memory do conversion in one step. Otherwise per row. */ + if (get_width() == width) { + IMB_colormanagement_processor_apply(&processor, out, width, height, get_num_channels(), false); + } + else { + for (int y = 0; y < height; y++) { + IMB_colormanagement_processor_apply(&processor, out, width, 1, get_num_channels(), false); + out += row_stride; + } + } +} + static void colorspace_to_scene_linear(MemoryBuffer *buf, const rcti &area, ColorSpace *colorspace) { const int width = BLI_rcti_size_x(&area); diff --git a/source/blender/compositor/intern/COM_MemoryBuffer.h b/source/blender/compositor/intern/COM_MemoryBuffer.h index 1af047e9ce1..1765fb93035 100644 --- a/source/blender/compositor/intern/COM_MemoryBuffer.h +++ b/source/blender/compositor/intern/COM_MemoryBuffer.h @@ -26,6 +26,8 @@ #include "BLI_math_interp.h" #include "BLI_rect.h" +#include "IMB_colormanagement.h" + struct ImBuf; namespace blender::compositor { @@ -286,8 +288,7 @@ class MemoryBuffer { } } - void read_elem_filtered( - const float x, const float y, float dx[2], float dy[2], float *out) const; + void read_elem_filtered(float x, float y, float dx[2], float dy[2], float *out) const; /** * Get channel value at given coordinates. @@ -579,6 +580,11 @@ class MemoryBuffer { return state_ == MemoryBufferState::Temporary; } + /** + * \brief Apply a color processor on the given area. + */ + void apply_processor(ColormanageProcessor &processor, const rcti area); + 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, @@ -722,18 +728,15 @@ class MemoryBuffer { 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); + int to_channel_offset); + void copy_rows_from(const MemoryBuffer *src, const rcti &src_area, int to_x, 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); + int channel_offset, + int elem_size, + int to_x, + int to_y, + int to_channel_offset); #ifdef WITH_CXX_GUARDEDALLOC MEM_CXX_CLASS_ALLOC_FUNCS("COM:MemoryBuffer") diff --git a/source/blender/compositor/intern/COM_Node.h b/source/blender/compositor/intern/COM_Node.h index dd126770303..37fa71f9b97 100644 --- a/source/blender/compositor/intern/COM_Node.h +++ b/source/blender/compositor/intern/COM_Node.h @@ -129,13 +129,13 @@ class Node { * Get the reference to a certain output-socket. * \param index: The index of the needed output-socket. */ - NodeOutput *get_output_socket(const unsigned int index = 0) const; + NodeOutput *get_output_socket(unsigned int index = 0) const; /** * get the reference to a certain input-socket. * \param index: The index of the needed input-socket. */ - NodeInput *get_input_socket(const unsigned int index) const; + NodeInput *get_input_socket(unsigned int index) const; /** * \brief Is this node in the active group (the group that is being edited) diff --git a/source/blender/compositor/nodes/COM_ConvertColorSpaceNode.cc b/source/blender/compositor/nodes/COM_ConvertColorSpaceNode.cc new file mode 100644 index 00000000000..4e7bbefc22d --- /dev/null +++ b/source/blender/compositor/nodes/COM_ConvertColorSpaceNode.cc @@ -0,0 +1,100 @@ +/* + * 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 2021, Blender Foundation. + */ + +#include "COM_ConvertColorSpaceNode.h" + +#include "BKE_node.h" + +#include "BLI_utildefines.h" + +#include "COM_ConvertColorSpaceOperation.h" +#include "COM_ConvertOperation.h" +#include "COM_ExecutionSystem.h" +#include "COM_ImageOperation.h" +#include "COM_MultilayerImageOperation.h" + +#include "CLG_log.h" + +static CLG_LogRef LOG = {"compositor"}; + +namespace blender::compositor { + +ConvertColorSpaceNode::ConvertColorSpaceNode(bNode *editorNode) : Node(editorNode) +{ + /* pass */ +} + +void ConvertColorSpaceNode::convert_to_operations(NodeConverter &converter, + const CompositorContext &UNUSED(context)) const +{ + bNode *b_node = get_bnode(); + + NodeInput *inputSocketImage = this->get_input_socket(0); + NodeOutput *outputSocketImage = this->get_output_socket(0); + + NodeConvertColorSpace *settings = static_cast<NodeConvertColorSpace *>(b_node->storage); + + if (!performs_conversion(*settings)) { + converter.map_output_socket(get_output_socket(0), + converter.add_input_proxy(get_input_socket(0), false)); + return; + } + + ConvertColorSpaceOperation *operation = new ConvertColorSpaceOperation(); + operation->set_settings((NodeConvertColorSpace *)b_node->storage); + converter.add_operation(operation); + + converter.map_input_socket(inputSocketImage, operation->get_input_socket(0)); + converter.map_output_socket(outputSocketImage, operation->get_output_socket()); +} + +bool ConvertColorSpaceNode::performs_conversion(NodeConvertColorSpace &settings) const +{ + bNode *b_node = get_bnode(); + + if (IMB_colormanagement_space_name_is_data(settings.from_color_space)) { + CLOG_INFO(&LOG, + 2, + "Color space conversion bypassed for node: %s. From color space is data: %s.", + b_node->name, + settings.from_color_space); + return false; + } + + if (IMB_colormanagement_space_name_is_data(settings.to_color_space)) { + CLOG_INFO(&LOG, + 2, + "Color space conversion bypassed for node: %s. To color space is data: %s.", + b_node->name, + settings.to_color_space); + return false; + } + + if (STREQLEN( + settings.from_color_space, settings.to_color_space, sizeof(settings.from_color_space))) { + CLOG_INFO(&LOG, + 2, + "Color space conversion bypassed for node: %s. To and from are the same: %s.", + b_node->name, + settings.from_color_space); + return false; + } + return true; +} + +} // namespace blender::compositor diff --git a/source/blender/compositor/nodes/COM_ConvertColorSpaceNode.h b/source/blender/compositor/nodes/COM_ConvertColorSpaceNode.h new file mode 100644 index 00000000000..b3460abea27 --- /dev/null +++ b/source/blender/compositor/nodes/COM_ConvertColorSpaceNode.h @@ -0,0 +1,46 @@ +/* + * 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 2021, Blender Foundation. + */ + +#pragma once + +#include "COM_Node.h" +#include "COM_defines.h" +#include "DNA_image_types.h" +#include "DNA_node_types.h" + +#include "RE_engine.h" +#include "RE_pipeline.h" + +namespace blender::compositor { + +/** + * \brief ImageNode + * \ingroup Node + */ +class ConvertColorSpaceNode : public Node { + public: + ConvertColorSpaceNode(bNode *editorNode); + void convert_to_operations(NodeConverter &converter, + const CompositorContext &context) const override; + + private: + /** \brief check if the given settings changes color space. */ + bool performs_conversion(NodeConvertColorSpace &settings) const; +}; + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_ConvertColorSpaceOperation.cc b/source/blender/compositor/operations/COM_ConvertColorSpaceOperation.cc new file mode 100644 index 00000000000..5b1dfb4a02c --- /dev/null +++ b/source/blender/compositor/operations/COM_ConvertColorSpaceOperation.cc @@ -0,0 +1,91 @@ +/* + * 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 2021, Blender Foundation. + */ + +#include "COM_ConvertColorSpaceOperation.h" + +namespace blender::compositor { + +ConvertColorSpaceOperation::ConvertColorSpaceOperation() +{ + this->add_input_socket(DataType::Color); + this->add_output_socket(DataType::Color); + this->input_program_ = nullptr; + color_processor_ = nullptr; +} + +void ConvertColorSpaceOperation::set_settings(NodeConvertColorSpace *node_color_space) +{ + this->settings_ = node_color_space; +} + +void ConvertColorSpaceOperation::init_execution() +{ + if (BLI_strnlen(settings_->from_color_space, sizeof(settings_->from_color_space)) == 0 || + BLI_strnlen(settings_->to_color_space, sizeof(settings_->to_color_space)) == 0) { + return; + } + + int in_colorspace_index = IMB_colormanagement_colorspace_get_named_index( + settings_->from_color_space); + int out_colorspace_index = IMB_colormanagement_colorspace_get_named_index( + settings_->to_color_space); + + if (in_colorspace_index == 0 || out_colorspace_index == 0) { + return; + } + + this->input_program_ = this->get_input_socket_reader(0); + + color_processor_ = IMB_colormanagement_colorspace_processor_new(settings_->from_color_space, + settings_->to_color_space); +} + +void ConvertColorSpaceOperation::execute_pixel_sampled(float output[4], + float x, + float y, + PixelSampler sampler) +{ + this->input_program_->read_sampled(output, x, y, sampler); + if (color_processor_ != nullptr) { + IMB_colormanagement_processor_apply_pixel(color_processor_, output, 3); + } +} + +void ConvertColorSpaceOperation::update_memory_buffer_partial(MemoryBuffer *output, + const rcti &area, + Span<MemoryBuffer *> inputs) +{ + for (BuffersIterator<float> it = output->iterate_with(inputs, area); !it.is_end(); ++it) { + copy_v4_v4(it.out, it.in(0)); + } + + if (color_processor_ != nullptr) { + output->apply_processor(*color_processor_, area); + } +} + +void ConvertColorSpaceOperation::deinit_execution() +{ + if (color_processor_ != nullptr) { + IMB_colormanagement_processor_free(color_processor_); + } + this->input_program_ = nullptr; + this->color_processor_ = nullptr; +} + +} // namespace blender::compositor diff --git a/source/blender/compositor/operations/COM_ConvertColorSpaceOperation.h b/source/blender/compositor/operations/COM_ConvertColorSpaceOperation.h new file mode 100644 index 00000000000..c065224eadc --- /dev/null +++ b/source/blender/compositor/operations/COM_ConvertColorSpaceOperation.h @@ -0,0 +1,57 @@ +/* + * 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 2021, Blender Foundation. + */ + +#pragma once + +#include "COM_ConvertColorSpaceNode.h" +#include "COM_MultiThreadedOperation.h" +#include "IMB_colormanagement.h" + +namespace blender::compositor { + +class ConvertColorSpaceOperation : public MultiThreadedOperation { + private: + SocketReader *input_program_; + NodeConvertColorSpace *settings_; + ColormanageProcessor *color_processor_; + + public: + ConvertColorSpaceOperation(); + + void set_settings(NodeConvertColorSpace *node_color_space); + /** + * The inner loop of this operation. + */ + void execute_pixel_sampled(float output[4], float x, float y, PixelSampler sampler) override; + + /** + * Initialize the execution + */ + void init_execution() override; + + /** + * Deinitialize the execution + */ + void deinit_execution() 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_GaussianAlphaBlurBaseOperation.h b/source/blender/compositor/operations/COM_GaussianAlphaBlurBaseOperation.h index 0f83a67cef7..4f374d446cf 100644 --- a/source/blender/compositor/operations/COM_GaussianAlphaBlurBaseOperation.h +++ b/source/blender/compositor/operations/COM_GaussianAlphaBlurBaseOperation.h @@ -39,9 +39,7 @@ class GaussianAlphaBlurBaseOperation : public BlurBaseOperation { virtual void init_execution() override; virtual void deinit_execution() override; - void get_area_of_interest(const int input_idx, - const rcti &output_area, - rcti &r_input_area) final; + void get_area_of_interest(int input_idx, const rcti &output_area, rcti &r_input_area) final; void update_memory_buffer_partial(MemoryBuffer *output, const rcti &area, Span<MemoryBuffer *> inputs) final; diff --git a/source/blender/compositor/operations/COM_GaussianBlurBaseOperation.h b/source/blender/compositor/operations/COM_GaussianBlurBaseOperation.h index 31b045241f8..55099c2d9be 100644 --- a/source/blender/compositor/operations/COM_GaussianBlurBaseOperation.h +++ b/source/blender/compositor/operations/COM_GaussianBlurBaseOperation.h @@ -39,9 +39,7 @@ class GaussianBlurBaseOperation : public BlurBaseOperation { virtual void init_execution() override; virtual void deinit_execution() override; - void get_area_of_interest(const int input_idx, - const rcti &output_area, - rcti &r_input_area) override; + void get_area_of_interest(int input_idx, const rcti &output_area, rcti &r_input_area) override; virtual void update_memory_buffer_partial(MemoryBuffer *output, const rcti &area, Span<MemoryBuffer *> inputs) override; diff --git a/source/blender/compositor/operations/COM_GaussianBokehBlurOperation.h b/source/blender/compositor/operations/COM_GaussianBokehBlurOperation.h index 923daf7a447..06d7d85894c 100644 --- a/source/blender/compositor/operations/COM_GaussianBokehBlurOperation.h +++ b/source/blender/compositor/operations/COM_GaussianBokehBlurOperation.h @@ -51,9 +51,7 @@ class GaussianBokehBlurOperation : public BlurBaseOperation { ReadBufferOperation *read_operation, rcti *output) override; - void get_area_of_interest(const int input_idx, - const rcti &output_area, - rcti &r_input_area) 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; @@ -88,9 +86,7 @@ class GaussianBlurReferenceOperation : public BlurBaseOperation { ReadBufferOperation *read_operation, rcti *output) override; - void get_area_of_interest(const int input_idx, - const rcti &output_area, - rcti &r_input_area) 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; diff --git a/source/blender/compositor/operations/COM_GlareBaseOperation.h b/source/blender/compositor/operations/COM_GlareBaseOperation.h index 09db5efcec9..c29587839b1 100644 --- a/source/blender/compositor/operations/COM_GlareBaseOperation.h +++ b/source/blender/compositor/operations/COM_GlareBaseOperation.h @@ -70,9 +70,7 @@ class GlareBaseOperation : public SingleThreadedOperation { ReadBufferOperation *read_operation, rcti *output) override; - void get_area_of_interest(const int input_idx, - const rcti &output_area, - rcti &r_input_area) final; + void get_area_of_interest(int input_idx, const rcti &output_area, rcti &r_input_area) final; void update_memory_buffer(MemoryBuffer *output, const rcti &area, diff --git a/source/blender/compositor/operations/COM_InpaintOperation.h b/source/blender/compositor/operations/COM_InpaintOperation.h index 989d154dab5..0e52aa82b92 100644 --- a/source/blender/compositor/operations/COM_InpaintOperation.h +++ b/source/blender/compositor/operations/COM_InpaintOperation.h @@ -67,9 +67,7 @@ class InpaintSimpleOperation : public NodeOperation { ReadBufferOperation *read_operation, rcti *output) override; - void get_area_of_interest(const int input_idx, - const rcti &output_area, - rcti &r_input_area) override; + void get_area_of_interest(int input_idx, const rcti &output_area, rcti &r_input_area) override; void update_memory_buffer(MemoryBuffer *output, const rcti &area, Span<MemoryBuffer *> inputs) override; diff --git a/source/blender/compositor/operations/COM_KeyingBlurOperation.h b/source/blender/compositor/operations/COM_KeyingBlurOperation.h index 11fde5f5436..cc4a98767d8 100644 --- a/source/blender/compositor/operations/COM_KeyingBlurOperation.h +++ b/source/blender/compositor/operations/COM_KeyingBlurOperation.h @@ -55,9 +55,7 @@ class KeyingBlurOperation : public MultiThreadedOperation { ReadBufferOperation *read_operation, rcti *output) override; - void get_area_of_interest(const int input_idx, - const rcti &output_area, - rcti &r_input_area) 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; diff --git a/source/blender/compositor/operations/COM_KeyingClipOperation.h b/source/blender/compositor/operations/COM_KeyingClipOperation.h index 3bdc7281683..b945d4264af 100644 --- a/source/blender/compositor/operations/COM_KeyingClipOperation.h +++ b/source/blender/compositor/operations/COM_KeyingClipOperation.h @@ -69,9 +69,7 @@ class KeyingClipOperation : public MultiThreadedOperation { ReadBufferOperation *read_operation, rcti *output) override; - void get_area_of_interest(const int input_idx, - const rcti &output_area, - rcti &r_input_area) 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; diff --git a/source/blender/compositor/operations/COM_OutputFileMultiViewOperation.h b/source/blender/compositor/operations/COM_OutputFileMultiViewOperation.h index 9f8bf2ed127..864eb68ac24 100644 --- a/source/blender/compositor/operations/COM_OutputFileMultiViewOperation.h +++ b/source/blender/compositor/operations/COM_OutputFileMultiViewOperation.h @@ -41,7 +41,7 @@ class OutputOpenExrSingleLayerMultiViewOperation : public OutputSingleLayerOpera const ColorManagedViewSettings *view_settings, const ColorManagedDisplaySettings *display_settings, const char *view_name, - const bool save_as_render); + bool save_as_render); void *get_handle(const char *filename); void deinit_execution() override; @@ -78,7 +78,7 @@ class OutputStereoOperation : public OutputSingleLayerOperation { const ColorManagedViewSettings *view_settings, const ColorManagedDisplaySettings *display_settings, const char *view_name, - const bool save_as_render); + bool save_as_render); void *get_handle(const char *filename); void deinit_execution() override; }; diff --git a/source/blender/compositor/operations/COM_OutputFileOperation.h b/source/blender/compositor/operations/COM_OutputFileOperation.h index 2a18b056c12..0e871f47b87 100644 --- a/source/blender/compositor/operations/COM_OutputFileOperation.h +++ b/source/blender/compositor/operations/COM_OutputFileOperation.h @@ -57,7 +57,7 @@ class OutputSingleLayerOperation : public MultiThreadedOperation { const ColorManagedViewSettings *view_settings, const ColorManagedDisplaySettings *display_settings, const char *view_name, - const bool save_as_render); + bool save_as_render); void execute_region(rcti *rect, unsigned int tile_number) override; bool is_output_operation(bool /*rendering*/) const override diff --git a/source/blender/compositor/operations/COM_RotateOperation.h b/source/blender/compositor/operations/COM_RotateOperation.h index 3970d3a2776..f53fb3a4932 100644 --- a/source/blender/compositor/operations/COM_RotateOperation.h +++ b/source/blender/compositor/operations/COM_RotateOperation.h @@ -56,27 +56,19 @@ class RotateOperation : public MultiThreadedOperation { const rcti &rotate_canvas, float &r_offset_x, float &r_offset_y); - static void get_area_rotation_bounds(const rcti &area, - const float center_x, - const float center_y, - const float sine, - const float cosine, - rcti &r_bounds); - static void get_area_rotation_bounds_inverted(const rcti &area, - const float center_x, - const float center_y, - const float sine, - const float cosine, - rcti &r_bounds); + static void get_area_rotation_bounds( + const rcti &area, float center_x, float center_y, float sine, float cosine, rcti &r_bounds); + static void get_area_rotation_bounds_inverted( + const rcti &area, float center_x, float center_y, float sine, float cosine, rcti &r_bounds); static void get_rotation_area_of_interest(const rcti &input_canvas, const rcti &rotate_canvas, - const float sine, - const float cosine, + float sine, + float cosine, const rcti &output_area, rcti &r_input_area); static void get_rotation_canvas(const rcti &input_canvas, - const float sine, - const float cosine, + float sine, + float cosine, rcti &r_canvas); bool determine_depending_area_of_interest(rcti *input, diff --git a/source/blender/compositor/operations/COM_ScaleOperation.h b/source/blender/compositor/operations/COM_ScaleOperation.h index cac865b41aa..132e9c8fed0 100644 --- a/source/blender/compositor/operations/COM_ScaleOperation.h +++ b/source/blender/compositor/operations/COM_ScaleOperation.h @@ -90,8 +90,8 @@ class ScaleOperation : public BaseScaleOperation { static void scale_area(rcti &area, float relative_scale_x, float relative_scale_y); static void get_scale_area_of_interest(const rcti &input_canvas, const rcti &scale_canvas, - const float relative_scale_x, - const float relative_scale_y, + float relative_scale_x, + float relative_scale_y, const rcti &output_area, rcti &r_input_area); static void clamp_area_size_max(rcti &area, Size2f max_size); diff --git a/source/blender/compositor/operations/COM_VectorBlurOperation.cc b/source/blender/compositor/operations/COM_VectorBlurOperation.cc index e34b629f457..1d097b37ca5 100644 --- a/source/blender/compositor/operations/COM_VectorBlurOperation.cc +++ b/source/blender/compositor/operations/COM_VectorBlurOperation.cc @@ -180,8 +180,13 @@ void VectorBlurOperation::generate_vector_blur(float *data, inputZ->get_buffer()); } -/* ****************** Spans ******************************* */ -/* span fill in method, is also used to localize data for zbuffering */ +/* -------------------------------------------------------------------- */ +/** \name Spans + * + * Duplicated logic from `zbuf.c`. + * \{ */ + +/** Span fill in method, is also used to localize data for Z-buffering. */ struct ZSpan { /* range for clipping */ int rectx, recty; @@ -327,11 +332,13 @@ static void zbuf_add_to_span(ZSpan *zspan, const float v1[2], const float v2[2]) } for (y = my2; y >= my0; y--, xs0 += dx0) { - /* xs0 is the xcoord! */ + /* xs0 is the X-coordinate! */ span[y] = xs0; } } +/** \} */ + /* ******************** VECBLUR ACCUM BUF ************************* */ struct DrawBufPixel { @@ -339,6 +346,9 @@ struct DrawBufPixel { float alpha; }; +/** + * \note Near duplicate of `zspan_scanconvert` in `zbuf.c` with some minor adjustments. + */ static void zbuf_fill_in_rgba( ZSpan *zspan, DrawBufPixel *col, float *v1, float *v2, float *v3, float *v4) { diff --git a/source/blender/compositor/operations/COM_VectorBlurOperation.h b/source/blender/compositor/operations/COM_VectorBlurOperation.h index efcb5001fd4..75df9d9e024 100644 --- a/source/blender/compositor/operations/COM_VectorBlurOperation.h +++ b/source/blender/compositor/operations/COM_VectorBlurOperation.h @@ -72,9 +72,7 @@ class VectorBlurOperation : public NodeOperation, public QualityStepHelper { ReadBufferOperation *read_operation, rcti *output) override; - void get_area_of_interest(const int input_idx, - const rcti &output_area, - rcti &r_input_area) override; + void get_area_of_interest(int input_idx, const rcti &output_area, rcti &r_input_area) override; void update_memory_buffer(MemoryBuffer *output, const rcti &area, Span<MemoryBuffer *> inputs) override; diff --git a/source/blender/depsgraph/DEG_depsgraph.h b/source/blender/depsgraph/DEG_depsgraph.h index 0b3e028cd06..b8ff49640b7 100644 --- a/source/blender/depsgraph/DEG_depsgraph.h +++ b/source/blender/depsgraph/DEG_depsgraph.h @@ -129,10 +129,10 @@ void DEG_free_node_types(void); * \{ */ /** Tag dependency graph for updates when visible scenes/layers changes. */ -void DEG_graph_tag_on_visible_update(Depsgraph *depsgraph, const bool do_time); +void DEG_graph_tag_on_visible_update(Depsgraph *depsgraph, 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); +void DEG_tag_on_visible_update(struct Main *bmain, bool do_time); /** * \note Will return NULL if the flag is not known, allowing to gracefully handle situations @@ -173,7 +173,7 @@ void DEG_enable_editors_update(struct Depsgraph *depsgraph); void DEG_editors_update(struct Depsgraph *depsgraph, bool time); /** Clear recalc flags after editors or renderers have handled updates. */ -void DEG_ids_clear_recalc(Depsgraph *depsgraph, const bool backup); +void DEG_ids_clear_recalc(Depsgraph *depsgraph, bool backup); /** * Restore recalc flags, backed up by a previous call to #DEG_ids_clear_recalc. @@ -220,8 +220,7 @@ typedef struct DEGEditorUpdateContext { } DEGEditorUpdateContext; typedef void (*DEG_EditorUpdateIDCb)(const DEGEditorUpdateContext *update_ctx, struct ID *id); -typedef void (*DEG_EditorUpdateSceneCb)(const DEGEditorUpdateContext *update_ctx, - const bool updated); +typedef void (*DEG_EditorUpdateSceneCb)(const DEGEditorUpdateContext *update_ctx, bool updated); /** Set callbacks which are being called when depsgraph changes. */ void DEG_editors_set_update_cb(DEG_EditorUpdateIDCb id_func, DEG_EditorUpdateSceneCb scene_func); @@ -266,7 +265,7 @@ void DEG_debug_print_eval_subdata_index(struct Depsgraph *depsgraph, const char *subdata_comment, const char *subdata_name, const void *subdata_address, - const int subdata_index); + int subdata_index); void DEG_debug_print_eval_parent_typed(struct Depsgraph *depsgraph, const char *function_name, diff --git a/source/blender/depsgraph/DEG_depsgraph_build.h b/source/blender/depsgraph/DEG_depsgraph_build.h index db82af6d43e..0461d8b63fd 100644 --- a/source/blender/depsgraph/DEG_depsgraph_build.h +++ b/source/blender/depsgraph/DEG_depsgraph_build.h @@ -72,7 +72,7 @@ void DEG_graph_build_for_render_pipeline(struct Depsgraph *graph); */ void DEG_graph_build_for_compositor_preview(struct Depsgraph *graph, struct bNodeTree *nodetree); -void DEG_graph_build_from_ids(struct Depsgraph *graph, struct ID **ids, const int num_ids); +void DEG_graph_build_from_ids(struct Depsgraph *graph, struct ID **ids, int num_ids); /** Tag relations from the given graph for update. */ void DEG_graph_tag_relations_update(struct Depsgraph *graph); diff --git a/source/blender/depsgraph/intern/builder/deg_builder_cache.cc b/source/blender/depsgraph/intern/builder/deg_builder_cache.cc index af7717d7595..0afaa72aad0 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_cache.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_cache.cc @@ -127,6 +127,7 @@ void AnimatedPropertyStorage::initializeFromID(DepsgraphBuilderCache *builder_ca void AnimatedPropertyStorage::tagPropertyAsAnimated(const AnimatedPropertyID &property_id) { + animated_objects_set.add(property_id.data); animated_properties_set.add(property_id); } @@ -147,6 +148,11 @@ bool AnimatedPropertyStorage::isPropertyAnimated(const PointerRNA *pointer_rna, return isPropertyAnimated(AnimatedPropertyID(pointer_rna, property_rna)); } +bool AnimatedPropertyStorage::isAnyPropertyAnimated(const PointerRNA *pointer_rna) +{ + return animated_objects_set.contains(pointer_rna->data); +} + /* Builder cache itself. */ DepsgraphBuilderCache::~DepsgraphBuilderCache() diff --git a/source/blender/depsgraph/intern/builder/deg_builder_cache.h b/source/blender/depsgraph/intern/builder/deg_builder_cache.h index c955a22a5cf..690046cb0d3 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_cache.h +++ b/source/blender/depsgraph/intern/builder/deg_builder_cache.h @@ -69,10 +69,13 @@ class AnimatedPropertyStorage { bool isPropertyAnimated(const AnimatedPropertyID &property_id); bool isPropertyAnimated(const PointerRNA *pointer_rna, const PropertyRNA *property_rna); + bool isAnyPropertyAnimated(const PointerRNA *pointer_rna); + /* The storage is fully initialized from all F-Curves from corresponding ID. */ bool is_fully_initialized; /* indexed by PointerRNA.data. */ + Set<void *> animated_objects_set; Set<AnimatedPropertyID> animated_properties_set; MEM_CXX_CLASS_ALLOC_FUNCS("AnimatedPropertyStorage"); @@ -102,6 +105,13 @@ class DepsgraphBuilderCache { return animated_property_storage->isPropertyAnimated(args...); } + bool isAnyPropertyAnimated(const PointerRNA *ptr) + { + AnimatedPropertyStorage *animated_property_storage = ensureInitializedAnimatedPropertyStorage( + ptr->owner_id); + return animated_property_storage->isAnyPropertyAnimated(ptr); + } + Map<ID *, AnimatedPropertyStorage *> animated_property_storage_map_; MEM_CXX_CLASS_ALLOC_FUNCS("DepsgraphBuilderCache"); diff --git a/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc b/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc index ecbe89b1e7f..79d674e8415 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc @@ -271,6 +271,21 @@ OperationNode *DepsgraphNodeBuilder::add_operation_node(ID *id, OperationNode *DepsgraphNodeBuilder::ensure_operation_node(ID *id, NodeType comp_type, + const char *comp_name, + OperationCode opcode, + const DepsEvalOperationCb &op, + const char *name, + int name_tag) +{ + OperationNode *operation = find_operation_node(id, comp_type, comp_name, opcode, name, name_tag); + if (operation != nullptr) { + return operation; + } + return add_operation_node(id, comp_type, comp_name, opcode, op, name, name_tag); +} + +OperationNode *DepsgraphNodeBuilder::ensure_operation_node(ID *id, + NodeType comp_type, OperationCode opcode, const DepsEvalOperationCb &op, const char *name, @@ -1198,8 +1213,16 @@ void DepsgraphNodeBuilder::build_driver_id_property(ID *id, const char *rna_path return; } const char *prop_identifier = RNA_property_identifier((PropertyRNA *)prop); - ensure_operation_node( - id, NodeType::PARAMETERS, OperationCode::ID_PROPERTY, nullptr, prop_identifier); + /* Custom properties of bones are placed in their components to improve granularity. */ + if (RNA_struct_is_a(ptr.type, &RNA_PoseBone)) { + const bPoseChannel *pchan = static_cast<const bPoseChannel *>(ptr.data); + ensure_operation_node( + id, NodeType::BONE, pchan->name, OperationCode::ID_PROPERTY, nullptr, prop_identifier); + } + else { + ensure_operation_node( + id, NodeType::PARAMETERS, OperationCode::ID_PROPERTY, nullptr, prop_identifier); + } } void DepsgraphNodeBuilder::build_parameters(ID *id) diff --git a/source/blender/depsgraph/intern/builder/deg_builder_nodes.h b/source/blender/depsgraph/intern/builder/deg_builder_nodes.h index 83bc33b6a4e..a1db4aaf693 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_nodes.h +++ b/source/blender/depsgraph/intern/builder/deg_builder_nodes.h @@ -135,6 +135,13 @@ class DepsgraphNodeBuilder : public DepsgraphBuilder { OperationNode *ensure_operation_node(ID *id, NodeType comp_type, + const char *comp_name, + OperationCode opcode, + const DepsEvalOperationCb &op = nullptr, + const char *name = "", + int name_tag = -1); + OperationNode *ensure_operation_node(ID *id, + NodeType comp_type, OperationCode opcode, const DepsEvalOperationCb &op = nullptr, const char *name = "", diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc index 558ea3dd6e0..1c09417e9ab 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc @@ -1729,8 +1729,17 @@ void DepsgraphRelationBuilder::build_driver_id_property(ID *id, const char *rna_ return; } const char *prop_identifier = RNA_property_identifier((PropertyRNA *)prop); - OperationKey id_property_key( - id, NodeType::PARAMETERS, OperationCode::ID_PROPERTY, prop_identifier); + /* Custom properties of bones are placed in their components to improve granularity. */ + OperationKey id_property_key; + if (RNA_struct_is_a(ptr.type, &RNA_PoseBone)) { + const bPoseChannel *pchan = static_cast<const bPoseChannel *>(ptr.data); + id_property_key = OperationKey( + id, NodeType::BONE, pchan->name, OperationCode::ID_PROPERTY, prop_identifier); + } + else { + id_property_key = OperationKey( + id, NodeType::PARAMETERS, OperationCode::ID_PROPERTY, prop_identifier); + } OperationKey parameters_exit_key(id, NodeType::PARAMETERS, OperationCode::PARAMETERS_EXIT); add_relation( id_property_key, parameters_exit_key, "ID Property -> Done", RELATION_CHECK_BEFORE_ADD); @@ -2521,8 +2530,13 @@ void DepsgraphRelationBuilder::build_nodetree(bNodeTree *ntree) * changed. The parent node group is currently explicitly tagged for update in * #ED_node_tree_propagate_change. In the future we could move this relation to the * depsgraph, but then the depsgraph has to do some more static analysis of the node tree to - * see which groups the output actually depends on. */ - add_relation(group_output_key, ntree_output_key, "Group Node", RELATION_FLAG_NO_FLUSH); + * see which groups the output actually depends on. + * + * Furthermore, shader nodes currently depend on relations being created from e.g. objects to + * nodes. Geometry nodes do not depend on these relations, because they are explicitly + * created by the modifier (which is the thing that actually depends on the objects). */ + const int relation_flag = (group_ntree->type == NTREE_SHADER) ? 0 : RELATION_FLAG_NO_FLUSH; + add_relation(group_output_key, ntree_output_key, "Group Node", relation_flag); } else { BLI_assert_msg(0, "Unknown ID type used for node"); 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 3039eebe857..856e37ee473 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_relations_rig.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_relations_rig.cc @@ -49,6 +49,7 @@ #include "DEG_depsgraph_build.h" #include "intern/builder/deg_builder.h" +#include "intern/builder/deg_builder_cache.h" #include "intern/builder/deg_builder_pchanmap.h" #include "intern/debug/deg_debug.h" #include "intern/node/deg_node.h" @@ -84,14 +85,21 @@ void DepsgraphRelationBuilder::build_ik_pose(Object *object, OperationKey solver_key( &object->id, NodeType::EVAL_POSE, rootchan->name, OperationCode::POSE_IK_SOLVER); OperationKey pose_cleanup_key(&object->id, NodeType::EVAL_POSE, OperationCode::POSE_CLEANUP); - add_relation(pchan_local_key, init_ik_key, "IK Constraint -> Init IK Tree"); + /* If any of the constraint parameters are animated, connect the relation. Since there is only + * one Init IK node per armature, this link has quite high risk of spurious dependency cycles. + */ + const bool is_itasc = (object->pose->iksolver == IKSOLVER_ITASC); + PointerRNA con_ptr; + RNA_pointer_create(&object->id, &RNA_Constraint, con, &con_ptr); + if (is_itasc || cache_->isAnyPropertyAnimated(&con_ptr)) { + add_relation(pchan_local_key, init_ik_key, "IK Constraint -> Init IK Tree"); + } add_relation(init_ik_key, solver_key, "Init IK -> IK Solver"); /* Never cleanup before solver is run. */ add_relation(solver_key, pose_cleanup_key, "IK Solver -> Cleanup", RELATION_FLAG_GODMODE); /* The ITASC solver currently accesses the target transforms in init tree :( * TODO: Fix ITASC and remove this. */ - bool is_itasc = (object->pose->iksolver == IKSOLVER_ITASC); OperationKey target_dependent_key = is_itasc ? init_ik_key : solver_key; /* IK target */ /* TODO(sergey): This should get handled as part of the constraint code. */ @@ -100,6 +108,10 @@ void DepsgraphRelationBuilder::build_ik_pose(Object *object, if (data->tar != object) { ComponentKey target_key(&data->tar->id, NodeType::TRANSFORM); add_relation(target_key, target_dependent_key, con->name); + /* Ensure target CoW is ready by the time IK tree is built just in case. */ + ComponentKey target_cow_key(&data->tar->id, NodeType::COPY_ON_WRITE); + add_relation( + target_cow_key, init_ik_key, "IK Target CoW -> Init IK Tree", RELATION_CHECK_BEFORE_ADD); } /* Subtarget references: */ if ((data->tar->type == OB_ARMATURE) && (data->subtarget[0])) { @@ -129,6 +141,10 @@ void DepsgraphRelationBuilder::build_ik_pose(Object *object, if (data->poletar != object) { ComponentKey target_key(&data->poletar->id, NodeType::TRANSFORM); add_relation(target_key, target_dependent_key, con->name); + /* Ensure target CoW is ready by the time IK tree is built just in case. */ + ComponentKey target_cow_key(&data->poletar->id, NodeType::COPY_ON_WRITE); + add_relation( + target_cow_key, init_ik_key, "IK Target CoW -> Init IK Tree", RELATION_CHECK_BEFORE_ADD); } /* Subtarget references: */ if ((data->poletar->type == OB_ARMATURE) && (data->polesubtarget[0])) { diff --git a/source/blender/depsgraph/intern/builder/deg_builder_rna.cc b/source/blender/depsgraph/intern/builder/deg_builder_rna.cc index 43d24125dc2..76a115a06c8 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_rna.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_rna.cc @@ -181,7 +181,15 @@ RNANodeIdentifier RNANodeQuery::construct_node_identifier(const PointerRNA *ptr, node_identifier.operation_name_tag = -1; /* Handling of commonly known scenarios. */ if (rna_prop_affects_parameters_node(ptr, prop)) { - node_identifier.type = NodeType::PARAMETERS; + /* Custom properties of bones are placed in their components to improve granularity. */ + if (RNA_struct_is_a(ptr->type, &RNA_PoseBone)) { + const bPoseChannel *pchan = static_cast<const bPoseChannel *>(ptr->data); + node_identifier.type = NodeType::BONE; + node_identifier.component_name = pchan->name; + } + else { + node_identifier.type = NodeType::PARAMETERS; + } node_identifier.operation_code = OperationCode::ID_PROPERTY; node_identifier.operation_name = RNA_property_identifier( reinterpret_cast<const PropertyRNA *>(prop)); diff --git a/source/blender/depsgraph/intern/depsgraph_query_iter.cc b/source/blender/depsgraph/intern/depsgraph_query_iter.cc index c84adbcde00..0b219dcbf5e 100644 --- a/source/blender/depsgraph/intern/depsgraph_query_iter.cc +++ b/source/blender/depsgraph/intern/depsgraph_query_iter.cc @@ -76,14 +76,8 @@ void deg_invalidate_iterator_work_data(DEGObjectIterData *data) #endif } -void verify_id_properties_freed(DEGObjectIterData *data) +void ensure_id_properties_freed(const Object *dupli_object, Object *temp_dupli_object) { - if (data->dupli_object_current == nullptr) { - /* We didn't enter duplication yet, so we can't have any dangling pointers. */ - return; - } - const Object *dupli_object = data->dupli_object_current->ob; - Object *temp_dupli_object = &data->temp_dupli_object; if (temp_dupli_object->id.properties == nullptr) { /* No ID properties in temp data-block -- no leak is possible. */ return; @@ -97,6 +91,35 @@ void verify_id_properties_freed(DEGObjectIterData *data) temp_dupli_object->id.properties = nullptr; } +void ensure_boundbox_freed(const Object *dupli_object, Object *temp_dupli_object) +{ + if (temp_dupli_object->runtime.bb == nullptr) { + /* No Bounding Box in temp data-block -- no leak is possible. */ + return; + } + if (temp_dupli_object->runtime.bb == dupli_object->runtime.bb) { + /* Temp copy of object did not modify Bounding Box. */ + return; + } + /* Free memory which is owned by temporary storage which is about to get overwritten. */ + MEM_freeN(temp_dupli_object->runtime.bb); + temp_dupli_object->runtime.bb = nullptr; +} + +void free_owned_memory(DEGObjectIterData *data) +{ + if (data->dupli_object_current == nullptr) { + /* We didn't enter duplication yet, so we can't have any dangling pointers. */ + return; + } + + const Object *dupli_object = data->dupli_object_current->ob; + Object *temp_dupli_object = &data->temp_dupli_object; + + ensure_id_properties_freed(dupli_object, temp_dupli_object); + ensure_boundbox_freed(dupli_object, temp_dupli_object); +} + bool deg_object_hide_original(eEvaluationMode eval_mode, Object *ob, DupliObject *dob) { /* Automatic hiding if this object is being instanced on verts/faces/frames @@ -153,7 +176,7 @@ bool deg_iterator_duplis_step(DEGObjectIterData *data) continue; } - verify_id_properties_freed(data); + free_owned_memory(data); data->dupli_object_current = dob; @@ -169,6 +192,8 @@ bool deg_iterator_duplis_step(DEGObjectIterData *data) copy_v4_v4(temp_dupli_object->color, dupli_parent->color); temp_dupli_object->runtime.select_id = dupli_parent->runtime.select_id; if (dob->ob->data != dob->ob_data) { + /* Do not modify the original boundbox. */ + temp_dupli_object->runtime.bb = nullptr; BKE_object_replace_data_on_shallow_copy(temp_dupli_object, dob->ob_data); } @@ -192,7 +217,7 @@ bool deg_iterator_duplis_step(DEGObjectIterData *data) return true; } - verify_id_properties_freed(data); + free_owned_memory(data); free_object_duplilist(data->dupli_list); data->dupli_parent = nullptr; data->dupli_list = nullptr; diff --git a/source/blender/draw/DRW_engine.h b/source/blender/draw/DRW_engine.h index 132f66ecb1e..7e411fff72b 100644 --- a/source/blender/draw/DRW_engine.h +++ b/source/blender/draw/DRW_engine.h @@ -107,9 +107,9 @@ void DRW_draw_render_loop_offscreen(struct Depsgraph *depsgraph, struct RenderEngineType *engine_type, struct ARegion *region, struct View3D *v3d, - const bool is_image_render, - const bool draw_background, - const bool do_color_management, + bool is_image_render, + bool draw_background, + bool do_color_management, struct GPUOffScreen *ofs, struct GPUViewport *viewport); void DRW_draw_render_loop_2d_ex(struct Depsgraph *depsgraph, @@ -125,7 +125,7 @@ void DRW_draw_select_loop(struct Depsgraph *depsgraph, bool use_obedit_skip, bool draw_surface, bool use_nearest, - const bool do_material_sub_selection, + bool do_material_sub_selection, const struct rcti *rect, DRW_SelectPassFn select_pass_fn, void *select_pass_user_data, diff --git a/source/blender/draw/DRW_select_buffer.h b/source/blender/draw/DRW_select_buffer.h index 18134558af8..0d5c417457c 100644 --- a/source/blender/draw/DRW_select_buffer.h +++ b/source/blender/draw/DRW_select_buffer.h @@ -82,10 +82,7 @@ typedef struct SELECTID_Context { /* draw_select_buffer.c */ -bool DRW_select_buffer_elem_get(const uint sel_id, - uint *r_elem, - uint *r_base_index, - char *r_elem_type); +bool DRW_select_buffer_elem_get(uint sel_id, uint *r_elem, uint *r_base_index, char *r_elem_type); uint DRW_select_buffer_context_offset_for_object_elem(struct Depsgraph *depsgraph, struct Object *object, char elem_type); @@ -116,7 +113,7 @@ uint *DRW_select_buffer_bitmap_from_circle(struct Depsgraph *depsgraph, struct ARegion *region, struct View3D *v3d, const int center[2], - const int radius, + int radius, uint *r_bitmap_len); /** * \param poly: The polygon coordinates. @@ -128,7 +125,7 @@ uint *DRW_select_buffer_bitmap_from_poly(struct Depsgraph *depsgraph, struct ARegion *region, struct View3D *v3d, const int poly[][2], - const int poly_len, + int poly_len, const struct rcti *rect, uint *r_bitmap_len); /** @@ -147,9 +144,7 @@ uint DRW_select_buffer_find_nearest_to_point(struct Depsgraph *depsgraph, struct ARegion *region, struct View3D *v3d, const int center[2], - const uint id_min, - const uint id_max, + uint id_min, + uint id_max, uint *dist); -void DRW_select_buffer_context_create(struct Base **bases, - const uint bases_len, - short select_mode); +void DRW_select_buffer_context_create(struct Base **bases, uint bases_len, short select_mode); diff --git a/source/blender/draw/engines/eevee/eevee_lightcache.h b/source/blender/draw/engines/eevee/eevee_lightcache.h index 589b035b8bd..240eecf9547 100644 --- a/source/blender/draw/engines/eevee/eevee_lightcache.h +++ b/source/blender/draw/engines/eevee/eevee_lightcache.h @@ -70,11 +70,8 @@ void EEVEE_lightbake_update_world_quick(struct EEVEE_ViewLayerData *sldata, /** * Light Cache. */ -struct LightCache *EEVEE_lightcache_create(const int grid_len, - const int cube_len, - const int cube_size, - const int vis_size, - const int irr_size[3]); +struct LightCache *EEVEE_lightcache_create( + int grid_len, int cube_len, int cube_size, int vis_size, const int irr_size[3]); void EEVEE_lightcache_free(struct LightCache *lcache); bool EEVEE_lightcache_load(struct LightCache *lcache); void EEVEE_lightcache_info_update(struct SceneEEVEE *eevee); diff --git a/source/blender/draw/engines/eevee/eevee_private.h b/source/blender/draw/engines/eevee/eevee_private.h index 34af8b6c58d..996716d6def 100644 --- a/source/blender/draw/engines/eevee/eevee_private.h +++ b/source/blender/draw/engines/eevee/eevee_private.h @@ -1499,7 +1499,7 @@ void EEVEE_temporal_sampling_create_view(EEVEE_Data *vedata); int EEVEE_temporal_sampling_sample_count_get(const Scene *scene, const EEVEE_StorageList *stl); int EEVEE_temporal_sampling_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata); void EEVEE_temporal_sampling_offset_calc(const double ht_point[2], - const float filter_size, + float filter_size, float r_offset[2]); void EEVEE_temporal_sampling_matrices_calc(EEVEE_EffectsInfo *effects, const double ht_point[2]); /** @@ -1533,7 +1533,7 @@ void EEVEE_volumes_free(void); void EEVEE_effects_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata, Object *camera, - const bool minimal); + bool minimal); void EEVEE_effects_cache_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata); void EEVEE_effects_draw_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata); /** diff --git a/source/blender/draw/engines/overlay/overlay_armature.c b/source/blender/draw/engines/overlay/overlay_armature.c index a754e81b949..6fdf410440d 100644 --- a/source/blender/draw/engines/overlay/overlay_armature.c +++ b/source/blender/draw/engines/overlay/overlay_armature.c @@ -139,6 +139,10 @@ void OVERLAY_armature_cache_init(OVERLAY_Data *vedata) pd->armature.do_pose_fade_geom = pd->armature.do_pose_xray && ((draw_ctx->object_mode & OB_MODE_WEIGHT_PAINT) == 0) && draw_ctx->object_pose != NULL; + + const float wire_alpha = pd->overlay.bone_wire_alpha; + const bool use_wire_alpha = (wire_alpha < 1.0f); + DRWState state; if (pd->armature.do_pose_fade_geom) { @@ -164,8 +168,8 @@ void OVERLAY_armature_cache_init(OVERLAY_Data *vedata) OVERLAY_InstanceFormats *formats = OVERLAY_shader_instance_formats_get(); OVERLAY_ArmatureCallBuffers *cb = &pd->armature_call_buffers[i]; - cb->custom_shapes_ghash = BLI_ghash_ptr_new(__func__); - cb->custom_shapes_transp_ghash = BLI_ghash_ptr_new(__func__); + cb->solid.custom_shapes_ghash = BLI_ghash_ptr_new(__func__); + cb->transp.custom_shapes_ghash = BLI_ghash_ptr_new(__func__); DRWPass **p_armature_ps = &psl->armature_ps[i]; DRWState infront_state = (DRW_state_is_select() && (i == 1)) ? DRW_STATE_IN_FRONT_SELECT : 0; @@ -189,44 +193,85 @@ void OVERLAY_armature_cache_init(OVERLAY_Data *vedata) grp = DRW_shgroup_create(sh, armature_ps); DRW_shgroup_uniform_block(grp, "globalsBlock", G_draw.block_ubo); DRW_shgroup_uniform_float_copy(grp, "alpha", 1.0f); - cb->point_solid = BUF_INSTANCE(grp, format, DRW_cache_bone_point_get()); + cb->solid.point_fill = BUF_INSTANCE(grp, format, DRW_cache_bone_point_get()); grp = DRW_shgroup_create(sh, armature_ps); DRW_shgroup_state_disable(grp, DRW_STATE_WRITE_DEPTH); DRW_shgroup_state_enable(grp, DRW_STATE_BLEND_ALPHA); - DRW_shgroup_uniform_float_copy(grp, "alpha", 0.4f); - cb->point_transp = BUF_INSTANCE(grp, format, DRW_cache_bone_point_get()); + DRW_shgroup_uniform_block(grp, "globalsBlock", G_draw.block_ubo); + DRW_shgroup_uniform_float_copy(grp, "alpha", wire_alpha * 0.4f); + cb->transp.point_fill = BUF_INSTANCE(grp, format, DRW_cache_bone_point_get()); sh = OVERLAY_shader_armature_shape(false); grp = DRW_shgroup_create(sh, armature_ps); DRW_shgroup_uniform_block(grp, "globalsBlock", G_draw.block_ubo); DRW_shgroup_uniform_float_copy(grp, "alpha", 1.0f); - cb->custom_solid = grp; - cb->box_solid = BUF_INSTANCE(grp, format, DRW_cache_bone_box_get()); - cb->octa_solid = BUF_INSTANCE(grp, format, DRW_cache_bone_octahedral_get()); + cb->solid.custom_fill = grp; + cb->solid.box_fill = BUF_INSTANCE(grp, format, DRW_cache_bone_box_get()); + cb->solid.octa_fill = BUF_INSTANCE(grp, format, DRW_cache_bone_octahedral_get()); grp = DRW_shgroup_create(sh, armature_ps); DRW_shgroup_state_disable(grp, DRW_STATE_WRITE_DEPTH); DRW_shgroup_state_enable(grp, DRW_STATE_BLEND_ALPHA); - DRW_shgroup_uniform_float_copy(grp, "alpha", 0.6f); - cb->custom_transp = grp; - cb->box_transp = BUF_INSTANCE(grp, format, DRW_cache_bone_box_get()); - cb->octa_transp = BUF_INSTANCE(grp, format, DRW_cache_bone_octahedral_get()); + DRW_shgroup_uniform_block(grp, "globalsBlock", G_draw.block_ubo); + DRW_shgroup_uniform_float_copy(grp, "alpha", wire_alpha * 0.6f); + cb->transp.custom_fill = grp; + cb->transp.box_fill = BUF_INSTANCE(grp, format, DRW_cache_bone_box_get()); + cb->transp.octa_fill = BUF_INSTANCE(grp, format, DRW_cache_bone_octahedral_get()); sh = OVERLAY_shader_armature_sphere(true); grp = DRW_shgroup_create(sh, armature_ps); DRW_shgroup_uniform_block(grp, "globalsBlock", G_draw.block_ubo); - cb->point_outline = BUF_INSTANCE(grp, format, DRW_cache_bone_point_wire_outline_get()); + DRW_shgroup_uniform_float_copy(grp, "alpha", 1.0f); + cb->solid.point_outline = BUF_INSTANCE(grp, format, DRW_cache_bone_point_wire_outline_get()); + + if (use_wire_alpha) { + grp = DRW_shgroup_create(sh, armature_ps); + DRW_shgroup_state_enable(grp, DRW_STATE_BLEND_ALPHA); + DRW_shgroup_uniform_block(grp, "globalsBlock", G_draw.block_ubo); + DRW_shgroup_uniform_float_copy(grp, "alpha", wire_alpha); + cb->transp.point_outline = BUF_INSTANCE( + grp, format, DRW_cache_bone_point_wire_outline_get()); + } + else { + cb->transp.point_outline = cb->solid.point_outline; + } sh = OVERLAY_shader_armature_shape(true); - cb->custom_outline = grp = DRW_shgroup_create(sh, armature_ps); + cb->solid.custom_outline = grp = DRW_shgroup_create(sh, armature_ps); DRW_shgroup_uniform_block(grp, "globalsBlock", G_draw.block_ubo); - cb->box_outline = BUF_INSTANCE(grp, format, DRW_cache_bone_box_wire_get()); - cb->octa_outline = BUF_INSTANCE(grp, format, DRW_cache_bone_octahedral_wire_get()); + DRW_shgroup_uniform_float_copy(grp, "alpha", 1.0f); + cb->solid.box_outline = BUF_INSTANCE(grp, format, DRW_cache_bone_box_wire_get()); + cb->solid.octa_outline = BUF_INSTANCE(grp, format, DRW_cache_bone_octahedral_wire_get()); + + if (use_wire_alpha) { + cb->transp.custom_outline = grp = DRW_shgroup_create(sh, armature_ps); + DRW_shgroup_state_enable(grp, DRW_STATE_BLEND_ALPHA); + DRW_shgroup_uniform_block(grp, "globalsBlock", G_draw.block_ubo); + DRW_shgroup_uniform_float_copy(grp, "alpha", wire_alpha); + cb->transp.box_outline = BUF_INSTANCE(grp, format, DRW_cache_bone_box_wire_get()); + cb->transp.octa_outline = BUF_INSTANCE(grp, format, DRW_cache_bone_octahedral_wire_get()); + } + else { + cb->transp.custom_outline = cb->solid.custom_outline; + cb->transp.box_outline = cb->solid.box_outline; + cb->transp.octa_outline = cb->solid.octa_outline; + } sh = OVERLAY_shader_armature_shape_wire(); - cb->custom_wire = grp = DRW_shgroup_create(sh, armature_ps); + cb->solid.custom_wire = grp = DRW_shgroup_create(sh, armature_ps); DRW_shgroup_uniform_block(grp, "globalsBlock", G_draw.block_ubo); + DRW_shgroup_uniform_float_copy(grp, "alpha", 1.0f); + + if (use_wire_alpha) { + cb->transp.custom_wire = grp = DRW_shgroup_create(sh, armature_ps); + DRW_shgroup_state_enable(grp, DRW_STATE_BLEND_ALPHA); + DRW_shgroup_uniform_block(grp, "globalsBlock", G_draw.block_ubo); + DRW_shgroup_uniform_float_copy(grp, "alpha", wire_alpha); + } + else { + cb->transp.custom_wire = cb->solid.custom_wire; + } } { format = formats->instance_extra; @@ -234,12 +279,35 @@ void OVERLAY_armature_cache_init(OVERLAY_Data *vedata) sh = OVERLAY_shader_armature_degrees_of_freedom_wire(); grp = DRW_shgroup_create(sh, armature_ps); DRW_shgroup_uniform_block(grp, "globalsBlock", G_draw.block_ubo); - cb->dof_lines = BUF_INSTANCE(grp, format, DRW_cache_bone_dof_lines_get()); + DRW_shgroup_uniform_float_copy(grp, "alpha", 1.0f); + cb->solid.dof_lines = BUF_INSTANCE(grp, format, DRW_cache_bone_dof_lines_get()); + + if (use_wire_alpha) { + grp = DRW_shgroup_create(sh, armature_ps); + DRW_shgroup_state_enable(grp, DRW_STATE_BLEND_ALPHA); + DRW_shgroup_uniform_block(grp, "globalsBlock", G_draw.block_ubo); + DRW_shgroup_uniform_float_copy(grp, "alpha", wire_alpha); + cb->transp.dof_lines = BUF_INSTANCE(grp, format, DRW_cache_bone_dof_lines_get()); + } + else { + cb->transp.dof_lines = cb->solid.dof_lines; + } sh = OVERLAY_shader_armature_degrees_of_freedom_solid(); grp = DRW_shgroup_create(sh, armature_transp_ps); DRW_shgroup_uniform_block(grp, "globalsBlock", G_draw.block_ubo); - cb->dof_sphere = BUF_INSTANCE(grp, format, DRW_cache_bone_dof_sphere_get()); + DRW_shgroup_uniform_float_copy(grp, "alpha", 1.0f); + cb->solid.dof_sphere = BUF_INSTANCE(grp, format, DRW_cache_bone_dof_sphere_get()); + + if (use_wire_alpha) { + grp = DRW_shgroup_create(sh, armature_transp_ps); + DRW_shgroup_uniform_block(grp, "globalsBlock", G_draw.block_ubo); + DRW_shgroup_uniform_float_copy(grp, "alpha", wire_alpha); + cb->transp.dof_sphere = BUF_INSTANCE(grp, format, DRW_cache_bone_dof_sphere_get()); + } + else { + cb->transp.dof_sphere = cb->solid.dof_sphere; + } } { format = formats->instance_bone_stick; @@ -247,7 +315,19 @@ void OVERLAY_armature_cache_init(OVERLAY_Data *vedata) sh = OVERLAY_shader_armature_stick(); grp = DRW_shgroup_create(sh, armature_ps); DRW_shgroup_uniform_block(grp, "globalsBlock", G_draw.block_ubo); - cb->stick = BUF_INSTANCE(grp, format, DRW_cache_bone_stick_get()); + DRW_shgroup_uniform_float_copy(grp, "alpha", 1.0f); + cb->solid.stick = BUF_INSTANCE(grp, format, DRW_cache_bone_stick_get()); + + if (use_wire_alpha) { + grp = DRW_shgroup_create(sh, armature_ps); + DRW_shgroup_state_enable(grp, DRW_STATE_BLEND_ALPHA); + DRW_shgroup_uniform_block(grp, "globalsBlock", G_draw.block_ubo); + DRW_shgroup_uniform_float_copy(grp, "alpha", wire_alpha); + cb->transp.stick = BUF_INSTANCE(grp, format, DRW_cache_bone_stick_get()); + } + else { + cb->transp.stick = cb->solid.stick; + } } { format = formats->instance_bone_envelope; @@ -258,29 +338,57 @@ void OVERLAY_armature_cache_init(OVERLAY_Data *vedata) DRW_shgroup_uniform_block(grp, "globalsBlock", G_draw.block_ubo); DRW_shgroup_uniform_bool_copy(grp, "isDistance", false); DRW_shgroup_uniform_float_copy(grp, "alpha", 1.0f); - cb->envelope_solid = BUF_INSTANCE(grp, format, DRW_cache_bone_envelope_solid_get()); + cb->solid.envelope_fill = BUF_INSTANCE(grp, format, DRW_cache_bone_envelope_solid_get()); grp = DRW_shgroup_create(sh, armature_ps); DRW_shgroup_state_disable(grp, DRW_STATE_WRITE_DEPTH); DRW_shgroup_state_enable(grp, DRW_STATE_BLEND_ALPHA | DRW_STATE_CULL_BACK); - DRW_shgroup_uniform_float_copy(grp, "alpha", 0.6f); - cb->envelope_transp = BUF_INSTANCE(grp, format, DRW_cache_bone_envelope_solid_get()); + DRW_shgroup_uniform_float_copy(grp, "alpha", wire_alpha * 0.6f); + cb->transp.envelope_fill = BUF_INSTANCE(grp, format, DRW_cache_bone_envelope_solid_get()); format = formats->instance_bone_envelope_outline; sh = OVERLAY_shader_armature_envelope(true); grp = DRW_shgroup_create(sh, armature_ps); DRW_shgroup_uniform_block(grp, "globalsBlock", G_draw.block_ubo); - cb->envelope_outline = BUF_INSTANCE(grp, format, DRW_cache_bone_envelope_outline_get()); + DRW_shgroup_uniform_float_copy(grp, "alpha", 1.0f); + cb->solid.envelope_outline = BUF_INSTANCE( + grp, format, DRW_cache_bone_envelope_outline_get()); + + if (use_wire_alpha) { + grp = DRW_shgroup_create(sh, armature_ps); + DRW_shgroup_state_enable(grp, DRW_STATE_BLEND_ALPHA); + DRW_shgroup_uniform_block(grp, "globalsBlock", G_draw.block_ubo); + DRW_shgroup_uniform_float_copy(grp, "alpha", wire_alpha); + cb->transp.envelope_outline = BUF_INSTANCE( + grp, format, DRW_cache_bone_envelope_outline_get()); + } + else { + cb->transp.envelope_outline = cb->solid.envelope_outline; + } format = formats->instance_bone_envelope_distance; sh = OVERLAY_shader_armature_envelope(false); grp = DRW_shgroup_create(sh, armature_transp_ps); DRW_shgroup_uniform_block(grp, "globalsBlock", G_draw.block_ubo); + DRW_shgroup_uniform_float_copy(grp, "alpha", 1.0f); DRW_shgroup_uniform_bool_copy(grp, "isDistance", true); DRW_shgroup_state_enable(grp, DRW_STATE_CULL_FRONT); - cb->envelope_distance = BUF_INSTANCE(grp, format, DRW_cache_bone_envelope_solid_get()); + cb->solid.envelope_distance = BUF_INSTANCE(grp, format, DRW_cache_bone_envelope_solid_get()); + + if (use_wire_alpha) { + grp = DRW_shgroup_create(sh, armature_transp_ps); + DRW_shgroup_uniform_block(grp, "globalsBlock", G_draw.block_ubo); + DRW_shgroup_uniform_float_copy(grp, "alpha", wire_alpha); + DRW_shgroup_uniform_bool_copy(grp, "isDistance", true); + DRW_shgroup_state_enable(grp, DRW_STATE_CULL_FRONT); + cb->transp.envelope_distance = BUF_INSTANCE( + grp, format, DRW_cache_bone_envelope_solid_get()); + } + else { + cb->transp.envelope_distance = cb->solid.envelope_distance; + } } { format = formats->pos_color; @@ -288,7 +396,19 @@ void OVERLAY_armature_cache_init(OVERLAY_Data *vedata) sh = OVERLAY_shader_armature_wire(); grp = DRW_shgroup_create(sh, armature_ps); DRW_shgroup_uniform_block(grp, "globalsBlock", G_draw.block_ubo); - cb->wire = BUF_LINE(grp, format); + DRW_shgroup_uniform_float_copy(grp, "alpha", 1.0f); + cb->solid.wire = BUF_LINE(grp, format); + + if (use_wire_alpha) { + grp = DRW_shgroup_create(sh, armature_ps); + DRW_shgroup_state_enable(grp, DRW_STATE_BLEND_ALPHA); + DRW_shgroup_uniform_block(grp, "globalsBlock", G_draw.block_ubo); + DRW_shgroup_uniform_float_copy(grp, "alpha", wire_alpha); + cb->transp.wire = BUF_LINE(grp, format); + } + else { + cb->transp.wire = cb->solid.wire; + } } } } @@ -2161,16 +2281,15 @@ static void armature_context_setup(ArmatureDrawContext *ctx, const bool is_filled = (!pd->armature.transparent && !draw_as_wire) || !is_object_mode; const bool is_transparent = pd->armature.transparent || (draw_as_wire && !is_object_mode); bArmature *arm = ob->data; - OVERLAY_ArmatureCallBuffers *cb = &pd->armature_call_buffers[is_xray]; + OVERLAY_ArmatureCallBuffers *cbo = &pd->armature_call_buffers[is_xray]; + OVERLAY_ArmatureCallBuffersInner *cb = is_transparent ? &cbo->transp : &cbo->solid; static const float select_const_color[4] = {1.0f, 1.0f, 1.0f, 1.0f}; switch (arm->drawtype) { case ARM_ENVELOPE: ctx->envelope_outline = cb->envelope_outline; - ctx->envelope_solid = (is_filled) ? - (is_transparent ? cb->envelope_transp : cb->envelope_solid) : - NULL; + ctx->envelope_solid = (is_filled) ? cb->envelope_fill : NULL; ctx->envelope_distance = (do_envelope_dist) ? cb->envelope_distance : NULL; break; case ARM_LINE: @@ -2181,24 +2300,23 @@ static void armature_context_setup(ArmatureDrawContext *ctx, break; case ARM_B_BONE: ctx->outline = cb->box_outline; - ctx->solid = (is_filled) ? (is_transparent ? cb->box_transp : cb->box_solid) : NULL; + ctx->solid = (is_filled) ? cb->box_fill : NULL; break; case ARM_OCTA: ctx->outline = cb->octa_outline; - ctx->solid = (is_filled) ? (is_transparent ? cb->octa_transp : cb->octa_solid) : NULL; + ctx->solid = (is_filled) ? cb->octa_fill : NULL; break; } ctx->ob = ob; ctx->extras = &pd->extra_call_buffers[is_xray]; ctx->dof_lines = cb->dof_lines; ctx->dof_sphere = cb->dof_sphere; - ctx->point_solid = (is_filled) ? (is_transparent ? cb->point_transp : cb->point_solid) : NULL; + ctx->point_solid = (is_filled) ? cb->point_fill : NULL; ctx->point_outline = cb->point_outline; - ctx->custom_solid = (is_filled) ? (is_transparent ? cb->custom_transp : cb->custom_solid) : NULL; + ctx->custom_solid = (is_filled) ? cb->custom_fill : NULL; ctx->custom_outline = cb->custom_outline; ctx->custom_wire = cb->custom_wire; - ctx->custom_shapes_ghash = is_transparent ? cb->custom_shapes_transp_ghash : - cb->custom_shapes_ghash; + ctx->custom_shapes_ghash = cb->custom_shapes_ghash; ctx->show_relations = pd->armature.show_relations; ctx->do_relations = !DRW_state_is_select() && pd->armature.show_relations && (is_edit_mode | is_pose_mode); @@ -2282,10 +2400,10 @@ void OVERLAY_armature_cache_finish(OVERLAY_Data *vedata) OVERLAY_PrivateData *pd = vedata->stl->pd; for (int i = 0; i < 2; i++) { - if (pd->armature_call_buffers[i].custom_shapes_ghash) { + if (pd->armature_call_buffers[i].solid.custom_shapes_ghash) { /* TODO(fclem): Do not free it for each frame but reuse it. Avoiding alloc cost. */ - BLI_ghash_free(pd->armature_call_buffers[i].custom_shapes_ghash, NULL, NULL); - BLI_ghash_free(pd->armature_call_buffers[i].custom_shapes_transp_ghash, NULL, NULL); + BLI_ghash_free(pd->armature_call_buffers[i].solid.custom_shapes_ghash, NULL, NULL); + BLI_ghash_free(pd->armature_call_buffers[i].transp.custom_shapes_ghash, NULL, NULL); } } } diff --git a/source/blender/draw/engines/overlay/overlay_private.h b/source/blender/draw/engines/overlay/overlay_private.h index 8e7c3094062..c8891a53213 100644 --- a/source/blender/draw/engines/overlay/overlay_private.h +++ b/source/blender/draw/engines/overlay/overlay_private.h @@ -216,37 +216,37 @@ typedef struct OVERLAY_ExtraCallBuffers { DRWShadingGroup *extra_loose_points; } OVERLAY_ExtraCallBuffers; -typedef struct OVERLAY_ArmatureCallBuffers { +typedef struct OVERLAY_ArmatureCallBuffersInner { DRWCallBuffer *box_outline; - DRWCallBuffer *box_solid; - DRWCallBuffer *box_transp; + DRWCallBuffer *box_fill; DRWCallBuffer *dof_lines; DRWCallBuffer *dof_sphere; DRWCallBuffer *envelope_distance; DRWCallBuffer *envelope_outline; - DRWCallBuffer *envelope_solid; - DRWCallBuffer *envelope_transp; + DRWCallBuffer *envelope_fill; DRWCallBuffer *octa_outline; - DRWCallBuffer *octa_solid; - DRWCallBuffer *octa_transp; + DRWCallBuffer *octa_fill; DRWCallBuffer *point_outline; - DRWCallBuffer *point_solid; - DRWCallBuffer *point_transp; + DRWCallBuffer *point_fill; DRWCallBuffer *stick; DRWCallBuffer *wire; DRWShadingGroup *custom_outline; - DRWShadingGroup *custom_solid; - DRWShadingGroup *custom_transp; + DRWShadingGroup *custom_fill; DRWShadingGroup *custom_wire; - GHash *custom_shapes_transp_ghash; + GHash *custom_shapes_ghash; +} OVERLAY_ArmatureCallBuffersInner; + +typedef struct OVERLAY_ArmatureCallBuffers { + OVERLAY_ArmatureCallBuffersInner solid; + OVERLAY_ArmatureCallBuffersInner transp; } OVERLAY_ArmatureCallBuffers; typedef struct OVERLAY_PrivateData { @@ -590,11 +590,11 @@ void OVERLAY_extra_line_dashed(OVERLAY_ExtraCallBuffers *cb, void OVERLAY_extra_line(OVERLAY_ExtraCallBuffers *cb, const float start[3], const float end[3], - const int color_id); + int color_id); void OVERLAY_empty_shape(OVERLAY_ExtraCallBuffers *cb, const float mat[4][4], - const float draw_size, - const char draw_type, + float draw_size, + char draw_type, const float color[4]); void OVERLAY_extra_loose_points(OVERLAY_ExtraCallBuffers *cb, struct GPUBatch *geom, diff --git a/source/blender/draw/engines/overlay/shaders/armature_dof_solid_frag.glsl b/source/blender/draw/engines/overlay/shaders/armature_dof_solid_frag.glsl index e511aab69c1..aedc9bcda61 100644 --- a/source/blender/draw/engines/overlay/shaders/armature_dof_solid_frag.glsl +++ b/source/blender/draw/engines/overlay/shaders/armature_dof_solid_frag.glsl @@ -1,4 +1,6 @@ +uniform float alpha = 1.0; + flat in vec4 finalColor; layout(location = 0) out vec4 fragColor; @@ -6,6 +8,6 @@ layout(location = 1) out vec4 lineOutput; void main() { - fragColor = finalColor; + fragColor = vec4(finalColor.rgb, finalColor.a * alpha); lineOutput = vec4(0.0); } diff --git a/source/blender/draw/engines/overlay/shaders/armature_envelope_solid_frag.glsl b/source/blender/draw/engines/overlay/shaders/armature_envelope_solid_frag.glsl index e4a4f0875f8..51cfe6250be 100644 --- a/source/blender/draw/engines/overlay/shaders/armature_envelope_solid_frag.glsl +++ b/source/blender/draw/engines/overlay/shaders/armature_envelope_solid_frag.glsl @@ -14,7 +14,7 @@ void main() float n = normalize(normalView).z; if (isDistance) { n = 1.0 - clamp(-n, 0.0, 1.0); - fragColor = vec4(1.0, 1.0, 1.0, 0.2) * n; + fragColor = vec4(1.0, 1.0, 1.0, 0.33 * alpha) * n; } else { /* Smooth lighting factor. */ diff --git a/source/blender/draw/engines/overlay/shaders/armature_stick_frag.glsl b/source/blender/draw/engines/overlay/shaders/armature_stick_frag.glsl index e7696c1ea7d..85136672180 100644 --- a/source/blender/draw/engines/overlay/shaders/armature_stick_frag.glsl +++ b/source/blender/draw/engines/overlay/shaders/armature_stick_frag.glsl @@ -1,4 +1,6 @@ +uniform float alpha = 1.0; + noperspective in float colorFac; flat in vec4 finalWireColor; flat in vec4 finalInnerColor; @@ -10,6 +12,6 @@ void main() { float fac = smoothstep(1.0, 0.2, colorFac); fragColor.rgb = mix(finalInnerColor.rgb, finalWireColor.rgb, fac); - fragColor.a = 1.0; + fragColor.a = alpha; lineOutput = vec4(0.0); } diff --git a/source/blender/draw/engines/overlay/shaders/armature_wire_frag.glsl b/source/blender/draw/engines/overlay/shaders/armature_wire_frag.glsl index 9413ac0f365..55278515f74 100644 --- a/source/blender/draw/engines/overlay/shaders/armature_wire_frag.glsl +++ b/source/blender/draw/engines/overlay/shaders/armature_wire_frag.glsl @@ -1,4 +1,6 @@ +uniform float alpha = 1.0; + flat in vec4 finalColor; flat in vec2 edgeStart; noperspective in vec2 edgePos; @@ -9,5 +11,5 @@ layout(location = 1) out vec4 lineOutput; void main() { lineOutput = pack_line_data(gl_FragCoord.xy, edgeStart, edgePos); - fragColor = finalColor; + fragColor = vec4(finalColor.rgb, finalColor.a * alpha); } diff --git a/source/blender/draw/engines/workbench/workbench_private.h b/source/blender/draw/engines/workbench/workbench_private.h index 42c873c7691..fb4600316ec 100644 --- a/source/blender/draw/engines/workbench/workbench_private.h +++ b/source/blender/draw/engines/workbench/workbench_private.h @@ -423,7 +423,7 @@ void workbench_transparent_draw_depth_pass(WORKBENCH_Data *data); /* workbench_shadow.c */ void workbench_shadow_data_update(WORKBENCH_PrivateData *wpd, WORKBENCH_UBO_World *wd); void workbench_shadow_cache_init(WORKBENCH_Data *data); -void workbench_shadow_cache_populate(WORKBENCH_Data *data, Object *ob, const bool has_transp_mat); +void workbench_shadow_cache_populate(WORKBENCH_Data *data, Object *ob, bool has_transp_mat); /* workbench_shader.c */ GPUShader *workbench_shader_opaque_get(WORKBENCH_PrivateData *wpd, eWORKBENCH_DataType data); diff --git a/source/blender/draw/intern/DRW_render.h b/source/blender/draw/intern/DRW_render.h index 6c4744cb104..b16caf49209 100644 --- a/source/blender/draw/intern/DRW_render.h +++ b/source/blender/draw/intern/DRW_render.h @@ -226,9 +226,9 @@ struct GPUShader *DRW_shader_create_with_shaderlib_ex(const char *vert, struct GPUShader *DRW_shader_create_with_transform_feedback(const char *vert, const char *geom, const char *defines, - const eGPUShaderTFBType prim_type, + eGPUShaderTFBType prim_type, const char **varying_names, - const int varying_count); + int varying_count); struct GPUShader *DRW_shader_create_fullscreen_ex(const char *frag, const char *defines, const char *name); @@ -249,18 +249,18 @@ struct GPUShader *DRW_shader_create_fullscreen_with_shaderlib_ex(const char *fra struct GPUMaterial *DRW_shader_find_from_world(struct World *wo, const void *engine_type, - const int options, + int options, bool deferred); struct GPUMaterial *DRW_shader_find_from_material(struct Material *ma, const void *engine_type, - const int options, + int options, bool deferred); struct GPUMaterial *DRW_shader_create_from_world(struct Scene *scene, struct World *wo, struct bNodeTree *ntree, const void *engine_type, - const int options, - const bool is_volume_shader, + int options, + bool is_volume_shader, const char *vert, const char *geom, const char *frag_lib, @@ -271,8 +271,8 @@ struct GPUMaterial *DRW_shader_create_from_material(struct Scene *scene, struct Material *ma, struct bNodeTree *ntree, const void *engine_type, - const int options, - const bool is_volume_shader, + int options, + bool is_volume_shader, const char *vert, const char *geom, const char *frag_lib, @@ -609,12 +609,12 @@ void DRW_shgroup_uniform_image_ref(DRWShadingGroup *shgroup, const char *name, G /* Store value instead of referencing it. */ -void DRW_shgroup_uniform_int_copy(DRWShadingGroup *shgroup, const char *name, const int value); +void DRW_shgroup_uniform_int_copy(DRWShadingGroup *shgroup, const char *name, int value); void DRW_shgroup_uniform_ivec2_copy(DRWShadingGroup *shgroup, const char *name, const int *value); void DRW_shgroup_uniform_ivec3_copy(DRWShadingGroup *shgroup, const char *name, const int *value); void DRW_shgroup_uniform_ivec4_copy(DRWShadingGroup *shgroup, const char *name, const int *value); -void DRW_shgroup_uniform_bool_copy(DRWShadingGroup *shgroup, const char *name, const bool value); -void DRW_shgroup_uniform_float_copy(DRWShadingGroup *shgroup, const char *name, const float value); +void DRW_shgroup_uniform_bool_copy(DRWShadingGroup *shgroup, const char *name, bool value); +void DRW_shgroup_uniform_float_copy(DRWShadingGroup *shgroup, const char *name, float value); void DRW_shgroup_uniform_vec2_copy(DRWShadingGroup *shgroup, const char *name, const float *value); void DRW_shgroup_uniform_vec3_copy(DRWShadingGroup *shgroup, const char *name, const float *value); void DRW_shgroup_uniform_vec4_copy(DRWShadingGroup *shgroup, const char *name, const float *value); diff --git a/source/blender/draw/intern/draw_cache.h b/source/blender/draw/intern/draw_cache.h index 7fcd86669ec..30e5a10df91 100644 --- a/source/blender/draw/intern/draw_cache.h +++ b/source/blender/draw/intern/draw_cache.h @@ -67,7 +67,7 @@ struct GPUBatch *DRW_cache_quad_wires_get(void); struct GPUBatch *DRW_cache_cube_get(void); struct GPUBatch *DRW_cache_normal_arrow_get(void); -struct GPUBatch *DRW_cache_sphere_get(const eDRWLevelOfDetail level_of_detail); +struct GPUBatch *DRW_cache_sphere_get(eDRWLevelOfDetail level_of_detail); /* Dummy VBOs */ diff --git a/source/blender/draw/intern/draw_cache_extract.h b/source/blender/draw/intern/draw_cache_extract.h index 6de9788b434..bd4edaf09fb 100644 --- a/source/blender/draw/intern/draw_cache_extract.h +++ b/source/blender/draw/intern/draw_cache_extract.h @@ -329,16 +329,16 @@ void mesh_buffer_cache_create_requested(struct TaskGraph *task_graph, MeshBatchCache *cache, MeshBufferCache *mbc, Mesh *me, - const bool is_editmode, - const bool is_paint_mode, - const bool is_mode_active, + bool is_editmode, + bool is_paint_mode, + bool is_mode_active, const float obmat[4][4], - const bool do_final, - const bool do_uvedit, - const bool use_subsurf_fdots, + bool do_final, + bool do_uvedit, + bool use_subsurf_fdots, const Scene *scene, const struct ToolSettings *ts, - const bool use_hide); + bool use_hide); void mesh_buffer_cache_create_requested_subdiv(MeshBatchCache *cache, MeshBufferCache *mbc, diff --git a/source/blender/draw/intern/draw_cache_extract_mesh.cc b/source/blender/draw/intern/draw_cache_extract_mesh.cc index 383a3b05b67..eed015bc212 100644 --- a/source/blender/draw/intern/draw_cache_extract_mesh.cc +++ b/source/blender/draw/intern/draw_cache_extract_mesh.cc @@ -869,7 +869,7 @@ static void mesh_buffer_cache_create_requested_subdiv(MeshBatchCache *cache, } if (extractor->finish_subdiv) { - extractor->finish_subdiv(subdiv_cache, buffer, data); + extractor->finish_subdiv(subdiv_cache, &mr, cache, buffer, data); } } MEM_freeN(data_stack); diff --git a/source/blender/draw/intern/draw_cache_impl.h b/source/blender/draw/intern/draw_cache_impl.h index 80b8c0506e7..77b507bc2b6 100644 --- a/source/blender/draw/intern/draw_cache_impl.h +++ b/source/blender/draw/intern/draw_cache_impl.h @@ -105,7 +105,7 @@ void DRW_mesh_batch_cache_free_old(struct Mesh *me, int ctime); /** \name Generic * \{ */ -void DRW_vertbuf_create_wiredata(struct GPUVertBuf *vbo, const int vert_len); +void DRW_vertbuf_create_wiredata(struct GPUVertBuf *vbo, int vert_len); /** \} */ @@ -178,7 +178,7 @@ void DRW_displist_indexbuf_create_edges_adjacency_lines(struct ListBase *lb, struct GPUBatch *DRW_lattice_batch_cache_get_all_edges(struct Lattice *lt, bool use_weight, - const int actdef); + int actdef); struct GPUBatch *DRW_lattice_batch_cache_get_all_verts(struct Lattice *lt); struct GPUBatch *DRW_lattice_batch_cache_get_edit_verts(struct Lattice *lt); @@ -228,8 +228,8 @@ void DRW_mesh_batch_cache_create_requested(struct TaskGraph *task_graph, struct Object *ob, struct Mesh *me, const struct Scene *scene, - const bool is_paint_mode, - const bool use_hide); + bool is_paint_mode, + bool use_hide); struct GPUBatch *DRW_mesh_batch_cache_get_all_verts(struct Mesh *me); struct GPUBatch *DRW_mesh_batch_cache_get_all_edges(struct Mesh *me); diff --git a/source/blender/draw/intern/draw_cache_impl_subdivision.cc b/source/blender/draw/intern/draw_cache_impl_subdivision.cc index 06b83a379e4..372566a8f90 100644 --- a/source/blender/draw/intern/draw_cache_impl_subdivision.cc +++ b/source/blender/draw/intern/draw_cache_impl_subdivision.cc @@ -258,10 +258,11 @@ static GPUShader *get_patch_evaluation_shader(int shader_type) static GPUShader *get_subdiv_shader(int shader_type, const char *defines) { - if (shader_type == SHADER_PATCH_EVALUATION || - shader_type == SHADER_PATCH_EVALUATION_LIMIT_NORMALS || - shader_type == SHADER_PATCH_EVALUATION_FVAR || - shader_type == SHADER_PATCH_EVALUATION_FACE_DOTS) { + if (ELEM(shader_type, + SHADER_PATCH_EVALUATION, + SHADER_PATCH_EVALUATION_LIMIT_NORMALS, + SHADER_PATCH_EVALUATION_FVAR, + SHADER_PATCH_EVALUATION_FACE_DOTS)) { return get_patch_evaluation_shader(shader_type); } if (g_subdiv_shaders[shader_type] == nullptr) { diff --git a/source/blender/draw/intern/draw_debug.h b/source/blender/draw/intern/draw_debug.h index 2f1a082af96..2616bc0af97 100644 --- a/source/blender/draw/intern/draw_debug.h +++ b/source/blender/draw/intern/draw_debug.h @@ -28,11 +28,11 @@ void DRW_debug_modelmat_reset(void); void DRW_debug_modelmat(const float modelmat[4][4]); void DRW_debug_line_v3v3(const float v1[3], const float v2[3], const float color[4]); -void DRW_debug_polygon_v3(const float (*v)[3], const int vert_len, const float color[4]); +void DRW_debug_polygon_v3(const float (*v)[3], int vert_len, const float color[4]); /** * \note g_modelmat is still applied on top. */ void DRW_debug_m4(const float m[4][4]); -void DRW_debug_m4_as_bbox(const float m[4][4], const float color[4], const bool invert); +void DRW_debug_m4_as_bbox(const float m[4][4], const float color[4], bool invert); void DRW_debug_bbox(const BoundBox *bbox, const float color[4]); -void DRW_debug_sphere(const float center[3], const float radius, const float color[4]); +void DRW_debug_sphere(const float center[3], float radius, const float color[4]); diff --git a/source/blender/draw/intern/draw_manager.c b/source/blender/draw/intern/draw_manager.c index 94950a1ff94..1c7a02339bc 100644 --- a/source/blender/draw/intern/draw_manager.c +++ b/source/blender/draw/intern/draw_manager.c @@ -757,8 +757,11 @@ static void duplidata_key_free(void *key) } else { Object temp_object = *dupli_key->ob; + /* Do not modify the original bound-box. */ + temp_object.runtime.bb = NULL; BKE_object_replace_data_on_shallow_copy(&temp_object, dupli_key->ob_data); drw_batch_cache_generate_requested(&temp_object); + MEM_SAFE_FREE(temp_object.runtime.bb); } MEM_freeN(key); } diff --git a/source/blender/draw/intern/draw_manager_text.h b/source/blender/draw/intern/draw_manager_text.h index 000a6ab5e6f..098b636cc98 100644 --- a/source/blender/draw/intern/draw_manager_text.h +++ b/source/blender/draw/intern/draw_manager_text.h @@ -38,7 +38,7 @@ void DRW_text_cache_destroy(struct DRWTextStore *dt); void DRW_text_cache_add(struct DRWTextStore *dt, const float co[3], const char *str, - const int str_len, + int str_len, short xoffs, short yoffs, short flag, diff --git a/source/blender/draw/intern/draw_subdivision.h b/source/blender/draw/intern/draw_subdivision.h index d36bfe87689..9dfcdabc0fe 100644 --- a/source/blender/draw/intern/draw_subdivision.h +++ b/source/blender/draw/intern/draw_subdivision.h @@ -178,7 +178,7 @@ void draw_subdiv_finalize_normals(const DRWSubdivCache *cache, void draw_subdiv_extract_pos_nor(const DRWSubdivCache *cache, struct GPUVertBuf *pos_nor, - const bool do_limit_normals); + bool do_limit_normals); void draw_subdiv_interp_custom_data(const DRWSubdivCache *cache, struct GPUVertBuf *src_data, @@ -188,8 +188,8 @@ void draw_subdiv_interp_custom_data(const DRWSubdivCache *cache, void draw_subdiv_extract_uvs(const DRWSubdivCache *cache, struct GPUVertBuf *uvs, - const int face_varying_channel, - const int dst_offset); + int face_varying_channel, + int dst_offset); void draw_subdiv_build_edge_fac_buffer(const DRWSubdivCache *cache, struct GPUVertBuf *pos_nor, @@ -198,7 +198,7 @@ void draw_subdiv_build_edge_fac_buffer(const DRWSubdivCache *cache, void draw_subdiv_build_tris_buffer(const DRWSubdivCache *cache, struct GPUIndexBuf *subdiv_tris, - const int material_count); + int material_count); void draw_subdiv_build_lines_buffer(const DRWSubdivCache *cache, struct GPUIndexBuf *lines_indices); diff --git a/source/blender/draw/intern/mesh_extractors/extract_mesh.h b/source/blender/draw/intern/mesh_extractors/extract_mesh.h index 35cc2cf986e..2db8f721e76 100644 --- a/source/blender/draw/intern/mesh_extractors/extract_mesh.h +++ b/source/blender/draw/intern/mesh_extractors/extract_mesh.h @@ -173,37 +173,34 @@ BLI_INLINE const float *bm_face_no_get(const MeshRenderData *mr, const BMFace *e /* TODO(jbakker): move parameters inside a struct. */ -typedef void(ExtractTriBMeshFn)(const MeshRenderData *mr, - BMLoop **elt, - const int elt_index, - void *data); +typedef void(ExtractTriBMeshFn)(const MeshRenderData *mr, BMLoop **elt, int elt_index, void *data); typedef void(ExtractTriMeshFn)(const MeshRenderData *mr, const MLoopTri *mlt, - const int elt_index, + int elt_index, void *data); typedef void(ExtractPolyBMeshFn)(const MeshRenderData *mr, const BMFace *f, - const int f_index, + int f_index, void *data); typedef void(ExtractPolyMeshFn)(const MeshRenderData *mr, const MPoly *mp, - const int mp_index, + int mp_index, void *data); typedef void(ExtractLEdgeBMeshFn)(const MeshRenderData *mr, const BMEdge *eed, - const int ledge_index, + int ledge_index, void *data); typedef void(ExtractLEdgeMeshFn)(const MeshRenderData *mr, const MEdge *med, - const int ledge_index, + int ledge_index, void *data); typedef void(ExtractLVertBMeshFn)(const MeshRenderData *mr, const BMVert *eve, - const int lvert_index, + int lvert_index, void *data); typedef void(ExtractLVertMeshFn)(const MeshRenderData *mr, const MVert *mv, - const int lvert_index, + int lvert_index, void *data); typedef void(ExtractLooseGeomSubdivFn)(const struct DRWSubdivCache *subdiv_cache, const MeshRenderData *mr, @@ -229,6 +226,8 @@ typedef void(ExtractIterSubdivFn)(const struct DRWSubdivCache *subdiv_cache, const MeshRenderData *mr, void *data); typedef void(ExtractFinishSubdivFn)(const struct DRWSubdivCache *subdiv_cache, + const MeshRenderData *mr, + struct MeshBatchCache *cache, void *buf, void *data); @@ -273,28 +272,28 @@ typedef struct MeshExtract { * otherwise don't use modifiers as they are not from this object. */ MeshRenderData *mesh_render_data_create(Mesh *me, - const bool is_editmode, - const bool is_paint_mode, - const bool is_mode_active, + bool is_editmode, + bool is_paint_mode, + bool is_mode_active, const float obmat[4][4], - const bool do_final, - const bool do_uvedit, + bool do_final, + bool do_uvedit, const ToolSettings *ts); void mesh_render_data_free(MeshRenderData *mr); -void mesh_render_data_update_normals(MeshRenderData *mr, const eMRDataType data_flag); +void mesh_render_data_update_normals(MeshRenderData *mr, eMRDataType data_flag); void mesh_render_data_update_loose_geom(MeshRenderData *mr, MeshBufferCache *cache, - const eMRIterType iter_type, - const eMRDataType data_flag); + eMRIterType iter_type, + eMRDataType data_flag); void mesh_render_data_update_polys_sorted(MeshRenderData *mr, MeshBufferCache *cache, - const eMRDataType data_flag); + eMRDataType data_flag); /** * Part of the creation of the #MeshRenderData that happens in a thread. */ void mesh_render_data_update_looptris(MeshRenderData *mr, - const eMRIterType iter_type, - const eMRDataType data_flag); + eMRIterType iter_type, + eMRDataType data_flag); /* draw_cache_extract_mesh_extractors.c */ typedef struct EditLoopData { @@ -307,19 +306,19 @@ typedef struct EditLoopData { void *mesh_extract_buffer_get(const MeshExtract *extractor, MeshBufferList *mbuflist); eMRIterType mesh_extract_iter_type(const MeshExtract *ext); const MeshExtract *mesh_extract_override_get(const MeshExtract *extractor, - const bool do_hq_normals, - const bool do_single_mat); + bool do_hq_normals, + bool do_single_mat); void mesh_render_data_face_flag(const MeshRenderData *mr, const BMFace *efa, - const int cd_ofs, + int cd_ofs, EditLoopData *eattr); void mesh_render_data_loop_flag(const MeshRenderData *mr, BMLoop *l, - const int cd_ofs, + int cd_ofs, EditLoopData *eattr); void mesh_render_data_loop_edge_flag(const MeshRenderData *mr, BMLoop *l, - const int cd_ofs, + int cd_ofs, EditLoopData *eattr); extern const MeshExtract extract_tris; diff --git a/source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_edituv.cc b/source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_edituv.cc index 6a1691e8634..5cb77426438 100644 --- a/source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_edituv.cc +++ b/source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_edituv.cc @@ -139,6 +139,8 @@ static void extract_edituv_tris_iter_subdiv(const DRWSubdivCache *subdiv_cache, } static void extract_edituv_tris_finish_subdiv(const struct DRWSubdivCache *UNUSED(subdiv_cache), + const MeshRenderData *UNUSED(mr), + struct MeshBatchCache *UNUSED(cache), void *buf, void *_data) { @@ -282,6 +284,8 @@ static void extract_edituv_lines_iter_subdiv(const DRWSubdivCache *subdiv_cache, } static void extract_edituv_lines_finish_subdiv(const struct DRWSubdivCache *UNUSED(subdiv_cache), + const MeshRenderData *UNUSED(mr), + struct MeshBatchCache *UNUSED(cache), void *buf, void *_data) { @@ -413,6 +417,8 @@ static void extract_edituv_points_iter_subdiv(const DRWSubdivCache *subdiv_cache } static void extract_edituv_points_finish_subdiv(const struct DRWSubdivCache *UNUSED(subdiv_cache), + const MeshRenderData *UNUSED(mr), + struct MeshBatchCache *UNUSED(cache), void *buf, void *_data) { 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 6855feb51ed..f125593cff2 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 @@ -193,7 +193,7 @@ static void extract_lines_adjacency_init_subdiv(const DRWSubdivCache *subdiv_cac * total: (number_of_loops + number_of_quads). */ const uint tess_len = subdiv_cache->num_subdiv_loops + subdiv_cache->num_subdiv_quads; line_adjacency_data_init( - data, tess_len, subdiv_cache->num_subdiv_verts, subdiv_cache->num_subdiv_loops); + data, subdiv_cache->num_subdiv_verts, subdiv_cache->num_subdiv_loops, tess_len); } static void extract_lines_adjacency_iter_subdiv(const DRWSubdivCache *subdiv_cache, @@ -220,14 +220,12 @@ static void extract_lines_adjacency_iter_subdiv(const DRWSubdivCache *subdiv_cac } static void extract_lines_adjacency_finish_subdiv(const DRWSubdivCache *UNUSED(subdiv_cache), + const MeshRenderData *mr, + struct MeshBatchCache *cache, void *buf, void *_data) { - GPUIndexBuf *ibo = static_cast<GPUIndexBuf *>(buf); - MeshExtract_LineAdjacency_Data *data = static_cast<MeshExtract_LineAdjacency_Data *>(_data); - GPU_indexbuf_build_in_place(&data->elb, ibo); - BLI_edgehash_free(data->eh, nullptr); - MEM_freeN(data->vert_to_loop); + extract_lines_adjacency_finish(mr, cache, buf, _data); } #undef NO_EDGE diff --git a/source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_points.cc b/source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_points.cc index 19167772a42..3ea3e67a8da 100644 --- a/source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_points.cc +++ b/source/blender/draw/intern/mesh_extractors/extract_mesh_ibo_points.cc @@ -216,6 +216,8 @@ static void extract_points_loose_geom_subdiv(const DRWSubdivCache *subdiv_cache, } static void extract_points_finish_subdiv(const DRWSubdivCache *UNUSED(subdiv_cache), + const MeshRenderData *UNUSED(mr), + struct MeshBatchCache *UNUSED(cache), void *buf, void *_userdata) { diff --git a/source/blender/editors/armature/armature_intern.h b/source/blender/editors/armature/armature_intern.h index 97f8c0cf630..252cf806e34 100644 --- a/source/blender/editors/armature/armature_intern.h +++ b/source/blender/editors/armature/armature_intern.h @@ -297,7 +297,7 @@ void armature_tag_select_mirrored(struct bArmature *arm); * Helper function for tools to work on mirrored parts. * it leaves mirrored bones selected then too, which is a good indication of what happened. */ -void armature_select_mirrored_ex(struct bArmature *arm, const int flag); +void armature_select_mirrored_ex(struct bArmature *arm, int flag); void armature_select_mirrored(struct bArmature *arm); /** Only works when tagged. */ void armature_tag_unselect(struct bArmature *arm); diff --git a/source/blender/editors/curve/curve_intern.h b/source/blender/editors/curve/curve_intern.h index 03ddeebde42..0d17af1983d 100644 --- a/source/blender/editors/curve/curve_intern.h +++ b/source/blender/editors/curve/curve_intern.h @@ -155,7 +155,7 @@ void ed_editnurb_translate_flag(struct ListBase *editnurb, /** * Only for #OB_SURF. */ -bool ed_editnurb_extrude_flag(struct EditNurb *editnurb, const uint8_t flag); +bool ed_editnurb_extrude_flag(struct EditNurb *editnurb, uint8_t flag); /** * \param axis: is in world-space. * \param cent: is in object-space. diff --git a/source/blender/editors/gizmo_library/gizmo_library_intern.h b/source/blender/editors/gizmo_library/gizmo_library_intern.h index a75a6b9a6ef..4a481f4bc59 100644 --- a/source/blender/editors/gizmo_library/gizmo_library_intern.h +++ b/source/blender/editors/gizmo_library/gizmo_library_intern.h @@ -52,22 +52,19 @@ typedef struct GizmoInteraction { float precision_offset; } GizmoInteraction; -float gizmo_offset_from_value(GizmoCommonData *data, - const float value, - const bool constrained, - const bool inverted); +float gizmo_offset_from_value(GizmoCommonData *data, float value, bool constrained, bool inverted); float gizmo_value_from_offset(GizmoCommonData *data, GizmoInteraction *inter, - const float offset, - const bool constrained, - const bool inverted, - const bool use_precision); + float offset, + bool constrained, + bool inverted, + bool use_precision); void gizmo_property_data_update(struct wmGizmo *gz, GizmoCommonData *data, wmGizmoProperty *gz_prop, - const bool constrained, - const bool inverted); + bool constrained, + bool inverted); void gizmo_property_value_reset(bContext *C, const struct wmGizmo *gz, @@ -76,7 +73,7 @@ void gizmo_property_value_reset(bContext *C, /* -------------------------------------------------------------------- */ -void gizmo_color_get(const struct wmGizmo *gz, const bool highlight, float r_color[4]); +void gizmo_color_get(const struct wmGizmo *gz, bool highlight, float r_color[4]); /** * Takes mouse coordinates and returns them in relation to the gizmo. @@ -101,7 +98,7 @@ bool gizmo_window_project_3d( * Main draw call for #GizmoGeomInfo data */ void wm_gizmo_geometryinfo_draw(const struct GizmoGeomInfo *info, - const bool select, + bool select, const float color[4]); void wm_gizmo_vec_draw( const float color[4], const float (*verts)[3], uint vert_count, uint pos, uint primitive_type); diff --git a/source/blender/editors/gpencil/gpencil_edit.c b/source/blender/editors/gpencil/gpencil_edit.c index 2a656ac3aad..e71a56894d0 100644 --- a/source/blender/editors/gpencil/gpencil_edit.c +++ b/source/blender/editors/gpencil/gpencil_edit.c @@ -3956,8 +3956,8 @@ static void gpencil_smooth_stroke(bContext *C, wmOperator *op) } if (smooth_thickness) { /* thickness need to repeat process several times */ - for (int r2 = 0; r2 < 20; r2++) { - BKE_gpencil_stroke_smooth_thickness(gps, i, factor); + for (int r2 = 0; r2 < repeat * 2; r2++) { + BKE_gpencil_stroke_smooth_thickness(gps, i, 1.0f - factor); } } if (smooth_uv) { diff --git a/source/blender/editors/gpencil/gpencil_intern.h b/source/blender/editors/gpencil/gpencil_intern.h index 601780ea651..0802b806060 100644 --- a/source/blender/editors/gpencil/gpencil_intern.h +++ b/source/blender/editors/gpencil/gpencil_intern.h @@ -322,7 +322,7 @@ void gpencil_apply_parent_point(struct Depsgraph *depsgraph, * generic based on gpencil_point_to_xy_fl */ void gpencil_point_3d_to_xy(const GP_SpaceConversion *gsc, - const short flag, + short flag, const float pt[3], float xy[2]); @@ -410,7 +410,7 @@ int gpencil_delete_selected_point_wrap(bContext *C); * \param gps: Stroke data * \param subdivide: Number of times to subdivide */ -void gpencil_subdivide_stroke(bGPdata *gpd, bGPDstroke *gps, const int subdivide); +void gpencil_subdivide_stroke(bGPdata *gpd, bGPDstroke *gps, int subdivide); /* Layers Enums -------------------------------------- */ diff --git a/source/blender/editors/gpencil/gpencil_trace.h b/source/blender/editors/gpencil/gpencil_trace.h index 7c62288f65d..77fb823b3b6 100644 --- a/source/blender/editors/gpencil/gpencil_trace.h +++ b/source/blender/editors/gpencil/gpencil_trace.h @@ -91,7 +91,7 @@ void ED_gpencil_trace_bitmap_invert(const potrace_bitmap_t *bm); */ void ED_gpencil_trace_image_to_bitmap(struct ImBuf *ibuf, const potrace_bitmap_t *bm, - const float threshold); + float threshold); /** * Convert Potrace Bitmap to Grease Pencil strokes @@ -106,7 +106,7 @@ void ED_gpencil_trace_data_to_strokes(struct Main *bmain, struct Object *ob, struct bGPDframe *gpf, int32_t offset[2], - const float scale, - const float sample, - const int32_t resolution, - const int32_t thickness); + float scale, + float sample, + int32_t resolution, + int32_t thickness); diff --git a/source/blender/editors/include/ED_armature.h b/source/blender/editors/include/ED_armature.h index 0053bf5c865..7631bd35e79 100644 --- a/source/blender/editors/include/ED_armature.h +++ b/source/blender/editors/include/ED_armature.h @@ -94,7 +94,7 @@ struct EditBone *ED_armature_ebone_add_primitive(struct Object *obedit_arm, */ float ED_armature_ebone_roll_to_vector(const struct EditBone *bone, const float align_axis[3], - const bool axis_only); + bool axis_only); /** * \param centermode: 0 == do center, 1 == center new, 2 == center cursor. * @@ -105,8 +105,8 @@ void ED_armature_origin_set( /** * See #BKE_armature_transform for object-mode transform. */ -void ED_armature_edit_transform(struct bArmature *arm, const float mat[4][4], const bool do_props); -void ED_armature_transform(struct bArmature *arm, const float mat[4][4], const bool do_props); +void ED_armature_edit_transform(struct bArmature *arm, const float mat[4][4], bool do_props); +void ED_armature_transform(struct bArmature *arm, const float mat[4][4], bool do_props); /* armature_naming.c */ @@ -138,7 +138,7 @@ void ED_armature_bone_rename(struct Main *bmain, void ED_armature_bones_flip_names(struct Main *bmain, struct bArmature *arm, struct ListBase *bones_names, - const bool do_strip_numbers); + bool do_strip_numbers); /* armature_ops.c */ @@ -203,7 +203,7 @@ bool ED_armature_edit_select_pick( * * \note Visibility checks must be done by the caller. */ -bool ED_armature_edit_select_op_from_tagged(struct bArmature *arm, const int sel_op); +bool ED_armature_edit_select_op_from_tagged(struct bArmature *arm, int sel_op); /* armature_skinning.c */ @@ -215,8 +215,8 @@ void ED_object_vgroup_calc_from_armature(struct ReportList *reports, struct Scene *scene, struct Object *ob, struct Object *par, - const int mode, - const bool mirror); + int mode, + bool mirror); /* editarmature_undo.c */ @@ -251,7 +251,7 @@ bool ED_armature_ebone_is_child_recursive(struct EditBone *ebone_parent, * \return The shared parent or NULL. */ struct EditBone *ED_armature_ebone_find_shared_parent(struct EditBone *ebone_child[], - const unsigned int ebone_child_tot); + unsigned int ebone_child_tot); void ED_armature_ebone_to_mat3(struct EditBone *ebone, float r_mat[3][3]); void ED_armature_ebone_to_mat4(struct EditBone *ebone, float r_mat[4][4]); void ED_armature_ebone_from_mat3(struct EditBone *ebone, const float mat[3][3]); @@ -282,10 +282,10 @@ void ED_armature_ebone_listbase_temp_clear(struct ListBase *lb); /** * Free's bones and their properties. */ -void ED_armature_ebone_listbase_free(struct ListBase *lb, const bool do_id_user); +void ED_armature_ebone_listbase_free(struct ListBase *lb, bool do_id_user); void ED_armature_ebone_listbase_copy(struct ListBase *lb_dst, struct ListBase *lb_src, - const bool do_id_user); + bool do_id_user); int ED_armature_ebone_selectflag_get(const struct EditBone *ebone); void ED_armature_ebone_selectflag_set(struct EditBone *ebone, int flag); @@ -353,14 +353,14 @@ void ED_armature_pose_select_in_wpaint_mode(struct ViewLayer *view_layer, bool ED_pose_deselect_all_multi_ex(struct Base **bases, uint bases_len, int select_mode, - const bool ignore_visibility); -bool ED_pose_deselect_all_multi(struct bContext *C, int select_mode, const bool ignore_visibility); + bool ignore_visibility); +bool ED_pose_deselect_all_multi(struct bContext *C, int select_mode, bool ignore_visibility); /** * 'select_mode' is usual SEL_SELECT/SEL_DESELECT/SEL_TOGGLE/SEL_INVERT. * When true, 'ignore_visibility' makes this func also affect invisible bones * (hidden or on hidden layers). */ -bool ED_pose_deselect_all(struct Object *ob, int select_mode, const bool ignore_visibility); +bool ED_pose_deselect_all(struct Object *ob, int select_mode, bool ignore_visibility); void ED_pose_bone_select_tag_update(struct Object *ob); /** * Utility method for changing the selection status of a bone. diff --git a/source/blender/editors/include/ED_buttons.h b/source/blender/editors/include/ED_buttons.h index 79404aada41..c3479c10d58 100644 --- a/source/blender/editors/include/ED_buttons.h +++ b/source/blender/editors/include/ED_buttons.h @@ -36,7 +36,7 @@ struct bContext; * \return The total number of items in the array returned. */ int ED_buttons_tabs_list(struct SpaceProperties *sbuts, short *context_tabs_array); -bool ED_buttons_tab_has_search_result(struct SpaceProperties *sbuts, const int index); +bool ED_buttons_tab_has_search_result(struct SpaceProperties *sbuts, int index); void ED_buttons_search_string_set(struct SpaceProperties *sbuts, const char *value); int ED_buttons_search_string_length(struct SpaceProperties *sbuts); @@ -48,7 +48,7 @@ bool ED_buttons_should_sync_with_outliner(const struct bContext *C, void ED_buttons_set_context(const struct bContext *C, struct SpaceProperties *sbuts, PointerRNA *ptr, - const int context); + int context); #ifdef __cplusplus } diff --git a/source/blender/editors/include/ED_curve.h b/source/blender/editors/include/ED_curve.h index 805d42b6fbc..a9225a5db60 100644 --- a/source/blender/editors/include/ED_curve.h +++ b/source/blender/editors/include/ED_curve.h @@ -100,7 +100,7 @@ void ED_curve_editfont_load(struct Object *obedit); void ED_curve_editfont_make(struct Object *obedit); void ED_curve_editfont_free(struct Object *obedit); -void ED_text_to_object(struct bContext *C, const struct Text *text, const bool split_lines); +void ED_text_to_object(struct bContext *C, const struct Text *text, bool split_lines); void ED_curve_beztcpy(struct EditNurb *editnurb, struct BezTriple *dst, diff --git a/source/blender/editors/include/ED_file_indexer.h b/source/blender/editors/include/ED_file_indexer.h index 0afa8819def..3b19a738b90 100644 --- a/source/blender/editors/include/ED_file_indexer.h +++ b/source/blender/editors/include/ED_file_indexer.h @@ -146,7 +146,7 @@ void ED_file_indexer_entries_clear(FileIndexerEntries *indexer_entries); void ED_file_indexer_entries_extend_from_datablock_infos( FileIndexerEntries *indexer_entries, const LinkNode * /* BLODataBlockInfo */ datablock_infos, - const int idcode); + int idcode); #ifdef __cplusplus } diff --git a/source/blender/editors/include/ED_fileselect.h b/source/blender/editors/include/ED_fileselect.h index 460de58bdb2..0528057fb54 100644 --- a/source/blender/editors/include/ED_fileselect.h +++ b/source/blender/editors/include/ED_fileselect.h @@ -127,7 +127,7 @@ void ED_fileselect_set_params_from_userdef(struct SpaceFile *sfile); */ void ED_fileselect_params_to_userdef(struct SpaceFile *sfile, const int temp_win_size[2], - const bool is_maximized); + bool is_maximized); void ED_fileselect_init_layout(struct SpaceFile *sfile, struct ARegion *region); @@ -171,9 +171,7 @@ void ED_fileselect_activate_asset_catalog(const struct SpaceFile *sfile, bUUID c * Activate and select the file that corresponds to the given ID. * Pass deferred=true to wait for the next refresh before activating. */ -void ED_fileselect_activate_by_id(struct SpaceFile *sfile, - struct ID *asset_id, - const bool deferred); +void ED_fileselect_activate_by_id(struct SpaceFile *sfile, struct ID *asset_id, bool deferred); void ED_fileselect_deselect_all(struct SpaceFile *sfile); void ED_fileselect_activate_by_relpath(struct SpaceFile *sfile, const char *relative_path); @@ -256,7 +254,7 @@ char *ED_fsmenu_entry_get_name(struct FSMenuEntry *fsentry); void ED_fsmenu_entry_set_name(struct FSMenuEntry *fsentry, const char *name); int ED_fsmenu_entry_get_icon(struct FSMenuEntry *fsentry); -void ED_fsmenu_entry_set_icon(struct FSMenuEntry *fsentry, const int icon); +void ED_fsmenu_entry_set_icon(struct FSMenuEntry *fsentry, int icon); #ifdef __cplusplus } diff --git a/source/blender/editors/include/ED_gizmo_library.h b/source/blender/editors/include/ED_gizmo_library.h index 55beff40177..8d4177faa0c 100644 --- a/source/blender/editors/include/ED_gizmo_library.h +++ b/source/blender/editors/include/ED_gizmo_library.h @@ -65,7 +65,7 @@ void ED_gizmo_draw_preset_circle(const struct wmGizmo *gz, void ED_gizmo_draw_preset_facemap(const struct bContext *C, const struct wmGizmo *gz, struct Object *ob, - const int facemap, + int facemap, int select_id); /* -------------------------------------------------------------------- */ @@ -97,13 +97,13 @@ enum { * * \note Needs to be called before #WM_gizmo_target_property_def_rna! */ -void ED_gizmo_arrow3d_set_ui_range(struct wmGizmo *gz, const float min, const float max); +void ED_gizmo_arrow3d_set_ui_range(struct wmGizmo *gz, float min, float max); /** * Define a custom factor for arrow min/max distance. * * \note Needs to be called before #WM_gizmo_target_property_def_rna! */ -void ED_gizmo_arrow3d_set_range_fac(struct wmGizmo *gz, const float range_fac); +void ED_gizmo_arrow3d_set_range_fac(struct wmGizmo *gz, float range_fac); /* -------------------------------------------------------------------- */ /* Cage Gizmo */ @@ -248,9 +248,9 @@ struct Dial3dParams { }; void ED_gizmotypes_dial_3d_draw_util(const float matrix_basis[4][4], const float matrix_final[4][4], - const float line_width, + float line_width, const float color[4], - const bool select, + bool select, struct Dial3dParams *params); /* snap3d_gizmo.c */ diff --git a/source/blender/editors/include/ED_gpencil.h b/source/blender/editors/include/ED_gpencil.h index 49ca5a4c5a3..919ea3e4a6b 100644 --- a/source/blender/editors/include/ED_gpencil.h +++ b/source/blender/editors/include/ED_gpencil.h @@ -193,7 +193,7 @@ bool ED_gpencil_has_keyframe_v3d(struct Scene *scene, struct Object *ob, int cfr /* ----------- Stroke Editing Utilities ---------------- */ bool ED_gpencil_frame_has_selected_stroke(const struct bGPDframe *gpf); -bool ED_gpencil_layer_has_selected_stroke(const struct bGPDlayer *gpl, const bool is_multiedit); +bool ED_gpencil_layer_has_selected_stroke(const struct bGPDlayer *gpl, bool is_multiedit); /** * Check whether given stroke can be edited given the supplied context. @@ -250,12 +250,8 @@ void ED_annotation_draw_view3d(struct Scene *scene, struct View3D *v3d, struct ARegion *region, bool only3d); -void ED_annotation_draw_ex(struct Scene *scene, - struct bGPdata *gpd, - int winx, - int winy, - const int cfra, - const char spacetype); +void ED_annotation_draw_ex( + struct Scene *scene, struct bGPdata *gpd, int winx, int winy, int cfra, char spacetype); /* ----------- Grease-Pencil AnimEdit API ------------------ */ /** @@ -315,7 +311,7 @@ void ED_gpencil_layer_frames_duplicate(struct bGPDlayer *gpl); void ED_gpencil_layer_merge(struct bGPdata *gpd, struct bGPDlayer *gpl_src, struct bGPDlayer *gpl_dst, - const bool reverse); + bool reverse); /** * Set keyframe type for selected frames from given gp-layer @@ -348,14 +344,14 @@ bool ED_gpencil_anim_copybuf_copy(struct bAnimContext *ac); /** * Pastes keyframes from buffer, and reports success. */ -bool ED_gpencil_anim_copybuf_paste(struct bAnimContext *ac, const short copy_mode); +bool ED_gpencil_anim_copybuf_paste(struct bAnimContext *ac, short copy_mode); /* ------------ Grease-Pencil Undo System ------------------ */ int ED_gpencil_session_active(void); /** * \param step: eUndoStepDir. */ -int ED_undo_gpencil_step(struct bContext *C, const int step); /* eUndoStepDir. */ +int ED_undo_gpencil_step(struct bContext *C, int step); /* eUndoStepDir. */ /* ------------ Grease-Pencil Armature ------------------ */ bool ED_gpencil_add_armature(const struct bContext *C, @@ -410,7 +406,7 @@ void ED_gpencil_brush_draw_eraser(struct Brush *brush, int x, int y); */ void ED_gpencil_stroke_init_data(struct bGPDstroke *gps, const float *array, - const int totpoints, + int totpoints, const float mat[4][4]); /** @@ -457,7 +453,7 @@ void ED_gpencil_project_stroke_to_plane(const struct Scene *scene, struct bGPDlayer *gpl, struct bGPDstroke *gps, const float origin[3], - const int axis); + int axis); /** * Reproject given point to a plane locked to axis to avoid stroke offset * \param pt: Point to affect (used for input & output). @@ -467,7 +463,7 @@ void ED_gpencil_project_point_to_plane(const struct Scene *scene, struct bGPDlayer *gpl, const struct RegionView3D *rv3d, const float origin[3], - const int axis, + int axis, struct bGPDspoint *pt); /** * Get drawing reference point for conversion or projection of the stroke @@ -490,8 +486,8 @@ void ED_gpencil_stroke_reproject(struct Depsgraph *depsgraph, struct bGPDlayer *gpl, struct bGPDframe *gpf, struct bGPDstroke *gps, - const eGP_ReprojectModes mode, - const bool keep_original); + eGP_ReprojectModes mode, + bool keep_original); /** * Turn brush cursor in on/off. @@ -552,7 +548,7 @@ int ED_gpencil_select_stroke_segment(struct bGPdata *gpd, struct bGPDspoint *pt, bool select, bool insert, - const float scale, + float scale, float r_hita[3], float r_hitb[3]); @@ -566,7 +562,7 @@ void ED_gpencil_select_curve_toggle_all(struct bContext *C, int action); struct tGPspoint *ED_gpencil_sbuffer_ensure(struct tGPspoint *buffer_array, int *buffer_size, int *buffer_used, - const bool clear); + bool clear); void ED_gpencil_sbuffer_update_eval(struct bGPdata *gpd, struct Object *ob_eval); /** @@ -600,7 +596,7 @@ void ED_gpencil_init_random_settings(struct Brush *brush, bool ED_gpencil_stroke_check_collision(const struct GP_SpaceConversion *gsc, struct bGPDstroke *gps, const float mouse[2], - const int radius, + int radius, const float diff_mat[4][4]); /** * Check if a point is inside of the stroke. @@ -631,7 +627,7 @@ struct bGPDstroke *ED_gpencil_stroke_nearest_to_ends(struct bContext *C, struct bGPDstroke *gps, const float ctrl1[2], const float ctrl2[2], - const float radius, + float radius, int *r_index); /** * Get extremes of stroke in 2D using current view. @@ -649,12 +645,12 @@ struct bGPDstroke *ED_gpencil_stroke_join_and_trim(struct bGPdata *gpd, struct bGPDframe *gpf, struct bGPDstroke *gps, struct bGPDstroke *gps_dst, - const int pt_index); + int pt_index); /** * Close if the distance between extremes is below threshold. */ -void ED_gpencil_stroke_close_by_distance(struct bGPDstroke *gps, const float threshold); +void ED_gpencil_stroke_close_by_distance(struct bGPDstroke *gps, float threshold); #ifdef __cplusplus } diff --git a/source/blender/editors/include/ED_image.h b/source/blender/editors/include/ED_image.h index 3308ae2c178..c5e8c2ee096 100644 --- a/source/blender/editors/include/ED_image.h +++ b/source/blender/editors/include/ED_image.h @@ -44,18 +44,18 @@ struct wmWindowManager; struct View2D; /* image_draw.c */ -float ED_space_image_zoom_level(const struct View2D *v2d, const int grid_dimension); +float ED_space_image_zoom_level(const struct View2D *v2d, int grid_dimension); void ED_space_image_grid_steps(struct SpaceImage *sima, float grid_steps[SI_GRID_STEPS_LEN], - const int grid_dimension); + int grid_dimension); /** * Calculate the increment snapping value for UV/image editor based on the zoom factor * The code in here (except the offset part) is used in `grid_frag.glsl` (see `grid_res`) for * drawing the grid overlay for the UV/Image editor. */ -float ED_space_image_increment_snap_value(const int grid_dimesnions, +float ED_space_image_increment_snap_value(int grid_dimesnions, const float grid_steps[SI_GRID_STEPS_LEN], - const float zoom_factor); + float zoom_factor); /* image_edit.c, exported for transform. */ @@ -198,7 +198,7 @@ typedef struct ImageFrameRange { */ ListBase ED_image_filesel_detect_sequences(struct Main *bmain, struct wmOperator *op, - const bool detect_udim); + bool detect_udim); #ifdef __cplusplus } diff --git a/source/blender/editors/include/ED_keyframes_edit.h b/source/blender/editors/include/ED_keyframes_edit.h index a7b580d5257..c7e89030ee2 100644 --- a/source/blender/editors/include/ED_keyframes_edit.h +++ b/source/blender/editors/include/ED_keyframes_edit.h @@ -413,8 +413,8 @@ void ANIM_fcurves_copybuf_free(void); short copy_animedit_keys(struct bAnimContext *ac, ListBase *anim_data); short paste_animedit_keys(struct bAnimContext *ac, ListBase *anim_data, - const eKeyPasteOffset offset_mode, - const eKeyMergeMode merge_mode, + eKeyPasteOffset offset_mode, + eKeyMergeMode merge_mode, bool flip); /* ************************************************ */ diff --git a/source/blender/editors/include/ED_keyframes_keylist.h b/source/blender/editors/include/ED_keyframes_keylist.h index 4194444ca0f..36a30bd5ee6 100644 --- a/source/blender/editors/include/ED_keyframes_keylist.h +++ b/source/blender/editors/include/ED_keyframes_keylist.h @@ -140,12 +140,9 @@ typedef enum eKeyframeExtremeDrawOpts { struct AnimKeylist *ED_keylist_create(void); void ED_keylist_free(struct AnimKeylist *keylist); void ED_keylist_prepare_for_direct_access(struct AnimKeylist *keylist); -const struct ActKeyColumn *ED_keylist_find_exact(const struct AnimKeylist *keylist, - const float cfra); -const struct ActKeyColumn *ED_keylist_find_next(const struct AnimKeylist *keylist, - const float cfra); -const struct ActKeyColumn *ED_keylist_find_prev(const struct AnimKeylist *keylist, - const float cfra); +const struct ActKeyColumn *ED_keylist_find_exact(const struct AnimKeylist *keylist, float cfra); +const struct ActKeyColumn *ED_keylist_find_next(const struct AnimKeylist *keylist, float cfra); +const struct ActKeyColumn *ED_keylist_find_prev(const struct AnimKeylist *keylist, float cfra); const struct ActKeyColumn *ED_keylist_find_any_between(const struct AnimKeylist *keylist, const Range2f frame_range); bool ED_keylist_is_empty(const struct AnimKeylist *keylist); @@ -160,41 +157,39 @@ int64_t ED_keylist_array_len(const struct AnimKeylist *keylist); void fcurve_to_keylist(struct AnimData *adt, struct FCurve *fcu, struct AnimKeylist *keylist, - const int saction_flag); + int saction_flag); /* Action Group */ void agroup_to_keylist(struct AnimData *adt, struct bActionGroup *agrp, struct AnimKeylist *keylist, - const int saction_flag); + int saction_flag); /* Action */ void action_to_keylist(struct AnimData *adt, struct bAction *act, struct AnimKeylist *keylist, - const int saction_flag); + int saction_flag); /* Object */ void ob_to_keylist(struct bDopeSheet *ads, struct Object *ob, struct AnimKeylist *keylist, - const int saction_flag); + int saction_flag); /* Cache File */ void cachefile_to_keylist(struct bDopeSheet *ads, struct CacheFile *cache_file, struct AnimKeylist *keylist, - const int saction_flag); + int saction_flag); /* Scene */ void scene_to_keylist(struct bDopeSheet *ads, struct Scene *sce, struct AnimKeylist *keylist, - const int saction_flag); + int saction_flag); /* DopeSheet Summary */ -void summary_to_keylist(struct bAnimContext *ac, - struct AnimKeylist *keylist, - const int saction_flag); +void summary_to_keylist(struct bAnimContext *ac, struct AnimKeylist *keylist, int saction_flag); /* Grease Pencil datablock summary */ void gpencil_to_keylist(struct bDopeSheet *ads, struct bGPdata *gpd, struct AnimKeylist *keylist, - const bool active); + bool active); /* Grease Pencil Layer */ void gpl_to_keylist(struct bDopeSheet *ads, struct bGPDlayer *gpl, struct AnimKeylist *keylist); /* Mask */ diff --git a/source/blender/editors/include/ED_keyframing.h b/source/blender/editors/include/ED_keyframing.h index d539c7b688c..8d89555c732 100644 --- a/source/blender/editors/include/ED_keyframing.h +++ b/source/blender/editors/include/ED_keyframing.h @@ -62,7 +62,7 @@ struct NlaKeyframingContext; * \param use_autokey_mode: include settings from key-framing mode in the result * (i.e. replace only). */ -eInsertKeyFlags ANIM_get_keyframing_flags(struct Scene *scene, const bool use_autokey_mode); +eInsertKeyFlags ANIM_get_keyframing_flags(struct Scene *scene, bool use_autokey_mode); /* -------- */ @@ -81,15 +81,13 @@ struct FCurve *ED_action_fcurve_ensure(struct Main *bmain, const char group[], struct PointerRNA *ptr, const char rna_path[], - const int array_index); + int array_index); /** * Find the F-Curve from the Active Action, * for the given Animation Data block. This assumes that all the destinations are valid. */ -struct FCurve *ED_action_fcurve_find(struct bAction *act, - const char rna_path[], - const int array_index); +struct FCurve *ED_action_fcurve_find(struct bAction *act, const char rna_path[], int array_index); /* -------- */ @@ -449,11 +447,11 @@ typedef enum eDriverFCurveCreationMode { */ struct FCurve *verify_driver_fcurve(struct ID *id, const char rna_path[], - const int array_index, + int array_index, eDriverFCurveCreationMode creation_mode); struct FCurve *alloc_driver_fcurve(const char rna_path[], - const int array_index, + int array_index, eDriverFCurveCreationMode creation_mode); /* -------- */ diff --git a/source/blender/editors/include/ED_lattice.h b/source/blender/editors/include/ED_lattice.h index dc800d78007..3d779fd14ef 100644 --- a/source/blender/editors/include/ED_lattice.h +++ b/source/blender/editors/include/ED_lattice.h @@ -43,7 +43,7 @@ bool ED_lattice_flags_set(struct Object *obedit, int flag); bool ED_lattice_select_pick( struct bContext *C, const int mval[2], bool extend, bool deselect, bool toggle); -bool ED_lattice_deselect_all_multi_ex(struct Base **bases, const uint bases_len); +bool ED_lattice_deselect_all_multi_ex(struct Base **bases, uint bases_len); bool ED_lattice_deselect_all_multi(struct bContext *C); /* editlattice_undo.c */ diff --git a/source/blender/editors/include/ED_mask.h b/source/blender/editors/include/ED_mask.h index 3aab6882dc2..1a4c36acff9 100644 --- a/source/blender/editors/include/ED_mask.h +++ b/source/blender/editors/include/ED_mask.h @@ -79,7 +79,7 @@ bool ED_mask_selected_minmax(const struct bContext *C, /* mask_draw.c */ -void ED_mask_draw(const struct bContext *C, const char draw_flag, const char draw_type); +void ED_mask_draw(const struct bContext *C, char draw_flag, char draw_type); /** * Sets up the opengl context. * width, height are to match the values from #ED_mask_get_size(). @@ -87,26 +87,25 @@ void ED_mask_draw(const struct bContext *C, const char draw_flag, const char dra void ED_mask_draw_region(struct Depsgraph *depsgraph, struct Mask *mask, struct ARegion *region, - const char draw_flag, - const char draw_type, - const eMaskOverlayMode overlay_mode, - const int width_i, - const int height_i, - const float aspx, - const float aspy, - const bool do_scale_applied, - const bool do_draw_cb, + char draw_flag, + char draw_type, + eMaskOverlayMode overlay_mode, + int width_i, + int height_i, + float aspx, + float aspy, + bool do_scale_applied, + bool do_draw_cb, float stabmat[4][4], const struct bContext *C); -void ED_mask_draw_frames( - struct Mask *mask, struct ARegion *region, const int cfra, const int sfra, const int efra); +void ED_mask_draw_frames(struct Mask *mask, struct ARegion *region, int cfra, int sfra, int efra); /* mask_shapekey.c */ -void ED_mask_layer_shape_auto_key(struct MaskLayer *mask_layer, const int frame); -bool ED_mask_layer_shape_auto_key_all(struct Mask *mask, const int frame); -bool ED_mask_layer_shape_auto_key_select(struct Mask *mask, const int frame); +void ED_mask_layer_shape_auto_key(struct MaskLayer *mask_layer, int frame); +bool ED_mask_layer_shape_auto_key_all(struct Mask *mask, int frame); +bool ED_mask_layer_shape_auto_key_select(struct Mask *mask, int frame); /* ----------- Mask AnimEdit API ------------------ */ diff --git a/source/blender/editors/include/ED_mesh.h b/source/blender/editors/include/ED_mesh.h index 3d8bdd09711..c6f02cb3bcf 100644 --- a/source/blender/editors/include/ED_mesh.h +++ b/source/blender/editors/include/ED_mesh.h @@ -70,20 +70,20 @@ struct wmOperator; * (length of total verts). */ void EDBM_verts_mirror_cache_begin_ex(struct BMEditMesh *em, - const int axis, - const bool use_self, - const bool use_select, - const bool respecthide, - const bool use_topology, + int axis, + bool use_self, + bool use_select, + bool respecthide, + bool use_topology, float maxdist, int *r_index); void EDBM_verts_mirror_cache_begin(struct BMEditMesh *em, - const int axis, - const bool use_self, - const bool use_select, - const bool respecthide, - const bool use_topology); -void EDBM_verts_mirror_apply(struct BMEditMesh *em, const int sel_from, const int sel_to); + int axis, + bool use_self, + bool use_select, + bool respecthide, + bool use_topology); +void EDBM_verts_mirror_apply(struct BMEditMesh *em, int sel_from, int sel_to); struct BMVert *EDBM_verts_mirror_get(struct BMEditMesh *em, struct BMVert *v); struct BMEdge *EDBM_verts_mirror_get_edge(struct BMEditMesh *em, struct BMEdge *e); struct BMFace *EDBM_verts_mirror_get_face(struct BMEditMesh *em, struct BMFace *f); @@ -96,7 +96,7 @@ void EDBM_mesh_normals_update(struct BMEditMesh *em); void EDBM_mesh_clear(struct BMEditMesh *em); void EDBM_selectmode_to_scene(struct bContext *C); -void EDBM_mesh_make(struct Object *ob, const int select_mode, const bool add_key_index); +void EDBM_mesh_make(struct Object *ob, int select_mode, bool add_key_index); /** * Should only be called on the active edit-mesh, otherwise call #BKE_editmesh_free_data. */ @@ -115,10 +115,10 @@ void EDBM_mesh_load(struct Main *bmain, struct Object *ob); * edges select/deselect faces and vertices, and in face select mode faces select/deselect * 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); +void EDBM_select_more(struct BMEditMesh *em, bool use_face_step); +void EDBM_select_less(struct BMEditMesh *em, bool use_face_step); -void EDBM_selectmode_flush_ex(struct BMEditMesh *em, const short selectmode); +void EDBM_selectmode_flush_ex(struct BMEditMesh *em, short selectmode); void EDBM_selectmode_flush(struct BMEditMesh *em); void EDBM_deselect_flush(struct BMEditMesh *em); @@ -145,17 +145,17 @@ void EDBM_update(struct Mesh *me, const struct EDBMUpdate_Params *params); /** * Bad level call from Python API. */ -void EDBM_update_extern(struct Mesh *me, const bool do_tessellation, const bool is_destructive); +void EDBM_update_extern(struct Mesh *me, bool do_tessellation, bool is_destructive); /** * A specialized vert map used by stitch operator. */ struct UvElementMap *BM_uv_element_map_create(struct BMesh *bm, const struct Scene *scene, - const bool face_selected, - const bool uv_selected, - const bool use_winding, - const bool do_islands); + bool face_selected, + bool uv_selected, + bool use_winding, + bool do_islands); void BM_uv_element_map_free(struct UvElementMap *element_map); struct UvElement *BM_uv_element_get(struct UvElementMap *map, struct BMFace *efa, @@ -169,21 +169,17 @@ bool EDBM_uv_check(struct BMEditMesh *em); * last_sel, use em->act_face otherwise get the last selected face in the editselections * at the moment, last_sel is mainly useful for making sure the space image doesn't flicker. */ -struct BMFace *EDBM_uv_active_face_get(struct BMEditMesh *em, - const bool sloppy, - const bool selected); +struct BMFace *EDBM_uv_active_face_get(struct BMEditMesh *em, bool sloppy, bool selected); void BM_uv_vert_map_free(struct UvVertMap *vmap); struct UvMapVert *BM_uv_vert_map_at_index(struct UvVertMap *vmap, unsigned int v); /** * Return a new #UvVertMap from the edit-mesh. */ -struct UvVertMap *BM_uv_vert_map_create(struct BMesh *bm, - const bool use_select, - const bool use_winding); +struct UvVertMap *BM_uv_vert_map_create(struct BMesh *bm, bool use_select, bool use_winding); -void EDBM_flag_enable_all(struct BMEditMesh *em, const char hflag); -void EDBM_flag_disable_all(struct BMEditMesh *em, const char hflag); +void EDBM_flag_enable_all(struct BMEditMesh *em, char hflag); +void EDBM_flag_disable_all(struct BMEditMesh *em, char hflag); bool BMBVH_EdgeVisible(struct BMBVHTree *tree, struct BMEdge *e, @@ -200,13 +196,9 @@ void EDBM_project_snap_verts(struct bContext *C, /* editmesh_automerge.c */ -void EDBM_automerge(struct Object *ob, bool update, const char hflag, const float dist); -void EDBM_automerge_and_split(struct Object *ob, - const bool split_edges, - const bool split_faces, - const bool update, - const char hflag, - const float dist); +void EDBM_automerge(struct Object *ob, bool update, char hflag, float dist); +void EDBM_automerge_and_split( + struct Object *ob, bool split_edges, bool split_faces, bool update, char hflag, float dist); /* editmesh_undo.c */ @@ -217,8 +209,8 @@ void ED_mesh_undosys_type(struct UndoType *ut); void EDBM_select_mirrored(struct BMEditMesh *em, const struct Mesh *me, - const int axis, - const bool extend, + int axis, + bool extend, int *r_totmirr, int *r_totfail); @@ -235,7 +227,7 @@ void EDBM_select_mirrored(struct BMEditMesh *em, */ struct BMVert *EDBM_vert_find_nearest_ex(struct ViewContext *vc, float *dist_px_manhattan_p, - const bool use_select_bias, + bool use_select_bias, bool use_cycle, struct Base **bases, uint bases_len, @@ -245,7 +237,7 @@ struct BMVert *EDBM_vert_find_nearest(struct ViewContext *vc, float *dist_px_man struct BMEdge *EDBM_edge_find_nearest_ex(struct ViewContext *vc, float *dist_px_manhattan, float *r_dist_center, - const bool use_select_bias, + bool use_select_bias, bool use_cycle, struct BMEdge **r_eed_zbuf, struct Base **bases, @@ -263,8 +255,8 @@ struct BMEdge *EDBM_edge_find_nearest(struct ViewContext *vc, float *dist_px_man struct BMFace *EDBM_face_find_nearest_ex(struct ViewContext *vc, float *dist_px_manhattan, float *r_dist_center, - const bool use_zbuf_single_px, - const bool use_select_bias, + bool use_zbuf_single_px, + bool use_select_bias, bool use_cycle, struct BMFace **r_efa_zbuf, struct Base **bases, @@ -274,7 +266,7 @@ struct BMFace *EDBM_face_find_nearest(struct ViewContext *vc, float *dist_px_man bool EDBM_unified_findnearest(struct ViewContext *vc, struct Base **bases, - const uint bases_len, + uint bases_len, int *r_base_index, struct BMVert **r_eve, struct BMEdge **r_eed, @@ -282,7 +274,7 @@ bool EDBM_unified_findnearest(struct ViewContext *vc, bool EDBM_unified_findnearest_from_raycast(struct ViewContext *vc, struct Base **bases, - const uint bases_len, + uint bases_len, bool use_boundary_vertices, bool use_boundary_edges, int *r_base_index_vert, @@ -314,22 +306,17 @@ void EDBM_selectmode_set(struct BMEditMesh *em); * - face -> vert * - edge -> vert */ -void EDBM_selectmode_convert(struct BMEditMesh *em, - const short selectmode_old, - const short selectmode_new); +void EDBM_selectmode_convert(struct BMEditMesh *em, short selectmode_old, short selectmode_new); /** * User access this. */ -bool EDBM_selectmode_set_multi(struct bContext *C, const short selectmode); +bool EDBM_selectmode_set_multi(struct bContext *C, short selectmode); /** * User facing function, does notification. */ -bool EDBM_selectmode_toggle_multi(struct bContext *C, - const short selectmode_new, - const int action, - const bool use_extend, - const bool use_expand); +bool EDBM_selectmode_toggle_multi( + struct bContext *C, short selectmode_new, int action, bool use_extend, bool use_expand); /** * Use to disable a select-mode if its enabled, Using another mode as a fallback @@ -339,10 +326,10 @@ bool EDBM_selectmode_toggle_multi(struct bContext *C, */ bool EDBM_selectmode_disable(struct Scene *scene, struct BMEditMesh *em, - const short selectmode_disable, - const short selectmode_fallback); + short selectmode_disable, + short selectmode_fallback); -bool EDBM_deselect_by_material(struct BMEditMesh *em, const short index, const bool select); +bool EDBM_deselect_by_material(struct BMEditMesh *em, short index, bool select); void EDBM_select_toggle_all(struct BMEditMesh *em); @@ -350,16 +337,16 @@ void EDBM_select_swap(struct BMEditMesh *em); /* exported for UV */ bool EDBM_select_interior_faces(struct BMEditMesh *em); void em_setup_viewcontext(struct bContext *C, struct ViewContext *vc); /* rename? */ -bool EDBM_mesh_deselect_all_multi_ex(struct Base **bases, const uint bases_len); +bool EDBM_mesh_deselect_all_multi_ex(struct Base **bases, uint bases_len); bool EDBM_mesh_deselect_all_multi(struct bContext *C); bool EDBM_selectmode_disable_multi_ex(struct Scene *scene, struct Base **bases, - const uint bases_len, - const short selectmode_disable, - const short selectmode_fallback); + uint bases_len, + short selectmode_disable, + short selectmode_fallback); bool EDBM_selectmode_disable_multi(struct bContext *C, - const short selectmode_disable, - const short selectmode_fallback); + short selectmode_disable, + short selectmode_fallback); /* editmesh_preselect_edgering.c */ struct EditMesh_PreSelEdgeRing; @@ -429,11 +416,11 @@ bool paintface_deselect_all_visible(struct bContext *C, void paintface_select_linked(struct bContext *C, struct Object *ob, const int mval[2], - const bool select); + bool select); bool paintface_minmax(struct Object *ob, float r_min[3], float r_max[3]); -void paintface_hide(struct bContext *C, struct Object *ob, const bool unselected); -void paintface_reveal(struct bContext *C, struct Object *ob, const bool select); +void paintface_hide(struct bContext *C, struct Object *ob, bool unselected); +void paintface_reveal(struct bContext *C, struct Object *ob, bool select); /** * \note if the caller passes false to flush_flags, @@ -463,7 +450,7 @@ bool ED_mesh_mirrtopo_recalc_check(struct BMEditMesh *em, void ED_mesh_mirrtopo_init(struct BMEditMesh *em, struct Mesh *me, MirrTopoStore_t *mesh_topo_store, - const bool skip_em_vert_array_init); + bool skip_em_vert_array_init); void ED_mesh_mirrtopo_free(MirrTopoStore_t *mesh_topo_store); /* object_vgroup.c */ @@ -476,7 +463,7 @@ void ED_vgroup_select_by_name(struct Object *ob, const char *name); /** * Removes out of range #MDeformWeights */ -void ED_vgroup_data_clamp_range(struct ID *id, const int total); +void ED_vgroup_data_clamp_range(struct ID *id, int total); /** * Matching index only. */ @@ -484,7 +471,7 @@ bool ED_vgroup_array_copy(struct Object *ob, struct Object *ob_from); bool ED_vgroup_parray_alloc(struct ID *id, struct MDeformVert ***dvert_arr, int *dvert_tot, - const bool use_vert_sel); + bool use_vert_sel); /** * For use with tools that use ED_vgroup_parray_alloc with \a use_vert_sel == true. * This finds the unselected mirror deform verts and copies the weights to them from the selected. @@ -494,9 +481,9 @@ bool ED_vgroup_parray_alloc(struct ID *id, */ void ED_vgroup_parray_mirror_sync(struct Object *ob, struct MDeformVert **dvert_array, - const int dvert_tot, + int dvert_tot, const bool *vgroup_validmap, - const int vgroup_tot); + int vgroup_tot); /** * Fill in the pointers for mirror verts (as if all mirror verts were selected too). * @@ -504,27 +491,27 @@ void ED_vgroup_parray_mirror_sync(struct Object *ob, */ void ED_vgroup_parray_mirror_assign(struct Object *ob, struct MDeformVert **dvert_array, - const int dvert_tot); + int dvert_tot); void ED_vgroup_parray_remove_zero(struct MDeformVert **dvert_array, - const int dvert_tot, + int dvert_tot, const bool *vgroup_validmap, - const int vgroup_tot, - const float epsilon, - const bool keep_single); + int vgroup_tot, + float epsilon, + bool keep_single); void ED_vgroup_parray_to_weight_array(const struct MDeformVert **dvert_array, - const int dvert_tot, + int dvert_tot, float *dvert_weights, - const int def_nr); + int def_nr); void ED_vgroup_parray_from_weight_array(struct MDeformVert **dvert_array, - const int dvert_tot, + int dvert_tot, const float *dvert_weights, - const int def_nr, - const bool remove_zero); + int def_nr, + bool remove_zero); void ED_vgroup_mirror(struct Object *ob, - const bool mirror_weights, - const bool flip_vgroups, - const bool all_vgroups, - const bool use_topology, + bool mirror_weights, + bool flip_vgroups, + bool all_vgroups, + bool use_topology, int *r_totmirr, int *r_totfail); @@ -560,36 +547,27 @@ void ED_mesh_geometry_clear(struct Mesh *mesh); void ED_mesh_update(struct Mesh *mesh, struct bContext *C, bool calc_edges, bool calc_edges_loose); void ED_mesh_uv_texture_ensure(struct Mesh *me, const char *name); -int ED_mesh_uv_texture_add(struct Mesh *me, - const char *name, - const bool active_set, - const bool do_init, - struct ReportList *reports); -bool ED_mesh_uv_texture_remove_index(struct Mesh *me, const int n); +int ED_mesh_uv_texture_add( + struct Mesh *me, const char *name, bool active_set, bool do_init, struct ReportList *reports); +bool ED_mesh_uv_texture_remove_index(struct Mesh *me, int n); bool ED_mesh_uv_texture_remove_active(struct Mesh *me); bool ED_mesh_uv_texture_remove_named(struct Mesh *me, const char *name); void ED_mesh_uv_loop_reset(struct bContext *C, struct Mesh *me); /** * Without a #bContext, called when UV-editing. */ -void ED_mesh_uv_loop_reset_ex(struct Mesh *me, const int layernum); +void ED_mesh_uv_loop_reset_ex(struct Mesh *me, int layernum); bool ED_mesh_color_ensure(struct Mesh *me, const char *name); -int ED_mesh_color_add(struct Mesh *me, - const char *name, - const bool active_set, - const bool do_init, - struct ReportList *reports); -bool ED_mesh_color_remove_index(struct Mesh *me, const int n); +int ED_mesh_color_add( + struct Mesh *me, const char *name, bool active_set, bool do_init, struct ReportList *reports); +bool ED_mesh_color_remove_index(struct Mesh *me, int n); bool ED_mesh_color_remove_active(struct Mesh *me); bool ED_mesh_color_remove_named(struct Mesh *me, const char *name); bool ED_mesh_sculpt_color_ensure(struct Mesh *me, const char *name); -int ED_mesh_sculpt_color_add(struct Mesh *me, - const char *name, - const bool active_set, - const bool do_init, - struct ReportList *reports); -bool ED_mesh_sculpt_color_remove_index(struct Mesh *me, const int n); +int ED_mesh_sculpt_color_add( + struct Mesh *me, const char *name, bool active_set, bool do_init, struct ReportList *reports); +bool ED_mesh_sculpt_color_remove_index(struct Mesh *me, int n); bool ED_mesh_sculpt_color_remove_active(struct Mesh *me); bool ED_mesh_sculpt_color_remove_named(struct Mesh *me, const char *name); @@ -654,16 +632,13 @@ 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. */ -int mesh_get_x_mirror_vert(struct Object *ob, - struct Mesh *me_eval, - int index, - const bool use_topology); +int mesh_get_x_mirror_vert(struct Object *ob, struct Mesh *me_eval, int index, bool use_topology); struct BMVert *editbmesh_get_x_mirror_vert(struct Object *ob, struct BMEditMesh *em, struct BMVert *eve, const float co[3], int index, - const bool use_topology); + bool use_topology); /** * This is a Mesh-based copy of #mesh_get_x_mirror_faces(). */ @@ -702,12 +677,10 @@ struct MDeformVert *ED_mesh_active_dvert_get_ob(struct Object *ob, int *r_index) struct MDeformVert *ED_mesh_active_dvert_get_only(struct Object *ob); void EDBM_mesh_stats_multi(struct Object **objects, - const uint objects_len, + uint objects_len, int totelem[3], int totelem_sel[3]); -void EDBM_mesh_elem_index_ensure_multi(struct Object **objects, - const uint objects_len, - const char htype); +void EDBM_mesh_elem_index_ensure_multi(struct Object **objects, uint objects_len, char htype); #define ED_MESH_PICK_DEFAULT_VERT_DIST 25 #define ED_MESH_PICK_DEFAULT_FACE_DIST 1 diff --git a/source/blender/editors/include/ED_numinput.h b/source/blender/editors/include/ED_numinput.h index 84fa4488374..9fd77fa858e 100644 --- a/source/blender/editors/include/ED_numinput.h +++ b/source/blender/editors/include/ED_numinput.h @@ -114,7 +114,7 @@ bool user_string_to_number(bContext *C, const struct UnitSettings *unit, int type, double *r_value, - const bool use_single_line_error, + bool use_single_line_error, char **r_error); /** \} */ diff --git a/source/blender/editors/include/ED_object.h b/source/blender/editors/include/ED_object.h index 576c6f51362..805b48d9195 100644 --- a/source/blender/editors/include/ED_object.h +++ b/source/blender/editors/include/ED_object.h @@ -82,12 +82,12 @@ Object **ED_object_array_in_mode_or_selected(struct bContext *C, /* object_utils.c */ bool ED_object_calc_active_center_for_editmode(struct Object *obedit, - const bool select_only, + bool select_only, float r_center[3]); bool ED_object_calc_active_center_for_posemode(struct Object *ob, - const bool select_only, + bool select_only, float r_center[3]); -bool ED_object_calc_active_center(struct Object *ob, const bool select_only, float r_center[3]); +bool ED_object_calc_active_center(struct Object *ob, bool select_only, float r_center[3]); /* Object Data Container helper API. */ struct XFormObjectData_Container; @@ -189,10 +189,10 @@ bool ED_object_parent_set(struct ReportList *reports, struct Object *const ob, struct Object *const par, int partype, - const bool xmirror, - const bool keep_transform, + bool xmirror, + bool keep_transform, const int vert_par[3]); -void ED_object_parent_clear(struct Object *ob, const int type); +void ED_object_parent_clear(struct Object *ob, int type); /** * Simple API for object selection, rather than just using the flag @@ -243,12 +243,9 @@ struct Base *ED_object_add_duplicate(struct Main *bmain, struct Scene *scene, struct ViewLayer *view_layer, struct Base *base, - const eDupli_ID_Flags dupflag); + eDupli_ID_Flags dupflag); -void ED_object_parent(struct Object *ob, - struct Object *parent, - const int type, - const char *substr); +void ED_object_parent(struct Object *ob, struct Object *parent, int type, const char *substr); char *ED_object_ot_drop_named_material_tooltip(struct bContext *C, struct PointerRNA *properties, const int mval[2]); @@ -323,7 +320,7 @@ void ED_object_sculptmode_enter_ex(struct Main *bmain, struct Depsgraph *depsgraph, struct Scene *scene, struct Object *ob, - const bool force_dyntopo, + bool force_dyntopo, struct ReportList *reports); void ED_object_sculptmode_enter(struct bContext *C, struct Depsgraph *depsgraph, @@ -335,8 +332,8 @@ void ED_object_sculptmode_exit_ex(struct Main *bmain, void ED_object_sculptmode_exit(struct bContext *C, struct Depsgraph *depsgraph); void ED_object_location_from_view(struct bContext *C, float loc[3]); -void ED_object_rotation_from_quat(float rot[3], const float quat[4], const char align_axis); -void ED_object_rotation_from_view(struct bContext *C, float rot[3], const char align_axis); +void ED_object_rotation_from_quat(float rot[3], const float quat[4], char align_axis); +void ED_object_rotation_from_view(struct bContext *C, float rot[3], char align_axis); void ED_object_base_init_transform_on_add(struct Object *object, const float loc[3], const float rot[3]); @@ -363,7 +360,7 @@ void ED_object_add_generic_props(struct wmOperatorType *ot, bool do_editmode); void ED_object_add_mesh_props(struct wmOperatorType *ot); bool ED_object_add_generic_get_opts(struct bContext *C, struct wmOperator *op, - const char view_align_axis, + char view_align_axis, float r_loc[3], float r_rot[3], float r_scale[3], @@ -378,20 +375,20 @@ bool ED_object_add_generic_get_opts(struct bContext *C, * \note Do not call undo push in this function (users of this function have to). */ struct Object *ED_object_add_type_with_obdata(struct bContext *C, - const int type, + int type, const char *name, const float loc[3], const float rot[3], - const bool enter_editmode, - const ushort local_view_bits, + bool enter_editmode, + ushort local_view_bits, struct ID *obdata); struct Object *ED_object_add_type(struct bContext *C, - const int type, + int type, const char *name, const float loc[3], const float rot[3], - const bool enter_editmode, - const unsigned short local_view_bits) + bool enter_editmode, + unsigned short local_view_bits) ATTR_NONNULL(1) ATTR_RETURNS_NONNULL; /** @@ -468,9 +465,7 @@ void ED_object_constraint_dependency_tag_update(struct Main *bmain, struct Object *ob, struct bConstraint *con); -bool ED_object_constraint_move_to_index(struct Object *ob, - struct bConstraint *con, - const int index); +bool ED_object_constraint_move_to_index(struct Object *ob, struct bConstraint *con, int index); void ED_object_constraint_link(struct Main *bmain, struct Object *ob_dst, struct ListBase *dst, @@ -514,7 +509,7 @@ bool ED_object_mode_generic_has_data(struct Depsgraph *depsgraph, const struct O void ED_object_posemode_set_for_weight_paint(struct bContext *C, struct Main *bmain, struct Object *ob, - const bool is_mode_set); + bool is_mode_set); /* object_modifier.c */ @@ -550,7 +545,7 @@ bool ED_object_modifier_move_up(struct ReportList *reports, bool ED_object_modifier_move_to_index(struct ReportList *reports, struct Object *ob, struct ModifierData *md, - const int index); + int index); bool ED_object_modifier_convert(struct ReportList *reports, struct Main *bmain, @@ -588,7 +583,7 @@ void ED_object_modifier_copy_to_object(struct bContext *C, */ bool ED_object_iter_other(struct Main *bmain, struct Object *orig_ob, - const bool include_orig, + bool include_orig, bool (*callback)(struct Object *ob, void *callback_data), void *callback_data); @@ -619,7 +614,7 @@ bool ED_object_gpencil_modifier_move_up(struct ReportList *reports, bool ED_object_gpencil_modifier_move_to_index(struct ReportList *reports, struct Object *ob, struct GpencilModifierData *md, - const int index); + int index); bool ED_object_gpencil_modifier_apply(struct Main *bmain, struct ReportList *reports, struct Depsgraph *depsgraph, @@ -653,7 +648,7 @@ int ED_object_shaderfx_move_up(struct ReportList *reports, bool ED_object_shaderfx_move_to_index(struct ReportList *reports, struct Object *ob, struct ShaderFxData *fx, - const int index); + int index); void ED_object_shaderfx_link(struct Object *dst, struct Object *src); void ED_object_shaderfx_copy(struct Object *dst, struct ShaderFxData *fx); @@ -665,7 +660,7 @@ const struct EnumPropertyItem *ED_object_vgroup_selection_itemf_helper( struct PointerRNA *ptr, struct PropertyRNA *prop, bool *r_free, - const unsigned int selection_mask); + unsigned int selection_mask); void ED_object_check_force_modifiers(struct Main *bmain, struct Scene *scene, @@ -683,7 +678,7 @@ struct Base *ED_object_find_first_by_data_id(struct ViewLayer *view_layer, struc * * \returns false if not found in current view layer */ -bool ED_object_jump_to_object(struct bContext *C, struct Object *ob, const bool reveal_hidden); +bool ED_object_jump_to_object(struct bContext *C, struct Object *ob, bool reveal_hidden); /** * Select and make the target object and bone active. * Switches to Pose mode if in Object mode so the selection is visible. @@ -694,7 +689,7 @@ bool ED_object_jump_to_object(struct bContext *C, struct Object *ob, const bool bool ED_object_jump_to_bone(struct bContext *C, struct Object *ob, const char *bone_name, - const bool reveal_hidden); + bool reveal_hidden); /* object_facemap_ops.c */ diff --git a/source/blender/editors/include/ED_particle.h b/source/blender/editors/include/ED_particle.h index ce25943b40a..9671f5b2b09 100644 --- a/source/blender/editors/include/ED_particle.h +++ b/source/blender/editors/include/ED_particle.h @@ -72,16 +72,13 @@ 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_box_select(struct bContext *C, const struct rcti *rect, int sel_op); bool PE_circle_select(struct bContext *C, struct wmGenericUserData *wm_userdata, - const int sel_op, + int sel_op, const int mval[2], float rad); -int PE_lasso_select(struct bContext *C, - const int mcoords[][2], - const int mcoords_len, - const int sel_op); +int PE_lasso_select(struct bContext *C, const int mcoords[][2], int mcoords_len, int sel_op); bool PE_deselect_all_visible_ex(struct PTCacheEdit *edit); bool PE_deselect_all_visible(struct bContext *C); diff --git a/source/blender/editors/include/ED_render.h b/source/blender/editors/include/ED_render.h index b91569cee03..dabf8fb838b 100644 --- a/source/blender/editors/include/ED_render.h +++ b/source/blender/editors/include/ED_render.h @@ -49,7 +49,7 @@ void ED_operatortypes_render(void); /* render_update.c */ -void ED_render_engine_changed(struct Main *bmain, const bool update_scene_data); +void ED_render_engine_changed(struct Main *bmain, bool update_scene_data); void ED_render_engine_area_exit(struct Main *bmain, struct ScrArea *area); void ED_render_view_layer_changed(struct Main *bmain, struct bScreen *screen); @@ -60,14 +60,14 @@ void ED_render_id_flush_update(const struct DEGEditorUpdateContext *update_ctx, * Update all 3D viewport render and draw engines on changes to the scene. * This is called by the dependency graph when it detects changes. */ -void ED_render_scene_update(const struct DEGEditorUpdateContext *update_ctx, const bool updated); +void ED_render_scene_update(const struct DEGEditorUpdateContext *update_ctx, bool updated); /** * Update 3D viewport render or draw engine on changes to the scene or view settings. */ void ED_render_view3d_update(struct Depsgraph *depsgraph, struct wmWindow *window, struct ScrArea *area, - const bool updated); + bool updated); struct Scene *ED_render_job_get_scene(const struct bContext *C); struct Scene *ED_render_job_get_current_scene(const struct bContext *C); @@ -113,7 +113,7 @@ void ED_preview_icon_job(const struct bContext *C, unsigned int *rect, int sizex, int sizey, - const bool delay); + bool delay); void ED_preview_restart_queue_free(void); void ED_preview_restart_queue_add(struct ID *id, enum eIconSizes size); diff --git a/source/blender/editors/include/ED_screen.h b/source/blender/editors/include/ED_screen.h index c65ef3e397d..651ae1de8be 100644 --- a/source/blender/editors/include/ED_screen.h +++ b/source/blender/editors/include/ED_screen.h @@ -160,11 +160,11 @@ void ED_region_visibility_change_update_animated(struct bContext *C, void ED_region_info_draw(struct ARegion *region, const char *text, float fill_color[4], - const bool full_redraw); + bool full_redraw); void ED_region_info_draw_multiline(ARegion *region, const char *text_array[], float fill_color[4], - const bool full_redraw); + bool full_redraw); void ED_region_image_metadata_panel_draw(struct ImBuf *ibuf, struct uiLayout *layout); void ED_region_grid_draw(struct ARegion *region, float zoomx, float zoomy, float x0, float y0); float ED_region_blend_alpha(struct ARegion *region); @@ -238,7 +238,7 @@ void ED_area_status_text(ScrArea *area, const char *str); /** * \param skip_region_exit: Skip calling area exit callback. Set for opening temp spaces. */ -void ED_area_newspace(struct bContext *C, ScrArea *area, int type, const bool skip_region_exit); +void ED_area_newspace(struct bContext *C, ScrArea *area, int type, bool skip_region_exit); void ED_area_prevspace(struct bContext *C, ScrArea *area); void ED_area_swapspace(struct bContext *C, ScrArea *sa1, ScrArea *sa2); int ED_area_headersize(void); @@ -316,7 +316,7 @@ bool ED_screen_change(struct bContext *C, struct bScreen *screen); void ED_screen_scene_change(struct bContext *C, struct wmWindow *win, struct Scene *scene, - const bool refresh_toolsystem); + bool refresh_toolsystem); /** * Called in wm_event_system.c. sets state vars in screen, cursors. * event type is mouse move. @@ -360,7 +360,7 @@ bScreen *ED_screen_state_maximized_create(struct bContext *C); struct ScrArea *ED_screen_state_toggle(struct bContext *C, struct wmWindow *win, struct ScrArea *area, - const short state); + short state); /** * Wrapper to open a temporary space either as fullscreen space, or as separate window, as defined * by \a display_type. @@ -397,7 +397,7 @@ Scene *ED_screen_scene_find_with_window(const struct bScreen *screen, struct wmWindow **r_window); ScrArea *ED_screen_area_find_with_spacedata(const bScreen *screen, const struct SpaceLink *sl, - const bool only_visible); + bool only_visible); struct wmWindow *ED_screen_window_find(const struct bScreen *screen, const struct wmWindowManager *wm); /** @@ -473,9 +473,8 @@ struct WorkSpaceLayout *ED_workspace_layout_duplicate(struct Main *bmain, bool ED_workspace_layout_delete(struct WorkSpace *workspace, struct WorkSpaceLayout *layout_old, struct bContext *C) ATTR_NONNULL(); -bool ED_workspace_layout_cycle(struct WorkSpace *workspace, - const short direction, - struct bContext *C) ATTR_NONNULL(); +bool ED_workspace_layout_cycle(struct WorkSpace *workspace, short direction, struct bContext *C) + ATTR_NONNULL(); void ED_workspace_status_text(struct bContext *C, const char *str); @@ -644,12 +643,9 @@ void ED_screen_user_menu_register(void); /* Cache display helpers */ void ED_region_cache_draw_background(struct ARegion *region); -void ED_region_cache_draw_curfra_label(const int framenr, const float x, const float y); -void ED_region_cache_draw_cached_segments(struct ARegion *region, - const int num_segments, - const int *points, - const int sfra, - const int efra); +void ED_region_cache_draw_curfra_label(int framenr, float x, float y); +void ED_region_cache_draw_cached_segments( + struct ARegion *region, int num_segments, const int *points, int sfra, int efra); /* area_utils.c */ @@ -664,19 +660,15 @@ void ED_region_generic_tools_region_message_subscribe( int ED_region_generic_tools_region_snap_size(const struct ARegion *region, int size, int axis); /* area_query.c */ -bool ED_region_overlap_isect_x(const ARegion *region, const int event_x); -bool ED_region_overlap_isect_y(const ARegion *region, const int event_y); +bool ED_region_overlap_isect_x(const ARegion *region, int event_x); +bool ED_region_overlap_isect_y(const ARegion *region, int event_y); bool ED_region_overlap_isect_xy(const ARegion *region, const int event_xy[2]); bool ED_region_overlap_isect_any_xy(const ScrArea *area, const int event_xy[2]); -bool ED_region_overlap_isect_x_with_margin(const ARegion *region, - const int event_x, - const int margin); -bool ED_region_overlap_isect_y_with_margin(const ARegion *region, - const int event_y, - const int margin); +bool ED_region_overlap_isect_x_with_margin(const ARegion *region, int event_x, int margin); +bool ED_region_overlap_isect_y_with_margin(const ARegion *region, int event_y, int margin); bool ED_region_overlap_isect_xy_with_margin(const ARegion *region, const int event_xy[2], - const int margin); + int margin); bool ED_region_panel_category_gutter_calc_rect(const ARegion *region, rcti *r_region_gutter); bool ED_region_panel_category_gutter_isect_xy(const ARegion *region, const int event_xy[2]); diff --git a/source/blender/editors/include/ED_sculpt.h b/source/blender/editors/include/ED_sculpt.h index 0cdd8873cb2..7c1124d705f 100644 --- a/source/blender/editors/include/ED_sculpt.h +++ b/source/blender/editors/include/ED_sculpt.h @@ -60,7 +60,7 @@ void ED_sculpt_undo_geometry_end(struct Object *ob); /* Face sets. */ int ED_sculpt_face_sets_find_next_available_id(struct Mesh *mesh); -void ED_sculpt_face_sets_initialize_none_to_id(struct Mesh *mesh, const int new_id); +void ED_sculpt_face_sets_initialize_none_to_id(struct Mesh *mesh, int new_id); int ED_sculpt_face_sets_active_update_and_get(struct bContext *C, struct Object *ob, diff --git a/source/blender/editors/include/ED_select_utils.h b/source/blender/editors/include/ED_select_utils.h index 4656099799b..295268c7719 100644 --- a/source/blender/editors/include/ED_select_utils.h +++ b/source/blender/editors/include/ED_select_utils.h @@ -64,27 +64,25 @@ enum { * Use when we've de-selected all first for 'SEL_OP_SET'. * 1: select, 0: deselect, -1: pass. */ -int ED_select_op_action(const eSelectOp sel_op, const bool is_select, const bool is_inside); +int ED_select_op_action(eSelectOp sel_op, bool is_select, bool is_inside); /** * Use when we've de-selected all items first (for modes that need it). * * \note In some cases changing selection needs to perform other checks, * so it's more straightforward to deselect all, then select. */ -int ED_select_op_action_deselected(const eSelectOp sel_op, - const bool is_select, - const bool is_inside); +int ED_select_op_action_deselected(eSelectOp sel_op, bool is_select, bool is_inside); -int ED_select_similar_compare_float(const float delta, const float thresh, const int compare); +int ED_select_similar_compare_float(float delta, float thresh, int compare); bool ED_select_similar_compare_float_tree(const struct KDTree_1d *tree, - const float length, - const float thresh, - const int compare); + float length, + float thresh, + int compare); /** * Utility to use for selection operations that run multiple times (circle select). */ -eSelectOp ED_select_op_modal(const eSelectOp sel_op, const bool is_first); +eSelectOp ED_select_op_modal(eSelectOp sel_op, bool is_first); #ifdef __cplusplus } diff --git a/source/blender/editors/include/ED_space_api.h b/source/blender/editors/include/ED_space_api.h index f4a69737da1..fb76b36baef 100644 --- a/source/blender/editors/include/ED_space_api.h +++ b/source/blender/editors/include/ED_space_api.h @@ -86,7 +86,7 @@ void *ED_region_draw_cb_activate(struct ARegionType *art, int type); void ED_region_draw_cb_draw(const struct bContext *C, struct ARegion *region, int type); void ED_region_surface_draw_cb_draw(struct ARegionType *art, int type); -void ED_region_draw_cb_exit(struct ARegionType *art, void *handle); +bool ED_region_draw_cb_exit(struct ARegionType *art, void *handle); void ED_region_draw_cb_remove_by_type(struct ARegionType *art, void *draw_fn, void (*free)(void *)); diff --git a/source/blender/editors/include/ED_transform.h b/source/blender/editors/include/ED_transform.h index 4f9bdfadbdf..b76f882e706 100644 --- a/source/blender/editors/include/ED_transform.h +++ b/source/blender/editors/include/ED_transform.h @@ -104,16 +104,16 @@ void BIF_removeTransformOrientationIndex(struct bContext *C, int index); bool BIF_createTransformOrientation(struct bContext *C, struct ReportList *reports, const char *name, - const bool use_view, - const bool activate, - const bool overwrite); + bool use_view, + bool activate, + bool overwrite); void BIF_selectTransformOrientation(struct bContext *C, struct TransformOrientation *target); void ED_getTransformOrientationMatrix(struct ViewLayer *view_layer, const struct View3D *v3d, struct Object *ob, struct Object *obedit, - const short around, + short around, float r_orientation_mat[3][3]); int BIF_countTransformOrientation(const struct bContext *C); @@ -161,8 +161,8 @@ short ED_transform_calc_orientation_from_type_ex(const struct Scene *scene, const struct RegionView3D *rv3d, struct Object *ob, struct Object *obedit, - const short orientation_index, - const int pivot_point, + short orientation_index, + int pivot_point, float r_mat[3][3]); /* transform gizmos */ diff --git a/source/blender/editors/include/ED_transform_snap_object_context.h b/source/blender/editors/include/ED_transform_snap_object_context.h index 6f25a63188d..fd65d8f3663 100644 --- a/source/blender/editors/include/ED_transform_snap_object_context.h +++ b/source/blender/editors/include/ED_transform_snap_object_context.h @@ -138,7 +138,7 @@ short ED_transform_snap_object_project_view3d_ex(struct SnapObjectContext *sctx, struct Depsgraph *depsgraph, const ARegion *region, const View3D *v3d, - const unsigned short snap_to, + unsigned short snap_to, const struct SnapObjectParams *params, const float mval[2], const float prev_co[3], @@ -166,7 +166,7 @@ short ED_transform_snap_object_project_view3d(struct SnapObjectContext *sctx, struct Depsgraph *depsgraph, const ARegion *region, const View3D *v3d, - const unsigned short snap_to, + unsigned short snap_to, const struct SnapObjectParams *params, const float mval[2], const float prev_co[3], diff --git a/source/blender/editors/include/ED_transverts.h b/source/blender/editors/include/ED_transverts.h index 28955da6ef1..cbcf28d53d5 100644 --- a/source/blender/editors/include/ED_transverts.h +++ b/source/blender/editors/include/ED_transverts.h @@ -42,7 +42,7 @@ typedef struct TransVertStore { int mode; } TransVertStore; -void ED_transverts_create_from_obedit(TransVertStore *tvs, struct Object *obedit, const int mode); +void ED_transverts_create_from_obedit(TransVertStore *tvs, struct Object *obedit, int mode); void ED_transverts_update_obedit(TransVertStore *tvs, struct Object *obedit); void ED_transverts_free(TransVertStore *tvs); bool ED_transverts_check_obedit(Object *obedit); diff --git a/source/blender/editors/include/ED_util.h b/source/blender/editors/include/ED_util.h index 69378d436ab..8a669a2afc2 100644 --- a/source/blender/editors/include/ED_util.h +++ b/source/blender/editors/include/ED_util.h @@ -108,7 +108,7 @@ float ED_slider_factor_get(struct tSlider *slider); void ED_slider_factor_set(struct tSlider *slider, float factor); bool ED_slider_allow_overshoot_get(struct tSlider *slider); -void ED_slider_allow_overshoot_set(struct tSlider *slider, const bool value); +void ED_slider_allow_overshoot_set(struct tSlider *slider, bool value); /* ************** XXX OLD CRUFT WARNING ************* */ diff --git a/source/blender/editors/include/ED_uvedit.h b/source/blender/editors/include/ED_uvedit.h index d5303904842..0af98fc367f 100644 --- a/source/blender/editors/include/ED_uvedit.h +++ b/source/blender/editors/include/ED_uvedit.h @@ -100,93 +100,87 @@ bool ED_uvedit_test(struct Object *obedit); bool uvedit_face_visible_test_ex(const struct ToolSettings *ts, struct BMFace *efa); bool uvedit_face_select_test_ex(const struct ToolSettings *ts, struct BMFace *efa, - const int cd_loop_uv_offset); + int cd_loop_uv_offset); bool uvedit_edge_select_test_ex(const struct ToolSettings *ts, struct BMLoop *l, - const int cd_loop_uv_offset); + int cd_loop_uv_offset); bool uvedit_uv_select_test_ex(const struct ToolSettings *ts, struct BMLoop *l, - const int cd_loop_uv_offset); + int cd_loop_uv_offset); bool uvedit_face_visible_test(const struct Scene *scene, struct BMFace *efa); -bool uvedit_face_select_test(const struct Scene *scene, - struct BMFace *efa, - const int cd_loop_uv_offset); -bool uvedit_edge_select_test(const struct Scene *scene, - struct BMLoop *l, - const int cd_loop_uv_offset); -bool uvedit_uv_select_test(const struct Scene *scene, - struct BMLoop *l, - const int cd_loop_uv_offset); +bool uvedit_face_select_test(const struct Scene *scene, struct BMFace *efa, int cd_loop_uv_offset); +bool uvedit_edge_select_test(const struct Scene *scene, struct BMLoop *l, int cd_loop_uv_offset); +bool uvedit_uv_select_test(const struct Scene *scene, struct BMLoop *l, int cd_loop_uv_offset); /* uv face */ void uvedit_face_select_set_with_sticky(const struct SpaceImage *sima, const struct Scene *scene, struct BMEditMesh *em, struct BMFace *efa, - const bool select, - const bool do_history, - const int cd_loop_uv_offset); + bool select, + bool do_history, + int cd_loop_uv_offset); void uvedit_face_select_set(const struct Scene *scene, struct BMEditMesh *em, struct BMFace *efa, - const bool select, - const bool do_history, - const int cd_loop_uv_offset); + bool select, + bool do_history, + int cd_loop_uv_offset); void uvedit_face_select_enable(const struct Scene *scene, struct BMEditMesh *em, struct BMFace *efa, - const bool do_history, - const int cd_loop_uv_offset); + bool do_history, + int cd_loop_uv_offset); void uvedit_face_select_disable(const struct Scene *scene, struct BMEditMesh *em, struct BMFace *efa, - const int cd_loop_uv_offset); + int cd_loop_uv_offset); /* uv edge */ void uvedit_edge_select_set_with_sticky(const struct SpaceImage *sima, const struct Scene *scene, struct BMEditMesh *em, struct BMLoop *l, - const bool select, - const bool do_history, - const uint cd_loop_uv_offset); + bool select, + bool do_history, + uint cd_loop_uv_offset); void uvedit_edge_select_set(const struct Scene *scene, struct BMEditMesh *em, struct BMLoop *l, - const bool select, - const bool do_history, - const int cd_loop_uv_offset); + bool select, + bool do_history, + int cd_loop_uv_offset); void uvedit_edge_select_enable(const struct Scene *scene, struct BMEditMesh *em, struct BMLoop *l, - const bool do_history, - const int cd_loop_uv_offset); + bool do_history, + int cd_loop_uv_offset); void uvedit_edge_select_disable(const struct Scene *scene, struct BMEditMesh *em, struct BMLoop *l, - const int cd_loop_uv_offset); + int cd_loop_uv_offset); /* uv vert */ void uvedit_uv_select_set_with_sticky(const struct SpaceImage *sima, const struct Scene *scene, struct BMEditMesh *em, struct BMLoop *l, - const bool select, - const bool do_history, - const uint cd_loop_uv_offset); + bool select, + bool do_history, + uint cd_loop_uv_offset); void uvedit_uv_select_set(const struct Scene *scene, struct BMEditMesh *em, struct BMLoop *l, - const bool select, - const bool do_history, - const int cd_loop_uv_offset); + bool select, + bool do_history, + int cd_loop_uv_offset); void uvedit_uv_select_enable(const struct Scene *scene, struct BMEditMesh *em, struct BMLoop *l, - const bool do_history, - const int cd_loop_uv_offset); + bool do_history, + int cd_loop_uv_offset); void uvedit_uv_select_disable(const struct Scene *scene, struct BMEditMesh *em, struct BMLoop *l, - const int cd_loop_uv_offset); + int cd_loop_uv_offset); bool ED_uvedit_nearest_uv(const struct Scene *scene, struct Object *obedit, @@ -195,7 +189,7 @@ bool ED_uvedit_nearest_uv(const struct Scene *scene, float r_uv[2]); bool ED_uvedit_nearest_uv_multi(const struct Scene *scene, struct Object **objects, - const uint objects_len, + uint objects_len, const float co[2], float *dist_sq, float r_uv[2]); @@ -228,7 +222,7 @@ struct BMLoop *ED_uvedit_active_edge_loop_get(struct BMesh *bm); char ED_uvedit_select_mode_get(const struct Scene *scene); void ED_uvedit_select_sync_flush(const struct ToolSettings *ts, struct BMEditMesh *em, - const bool select); + bool select); /* uvedit_unwrap_ops.c */ @@ -278,7 +272,7 @@ bool uv_coords_isect_udim(const struct Image *image, const float coords[2]); void ED_uvedit_pack_islands_multi(const struct Scene *scene, Object **objects, - const uint objects_len, + uint objects_len, const struct UVMapUDIM_Params *udim_params, const struct UVPackIsland_Params *params); diff --git a/source/blender/editors/include/ED_view3d.h b/source/blender/editors/include/ED_view3d.h index 6c986d8efe1..0398c209c68 100644 --- a/source/blender/editors/include/ED_view3d.h +++ b/source/blender/editors/include/ED_view3d.h @@ -114,17 +114,17 @@ bool ED_view3d_has_workbench_in_texture_color(const struct Scene *scene, */ void ED_view3d_cursor3d_position(struct bContext *C, const int mval[2], - const bool use_depth, + bool use_depth, float r_cursor_co[3]); void ED_view3d_cursor3d_position_rotation(struct bContext *C, const int mval[2], - const bool use_depth, + bool use_depth, enum eV3DCursorOrient orientation, float r_cursor_co[3], float r_cursor_quat[4]); void ED_view3d_cursor3d_update(struct bContext *C, const int mval[2], - const bool use_depth, + bool use_depth, enum eV3DCursorOrient orientation); struct Camera *ED_view3d_camera_data_get(struct View3D *v3d, struct RegionView3D *rv3d); @@ -137,7 +137,7 @@ struct Camera *ED_view3d_camera_data_get(struct View3D *v3d, struct RegionView3D * \param quat: The view rotation, quaternion normally from #RegionView3D.viewquat. * \param dist: The view distance from ofs, normally from #RegionView3D.dist. */ -void ED_view3d_to_m4(float mat[4][4], const float ofs[3], const float quat[4], const float dist); +void ED_view3d_to_m4(float mat[4][4], const float ofs[3], const float quat[4], float dist); /** * Set the view transformation from a 4x4 matrix. * @@ -171,7 +171,7 @@ void ED_view3d_to_object(const struct Depsgraph *depsgraph, struct Object *ob, const float ofs[3], const float quat[4], - const float dist); + float dist); bool ED_view3d_camera_to_view_selected(struct Main *bmain, struct Depsgraph *depsgraph, @@ -213,7 +213,7 @@ bool ED_view3d_depth_read_cached_normal(const struct ARegion *region, float r_normal[3]); bool ED_view3d_depth_unproject_v3(const struct ARegion *region, const int mval[2], - const double depth, + double depth, float r_location_world[3]); /* Projection */ @@ -280,7 +280,7 @@ typedef enum { /* view3d_snap.c */ bool ED_view3d_snap_selected_to_location(struct bContext *C, const float snap_target_global[3], - const int pivot_point); + int pivot_point); /* view3d_cursor_snap.c */ #define USE_SNAP_DETECT_FROM_KEYMAP_HACK @@ -343,8 +343,8 @@ void ED_view3d_cursor_snap_deactive(V3DSnapCursorState *state); void ED_view3d_cursor_snap_prevpoint_set(V3DSnapCursorState *state, const float prev_point[3]); V3DSnapCursorData *ED_view3d_cursor_snap_data_get(V3DSnapCursorState *state, const struct bContext *C, - const int x, - const int y); + int x, + int y); struct SnapObjectContext *ED_view3d_cursor_snap_context_ensure(struct Scene *scene); void ED_view3d_cursor_snap_draw_util(struct RegionView3D *rv3d, const float loc_prev[3], @@ -352,7 +352,7 @@ void ED_view3d_cursor_snap_draw_util(struct RegionView3D *rv3d, const float normal[3], const uchar color_line[4], const uchar color_point[4], - const short snap_elem_type); + short snap_elem_type); /* view3d_iterators.c */ @@ -362,12 +362,12 @@ void meshobject_foreachScreenVert( struct ViewContext *vc, void (*func)(void *userData, struct MVert *eve, const float screen_co[2], int index), void *userData, - const eV3DProjTest clip_flag); + eV3DProjTest clip_flag); void mesh_foreachScreenVert( struct ViewContext *vc, void (*func)(void *userData, struct BMVert *eve, const float screen_co[2], int index), void *userData, - const eV3DProjTest clip_flag); + eV3DProjTest clip_flag); void mesh_foreachScreenEdge(struct ViewContext *vc, void (*func)(void *userData, struct BMEdge *eed, @@ -375,7 +375,7 @@ void mesh_foreachScreenEdge(struct ViewContext *vc, const float screen_co_b[2], int index), void *userData, - const eV3DProjTest clip_flag); + eV3DProjTest clip_flag); /** * A version of #mesh_foreachScreenEdge that clips the segment when @@ -388,13 +388,13 @@ void mesh_foreachScreenEdge_clip_bb_segment(struct ViewContext *vc, const float screen_co_b[2], int index), void *userData, - const eV3DProjTest clip_flag); + eV3DProjTest clip_flag); void mesh_foreachScreenFace( struct ViewContext *vc, void (*func)(void *userData, struct BMFace *efa, const float screen_co[2], int index), void *userData, - const eV3DProjTest clip_flag); + eV3DProjTest clip_flag); void nurbs_foreachScreenVert(struct ViewContext *vc, void (*func)(void *userData, struct Nurb *nu, @@ -404,7 +404,7 @@ void nurbs_foreachScreenVert(struct ViewContext *vc, bool handle_visible, const float screen_co[2]), void *userData, - const eV3DProjTest clip_flag); + eV3DProjTest clip_flag); /** * #ED_view3d_init_mats_rv3d must be called first. */ @@ -413,13 +413,13 @@ void mball_foreachScreenElem(struct ViewContext *vc, struct MetaElem *ml, const float screen_co[2]), void *userData, - const eV3DProjTest clip_flag); + eV3DProjTest clip_flag); void lattice_foreachScreenVert(struct ViewContext *vc, void (*func)(void *userData, struct BPoint *bp, const float screen_co[2]), void *userData, - const eV3DProjTest clip_flag); + eV3DProjTest clip_flag); /** * #ED_view3d_init_mats_rv3d must be called first. */ @@ -429,7 +429,7 @@ void armature_foreachScreenBone(struct ViewContext *vc, const float screen_co_a[2], const float screen_co_b[2]), void *userData, - const eV3DProjTest clip_flag); + eV3DProjTest clip_flag); /** * ED_view3d_init_mats_rv3d must be called first. @@ -440,7 +440,7 @@ void pose_foreachScreenBone(struct ViewContext *vc, const float screen_co_a[2], const float screen_co_b[2]), void *userData, - const eV3DProjTest clip_flag); + eV3DProjTest clip_flag); /* *** end iterators *** */ /* view3d_project.c */ @@ -465,58 +465,58 @@ eV3DProjStatus ED_view3d_project_base(const struct ARegion *region, struct Base /* *** short *** */ eV3DProjStatus ED_view3d_project_short_ex(const struct ARegion *region, float perspmat[4][4], - const bool is_local, + bool is_local, const float co[3], short r_co[2], - const eV3DProjTest flag); + eV3DProjTest flag); /* --- short --- */ eV3DProjStatus ED_view3d_project_short_global(const struct ARegion *region, const float co[3], short r_co[2], - const eV3DProjTest flag); + eV3DProjTest flag); /* object space, use ED_view3d_init_mats_rv3d before calling */ eV3DProjStatus ED_view3d_project_short_object(const struct ARegion *region, const float co[3], short r_co[2], - const eV3DProjTest flag); + eV3DProjTest flag); /* *** int *** */ eV3DProjStatus ED_view3d_project_int_ex(const struct ARegion *region, float perspmat[4][4], - const bool is_local, + bool is_local, const float co[3], int r_co[2], - const eV3DProjTest flag); + eV3DProjTest flag); /* --- int --- */ eV3DProjStatus ED_view3d_project_int_global(const struct ARegion *region, const float co[3], int r_co[2], - const eV3DProjTest flag); + eV3DProjTest flag); /* object space, use ED_view3d_init_mats_rv3d before calling */ eV3DProjStatus ED_view3d_project_int_object(const struct ARegion *region, const float co[3], int r_co[2], - const eV3DProjTest flag); + eV3DProjTest flag); /* *** float *** */ eV3DProjStatus ED_view3d_project_float_ex(const struct ARegion *region, float perspmat[4][4], - const bool is_local, + bool is_local, const float co[3], float r_co[2], - const eV3DProjTest flag); + eV3DProjTest flag); /* --- float --- */ eV3DProjStatus ED_view3d_project_float_global(const struct ARegion *region, const float co[3], float r_co[2], - const eV3DProjTest flag); + eV3DProjTest flag); /** * Object space, use #ED_view3d_init_mats_rv3d before calling. */ eV3DProjStatus ED_view3d_project_float_object(const struct ARegion *region, const float co[3], float r_co[2], - const eV3DProjTest flag); + eV3DProjTest flag); float ED_view3d_pixel_size(const struct RegionView3D *rv3d, const float co[3]); float ED_view3d_pixel_size_no_ui_scale(const struct RegionView3D *rv3d, const float co[3]); @@ -550,7 +550,7 @@ bool ED_view3d_win_to_ray_clipped(struct Depsgraph *depsgraph, const float mval[2], float r_ray_start[3], float r_ray_normal[3], - const bool do_clip_planes); + bool do_clip_planes); /** * Calculate a 3d viewpoint and direction vector from 2d window coordinates. * This ray_start is located at the viewpoint, ray_normal is the direction towards `mval`. @@ -620,7 +620,7 @@ void ED_view3d_win_to_3d_int(const struct View3D *v3d, bool ED_view3d_win_to_3d_on_plane(const struct ARegion *region, const float plane[4], const float mval[2], - const bool do_clip, + bool do_clip, float r_out[3]); /** * A wrapper for #ED_view3d_win_to_3d_on_plane that projects onto \a plane_fallback @@ -632,13 +632,13 @@ bool ED_view3d_win_to_3d_on_plane(const struct ARegion *region, bool ED_view3d_win_to_3d_on_plane_with_fallback(const struct ARegion *region, const float plane[4], const float mval[2], - const bool do_clip, + bool do_clip, const float plane_fallback[4], float r_out[3]); bool ED_view3d_win_to_3d_on_plane_int(const struct ARegion *region, const float plane[4], const int mval[2], - const bool do_clip, + bool do_clip, float r_out[3]); /** * Calculate a 3d difference vector from 2d window offset. @@ -651,7 +651,7 @@ bool ED_view3d_win_to_3d_on_plane_int(const struct ARegion *region, void ED_view3d_win_to_delta(const struct ARegion *region, const float mval[2], float out[3], - const float zfac); + float zfac); /** * Calculate a 3d origin from 2d window coordinates. * \note Orthographic views have a less obvious origin, @@ -697,7 +697,7 @@ bool ED_view3d_win_to_segment_clipped(struct Depsgraph *depsgraph, const float mval[2], float r_ray_start[3], float r_ray_end[3], - const bool do_clip_planes); + bool do_clip_planes); void ED_view3d_ob_project_mat_get(const struct RegionView3D *v3d, const struct Object *ob, float r_pmat[4][4]); @@ -729,7 +729,7 @@ bool ED_view3d_clip_range_get(struct Depsgraph *depsgraph, const struct RegionView3D *rv3d, float *r_clipsta, float *r_clipend, - const bool use_ortho_factor); + bool use_ortho_factor); bool ED_view3d_viewplane_get(struct Depsgraph *depsgraph, const struct View3D *v3d, const struct RegionView3D *rv3d, @@ -743,7 +743,7 @@ bool ED_view3d_viewplane_get(struct Depsgraph *depsgraph, /** * Use instead of: `GPU_polygon_offset(rv3d->dist, ...)` see bug T37727. */ -void ED_view3d_polygon_offset(const struct RegionView3D *rv3d, const float dist); +void ED_view3d_polygon_offset(const struct RegionView3D *rv3d, float dist); void ED_view3d_calc_camera_border(const struct Scene *scene, struct Depsgraph *depsgraph, @@ -751,7 +751,7 @@ void ED_view3d_calc_camera_border(const struct Scene *scene, const struct View3D *v3d, const struct RegionView3D *rv3d, struct rctf *r_viewborder, - const bool no_shift); + bool no_shift); void ED_view3d_calc_camera_border_size(const struct Scene *scene, struct Depsgraph *depsgraph, const struct ARegion *region, @@ -766,7 +766,7 @@ bool ED_view3d_calc_render_border(const struct Scene *scene, void ED_view3d_clipping_calc_from_boundbox(float clip[4][4], const struct BoundBox *clipbb, - const bool is_flip); + bool is_flip); void ED_view3d_clipping_calc(struct BoundBox *bb, float planes[4][4], const struct ARegion *region, @@ -796,12 +796,10 @@ void ED_view3d_clipping_local(struct RegionView3D *rv3d, const float mat[4][4]); * * \note Callers should check #RV3D_CLIPPING_ENABLED first. */ -bool ED_view3d_clipping_test(const struct RegionView3D *rv3d, - const float co[3], - const bool is_local); +bool ED_view3d_clipping_test(const struct RegionView3D *rv3d, const float co[3], bool is_local); -float ED_view3d_radius_to_dist_persp(const float angle, const float radius); -float ED_view3d_radius_to_dist_ortho(const float lens, const float radius); +float ED_view3d_radius_to_dist_persp(float angle, float radius); +float ED_view3d_radius_to_dist_ortho(float lens, float radius); /** * Return a new #RegionView3D.dist value to fit the \a radius. * @@ -830,9 +828,9 @@ float ED_view3d_radius_to_dist_ortho(const float lens, const float radius); float ED_view3d_radius_to_dist(const struct View3D *v3d, const struct ARegion *region, const struct Depsgraph *depsgraph, - const char persp, - const bool use_aspect, - const float radius); + char persp, + bool use_aspect, + float radius); /** * Back-buffer select and draw support. @@ -842,7 +840,7 @@ void ED_view3d_backbuf_depth_validate(struct ViewContext *vc); * allow for small values [0.5 - 2.5], * and large values, FLT_MAX by clamping by the area size */ -int ED_view3d_backbuf_sample_size_clamp(struct ARegion *region, const float dist); +int ED_view3d_backbuf_sample_size_clamp(struct ARegion *region, float dist); void ED_view3d_select_id_validate(struct ViewContext *vc); @@ -859,7 +857,7 @@ bool ED_view3d_autodist(struct Depsgraph *depsgraph, struct View3D *v3d, const int mval[2], float mouse_worldloc[3], - const bool alphaoverride, + bool alphaoverride, const float fallback_depth_pt[3]); /** @@ -919,7 +917,7 @@ int view3d_opengl_select_ex(struct ViewContext *vc, const struct rcti *input, eV3DSelectMode select_mode, eV3DSelectObjectFilter select_filter, - const bool do_material_slot_selection); + bool do_material_slot_selection); int view3d_opengl_select(struct ViewContext *vc, unsigned int *buffer, unsigned int bufsize, @@ -1004,7 +1002,7 @@ void ED_view3d_mats_rv3d_restore(struct RegionView3D *rv3d, struct RV3DMatrixSto void ED_draw_object_facemap(struct Depsgraph *depsgraph, struct Object *ob, const float col[4], - const int facemap); + int facemap); struct RenderEngineType *ED_view3d_engine_type(const struct Scene *scene, int drawtype); @@ -1046,9 +1044,9 @@ void ED_view3d_update_viewmat(struct Depsgraph *depsgraph, const float winmat[4][4], const struct rcti *rect, bool offscreen); -bool ED_view3d_quat_from_axis_view(const char view, const char view_axis_roll, float r_quat[4]); +bool ED_view3d_quat_from_axis_view(char view, char view_axis_roll, float r_quat[4]); bool ED_view3d_quat_to_axis_view(const float viewquat[4], - const float epsilon, + float epsilon, char *r_view, char *r_view_axis_rotation); @@ -1079,7 +1077,7 @@ bool ED_view3d_offset_lock_check(const struct View3D *v3d, const struct RegionVi void ED_view3d_persp_switch_from_camera(const struct Depsgraph *depsgraph, struct View3D *v3d, struct RegionView3D *rv3d, - const char persp); + char persp); /** * Action to take when rotating the view, * handle auto-perspective and logic for switching out of views. @@ -1105,7 +1103,7 @@ bool ED_view3d_camera_lock_check(const struct View3D *v3d, const struct RegionVi void ED_view3d_camera_lock_init_ex(const struct Depsgraph *depsgraph, struct View3D *v3d, struct RegionView3D *rv3d, - const bool calc_dist); + bool calc_dist); void ED_view3d_camera_lock_init(const struct Depsgraph *depsgraph, struct View3D *v3d, struct RegionView3D *rv3d); @@ -1123,8 +1121,8 @@ bool ED_view3d_camera_lock_sync(const struct Depsgraph *depsgraph, bool ED_view3d_camera_autokey(const struct Scene *scene, struct ID *id_key, struct bContext *C, - const bool do_rotate, - const bool do_translate); + bool do_rotate, + bool do_translate); /** * Call after modifying a locked view. * @@ -1134,8 +1132,8 @@ bool ED_view3d_camera_autokey(const struct Scene *scene, bool ED_view3d_camera_lock_autokey(struct View3D *v3d, struct RegionView3D *rv3d, struct bContext *C, - const bool do_rotate, - const bool do_translate); + bool do_rotate, + bool do_translate); void ED_view3d_lock_clear(struct View3D *v3d); @@ -1154,15 +1152,13 @@ void ED_view3d_lock_clear(struct View3D *v3d); * \param fallback_dist: The distance to use if the object is too near or in front of \a ofs. * \returns A newly calculated distance or the fallback. */ -float ED_view3d_offset_distance(const float mat[4][4], - const float ofs[3], - const float fallback_dist); +float ED_view3d_offset_distance(const float mat[4][4], const float ofs[3], float fallback_dist); /** * Set the dist without moving the view (compensate with #RegionView3D.ofs) * * \note take care that #RegionView3d.viewinv is up to date, #ED_view3d_update_viewmat first. */ -void ED_view3d_distance_set(struct RegionView3D *rv3d, const float dist); +void ED_view3d_distance_set(struct RegionView3D *rv3d, float dist); /** * Change the distance & offset to match the depth of \a dist_co along the view axis. * @@ -1172,7 +1168,7 @@ void ED_view3d_distance_set(struct RegionView3D *rv3d, const float dist); */ bool ED_view3d_distance_set_from_location(struct RegionView3D *rv3d, const float dist_co[3], - const float dist_min); + float dist_min); /** * Could move this elsewhere, but tied into #ED_view3d_grid_scale @@ -1223,8 +1219,8 @@ void ED_view3d_draw_bgpic_test(const struct Scene *scene, struct Depsgraph *depsgraph, struct ARegion *region, struct View3D *v3d, - const bool do_foreground, - const bool do_camera_frame); + bool do_foreground, + bool do_camera_frame); /* view3d_gizmo_preselect_type.c */ @@ -1247,12 +1243,10 @@ void ED_view3d_buttons_region_layout_ex(const struct bContext *C, * Try to keep the same UUID previously used to allow users to quickly toggle back and forth. */ bool ED_view3d_local_collections_set(struct Main *bmain, struct View3D *v3d); -void ED_view3d_local_collections_reset(struct bContext *C, const bool reset_all); +void ED_view3d_local_collections_reset(struct bContext *C, bool reset_all); #ifdef WITH_XR_OPENXR -void ED_view3d_xr_mirror_update(const struct ScrArea *area, - const struct View3D *v3d, - const bool enable); +void ED_view3d_xr_mirror_update(const struct ScrArea *area, const struct View3D *v3d, bool enable); void ED_view3d_xr_shading_update(struct wmWindowManager *wm, const View3D *v3d, const struct Scene *scene); diff --git a/source/blender/editors/include/ED_view3d_offscreen.h b/source/blender/editors/include/ED_view3d_offscreen.h index 1da0a282697..ae2329c457b 100644 --- a/source/blender/editors/include/ED_view3d_offscreen.h +++ b/source/blender/editors/include/ED_view3d_offscreen.h @@ -53,8 +53,8 @@ void ED_view3d_draw_offscreen(struct Depsgraph *depsgraph, bool is_image_render, bool draw_background, const char *viewname, - const bool do_color_management, - const bool restore_rv3d_mats, + bool do_color_management, + bool restore_rv3d_mats, struct GPUOffScreen *ofs, struct GPUViewport *viewport); /** @@ -76,7 +76,7 @@ void ED_view3d_draw_offscreen_simple(struct Depsgraph *depsgraph, bool is_image_render, bool draw_background, const char *viewname, - const bool do_color_management, + bool do_color_management, struct GPUOffScreen *ofs, struct GPUViewport *viewport); @@ -96,7 +96,7 @@ struct ImBuf *ED_view3d_draw_offscreen_imbuf(struct Depsgraph *depsgraph, eImBufFlags imbuf_flag, int alpha_mode, const char *viewname, - const bool restore_rv3d_mats, + bool restore_rv3d_mats, struct GPUOffScreen *ofs, char err_out[256]); /** diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h index cee323bd5c9..f01b8318e98 100644 --- a/source/blender/editors/include/UI_interface.h +++ b/source/blender/editors/include/UI_interface.h @@ -494,9 +494,9 @@ void UI_draw_widget_scroll(struct uiWidgetColors *wcol, float UI_text_clip_middle_ex(const struct uiFontStyle *fstyle, char *str, float okwidth, - const float minwidth, + float minwidth, const size_t max_len, - const char rpart_sep); + char rpart_sep); /** * Callbacks @@ -531,11 +531,8 @@ typedef struct ARegion *(*uiButSearchCreateFn)(struct bContext *C, * to display the full list of options. The value will be false after the button's text is edited * (for every call except the first). */ -typedef void (*uiButSearchUpdateFn)(const struct bContext *C, - void *arg, - const char *str, - uiSearchItems *items, - const bool is_first); +typedef void (*uiButSearchUpdateFn)( + const struct bContext *C, void *arg, const char *str, uiSearchItems *items, bool is_first); typedef bool (*uiButSearchContextMenuFn)(struct bContext *C, void *arg, void *active, @@ -621,7 +618,7 @@ bool UI_but_is_tool(const uiBut *but); bool UI_but_is_utf8(const uiBut *but); #define UI_but_is_decorator(but) ((but)->type == UI_BTYPE_DECORATOR) -bool UI_block_is_empty_ex(const uiBlock *block, const bool skip_title); +bool UI_block_is_empty_ex(const uiBlock *block, bool skip_title); bool UI_block_is_empty(const uiBlock *block); bool UI_block_can_add_separator(const uiBlock *block); @@ -662,7 +659,7 @@ int UI_popup_menu_invoke(struct bContext *C, const char *idname, struct ReportLi * Allow setting menu return value from externals. * E.g. WM might need to do this for exiting files correctly. */ -void UI_popup_menu_retval_set(const uiBlock *block, const int retval, const bool enable); +void UI_popup_menu_retval_set(const uiBlock *block, int retval, bool enable); /** * Setting the button makes the popup open from the button instead of the cursor. */ @@ -866,7 +863,7 @@ void UI_but_drag_set_id(uiBut *but, struct ID *id); * Set an image to display while dragging. This works for any drag type (`WM_DRAG_XXX`). * Not to be confused with #UI_but_drag_set_image(), which sets up dragging of an image. */ -void UI_but_drag_attach_image(uiBut *but, struct ImBuf *imb, const float scale); +void UI_but_drag_attach_image(uiBut *but, struct ImBuf *imb, float scale); /** * \param asset: May be passed from a temporary variable, drag data only stores a copy of this. */ @@ -879,14 +876,14 @@ void UI_but_drag_set_asset(uiBut *but, struct ImBuf *imb, float scale); void UI_but_drag_set_rna(uiBut *but, struct PointerRNA *ptr); -void UI_but_drag_set_path(uiBut *but, const char *path, const bool use_free); +void UI_but_drag_set_path(uiBut *but, const char *path, bool use_free); void UI_but_drag_set_name(uiBut *but, const char *name); /** * Value from button itself. */ void UI_but_drag_set_value(uiBut *but); void UI_but_drag_set_image( - uiBut *but, const char *path, int icon, struct ImBuf *imb, float scale, const bool use_free); + uiBut *but, const char *path, int icon, struct ImBuf *imb, float scale, bool use_free); uiBut *UI_but_active_drop_name_button(const struct bContext *C); /** @@ -918,7 +915,7 @@ bool UI_but_active_only_ex(const struct bContext *C, struct ARegion *region, uiBlock *block, uiBut *but, - const bool remove_on_failure); + bool remove_on_failure); bool UI_but_active_only(const struct bContext *C, struct ARegion *region, uiBlock *block, @@ -1373,7 +1370,7 @@ uiBut *uiDefIconTextButO_ptr(uiBlock *block, /* for passing inputs to ButO buttons */ struct PointerRNA *UI_but_operator_ptr_get(uiBut *but); -void UI_but_unit_type_set(uiBut *but, const int unit_type); +void UI_but_unit_type_set(uiBut *but, int unit_type); int UI_but_unit_type_get(const uiBut *but); typedef enum uiStringInfoType { @@ -1641,7 +1638,7 @@ eAutoPropButsReturn uiDefAutoButsRNA(uiLayout *layout, void *user_data, struct PropertyRNA *prop_activate_init, eButLabelAlign label_align, - const bool compact); + bool compact); /** * Public function exported for functions that use #UI_BTYPE_SEARCH_MENU. @@ -1661,7 +1658,7 @@ bool UI_search_item_add(uiSearchItems *items, void *poin, int iconid, int state, - const uint8_t name_prefix_offset); + uint8_t name_prefix_offset); /** * \note The item-pointer (referred to below) is a per search item user pointer @@ -1682,7 +1679,7 @@ void UI_but_func_search_set(uiBut *but, uiButSearchCreateFn search_create_fn, uiButSearchUpdateFn search_update_fn, void *arg, - const bool free_arg, + bool free_arg, uiFreeArgFunc search_arg_free_fn, uiButHandleFunc search_exec_fn, void *active); @@ -1693,7 +1690,7 @@ void UI_but_func_search_set_tooltip(uiBut *but, uiButSearchTooltipFn tooltip_fn) * showing the icon and highlighted text after the last instance of this string. */ void UI_but_func_search_set_sep_string(uiBut *but, const char *search_sep_string); -void UI_but_func_search_set_results_are_suggestions(uiBut *but, const bool value); +void UI_but_func_search_set_results_are_suggestions(uiBut *but, bool value); /** * Height in pixels, it's using hard-coded values still. @@ -1918,7 +1915,7 @@ void UI_region_handlers_add(struct ListBase *handlers); void UI_popup_handlers_add(struct bContext *C, struct ListBase *handlers, uiPopupBlockHandle *popup, - const char flag); + char flag); void UI_popup_handlers_remove(struct ListBase *handlers, uiPopupBlockHandle *popup); void UI_popup_handlers_remove_all(struct bContext *C, struct ListBase *handlers); @@ -2168,7 +2165,7 @@ void uiTemplateID(uiLayout *layout, const char *openop, const char *unlinkop, int filter, - const bool live_icon, + bool live_icon, const char *text); void uiTemplateIDBrowse(uiLayout *layout, struct bContext *C, @@ -2189,7 +2186,7 @@ void uiTemplateIDPreview(uiLayout *layout, int rows, int cols, int filter, - const bool hide_buttons); + bool hide_buttons); /** * Version of #uiTemplateID using tabs. */ @@ -2233,8 +2230,8 @@ void uiTemplateSearchPreview(uiLayout *layout, const char *searchpropname, const char *newop, const char *unlinkop, - const int rows, - const int cols); + int rows, + int cols); /** * This is creating/editing RNA-Paths * @@ -2541,7 +2538,7 @@ void uiTemplateAssetView(struct uiLayout *layout, struct PointerRNA *active_dataptr, const char *active_propname, const struct AssetFilterSettings *filter_settings, - const int display_flags, + int display_flags, const char *activate_opname, struct PointerRNA *r_activate_op_properties, const char *drag_opname, @@ -2750,8 +2747,7 @@ typedef struct uiPropertySplitWrapper { uiPropertySplitWrapper uiItemPropertySplitWrapperCreate(uiLayout *parent_layout); void uiItemL(uiLayout *layout, const char *name, int icon); /* label */ -void uiItemL_ex( - uiLayout *layout, const char *name, int icon, const bool highlight, const bool redalert); +void uiItemL_ex(uiLayout *layout, const char *name, int icon, bool highlight, bool redalert); /** * Helper to add a label and creates a property split layout if needed. */ @@ -2862,7 +2858,7 @@ const char *UI_layout_introspect(uiLayout *layout); * Helper to add a big icon and create a split layout for alert popups. * Returns the layout to place further items into the alert box. */ -uiLayout *uiItemsAlertBox(uiBlock *block, const int size, const eAlertIcon icon); +uiLayout *uiItemsAlertBox(uiBlock *block, int size, eAlertIcon icon); /* UI Operators */ typedef struct uiDragColorHandle { @@ -3011,7 +3007,7 @@ int UI_fontstyle_string_width(const struct uiFontStyle *fs, */ int UI_fontstyle_string_width_with_block_aspect(const struct uiFontStyle *fs, const char *str, - const float aspect) ATTR_WARN_UNUSED_RESULT + float aspect) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1, 2); int UI_fontstyle_height_max(const struct uiFontStyle *fs); diff --git a/source/blender/editors/include/UI_interface.hh b/source/blender/editors/include/UI_interface.hh index d18ec009108..a52b4ebd338 100644 --- a/source/blender/editors/include/UI_interface.hh +++ b/source/blender/editors/include/UI_interface.hh @@ -59,10 +59,10 @@ void template_breadcrumbs(uiLayout &layout, Span<ContextPathItem> context_path); void attribute_search_add_items( StringRefNull str, - const bool is_output, + bool is_output, Span<const nodes::geometry_nodes_eval_log::GeometryAttributeInfo *> infos, uiSearchItems *items, - const bool is_first); + bool is_first); } // namespace blender::ui diff --git a/source/blender/editors/include/UI_interface_icons.h b/source/blender/editors/include/UI_interface_icons.h index 242b8504ae1..6ffeb4134ae 100644 --- a/source/blender/editors/include/UI_interface_icons.h +++ b/source/blender/editors/include/UI_interface_icons.h @@ -87,8 +87,8 @@ bool UI_icon_get_theme_color(int icon_id, unsigned char color[4]); void UI_icon_render_id(const struct bContext *C, struct Scene *scene, struct ID *id, - const enum eIconSizes size, - const bool use_job); + enum eIconSizes size, + bool use_job); /** * Render size for preview images and icons */ @@ -108,7 +108,7 @@ void UI_icon_draw_ex(float x, float alpha, float desaturate, const uchar mono_color[4], - const bool mono_border); + bool mono_border); void UI_icons_free(void); void UI_icons_free_drawinfo(void *drawinfo); @@ -121,13 +121,10 @@ int UI_iconfile_get_index(const char *filename); struct PreviewImage *UI_icon_to_preview(int icon_id); -int UI_icon_from_rnaptr(const struct bContext *C, - struct PointerRNA *ptr, - int rnaicon, - const bool big); -int UI_icon_from_idcode(const int idcode); +int UI_icon_from_rnaptr(const struct bContext *C, struct PointerRNA *ptr, int rnaicon, bool big); +int UI_icon_from_idcode(int idcode); int UI_icon_from_library(const struct ID *id); -int UI_icon_from_object_mode(const int mode); +int UI_icon_from_object_mode(int mode); int UI_icon_color_from_collection(const struct Collection *collection); #ifdef __cplusplus diff --git a/source/blender/editors/include/UI_resources.h b/source/blender/editors/include/UI_resources.h index 98e141c65b5..40e4d8cee9c 100644 --- a/source/blender/editors/include/UI_resources.h +++ b/source/blender/editors/include/UI_resources.h @@ -502,7 +502,7 @@ int UI_ThemeMenuShadowWidth(void); */ const unsigned char *UI_ThemeGetColorPtr(struct bTheme *btheme, int spacetype, int colorid); -void UI_make_axis_color(const unsigned char src_col[3], unsigned char dst_col[3], const char axis); +void UI_make_axis_color(const unsigned char src_col[3], unsigned char dst_col[3], char axis); #ifdef __cplusplus } diff --git a/source/blender/editors/include/UI_view2d.h b/source/blender/editors/include/UI_view2d.h index 37246c2fe8f..a3f39e1286e 100644 --- a/source/blender/editors/include/UI_view2d.h +++ b/source/blender/editors/include/UI_view2d.h @@ -175,7 +175,7 @@ void UI_view2d_view_ortho(const struct View2D *v2d); * \param xaxis: if non-zero, only use cur x-axis, * otherwise use cur-yaxis (mostly this will be used for x). */ -void UI_view2d_view_orthoSpecial(struct ARegion *region, struct View2D *v2d, const bool xaxis); +void UI_view2d_view_orthoSpecial(struct ARegion *region, struct View2D *v2d, bool xaxis); /** * Restore view matrices after drawing. */ @@ -435,7 +435,7 @@ void ED_keymap_view2d(struct wmKeyConfig *keyconf); void UI_view2d_smooth_view(struct bContext *C, struct ARegion *region, const struct rctf *cur, - const int smooth_viewtx); + int smooth_viewtx); #define UI_MARKER_MARGIN_Y (42 * UI_DPI_FAC) #define UI_TIME_SCRUB_MARGIN_Y (23 * UI_DPI_FAC) diff --git a/source/blender/editors/interface/interface_eyedropper_intern.h b/source/blender/editors/interface/interface_eyedropper_intern.h index 17bb78a7861..ec448ef9b9f 100644 --- a/source/blender/editors/interface/interface_eyedropper_intern.h +++ b/source/blender/editors/interface/interface_eyedropper_intern.h @@ -25,7 +25,7 @@ /* interface_eyedropper.c */ void eyedropper_draw_cursor_text_window(const struct wmWindow *window, const char *name); -void eyedropper_draw_cursor_text_region(const int x, const int y, const char *name); +void eyedropper_draw_cursor_text_region(int x, int y, const char *name); /** * Utility to retrieve a button representing a RNA property that is currently under the cursor. * diff --git a/source/blender/editors/interface/interface_intern.h b/source/blender/editors/interface/interface_intern.h index dc8744aaae9..027f03d05c7 100644 --- a/source/blender/editors/interface/interface_intern.h +++ b/source/blender/editors/interface/interface_intern.h @@ -671,7 +671,7 @@ extern void ui_but_v3_get(uiBut *but, float vec[3]); extern void ui_but_v3_set(uiBut *but, const float vec[3]); extern void ui_hsvcircle_vals_from_pos( - const rcti *rect, const float mx, const float my, float *r_val_rad, float *r_val_dist); + const rcti *rect, float mx, float my, float *r_val_rad, float *r_val_dist); /** * Cursor in HSV circle, in float units -1 to 1, to map on radius. */ @@ -689,8 +689,8 @@ extern void ui_hsvcube_pos_from_vals( extern void ui_but_string_get_ex(uiBut *but, char *str, const size_t maxlen, - const int float_precision, - const bool use_exp_float, + int float_precision, + bool use_exp_float, bool *r_use_exp_float) ATTR_NONNULL(1, 2); extern void ui_but_string_get(uiBut *but, char *str, const size_t maxlen) ATTR_NONNULL(); /** @@ -722,7 +722,7 @@ extern void ui_but_active_string_clear_and_exit(struct bContext *C, uiBut *but) extern void ui_but_set_string_interactive(struct bContext *C, uiBut *but, const char *value); extern uiBut *ui_but_drag_multi_edit_get(uiBut *but); -void ui_def_but_icon(uiBut *but, const int icon, const int flag); +void ui_def_but_icon(uiBut *but, int icon, int flag); /** * Avoid using this where possible since it's better not to ask for an icon in the first place. */ @@ -905,7 +905,7 @@ int ui_searchbox_find_index(struct ARegion *region, const char *name); /** * Region is the search box itself. */ -void ui_searchbox_update(struct bContext *C, struct ARegion *region, uiBut *but, const bool reset); +void ui_searchbox_update(struct bContext *C, struct ARegion *region, uiBut *but, bool reset); int ui_searchbox_autocomplete(struct bContext *C, struct ARegion *region, uiBut *but, char *str); bool ui_searchbox_event(struct bContext *C, struct ARegion *region, @@ -1000,9 +1000,9 @@ extern int ui_handler_panel_region(struct bContext *C, extern void ui_draw_aligned_panel(const struct uiStyle *style, const uiBlock *block, const rcti *rect, - const bool show_pin, - const bool show_background, - const bool region_search_filter_active); + bool show_pin, + bool show_background, + bool region_search_filter_active); void ui_panel_tag_search_filter_match(struct Panel *panel); /* interface_draw.c */ @@ -1013,10 +1013,7 @@ extern void ui_draw_dropshadow( /** * Draws in resolution of 48x4 colors. */ -void ui_draw_gradient(const rcti *rect, - const float hsv[3], - const eButGradientType type, - const float alpha); +void ui_draw_gradient(const rcti *rect, const float hsv[3], eButGradientType type, float alpha); /* based on UI_draw_roundbox_gl_mode, * check on making a version which allows us to skip some sides */ @@ -1040,7 +1037,7 @@ void ui_draw_but_COLORBAND(uiBut *but, const struct uiWidgetColors *wcol, const void ui_draw_but_UNITVEC(uiBut *but, const struct uiWidgetColors *wcol, const rcti *rect, - const float radius); + float radius); void ui_draw_but_CURVE(struct ARegion *region, uiBut *but, const struct uiWidgetColors *wcol, @@ -1118,7 +1115,7 @@ extern void ui_but_active_free(const struct bContext *C, uiBut *but); */ extern void ui_but_update_view_for_active(const struct bContext *C, const uiBlock *block); extern int ui_but_menu_direction(uiBut *but); -extern void ui_but_text_password_hide(char password_str[128], uiBut *but, const bool restore); +extern void ui_but_text_password_hide(char password_str[128], uiBut *but, bool restore); /** * Finds the pressed button in an aligned row (typically an expanded enum). * @@ -1131,7 +1128,7 @@ float ui_block_calc_pie_segment(struct uiBlock *block, const float event_xy[2]); /* XXX, this code will shorten any allocated string to 'UI_MAX_NAME_STR' * since this is really long its unlikely to be an issue, * but this could be supported */ -void ui_but_add_shortcut(uiBut *but, const char *shortcut_str, const bool do_strip); +void ui_but_add_shortcut(uiBut *but, const char *shortcut_str, bool do_strip); void ui_but_clipboard_free(void); bool ui_but_rna_equals(const uiBut *a, const uiBut *b); bool ui_but_rna_equals_ex(const uiBut *but, @@ -1272,8 +1269,8 @@ void uiStyleInit(void); /* interface_icons.c */ -void ui_icon_ensure_deferred(const struct bContext *C, const int icon_id, const bool big); -int ui_id_icon_get(const struct bContext *C, struct ID *id, const bool big); +void ui_icon_ensure_deferred(const struct bContext *C, int icon_id, bool big); +int ui_id_icon_get(const struct bContext *C, struct ID *id, bool big); /* interface_icons_event.c */ @@ -1365,7 +1362,7 @@ bool ui_but_is_toggle(const uiBut *but) ATTR_WARN_UNUSED_RESULT; * \note ctrl is kind of a hack currently, * so that non-embossed UI_BTYPE_TEXT button behaves as a label when ctrl is not pressed. */ -bool ui_but_is_interactive(const uiBut *but, const bool labeledit) ATTR_WARN_UNUSED_RESULT; +bool ui_but_is_interactive(const uiBut *but, bool labeledit) ATTR_WARN_UNUSED_RESULT; bool ui_but_is_popover_once_compat(const uiBut *but) ATTR_WARN_UNUSED_RESULT; bool ui_but_has_array_value(const uiBut *but) ATTR_WARN_UNUSED_RESULT; int ui_but_icon(const uiBut *but); @@ -1388,7 +1385,7 @@ uiBut *ui_list_find_from_row(const struct ARegion *region, uiBut *ui_list_row_find_mouse_over(const struct ARegion *region, const int xy[2]) ATTR_NONNULL(1, 2) ATTR_WARN_UNUSED_RESULT; uiBut *ui_list_row_find_from_index(const struct ARegion *region, - const int index, + int index, uiBut *listbox) ATTR_WARN_UNUSED_RESULT; uiBut *ui_tree_row_find_mouse_over(const struct ARegion *region, const int xy[2]) ATTR_NONNULL(1, 2); @@ -1400,7 +1397,7 @@ typedef bool (*uiButFindPollFn)(const uiBut *but, const void *customdata); */ uiBut *ui_but_find_mouse_over_ex(const struct ARegion *region, const int xy[2], - const bool labeledit, + bool labeledit, const uiButFindPollFn find_poll, const void *find_custom_data) ATTR_NONNULL(1, 2) ATTR_WARN_UNUSED_RESULT; @@ -1512,11 +1509,8 @@ typedef struct uiRNACollectionSearch { /* Block has to be stored for freeing butstore (uiBut.block doesn't work with undo). */ uiBlock *butstore_block; } uiRNACollectionSearch; -void ui_rna_collection_search_update_fn(const struct bContext *C, - void *arg, - const char *str, - uiSearchItems *items, - const bool is_first); +void ui_rna_collection_search_update_fn( + const struct bContext *C, void *arg, const char *str, uiSearchItems *items, bool is_first); /* interface_ops.c */ diff --git a/source/blender/editors/interface/interface_style.c b/source/blender/editors/interface/interface_style.c index 76063412758..c28769a4951 100644 --- a/source/blender/editors/interface/interface_style.c +++ b/source/blender/editors/interface/interface_style.c @@ -427,11 +427,11 @@ void uiStyleInit(void) } if (U.font_path_ui[0]) { - BLI_strncpy(font_first->filename, U.font_path_ui, sizeof(font_first->filename)); + BLI_strncpy(font_first->filepath, U.font_path_ui, sizeof(font_first->filepath)); font_first->uifont_id = UIFONT_CUSTOM1; } else { - BLI_strncpy(font_first->filename, "default", sizeof(font_first->filename)); + BLI_strncpy(font_first->filepath, "default", sizeof(font_first->filepath)); font_first->uifont_id = UIFONT_DEFAULT; } @@ -442,7 +442,7 @@ void uiStyleInit(void) font->blf_id = BLF_load_default(unique); } else { - font->blf_id = BLF_load(font->filename); + font->blf_id = BLF_load(font->filepath); if (font->blf_id == -1) { font->blf_id = BLF_load_default(unique); } diff --git a/source/blender/editors/mask/mask_intern.h b/source/blender/editors/mask/mask_intern.h index 41ff14dcd5f..19a3b3966a1 100644 --- a/source/blender/editors/mask/mask_intern.h +++ b/source/blender/editors/mask/mask_intern.h @@ -95,8 +95,8 @@ bool ED_mask_spline_select_check(const struct MaskSpline *spline); bool ED_mask_layer_select_check(const struct MaskLayer *mask_layer); bool ED_mask_select_check(const struct Mask *mask); -void ED_mask_spline_select_set(struct MaskSpline *spline, const bool do_select); -void ED_mask_layer_select_set(struct MaskLayer *mask_layer, const bool do_select); +void ED_mask_spline_select_set(struct MaskSpline *spline, bool do_select); +void ED_mask_layer_select_set(struct MaskLayer *mask_layer, bool do_select); void ED_mask_select_toggle_all(struct Mask *mask, int action); void ED_mask_select_flush_all(struct Mask *mask); @@ -126,8 +126,8 @@ bool ED_mask_find_nearest_diff_point(const struct bContext *C, int threshold, bool feather, float tangent[2], - const bool use_deform, - const bool use_project, + bool use_deform, + bool use_project, struct MaskLayer **r_mask_layer, struct MaskSpline **r_spline, struct MaskSplinePoint **r_point, @@ -136,7 +136,7 @@ bool ED_mask_find_nearest_diff_point(const struct bContext *C, bool ED_mask_feather_find_nearest(const struct bContext *C, struct Mask *mask, const float normal_co[2], - const float threshold, + float threshold, struct MaskLayer **r_mask_layer, struct MaskSpline **r_spline, struct MaskSplinePoint **r_point, @@ -145,7 +145,7 @@ bool ED_mask_feather_find_nearest(const struct bContext *C, struct MaskSplinePoint *ED_mask_point_find_nearest(const struct bContext *C, struct Mask *mask, const float normal_co[2], - const float threshold, + float threshold, struct MaskLayer **r_mask_layer, struct MaskSpline **r_spline, eMaskWhichHandle *r_which_handle, diff --git a/source/blender/editors/mesh/mesh_intern.h b/source/blender/editors/mesh/mesh_intern.h index bba142133a6..575e6d66ccd 100644 --- a/source/blender/editors/mesh/mesh_intern.h +++ b/source/blender/editors/mesh/mesh_intern.h @@ -48,7 +48,7 @@ bool EDBM_op_callf(struct BMEditMesh *em, struct wmOperator *op, const char *fmt bool EDBM_op_call_and_selectf(struct BMEditMesh *em, struct wmOperator *op, const char *select_slot, - const bool select_replace, + bool select_replace, const char *fmt, ...); /** @@ -74,7 +74,7 @@ bool EDBM_op_init( bool EDBM_op_finish(struct BMEditMesh *em, struct BMOperator *bmop, struct wmOperator *op, - const bool do_report); + bool do_report); void EDBM_stats_update(struct BMEditMesh *em); @@ -110,8 +110,8 @@ struct BMElem *EDBM_elem_from_index_any_multi(struct ViewLayer *view_layer, */ bool edbm_extrude_edges_indiv(struct BMEditMesh *em, struct wmOperator *op, - const char hflag, - const bool use_normal_flip); + char hflag, + bool use_normal_flip); /* *** editmesh_add.c *** */ diff --git a/source/blender/editors/object/object_add.c b/source/blender/editors/object/object_add.c index 9354171a1e4..b9943d13b19 100644 --- a/source/blender/editors/object/object_add.c +++ b/source/blender/editors/object/object_add.c @@ -1742,15 +1742,16 @@ void OBJECT_OT_collection_instance_add(wmOperatorType *ot) ot->prop = prop; ED_object_add_generic_props(ot, false); - RNA_def_int(ot->srna, - "session_uuid", - 0, - INT32_MIN, - INT32_MAX, - "Session UUID", - "Session UUID of the collection to add", - INT32_MIN, - INT32_MAX); + prop = RNA_def_int(ot->srna, + "session_uuid", + 0, + INT32_MIN, + INT32_MAX, + "Session UUID", + "Session UUID of the collection to add", + INT32_MIN, + INT32_MAX); + RNA_def_property_flag(prop, PROP_SKIP_SAVE | PROP_HIDDEN); object_add_drop_xy_props(ot); } diff --git a/source/blender/editors/object/object_intern.h b/source/blender/editors/object/object_intern.h index 9a1b4b48464..d517d68f1fc 100644 --- a/source/blender/editors/object/object_intern.h +++ b/source/blender/editors/object/object_intern.h @@ -176,8 +176,8 @@ void COLLECTION_OT_objects_remove_active(struct wmOperatorType *ot); bool edit_modifier_poll_generic(struct bContext *C, struct StructRNA *rna_type, int obtype_flag, - const bool is_editmode_allowed, - const bool is_liboverride_allowed); + bool is_editmode_allowed, + bool is_liboverride_allowed); void edit_modifier_properties(struct wmOperatorType *ot); bool edit_modifier_invoke_properties(struct bContext *C, struct wmOperator *op); diff --git a/source/blender/editors/physics/particle_object.c b/source/blender/editors/physics/particle_object.c index 4f571fa6353..896a37c3984 100644 --- a/source/blender/editors/physics/particle_object.c +++ b/source/blender/editors/physics/particle_object.c @@ -746,7 +746,7 @@ static bool remap_hair_emitter(Depsgraph *depsgraph, const bool use_dm_final_indices = (target_psys->part->use_modifier_stack && !target_psmd->mesh_final->runtime.deformed_only); - if (use_dm_final_indices) { + if (use_dm_final_indices || !target_psmd->mesh_original) { mesh = target_psmd->mesh_final; } else { diff --git a/source/blender/editors/screen/screen_draw.c b/source/blender/editors/screen/screen_draw.c index e720ae4b9d8..01730b3c9aa 100644 --- a/source/blender/editors/screen/screen_draw.c +++ b/source/blender/editors/screen/screen_draw.c @@ -144,7 +144,7 @@ static void drawscredge_area_draw( } GPUBatch *batch = batch_screen_edges_get(NULL); - GPU_batch_program_set_builtin(batch, GPU_SHADER_2D_AREA_EDGES); + GPU_batch_program_set_builtin(batch, GPU_SHADER_2D_AREA_BORDERS); GPU_batch_uniform_4fv(batch, "rect", (float *)&rect); GPU_batch_draw(batch); } @@ -212,7 +212,7 @@ void ED_screen_draw_edges(wmWindow *win) GPU_blend(GPU_BLEND_ALPHA); GPUBatch *batch = batch_screen_edges_get(&verts_per_corner); - GPU_batch_program_set_builtin(batch, GPU_SHADER_2D_AREA_EDGES); + GPU_batch_program_set_builtin(batch, GPU_SHADER_2D_AREA_BORDERS); GPU_batch_uniform_1i(batch, "cornerLen", verts_per_corner); GPU_batch_uniform_1f(batch, "scale", corner_scale); GPU_batch_uniform_4fv(batch, "color", col); diff --git a/source/blender/editors/screen/screen_intern.h b/source/blender/editors/screen/screen_intern.h index bc06e46ba96..e42c891b0ba 100644 --- a/source/blender/editors/screen/screen_intern.h +++ b/source/blender/editors/screen/screen_intern.h @@ -71,10 +71,10 @@ typedef enum eScreenAxis { /** * we swap spaces for fullscreen to keep all allocated data area vertices were set */ -void ED_area_data_copy(ScrArea *area_dst, ScrArea *area_src, const bool do_free); +void ED_area_data_copy(ScrArea *area_dst, ScrArea *area_src, bool do_free); void ED_area_data_swap(ScrArea *area_dst, ScrArea *area_src); /* for quick toggle, can skip fades */ -void region_toggle_hidden(struct bContext *C, ARegion *region, const bool do_fade); +void region_toggle_hidden(struct bContext *C, ARegion *region, bool do_fade); /* screen_draw.c */ @@ -85,7 +85,7 @@ void region_toggle_hidden(struct bContext *C, ARegion *region, const bool do_fad * \param sa2: Target area that will be replaced. */ void screen_draw_join_highlight(struct ScrArea *sa1, struct ScrArea *sa2); -void screen_draw_split_preview(struct ScrArea *area, const eScreenAxis dir_axis, const float fac); +void screen_draw_split_preview(struct ScrArea *area, eScreenAxis dir_axis, float fac); /* screen_edit.c */ @@ -111,9 +111,9 @@ void screen_change_prepare(bScreen *screen_old, ScrArea *area_split(const wmWindow *win, bScreen *screen, ScrArea *area, - const eScreenAxis dir_axis, - const float fac, - const bool merge); + eScreenAxis dir_axis, + float fac, + bool merge); /** * Join any two neighboring areas. Might involve complex changes. */ @@ -127,8 +127,7 @@ eScreenDir area_getorientation(ScrArea *sa_a, ScrArea *sa_b); /** * Get alignment offset of adjacent areas. 'dir' value is like #area_getorientation(). */ -void area_getoffsets( - ScrArea *sa_a, ScrArea *sa_b, const eScreenDir dir, int *r_offset1, int *r_offset2); +void area_getoffsets(ScrArea *sa_a, ScrArea *sa_b, eScreenDir dir, int *r_offset1, int *r_offset2); /** * Close a screen area, allowing most-aligned neighbor to take its place. */ @@ -150,15 +149,15 @@ bool screen_geom_edge_is_horizontal(ScrEdge *se); */ ScrEdge *screen_geom_area_map_find_active_scredge(const struct ScrAreaMap *area_map, const rcti *bounds_rect, - const int mx, - const int my); + int mx, + int my); /** * Need win size to make sure not to include edges along screen edge. */ ScrEdge *screen_geom_find_active_scredge(const wmWindow *win, const bScreen *screen, - const int mx, - const int my); + int mx, + int my); /** * \brief Main screen-layout calculation function. * @@ -172,7 +171,7 @@ void screen_geom_vertices_scale(const wmWindow *win, bScreen *screen); */ short screen_geom_find_area_split_point(const ScrArea *area, const rcti *window_rect, - const eScreenAxis dir_axis, + eScreenAxis dir_axis, float fac); /** * Select all edges that are directly or indirectly connected to \a edge. diff --git a/source/blender/editors/sculpt_paint/CMakeLists.txt b/source/blender/editors/sculpt_paint/CMakeLists.txt index 517125f016e..5c8d7a9e9b6 100644 --- a/source/blender/editors/sculpt_paint/CMakeLists.txt +++ b/source/blender/editors/sculpt_paint/CMakeLists.txt @@ -59,7 +59,7 @@ set(SRC sculpt.c sculpt_automasking.c sculpt_boundary.c - sculpt_brushes.c + sculpt_brush_types.c sculpt_cloth.c sculpt_detail.c sculpt_dyntopo.c diff --git a/source/blender/editors/sculpt_paint/paint_intern.h b/source/blender/editors/sculpt_paint/paint_intern.h index 09013ea00f4..d31390bbb42 100644 --- a/source/blender/editors/sculpt_paint/paint_intern.h +++ b/source/blender/editors/sculpt_paint/paint_intern.h @@ -152,10 +152,7 @@ unsigned int vpaint_get_current_col(struct Scene *scene, struct VPaint *vp, bool /** * \note weight-paint has an equivalent function: #ED_wpaint_blend_tool */ -unsigned int ED_vpaint_blend_tool(const int tool, - const uint col, - const uint paintcol, - const int alpha_i); +unsigned int ED_vpaint_blend_tool(int tool, uint col, uint paintcol, int alpha_i); /** * Apply callback to each vertex of the active vertex color layer. */ @@ -173,10 +170,7 @@ bool ED_vpaint_color_transform(struct Object *ob, * * \note vertex-paint has an equivalent function: #ED_vpaint_blend_tool */ -float ED_wpaint_blend_tool(const int tool, - const float weight, - const float paintval, - const float alpha); +float ED_wpaint_blend_tool(int tool, float weight, float paintval, float alpha); /* Utility for tools to ensure vertex groups exist before they begin. */ enum eWPaintFlag { WPAINT_ENSURE_MIRROR = (1 << 0), @@ -193,7 +187,7 @@ bool ED_wpaint_ensure_data(struct bContext *C, enum eWPaintFlag flag, struct WPaintVGroupIndex *vgroup_index); /** Return -1 when invalid. */ -int ED_wpaint_mirror_vgroup_ensure(struct Object *ob, const int vgroup_active); +int ED_wpaint_mirror_vgroup_ensure(struct Object *ob, int vgroup_active); /* paint_vertex_color_ops.c */ @@ -246,7 +240,7 @@ void paint_2d_stroke_done(void *ps); void paint_2d_stroke(void *ps, const float prev_mval[2], const float mval[2], - const bool eraser, + bool eraser, float pressure, float distance, float size); @@ -269,7 +263,7 @@ void paint_proj_stroke(const struct bContext *C, void *ps_handle_p, const float prev_pos[2], const float pos[2], - const bool eraser, + bool eraser, float pressure, float distance, float size); @@ -333,8 +327,8 @@ typedef struct CurveMaskCache { void paint_curve_mask_cache_free_data(CurveMaskCache *curve_mask_cache); void paint_curve_mask_cache_update(CurveMaskCache *curve_mask_cache, const struct Brush *brush, - const int diameter, - const float radius, + int diameter, + float radius, const float cursor_position[2]); /* sculpt_uv.c */ diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c index 21bbc9fb543..02886643cb4 100644 --- a/source/blender/editors/sculpt_paint/sculpt.c +++ b/source/blender/editors/sculpt_paint/sculpt.c @@ -3238,14 +3238,22 @@ static void do_brush_action(Sculpt *sd, Object *ob, Brush *brush, UnifiedPaintSe } } - /* Initialize auto-masking cache. For anchored brushes with spherical falloff, - * we start off with zero radius, thus we have no PBVH nodes on the first brush step. */ + /* For anchored brushes with spherical falloff, we start off with zero radius, thus we have no + * PBVH nodes on the first brush step. */ if (totnode || ((brush->falloff_shape == PAINT_FALLOFF_SHAPE_SPHERE) && (brush->flag & BRUSH_ANCHORED))) { if (SCULPT_stroke_is_first_brush_step(ss->cache)) { + /* Initialize auto-masking cache. */ if (SCULPT_is_automasking_enabled(sd, ss, brush)) { ss->cache->automasking = SCULPT_automasking_cache_init(sd, brush, ob); } + /* Initialize surface smooth cache. */ + if ((brush->sculpt_tool == SCULPT_TOOL_SMOOTH) && + (brush->smooth_deform_type == BRUSH_SMOOTH_DEFORM_SURFACE)) { + BLI_assert(ss->cache->surface_smooth_laplacian_disp == NULL); + ss->cache->surface_smooth_laplacian_disp = MEM_callocN( + sizeof(float[3]) * SCULPT_vertex_count_get(ss), "HC smooth laplacian b"); + } } } diff --git a/source/blender/editors/sculpt_paint/sculpt_brushes.c b/source/blender/editors/sculpt_paint/sculpt_brush_types.c index 8842d93410c..8842d93410c 100644 --- a/source/blender/editors/sculpt_paint/sculpt_brushes.c +++ b/source/blender/editors/sculpt_paint/sculpt_brush_types.c diff --git a/source/blender/editors/sculpt_paint/sculpt_intern.h b/source/blender/editors/sculpt_paint/sculpt_intern.h index f239d12b69e..c5abc0b1640 100644 --- a/source/blender/editors/sculpt_paint/sculpt_intern.h +++ b/source/blender/editors/sculpt_paint/sculpt_intern.h @@ -139,7 +139,7 @@ void SCULPT_vertex_limit_surface_get(SculptSession *ss, int index, float r_co[3] * depending on the given deformation target. */ float *SCULPT_brush_deform_target_vertex_co_get(SculptSession *ss, - const int deform_target, + int deform_target, PBVHVertexIter *iter); #define SCULPT_VERTEX_NEIGHBOR_FIXED_CAPACITY 256 @@ -160,8 +160,8 @@ typedef struct SculptVertexNeighborIter { } SculptVertexNeighborIter; void SCULPT_vertex_neighbors_get(struct SculptSession *ss, - const int index, - const bool include_duplicates, + int index, + bool include_duplicates, SculptVertexNeighborIter *iter); /* Iterator over neighboring vertices. */ @@ -200,7 +200,7 @@ struct MVert *SCULPT_mesh_deformed_mverts_get(SculptSession *ss); #define FAKE_NEIGHBOR_NONE -1 -void SCULPT_fake_neighbors_ensure(struct Sculpt *sd, Object *ob, const float max_dist); +void SCULPT_fake_neighbors_ensure(struct Sculpt *sd, Object *ob, float max_dist); void SCULPT_fake_neighbors_enable(Object *ob); void SCULPT_fake_neighbors_disable(Object *ob); void SCULPT_fake_neighbors_free(struct Object *ob); @@ -208,7 +208,7 @@ void SCULPT_fake_neighbors_free(struct Object *ob); /* Vertex Info. */ void SCULPT_boundary_info_ensure(Object *object); /* Boundary Info needs to be initialized in order to use this function. */ -bool SCULPT_vertex_is_boundary(const SculptSession *ss, const int index); +bool SCULPT_vertex_is_boundary(const SculptSession *ss, int index); void SCULPT_connected_components_ensure(Object *ob); @@ -327,7 +327,7 @@ void SCULPT_clip(Sculpt *sd, SculptSession *ss, float co[3], const float val[3]) float SCULPT_brush_plane_offset_get(Sculpt *sd, SculptSession *ss); ePaintSymmetryAreas SCULPT_get_vertex_symm_area(const float co[3]); -bool SCULPT_check_vertex_pivot_symmetry(const float vco[3], const float pco[3], const char symm); +bool SCULPT_check_vertex_pivot_symmetry(const float vco[3], const float pco[3], char symm); /** * Checks if a vertex is inside the brush radius from any of its mirrored axis. */ @@ -337,12 +337,12 @@ bool SCULPT_is_vertex_inside_brush_radius_symm(const float vertex[3], char symm); bool SCULPT_is_symmetry_iteration_valid(char i, char symm); void SCULPT_flip_v3_by_symm_area(float v[3], - const ePaintSymmetryFlags symm, - const ePaintSymmetryAreas symmarea, + ePaintSymmetryFlags symm, + ePaintSymmetryAreas symmarea, const float pivot[3]); void SCULPT_flip_quat_by_symm_area(float quat[4], - const ePaintSymmetryFlags symm, - const ePaintSymmetryAreas symmarea, + ePaintSymmetryFlags symm, + ePaintSymmetryAreas symmarea, const float pivot[3]); /* Flood Fill. */ @@ -420,9 +420,7 @@ struct AutomaskingCache *SCULPT_automasking_active_cache_get(SculptSession *ss); struct AutomaskingCache *SCULPT_automasking_cache_init(Sculpt *sd, Brush *brush, Object *ob); void SCULPT_automasking_cache_free(struct AutomaskingCache *automasking); -bool SCULPT_is_automasking_mode_enabled(const Sculpt *sd, - const Brush *br, - const eAutomasking_flag mode); +bool SCULPT_is_automasking_mode_enabled(const Sculpt *sd, const Brush *br, eAutomasking_flag mode); bool SCULPT_is_automasking_enabled(const Sculpt *sd, const SculptSession *ss, const Brush *br); typedef enum eBoundaryAutomaskMode { @@ -444,19 +442,19 @@ float *SCULPT_boundary_automasking_init(Object *ob, */ float *SCULPT_geodesic_distances_create(struct Object *ob, struct GSet *initial_vertices, - const float limit_radius); + float limit_radius); float *SCULPT_geodesic_from_vertex_and_symm(struct Sculpt *sd, struct Object *ob, - const int vertex, - const float limit_radius); -float *SCULPT_geodesic_from_vertex(Object *ob, const int vertex, const float limit_radius); + int vertex, + float limit_radius); +float *SCULPT_geodesic_from_vertex(Object *ob, int vertex, float limit_radius); /* Filters. */ -void SCULPT_filter_cache_init(struct bContext *C, Object *ob, Sculpt *sd, const int undo_type); +void SCULPT_filter_cache_init(struct bContext *C, Object *ob, Sculpt *sd, int undo_type); void SCULPT_filter_cache_free(SculptSession *ss); void SCULPT_mask_filter_smooth_apply( - Sculpt *sd, Object *ob, PBVHNode **nodes, const int totnode, const int smooth_iterations); + Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode, int smooth_iterations); /* Brushes. */ @@ -474,13 +472,12 @@ void SCULPT_cloth_simulation_free(struct SculptClothSimulation *cloth_sim); /* Public functions. */ -struct SculptClothSimulation *SCULPT_cloth_brush_simulation_create( - struct SculptSession *ss, - const float cloth_mass, - const float cloth_damping, - const float cloth_softbody_strength, - const bool use_collisions, - const bool needs_deform_coords); +struct SculptClothSimulation *SCULPT_cloth_brush_simulation_create(struct SculptSession *ss, + float cloth_mass, + float cloth_damping, + float cloth_softbody_strength, + bool use_collisions, + bool needs_deform_coords); void SCULPT_cloth_brush_simulation_init(struct SculptSession *ss, struct SculptClothSimulation *cloth_sim); @@ -503,20 +500,20 @@ void SCULPT_cloth_brush_ensure_nodes_constraints(struct Sculpt *sd, int totnode, struct SculptClothSimulation *cloth_sim, float initial_location[3], - const float radius); + float radius); /** * Cursor drawing function. */ -void SCULPT_cloth_simulation_limits_draw(const uint gpuattr, +void SCULPT_cloth_simulation_limits_draw(uint gpuattr, const struct Brush *brush, const float location[3], const float normal[3], - const float rds, - const float line_width, + float rds, + float line_width, const float outline_col[3], - const float alpha); -void SCULPT_cloth_plane_falloff_preview_draw(const uint gpuattr, + float alpha); +void SCULPT_cloth_plane_falloff_preview_draw(uint gpuattr, struct SculptSession *ss, const float outline_col[3], float outline_alpha); @@ -601,7 +598,7 @@ struct SculptPoseIKChain *SCULPT_pose_ik_chain_init(struct Sculpt *sd, struct SculptSession *ss, struct Brush *br, const float initial_location[3], - const float radius); + float radius); void SCULPT_pose_ik_chain_free(struct SculptPoseIKChain *ik_chain); /* Boundary Brush. */ @@ -612,8 +609,8 @@ void SCULPT_pose_ik_chain_free(struct SculptPoseIKChain *ik_chain); */ struct SculptBoundary *SCULPT_boundary_data_init(Object *object, Brush *brush, - const int initial_vertex, - const float radius); + int initial_vertex, + float radius); void SCULPT_boundary_data_free(struct SculptBoundary *boundary); /* Main Brush Function. */ void SCULPT_do_boundary_brush(struct Sculpt *sd, @@ -621,20 +618,20 @@ void SCULPT_do_boundary_brush(struct Sculpt *sd, struct PBVHNode **nodes, int totnode); -void SCULPT_boundary_edges_preview_draw(const uint gpuattr, +void SCULPT_boundary_edges_preview_draw(uint gpuattr, struct SculptSession *ss, const float outline_col[3], - const float outline_alpha); -void SCULPT_boundary_pivot_line_preview_draw(const uint gpuattr, struct SculptSession *ss); + float outline_alpha); +void SCULPT_boundary_pivot_line_preview_draw(uint gpuattr, struct SculptSession *ss); /* Multi-plane Scrape Brush. */ /* Main Brush Function. */ void SCULPT_do_multiplane_scrape_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode); -void SCULPT_multiplane_scrape_preview_draw(const uint gpuattr, +void SCULPT_multiplane_scrape_preview_draw(uint gpuattr, Brush *brush, SculptSession *ss, const float outline_col[3], - const float outline_alpha); + float outline_alpha); /* Draw Face Sets Brush. */ void SCULPT_do_draw_face_sets_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode); @@ -661,12 +658,8 @@ void SCULPT_neighbor_color_average(SculptSession *ss, float result[4], int index */ void SCULPT_neighbor_coords_average_interior(SculptSession *ss, float result[3], int index); -void SCULPT_smooth(Sculpt *sd, - Object *ob, - PBVHNode **nodes, - const int totnode, - float bstrength, - const bool smooth_mask); +void SCULPT_smooth( + Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode, float bstrength, bool smooth_mask); void SCULPT_do_smooth_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode); /* Surface Smooth Brush. */ @@ -675,15 +668,11 @@ void SCULPT_surface_smooth_laplacian_step(SculptSession *ss, float *disp, const float co[3], float (*laplacian_disp)[3], - const int v_index, + int v_index, const float origco[3], - const float alpha); -void SCULPT_surface_smooth_displace_step(SculptSession *ss, - float *co, - float (*laplacian_disp)[3], - const int v_index, - const float beta, - const float fade); + float alpha); +void SCULPT_surface_smooth_displace_step( + SculptSession *ss, float *co, float (*laplacian_disp)[3], int v_index, float beta, float fade); void SCULPT_do_surface_smooth_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode); /* Slide/Relax */ @@ -954,7 +943,7 @@ bool SCULPT_brush_test_sphere_fast(const SculptBrushTest *test, const float co[3 bool SCULPT_brush_test_cube(SculptBrushTest *test, const float co[3], const float local[4][4], - const float roundness); + float roundness); bool SCULPT_brush_test_circle_sq(SculptBrushTest *test, const float co[3]); /** * Test AABB against sphere. @@ -977,19 +966,19 @@ const float *SCULPT_brush_frontface_normal_from_falloff_shape(SculptSession *ss, float SCULPT_brush_strength_factor(struct SculptSession *ss, const struct Brush *br, const float point[3], - const float len, + float len, const short vno[3], const float fno[3], - const float mask, - const int vertex_index, - const int thread_id); + float mask, + int vertex_index, + int thread_id); /** * Tilts a normal by the x and y tilt values using the view axis. */ void SCULPT_tilt_apply_to_normal(float r_normal[3], struct StrokeCache *cache, - const float tilt_strength); + float tilt_strength); /** * Get effective surface normal with pen tilt and tilt strength applied to it. @@ -1423,10 +1412,7 @@ typedef struct FilterCache { * Flip all the edit-data across the axis/axes specified by \a symm. * Used to calculate multiple modifications to the mesh when symmetry is enabled. */ -void SCULPT_cache_calc_brushdata_symm(StrokeCache *cache, - const char symm, - const char axis, - const float angle); +void SCULPT_cache_calc_brushdata_symm(StrokeCache *cache, char symm, char axis, float angle); void SCULPT_cache_free(StrokeCache *cache); SculptUndoNode *SCULPT_undo_push_node(Object *ob, PBVHNode *node, SculptUndoType type); @@ -1434,7 +1420,7 @@ SculptUndoNode *SCULPT_undo_get_node(PBVHNode *node); SculptUndoNode *SCULPT_undo_get_first_node(void); void SCULPT_undo_push_begin(struct Object *ob, const char *name); void SCULPT_undo_push_end(void); -void SCULPT_undo_push_end_ex(const bool use_nested_undo); +void SCULPT_undo_push_end_ex(bool use_nested_undo); void SCULPT_vertcos_to_key(Object *ob, KeyBlock *kb, const float (*vertCos)[3]); @@ -1516,7 +1502,7 @@ void SCULPT_OT_dyntopo_detail_size_edit(struct wmOperatorType *ot); void SCULPT_OT_dynamic_topology_toggle(struct wmOperatorType *ot); -/* sculpt_brushes.c */ +/* sculpt_brush_types.c */ float SCULPT_clay_thumb_get_stabilized_pressure(struct StrokeCache *cache); @@ -1615,13 +1601,10 @@ void SCULPT_do_mask_brush(struct Sculpt *sd, struct PBVHNode **nodes, int totnode); -void SCULPT_bmesh_topology_rake(struct Sculpt *sd, - struct Object *ob, - struct PBVHNode **nodes, - const int totnode, - float bstrength); +void SCULPT_bmesh_topology_rake( + struct Sculpt *sd, struct Object *ob, struct PBVHNode **nodes, int totnode, float bstrength); -/* end sculpt_brushes.c */ +/* end sculpt_brush_types.c */ /* sculpt_ops.c */ void SCULPT_OT_brush_stroke(struct wmOperatorType *ot); diff --git a/source/blender/editors/sculpt_paint/sculpt_smooth.c b/source/blender/editors/sculpt_paint/sculpt_smooth.c index 847f42fe9e8..c65489548b7 100644 --- a/source/blender/editors/sculpt_paint/sculpt_smooth.c +++ b/source/blender/editors/sculpt_paint/sculpt_smooth.c @@ -538,13 +538,6 @@ static void SCULPT_do_surface_smooth_brush_displace_task_cb_ex( void SCULPT_do_surface_smooth_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode) { Brush *brush = BKE_paint_brush(&sd->paint); - SculptSession *ss = ob->sculpt; - - if (SCULPT_stroke_is_first_brush_step(ss->cache)) { - BLI_assert(ss->cache->surface_smooth_laplacian_disp == NULL); - ss->cache->surface_smooth_laplacian_disp = MEM_callocN( - sizeof(float[3]) * SCULPT_vertex_count_get(ss), "HC smooth laplacian b"); - } /* Threaded loop over nodes. */ SculptThreadedTaskData data = { diff --git a/source/blender/editors/space_api/spacetypes.c b/source/blender/editors/space_api/spacetypes.c index 93d023c8bb4..f8adba30547 100644 --- a/source/blender/editors/space_api/spacetypes.c +++ b/source/blender/editors/space_api/spacetypes.c @@ -248,15 +248,16 @@ void *ED_region_draw_cb_activate(ARegionType *art, return rdc; } -void ED_region_draw_cb_exit(ARegionType *art, void *handle) +bool ED_region_draw_cb_exit(ARegionType *art, void *handle) { LISTBASE_FOREACH (RegionDrawCB *, rdc, &art->drawcalls) { if (rdc == (RegionDrawCB *)handle) { BLI_remlink(&art->drawcalls, rdc); MEM_freeN(rdc); - return; + return true; } } + return false; } static void ed_region_draw_cb_draw(const bContext *C, ARegion *region, ARegionType *art, int type) diff --git a/source/blender/editors/space_clip/clip_intern.h b/source/blender/editors/space_clip/clip_intern.h index 20cc6e3da15..15f905f3157 100644 --- a/source/blender/editors/space_clip/clip_intern.h +++ b/source/blender/editors/space_clip/clip_intern.h @@ -184,7 +184,7 @@ void clip_delete_plane_track(struct bContext *C, * 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); + SpaceClip *sc, float x, float y, float *r_offset_x, float *r_offset_y); void clip_view_center_to_point(SpaceClip *sc, float x, float y); bool clip_view_calculate_view_selection( diff --git a/source/blender/editors/space_file/file_intern.h b/source/blender/editors/space_file/file_intern.h index 3fe48157a09..4334beea196 100644 --- a/source/blender/editors/space_file/file_intern.h +++ b/source/blender/editors/space_file/file_intern.h @@ -128,7 +128,7 @@ void fileselect_refresh_params(struct SpaceFile *sfile); /** * Sets #FileSelectParams.file (name of selected file) */ -void fileselect_file_set(SpaceFile *sfile, const int index); +void fileselect_file_set(SpaceFile *sfile, int index); bool file_attribute_column_type_enabled(const FileSelectParams *params, FileAttributeColumnType column); /** @@ -204,7 +204,7 @@ void file_tools_region_panels_register(struct ARegionType *art); /* file_utils.c */ -void file_tile_boundbox(const ARegion *region, FileLayout *layout, const int file, rcti *r_bounds); +void file_tile_boundbox(const ARegion *region, FileLayout *layout, int file, rcti *r_bounds); /** * If \a path leads to a .blend, remove the trailing slash (if needed). diff --git a/source/blender/editors/space_file/filelist.h b/source/blender/editors/space_file/filelist.h index 0119a9b4f52..696986d4660 100644 --- a/source/blender/editors/space_file/filelist.h +++ b/source/blender/editors/space_file/filelist.h @@ -62,16 +62,16 @@ void folder_history_list_ensure_for_active_browse_mode(struct SpaceFile *sfile); void folder_history_list_free(struct SpaceFile *sfile); struct ListBase folder_history_list_duplicate(struct ListBase *listbase); -void filelist_setsorting(struct FileList *filelist, const short sort, bool invert_sort); +void filelist_setsorting(struct FileList *filelist, short sort, bool invert_sort); void filelist_sort(struct FileList *filelist); void filelist_setfilter_options(struct FileList *filelist, - const bool do_filter, - const bool hide_dot, - const bool hide_parent, - const uint64_t filter, - const uint64_t filter_id, - const bool filter_assets_only, + bool do_filter, + bool hide_dot, + bool hide_parent, + uint64_t filter, + uint64_t filter_id, + bool filter_assets_only, const char *filter_glob, const char *filter_search); /** @@ -98,19 +98,19 @@ void filelist_setlibrary(struct FileList *filelist, void filelist_init_icons(void); void filelist_free_icons(void); -struct ImBuf *filelist_getimage(struct FileList *filelist, const int index); +struct ImBuf *filelist_getimage(struct FileList *filelist, int index); struct ImBuf *filelist_file_getimage(const FileDirEntry *file); struct ImBuf *filelist_geticon_image_ex(const FileDirEntry *file); -struct ImBuf *filelist_geticon_image(struct FileList *filelist, const int index); -int filelist_geticon(struct FileList *filelist, const int index, const bool is_main); +struct ImBuf *filelist_geticon_image(struct FileList *filelist, int index); +int filelist_geticon(struct FileList *filelist, int index, bool is_main); struct FileList *filelist_new(short type); void filelist_settype(struct FileList *filelist, short type); void filelist_clear(struct FileList *filelist); void filelist_clear_ex(struct FileList *filelist, - const bool do_asset_library, - const bool do_cache, - const bool do_selection); + bool do_asset_library, + bool do_cache, + bool do_selection); /** * A "smarter" version of #filelist_clear() that calls partial clearing based on the filelist * force-reset flags. @@ -156,7 +156,7 @@ void filelist_file_cache_slidingwindow_set(struct FileList *filelist, size_t win /** * Load in cache all entries "around" given index (as much as block cache may hold). */ -bool filelist_file_cache_block(struct FileList *filelist, const int index); +bool filelist_file_cache_block(struct FileList *filelist, int index); bool filelist_needs_force_reset(struct FileList *filelist); void filelist_tag_force_reset(struct FileList *filelist); @@ -171,7 +171,7 @@ unsigned int filelist_entry_select_set(const struct FileList *filelist, unsigned int flag, FileCheckType check); void filelist_entry_select_index_set(struct FileList *filelist, - const int index, + int index, FileSelType select, unsigned int flag, FileCheckType check); @@ -184,9 +184,9 @@ unsigned int filelist_entry_select_get(struct FileList *filelist, struct FileDirEntry *entry, FileCheckType check); unsigned int filelist_entry_select_index_get(struct FileList *filelist, - const int index, + int index, FileCheckType check); -bool filelist_entry_is_selected(struct FileList *filelist, const int index); +bool filelist_entry_is_selected(struct FileList *filelist, int index); /** * Set selection of the '..' parent entry, but only if it's actually visible. */ @@ -195,7 +195,7 @@ void filelist_entry_parent_select_set(struct FileList *filelist, unsigned int flag, FileCheckType check); -void filelist_setrecursion(struct FileList *filelist, const int recursion_level); +void filelist_setrecursion(struct FileList *filelist, int recursion_level); struct AssetLibrary *filelist_asset_library(struct FileList *filelist); @@ -213,7 +213,7 @@ void filelist_readjob_stop(struct FileList *filelist, struct wmWindowManager *wm int filelist_readjob_running(struct FileList *filelist, struct wmWindowManager *wm); bool filelist_cache_previews_update(struct FileList *filelist); -void filelist_cache_previews_set(struct FileList *filelist, const bool use_previews); +void filelist_cache_previews_set(struct FileList *filelist, bool use_previews); bool filelist_cache_previews_running(struct FileList *filelist); bool filelist_cache_previews_done(struct FileList *filelist); diff --git a/source/blender/editors/space_file/fsmenu.h b/source/blender/editors/space_file/fsmenu.h index 6296314d40a..0915c9a5a2f 100644 --- a/source/blender/editors/space_file/fsmenu.h +++ b/source/blender/editors/space_file/fsmenu.h @@ -42,7 +42,7 @@ void fsmenu_insert_entry(struct FSMenu *fsmenu, const char *path, const char *name, int icon, - const enum FSMenuInsert flag); + enum FSMenuInsert flag); /** Refresh 'valid' status of given menu entry */ void fsmenu_entry_refresh_valid(struct FSMenuEntry *fsentry); diff --git a/source/blender/editors/space_info/textview.h b/source/blender/editors/space_info/textview.h index 96f537b4b97..38c073a328a 100644 --- a/source/blender/editors/space_info/textview.h +++ b/source/blender/editors/space_info/textview.h @@ -81,7 +81,7 @@ typedef struct TextViewContext { * Use for selection. */ int textview_draw(struct TextViewContext *tvc, - const bool do_draw, + bool do_draw, const int mval_init[2], void **r_mval_pick_item, int *r_mval_pick_offset); diff --git a/source/blender/editors/space_node/drawnode.cc b/source/blender/editors/space_node/drawnode.cc index 5bb5320655b..ba1c0b41a98 100644 --- a/source/blender/editors/space_node/drawnode.cc +++ b/source/blender/editors/space_node/drawnode.cc @@ -216,22 +216,6 @@ static void node_buts_texture(uiLayout *layout, bContext *UNUSED(C), PointerRNA } } -static void node_shader_buts_clamp(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) -{ - uiItemR(layout, ptr, "clamp_type", DEFAULT_FLAGS, "", ICON_NONE); -} - -static void node_shader_buts_map_range(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) -{ - uiItemR(layout, ptr, "data_type", DEFAULT_FLAGS, "", ICON_NONE); - uiItemR(layout, ptr, "interpolation_type", DEFAULT_FLAGS, "", ICON_NONE); - if (!ELEM(RNA_enum_get(ptr, "interpolation_type"), - NODE_MAP_RANGE_SMOOTHSTEP, - NODE_MAP_RANGE_SMOOTHERSTEP)) { - uiItemR(layout, ptr, "clamp", DEFAULT_FLAGS, nullptr, ICON_NONE); - } -} - static void node_buts_math(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { uiItemR(layout, ptr, "operation", DEFAULT_FLAGS, "", ICON_NONE); @@ -380,40 +364,6 @@ static void node_buts_image_user(uiLayout *layout, } } -static void node_shader_buts_mapping(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) -{ - uiItemR(layout, ptr, "vector_type", DEFAULT_FLAGS, nullptr, ICON_NONE); -} - -static void node_shader_buts_vector_rotate(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) -{ - uiItemR(layout, ptr, "rotation_type", DEFAULT_FLAGS, nullptr, ICON_NONE); - uiItemR(layout, ptr, "invert", DEFAULT_FLAGS, nullptr, 0); -} - -static void node_shader_buts_vect_math(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) -{ - uiItemR(layout, ptr, "operation", DEFAULT_FLAGS, "", ICON_NONE); -} - -static void node_shader_buts_vect_transform(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) -{ - uiItemR(layout, ptr, "vector_type", DEFAULT_FLAGS | UI_ITEM_R_EXPAND, nullptr, ICON_NONE); - uiItemR(layout, ptr, "convert_from", DEFAULT_FLAGS, "", ICON_NONE); - uiItemR(layout, ptr, "convert_to", DEFAULT_FLAGS, "", ICON_NONE); -} - -static void node_shader_buts_attribute(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) -{ - uiItemR(layout, ptr, "attribute_type", DEFAULT_FLAGS, IFACE_("Type"), ICON_NONE); - uiItemR(layout, ptr, "attribute_name", DEFAULT_FLAGS, IFACE_("Name"), ICON_NONE); -} - -static void node_shader_buts_wireframe(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) -{ - uiItemR(layout, ptr, "use_pixel_size", DEFAULT_FLAGS, nullptr, 0); -} - static void node_shader_buts_tex_image(uiLayout *layout, bContext *C, PointerRNA *ptr) { PointerRNA imaptr = RNA_pointer_get(ptr, "image"); @@ -483,375 +433,21 @@ static void node_shader_buts_tex_environment_ex(uiLayout *layout, bContext *C, P uiItemR(layout, ptr, "projection", DEFAULT_FLAGS, IFACE_("Projection"), ICON_NONE); } -static void node_shader_buts_tex_sky(uiLayout *layout, bContext *C, PointerRNA *ptr) -{ - uiItemR(layout, ptr, "sky_type", DEFAULT_FLAGS, "", ICON_NONE); - - if (RNA_enum_get(ptr, "sky_type") == SHD_SKY_PREETHAM) { - uiItemR(layout, ptr, "sun_direction", DEFAULT_FLAGS, "", ICON_NONE); - uiItemR(layout, ptr, "turbidity", DEFAULT_FLAGS, nullptr, ICON_NONE); - } - if (RNA_enum_get(ptr, "sky_type") == SHD_SKY_HOSEK) { - uiItemR(layout, ptr, "sun_direction", DEFAULT_FLAGS, "", ICON_NONE); - uiItemR(layout, ptr, "turbidity", DEFAULT_FLAGS, nullptr, ICON_NONE); - uiItemR(layout, ptr, "ground_albedo", DEFAULT_FLAGS, nullptr, ICON_NONE); - } - if (RNA_enum_get(ptr, "sky_type") == SHD_SKY_NISHITA) { - Scene *scene = CTX_data_scene(C); - if (BKE_scene_uses_blender_eevee(scene)) { - uiItemL(layout, TIP_("Nishita not available in Eevee"), ICON_ERROR); - } - uiItemR(layout, ptr, "sun_disc", DEFAULT_FLAGS, nullptr, 0); - - uiLayout *col; - if (RNA_boolean_get(ptr, "sun_disc")) { - col = uiLayoutColumn(layout, true); - uiItemR(col, ptr, "sun_size", DEFAULT_FLAGS, nullptr, ICON_NONE); - uiItemR(col, ptr, "sun_intensity", DEFAULT_FLAGS, nullptr, ICON_NONE); - } - - col = uiLayoutColumn(layout, true); - uiItemR(col, ptr, "sun_elevation", DEFAULT_FLAGS, nullptr, ICON_NONE); - uiItemR(col, ptr, "sun_rotation", DEFAULT_FLAGS, nullptr, ICON_NONE); - - uiItemR(layout, ptr, "altitude", DEFAULT_FLAGS, nullptr, ICON_NONE); - - col = uiLayoutColumn(layout, true); - uiItemR(col, ptr, "air_density", DEFAULT_FLAGS, nullptr, ICON_NONE); - uiItemR(col, ptr, "dust_density", DEFAULT_FLAGS, nullptr, ICON_NONE); - uiItemR(col, ptr, "ozone_density", DEFAULT_FLAGS, nullptr, ICON_NONE); - } -} - -static void node_shader_buts_tex_gradient(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) -{ - uiItemR(layout, ptr, "gradient_type", DEFAULT_FLAGS, "", ICON_NONE); -} - -static void node_shader_buts_tex_magic(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) -{ - uiItemR(layout, ptr, "turbulence_depth", DEFAULT_FLAGS, nullptr, ICON_NONE); -} - -static void node_shader_buts_tex_brick(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) -{ - uiLayout *col; - - col = uiLayoutColumn(layout, true); - uiItemR(col, ptr, "offset", DEFAULT_FLAGS | UI_ITEM_R_SLIDER, IFACE_("Offset"), ICON_NONE); - uiItemR(col, ptr, "offset_frequency", DEFAULT_FLAGS, IFACE_("Frequency"), ICON_NONE); - - col = uiLayoutColumn(layout, true); - uiItemR(col, ptr, "squash", DEFAULT_FLAGS, IFACE_("Squash"), ICON_NONE); - uiItemR(col, ptr, "squash_frequency", DEFAULT_FLAGS, IFACE_("Frequency"), ICON_NONE); -} - -static void node_shader_buts_tex_wave(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) -{ - uiItemR(layout, ptr, "wave_type", DEFAULT_FLAGS, "", ICON_NONE); - int type = RNA_enum_get(ptr, "wave_type"); - if (type == SHD_WAVE_BANDS) { - uiItemR(layout, ptr, "bands_direction", DEFAULT_FLAGS, "", ICON_NONE); - } - else { /* SHD_WAVE_RINGS */ - uiItemR(layout, ptr, "rings_direction", DEFAULT_FLAGS, "", ICON_NONE); - } - - uiItemR(layout, ptr, "wave_profile", DEFAULT_FLAGS, "", ICON_NONE); -} - -static void node_shader_buts_tex_musgrave(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) -{ - uiItemR(layout, ptr, "musgrave_dimensions", DEFAULT_FLAGS, "", ICON_NONE); - uiItemR(layout, ptr, "musgrave_type", DEFAULT_FLAGS, "", ICON_NONE); -} - -static void node_shader_buts_tex_voronoi(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) -{ - uiItemR(layout, ptr, "voronoi_dimensions", DEFAULT_FLAGS, "", ICON_NONE); - uiItemR(layout, ptr, "feature", DEFAULT_FLAGS, "", ICON_NONE); - int feature = RNA_enum_get(ptr, "feature"); - if (!ELEM(feature, SHD_VORONOI_DISTANCE_TO_EDGE, SHD_VORONOI_N_SPHERE_RADIUS) && - RNA_enum_get(ptr, "voronoi_dimensions") != 1) { - uiItemR(layout, ptr, "distance", DEFAULT_FLAGS, "", ICON_NONE); - } -} - -static void node_shader_buts_tex_noise(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) -{ - uiItemR(layout, ptr, "noise_dimensions", DEFAULT_FLAGS, "", ICON_NONE); -} - -static void node_shader_buts_tex_pointdensity(uiLayout *layout, - bContext *UNUSED(C), - PointerRNA *ptr) -{ - bNode *node = (bNode *)ptr->data; - NodeShaderTexPointDensity *shader_point_density = (NodeShaderTexPointDensity *)node->storage; - Object *ob = (Object *)node->id; - - PointerRNA ob_ptr, obdata_ptr; - RNA_id_pointer_create((ID *)ob, &ob_ptr); - RNA_id_pointer_create(ob ? (ID *)ob->data : nullptr, &obdata_ptr); - - uiItemR(layout, ptr, "point_source", UI_ITEM_R_EXPAND, nullptr, ICON_NONE); - uiItemR(layout, ptr, "object", DEFAULT_FLAGS, nullptr, ICON_NONE); - - if (node->id && shader_point_density->point_source == SHD_POINTDENSITY_SOURCE_PSYS) { - PointerRNA dataptr; - RNA_id_pointer_create((ID *)node->id, &dataptr); - uiItemPointerR( - layout, ptr, "particle_system", &dataptr, "particle_systems", nullptr, ICON_NONE); - } - - uiItemR(layout, ptr, "space", DEFAULT_FLAGS, nullptr, ICON_NONE); - uiItemR(layout, ptr, "radius", DEFAULT_FLAGS, nullptr, ICON_NONE); - uiItemR(layout, ptr, "interpolation", DEFAULT_FLAGS, nullptr, ICON_NONE); - uiItemR(layout, ptr, "resolution", DEFAULT_FLAGS, nullptr, ICON_NONE); - if (shader_point_density->point_source == SHD_POINTDENSITY_SOURCE_PSYS) { - uiItemR(layout, ptr, "particle_color_source", DEFAULT_FLAGS, nullptr, ICON_NONE); - } - else { - uiItemR(layout, ptr, "vertex_color_source", DEFAULT_FLAGS, nullptr, ICON_NONE); - if (shader_point_density->ob_color_source == SHD_POINTDENSITY_COLOR_VERTWEIGHT) { - if (ob_ptr.data) { - uiItemPointerR( - layout, ptr, "vertex_attribute_name", &ob_ptr, "vertex_groups", "", ICON_NONE); - } - } - if (shader_point_density->ob_color_source == SHD_POINTDENSITY_COLOR_VERTCOL) { - if (obdata_ptr.data) { - uiItemPointerR( - layout, ptr, "vertex_attribute_name", &obdata_ptr, "vertex_colors", "", ICON_NONE); - } - } - } -} - -static void node_shader_buts_tex_coord(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) -{ - uiItemR(layout, ptr, "object", DEFAULT_FLAGS, nullptr, 0); - uiItemR(layout, ptr, "from_instancer", DEFAULT_FLAGS, nullptr, 0); -} - -static void node_shader_buts_bump(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) -{ - uiItemR(layout, ptr, "invert", DEFAULT_FLAGS, nullptr, 0); -} - -static void node_shader_buts_uvmap(uiLayout *layout, bContext *C, PointerRNA *ptr) -{ - uiItemR(layout, ptr, "from_instancer", DEFAULT_FLAGS, nullptr, 0); - - if (!RNA_boolean_get(ptr, "from_instancer")) { - PointerRNA obptr = CTX_data_pointer_get(C, "active_object"); - - if (obptr.data && RNA_enum_get(&obptr, "type") == OB_MESH) { - PointerRNA dataptr = RNA_pointer_get(&obptr, "data"); - uiItemPointerR(layout, ptr, "uv_map", &dataptr, "uv_layers", "", ICON_NONE); - } - } -} - -static void node_shader_buts_vertex_color(uiLayout *layout, bContext *C, PointerRNA *ptr) -{ - PointerRNA obptr = CTX_data_pointer_get(C, "active_object"); - if (obptr.data && RNA_enum_get(&obptr, "type") == OB_MESH) { - PointerRNA dataptr = RNA_pointer_get(&obptr, "data"); - - if (U.experimental.use_sculpt_vertex_colors && - RNA_collection_length(&dataptr, "sculpt_vertex_colors")) { - uiItemPointerR( - layout, ptr, "layer_name", &dataptr, "sculpt_vertex_colors", "", ICON_GROUP_VCOL); - } - else { - uiItemPointerR(layout, ptr, "layer_name", &dataptr, "vertex_colors", "", ICON_GROUP_VCOL); - } - } - else { - uiItemL(layout, TIP_("No mesh in active object"), ICON_ERROR); - } -} - -static void node_shader_buts_uvalongstroke(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) -{ - uiItemR(layout, ptr, "use_tips", DEFAULT_FLAGS, nullptr, 0); -} - -static void node_shader_buts_normal_map(uiLayout *layout, bContext *C, PointerRNA *ptr) -{ - uiItemR(layout, ptr, "space", DEFAULT_FLAGS, "", 0); - - if (RNA_enum_get(ptr, "space") == SHD_SPACE_TANGENT) { - PointerRNA obptr = CTX_data_pointer_get(C, "active_object"); - - if (obptr.data && RNA_enum_get(&obptr, "type") == OB_MESH) { - PointerRNA dataptr = RNA_pointer_get(&obptr, "data"); - uiItemPointerR(layout, ptr, "uv_map", &dataptr, "uv_layers", "", ICON_NONE); - } - else { - uiItemR(layout, ptr, "uv_map", DEFAULT_FLAGS, "", 0); - } - } -} - static void node_shader_buts_displacement(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { uiItemR(layout, ptr, "space", DEFAULT_FLAGS, "", 0); } -static void node_shader_buts_tangent(uiLayout *layout, bContext *C, PointerRNA *ptr) -{ - uiLayout *split, *row; - - split = uiLayoutSplit(layout, 0.0f, false); - - uiItemR(split, ptr, "direction_type", DEFAULT_FLAGS, "", 0); - - row = uiLayoutRow(split, false); - - if (RNA_enum_get(ptr, "direction_type") == SHD_TANGENT_UVMAP) { - PointerRNA obptr = CTX_data_pointer_get(C, "active_object"); - - if (obptr.data && RNA_enum_get(&obptr, "type") == OB_MESH) { - PointerRNA dataptr = RNA_pointer_get(&obptr, "data"); - uiItemPointerR(row, ptr, "uv_map", &dataptr, "uv_layers", "", ICON_NONE); - } - else { - uiItemR(row, ptr, "uv_map", DEFAULT_FLAGS, "", 0); - } - } - else { - uiItemR(row, ptr, "axis", DEFAULT_FLAGS | UI_ITEM_R_EXPAND, nullptr, 0); - } -} - static void node_shader_buts_glossy(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { uiItemR(layout, ptr, "distribution", DEFAULT_FLAGS, "", ICON_NONE); } -static void node_shader_buts_principled(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) -{ - uiItemR(layout, ptr, "distribution", DEFAULT_FLAGS, "", ICON_NONE); - uiItemR(layout, ptr, "subsurface_method", DEFAULT_FLAGS, "", ICON_NONE); -} - -static void node_shader_buts_anisotropic(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) -{ - uiItemR(layout, ptr, "distribution", DEFAULT_FLAGS, "", ICON_NONE); -} - -static void node_shader_buts_subsurface(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) -{ - uiItemR(layout, ptr, "falloff", DEFAULT_FLAGS, "", ICON_NONE); -} - -static void node_shader_buts_toon(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) -{ - uiItemR(layout, ptr, "component", DEFAULT_FLAGS, "", ICON_NONE); -} - -static void node_shader_buts_hair(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) -{ - uiItemR(layout, ptr, "component", DEFAULT_FLAGS, "", ICON_NONE); -} - -static void node_shader_buts_principled_hair(uiLayout *layout, - bContext *UNUSED(C), - PointerRNA *ptr) -{ - uiItemR(layout, ptr, "parametrization", DEFAULT_FLAGS, "", ICON_NONE); -} - -static void node_shader_buts_ies(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) -{ - uiLayout *row; - - row = uiLayoutRow(layout, false); - uiItemR(row, ptr, "mode", DEFAULT_FLAGS | UI_ITEM_R_EXPAND, nullptr, ICON_NONE); - - row = uiLayoutRow(layout, true); - - if (RNA_enum_get(ptr, "mode") == NODE_IES_INTERNAL) { - uiItemR(row, ptr, "ies", DEFAULT_FLAGS, "", ICON_NONE); - } - else { - uiItemR(row, ptr, "filepath", DEFAULT_FLAGS, "", ICON_NONE); - } -} - -static void node_shader_buts_script(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) -{ - uiLayout *row; - - row = uiLayoutRow(layout, false); - uiItemR(row, ptr, "mode", DEFAULT_FLAGS | UI_ITEM_R_EXPAND, nullptr, ICON_NONE); - - row = uiLayoutRow(layout, true); - - if (RNA_enum_get(ptr, "mode") == NODE_SCRIPT_INTERNAL) { - uiItemR(row, ptr, "script", DEFAULT_FLAGS, "", ICON_NONE); - } - else { - uiItemR(row, ptr, "filepath", DEFAULT_FLAGS, "", ICON_NONE); - } - - uiItemO(row, "", ICON_FILE_REFRESH, "node.shader_script_update"); -} - -static void node_shader_buts_script_ex(uiLayout *layout, bContext *C, PointerRNA *ptr) -{ - uiItemS(layout); - - node_shader_buts_script(layout, C, ptr); - -#if 0 /* not implemented yet */ - if (RNA_enum_get(ptr, "mode") == NODE_SCRIPT_EXTERNAL) { - uiItemR(layout, ptr, "use_auto_update", DEFAULT_FLAGS, nullptr, ICON_NONE); - } -#endif -} - static void node_buts_output_shader(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { uiItemR(layout, ptr, "target", DEFAULT_FLAGS, "", ICON_NONE); } -static void node_buts_output_linestyle(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) -{ - uiLayout *row, *col; - - col = uiLayoutColumn(layout, false); - row = uiLayoutRow(col, true); - uiItemR(row, ptr, "blend_type", DEFAULT_FLAGS, "", ICON_NONE); - uiItemR(col, ptr, "use_clamp", DEFAULT_FLAGS, nullptr, ICON_NONE); -} - -static void node_shader_buts_bevel(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) -{ - uiItemR(layout, ptr, "samples", DEFAULT_FLAGS, nullptr, ICON_NONE); -} - -static void node_shader_buts_ambient_occlusion(uiLayout *layout, - bContext *UNUSED(C), - PointerRNA *ptr) -{ - uiItemR(layout, ptr, "samples", DEFAULT_FLAGS, nullptr, ICON_NONE); - uiItemR(layout, ptr, "inside", DEFAULT_FLAGS, nullptr, ICON_NONE); - uiItemR(layout, ptr, "only_local", DEFAULT_FLAGS, nullptr, ICON_NONE); -} - -static void node_shader_buts_white_noise(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) -{ - uiItemR(layout, ptr, "noise_dimensions", DEFAULT_FLAGS, "", ICON_NONE); -} - -static void node_shader_buts_output_aov(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) -{ - uiItemR(layout, ptr, "name", DEFAULT_FLAGS, nullptr, ICON_NONE); -} - /* only once called */ static void node_shader_set_butfunc(bNodeType *ntype) { @@ -868,9 +464,6 @@ static void node_shader_set_butfunc(bNodeType *ntype) case SH_NODE_CURVE_FLOAT: ntype->draw_buttons = node_buts_curvefloat; break; - case SH_NODE_MAPPING: - ntype->draw_buttons = node_shader_buts_mapping; - break; case SH_NODE_VALUE: ntype->draw_buttons = node_buts_value; break; @@ -883,33 +476,9 @@ static void node_shader_set_butfunc(bNodeType *ntype) case SH_NODE_VALTORGB: ntype->draw_buttons = node_buts_colorramp; break; - case SH_NODE_CLAMP: - ntype->draw_buttons = node_shader_buts_clamp; - break; - case SH_NODE_MAP_RANGE: - ntype->draw_buttons = node_shader_buts_map_range; - break; case SH_NODE_MATH: ntype->draw_buttons = node_buts_math; break; - case SH_NODE_VECTOR_MATH: - ntype->draw_buttons = node_shader_buts_vect_math; - break; - case SH_NODE_VECTOR_ROTATE: - ntype->draw_buttons = node_shader_buts_vector_rotate; - break; - case SH_NODE_VECT_TRANSFORM: - ntype->draw_buttons = node_shader_buts_vect_transform; - break; - case SH_NODE_ATTRIBUTE: - ntype->draw_buttons = node_shader_buts_attribute; - break; - case SH_NODE_WIREFRAME: - ntype->draw_buttons = node_shader_buts_wireframe; - break; - case SH_NODE_TEX_SKY: - ntype->draw_buttons = node_shader_buts_tex_sky; - break; case SH_NODE_TEX_IMAGE: ntype->draw_buttons = node_shader_buts_tex_image; ntype->draw_buttons_ex = node_shader_buts_tex_image_ex; @@ -918,105 +487,20 @@ static void node_shader_set_butfunc(bNodeType *ntype) ntype->draw_buttons = node_shader_buts_tex_environment; ntype->draw_buttons_ex = node_shader_buts_tex_environment_ex; break; - case SH_NODE_TEX_GRADIENT: - ntype->draw_buttons = node_shader_buts_tex_gradient; - break; - case SH_NODE_TEX_MAGIC: - ntype->draw_buttons = node_shader_buts_tex_magic; - break; - case SH_NODE_TEX_BRICK: - ntype->draw_buttons = node_shader_buts_tex_brick; - break; - case SH_NODE_TEX_WAVE: - ntype->draw_buttons = node_shader_buts_tex_wave; - break; - case SH_NODE_TEX_MUSGRAVE: - ntype->draw_buttons = node_shader_buts_tex_musgrave; - break; - case SH_NODE_TEX_VORONOI: - ntype->draw_buttons = node_shader_buts_tex_voronoi; - break; - case SH_NODE_TEX_NOISE: - ntype->draw_buttons = node_shader_buts_tex_noise; - break; - case SH_NODE_TEX_POINTDENSITY: - ntype->draw_buttons = node_shader_buts_tex_pointdensity; - break; - case SH_NODE_TEX_COORD: - ntype->draw_buttons = node_shader_buts_tex_coord; - break; - case SH_NODE_BUMP: - ntype->draw_buttons = node_shader_buts_bump; - break; - case SH_NODE_NORMAL_MAP: - ntype->draw_buttons = node_shader_buts_normal_map; - break; case SH_NODE_DISPLACEMENT: case SH_NODE_VECTOR_DISPLACEMENT: ntype->draw_buttons = node_shader_buts_displacement; break; - case SH_NODE_TANGENT: - ntype->draw_buttons = node_shader_buts_tangent; - break; case SH_NODE_BSDF_GLOSSY: case SH_NODE_BSDF_GLASS: case SH_NODE_BSDF_REFRACTION: ntype->draw_buttons = node_shader_buts_glossy; break; - case SH_NODE_BSDF_PRINCIPLED: - ntype->draw_buttons = node_shader_buts_principled; - break; - case SH_NODE_BSDF_ANISOTROPIC: - ntype->draw_buttons = node_shader_buts_anisotropic; - break; - case SH_NODE_SUBSURFACE_SCATTERING: - ntype->draw_buttons = node_shader_buts_subsurface; - break; - case SH_NODE_BSDF_TOON: - ntype->draw_buttons = node_shader_buts_toon; - break; - case SH_NODE_BSDF_HAIR: - ntype->draw_buttons = node_shader_buts_hair; - break; - case SH_NODE_BSDF_HAIR_PRINCIPLED: - ntype->draw_buttons = node_shader_buts_principled_hair; - break; - case SH_NODE_SCRIPT: - ntype->draw_buttons = node_shader_buts_script; - ntype->draw_buttons_ex = node_shader_buts_script_ex; - break; - case SH_NODE_UVMAP: - ntype->draw_buttons = node_shader_buts_uvmap; - break; - case SH_NODE_VERTEX_COLOR: - ntype->draw_buttons = node_shader_buts_vertex_color; - break; - case SH_NODE_UVALONGSTROKE: - ntype->draw_buttons = node_shader_buts_uvalongstroke; - break; case SH_NODE_OUTPUT_MATERIAL: case SH_NODE_OUTPUT_LIGHT: case SH_NODE_OUTPUT_WORLD: ntype->draw_buttons = node_buts_output_shader; break; - case SH_NODE_OUTPUT_LINESTYLE: - ntype->draw_buttons = node_buts_output_linestyle; - break; - case SH_NODE_TEX_IES: - ntype->draw_buttons = node_shader_buts_ies; - break; - case SH_NODE_BEVEL: - ntype->draw_buttons = node_shader_buts_bevel; - break; - case SH_NODE_AMBIENT_OCCLUSION: - ntype->draw_buttons = node_shader_buts_ambient_occlusion; - break; - case SH_NODE_TEX_WHITE_NOISE: - ntype->draw_buttons = node_shader_buts_white_noise; - break; - case SH_NODE_OUTPUT_AOV: - ntype->draw_buttons = node_shader_buts_output_aov; - break; } } diff --git a/source/blender/editors/space_node/node_add.cc b/source/blender/editors/space_node/node_add.cc index 0aa9cd5511a..be29c125e5a 100644 --- a/source/blender/editors/space_node/node_add.cc +++ b/source/blender/editors/space_node/node_add.cc @@ -499,6 +499,8 @@ static bool node_add_object_poll(bContext *C) void NODE_OT_add_object(wmOperatorType *ot) { + PropertyRNA *prop; + /* identifiers */ ot->name = "Add Node Object"; ot->description = "Add an object info node to the current node editor"; @@ -513,15 +515,16 @@ void NODE_OT_add_object(wmOperatorType *ot) ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_INTERNAL; RNA_def_string(ot->srna, "name", "Object", MAX_ID_NAME - 2, "Name", "Data-block name to assign"); - RNA_def_int(ot->srna, - "session_uuid", - 0, - INT32_MIN, - INT32_MAX, - "Session UUID", - "Session UUID of the data-block to assign", - INT32_MIN, - INT32_MAX); + prop = RNA_def_int(ot->srna, + "session_uuid", + 0, + INT32_MIN, + INT32_MAX, + "Session UUID", + "Session UUID of the data-block to assign", + INT32_MIN, + INT32_MAX); + RNA_def_property_flag(prop, (PropertyFlag)(PROP_HIDDEN | PROP_SKIP_SAVE)); } /** \} */ @@ -602,6 +605,8 @@ static bool node_add_texture_poll(bContext *C) void NODE_OT_add_texture(wmOperatorType *ot) { + PropertyRNA *prop; + /* identifiers */ ot->name = "Add Node Texture"; ot->description = "Add a texture to the current node editor"; @@ -617,15 +622,16 @@ void NODE_OT_add_texture(wmOperatorType *ot) RNA_def_string( ot->srna, "name", "Texture", MAX_ID_NAME - 2, "Name", "Data-block name to assign"); - RNA_def_int(ot->srna, - "session_uuid", - 0, - INT32_MIN, - INT32_MAX, - "Session UUID", - "Session UUID of the data-block to assign", - INT32_MIN, - INT32_MAX); + prop = RNA_def_int(ot->srna, + "session_uuid", + 0, + INT32_MIN, + INT32_MAX, + "Session UUID", + "Session UUID of the data-block to assign", + INT32_MIN, + INT32_MAX); + RNA_def_property_flag(prop, (PropertyFlag)(PROP_HIDDEN | PROP_SKIP_SAVE)); } /** \} */ @@ -711,6 +717,8 @@ static bool node_add_collection_poll(bContext *C) void NODE_OT_add_collection(wmOperatorType *ot) { + PropertyRNA *prop; + /* identifiers */ ot->name = "Add Node Collection"; ot->description = "Add an collection info node to the current node editor"; @@ -726,15 +734,16 @@ void NODE_OT_add_collection(wmOperatorType *ot) RNA_def_string( ot->srna, "name", "Collection", MAX_ID_NAME - 2, "Name", "Data-block name to assign"); - RNA_def_int(ot->srna, - "session_uuid", - 0, - INT32_MIN, - INT32_MAX, - "Session UUID", - "Session UUID of the data-block to assign", - INT32_MIN, - INT32_MAX); + prop = RNA_def_int(ot->srna, + "session_uuid", + 0, + INT32_MIN, + INT32_MAX, + "Session UUID", + "Session UUID of the data-block to assign", + INT32_MIN, + INT32_MAX); + RNA_def_property_flag(prop, (PropertyFlag)(PROP_HIDDEN | PROP_SKIP_SAVE)); } /** \} */ @@ -916,6 +925,8 @@ static int node_add_mask_exec(bContext *C, wmOperator *op) void NODE_OT_add_mask(wmOperatorType *ot) { + PropertyRNA *prop; + /* identifiers */ ot->name = "Add Mask Node"; ot->description = "Add a mask node to the current node editor"; @@ -929,15 +940,16 @@ void NODE_OT_add_mask(wmOperatorType *ot) ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_INTERNAL; RNA_def_string(ot->srna, "name", "Mask", MAX_ID_NAME - 2, "Name", "Data-block name to assign"); - RNA_def_int(ot->srna, - "session_uuid", - 0, - INT32_MIN, - INT32_MAX, - "Session UUID", - "Session UUID of the data-block to assign", - INT32_MIN, - INT32_MAX); + prop = RNA_def_int(ot->srna, + "session_uuid", + 0, + INT32_MIN, + INT32_MAX, + "Session UUID", + "Session UUID of the data-block to assign", + INT32_MIN, + INT32_MAX); + RNA_def_property_flag(prop, (PropertyFlag)(PROP_HIDDEN | PROP_SKIP_SAVE)); } /** \} */ diff --git a/source/blender/editors/space_node/node_gizmo.cc b/source/blender/editors/space_node/node_gizmo.cc index 717f4d2f4f9..41d13976209 100644 --- a/source/blender/editors/space_node/node_gizmo.cc +++ b/source/blender/editors/space_node/node_gizmo.cc @@ -380,7 +380,7 @@ static void WIDGETGROUP_node_crop_refresh(const bContext *C, wmGizmoGroup *gzgro params.value_get_fn = gizmo_node_crop_prop_matrix_get; params.value_set_fn = gizmo_node_crop_prop_matrix_set; params.range_get_fn = nullptr; - params.user_data = snode; + params.user_data = node; WM_gizmo_target_property_def_func(gz, "matrix", ¶ms); } else { diff --git a/source/blender/editors/space_node/node_intern.hh b/source/blender/editors/space_node/node_intern.hh index f3183acda50..0f542734f66 100644 --- a/source/blender/editors/space_node/node_intern.hh +++ b/source/blender/editors/space_node/node_intern.hh @@ -118,7 +118,7 @@ blender::float2 node_link_calculate_multi_input_position(const blender::float2 & int total_inputs); int node_get_resize_cursor(NodeResizeDirection directions); -NodeResizeDirection node_get_resize_direction(const bNode *node, const int x, const int y); +NodeResizeDirection node_get_resize_direction(const bNode *node, int x, int y); /** * Usual convention here would be #node_socket_get_color(), * but that's already used (for setting a color property socket). @@ -143,9 +143,9 @@ void node_keymap(wmKeyConfig *keyconf); void node_deselect_all(SpaceNode &snode); void node_socket_select(bNode *node, bNodeSocket &sock); -void node_socket_deselect(bNode *node, bNodeSocket &sock, const bool deselect_node); -void node_deselect_all_input_sockets(SpaceNode &snode, const bool deselect_nodes); -void node_deselect_all_output_sockets(SpaceNode &snode, const bool deselect_nodes); +void node_socket_deselect(bNode *node, bNodeSocket &sock, bool deselect_node); +void node_deselect_all_input_sockets(SpaceNode &snode, bool deselect_nodes); +void node_deselect_all_output_sockets(SpaceNode &snode, bool deselect_nodes); void node_select_single(bContext &C, bNode &node); void NODE_OT_select(wmOperatorType *ot); @@ -196,7 +196,7 @@ bool node_link_bezier_points(const View2D *v2d, const SpaceNode *snode, const bNodeLink &link, float coord_array[][2], - const int resol); + int resol); /** * Return quadratic beziers points for a given nodelink and clip if v2d is not nullptr. */ diff --git a/source/blender/editors/space_node/node_templates.cc b/source/blender/editors/space_node/node_templates.cc index 492237477c1..74c0d2124cd 100644 --- a/source/blender/editors/space_node/node_templates.cc +++ b/source/blender/editors/space_node/node_templates.cc @@ -381,17 +381,42 @@ static Vector<NodeLinkItem> ui_node_link_items(NodeLinkArg *arg, const SocketDeclaration &socket_decl = *socket_decl_ptr; NodeLinkItem item; item.socket_index = index++; - /* A socket declaration does not necessarily map to exactly one built-in socket type. So only - * check for the types that matter here. */ - if (dynamic_cast<const decl::Color *>(&socket_decl)) { - item.socket_type = SOCK_RGBA; - } - else if (dynamic_cast<const decl::Float *>(&socket_decl)) { + if (dynamic_cast<const decl::Float *>(&socket_decl)) { item.socket_type = SOCK_FLOAT; } + else if (dynamic_cast<const decl::Int *>(&socket_decl)) { + item.socket_type = SOCK_INT; + } + else if (dynamic_cast<const decl::Bool *>(&socket_decl)) { + item.socket_type = SOCK_BOOLEAN; + } else if (dynamic_cast<const decl::Vector *>(&socket_decl)) { item.socket_type = SOCK_VECTOR; } + else if (dynamic_cast<const decl::Color *>(&socket_decl)) { + item.socket_type = SOCK_RGBA; + } + else if (dynamic_cast<const decl::String *>(&socket_decl)) { + item.socket_type = SOCK_STRING; + } + else if (dynamic_cast<const decl::Image *>(&socket_decl)) { + item.socket_type = SOCK_IMAGE; + } + else if (dynamic_cast<const decl::Texture *>(&socket_decl)) { + item.socket_type = SOCK_TEXTURE; + } + else if (dynamic_cast<const decl::Material *>(&socket_decl)) { + item.socket_type = SOCK_MATERIAL; + } + else if (dynamic_cast<const decl::Shader *>(&socket_decl)) { + item.socket_type = SOCK_SHADER; + } + else if (dynamic_cast<const decl::Collection *>(&socket_decl)) { + item.socket_type = SOCK_COLLECTION; + } + else if (dynamic_cast<const decl::Object *>(&socket_decl)) { + item.socket_type = SOCK_OBJECT; + } else { item.socket_type = SOCK_CUSTOM; } diff --git a/source/blender/editors/space_outliner/outliner_intern.h b/source/blender/editors/space_outliner/outliner_intern.h index 3439e4fa219..e331887319e 100644 --- a/source/blender/editors/space_outliner/outliner_intern.h +++ b/source/blender/editors/space_outliner/outliner_intern.h @@ -296,7 +296,7 @@ void outliner_collection_isolate_flag(struct Scene *scene, struct Collection *collection, struct PropertyRNA *layer_or_collection_prop, const char *propname, - const bool value); + bool value); /** * Return the index to use based on the TreeElement ID and object type @@ -314,7 +314,7 @@ void tree_element_type_active_set(struct bContext *C, const TreeViewContext *tvc, TreeElement *te, TreeStoreElem *tselem, - const eOLSetState set, + eOLSetState set, bool recursive); /** * Generic call for non-id data to check the active state in UI. @@ -329,8 +329,8 @@ eOLDrawState tree_element_type_active_state_get(const struct bContext *C, void tree_element_activate(struct bContext *C, const TreeViewContext *tvc, TreeElement *te, - const eOLSetState set, - const bool handle_all_types); + eOLSetState set, + bool handle_all_types); eOLDrawState tree_element_active_state_get(const TreeViewContext *tvc, const TreeElement *te, const TreeStoreElem *tselem); @@ -343,7 +343,7 @@ struct bPoseChannel *outliner_find_parent_bone(TreeElement *te, TreeElement **r_ void outliner_item_select(struct bContext *C, struct SpaceOutliner *space_outliner, struct TreeElement *te, - const short select_flag); + short select_flag); /** * Find if x coordinate is over an icon or name. @@ -366,7 +366,7 @@ bool outliner_is_co_within_mode_column(SpaceOutliner *space_outliner, const floa void outliner_item_mode_toggle(struct bContext *C, TreeViewContext *tvc, TreeElement *te, - const bool do_extend); + bool do_extend); /* outliner_edit.c ---------------------------------------------- */ typedef void (*outliner_operation_fn)(struct bContext *C, @@ -396,7 +396,7 @@ void outliner_do_object_operation(struct bContext *C, struct ListBase *lb, outliner_operation_fn operation_fn); -int outliner_flag_is_any_test(ListBase *lb, short flag, const int curlevel); +int outliner_flag_is_any_test(ListBase *lb, short flag, int curlevel); /** * Set or unset \a flag for all outliner elements in \a lb and sub-trees. * \return if any flag was modified. diff --git a/source/blender/editors/space_outliner/outliner_tools.c b/source/blender/editors/space_outliner/outliner_tools.c index bcd455de9a4..4849da16685 100644 --- a/source/blender/editors/space_outliner/outliner_tools.c +++ b/source/blender/editors/space_outliner/outliner_tools.c @@ -959,7 +959,6 @@ static void id_override_library_resync_fn(bContext *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_sequencer/sequencer_intern.h b/source/blender/editors/space_sequencer/sequencer_intern.h index cb33c648b0a..8f7ab2ea881 100644 --- a/source/blender/editors/space_sequencer/sequencer_intern.h +++ b/source/blender/editors/space_sequencer/sequencer_intern.h @@ -57,12 +57,12 @@ void sequencer_draw_preview(const struct bContext *C, bool draw_backdrop); void color3ubv_from_seq(const struct Scene *curscene, const struct Sequence *seq, - const bool show_strip_color_tag, + bool show_strip_color_tag, uchar r_col[3]); void sequencer_special_update_set(Sequence *seq); /* Get handle width in 2d-View space. */ -float sequence_handle_size_get_clamped(struct Sequence *seq, const float pixelx); +float sequence_handle_size_get_clamped(struct Sequence *seq, float pixelx); /* UNUSED */ /* void seq_reset_imageofs(struct SpaceSeq *sseq); */ diff --git a/source/blender/editors/space_spreadsheet/spreadsheet_column.hh b/source/blender/editors/space_spreadsheet/spreadsheet_column.hh index 1a03278acad..7dad505c21b 100644 --- a/source/blender/editors/space_spreadsheet/spreadsheet_column.hh +++ b/source/blender/editors/space_spreadsheet/spreadsheet_column.hh @@ -44,7 +44,7 @@ void spreadsheet_column_id_free(SpreadsheetColumnID *column_id); SpreadsheetColumn *spreadsheet_column_new(SpreadsheetColumnID *column_id); SpreadsheetColumn *spreadsheet_column_copy(const SpreadsheetColumn *src_column); void spreadsheet_column_assign_runtime_data(SpreadsheetColumn *column, - const eSpreadsheetColumnValueType data_type, + eSpreadsheetColumnValueType data_type, const StringRefNull display_name); void spreadsheet_column_free(SpreadsheetColumn *column); diff --git a/source/blender/editors/space_text/text_format.h b/source/blender/editors/space_text/text_format.h index 01c40b4ed22..ebccaa54342 100644 --- a/source/blender/editors/space_text/text_format.h +++ b/source/blender/editors/space_text/text_format.h @@ -66,12 +66,12 @@ int text_check_format_len(TextLine *line, unsigned int len); * * \param len: length in bytes of \a fmt_p to fill. */ -void text_format_fill(const char **str_p, char **fmt_p, const char type, const int len); +void text_format_fill(const char **str_p, char **fmt_p, char type, int len); /** * ASCII version of #text_format_fill, * use when we no the text being stepped over is ascii (as is the case for most keywords) */ -void text_format_fill_ascii(const char **str_p, char **fmt_p, const char type, const int len); +void text_format_fill_ascii(const char **str_p, char **fmt_p, char type, int len); /* *** Generalize Formatting *** */ typedef struct TextFormatType { @@ -88,7 +88,7 @@ typedef struct TextFormatType { * * See: FMT_TYPE_ enums below */ - void (*format_line)(SpaceText *st, TextLine *line, const bool do_next); + void (*format_line)(SpaceText *st, TextLine *line, bool do_next); const char **ext; /* NULL terminated extensions */ } TextFormatType; diff --git a/source/blender/editors/space_text/text_intern.h b/source/blender/editors/space_text/text_intern.h index 3cae4188932..0b81cd74a42 100644 --- a/source/blender/editors/space_text/text_intern.h +++ b/source/blender/editors/space_text/text_intern.h @@ -42,7 +42,7 @@ void text_update_character_width(struct SpaceText *st); /** * Takes an area instead of a region, use for listeners. */ -void text_scroll_to_cursor__area(struct SpaceText *st, struct ScrArea *area, const bool center); +void text_scroll_to_cursor__area(struct SpaceText *st, struct ScrArea *area, bool center); void text_update_cursor_moved(struct bContext *C); /* Padding around line numbers in character widths. */ diff --git a/source/blender/editors/space_view3d/view3d_intern.h b/source/blender/editors/space_view3d/view3d_intern.h index 7388004125c..6a1a09df316 100644 --- a/source/blender/editors/space_view3d/view3d_intern.h +++ b/source/blender/editors/space_view3d/view3d_intern.h @@ -115,8 +115,8 @@ struct wmNDOFMotionData; void view3d_ndof_fly(const struct wmNDOFMotionData *ndof, struct View3D *v3d, struct RegionView3D *rv3d, - const bool use_precision, - const short protectflag, + bool use_precision, + short protectflag, bool *r_has_translate, bool *r_has_rotate); #endif /* WITH_INPUT_NDOF */ @@ -203,13 +203,13 @@ void ED_view3d_smooth_view_ex(const struct Depsgraph *depsgraph, struct ScrArea *area, struct View3D *v3d, struct ARegion *region, - const int smooth_viewtx, + int smooth_viewtx, const V3D_SmoothParams *sview); void ED_view3d_smooth_view(struct bContext *C, struct View3D *v3d, struct ARegion *region, - const int smooth_viewtx, + int smooth_viewtx, const V3D_SmoothParams *sview); /** @@ -274,17 +274,17 @@ struct View3DCameraControl *ED_view3d_cameracontrol_acquire(struct Depsgraph *de * Updates cameras from the `rv3d` values, optionally auto-keyframing. */ void ED_view3d_cameracontrol_update(struct View3DCameraControl *vctrl, - const bool use_autokey, + bool use_autokey, struct bContext *C, - const bool do_rotate, - const bool do_translate); + bool do_rotate, + bool do_translate); /** * Release view control. * * \param restore: Sets the view state to the values that were set * before #ED_view3d_control_acquire was called. */ -void ED_view3d_cameracontrol_release(struct View3DCameraControl *vctrl, const bool restore); +void ED_view3d_cameracontrol_release(struct View3DCameraControl *vctrl, bool restore); /** * Returns the object which is being manipulated or NULL. */ diff --git a/source/blender/editors/transform/transform.h b/source/blender/editors/transform/transform.h index 3035d11d0e3..642de550812 100644 --- a/source/blender/editors/transform/transform.h +++ b/source/blender/editors/transform/transform.h @@ -712,9 +712,9 @@ int transformEnd(struct bContext *C, TransInfo *t); void setTransformViewMatrices(TransInfo *t); void setTransformViewAspect(TransInfo *t, float r_aspect[3]); void convertViewVec(TransInfo *t, float r_vec[3], double dx, double dy); -void projectIntViewEx(TransInfo *t, const float vec[3], int adr[2], const eV3DProjTest flag); +void projectIntViewEx(TransInfo *t, const float vec[3], int adr[2], eV3DProjTest flag); void projectIntView(TransInfo *t, const float vec[3], int adr[2]); -void projectFloatViewEx(TransInfo *t, const float vec[3], float adr[2], const eV3DProjTest flag); +void projectFloatViewEx(TransInfo *t, const float vec[3], float adr[2], eV3DProjTest flag); void projectFloatView(TransInfo *t, const float vec[3], float adr[2]); void applyAspectRatio(TransInfo *t, float vec[2]); @@ -770,7 +770,7 @@ typedef enum { } MouseInputMode; void initMouseInput( - TransInfo *t, MouseInput *mi, const float center[2], const int mval[2], const bool precision); + TransInfo *t, MouseInput *mi, const float center[2], const int mval[2], bool precision); void initMouseInputMode(TransInfo *t, MouseInput *mi, MouseInputMode mode); void applyMouseInput(struct TransInfo *t, struct MouseInput *mi, diff --git a/source/blender/editors/transform/transform_convert.h b/source/blender/editors/transform/transform_convert.h index 12f3b39927e..c40f3c28a79 100644 --- a/source/blender/editors/transform/transform_convert.h +++ b/source/blender/editors/transform/transform_convert.h @@ -48,9 +48,9 @@ int special_transform_moving(TransInfo *t); void special_aftertrans_update(struct bContext *C, TransInfo *t); void sort_trans_data_dist(TransInfo *t); void createTransData(struct bContext *C, TransInfo *t); -bool clipUVTransform(TransInfo *t, float vec[2], const bool resize); +bool clipUVTransform(TransInfo *t, float vec[2], bool resize); void clipUVData(TransInfo *t); -void transform_convert_flush_handle2D(TransData *td, TransData2D *td2d, const float y_fac); +void transform_convert_flush_handle2D(TransData *td, TransData2D *td2d, float y_fac); /** * Called for updating while transform acts, once per redraw. */ @@ -83,7 +83,7 @@ void transform_around_single_fallback(TransInfo *t); * but may want to use a different one at times (if caller does not operate on * selection). */ -void posttrans_fcurve_clean(struct FCurve *fcu, const int sel_flag, const bool use_handle); +void posttrans_fcurve_clean(struct FCurve *fcu, int sel_flag, bool use_handle); /** * Little helper function for ObjectToTransData used to give certain * constraints (ChildOf, FollowPath, and others that may be added) @@ -125,8 +125,8 @@ void special_aftertrans_update__actedit(bContext *C, TransInfo *t); * Returns total number of bones with #BONE_TRANSFORM. */ int transform_convert_pose_transflags_update(Object *ob, - const int mode, - const short around, + int mode, + short around, bool has_translate_rotate[2]); /** * When objects array is NULL, use 't->data_container' as is. @@ -208,9 +208,9 @@ struct TransMeshDataCrazySpace { }; void transform_convert_mesh_islands_calc(struct BMEditMesh *em, - const bool calc_single_islands, - const bool calc_island_center, - const bool calc_island_axismtx, + bool calc_single_islands, + bool calc_island_center, + bool calc_island_axismtx, struct TransIslandData *r_island_data); void transform_convert_mesh_islanddata_free(struct TransIslandData *island_data); /** @@ -223,8 +223,8 @@ void transform_convert_mesh_connectivity_distance(struct BMesh *bm, float *dists, int *index); void transform_convert_mesh_mirrordata_calc(struct BMEditMesh *em, - const bool use_select, - const bool use_topology, + bool use_select, + bool use_topology, const bool mirror_axis[3], struct TransMirrorData *r_mirror_data); void transform_convert_mesh_mirrordata_free(struct TransMirrorData *mirror_data); diff --git a/source/blender/editors/transform/transform_mode.h b/source/blender/editors/transform/transform_mode.h index ec3d5b8d0fe..cdcda5a8648 100644 --- a/source/blender/editors/transform/transform_mode.h +++ b/source/blender/editors/transform/transform_mode.h @@ -45,7 +45,7 @@ bool transdata_check_local_center(const TransInfo *t, short around); /** * Informs if the mode can be switched during modal. */ -bool transform_mode_is_changeable(const int mode); +bool transform_mode_is_changeable(int mode); void protectedTransBits(short protectflag, float vec[3]); void protectedSizeBits(short protectflag, float size[3]); void constraintTransLim(const TransInfo *t, TransData *td); @@ -69,13 +69,13 @@ void ElementRotation(const TransInfo *t, const TransDataContainer *tc, TransData *td, const float mat[3][3], - const short around); + short around); void headerResize(TransInfo *t, const float vec[3], char *str, int str_size); void ElementResize(const TransInfo *t, const TransDataContainer *tc, TransData *td, const float mat[3][3]); -void transform_mode_init(TransInfo *t, struct wmOperator *op, const int mode); +void transform_mode_init(TransInfo *t, struct wmOperator *op, int mode); /** * When in modal and not set, initializes a default orientation for the mode. */ diff --git a/source/blender/editors/transform/transform_orientations.h b/source/blender/editors/transform/transform_orientations.h index 6e0e3d9f8c7..dd2d5bc86c5 100644 --- a/source/blender/editors/transform/transform_orientations.h +++ b/source/blender/editors/transform/transform_orientations.h @@ -34,8 +34,8 @@ short transform_orientation_matrix_get(struct bContext *C, short orient_index, const float custom[3][3], float r_spacemtx[3][3]); -const char *transform_orientations_spacename_get(struct TransInfo *t, const short orient_type); -void transform_orientations_current_set(struct TransInfo *t, const short orient_index); +const char *transform_orientations_spacename_get(struct TransInfo *t, short orient_type); +void transform_orientations_current_set(struct TransInfo *t, short orient_index); /** * Those two fill in mat and return non-zero on success. @@ -55,7 +55,7 @@ bool createSpaceNormalTangent(float mat[3][3], const float normal[3], const floa struct TransformOrientation *addMatrixSpace(struct bContext *C, float mat[3][3], const char *name, - const bool overwrite); + bool overwrite); void applyTransformOrientation(const struct TransformOrientation *ts, float r_mat[3][3], char r_name[64]); @@ -75,5 +75,5 @@ int getTransformOrientation_ex(ViewLayer *view_layer, struct Object *obedit, float normal[3], float plane[3], - const short around); + short around); int getTransformOrientation(const struct bContext *C, float normal[3], float plane[3]); diff --git a/source/blender/editors/transform/transform_snap.h b/source/blender/editors/transform/transform_snap.h index bc89c7a8cda..389c1441db1 100644 --- a/source/blender/editors/transform/transform_snap.h +++ b/source/blender/editors/transform/transform_snap.h @@ -27,7 +27,7 @@ bool peelObjectsTransform(struct TransInfo *t, const float mval[2], - const bool use_peel_object, + bool use_peel_object, /* return args */ float r_loc[3], float r_no[3], @@ -92,9 +92,9 @@ void transform_snap_sequencer_apply_translate(TransInfo *t, float *vec); */ short getAnimEdit_SnapMode(TransInfo *t); void snapFrameTransform(TransInfo *t, - const eAnimEdit_AutoSnap autosnap, - const float val_initial, - const float val_final, + eAnimEdit_AutoSnap autosnap, + float val_initial, + float val_final, float *r_val_final); /** * This function is used by Animation Editor specific transform functions to do @@ -102,5 +102,5 @@ void snapFrameTransform(TransInfo *t, */ void transform_snap_anim_flush_data(TransInfo *t, TransData *td, - const eAnimEdit_AutoSnap autosnap, + eAnimEdit_AutoSnap autosnap, float *r_val_final); diff --git a/source/blender/editors/uvedit/uvedit_intern.h b/source/blender/editors/uvedit/uvedit_intern.h index 1fa96a932ed..9646444c103 100644 --- a/source/blender/editors/uvedit/uvedit_intern.h +++ b/source/blender/editors/uvedit/uvedit_intern.h @@ -74,13 +74,13 @@ typedef struct UvNearestHit { bool uv_find_nearest_vert(struct Scene *scene, struct Object *obedit, const float co[2], - const float penalty_dist, + float penalty_dist, struct UvNearestHit *hit); bool uv_find_nearest_vert_multi(struct Scene *scene, struct Object **objects, - const uint objects_len, + uint objects_len, const float co[2], - const float penalty_dist, + float penalty_dist, struct UvNearestHit *hit); bool uv_find_nearest_edge(struct Scene *scene, @@ -89,7 +89,7 @@ bool uv_find_nearest_edge(struct Scene *scene, struct UvNearestHit *hit); bool uv_find_nearest_edge_multi(struct Scene *scene, struct Object **objects, - const uint objects_len, + uint objects_len, const float co[2], struct UvNearestHit *hit); @@ -106,20 +106,20 @@ bool uv_find_nearest_face_ex(struct Scene *scene, struct Object *obedit, const float co[2], struct UvNearestHit *hit, - const bool only_in_face); + bool only_in_face); bool uv_find_nearest_face(struct Scene *scene, struct Object *obedit, const float co[2], struct UvNearestHit *hit); bool uv_find_nearest_face_multi_ex(struct Scene *scene, struct Object **objects, - const uint objects_len, + uint objects_len, const float co[2], struct UvNearestHit *hit, - const bool only_in_face); + bool only_in_face); bool uv_find_nearest_face_multi(struct Scene *scene, struct Object **objects, - const uint objects_len, + uint objects_len, const float co[2], struct UvNearestHit *hit); @@ -162,14 +162,14 @@ void UV_OT_shortest_path_select(struct wmOperatorType *ot); bool uvedit_select_is_any_selected(struct Scene *scene, struct Object *obedit); bool uvedit_select_is_any_selected_multi(struct Scene *scene, struct Object **objects, - const uint objects_len); + uint objects_len); /** * \warning This returns first selected UV, * not ideal in many cases since there could be multiple. */ const float *uvedit_first_selected_uv_from_vertex(struct Scene *scene, struct BMVert *eve, - const int cd_loop_uv_offset); + int cd_loop_uv_offset); void UV_OT_select_all(struct wmOperatorType *ot); void UV_OT_select(struct wmOperatorType *ot); diff --git a/source/blender/freestyle/intern/scene_graph/FrsMaterial.h b/source/blender/freestyle/intern/scene_graph/FrsMaterial.h index ecdba75b864..a66380f01be 100644 --- a/source/blender/freestyle/intern/scene_graph/FrsMaterial.h +++ b/source/blender/freestyle/intern/scene_graph/FrsMaterial.h @@ -57,8 +57,8 @@ class FrsMaterial { const float *iAmbiant, const float *iSpecular, const float *iEmission, - const float iShininess, - const int iPriority); + float iShininess, + int iPriority); /** Copy constructor */ inline FrsMaterial(const FrsMaterial &m); @@ -240,7 +240,7 @@ class FrsMaterial { * \param a: * Alpha component */ - inline void setLine(const float r, const float g, const float b, const float a); + inline void setLine(float r, float g, float b, float a); /** Sets the diffuse color. * \param r: @@ -252,7 +252,7 @@ class FrsMaterial { * \param a: * Alpha component */ - inline void setDiffuse(const float r, const float g, const float b, const float a); + inline void setDiffuse(float r, float g, float b, float a); /** Sets the specular color. * \param r: @@ -264,7 +264,7 @@ class FrsMaterial { * \param a: * Alpha component */ - inline void setSpecular(const float r, const float g, const float b, const float a); + inline void setSpecular(float r, float g, float b, float a); /** Sets the ambient color. * \param r: @@ -276,7 +276,7 @@ class FrsMaterial { * \param a: * Alpha component */ - inline void setAmbient(const float r, const float g, const float b, const float a); + inline void setAmbient(float r, float g, float b, float a); /** Sets the emissive color. * \param r: @@ -288,19 +288,19 @@ class FrsMaterial { * \param a: * Alpha component */ - inline void setEmission(const float r, const float g, const float b, const float a); + inline void setEmission(float r, float g, float b, float a); /** Sets the shininess. * \param s: * Shininess */ - inline void setShininess(const float s); + inline void setShininess(float s); /** Sets the line color priority. * \param priority: * Priority */ - inline void setPriority(const int priority); + inline void setPriority(int priority); /* operators */ inline FrsMaterial &operator=(const FrsMaterial &m); diff --git a/source/blender/freestyle/intern/stroke/Curve.h b/source/blender/freestyle/intern/stroke/Curve.h index 9a05fcd380b..b26408d8183 100644 --- a/source/blender/freestyle/intern/stroke/Curve.h +++ b/source/blender/freestyle/intern/stroke/Curve.h @@ -540,7 +540,7 @@ class Curve : public Interface1D { } const SShape *occluded_shape() const; - const bool occludee_empty() const; + bool occludee_empty() const; real z_discontinuity(int iCombination = 0) const; int shape_id() const; const SShape *shape() const; diff --git a/source/blender/freestyle/intern/view_map/ViewMapIO.h b/source/blender/freestyle/intern/view_map/ViewMapIO.h index e4c42c094d0..4b737f1eb8c 100644 --- a/source/blender/freestyle/intern/view_map/ViewMapIO.h +++ b/source/blender/freestyle/intern/view_map/ViewMapIO.h @@ -44,11 +44,11 @@ namespace Options { static const unsigned char FLOAT_VECTORS = 1; static const unsigned char NO_OCCLUDERS = 2; -void setFlags(const unsigned char flags); +void setFlags(unsigned char flags); -void addFlags(const unsigned char flags); +void addFlags(unsigned char flags); -void rmFlags(const unsigned char flags); +void rmFlags(unsigned char flags); unsigned char getFlags(); diff --git a/source/blender/functions/FN_field.hh b/source/blender/functions/FN_field.hh index 11f8a7e9b94..1b89c5353e9 100644 --- a/source/blender/functions/FN_field.hh +++ b/source/blender/functions/FN_field.hh @@ -448,7 +448,7 @@ class FieldEvaluator : NonMovable, NonCopyable { * to avoid calculations for unnecessary elements later on. The evaluator will own the indices in * some cases, so it must live at least as long as the returned mask. */ - IndexMask get_evaluated_as_mask(const int field_index); + IndexMask get_evaluated_as_mask(int field_index); }; /** diff --git a/source/blender/functions/FN_generic_virtual_array.hh b/source/blender/functions/FN_generic_virtual_array.hh index 6aebca51219..bcb710e3472 100644 --- a/source/blender/functions/FN_generic_virtual_array.hh +++ b/source/blender/functions/FN_generic_virtual_array.hh @@ -47,15 +47,15 @@ class GVArrayImpl { int64_t size_; public: - GVArrayImpl(const CPPType &type, const int64_t size); + GVArrayImpl(const CPPType &type, int64_t size); virtual ~GVArrayImpl() = default; const CPPType &type() const; int64_t size() const; - virtual void get(const int64_t index, void *r_value) const; - virtual void get_to_uninitialized(const int64_t index, void *r_value) const = 0; + virtual void get(int64_t index, void *r_value) const; + virtual void get_to_uninitialized(int64_t index, void *r_value) const = 0; virtual bool is_span() const; virtual GSpan get_internal_span() const; @@ -73,11 +73,11 @@ class GVArrayImpl { /* A generic version of #VMutableArrayImpl. */ class GVMutableArrayImpl : public GVArrayImpl { public: - GVMutableArrayImpl(const CPPType &type, const int64_t size); + GVMutableArrayImpl(const CPPType &type, int64_t size); - virtual void set_by_copy(const int64_t index, const void *value); - virtual void set_by_relocate(const int64_t index, void *value); - virtual void set_by_move(const int64_t index, void *value) = 0; + virtual void set_by_copy(int64_t index, const void *value); + virtual void set_by_relocate(int64_t index, void *value); + virtual void set_by_move(int64_t index, void *value) = 0; virtual void set_all(const void *src); @@ -173,13 +173,13 @@ class GVArrayCommon { */ void get_internal_single_to_uninitialized(void *r_value) const; - void get(const int64_t index, void *r_value) const; + void get(int64_t index, void *r_value) const; /** * Returns a copy of the value at the given index. Usually a typed virtual array should * be used instead, but sometimes this is simpler when only a few indices are needed. */ - template<typename T> T get(const int64_t index) const; - void get_to_uninitialized(const int64_t index, void *r_value) const; + template<typename T> T get(int64_t index) const; + void get_to_uninitialized(int64_t index, void *r_value) const; }; /** Generic version of #VArray. */ @@ -200,9 +200,9 @@ class GVArray : public GVArrayCommon { template<typename ImplT, typename... Args> static GVArray For(Args &&...args); - static GVArray ForSingle(const CPPType &type, const int64_t size, const void *value); - static GVArray ForSingleRef(const CPPType &type, const int64_t size, const void *value); - static GVArray ForSingleDefault(const CPPType &type, const int64_t size); + static GVArray ForSingle(const CPPType &type, int64_t size, const void *value); + static GVArray ForSingleRef(const CPPType &type, int64_t size, const void *value); + static GVArray ForSingleDefault(const CPPType &type, int64_t size); static GVArray ForSpan(GSpan span); static GVArray ForGArray(GArray<> array); static GVArray ForEmpty(const CPPType &type); @@ -244,9 +244,9 @@ class GVMutableArray : public GVArrayCommon { template<typename T> bool try_assign_VMutableArray(VMutableArray<T> &varray) const; - void set_by_copy(const int64_t index, const void *value); - void set_by_move(const int64_t index, void *value); - void set_by_relocate(const int64_t index, void *value); + void set_by_copy(int64_t index, const void *value); + void set_by_move(int64_t index, void *value); + void set_by_relocate(int64_t index, void *value); void fill(const void *value); /** @@ -593,15 +593,15 @@ class GVArrayImpl_For_GSpan : public GVMutableArrayImpl { GVArrayImpl_For_GSpan(const GMutableSpan span); protected: - GVArrayImpl_For_GSpan(const CPPType &type, const int64_t size); + GVArrayImpl_For_GSpan(const CPPType &type, int64_t size); public: - void get(const int64_t index, void *r_value) const override; - void get_to_uninitialized(const int64_t index, void *r_value) const override; + void get(int64_t index, void *r_value) const override; + void get_to_uninitialized(int64_t index, void *r_value) const override; - void set_by_copy(const int64_t index, const void *value) override; - void set_by_move(const int64_t index, void *value) override; - void set_by_relocate(const int64_t index, void *value) override; + void set_by_copy(int64_t index, const void *value) override; + void set_by_move(int64_t index, void *value) override; + void set_by_relocate(int64_t index, void *value) override; bool is_span() const override; GSpan get_internal_span() const override; diff --git a/source/blender/functions/FN_generic_virtual_vector_array.hh b/source/blender/functions/FN_generic_virtual_vector_array.hh index b80e21eaef1..b89ca22fe7e 100644 --- a/source/blender/functions/FN_generic_virtual_vector_array.hh +++ b/source/blender/functions/FN_generic_virtual_vector_array.hh @@ -88,10 +88,10 @@ class GVVectorArray { } protected: - virtual int64_t get_vector_size_impl(const int64_t index) const = 0; + virtual int64_t get_vector_size_impl(int64_t index) const = 0; - virtual void get_vector_element_impl(const int64_t index, - const int64_t index_in_vector, + virtual void get_vector_element_impl(int64_t index, + int64_t index_in_vector, void *r_value) const = 0; virtual bool is_single_vector_impl() const @@ -114,8 +114,8 @@ class GVArray_For_GVVectorArrayIndex : public GVArrayImpl { } protected: - void get(const int64_t index_in_vector, void *r_value) const override; - void get_to_uninitialized(const int64_t index_in_vector, void *r_value) const override; + void get(int64_t index_in_vector, void *r_value) const override; + void get_to_uninitialized(int64_t index_in_vector, void *r_value) const override; }; class GVVectorArray_For_SingleGVArray : public GVVectorArray { @@ -129,9 +129,9 @@ class GVVectorArray_For_SingleGVArray : public GVVectorArray { } protected: - int64_t get_vector_size_impl(const int64_t index) const override; - void get_vector_element_impl(const int64_t index, - const int64_t index_in_vector, + int64_t get_vector_size_impl(int64_t index) const override; + void get_vector_element_impl(int64_t index, + int64_t index_in_vector, void *r_value) const override; bool is_single_vector_impl() const override; @@ -148,9 +148,9 @@ class GVVectorArray_For_SingleGSpan : public GVVectorArray { } protected: - int64_t get_vector_size_impl(const int64_t UNUSED(index)) const override; - void get_vector_element_impl(const int64_t UNUSED(index), - const int64_t index_in_vector, + int64_t get_vector_size_impl(int64_t UNUSED(index)) const override; + void get_vector_element_impl(int64_t UNUSED(index), + int64_t index_in_vector, void *r_value) const override; bool is_single_vector_impl() const override; diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencil_util.h b/source/blender/gpencil_modifiers/intern/MOD_gpencil_util.h index 722574929c0..22893bdb184 100644 --- a/source/blender/gpencil_modifiers/intern/MOD_gpencil_util.h +++ b/source/blender/gpencil_modifiers/intern/MOD_gpencil_util.h @@ -35,15 +35,15 @@ struct bGPDstroke; bool is_stroke_affected_by_modifier(struct Object *ob, char *mlayername, struct Material *material, - const int mpassindex, - const int gpl_passindex, - const int minpoints, + int mpassindex, + int gpl_passindex, + int minpoints, bGPDlayer *gpl, bGPDstroke *gps, - const bool inv1, - const bool inv2, - const bool inv3, - const bool inv4); + bool inv1, + bool inv2, + bool inv3, + bool inv4); /** * Verify if valid vertex group *and return weight. diff --git a/source/blender/gpencil_modifiers/intern/lineart/MOD_lineart.h b/source/blender/gpencil_modifiers/intern/lineart/MOD_lineart.h index dadeebeff0a..8c5820c9667 100644 --- a/source/blender/gpencil_modifiers/intern/lineart/MOD_lineart.h +++ b/source/blender/gpencil_modifiers/intern/lineart/MOD_lineart.h @@ -655,7 +655,7 @@ void MOD_lineart_chain_split_for_fixed_occlusion(LineartRenderBuffer *rb); * implemented yet. */ void MOD_lineart_chain_connect(LineartRenderBuffer *rb); -void MOD_lineart_chain_discard_short(LineartRenderBuffer *rb, const float threshold); +void MOD_lineart_chain_discard_short(LineartRenderBuffer *rb, float threshold); void MOD_lineart_chain_clip_at_border(LineartRenderBuffer *rb); /** * This should always be the last stage!, see the end of diff --git a/source/blender/gpu/CMakeLists.txt b/source/blender/gpu/CMakeLists.txt index 9dd8b69be40..2987709c875 100644 --- a/source/blender/gpu/CMakeLists.txt +++ b/source/blender/gpu/CMakeLists.txt @@ -245,28 +245,15 @@ data_to_c_simple(shaders/gpu_shader_3D_clipped_uniform_color_vert.glsl SRC) data_to_c_simple(shaders/gpu_shader_instance_variying_size_variying_color_vert.glsl SRC) -data_to_c_simple(shaders/gpu_shader_point_uniform_color_frag.glsl SRC) data_to_c_simple(shaders/gpu_shader_point_uniform_color_aa_frag.glsl SRC) data_to_c_simple(shaders/gpu_shader_point_uniform_color_outline_aa_frag.glsl SRC) -data_to_c_simple(shaders/gpu_shader_point_varying_color_outline_aa_frag.glsl SRC) data_to_c_simple(shaders/gpu_shader_point_varying_color_varying_outline_aa_frag.glsl SRC) data_to_c_simple(shaders/gpu_shader_point_varying_color_frag.glsl SRC) data_to_c_simple(shaders/gpu_shader_3D_point_fixed_size_varying_color_vert.glsl SRC) -data_to_c_simple(shaders/gpu_shader_3D_point_varying_size_vert.glsl SRC) data_to_c_simple(shaders/gpu_shader_3D_point_varying_size_varying_color_vert.glsl SRC) data_to_c_simple(shaders/gpu_shader_3D_point_uniform_size_aa_vert.glsl SRC) -data_to_c_simple(shaders/gpu_shader_3D_point_uniform_size_outline_aa_vert.glsl SRC) -data_to_c_simple(shaders/gpu_shader_2D_point_varying_size_varying_color_vert.glsl SRC) data_to_c_simple(shaders/gpu_shader_2D_point_uniform_size_aa_vert.glsl SRC) data_to_c_simple(shaders/gpu_shader_2D_point_uniform_size_outline_aa_vert.glsl SRC) -data_to_c_simple(shaders/gpu_shader_2D_point_uniform_size_varying_color_outline_aa_vert.glsl SRC) - -data_to_c_simple(shaders/gpu_shader_2D_edituvs_points_vert.glsl SRC) -data_to_c_simple(shaders/gpu_shader_2D_edituvs_facedots_vert.glsl SRC) -data_to_c_simple(shaders/gpu_shader_2D_edituvs_edges_vert.glsl SRC) -data_to_c_simple(shaders/gpu_shader_2D_edituvs_edges_frag.glsl SRC) -data_to_c_simple(shaders/gpu_shader_2D_edituvs_faces_vert.glsl SRC) -data_to_c_simple(shaders/gpu_shader_2D_edituvs_stretch_vert.glsl SRC) data_to_c_simple(shaders/gpu_shader_text_vert.glsl SRC) data_to_c_simple(shaders/gpu_shader_text_frag.glsl SRC) @@ -407,10 +394,8 @@ if(WITH_GTESTS) tests/gpu_testing.hh ) set(TEST_INC - ../../../intern/ghost ) set(TEST_LIB - ) include(GTestTesting) blender_add_test_lib(bf_gpu_tests "${TEST_SRC}" "${INC};${TEST_INC}" "${INC_SYS}" "${LIB};${TEST_LIB}") diff --git a/source/blender/gpu/GPU_batch_presets.h b/source/blender/gpu/GPU_batch_presets.h index 73c9172f2ba..1681db8126a 100644 --- a/source/blender/gpu/GPU_batch_presets.h +++ b/source/blender/gpu/GPU_batch_presets.h @@ -39,10 +39,10 @@ extern "C" { struct GPUBatch *GPU_batch_preset_sphere(int lod) ATTR_WARN_UNUSED_RESULT; struct GPUBatch *GPU_batch_preset_sphere_wire(int lod) ATTR_WARN_UNUSED_RESULT; -struct GPUBatch *GPU_batch_preset_panel_drag_widget(const float pixelsize, +struct GPUBatch *GPU_batch_preset_panel_drag_widget(float pixelsize, const float col_high[4], const float col_dark[4], - const float width) ATTR_WARN_UNUSED_RESULT; + float width) ATTR_WARN_UNUSED_RESULT; /** * To be used with procedural placement inside shader. diff --git a/source/blender/gpu/GPU_buffers.h b/source/blender/gpu/GPU_buffers.h index 9ba283bf65f..598d4961e05 100644 --- a/source/blender/gpu/GPU_buffers.h +++ b/source/blender/gpu/GPU_buffers.h @@ -61,7 +61,7 @@ GPU_PBVH_Buffers *GPU_pbvh_mesh_buffers_build(const struct MPoly *mpoly, const struct MVert *mvert, const int *face_indices, const int *sculpt_face_sets, - const int face_indices_len, + int face_indices_len, const struct Mesh *mesh); /** @@ -99,10 +99,10 @@ void GPU_pbvh_mesh_buffers_update(GPU_PBVH_Buffers *buffers, const float *vmask, const struct MLoopCol *vcol, const int *sculpt_face_sets, - const int face_sets_color_seed, - const int face_sets_color_default, + int face_sets_color_seed, + int face_sets_color_default, const struct MPropCol *vtcol, - const int update_flags); + int update_flags); /** * Creates a vertex buffer (coordinate, normal, color) and, @@ -114,7 +114,7 @@ void GPU_pbvh_bmesh_buffers_update(GPU_PBVH_Buffers *buffers, struct GSet *bm_faces, struct GSet *bm_unique_verts, struct GSet *bm_other_verts, - const int update_flags); + int update_flags); /** * Threaded: do not call any functions that use OpenGL calls! @@ -126,10 +126,10 @@ void GPU_pbvh_grid_buffers_update(GPU_PBVH_Buffers *buffers, int *grid_indices, int totgrid, const int *sculpt_face_sets, - const int face_sets_color_seed, - const int face_sets_color_default, + int face_sets_color_seed, + int face_sets_color_default, const struct CCGKey *key, - const int update_flags); + int update_flags); /** * Finish update. Not thread safe, must run in OpenGL main thread. diff --git a/source/blender/gpu/GPU_immediate_util.h b/source/blender/gpu/GPU_immediate_util.h index 102bd6c284c..cd45913158d 100644 --- a/source/blender/gpu/GPU_immediate_util.h +++ b/source/blender/gpu/GPU_immediate_util.h @@ -148,7 +148,7 @@ void imm_draw_cube_wire_3d(uint pos, const float center[3], const float aspect[3 void imm_draw_cube_corners_3d(uint pos, const float center[3], const float aspect[3], - const float factor); + float factor); /** * Draw a cylinder. Replacement for #gluCylinder. diff --git a/source/blender/gpu/GPU_material.h b/source/blender/gpu/GPU_material.h index f7a01fadadc..3555b957d67 100644 --- a/source/blender/gpu/GPU_material.h +++ b/source/blender/gpu/GPU_material.h @@ -171,7 +171,7 @@ bool GPU_stack_link(GPUMaterial *mat, GPUNodeLink *GPU_uniformbuf_link_out(struct GPUMaterial *mat, struct bNode *node, struct GPUNodeStack *stack, - const int index); + int index); void GPU_material_output_link(GPUMaterial *material, GPUNodeLink *link); void GPU_material_add_output_link_aov(GPUMaterial *material, GPUNodeLink *link, int hash); @@ -197,8 +197,8 @@ GPUMaterial *GPU_material_from_nodetree(struct Scene *scene, struct bNodeTree *ntree, struct ListBase *gpumaterials, const void *engine_type, - const int options, - const bool is_volume_shader, + int options, + bool is_volume_shader, const char *vert_code, const char *geom_code, const char *frag_lib, diff --git a/source/blender/gpu/GPU_shader.h b/source/blender/gpu/GPU_shader.h index 5c373551494..f36c8f99064 100644 --- a/source/blender/gpu/GPU_shader.h +++ b/source/blender/gpu/GPU_shader.h @@ -62,9 +62,9 @@ GPUShader *GPU_shader_create_ex(const char *vertcode, const char *computecode, const char *libcode, const char *defines, - const eGPUShaderTFBType tf_type, + eGPUShaderTFBType tf_type, const char **tf_names, - const int tf_count, + int tf_count, const char *shname); struct GPU_ShaderCreateFromArray_Params { @@ -294,14 +294,6 @@ typedef enum eGPUBuiltinShader { GPU_SHADER_3D_IMAGE_MODULATE_ALPHA, /* points */ /** - * Draw round points with a hardcoded size. - * Take a single color for all the vertices and a 2D position for each vertex. - * - * \param color: uniform vec4 - * \param pos: in vec2 - */ - GPU_SHADER_2D_POINT_FIXED_SIZE_UNIFORM_COLOR, - /** * Draw round points with a constant size. * Take a single color for all the vertices and a 2D position for each vertex. * @@ -322,34 +314,6 @@ typedef enum eGPUBuiltinShader { */ GPU_SHADER_2D_POINT_UNIFORM_SIZE_UNIFORM_COLOR_OUTLINE_AA, /** - * Draw round points with a constant size and an outline. - * Take a 2D position and a color for each vertex. - * - * \param size: uniform float - * \param outlineWidth: uniform float - * \param outlineColor: uniform vec4 - * \param color: in vec4 - * \param pos: in vec2 - */ - GPU_SHADER_2D_POINT_UNIFORM_SIZE_VARYING_COLOR_OUTLINE_AA, - /** - * Draw round points with a constant size and an outline. - * Take a 2D position and a color for each vertex. - * - * \param size: in float - * \param color: in vec4 - * \param pos: in vec2 - */ - GPU_SHADER_2D_POINT_VARYING_SIZE_VARYING_COLOR, - /** - * Draw round points with a hardcoded size. - * Take a single color for all the vertices and a 3D position for each vertex. - * - * \param color: uniform vec4 - * \param pos: in vec3 - */ - GPU_SHADER_3D_POINT_FIXED_SIZE_UNIFORM_COLOR, - /** * Draw round points with a hardcoded size. * Take a single color for all the vertices and a 3D position for each vertex. * @@ -368,26 +332,6 @@ typedef enum eGPUBuiltinShader { GPU_SHADER_3D_POINT_UNIFORM_SIZE_UNIFORM_COLOR_AA, /** * Draw round points with a constant size and an outline. - * Take a single color for all the vertices and a 3D position for each vertex. - * - * \param size: uniform float - * \param outlineWidth: uniform float - * \param color: uniform vec4 - * \param outlineColor: uniform vec4 - * \param pos: in vec3 - */ - GPU_SHADER_3D_POINT_UNIFORM_SIZE_UNIFORM_COLOR_OUTLINE_AA, - /** - * Draw round points with a constant size and an outline. - * Take a single color for all the vertices and a 3D position for each vertex. - * - * \param color: uniform vec4 - * \param size: in float - * \param pos: in vec3 - */ - GPU_SHADER_3D_POINT_VARYING_SIZE_UNIFORM_COLOR, - /** - * Draw round points with a constant size and an outline. * Take a 3D position and a color for each vertex. * * \param size: in float @@ -403,23 +347,14 @@ typedef enum eGPUBuiltinShader { /* grease pencil drawing */ GPU_SHADER_GPENCIL_STROKE, /* specialized for widget drawing */ - GPU_SHADER_2D_AREA_EDGES, + GPU_SHADER_2D_AREA_BORDERS, GPU_SHADER_2D_WIDGET_BASE, GPU_SHADER_2D_WIDGET_BASE_INST, GPU_SHADER_2D_WIDGET_SHADOW, GPU_SHADER_2D_NODELINK, GPU_SHADER_2D_NODELINK_INST, - /* specialized for edituv drawing */ - GPU_SHADER_2D_UV_UNIFORM_COLOR, - GPU_SHADER_2D_UV_VERTS, - GPU_SHADER_2D_UV_FACEDOTS, - GPU_SHADER_2D_UV_EDGES, - GPU_SHADER_2D_UV_EDGES_SMOOTH, - GPU_SHADER_2D_UV_FACES, - GPU_SHADER_2D_UV_FACES_STRETCH_AREA, - GPU_SHADER_2D_UV_FACES_STRETCH_ANGLE, } eGPUBuiltinShader; -#define GPU_SHADER_BUILTIN_LEN (GPU_SHADER_2D_UV_FACES_STRETCH_ANGLE + 1) +#define GPU_SHADER_BUILTIN_LEN (GPU_SHADER_2D_NODELINK_INST + 1) /** Support multiple configurations. */ typedef enum eGPUShaderConfig { diff --git a/source/blender/gpu/GPU_texture.h b/source/blender/gpu/GPU_texture.h index 54e9bde70d8..d65115541fa 100644 --- a/source/blender/gpu/GPU_texture.h +++ b/source/blender/gpu/GPU_texture.h @@ -281,7 +281,7 @@ void GPU_texture_free(GPUTexture *tex); void GPU_texture_ref(GPUTexture *tex); void GPU_texture_bind(GPUTexture *tex, int unit); -void GPU_texture_bind_ex(GPUTexture *tex, eGPUSamplerState state, int unit, const bool set_number); +void GPU_texture_bind_ex(GPUTexture *tex, eGPUSamplerState state, int unit, bool set_number); void GPU_texture_unbind(GPUTexture *tex); void GPU_texture_unbind_all(void); diff --git a/source/blender/gpu/intern/gpu_material_library.h b/source/blender/gpu/intern/gpu_material_library.h index d3b12d3a2b7..7f9eeb8166a 100644 --- a/source/blender/gpu/intern/gpu_material_library.h +++ b/source/blender/gpu/intern/gpu_material_library.h @@ -63,4 +63,4 @@ char *gpu_material_library_generate_code(struct GSet *used_libraries, const char /* Code Parsing */ const char *gpu_str_skip_token(const char *str, char *token, int max); -const char *gpu_data_type_to_string(const eGPUType type); +const char *gpu_data_type_to_string(eGPUType type); diff --git a/source/blender/gpu/intern/gpu_shader_builtin.c b/source/blender/gpu/intern/gpu_shader_builtin.c index bea43bacb23..24ca691be78 100644 --- a/source/blender/gpu/intern/gpu_shader_builtin.c +++ b/source/blender/gpu/intern/gpu_shader_builtin.c @@ -93,28 +93,15 @@ extern char datatoc_gpu_shader_3D_clipped_uniform_color_vert_glsl[]; extern char datatoc_gpu_shader_instance_variying_size_variying_color_vert_glsl[]; -extern char datatoc_gpu_shader_point_uniform_color_frag_glsl[]; extern char datatoc_gpu_shader_point_uniform_color_aa_frag_glsl[]; extern char datatoc_gpu_shader_point_uniform_color_outline_aa_frag_glsl[]; -extern char datatoc_gpu_shader_point_varying_color_outline_aa_frag_glsl[]; extern char datatoc_gpu_shader_point_varying_color_varying_outline_aa_frag_glsl[]; extern char datatoc_gpu_shader_point_varying_color_frag_glsl[]; extern char datatoc_gpu_shader_3D_point_fixed_size_varying_color_vert_glsl[]; -extern char datatoc_gpu_shader_3D_point_varying_size_vert_glsl[]; extern char datatoc_gpu_shader_3D_point_varying_size_varying_color_vert_glsl[]; extern char datatoc_gpu_shader_3D_point_uniform_size_aa_vert_glsl[]; -extern char datatoc_gpu_shader_3D_point_uniform_size_outline_aa_vert_glsl[]; -extern char datatoc_gpu_shader_2D_point_varying_size_varying_color_vert_glsl[]; extern char datatoc_gpu_shader_2D_point_uniform_size_aa_vert_glsl[]; extern char datatoc_gpu_shader_2D_point_uniform_size_outline_aa_vert_glsl[]; -extern char datatoc_gpu_shader_2D_point_uniform_size_varying_color_outline_aa_vert_glsl[]; - -extern char datatoc_gpu_shader_2D_edituvs_points_vert_glsl[]; -extern char datatoc_gpu_shader_2D_edituvs_facedots_vert_glsl[]; -extern char datatoc_gpu_shader_2D_edituvs_edges_vert_glsl[]; -extern char datatoc_gpu_shader_2D_edituvs_edges_frag_glsl[]; -extern char datatoc_gpu_shader_2D_edituvs_faces_vert_glsl[]; -extern char datatoc_gpu_shader_2D_edituvs_stretch_vert_glsl[]; extern char datatoc_gpu_shader_2D_line_dashed_uniform_color_vert_glsl[]; extern char datatoc_gpu_shader_2D_line_dashed_frag_glsl[]; @@ -343,18 +330,6 @@ static const GPUShaderStages builtin_shader_stages[GPU_SHADER_BUILTIN_LEN] = { .frag = datatoc_gpu_shader_2D_line_dashed_frag_glsl, }, - [GPU_SHADER_2D_POINT_FIXED_SIZE_UNIFORM_COLOR] = - { - .name = "GPU_SHADER_2D_POINT_FIXED_SIZE_UNIFORM_COLOR", - .vert = datatoc_gpu_shader_2D_vert_glsl, - .frag = datatoc_gpu_shader_point_uniform_color_frag_glsl, - }, - [GPU_SHADER_2D_POINT_VARYING_SIZE_VARYING_COLOR] = - { - .name = "GPU_SHADER_2D_POINT_VARYING_SIZE_VARYING_COLOR", - .vert = datatoc_gpu_shader_2D_point_varying_size_varying_color_vert_glsl, - .frag = datatoc_gpu_shader_point_varying_color_frag_glsl, - }, [GPU_SHADER_2D_POINT_UNIFORM_SIZE_UNIFORM_COLOR_AA] = { .name = "GPU_SHADER_2D_POINT_UNIFORM_SIZE_UNIFORM_COLOR_AA", @@ -367,30 +342,12 @@ static const GPUShaderStages builtin_shader_stages[GPU_SHADER_BUILTIN_LEN] = { .vert = datatoc_gpu_shader_2D_point_uniform_size_outline_aa_vert_glsl, .frag = datatoc_gpu_shader_point_uniform_color_outline_aa_frag_glsl, }, - [GPU_SHADER_2D_POINT_UNIFORM_SIZE_VARYING_COLOR_OUTLINE_AA] = - { - .name = "GPU_SHADER_2D_POINT_UNIFORM_SIZE_VARYING_COLOR_OUTLINE_AA", - .vert = datatoc_gpu_shader_2D_point_uniform_size_varying_color_outline_aa_vert_glsl, - .frag = datatoc_gpu_shader_point_varying_color_outline_aa_frag_glsl, - }, - [GPU_SHADER_3D_POINT_FIXED_SIZE_UNIFORM_COLOR] = - { - .name = "GPU_SHADER_3D_POINT_FIXED_SIZE_UNIFORM_COLOR", - .vert = datatoc_gpu_shader_3D_vert_glsl, - .frag = datatoc_gpu_shader_point_uniform_color_frag_glsl, - }, [GPU_SHADER_3D_POINT_FIXED_SIZE_VARYING_COLOR] = { .name = "GPU_SHADER_3D_POINT_FIXED_SIZE_VARYING_COLOR", .vert = datatoc_gpu_shader_3D_point_fixed_size_varying_color_vert_glsl, .frag = datatoc_gpu_shader_point_varying_color_frag_glsl, }, - [GPU_SHADER_3D_POINT_VARYING_SIZE_UNIFORM_COLOR] = - { - .name = "GPU_SHADER_3D_POINT_VARYING_SIZE_UNIFORM_COLOR", - .vert = datatoc_gpu_shader_3D_point_varying_size_vert_glsl, - .frag = datatoc_gpu_shader_point_uniform_color_frag_glsl, - }, [GPU_SHADER_3D_POINT_VARYING_SIZE_VARYING_COLOR] = { .name = "GPU_SHADER_3D_POINT_VARYING_SIZE_VARYING_COLOR", @@ -403,12 +360,6 @@ static const GPUShaderStages builtin_shader_stages[GPU_SHADER_BUILTIN_LEN] = { .vert = datatoc_gpu_shader_3D_point_uniform_size_aa_vert_glsl, .frag = datatoc_gpu_shader_point_uniform_color_aa_frag_glsl, }, - [GPU_SHADER_3D_POINT_UNIFORM_SIZE_UNIFORM_COLOR_OUTLINE_AA] = - { - .name = "GPU_SHADER_3D_POINT_UNIFORM_SIZE_UNIFORM_COLOR_OUTLINE_AA", - .vert = datatoc_gpu_shader_3D_point_uniform_size_outline_aa_vert_glsl, - .frag = datatoc_gpu_shader_point_uniform_color_outline_aa_frag_glsl, - }, [GPU_SHADER_INSTANCE_VARIYING_COLOR_VARIYING_SIZE] = { @@ -418,9 +369,9 @@ static const GPUShaderStages builtin_shader_stages[GPU_SHADER_BUILTIN_LEN] = { .defs = "#define UNIFORM_SCALE\n", }, - [GPU_SHADER_2D_AREA_EDGES] = + [GPU_SHADER_2D_AREA_BORDERS] = { - .name = "GPU_SHADER_2D_AREA_EDGES", + .name = "GPU_SHADER_2D_AREA_BORDERS", .vert = datatoc_gpu_shader_2D_area_borders_vert_glsl, .frag = datatoc_gpu_shader_2D_area_borders_frag_glsl, }, @@ -457,58 +408,6 @@ static const GPUShaderStages builtin_shader_stages[GPU_SHADER_BUILTIN_LEN] = { .defs = "#define USE_INSTANCE\n", }, - [GPU_SHADER_2D_UV_UNIFORM_COLOR] = - { - .name = "GPU_SHADER_2D_UV_UNIFORM_COLOR", - .vert = datatoc_gpu_shader_2D_vert_glsl, - .frag = datatoc_gpu_shader_uniform_color_frag_glsl, - .defs = "#define UV_POS\n", - }, - [GPU_SHADER_2D_UV_VERTS] = - { - .name = "GPU_SHADER_2D_UV_VERTS", - .vert = datatoc_gpu_shader_2D_edituvs_points_vert_glsl, - .frag = datatoc_gpu_shader_point_varying_color_varying_outline_aa_frag_glsl, - }, - [GPU_SHADER_2D_UV_FACEDOTS] = - { - .name = "GPU_SHADER_2D_UV_FACEDOTS", - .vert = datatoc_gpu_shader_2D_edituvs_facedots_vert_glsl, - .frag = datatoc_gpu_shader_point_varying_color_frag_glsl, - }, - [GPU_SHADER_2D_UV_EDGES] = - { - .name = "GPU_SHADER_2D_UV_EDGES", - .vert = datatoc_gpu_shader_2D_edituvs_edges_vert_glsl, - .frag = datatoc_gpu_shader_2D_edituvs_edges_frag_glsl, - }, - [GPU_SHADER_2D_UV_EDGES_SMOOTH] = - { - .name = "GPU_SHADER_2D_UV_EDGES_SMOOTH", - .vert = datatoc_gpu_shader_2D_edituvs_edges_vert_glsl, - .frag = datatoc_gpu_shader_2D_edituvs_edges_frag_glsl, - .defs = "#define SMOOTH_COLOR\n", - }, - [GPU_SHADER_2D_UV_FACES] = - { - .name = "GPU_SHADER_2D_UV_FACES", - .vert = datatoc_gpu_shader_2D_edituvs_faces_vert_glsl, - .frag = datatoc_gpu_shader_flat_color_frag_glsl, - }, - [GPU_SHADER_2D_UV_FACES_STRETCH_AREA] = - { - .name = "GPU_SHADER_2D_UV_FACES_STRETCH_AREA", - .vert = datatoc_gpu_shader_2D_edituvs_stretch_vert_glsl, - .frag = datatoc_gpu_shader_2D_smooth_color_frag_glsl, - }, - [GPU_SHADER_2D_UV_FACES_STRETCH_ANGLE] = - { - .name = "GPU_SHADER_2D_UV_FACES_STRETCH_ANGLE", - .vert = datatoc_gpu_shader_2D_edituvs_stretch_vert_glsl, - .frag = datatoc_gpu_shader_2D_smooth_color_frag_glsl, - .defs = "#define STRETCH_ANGLE\n", - }, - [GPU_SHADER_GPENCIL_STROKE] = { .name = "GPU_SHADER_GPENCIL_STROKE", @@ -546,7 +445,6 @@ GPUShader *GPU_shader_get_builtin_shader_with_config(eGPUBuiltinShader shader, GPU_SHADER_3D_SMOOTH_COLOR, GPU_SHADER_3D_DEPTH_ONLY, GPU_SHADER_INSTANCE_VARIYING_COLOR_VARIYING_SIZE, - GPU_SHADER_3D_POINT_UNIFORM_SIZE_UNIFORM_COLOR_OUTLINE_AA, GPU_SHADER_3D_POINT_UNIFORM_SIZE_UNIFORM_COLOR_AA, GPU_SHADER_3D_FLAT_COLOR, GPU_SHADER_3D_LINE_DASHED_UNIFORM_COLOR)); diff --git a/source/blender/gpu/intern/gpu_shader_interface.hh b/source/blender/gpu/intern/gpu_shader_interface.hh index a6f0e30b715..4bd8f245e2b 100644 --- a/source/blender/gpu/intern/gpu_shader_interface.hh +++ b/source/blender/gpu/intern/gpu_shader_interface.hh @@ -137,12 +137,12 @@ class ShaderInterface { private: inline const ShaderInput *input_lookup(const ShaderInput *const inputs, - const uint inputs_len, + uint inputs_len, const char *name) const; inline const ShaderInput *input_lookup(const ShaderInput *const inputs, - const uint inputs_len, - const int binding) const; + uint inputs_len, + int binding) const; }; inline const char *ShaderInterface::builtin_uniform_name(GPUUniformBuiltin u) diff --git a/source/blender/gpu/intern/gpu_shader_private.hh b/source/blender/gpu/intern/gpu_shader_private.hh index 8bd1115c731..498dd8f3877 100644 --- a/source/blender/gpu/intern/gpu_shader_private.hh +++ b/source/blender/gpu/intern/gpu_shader_private.hh @@ -56,7 +56,7 @@ class Shader { virtual bool finalize() = 0; virtual void transform_feedback_names_set(Span<const char *> name_list, - const eGPUShaderTFBType geom_type) = 0; + eGPUShaderTFBType geom_type) = 0; virtual bool transform_feedback_enable(GPUVertBuf *) = 0; virtual void transform_feedback_disable() = 0; @@ -77,11 +77,8 @@ class Shader { }; protected: - void print_log(Span<const char *> sources, - char *log, - const char *stage, - const bool error, - GPULogParser *parser); + void print_log( + Span<const char *> sources, char *log, const char *stage, bool error, GPULogParser *parser); }; /* Syntactic sugar. */ diff --git a/source/blender/gpu/opengl/gl_shader.hh b/source/blender/gpu/opengl/gl_shader.hh index 6a424e0c7ee..9ea1334b862 100644 --- a/source/blender/gpu/opengl/gl_shader.hh +++ b/source/blender/gpu/opengl/gl_shader.hh @@ -62,7 +62,7 @@ class GLShader : public Shader { /** Should be called before linking. */ void transform_feedback_names_set(Span<const char *> name_list, - const eGPUShaderTFBType geom_type) override; + eGPUShaderTFBType geom_type) override; bool transform_feedback_enable(GPUVertBuf *buf) override; void transform_feedback_disable() override; diff --git a/source/blender/gpu/opengl/gl_state.hh b/source/blender/gpu/opengl/gl_state.hh index e0c0dab76e1..83ff3ffc9e9 100644 --- a/source/blender/gpu/opengl/gl_state.hh +++ b/source/blender/gpu/opengl/gl_state.hh @@ -97,17 +97,17 @@ class GLStateManager : public StateManager { uint8_t bound_image_slots(); private: - static void set_write_mask(const eGPUWriteMask value); - static void set_depth_test(const eGPUDepthTest value); - static void set_stencil_test(const eGPUStencilTest test, const eGPUStencilOp operation); - static void set_stencil_mask(const eGPUStencilTest test, const GPUStateMutable state); - static void set_clip_distances(const int new_dist_len, const int old_dist_len); - static void set_logic_op(const bool enable); - static void set_facing(const bool invert); - static void set_backface_culling(const eGPUFaceCullTest test); - static void set_provoking_vert(const eGPUProvokingVertex vert); - static void set_shadow_bias(const bool enable); - static void set_blend(const eGPUBlend value); + static void set_write_mask(eGPUWriteMask value); + static void set_depth_test(eGPUDepthTest value); + static void set_stencil_test(eGPUStencilTest test, eGPUStencilOp operation); + static void set_stencil_mask(eGPUStencilTest test, const GPUStateMutable state); + static void set_clip_distances(int new_dist_len, int old_dist_len); + static void set_logic_op(bool enable); + static void set_facing(bool invert); + static void set_backface_culling(eGPUFaceCullTest test); + static void set_provoking_vert(eGPUProvokingVertex vert); + static void set_shadow_bias(bool enable); + static void set_blend(eGPUBlend value); void set_state(const GPUState &state); void set_mutable_state(const GPUStateMutable &state); diff --git a/source/blender/gpu/opengl/gl_vertex_array.hh b/source/blender/gpu/opengl/gl_vertex_array.hh index 0f9b61f9648..b8edbf3a691 100644 --- a/source/blender/gpu/opengl/gl_vertex_array.hh +++ b/source/blender/gpu/opengl/gl_vertex_array.hh @@ -39,13 +39,13 @@ namespace GLVertArray { void update_bindings(const GLuint vao, const GPUBatch *batch, const ShaderInterface *interface, - const int base_instance); + int base_instance); /** * Another version of update_bindings for Immediate mode. */ void update_bindings(const GLuint vao, - const uint v_first, + uint v_first, const GPUVertFormat *format, const ShaderInterface *interface); diff --git a/source/blender/gpu/shaders/gpu_shader_2D_edituvs_edges_frag.glsl b/source/blender/gpu/shaders/gpu_shader_2D_edituvs_edges_frag.glsl deleted file mode 100644 index 108fc85c4a5..00000000000 --- a/source/blender/gpu/shaders/gpu_shader_2D_edituvs_edges_frag.glsl +++ /dev/null @@ -1,30 +0,0 @@ - - -uniform float dashWidth; - -#ifdef SMOOTH_COLOR -noperspective in vec4 finalColor; -#else -flat in vec4 finalColor; -#endif - -noperspective in vec2 stipple_pos; -flat in vec2 stipple_start; - -out vec4 fragColor; - -void main() -{ - fragColor = finalColor; - - /* Avoid passing viewport size */ - vec2 dd = fwidth(stipple_pos); - - float dist = distance(stipple_start, stipple_pos) / max(dd.x, dd.y); - - if (fract(dist / dashWidth) > 0.5) { - fragColor.rgb = vec3(0.0); - } - - fragColor = blender_srgb_to_framebuffer_space(fragColor); -} diff --git a/source/blender/gpu/shaders/gpu_shader_2D_edituvs_edges_vert.glsl b/source/blender/gpu/shaders/gpu_shader_2D_edituvs_edges_vert.glsl deleted file mode 100644 index 69fe5c93a61..00000000000 --- a/source/blender/gpu/shaders/gpu_shader_2D_edituvs_edges_vert.glsl +++ /dev/null @@ -1,38 +0,0 @@ - -uniform mat4 ModelViewProjectionMatrix; -uniform vec4 edgeColor; -uniform vec4 selectColor; - -in vec2 pos; -in int flag; - -#ifdef SMOOTH_COLOR -noperspective out vec4 finalColor; -#else -flat out vec4 finalColor; -#endif - -noperspective out vec2 stipple_pos; -flat out vec2 stipple_start; - -/* TODO: Port drawing to draw manager and - * remove constants duplications. */ -#define VERT_UV_SELECT (1 << 3) -#define EDGE_UV_SELECT (1 << 5) - -void main() -{ -#ifdef SMOOTH_COLOR - bool is_select = (flag & VERT_UV_SELECT) != 0; -#else - bool is_select = (flag & EDGE_UV_SELECT) != 0; -#endif - - gl_Position = ModelViewProjectionMatrix * vec4(pos, 0.0, 1.0); - gl_Position.z = float(!is_select); - - /* Avoid precision loss. */ - stipple_start = stipple_pos = 500.0 + 500.0 * (gl_Position.xy / gl_Position.w); - - finalColor = (is_select) ? selectColor : edgeColor; -} diff --git a/source/blender/gpu/shaders/gpu_shader_2D_edituvs_facedots_vert.glsl b/source/blender/gpu/shaders/gpu_shader_2D_edituvs_facedots_vert.glsl deleted file mode 100644 index 7a94fc088c4..00000000000 --- a/source/blender/gpu/shaders/gpu_shader_2D_edituvs_facedots_vert.glsl +++ /dev/null @@ -1,19 +0,0 @@ - -uniform mat4 ModelViewProjectionMatrix; -uniform vec4 vertColor; -uniform vec4 selectColor; - -in vec2 pos; -in int flag; - -out vec4 finalColor; - -/* TODO: Port drawing to draw manager and - * remove constants duplications. */ -#define FACE_UV_SELECT (1 << 7) - -void main() -{ - gl_Position = ModelViewProjectionMatrix * vec4(pos, 0.0, 1.0); - finalColor = ((flag & FACE_UV_SELECT) != 0) ? selectColor : vertColor; -} diff --git a/source/blender/gpu/shaders/gpu_shader_2D_edituvs_faces_vert.glsl b/source/blender/gpu/shaders/gpu_shader_2D_edituvs_faces_vert.glsl deleted file mode 100644 index 6fc41271cf5..00000000000 --- a/source/blender/gpu/shaders/gpu_shader_2D_edituvs_faces_vert.glsl +++ /dev/null @@ -1,26 +0,0 @@ - -uniform mat4 ModelViewProjectionMatrix; -uniform vec4 faceColor; -uniform vec4 selectColor; -uniform vec4 activeColor; - -in vec2 pos; -in int flag; - -flat out vec4 finalColor; - -/* TODO: Port drawing to draw manager and - * remove constants duplications. */ -#define FACE_UV_ACTIVE (1 << 6) -#define FACE_UV_SELECT (1 << 7) - -void main() -{ - gl_Position = ModelViewProjectionMatrix * vec4(pos, 0.0, 1.0); - - bool is_selected = (flag & FACE_UV_SELECT) != 0; - bool is_active = (flag & FACE_UV_ACTIVE) != 0; - - finalColor = (is_selected) ? selectColor : faceColor; - finalColor = (is_active) ? activeColor : finalColor; -} diff --git a/source/blender/gpu/shaders/gpu_shader_2D_edituvs_points_vert.glsl b/source/blender/gpu/shaders/gpu_shader_2D_edituvs_points_vert.glsl deleted file mode 100644 index bec565be1df..00000000000 --- a/source/blender/gpu/shaders/gpu_shader_2D_edituvs_points_vert.glsl +++ /dev/null @@ -1,44 +0,0 @@ - -uniform mat4 ModelViewProjectionMatrix; -uniform vec4 vertColor; -uniform vec4 selectColor; -uniform vec4 pinnedColor; -uniform float pointSize; -uniform float outlineWidth; - -in vec2 pos; -in int flag; - -out vec4 fillColor; -out vec4 outlineColor; -out vec4 radii; - -/* TODO: Port drawing to draw manager and - * remove constants duplications. */ -#define VERT_UV_SELECT (1 << 3) -#define VERT_UV_PINNED (1 << 4) - -void main() -{ - gl_Position = ModelViewProjectionMatrix * vec4(pos, 0.0, 1.0); - gl_PointSize = pointSize; - - bool is_selected = (flag & VERT_UV_SELECT) != 0; - bool is_pinned = (flag & VERT_UV_PINNED) != 0; - - vec4 deselect_col = (is_pinned) ? pinnedColor : vertColor; - fillColor = (is_selected) ? selectColor : deselect_col; - outlineColor = (is_pinned) ? pinnedColor : vec4(fillColor.rgb, 0.0); - - /* Calculate concentric radii in pixels. */ - float radius = 0.5 * pointSize; - - /* Start at the outside and progress toward the center. */ - radii[0] = radius; - radii[1] = radius - 1.0; - radii[2] = radius - outlineWidth; - radii[3] = radius - outlineWidth - 1.0; - - /* Convert to PointCoord units. */ - radii /= pointSize; -} diff --git a/source/blender/gpu/shaders/gpu_shader_2D_edituvs_stretch_vert.glsl b/source/blender/gpu/shaders/gpu_shader_2D_edituvs_stretch_vert.glsl deleted file mode 100644 index 3254a7e1508..00000000000 --- a/source/blender/gpu/shaders/gpu_shader_2D_edituvs_stretch_vert.glsl +++ /dev/null @@ -1,98 +0,0 @@ - -uniform mat4 ModelViewProjectionMatrix; -uniform vec2 aspect; - -in vec2 pos; - -#ifdef STRETCH_ANGLE -in vec2 uv_angles; -in float angle; - -#else -in float ratio; -uniform float totalAreaRatio; -uniform float totalAreaRatioInv; - -#endif - -noperspective out vec4 finalColor; - -vec3 weight_to_rgb(float weight) -{ - vec3 r_rgb; - float blend = ((weight / 2.0) + 0.5); - - if (weight <= 0.25) { /* blue->cyan */ - r_rgb[0] = 0.0; - r_rgb[1] = blend * weight * 4.0; - r_rgb[2] = blend; - } - else if (weight <= 0.50) { /* cyan->green */ - r_rgb[0] = 0.0; - r_rgb[1] = blend; - r_rgb[2] = blend * (1.0 - ((weight - 0.25) * 4.0)); - } - else if (weight <= 0.75) { /* green->yellow */ - r_rgb[0] = blend * ((weight - 0.50) * 4.0); - r_rgb[1] = blend; - r_rgb[2] = 0.0; - } - else if (weight <= 1.0) { /* yellow->red */ - r_rgb[0] = blend; - r_rgb[1] = blend * (1.0 - ((weight - 0.75) * 4.0)); - r_rgb[2] = 0.0; - } - else { - /* exceptional value, unclamped or nan, - * avoid uninitialized memory use */ - r_rgb[0] = 1.0; - r_rgb[1] = 0.0; - r_rgb[2] = 1.0; - } - - return r_rgb; -} - -#define M_PI 3.1415926535897932 - -vec2 angle_to_v2(float angle) -{ - return vec2(cos(angle), sin(angle)); -} - -/* Adapted from BLI_math_vector.h */ -float angle_normalized_v2v2(vec2 v1, vec2 v2) -{ - v1 = normalize(v1 * aspect); - v2 = normalize(v2 * aspect); - /* this is the same as acos(dot_v3v3(v1, v2)), but more accurate */ - bool q = (dot(v1, v2) >= 0.0); - vec2 v = (q) ? (v1 - v2) : (v1 + v2); - float a = 2.0 * asin(length(v) / 2.0); - return (q) ? a : M_PI - a; -} - -float area_ratio_to_stretch(float ratio, float tot_ratio, float inv_tot_ratio) -{ - ratio *= (ratio > 0.0f) ? tot_ratio : -inv_tot_ratio; - return (ratio > 1.0f) ? (1.0f / ratio) : ratio; -} - -void main() -{ - gl_Position = ModelViewProjectionMatrix * vec4(pos, 0.0, 1.0); - -#ifdef STRETCH_ANGLE - vec2 v1 = angle_to_v2(uv_angles.x * M_PI); - vec2 v2 = angle_to_v2(uv_angles.y * M_PI); - float uv_angle = angle_normalized_v2v2(v1, v2) / M_PI; - float stretch = 1.0 - abs(uv_angle - angle); - stretch = stretch; - stretch = 1.0 - stretch * stretch; -#else - float stretch = 1.0 - area_ratio_to_stretch(ratio, totalAreaRatio, totalAreaRatioInv); - -#endif - - finalColor = vec4(weight_to_rgb(stretch), 1.0); -} diff --git a/source/blender/gpu/shaders/gpu_shader_2D_point_uniform_size_varying_color_outline_aa_vert.glsl b/source/blender/gpu/shaders/gpu_shader_2D_point_uniform_size_varying_color_outline_aa_vert.glsl deleted file mode 100644 index 3eec271913a..00000000000 --- a/source/blender/gpu/shaders/gpu_shader_2D_point_uniform_size_varying_color_outline_aa_vert.glsl +++ /dev/null @@ -1,28 +0,0 @@ - -uniform mat4 ModelViewProjectionMatrix; -uniform float size; -uniform float outlineWidth; - -in vec2 pos; -in vec4 color; -out vec4 radii; -out vec4 fillColor; - -void main() -{ - gl_Position = ModelViewProjectionMatrix * vec4(pos, 0.0, 1.0); - gl_PointSize = size; - fillColor = color; - - /* Calculate concentric radii in pixels. */ - float radius = 0.5 * size; - - /* Start at the outside and progress toward the center. */ - radii[0] = radius; - radii[1] = radius - 1.0; - radii[2] = radius - outlineWidth; - radii[3] = radius - outlineWidth - 1.0; - - /* Convert to PointCoord units. */ - radii /= size; -} diff --git a/source/blender/gpu/shaders/gpu_shader_3D_point_uniform_size_outline_aa_vert.glsl b/source/blender/gpu/shaders/gpu_shader_3D_point_uniform_size_outline_aa_vert.glsl deleted file mode 100644 index fb5506a778d..00000000000 --- a/source/blender/gpu/shaders/gpu_shader_3D_point_uniform_size_outline_aa_vert.glsl +++ /dev/null @@ -1,33 +0,0 @@ - -uniform mat4 ModelViewProjectionMatrix; -#ifdef USE_WORLD_CLIP_PLANES -uniform mat4 ModelMatrix; -#endif -uniform float size; -uniform float outlineWidth; - -in vec3 pos; -out vec4 radii; - -void main() -{ - vec4 pos_4d = vec4(pos, 1.0); - gl_Position = ModelViewProjectionMatrix * pos_4d; - gl_PointSize = size; - - /* calculate concentric radii in pixels */ - float radius = 0.5 * size; - - /* start at the outside and progress toward the center */ - radii[0] = radius; - radii[1] = radius - 1.0; - radii[2] = radius - outlineWidth; - radii[3] = radius - outlineWidth - 1.0; - - /* convert to PointCoord units */ - radii /= size; - -#ifdef USE_WORLD_CLIP_PLANES - world_clip_planes_calc_clip_distance((ModelMatrix * pos_4d).xyz); -#endif -} diff --git a/source/blender/gpu/shaders/gpu_shader_3D_point_varying_size_vert.glsl b/source/blender/gpu/shaders/gpu_shader_3D_point_varying_size_vert.glsl deleted file mode 100644 index fc61be936fe..00000000000 --- a/source/blender/gpu/shaders/gpu_shader_3D_point_varying_size_vert.glsl +++ /dev/null @@ -1,11 +0,0 @@ - -uniform mat4 ModelViewProjectionMatrix; - -in vec3 pos; -in float size; - -void main() -{ - gl_Position = ModelViewProjectionMatrix * vec4(pos, 1.0); - gl_PointSize = size; -} diff --git a/source/blender/gpu/shaders/gpu_shader_point_uniform_color_frag.glsl b/source/blender/gpu/shaders/gpu_shader_point_uniform_color_frag.glsl deleted file mode 100644 index 692320bea93..00000000000 --- a/source/blender/gpu/shaders/gpu_shader_point_uniform_color_frag.glsl +++ /dev/null @@ -1,18 +0,0 @@ - -uniform vec4 color; - -out vec4 fragColor; - -void main() -{ - vec2 centered = gl_PointCoord - vec2(0.5); - float dist_squared = dot(centered, centered); - const float rad_squared = 0.25; - - // round point with jaggy edges - if (dist_squared > rad_squared) { - discard; - } - - fragColor = color; -} diff --git a/source/blender/gpu/shaders/gpu_shader_point_varying_color_outline_aa_frag.glsl b/source/blender/gpu/shaders/gpu_shader_point_varying_color_outline_aa_frag.glsl deleted file mode 100644 index 1d936e4e072..00000000000 --- a/source/blender/gpu/shaders/gpu_shader_point_varying_color_outline_aa_frag.glsl +++ /dev/null @@ -1,33 +0,0 @@ - -uniform vec4 outlineColor; - -in vec4 radii; -in vec4 fillColor; -out vec4 fragColor; - -void main() -{ - float dist = length(gl_PointCoord - vec2(0.5)); - - /* transparent outside of point - * --- 0 --- - * smooth transition - * --- 1 --- - * pure outline color - * --- 2 --- - * smooth transition - * --- 3 --- - * pure fill color - * ... - * dist = 0 at center of point */ - - float midStroke = 0.5 * (radii[1] + radii[2]); - - if (dist > midStroke) { - fragColor.rgb = outlineColor.rgb; - fragColor.a = mix(outlineColor.a, 0.0, smoothstep(radii[1], radii[0], dist)); - } - else { - fragColor = mix(fillColor, outlineColor, smoothstep(radii[3], radii[2], dist)); - } -} diff --git a/source/blender/gpu/tests/gpu_shader_builtin_test.cc b/source/blender/gpu/tests/gpu_shader_builtin_test.cc index 523a7e5b881..6d6a772f5fb 100644 --- a/source/blender/gpu/tests/gpu_shader_builtin_test.cc +++ b/source/blender/gpu/tests/gpu_shader_builtin_test.cc @@ -29,7 +29,6 @@ static void test_shader_builtin() test_compile_builtin_shader(GPU_SHADER_INSTANCE_VARIYING_COLOR_VARIYING_SIZE); test_compile_builtin_shader(GPU_SHADER_3D_LINE_DASHED_UNIFORM_COLOR); test_compile_builtin_shader(GPU_SHADER_3D_POINT_UNIFORM_SIZE_UNIFORM_COLOR_AA); - test_compile_builtin_shader(GPU_SHADER_3D_POINT_UNIFORM_SIZE_UNIFORM_COLOR_OUTLINE_AA); test_compile_builtin_shader(GPU_SHADER_TEXT, GPU_SHADER_CFG_DEFAULT); test_compile_builtin_shader(GPU_SHADER_KEYFRAME_SHAPE, GPU_SHADER_CFG_DEFAULT); @@ -53,40 +52,22 @@ static void test_shader_builtin() test_compile_builtin_shader(GPU_SHADER_2D_IMAGE_OVERLAYS_MERGE, GPU_SHADER_CFG_DEFAULT); test_compile_builtin_shader(GPU_SHADER_2D_IMAGE_OVERLAYS_STEREO_MERGE, GPU_SHADER_CFG_DEFAULT); test_compile_builtin_shader(GPU_SHADER_2D_IMAGE_SHUFFLE_COLOR, GPU_SHADER_CFG_DEFAULT); - test_compile_builtin_shader(GPU_SHADER_2D_POINT_FIXED_SIZE_UNIFORM_COLOR, - GPU_SHADER_CFG_DEFAULT); - test_compile_builtin_shader(GPU_SHADER_2D_POINT_UNIFORM_SIZE_VARYING_COLOR_OUTLINE_AA, - GPU_SHADER_CFG_DEFAULT); - test_compile_builtin_shader(GPU_SHADER_2D_POINT_VARYING_SIZE_VARYING_COLOR, - GPU_SHADER_CFG_DEFAULT); - test_compile_builtin_shader(GPU_SHADER_3D_POINT_FIXED_SIZE_UNIFORM_COLOR, - GPU_SHADER_CFG_DEFAULT); test_compile_builtin_shader(GPU_SHADER_2D_POINT_UNIFORM_SIZE_UNIFORM_COLOR_AA, GPU_SHADER_CFG_DEFAULT); test_compile_builtin_shader(GPU_SHADER_2D_POINT_UNIFORM_SIZE_UNIFORM_COLOR_OUTLINE_AA, GPU_SHADER_CFG_DEFAULT); test_compile_builtin_shader(GPU_SHADER_3D_POINT_FIXED_SIZE_VARYING_COLOR, GPU_SHADER_CFG_DEFAULT); - test_compile_builtin_shader(GPU_SHADER_3D_POINT_VARYING_SIZE_UNIFORM_COLOR, - GPU_SHADER_CFG_DEFAULT); test_compile_builtin_shader(GPU_SHADER_3D_POINT_VARYING_SIZE_VARYING_COLOR, GPU_SHADER_CFG_DEFAULT); test_compile_builtin_shader(GPU_SHADER_2D_LINE_DASHED_UNIFORM_COLOR, GPU_SHADER_CFG_DEFAULT); test_compile_builtin_shader(GPU_SHADER_GPENCIL_STROKE, GPU_SHADER_CFG_DEFAULT); - test_compile_builtin_shader(GPU_SHADER_2D_AREA_EDGES, GPU_SHADER_CFG_DEFAULT); + test_compile_builtin_shader(GPU_SHADER_2D_AREA_BORDERS, GPU_SHADER_CFG_DEFAULT); test_compile_builtin_shader(GPU_SHADER_2D_WIDGET_BASE, GPU_SHADER_CFG_DEFAULT); test_compile_builtin_shader(GPU_SHADER_2D_WIDGET_BASE_INST, GPU_SHADER_CFG_DEFAULT); test_compile_builtin_shader(GPU_SHADER_2D_WIDGET_SHADOW, GPU_SHADER_CFG_DEFAULT); test_compile_builtin_shader(GPU_SHADER_2D_NODELINK, GPU_SHADER_CFG_DEFAULT); test_compile_builtin_shader(GPU_SHADER_2D_NODELINK_INST, GPU_SHADER_CFG_DEFAULT); - test_compile_builtin_shader(GPU_SHADER_2D_UV_UNIFORM_COLOR, GPU_SHADER_CFG_DEFAULT); - test_compile_builtin_shader(GPU_SHADER_2D_UV_VERTS, GPU_SHADER_CFG_DEFAULT); - test_compile_builtin_shader(GPU_SHADER_2D_UV_FACEDOTS, GPU_SHADER_CFG_DEFAULT); - test_compile_builtin_shader(GPU_SHADER_2D_UV_EDGES, GPU_SHADER_CFG_DEFAULT); - test_compile_builtin_shader(GPU_SHADER_2D_UV_EDGES_SMOOTH, GPU_SHADER_CFG_DEFAULT); - test_compile_builtin_shader(GPU_SHADER_2D_UV_FACES, GPU_SHADER_CFG_DEFAULT); - test_compile_builtin_shader(GPU_SHADER_2D_UV_FACES_STRETCH_AREA, GPU_SHADER_CFG_DEFAULT); - test_compile_builtin_shader(GPU_SHADER_2D_UV_FACES_STRETCH_ANGLE, GPU_SHADER_CFG_DEFAULT); } GPU_TEST(shader_builtin) diff --git a/source/blender/imbuf/IMB_colormanagement.h b/source/blender/imbuf/IMB_colormanagement.h index 890c694d830..30f2f24447f 100644 --- a/source/blender/imbuf/IMB_colormanagement.h +++ b/source/blender/imbuf/IMB_colormanagement.h @@ -177,20 +177,20 @@ void IMB_colormanagement_colorspace_to_scene_linear(float *buffer, bool predivide); void IMB_colormanagement_imbuf_to_byte_texture(unsigned char *out_buffer, - const int x, - const int y, - const int width, - const int height, + int x, + int y, + int width, + int height, const struct ImBuf *ibuf, - const bool compress_as_srgb, - const bool store_premultiplied); + bool compress_as_srgb, + bool store_premultiplied); void IMB_colormanagement_imbuf_to_float_texture(float *out_buffer, - const int offset_x, - const int offset_y, - const int width, - const int height, + int offset_x, + int offset_y, + int width, + int height, const struct ImBuf *ibuf, - const bool store_premultiplied); + bool store_premultiplied); /** * Conversion between color picking role. Typically we would expect such a diff --git a/source/blender/imbuf/IMB_imbuf.h b/source/blender/imbuf/IMB_imbuf.h index 1f698c65382..c7481c6ea67 100644 --- a/source/blender/imbuf/IMB_imbuf.h +++ b/source/blender/imbuf/IMB_imbuf.h @@ -378,7 +378,7 @@ struct IndexBuildContext *IMB_anim_index_rebuild_context(struct anim *anim, IMB_Timecode_Type tcs_in_use, IMB_Proxy_Size proxy_sizes_in_use, int quality, - const bool overwrite, + bool overwrite, struct GSet *file_list); /** @@ -536,7 +536,7 @@ void IMB_scaleImBuf_threaded(struct ImBuf *ibuf, unsigned int newx, unsigned int * \attention Defined in writeimage.c */ bool IMB_saveiff(struct ImBuf *ibuf, const char *filepath, int flags); -bool IMB_prepare_write_ImBuf(const bool isfloat, struct ImBuf *ibuf); +bool IMB_prepare_write_ImBuf(bool isfloat, struct ImBuf *ibuf); /** * @@ -837,7 +837,7 @@ void IMB_rectfill_area(struct ImBuf *ibuf, */ void IMB_rectfill_area_replace( const struct ImBuf *ibuf, const float col[4], int x1, int y1, int x2, int y2); -void IMB_rectfill_alpha(struct ImBuf *ibuf, const float value); +void IMB_rectfill_alpha(struct ImBuf *ibuf, float value); /** * This should not be here, really, @@ -929,8 +929,8 @@ typedef enum eIMBTransformMode { */ void IMB_transform(const struct ImBuf *src, struct ImBuf *dst, - const eIMBTransformMode mode, - const eIMBInterpolationFilterMode filter, + eIMBTransformMode mode, + eIMBInterpolationFilterMode filter, const float transform_matrix[4][4], const struct rctf *src_crop); @@ -972,14 +972,14 @@ void IMB_update_gpu_texture_sub(struct GPUTexture *tex, /** * \attention defined in stereoimbuf.c */ -void IMB_stereo3d_write_dimensions(const char mode, - const bool is_squeezed, +void IMB_stereo3d_write_dimensions(char mode, + bool is_squeezed, const size_t width, const size_t height, size_t *r_width, size_t *r_height); -void IMB_stereo3d_read_dimensions(const char mode, - const bool is_squeezed, +void IMB_stereo3d_read_dimensions(char mode, + bool is_squeezed, const size_t width, const size_t height, size_t *r_width, diff --git a/source/blender/imbuf/intern/dds/FlipDXT.cpp b/source/blender/imbuf/intern/dds/FlipDXT.cpp index 359d6f30cdc..6686d56e9d1 100644 --- a/source/blender/imbuf/intern/dds/FlipDXT.cpp +++ b/source/blender/imbuf/intern/dds/FlipDXT.cpp @@ -168,9 +168,16 @@ static void FlipDXT5BlockHalf(uint8_t *block) FlipDXT1BlockHalf(block + 8); } -int FlipDXTCImage( - unsigned int width, unsigned int height, unsigned int levels, int fourcc, uint8_t *data) +int FlipDXTCImage(unsigned int width, + unsigned int height, + unsigned int levels, + int fourcc, + uint8_t *data, + int data_size, + unsigned int *r_num_valid_levels) { + *r_num_valid_levels = 0; + /* Must have valid dimensions. */ if (width == 0 || height == 0) { return 0; @@ -204,14 +211,25 @@ int FlipDXTCImage( return 0; } + *r_num_valid_levels = levels; + unsigned int mip_width = width; unsigned int mip_height = height; + const uint8_t *data_end = data + data_size; + for (unsigned int i = 0; i < levels; i++) { unsigned int blocks_per_row = (mip_width + 3) / 4; unsigned int blocks_per_col = (mip_height + 3) / 4; unsigned int blocks = blocks_per_row * blocks_per_col; + if (data + block_bytes * blocks > data_end) { + /* Stop flipping when running out of data to be modified, avoiding possible buffer overrun + * on a malformed files. */ + *r_num_valid_levels = i; + break; + } + if (mip_height == 1) { /* no flip to do, and we're done. */ break; diff --git a/source/blender/imbuf/intern/dds/FlipDXT.h b/source/blender/imbuf/intern/dds/FlipDXT.h index b4f71e4eca7..f9d3ce6112e 100644 --- a/source/blender/imbuf/intern/dds/FlipDXT.h +++ b/source/blender/imbuf/intern/dds/FlipDXT.h @@ -23,5 +23,10 @@ * * Use to flip vertically to fit OpenGL convention. */ -int FlipDXTCImage( - unsigned int width, unsigned int height, unsigned int levels, int fourcc, uint8_t *data); +int FlipDXTCImage(unsigned int width, + unsigned int height, + unsigned int levels, + int fourcc, + uint8_t *data, + int data_size, + unsigned int *r_num_valid_levels); diff --git a/source/blender/imbuf/intern/dds/Stream.cpp b/source/blender/imbuf/intern/dds/Stream.cpp index 3dab3c35675..31bf2076ed1 100644 --- a/source/blender/imbuf/intern/dds/Stream.cpp +++ b/source/blender/imbuf/intern/dds/Stream.cpp @@ -26,6 +26,21 @@ static const char *msg_error_seek = "DDS: trying to seek beyond end of stream (corrupt file?)"; static const char *msg_error_read = "DDS: trying to read beyond end of stream (corrupt file?)"; +inline bool is_read_within_bounds(const Stream &mem, unsigned int cnt) +{ + if (mem.pos >= mem.size) { + /* No more data remained in the memory buffer. */ + return false; + } + + if (cnt > mem.size - mem.pos) { + /* Reading past the memory bounds. */ + return false; + } + + return true; +} + unsigned int Stream::seek(unsigned int p) { if (p > size) { @@ -40,7 +55,7 @@ unsigned int Stream::seek(unsigned int p) unsigned int mem_read(Stream &mem, unsigned long long &i) { - if (mem.pos + 8 > mem.size) { + if (!is_read_within_bounds(mem, 8)) { mem.set_failed(msg_error_seek); return 0; } @@ -51,7 +66,7 @@ unsigned int mem_read(Stream &mem, unsigned long long &i) unsigned int mem_read(Stream &mem, unsigned int &i) { - if (mem.pos + 4 > mem.size) { + if (!is_read_within_bounds(mem, 4)) { mem.set_failed(msg_error_read); return 0; } @@ -62,7 +77,7 @@ unsigned int mem_read(Stream &mem, unsigned int &i) unsigned int mem_read(Stream &mem, unsigned short &i) { - if (mem.pos + 2 > mem.size) { + if (!is_read_within_bounds(mem, 2)) { mem.set_failed(msg_error_read); return 0; } @@ -73,7 +88,7 @@ unsigned int mem_read(Stream &mem, unsigned short &i) unsigned int mem_read(Stream &mem, unsigned char &i) { - if (mem.pos + 1 > mem.size) { + if (!is_read_within_bounds(mem, 1)) { mem.set_failed(msg_error_read); return 0; } @@ -84,7 +99,7 @@ unsigned int mem_read(Stream &mem, unsigned char &i) unsigned int mem_read(Stream &mem, unsigned char *i, unsigned int cnt) { - if (mem.pos + cnt > mem.size) { + if (!is_read_within_bounds(mem, cnt)) { mem.set_failed(msg_error_read); return 0; } diff --git a/source/blender/imbuf/intern/dds/dds_api.cpp b/source/blender/imbuf/intern/dds/dds_api.cpp index 1729a9a64f8..f576209ff62 100644 --- a/source/blender/imbuf/intern/dds/dds_api.cpp +++ b/source/blender/imbuf/intern/dds/dds_api.cpp @@ -186,8 +186,13 @@ struct ImBuf *imb_load_dds(const unsigned char *mem, /* flip compressed texture */ if (ibuf->dds_data.data) { - FlipDXTCImage( - dds.width(), dds.height(), dds.mipmapCount(), dds.fourCC(), ibuf->dds_data.data); + FlipDXTCImage(dds.width(), + dds.height(), + ibuf->dds_data.nummipmaps, + dds.fourCC(), + ibuf->dds_data.data, + ibuf->dds_data.size, + &ibuf->dds_data.nummipmaps); } } else { diff --git a/source/blender/imbuf/intern/openexr/openexr_multi.h b/source/blender/imbuf/intern/openexr/openexr_multi.h index 6694c32820b..0c3c4a4400f 100644 --- a/source/blender/imbuf/intern/openexr/openexr_multi.h +++ b/source/blender/imbuf/intern/openexr/openexr_multi.h @@ -60,7 +60,7 @@ void IMB_exr_add_channel(void *handle, * Read from file. */ bool IMB_exr_begin_read( - void *handle, const char *filename, int *width, int *height, const bool parse_channels); + void *handle, const char *filename, int *width, int *height, bool parse_channels); /** * Used for output files (from #RenderResult) (single and multi-layer, single and multi-view). */ diff --git a/source/blender/imbuf/intern/rotate.c b/source/blender/imbuf/intern/rotate.c index 83dc29aa107..f02f3e37d6a 100644 --- a/source/blender/imbuf/intern/rotate.c +++ b/source/blender/imbuf/intern/rotate.c @@ -32,7 +32,7 @@ void IMB_flipy(struct ImBuf *ibuf) { - int x, y; + size_t x_size, y_size; if (ibuf == NULL) { return; @@ -41,21 +41,23 @@ void IMB_flipy(struct ImBuf *ibuf) if (ibuf->rect) { unsigned int *top, *bottom, *line; - x = ibuf->x; - y = ibuf->y; + x_size = ibuf->x; + y_size = ibuf->y; + + const size_t stride = x_size * sizeof(int); top = ibuf->rect; - bottom = top + ((y - 1) * x); - line = MEM_mallocN(x * sizeof(int), "linebuf"); + bottom = top + ((y_size - 1) * x_size); + line = MEM_mallocN(stride, "linebuf"); - y >>= 1; + y_size >>= 1; - for (; y > 0; y--) { - memcpy(line, top, x * sizeof(int)); - memcpy(top, bottom, x * sizeof(int)); - memcpy(bottom, line, x * sizeof(int)); - bottom -= x; - top += x; + for (; y_size > 0; y_size--) { + memcpy(line, top, stride); + memcpy(top, bottom, stride); + memcpy(bottom, line, stride); + bottom -= x_size; + top += x_size; } MEM_freeN(line); @@ -64,21 +66,23 @@ void IMB_flipy(struct ImBuf *ibuf) if (ibuf->rect_float) { float *topf = NULL, *bottomf = NULL, *linef = NULL; - x = ibuf->x; - y = ibuf->y; + x_size = ibuf->x; + y_size = ibuf->y; + + const size_t stride = x_size * 4 * sizeof(float); topf = ibuf->rect_float; - bottomf = topf + 4 * ((y - 1) * x); - linef = MEM_mallocN(4 * x * sizeof(float), "linebuf"); + bottomf = topf + 4 * ((y_size - 1) * x_size); + linef = MEM_mallocN(stride, "linebuf"); - y >>= 1; + y_size >>= 1; - for (; y > 0; y--) { - memcpy(linef, topf, 4 * x * sizeof(float)); - memcpy(topf, bottomf, 4 * x * sizeof(float)); - memcpy(bottomf, linef, 4 * x * sizeof(float)); - bottomf -= 4 * x; - topf += 4 * x; + for (; y_size > 0; y_size--) { + memcpy(linef, topf, stride); + memcpy(topf, bottomf, stride); + memcpy(bottomf, linef, stride); + bottomf -= 4 * x_size; + topf += 4 * x_size; } MEM_freeN(linef); @@ -99,20 +103,22 @@ void IMB_flipx(struct ImBuf *ibuf) if (ibuf->rect) { for (yi = y - 1; yi >= 0; yi--) { + const size_t x_offset = (size_t)x * yi; for (xr = x - 1, xl = 0; xr >= xl; xr--, xl++) { - SWAP(unsigned int, ibuf->rect[(x * yi) + xr], ibuf->rect[(x * yi) + xl]); + SWAP(unsigned int, ibuf->rect[x_offset + xr], ibuf->rect[x_offset + xl]); } } } if (ibuf->rect_float) { for (yi = y - 1; yi >= 0; yi--) { + const size_t x_offset = (size_t)x * yi; for (xr = x - 1, xl = 0; xr >= xl; xr--, xl++) { - memcpy(&px_f, &ibuf->rect_float[((x * yi) + xr) * 4], sizeof(float[4])); - memcpy(&ibuf->rect_float[((x * yi) + xr) * 4], - &ibuf->rect_float[((x * yi) + xl) * 4], + memcpy(&px_f, &ibuf->rect_float[(x_offset + xr) * 4], sizeof(float[4])); + memcpy(&ibuf->rect_float[(x_offset + xr) * 4], + &ibuf->rect_float[(x_offset + xl) * 4], sizeof(float[4])); - memcpy(&ibuf->rect_float[((x * yi) + xl) * 4], &px_f, sizeof(float[4])); + memcpy(&ibuf->rect_float[(x_offset + xl) * 4], &px_f, sizeof(float[4])); } } } diff --git a/source/blender/io/alembic/intern/abc_customdata.cc b/source/blender/io/alembic/intern/abc_customdata.cc index 26203864cf8..c3ff64fd0ad 100644 --- a/source/blender/io/alembic/intern/abc_customdata.cc +++ b/source/blender/io/alembic/intern/abc_customdata.cc @@ -620,7 +620,7 @@ AbcUvScope get_uv_scope(const Alembic::AbcGeom::GeometryScope scope, /* kVaryingScope is sometimes used for vertex scopes as the values vary across the vertices. To * be sure, one has to check the size of the data against the number of vertices, as it could * also be a varying attribute across the faces (i.e. one value per face). */ - if ((scope == kVaryingScope || scope == kVertexScope) && indices->size() == config.totvert) { + if ((ELEM(scope, kVaryingScope, kVertexScope)) && indices->size() == config.totvert) { return ABC_UV_SCOPE_VERTEX; } diff --git a/source/blender/io/alembic/intern/abc_reader_mesh.cc b/source/blender/io/alembic/intern/abc_reader_mesh.cc index adf1a3e241c..83ca3399db5 100644 --- a/source/blender/io/alembic/intern/abc_reader_mesh.cc +++ b/source/blender/io/alembic/intern/abc_reader_mesh.cc @@ -463,13 +463,17 @@ static void read_velocity(const V3fArraySamplePtr &velocities, const CDStreamConfig &config, const float velocity_scale) { + const int num_velocity_vectors = static_cast<int>(velocities->size()); + if (num_velocity_vectors != config.mesh->totvert) { + /* Files containing videogrammetry data may be malformed and export velocity data on missing + * frames (most likely by copying the last valid data). */ + return; + } + CustomDataLayer *velocity_layer = BKE_id_attribute_new( &config.mesh->id, "velocity", CD_PROP_FLOAT3, ATTR_DOMAIN_POINT, nullptr); float(*velocity)[3] = (float(*)[3])velocity_layer->data; - const int num_velocity_vectors = static_cast<int>(velocities->size()); - BLI_assert(num_velocity_vectors == config.mesh->totvert); - for (int i = 0; i < num_velocity_vectors; i++) { const Imath::V3f &vel_in = (*velocities)[i]; copy_zup_from_yup(velocity[i], vel_in.getValue()); diff --git a/source/blender/io/alembic/intern/abc_util.h b/source/blender/io/alembic/intern/abc_util.h index 3a0b2852eea..672494e80db 100644 --- a/source/blender/io/alembic/intern/abc_util.h +++ b/source/blender/io/alembic/intern/abc_util.h @@ -51,7 +51,7 @@ Imath::M44d convert_matrix_datatype(float mat[4][4]); /* Convert from Alembic to float matrix representations. Does NOT convert from Y-up to Z-up. */ void convert_matrix_datatype(const Imath::M44d &xform, float r_mat[4][4]); -void split(const std::string &s, const char delim, std::vector<std::string> &tokens); +void split(const std::string &s, char delim, std::vector<std::string> &tokens); template<class TContainer> bool begins_with(const TContainer &input, const TContainer &match) { diff --git a/source/blender/io/collada/AnimationImporter.h b/source/blender/io/collada/AnimationImporter.h index a4624a18cd5..909a3017e66 100644 --- a/source/blender/io/collada/AnimationImporter.h +++ b/source/blender/io/collada/AnimationImporter.h @@ -211,7 +211,7 @@ class AnimationImporter : private TransformReader, public AnimationImporterBase */ void Assign_lens_animations(const COLLADAFW::UniqueId &listid, ListBase *AnimCurves, - const double aspect, + double aspect, Camera *cam, const char *anim_type, int fov_type); diff --git a/source/blender/io/collada/ArmatureImporter.h b/source/blender/io/collada/ArmatureImporter.h index ea78efeb5d7..fc0333b0ab1 100644 --- a/source/blender/io/collada/ArmatureImporter.h +++ b/source/blender/io/collada/ArmatureImporter.h @@ -120,7 +120,7 @@ class ArmatureImporter : private TransformReader { void fix_leaf_bone_hierarchy(bArmature *armature, Bone *bone, bool fix_orientation); void fix_leaf_bone(bArmature *armature, EditBone *ebone, BoneExtended *be, bool fix_orientation); void fix_parent_connect(bArmature *armature, Bone *bone); - void connect_bone_chains(bArmature *armature, Bone *bone, const int max_chain_length); + void connect_bone_chains(bArmature *armature, Bone *bone, int max_chain_length); void set_pose(Object *ob_arm, COLLADAFW::Node *root_node, diff --git a/source/blender/io/collada/BCAnimationCurve.h b/source/blender/io/collada/BCAnimationCurve.h index 36b2a5e8509..cf4cb4e0642 100644 --- a/source/blender/io/collada/BCAnimationCurve.h +++ b/source/blender/io/collada/BCAnimationCurve.h @@ -59,8 +59,8 @@ class BCCurveKey { BCCurveKey(); BCCurveKey(const BC_animation_type type, const std::string path, - const int array_index, - const int subindex = -1); + int array_index, + int subindex = -1); void operator=(const BCCurveKey &other); std::string get_full_path() const; std::string get_path() const; @@ -127,7 +127,7 @@ class BCAnimationCurve { FCurve *get_fcurve() const; int sample_count() const; - float get_value(const float frame); + float get_value(float frame); void get_values(BCValues &values) const; void get_value_map(BCValueMap &value_map); @@ -135,14 +135,14 @@ class BCAnimationCurve { /* Curve edit functions create a copy of the underlying #FCurve. */ FCurve *get_edit_fcurve(); - bool add_value_from_rna(const int frame); - bool add_value_from_matrix(const BCSample &sample, const int frame); - void add_value(const float val, const int frame); + bool add_value_from_rna(int frame); + bool add_value_from_matrix(const BCSample &sample, int frame); + void add_value(float val, int frame); void clean_handles(); /* experimental stuff */ - int closest_index_above(const float sample_frame, const int start_at) const; - int closest_index_below(const float sample_frame) const; + int closest_index_above(float sample_frame, int start_at) const; + int closest_index_below(float sample_frame) const; }; typedef std::map<BCCurveKey, BCAnimationCurve *> BCAnimationCurveMap; diff --git a/source/blender/io/collada/BCMath.h b/source/blender/io/collada/BCMath.h index 503a76541fd..dbcfe96bc61 100644 --- a/source/blender/io/collada/BCMath.h +++ b/source/blender/io/collada/BCMath.h @@ -82,25 +82,25 @@ class BCMatrix { * We need double here because the OpenCollada API needs it. * precision = -1 indicates to not limit the precision. */ - void get_matrix(DMatrix &matrix, const bool transposed = false, const int precision = -1) const; + void get_matrix(DMatrix &matrix, bool transposed = false, int precision = -1) const; void get_matrix(Matrix &matrix, - const bool transposed = false, - const int precision = -1, - const bool inverted = false) const; + bool transposed = false, + int precision = -1, + bool inverted = false) const; void set_transform(Object *ob); void set_transform(Matrix &mat); void add_transform(Matrix &to, const Matrix &transform, const Matrix &from, - const bool inverted = false); + bool inverted = false); void apply_transform(Matrix &to, const Matrix &transform, const Matrix &from, - const bool inverse = false); + bool inverse = false); void add_inverted_transform(Matrix &to, const Matrix &transform, const Matrix &from); - void add_transform(const Matrix &matrix, const bool inverted = false); - void add_transform(const BCMatrix &matrix, const bool inverted = false); - void apply_transform(const BCMatrix &matrix, const bool inverted = false); + void add_transform(const Matrix &matrix, bool inverted = false); + void add_transform(const BCMatrix &matrix, bool inverted = false); + void apply_transform(const BCMatrix &matrix, bool inverted = false); bool in_range(const BCMatrix &other, float distance) const; diff --git a/source/blender/io/collada/BCSampleData.h b/source/blender/io/collada/BCSampleData.h index dccc5228c4f..a76466a42f5 100644 --- a/source/blender/io/collada/BCSampleData.h +++ b/source/blender/io/collada/BCSampleData.h @@ -54,7 +54,7 @@ class BCSample { void add_bone_matrix(Bone *bone, Matrix &mat); /** Get channel value. */ - bool get_value(std::string channel_target, const int array_index, float *val) const; + bool get_value(std::string channel_target, int array_index, float *val) const; const BCMatrix &get_matrix() const; const BCMatrix *get_matrix(Bone *bone) const; /* returns NULL if bone is not animated */ }; diff --git a/source/blender/io/collada/collada_utils.h b/source/blender/io/collada/collada_utils.h index cf62ea0a275..e06f7b2cb8b 100644 --- a/source/blender/io/collada/collada_utils.h +++ b/source/blender/io/collada/collada_utils.h @@ -291,23 +291,23 @@ extern bool bc_has_animations(Object *ob); extern void bc_add_global_transform(Matrix &to_mat, const Matrix &from_mat, const BCMatrix &global_transform, - const bool invert = false); + bool invert = false); extern void bc_add_global_transform(Vector &to_vec, const Vector &from_vec, const BCMatrix &global_transform, - const bool invert = false); + bool invert = false); extern void bc_add_global_transform(Vector &to_vec, const BCMatrix &global_transform, - const bool invert = false); + bool invert = false); extern void bc_add_global_transform(Matrix &to_mat, const BCMatrix &global_transform, - const bool invert = false); + bool invert = false); extern void bc_apply_global_transform(Matrix &to_mat, const BCMatrix &global_transform, - const bool invert = false); + bool invert = false); extern void bc_apply_global_transform(Vector &to_vec, const BCMatrix &global_transform, - const bool invert = false); + bool invert = false); /** * Check if custom information about bind matrix exists and modify the from_mat * accordingly. @@ -382,7 +382,7 @@ class BoneExtended { void set_name(char *aName); char *get_name(); - void set_chain_length(const int aLength); + void set_chain_length(int aLength); int get_chain_length(); void set_leaf_bone(bool state); diff --git a/source/blender/io/common/IO_abstract_hierarchy_iterator.h b/source/blender/io/common/IO_abstract_hierarchy_iterator.h index 0bebc4384a9..e024b766c99 100644 --- a/source/blender/io/common/IO_abstract_hierarchy_iterator.h +++ b/source/blender/io/common/IO_abstract_hierarchy_iterator.h @@ -111,7 +111,7 @@ struct HierarchyContext { void mark_as_instance_of(const std::string &reference_export_path); void mark_as_not_instanced(); - bool is_object_visible(const enum eEvaluationMode evaluation_mode) const; + bool is_object_visible(enum eEvaluationMode evaluation_mode) const; }; /* Abstract writer for objects. Create concrete subclasses to write to USD, Alembic, etc. diff --git a/source/blender/io/gpencil/intern/gpencil_io_base.hh b/source/blender/io/gpencil/intern/gpencil_io_base.hh index 6437796648d..09557cd7a4d 100644 --- a/source/blender/io/gpencil/intern/gpencil_io_base.hh +++ b/source/blender/io/gpencil/intern/gpencil_io_base.hh @@ -49,7 +49,7 @@ class GpencilIO { public: GpencilIO(const GpencilIOParams *iparams); - void frame_number_set(const int value); + void frame_number_set(int value); void prepare_camera_params(Scene *scene, const GpencilIOParams *iparams); protected: diff --git a/source/blender/io/gpencil/intern/gpencil_io_export_pdf.hh b/source/blender/io/gpencil/intern/gpencil_io_export_pdf.hh index 18de321914c..5de22530fec 100644 --- a/source/blender/io/gpencil/intern/gpencil_io_export_pdf.hh +++ b/source/blender/io/gpencil/intern/gpencil_io_export_pdf.hh @@ -61,16 +61,13 @@ class GpencilExporterPDF : public GpencilExporter { * Export a stroke using poly-line or polygon * \param do_fill: True if the stroke is only fill */ - void export_stroke_to_polyline(bGPDlayer *gpl, - bGPDstroke *gps, - const bool is_stroke, - const bool do_fill, - const bool normalize); + void export_stroke_to_polyline( + bGPDlayer *gpl, bGPDstroke *gps, bool is_stroke, bool do_fill, bool normalize); /** * Set color. * \param do_fill: True if the stroke is only fill. */ - void color_set(bGPDlayer *gpl, const bool do_fill); + void color_set(bGPDlayer *gpl, bool do_fill); }; } // namespace blender::io::gpencil 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 b3175978072..8b88e9dc142 100644 --- a/source/blender/io/gpencil/intern/gpencil_io_export_svg.hh +++ b/source/blender/io/gpencil/intern/gpencil_io_export_svg.hh @@ -69,12 +69,8 @@ class GpencilExporterSVG : public GpencilExporter { * \param size: Size of the text * \param hexcolor: Color of the text */ - static void add_text(pugi::xml_node node, - float x, - float y, - std::string text, - const float size, - std::string hexcolor); + static void add_text( + pugi::xml_node node, float x, float y, std::string text, float size, std::string hexcolor); private: /** XML doc. */ @@ -96,7 +92,7 @@ class GpencilExporterSVG : public GpencilExporter { void export_stroke_to_path(struct bGPDlayer *gpl, struct bGPDstroke *gps, pugi::xml_node node_gpl, - const bool do_fill); + bool do_fill); /** * Export a stroke using poly-line or polygon @@ -106,8 +102,8 @@ class GpencilExporterSVG : public GpencilExporter { void export_stroke_to_polyline(struct bGPDlayer *gpl, struct bGPDstroke *gps, pugi::xml_node node_gpl, - const bool is_stroke, - const bool do_fill); + bool is_stroke, + bool do_fill); /** * Set color SVG string for stroke @@ -117,7 +113,7 @@ class GpencilExporterSVG : public GpencilExporter { void color_string_set(struct bGPDlayer *gpl, struct bGPDstroke *gps, pugi::xml_node node_gps, - const bool do_fill); + bool do_fill); /** Convert a color to Hex value (#FFFFFF). */ std::string rgb_to_hexstr(const float color[3]); diff --git a/source/blender/io/gpencil/intern/gpencil_io_import_base.hh b/source/blender/io/gpencil/intern/gpencil_io_import_base.hh index 7d6fad2340b..31ded8234c8 100644 --- a/source/blender/io/gpencil/intern/gpencil_io_import_base.hh +++ b/source/blender/io/gpencil/intern/gpencil_io_import_base.hh @@ -33,7 +33,7 @@ class GpencilImporter : public GpencilIO { protected: struct Object *create_object(); - int32_t create_material(const char *name, const bool stroke, const bool fill); + int32_t create_material(const char *name, bool stroke, bool fill); private: }; diff --git a/source/blender/io/gpencil/intern/gpencil_io_import_svg.hh b/source/blender/io/gpencil/intern/gpencil_io_import_svg.hh index 99e8b1ed4fd..24e80563a14 100644 --- a/source/blender/io/gpencil/intern/gpencil_io_import_svg.hh +++ b/source/blender/io/gpencil/intern/gpencil_io_import_svg.hh @@ -47,10 +47,10 @@ class GpencilImporterSVG : public GpencilImporter { struct bGPDframe *gpf, struct NSVGshape *shape, struct NSVGpath *path, - const int32_t mat_index, + int32_t mat_index, const float matrix[4][4]); - void convert_color(const int32_t color, float r_linear_rgba[4]); + void convert_color(int32_t color, float r_linear_rgba[4]); }; } // namespace blender::io::gpencil diff --git a/source/blender/io/wavefront_obj/exporter/obj_export_file_writer.hh b/source/blender/io/wavefront_obj/exporter/obj_export_file_writer.hh index c7ec7ec648f..3403d059068 100644 --- a/source/blender/io/wavefront_obj/exporter/obj_export_file_writer.hh +++ b/source/blender/io/wavefront_obj/exporter/obj_export_file_writer.hh @@ -91,22 +91,22 @@ class OBJWriter : NonMovable, NonCopyable { */ int write_smooth_group(const OBJMesh &obj_mesh_data, int poly_index, - const int last_poly_smooth_group) const; + int last_poly_smooth_group) const; /** * Write material name and material group of a polygon in the .OBJ file. * \return #mat_nr of the polygon at the given index. * \note It doesn't write to the material library. */ int16_t write_poly_material(const OBJMesh &obj_mesh_data, - const int poly_index, - const int16_t last_poly_mat_nr, + int poly_index, + int16_t last_poly_mat_nr, std::function<const char *(int)> matname_fn) const; /** * Write the name of the deform group of a polygon. */ int16_t write_vertex_group(const OBJMesh &obj_mesh_data, - const int poly_index, - const int16_t last_poly_vertex_group) const; + int poly_index, + int16_t last_poly_vertex_group) const; /** * Write polygon elements with at least vertex indices, and conditionally with UV vertex * indices and polygon normal indices. Also write groups: smooth, vertex, material. @@ -138,7 +138,7 @@ class OBJWriter : NonMovable, NonCopyable { /** * \return Writer function with appropriate polygon-element syntax. */ - func_vert_uv_normal_indices get_poly_element_writer(const int total_uv_vertices) const; + func_vert_uv_normal_indices get_poly_element_writer(int total_uv_vertices) const; /** * Write one line of polygon indices as "f v1/vt1/vn1 v2/vt2/vn2 ...". diff --git a/source/blender/io/wavefront_obj/exporter/obj_export_mesh.hh b/source/blender/io/wavefront_obj/exporter/obj_export_mesh.hh index 5d9c08a288e..9a4dfe3efe3 100644 --- a/source/blender/io/wavefront_obj/exporter/obj_export_mesh.hh +++ b/source/blender/io/wavefront_obj/exporter/obj_export_mesh.hh @@ -106,12 +106,12 @@ class OBJMesh : NonCopyable { /** * Return mat_nr-th material of the object. The given index should be zero-based. */ - const Material *get_object_material(const int16_t mat_nr) const; + const Material *get_object_material(int16_t mat_nr) const; /** * Returns a zero-based index of a polygon's material indexing into * the Object's material slots. */ - int16_t ith_poly_matnr(const int poly_index) const; + int16_t ith_poly_matnr(int poly_index) const; void ensure_mesh_normals() const; void ensure_mesh_edges() const; @@ -120,12 +120,12 @@ class OBJMesh : NonCopyable { * Calculate smooth groups of a smooth-shaded object. * \return A polygon aligned array of smooth group numbers. */ - void calc_smooth_groups(const bool use_bitflags); + void calc_smooth_groups(bool use_bitflags); /** * \return Smooth group of the polygon at the given index. */ - int ith_smooth_group(const int poly_index) const; - bool is_ith_poly_smooth(const int poly_index) const; + int ith_smooth_group(int poly_index) const; + bool is_ith_poly_smooth(int poly_index) const; /** * Get object name as it appears in the outliner. @@ -138,42 +138,42 @@ class OBJMesh : NonCopyable { /** * Get object's material (at the given index) name. The given index should be zero-based. */ - const char *get_object_material_name(const int16_t mat_nr) const; + const char *get_object_material_name(int16_t mat_nr) const; /** * Calculate coordinates of the vertex at the given index. */ - float3 calc_vertex_coords(const int vert_index, const float scaling_factor) const; + float3 calc_vertex_coords(int vert_index, float scaling_factor) const; /** * Calculate vertex indices of all vertices of the polygon at the given index. */ - Vector<int> calc_poly_vertex_indices(const int poly_index) const; + Vector<int> calc_poly_vertex_indices(int poly_index) const; /** * Calculate UV vertex coordinates of an Object. * * \note Also store the UV vertex indices in the member variable. */ void store_uv_coords_and_indices(Vector<std::array<float, 2>> &r_uv_coords); - Span<int> calc_poly_uv_indices(const int poly_index) const; + Span<int> calc_poly_uv_indices(int poly_index) const; /** * Calculate polygon normal of a polygon at given index. * * Should be used for flat-shaded polygons. */ - float3 calc_poly_normal(const int poly_index) const; + float3 calc_poly_normal(int poly_index) const; /** * Calculate a polygon's polygon/loop normal indices. * \param object_tot_prev_normals Number of normals of this Object written so far. * \return Number of distinct normal indices. */ - std::pair<int, Vector<int>> calc_poly_normal_indices(const int poly_index, - const int object_tot_prev_normals) const; + std::pair<int, Vector<int>> calc_poly_normal_indices(int poly_index, + int object_tot_prev_normals) const; /** * Calculate loop normals of a polygon at the given index. * * Should be used for smooth-shaded polygons. */ - void calc_loop_normals(const int poly_index, Vector<float3> &r_loop_normals) const; + void calc_loop_normals(int poly_index, Vector<float3> &r_loop_normals) const; /** * Find the index of the vertex group with the maximum number of vertices in a polygon. * The index indices into the #Object.defbase. @@ -181,17 +181,17 @@ class OBJMesh : NonCopyable { * If two or more groups have the same number of vertices (maximum), group name depends on the * implementation of #std::max_element. */ - int16_t get_poly_deform_group_index(const int poly_index) const; + int16_t get_poly_deform_group_index(int poly_index) const; /** * Find the name of the vertex deform group at the given index. * The index indices into the #Object.defbase. */ - const char *get_poly_deform_group_name(const int16_t def_group_index) const; + const char *get_poly_deform_group_name(int16_t def_group_index) const; /** * Calculate vertex indices of an edge's corners if it is a loose edge. */ - std::optional<std::array<int, 2>> calc_loose_edge_vert_indices(const int edge_index) const; + std::optional<std::array<int, 2>> calc_loose_edge_vert_indices(int edge_index) const; private: /** @@ -208,6 +208,6 @@ class OBJMesh : NonCopyable { /** * Set the final transform after applying axes settings and an Object's world transform. */ - void set_world_axes_transform(const eTransformAxisForward forward, const eTransformAxisUp up); + void set_world_axes_transform(eTransformAxisForward forward, eTransformAxisUp up); }; } // namespace blender::io::obj diff --git a/source/blender/io/wavefront_obj/exporter/obj_export_nurbs.hh b/source/blender/io/wavefront_obj/exporter/obj_export_nurbs.hh index fe457f3c1c7..0c71c3cc09d 100644 --- a/source/blender/io/wavefront_obj/exporter/obj_export_nurbs.hh +++ b/source/blender/io/wavefront_obj/exporter/obj_export_nurbs.hh @@ -47,28 +47,26 @@ class OBJCurve : NonCopyable { * \param spline_index: Zero-based index of spline of interest. * \return: Total vertices in a spline. */ - int total_spline_vertices(const int spline_index) const; + int total_spline_vertices(int spline_index) const; /** * Get coordinates of the vertex at the given index on the given spline. */ - float3 vertex_coordinates(const int spline_index, - const int vertex_index, - const float scaling_factor) const; + float3 vertex_coordinates(int spline_index, int vertex_index, float scaling_factor) const; /** * Get total control points of the NURBS spline at the given index. This is different than total * vertices of a spline. */ - int total_spline_control_points(const int spline_index) const; + int total_spline_control_points(int spline_index) const; /** * Get the degree of the NURBS spline at the given index. */ - int get_nurbs_degree(const int spline_index) const; + int get_nurbs_degree(int spline_index) const; private: /** * Set the final transform after applying axes settings and an Object's world transform. */ - void set_world_axes_transform(const eTransformAxisForward forward, const eTransformAxisUp up); + void set_world_axes_transform(eTransformAxisForward forward, eTransformAxisUp up); }; } // namespace blender::io::obj diff --git a/source/blender/io/wavefront_obj/exporter/obj_exporter.hh b/source/blender/io/wavefront_obj/exporter/obj_exporter.hh index 1a193bf437f..a06898a21cf 100644 --- a/source/blender/io/wavefront_obj/exporter/obj_exporter.hh +++ b/source/blender/io/wavefront_obj/exporter/obj_exporter.hh @@ -38,7 +38,7 @@ class OBJDepsgraph : NonMovable, NonCopyable { bool needs_free_ = false; public: - OBJDepsgraph(const bContext *C, const eEvaluationMode eval_mode); + OBJDepsgraph(const bContext *C, eEvaluationMode eval_mode); ~OBJDepsgraph(); Depsgraph *get(); @@ -97,5 +97,5 @@ filter_supported_objects(Depsgraph *depsgraph, const OBJExportParams &export_par * * \return Whether the filepath is in #FILE_MAX limits. */ -bool append_frame_to_filename(const char *filepath, const int frame, char *r_filepath_with_frames); +bool append_frame_to_filename(const char *filepath, int frame, char *r_filepath_with_frames); } // namespace blender::io::obj diff --git a/source/blender/makesdna/DNA_ID.h b/source/blender/makesdna/DNA_ID.h index 9fdf7be04e2..a70befc155b 100644 --- a/source/blender/makesdna/DNA_ID.h +++ b/source/blender/makesdna/DNA_ID.h @@ -445,12 +445,21 @@ typedef struct Library { struct PackedFile *packedfile; + ushort tag; + char _pad_0[6]; + /* Temp data needed by read/write code, and liboverride recursive resync. */ int temp_index; /** See BLENDER_FILE_VERSION, BLENDER_FILE_SUBVERSION, needed for do_versions. */ short versionfile, subversionfile; } Library; +/* Library.tag */ +enum eLibrary_Tag { + /* Automatic recursive resync was needed when linking/loading data from that library. */ + LIBRARY_TAG_RESYNC_REQUIRED = 1 << 0, +}; + /** * A weak library/ID reference for local data that has been appended, to allow re-using that local * data instead of creating a new copy of it in future appends. diff --git a/source/blender/makesdna/DNA_genfile.h b/source/blender/makesdna/DNA_genfile.h index 5e0cff9fd83..dd118658003 100644 --- a/source/blender/makesdna/DNA_genfile.h +++ b/source/blender/makesdna/DNA_genfile.h @@ -87,7 +87,7 @@ enum eSDNA_StructCompare { * Constructs and returns a decoded SDNA structure from the given encoded SDNA data block. */ struct SDNA *DNA_sdna_from_data(const void *data, - const int data_len, + int data_len, bool do_endian_swap, bool data_alloc, const char **r_error_message); @@ -163,7 +163,7 @@ bool DNA_struct_elem_find(const struct SDNA *sdna, /** * Returns the size in bytes of a primitive type. */ -int DNA_elem_type_size(const eSDNA_Type elem_nr); +int DNA_elem_type_size(eSDNA_Type elem_nr); /** * Rename a struct diff --git a/source/blender/makesdna/DNA_node_types.h b/source/blender/makesdna/DNA_node_types.h index 16900b7e8b0..6cb1683ff15 100644 --- a/source/blender/makesdna/DNA_node_types.h +++ b/source/blender/makesdna/DNA_node_types.h @@ -923,6 +923,11 @@ typedef struct NodeColorspill { float uspillr, uspillg, uspillb; } NodeColorspill; +typedef struct NodeConvertColorSpace { + char from_color_space[64]; + char to_color_space[64]; +} NodeConvertColorSpace; + typedef struct NodeDilateErode { char falloff; } NodeDilateErode; diff --git a/source/blender/makesdna/DNA_userdef_types.h b/source/blender/makesdna/DNA_userdef_types.h index 34415308ef6..a1a4f9381a3 100644 --- a/source/blender/makesdna/DNA_userdef_types.h +++ b/source/blender/makesdna/DNA_userdef_types.h @@ -55,17 +55,16 @@ typedef enum eUIFont_ID { * Default fonts to load/initialize. * First font is the default (index 0), others optional. */ +# +# typedef struct uiFont { struct uiFont *next, *prev; /** 1024 = FILE_MAX. */ - char filename[1024]; + char filepath[1024]; /** From blfont lib. */ short blf_id; /** Own id (eUIFont_ID). */ short uifont_id; - /** Fonts that read from left to right. */ - short r_to_l; - char _pad0[2]; } uiFont; /** This state defines appearance of text. */ diff --git a/source/blender/makesdna/DNA_view3d_defaults.h b/source/blender/makesdna/DNA_view3d_defaults.h index c4d0c83b346..870197a401c 100644 --- a/source/blender/makesdna/DNA_view3d_defaults.h +++ b/source/blender/makesdna/DNA_view3d_defaults.h @@ -53,6 +53,7 @@ .wireframe_threshold = 1.0f, \ .wireframe_opacity = 1.0f, \ .xray_alpha_bone = 0.5f, \ + .bone_wire_alpha = 1.0f, \ .fade_alpha = 0.40f, \ .texture_paint_mode_opacity = 1.0f, \ .weight_paint_mode_opacity = 1.0f, \ diff --git a/source/blender/makesdna/DNA_view3d_types.h b/source/blender/makesdna/DNA_view3d_types.h index ae95f58d4f0..2ec58181394 100644 --- a/source/blender/makesdna/DNA_view3d_types.h +++ b/source/blender/makesdna/DNA_view3d_types.h @@ -224,6 +224,8 @@ typedef struct View3DOverlay { /** Armature edit/pose mode settings. */ float xray_alpha_bone; + float bone_wire_alpha; + char _pad1[4]; /** Darken Inactive. */ float fade_alpha; diff --git a/source/blender/makesdna/intern/dna_utils.h b/source/blender/makesdna/intern/dna_utils.h index 7ba71fb970b..e161e317c42 100644 --- a/source/blender/makesdna/intern/dna_utils.h +++ b/source/blender/makesdna/intern/dna_utils.h @@ -45,7 +45,7 @@ uint DNA_elem_id_strip(char *elem); * return true if it does, with start/end offsets. */ bool DNA_elem_id_match(const char *elem_search, - const int elem_search_len, + int elem_search_len, const char *elem_full, uint *r_elem_full_offset); /** @@ -53,12 +53,12 @@ bool DNA_elem_id_match(const char *elem_search, */ char *DNA_elem_id_rename(struct MemArena *mem_arena, const char *elem_src, - const int elem_src_len, + int elem_src_len, const char *elem_dst, - const int elem_dst_len, + int elem_dst_len, const char *elem_src_full, - const int elem_src_full_len, - const uint elem_src_full_offset_len); + int elem_src_full_len, + uint elem_src_full_offset_len); /** * When requesting version info, support both directions. diff --git a/source/blender/makesrna/RNA_access.h b/source/blender/makesrna/RNA_access.h index 7fa7405add1..20f77626e49 100644 --- a/source/blender/makesrna/RNA_access.h +++ b/source/blender/makesrna/RNA_access.h @@ -137,6 +137,7 @@ extern StructRNA RNA_CompositorNodeChannelMatte; extern StructRNA RNA_CompositorNodeChromaMatte; extern StructRNA RNA_CompositorNodeColorMatte; extern StructRNA RNA_CompositorNodeColorSpill; +extern StructRNA RNA_CompositorNodeConvertColorSpace; extern StructRNA RNA_CompositorNodeCombHSVA; extern StructRNA RNA_CompositorNodeCombRGBA; extern StructRNA RNA_CompositorNodeCombYCCA; @@ -777,7 +778,7 @@ bool RNA_pointer_is_null(const PointerRNA *ptr); bool RNA_path_resolved_create(PointerRNA *ptr, struct PropertyRNA *prop, - const int prop_index, + int prop_index, PathResolvedRNA *r_anim_rna); void RNA_blender_rna_pointer_create(PointerRNA *r_ptr); @@ -937,13 +938,11 @@ void RNA_property_float_ui_range(PointerRNA *ptr, int RNA_property_float_clamp(PointerRNA *ptr, PropertyRNA *prop, float *value); int RNA_property_int_clamp(PointerRNA *ptr, PropertyRNA *prop, int *value); -bool RNA_enum_identifier(const EnumPropertyItem *item, const int value, const char **identifier); -int RNA_enum_bitflag_identifiers(const EnumPropertyItem *item, - const int value, - const char **identifier); -bool RNA_enum_name(const EnumPropertyItem *item, const int value, const char **r_name); -bool RNA_enum_description(const EnumPropertyItem *item, const int value, const char **description); -int RNA_enum_from_value(const EnumPropertyItem *item, const int value); +bool RNA_enum_identifier(const EnumPropertyItem *item, int value, const char **identifier); +int RNA_enum_bitflag_identifiers(const EnumPropertyItem *item, int value, const char **identifier); +bool RNA_enum_name(const EnumPropertyItem *item, int value, const char **r_name); +bool RNA_enum_description(const EnumPropertyItem *item, int value, const char **description); +int RNA_enum_from_value(const EnumPropertyItem *item, int value); int RNA_enum_from_identifier(const EnumPropertyItem *item, const char *identifier); /** * Take care using this with translated enums, @@ -955,7 +954,7 @@ unsigned int RNA_enum_items_count(const EnumPropertyItem *item); void RNA_property_enum_items_ex(struct bContext *C, PointerRNA *ptr, PropertyRNA *prop, - const bool use_static, + bool use_static, const EnumPropertyItem **r_item, int *r_totitem, bool *r_free); @@ -979,32 +978,20 @@ void RNA_property_enum_items_gettexted_all(struct bContext *C, bool *r_free); bool RNA_property_enum_value( struct bContext *C, PointerRNA *ptr, PropertyRNA *prop, const char *identifier, int *r_value); -bool RNA_property_enum_identifier(struct bContext *C, - PointerRNA *ptr, - PropertyRNA *prop, - const int value, - const char **identifier); +bool RNA_property_enum_identifier( + struct bContext *C, PointerRNA *ptr, PropertyRNA *prop, int value, const char **identifier); bool RNA_property_enum_name( - struct bContext *C, PointerRNA *ptr, PropertyRNA *prop, const int value, const char **name); + struct bContext *C, PointerRNA *ptr, PropertyRNA *prop, int value, const char **name); bool RNA_property_enum_name_gettexted( - struct bContext *C, PointerRNA *ptr, PropertyRNA *prop, const int value, const char **name); + struct bContext *C, PointerRNA *ptr, PropertyRNA *prop, int value, const char **name); -bool RNA_property_enum_item_from_value(struct bContext *C, - PointerRNA *ptr, - PropertyRNA *prop, - const int value, - EnumPropertyItem *r_item); -bool RNA_property_enum_item_from_value_gettexted(struct bContext *C, - PointerRNA *ptr, - PropertyRNA *prop, - const int value, - EnumPropertyItem *r_item); - -int RNA_property_enum_bitflag_identifiers(struct bContext *C, - PointerRNA *ptr, - PropertyRNA *prop, - const int value, - const char **identifier); +bool RNA_property_enum_item_from_value( + struct bContext *C, PointerRNA *ptr, PropertyRNA *prop, int value, EnumPropertyItem *r_item); +bool RNA_property_enum_item_from_value_gettexted( + struct bContext *C, PointerRNA *ptr, PropertyRNA *prop, int value, EnumPropertyItem *r_item); + +int RNA_property_enum_bitflag_identifiers( + struct bContext *C, PointerRNA *ptr, PropertyRNA *prop, int value, const char **identifier); StructRNA *RNA_property_pointer_type(PointerRNA *ptr, PropertyRNA *prop); bool RNA_property_pointer_poll(PointerRNA *ptr, PropertyRNA *prop, PointerRNA *value); @@ -1035,9 +1022,7 @@ bool RNA_property_overridable_get(PointerRNA *ptr, PropertyRNA *prop); /** * Should only be used for custom properties. */ -bool RNA_property_overridable_library_set(PointerRNA *ptr, - PropertyRNA *prop, - const bool is_overridable); +bool RNA_property_overridable_library_set(PointerRNA *ptr, PropertyRNA *prop, bool is_overridable); bool RNA_property_overridden(PointerRNA *ptr, PropertyRNA *prop); bool RNA_property_comparable(PointerRNA *ptr, PropertyRNA *prop); /** @@ -1156,7 +1141,7 @@ int RNA_property_collection_lookup_string_index( */ int RNA_property_collection_assign_int(PointerRNA *ptr, PropertyRNA *prop, - const int key, + int key, const PointerRNA *assign_ptr); bool RNA_property_collection_type_get(PointerRNA *ptr, PropertyRNA *prop, PointerRNA *r_ptr); @@ -1557,22 +1542,19 @@ char *RNA_pointer_as_string(struct bContext *C, */ char *RNA_pointer_as_string_keywords_ex(struct bContext *C, PointerRNA *ptr, - const bool as_function, - const bool all_args, - const bool nested_args, - const int max_prop_length, + bool as_function, + bool all_args, + bool nested_args, + int max_prop_length, PropertyRNA *iterprop); char *RNA_pointer_as_string_keywords(struct bContext *C, PointerRNA *ptr, - const bool as_function, - const bool all_args, - const bool nested_args, - const int max_prop_length); -char *RNA_function_as_string_keywords(struct bContext *C, - FunctionRNA *func, - const bool as_function, - const bool all_args, - const int max_prop_length); + bool as_function, + bool all_args, + bool nested_args, + int max_prop_length); +char *RNA_function_as_string_keywords( + struct bContext *C, FunctionRNA *func, bool as_function, bool all_args, int max_prop_length); /* Function */ @@ -1762,7 +1744,7 @@ bool RNA_struct_override_matches(struct Main *bmain, const char *root_path, const size_t root_path_len, struct IDOverrideLibrary *override, - const eRNAOverrideMatch flags, + eRNAOverrideMatch flags, eRNAOverrideMatchResult *r_report_flags); /** @@ -1793,7 +1775,7 @@ void RNA_struct_override_apply(struct Main *bmain, struct PointerRNA *ptr_src, struct PointerRNA *ptr_storage, struct IDOverrideLibrary *override, - const eRNAOverrideApplyFlag flag); + eRNAOverrideApplyFlag flag); struct IDOverrideLibraryProperty *RNA_property_override_property_find(struct Main *bmain, PointerRNA *ptr, @@ -1808,23 +1790,23 @@ struct IDOverrideLibraryPropertyOperation *RNA_property_override_property_operat struct Main *bmain, PointerRNA *ptr, PropertyRNA *prop, - const int index, - const bool strict, + int index, + bool strict, bool *r_strict); struct IDOverrideLibraryPropertyOperation *RNA_property_override_property_operation_get( struct Main *bmain, PointerRNA *ptr, PropertyRNA *prop, - const short operation, - const int index, - const bool strict, + short operation, + int index, + bool strict, bool *r_strict, bool *r_created); eRNAOverrideStatus RNA_property_override_library_status(struct Main *bmainm, PointerRNA *ptr, PropertyRNA *prop, - const int index); + int index); void RNA_struct_state_owner_set(const char *name); const char *RNA_struct_state_owner_get(void); diff --git a/source/blender/makesrna/RNA_define.h b/source/blender/makesrna/RNA_define.h index 3596a5f2234..ca534316c39 100644 --- a/source/blender/makesrna/RNA_define.h +++ b/source/blender/makesrna/RNA_define.h @@ -53,7 +53,7 @@ void RNA_define_fallback_property_update(int noteflag, const char *updatefunc); * Properties defined when this is enabled are lib-overridable by default * (except for Pointer ones). */ -void RNA_define_lib_overridable(const bool make_overridable); +void RNA_define_lib_overridable(bool make_overridable); void RNA_init(void); void RNA_exit(void); diff --git a/source/blender/makesrna/intern/rna_access_compare_override.c b/source/blender/makesrna/intern/rna_access_compare_override.c index e59938d7ea3..950eccdb552 100644 --- a/source/blender/makesrna/intern/rna_access_compare_override.c +++ b/source/blender/makesrna/intern/rna_access_compare_override.c @@ -1127,6 +1127,9 @@ static void rna_property_override_check_resync(Main *bmain, * self-references updated to itself, instead of still pointing to its linked source. */ (id_dst->lib == id_src->lib && id_dst != id_owner_dst))) { id_owner_dst->tag |= LIB_TAG_LIB_OVERRIDE_NEED_RESYNC; + if (ID_IS_LINKED(id_owner_src)) { + id_owner_src->lib->tag |= LIBRARY_TAG_RESYNC_REQUIRED; + } CLOG_INFO(&LOG, 3, "Local override %s detected as needing resync", id_owner_dst->name); } } diff --git a/source/blender/makesrna/intern/rna_internal.h b/source/blender/makesrna/intern/rna_internal.h index c1989a5b10d..20e6e931b4b 100644 --- a/source/blender/makesrna/intern/rna_internal.h +++ b/source/blender/makesrna/intern/rna_internal.h @@ -240,9 +240,9 @@ bool rna_AnimaData_override_apply(struct Main *bmain, struct PropertyRNA *prop_local, struct PropertyRNA *prop_reference, struct PropertyRNA *prop_storage, - const int len_local, - const int len_reference, - const int len_storage, + int len_local, + int len_reference, + int len_storage, struct PointerRNA *ptr_item_local, struct PointerRNA *ptr_item_reference, struct PointerRNA *ptr_item_storage, @@ -268,7 +268,7 @@ void rna_def_mtex_common(struct BlenderRNA *brna, const char *update, const char *update_index); void rna_def_texpaint_slots(struct BlenderRNA *brna, struct StructRNA *srna); -void rna_def_view_layer_common(struct BlenderRNA *brna, struct StructRNA *srna, const bool scene); +void rna_def_view_layer_common(struct BlenderRNA *brna, struct StructRNA *srna, bool scene); int rna_AssetMetaData_editable(struct PointerRNA *ptr, const char **r_info); /** @@ -446,7 +446,7 @@ void RNA_api_space_text(struct StructRNA *srna); void RNA_api_space_filebrowser(struct StructRNA *srna); void RNA_api_region_view3d(struct StructRNA *srna); void RNA_api_texture(struct StructRNA *srna); -void RNA_api_sequences(BlenderRNA *brna, PropertyRNA *cprop, const bool metastrip); +void RNA_api_sequences(BlenderRNA *brna, PropertyRNA *cprop, bool metastrip); void RNA_api_sequence_elements(BlenderRNA *brna, PropertyRNA *cprop); void RNA_api_sound(struct StructRNA *srna); void RNA_api_vfont(struct StructRNA *srna); @@ -541,11 +541,11 @@ struct PropertyRNA *rna_ensure_property(struct PropertyRNA *prop) ATTR_WARN_UNUS int rna_property_override_diff_default(struct Main *bmain, struct PropertyRNAOrID *prop_a, struct PropertyRNAOrID *prop_b, - const int mode, + int mode, struct IDOverrideLibrary *override, const char *rna_path, const size_t rna_path_len, - const int flags, + int flags, bool *r_override_changed); bool rna_property_override_store_default(struct Main *bmain, @@ -555,9 +555,9 @@ bool rna_property_override_store_default(struct Main *bmain, struct PropertyRNA *prop_local, struct PropertyRNA *prop_reference, struct PropertyRNA *prop_storage, - const int len_local, - const int len_reference, - const int len_storage, + int len_local, + int len_reference, + int len_storage, struct IDOverrideLibraryPropertyOperation *opop); bool rna_property_override_apply_default(struct Main *bmain, @@ -567,9 +567,9 @@ bool rna_property_override_apply_default(struct Main *bmain, struct PropertyRNA *prop_dst, struct PropertyRNA *prop_src, struct PropertyRNA *prop_storage, - const int len_dst, - const int len_src, - const int len_storage, + int len_dst, + int len_src, + int len_storage, struct PointerRNA *ptr_item_dst, struct PointerRNA *ptr_item_src, struct PointerRNA *ptr_item_storage, diff --git a/source/blender/makesrna/intern/rna_internal_types.h b/source/blender/makesrna/intern/rna_internal_types.h index 29df7a53c44..f0e32a19d04 100644 --- a/source/blender/makesrna/intern/rna_internal_types.h +++ b/source/blender/makesrna/intern/rna_internal_types.h @@ -211,11 +211,11 @@ typedef struct PropertyRNAOrID { typedef int (*RNAPropOverrideDiff)(struct Main *bmain, struct PropertyRNAOrID *prop_a, struct PropertyRNAOrID *prop_b, - const int mode, + int mode, struct IDOverrideLibrary *override, const char *rna_path, const size_t rna_path_len, - const int flags, + int flags, bool *r_override_changed); /** @@ -235,9 +235,9 @@ typedef bool (*RNAPropOverrideStore)(struct Main *bmain, struct PropertyRNA *prop_local, struct PropertyRNA *prop_reference, struct PropertyRNA *prop_storage, - const int len_local, - const int len_reference, - const int len_storage, + int len_local, + int len_reference, + int len_storage, struct IDOverrideLibraryPropertyOperation *opop); /** @@ -254,9 +254,9 @@ typedef bool (*RNAPropOverrideApply)(struct Main *bmain, struct PropertyRNA *prop_dst, struct PropertyRNA *prop_src, struct PropertyRNA *prop_storage, - const int len_dst, - const int len_src, - const int len_storage, + int len_dst, + int len_src, + int len_storage, struct PointerRNA *ptr_item_dst, struct PointerRNA *ptr_item_src, struct PointerRNA *ptr_item_storage, diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c index ba380583e88..2e2e96c0ae4 100644 --- a/source/blender/makesrna/intern/rna_nodetree.c +++ b/source/blender/makesrna/intern/rna_nodetree.c @@ -52,6 +52,7 @@ #include "rna_internal.h" #include "rna_internal_types.h" +#include "IMB_colormanagement.h" #include "IMB_imbuf.h" #include "IMB_imbuf_types.h" @@ -4666,6 +4667,55 @@ bool rna_NodeSocketMaterial_default_value_poll(PointerRNA *UNUSED(ptr), PointerR return ma->gp_style == NULL; } +static int rna_NodeConvertColorSpace_from_color_space_get(struct PointerRNA *ptr) +{ + bNode *node = (bNode *)ptr->data; + NodeConvertColorSpace *node_storage = node->storage; + return IMB_colormanagement_colorspace_get_named_index(node_storage->from_color_space); +} + +static void rna_NodeConvertColorSpace_from_color_space_set(struct PointerRNA *ptr, int value) +{ + bNode *node = (bNode *)ptr->data; + NodeConvertColorSpace *node_storage = node->storage; + const char *name = IMB_colormanagement_colorspace_get_indexed_name(value); + + if (name && name[0]) { + BLI_strncpy(node_storage->from_color_space, name, sizeof(node_storage->from_color_space)); + } +} +static int rna_NodeConvertColorSpace_to_color_space_get(struct PointerRNA *ptr) +{ + bNode *node = (bNode *)ptr->data; + NodeConvertColorSpace *node_storage = node->storage; + return IMB_colormanagement_colorspace_get_named_index(node_storage->to_color_space); +} + +static void rna_NodeConvertColorSpace_to_color_space_set(struct PointerRNA *ptr, int value) +{ + bNode *node = (bNode *)ptr->data; + NodeConvertColorSpace *node_storage = node->storage; + const char *name = IMB_colormanagement_colorspace_get_indexed_name(value); + + if (name && name[0]) { + BLI_strncpy(node_storage->to_color_space, name, sizeof(node_storage->to_color_space)); + } +} + +static const EnumPropertyItem *rna_NodeConvertColorSpace_color_space_itemf( + bContext *UNUSED(C), PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), bool *r_free) +{ + EnumPropertyItem *items = NULL; + int totitem = 0; + + IMB_colormanagement_colorspace_items_add(&items, &totitem); + RNA_enum_item_end(&items, &totitem); + + *r_free = true; + + return items; +} + #else static const EnumPropertyItem prop_image_layer_items[] = { @@ -7313,6 +7363,42 @@ static void def_cmp_distance_matte(StructRNA *srna) RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update"); } +static void def_cmp_convert_color_space(StructRNA *srna) +{ + PropertyRNA *prop; + RNA_def_struct_sdna_from(srna, "NodeConvertColorSpace", "storage"); + + static const EnumPropertyItem color_space_items[] = { + {0, + "NONE", + 0, + "None", + "Do not perform any color transform on load, treat colors as in scene linear space " + "already"}, + {0, NULL, 0, NULL, NULL}, + }; + + prop = RNA_def_property(srna, "from_color_space", PROP_ENUM, PROP_NONE); + RNA_def_property_flag(prop, PROP_ENUM_NO_CONTEXT); + RNA_def_property_enum_items(prop, color_space_items); + RNA_def_property_enum_funcs(prop, + "rna_NodeConvertColorSpace_from_color_space_get", + "rna_NodeConvertColorSpace_from_color_space_set", + "rna_NodeConvertColorSpace_color_space_itemf"); + RNA_def_property_ui_text(prop, "From", "Color space of the input image"); + RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update"); + + prop = RNA_def_property(srna, "to_color_space", PROP_ENUM, PROP_NONE); + RNA_def_property_flag(prop, PROP_ENUM_NO_CONTEXT); + RNA_def_property_enum_items(prop, color_space_items); + RNA_def_property_enum_funcs(prop, + "rna_NodeConvertColorSpace_to_color_space_get", + "rna_NodeConvertColorSpace_to_color_space_set", + "rna_NodeConvertColorSpace_color_space_itemf"); + RNA_def_property_ui_text(prop, "To", "Color space of the output image"); + RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_update"); +} + static void def_cmp_color_spill(StructRNA *srna) { PropertyRNA *prop; diff --git a/source/blender/makesrna/intern/rna_render.c b/source/blender/makesrna/intern/rna_render.c index fcb46904e8d..65e9a140f82 100644 --- a/source/blender/makesrna/intern/rna_render.c +++ b/source/blender/makesrna/intern/rna_render.c @@ -98,6 +98,7 @@ const EnumPropertyItem rna_enum_bake_pass_type_items[] = { # include "RNA_access.h" +# include "BKE_appdir.h" # include "BKE_context.h" # include "BKE_report.h" @@ -420,6 +421,16 @@ static StructRNA *rna_RenderEngine_refine(PointerRNA *ptr) &RNA_RenderEngine; } +static void rna_RenderEngine_tempdir_get(PointerRNA *UNUSED(ptr), char *value) +{ + BLI_strncpy(value, BKE_tempdir_session(), FILE_MAX); +} + +static int rna_RenderEngine_tempdir_length(PointerRNA *UNUSED(ptr)) +{ + return strlen(BKE_tempdir_session()); +} + static PointerRNA rna_RenderEngine_render_get(PointerRNA *ptr) { RenderEngine *engine = (RenderEngine *)ptr->data; @@ -860,6 +871,12 @@ static void rna_def_render_engine(BlenderRNA *brna) RNA_def_property_int_sdna(prop, NULL, "resolution_y"); RNA_def_property_clear_flag(prop, PROP_EDITABLE); + prop = RNA_def_property(srna, "temporary_directory", PROP_STRING, PROP_NONE); + RNA_def_function_ui_description(func, "The temp directory used by Blender"); + RNA_def_property_string_funcs( + prop, "rna_RenderEngine_tempdir_get", "rna_RenderEngine_tempdir_length", NULL); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + /* Render Data */ prop = RNA_def_property(srna, "render", PROP_POINTER, PROP_NONE); RNA_def_property_struct_type(prop, "RenderSettings"); diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c index 16e9a6208fb..05c1a645823 100644 --- a/source/blender/makesrna/intern/rna_space.c +++ b/source/blender/makesrna/intern/rna_space.c @@ -4301,6 +4301,15 @@ static void rna_def_space_view3d_overlay(BlenderRNA *brna) RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, "rna_GPencil_update"); + prop = RNA_def_property(srna, "bone_wire_alpha", PROP_FLOAT, PROP_FACTOR); + RNA_def_property_float_sdna(prop, NULL, "overlay.bone_wire_alpha"); + RNA_def_property_ui_text( + prop, "Bone Wireframe Opacity", "Maximim opacity of bones in wireframe display mode"); + RNA_def_property_range(prop, 0.0f, FLT_MAX); + RNA_def_property_ui_range(prop, 0.0f, 1.0f, 1, 2); + RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); + RNA_def_property_update(prop, NC_SPACE | ND_SPACE_VIEW3D, "rna_GPencil_update"); + prop = RNA_def_property(srna, "show_motion_paths", PROP_BOOLEAN, PROP_NONE); RNA_def_property_boolean_negative_sdna( prop, NULL, "overlay.flag", V3D_OVERLAY_HIDE_MOTION_PATHS); diff --git a/source/blender/modifiers/intern/MOD_meshcache_util.h b/source/blender/modifiers/intern/MOD_meshcache_util.h index 74131099e3c..b1a8a3ffc19 100644 --- a/source/blender/modifiers/intern/MOD_meshcache_util.h +++ b/source/blender/modifiers/intern/MOD_meshcache_util.h @@ -23,52 +23,45 @@ /* MOD_meshcache_mdd.c */ bool MOD_meshcache_read_mdd_index(FILE *fp, float (*vertexCos)[3], - const int vertex_tot, - const int index, - const float factor, + int vertex_tot, + int index, + float factor, const char **err_str); bool MOD_meshcache_read_mdd_frame(FILE *fp, float (*vertexCos)[3], - const int verts_tot, - const char interp, - const float frame, + int verts_tot, + char interp, + float frame, const char **err_str); bool MOD_meshcache_read_mdd_times(const char *filepath, float (*vertexCos)[3], - const int verts_tot, - const char interp, - const float time, - const float fps, - const char time_mode, + int verts_tot, + char interp, + float time, + float fps, + char time_mode, const char **err_str); /* MOD_meshcache_pc2.c */ -bool MOD_meshcache_read_pc2_index(FILE *fp, - float (*vertexCos)[3], - const int verts_tot, - const int index, - const float factor, - const char **err_str); +bool MOD_meshcache_read_pc2_index( + FILE *fp, float (*vertexCos)[3], int verts_tot, int index, float factor, const char **err_str); bool MOD_meshcache_read_pc2_frame(FILE *fp, float (*vertexCos)[3], - const int verts_tot, - const char interp, - const float frame, + int verts_tot, + char interp, + float frame, const char **err_str); bool MOD_meshcache_read_pc2_times(const char *filepath, float (*vertexCos)[3], - const int verts_tot, - const char interp, - const float time, - const float fps, - const char time_mode, + int verts_tot, + char interp, + float time, + float fps, + char time_mode, const char **err_str); /* MOD_meshcache_util.c */ -void MOD_meshcache_calc_range(const float frame, - const char interp, - const int frame_tot, - int r_index_range[2], - float *r_factor); +void MOD_meshcache_calc_range( + float frame, char interp, int frame_tot, int r_index_range[2], float *r_factor); #define FRAME_SNAP_EPS 0.0001f diff --git a/source/blender/modifiers/intern/MOD_util.h b/source/blender/modifiers/intern/MOD_util.h index a6fc2749e71..de02b55440a 100644 --- a/source/blender/modifiers/intern/MOD_util.h +++ b/source/blender/modifiers/intern/MOD_util.h @@ -51,9 +51,9 @@ struct Mesh *MOD_deform_mesh_eval_get(struct Object *ob, struct BMEditMesh *em, struct Mesh *mesh, const float (*vertexCos)[3], - const int num_verts, - const bool use_normals, - const bool use_orco); + int num_verts, + bool use_normals, + bool use_orco); void MOD_get_vgroup(struct Object *ob, struct Mesh *mesh, diff --git a/source/blender/modifiers/intern/MOD_weightvg_util.h b/source/blender/modifiers/intern/MOD_weightvg_util.h index 00aecd7342c..3bcbe3ed68b 100644 --- a/source/blender/modifiers/intern/MOD_weightvg_util.h +++ b/source/blender/modifiers/intern/MOD_weightvg_util.h @@ -64,7 +64,7 @@ struct uiLayout; void weightvg_do_map(int num, float *new_w, short falloff_type, - const bool do_invert, + bool do_invert, struct CurveMapping *cmap, struct RNG *rng); @@ -77,22 +77,22 @@ void weightvg_do_map(int num, * Else, weird results might appear. */ void weightvg_do_mask(const ModifierEvalContext *ctx, - const int num, + int num, const int *indices, float *org_w, const float *new_w, Object *ob, struct Mesh *mesh, - const float fact, + float fact, const char defgrp_name[MAX_VGROUP_NAME], struct Scene *scene, Tex *texture, - const int tex_use_channel, - const int tex_mapping, + int tex_use_channel, + int tex_mapping, Object *tex_map_object, const char *text_map_bone, const char *tex_uvlayer_name, - const bool invert_vgroup_mask); + bool invert_vgroup_mask); /** * Applies weights to given vgroup (defgroup), and optionally add/remove vertices from the group. @@ -107,11 +107,11 @@ void weightvg_update_vg(struct MDeformVert *dvert, int num, const int *indices, const float *weights, - const bool do_add, - const float add_thresh, - const bool do_rem, - const float rem_thresh, - const bool do_normalize); + bool do_add, + float add_thresh, + bool do_rem, + float rem_thresh, + bool do_normalize); /** * Common vertex weight mask interface elements for the modifier panels. diff --git a/source/blender/nodes/CMakeLists.txt b/source/blender/nodes/CMakeLists.txt index e210958fa5d..f965302be5e 100644 --- a/source/blender/nodes/CMakeLists.txt +++ b/source/blender/nodes/CMakeLists.txt @@ -22,6 +22,7 @@ add_subdirectory(composite) add_subdirectory(function) add_subdirectory(geometry) add_subdirectory(shader) +add_subdirectory(texture) set(INC . @@ -51,32 +52,6 @@ set(INC set(SRC - texture/nodes/node_texture_at.c - texture/nodes/node_texture_bricks.c - texture/nodes/node_texture_checker.c - texture/nodes/node_texture_common.c - texture/nodes/node_texture_compose.c - texture/nodes/node_texture_coord.c - texture/nodes/node_texture_curves.c - texture/nodes/node_texture_decompose.c - texture/nodes/node_texture_distance.c - texture/nodes/node_texture_hueSatVal.c - texture/nodes/node_texture_image.c - texture/nodes/node_texture_invert.c - texture/nodes/node_texture_math.c - texture/nodes/node_texture_mixRgb.c - texture/nodes/node_texture_output.c - texture/nodes/node_texture_proc.c - texture/nodes/node_texture_rotate.c - texture/nodes/node_texture_scale.c - texture/nodes/node_texture_texture.c - texture/nodes/node_texture_translate.c - texture/nodes/node_texture_valToNor.c - texture/nodes/node_texture_valToRgb.c - texture/nodes/node_texture_viewer.c - texture/node_texture_tree.c - texture/node_texture_util.c - intern/derived_node_tree.cc intern/geometry_nodes_eval_log.cc intern/math_functions.cc @@ -91,8 +66,6 @@ set(SRC intern/node_util.c intern/socket_search_link.cc - texture/node_texture_util.h - NOD_common.h NOD_composite.h NOD_derived_node_tree.hh @@ -123,6 +96,7 @@ set(LIB bf_nodes_function bf_nodes_geometry bf_nodes_shader + bf_nodes_texture ) if(WITH_BULLET) diff --git a/source/blender/nodes/NOD_composite.h b/source/blender/nodes/NOD_composite.h index d243577f68d..72539f6081e 100644 --- a/source/blender/nodes/NOD_composite.h +++ b/source/blender/nodes/NOD_composite.h @@ -62,6 +62,7 @@ void register_node_type_cmp_alphaover(void); void register_node_type_cmp_zcombine(void); void register_node_type_cmp_colorbalance(void); void register_node_type_cmp_huecorrect(void); +void register_node_type_cmp_convert_color_space(void); void register_node_type_cmp_normal(void); void register_node_type_cmp_curve_vec(void); diff --git a/source/blender/nodes/NOD_geometry_exec.hh b/source/blender/nodes/NOD_geometry_exec.hh index 2246cc29dc4..7060760237a 100644 --- a/source/blender/nodes/NOD_geometry_exec.hh +++ b/source/blender/nodes/NOD_geometry_exec.hh @@ -328,7 +328,7 @@ class GeoNodeExecParams { */ GVArray get_input_attribute(const StringRef name, const GeometryComponent &component, - const AttributeDomain domain, + AttributeDomain domain, const CustomDataType type, const void *default_value) const; @@ -358,7 +358,7 @@ class GeoNodeExecParams { */ AttributeDomain get_highest_priority_input_domain(Span<std::string> names, const GeometryComponent &component, - const AttributeDomain default_domain) const; + AttributeDomain default_domain) const; std::string attribute_producer_name() const; diff --git a/source/blender/nodes/NOD_math_functions.hh b/source/blender/nodes/NOD_math_functions.hh index 54abc754346..a0a2e6f81f8 100644 --- a/source/blender/nodes/NOD_math_functions.hh +++ b/source/blender/nodes/NOD_math_functions.hh @@ -36,9 +36,9 @@ struct FloatMathOperationInfo { } }; -const FloatMathOperationInfo *get_float_math_operation_info(const int operation); -const FloatMathOperationInfo *get_float3_math_operation_info(const int operation); -const FloatMathOperationInfo *get_float_compare_operation_info(const int operation); +const FloatMathOperationInfo *get_float_math_operation_info(int operation); +const FloatMathOperationInfo *get_float3_math_operation_info(int operation); +const FloatMathOperationInfo *get_float_compare_operation_info(int operation); /** * This calls the `callback` with two arguments: diff --git a/source/blender/nodes/NOD_socket_declarations.hh b/source/blender/nodes/NOD_socket_declarations.hh index c0ba949e337..c0580a2c919 100644 --- a/source/blender/nodes/NOD_socket_declarations.hh +++ b/source/blender/nodes/NOD_socket_declarations.hh @@ -47,9 +47,9 @@ class Float : public SocketDeclaration { class FloatBuilder : public SocketDeclarationBuilder<Float> { public: - FloatBuilder &min(const float value); - FloatBuilder &max(const float value); - FloatBuilder &default_value(const float value); + FloatBuilder &min(float value); + FloatBuilder &max(float value); + FloatBuilder &default_value(float value); FloatBuilder &subtype(PropertySubType subtype); }; @@ -75,9 +75,9 @@ class Int : public SocketDeclaration { class IntBuilder : public SocketDeclarationBuilder<Int> { public: - IntBuilder &min(const int value); - IntBuilder &max(const int value); - IntBuilder &default_value(const int value); + IntBuilder &min(int value); + IntBuilder &max(int value); + IntBuilder &default_value(int value); IntBuilder &subtype(PropertySubType subtype); }; @@ -105,8 +105,8 @@ class VectorBuilder : public SocketDeclarationBuilder<Vector> { public: VectorBuilder &default_value(const float3 value); VectorBuilder &subtype(PropertySubType subtype); - VectorBuilder &min(const float min); - VectorBuilder &max(const float max); + VectorBuilder &min(float min); + VectorBuilder &max(float max); VectorBuilder &compact(); }; @@ -127,7 +127,7 @@ class Bool : public SocketDeclaration { class BoolBuilder : public SocketDeclarationBuilder<Bool> { public: - BoolBuilder &default_value(const bool value); + BoolBuilder &default_value(bool value); }; class ColorBuilder; diff --git a/source/blender/nodes/NOD_static_types.h b/source/blender/nodes/NOD_static_types.h index 9afd11271ca..4edd0c50011 100644 --- a/source/blender/nodes/NOD_static_types.h +++ b/source/blender/nodes/NOD_static_types.h @@ -227,6 +227,7 @@ DefNode(CompositorNode, CMP_NODE_DENOISE, def_cmp_denoise, "DENOIS DefNode(CompositorNode, CMP_NODE_EXPOSURE, 0, "EXPOSURE", Exposure, "Exposure", "" ) DefNode(CompositorNode, CMP_NODE_ANTIALIASING, def_cmp_antialiasing, "ANTIALIASING", AntiAliasing, "Anti-Aliasing", "" ) DefNode(CompositorNode, CMP_NODE_POSTERIZE, 0, "POSTERIZE", Posterize, "Posterize", "" ) +DefNode(CompositorNode, CMP_NODE_CONVERT_COLOR_SPACE,def_cmp_convert_color_space, "CONVERT_COLORSPACE", ConvertColorSpace, "Color Space","" ) DefNode(TextureNode, TEX_NODE_OUTPUT, def_tex_output, "OUTPUT", Output, "Output", "" ) DefNode(TextureNode, TEX_NODE_CHECKER, 0, "CHECKER", Checker, "Checker", "" ) diff --git a/source/blender/nodes/composite/CMakeLists.txt b/source/blender/nodes/composite/CMakeLists.txt index 6818c08d6ed..20a7fcc9826 100644 --- a/source/blender/nodes/composite/CMakeLists.txt +++ b/source/blender/nodes/composite/CMakeLists.txt @@ -51,6 +51,7 @@ set(SRC nodes/node_composite_color_spill.cc nodes/node_composite_colorbalance.cc nodes/node_composite_colorcorrection.cc + nodes/node_composite_convert_color_space.cc nodes/node_composite_common.cc nodes/node_composite_composite.cc nodes/node_composite_cornerpin.cc @@ -82,7 +83,7 @@ set(SRC nodes/node_composite_keyingscreen.cc nodes/node_composite_lensdist.cc nodes/node_composite_levels.cc - nodes/node_composite_lumma_matte.cc + nodes/node_composite_luma_matte.cc nodes/node_composite_map_range.cc nodes/node_composite_map_uv.cc nodes/node_composite_map_value.cc diff --git a/source/blender/nodes/composite/nodes/node_composite_common.cc b/source/blender/nodes/composite/nodes/node_composite_common.cc index 36678baafa5..d5f7279398e 100644 --- a/source/blender/nodes/composite/nodes/node_composite_common.cc +++ b/source/blender/nodes/composite/nodes/node_composite_common.cc @@ -47,7 +47,6 @@ void register_node_type_cmp_group() BLI_assert(ntype.rna_ext.srna != nullptr); RNA_struct_blender_type_set(ntype.rna_ext.srna, &ntype); - node_type_socket_templates(&ntype, nullptr, nullptr); node_type_size(&ntype, 140, 60, 400); ntype.labelfunc = node_group_label; node_type_group_update(&ntype, node_group_update); diff --git a/source/blender/nodes/composite/nodes/node_composite_convert_color_space.cc b/source/blender/nodes/composite/nodes/node_composite_convert_color_space.cc new file mode 100644 index 00000000000..2aa0b74aa11 --- /dev/null +++ b/source/blender/nodes/composite/nodes/node_composite_convert_color_space.cc @@ -0,0 +1,82 @@ +/* + * 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 Blender Foundation. + * All rights reserved. + */ + +/** \file + * \ingroup cmpnodes + */ + +#include "node_composite_util.hh" + +#include "RNA_access.h" + +#include "UI_interface.h" +#include "UI_resources.h" + +#include "IMB_colormanagement.h" + +namespace blender::nodes { + +static void CMP_NODE_CONVERT_COLOR_SPACE_declare(NodeDeclarationBuilder &b) +{ + b.add_input<decl::Color>(N_("Image")).default_value({1.0f, 1.0f, 1.0f, 1.0f}); + b.add_output<decl::Color>(N_("Image")); +} + +} // namespace blender::nodes + +static void node_composit_init_convert_colorspace(bNodeTree *UNUSED(ntree), bNode *node) +{ + NodeConvertColorSpace *ncs = static_cast<NodeConvertColorSpace *>( + MEM_callocN(sizeof(NodeConvertColorSpace), "node colorspace")); + const char *first_colorspace = IMB_colormanagement_role_colorspace_name_get( + COLOR_ROLE_SCENE_LINEAR); + if (first_colorspace && first_colorspace[0]) { + STRNCPY(ncs->from_color_space, first_colorspace); + STRNCPY(ncs->to_color_space, first_colorspace); + } + else { + ncs->from_color_space[0] = 0; + ncs->to_color_space[0] = 0; + } + node->storage = ncs; +} + +static void node_composit_buts_convert_colorspace(uiLayout *layout, + bContext *UNUSED(C), + PointerRNA *ptr) +{ + uiItemR(layout, ptr, "from_color_space", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); + uiItemR(layout, ptr, "to_color_space", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); +} + +void register_node_type_cmp_convert_color_space(void) +{ + static bNodeType ntype; + + cmp_node_type_base( + &ntype, CMP_NODE_CONVERT_COLOR_SPACE, "Convert Colorspace", NODE_CLASS_CONVERTER); + ntype.declare = blender::nodes::CMP_NODE_CONVERT_COLOR_SPACE_declare; + ntype.draw_buttons = node_composit_buts_convert_colorspace; + node_type_size_preset(&ntype, NODE_SIZE_MIDDLE); + node_type_init(&ntype, node_composit_init_convert_colorspace); + node_type_storage( + &ntype, "NodeConvertColorSpace", node_free_standard_storage, node_copy_standard_storage); + + nodeRegisterType(&ntype); +} diff --git a/source/blender/nodes/composite/nodes/node_composite_lumma_matte.cc b/source/blender/nodes/composite/nodes/node_composite_luma_matte.cc index 313bbf73955..313bbf73955 100644 --- a/source/blender/nodes/composite/nodes/node_composite_lumma_matte.cc +++ b/source/blender/nodes/composite/nodes/node_composite_luma_matte.cc diff --git a/source/blender/nodes/composite/nodes/node_composite_output_file.cc b/source/blender/nodes/composite/nodes/node_composite_output_file.cc index f4699ec02d0..602cc4a8ca8 100644 --- a/source/blender/nodes/composite/nodes/node_composite_output_file.cc +++ b/source/blender/nodes/composite/nodes/node_composite_output_file.cc @@ -440,7 +440,6 @@ void register_node_type_cmp_output_file() static bNodeType ntype; cmp_node_type_base(&ntype, CMP_NODE_OUTPUT_FILE, "File Output", NODE_CLASS_OUTPUT); - node_type_socket_templates(&ntype, nullptr, nullptr); ntype.draw_buttons = node_composit_buts_file_output; ntype.draw_buttons_ex = node_composit_buts_file_output_ex; ntype.initfunc_api = init_output_file; diff --git a/source/blender/nodes/function/nodes/legacy/node_fn_random_float.cc b/source/blender/nodes/function/nodes/legacy/node_fn_random_float.cc index 582e6748a1e..9470b82a8eb 100644 --- a/source/blender/nodes/function/nodes/legacy/node_fn_random_float.cc +++ b/source/blender/nodes/function/nodes/legacy/node_fn_random_float.cc @@ -27,7 +27,7 @@ static void fn_node_legacy_random_float_declare(NodeDeclarationBuilder &b) b.add_input<decl::Float>(N_("Max")).default_value(1.0f).min(-10000.0f).max(10000.0f); b.add_input<decl::Int>(N_("Seed")).min(-10000).max(10000); b.add_output<decl::Float>(N_("Value")); -}; +} class RandomFloatFunction : public blender::fn::MultiFunction { public: diff --git a/source/blender/nodes/function/nodes/node_fn_boolean_math.cc b/source/blender/nodes/function/nodes/node_fn_boolean_math.cc index e8c05defe7c..cd05f07d392 100644 --- a/source/blender/nodes/function/nodes/node_fn_boolean_math.cc +++ b/source/blender/nodes/function/nodes/node_fn_boolean_math.cc @@ -32,7 +32,7 @@ static void fn_node_boolean_math_declare(NodeDeclarationBuilder &b) b.add_input<decl::Bool>(N_("Boolean"), "Boolean"); b.add_input<decl::Bool>(N_("Boolean"), "Boolean_001"); b.add_output<decl::Bool>(N_("Boolean")); -}; +} static void fn_node_boolean_math_layout(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { diff --git a/source/blender/nodes/function/nodes/node_fn_compare.cc b/source/blender/nodes/function/nodes/node_fn_compare.cc index 28a6093e849..3bb46511eeb 100644 --- a/source/blender/nodes/function/nodes/node_fn_compare.cc +++ b/source/blender/nodes/function/nodes/node_fn_compare.cc @@ -55,7 +55,7 @@ static void fn_node_compare_declare(NodeDeclarationBuilder &b) b.add_input<decl::Float>(N_("Epsilon")).default_value(0.001).min(-10000.0f).max(10000.0f); b.add_output<decl::Bool>(N_("Result")); -}; +} static void geo_node_compare_layout(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { diff --git a/source/blender/nodes/function/nodes/node_fn_float_to_int.cc b/source/blender/nodes/function/nodes/node_fn_float_to_int.cc index 1a130e748d5..488787980dc 100644 --- a/source/blender/nodes/function/nodes/node_fn_float_to_int.cc +++ b/source/blender/nodes/function/nodes/node_fn_float_to_int.cc @@ -32,7 +32,7 @@ static void fn_node_float_to_int_declare(NodeDeclarationBuilder &b) b.is_function_node(); b.add_input<decl::Float>(N_("Float")); b.add_output<decl::Int>(N_("Integer")); -}; +} static void fn_node_float_to_int_layout(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { diff --git a/source/blender/nodes/function/nodes/node_fn_input_bool.cc b/source/blender/nodes/function/nodes/node_fn_input_bool.cc index b6f7c802cc9..583570effd9 100644 --- a/source/blender/nodes/function/nodes/node_fn_input_bool.cc +++ b/source/blender/nodes/function/nodes/node_fn_input_bool.cc @@ -26,7 +26,7 @@ namespace blender::nodes::node_fn_input_bool_cc { static void fn_node_input_bool_declare(NodeDeclarationBuilder &b) { b.add_output<decl::Bool>(N_("Boolean")); -}; +} static void fn_node_input_bool_layout(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { diff --git a/source/blender/nodes/function/nodes/node_fn_input_color.cc b/source/blender/nodes/function/nodes/node_fn_input_color.cc index 5ace57810e1..1fad5b2f5f4 100644 --- a/source/blender/nodes/function/nodes/node_fn_input_color.cc +++ b/source/blender/nodes/function/nodes/node_fn_input_color.cc @@ -24,7 +24,7 @@ namespace blender::nodes::node_fn_input_color_cc { static void fn_node_input_color_declare(NodeDeclarationBuilder &b) { b.add_output<decl::Color>(N_("Color")); -}; +} static void fn_node_input_color_layout(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { diff --git a/source/blender/nodes/function/nodes/node_fn_input_int.cc b/source/blender/nodes/function/nodes/node_fn_input_int.cc index d96339ae365..dc30ecb253c 100644 --- a/source/blender/nodes/function/nodes/node_fn_input_int.cc +++ b/source/blender/nodes/function/nodes/node_fn_input_int.cc @@ -26,7 +26,7 @@ namespace blender::nodes::node_fn_input_int_cc { static void fn_node_input_int_declare(NodeDeclarationBuilder &b) { b.add_output<decl::Int>(N_("Integer")); -}; +} static void fn_node_input_int_layout(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { diff --git a/source/blender/nodes/function/nodes/node_fn_input_special_characters.cc b/source/blender/nodes/function/nodes/node_fn_input_special_characters.cc index 8137b424143..681bc16a301 100644 --- a/source/blender/nodes/function/nodes/node_fn_input_special_characters.cc +++ b/source/blender/nodes/function/nodes/node_fn_input_special_characters.cc @@ -22,7 +22,7 @@ static void fn_node_input_special_characters_declare(NodeDeclarationBuilder &b) { b.add_output<decl::String>(N_("Line Break")); b.add_output<decl::String>(N_("Tab")); -}; +} class MF_SpecialCharacters : public fn::MultiFunction { public: diff --git a/source/blender/nodes/function/nodes/node_fn_input_string.cc b/source/blender/nodes/function/nodes/node_fn_input_string.cc index a326caf50bd..4abb352d802 100644 --- a/source/blender/nodes/function/nodes/node_fn_input_string.cc +++ b/source/blender/nodes/function/nodes/node_fn_input_string.cc @@ -25,7 +25,7 @@ static void fn_node_input_string_declare(NodeDeclarationBuilder &b) { b.is_function_node(); b.add_output<decl::String>(N_("String")); -}; +} static void fn_node_input_string_layout(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { diff --git a/source/blender/nodes/function/nodes/node_fn_input_vector.cc b/source/blender/nodes/function/nodes/node_fn_input_vector.cc index 34515c4414c..ba9600b461c 100644 --- a/source/blender/nodes/function/nodes/node_fn_input_vector.cc +++ b/source/blender/nodes/function/nodes/node_fn_input_vector.cc @@ -26,7 +26,7 @@ namespace blender::nodes::node_fn_input_vector_cc { static void fn_node_input_vector_declare(NodeDeclarationBuilder &b) { b.add_output<decl::Vector>(N_("Vector")); -}; +} static void fn_node_input_vector_layout(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { diff --git a/source/blender/nodes/function/nodes/node_fn_replace_string.cc b/source/blender/nodes/function/nodes/node_fn_replace_string.cc index 243cb63d713..afe516a5214 100644 --- a/source/blender/nodes/function/nodes/node_fn_replace_string.cc +++ b/source/blender/nodes/function/nodes/node_fn_replace_string.cc @@ -27,7 +27,7 @@ static void fn_node_replace_string_declare(NodeDeclarationBuilder &b) b.add_input<decl::String>(N_("Replace")) .description(N_("The string to replace each match with")); b.add_output<decl::String>(N_("String")); -}; +} static std::string replace_all(std::string str, const std::string &from, const std::string &to) { diff --git a/source/blender/nodes/function/nodes/node_fn_rotate_euler.cc b/source/blender/nodes/function/nodes/node_fn_rotate_euler.cc index 582a9bb10a8..3140aeac975 100644 --- a/source/blender/nodes/function/nodes/node_fn_rotate_euler.cc +++ b/source/blender/nodes/function/nodes/node_fn_rotate_euler.cc @@ -34,7 +34,7 @@ static void fn_node_rotate_euler_declare(NodeDeclarationBuilder &b) b.add_input<decl::Vector>(N_("Axis")).default_value({0.0, 0.0, 1.0}).subtype(PROP_XYZ); b.add_input<decl::Float>(N_("Angle")).subtype(PROP_ANGLE); b.add_output<decl::Vector>(N_("Rotation")); -}; +} static void fn_node_rotate_euler_update(bNodeTree *ntree, bNode *node) { diff --git a/source/blender/nodes/function/nodes/node_fn_slice_string.cc b/source/blender/nodes/function/nodes/node_fn_slice_string.cc index f9d0af5ba9b..4055495ec1f 100644 --- a/source/blender/nodes/function/nodes/node_fn_slice_string.cc +++ b/source/blender/nodes/function/nodes/node_fn_slice_string.cc @@ -26,7 +26,7 @@ static void fn_node_slice_string_declare(NodeDeclarationBuilder &b) b.add_input<decl::Int>(N_("Position")); b.add_input<decl::Int>(N_("Length")).min(0).default_value(10); b.add_output<decl::String>(N_("String")); -}; +} static void fn_node_slice_string_build_multi_function(NodeMultiFunctionBuilder &builder) { diff --git a/source/blender/nodes/function/nodes/node_fn_string_length.cc b/source/blender/nodes/function/nodes/node_fn_string_length.cc index 8ab56812125..bed434c8f2c 100644 --- a/source/blender/nodes/function/nodes/node_fn_string_length.cc +++ b/source/blender/nodes/function/nodes/node_fn_string_length.cc @@ -26,7 +26,7 @@ static void fn_node_string_length_declare(NodeDeclarationBuilder &b) { b.add_input<decl::String>(N_("String")); b.add_output<decl::Int>(N_("Length")); -}; +} static void fn_node_string_length_build_multi_function(NodeMultiFunctionBuilder &builder) { diff --git a/source/blender/nodes/function/nodes/node_fn_value_to_string.cc b/source/blender/nodes/function/nodes/node_fn_value_to_string.cc index 235c612dc15..ee0613de9bd 100644 --- a/source/blender/nodes/function/nodes/node_fn_value_to_string.cc +++ b/source/blender/nodes/function/nodes/node_fn_value_to_string.cc @@ -24,7 +24,7 @@ static void fn_node_value_to_string_declare(NodeDeclarationBuilder &b) b.add_input<decl::Float>(N_("Value")); b.add_input<decl::Int>(N_("Decimals")).min(0); b.add_output<decl::String>(N_("String")); -}; +} static void fn_node_value_to_string_build_multi_function(NodeMultiFunctionBuilder &builder) { diff --git a/source/blender/nodes/geometry/node_geometry_util.hh b/source/blender/nodes/geometry/node_geometry_util.hh index 3a6c5e38f82..f0f2b64ec4e 100644 --- a/source/blender/nodes/geometry/node_geometry_util.hh +++ b/source/blender/nodes/geometry/node_geometry_util.hh @@ -52,11 +52,11 @@ namespace blender::nodes { void update_attribute_input_socket_availabilities(bNodeTree &ntree, bNode &node, const StringRef name, - const GeometryNodeAttributeInputMode mode, - const bool name_is_available = true); + GeometryNodeAttributeInputMode mode, + bool name_is_available = true); Array<uint32_t> get_geometry_element_ids_as_uints(const GeometryComponent &component, - const AttributeDomain domain); + AttributeDomain domain); void transform_mesh(Mesh &mesh, const float3 translation, @@ -67,12 +67,9 @@ void transform_geometry_set(GeometrySet &geometry, const float4x4 &transform, const Depsgraph &depsgraph); -Mesh *create_line_mesh(const float3 start, const float3 delta, const int count); +Mesh *create_line_mesh(const float3 start, const float3 delta, int count); -Mesh *create_grid_mesh(const int verts_x, - const int verts_y, - const float size_x, - const float size_y); +Mesh *create_grid_mesh(int verts_x, int verts_y, float size_x, float size_y); struct ConeAttributeOutputs { StrongAnonymousAttributeID top_id; @@ -80,12 +77,12 @@ struct ConeAttributeOutputs { StrongAnonymousAttributeID side_id; }; -Mesh *create_cylinder_or_cone_mesh(const float radius_top, - const float radius_bottom, - const float depth, - const int circle_segments, - const int side_segments, - const int fill_segments, +Mesh *create_cylinder_or_cone_mesh(float radius_top, + float radius_bottom, + float depth, + int circle_segments, + int side_segments, + int fill_segments, const GeometryNodeMeshCircleFillType fill_type, ConeAttributeOutputs &attribute_outputs); @@ -97,17 +94,17 @@ Mesh *create_cuboid_mesh(float3 size, int verts_x, int verts_y, int verts_z); void copy_point_attributes_based_on_mask(const GeometryComponent &in_component, GeometryComponent &result_component, Span<bool> masks, - const bool invert); + bool invert); /** * Returns the parts of the geometry that are on the selection for the given domain. If the domain * is not applicable for the component, e.g. face domain for point cloud, nothing happens to that * component. If no component can work with the domain, then `error_message` is set to true. */ void separate_geometry(GeometrySet &geometry_set, - const AttributeDomain domain, - const GeometryNodeDeleteGeometryMode mode, + AttributeDomain domain, + GeometryNodeDeleteGeometryMode mode, const Field<bool> &selection_field, - const bool invert, + bool invert, bool &r_is_error); struct CurveToPointsResults { diff --git a/source/blender/nodes/geometry/nodes/node_geo_common.cc b/source/blender/nodes/geometry/nodes/node_geo_common.cc index 1e00ea3d896..093b4450657 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_common.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_common.cc @@ -35,7 +35,6 @@ void register_node_type_geo_group() BLI_assert(ntype.rna_ext.srna != nullptr); RNA_struct_blender_type_set(ntype.rna_ext.srna, &ntype); - node_type_socket_templates(&ntype, nullptr, nullptr); node_type_size(&ntype, 140, 60, 400); ntype.labelfunc = node_group_label; node_type_group_update(&ntype, node_group_update); 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 5ea8034c437..b3325844a5c 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_delete_geometry.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_delete_geometry.cc @@ -1354,16 +1354,16 @@ static void node_geo_exec(GeoNodeExecParams params) const AttributeDomain domain = static_cast<AttributeDomain>(storage.domain); const GeometryNodeDeleteGeometryMode mode = (GeometryNodeDeleteGeometryMode)storage.mode; - bool all_is_error = false; - geometry_set.modify_geometry_sets([&](GeometrySet &geometry_set) { - bool this_is_error = false; - /* Invert here because we want to keep the things not in the selection. */ - separate_geometry(geometry_set, domain, mode, selection_field, true, this_is_error); - all_is_error &= this_is_error; - }); - if (all_is_error) { - /* Only show this if none of the instances/components actually changed. */ - params.error_message_add(NodeWarningType::Info, TIP_("No geometry with given domain")); + if (domain == ATTR_DOMAIN_INSTANCE) { + bool is_error; + separate_geometry(geometry_set, domain, mode, selection_field, true, is_error); + } + else { + geometry_set.modify_geometry_sets([&](GeometrySet &geometry_set) { + bool is_error; + /* Invert here because we want to keep the things not in the selection. */ + separate_geometry(geometry_set, domain, mode, selection_field, true, is_error); + }); } params.set_output("Geometry", std::move(geometry_set)); diff --git a/source/blender/nodes/geometry/nodes/node_geo_input_normal.cc b/source/blender/nodes/geometry/nodes/node_geo_input_normal.cc index 86c2b0e4543..db5f30fb6c9 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_input_normal.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_input_normal.cc @@ -167,6 +167,7 @@ static void calculate_nurbs_normals(const NURBSpline &spline, MutableSpan<float3 PolySpline poly_spline; poly_spline.resize(spline.size()); poly_spline.positions().copy_from(spline.positions()); + poly_spline.tilts().copy_from(spline.tilts()); normals.copy_from(poly_spline.evaluated_normals()); } diff --git a/source/blender/nodes/geometry/nodes/node_geo_instance_on_points.cc b/source/blender/nodes/geometry/nodes/node_geo_instance_on_points.cc index 66ac618be5f..71256a7f781 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_instance_on_points.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_instance_on_points.cc @@ -36,7 +36,7 @@ static void node_declare(NodeDeclarationBuilder &b) .description(N_("Geometry that is instanced on the points")); b.add_input<decl::Bool>(N_("Pick Instance")) .supports_field() - .description("Place different instances on different points"); + .description(N_("Place different instances on different points")); b.add_input<decl::Int>(N_("Instance Index")) .implicit_field() .description(N_( diff --git a/source/blender/nodes/geometry/nodes/node_geo_rotate_instances.cc b/source/blender/nodes/geometry/nodes/node_geo_rotate_instances.cc index 5a088e16221..7d5c5b77ffd 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_rotate_instances.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_rotate_instances.cc @@ -28,7 +28,7 @@ static void node_declare(NodeDeclarationBuilder &b) b.add_input<decl::Vector>(N_("Pivot Point")).subtype(PROP_TRANSLATION).supports_field(); b.add_input<decl::Bool>(N_("Local Space")).default_value(true).supports_field(); b.add_output<decl::Geometry>(N_("Instances")); -}; +} static void rotate_instances(GeoNodeExecParams ¶ms, InstancesComponent &instances_component) { diff --git a/source/blender/nodes/geometry/nodes/node_geo_scale_instances.cc b/source/blender/nodes/geometry/nodes/node_geo_scale_instances.cc index 04c4e097f8d..5bd2028ff41 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_scale_instances.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_scale_instances.cc @@ -31,7 +31,7 @@ static void node_declare(NodeDeclarationBuilder &b) b.add_input<decl::Vector>(N_("Center")).subtype(PROP_TRANSLATION).supports_field(); b.add_input<decl::Bool>(N_("Local Space")).default_value(true).supports_field(); b.add_output<decl::Geometry>(N_("Instances")); -}; +} static void scale_instances(GeoNodeExecParams ¶ms, InstancesComponent &instances_component) { diff --git a/source/blender/nodes/geometry/nodes/node_geo_separate_geometry.cc b/source/blender/nodes/geometry/nodes/node_geo_separate_geometry.cc index 63da7399c3e..fec1ac1363e 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_separate_geometry.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_separate_geometry.cc @@ -59,7 +59,7 @@ static void node_geo_exec(GeoNodeExecParams params) const NodeGeometrySeparateGeometry &storage = node_storage(params.node()); const AttributeDomain domain = static_cast<AttributeDomain>(storage.domain); - auto separate_geometry_maybe_recursively = [&](bool invert) { + auto separate_geometry_maybe_recursively = [&](GeometrySet &geometry_set, bool invert) { bool is_error; if (domain == ATTR_DOMAIN_INSTANCE) { /* Only delete top level instances. */ @@ -84,11 +84,11 @@ static void node_geo_exec(GeoNodeExecParams params) GeometrySet second_set(geometry_set); if (params.output_is_required("Selection")) { - separate_geometry_maybe_recursively(false); + separate_geometry_maybe_recursively(geometry_set, false); params.set_output("Selection", std::move(geometry_set)); } if (params.output_is_required("Inverted")) { - separate_geometry_maybe_recursively(true); + separate_geometry_maybe_recursively(second_set, true); params.set_output("Inverted", std::move(second_set)); } } diff --git a/source/blender/nodes/geometry/nodes/node_geo_string_join.cc b/source/blender/nodes/geometry/nodes/node_geo_string_join.cc index 0fbe9a41ca5..176fcf3178a 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_string_join.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_string_join.cc @@ -23,7 +23,7 @@ static void node_declare(NodeDeclarationBuilder &b) b.add_input<decl::String>(N_("Delimiter")); b.add_input<decl::String>(N_("Strings")).multi_input().hide_value(); b.add_output<decl::String>(N_("String")); -}; +} static void node_geo_exec(GeoNodeExecParams params) { diff --git a/source/blender/nodes/geometry/nodes/node_geo_translate_instances.cc b/source/blender/nodes/geometry/nodes/node_geo_translate_instances.cc index 1061ece49a9..91c503ff047 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_translate_instances.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_translate_instances.cc @@ -27,7 +27,7 @@ static void node_declare(NodeDeclarationBuilder &b) b.add_input<decl::Vector>(N_("Translation")).subtype(PROP_TRANSLATION).supports_field(); b.add_input<decl::Bool>(N_("Local Space")).default_value(true).supports_field(); b.add_output<decl::Geometry>(N_("Instances")); -}; +} static void translate_instances(GeoNodeExecParams ¶ms, InstancesComponent &instances_component) { diff --git a/source/blender/nodes/shader/node_shader_tree.cc b/source/blender/nodes/shader/node_shader_tree.cc index 0fa977aa63c..8f1bb1dcd9a 100644 --- a/source/blender/nodes/shader/node_shader_tree.cc +++ b/source/blender/nodes/shader/node_shader_tree.cc @@ -665,8 +665,8 @@ static bNode *ntree_shader_copy_branch(bNodeTree *ntree, LISTBASE_FOREACH (bNode *, node, &ntree->nodes) { if (node->tmp_flag >= 0) { int id = node->tmp_flag; - nodes_copy[id] = BKE_node_copy( - ntree, node, LIB_ID_CREATE_NO_USER_REFCOUNT | LIB_ID_CREATE_NO_MAIN, false); + nodes_copy[id] = blender::bke::node_copy( + ntree, *node, LIB_ID_CREATE_NO_USER_REFCOUNT | LIB_ID_CREATE_NO_MAIN, false); nodes_copy[id]->tmp_flag = -2; /* Copy */ /* Make sure to clear all sockets links as they are invalid. */ LISTBASE_FOREACH (bNodeSocket *, sock, &nodes_copy[id]->inputs) { diff --git a/source/blender/nodes/shader/nodes/node_shader_ambient_occlusion.cc b/source/blender/nodes/shader/nodes/node_shader_ambient_occlusion.cc index 73f0e515a46..9c64594aab8 100644 --- a/source/blender/nodes/shader/nodes/node_shader_ambient_occlusion.cc +++ b/source/blender/nodes/shader/nodes/node_shader_ambient_occlusion.cc @@ -19,6 +19,9 @@ #include "node_shader_util.hh" +#include "UI_interface.h" +#include "UI_resources.h" + namespace blender::nodes::node_shader_ambient_occlusion_cc { static void node_declare(NodeDeclarationBuilder &b) @@ -30,6 +33,15 @@ static void node_declare(NodeDeclarationBuilder &b) b.add_output<decl::Float>(N_("AO")); } +static void node_shader_buts_ambient_occlusion(uiLayout *layout, + bContext *UNUSED(C), + PointerRNA *ptr) +{ + uiItemR(layout, ptr, "samples", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); + uiItemR(layout, ptr, "inside", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); + uiItemR(layout, ptr, "only_local", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); +} + static int node_shader_gpu_ambient_occlusion(GPUMaterial *mat, bNode *node, bNodeExecData *UNUSED(execdata), @@ -71,6 +83,7 @@ void register_node_type_sh_ambient_occlusion() sh_node_type_base(&ntype, SH_NODE_AMBIENT_OCCLUSION, "Ambient Occlusion", NODE_CLASS_INPUT); ntype.declare = file_ns::node_declare; + ntype.draw_buttons = file_ns::node_shader_buts_ambient_occlusion; node_type_init(&ntype, file_ns::node_shader_init_ambient_occlusion); node_type_gpu(&ntype, file_ns::node_shader_gpu_ambient_occlusion); diff --git a/source/blender/nodes/shader/nodes/node_shader_attribute.cc b/source/blender/nodes/shader/nodes/node_shader_attribute.cc index 780d0a72ef8..cf1b49ba29c 100644 --- a/source/blender/nodes/shader/nodes/node_shader_attribute.cc +++ b/source/blender/nodes/shader/nodes/node_shader_attribute.cc @@ -19,17 +19,24 @@ #include "node_shader_util.hh" +#include "UI_interface.h" +#include "UI_resources.h" + namespace blender::nodes::node_shader_attribute_cc { -/* **************** OUTPUT ******************** */ +static void node_declare(NodeDeclarationBuilder &b) +{ + b.add_output<decl::Color>(N_("Color")); + b.add_output<decl::Vector>(N_("Vector")); + b.add_output<decl::Float>(N_("Fac")); + b.add_output<decl::Float>(N_("Alpha")); +} -static bNodeSocketTemplate sh_node_attribute_out[] = { - {SOCK_RGBA, N_("Color")}, - {SOCK_VECTOR, N_("Vector"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, - {SOCK_FLOAT, N_("Fac"), 0.0f, 0.0f, 0.0f, 0.0f, -FLT_MAX, FLT_MAX, PROP_FACTOR}, - {SOCK_FLOAT, N_("Alpha"), 0.0f, 0.0f, 0.0f, 0.0f, -FLT_MAX, FLT_MAX, PROP_FACTOR}, - {-1, ""}, -}; +static void node_shader_buts_attribute(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) +{ + uiItemR(layout, ptr, "attribute_type", UI_ITEM_R_SPLIT_EMPTY_NAME, IFACE_("Type"), ICON_NONE); + uiItemR(layout, ptr, "attribute_name", UI_ITEM_R_SPLIT_EMPTY_NAME, IFACE_("Name"), ICON_NONE); +} static void node_shader_init_attribute(bNodeTree *UNUSED(ntree), bNode *node) { @@ -75,8 +82,8 @@ static int node_shader_gpu_attribute(GPUMaterial *mat, GPU_stack_link(mat, node, "node_attribute", in, out, cd_attr); - /* for each output. */ - for (int i = 0; sh_node_attribute_out[i].type != -1; i++) { + int i; + LISTBASE_FOREACH_INDEX (bNodeSocket *, sock, &node->outputs, i) { node_shader_gpu_bump_tex_coord(mat, node, &out[i].link); } @@ -93,7 +100,8 @@ void register_node_type_sh_attribute() static bNodeType ntype; sh_node_type_base(&ntype, SH_NODE_ATTRIBUTE, "Attribute", NODE_CLASS_INPUT); - node_type_socket_templates(&ntype, nullptr, file_ns::sh_node_attribute_out); + ntype.declare = file_ns::node_declare; + ntype.draw_buttons = file_ns::node_shader_buts_attribute; node_type_init(&ntype, file_ns::node_shader_init_attribute); node_type_storage( &ntype, "NodeShaderAttribute", node_free_standard_storage, node_copy_standard_storage); diff --git a/source/blender/nodes/shader/nodes/node_shader_background.cc b/source/blender/nodes/shader/nodes/node_shader_background.cc index 39858e36fd1..3b9e71cf842 100644 --- a/source/blender/nodes/shader/nodes/node_shader_background.cc +++ b/source/blender/nodes/shader/nodes/node_shader_background.cc @@ -21,18 +21,12 @@ namespace blender::nodes::node_shader_background_cc { -/* **************** OUTPUT ******************** */ - -static bNodeSocketTemplate sh_node_background_in[] = { - {SOCK_RGBA, N_("Color"), 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f}, - {SOCK_FLOAT, N_("Strength"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1000000.0f}, - {-1, ""}, -}; - -static bNodeSocketTemplate sh_node_background_out[] = { - {SOCK_SHADER, N_("Background")}, - {-1, ""}, -}; +static void node_declare(NodeDeclarationBuilder &b) +{ + b.add_input<decl::Color>(N_("Color")).default_value({0.8f, 0.8f, 0.8f, 1.0f}); + b.add_input<decl::Float>(N_("Strength")).default_value(1.0f).min(0.0f).max(1000000.0f); + b.add_output<decl::Shader>(N_("Background")); +} static int node_shader_gpu_background(GPUMaterial *mat, bNode *node, @@ -53,8 +47,7 @@ void register_node_type_sh_background() static bNodeType ntype; sh_node_type_base(&ntype, SH_NODE_BACKGROUND, "Background", NODE_CLASS_SHADER); - node_type_socket_templates( - &ntype, file_ns::sh_node_background_in, file_ns::sh_node_background_out); + ntype.declare = file_ns::node_declare; node_type_gpu(&ntype, file_ns::node_shader_gpu_background); nodeRegisterType(&ntype); diff --git a/source/blender/nodes/shader/nodes/node_shader_bevel.cc b/source/blender/nodes/shader/nodes/node_shader_bevel.cc index a3063358556..c4fa61753f5 100644 --- a/source/blender/nodes/shader/nodes/node_shader_bevel.cc +++ b/source/blender/nodes/shader/nodes/node_shader_bevel.cc @@ -19,20 +19,22 @@ #include "node_shader_util.hh" -namespace blender::nodes::node_shader_bevel_cc { +#include "UI_interface.h" +#include "UI_resources.h" -/* **************** OUTPUT ******************** */ +namespace blender::nodes::node_shader_bevel_cc { -static bNodeSocketTemplate sh_node_bevel_in[] = { - {SOCK_FLOAT, N_("Radius"), 0.05f, 0.0f, 0.0f, 0.0f, 0.0f, 1000.0f}, - {SOCK_VECTOR, N_("Normal"), 0.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f, PROP_NONE, SOCK_HIDE_VALUE}, - {-1, ""}, -}; +static void node_declare(NodeDeclarationBuilder &b) +{ + b.add_input<decl::Float>(N_("Radius")).default_value(0.05f).min(0.0f).max(1000.0f); + b.add_input<decl::Vector>(N_("Normal")).hide_value(); + b.add_output<decl::Vector>(N_("Normal")); +} -static bNodeSocketTemplate sh_node_bevel_out[] = { - {SOCK_VECTOR, N_("Normal"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, - {-1, ""}, -}; +static void node_shader_buts_bevel(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) +{ + uiItemR(layout, ptr, "samples", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); +} static void node_shader_init_bevel(bNodeTree *UNUSED(ntree), bNode *node) { @@ -66,7 +68,8 @@ void register_node_type_sh_bevel() static bNodeType ntype; sh_node_type_base(&ntype, SH_NODE_BEVEL, "Bevel", NODE_CLASS_INPUT); - node_type_socket_templates(&ntype, file_ns::sh_node_bevel_in, file_ns::sh_node_bevel_out); + ntype.declare = file_ns::node_declare; + ntype.draw_buttons = file_ns::node_shader_buts_bevel; node_type_init(&ntype, file_ns::node_shader_init_bevel); node_type_gpu(&ntype, file_ns::gpu_shader_bevel); diff --git a/source/blender/nodes/shader/nodes/node_shader_brightness.cc b/source/blender/nodes/shader/nodes/node_shader_brightness.cc index e6328c4972a..66bfaba2785 100644 --- a/source/blender/nodes/shader/nodes/node_shader_brightness.cc +++ b/source/blender/nodes/shader/nodes/node_shader_brightness.cc @@ -21,19 +21,13 @@ namespace blender::nodes::node_shader_brightness_cc { -/* **************** Bright and contrast ******************** */ - -static bNodeSocketTemplate sh_node_brightcontrast_in[] = { - {SOCK_RGBA, N_("Color"), 1.0f, 1.0f, 1.0f, 1.0f}, - {SOCK_FLOAT, N_("Bright"), 0.0f, 0.0f, 0.0f, 0.0f, -100.0f, 100.0f, PROP_NONE}, - {SOCK_FLOAT, N_("Contrast"), 0.0f, 0.0f, 0.0f, 0.0f, -100.0f, 100.0f, PROP_NONE}, - {-1, ""}, -}; - -static bNodeSocketTemplate sh_node_brightcontrast_out[] = { - {SOCK_RGBA, N_("Color")}, - {-1, ""}, -}; +static void node_declare(NodeDeclarationBuilder &b) +{ + b.add_input<decl::Color>(N_("Color")).default_value({1.0f, 1.0f, 1.0f, 1.0f}); + b.add_input<decl::Float>(N_("Bright")).default_value(0.0f).min(-100.0f).max(100.0f); + b.add_input<decl::Float>(N_("Contrast")).default_value(0.0f).min(-100.0f).max(100.0f); + b.add_output<decl::Color>(N_("Color")); +} static int gpu_shader_brightcontrast(GPUMaterial *mat, bNode *node, @@ -53,8 +47,7 @@ void register_node_type_sh_brightcontrast() static bNodeType ntype; sh_node_type_base(&ntype, SH_NODE_BRIGHTCONTRAST, "Bright/Contrast", NODE_CLASS_OP_COLOR); - node_type_socket_templates( - &ntype, file_ns::sh_node_brightcontrast_in, file_ns::sh_node_brightcontrast_out); + ntype.declare = file_ns::node_declare; node_type_gpu(&ntype, file_ns::gpu_shader_brightcontrast); nodeRegisterType(&ntype); diff --git a/source/blender/nodes/shader/nodes/node_shader_bsdf_anisotropic.cc b/source/blender/nodes/shader/nodes/node_shader_bsdf_anisotropic.cc index 2e698aeb4d7..3f0749ab2af 100644 --- a/source/blender/nodes/shader/nodes/node_shader_bsdf_anisotropic.cc +++ b/source/blender/nodes/shader/nodes/node_shader_bsdf_anisotropic.cc @@ -19,24 +19,34 @@ #include "node_shader_util.hh" -namespace blender::nodes::node_shader_bsdf_anisotropic_cc { +#include "UI_interface.h" +#include "UI_resources.h" -/* **************** OUTPUT ******************** */ +namespace blender::nodes::node_shader_bsdf_anisotropic_cc { -static bNodeSocketTemplate sh_node_bsdf_anisotropic_in[] = { - {SOCK_RGBA, N_("Color"), 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f}, - {SOCK_FLOAT, N_("Roughness"), 0.5f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR}, - {SOCK_FLOAT, N_("Anisotropy"), 0.5f, 0.0f, 0.0f, 0.0f, -1.0f, 1.0f}, - {SOCK_FLOAT, N_("Rotation"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR}, - {SOCK_VECTOR, N_("Normal"), 0.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f, PROP_NONE, SOCK_HIDE_VALUE}, - {SOCK_VECTOR, N_("Tangent"), 0.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f, PROP_NONE, SOCK_HIDE_VALUE}, - {-1, ""}, -}; +static void node_declare(NodeDeclarationBuilder &b) +{ + b.add_input<decl::Color>(N_("Color")).default_value({0.8f, 0.8f, 0.8f, 1.0f}); + b.add_input<decl::Float>(N_("Roughness")) + .default_value(0.5f) + .min(0.0f) + .max(1.0f) + .subtype(PROP_FACTOR); + b.add_input<decl::Float>(N_("Anisotropy")).default_value(0.5f).min(-1.0f).max(1.0f); + b.add_input<decl::Float>(N_("Rotation")) + .default_value(0.0f) + .min(0.0f) + .max(1.0f) + .subtype(PROP_FACTOR); + b.add_input<decl::Vector>(N_("Normal")).hide_value(); + b.add_input<decl::Vector>(N_("Tangent")).hide_value(); + b.add_output<decl::Shader>(N_("BSDF")); +} -static bNodeSocketTemplate sh_node_bsdf_anisotropic_out[] = { - {SOCK_SHADER, N_("BSDF")}, - {-1, ""}, -}; +static void node_shader_buts_anisotropic(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) +{ + uiItemR(layout, ptr, "distribution", UI_ITEM_R_SPLIT_EMPTY_NAME, "", ICON_NONE); +} static void node_shader_init_anisotropic(bNodeTree *UNUSED(ntree), bNode *node) { @@ -76,8 +86,8 @@ void register_node_type_sh_bsdf_anisotropic() static bNodeType ntype; sh_node_type_base(&ntype, SH_NODE_BSDF_ANISOTROPIC, "Anisotropic BSDF", NODE_CLASS_SHADER); - node_type_socket_templates( - &ntype, file_ns::sh_node_bsdf_anisotropic_in, file_ns::sh_node_bsdf_anisotropic_out); + ntype.declare = file_ns::node_declare; + ntype.draw_buttons = file_ns::node_shader_buts_anisotropic; node_type_size_preset(&ntype, NODE_SIZE_MIDDLE); node_type_init(&ntype, file_ns::node_shader_init_anisotropic); node_type_gpu(&ntype, file_ns::node_shader_gpu_bsdf_anisotropic); diff --git a/source/blender/nodes/shader/nodes/node_shader_bsdf_diffuse.cc b/source/blender/nodes/shader/nodes/node_shader_bsdf_diffuse.cc index 3719227f46c..5848ca76cdd 100644 --- a/source/blender/nodes/shader/nodes/node_shader_bsdf_diffuse.cc +++ b/source/blender/nodes/shader/nodes/node_shader_bsdf_diffuse.cc @@ -21,19 +21,17 @@ namespace blender::nodes::node_shader_bsdf_diffuse_cc { -/* **************** OUTPUT ******************** */ - -static bNodeSocketTemplate sh_node_bsdf_diffuse_in[] = { - {SOCK_RGBA, N_("Color"), 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f}, - {SOCK_FLOAT, N_("Roughness"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR}, - {SOCK_VECTOR, N_("Normal"), 0.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f, PROP_NONE, SOCK_HIDE_VALUE}, - {-1, ""}, -}; - -static bNodeSocketTemplate sh_node_bsdf_diffuse_out[] = { - {SOCK_SHADER, N_("BSDF")}, - {-1, ""}, -}; +static void node_declare(NodeDeclarationBuilder &b) +{ + b.add_input<decl::Color>(N_("Color")).default_value({0.8f, 0.8f, 0.8f, 1.0f}); + b.add_input<decl::Float>(N_("Roughness")) + .default_value(0.0f) + .min(0.0f) + .max(1.0f) + .subtype(PROP_FACTOR); + b.add_input<decl::Vector>(N_("Normal")).hide_value(); + b.add_output<decl::Shader>(N_("BSDF")); +} static int node_shader_gpu_bsdf_diffuse(GPUMaterial *mat, bNode *node, @@ -60,8 +58,7 @@ void register_node_type_sh_bsdf_diffuse() static bNodeType ntype; sh_node_type_base(&ntype, SH_NODE_BSDF_DIFFUSE, "Diffuse BSDF", NODE_CLASS_SHADER); - node_type_socket_templates( - &ntype, file_ns::sh_node_bsdf_diffuse_in, file_ns::sh_node_bsdf_diffuse_out); + ntype.declare = file_ns::node_declare; node_type_size_preset(&ntype, NODE_SIZE_MIDDLE); node_type_gpu(&ntype, file_ns::node_shader_gpu_bsdf_diffuse); diff --git a/source/blender/nodes/shader/nodes/node_shader_bsdf_glass.cc b/source/blender/nodes/shader/nodes/node_shader_bsdf_glass.cc index 2cea42146fd..47d4b87198b 100644 --- a/source/blender/nodes/shader/nodes/node_shader_bsdf_glass.cc +++ b/source/blender/nodes/shader/nodes/node_shader_bsdf_glass.cc @@ -21,20 +21,18 @@ namespace blender::nodes::node_shader_bsdf_glass_cc { -/* **************** OUTPUT ******************** */ - -static bNodeSocketTemplate sh_node_bsdf_glass_in[] = { - {SOCK_RGBA, N_("Color"), 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f}, - {SOCK_FLOAT, N_("Roughness"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR}, - {SOCK_FLOAT, N_("IOR"), 1.45f, 0.0f, 0.0f, 0.0f, 0.0f, 1000.0f}, - {SOCK_VECTOR, N_("Normal"), 0.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f, PROP_NONE, SOCK_HIDE_VALUE}, - {-1, ""}, -}; - -static bNodeSocketTemplate sh_node_bsdf_glass_out[] = { - {SOCK_SHADER, N_("BSDF")}, - {-1, ""}, -}; +static void node_declare(NodeDeclarationBuilder &b) +{ + b.add_input<decl::Color>(N_("Color")).default_value({1.0f, 1.0f, 1.0f, 1.0f}); + b.add_input<decl::Float>(N_("Roughness")) + .default_value(0.0f) + .min(0.0f) + .max(1.0f) + .subtype(PROP_FACTOR); + b.add_input<decl::Float>(N_("IOR")).default_value(1.45f).min(0.0f).max(1000.0f); + b.add_input<decl::Vector>(N_("Normal")).hide_value(); + b.add_output<decl::Shader>(N_("BSDF")); +} static void node_shader_init_glass(bNodeTree *UNUSED(ntree), bNode *node) { @@ -78,8 +76,7 @@ void register_node_type_sh_bsdf_glass() static bNodeType ntype; sh_node_type_base(&ntype, SH_NODE_BSDF_GLASS, "Glass BSDF", NODE_CLASS_SHADER); - node_type_socket_templates( - &ntype, file_ns::sh_node_bsdf_glass_in, file_ns::sh_node_bsdf_glass_out); + ntype.declare = file_ns::node_declare; node_type_size_preset(&ntype, NODE_SIZE_MIDDLE); node_type_init(&ntype, file_ns::node_shader_init_glass); node_type_gpu(&ntype, file_ns::node_shader_gpu_bsdf_glass); diff --git a/source/blender/nodes/shader/nodes/node_shader_bsdf_glossy.cc b/source/blender/nodes/shader/nodes/node_shader_bsdf_glossy.cc index 1227d79af93..03a3e634f56 100644 --- a/source/blender/nodes/shader/nodes/node_shader_bsdf_glossy.cc +++ b/source/blender/nodes/shader/nodes/node_shader_bsdf_glossy.cc @@ -21,19 +21,17 @@ namespace blender::nodes::node_shader_bsdf_glossy_cc { -/* **************** OUTPUT ******************** */ - -static bNodeSocketTemplate sh_node_bsdf_glossy_in[] = { - {SOCK_RGBA, N_("Color"), 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f}, - {SOCK_FLOAT, N_("Roughness"), 0.5f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR}, - {SOCK_VECTOR, N_("Normal"), 0.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f, PROP_NONE, SOCK_HIDE_VALUE}, - {-1, ""}, -}; - -static bNodeSocketTemplate sh_node_bsdf_glossy_out[] = { - {SOCK_SHADER, N_("BSDF")}, - {-1, ""}, -}; +static void node_declare(NodeDeclarationBuilder &b) +{ + b.add_input<decl::Color>(N_("Color")).default_value({0.8f, 0.8f, 0.8f, 1.0f}); + b.add_input<decl::Float>(N_("Roughness")) + .default_value(0.5f) + .min(0.0f) + .max(1.0f) + .subtype(PROP_FACTOR); + b.add_input<decl::Vector>(N_("Normal")).hide_value(); + b.add_output<decl::Shader>(N_("BSDF")); +} static void node_shader_init_glossy(bNodeTree *UNUSED(ntree), bNode *node) { @@ -77,8 +75,7 @@ void register_node_type_sh_bsdf_glossy() static bNodeType ntype; sh_node_type_base(&ntype, SH_NODE_BSDF_GLOSSY, "Glossy BSDF", NODE_CLASS_SHADER); - node_type_socket_templates( - &ntype, file_ns::sh_node_bsdf_glossy_in, file_ns::sh_node_bsdf_glossy_out); + ntype.declare = file_ns::node_declare; node_type_size_preset(&ntype, NODE_SIZE_MIDDLE); node_type_init(&ntype, file_ns::node_shader_init_glossy); node_type_gpu(&ntype, file_ns::node_shader_gpu_bsdf_glossy); diff --git a/source/blender/nodes/shader/nodes/node_shader_bsdf_hair.cc b/source/blender/nodes/shader/nodes/node_shader_bsdf_hair.cc index 56282d1c991..3be2bd22f60 100644 --- a/source/blender/nodes/shader/nodes/node_shader_bsdf_hair.cc +++ b/source/blender/nodes/shader/nodes/node_shader_bsdf_hair.cc @@ -19,23 +19,37 @@ #include "node_shader_util.hh" -namespace blender::nodes::node_shader_bsdf_hair_cc { +#include "UI_interface.h" +#include "UI_resources.h" -/* **************** OUTPUT ******************** */ +namespace blender::nodes::node_shader_bsdf_hair_cc { -static bNodeSocketTemplate sh_node_bsdf_hair_in[] = { - {SOCK_RGBA, N_("Color"), 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f}, - {SOCK_FLOAT, N_("Offset"), 0.0f, 0.0f, 0.0f, 0.0f, -M_PI_2, M_PI_2, PROP_ANGLE}, - {SOCK_FLOAT, N_("RoughnessU"), 0.1f, 0.1f, 0.1f, 0.0f, 0.0f, 1.0f, PROP_FACTOR}, - {SOCK_FLOAT, N_("RoughnessV"), 1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR}, - {SOCK_VECTOR, N_("Tangent"), 0.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f, PROP_NONE, SOCK_HIDE_VALUE}, - {-1, ""}, -}; +static void node_declare(NodeDeclarationBuilder &b) +{ + b.add_input<decl::Color>(N_("Color")).default_value({0.8f, 0.8f, 0.8f, 1.0f}); + b.add_input<decl::Float>(N_("Offset")) + .default_value(0.0f) + .min(-M_PI_2) + .max(M_PI_2) + .subtype(PROP_ANGLE); + b.add_input<decl::Float>(N_("RoughnessU")) + .default_value(0.1f) + .min(0.0f) + .max(1.0f) + .subtype(PROP_FACTOR); + b.add_input<decl::Float>(N_("RoughnessV")) + .default_value(1.0f) + .min(0.0f) + .max(1.0f) + .subtype(PROP_FACTOR); + b.add_input<decl::Vector>(N_("Tangent")).hide_value(); + b.add_output<decl::Shader>(N_("BSDF")); +} -static bNodeSocketTemplate sh_node_bsdf_hair_out[] = { - {SOCK_SHADER, N_("BSDF")}, - {-1, ""}, -}; +static void node_shader_buts_hair(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) +{ + uiItemR(layout, ptr, "component", UI_ITEM_R_SPLIT_EMPTY_NAME, "", ICON_NONE); +} static int node_shader_gpu_bsdf_hair(GPUMaterial *mat, bNode *node, @@ -56,8 +70,8 @@ void register_node_type_sh_bsdf_hair() static bNodeType ntype; sh_node_type_base(&ntype, SH_NODE_BSDF_HAIR, "Hair BSDF", NODE_CLASS_SHADER); - node_type_socket_templates( - &ntype, file_ns::sh_node_bsdf_hair_in, file_ns::sh_node_bsdf_hair_out); + ntype.declare = file_ns::node_declare; + ntype.draw_buttons = file_ns::node_shader_buts_hair; node_type_size(&ntype, 150, 60, 200); node_type_gpu(&ntype, file_ns::node_shader_gpu_bsdf_hair); diff --git a/source/blender/nodes/shader/nodes/node_shader_bsdf_hair_principled.cc b/source/blender/nodes/shader/nodes/node_shader_bsdf_hair_principled.cc index 16d48144578..7062888b5fb 100644 --- a/source/blender/nodes/shader/nodes/node_shader_bsdf_hair_principled.cc +++ b/source/blender/nodes/shader/nodes/node_shader_bsdf_hair_principled.cc @@ -19,40 +19,72 @@ #include "node_shader_util.hh" -namespace blender::nodes::node_shader_bsdf_hair_principled_cc { +#include "UI_interface.h" +#include "UI_resources.h" -/* **************** OUTPUT ******************** */ +namespace blender::nodes::node_shader_bsdf_hair_principled_cc { /* Color, melanin and absorption coefficient default to approximately same brownish hair. */ -static bNodeSocketTemplate sh_node_bsdf_hair_principled_in[] = { - {SOCK_RGBA, N_("Color"), 0.017513f, 0.005763f, 0.002059f, 1.0f, 0.0f, 1.0f}, - {SOCK_FLOAT, N_("Melanin"), 0.8f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR}, - {SOCK_FLOAT, N_("Melanin Redness"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR}, - {SOCK_RGBA, N_("Tint"), 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f}, - {SOCK_VECTOR, N_("Absorption Coefficient"), 0.245531f, 0.52f, 1.365f, 0.0f, 0.0f, 1000.0f}, - {SOCK_FLOAT, N_("Roughness"), 0.3f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR}, - {SOCK_FLOAT, N_("Radial Roughness"), 0.3f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR}, - {SOCK_FLOAT, N_("Coat"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR}, - {SOCK_FLOAT, N_("IOR"), 1.55f, 0.0f, 0.0f, 0.0f, 0.0f, 1000.0f}, - {SOCK_FLOAT, - N_("Offset"), - 2.0f * ((float)M_PI) / 180.0f, - 0.0f, - 0.0f, - 0.0f, - -M_PI_2, - M_PI_2, - PROP_ANGLE}, - {SOCK_FLOAT, N_("Random Color"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR}, - {SOCK_FLOAT, N_("Random Roughness"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR}, - {SOCK_FLOAT, N_("Random"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE, SOCK_HIDE_VALUE}, - {-1, ""}, -}; +static void node_declare(NodeDeclarationBuilder &b) +{ + b.add_input<decl::Color>(N_("Color")).default_value({0.017513f, 0.005763f, 0.002059f, 1.0f}); + b.add_input<decl::Float>(N_("Melanin")) + .default_value(0.8f) + .min(0.0f) + .max(1.0f) + .subtype(PROP_FACTOR); + b.add_input<decl::Float>(N_("Melanin Redness")) + .default_value(1.0f) + .min(0.0f) + .max(1.0f) + .subtype(PROP_FACTOR); + b.add_input<decl::Color>(N_("Tint")).default_value({1.0f, 1.0f, 1.0f, 1.0f}); + b.add_input<decl::Vector>(N_("Absorption Coefficient")) + .default_value({0.245531f, 0.52f, 1.365f}) + .min(0.0f) + .max(1000.0f); + b.add_input<decl::Float>(N_("Roughness")) + .default_value(0.3f) + .min(0.0f) + .max(1.0f) + .subtype(PROP_FACTOR); + b.add_input<decl::Float>(N_("Radial Roughness")) + .default_value(0.3f) + .min(0.0f) + .max(1.0f) + .subtype(PROP_FACTOR); + b.add_input<decl::Float>(N_("Coat")) + .default_value(0.0f) + .min(0.0f) + .max(1.0f) + .subtype(PROP_FACTOR); + b.add_input<decl::Float>(N_("IOR")).default_value(1.55f).min(0.0f).max(1000.0f).subtype( + PROP_FACTOR); + b.add_input<decl::Float>(N_("Offset")) + .default_value(2.0f * ((float)M_PI) / 180.0f) + .min(-M_PI_2) + .max(M_PI_2) + .subtype(PROP_ANGLE); + b.add_input<decl::Float>(N_("Random Color")) + .default_value(0.0f) + .min(0.0f) + .max(1.0f) + .subtype(PROP_FACTOR); + b.add_input<decl::Float>(N_("Random Roughness")) + .default_value(0.0f) + .min(0.0f) + .max(1.0f) + .subtype(PROP_FACTOR); + b.add_input<decl::Float>(N_("Random")).hide_value(); + b.add_output<decl::Shader>(N_("BSDF")); +} -static bNodeSocketTemplate sh_node_bsdf_hair_principled_out[] = { - {SOCK_SHADER, N_("BSDF")}, - {-1, ""}, -}; +static void node_shader_buts_principled_hair(uiLayout *layout, + bContext *UNUSED(C), + PointerRNA *ptr) +{ + uiItemR(layout, ptr, "parametrization", UI_ITEM_R_SPLIT_EMPTY_NAME, "", ICON_NONE); +} /* Initialize the custom Parametrization property to Color. */ static void node_shader_init_hair_principled(bNodeTree *UNUSED(ntree), bNode *node) @@ -103,8 +135,8 @@ void register_node_type_sh_bsdf_hair_principled() sh_node_type_base( &ntype, SH_NODE_BSDF_HAIR_PRINCIPLED, "Principled Hair BSDF", NODE_CLASS_SHADER); - node_type_socket_templates( - &ntype, file_ns::sh_node_bsdf_hair_principled_in, file_ns::sh_node_bsdf_hair_principled_out); + ntype.declare = file_ns::node_declare; + ntype.draw_buttons = file_ns::node_shader_buts_principled_hair; node_type_size_preset(&ntype, NODE_SIZE_LARGE); node_type_init(&ntype, file_ns::node_shader_init_hair_principled); node_type_update(&ntype, file_ns::node_shader_update_hair_principled); diff --git a/source/blender/nodes/shader/nodes/node_shader_bsdf_principled.cc b/source/blender/nodes/shader/nodes/node_shader_bsdf_principled.cc index 72b2c278635..4c378d9bc09 100644 --- a/source/blender/nodes/shader/nodes/node_shader_bsdf_principled.cc +++ b/source/blender/nodes/shader/nodes/node_shader_bsdf_principled.cc @@ -19,61 +19,114 @@ #include "node_shader_util.hh" +#include "UI_interface.h" +#include "UI_resources.h" + namespace blender::nodes::node_shader_bsdf_principled_cc { -/* **************** OUTPUT ******************** */ - -static bNodeSocketTemplate sh_node_bsdf_principled_in[] = { - {SOCK_RGBA, N_("Base Color"), 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f}, - {SOCK_FLOAT, N_("Subsurface"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR}, - {SOCK_VECTOR, - N_("Subsurface Radius"), - 1.0f, - 0.2f, - 0.1f, - 0.0f, - 0.0f, - 100.0f, - PROP_NONE, - SOCK_COMPACT}, - {SOCK_RGBA, N_("Subsurface Color"), 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f}, - {SOCK_FLOAT, N_("Subsurface IOR"), 1.4f, 0.0f, 0.0f, 0.0f, 1.01f, 3.8f, PROP_FACTOR}, - {SOCK_FLOAT, N_("Subsurface Anisotropy"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR}, - {SOCK_FLOAT, N_("Metallic"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR}, - {SOCK_FLOAT, N_("Specular"), 0.5f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR}, - {SOCK_FLOAT, N_("Specular Tint"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR}, - {SOCK_FLOAT, N_("Roughness"), 0.5f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR}, - {SOCK_FLOAT, N_("Anisotropic"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR}, - {SOCK_FLOAT, N_("Anisotropic Rotation"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR}, - {SOCK_FLOAT, N_("Sheen"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR}, - {SOCK_FLOAT, N_("Sheen Tint"), 0.5f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR}, - {SOCK_FLOAT, N_("Clearcoat"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR}, - {SOCK_FLOAT, N_("Clearcoat Roughness"), 0.03f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR}, - {SOCK_FLOAT, N_("IOR"), 1.45f, 0.0f, 0.0f, 0.0f, 0.0f, 1000.0f}, - {SOCK_FLOAT, N_("Transmission"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR}, - {SOCK_FLOAT, N_("Transmission Roughness"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR}, - {SOCK_RGBA, N_("Emission"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f}, - {SOCK_FLOAT, N_("Emission Strength"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1000000.0f}, - {SOCK_FLOAT, N_("Alpha"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR}, - {SOCK_VECTOR, N_("Normal"), 0.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f, PROP_NONE, SOCK_HIDE_VALUE}, - {SOCK_VECTOR, - N_("Clearcoat Normal"), - 0.0f, - 0.0f, - 0.0f, - 1.0f, - -1.0f, - 1.0f, - PROP_NONE, - SOCK_HIDE_VALUE}, - {SOCK_VECTOR, N_("Tangent"), 0.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f, PROP_NONE, SOCK_HIDE_VALUE}, - {-1, ""}, -}; - -static bNodeSocketTemplate sh_node_bsdf_principled_out[] = { - {SOCK_SHADER, N_("BSDF")}, - {-1, ""}, -}; +static void node_declare(NodeDeclarationBuilder &b) +{ + b.add_input<decl::Color>(N_("Base Color")).default_value({0.8f, 0.8f, 0.8f, 1.0f}); + b.add_input<decl::Float>(N_("Subsurface")) + .default_value(0.0f) + .min(0.0f) + .max(1.0f) + .subtype(PROP_FACTOR); + b.add_input<decl::Vector>(N_("Subsurface Radius")) + .default_value({1.0f, 0.2f, 0.1f}) + .min(0.0f) + .max(100.0f) + .compact(); + b.add_input<decl::Color>(N_("Subsurface Color")).default_value({0.8f, 0.8f, 0.8f, 1.0f}); + b.add_input<decl::Float>(N_("Subsurface IOR")) + .default_value(1.4f) + .min(1.01f) + .max(3.8f) + .subtype(PROP_FACTOR); + b.add_input<decl::Float>(N_("Subsurface Anisotropy")) + .default_value(0.0f) + .min(0.0f) + .max(1.0f) + .subtype(PROP_FACTOR); + b.add_input<decl::Float>(N_("Metallic")) + .default_value(0.0f) + .min(0.0f) + .max(1.0f) + .subtype(PROP_FACTOR); + b.add_input<decl::Float>(N_("Specular")) + .default_value(0.5f) + .min(0.0f) + .max(1.0f) + .subtype(PROP_FACTOR); + b.add_input<decl::Float>(N_("Specular Tint")) + .default_value(0.5f) + .min(0.0f) + .max(1.0f) + .subtype(PROP_FACTOR); + b.add_input<decl::Float>(N_("Roughness")) + .default_value(0.5f) + .min(0.0f) + .max(1.0f) + .subtype(PROP_FACTOR); + b.add_input<decl::Float>(N_("Anisotropic")) + .default_value(0.0f) + .min(0.0f) + .max(1.0f) + .subtype(PROP_FACTOR); + b.add_input<decl::Float>(N_("Anisotropic Rotation")) + .default_value(0.0f) + .min(0.0f) + .max(1.0f) + .subtype(PROP_FACTOR); + b.add_input<decl::Float>(N_("Sheen")) + .default_value(0.0f) + .min(0.0f) + .max(1.0f) + .subtype(PROP_FACTOR); + b.add_input<decl::Float>(N_("Sheen Tint")) + .default_value(0.5f) + .min(0.0f) + .max(1.0f) + .subtype(PROP_FACTOR); + b.add_input<decl::Float>(N_("Clearcoat")) + .default_value(0.0f) + .min(0.0f) + .max(1.0f) + .subtype(PROP_FACTOR); + b.add_input<decl::Float>(N_("Clearcoat Roughness")) + .default_value(0.03f) + .min(0.0f) + .max(1.0f) + .subtype(PROP_FACTOR); + b.add_input<decl::Float>(N_("IOR")).default_value(1.45f).min(0.0f).max(1000.0f); + b.add_input<decl::Float>(N_("Transmission")) + .default_value(0.0f) + .min(0.0f) + .max(1.0f) + .subtype(PROP_FACTOR); + b.add_input<decl::Float>(N_("Transmission Roughness")) + .default_value(0.0f) + .min(0.0f) + .max(1.0f) + .subtype(PROP_FACTOR); + b.add_input<decl::Color>(N_("Emission")).default_value({0.0f, 0.0f, 0.0f, 1.0f}); + b.add_input<decl::Float>(N_("Emission Strength")).default_value(1.0).min(0.0f).max(1000000.0f); + b.add_input<decl::Float>(N_("Alpha")) + .default_value(1.0f) + .min(0.0f) + .max(1.0f) + .subtype(PROP_FACTOR); + b.add_input<decl::Vector>(N_("Normal")).hide_value(); + b.add_input<decl::Vector>(N_("Clearcoat Normal")).hide_value(); + b.add_input<decl::Vector>(N_("Tangent")).hide_value(); + b.add_output<decl::Shader>(N_("BSDF")); +} + +static void node_shader_buts_principled(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) +{ + uiItemR(layout, ptr, "distribution", UI_ITEM_R_SPLIT_EMPTY_NAME, "", ICON_NONE); + uiItemR(layout, ptr, "subsurface_method", UI_ITEM_R_SPLIT_EMPTY_NAME, "", ICON_NONE); +} static void node_shader_init_principled(bNodeTree *UNUSED(ntree), bNode *node) { @@ -195,8 +248,8 @@ void register_node_type_sh_bsdf_principled() static bNodeType ntype; sh_node_type_base(&ntype, SH_NODE_BSDF_PRINCIPLED, "Principled BSDF", NODE_CLASS_SHADER); - node_type_socket_templates( - &ntype, file_ns::sh_node_bsdf_principled_in, file_ns::sh_node_bsdf_principled_out); + ntype.declare = file_ns::node_declare; + ntype.draw_buttons = file_ns::node_shader_buts_principled; node_type_size_preset(&ntype, NODE_SIZE_LARGE); node_type_init(&ntype, file_ns::node_shader_init_principled); node_type_gpu(&ntype, file_ns::node_shader_gpu_bsdf_principled); diff --git a/source/blender/nodes/shader/nodes/node_shader_bsdf_refraction.cc b/source/blender/nodes/shader/nodes/node_shader_bsdf_refraction.cc index 63bca201898..0d588c82869 100644 --- a/source/blender/nodes/shader/nodes/node_shader_bsdf_refraction.cc +++ b/source/blender/nodes/shader/nodes/node_shader_bsdf_refraction.cc @@ -21,20 +21,18 @@ namespace blender::nodes::node_shader_bsdf_refraction_cc { -/* **************** OUTPUT ******************** */ - -static bNodeSocketTemplate sh_node_bsdf_refraction_in[] = { - {SOCK_RGBA, N_("Color"), 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f}, - {SOCK_FLOAT, N_("Roughness"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR}, - {SOCK_FLOAT, N_("IOR"), 1.45f, 0.0f, 0.0f, 0.0f, 0.0f, 1000.0f}, - {SOCK_VECTOR, N_("Normal"), 0.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f, PROP_NONE, SOCK_HIDE_VALUE}, - {-1, ""}, -}; - -static bNodeSocketTemplate sh_node_bsdf_refraction_out[] = { - {SOCK_SHADER, N_("BSDF")}, - {-1, ""}, -}; +static void node_declare(NodeDeclarationBuilder &b) +{ + b.add_input<decl::Color>(N_("Color")).default_value({1.0f, 1.0f, 1.0f, 1.0f}); + b.add_input<decl::Float>(N_("Roughness")) + .default_value(0.0f) + .min(0.0f) + .max(1.0f) + .subtype(PROP_FACTOR); + b.add_input<decl::Float>(N_("IOR")).default_value(1.45f).min(0.0f).max(1000.0f); + b.add_input<decl::Vector>(N_("Normal")).hide_value(); + b.add_output<decl::Shader>(N_("BSDF")); +} static void node_shader_init_refraction(bNodeTree *UNUSED(ntree), bNode *node) { @@ -70,8 +68,7 @@ void register_node_type_sh_bsdf_refraction() static bNodeType ntype; sh_node_type_base(&ntype, SH_NODE_BSDF_REFRACTION, "Refraction BSDF", NODE_CLASS_SHADER); - node_type_socket_templates( - &ntype, file_ns::sh_node_bsdf_refraction_in, file_ns::sh_node_bsdf_refraction_out); + ntype.declare = file_ns::node_declare; node_type_size_preset(&ntype, NODE_SIZE_MIDDLE); node_type_init(&ntype, file_ns::node_shader_init_refraction); node_type_gpu(&ntype, file_ns::node_shader_gpu_bsdf_refraction); diff --git a/source/blender/nodes/shader/nodes/node_shader_bsdf_toon.cc b/source/blender/nodes/shader/nodes/node_shader_bsdf_toon.cc index 270288c3ce0..5093b896764 100644 --- a/source/blender/nodes/shader/nodes/node_shader_bsdf_toon.cc +++ b/source/blender/nodes/shader/nodes/node_shader_bsdf_toon.cc @@ -19,22 +19,32 @@ #include "node_shader_util.hh" -namespace blender::nodes::node_shader_bsdf_toon_cc { +#include "UI_interface.h" +#include "UI_resources.h" -/* **************** OUTPUT ******************** */ +namespace blender::nodes::node_shader_bsdf_toon_cc { -static bNodeSocketTemplate sh_node_bsdf_toon_in[] = { - {SOCK_RGBA, N_("Color"), 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f}, - {SOCK_FLOAT, N_("Size"), 0.5f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR}, - {SOCK_FLOAT, N_("Smooth"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR}, - {SOCK_VECTOR, N_("Normal"), 0.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f, PROP_NONE, SOCK_HIDE_VALUE}, - {-1, ""}, -}; +static void node_declare(NodeDeclarationBuilder &b) +{ + b.add_input<decl::Color>(N_("Color")).default_value({0.8f, 0.8f, 0.8f, 1.0f}); + b.add_input<decl::Float>(N_("Size")) + .default_value(0.5f) + .min(0.0f) + .max(1.0f) + .subtype(PROP_FACTOR); + b.add_input<decl::Float>(N_("Smooth")) + .default_value(0.0f) + .min(0.0f) + .max(1.0f) + .subtype(PROP_FACTOR); + b.add_input<decl::Vector>(N_("Normal")).hide_value(); + b.add_output<decl::Shader>(N_("BSDF")); +} -static bNodeSocketTemplate sh_node_bsdf_toon_out[] = { - {SOCK_SHADER, N_("BSDF")}, - {-1, ""}, -}; +static void node_shader_buts_toon(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) +{ + uiItemR(layout, ptr, "component", UI_ITEM_R_SPLIT_EMPTY_NAME, "", ICON_NONE); +} static int node_shader_gpu_bsdf_toon(GPUMaterial *mat, bNode *node, @@ -61,8 +71,8 @@ void register_node_type_sh_bsdf_toon() static bNodeType ntype; sh_node_type_base(&ntype, SH_NODE_BSDF_TOON, "Toon BSDF", NODE_CLASS_SHADER); - node_type_socket_templates( - &ntype, file_ns::sh_node_bsdf_toon_in, file_ns::sh_node_bsdf_toon_out); + ntype.declare = file_ns::node_declare; + ntype.draw_buttons = file_ns::node_shader_buts_toon; node_type_size_preset(&ntype, NODE_SIZE_MIDDLE); node_type_gpu(&ntype, file_ns::node_shader_gpu_bsdf_toon); diff --git a/source/blender/nodes/shader/nodes/node_shader_bsdf_translucent.cc b/source/blender/nodes/shader/nodes/node_shader_bsdf_translucent.cc index 421c7c16032..22891738299 100644 --- a/source/blender/nodes/shader/nodes/node_shader_bsdf_translucent.cc +++ b/source/blender/nodes/shader/nodes/node_shader_bsdf_translucent.cc @@ -21,18 +21,12 @@ namespace blender::nodes::node_shader_bsdf_translucent_cc { -/* **************** OUTPUT ******************** */ - -static bNodeSocketTemplate sh_node_bsdf_translucent_in[] = { - {SOCK_RGBA, N_("Color"), 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f}, - {SOCK_VECTOR, N_("Normal"), 0.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f, PROP_NONE, SOCK_HIDE_VALUE}, - {-1, ""}, -}; - -static bNodeSocketTemplate sh_node_bsdf_translucent_out[] = { - {SOCK_SHADER, N_("BSDF")}, - {-1, ""}, -}; +static void node_declare(NodeDeclarationBuilder &b) +{ + b.add_input<decl::Color>(N_("Color")).default_value({0.8f, 0.8f, 0.8f, 1.0f}); + b.add_input<decl::Vector>(N_("Normal")).hide_value(); + b.add_output<decl::Shader>(N_("BSDF")); +} static int node_shader_gpu_bsdf_translucent(GPUMaterial *mat, bNode *node, @@ -59,8 +53,7 @@ void register_node_type_sh_bsdf_translucent() static bNodeType ntype; sh_node_type_base(&ntype, SH_NODE_BSDF_TRANSLUCENT, "Translucent BSDF", NODE_CLASS_SHADER); - node_type_socket_templates( - &ntype, file_ns::sh_node_bsdf_translucent_in, file_ns::sh_node_bsdf_translucent_out); + ntype.declare = file_ns::node_declare; node_type_gpu(&ntype, file_ns::node_shader_gpu_bsdf_translucent); nodeRegisterType(&ntype); diff --git a/source/blender/nodes/shader/nodes/node_shader_bsdf_transparent.cc b/source/blender/nodes/shader/nodes/node_shader_bsdf_transparent.cc index d1dc1856863..d764f4dd76b 100644 --- a/source/blender/nodes/shader/nodes/node_shader_bsdf_transparent.cc +++ b/source/blender/nodes/shader/nodes/node_shader_bsdf_transparent.cc @@ -21,17 +21,11 @@ namespace blender::nodes::node_shader_bsdf_transparent_cc { -/* **************** OUTPUT ******************** */ - -static bNodeSocketTemplate sh_node_bsdf_transparent_in[] = { - {SOCK_RGBA, N_("Color"), 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f}, - {-1, ""}, -}; - -static bNodeSocketTemplate sh_node_bsdf_transparent_out[] = { - {SOCK_SHADER, N_("BSDF")}, - {-1, ""}, -}; +static void node_declare(NodeDeclarationBuilder &b) +{ + b.add_input<decl::Color>(N_("Color")).default_value({1.0f, 1.0f, 1.0f, 1.0f}); + b.add_output<decl::Shader>(N_("BSDF")); +} static int node_shader_gpu_bsdf_transparent(GPUMaterial *mat, bNode *node, @@ -52,8 +46,7 @@ void register_node_type_sh_bsdf_transparent() static bNodeType ntype; sh_node_type_base(&ntype, SH_NODE_BSDF_TRANSPARENT, "Transparent BSDF", NODE_CLASS_SHADER); - node_type_socket_templates( - &ntype, file_ns::sh_node_bsdf_transparent_in, file_ns::sh_node_bsdf_transparent_out); + ntype.declare = file_ns::node_declare; node_type_gpu(&ntype, file_ns::node_shader_gpu_bsdf_transparent); nodeRegisterType(&ntype); diff --git a/source/blender/nodes/shader/nodes/node_shader_bsdf_velvet.cc b/source/blender/nodes/shader/nodes/node_shader_bsdf_velvet.cc index 6293f38d792..dd090236c08 100644 --- a/source/blender/nodes/shader/nodes/node_shader_bsdf_velvet.cc +++ b/source/blender/nodes/shader/nodes/node_shader_bsdf_velvet.cc @@ -21,19 +21,17 @@ namespace blender::nodes::node_shader_bsdf_velvet_cc { -/* **************** OUTPUT ******************** */ - -static bNodeSocketTemplate sh_node_bsdf_velvet_in[] = { - {SOCK_RGBA, N_("Color"), 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f}, - {SOCK_FLOAT, N_("Sigma"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR}, - {SOCK_VECTOR, N_("Normal"), 0.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f, PROP_NONE, SOCK_HIDE_VALUE}, - {-1, ""}, -}; - -static bNodeSocketTemplate sh_node_bsdf_velvet_out[] = { - {SOCK_SHADER, N_("BSDF")}, - {-1, ""}, -}; +static void node_declare(NodeDeclarationBuilder &b) +{ + b.add_input<decl::Color>(N_("Color")).default_value({0.8f, 0.8f, 0.8f, 1.0f}); + b.add_input<decl::Float>(N_("Sigma")) + .default_value(1.0f) + .min(0.0f) + .max(1.0f) + .subtype(PROP_FACTOR); + b.add_input<decl::Vector>(N_("Normal")).hide_value(); + b.add_output<decl::Shader>(N_("BSDF")); +} static int node_shader_gpu_bsdf_velvet(GPUMaterial *mat, bNode *node, @@ -60,8 +58,7 @@ void register_node_type_sh_bsdf_velvet() static bNodeType ntype; sh_node_type_base(&ntype, SH_NODE_BSDF_VELVET, "Velvet BSDF", NODE_CLASS_SHADER); - node_type_socket_templates( - &ntype, file_ns::sh_node_bsdf_velvet_in, file_ns::sh_node_bsdf_velvet_out); + ntype.declare = file_ns::node_declare; node_type_gpu(&ntype, file_ns::node_shader_gpu_bsdf_velvet); nodeRegisterType(&ntype); diff --git a/source/blender/nodes/shader/nodes/node_shader_bump.cc b/source/blender/nodes/shader/nodes/node_shader_bump.cc index 7718b21af52..252abd02ad7 100644 --- a/source/blender/nodes/shader/nodes/node_shader_bump.cc +++ b/source/blender/nodes/shader/nodes/node_shader_bump.cc @@ -23,6 +23,9 @@ #include "node_shader_util.hh" +#include "UI_interface.h" +#include "UI_resources.h" + /* **************** BUMP ******************** */ namespace blender::nodes::node_shader_bump_cc { @@ -46,6 +49,11 @@ static void node_declare(NodeDeclarationBuilder &b) b.add_output<decl::Vector>(N_("Normal")); } +static void node_shader_buts_bump(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) +{ + uiItemR(layout, ptr, "invert", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, 0); +} + static int gpu_shader_bump(GPUMaterial *mat, bNode *node, bNodeExecData *UNUSED(execdata), @@ -73,6 +81,7 @@ void register_node_type_sh_bump() sh_node_type_base(&ntype, SH_NODE_BUMP, "Bump", NODE_CLASS_OP_VECTOR); ntype.declare = file_ns::node_declare; + ntype.draw_buttons = file_ns::node_shader_buts_bump; node_type_gpu(&ntype, file_ns::gpu_shader_bump); nodeRegisterType(&ntype); diff --git a/source/blender/nodes/shader/nodes/node_shader_clamp.cc b/source/blender/nodes/shader/nodes/node_shader_clamp.cc index f4c72f0616f..cd0f1b3c44d 100644 --- a/source/blender/nodes/shader/nodes/node_shader_clamp.cc +++ b/source/blender/nodes/shader/nodes/node_shader_clamp.cc @@ -23,6 +23,9 @@ #include "node_shader_util.hh" +#include "UI_interface.h" +#include "UI_resources.h" + namespace blender::nodes::node_shader_clamp_cc { static void sh_node_clamp_declare(NodeDeclarationBuilder &b) @@ -32,7 +35,12 @@ static void sh_node_clamp_declare(NodeDeclarationBuilder &b) b.add_input<decl::Float>(N_("Min")).default_value(0.0f).min(-10000.0f).max(10000.0f); b.add_input<decl::Float>(N_("Max")).default_value(1.0f).min(-10000.0f).max(10000.0f); b.add_output<decl::Float>(N_("Result")); -}; +} + +static void node_shader_buts_clamp(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) +{ + uiItemR(layout, ptr, "clamp_type", UI_ITEM_R_SPLIT_EMPTY_NAME, "", ICON_NONE); +} static void node_shader_init_clamp(bNodeTree *UNUSED(ntree), bNode *node) { @@ -83,6 +91,7 @@ void register_node_type_sh_clamp() sh_fn_node_type_base(&ntype, SH_NODE_CLAMP, "Clamp", NODE_CLASS_CONVERTER); ntype.declare = file_ns::sh_node_clamp_declare; + ntype.draw_buttons = file_ns::node_shader_buts_clamp; node_type_init(&ntype, file_ns::node_shader_init_clamp); node_type_gpu(&ntype, file_ns::gpu_shader_clamp); ntype.build_multi_function = file_ns::sh_node_clamp_build_multi_function; diff --git a/source/blender/nodes/shader/nodes/node_shader_color_ramp.cc b/source/blender/nodes/shader/nodes/node_shader_color_ramp.cc index 353cbf4ca15..d8c43e1d66b 100644 --- a/source/blender/nodes/shader/nodes/node_shader_color_ramp.cc +++ b/source/blender/nodes/shader/nodes/node_shader_color_ramp.cc @@ -35,7 +35,7 @@ static void sh_node_valtorgb_declare(NodeDeclarationBuilder &b) b.add_input<decl::Float>(N_("Fac")).default_value(0.5f).min(0.0f).max(1.0f).subtype(PROP_FACTOR); b.add_output<decl::Color>(N_("Color")); b.add_output<decl::Float>(N_("Alpha")); -}; +} static void node_shader_init_valtorgb(bNodeTree *UNUSED(ntree), bNode *node) { diff --git a/source/blender/nodes/shader/nodes/node_shader_common.cc b/source/blender/nodes/shader/nodes/node_shader_common.cc index 6f300890f7f..3f0fff34533 100644 --- a/source/blender/nodes/shader/nodes/node_shader_common.cc +++ b/source/blender/nodes/shader/nodes/node_shader_common.cc @@ -108,7 +108,6 @@ void register_node_type_sh_group() BLI_assert(ntype.rna_ext.srna != nullptr); RNA_struct_blender_type_set(ntype.rna_ext.srna, &ntype); - node_type_socket_templates(&ntype, nullptr, nullptr); node_type_size(&ntype, 140, 60, 400); ntype.labelfunc = node_group_label; node_type_group_update(&ntype, node_group_update); diff --git a/source/blender/nodes/shader/nodes/node_shader_curves.cc b/source/blender/nodes/shader/nodes/node_shader_curves.cc index 67095561caf..bce59a60033 100644 --- a/source/blender/nodes/shader/nodes/node_shader_curves.cc +++ b/source/blender/nodes/shader/nodes/node_shader_curves.cc @@ -31,7 +31,7 @@ static void sh_node_curve_vec_declare(NodeDeclarationBuilder &b) b.add_input<decl::Float>(N_("Fac")).min(0.0f).max(1.0f).default_value(1.0f).subtype(PROP_FACTOR); b.add_input<decl::Vector>(N_("Vector")).min(-1.0f).max(1.0f); b.add_output<decl::Vector>(N_("Vector")); -}; +} static void node_shader_init_curve_vec(bNodeTree *UNUSED(ntree), bNode *node) { @@ -164,7 +164,7 @@ static void sh_node_curve_rgb_declare(NodeDeclarationBuilder &b) b.add_input<decl::Float>(N_("Fac")).min(0.0f).max(1.0f).default_value(1.0f).subtype(PROP_FACTOR); b.add_input<decl::Color>(N_("Color")).default_value({1.0f, 1.0f, 1.0f, 1.0f}); b.add_output<decl::Color>(N_("Color")); -}; +} static void node_shader_init_curve_rgb(bNodeTree *UNUSED(ntree), bNode *node) { @@ -326,7 +326,7 @@ static void sh_node_curve_float_declare(NodeDeclarationBuilder &b) .subtype(PROP_FACTOR); b.add_input<decl::Float>(N_("Value")).default_value(1.0f).is_default_link_socket(); b.add_output<decl::Float>(N_("Value")); -}; +} static void node_shader_init_curve_float(bNodeTree *UNUSED(ntree), bNode *node) { diff --git a/source/blender/nodes/shader/nodes/node_shader_eevee_specular.cc b/source/blender/nodes/shader/nodes/node_shader_eevee_specular.cc index aa34ba225a2..e4c80725c8e 100644 --- a/source/blender/nodes/shader/nodes/node_shader_eevee_specular.cc +++ b/source/blender/nodes/shader/nodes/node_shader_eevee_specular.cc @@ -21,44 +21,36 @@ namespace blender::nodes::node_shader_eevee_specular_cc { -/* **************** OUTPUT ******************** */ - -static bNodeSocketTemplate sh_node_eevee_specular_in[] = { - {SOCK_RGBA, N_("Base Color"), 0.8f, 0.8f, 0.8f, 1.0f}, - {SOCK_RGBA, N_("Specular"), 0.03f, 0.03f, 0.03f, 1.0f}, - {SOCK_FLOAT, N_("Roughness"), 0.2f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR}, - {SOCK_RGBA, N_("Emissive Color"), 0.0f, 0.0f, 0.0f, 1.0f}, - {SOCK_FLOAT, N_("Transparency"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR}, - {SOCK_VECTOR, N_("Normal"), 0.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f, PROP_NONE, SOCK_HIDE_VALUE}, - {SOCK_FLOAT, N_("Clear Coat"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR}, - {SOCK_FLOAT, N_("Clear Coat Roughness"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR}, - {SOCK_VECTOR, - N_("Clear Coat Normal"), - 0.0f, - 0.0f, - 0.0f, - 0.0f, - 0.0f, - 1.0f, - PROP_NONE, - SOCK_HIDE_VALUE}, - {SOCK_FLOAT, - N_("Ambient Occlusion"), - 1.0f, - 0.0f, - 0.0f, - 0.0f, - 0.0f, - 1.0f, - PROP_NONE, - SOCK_HIDE_VALUE}, - {-1, ""}, -}; - -static bNodeSocketTemplate sh_node_eevee_specular_out[] = { - {SOCK_SHADER, N_("BSDF")}, - {-1, ""}, -}; +static void node_declare(NodeDeclarationBuilder &b) +{ + b.add_input<decl::Color>(N_("Base Color")).default_value({0.8f, 0.8f, 0.8f, 1.0f}); + b.add_input<decl::Color>(N_("Specular")).default_value({0.03f, 0.03f, 0.03f, 1.0f}); + b.add_input<decl::Float>(N_("Roughness")) + .default_value(0.2f) + .min(0.0f) + .max(1.0f) + .subtype(PROP_FACTOR); + b.add_input<decl::Color>(N_("Emissive Color")).default_value({0.0f, 0.0f, 0.0f, 1.0f}); + b.add_input<decl::Float>(N_("Transparency")) + .default_value(0.0f) + .min(0.0f) + .max(1.0f) + .subtype(PROP_FACTOR); + b.add_input<decl::Vector>(N_("Normal")).hide_value(); + b.add_input<decl::Float>(N_("Clear Coat")) + .default_value(0.0f) + .min(0.0f) + .max(1.0f) + .subtype(PROP_FACTOR); + b.add_input<decl::Float>(N_("Clear Coat Roughness")) + .default_value(0.0f) + .min(0.0f) + .max(1.0f) + .subtype(PROP_FACTOR); + b.add_input<decl::Vector>(N_("Clear Coat Normal")).hide_value(); + b.add_input<decl::Float>(N_("Ambient Occlusion")).hide_value(); + b.add_output<decl::Shader>(N_("BSDF")); +} static int node_shader_gpu_eevee_specular(GPUMaterial *mat, bNode *node, @@ -98,8 +90,7 @@ void register_node_type_sh_eevee_specular() static bNodeType ntype; sh_node_type_base(&ntype, SH_NODE_EEVEE_SPECULAR, "Specular BSDF", NODE_CLASS_SHADER); - node_type_socket_templates( - &ntype, file_ns::sh_node_eevee_specular_in, file_ns::sh_node_eevee_specular_out); + ntype.declare = file_ns::node_declare; node_type_gpu(&ntype, file_ns::node_shader_gpu_eevee_specular); nodeRegisterType(&ntype); diff --git a/source/blender/nodes/shader/nodes/node_shader_emission.cc b/source/blender/nodes/shader/nodes/node_shader_emission.cc index 47e4d3ad399..ea36763578f 100644 --- a/source/blender/nodes/shader/nodes/node_shader_emission.cc +++ b/source/blender/nodes/shader/nodes/node_shader_emission.cc @@ -21,18 +21,12 @@ namespace blender::nodes::node_shader_emission_cc { -/* **************** OUTPUT ******************** */ - -static bNodeSocketTemplate sh_node_emission_in[] = { - {SOCK_RGBA, N_("Color"), 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f}, - {SOCK_FLOAT, N_("Strength"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1000000.0f}, - {-1, ""}, -}; - -static bNodeSocketTemplate sh_node_emission_out[] = { - {SOCK_SHADER, N_("Emission")}, - {-1, ""}, -}; +static void node_declare(NodeDeclarationBuilder &b) +{ + b.add_input<decl::Color>(N_("Color")).default_value({1.0f, 1.0f, 1.0f, 1.0f}); + b.add_input<decl::Float>(N_("Strength")).default_value(1.0f).min(0.0f).max(1000000.0f); + b.add_output<decl::Shader>(N_("Emission")); +} static int node_shader_gpu_emission(GPUMaterial *mat, bNode *node, @@ -53,7 +47,7 @@ void register_node_type_sh_emission() static bNodeType ntype; sh_node_type_base(&ntype, SH_NODE_EMISSION, "Emission", NODE_CLASS_SHADER); - node_type_socket_templates(&ntype, file_ns::sh_node_emission_in, file_ns::sh_node_emission_out); + ntype.declare = file_ns::node_declare; node_type_gpu(&ntype, file_ns::node_shader_gpu_emission); nodeRegisterType(&ntype); diff --git a/source/blender/nodes/shader/nodes/node_shader_fresnel.cc b/source/blender/nodes/shader/nodes/node_shader_fresnel.cc index 2abfb57a364..5dba42fcc30 100644 --- a/source/blender/nodes/shader/nodes/node_shader_fresnel.cc +++ b/source/blender/nodes/shader/nodes/node_shader_fresnel.cc @@ -21,17 +21,12 @@ namespace blender::nodes::node_shader_fresnel_cc { -/* **************** Fresnel ******************** */ -static bNodeSocketTemplate sh_node_fresnel_in[] = { - {SOCK_FLOAT, N_("IOR"), 1.45f, 0.0f, 0.0f, 0.0f, 0.0f, 1000.0f}, - {SOCK_VECTOR, N_("Normal"), 0.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f, PROP_NONE, SOCK_HIDE_VALUE}, - {-1, ""}, -}; - -static bNodeSocketTemplate sh_node_fresnel_out[] = { - {SOCK_FLOAT, N_("Fac"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR}, - {-1, ""}, -}; +static void node_declare(NodeDeclarationBuilder &b) +{ + b.add_input<decl::Float>(N_("IOR")).default_value(1.45f).min(0.0f).max(1000.0f); + b.add_input<decl::Vector>(N_("Normal")).hide_value(); + b.add_output<decl::Float>(N_("Fac")); +} static int node_shader_gpu_fresnel(GPUMaterial *mat, bNode *node, @@ -60,7 +55,7 @@ void register_node_type_sh_fresnel() static bNodeType ntype; sh_node_type_base(&ntype, SH_NODE_FRESNEL, "Fresnel", NODE_CLASS_INPUT); - node_type_socket_templates(&ntype, file_ns::sh_node_fresnel_in, file_ns::sh_node_fresnel_out); + ntype.declare = file_ns::node_declare; node_type_gpu(&ntype, file_ns::node_shader_gpu_fresnel); nodeRegisterType(&ntype); diff --git a/source/blender/nodes/shader/nodes/node_shader_hair_info.cc b/source/blender/nodes/shader/nodes/node_shader_hair_info.cc index c5af7e16201..e22a825c066 100644 --- a/source/blender/nodes/shader/nodes/node_shader_hair_info.cc +++ b/source/blender/nodes/shader/nodes/node_shader_hair_info.cc @@ -21,16 +21,16 @@ namespace blender::nodes::node_shader_hair_info_cc { -static bNodeSocketTemplate outputs[] = { - {SOCK_FLOAT, N_("Is Strand"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, - {SOCK_FLOAT, N_("Intercept"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, - {SOCK_FLOAT, N_("Length"), 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, N_("Random")}, - {-1, ""}, -}; +static void node_declare(NodeDeclarationBuilder &b) +{ + b.add_output<decl::Float>(N_("Is Strand")); + b.add_output<decl::Float>(N_("Intercept")); + b.add_output<decl::Float>(N_("Length")); + b.add_output<decl::Float>(N_("Thickness")); + b.add_output<decl::Vector>(N_("Tangent Normal")); + // b.add_output<decl::Float>(N_("Fade")); + b.add_output<decl::Float>(N_("Random")); +} static int node_shader_gpu_hair_info(GPUMaterial *mat, bNode *node, @@ -55,7 +55,7 @@ void register_node_type_sh_hair_info() static bNodeType ntype; sh_node_type_base(&ntype, SH_NODE_HAIR_INFO, "Hair Info", NODE_CLASS_INPUT); - node_type_socket_templates(&ntype, nullptr, file_ns::outputs); + ntype.declare = file_ns::node_declare; node_type_gpu(&ntype, file_ns::node_shader_gpu_hair_info); nodeRegisterType(&ntype); diff --git a/source/blender/nodes/shader/nodes/node_shader_hueSatVal.cc b/source/blender/nodes/shader/nodes/node_shader_hueSatVal.cc index 75e1b372601..94b9a61c602 100644 --- a/source/blender/nodes/shader/nodes/node_shader_hueSatVal.cc +++ b/source/blender/nodes/shader/nodes/node_shader_hueSatVal.cc @@ -25,19 +25,15 @@ namespace blender::nodes::node_shader_hueSatVal_cc { -/* **************** Hue Saturation ******************** */ -static bNodeSocketTemplate sh_node_hue_sat_in[] = { - {SOCK_FLOAT, N_("Hue"), 0.5f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE}, - {SOCK_FLOAT, N_("Saturation"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 2.0f, PROP_NONE}, - {SOCK_FLOAT, N_("Value"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 2.0f, PROP_NONE}, - {SOCK_FLOAT, N_("Fac"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR}, - {SOCK_RGBA, N_("Color"), 0.8f, 0.8f, 0.8f, 1.0f}, - {-1, ""}, -}; -static bNodeSocketTemplate sh_node_hue_sat_out[] = { - {SOCK_RGBA, N_("Color")}, - {-1, ""}, -}; +static void node_declare(NodeDeclarationBuilder &b) +{ + b.add_input<decl::Float>(N_("Hue")).default_value(0.5f).min(0.0f).max(1.0f); + b.add_input<decl::Float>(N_("Saturation")).default_value(1.0f).min(0.0f).max(2.0f); + b.add_input<decl::Float>(N_("Value")).default_value(1.0f).min(0.0f).max(2.0f); + b.add_input<decl::Float>(N_("Fac")).default_value(1.0f).min(0.0f).max(1.0f).subtype(PROP_FACTOR); + b.add_input<decl::Color>(N_("Color")).default_value({0.8f, 0.8f, 0.8f, 1.0f}); + b.add_output<decl::Color>(N_("Color")); +} static int gpu_shader_hue_sat(GPUMaterial *mat, bNode *node, @@ -57,7 +53,7 @@ void register_node_type_sh_hue_sat() static bNodeType ntype; sh_node_type_base(&ntype, SH_NODE_HUE_SAT, "Hue Saturation Value", NODE_CLASS_OP_COLOR); - node_type_socket_templates(&ntype, file_ns::sh_node_hue_sat_in, file_ns::sh_node_hue_sat_out); + ntype.declare = file_ns::node_declare; node_type_size_preset(&ntype, NODE_SIZE_MIDDLE); node_type_gpu(&ntype, file_ns::gpu_shader_hue_sat); diff --git a/source/blender/nodes/shader/nodes/node_shader_ies_light.cc b/source/blender/nodes/shader/nodes/node_shader_ies_light.cc index a107fd83b0e..82f0a3045c9 100644 --- a/source/blender/nodes/shader/nodes/node_shader_ies_light.cc +++ b/source/blender/nodes/shader/nodes/node_shader_ies_light.cc @@ -19,20 +19,34 @@ #include "node_shader_util.hh" +#include "UI_interface.h" +#include "UI_resources.h" + namespace blender::nodes::node_shader_ies_light_cc { -/* **************** IES Light ******************** */ +static void node_declare(NodeDeclarationBuilder &b) +{ + b.add_input<decl::Vector>(N_("Vector")).hide_value(); + b.add_input<decl::Float>(N_("Strength")).default_value(1.0f).min(0.0f).max(1000000.0f); + b.add_output<decl::Float>(N_("Fac")); +} -static bNodeSocketTemplate sh_node_tex_ies_in[] = { - {SOCK_VECTOR, N_("Vector"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE, SOCK_HIDE_VALUE}, - {SOCK_FLOAT, N_("Strength"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1000000.0f, PROP_NONE}, - {-1, ""}, -}; +static void node_shader_buts_ies(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) +{ + uiLayout *row; -static bNodeSocketTemplate sh_node_tex_ies_out[] = { - {SOCK_FLOAT, N_("Fac")}, - {-1, ""}, -}; + row = uiLayoutRow(layout, false); + uiItemR(row, ptr, "mode", UI_ITEM_R_SPLIT_EMPTY_NAME | UI_ITEM_R_EXPAND, nullptr, ICON_NONE); + + row = uiLayoutRow(layout, true); + + if (RNA_enum_get(ptr, "mode") == NODE_IES_INTERNAL) { + uiItemR(row, ptr, "ies", UI_ITEM_R_SPLIT_EMPTY_NAME, "", ICON_NONE); + } + else { + uiItemR(row, ptr, "filepath", UI_ITEM_R_SPLIT_EMPTY_NAME, "", ICON_NONE); + } +} static void node_shader_init_tex_ies(bNodeTree *UNUSED(ntree), bNode *node) { @@ -50,7 +64,8 @@ void register_node_type_sh_tex_ies() static bNodeType ntype; sh_node_type_base(&ntype, SH_NODE_TEX_IES, "IES Texture", NODE_CLASS_TEXTURE); - node_type_socket_templates(&ntype, file_ns::sh_node_tex_ies_in, file_ns::sh_node_tex_ies_out); + ntype.declare = file_ns::node_declare; + ntype.draw_buttons = file_ns::node_shader_buts_ies; node_type_init(&ntype, file_ns::node_shader_init_tex_ies); node_type_storage( &ntype, "NodeShaderTexIES", node_free_standard_storage, node_copy_standard_storage); diff --git a/source/blender/nodes/shader/nodes/node_shader_invert.cc b/source/blender/nodes/shader/nodes/node_shader_invert.cc index bcdb7ca7b00..3b5f4cb1d38 100644 --- a/source/blender/nodes/shader/nodes/node_shader_invert.cc +++ b/source/blender/nodes/shader/nodes/node_shader_invert.cc @@ -25,13 +25,12 @@ namespace blender::nodes::node_shader_invert_cc { -/* **************** INVERT ******************** */ -static bNodeSocketTemplate sh_node_invert_in[] = { - {SOCK_FLOAT, N_("Fac"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR}, - {SOCK_RGBA, N_("Color"), 0.0f, 0.0f, 0.0f, 1.0f}, - {-1, ""}}; - -static bNodeSocketTemplate sh_node_invert_out[] = {{SOCK_RGBA, N_("Color")}, {-1, ""}}; +static void node_declare(NodeDeclarationBuilder &b) +{ + b.add_input<decl::Float>(N_("Fac")).default_value(1.0f).min(0.0f).max(1.0f).subtype(PROP_FACTOR); + b.add_input<decl::Color>(N_("Color")).default_value({0.0f, 0.0f, 0.0f, 1.0f}); + b.add_output<decl::Color>(N_("Color")); +} static int gpu_shader_invert(GPUMaterial *mat, bNode *node, @@ -51,7 +50,7 @@ void register_node_type_sh_invert() static bNodeType ntype; sh_node_type_base(&ntype, SH_NODE_INVERT, "Invert", NODE_CLASS_OP_COLOR); - node_type_socket_templates(&ntype, file_ns::sh_node_invert_in, file_ns::sh_node_invert_out); + ntype.declare = file_ns::node_declare; node_type_gpu(&ntype, file_ns::gpu_shader_invert); nodeRegisterType(&ntype); diff --git a/source/blender/nodes/shader/nodes/node_shader_layer_weight.cc b/source/blender/nodes/shader/nodes/node_shader_layer_weight.cc index f78bbcaacaa..b4210ce154c 100644 --- a/source/blender/nodes/shader/nodes/node_shader_layer_weight.cc +++ b/source/blender/nodes/shader/nodes/node_shader_layer_weight.cc @@ -21,19 +21,13 @@ namespace blender::nodes::node_shader_layer_weight_cc { -/* **************** Layer Weight ******************** */ - -static bNodeSocketTemplate sh_node_layer_weight_in[] = { - {SOCK_FLOAT, N_("Blend"), 0.5f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, - {SOCK_VECTOR, N_("Normal"), 0.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f, PROP_NONE, SOCK_HIDE_VALUE}, - {-1, ""}, -}; - -static bNodeSocketTemplate sh_node_layer_weight_out[] = { - {SOCK_FLOAT, N_("Fresnel"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, - {SOCK_FLOAT, N_("Facing"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, - {-1, ""}, -}; +static void node_declare(NodeDeclarationBuilder &b) +{ + b.add_input<decl::Float>(N_("Blend")).default_value(0.5f).min(0.0f).max(1.0f); + b.add_input<decl::Vector>(N_("Normal")).hide_value(); + b.add_output<decl::Float>(N_("Fresnel")); + b.add_output<decl::Float>(N_("Facing")); +} static int node_shader_gpu_layer_weight(GPUMaterial *mat, bNode *node, @@ -62,8 +56,7 @@ void register_node_type_sh_layer_weight() static bNodeType ntype; sh_node_type_base(&ntype, SH_NODE_LAYER_WEIGHT, "Layer Weight", NODE_CLASS_INPUT); - node_type_socket_templates( - &ntype, file_ns::sh_node_layer_weight_in, file_ns::sh_node_layer_weight_out); + ntype.declare = file_ns::node_declare; node_type_gpu(&ntype, file_ns::node_shader_gpu_layer_weight); nodeRegisterType(&ntype); diff --git a/source/blender/nodes/shader/nodes/node_shader_light_falloff.cc b/source/blender/nodes/shader/nodes/node_shader_light_falloff.cc index 6c2baa01e54..50eea2b3643 100644 --- a/source/blender/nodes/shader/nodes/node_shader_light_falloff.cc +++ b/source/blender/nodes/shader/nodes/node_shader_light_falloff.cc @@ -21,22 +21,14 @@ namespace blender::nodes::node_shader_light_falloff_cc { -/* **************** INPUT ********************* */ - -static bNodeSocketTemplate sh_node_light_falloff_in[] = { - {SOCK_FLOAT, N_("Strength"), 100.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1000000.0f}, - {SOCK_FLOAT, N_("Smooth"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1000.0f}, - {-1, ""}, -}; - -/* **************** OUTPUT ******************** */ - -static bNodeSocketTemplate sh_node_light_falloff_out[] = { - {SOCK_FLOAT, N_("Quadratic"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, - {SOCK_FLOAT, N_("Linear"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, - {SOCK_FLOAT, N_("Constant"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, - {-1, ""}, -}; +static void node_declare(NodeDeclarationBuilder &b) +{ + b.add_input<decl::Float>(N_("Strength")).default_value(100.0f).min(0.0f).max(1000000.0f); + b.add_input<decl::Float>(N_("Smooth")).default_value(0.0f).min(0.0f).max(1000.0f); + b.add_output<decl::Float>(N_("Quadratic")); + b.add_output<decl::Float>(N_("Linear")); + b.add_output<decl::Float>(N_("Constant")); +} static int node_shader_gpu_light_falloff(GPUMaterial *mat, bNode *node, @@ -57,8 +49,7 @@ void register_node_type_sh_light_falloff() static bNodeType ntype; sh_node_type_base(&ntype, SH_NODE_LIGHT_FALLOFF, "Light Falloff", NODE_CLASS_OP_COLOR); - node_type_socket_templates( - &ntype, file_ns::sh_node_light_falloff_in, file_ns::sh_node_light_falloff_out); + ntype.declare = file_ns::node_declare; node_type_size_preset(&ntype, NODE_SIZE_MIDDLE); node_type_gpu(&ntype, file_ns::node_shader_gpu_light_falloff); diff --git a/source/blender/nodes/shader/nodes/node_shader_light_path.cc b/source/blender/nodes/shader/nodes/node_shader_light_path.cc index 9f8e6502ce5..6fbd5751886 100644 --- a/source/blender/nodes/shader/nodes/node_shader_light_path.cc +++ b/source/blender/nodes/shader/nodes/node_shader_light_path.cc @@ -21,24 +21,22 @@ namespace blender::nodes::node_shader_light_path_cc { -/* **************** OUTPUT ******************** */ - -static bNodeSocketTemplate sh_node_light_path_out[] = { - {SOCK_FLOAT, N_("Is Camera Ray"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, - {SOCK_FLOAT, N_("Is Shadow Ray"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, - {SOCK_FLOAT, N_("Is Diffuse Ray"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, - {SOCK_FLOAT, N_("Is Glossy Ray"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, - {SOCK_FLOAT, N_("Is Singular Ray"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, - {SOCK_FLOAT, N_("Is Reflection Ray"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, - {SOCK_FLOAT, N_("Is Transmission Ray"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, - {SOCK_FLOAT, N_("Ray Length"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, - {SOCK_FLOAT, N_("Ray Depth"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, - {SOCK_FLOAT, N_("Diffuse Depth"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, - {SOCK_FLOAT, N_("Glossy Depth"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, - {SOCK_FLOAT, N_("Transparent Depth"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, - {SOCK_FLOAT, N_("Transmission Depth"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, - {-1, ""}, -}; +static void node_declare(NodeDeclarationBuilder &b) +{ + b.add_output<decl::Float>(N_("Is Camera Ray")); + b.add_output<decl::Float>(N_("Is Shadow Ray")); + b.add_output<decl::Float>(N_("Is Diffuse Ray")); + b.add_output<decl::Float>(N_("Is Glossy Ray")); + b.add_output<decl::Float>(N_("Is Singular Ray")); + b.add_output<decl::Float>(N_("Is Reflection Ray")); + b.add_output<decl::Float>(N_("Is Transmission Ray")); + b.add_output<decl::Float>(N_("Ray Length")); + b.add_output<decl::Float>(N_("Ray Depth")); + b.add_output<decl::Float>(N_("Diffuse Depth")); + b.add_output<decl::Float>(N_("Glossy Depth")); + b.add_output<decl::Float>(N_("Transparent Depth")); + b.add_output<decl::Float>(N_("Transmission Depth")); +} static int node_shader_gpu_light_path(GPUMaterial *mat, bNode *node, @@ -59,7 +57,7 @@ void register_node_type_sh_light_path() static bNodeType ntype; sh_node_type_base(&ntype, SH_NODE_LIGHT_PATH, "Light Path", NODE_CLASS_INPUT); - node_type_socket_templates(&ntype, nullptr, file_ns::sh_node_light_path_out); + ntype.declare = file_ns::node_declare; node_type_gpu(&ntype, file_ns::node_shader_gpu_light_path); nodeRegisterType(&ntype); diff --git a/source/blender/nodes/shader/nodes/node_shader_map_range.cc b/source/blender/nodes/shader/nodes/node_shader_map_range.cc index c4527fd3420..3276a1bfd72 100644 --- a/source/blender/nodes/shader/nodes/node_shader_map_range.cc +++ b/source/blender/nodes/shader/nodes/node_shader_map_range.cc @@ -29,6 +29,9 @@ #include "NOD_socket_search_link.hh" +#include "UI_interface.h" +#include "UI_resources.h" + namespace blender::nodes::node_shader_map_range_cc { NODE_STORAGE_FUNCS(NodeMapRange) @@ -50,7 +53,18 @@ static void sh_node_map_range_declare(NodeDeclarationBuilder &b) b.add_input<decl::Vector>(N_("Steps"), "Steps_FLOAT3").default_value(float3(4.0f)); b.add_output<decl::Float>(N_("Result")); b.add_output<decl::Vector>(N_("Vector")); -}; +} + +static void node_shader_buts_map_range(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) +{ + uiItemR(layout, ptr, "data_type", UI_ITEM_R_SPLIT_EMPTY_NAME, "", ICON_NONE); + uiItemR(layout, ptr, "interpolation_type", UI_ITEM_R_SPLIT_EMPTY_NAME, "", ICON_NONE); + if (!ELEM(RNA_enum_get(ptr, "interpolation_type"), + NODE_MAP_RANGE_SMOOTHSTEP, + NODE_MAP_RANGE_SMOOTHERSTEP)) { + uiItemR(layout, ptr, "clamp", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); + } +} static void node_shader_update_map_range(bNodeTree *ntree, bNode *node) { @@ -650,6 +664,7 @@ void register_node_type_sh_map_range() sh_fn_node_type_base(&ntype, SH_NODE_MAP_RANGE, "Map Range", NODE_CLASS_CONVERTER); ntype.declare = file_ns::sh_node_map_range_declare; + ntype.draw_buttons = file_ns::node_shader_buts_map_range; node_type_init(&ntype, file_ns::node_shader_init_map_range); node_type_storage( &ntype, "NodeMapRange", node_free_standard_storage, node_copy_standard_storage); diff --git a/source/blender/nodes/shader/nodes/node_shader_mapping.cc b/source/blender/nodes/shader/nodes/node_shader_mapping.cc index 758b675f9d6..19c3a26796e 100644 --- a/source/blender/nodes/shader/nodes/node_shader_mapping.cc +++ b/source/blender/nodes/shader/nodes/node_shader_mapping.cc @@ -23,21 +23,39 @@ #include "node_shader_util.hh" +#include "UI_interface.h" +#include "UI_resources.h" + namespace blender::nodes::node_shader_mapping_cc { -/* **************** MAPPING ******************** */ -static bNodeSocketTemplate sh_node_mapping_in[] = { - {SOCK_VECTOR, N_("Vector"), 0.0f, 0.0f, 0.0f, 1.0f, -FLT_MAX, FLT_MAX, PROP_NONE}, - {SOCK_VECTOR, N_("Location"), 0.0f, 0.0f, 0.0f, 1.0f, -FLT_MAX, FLT_MAX, PROP_TRANSLATION}, - {SOCK_VECTOR, N_("Rotation"), 0.0f, 0.0f, 0.0f, 1.0f, -FLT_MAX, FLT_MAX, PROP_EULER}, - {SOCK_VECTOR, N_("Scale"), 1.0f, 1.0f, 1.0f, 1.0f, -FLT_MAX, FLT_MAX, PROP_XYZ}, - {-1, ""}, -}; +static void node_declare(NodeDeclarationBuilder &b) +{ + b.add_input<decl::Vector>(N_("Vector")) + .default_value({0.0f, 0.0f, 0.0f}) + .min(-FLT_MAX) + .max(FLT_MAX); + b.add_input<decl::Vector>(N_("Location")) + .default_value({0.0f, 0.0f, 0.0f}) + .min(-FLT_MAX) + .max(FLT_MAX) + .subtype(PROP_TRANSLATION); + b.add_input<decl::Vector>(N_("Rotation")) + .default_value({0.0f, 0.0f, 0.0f}) + .min(-FLT_MAX) + .max(FLT_MAX) + .subtype(PROP_EULER); + b.add_input<decl::Vector>(N_("Scale")) + .default_value({1.0f, 1.0f, 1.0f}) + .min(-FLT_MAX) + .max(FLT_MAX) + .subtype(PROP_XYZ); + b.add_output<decl::Vector>(N_("Vector")); +} -static bNodeSocketTemplate sh_node_mapping_out[] = { - {SOCK_VECTOR, N_("Vector")}, - {-1, ""}, -}; +static void node_shader_buts_mapping(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) +{ + uiItemR(layout, ptr, "vector_type", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); +} static const char *gpu_shader_get_name(int mode) { @@ -83,7 +101,8 @@ void register_node_type_sh_mapping() static bNodeType ntype; sh_node_type_base(&ntype, SH_NODE_MAPPING, "Mapping", NODE_CLASS_OP_VECTOR); - node_type_socket_templates(&ntype, file_ns::sh_node_mapping_in, file_ns::sh_node_mapping_out); + ntype.declare = file_ns::node_declare; + ntype.draw_buttons = file_ns::node_shader_buts_mapping; node_type_gpu(&ntype, file_ns::gpu_shader_mapping); node_type_update(&ntype, file_ns::node_shader_update_mapping); diff --git a/source/blender/nodes/shader/nodes/node_shader_math.cc b/source/blender/nodes/shader/nodes/node_shader_math.cc index ca30b16f7ff..50585405cbf 100644 --- a/source/blender/nodes/shader/nodes/node_shader_math.cc +++ b/source/blender/nodes/shader/nodes/node_shader_math.cc @@ -45,7 +45,7 @@ static void sh_node_math_declare(NodeDeclarationBuilder &b) .min(-10000.0f) .max(10000.0f); b.add_output<decl::Float>(N_("Value")); -}; +} class SocketSearchOp { public: diff --git a/source/blender/nodes/shader/nodes/node_shader_mix_rgb.cc b/source/blender/nodes/shader/nodes/node_shader_mix_rgb.cc index 7f9dc8424cf..9678e86d289 100644 --- a/source/blender/nodes/shader/nodes/node_shader_mix_rgb.cc +++ b/source/blender/nodes/shader/nodes/node_shader_mix_rgb.cc @@ -32,7 +32,7 @@ static void sh_node_mix_rgb_declare(NodeDeclarationBuilder &b) b.add_input<decl::Color>(N_("Color1")).default_value({0.5f, 0.5f, 0.5f, 1.0f}); b.add_input<decl::Color>(N_("Color2")).default_value({0.5f, 0.5f, 0.5f, 1.0f}); b.add_output<decl::Color>(N_("Color")); -}; +} static const char *gpu_shader_get_name(int mode) { diff --git a/source/blender/nodes/shader/nodes/node_shader_mix_shader.cc b/source/blender/nodes/shader/nodes/node_shader_mix_shader.cc index c320fafa2ef..d9aa906e451 100644 --- a/source/blender/nodes/shader/nodes/node_shader_mix_shader.cc +++ b/source/blender/nodes/shader/nodes/node_shader_mix_shader.cc @@ -27,7 +27,7 @@ static void node_declare(NodeDeclarationBuilder &b) b.add_input<decl::Shader>(N_("Shader")); b.add_input<decl::Shader>(N_("Shader"), "Shader_001"); b.add_output<decl::Shader>(N_("Shader")); -}; +} static int node_shader_gpu_mix_shader(GPUMaterial *mat, bNode *node, diff --git a/source/blender/nodes/shader/nodes/node_shader_normal.cc b/source/blender/nodes/shader/nodes/node_shader_normal.cc index d6caa4219f9..e677f36e425 100644 --- a/source/blender/nodes/shader/nodes/node_shader_normal.cc +++ b/source/blender/nodes/shader/nodes/node_shader_normal.cc @@ -25,17 +25,20 @@ namespace blender::nodes::node_shader_normal_cc { -/* **************** NORMAL ******************** */ -static bNodeSocketTemplate sh_node_normal_in[] = { - {SOCK_VECTOR, N_("Normal"), 0.0f, 0.0f, 1.0f, 0.0f, -1.0f, 1.0f, PROP_DIRECTION}, - {-1, ""}, -}; - -static bNodeSocketTemplate sh_node_normal_out[] = { - {SOCK_VECTOR, N_("Normal"), 0.0f, 0.0f, 1.0f, 0.0f, -1.0f, 1.0f, PROP_DIRECTION}, - {SOCK_FLOAT, N_("Dot")}, - {-1, ""}, -}; +static void node_declare(NodeDeclarationBuilder &b) +{ + b.add_input<decl::Vector>(N_("Normal")) + .default_value({0.0f, 0.0f, 1.0f}) + .min(-1.0f) + .max(1.0f) + .subtype(PROP_DIRECTION); + b.add_output<decl::Vector>(N_("Normal")) + .default_value({0.0f, 0.0f, 1.0f}) + .min(-1.0f) + .max(1.0f) + .subtype(PROP_DIRECTION); + b.add_output<decl::Float>(N_("Dot")); +} static int gpu_shader_normal(GPUMaterial *mat, bNode *node, @@ -56,7 +59,7 @@ void register_node_type_sh_normal() static bNodeType ntype; sh_node_type_base(&ntype, SH_NODE_NORMAL, "Normal", NODE_CLASS_OP_VECTOR); - node_type_socket_templates(&ntype, file_ns::sh_node_normal_in, file_ns::sh_node_normal_out); + ntype.declare = file_ns::node_declare; node_type_gpu(&ntype, file_ns::gpu_shader_normal); nodeRegisterType(&ntype); diff --git a/source/blender/nodes/shader/nodes/node_shader_normal_map.cc b/source/blender/nodes/shader/nodes/node_shader_normal_map.cc index ca75a29e6fe..338b4c62a3a 100644 --- a/source/blender/nodes/shader/nodes/node_shader_normal_map.cc +++ b/source/blender/nodes/shader/nodes/node_shader_normal_map.cc @@ -19,20 +19,36 @@ #include "node_shader_util.hh" -namespace blender::nodes::node_shader_normal_map_cc { +#include "BKE_context.h" + +#include "UI_interface.h" +#include "UI_resources.h" -/* **************** OUTPUT ******************** */ +namespace blender::nodes::node_shader_normal_map_cc { -static bNodeSocketTemplate sh_node_normal_map_in[] = { - {SOCK_FLOAT, N_("Strength"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 10.0f}, - {SOCK_RGBA, N_("Color"), 0.5f, 0.5f, 1.0f, 1.0f, 0.0f, 1.0f}, - {-1, ""}, -}; +static void node_declare(NodeDeclarationBuilder &b) +{ + b.add_input<decl::Float>(N_("Strength")).default_value(1.0f).min(0.0f).max(10.0f); + b.add_input<decl::Color>(N_("Color")).default_value({0.5f, 0.5f, 1.0f, 1.0f}); + b.add_output<decl::Vector>(N_("Normal")); +} -static bNodeSocketTemplate sh_node_normal_map_out[] = { - {SOCK_VECTOR, N_("Normal"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, - {-1, ""}, -}; +static void node_shader_buts_normal_map(uiLayout *layout, bContext *C, PointerRNA *ptr) +{ + uiItemR(layout, ptr, "space", UI_ITEM_R_SPLIT_EMPTY_NAME, "", 0); + + if (RNA_enum_get(ptr, "space") == SHD_SPACE_TANGENT) { + PointerRNA obptr = CTX_data_pointer_get(C, "active_object"); + + if (obptr.data && RNA_enum_get(&obptr, "type") == OB_MESH) { + PointerRNA dataptr = RNA_pointer_get(&obptr, "data"); + uiItemPointerR(layout, ptr, "uv_map", &dataptr, "uv_layers", "", ICON_NONE); + } + else { + uiItemR(layout, ptr, "uv_map", UI_ITEM_R_SPLIT_EMPTY_NAME, "", 0); + } + } +} static void node_shader_init_normal_map(bNodeTree *UNUSED(ntree), bNode *node) { @@ -118,8 +134,8 @@ void register_node_type_sh_normal_map() static bNodeType ntype; sh_node_type_base(&ntype, SH_NODE_NORMAL_MAP, "Normal Map", NODE_CLASS_OP_VECTOR); - node_type_socket_templates( - &ntype, file_ns::sh_node_normal_map_in, file_ns::sh_node_normal_map_out); + ntype.declare = file_ns::node_declare; + ntype.draw_buttons = file_ns::node_shader_buts_normal_map; node_type_size_preset(&ntype, NODE_SIZE_MIDDLE); node_type_init(&ntype, file_ns::node_shader_init_normal_map); node_type_storage( diff --git a/source/blender/nodes/shader/nodes/node_shader_output_aov.cc b/source/blender/nodes/shader/nodes/node_shader_output_aov.cc index 58a075e9e05..6ffd763b0d1 100644 --- a/source/blender/nodes/shader/nodes/node_shader_output_aov.cc +++ b/source/blender/nodes/shader/nodes/node_shader_output_aov.cc @@ -21,13 +21,21 @@ #include "BLI_hash.h" +#include "UI_interface.h" +#include "UI_resources.h" + namespace blender::nodes::node_shader_output_aov_cc { static void node_declare(NodeDeclarationBuilder &b) { b.add_input<decl::Color>(N_("Color")).default_value({0.0f, 0.0f, 0.0f, 1.0f}); b.add_input<decl::Float>(N_("Value")).default_value(0.0f).min(0.0f).max(1.0f); -}; +} + +static void node_shader_buts_output_aov(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) +{ + uiItemR(layout, ptr, "name", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); +} static void node_shader_init_output_aov(bNodeTree *UNUSED(ntree), bNode *node) { @@ -63,6 +71,7 @@ void register_node_type_sh_output_aov() sh_node_type_base(&ntype, SH_NODE_OUTPUT_AOV, "AOV Output", NODE_CLASS_OUTPUT); ntype.declare = file_ns::node_declare; + ntype.draw_buttons = file_ns::node_shader_buts_output_aov; node_type_init(&ntype, file_ns::node_shader_init_output_aov); node_type_storage( &ntype, "NodeShaderOutputAOV", node_free_standard_storage, node_copy_standard_storage); diff --git a/source/blender/nodes/shader/nodes/node_shader_output_light.cc b/source/blender/nodes/shader/nodes/node_shader_output_light.cc index 05eec40e020..0c8288f801b 100644 --- a/source/blender/nodes/shader/nodes/node_shader_output_light.cc +++ b/source/blender/nodes/shader/nodes/node_shader_output_light.cc @@ -24,7 +24,7 @@ namespace blender::nodes::node_shader_output_light_cc { static void node_declare(NodeDeclarationBuilder &b) { b.add_input<decl::Shader>(N_("Surface")); -}; +} } // namespace blender::nodes::node_shader_output_light_cc diff --git a/source/blender/nodes/shader/nodes/node_shader_output_linestyle.cc b/source/blender/nodes/shader/nodes/node_shader_output_linestyle.cc index c866b1e336f..9b6c3292e75 100644 --- a/source/blender/nodes/shader/nodes/node_shader_output_linestyle.cc +++ b/source/blender/nodes/shader/nodes/node_shader_output_linestyle.cc @@ -19,6 +19,9 @@ #include "node_shader_util.hh" +#include "UI_interface.h" +#include "UI_resources.h" + namespace blender::nodes::node_shader_output_linestyle_cc { static void node_declare(NodeDeclarationBuilder &b) @@ -39,7 +42,17 @@ static void node_declare(NodeDeclarationBuilder &b) .min(0.0f) .max(1.0f) .subtype(PROP_FACTOR); -}; +} + +static void node_buts_output_linestyle(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) +{ + uiLayout *row, *col; + + col = uiLayoutColumn(layout, false); + row = uiLayoutRow(col, true); + uiItemR(row, ptr, "blend_type", UI_ITEM_R_SPLIT_EMPTY_NAME, "", ICON_NONE); + uiItemR(col, ptr, "use_clamp", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); +} } // namespace blender::nodes::node_shader_output_linestyle_cc @@ -52,6 +65,7 @@ void register_node_type_sh_output_linestyle() sh_node_type_base(&ntype, SH_NODE_OUTPUT_LINESTYLE, "Line Style Output", NODE_CLASS_OUTPUT); ntype.declare = file_ns::node_declare; + ntype.draw_buttons = file_ns::node_buts_output_linestyle; ntype.no_muting = true; nodeRegisterType(&ntype); diff --git a/source/blender/nodes/shader/nodes/node_shader_output_material.cc b/source/blender/nodes/shader/nodes/node_shader_output_material.cc index 7d46e8e28fc..5fc95b92e3f 100644 --- a/source/blender/nodes/shader/nodes/node_shader_output_material.cc +++ b/source/blender/nodes/shader/nodes/node_shader_output_material.cc @@ -28,7 +28,7 @@ static void node_declare(NodeDeclarationBuilder &b) b.add_input<decl::Shader>(N_("Surface")); b.add_input<decl::Shader>(N_("Volume")); b.add_input<decl::Vector>(N_("Displacement")).hide_value(); -}; +} static int node_shader_gpu_output_material(GPUMaterial *mat, bNode *node, diff --git a/source/blender/nodes/shader/nodes/node_shader_output_world.cc b/source/blender/nodes/shader/nodes/node_shader_output_world.cc index 9ea325bbf78..501dc088cbe 100644 --- a/source/blender/nodes/shader/nodes/node_shader_output_world.cc +++ b/source/blender/nodes/shader/nodes/node_shader_output_world.cc @@ -25,7 +25,7 @@ static void node_declare(NodeDeclarationBuilder &b) { b.add_input<decl::Shader>(N_("Surface")); b.add_input<decl::Shader>(N_("Volume")); -}; +} static int node_shader_gpu_output_world(GPUMaterial *mat, bNode *node, diff --git a/source/blender/nodes/shader/nodes/node_shader_particle_info.cc b/source/blender/nodes/shader/nodes/node_shader_particle_info.cc index 163a5d6ebfe..d68d0fe0d72 100644 --- a/source/blender/nodes/shader/nodes/node_shader_particle_info.cc +++ b/source/blender/nodes/shader/nodes/node_shader_particle_info.cc @@ -36,7 +36,7 @@ static void node_declare(NodeDeclarationBuilder &b) b.add_output<decl::Float>(N_("Size")); b.add_output<decl::Vector>(N_("Velocity")); b.add_output<decl::Vector>(N_("Angular Velocity")); -}; +} static int gpu_shader_particle_info(GPUMaterial *mat, bNode *node, diff --git a/source/blender/nodes/shader/nodes/node_shader_rgb_to_bw.cc b/source/blender/nodes/shader/nodes/node_shader_rgb_to_bw.cc index d93c2326490..13ba056d9ee 100644 --- a/source/blender/nodes/shader/nodes/node_shader_rgb_to_bw.cc +++ b/source/blender/nodes/shader/nodes/node_shader_rgb_to_bw.cc @@ -31,7 +31,7 @@ static void sh_node_rgbtobw_declare(NodeDeclarationBuilder &b) { b.add_input<decl::Color>(N_("Color")).default_value({0.5f, 0.5f, 0.5f, 1.0f}); b.add_output<decl::Float>(N_("Val")); -}; +} static int gpu_shader_rgbtobw(GPUMaterial *mat, bNode *node, diff --git a/source/blender/nodes/shader/nodes/node_shader_script.cc b/source/blender/nodes/shader/nodes/node_shader_script.cc index 6c6578cf6c1..e6af90fa588 100644 --- a/source/blender/nodes/shader/nodes/node_shader_script.cc +++ b/source/blender/nodes/shader/nodes/node_shader_script.cc @@ -23,9 +23,42 @@ #include "node_shader_util.hh" +#include "UI_interface.h" +#include "UI_resources.h" + namespace blender::nodes::node_shader_script_cc { -/* **************** Script ******************** */ +static void node_shader_buts_script(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) +{ + uiLayout *row; + + row = uiLayoutRow(layout, false); + uiItemR(row, ptr, "mode", UI_ITEM_R_SPLIT_EMPTY_NAME | UI_ITEM_R_EXPAND, nullptr, ICON_NONE); + + row = uiLayoutRow(layout, true); + + if (RNA_enum_get(ptr, "mode") == NODE_SCRIPT_INTERNAL) { + uiItemR(row, ptr, "script", UI_ITEM_R_SPLIT_EMPTY_NAME, "", ICON_NONE); + } + else { + uiItemR(row, ptr, "filepath", UI_ITEM_R_SPLIT_EMPTY_NAME, "", ICON_NONE); + } + + uiItemO(row, "", ICON_FILE_REFRESH, "node.shader_script_update"); +} + +static void node_shader_buts_script_ex(uiLayout *layout, bContext *C, PointerRNA *ptr) +{ + uiItemS(layout); + + node_shader_buts_script(layout, C, ptr); + +#if 0 /* not implemented yet */ + if (RNA_enum_get(ptr, "mode") == NODE_SCRIPT_EXTERNAL) { + uiItemR(layout, ptr, "use_auto_update", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); + } +#endif +} static void init(bNodeTree *UNUSED(ntree), bNode *node) { @@ -69,6 +102,8 @@ void register_node_type_sh_script() static bNodeType ntype; sh_node_type_base(&ntype, SH_NODE_SCRIPT, "Script", NODE_CLASS_SCRIPT); + ntype.draw_buttons = file_ns::node_shader_buts_script; + ntype.draw_buttons_ex = file_ns::node_shader_buts_script_ex; node_type_init(&ntype, file_ns::init); node_type_storage( &ntype, "NodeShaderScript", file_ns::node_free_script, file_ns::node_copy_script); diff --git a/source/blender/nodes/shader/nodes/node_shader_sepcomb_hsv.cc b/source/blender/nodes/shader/nodes/node_shader_sepcomb_hsv.cc index 44cdc5cd402..700e4ce3667 100644 --- a/source/blender/nodes/shader/nodes/node_shader_sepcomb_hsv.cc +++ b/source/blender/nodes/shader/nodes/node_shader_sepcomb_hsv.cc @@ -26,16 +26,14 @@ namespace blender::nodes::node_shader_sepcomb_hsv_cc { /* **************** SEPARATE HSV ******************** */ -static bNodeSocketTemplate sh_node_sephsv_in[] = { - {SOCK_RGBA, N_("Color"), 0.8f, 0.8f, 0.8f, 1.0f}, - {-1, ""}, -}; -static bNodeSocketTemplate sh_node_sephsv_out[] = { - {SOCK_FLOAT, N_("H")}, - {SOCK_FLOAT, N_("S")}, - {SOCK_FLOAT, N_("V")}, - {-1, ""}, -}; + +static void node_declare_sephsv(NodeDeclarationBuilder &b) +{ + b.add_input<decl::Color>(N_("Color")).default_value({0.8f, 0.8f, 0.8f, 1.0}); + b.add_output<decl::Float>(N_("H")); + b.add_output<decl::Float>(N_("S")); + b.add_output<decl::Float>(N_("V")); +} static int gpu_shader_sephsv(GPUMaterial *mat, bNode *node, @@ -55,7 +53,7 @@ void register_node_type_sh_sephsv() static bNodeType ntype; sh_node_type_base(&ntype, SH_NODE_SEPHSV, "Separate HSV", NODE_CLASS_CONVERTER); - node_type_socket_templates(&ntype, file_ns::sh_node_sephsv_in, file_ns::sh_node_sephsv_out); + ntype.declare = file_ns::node_declare_sephsv; node_type_gpu(&ntype, file_ns::gpu_shader_sephsv); nodeRegisterType(&ntype); @@ -64,16 +62,14 @@ void register_node_type_sh_sephsv() namespace blender::nodes::node_shader_sepcomb_hsv_cc { /* **************** COMBINE HSV ******************** */ -static bNodeSocketTemplate sh_node_combhsv_in[] = { - {SOCK_FLOAT, N_("H"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_UNSIGNED}, - {SOCK_FLOAT, N_("S"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_UNSIGNED}, - {SOCK_FLOAT, N_("V"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, PROP_UNSIGNED}, - {-1, ""}, -}; -static bNodeSocketTemplate sh_node_combhsv_out[] = { - {SOCK_RGBA, N_("Color")}, - {-1, ""}, -}; + +static void node_declare_combhsv(NodeDeclarationBuilder &b) +{ + b.add_input<decl::Float>(N_("H")).default_value(0.0f).min(0.0f).max(1.0f).subtype(PROP_UNSIGNED); + b.add_input<decl::Float>(N_("S")).default_value(0.0f).min(0.0f).max(1.0f).subtype(PROP_UNSIGNED); + b.add_input<decl::Float>(N_("V")).default_value(0.0f).min(0.0f).max(1.0f).subtype(PROP_UNSIGNED); + b.add_output<decl::Color>(N_("Color")); +} static int gpu_shader_combhsv(GPUMaterial *mat, bNode *node, @@ -93,7 +89,7 @@ void register_node_type_sh_combhsv() static bNodeType ntype; sh_node_type_base(&ntype, SH_NODE_COMBHSV, "Combine HSV", NODE_CLASS_CONVERTER); - node_type_socket_templates(&ntype, file_ns::sh_node_combhsv_in, file_ns::sh_node_combhsv_out); + ntype.declare = file_ns::node_declare_combhsv; node_type_gpu(&ntype, file_ns::gpu_shader_combhsv); nodeRegisterType(&ntype); diff --git a/source/blender/nodes/shader/nodes/node_shader_sepcomb_rgb.cc b/source/blender/nodes/shader/nodes/node_shader_sepcomb_rgb.cc index 5ca2d4e2f68..d4be0bd14dc 100644 --- a/source/blender/nodes/shader/nodes/node_shader_sepcomb_rgb.cc +++ b/source/blender/nodes/shader/nodes/node_shader_sepcomb_rgb.cc @@ -32,7 +32,7 @@ static void sh_node_seprgb_declare(NodeDeclarationBuilder &b) b.add_output<decl::Float>(N_("R")); b.add_output<decl::Float>(N_("G")); b.add_output<decl::Float>(N_("B")); -}; +} static int gpu_shader_seprgb(GPUMaterial *mat, bNode *node, @@ -111,7 +111,7 @@ static void sh_node_combrgb_declare(NodeDeclarationBuilder &b) b.add_input<decl::Float>(N_("G")).min(0.0f).max(1.0f); b.add_input<decl::Float>(N_("B")).min(0.0f).max(1.0f); b.add_output<decl::Color>(N_("Image")); -}; +} static int gpu_shader_combrgb(GPUMaterial *mat, bNode *node, diff --git a/source/blender/nodes/shader/nodes/node_shader_sepcomb_xyz.cc b/source/blender/nodes/shader/nodes/node_shader_sepcomb_xyz.cc index 57eef716e88..f8064eb192a 100644 --- a/source/blender/nodes/shader/nodes/node_shader_sepcomb_xyz.cc +++ b/source/blender/nodes/shader/nodes/node_shader_sepcomb_xyz.cc @@ -32,7 +32,7 @@ static void sh_node_sepxyz_declare(NodeDeclarationBuilder &b) b.add_output<decl::Float>(N_("X")); b.add_output<decl::Float>(N_("Y")); b.add_output<decl::Float>(N_("Z")); -}; +} static int gpu_shader_sepxyz(GPUMaterial *mat, bNode *node, @@ -111,7 +111,7 @@ static void sh_node_combxyz_declare(NodeDeclarationBuilder &b) b.add_input<decl::Float>(N_("Y")).min(-10000.0f).max(10000.0f); b.add_input<decl::Float>(N_("Z")).min(-10000.0f).max(10000.0f); b.add_output<decl::Vector>(N_("Vector")); -}; +} static int gpu_shader_combxyz(GPUMaterial *mat, bNode *node, diff --git a/source/blender/nodes/shader/nodes/node_shader_shader_to_rgb.cc b/source/blender/nodes/shader/nodes/node_shader_shader_to_rgb.cc index 2e0ba3f1a36..153b1abfbca 100644 --- a/source/blender/nodes/shader/nodes/node_shader_shader_to_rgb.cc +++ b/source/blender/nodes/shader/nodes/node_shader_shader_to_rgb.cc @@ -26,7 +26,7 @@ static void node_declare(NodeDeclarationBuilder &b) b.add_input<decl::Shader>(N_("Shader")); b.add_output<decl::Color>(N_("Color")); b.add_output<decl::Float>(N_("Alpha")); -}; +} static int node_shader_gpu_shadertorgb(GPUMaterial *mat, bNode *node, diff --git a/source/blender/nodes/shader/nodes/node_shader_squeeze.cc b/source/blender/nodes/shader/nodes/node_shader_squeeze.cc index f71b6a3e4e5..83965160019 100644 --- a/source/blender/nodes/shader/nodes/node_shader_squeeze.cc +++ b/source/blender/nodes/shader/nodes/node_shader_squeeze.cc @@ -25,14 +25,13 @@ namespace blender::nodes::node_shader_squeeze_cc { -/* **************** VALUE SQUEEZE ******************** */ -static bNodeSocketTemplate sh_node_squeeze_in[] = { - {SOCK_FLOAT, N_("Value"), 0.0f, 0.0f, 0.0f, 0.0f, -100.0f, 100.0f, PROP_NONE}, - {SOCK_FLOAT, N_("Width"), 1.0f, 0.0f, 0.0f, 0.0f, -100.0f, 100.0f, PROP_NONE}, - {SOCK_FLOAT, N_("Center"), 0.0f, 0.0f, 0.0f, 0.0f, -100.0f, 100.0f, PROP_NONE}, - {-1, ""}}; - -static bNodeSocketTemplate sh_node_squeeze_out[] = {{SOCK_FLOAT, N_("Value")}, {-1, ""}}; +static void node_declare(NodeDeclarationBuilder &b) +{ + b.add_input<decl::Float>(N_("Value")).default_value(0.0f).min(-100.0f).max(100.0f); + b.add_input<decl::Float>(N_("Width")).default_value(1.0f).min(-100.0f).max(100.0f); + b.add_input<decl::Float>(N_("Center")).default_value(0.0f).min(-100.0f).max(100.0f); + b.add_output<decl::Float>(N_("Value")); +} static int gpu_shader_squeeze(GPUMaterial *mat, bNode *node, @@ -52,7 +51,7 @@ void register_node_type_sh_squeeze() static bNodeType ntype; sh_node_type_base(&ntype, SH_NODE_SQUEEZE, "Squeeze Value", NODE_CLASS_CONVERTER); - node_type_socket_templates(&ntype, file_ns::sh_node_squeeze_in, file_ns::sh_node_squeeze_out); + ntype.declare = file_ns::node_declare; node_type_gpu(&ntype, file_ns::gpu_shader_squeeze); nodeRegisterType(&ntype); diff --git a/source/blender/nodes/shader/nodes/node_shader_subsurface_scattering.cc b/source/blender/nodes/shader/nodes/node_shader_subsurface_scattering.cc index a5820aef194..f60db81b4a9 100644 --- a/source/blender/nodes/shader/nodes/node_shader_subsurface_scattering.cc +++ b/source/blender/nodes/shader/nodes/node_shader_subsurface_scattering.cc @@ -19,24 +19,35 @@ #include "node_shader_util.hh" -namespace blender::nodes::node_shader_subsurface_scattering_cc { +#include "UI_interface.h" +#include "UI_resources.h" -/* **************** OUTPUT ******************** */ +namespace blender::nodes::node_shader_subsurface_scattering_cc { -static bNodeSocketTemplate sh_node_subsurface_scattering_in[] = { - {SOCK_RGBA, N_("Color"), 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f}, - {SOCK_FLOAT, N_("Scale"), 1.0, 0.0f, 0.0f, 0.0f, 0.0f, 1000.0f}, - {SOCK_VECTOR, N_("Radius"), 1.0f, 0.2f, 0.1f, 0.0f, 0.0f, 100.0f, PROP_NONE, SOCK_COMPACT}, - {SOCK_FLOAT, N_("IOR"), 1.4f, 0.0f, 0.0f, 0.0f, 1.01f, 3.8f, PROP_FACTOR}, - {SOCK_FLOAT, N_("Anisotropy"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR}, - {SOCK_VECTOR, N_("Normal"), 0.0f, 0.0f, 0.0f, 1.0f, -1.0f, 1.0f, PROP_NONE, SOCK_HIDE_VALUE}, - {-1, ""}, -}; +static void node_declare(NodeDeclarationBuilder &b) +{ + b.add_input<decl::Color>(N_("Color")).default_value({0.8f, 0.8f, 0.8f, 1.0f}); + b.add_input<decl::Float>(N_("Scale")).default_value(1.0f).min(0.0f).max(1000.0f); + b.add_input<decl::Vector>(N_("Radius")) + .default_value({1.0f, 0.2f, 0.1f}) + .min(0.0f) + .max(100.0f) + .compact(); + b.add_input<decl::Float>(N_("IOR")).default_value(1.4f).min(1.01f).max(3.8f).subtype( + PROP_FACTOR); + b.add_input<decl::Float>(N_("Anisotropy")) + .default_value(0.0f) + .min(0.0f) + .max(1.0f) + .subtype(PROP_FACTOR); + b.add_input<decl::Vector>(N_("Normal")).hide_value(); + b.add_output<decl::Shader>(N_("BSSRDF")); +} -static bNodeSocketTemplate sh_node_subsurface_scattering_out[] = { - {SOCK_SHADER, N_("BSSRDF")}, - {-1, ""}, -}; +static void node_shader_buts_subsurface(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) +{ + uiItemR(layout, ptr, "falloff", UI_ITEM_R_SPLIT_EMPTY_NAME, "", ICON_NONE); +} static void node_shader_init_subsurface_scattering(bNodeTree *UNUSED(ntree), bNode *node) { @@ -91,9 +102,8 @@ void register_node_type_sh_subsurface_scattering() sh_node_type_base( &ntype, SH_NODE_SUBSURFACE_SCATTERING, "Subsurface Scattering", NODE_CLASS_SHADER); - node_type_socket_templates(&ntype, - file_ns::sh_node_subsurface_scattering_in, - file_ns::sh_node_subsurface_scattering_out); + ntype.declare = file_ns::node_declare; + ntype.draw_buttons = file_ns::node_shader_buts_subsurface; node_type_size_preset(&ntype, NODE_SIZE_MIDDLE); node_type_init(&ntype, file_ns::node_shader_init_subsurface_scattering); node_type_gpu(&ntype, file_ns::node_shader_gpu_subsurface_scattering); diff --git a/source/blender/nodes/shader/nodes/node_shader_tangent.cc b/source/blender/nodes/shader/nodes/node_shader_tangent.cc index 55eec96ce81..c4e5660b9f8 100644 --- a/source/blender/nodes/shader/nodes/node_shader_tangent.cc +++ b/source/blender/nodes/shader/nodes/node_shader_tangent.cc @@ -19,12 +19,43 @@ #include "node_shader_util.hh" +#include "BKE_context.h" + +#include "UI_interface.h" +#include "UI_resources.h" + namespace blender::nodes::node_shader_tangent_cc { static void node_declare(NodeDeclarationBuilder &b) { b.add_output<decl::Vector>(N_("Tangent")); -}; +} + +static void node_shader_buts_tangent(uiLayout *layout, bContext *C, PointerRNA *ptr) +{ + uiLayout *split, *row; + + split = uiLayoutSplit(layout, 0.0f, false); + + uiItemR(split, ptr, "direction_type", UI_ITEM_R_SPLIT_EMPTY_NAME, "", 0); + + row = uiLayoutRow(split, false); + + if (RNA_enum_get(ptr, "direction_type") == SHD_TANGENT_UVMAP) { + PointerRNA obptr = CTX_data_pointer_get(C, "active_object"); + + if (obptr.data && RNA_enum_get(&obptr, "type") == OB_MESH) { + PointerRNA dataptr = RNA_pointer_get(&obptr, "data"); + uiItemPointerR(row, ptr, "uv_map", &dataptr, "uv_layers", "", ICON_NONE); + } + else { + uiItemR(row, ptr, "uv_map", UI_ITEM_R_SPLIT_EMPTY_NAME, "", 0); + } + } + else { + uiItemR(row, ptr, "axis", UI_ITEM_R_SPLIT_EMPTY_NAME | UI_ITEM_R_EXPAND, nullptr, 0); + } +} static void node_shader_init_tangent(bNodeTree *UNUSED(ntree), bNode *node) { @@ -79,6 +110,7 @@ void register_node_type_sh_tangent() sh_node_type_base(&ntype, SH_NODE_TANGENT, "Tangent", NODE_CLASS_INPUT); ntype.declare = file_ns::node_declare; + ntype.draw_buttons = file_ns::node_shader_buts_tangent; node_type_size_preset(&ntype, NODE_SIZE_MIDDLE); node_type_init(&ntype, file_ns::node_shader_init_tangent); node_type_gpu(&ntype, file_ns::node_shader_gpu_tangent); diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_brick.cc b/source/blender/nodes/shader/nodes/node_shader_tex_brick.cc index 6a4a131a315..61b1613c11a 100644 --- a/source/blender/nodes/shader/nodes/node_shader_tex_brick.cc +++ b/source/blender/nodes/shader/nodes/node_shader_tex_brick.cc @@ -22,6 +22,9 @@ #include "BLI_float2.hh" #include "BLI_float4.hh" +#include "UI_interface.h" +#include "UI_resources.h" + namespace blender::nodes::node_shader_tex_brick_cc { static void sh_node_tex_brick_declare(NodeDeclarationBuilder &b) @@ -55,7 +58,27 @@ static void sh_node_tex_brick_declare(NodeDeclarationBuilder &b) .no_muted_links(); b.add_output<decl::Color>(N_("Color")); b.add_output<decl::Float>(N_("Fac")); -}; +} + +static void node_shader_buts_tex_brick(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) +{ + uiLayout *col; + + col = uiLayoutColumn(layout, true); + uiItemR(col, + ptr, + "offset", + UI_ITEM_R_SPLIT_EMPTY_NAME | UI_ITEM_R_SLIDER, + IFACE_("Offset"), + ICON_NONE); + uiItemR( + col, ptr, "offset_frequency", UI_ITEM_R_SPLIT_EMPTY_NAME, IFACE_("Frequency"), ICON_NONE); + + col = uiLayoutColumn(layout, true); + uiItemR(col, ptr, "squash", UI_ITEM_R_SPLIT_EMPTY_NAME, IFACE_("Squash"), ICON_NONE); + uiItemR( + col, ptr, "squash_frequency", UI_ITEM_R_SPLIT_EMPTY_NAME, IFACE_("Frequency"), ICON_NONE); +} static void node_shader_init_tex_brick(bNodeTree *UNUSED(ntree), bNode *node) { @@ -272,6 +295,7 @@ void register_node_type_sh_tex_brick() sh_fn_node_type_base(&ntype, SH_NODE_TEX_BRICK, "Brick Texture", NODE_CLASS_TEXTURE); ntype.declare = file_ns::sh_node_tex_brick_declare; + ntype.draw_buttons = file_ns::node_shader_buts_tex_brick; node_type_size_preset(&ntype, NODE_SIZE_MIDDLE); node_type_init(&ntype, file_ns::node_shader_init_tex_brick); node_type_storage( diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_checker.cc b/source/blender/nodes/shader/nodes/node_shader_tex_checker.cc index f22af9f4963..6022f13821a 100644 --- a/source/blender/nodes/shader/nodes/node_shader_tex_checker.cc +++ b/source/blender/nodes/shader/nodes/node_shader_tex_checker.cc @@ -34,7 +34,7 @@ static void sh_node_tex_checker_declare(NodeDeclarationBuilder &b) .no_muted_links(); b.add_output<decl::Color>(N_("Color")); b.add_output<decl::Float>(N_("Fac")); -}; +} static void node_shader_init_tex_checker(bNodeTree *UNUSED(ntree), bNode *node) { diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_coord.cc b/source/blender/nodes/shader/nodes/node_shader_tex_coord.cc index 9372d29456d..1bbaed88ea5 100644 --- a/source/blender/nodes/shader/nodes/node_shader_tex_coord.cc +++ b/source/blender/nodes/shader/nodes/node_shader_tex_coord.cc @@ -21,20 +21,27 @@ #include "DNA_customdata_types.h" +#include "UI_interface.h" +#include "UI_resources.h" + namespace blender::nodes::node_shader_tex_coord_cc { -/* **************** OUTPUT ******************** */ +static void node_declare(NodeDeclarationBuilder &b) +{ + b.add_output<decl::Vector>(N_("Generated")); + b.add_output<decl::Vector>(N_("Normal")); + b.add_output<decl::Vector>(N_("UV")); + b.add_output<decl::Vector>(N_("Object")); + b.add_output<decl::Vector>(N_("Camera")); + b.add_output<decl::Vector>(N_("Window")); + b.add_output<decl::Vector>(N_("Reflection")); +} -static bNodeSocketTemplate sh_node_tex_coord_out[] = { - {SOCK_VECTOR, N_("Generated"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, - {SOCK_VECTOR, N_("Normal"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, - {SOCK_VECTOR, N_("UV"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, - {SOCK_VECTOR, N_("Object"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, - {SOCK_VECTOR, N_("Camera"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, - {SOCK_VECTOR, N_("Window"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, - {SOCK_VECTOR, N_("Reflection"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, - {-1, ""}, -}; +static void node_shader_buts_tex_coord(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) +{ + uiItemR(layout, ptr, "object", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, 0); + uiItemR(layout, ptr, "from_instancer", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, 0); +} static int node_shader_gpu_tex_coord(GPUMaterial *mat, bNode *node, @@ -63,8 +70,8 @@ static int node_shader_gpu_tex_coord(GPUMaterial *mat, GPU_stack_link( mat, node, "node_tex_coord", in, out, viewpos, worldnor, inv_obmat, texcofacs, orco, mtface); - /* for each output. */ - for (int i = 0; sh_node_tex_coord_out[i].type != -1; i++) { + int i; + LISTBASE_FOREACH_INDEX (bNodeSocket *, sock, &node->outputs, i) { node_shader_gpu_bump_tex_coord(mat, node, &out[i].link); /* Normalize some vectors after dFdx/dFdy offsets. * This is the case for interpolated, non linear functions. @@ -95,7 +102,8 @@ void register_node_type_sh_tex_coord() static bNodeType ntype; sh_node_type_base(&ntype, SH_NODE_TEX_COORD, "Texture Coordinate", NODE_CLASS_INPUT); - node_type_socket_templates(&ntype, nullptr, file_ns::sh_node_tex_coord_out); + ntype.declare = file_ns::node_declare; + ntype.draw_buttons = file_ns::node_shader_buts_tex_coord; node_type_gpu(&ntype, file_ns::node_shader_gpu_tex_coord); nodeRegisterType(&ntype); diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_environment.cc b/source/blender/nodes/shader/nodes/node_shader_tex_environment.cc index aa96d075f7f..7b947392084 100644 --- a/source/blender/nodes/shader/nodes/node_shader_tex_environment.cc +++ b/source/blender/nodes/shader/nodes/node_shader_tex_environment.cc @@ -21,17 +21,11 @@ namespace blender::nodes::node_shader_tex_environment_cc { -/* **************** OUTPUT ******************** */ - -static bNodeSocketTemplate sh_node_tex_environment_in[] = { - {SOCK_VECTOR, N_("Vector"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE, SOCK_HIDE_VALUE}, - {-1, ""}, -}; - -static bNodeSocketTemplate sh_node_tex_environment_out[] = { - {SOCK_RGBA, N_("Color"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE, SOCK_NO_INTERNAL_LINK}, - {-1, ""}, -}; +static void node_declare(NodeDeclarationBuilder &b) +{ + b.add_input<decl::Vector>(N_("Vector")).hide_value(); + b.add_output<decl::Color>(N_("Color")).no_muted_links(); +} static void node_shader_init_tex_environment(bNodeTree *UNUSED(ntree), bNode *node) { @@ -144,8 +138,7 @@ void register_node_type_sh_tex_environment() static bNodeType ntype; sh_node_type_base(&ntype, SH_NODE_TEX_ENVIRONMENT, "Environment Texture", NODE_CLASS_TEXTURE); - node_type_socket_templates( - &ntype, file_ns::sh_node_tex_environment_in, file_ns::sh_node_tex_environment_out); + ntype.declare = file_ns::node_declare; node_type_init(&ntype, file_ns::node_shader_init_tex_environment); node_type_storage( &ntype, "NodeTexEnvironment", node_free_standard_storage, node_copy_standard_storage); diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_gradient.cc b/source/blender/nodes/shader/nodes/node_shader_tex_gradient.cc index 2f47f214681..85e0f262ca7 100644 --- a/source/blender/nodes/shader/nodes/node_shader_tex_gradient.cc +++ b/source/blender/nodes/shader/nodes/node_shader_tex_gradient.cc @@ -19,6 +19,9 @@ #include "node_shader_util.hh" +#include "UI_interface.h" +#include "UI_resources.h" + namespace blender::nodes::node_shader_tex_gradient_cc { static void sh_node_tex_gradient_declare(NodeDeclarationBuilder &b) @@ -27,7 +30,12 @@ static void sh_node_tex_gradient_declare(NodeDeclarationBuilder &b) b.add_input<decl::Vector>(N_("Vector")).hide_value().implicit_field(); b.add_output<decl::Color>(N_("Color")).no_muted_links(); b.add_output<decl::Float>(N_("Fac")).no_muted_links(); -}; +} + +static void node_shader_buts_tex_gradient(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) +{ + uiItemR(layout, ptr, "gradient_type", UI_ITEM_R_SPLIT_EMPTY_NAME, "", ICON_NONE); +} static void node_shader_init_tex_gradient(bNodeTree *UNUSED(ntree), bNode *node) { @@ -163,6 +171,7 @@ void register_node_type_sh_tex_gradient() sh_fn_node_type_base(&ntype, SH_NODE_TEX_GRADIENT, "Gradient Texture", NODE_CLASS_TEXTURE); ntype.declare = file_ns::sh_node_tex_gradient_declare; + ntype.draw_buttons = file_ns::node_shader_buts_tex_gradient; node_type_init(&ntype, file_ns::node_shader_init_tex_gradient); node_type_storage( &ntype, "NodeTexGradient", node_free_standard_storage, node_copy_standard_storage); diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_image.cc b/source/blender/nodes/shader/nodes/node_shader_tex_image.cc index 745121691ac..d5479f46a35 100644 --- a/source/blender/nodes/shader/nodes/node_shader_tex_image.cc +++ b/source/blender/nodes/shader/nodes/node_shader_tex_image.cc @@ -27,7 +27,7 @@ static void sh_node_tex_image_declare(NodeDeclarationBuilder &b) b.add_input<decl::Vector>(N_("Vector")).implicit_field(); b.add_output<decl::Color>(N_("Color")).no_muted_links(); b.add_output<decl::Float>(N_("Alpha")).no_muted_links(); -}; +} static void node_shader_init_tex_image(bNodeTree *UNUSED(ntree), bNode *node) { diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_magic.cc b/source/blender/nodes/shader/nodes/node_shader_tex_magic.cc index b388f1a3172..e40914783b6 100644 --- a/source/blender/nodes/shader/nodes/node_shader_tex_magic.cc +++ b/source/blender/nodes/shader/nodes/node_shader_tex_magic.cc @@ -19,6 +19,9 @@ #include "node_shader_util.hh" +#include "UI_interface.h" +#include "UI_resources.h" + namespace blender::nodes::node_shader_tex_magic_cc { static void sh_node_tex_magic_declare(NodeDeclarationBuilder &b) @@ -29,7 +32,12 @@ static void sh_node_tex_magic_declare(NodeDeclarationBuilder &b) b.add_input<decl::Float>(N_("Distortion")).min(-1000.0f).max(1000.0f).default_value(1.0f); b.add_output<decl::Color>(N_("Color")).no_muted_links(); b.add_output<decl::Float>(N_("Fac")).no_muted_links(); -}; +} + +static void node_shader_buts_tex_magic(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) +{ + uiItemR(layout, ptr, "turbulence_depth", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); +} static void node_shader_init_tex_magic(bNodeTree *UNUSED(ntree), bNode *node) { @@ -185,6 +193,7 @@ void register_node_type_sh_tex_magic() sh_fn_node_type_base(&ntype, SH_NODE_TEX_MAGIC, "Magic Texture", NODE_CLASS_TEXTURE); ntype.declare = file_ns::sh_node_tex_magic_declare; + ntype.draw_buttons = file_ns::node_shader_buts_tex_magic; node_type_init(&ntype, file_ns::node_shader_init_tex_magic); node_type_storage( &ntype, "NodeTexMagic", node_free_standard_storage, node_copy_standard_storage); diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_musgrave.cc b/source/blender/nodes/shader/nodes/node_shader_tex_musgrave.cc index 94713ad24ba..45c2a83c178 100644 --- a/source/blender/nodes/shader/nodes/node_shader_tex_musgrave.cc +++ b/source/blender/nodes/shader/nodes/node_shader_tex_musgrave.cc @@ -21,6 +21,9 @@ #include "BLI_noise.hh" +#include "UI_interface.h" +#include "UI_resources.h" + namespace blender::nodes::node_shader_tex_musgrave_cc { NODE_STORAGE_FUNCS(NodeTexMusgrave) @@ -40,7 +43,13 @@ static void sh_node_tex_musgrave_declare(NodeDeclarationBuilder &b) b.add_input<decl::Float>(N_("Offset")).min(-1000.0f).max(1000.0f); b.add_input<decl::Float>(N_("Gain")).min(0.0f).max(1000.0f).default_value(1.0f); b.add_output<decl::Float>(N_("Fac")).no_muted_links(); -}; +} + +static void node_shader_buts_tex_musgrave(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) +{ + uiItemR(layout, ptr, "musgrave_dimensions", UI_ITEM_R_SPLIT_EMPTY_NAME, "", ICON_NONE); + uiItemR(layout, ptr, "musgrave_type", UI_ITEM_R_SPLIT_EMPTY_NAME, "", ICON_NONE); +} static void node_shader_init_tex_musgrave(bNodeTree *UNUSED(ntree), bNode *node) { @@ -539,6 +548,7 @@ void register_node_type_sh_tex_musgrave() sh_fn_node_type_base(&ntype, SH_NODE_TEX_MUSGRAVE, "Musgrave Texture", NODE_CLASS_TEXTURE); ntype.declare = file_ns::sh_node_tex_musgrave_declare; + ntype.draw_buttons = file_ns::node_shader_buts_tex_musgrave; node_type_size_preset(&ntype, NODE_SIZE_MIDDLE); node_type_init(&ntype, file_ns::node_shader_init_tex_musgrave); node_type_storage( diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_noise.cc b/source/blender/nodes/shader/nodes/node_shader_tex_noise.cc index fe402675ec6..0e549859a39 100644 --- a/source/blender/nodes/shader/nodes/node_shader_tex_noise.cc +++ b/source/blender/nodes/shader/nodes/node_shader_tex_noise.cc @@ -21,6 +21,9 @@ #include "BLI_noise.hh" +#include "UI_interface.h" +#include "UI_resources.h" + namespace blender::nodes::node_shader_tex_noise_cc { NODE_STORAGE_FUNCS(NodeTexNoise) @@ -43,7 +46,12 @@ static void sh_node_tex_noise_declare(NodeDeclarationBuilder &b) b.add_input<decl::Float>(N_("Distortion")).min(-1000.0f).max(1000.0f).default_value(0.0f); b.add_output<decl::Float>(N_("Fac")).no_muted_links(); b.add_output<decl::Color>(N_("Color")).no_muted_links(); -}; +} + +static void node_shader_buts_tex_noise(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) +{ + uiItemR(layout, ptr, "noise_dimensions", UI_ITEM_R_SPLIT_EMPTY_NAME, "", ICON_NONE); +} static void node_shader_init_tex_noise(bNodeTree *UNUSED(ntree), bNode *node) { @@ -256,6 +264,7 @@ void register_node_type_sh_tex_noise() sh_fn_node_type_base(&ntype, SH_NODE_TEX_NOISE, "Noise Texture", NODE_CLASS_TEXTURE); ntype.declare = file_ns::sh_node_tex_noise_declare; + ntype.draw_buttons = file_ns::node_shader_buts_tex_noise; node_type_init(&ntype, file_ns::node_shader_init_tex_noise); node_type_storage( &ntype, "NodeTexNoise", node_free_standard_storage, node_copy_standard_storage); diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_pointdensity.cc b/source/blender/nodes/shader/nodes/node_shader_tex_pointdensity.cc index 31d14d09963..1a4cf70565f 100644 --- a/source/blender/nodes/shader/nodes/node_shader_tex_pointdensity.cc +++ b/source/blender/nodes/shader/nodes/node_shader_tex_pointdensity.cc @@ -21,20 +21,63 @@ #include "RE_texture.h" +#include "UI_interface.h" +#include "UI_resources.h" + namespace blender::nodes::node_shader_tex_pointdensity_cc { -/* **************** OUTPUT ******************** */ +static void node_declare(NodeDeclarationBuilder &b) +{ + b.add_input<decl::Vector>(N_("Vector")).hide_value(); + b.add_output<decl::Color>(N_("Color")); + b.add_output<decl::Float>(N_("Density")); +} + +static void node_shader_buts_tex_pointdensity(uiLayout *layout, + bContext *UNUSED(C), + PointerRNA *ptr) +{ + bNode *node = (bNode *)ptr->data; + NodeShaderTexPointDensity *shader_point_density = (NodeShaderTexPointDensity *)node->storage; + Object *ob = (Object *)node->id; + + PointerRNA ob_ptr, obdata_ptr; + RNA_id_pointer_create((ID *)ob, &ob_ptr); + RNA_id_pointer_create(ob ? (ID *)ob->data : nullptr, &obdata_ptr); -static bNodeSocketTemplate sh_node_tex_pointdensity_in[] = { - {SOCK_VECTOR, N_("Vector"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE, SOCK_HIDE_VALUE}, - {-1, ""}, -}; + uiItemR(layout, ptr, "point_source", UI_ITEM_R_EXPAND, nullptr, ICON_NONE); + uiItemR(layout, ptr, "object", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); -static bNodeSocketTemplate sh_node_tex_pointdensity_out[] = { - {SOCK_RGBA, N_("Color"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f}, - {SOCK_FLOAT, N_("Density"), 0.0f, 0.0f, 0.0f, 0.0f, -10000.0f, 10000.0f}, - {-1, ""}, -}; + if (node->id && shader_point_density->point_source == SHD_POINTDENSITY_SOURCE_PSYS) { + PointerRNA dataptr; + RNA_id_pointer_create((ID *)node->id, &dataptr); + uiItemPointerR( + layout, ptr, "particle_system", &dataptr, "particle_systems", nullptr, ICON_NONE); + } + + uiItemR(layout, ptr, "space", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); + uiItemR(layout, ptr, "radius", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); + uiItemR(layout, ptr, "interpolation", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); + uiItemR(layout, ptr, "resolution", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); + if (shader_point_density->point_source == SHD_POINTDENSITY_SOURCE_PSYS) { + uiItemR(layout, ptr, "particle_color_source", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); + } + else { + uiItemR(layout, ptr, "vertex_color_source", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); + if (shader_point_density->ob_color_source == SHD_POINTDENSITY_COLOR_VERTWEIGHT) { + if (ob_ptr.data) { + uiItemPointerR( + layout, ptr, "vertex_attribute_name", &ob_ptr, "vertex_groups", "", ICON_NONE); + } + } + if (shader_point_density->ob_color_source == SHD_POINTDENSITY_COLOR_VERTCOL) { + if (obdata_ptr.data) { + uiItemPointerR( + layout, ptr, "vertex_attribute_name", &obdata_ptr, "vertex_colors", "", ICON_NONE); + } + } + } +} static void node_shader_init_tex_pointdensity(bNodeTree *UNUSED(ntree), bNode *node) { @@ -76,8 +119,8 @@ void register_node_type_sh_tex_pointdensity() static bNodeType ntype; sh_node_type_base(&ntype, SH_NODE_TEX_POINTDENSITY, "Point Density", NODE_CLASS_TEXTURE); - node_type_socket_templates( - &ntype, file_ns::sh_node_tex_pointdensity_in, file_ns::sh_node_tex_pointdensity_out); + ntype.declare = file_ns::node_declare; + ntype.draw_buttons = file_ns::node_shader_buts_tex_pointdensity; node_type_init(&ntype, file_ns::node_shader_init_tex_pointdensity); node_type_storage(&ntype, "NodeShaderTexPointDensity", diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_sky.cc b/source/blender/nodes/shader/nodes/node_shader_tex_sky.cc index 30ec746c2d0..b8728d69bba 100644 --- a/source/blender/nodes/shader/nodes/node_shader_tex_sky.cc +++ b/source/blender/nodes/shader/nodes/node_shader_tex_sky.cc @@ -20,19 +20,59 @@ #include "node_shader_util.hh" #include "sky_model.h" +#include "BKE_context.h" +#include "BKE_scene.h" + +#include "UI_interface.h" +#include "UI_resources.h" + namespace blender::nodes::node_shader_tex_sky_cc { -/* **************** OUTPUT ******************** */ +static void node_declare(NodeDeclarationBuilder &b) +{ + b.add_input<decl::Vector>(N_("Vector")).hide_value(); + b.add_output<decl::Color>(N_("Color")).no_muted_links(); +} -static bNodeSocketTemplate sh_node_tex_sky_in[] = { - {SOCK_VECTOR, N_("Vector"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE, SOCK_HIDE_VALUE}, - {-1, ""}, -}; +static void node_shader_buts_tex_sky(uiLayout *layout, bContext *C, PointerRNA *ptr) +{ + uiItemR(layout, ptr, "sky_type", UI_ITEM_R_SPLIT_EMPTY_NAME, "", ICON_NONE); -static bNodeSocketTemplate sh_node_tex_sky_out[] = { - {SOCK_RGBA, N_("Color"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_NONE, SOCK_NO_INTERNAL_LINK}, - {-1, ""}, -}; + if (RNA_enum_get(ptr, "sky_type") == SHD_SKY_PREETHAM) { + uiItemR(layout, ptr, "sun_direction", UI_ITEM_R_SPLIT_EMPTY_NAME, "", ICON_NONE); + uiItemR(layout, ptr, "turbidity", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); + } + if (RNA_enum_get(ptr, "sky_type") == SHD_SKY_HOSEK) { + uiItemR(layout, ptr, "sun_direction", UI_ITEM_R_SPLIT_EMPTY_NAME, "", ICON_NONE); + uiItemR(layout, ptr, "turbidity", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); + uiItemR(layout, ptr, "ground_albedo", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); + } + if (RNA_enum_get(ptr, "sky_type") == SHD_SKY_NISHITA) { + Scene *scene = CTX_data_scene(C); + if (BKE_scene_uses_blender_eevee(scene)) { + uiItemL(layout, TIP_("Nishita not available in Eevee"), ICON_ERROR); + } + uiItemR(layout, ptr, "sun_disc", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, 0); + + uiLayout *col; + if (RNA_boolean_get(ptr, "sun_disc")) { + col = uiLayoutColumn(layout, true); + uiItemR(col, ptr, "sun_size", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); + uiItemR(col, ptr, "sun_intensity", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); + } + + col = uiLayoutColumn(layout, true); + uiItemR(col, ptr, "sun_elevation", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); + uiItemR(col, ptr, "sun_rotation", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); + + uiItemR(layout, ptr, "altitude", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); + + col = uiLayoutColumn(layout, true); + uiItemR(col, ptr, "air_density", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); + uiItemR(col, ptr, "dust_density", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); + uiItemR(col, ptr, "ozone_density", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); + } +} static void node_shader_init_tex_sky(bNodeTree *UNUSED(ntree), bNode *node) { @@ -215,7 +255,8 @@ void register_node_type_sh_tex_sky() static bNodeType ntype; sh_node_type_base(&ntype, SH_NODE_TEX_SKY, "Sky Texture", NODE_CLASS_TEXTURE); - node_type_socket_templates(&ntype, file_ns::sh_node_tex_sky_in, file_ns::sh_node_tex_sky_out); + ntype.declare = file_ns::node_declare; + ntype.draw_buttons = file_ns::node_shader_buts_tex_sky; node_type_size_preset(&ntype, NODE_SIZE_MIDDLE); node_type_init(&ntype, file_ns::node_shader_init_tex_sky); node_type_storage(&ntype, "NodeTexSky", node_free_standard_storage, node_copy_standard_storage); diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_voronoi.cc b/source/blender/nodes/shader/nodes/node_shader_tex_voronoi.cc index 72f7fe08a15..2b5c1ddfe21 100644 --- a/source/blender/nodes/shader/nodes/node_shader_tex_voronoi.cc +++ b/source/blender/nodes/shader/nodes/node_shader_tex_voronoi.cc @@ -21,6 +21,9 @@ #include "BLI_noise.hh" +#include "UI_interface.h" +#include "UI_resources.h" + namespace blender::nodes::node_shader_tex_voronoi_cc { NODE_STORAGE_FUNCS(NodeTexVoronoi) @@ -60,7 +63,18 @@ static void sh_node_tex_voronoi_declare(NodeDeclarationBuilder &b) b.add_output<decl::Float>(N_("Radius")).no_muted_links().make_available([](bNode &node) { node_storage(node).feature = SHD_VORONOI_N_SPHERE_RADIUS; }); -}; +} + +static void node_shader_buts_tex_voronoi(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) +{ + uiItemR(layout, ptr, "voronoi_dimensions", UI_ITEM_R_SPLIT_EMPTY_NAME, "", ICON_NONE); + uiItemR(layout, ptr, "feature", UI_ITEM_R_SPLIT_EMPTY_NAME, "", ICON_NONE); + int feature = RNA_enum_get(ptr, "feature"); + if (!ELEM(feature, SHD_VORONOI_DISTANCE_TO_EDGE, SHD_VORONOI_N_SPHERE_RADIUS) && + RNA_enum_get(ptr, "voronoi_dimensions") != 1) { + uiItemR(layout, ptr, "distance", UI_ITEM_R_SPLIT_EMPTY_NAME, "", ICON_NONE); + } +} static void node_shader_init_tex_voronoi(bNodeTree *UNUSED(ntree), bNode *node) { @@ -1346,6 +1360,7 @@ void register_node_type_sh_tex_voronoi() sh_fn_node_type_base(&ntype, SH_NODE_TEX_VORONOI, "Voronoi Texture", NODE_CLASS_TEXTURE); ntype.declare = file_ns::sh_node_tex_voronoi_declare; + ntype.draw_buttons = file_ns::node_shader_buts_tex_voronoi; node_type_init(&ntype, file_ns::node_shader_init_tex_voronoi); node_type_storage( &ntype, "NodeTexVoronoi", node_free_standard_storage, node_copy_standard_storage); diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_wave.cc b/source/blender/nodes/shader/nodes/node_shader_tex_wave.cc index 9a3e214333b..fc6c66061ff 100644 --- a/source/blender/nodes/shader/nodes/node_shader_tex_wave.cc +++ b/source/blender/nodes/shader/nodes/node_shader_tex_wave.cc @@ -21,6 +21,9 @@ #include "BLI_noise.hh" +#include "UI_interface.h" +#include "UI_resources.h" + namespace blender::nodes::node_shader_tex_wave_cc { static void sh_node_tex_wave_declare(NodeDeclarationBuilder &b) @@ -39,7 +42,21 @@ static void sh_node_tex_wave_declare(NodeDeclarationBuilder &b) b.add_input<decl::Float>(N_("Phase Offset")).min(-1000.0f).max(1000.0f).default_value(0.0f); b.add_output<decl::Color>(N_("Color")).no_muted_links(); b.add_output<decl::Float>(N_("Fac")).no_muted_links(); -}; +} + +static void node_shader_buts_tex_wave(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) +{ + uiItemR(layout, ptr, "wave_type", UI_ITEM_R_SPLIT_EMPTY_NAME, "", ICON_NONE); + int type = RNA_enum_get(ptr, "wave_type"); + if (type == SHD_WAVE_BANDS) { + uiItemR(layout, ptr, "bands_direction", UI_ITEM_R_SPLIT_EMPTY_NAME, "", ICON_NONE); + } + else { /* SHD_WAVE_RINGS */ + uiItemR(layout, ptr, "rings_direction", UI_ITEM_R_SPLIT_EMPTY_NAME, "", ICON_NONE); + } + + uiItemR(layout, ptr, "wave_profile", UI_ITEM_R_SPLIT_EMPTY_NAME, "", ICON_NONE); +} static void node_shader_init_tex_wave(bNodeTree *UNUSED(ntree), bNode *node) { @@ -222,6 +239,7 @@ void register_node_type_sh_tex_wave() sh_fn_node_type_base(&ntype, SH_NODE_TEX_WAVE, "Wave Texture", NODE_CLASS_TEXTURE); ntype.declare = file_ns::sh_node_tex_wave_declare; + ntype.draw_buttons = file_ns::node_shader_buts_tex_wave; node_type_size_preset(&ntype, NODE_SIZE_MIDDLE); node_type_init(&ntype, file_ns::node_shader_init_tex_wave); node_type_storage(&ntype, "NodeTexWave", node_free_standard_storage, node_copy_standard_storage); diff --git a/source/blender/nodes/shader/nodes/node_shader_tex_white_noise.cc b/source/blender/nodes/shader/nodes/node_shader_tex_white_noise.cc index 96d45d7c53b..3a5bc98896c 100644 --- a/source/blender/nodes/shader/nodes/node_shader_tex_white_noise.cc +++ b/source/blender/nodes/shader/nodes/node_shader_tex_white_noise.cc @@ -21,6 +21,9 @@ #include "BLI_noise.hh" +#include "UI_interface.h" +#include "UI_resources.h" + namespace blender::nodes::node_shader_tex_white_noise_cc { static void sh_node_tex_white_noise_declare(NodeDeclarationBuilder &b) @@ -33,7 +36,12 @@ static void sh_node_tex_white_noise_declare(NodeDeclarationBuilder &b) }); b.add_output<decl::Float>(N_("Value")); b.add_output<decl::Color>(N_("Color")); -}; +} + +static void node_shader_buts_white_noise(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) +{ + uiItemR(layout, ptr, "noise_dimensions", UI_ITEM_R_SPLIT_EMPTY_NAME, "", ICON_NONE); +} static void node_shader_init_tex_white_noise(bNodeTree *UNUSED(ntree), bNode *node) { @@ -198,6 +206,7 @@ void register_node_type_sh_tex_white_noise() sh_fn_node_type_base(&ntype, SH_NODE_TEX_WHITE_NOISE, "White Noise Texture", NODE_CLASS_TEXTURE); ntype.declare = file_ns::sh_node_tex_white_noise_declare; + ntype.draw_buttons = file_ns::node_shader_buts_white_noise; node_type_init(&ntype, file_ns::node_shader_init_tex_white_noise); node_type_gpu(&ntype, file_ns::gpu_shader_tex_white_noise); node_type_update(&ntype, file_ns::node_shader_update_tex_white_noise); diff --git a/source/blender/nodes/shader/nodes/node_shader_uv_along_stroke.cc b/source/blender/nodes/shader/nodes/node_shader_uv_along_stroke.cc index 18bea5c1ec6..382a0f16ecd 100644 --- a/source/blender/nodes/shader/nodes/node_shader_uv_along_stroke.cc +++ b/source/blender/nodes/shader/nodes/node_shader_uv_along_stroke.cc @@ -19,6 +19,9 @@ #include "node_shader_util.hh" +#include "UI_interface.h" +#include "UI_resources.h" + namespace blender::nodes::node_shader_uv_along_stroke_cc { static void node_declare(NodeDeclarationBuilder &b) @@ -26,6 +29,11 @@ static void node_declare(NodeDeclarationBuilder &b) b.add_output<decl::Vector>(N_("UV")); } +static void node_shader_buts_uvalongstroke(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) +{ + uiItemR(layout, ptr, "use_tips", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, 0); +} + } // namespace blender::nodes::node_shader_uv_along_stroke_cc /* node type definition */ @@ -37,6 +45,7 @@ void register_node_type_sh_uvalongstroke() sh_node_type_base(&ntype, SH_NODE_UVALONGSTROKE, "UV Along Stroke", NODE_CLASS_INPUT); ntype.declare = file_ns::node_declare; + ntype.draw_buttons = file_ns::node_shader_buts_uvalongstroke; nodeRegisterType(&ntype); } diff --git a/source/blender/nodes/shader/nodes/node_shader_uvmap.cc b/source/blender/nodes/shader/nodes/node_shader_uvmap.cc index 70fde996dc3..b004be75188 100644 --- a/source/blender/nodes/shader/nodes/node_shader_uvmap.cc +++ b/source/blender/nodes/shader/nodes/node_shader_uvmap.cc @@ -19,8 +19,13 @@ #include "node_shader_util.hh" +#include "BKE_context.h" + #include "DNA_customdata_types.h" +#include "UI_interface.h" +#include "UI_resources.h" + namespace blender::nodes::node_shader_uvmap_cc { static void node_declare(NodeDeclarationBuilder &b) @@ -28,6 +33,20 @@ static void node_declare(NodeDeclarationBuilder &b) b.add_output<decl::Vector>(N_("UV")); } +static void node_shader_buts_uvmap(uiLayout *layout, bContext *C, PointerRNA *ptr) +{ + uiItemR(layout, ptr, "from_instancer", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, 0); + + if (!RNA_boolean_get(ptr, "from_instancer")) { + PointerRNA obptr = CTX_data_pointer_get(C, "active_object"); + + if (obptr.data && RNA_enum_get(&obptr, "type") == OB_MESH) { + PointerRNA dataptr = RNA_pointer_get(&obptr, "data"); + uiItemPointerR(layout, ptr, "uv_map", &dataptr, "uv_layers", "", ICON_NONE); + } + } +} + static void node_shader_init_uvmap(bNodeTree *UNUSED(ntree), bNode *node) { NodeShaderUVMap *attr = MEM_cnew<NodeShaderUVMap>("NodeShaderUVMap"); @@ -61,6 +80,7 @@ void register_node_type_sh_uvmap() sh_node_type_base(&ntype, SH_NODE_UVMAP, "UV Map", NODE_CLASS_INPUT); ntype.declare = file_ns::node_declare; + ntype.draw_buttons = file_ns::node_shader_buts_uvmap; node_type_size_preset(&ntype, NODE_SIZE_MIDDLE); node_type_init(&ntype, file_ns::node_shader_init_uvmap); node_type_storage( diff --git a/source/blender/nodes/shader/nodes/node_shader_value.cc b/source/blender/nodes/shader/nodes/node_shader_value.cc index 21f2e072990..265f03e6e88 100644 --- a/source/blender/nodes/shader/nodes/node_shader_value.cc +++ b/source/blender/nodes/shader/nodes/node_shader_value.cc @@ -28,7 +28,7 @@ namespace blender::nodes::node_shader_value_cc { static void sh_node_value_declare(NodeDeclarationBuilder &b) { b.add_output<decl::Float>(N_("Value")); -}; +} static int gpu_shader_value(GPUMaterial *mat, bNode *node, diff --git a/source/blender/nodes/shader/nodes/node_shader_vector_math.cc b/source/blender/nodes/shader/nodes/node_shader_vector_math.cc index 1276592e2af..591734c7dd6 100644 --- a/source/blender/nodes/shader/nodes/node_shader_vector_math.cc +++ b/source/blender/nodes/shader/nodes/node_shader_vector_math.cc @@ -28,6 +28,9 @@ #include "RNA_enum_types.h" +#include "UI_interface.h" +#include "UI_resources.h" + namespace blender::nodes::node_shader_vector_math_cc { static void sh_node_vector_math_declare(NodeDeclarationBuilder &b) @@ -39,7 +42,12 @@ static void sh_node_vector_math_declare(NodeDeclarationBuilder &b) b.add_input<decl::Float>(N_("Scale")).default_value(1.0f).min(-10000.0f).max(10000.0f); b.add_output<decl::Vector>(N_("Vector")); b.add_output<decl::Float>(N_("Value")); -}; +} + +static void node_shader_buts_vect_math(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) +{ + uiItemR(layout, ptr, "operation", UI_ITEM_R_SPLIT_EMPTY_NAME, "", ICON_NONE); +} class SocketSearchOp { public: @@ -331,6 +339,7 @@ void register_node_type_sh_vect_math() sh_fn_node_type_base(&ntype, SH_NODE_VECTOR_MATH, "Vector Math", NODE_CLASS_OP_VECTOR); ntype.declare = file_ns::sh_node_vector_math_declare; + ntype.draw_buttons = file_ns::node_shader_buts_vect_math; ntype.labelfunc = node_vector_math_label; node_type_gpu(&ntype, file_ns::gpu_shader_vector_math); node_type_update(&ntype, file_ns::node_shader_update_vector_math); diff --git a/source/blender/nodes/shader/nodes/node_shader_vector_rotate.cc b/source/blender/nodes/shader/nodes/node_shader_vector_rotate.cc index bb7a81ef5d8..d8dcd028c56 100644 --- a/source/blender/nodes/shader/nodes/node_shader_vector_rotate.cc +++ b/source/blender/nodes/shader/nodes/node_shader_vector_rotate.cc @@ -23,6 +23,9 @@ #include "node_shader_util.hh" +#include "UI_interface.h" +#include "UI_resources.h" + namespace blender::nodes::node_shader_vector_rotate_cc { static void sh_node_vector_rotate_declare(NodeDeclarationBuilder &b) @@ -34,7 +37,13 @@ static void sh_node_vector_rotate_declare(NodeDeclarationBuilder &b) b.add_input<decl::Float>(N_("Angle")).subtype(PROP_ANGLE); b.add_input<decl::Vector>(N_("Rotation")).subtype(PROP_EULER); b.add_output<decl::Vector>(N_("Vector")); -}; +} + +static void node_shader_buts_vector_rotate(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) +{ + uiItemR(layout, ptr, "rotation_type", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, ICON_NONE); + uiItemR(layout, ptr, "invert", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, 0); +} static const char *gpu_shader_get_name(int mode) { @@ -213,6 +222,7 @@ void register_node_type_sh_vector_rotate() sh_fn_node_type_base(&ntype, SH_NODE_VECTOR_ROTATE, "Vector Rotate", NODE_CLASS_OP_VECTOR); ntype.declare = file_ns::sh_node_vector_rotate_declare; + ntype.draw_buttons = file_ns::node_shader_buts_vector_rotate; node_type_gpu(&ntype, file_ns::gpu_shader_vector_rotate); node_type_update(&ntype, file_ns::node_shader_update_vector_rotate); ntype.build_multi_function = file_ns::sh_node_vector_rotate_build_multi_function; diff --git a/source/blender/nodes/shader/nodes/node_shader_vector_transform.cc b/source/blender/nodes/shader/nodes/node_shader_vector_transform.cc index 30bc3f020b1..a8a6902e30c 100644 --- a/source/blender/nodes/shader/nodes/node_shader_vector_transform.cc +++ b/source/blender/nodes/shader/nodes/node_shader_vector_transform.cc @@ -23,16 +23,31 @@ #include "node_shader_util.hh" +#include "UI_interface.h" +#include "UI_resources.h" + namespace blender::nodes::node_shader_vector_transform_cc { -/* **************** Vector Transform ******************** */ -static bNodeSocketTemplate sh_node_vect_transform_in[] = { - {SOCK_VECTOR, N_("Vector"), 0.5f, 0.5f, 0.5f, 1.0f, -10000.0f, 10000.0f, PROP_NONE}, {-1, ""}}; +static void node_declare(NodeDeclarationBuilder &b) +{ + b.add_input<decl::Vector>(N_("Vector")) + .default_value({0.5f, 0.5f, 0.5f}) + .min(-10000.0f) + .max(10000.0f); + b.add_output<decl::Vector>(N_("Vector")); +} -static bNodeSocketTemplate sh_node_vect_transform_out[] = { - {SOCK_VECTOR, N_("Vector")}, - {-1, ""}, -}; +static void node_shader_buts_vect_transform(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) +{ + uiItemR(layout, + ptr, + "vector_type", + UI_ITEM_R_SPLIT_EMPTY_NAME | UI_ITEM_R_EXPAND, + nullptr, + ICON_NONE); + uiItemR(layout, ptr, "convert_from", UI_ITEM_R_SPLIT_EMPTY_NAME, "", ICON_NONE); + uiItemR(layout, ptr, "convert_to", UI_ITEM_R_SPLIT_EMPTY_NAME, "", ICON_NONE); +} static void node_shader_init_vect_transform(bNodeTree *UNUSED(ntree), bNode *node) { @@ -138,9 +153,9 @@ void register_node_type_sh_vect_transform() static bNodeType ntype; sh_node_type_base(&ntype, SH_NODE_VECT_TRANSFORM, "Vector Transform", NODE_CLASS_OP_VECTOR); + ntype.declare = file_ns::node_declare; + ntype.draw_buttons = file_ns::node_shader_buts_vect_transform; node_type_init(&ntype, file_ns::node_shader_init_vect_transform); - node_type_socket_templates( - &ntype, file_ns::sh_node_vect_transform_in, file_ns::sh_node_vect_transform_out); node_type_storage( &ntype, "NodeShaderVectTransform", node_free_standard_storage, node_copy_standard_storage); node_type_gpu(&ntype, file_ns::gpu_shader_vect_transform); diff --git a/source/blender/nodes/shader/nodes/node_shader_vertex_color.cc b/source/blender/nodes/shader/nodes/node_shader_vertex_color.cc index 0d3f047f54e..6501527ef5d 100644 --- a/source/blender/nodes/shader/nodes/node_shader_vertex_color.cc +++ b/source/blender/nodes/shader/nodes/node_shader_vertex_color.cc @@ -19,6 +19,11 @@ #include "node_shader_util.hh" +#include "BKE_context.h" + +#include "UI_interface.h" +#include "UI_resources.h" + namespace blender::nodes::node_shader_vertex_color_cc { static void node_declare(NodeDeclarationBuilder &b) @@ -27,6 +32,26 @@ static void node_declare(NodeDeclarationBuilder &b) b.add_output<decl::Float>(N_("Alpha")); } +static void node_shader_buts_vertex_color(uiLayout *layout, bContext *C, PointerRNA *ptr) +{ + PointerRNA obptr = CTX_data_pointer_get(C, "active_object"); + if (obptr.data && RNA_enum_get(&obptr, "type") == OB_MESH) { + PointerRNA dataptr = RNA_pointer_get(&obptr, "data"); + + if (U.experimental.use_sculpt_vertex_colors && + RNA_collection_length(&dataptr, "sculpt_vertex_colors")) { + uiItemPointerR( + layout, ptr, "layer_name", &dataptr, "sculpt_vertex_colors", "", ICON_GROUP_VCOL); + } + else { + uiItemPointerR(layout, ptr, "layer_name", &dataptr, "vertex_colors", "", ICON_GROUP_VCOL); + } + } + else { + uiItemL(layout, TIP_("No mesh in active object"), ICON_ERROR); + } +} + static void node_shader_init_vertex_color(bNodeTree *UNUSED(ntree), bNode *node) { NodeShaderVertexColor *vertexColor = MEM_cnew<NodeShaderVertexColor>("NodeShaderVertexColor"); @@ -58,6 +83,7 @@ void register_node_type_sh_vertex_color() sh_node_type_base(&ntype, SH_NODE_VERTEX_COLOR, "Vertex Color", NODE_CLASS_INPUT); ntype.declare = file_ns::node_declare; + ntype.draw_buttons = file_ns::node_shader_buts_vertex_color; node_type_init(&ntype, file_ns::node_shader_init_vertex_color); node_type_storage( &ntype, "NodeShaderVertexColor", node_free_standard_storage, node_copy_standard_storage); diff --git a/source/blender/nodes/shader/nodes/node_shader_volume_absorption.cc b/source/blender/nodes/shader/nodes/node_shader_volume_absorption.cc index cd697c96d66..a31bfdb6543 100644 --- a/source/blender/nodes/shader/nodes/node_shader_volume_absorption.cc +++ b/source/blender/nodes/shader/nodes/node_shader_volume_absorption.cc @@ -21,18 +21,12 @@ namespace blender::nodes::node_shader_volume_absorption_cc { -/* **************** OUTPUT ******************** */ - -static bNodeSocketTemplate sh_node_volume_absorption_in[] = { - {SOCK_RGBA, N_("Color"), 0.8f, 0.8f, 0.8f, 1.0f, 0.0f, 1.0f}, - {SOCK_FLOAT, N_("Density"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1000.0f}, - {-1, ""}, -}; - -static bNodeSocketTemplate sh_node_volume_absorption_out[] = { - {SOCK_SHADER, N_("Volume")}, - {-1, ""}, -}; +static void node_declare(NodeDeclarationBuilder &b) +{ + b.add_input<decl::Color>(N_("Color")).default_value({0.8f, 0.8f, 0.8f, 1.0f}); + b.add_input<decl::Float>(N_("Density")).default_value(1.0f).min(0.0f).max(1000.0f); + b.add_output<decl::Shader>(N_("Volume")); +} static int node_shader_gpu_volume_absorption(GPUMaterial *mat, bNode *node, @@ -53,8 +47,7 @@ void register_node_type_sh_volume_absorption() static bNodeType ntype; sh_node_type_base(&ntype, SH_NODE_VOLUME_ABSORPTION, "Volume Absorption", NODE_CLASS_SHADER); - node_type_socket_templates( - &ntype, file_ns::sh_node_volume_absorption_in, file_ns::sh_node_volume_absorption_out); + ntype.declare = file_ns::node_declare; node_type_gpu(&ntype, file_ns::node_shader_gpu_volume_absorption); nodeRegisterType(&ntype); diff --git a/source/blender/nodes/shader/nodes/node_shader_volume_principled.cc b/source/blender/nodes/shader/nodes/node_shader_volume_principled.cc index 3acf8c35ac1..54e92eafcf6 100644 --- a/source/blender/nodes/shader/nodes/node_shader_volume_principled.cc +++ b/source/blender/nodes/shader/nodes/node_shader_volume_principled.cc @@ -21,28 +21,30 @@ namespace blender::nodes::node_shader_volume_principled_cc { -/* **************** OUTPUT ******************** */ - -static bNodeSocketTemplate sh_node_volume_principled_in[] = { - {SOCK_RGBA, N_("Color"), 0.5f, 0.5f, 0.5f, 1.0f, 0.0f, 1.0f}, - {SOCK_STRING, N_("Color Attribute"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, - {SOCK_FLOAT, N_("Density"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1000.0f}, - {SOCK_STRING, N_("Density Attribute"), 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, - {SOCK_FLOAT, N_("Anisotropy"), 0.0f, 0.0f, 0.0f, 0.0f, -1.0f, 1.0f, PROP_FACTOR}, - {SOCK_RGBA, N_("Absorption Color"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f}, - {SOCK_FLOAT, N_("Emission Strength"), 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1000.0f}, - {SOCK_RGBA, N_("Emission Color"), 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f}, - {SOCK_FLOAT, N_("Blackbody Intensity"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, PROP_FACTOR}, - {SOCK_RGBA, N_("Blackbody Tint"), 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f}, - {SOCK_FLOAT, N_("Temperature"), 1000.0f, 0.0f, 0.0f, 0.0f, 0.0f, 6500.0f}, - {SOCK_STRING, N_("Temperature Attribute"), 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f}, - {-1, ""}, -}; - -static bNodeSocketTemplate sh_node_volume_principled_out[] = { - {SOCK_SHADER, N_("Volume")}, - {-1, ""}, -}; +static void node_declare(NodeDeclarationBuilder &b) +{ + b.add_input<decl::Color>(N_("Color")).default_value({0.5f, 0.5f, 0.5f, 1.0f}); + b.add_input<decl::String>(N_("Color Attribute")); + b.add_input<decl::Float>(N_("Density")).default_value(1.0f).min(0.0f).max(1000.0f); + b.add_input<decl::String>(N_("Density Attribute")); + b.add_input<decl::Float>(N_("Anisotropy")) + .default_value(0.0f) + .min(-1.0f) + .max(1.0f) + .subtype(PROP_FACTOR); + b.add_input<decl::Color>(N_("Absorption Color")).default_value({0.0f, 0.0f, 0.0f, 1.0f}); + b.add_input<decl::Float>(N_("Emission Strength")).default_value(0.0f).min(0.0f).max(1000.0f); + b.add_input<decl::Color>(N_("Emission Color")).default_value({1.0f, 1.0f, 1.0f, 1.0f}); + b.add_input<decl::Float>(N_("Blackbody Intensity")) + .default_value(0.0f) + .min(0.0f) + .max(1.0f) + .subtype(PROP_FACTOR); + b.add_input<decl::Color>(N_("Blackbody Tint")).default_value({1.0f, 1.0f, 1.0f, 1.0f}); + b.add_input<decl::Float>(N_("Temperature")).default_value(1000.0f).min(0.0f).max(6500.0f); + b.add_input<decl::String>(N_("Temperature Attribute")); + b.add_output<decl::Shader>(N_("Volume")); +} static void node_shader_init_volume_principled(bNodeTree *UNUSED(ntree), bNode *node) { @@ -138,8 +140,7 @@ void register_node_type_sh_volume_principled() static bNodeType ntype; sh_node_type_base(&ntype, SH_NODE_VOLUME_PRINCIPLED, "Principled Volume", NODE_CLASS_SHADER); - node_type_socket_templates( - &ntype, file_ns::sh_node_volume_principled_in, file_ns::sh_node_volume_principled_out); + ntype.declare = file_ns::node_declare; node_type_size_preset(&ntype, NODE_SIZE_LARGE); node_type_init(&ntype, file_ns::node_shader_init_volume_principled); node_type_gpu(&ntype, file_ns::node_shader_gpu_volume_principled); diff --git a/source/blender/nodes/shader/nodes/node_shader_wireframe.cc b/source/blender/nodes/shader/nodes/node_shader_wireframe.cc index a23887e9721..1ba2391a09d 100644 --- a/source/blender/nodes/shader/nodes/node_shader_wireframe.cc +++ b/source/blender/nodes/shader/nodes/node_shader_wireframe.cc @@ -19,6 +19,9 @@ #include "node_shader_util.hh" +#include "UI_interface.h" +#include "UI_resources.h" + namespace blender::nodes::node_shader_wireframe_cc { static void node_declare(NodeDeclarationBuilder &b) @@ -27,6 +30,11 @@ static void node_declare(NodeDeclarationBuilder &b) b.add_output<decl::Float>(N_("Fac")); } +static void node_shader_buts_wireframe(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) +{ + uiItemR(layout, ptr, "use_pixel_size", UI_ITEM_R_SPLIT_EMPTY_NAME, nullptr, 0); +} + static int node_shader_gpu_wireframe(GPUMaterial *mat, bNode *node, bNodeExecData *UNUSED(execdata), @@ -60,6 +68,7 @@ void register_node_type_sh_wireframe() sh_node_type_base(&ntype, SH_NODE_WIREFRAME, "Wireframe", NODE_CLASS_INPUT); ntype.declare = file_ns::node_declare; + ntype.draw_buttons = file_ns::node_shader_buts_wireframe; node_type_gpu(&ntype, file_ns::node_shader_gpu_wireframe); nodeRegisterType(&ntype); diff --git a/source/blender/nodes/texture/CMakeLists.txt b/source/blender/nodes/texture/CMakeLists.txt new file mode 100644 index 00000000000..053b17e4e57 --- /dev/null +++ b/source/blender/nodes/texture/CMakeLists.txt @@ -0,0 +1,89 @@ +# ***** BEGIN GPL LICENSE BLOCK ***** +# +# 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. +# +# ***** END GPL LICENSE BLOCK ***** + +set(INC + . + ../ + ../intern + ../../editors/include + ../../blenkernel + ../../blenlib + ../../blentranslation + ../../depsgraph + ../../imbuf + ../../makesdna + ../../makesrna + ../../render + ../../windowmanager + ../../../../intern/guardedalloc +) + + +set(SRC + nodes/node_texture_at.c + nodes/node_texture_bricks.c + nodes/node_texture_checker.c + nodes/node_texture_common.c + nodes/node_texture_compose.c + nodes/node_texture_coord.c + nodes/node_texture_curves.c + nodes/node_texture_decompose.c + nodes/node_texture_distance.c + nodes/node_texture_hueSatVal.c + nodes/node_texture_image.c + nodes/node_texture_invert.c + nodes/node_texture_math.c + nodes/node_texture_mixRgb.c + nodes/node_texture_output.c + nodes/node_texture_proc.c + nodes/node_texture_rotate.c + nodes/node_texture_scale.c + nodes/node_texture_texture.c + nodes/node_texture_translate.c + nodes/node_texture_valToNor.c + nodes/node_texture_valToRgb.c + nodes/node_texture_viewer.c + node_texture_tree.c + node_texture_util.c + + node_texture_util.h +) + +set(LIB + bf_nodes +) + +if(WITH_PYTHON) + list(APPEND INC + ../../python + ) + list(APPEND INC_SYS + ${PYTHON_INCLUDE_DIRS} + ) + list(APPEND LIB + ${PYTHON_LINKFLAGS} + ${PYTHON_LIBRARIES} + ) + add_definitions(-DWITH_PYTHON) +endif() + +if(WITH_INTERNATIONAL) + add_definitions(-DWITH_INTERNATIONAL) +endif() + +blender_add_lib(bf_nodes_texture "${SRC}" "${INC}" "${INC_SYS}" "${LIB}") diff --git a/source/blender/nodes/texture/nodes/node_texture_common.c b/source/blender/nodes/texture/nodes/node_texture_common.c index b01353bcd21..d68cfe78b44 100644 --- a/source/blender/nodes/texture/nodes/node_texture_common.c +++ b/source/blender/nodes/texture/nodes/node_texture_common.c @@ -170,7 +170,6 @@ void register_node_type_tex_group(void) BLI_assert(ntype.rna_ext.srna != NULL); RNA_struct_blender_type_set(ntype.rna_ext.srna, &ntype); - node_type_socket_templates(&ntype, NULL, NULL); node_type_size(&ntype, 140, 60, 400); ntype.labelfunc = node_group_label; node_type_group_update(&ntype, node_group_update); diff --git a/source/blender/python/BPY_extern.h b/source/blender/python/BPY_extern.h index e233a078ea9..b6604846bb8 100644 --- a/source/blender/python/BPY_extern.h +++ b/source/blender/python/BPY_extern.h @@ -81,7 +81,7 @@ void BPY_text_free_code(struct Text *text); void BPY_modules_update(void); void BPY_modules_load_user(struct bContext *C); -void BPY_app_handlers_reset(const short do_all); +void BPY_app_handlers_reset(short do_all); /** * Update function, it gets rid of py-drivers global dictionary, forcing diff --git a/source/blender/python/BPY_extern_run.h b/source/blender/python/BPY_extern_run.h index 30740d7fb60..9088a4b89c0 100644 --- a/source/blender/python/BPY_extern_run.h +++ b/source/blender/python/BPY_extern_run.h @@ -88,10 +88,8 @@ bool BPY_run_filepath(struct bContext *C, const char *filepath, struct ReportLis * This is done so error messages give useful output however there are rare cases causes problems * with introspection tools which attempt to load `__file__`. */ -bool BPY_run_text(struct bContext *C, - struct Text *text, - struct ReportList *reports, - const bool do_jump) ATTR_NONNULL(1, 2); +bool BPY_run_text(struct bContext *C, struct Text *text, struct ReportList *reports, bool do_jump) + ATTR_NONNULL(1, 2); /** \} */ diff --git a/source/blender/python/bmesh/bmesh_py_types.h b/source/blender/python/bmesh/bmesh_py_types.h index 42d1fee31c3..3786a0552d2 100644 --- a/source/blender/python/bmesh/bmesh_py_types.h +++ b/source/blender/python/bmesh/bmesh_py_types.h @@ -141,7 +141,7 @@ PyObject *BPy_BMVert_CreatePyObject(BMesh *bm, BMVert *v); PyObject *BPy_BMEdge_CreatePyObject(BMesh *bm, BMEdge *e); PyObject *BPy_BMFace_CreatePyObject(BMesh *bm, BMFace *f); PyObject *BPy_BMLoop_CreatePyObject(BMesh *bm, BMLoop *l); -PyObject *BPy_BMElemSeq_CreatePyObject(BMesh *bm, BPy_BMElem *py_ele, const char itype); +PyObject *BPy_BMElemSeq_CreatePyObject(BMesh *bm, BPy_BMElem *py_ele, char itype); PyObject *BPy_BMVertSeq_CreatePyObject(BMesh *bm); PyObject *BPy_BMEdgeSeq_CreatePyObject(BMesh *bm); PyObject *BPy_BMFaceSeq_CreatePyObject(BMesh *bm); @@ -162,18 +162,18 @@ void *BPy_BMElem_PySeq_As_Array_FAST(BMesh **r_bm, Py_ssize_t min, Py_ssize_t max, Py_ssize_t *r_size, - const char htype, - const bool do_unique_check, - const bool do_bm_check, + char htype, + bool do_unique_check, + bool do_bm_check, const char *error_prefix); void *BPy_BMElem_PySeq_As_Array(BMesh **r_bm, PyObject *seq, Py_ssize_t min, Py_ssize_t max, Py_ssize_t *r_size, - const char htype, - const bool do_unique_check, - const bool do_bm_check, + char htype, + bool do_unique_check, + bool do_bm_check, const char *error_prefix); PyObject *BPy_BMElem_Array_As_Tuple(BMesh *bm, BMHeader **elem, Py_ssize_t elem_len); @@ -182,14 +182,14 @@ PyObject *BPy_BMEdge_Array_As_Tuple(BMesh *bm, BMEdge **elem, Py_ssize_t elem_le PyObject *BPy_BMFace_Array_As_Tuple(BMesh *bm, BMFace **elem, Py_ssize_t elem_len); PyObject *BPy_BMLoop_Array_As_Tuple(BMesh *bm, BMLoop **elem, Py_ssize_t elem_len); -int BPy_BMElem_CheckHType(PyTypeObject *type, const char htype); +int BPy_BMElem_CheckHType(PyTypeObject *type, char htype); /** * Use for error strings only, not thread safe, * * \return a string like '(BMVert/BMEdge/BMFace/BMLoop)' */ -char *BPy_BMElem_StringFromHType_ex(const char htype, char ret[32]); -char *BPy_BMElem_StringFromHType(const char htype); +char *BPy_BMElem_StringFromHType_ex(char htype, char ret[32]); +char *BPy_BMElem_StringFromHType(char htype); // void bpy_bm_generic_invalidate(BPy_BMGeneric *self); int bpy_bm_generic_valid_check(BPy_BMGeneric *self); diff --git a/source/blender/python/bmesh/bmesh_py_types_customdata.h b/source/blender/python/bmesh/bmesh_py_types_customdata.h index a5555a14ad7..d81e149cac1 100644 --- a/source/blender/python/bmesh/bmesh_py_types_customdata.h +++ b/source/blender/python/bmesh/bmesh_py_types_customdata.h @@ -61,9 +61,9 @@ typedef struct BPy_BMLayerItem { int index; /* index of this layer type */ } BPy_BMLayerItem; -PyObject *BPy_BMLayerAccess_CreatePyObject(BMesh *bm, const char htype); -PyObject *BPy_BMLayerCollection_CreatePyObject(BMesh *bm, const char htype, int type); -PyObject *BPy_BMLayerItem_CreatePyObject(BMesh *bm, const char htype, int type, int index); +PyObject *BPy_BMLayerAccess_CreatePyObject(BMesh *bm, char htype); +PyObject *BPy_BMLayerCollection_CreatePyObject(BMesh *bm, char htype, int type); +PyObject *BPy_BMLayerItem_CreatePyObject(BMesh *bm, char htype, int type, int index); void BPy_BM_init_types_customdata(void); diff --git a/source/blender/python/generic/py_capi_utils.h b/source/blender/python/generic/py_capi_utils.h index f6d8d7298af..604792389fa 100644 --- a/source/blender/python/generic/py_capi_utils.h +++ b/source/blender/python/generic/py_capi_utils.h @@ -73,7 +73,7 @@ int PyC_AsArray_Multi_FAST(void *array, const size_t array_item_size, PyObject *value_fast, const int *dims, - const int dims_len, + int dims_len, const PyTypeObject *type, const char *error_prefix); @@ -81,7 +81,7 @@ int PyC_AsArray_Multi(void *array, const size_t array_item_size, PyObject *value, const int *dims, - const int dims_len, + int dims_len, const PyTypeObject *type, const char *error_prefix); @@ -102,10 +102,10 @@ PyObject *PyC_Tuple_PackArray_Bool(const bool *array, uint len); #define PyC_Tuple_Pack_Bool(...) \ PyC_Tuple_PackArray_Bool(((const bool[]){__VA_ARGS__}), VA_NARGS_COUNT(__VA_ARGS__)) -PyObject *PyC_Tuple_PackArray_Multi_F32(const float *array, const int dims[], const int dims_len); -PyObject *PyC_Tuple_PackArray_Multi_F64(const double *array, const int dims[], const int dims_len); -PyObject *PyC_Tuple_PackArray_Multi_I32(const int *array, const int dims[], const int dims_len); -PyObject *PyC_Tuple_PackArray_Multi_Bool(const bool *array, const int dims[], const int dims_len); +PyObject *PyC_Tuple_PackArray_Multi_F32(const float *array, const int dims[], int dims_len); +PyObject *PyC_Tuple_PackArray_Multi_F64(const double *array, const int dims[], int dims_len); +PyObject *PyC_Tuple_PackArray_Multi_I32(const int *array, const int dims[], int dims_len); +PyObject *PyC_Tuple_PackArray_Multi_Bool(const bool *array, const int dims[], int dims_len); /** * Caller needs to ensure tuple is uninitialized. @@ -219,8 +219,7 @@ struct PyC_StringEnum { * Use with PyArg_ParseTuple's "O&" formatting. */ int PyC_ParseStringEnum(PyObject *o, void *p); -const char *PyC_StringEnum_FindIDFromValue(const struct PyC_StringEnumItems *items, - const int value); +const char *PyC_StringEnum_FindIDFromValue(const struct PyC_StringEnumItems *items, int value); int PyC_CheckArgs_DeepCopy(PyObject *args); diff --git a/source/blender/python/gpu/gpu_py_buffer.h b/source/blender/python/gpu/gpu_py_buffer.h index cbc46339628..3dcf335230d 100644 --- a/source/blender/python/gpu/gpu_py_buffer.h +++ b/source/blender/python/gpu/gpu_py_buffer.h @@ -55,7 +55,7 @@ size_t bpygpu_Buffer_size(BPyGPUBuffer *buffer); * \param buffer: When not NULL holds a contiguous buffer * with the correct format from which the buffer will be initialized */ -BPyGPUBuffer *BPyGPU_Buffer_CreatePyObject(const int format, +BPyGPUBuffer *BPyGPU_Buffer_CreatePyObject(int format, const Py_ssize_t *shape, - const int shape_len, + int shape_len, void *buffer); diff --git a/source/blender/python/intern/bpy_capi_utils.h b/source/blender/python/intern/bpy_capi_utils.h index 0e4a28fb657..0889dec36c8 100644 --- a/source/blender/python/intern/bpy_capi_utils.h +++ b/source/blender/python/intern/bpy_capi_utils.h @@ -32,15 +32,15 @@ struct EnumPropertyItem; struct ReportList; /* error reporting */ -short BPy_reports_to_error(struct ReportList *reports, PyObject *exception, const bool clear); +short BPy_reports_to_error(struct ReportList *reports, PyObject *exception, bool clear); /** * A version of #BKE_report_write_file_fp that uses Python's stdout. */ void BPy_reports_write_stdout(const struct ReportList *reports, const char *header); bool BPy_errors_to_report_ex(struct ReportList *reports, const char *error_prefix, - const bool use_full, - const bool use_location); + bool use_full, + bool use_location); bool BPy_errors_to_report_brief_with_prefix(struct ReportList *reports, const char *error_prefix); bool BPy_errors_to_report(struct ReportList *reports); diff --git a/source/blender/python/intern/bpy_rna.h b/source/blender/python/intern/bpy_rna.h index f6a05a86311..b131aed6d23 100644 --- a/source/blender/python/intern/bpy_rna.h +++ b/source/blender/python/intern/bpy_rna.h @@ -178,7 +178,7 @@ typedef struct { } BPy_FunctionRNA; StructRNA *srna_from_self(PyObject *self, const char *error_prefix); -StructRNA *pyrna_struct_as_srna(PyObject *self, const bool parent, const char *error_prefix); +StructRNA *pyrna_struct_as_srna(PyObject *self, bool parent, const char *error_prefix); void BPY_rna_init(void); void BPY_rna_exit(void); @@ -196,10 +196,7 @@ bool pyrna_id_FromPyObject(PyObject *obj, struct ID **id); bool pyrna_id_CheckPyObject(PyObject *obj); /* operators also need this to set args */ -int pyrna_pydict_to_props(PointerRNA *ptr, - PyObject *kw, - const bool all_args, - const char *error_prefix); +int pyrna_pydict_to_props(PointerRNA *ptr, PyObject *kw, bool all_args, const char *error_prefix); PyObject *pyrna_prop_to_py(PointerRNA *ptr, PropertyRNA *prop); int pyrna_deferred_register_class(struct StructRNA *srna, PyTypeObject *py_class); diff --git a/source/blender/python/intern/bpy_rna_callback.c b/source/blender/python/intern/bpy_rna_callback.c index 16968cebab4..16ea4bf3e5e 100644 --- a/source/blender/python/intern/bpy_rna_callback.c +++ b/source/blender/python/intern/bpy_rna_callback.c @@ -383,6 +383,7 @@ PyObject *pyrna_callback_classmethod_remove(PyObject *UNUSED(self), PyObject *ar void *handle; StructRNA *srna; bool capsule_clear = false; + bool handle_removed = false; if (PyTuple_GET_SIZE(args) < 2) { PyErr_SetString(PyExc_ValueError, "callback_remove(handler): expected at least 2 args"); @@ -406,7 +407,7 @@ PyObject *pyrna_callback_classmethod_remove(PyObject *UNUSED(self), PyObject *ar args, "OO!:WindowManager.draw_cursor_remove", &cls, &PyCapsule_Type, &py_handle)) { return NULL; } - WM_paint_cursor_end(handle); + handle_removed = WM_paint_cursor_end(handle); capsule_clear = true; } else if (RNA_struct_is_a(srna, &RNA_Space)) { @@ -445,7 +446,7 @@ PyObject *pyrna_callback_classmethod_remove(PyObject *UNUSED(self), PyObject *ar params.region_type_enum.value_orig); return NULL; } - ED_region_draw_cb_exit(art, handle); + handle_removed = ED_region_draw_cb_exit(art, handle); capsule_clear = true; } else { @@ -453,9 +454,14 @@ PyObject *pyrna_callback_classmethod_remove(PyObject *UNUSED(self), PyObject *ar return NULL; } - /* The handle has been removed, so decrement its customdata. */ - PyObject *handle_args = PyCapsule_GetContext(py_handle); - Py_DECREF(handle_args); + /* When `handle_removed == false`: Blender has already freed the data + * (freeing screen data when loading a new file for example). + * This will have already decremented the user, so don't decrement twice. */ + if (handle_removed == true) { + /* The handle has been removed, so decrement its custom-data. */ + PyObject *handle_args = PyCapsule_GetContext(py_handle); + Py_DECREF(handle_args); + } /* don't allow reuse */ if (capsule_clear) { diff --git a/source/blender/python/mathutils/mathutils_Euler.h b/source/blender/python/mathutils/mathutils_Euler.h index 0deef3cfdf3..453a3b3736e 100644 --- a/source/blender/python/mathutils/mathutils_Euler.h +++ b/source/blender/python/mathutils/mathutils_Euler.h @@ -37,14 +37,14 @@ typedef struct { /* prototypes */ PyObject *Euler_CreatePyObject(const float eul[3], - const short order, + short order, PyTypeObject *base_type) ATTR_WARN_UNUSED_RESULT; PyObject *Euler_CreatePyObject_wrap(float eul[3], - const short order, + short order, PyTypeObject *base_type) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1); PyObject *Euler_CreatePyObject_cb(PyObject *cb_user, - const short order, + short order, unsigned char cb_type, unsigned char cb_subtype) ATTR_WARN_UNUSED_RESULT; diff --git a/source/blender/python/mathutils/mathutils_Matrix.h b/source/blender/python/mathutils/mathutils_Matrix.h index 56bb4d39d01..3067c5417b9 100644 --- a/source/blender/python/mathutils/mathutils_Matrix.h +++ b/source/blender/python/mathutils/mathutils_Matrix.h @@ -61,17 +61,17 @@ typedef struct { /* prototypes */ PyObject *Matrix_CreatePyObject(const float *mat, - const ushort num_col, - const ushort num_row, + ushort num_col, + ushort num_row, PyTypeObject *base_type) ATTR_WARN_UNUSED_RESULT; PyObject *Matrix_CreatePyObject_wrap(float *mat, - const ushort num_col, - const ushort num_row, + ushort num_col, + ushort num_row, PyTypeObject *base_type) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1); PyObject *Matrix_CreatePyObject_cb(PyObject *user, - const unsigned short num_col, - const unsigned short num_row, + unsigned short num_col, + unsigned short num_row, unsigned char cb_type, unsigned char cb_subtype) ATTR_WARN_UNUSED_RESULT; @@ -79,8 +79,8 @@ PyObject *Matrix_CreatePyObject_cb(PyObject *user, * \param mat: Initialized matrix value to use in-place, allocated with #PyMem_Malloc */ PyObject *Matrix_CreatePyObject_alloc(float *mat, - const ushort num_col, - const ushort num_row, + ushort num_col, + ushort num_row, PyTypeObject *base_type) ATTR_WARN_UNUSED_RESULT; /* PyArg_ParseTuple's "O&" formatting helpers. */ diff --git a/source/blender/python/mathutils/mathutils_Vector.h b/source/blender/python/mathutils/mathutils_Vector.h index fb420b32df4..50609e51b0a 100644 --- a/source/blender/python/mathutils/mathutils_Vector.h +++ b/source/blender/python/mathutils/mathutils_Vector.h @@ -33,7 +33,7 @@ typedef struct { /*prototypes*/ PyObject *Vector_CreatePyObject(const float *vec, - const int size, + int size, PyTypeObject *base_type) ATTR_WARN_UNUSED_RESULT; /** * Create a vector that wraps existing memory. @@ -41,7 +41,7 @@ PyObject *Vector_CreatePyObject(const float *vec, * \param vec: Use this vector in-place. */ PyObject *Vector_CreatePyObject_wrap(float *vec, - const int size, + int size, PyTypeObject *base_type) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1); /** @@ -56,6 +56,6 @@ PyObject *Vector_CreatePyObject_cb(PyObject *user, * \param vec: Initialized vector value to use in-place, allocated with #PyMem_Malloc */ PyObject *Vector_CreatePyObject_alloc(float *vec, - const int size, + int size, PyTypeObject *base_type) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1); diff --git a/source/blender/render/RE_bake.h b/source/blender/render/RE_bake.h index b2c44e051d1..43d3b5b323c 100644 --- a/source/blender/render/RE_bake.h +++ b/source/blender/render/RE_bake.h @@ -81,25 +81,25 @@ bool RE_bake_has_engine(const struct Render *re); bool RE_bake_engine(struct Render *re, struct Depsgraph *depsgraph, struct Object *object, - const int object_id, + int object_id, const BakePixel pixel_array[], const BakeTargets *targets, - const eScenePassType pass_type, - const int pass_filter, + eScenePassType pass_type, + int pass_filter, float result[]); /* bake.c */ -int RE_pass_depth(const eScenePassType pass_type); +int RE_pass_depth(eScenePassType pass_type); bool RE_bake_pixels_populate_from_objects(struct Mesh *me_low, BakePixel pixel_array_from[], BakePixel pixel_array_to[], BakeHighPolyData highpoly[], - const int tot_highpoly, + int tot_highpoly, const size_t num_pixels, - const bool is_custom_cage, - const float cage_extrusion, - const float max_ray_distance, + bool is_custom_cage, + float cage_extrusion, + float max_ray_distance, float mat_low[4][4], float mat_cage[4][4], struct Mesh *me_cage); @@ -112,11 +112,11 @@ void RE_bake_pixels_populate(struct Mesh *me, void RE_bake_mask_fill(const BakePixel pixel_array[], const size_t num_pixels, char *mask); -void RE_bake_margin(struct ImBuf *ibuf, char *mask, const int margin); +void RE_bake_margin(struct ImBuf *ibuf, char *mask, int margin); void RE_bake_normal_world_to_object(const BakePixel pixel_array[], const size_t num_pixels, - const int depth, + int depth, float result[], struct Object *ob, const eBakeNormalSwizzle normal_swizzle[3]); @@ -126,18 +126,18 @@ void RE_bake_normal_world_to_object(const BakePixel pixel_array[], */ void RE_bake_normal_world_to_tangent(const BakePixel pixel_array[], const size_t num_pixels, - const int depth, + int depth, float result[], struct Mesh *me, const eBakeNormalSwizzle normal_swizzle[3], float mat[4][4]); void RE_bake_normal_world_to_world(const BakePixel pixel_array[], const size_t num_pixels, - const int depth, + int depth, float result[], const eBakeNormalSwizzle normal_swizzle[3]); -void RE_bake_ibuf_clear(struct Image *image, const bool is_tangent); +void RE_bake_ibuf_clear(struct Image *image, bool is_tangent); #ifdef __cplusplus } diff --git a/source/blender/render/RE_engine.h b/source/blender/render/RE_engine.h index b22d263490c..c0bd8c0fe4e 100644 --- a/source/blender/render/RE_engine.h +++ b/source/blender/render/RE_engine.h @@ -106,10 +106,10 @@ typedef struct RenderEngineType { void (*bake)(struct RenderEngine *engine, struct Depsgraph *depsgraph, struct Object *object, - const int pass_type, - const int pass_filter, - const int width, - const int height); + int pass_type, + int pass_filter, + int width, + int height); void (*view_update)(struct RenderEngine *engine, const struct bContext *context, diff --git a/source/blender/render/RE_pipeline.h b/source/blender/render/RE_pipeline.h index bf7d41b97b2..072fc7363b2 100644 --- a/source/blender/render/RE_pipeline.h +++ b/source/blender/render/RE_pipeline.h @@ -237,7 +237,7 @@ void RE_ReleaseResultImageViews(struct Render *re, struct RenderResult *rr); * This #RenderResult struct is the only exception to the rule of a #RenderResult * always having at least one #RenderView. */ -void RE_AcquireResultImage(struct Render *re, struct RenderResult *rr, const int view_id); +void RE_AcquireResultImage(struct Render *re, struct RenderResult *rr, int view_id); void RE_ReleaseResultImage(struct Render *re); void RE_SwapResult(struct Render *re, struct RenderResult **rr); void RE_ClearResult(struct Render *re); @@ -255,12 +255,12 @@ void RE_ResultGet32(struct Render *re, unsigned int *rect); void RE_AcquiredResultGet32(struct Render *re, struct RenderResult *result, unsigned int *rect, - const int view_id); + int view_id); void RE_render_result_rect_from_ibuf(struct RenderResult *rr, struct RenderData *rd, struct ImBuf *ibuf, - const int view_id); + int view_id); struct RenderLayer *RE_GetRenderLayer(struct RenderResult *rr, const char *name); float *RE_RenderLayerGetPass(volatile struct RenderLayer *rl, @@ -283,7 +283,7 @@ void RE_create_render_pass(struct RenderResult *rr, const char *chan_id, const char *layername, const char *viewname, - const bool allocate); + bool allocate); /** * Obligatory initialize call, doesn't change during entire render sequence. @@ -325,7 +325,7 @@ void RE_init_threadcount(Render *re); bool RE_WriteRenderViewsImage(struct ReportList *reports, struct RenderResult *rr, struct Scene *scene, - const bool stamp, + bool stamp, char *name); bool RE_WriteRenderViewsMovie(struct ReportList *reports, struct RenderResult *rr, @@ -333,7 +333,7 @@ bool RE_WriteRenderViewsMovie(struct ReportList *reports, struct RenderData *rd, struct bMovieHandle *mh, void **movie_ctx_arr, - const int totvideos, + int totvideos, bool preview); /** @@ -347,7 +347,7 @@ void RE_RenderFrame(struct Render *re, struct ViewLayer *single_layer, struct Object *camera_override, int frame, - const bool write_still); + bool write_still); /** * Saves images to disk. */ @@ -476,7 +476,7 @@ bool RE_allow_render_generic_object(struct Object *ob); bool RE_HasCombinedLayer(RenderResult *res); bool RE_HasFloatPixels(RenderResult *res); bool RE_RenderResult_is_stereo(RenderResult *res); -struct RenderView *RE_RenderViewGetById(struct RenderResult *rr, const int view_id); +struct RenderView *RE_RenderViewGetById(struct RenderResult *rr, int view_id); struct RenderView *RE_RenderViewGetByName(struct RenderResult *rr, const char *viewname); RenderResult *RE_DuplicateRenderResult(RenderResult *rr); diff --git a/source/blender/render/RE_texture.h b/source/blender/render/RE_texture.h index cb18dc92415..d71c793f300 100644 --- a/source/blender/render/RE_texture.h +++ b/source/blender/render/RE_texture.h @@ -45,10 +45,10 @@ extern "C" { */ bool RE_texture_evaluate(const struct MTex *mtex, const float vec[3], - const int thread, + int thread, struct ImagePool *pool, - const bool skip_load_image, - const bool texnode_preview, + bool skip_load_image, + bool texnode_preview, /* Return arguments. */ float *r_intensity, float r_rgba[4]) ATTR_NONNULL(1, 2, 7, 8); @@ -88,7 +88,7 @@ void RE_point_density_minmax(struct Depsgraph *depsgraph, */ void RE_point_density_sample(struct Depsgraph *depsgraph, struct PointDensity *pd, - const int resolution, + int resolution, float *values); void RE_point_density_free(struct PointDensity *pd); @@ -122,10 +122,10 @@ int multitex_ext(struct Tex *tex, float dyt[3], int osatex, struct TexResult *texres, - const short thread, + short thread, struct ImagePool *pool, bool scene_color_manage, - const bool skip_load_image); + bool skip_load_image); /** * Nodes disabled. @@ -138,7 +138,7 @@ int multitex_ext_safe(struct Tex *tex, struct TexResult *texres, struct ImagePool *pool, bool scene_color_manage, - const bool skip_load_image); + bool skip_load_image); /** * Only for internal node usage. @@ -152,7 +152,7 @@ int multitex_nodes(struct Tex *tex, float dyt[3], int osatex, struct TexResult *texres, - const short thread, + short thread, short which_output, struct MTex *mtex, struct ImagePool *pool); diff --git a/source/blender/render/intern/render_result.h b/source/blender/render/intern/render_result.h index ede0a0d21ea..9084dbf95ce 100644 --- a/source/blender/render/intern/render_result.h +++ b/source/blender/render/intern/render_result.h @@ -107,7 +107,7 @@ struct RenderPass *render_layer_add_pass(struct RenderResult *rr, const char *name, const char *viewname, const char *chan_id, - const bool allocate); + bool allocate); /** * Called for reading temp files, and for external engines. @@ -128,16 +128,16 @@ bool render_result_exr_file_cache_read(struct Render *re); struct ImBuf *render_result_rect_to_ibuf(struct RenderResult *rr, const struct RenderData *rd, - const int view_id); + int view_id); -void render_result_rect_fill_zero(struct RenderResult *rr, const int view_id); +void render_result_rect_fill_zero(struct RenderResult *rr, int view_id); void render_result_rect_get_pixels(struct RenderResult *rr, unsigned int *rect, int rectx, int recty, const struct ColorManagedViewSettings *view_settings, const struct ColorManagedDisplaySettings *display_settings, - const int view_id); + int view_id); /** * Create a new views #ListBase in rr without duplicating the memory pointers. diff --git a/source/blender/render/intern/texture_common.h b/source/blender/render/intern/texture_common.h index b3a976c3fe0..5fc3af6153f 100644 --- a/source/blender/render/intern/texture_common.h +++ b/source/blender/render/intern/texture_common.h @@ -89,13 +89,13 @@ int imagewraposa(struct Tex *tex, const float dyt[2], struct TexResult *texres, struct ImagePool *pool, - const bool skip_load_image); + bool skip_load_image); int imagewrap(struct Tex *tex, struct Image *ima, const float texvec[3], struct TexResult *texres, struct ImagePool *pool, - const bool skip_load_image); + bool skip_load_image); void image_sample(struct Image *ima, float fx, float fy, diff --git a/source/blender/render/intern/zbuf.c b/source/blender/render/intern/zbuf.c index 1812a492ac0..beba10ad82a 100644 --- a/source/blender/render/intern/zbuf.c +++ b/source/blender/render/intern/zbuf.c @@ -19,6 +19,9 @@ /** \file * \ingroup render + * + * \note Some of this logic has been duplicated in `COM_VectorBlurOperation.cc` + * changes here may also apply also apply to that file. */ /*---------------------------------------------------------------------------*/ diff --git a/source/blender/render/intern/zbuf.h b/source/blender/render/intern/zbuf.h index c5108a9d6a7..3e4832e04d6 100644 --- a/source/blender/render/intern/zbuf.h +++ b/source/blender/render/intern/zbuf.h @@ -24,7 +24,7 @@ extern "C" { #endif -/* span fill in method, is also used to localize data for zbuffering */ +/** Span fill in method, is also used to localize data for Z-buffering. */ typedef struct ZSpan { int rectx, recty; /* range for clipping */ diff --git a/source/blender/sequencer/SEQ_add.h b/source/blender/sequencer/SEQ_add.h index 936868725b4..85f44ab914f 100644 --- a/source/blender/sequencer/SEQ_add.h +++ b/source/blender/sequencer/SEQ_add.h @@ -79,8 +79,8 @@ typedef struct SeqLoadData { void SEQ_add_load_data_init(struct SeqLoadData *load_data, const char *name, const char *path, - const int start_frame, - const int channel); + int start_frame, + int channel); /** * Add image strip. * \note Use #SEQ_add_image_set_directory() and #SEQ_add_image_load_file() to load image sequences @@ -109,7 +109,7 @@ struct Sequence *SEQ_add_sound_strip(struct Main *bmain, struct Scene *scene, struct ListBase *seqbase, struct SeqLoadData *load_data, - const double audio_offset); + double audio_offset); /** * Add meta strip. * @@ -206,7 +206,7 @@ void SEQ_add_image_init_alpha_mode(struct Sequence *seq); void SEQ_add_reload_new_file(struct Main *bmain, struct Scene *scene, struct Sequence *seq, - const bool lock_range); + bool lock_range); void SEQ_add_movie_reload_if_needed(struct Main *bmain, struct Scene *scene, struct Sequence *seq, diff --git a/source/blender/sequencer/SEQ_edit.h b/source/blender/sequencer/SEQ_edit.h index fe12ac253b9..73723c23920 100644 --- a/source/blender/sequencer/SEQ_edit.h +++ b/source/blender/sequencer/SEQ_edit.h @@ -90,8 +90,8 @@ struct Sequence *SEQ_edit_strip_split(struct Main *bmain, struct Scene *scene, struct ListBase *seqbase, struct Sequence *seq, - const int timeline_frame, - const eSeqSplitMethod method, + int timeline_frame, + eSeqSplitMethod method, const char **r_error); /** * Find gap after initial_frame and move strips on right side to close the gap @@ -104,8 +104,8 @@ struct Sequence *SEQ_edit_strip_split(struct Main *bmain, */ bool SEQ_edit_remove_gaps(struct Scene *scene, struct ListBase *seqbase, - const int initial_frame, - const bool remove_all_gaps); + int initial_frame, + bool remove_all_gaps); void SEQ_edit_sequence_name_set(struct Scene *scene, struct Sequence *seq, const char *new_name); #ifdef __cplusplus diff --git a/source/blender/sequencer/SEQ_effects.h b/source/blender/sequencer/SEQ_effects.h index 87a8288a593..8a79abde7bc 100644 --- a/source/blender/sequencer/SEQ_effects.h +++ b/source/blender/sequencer/SEQ_effects.h @@ -59,10 +59,10 @@ struct SeqEffectHandle { void (*load)(struct Sequence *seqconst); /* duplicate */ - void (*copy)(struct Sequence *dst, struct Sequence *src, const int flag); + void (*copy)(struct Sequence *dst, struct Sequence *src, int flag); /* destruct */ - void (*free)(struct Sequence *seq, const bool do_id_user); + void (*free)(struct Sequence *seq, bool do_id_user); /* returns: -1: no input needed, * 0: no early out, @@ -105,8 +105,8 @@ struct SeqEffectHandle { struct SeqEffectHandle SEQ_effect_handle_get(struct Sequence *seq); int SEQ_effect_get_num_inputs(int seq_type); -void SEQ_effect_text_font_unload(struct TextVars *data, const bool do_id_user); -void SEQ_effect_text_font_load(struct TextVars *data, const bool do_id_user); +void SEQ_effect_text_font_unload(struct TextVars *data, bool do_id_user); +void SEQ_effect_text_font_load(struct TextVars *data, bool do_id_user); #ifdef __cplusplus } diff --git a/source/blender/sequencer/SEQ_iterator.h b/source/blender/sequencer/SEQ_iterator.h index 2826e6b75cb..c26886c2e6c 100644 --- a/source/blender/sequencer/SEQ_iterator.h +++ b/source/blender/sequencer/SEQ_iterator.h @@ -225,8 +225,8 @@ SeqCollection *SEQ_query_all_strips_recursive(ListBase *seqbase); * \return strip collection */ SeqCollection *SEQ_query_rendered_strips(ListBase *seqbase, - const int timeline_frame, - const int displayed_channel); + int timeline_frame, + int displayed_channel); /** * Query all effect strips that are directly or indirectly connected to seq_reference. * This includes all effects of seq_reference, strips used by another inputs and their effects, so diff --git a/source/blender/sequencer/SEQ_sequencer.h b/source/blender/sequencer/SEQ_sequencer.h index a3ee716c3f6..1229f6f7bea 100644 --- a/source/blender/sequencer/SEQ_sequencer.h +++ b/source/blender/sequencer/SEQ_sequencer.h @@ -68,7 +68,7 @@ int SEQ_tool_settings_pivot_point_get(struct Scene *scene); struct SequencerToolSettings *SEQ_tool_settings_copy(struct SequencerToolSettings *tool_settings); struct Editing *SEQ_editing_get(const struct Scene *scene); struct Editing *SEQ_editing_ensure(struct Scene *scene); -void SEQ_editing_free(struct Scene *scene, const bool do_id_user); +void SEQ_editing_free(struct Scene *scene, bool do_id_user); /** * Get seqbase that is being viewed currently. This can be main seqbase or meta strip seqbase * @@ -84,7 +84,7 @@ struct ListBase *SEQ_active_seqbase_get(const struct Editing *ed); */ void SEQ_seqbase_active_set(struct Editing *ed, struct ListBase *seqbase); struct Sequence *SEQ_sequence_alloc(ListBase *lb, int timeline_frame, int machine, int type); -void SEQ_sequence_free(struct Scene *scene, struct Sequence *seq, const bool do_clean_animdata); +void SEQ_sequence_free(struct Scene *scene, struct Sequence *seq, bool do_clean_animdata); /** * Create and initialize #MetaStack, append it to `ed->metastack` ListBase * @@ -119,7 +119,7 @@ void SEQ_sequence_base_dupli_recursive(const struct Scene *scene_src, struct ListBase *nseqbase, const struct ListBase *seqbase, int dupe_flag, - const int flag); + int flag); bool SEQ_valid_strip_channel(struct Sequence *seq); /** diff --git a/source/blender/sequencer/SEQ_time.h b/source/blender/sequencer/SEQ_time.h index e563e94da24..f08220e4958 100644 --- a/source/blender/sequencer/SEQ_time.h +++ b/source/blender/sequencer/SEQ_time.h @@ -59,10 +59,10 @@ void SEQ_timeline_boundbox(const struct Scene *scene, float SEQ_time_sequence_get_fps(struct Scene *scene, struct Sequence *seq); int SEQ_time_find_next_prev_edit(struct Scene *scene, int timeline_frame, - const short side, - const bool do_skip_mute, - const bool do_center, - const bool do_unselected); + short side, + bool do_skip_mute, + bool do_center, + bool do_unselected); void SEQ_time_update_sequence(struct Scene *scene, struct ListBase *seqbase, struct Sequence *seq); void SEQ_time_update_recursive(struct Scene *scene, struct Sequence *changed_seq); /** @@ -74,7 +74,7 @@ void SEQ_time_update_recursive(struct Scene *scene, struct Sequence *changed_seq * \param timeline_frame: absolute frame position * \return true if strip intersects with timeline frame. */ -bool SEQ_time_strip_intersects_frame(const struct Sequence *seq, const int timeline_frame); +bool SEQ_time_strip_intersects_frame(const struct Sequence *seq, int timeline_frame); void SEQ_time_update_meta_strip_range(struct Scene *scene, struct Sequence *seq_meta); #ifdef __cplusplus diff --git a/source/blender/sequencer/SEQ_transform.h b/source/blender/sequencer/SEQ_transform.h index fe0c223bcb1..00d1f1c9955 100644 --- a/source/blender/sequencer/SEQ_transform.h +++ b/source/blender/sequencer/SEQ_transform.h @@ -65,7 +65,7 @@ bool SEQ_transform_seqbase_shuffle_time(struct SeqCollection *strips_to_shuffle, struct ListBase *seqbasep, struct Scene *evil_scene, struct ListBase *markers, - const bool use_sync_markers); + bool use_sync_markers); /** * Check if the selected seq's reference unselected seq's. */ @@ -80,8 +80,8 @@ bool SEQ_transform_seqbase_isolated_sel_check(struct ListBase *seqbase); */ void SEQ_transform_offset_after_frame(struct Scene *scene, struct ListBase *seqbase, - const int delta, - const int timeline_frame); + int delta, + int timeline_frame); /* Image transformation. */ diff --git a/source/blender/sequencer/SEQ_utils.h b/source/blender/sequencer/SEQ_utils.h index 58d7a92f370..a209857d1f9 100644 --- a/source/blender/sequencer/SEQ_utils.h +++ b/source/blender/sequencer/SEQ_utils.h @@ -66,11 +66,11 @@ struct Mask *SEQ_active_mask_get(struct Scene *scene); void SEQ_alpha_mode_from_file_extension(struct Sequence *seq); bool SEQ_sequence_has_source(const struct Sequence *seq); void SEQ_set_scale_to_fit(const struct Sequence *seq, - const int image_width, - const int image_height, - const int preview_width, - const int preview_height, - const eSeqImageFitMethod fit_method); + int image_width, + int image_height, + int preview_width, + int preview_height, + eSeqImageFitMethod fit_method); /** * Ensure, that provided Sequence has unique name. If animation data exists for this Sequence, it * will be duplicated and mapped onto new name diff --git a/source/blender/sequencer/intern/multiview.h b/source/blender/sequencer/intern/multiview.h index 3d528c22fff..79d99c88b50 100644 --- a/source/blender/sequencer/intern/multiview.h +++ b/source/blender/sequencer/intern/multiview.h @@ -36,9 +36,9 @@ struct Scene; * ********************************************************************** */ -void seq_anim_add_suffix(struct Scene *scene, struct anim *anim, const int view_id); +void seq_anim_add_suffix(struct Scene *scene, struct anim *anim, int view_id); void seq_multiview_name(struct Scene *scene, - const int view_id, + int view_id, const char *prefix, const char *ext, char *r_path, @@ -46,7 +46,7 @@ void seq_multiview_name(struct Scene *scene, /** * The number of files will vary according to the stereo format. */ -int seq_num_files(struct Scene *scene, char views_format, const bool is_multiview); +int seq_num_files(struct Scene *scene, char views_format, bool is_multiview); #ifdef __cplusplus } diff --git a/source/blender/sequencer/intern/proxy.h b/source/blender/sequencer/intern/proxy.h index a65fdcd42fe..e92cd8de429 100644 --- a/source/blender/sequencer/intern/proxy.h +++ b/source/blender/sequencer/intern/proxy.h @@ -36,7 +36,7 @@ struct anim; struct ImBuf *seq_proxy_fetch(const struct SeqRenderData *context, struct Sequence *seq, int timeline_frame); -bool seq_proxy_get_custom_file_fname(struct Sequence *seq, char *name, const int view_id); +bool seq_proxy_get_custom_file_fname(struct Sequence *seq, char *name, int view_id); void free_proxy_seq(Sequence *seq); void seq_proxy_index_dir_set(struct anim *anim, const char *base_dir); diff --git a/source/blender/sequencer/intern/sequencer.h b/source/blender/sequencer/intern/sequencer.h index f8ad17e9032..aff81255d7d 100644 --- a/source/blender/sequencer/intern/sequencer.h +++ b/source/blender/sequencer/intern/sequencer.h @@ -36,8 +36,8 @@ struct Sequence; */ void seq_free_sequence_recurse(struct Scene *scene, struct Sequence *seq, - const bool do_id_user, - const bool do_clean_animdata); + bool do_id_user, + bool do_clean_animdata); #ifdef __cplusplus } diff --git a/source/blender/sequencer/intern/strip_time.h b/source/blender/sequencer/intern/strip_time.h index aa807b6da25..4fe8d03e641 100644 --- a/source/blender/sequencer/intern/strip_time.h +++ b/source/blender/sequencer/intern/strip_time.h @@ -51,7 +51,7 @@ typedef struct GapInfo { */ void seq_time_gap_info_get(const struct Scene *scene, struct ListBase *seqbase, - const int initial_frame, + int initial_frame, struct GapInfo *r_gap_info); #ifdef __cplusplus diff --git a/source/blender/simulation/intern/hair_volume.cpp b/source/blender/simulation/intern/hair_volume.cpp index d4550eec5d6..f9b61fe9942 100644 --- a/source/blender/simulation/intern/hair_volume.cpp +++ b/source/blender/simulation/intern/hair_volume.cpp @@ -842,8 +842,8 @@ bool SIM_hair_volume_solve_divergence(HairGrid *grid, } /* Main Poisson equation system: - * This is derived from the discretezation of the Poisson equation - * div(grad(p)) = div(v) + * This is derived from the discretization of the Poisson equation: + * `div(grad(p)) = div(v)` * * The finite difference approximation yields the linear equation system described here: * https://en.wikipedia.org/wiki/Discrete_Poisson_equation diff --git a/source/blender/windowmanager/WM_api.h b/source/blender/windowmanager/WM_api.h index 4ffd31a9923..9a8a6a3a3ac 100644 --- a/source/blender/windowmanager/WM_api.h +++ b/source/blender/windowmanager/WM_api.h @@ -118,7 +118,7 @@ void WM_init(struct bContext *C, int argc, const char **argv); /** * \note doesn't run exit() call #WM_exit() for that. */ -void WM_exit_ex(struct bContext *C, const bool do_python); +void WM_exit_ex(struct bContext *C, bool do_python); /** * \brief Main exit function to close Blender ordinarily. @@ -277,7 +277,7 @@ struct ID *WM_file_link_datablock(struct Main *bmain, struct ViewLayer *view_layer, struct View3D *v3d, const char *filepath, - const short id_code, + short id_code, const char *id_name, int flag); /** @@ -289,7 +289,7 @@ struct ID *WM_file_append_datablock(struct Main *bmain, struct ViewLayer *view_layer, struct View3D *v3d, const char *filepath, - const short id_code, + short id_code, const char *id_name, int flag); void WM_lib_reload(struct Library *lib, struct bContext *C, struct ReportList *reports); @@ -404,7 +404,7 @@ struct wmEventHandler_UI *WM_event_add_ui_handler(const struct bContext *C, wmUIHandlerFunc handle_fn, wmUIHandlerRemoveFunc remove_fn, void *user_data, - const char flag); + char flag); /** * \param postpone: Enable for `win->modalhandlers`, * this is in a running for () loop in wm_handlers_do(). @@ -413,7 +413,7 @@ void WM_event_remove_ui_handler(ListBase *handlers, wmUIHandlerFunc handle_fn, wmUIHandlerRemoveFunc remove_fn, void *user_data, - const bool postpone); + bool postpone); void WM_event_remove_area_handler(struct ListBase *handlers, void *area); void WM_event_free_ui_handler_all(struct bContext *C, ListBase *handlers, @@ -605,7 +605,7 @@ int WM_operator_ui_popup(struct bContext *C, struct wmOperator *op, int width); int WM_operator_confirm_message_ex(struct bContext *C, struct wmOperator *op, const char *title, - const int icon, + int icon, const char *message, const wmOperatorCallContext opcontext); int WM_operator_confirm_message(struct bContext *C, struct wmOperator *op, const char *message); @@ -638,7 +638,7 @@ bool WM_operator_poll_context(struct bContext *C, struct wmOperatorType *ot, sho * * \warning do not use this within an operator to call its self! T29537. */ -int WM_operator_call_ex(struct bContext *C, struct wmOperator *op, const bool store); +int WM_operator_call_ex(struct bContext *C, struct wmOperator *op, bool store); int WM_operator_call(struct bContext *C, struct wmOperator *op); /** * This is intended to be used when an invoke operator wants to call exec on its self @@ -688,7 +688,7 @@ int WM_operator_call_py(struct bContext *C, wmOperatorCallContext context, struct PointerRNA *properties, struct ReportList *reports, - const bool is_undo); + bool is_undo); void WM_operator_name_call_ptr_with_depends_on_cursor(struct bContext *C, wmOperatorType *ot, @@ -706,7 +706,7 @@ void WM_operator_properties_alloc(struct PointerRNA **ptr, /** * Make props context sensitive or not. */ -void WM_operator_properties_sanitize(struct PointerRNA *ptr, const bool no_context); +void WM_operator_properties_sanitize(struct PointerRNA *ptr, bool no_context); /** * Set all props to their default. @@ -716,7 +716,7 @@ void WM_operator_properties_sanitize(struct PointerRNA *ptr, const bool no_conte * \note There's nothing specific to operators here. * This could be made a general function. */ -bool WM_operator_properties_default(struct PointerRNA *ptr, const bool do_update); +bool WM_operator_properties_default(struct PointerRNA *ptr, bool do_update); /** * Remove all props without #PROP_SKIP_SAVE. */ @@ -738,7 +738,7 @@ wmOperator *WM_operator_last_redo(const struct bContext *C); /** * Use for drag & drop a path or name with operators invoke() function. */ -ID *WM_operator_drop_load_path(struct bContext *C, struct wmOperator *op, const short idcode); +ID *WM_operator_drop_load_path(struct bContext *C, struct wmOperator *op, short idcode); bool WM_operator_last_properties_init(struct wmOperator *op); bool WM_operator_last_properties_store(struct wmOperator *op); @@ -870,14 +870,14 @@ bool WM_operator_properties_checker_interval_test(const struct CheckerIntervalPa */ char *WM_operator_pystring_ex(struct bContext *C, struct wmOperator *op, - const bool all_args, - const bool macro_args, + bool all_args, + bool macro_args, struct wmOperatorType *ot, struct PointerRNA *opptr); char *WM_operator_pystring(struct bContext *C, struct wmOperator *op, - const bool all_args, - const bool macro_args); + bool all_args, + bool macro_args); /** * \return true if the string was shortened. */ @@ -1243,7 +1243,7 @@ void wmOrtho2(float x1, float x2, float y1, float y2); * Default pixel alignment for regions. */ void wmOrtho2_region_pixelspace(const struct ARegion *region); -void wmOrtho2_pixelspace(const float x, const float y); +void wmOrtho2_pixelspace(float x, float y); void wmGetProjectionMatrix(float mat[4][4], const struct rcti *winrct); /* threaded Jobs Manager */ @@ -1481,9 +1481,7 @@ int WM_userdef_event_map(int kmitype); int WM_userdef_event_type_from_keymap_type(int kmitype); #ifdef WITH_INPUT_NDOF -void WM_event_ndof_pan_get(const struct wmNDOFMotionData *ndof, - float r_pan[3], - const bool use_zoom); +void WM_event_ndof_pan_get(const struct wmNDOFMotionData *ndof, float r_pan[3], bool use_zoom); void WM_event_ndof_rotate_get(const struct wmNDOFMotionData *ndof, float r_rot[3]); float WM_event_ndof_to_axis_angle(const struct wmNDOFMotionData *ndof, float axis[3]); diff --git a/source/blender/windowmanager/WM_keymap.h b/source/blender/windowmanager/WM_keymap.h index 4d1f2d979cb..4f1a2c8b923 100644 --- a/source/blender/windowmanager/WM_keymap.h +++ b/source/blender/windowmanager/WM_keymap.h @@ -63,10 +63,7 @@ wmKeyMapItem *WM_keymap_add_item( wmKeyMapItem *WM_keymap_add_item_copy(struct wmKeyMap *keymap, wmKeyMapItem *kmi_src); bool WM_keymap_remove_item(struct wmKeyMap *keymap, struct wmKeyMapItem *kmi); -int WM_keymap_item_to_string(const wmKeyMapItem *kmi, - const bool compact, - char *result, - const int result_len); +int WM_keymap_item_to_string(const wmKeyMapItem *kmi, bool compact, char *result, int result_len); wmKeyMap *WM_keymap_list_find(ListBase *lb, const char *idname, int spaceid, int regionid); wmKeyMap *WM_keymap_list_find_spaceid_or_empty(ListBase *lb, @@ -135,26 +132,20 @@ wmKeyMap *WM_keymap_guess_from_context(const struct bContext *C); */ wmKeyMap *WM_keymap_guess_opname(const struct bContext *C, const char *opname); -bool WM_keymap_uses_event_modifier(const wmKeyMap *keymap, const int event_modifier); +bool WM_keymap_uses_event_modifier(const wmKeyMap *keymap, int event_modifier); void WM_keymap_fix_linking(void); /* Modal Keymap */ -int WM_modalkeymap_items_to_string(const struct wmKeyMap *km, - const int propvalue, - const bool compact, - char *result, - const int result_len); -int WM_modalkeymap_operator_items_to_string(struct wmOperatorType *ot, - const int propvalue, - const bool compact, - char *result, - const int result_len); +int WM_modalkeymap_items_to_string( + const struct wmKeyMap *km, int propvalue, bool compact, char *result, int result_len); +int WM_modalkeymap_operator_items_to_string( + struct wmOperatorType *ot, int propvalue, bool compact, char *result, int result_len); char *WM_modalkeymap_operator_items_to_string_buf(struct wmOperatorType *ot, - const int propvalue, - const bool compact, - const int max_len, + int propvalue, + bool compact, + int max_len, int *r_available_len, char **r_result); @@ -166,7 +157,7 @@ wmKeyMapItem *WM_modalkeymap_add_item( struct wmKeyMap *km, int type, int val, int modifier, int keymodifier, int value); wmKeyMapItem *WM_modalkeymap_add_item_str( struct wmKeyMap *km, int type, int val, int modifier, int keymodifier, const char *value); -const wmKeyMapItem *WM_modalkeymap_find_propvalue(const wmKeyMap *km, const int propvalue); +const wmKeyMapItem *WM_modalkeymap_find_propvalue(const wmKeyMap *km, int propvalue); void WM_modalkeymap_assign(struct wmKeyMap *km, const char *opname); /* Keymap Editor */ @@ -183,17 +174,17 @@ int WM_keymap_item_map_type_get(const struct wmKeyMapItem *kmi); /* Key Event */ -const char *WM_key_event_string(const short type, const bool compact); -int WM_keymap_item_raw_to_string(const short shift, - const short ctrl, - const short alt, - const short oskey, - const short keymodifier, - const short val, - const short type, - const bool compact, +const char *WM_key_event_string(short type, bool compact); +int WM_keymap_item_raw_to_string(short shift, + short ctrl, + short alt, + short oskey, + short keymodifier, + short val, + short type, + bool compact, char *result, - const int result_len); + int result_len); /** * \param include_mask, exclude_mask: * Event types to include/exclude when looking up keys (#eEventType_Mask). @@ -202,22 +193,22 @@ wmKeyMapItem *WM_key_event_operator(const struct bContext *C, const char *opname, wmOperatorCallContext opcontext, struct IDProperty *properties, - const short include_mask, - const short exclude_mask, + short include_mask, + short exclude_mask, struct wmKeyMap **r_keymap); char *WM_key_event_operator_string(const struct bContext *C, const char *opname, wmOperatorCallContext opcontext, struct IDProperty *properties, - const bool is_strict, + bool is_strict, char *result, - const int result_len); + int result_len); wmKeyMapItem *WM_key_event_operator_from_keymap(struct wmKeyMap *keymap, const char *opname, struct IDProperty *properties, - const short include_mask, - const short exclude_mask); + short include_mask, + short exclude_mask); const char *WM_bool_as_string(bool test); diff --git a/source/blender/windowmanager/gizmo/WM_gizmo_api.h b/source/blender/windowmanager/gizmo/WM_gizmo_api.h index 8691ebe06ec..5bcb9b195bf 100644 --- a/source/blender/windowmanager/gizmo/WM_gizmo_api.h +++ b/source/blender/windowmanager/gizmo/WM_gizmo_api.h @@ -138,9 +138,9 @@ void WM_gizmo_set_matrix_offset_rotation_from_yz_axis(struct wmGizmo *gz, const float y_axis[3], const float z_axis[3]); -void WM_gizmo_set_flag(struct wmGizmo *gz, const int flag, const bool enable); -void WM_gizmo_set_scale(struct wmGizmo *gz, const float scale); -void WM_gizmo_set_line_width(struct wmGizmo *gz, const float line_width); +void WM_gizmo_set_flag(struct wmGizmo *gz, int flag, bool enable); +void WM_gizmo_set_scale(struct wmGizmo *gz, float scale); +void WM_gizmo_set_line_width(struct wmGizmo *gz, float line_width); void WM_gizmo_get_color(const struct wmGizmo *gz, float color[4]); void WM_gizmo_set_color(struct wmGizmo *gz, const float color[4]); @@ -175,7 +175,7 @@ void WM_gizmo_properties_create(struct PointerRNA *ptr, const char *gtstring); void WM_gizmo_properties_alloc(struct PointerRNA **ptr, struct IDProperty **properties, const char *gtstring); -void WM_gizmo_properties_sanitize(struct PointerRNA *ptr, const bool no_context); +void WM_gizmo_properties_sanitize(struct PointerRNA *ptr, bool no_context); /** * Set all props to their default. * @@ -184,7 +184,7 @@ void WM_gizmo_properties_sanitize(struct PointerRNA *ptr, const bool no_context) * \note There's nothing specific to gizmos here. * This could be made a general function. */ -bool WM_gizmo_properties_default(struct PointerRNA *ptr, const bool do_update); +bool WM_gizmo_properties_default(struct PointerRNA *ptr, bool do_update); /** * Remove all props without #PROP_SKIP_SAVE. */ @@ -274,7 +274,7 @@ float WM_gizmo_target_property_float_get(const struct wmGizmo *gz, void WM_gizmo_target_property_float_set(struct bContext *C, const struct wmGizmo *gz, struct wmGizmoProperty *gz_prop, - const float value); + float value); void WM_gizmo_target_property_float_get_array(const struct wmGizmo *gz, struct wmGizmoProperty *gz_prop, @@ -376,15 +376,14 @@ struct wmGizmoGroup *WM_gizmomap_group_find_ptr(struct wmGizmoMap *gzmap, const struct wmGizmoGroupType *gzgt); eWM_GizmoFlagMapDrawStep WM_gizmomap_drawstep_from_gizmo_group(const struct wmGizmoGroup *gzgroup); -void WM_gizmomap_tag_refresh_drawstep(struct wmGizmoMap *gzmap, - const eWM_GizmoFlagMapDrawStep drawstep); +void WM_gizmomap_tag_refresh_drawstep(struct wmGizmoMap *gzmap, eWM_GizmoFlagMapDrawStep drawstep); void WM_gizmomap_tag_refresh(struct wmGizmoMap *gzmap); bool WM_gizmomap_tag_delay_refresh_for_tweak_check(struct wmGizmoMap *gzmap); void WM_gizmomap_draw(struct wmGizmoMap *gzmap, const struct bContext *C, - const eWM_GizmoFlagMapDrawStep drawstep); + eWM_GizmoFlagMapDrawStep drawstep); void WM_gizmomap_add_handlers(struct ARegion *region, struct wmGizmoMap *gzmap); /** * Select/Deselect all selectable gizmos in \a gzmap. @@ -392,7 +391,7 @@ void WM_gizmomap_add_handlers(struct ARegion *region, struct wmGizmoMap *gzmap); * * TODO: select all by type. */ -bool WM_gizmomap_select_all(struct bContext *C, struct wmGizmoMap *gzmap, const int action); +bool WM_gizmomap_select_all(struct bContext *C, struct wmGizmoMap *gzmap, int action); bool WM_gizmomap_cursor_set(const struct wmGizmoMap *gzmap, struct wmWindow *win); void WM_gizmomap_message_subscribe(const struct bContext *C, struct wmGizmoMap *gzmap, diff --git a/source/blender/windowmanager/gizmo/intern/wm_gizmo_intern.h b/source/blender/windowmanager/gizmo/intern/wm_gizmo_intern.h index b6912d79076..187612f2651 100644 --- a/source/blender/windowmanager/gizmo/intern/wm_gizmo_intern.h +++ b/source/blender/windowmanager/gizmo/intern/wm_gizmo_intern.h @@ -40,7 +40,7 @@ bool wm_gizmo_select_set_ex( bool wm_gizmo_select_and_highlight(bContext *C, struct wmGizmoMap *gzmap, struct wmGizmo *gz); void wm_gizmo_calculate_scale(struct wmGizmo *gz, const bContext *C); -void wm_gizmo_update(struct wmGizmo *gz, const bContext *C, const bool refresh_map); +void wm_gizmo_update(struct wmGizmo *gz, const bContext *C, bool refresh_map); int wm_gizmo_is_visible(struct wmGizmo *gz); enum { @@ -75,7 +75,7 @@ struct wmGizmoGroup *wm_gizmogroup_find_by_type(const struct wmGizmoMap *gzmap, struct wmGizmo *wm_gizmogroup_find_intersected_gizmo(wmWindowManager *wm, const struct wmGizmoGroup *gzgroup, struct bContext *C, - const int event_modifier, + int event_modifier, const int mval[2], int *r_part); /** @@ -84,10 +84,10 @@ struct wmGizmo *wm_gizmogroup_find_intersected_gizmo(wmWindowManager *wm, */ void wm_gizmogroup_intersectable_gizmos_to_list(wmWindowManager *wm, const struct wmGizmoGroup *gzgroup, - const int event_modifier, + int event_modifier, struct BLI_Buffer *visible_gizmos); bool wm_gizmogroup_is_visible_in_drawstep(const struct wmGizmoGroup *gzgroup, - const eWM_GizmoFlagMapDrawStep drawstep); + eWM_GizmoFlagMapDrawStep drawstep); void wm_gizmogrouptype_setup_keymap(struct wmGizmoGroupType *gzgt, struct wmKeyConfig *keyconf); diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c index ef644da5578..28d8413fe0b 100644 --- a/source/blender/windowmanager/intern/wm_event_system.c +++ b/source/blender/windowmanager/intern/wm_event_system.c @@ -2263,7 +2263,7 @@ static int wm_handler_operator_call(bContext *C, CTX_wm_region_set(C, NULL); } - /* /update gizmos during modal handlers. */ + /* Update gizmos during modal handlers. */ wm_gizmomaps_handled_modal_update(C, event, handler); /* Remove modal handler, operator itself should have been canceled and freed. */ diff --git a/source/blender/windowmanager/intern/wm_jobs.c b/source/blender/windowmanager/intern/wm_jobs.c index 66277ec57f4..e7ad654d3e5 100644 --- a/source/blender/windowmanager/intern/wm_jobs.c +++ b/source/blender/windowmanager/intern/wm_jobs.c @@ -381,7 +381,6 @@ static void *do_job_thread(void *job_v) { wmJob *wm_job = job_v; - BLI_thread_put_thread_on_fast_node(); wm_job->startjob(wm_job->run_customdata, &wm_job->stop, &wm_job->do_update, &wm_job->progress); wm_job->ready = true; diff --git a/source/blender/windowmanager/wm_event_types.h b/source/blender/windowmanager/wm_event_types.h index 437bd1057c2..4ed1b7b9d0d 100644 --- a/source/blender/windowmanager/wm_event_types.h +++ b/source/blender/windowmanager/wm_event_types.h @@ -436,7 +436,7 @@ enum eEventType_Mask { (EVT_TYPE_MASK_KEYBOARD | EVT_TYPE_MASK_MOUSE | EVT_TYPE_MASK_NDOF) #define EVT_TYPE_MASK_HOTKEY_EXCLUDE EVT_TYPE_MASK_KEYBOARD_MODIFIER -bool WM_event_type_mask_test(const int event_type, const enum eEventType_Mask mask); +bool WM_event_type_mask_test(int event_type, enum eEventType_Mask mask); /* ********** wmEvent.val ********** */ diff --git a/source/blender/windowmanager/wm_window.h b/source/blender/windowmanager/wm_window.h index e44a39ecf1a..b003a4f92e7 100644 --- a/source/blender/windowmanager/wm_window.h +++ b/source/blender/windowmanager/wm_window.h @@ -58,19 +58,13 @@ wmWindow *wm_window_new(const struct Main *bmain, /** * Part of `wm_window.c` API. */ -wmWindow *wm_window_copy(struct Main *bmain, - wmWindowManager *wm, - wmWindow *win_src, - const bool duplicate_layout, - const bool child); +wmWindow *wm_window_copy( + struct Main *bmain, wmWindowManager *wm, wmWindow *win_src, bool duplicate_layout, bool child); /** * A higher level version of copy that tests the new window can be added. * (called from the operator directly). */ -wmWindow *wm_window_copy_test(bContext *C, - wmWindow *win_src, - const bool duplicate_layout, - const bool child); +wmWindow *wm_window_copy_test(bContext *C, wmWindow *win_src, bool duplicate_layout, bool child); /** * Including window itself. * \param C: can be NULL. diff --git a/source/blender/windowmanager/xr/intern/wm_xr_operators.c b/source/blender/windowmanager/xr/intern/wm_xr_operators.c index c503f5d4fee..9c2eaefd61c 100644 --- a/source/blender/windowmanager/xr/intern/wm_xr_operators.c +++ b/source/blender/windowmanager/xr/intern/wm_xr_operators.c @@ -956,7 +956,7 @@ static int wm_xr_navigation_fly_modal(bContext *C, wmOperator *op, const wmEvent const double time_now = PIL_check_seconds_timer(); mode = (eXrFlyMode)RNA_enum_get(op->ptr, "mode"); - turn = (mode == XR_FLY_TURNLEFT || mode == XR_FLY_TURNRIGHT); + turn = (ELEM(mode, XR_FLY_TURNLEFT, XR_FLY_TURNRIGHT)); locz_lock = RNA_boolean_get(op->ptr, "lock_location_z"); dir_lock = RNA_boolean_get(op->ptr, "lock_direction"); |