Cleanup: Remove unnecessary keywords from C++ headers

This commit is contained in:
Hans Goudey
2024-03-26 15:58:39 -04:00
parent 265bfdb019
commit 48e4576162
6 changed files with 329 additions and 424 deletions

View File

@@ -26,6 +26,7 @@
#define BLF_BLUR_ENABLE 0
struct ColorManagedDisplay;
struct ListBase;
struct ResultBLF;
struct rcti;
@@ -81,7 +82,7 @@ bool BLF_get_vfont_metrics(int fontid, float *ascend_ratio, float *em_ratio, flo
*/
float BLF_character_to_curves(int fontid,
unsigned int unicode,
struct ListBase *nurbsbase,
ListBase *nurbsbase,
const float scale);
/**
@@ -143,15 +144,14 @@ void BLF_batch_draw_end();
/**
* Draw the string using the current font.
*/
void BLF_draw_ex(int fontid, const char *str, size_t str_len, struct ResultBLF *r_info)
ATTR_NONNULL(2);
void BLF_draw_ex(int fontid, const char *str, size_t str_len, ResultBLF *r_info) ATTR_NONNULL(2);
void BLF_draw(int fontid, const char *str, size_t str_len) ATTR_NONNULL(2);
int BLF_draw_mono(int fontid, const char *str, size_t str_len, int cwidth, int tab_columns)
ATTR_NONNULL(2);
typedef bool (*BLF_GlyphBoundsFn)(const char *str,
size_t str_step_ofs,
const struct rcti *bounds,
const rcti *bounds,
void *user_data);
/**
@@ -182,8 +182,7 @@ size_t BLF_str_offset_from_cursor_position(int fontid,
bool BLF_str_offset_to_glyph_bounds(int fontid,
const char *str,
size_t str_offset,
struct rcti *glyph_bounds) ATTR_WARN_UNUSED_RESULT
ATTR_NONNULL(2, 4);
rcti *glyph_bounds) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(2, 4);
/**
* Get the string byte offset that fits within a given width.
@@ -206,23 +205,20 @@ size_t BLF_width_to_rstrlen(int fontid,
* This function return the bounding box of the string
* and are not multiplied by the aspect.
*/
void BLF_boundbox_ex(int fontid,
const char *str,
size_t str_len,
struct rcti *box,
struct ResultBLF *r_info) ATTR_NONNULL(2);
void BLF_boundbox(int fontid, const char *str, size_t str_len, struct rcti *box) ATTR_NONNULL();
void BLF_boundbox_ex(int fontid, const char *str, size_t str_len, rcti *box, ResultBLF *r_info)
ATTR_NONNULL(2);
void BLF_boundbox(int fontid, const char *str, size_t str_len, rcti *box) ATTR_NONNULL();
/**
* The next both function return the width and height
* of the string, using the current font and both value
* are multiplied by the aspect of the font.
*/
float BLF_width_ex(int fontid, const char *str, size_t str_len, struct ResultBLF *r_info)
float BLF_width_ex(int fontid, const char *str, size_t str_len, ResultBLF *r_info)
ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(2);
float BLF_width(int fontid, const char *str, size_t str_len) ATTR_WARN_UNUSED_RESULT
ATTR_NONNULL();
float BLF_height_ex(int fontid, const char *str, size_t str_len, struct ResultBLF *r_info)
float BLF_height_ex(int fontid, const char *str, size_t str_len, ResultBLF *r_info)
ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(2);
float BLF_height(int fontid, const char *str, size_t str_len) ATTR_WARN_UNUSED_RESULT
ATTR_NONNULL();
@@ -299,7 +295,7 @@ void BLF_buffer(int fontid,
int w,
int h,
int nch,
struct ColorManagedDisplay *display);
ColorManagedDisplay *display);
/**
* Set the color to be used for text.
@@ -310,7 +306,7 @@ void BLF_buffer_col(int fontid, const float rgba[4]) ATTR_NONNULL(2);
* Draw the string into the buffer, this function draw in both buffer,
* float and unsigned char _BUT_ it's not necessary set both buffer, NULL is valid here.
*/
void BLF_draw_buffer_ex(int fontid, const char *str, size_t str_len, struct ResultBLF *r_info)
void BLF_draw_buffer_ex(int fontid, const char *str, size_t str_len, ResultBLF *r_info)
ATTR_NONNULL(2);
void BLF_draw_buffer(int fontid, const char *str, size_t str_len) ATTR_NONNULL(2);

View File

@@ -49,9 +49,9 @@ struct rcti;
#define BLF_DPI 72
/** Font array. */
extern struct FontBLF *global_font[BLF_MAX_FONT];
extern FontBLF *global_font[BLF_MAX_FONT];
void blf_batch_draw_begin(struct FontBLF *font);
void blf_batch_draw_begin(FontBLF *font);
void blf_batch_draw();
/**
@@ -68,34 +68,28 @@ bool blf_font_id_is_valid(int fontid);
/**
* Return glyph id from char-code.
*/
uint blf_get_char_index(struct FontBLF *font, uint charcode);
uint blf_get_char_index(FontBLF *font, uint charcode);
/**
* Create an FT_Face for this font if not already existing.
*/
bool blf_ensure_face(struct FontBLF *font);
void blf_ensure_size(struct FontBLF *font);
bool blf_ensure_face(FontBLF *font);
void blf_ensure_size(FontBLF *font);
void blf_draw_buffer__start(struct FontBLF *font);
void blf_draw_buffer__start(FontBLF *font);
void blf_draw_buffer__end();
struct FontBLF *blf_font_new_from_filepath(const char *filepath);
struct FontBLF *blf_font_new_from_mem(const char *name, const unsigned char *mem, size_t mem_size);
void blf_font_attach_from_mem(struct FontBLF *font, const unsigned char *mem, size_t mem_size);
FontBLF *blf_font_new_from_filepath(const char *filepath);
FontBLF *blf_font_new_from_mem(const char *name, const unsigned char *mem, size_t mem_size);
void blf_font_attach_from_mem(FontBLF *font, const unsigned char *mem, size_t mem_size);
/**
* Change font's output size. Returns true if successful in changing the size.
*/
bool blf_font_size(struct FontBLF *font, float size);
bool blf_font_size(FontBLF *font, float size);
void blf_font_draw(struct FontBLF *font,
const char *str,
size_t str_len,
struct ResultBLF *r_info);
void blf_font_draw__wrap(struct FontBLF *font,
const char *str,
size_t str_len,
struct ResultBLF *r_info);
void blf_font_draw(FontBLF *font, const char *str, size_t str_len, ResultBLF *r_info);
void blf_font_draw__wrap(FontBLF *font, const char *str, size_t str_len, ResultBLF *r_info);
blender::Vector<blender::StringRef> blf_font_string_wrap(FontBLF *font,
blender::StringRef str,
@@ -105,89 +99,63 @@ blender::Vector<blender::StringRef> blf_font_string_wrap(FontBLF *font,
* Use fixed column width, but an utf8 character may occupy multiple columns.
*/
int blf_font_draw_mono(
struct FontBLF *font, const char *str, size_t str_len, int cwidth, int tab_columns);
void blf_font_draw_buffer(struct FontBLF *font,
const char *str,
size_t str_len,
struct ResultBLF *r_info);
void blf_font_draw_buffer__wrap(struct FontBLF *font,
const char *str,
size_t str_len,
struct ResultBLF *r_info);
FontBLF *font, const char *str, size_t str_len, int cwidth, int tab_columns);
void blf_font_draw_buffer(FontBLF *font, const char *str, size_t str_len, ResultBLF *r_info);
void blf_font_draw_buffer__wrap(FontBLF *font, const char *str, size_t str_len, ResultBLF *r_info);
size_t blf_font_width_to_strlen(
struct FontBLF *font, const char *str, size_t str_len, int width, int *r_width);
FontBLF *font, const char *str, size_t str_len, int width, int *r_width);
size_t blf_font_width_to_rstrlen(
struct FontBLF *font, const char *str, size_t str_len, int width, int *r_width);
void blf_font_boundbox(struct FontBLF *font,
const char *str,
size_t str_len,
struct rcti *r_box,
struct ResultBLF *r_info);
void blf_font_boundbox__wrap(struct FontBLF *font,
const char *str,
size_t str_len,
struct rcti *r_box,
struct ResultBLF *r_info);
void blf_font_width_and_height(struct FontBLF *font,
FontBLF *font, const char *str, size_t str_len, int width, int *r_width);
void blf_font_boundbox(
FontBLF *font, const char *str, size_t str_len, rcti *r_box, ResultBLF *r_info);
void blf_font_boundbox__wrap(
FontBLF *font, const char *str, size_t str_len, rcti *r_box, ResultBLF *r_info);
void blf_font_width_and_height(FontBLF *font,
const char *str,
size_t str_len,
float *r_width,
float *r_height,
struct ResultBLF *r_info);
float blf_font_width(struct FontBLF *font,
const char *str,
size_t str_len,
struct ResultBLF *r_info);
float blf_font_height(struct FontBLF *font,
const char *str,
size_t str_len,
struct ResultBLF *r_info);
float blf_font_fixed_width(struct FontBLF *font);
int blf_font_height_max(struct FontBLF *font);
int blf_font_width_max(struct FontBLF *font);
int blf_font_descender(struct FontBLF *font);
int blf_font_ascender(struct FontBLF *font);
ResultBLF *r_info);
float blf_font_width(FontBLF *font, const char *str, size_t str_len, ResultBLF *r_info);
float blf_font_height(FontBLF *font, const char *str, size_t str_len, ResultBLF *r_info);
float blf_font_fixed_width(FontBLF *font);
int blf_font_height_max(FontBLF *font);
int blf_font_width_max(FontBLF *font);
int blf_font_descender(FontBLF *font);
int blf_font_ascender(FontBLF *font);
char *blf_display_name(struct FontBLF *font);
char *blf_display_name(FontBLF *font);
void blf_font_boundbox_foreach_glyph(struct FontBLF *font,
const char *str,
size_t str_len,
bool (*user_fn)(const char *str,
size_t str_step_ofs,
const struct rcti *bounds,
void *user_data),
void *user_data);
void blf_font_boundbox_foreach_glyph(
FontBLF *font,
const char *str,
size_t str_len,
bool (*user_fn)(const char *str, size_t str_step_ofs, const rcti *bounds, void *user_data),
void *user_data);
size_t blf_str_offset_from_cursor_position(struct FontBLF *font,
size_t blf_str_offset_from_cursor_position(FontBLF *font,
const char *str,
size_t str_len,
int location_x);
void blf_str_offset_to_glyph_bounds(struct FontBLF *font,
void blf_str_offset_to_glyph_bounds(FontBLF *font,
const char *str,
size_t str_offset,
struct rcti *glyph_bounds);
rcti *glyph_bounds);
void blf_font_free(struct FontBLF *font);
void blf_font_free(FontBLF *font);
struct GlyphCacheBLF *blf_glyph_cache_acquire(struct FontBLF *font);
void blf_glyph_cache_release(struct FontBLF *font);
void blf_glyph_cache_clear(struct FontBLF *font);
GlyphCacheBLF *blf_glyph_cache_acquire(FontBLF *font);
void blf_glyph_cache_release(FontBLF *font);
void blf_glyph_cache_clear(FontBLF *font);
/**
* Create (or load from cache) a fully-rendered bitmap glyph.
*/
struct GlyphBLF *blf_glyph_ensure(struct FontBLF *font,
struct GlyphCacheBLF *gc,
uint charcode,
uint8_t subpixel = 0);
GlyphBLF *blf_glyph_ensure(FontBLF *font, GlyphCacheBLF *gc, uint charcode, uint8_t subpixel = 0);
#ifdef BLF_SUBPIXEL_AA
struct GlyphBLF *blf_glyph_ensure_subpixel(struct FontBLF *font,
struct GlyphCacheBLF *gc,
struct GlyphBLF *g,
int32_t pen_x);
GlyphBLF *blf_glyph_ensure_subpixel(FontBLF *font, GlyphCacheBLF *gc, GlyphBLF *g, int32_t pen_x);
#endif
/**
@@ -195,11 +163,10 @@ struct GlyphBLF *blf_glyph_ensure_subpixel(struct FontBLF *font,
*/
float blf_character_to_curves(FontBLF *font,
unsigned int unicode,
struct ListBase *nurbsbase,
ListBase *nurbsbase,
const float scale);
void blf_glyph_draw(
struct FontBLF *font, struct GlyphCacheBLF *gc, struct GlyphBLF *g, int x, int y);
void blf_glyph_draw(FontBLF *font, GlyphCacheBLF *gc, GlyphBLF *g, int x, int y);
#ifdef WIN32
/* `blf_font_win32_compat.cc` */

View File

@@ -33,31 +33,31 @@ struct Object;
struct Scene;
/* TODO: Move to `BKE_mesh_types.hh` when possible. */
typedef enum eMeshBatchDirtyMode {
enum eMeshBatchDirtyMode {
BKE_MESH_BATCH_DIRTY_ALL = 0,
BKE_MESH_BATCH_DIRTY_SELECT,
BKE_MESH_BATCH_DIRTY_SELECT_PAINT,
BKE_MESH_BATCH_DIRTY_SHADING,
BKE_MESH_BATCH_DIRTY_UVEDIT_ALL,
BKE_MESH_BATCH_DIRTY_UVEDIT_SELECT,
} eMeshBatchDirtyMode;
};
/* `mesh.cc` */
struct BMesh *BKE_mesh_to_bmesh_ex(const struct Mesh *mesh,
const struct BMeshCreateParams *create_params,
const struct BMeshFromMeshParams *convert_params);
struct BMesh *BKE_mesh_to_bmesh(struct Mesh *mesh,
struct Object *ob,
bool add_key_index,
const struct BMeshCreateParams *params);
BMesh *BKE_mesh_to_bmesh_ex(const Mesh *mesh,
const BMeshCreateParams *create_params,
const BMeshFromMeshParams *convert_params);
BMesh *BKE_mesh_to_bmesh(Mesh *mesh,
Object *ob,
bool add_key_index,
const BMeshCreateParams *params);
struct Mesh *BKE_mesh_from_bmesh_nomain(struct BMesh *bm,
const struct BMeshToMeshParams *params,
const struct Mesh *me_settings);
struct Mesh *BKE_mesh_from_bmesh_for_eval_nomain(struct BMesh *bm,
const struct CustomData_MeshMasks *cd_mask_extra,
const struct Mesh *me_settings);
Mesh *BKE_mesh_from_bmesh_nomain(BMesh *bm,
const BMeshToMeshParams *params,
const Mesh *me_settings);
Mesh *BKE_mesh_from_bmesh_for_eval_nomain(BMesh *bm,
const CustomData_MeshMasks *cd_mask_extra,
const Mesh *me_settings);
/**
* Add original index (#CD_ORIGINDEX) layers if they don't already exist. This is meant to be used
@@ -66,34 +66,34 @@ struct Mesh *BKE_mesh_from_bmesh_for_eval_nomain(struct BMesh *bm,
*
* The mesh is expected to of a `ME_WRAPPER_TYPE_MDATA` wrapper type. This is asserted.
*/
void BKE_mesh_ensure_default_orig_index_customdata(struct Mesh *mesh);
void BKE_mesh_ensure_default_orig_index_customdata(Mesh *mesh);
/**
* Same as #BKE_mesh_ensure_default_orig_index_customdata but does not perform any checks: they
* must be done by the caller.
*/
void BKE_mesh_ensure_default_orig_index_customdata_no_check(struct Mesh *mesh);
void BKE_mesh_ensure_default_orig_index_customdata_no_check(Mesh *mesh);
/**
* Free (or release) any data used by this mesh (does not free the mesh itself).
* Only use for undo, in most cases `BKE_id_free(nullptr, me)` should be used.
*/
void BKE_mesh_free_data_for_undo(struct Mesh *mesh);
void BKE_mesh_free_data_for_undo(Mesh *mesh);
/**
* Remove all geometry and derived data like caches from the mesh.
*/
void BKE_mesh_clear_geometry(struct Mesh *mesh);
void BKE_mesh_clear_geometry(Mesh *mesh);
/**
* Same as #BKE_mesh_clear_geometry, but also clears attribute meta-data like active attribute
* names and vertex group names. Used when the geometry is *entirely* replaced.
*/
void BKE_mesh_clear_geometry_and_metadata(struct Mesh *mesh);
void BKE_mesh_clear_geometry_and_metadata(Mesh *mesh);
struct Mesh *BKE_mesh_add(struct Main *bmain, const char *name);
Mesh *BKE_mesh_add(Main *bmain, const char *name);
void BKE_mesh_free_editmesh(struct Mesh *mesh);
void BKE_mesh_free_editmesh(Mesh *mesh);
/**
* A version of #BKE_mesh_copy_parameters that is intended for evaluated output
@@ -101,82 +101,68 @@ void BKE_mesh_free_editmesh(struct Mesh *mesh);
*
* \warning User counts are not handled for ID's.
*/
void BKE_mesh_copy_parameters_for_eval(struct Mesh *me_dst, const struct Mesh *me_src);
void BKE_mesh_copy_parameters_for_eval(Mesh *me_dst, const Mesh *me_src);
/**
* Copy user editable settings that we want to preserve
* 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_ensure_skin_customdata(struct Mesh *mesh);
void BKE_mesh_copy_parameters(Mesh *me_dst, const Mesh *me_src);
void BKE_mesh_ensure_skin_customdata(Mesh *mesh);
/** Add face offsets to describe faces to a new mesh. */
void BKE_mesh_face_offsets_ensure_alloc(struct Mesh *mesh);
void BKE_mesh_face_offsets_ensure_alloc(Mesh *mesh);
struct Mesh *BKE_mesh_new_nomain(int verts_num, int edges_num, int faces_num, int corners_num);
struct Mesh *BKE_mesh_new_nomain_from_template(
const struct Mesh *me_src, int verts_num, int edges_num, int faces_num, int corners_num);
struct Mesh *BKE_mesh_new_nomain_from_template_ex(const struct Mesh *me_src,
int verts_num,
int edges_num,
int tessface_num,
int faces_num,
int corners_num,
struct CustomData_MeshMasks mask);
Mesh *BKE_mesh_new_nomain(int verts_num, int edges_num, int faces_num, int corners_num);
Mesh *BKE_mesh_new_nomain_from_template(
const Mesh *me_src, int verts_num, int edges_num, int faces_num, int corners_num);
Mesh *BKE_mesh_new_nomain_from_template_ex(const Mesh *me_src,
int verts_num,
int edges_num,
int tessface_num,
int faces_num,
int corners_num,
CustomData_MeshMasks mask);
void BKE_mesh_eval_delete(struct Mesh *mesh_eval);
void BKE_mesh_eval_delete(Mesh *mesh_eval);
/**
* Performs copy for use during evaluation,
* optional referencing original arrays to reduce memory.
*/
struct Mesh *BKE_mesh_copy_for_eval(const struct Mesh *source);
Mesh *BKE_mesh_copy_for_eval(const Mesh *source);
/**
* These functions construct a new Mesh,
* contrary to #BKE_mesh_to_curve_nurblist which modifies ob itself.
*/
struct Mesh *BKE_mesh_new_nomain_from_curve(const struct Object *ob);
struct Mesh *BKE_mesh_new_nomain_from_curve_displist(const struct Object *ob,
const struct ListBase *dispbase);
Mesh *BKE_mesh_new_nomain_from_curve(const Object *ob);
Mesh *BKE_mesh_new_nomain_from_curve_displist(const Object *ob, const ListBase *dispbase);
bool BKE_mesh_attribute_required(const char *name);
float (*BKE_mesh_orco_verts_get(struct Object *ob))[3];
void BKE_mesh_orco_verts_transform(struct Mesh *mesh, float (*orco)[3], int totvert, bool invert);
float (*BKE_mesh_orco_verts_get(Object *ob))[3];
void BKE_mesh_orco_verts_transform(Mesh *mesh, float (*orco)[3], int totvert, bool invert);
/**
* Add a #CD_ORCO layer to the Mesh if there is none already.
*/
void BKE_mesh_orco_ensure(struct Object *ob, struct Mesh *mesh);
void BKE_mesh_orco_ensure(Object *ob, Mesh *mesh);
struct Mesh *BKE_mesh_from_object(struct Object *ob);
void BKE_mesh_assign_object(struct Main *bmain, struct Object *ob, struct Mesh *mesh);
void BKE_mesh_to_curve_nurblist(const struct Mesh *mesh,
struct ListBase *nurblist,
int edge_users_test);
void BKE_mesh_to_curve(struct Main *bmain,
struct Depsgraph *depsgraph,
struct Scene *scene,
struct Object *ob);
void BKE_mesh_to_pointcloud(struct Main *bmain,
struct Depsgraph *depsgraph,
struct Scene *scene,
struct Object *ob);
void BKE_pointcloud_to_mesh(struct Main *bmain,
struct Depsgraph *depsgraph,
struct Scene *scene,
struct Object *ob);
void BKE_mesh_material_index_remove(struct Mesh *mesh, short index);
bool BKE_mesh_material_index_used(struct Mesh *mesh, short index);
void BKE_mesh_material_index_clear(struct Mesh *mesh);
void BKE_mesh_material_remap(struct Mesh *mesh, const unsigned int *remap, unsigned int remap_len);
Mesh *BKE_mesh_from_object(Object *ob);
void BKE_mesh_assign_object(Main *bmain, Object *ob, Mesh *mesh);
void BKE_mesh_to_curve_nurblist(const Mesh *mesh, ListBase *nurblist, int edge_users_test);
void BKE_mesh_to_curve(Main *bmain, Depsgraph *depsgraph, Scene *scene, Object *ob);
void BKE_mesh_to_pointcloud(Main *bmain, Depsgraph *depsgraph, Scene *scene, Object *ob);
void BKE_pointcloud_to_mesh(Main *bmain, Depsgraph *depsgraph, Scene *scene, Object *ob);
void BKE_mesh_material_index_remove(Mesh *mesh, short index);
bool BKE_mesh_material_index_used(Mesh *mesh, short index);
void BKE_mesh_material_index_clear(Mesh *mesh);
void BKE_mesh_material_remap(Mesh *mesh, const unsigned int *remap, unsigned int remap_len);
void BKE_mesh_texspace_calc(struct Mesh *mesh);
void BKE_mesh_texspace_ensure(struct Mesh *mesh);
void BKE_mesh_texspace_get(struct Mesh *mesh,
float r_texspace_location[3],
float r_texspace_size[3]);
void BKE_mesh_texspace_get_reference(struct Mesh *mesh,
void BKE_mesh_texspace_calc(Mesh *mesh);
void BKE_mesh_texspace_ensure(Mesh *mesh);
void BKE_mesh_texspace_get(Mesh *mesh, float r_texspace_location[3], float r_texspace_size[3]);
void BKE_mesh_texspace_get_reference(Mesh *mesh,
char **r_texspace_flag,
float **r_texspace_location,
float **r_texspace_size);
@@ -191,62 +177,62 @@ void BKE_mesh_texspace_get_reference(struct Mesh *mesh,
* \note Dependency graph argument is required when preserve_all_data_layers is true, and is
* ignored otherwise.
*/
struct Mesh *BKE_mesh_new_from_object(struct Depsgraph *depsgraph,
struct Object *object,
bool preserve_all_data_layers,
bool preserve_origindex);
Mesh *BKE_mesh_new_from_object(Depsgraph *depsgraph,
Object *object,
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.
* However, that function enforces object type to be a geometry one, and ensures a mesh is always
* generated, be it empty.
*/
struct Mesh *BKE_mesh_new_from_object_to_bmain(struct Main *bmain,
struct Depsgraph *depsgraph,
struct Object *object,
bool preserve_all_data_layers);
Mesh *BKE_mesh_new_from_object_to_bmain(Main *bmain,
Depsgraph *depsgraph,
Object *object,
bool preserve_all_data_layers);
/**
* Move data from a mesh outside of the main data-base into a mesh in the data-base.
* Takes ownership of the source mesh.
*/
void BKE_mesh_nomain_to_mesh(struct Mesh *mesh_src, struct Mesh *mesh_dst, struct Object *ob);
void BKE_mesh_nomain_to_meshkey(struct Mesh *mesh_src, struct Mesh *mesh_dst, struct KeyBlock *kb);
void BKE_mesh_nomain_to_mesh(Mesh *mesh_src, Mesh *mesh_dst, Object *ob);
void BKE_mesh_nomain_to_meshkey(Mesh *mesh_src, Mesh *mesh_dst, KeyBlock *kb);
/* vertex level transformations & checks (no derived mesh) */
/* basic vertex data functions */
void BKE_mesh_transform(struct Mesh *mesh, const float mat[4][4], bool do_keys);
void BKE_mesh_translate(struct Mesh *mesh, const float offset[3], bool do_keys);
void BKE_mesh_transform(Mesh *mesh, const float mat[4][4], bool do_keys);
void BKE_mesh_translate(Mesh *mesh, const float offset[3], bool do_keys);
void BKE_mesh_tessface_clear(struct Mesh *mesh);
void BKE_mesh_tessface_clear(Mesh *mesh);
void BKE_mesh_mselect_clear(struct Mesh *mesh);
void BKE_mesh_mselect_validate(struct Mesh *mesh);
void BKE_mesh_mselect_clear(Mesh *mesh);
void BKE_mesh_mselect_validate(Mesh *mesh);
/**
* \return the index within `me->mselect`, or -1
*/
int BKE_mesh_mselect_find(struct Mesh *mesh, int index, int type);
int BKE_mesh_mselect_find(Mesh *mesh, int index, int type);
/**
* \return The index of the active element.
*/
int BKE_mesh_mselect_active_get(struct Mesh *mesh, int type);
void BKE_mesh_mselect_active_set(struct Mesh *mesh, int index, int type);
int BKE_mesh_mselect_active_get(Mesh *mesh, int type);
void BKE_mesh_mselect_active_set(Mesh *mesh, int index, int type);
void BKE_mesh_count_selected_items(const struct Mesh *mesh, int r_count[3]);
void BKE_mesh_count_selected_items(const Mesh *mesh, int r_count[3]);
/* *** mesh_normals.cc *** */
/** Return true if the mesh vertex normals either are not stored or are dirty. */
bool BKE_mesh_vert_normals_are_dirty(const struct Mesh *mesh);
bool BKE_mesh_vert_normals_are_dirty(const Mesh *mesh);
/** Return true if the mesh face normals either are not stored or are dirty. */
bool BKE_mesh_face_normals_are_dirty(const struct Mesh *mesh);
bool BKE_mesh_face_normals_are_dirty(const Mesh *mesh);
/**
* References a contiguous loop-fan with normal offset vars.
*/
typedef struct MLoopNorSpace {
struct MLoopNorSpace {
/** Automatically computed loop normal. */
float vec_lnor[3];
/** Reference vector, orthogonal to vec_lnor. */
@@ -263,7 +249,7 @@ typedef struct MLoopNorSpace {
* - BMLoop pointers. */
struct LinkNode *loops;
char flags;
} MLoopNorSpace;
};
/**
* MLoopNorSpace.flags
*/
@@ -274,14 +260,14 @@ enum {
/**
* Collection of #MLoopNorSpace basic storage & pre-allocation.
*/
typedef struct MLoopNorSpaceArray {
struct MLoopNorSpaceArray {
MLoopNorSpace **lspacearr; /* Face corner aligned array */
struct LinkNode
*loops_pool; /* Allocated once, avoids to call BLI_linklist_prepend_arena() for each loop! */
char data_type; /* Whether we store loop indices, or pointers to BMLoop. */
int spaces_num; /* Number of clnors spaces defined in this array. */
struct MemArena *mem;
} MLoopNorSpaceArray;
};
/**
* MLoopNorSpaceArray.data_type
*/
@@ -360,7 +346,7 @@ void BKE_mesh_normals_loop_to_vertex(int numVerts,
/**
* High-level custom normals functions.
*/
bool BKE_mesh_has_custom_loop_normals(struct Mesh *mesh);
bool BKE_mesh_has_custom_loop_normals(Mesh *mesh);
/**
* Higher level functions hiding most of the code needed around call to
@@ -369,7 +355,7 @@ bool BKE_mesh_has_custom_loop_normals(struct Mesh *mesh);
* \param r_custom_loop_normals: is not const, since code will replace zero_v3 normals there
* with automatically computed vectors.
*/
void BKE_mesh_set_custom_normals(struct Mesh *mesh, float (*r_custom_loop_normals)[3]);
void BKE_mesh_set_custom_normals(Mesh *mesh, float (*r_custom_loop_normals)[3]);
/**
* Higher level functions hiding most of the code needed around call to
* #normals_corner_custom_set_from_verts().
@@ -377,24 +363,24 @@ void BKE_mesh_set_custom_normals(struct Mesh *mesh, float (*r_custom_loop_normal
* \param r_custom_vert_normals: is not const, since code will replace zero_v3 normals there
* with automatically computed vectors.
*/
void BKE_mesh_set_custom_normals_from_verts(struct Mesh *mesh, float (*r_custom_vert_normals)[3]);
void BKE_mesh_set_custom_normals_from_verts(Mesh *mesh, float (*r_custom_vert_normals)[3]);
/* *** mesh_evaluate.cc *** */
float BKE_mesh_calc_area(const struct Mesh *mesh);
float BKE_mesh_calc_area(const Mesh *mesh);
bool BKE_mesh_center_median(const struct Mesh *mesh, float r_cent[3]);
bool BKE_mesh_center_median(const Mesh *mesh, float r_cent[3]);
/**
* Calculate the center from faces,
* use when we want to ignore vertex locations that don't have connected faces.
*/
bool BKE_mesh_center_median_from_faces(const struct Mesh *mesh, float r_cent[3]);
bool BKE_mesh_center_of_surface(const struct Mesh *mesh, float r_cent[3]);
bool BKE_mesh_center_median_from_faces(const Mesh *mesh, float r_cent[3]);
bool BKE_mesh_center_of_surface(const Mesh *mesh, float r_cent[3]);
/**
* \note Mesh must be manifold with consistent face-winding,
* see #mesh_calc_face_volume_centroid for details.
*/
bool BKE_mesh_center_of_volume(const struct Mesh *mesh, float r_cent[3]);
bool BKE_mesh_center_of_volume(const Mesh *mesh, float r_cent[3]);
/**
* Calculate the volume and center.
@@ -414,7 +400,7 @@ void BKE_mesh_calc_volume(const float (*vert_positions)[3],
* Flip a single corner'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, bool use_loop_mdisp_flip);
void BKE_mesh_mdisp_flip(MDisps *md, bool use_loop_mdisp_flip);
/**
* Account for custom-data such as UVs becoming detached because of imprecision
@@ -422,7 +408,7 @@ void BKE_mesh_mdisp_flip(struct MDisps *md, bool use_loop_mdisp_flip);
* Without running this operation subdivision surface can cause UVs to be disconnected,
* see: #81065.
*/
void BKE_mesh_merge_customdata_for_apply_modifier(struct Mesh *mesh);
void BKE_mesh_merge_customdata_for_apply_modifier(Mesh *mesh);
/* Flush flags. */
@@ -456,80 +442,75 @@ void BKE_mesh_calc_relative_deform(const int *face_offsets,
*
* \returns true if a change is made.
*/
bool BKE_mesh_validate(struct Mesh *mesh, bool do_verbose, bool cddata_check_mask);
bool BKE_mesh_validate(Mesh *mesh, 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.
*/
bool BKE_mesh_is_valid(struct Mesh *mesh);
bool BKE_mesh_is_valid(Mesh *mesh);
/**
* Check all material indices of faces are valid, invalid ones are set to 0.
* \returns True if the material indices are valid.
*/
bool BKE_mesh_validate_material_indices(struct Mesh *mesh);
#ifdef __cplusplus
bool BKE_mesh_validate_material_indices(Mesh *mesh);
/**
* Validate the mesh, \a do_fixes requires \a mesh to be non-null.
*
* \return false if no changes needed to be made.
*/
bool BKE_mesh_validate_arrays(struct Mesh *mesh,
bool BKE_mesh_validate_arrays(Mesh *mesh,
float (*vert_positions)[3],
unsigned int verts_num,
blender::int2 *edges,
unsigned int edges_num,
struct MFace *legacy_faces,
MFace *legacy_faces,
unsigned int legacy_faces_num,
int *corner_verts,
int *corner_edges,
unsigned int corners_num,
const int *face_offsets,
unsigned int faces_num,
struct MDeformVert *dverts, /* assume totvert length */
MDeformVert *dverts, /* assume totvert length */
bool do_verbose,
bool do_fixes,
bool *r_change);
#endif
/**
* \returns is_valid.
*/
bool BKE_mesh_validate_all_customdata(struct CustomData *vert_data,
bool BKE_mesh_validate_all_customdata(CustomData *vert_data,
uint verts_num,
struct CustomData *edge_data,
CustomData *edge_data,
uint edges_num,
struct CustomData *corner_data,
CustomData *corner_data,
uint corners_num,
struct CustomData *face_data,
CustomData *face_data,
uint faces_num,
bool check_meshmask,
bool do_verbose,
bool do_fixes,
bool *r_change);
void BKE_mesh_strip_loose_faces(struct Mesh *mesh);
void BKE_mesh_strip_loose_faces(Mesh *mesh);
/* In DerivedMesh.cc */
void BKE_mesh_wrapper_deferred_finalize_mdata(struct Mesh *mesh_eval);
void BKE_mesh_wrapper_deferred_finalize_mdata(Mesh *mesh_eval);
/* **** Depsgraph evaluation **** */
void BKE_mesh_eval_geometry(struct Depsgraph *depsgraph, struct Mesh *mesh);
void BKE_mesh_eval_geometry(Depsgraph *depsgraph, Mesh *mesh);
/* Draw Cache */
void BKE_mesh_batch_cache_dirty_tag(struct Mesh *mesh, eMeshBatchDirtyMode mode);
void BKE_mesh_batch_cache_dirty_tag(Mesh *mesh, eMeshBatchDirtyMode mode);
void BKE_mesh_batch_cache_free(void *batch_cache);
extern void (*BKE_mesh_batch_cache_dirty_tag_cb)(struct Mesh *mesh, eMeshBatchDirtyMode mode);
extern void (*BKE_mesh_batch_cache_dirty_tag_cb)(Mesh *mesh, eMeshBatchDirtyMode mode);
extern void (*BKE_mesh_batch_cache_free_cb)(void *batch_cache);
/* `mesh_debug.cc` */
#ifndef NDEBUG
char *BKE_mesh_debug_info(const struct Mesh *mesh)
ATTR_NONNULL(1) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT;
void BKE_mesh_debug_print(const struct Mesh *mesh) ATTR_NONNULL(1);
char *BKE_mesh_debug_info(const Mesh *mesh) ATTR_NONNULL(1) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT;
void BKE_mesh_debug_print(const Mesh *mesh) ATTR_NONNULL(1);
#endif

View File

@@ -70,7 +70,7 @@ struct uiLayout;
* static struct lists. These are converted to the new template collections
* in RNA types automatically.
*/
typedef struct bNodeSocketTemplate {
struct bNodeSocketTemplate {
int type;
char name[64]; /* MAX_NAME */
float val1, val2, val3, val4; /* default alloc value for inputs */
@@ -79,9 +79,9 @@ typedef struct bNodeSocketTemplate {
int flag;
/* after this line is used internal only */
struct bNodeSocket *sock; /* used to hold verified socket */
char identifier[64]; /* generated from name */
} bNodeSocketTemplate;
bNodeSocket *sock; /* used to hold verified socket */
char identifier[64]; /* generated from name */
};
/* Use `void *` for callbacks that require C++. This is rather ugly, but works well for now. This
* would not be necessary if we would use bNodeSocketType and bNodeType only in C++ code.
@@ -133,7 +133,7 @@ using NodeExtraInfoFunction = void (*)(blender::nodes::NodeExtraInfoParams &para
*
* Defines the appearance and behavior of a socket in the UI.
*/
typedef struct bNodeSocketType {
struct bNodeSocketType {
/** Identifier name. */
char idname[64];
/** Type label. */
@@ -141,30 +141,21 @@ typedef struct bNodeSocketType {
/** Sub-type label. */
char subtype_label[64];
void (*draw)(struct bContext *C,
struct uiLayout *layout,
struct PointerRNA *ptr,
struct PointerRNA *node_ptr,
const char *text);
void (*draw_color)(struct bContext *C,
struct PointerRNA *ptr,
struct PointerRNA *node_ptr,
float *r_color);
void (*draw)(
bContext *C, uiLayout *layout, PointerRNA *ptr, PointerRNA *node_ptr, const char *text);
void (*draw_color)(bContext *C, PointerRNA *ptr, PointerRNA *node_ptr, float *r_color);
void (*draw_color_simple)(const bNodeSocketType *socket_type, float *r_color);
void (*interface_draw)(struct ID *id,
struct bNodeTreeInterfaceSocket *socket,
struct bContext *C,
struct uiLayout *layout);
void (*interface_init_socket)(struct ID *id,
const struct bNodeTreeInterfaceSocket *interface_socket,
struct bNode *node,
struct bNodeSocket *socket,
void (*interface_draw)(ID *id, bNodeTreeInterfaceSocket *socket, bContext *C, uiLayout *layout);
void (*interface_init_socket)(ID *id,
const bNodeTreeInterfaceSocket *interface_socket,
bNode *node,
bNodeSocket *socket,
const char *data_path);
void (*interface_from_socket)(struct ID *id,
struct bNodeTreeInterfaceSocket *interface_socket,
const struct bNode *node,
const struct bNodeSocket *socket);
void (*interface_from_socket)(ID *id,
bNodeTreeInterfaceSocket *interface_socket,
const bNode *node,
const bNodeSocket *socket);
/* RNA integration */
ExtensionRNA ext_socket;
@@ -179,7 +170,7 @@ typedef struct bNodeSocketType {
int output_link_limit;
/* Callback to free the socket type. */
void (*free_self)(struct bNodeSocketType *stype);
void (*free_self)(bNodeSocketType *stype);
/* Return the CPPType of this socket. */
const blender::CPPType *base_cpp_type;
@@ -191,24 +182,17 @@ typedef struct bNodeSocketType {
SocketGetGeometryNodesCPPValueFunction get_geometry_nodes_cpp_value;
/* Default value for this socket type. */
const void *geometry_nodes_default_cpp_value;
} bNodeSocketType;
};
typedef void *(*NodeInitExecFunction)(struct bNodeExecContext *context,
struct bNode *node,
bNodeInstanceKey key);
typedef void (*NodeFreeExecFunction)(void *nodedata);
typedef void (*NodeExecFunction)(void *data,
int thread,
struct bNode *,
struct bNodeExecData *execdata,
struct bNodeStack **in,
struct bNodeStack **out);
typedef int (*NodeGPUExecFunction)(struct GPUMaterial *mat,
struct bNode *node,
struct bNodeExecData *execdata,
struct GPUNodeStack *in,
struct GPUNodeStack *out);
typedef void (*NodeMaterialXFunction)(void *data, struct bNode *node, struct bNodeSocket *out);
using NodeInitExecFunction = void *(*)(bNodeExecContext *context,
bNode *node,
bNodeInstanceKey key);
using NodeFreeExecFunction = void (*)(void *nodedata);
using NodeExecFunction = void (*)(
void *data, int thread, bNode *, bNodeExecData *execdata, bNodeStack **in, bNodeStack **out);
using NodeGPUExecFunction = int (*)(
GPUMaterial *mat, bNode *node, bNodeExecData *execdata, GPUNodeStack *in, GPUNodeStack *out);
using NodeMaterialXFunction = void (*)(void *data, bNode *node, bNodeSocket *out);
/**
* \brief Defines a node type.
@@ -216,7 +200,7 @@ typedef void (*NodeMaterialXFunction)(void *data, struct bNode *node, struct bNo
* Initial attributes and constants for a node as well as callback functions
* implementing the node behavior.
*/
typedef struct bNodeType {
struct bNodeType {
char idname[64]; /* identifier name */
int type;
@@ -236,30 +220,26 @@ typedef struct bNodeType {
char storagename[64]; /* struct name for DNA */
/* Draw the option buttons on the node */
void (*draw_buttons)(struct uiLayout *, struct bContext *C, struct PointerRNA *ptr);
void (*draw_buttons)(uiLayout *, bContext *C, PointerRNA *ptr);
/* Additional parameters in the side panel */
void (*draw_buttons_ex)(struct uiLayout *, struct bContext *C, struct PointerRNA *ptr);
void (*draw_buttons_ex)(uiLayout *, bContext *C, PointerRNA *ptr);
/* Additional drawing on backdrop */
void (*draw_backdrop)(
struct SpaceNode *snode, struct ImBuf *backdrop, struct bNode *node, int x, int y);
void (*draw_backdrop)(SpaceNode *snode, ImBuf *backdrop, bNode *node, int x, int y);
/**
* Optional custom label function for the node header.
* \note Used as a fallback when #bNode.label isn't set.
*/
void (*labelfunc)(const struct bNodeTree *ntree,
const struct bNode *node,
char *label,
int label_maxncpy);
void (*labelfunc)(const bNodeTree *ntree, const bNode *node, char *label, int label_maxncpy);
/** Optional override for node class, used for drawing node header. */
int (*ui_class)(const struct bNode *node);
int (*ui_class)(const bNode *node);
/** Called when the node is updated in the editor. */
void (*updatefunc)(struct bNodeTree *ntree, struct bNode *node);
void (*updatefunc)(bNodeTree *ntree, bNode *node);
/** Check and update if internal ID data has changed. */
void (*group_update_func)(struct bNodeTree *ntree, struct bNode *node);
void (*group_update_func)(bNodeTree *ntree, bNode *node);
/**
* Initialize a new node instance of this type after creation.
@@ -267,7 +247,7 @@ typedef struct bNodeType {
* \note Assignments to `node->id` must not increment the user of the ID.
* This is handled by the caller of this callback.
*/
void (*initfunc)(struct bNodeTree *ntree, struct bNode *node);
void (*initfunc)(bNodeTree *ntree, bNode *node);
/**
* Free the node instance.
*
@@ -275,22 +255,20 @@ typedef struct bNodeType {
* while freeing #Main, the state of this ID is undefined.
* Higher level logic to remove the node handles the user-count.
*/
void (*freefunc)(struct bNode *node);
void (*freefunc)(bNode *node);
/** Make a copy of the node instance. */
void (*copyfunc)(struct bNodeTree *dest_ntree,
struct bNode *dest_node,
const struct bNode *src_node);
void (*copyfunc)(bNodeTree *dest_ntree, bNode *dest_node, const bNode *src_node);
/* Registerable API callback versions, called in addition to C callbacks */
void (*initfunc_api)(const struct bContext *C, struct PointerRNA *ptr);
void (*freefunc_api)(struct PointerRNA *ptr);
void (*copyfunc_api)(struct PointerRNA *ptr, const struct bNode *src_node);
void (*initfunc_api)(const bContext *C, PointerRNA *ptr);
void (*freefunc_api)(PointerRNA *ptr);
void (*copyfunc_api)(PointerRNA *ptr, const bNode *src_node);
/**
* An additional poll test for deciding whether nodes should be an option in search menus.
* Potentially more strict poll than #poll(), but doesn't have to check the same things.
*/
bool (*add_ui_poll)(const struct bContext *C);
bool (*add_ui_poll)(const bContext *C);
/**
* Can this node type be added to a node tree?
@@ -301,21 +279,19 @@ typedef struct bNodeType {
* when it's not just a dummy, that is, if it actually wants to access
* the returned disabled-hint (null-check needed!).
*/
bool (*poll)(const struct bNodeType *ntype,
const struct bNodeTree *nodetree,
const char **r_disabled_hint);
bool (*poll)(const bNodeType *ntype, const bNodeTree *nodetree, const char **r_disabled_hint);
/**
* Can this node be added to a node tree?
* \param r_disabled_hint: See `poll()`.
*/
bool (*poll_instance)(const struct bNode *node,
const struct bNodeTree *nodetree,
bool (*poll_instance)(const bNode *node,
const bNodeTree *nodetree,
const char **r_disabled_hint);
/* Optional handling of link insertion. Returns false if the link shouldn't be created. */
bool (*insert_link)(struct bNodeTree *ntree, struct bNode *node, struct bNodeLink *link);
bool (*insert_link)(bNodeTree *ntree, bNode *node, bNodeLink *link);
void (*free_self)(struct bNodeType *ntype);
void (*free_self)(bNodeType *ntype);
/* **** execution callbacks **** */
NodeInitExecFunction init_exec_fn;
@@ -379,7 +355,7 @@ typedef struct bNodeType {
/* RNA integration */
ExtensionRNA rna_ext;
} bNodeType;
};
/** #bNodeType.nclass (for add-menu and themes). */
#define NODE_CLASS_INPUT 0
@@ -402,8 +378,8 @@ typedef struct bNodeType {
struct bNodeTreeExec;
typedef void (*bNodeClassCallback)(void *calldata, int nclass, const char *name);
typedef struct bNodeTreeType {
using bNodeClassCallback = void (*)(void *calldata, int nclass, const char *name);
struct bNodeTreeType {
int type; /* type identifier */
char idname[64]; /* identifier name */
@@ -416,33 +392,30 @@ typedef struct bNodeTreeType {
/* callbacks */
/* Iteration over all node classes. */
void (*foreach_nodeclass)(struct Scene *scene, void *calldata, bNodeClassCallback func);
void (*foreach_nodeclass)(Scene *scene, void *calldata, bNodeClassCallback func);
/* Check visibility in the node editor */
bool (*poll)(const struct bContext *C, struct bNodeTreeType *ntreetype);
bool (*poll)(const bContext *C, bNodeTreeType *ntreetype);
/* Select a node tree from the context */
void (*get_from_context)(const struct bContext *C,
struct bNodeTreeType *ntreetype,
struct bNodeTree **r_ntree,
struct ID **r_id,
struct ID **r_from);
void (*get_from_context)(
const bContext *C, bNodeTreeType *ntreetype, bNodeTree **r_ntree, ID **r_id, ID **r_from);
/* calls allowing threaded composite */
void (*localize)(struct bNodeTree *localtree, struct bNodeTree *ntree);
void (*local_merge)(struct Main *bmain, struct bNodeTree *localtree, struct bNodeTree *ntree);
void (*localize)(bNodeTree *localtree, bNodeTree *ntree);
void (*local_merge)(Main *bmain, bNodeTree *localtree, bNodeTree *ntree);
/* Tree update. Overrides `nodetype->updatetreefunc`. */
void (*update)(struct bNodeTree *ntree);
void (*update)(bNodeTree *ntree);
bool (*validate_link)(eNodeSocketDatatype from, eNodeSocketDatatype to);
void (*node_add_init)(struct bNodeTree *ntree, struct bNode *bnode);
void (*node_add_init)(bNodeTree *ntree, bNode *bnode);
/* Check if the socket type is valid for this tree type. */
bool (*valid_socket_type)(struct bNodeTreeType *ntreetype, struct bNodeSocketType *socket_type);
bool (*valid_socket_type)(bNodeTreeType *ntreetype, bNodeSocketType *socket_type);
/* RNA integration */
ExtensionRNA rna_ext;
} bNodeTreeType;
};
/** \} */
@@ -450,11 +423,11 @@ typedef struct bNodeTreeType {
/** \name Generic API, Trees
* \{ */
struct bNodeTreeType *ntreeTypeFind(const char *idname);
void ntreeTypeAdd(struct bNodeTreeType *nt);
void ntreeTypeFreeLink(const struct bNodeTreeType *nt);
bool ntreeIsRegistered(const struct bNodeTree *ntree);
struct GHashIterator *ntreeTypeGetIterator();
bNodeTreeType *ntreeTypeFind(const char *idname);
void ntreeTypeAdd(bNodeTreeType *nt);
void ntreeTypeFreeLink(const bNodeTreeType *nt);
bool ntreeIsRegistered(const bNodeTree *ntree);
GHashIterator *ntreeTypeGetIterator();
/* Helper macros for iterating over tree types. */
#define NODE_TREE_TYPES_BEGIN(ntype) \
@@ -479,14 +452,14 @@ struct GHashIterator *ntreeTypeGetIterator();
* In that case the update_typeinfo function will set type-info on registration
* and do necessary updates.
*/
void ntreeSetTypes(const struct bContext *C, struct bNodeTree *ntree);
void ntreeSetTypes(const bContext *C, bNodeTree *ntree);
struct bNodeTree *ntreeAddTree(struct Main *bmain, const char *name, const char *idname);
bNodeTree *ntreeAddTree(Main *bmain, const char *name, const char *idname);
/**
* Free tree which is embedded into another data-block.
*/
void ntreeFreeEmbeddedTree(struct bNodeTree *ntree);
void ntreeFreeEmbeddedTree(bNodeTree *ntree);
/**
* Get address of potential node-tree pointer of given ID.
@@ -494,39 +467,38 @@ void ntreeFreeEmbeddedTree(struct bNodeTree *ntree);
* \warning Using this function directly is potentially dangerous, if you don't know or are not
* sure, please use `ntreeFromID()` instead.
*/
struct bNodeTree **BKE_ntree_ptr_from_id(struct ID *id);
bNodeTree **BKE_ntree_ptr_from_id(ID *id);
/**
* Returns the private NodeTree object of the data-block, if it has one.
*/
struct bNodeTree *ntreeFromID(struct ID *id);
bNodeTree *ntreeFromID(ID *id);
void ntreeFreeLocalTree(struct bNodeTree *ntree);
void ntreeFreeLocalTree(bNodeTree *ntree);
/**
* Check recursively if a node tree contains another.
*/
bool ntreeContainsTree(const struct bNodeTree *tree_to_search_in,
const struct bNodeTree *tree_to_search_for);
bool ntreeContainsTree(const bNodeTree *tree_to_search_in, const bNodeTree *tree_to_search_for);
void ntreeUpdateAllUsers(struct Main *main, struct ID *id);
void ntreeUpdateAllUsers(Main *main, ID *id);
/**
* XXX: old trees handle output flags automatically based on special output
* node types and last active selection.
* New tree types have a per-output socket flag to indicate the final output to use explicitly.
*/
void ntreeSetOutput(struct bNodeTree *ntree);
void ntreeSetOutput(bNodeTree *ntree);
/**
* Returns localized tree for execution in threads.
*/
struct bNodeTree *ntreeLocalize(struct bNodeTree *ntree);
bNodeTree *ntreeLocalize(bNodeTree *ntree);
/**
* This is only direct data, tree itself should have been written.
*/
void ntreeBlendWrite(struct BlendWriter *writer, struct bNodeTree *ntree);
void ntreeBlendWrite(BlendWriter *writer, bNodeTree *ntree);
/** \} */
@@ -534,12 +506,12 @@ void ntreeBlendWrite(struct BlendWriter *writer, struct bNodeTree *ntree);
/** \name Generic API, Nodes
* \{ */
struct bNodeType *nodeTypeFind(const char *idname);
bNodeType *nodeTypeFind(const char *idname);
const char *nodeTypeFindAlias(const char *idname);
void nodeRegisterType(struct bNodeType *ntype);
void nodeUnregisterType(struct bNodeType *ntype);
void nodeRegisterAlias(struct bNodeType *nt, const char *alias);
struct GHashIterator *nodeTypeGetIterator();
void nodeRegisterType(bNodeType *ntype);
void nodeUnregisterType(bNodeType *ntype);
void nodeRegisterAlias(bNodeType *nt, const char *alias);
GHashIterator *nodeTypeGetIterator();
/* Helper macros for iterating over node types. */
#define NODE_TYPES_BEGIN(ntype) \
@@ -555,11 +527,11 @@ struct GHashIterator *nodeTypeGetIterator();
} \
((void)0)
struct bNodeSocketType *nodeSocketTypeFind(const char *idname);
void nodeRegisterSocketType(struct bNodeSocketType *stype);
void nodeUnregisterSocketType(struct bNodeSocketType *stype);
bool nodeSocketIsRegistered(const struct bNodeSocket *sock);
struct GHashIterator *nodeSocketTypeGetIterator();
bNodeSocketType *nodeSocketTypeFind(const char *idname);
void nodeRegisterSocketType(bNodeSocketType *stype);
void nodeUnregisterSocketType(bNodeSocketType *stype);
bool nodeSocketIsRegistered(const bNodeSocket *sock);
GHashIterator *nodeSocketTypeGetIterator();
const char *nodeSocketTypeLabel(const bNodeSocketType *stype);
const char *nodeStaticSocketType(int type, int subtype);
@@ -582,114 +554,100 @@ const char *nodeStaticSocketLabel(int type, int subtype);
} \
((void)0)
struct bNodeSocket *nodeFindSocket(const struct bNode *node,
eNodeSocketInOut in_out,
const char *identifier);
struct bNodeSocket *nodeAddSocket(struct bNodeTree *ntree,
struct bNode *node,
eNodeSocketInOut in_out,
const char *idname,
const char *identifier,
const char *name);
struct bNodeSocket *nodeAddStaticSocket(struct bNodeTree *ntree,
struct bNode *node,
eNodeSocketInOut in_out,
int type,
int subtype,
const char *identifier,
const char *name);
void nodeRemoveSocket(struct bNodeTree *ntree, struct bNode *node, struct bNodeSocket *sock);
bNodeSocket *nodeFindSocket(const bNode *node, eNodeSocketInOut in_out, const char *identifier);
bNodeSocket *nodeAddSocket(bNodeTree *ntree,
bNode *node,
eNodeSocketInOut in_out,
const char *idname,
const char *identifier,
const char *name);
bNodeSocket *nodeAddStaticSocket(bNodeTree *ntree,
bNode *node,
eNodeSocketInOut in_out,
int type,
int subtype,
const char *identifier,
const char *name);
void nodeRemoveSocket(bNodeTree *ntree, bNode *node, bNodeSocket *sock);
void nodeModifySocketTypeStatic(
struct bNodeTree *ntree, struct bNode *node, struct bNodeSocket *sock, int type, int subtype);
bNodeTree *ntree, bNode *node, bNodeSocket *sock, int type, int subtype);
struct bNode *nodeAddNode(const struct bContext *C, struct bNodeTree *ntree, const char *idname);
struct bNode *nodeAddStaticNode(const struct bContext *C, struct bNodeTree *ntree, int type);
bNode *nodeAddNode(const bContext *C, bNodeTree *ntree, const char *idname);
bNode *nodeAddStaticNode(const bContext *C, bNodeTree *ntree, int type);
/**
* Find the first available, non-duplicate name for a given node.
*/
void nodeUniqueName(struct bNodeTree *ntree, struct bNode *node);
void nodeUniqueName(bNodeTree *ntree, bNode *node);
/**
* Create a new unique integer identifier for the node. Also set the node's
* index in the tree, which is an eagerly maintained cache.
*/
void nodeUniqueID(struct bNodeTree *ntree, struct bNode *node);
void nodeUniqueID(bNodeTree *ntree, bNode *node);
/**
* Delete node, associated animation data and ID user count.
*/
void nodeRemoveNode(struct Main *bmain,
struct bNodeTree *ntree,
struct bNode *node,
bool do_id_user);
void nodeRemoveNode(Main *bmain, bNodeTree *ntree, bNode *node, bool do_id_user);
void nodeDimensionsGet(const struct bNode *node, float *r_width, float *r_height);
void nodeTagUpdateID(struct bNode *node);
void nodeInternalLinks(struct bNode *node, struct bNodeLink **r_links, int *r_len);
void nodeDimensionsGet(const bNode *node, float *r_width, float *r_height);
void nodeTagUpdateID(bNode *node);
void nodeInternalLinks(bNode *node, bNodeLink **r_links, int *r_len);
/**
* Also used via RNA API, so we check for proper input output direction.
*/
struct bNodeLink *nodeAddLink(struct bNodeTree *ntree,
struct bNode *fromnode,
struct bNodeSocket *fromsock,
struct bNode *tonode,
struct bNodeSocket *tosock);
void nodeRemLink(struct bNodeTree *ntree, struct bNodeLink *link);
void nodeRemSocketLinks(struct bNodeTree *ntree, struct bNodeSocket *sock);
bNodeLink *nodeAddLink(
bNodeTree *ntree, bNode *fromnode, bNodeSocket *fromsock, bNode *tonode, bNodeSocket *tosock);
void nodeRemLink(bNodeTree *ntree, bNodeLink *link);
void nodeRemSocketLinks(bNodeTree *ntree, bNodeSocket *sock);
bool nodeLinkIsHidden(const struct bNodeLink *link);
bool nodeLinkIsHidden(const bNodeLink *link);
void nodeAttachNode(struct bNodeTree *ntree, struct bNode *node, struct bNode *parent);
void nodeDetachNode(struct bNodeTree *ntree, struct bNode *node);
void nodeAttachNode(bNodeTree *ntree, bNode *node, bNode *parent);
void nodeDetachNode(bNodeTree *ntree, bNode *node);
/**
* Same as above but expects that the socket definitely is in the node tree.
*/
void nodeFindNode(struct bNodeTree *ntree,
struct bNodeSocket *sock,
struct bNode **r_node,
int *r_sockindex);
void nodeFindNode(bNodeTree *ntree, bNodeSocket *sock, bNode **r_node, int *r_sockindex);
/**
* Finds a node based on its name.
*/
struct bNode *nodeFindNodebyName(struct bNodeTree *ntree, const char *name);
bNode *nodeFindNodebyName(bNodeTree *ntree, const char *name);
/**
* Finds a node based on given socket and returns true on success.
*/
bool nodeFindNodeTry(struct bNodeTree *ntree,
struct bNodeSocket *sock,
struct bNode **r_node,
int *r_sockindex);
bool nodeFindNodeTry(bNodeTree *ntree, bNodeSocket *sock, bNode **r_node, int *r_sockindex);
bool nodeIsParentAndChild(const bNode *parent, const bNode *child);
int nodeCountSocketLinks(const struct bNodeTree *ntree, const struct bNodeSocket *sock);
int nodeCountSocketLinks(const bNodeTree *ntree, const bNodeSocket *sock);
void nodeSetSelected(struct bNode *node, bool select);
void nodeSetSelected(bNode *node, bool select);
/**
* Two active flags, ID nodes have special flag for buttons display.
*/
void nodeSetActive(struct bNodeTree *ntree, struct bNode *node);
struct bNode *nodeGetActive(struct bNodeTree *ntree);
void nodeClearActive(struct bNodeTree *ntree);
void nodeSetActive(bNodeTree *ntree, bNode *node);
bNode *nodeGetActive(bNodeTree *ntree);
void nodeClearActive(bNodeTree *ntree);
/**
* Two active flags, ID nodes have special flag for buttons display.
*/
struct bNode *nodeGetActiveTexture(struct bNodeTree *ntree);
bNode *nodeGetActiveTexture(bNodeTree *ntree);
int nodeSocketLinkLimit(const struct bNodeSocket *sock);
int nodeSocketLinkLimit(const bNodeSocket *sock);
/**
* Node Instance Hash.
*/
typedef struct bNodeInstanceHash {
struct bNodeInstanceHash {
/** XXX should be made a direct member, #GHash allocation needs to support it */
GHash *ghash;
} bNodeInstanceHash;
};
typedef void (*bNodeInstanceValueFP)(void *value);
using bNodeInstanceValueFP = void (*)(void *value);
/**
* Magic number for initial hash key.
@@ -698,8 +656,8 @@ extern const bNodeInstanceKey NODE_INSTANCE_KEY_BASE;
extern const bNodeInstanceKey NODE_INSTANCE_KEY_NONE;
bNodeInstanceKey BKE_node_instance_key(bNodeInstanceKey parent_key,
const struct bNodeTree *ntree,
const struct bNode *node);
const bNodeTree *ntree,
const bNode *node);
bNodeInstanceHash *BKE_node_instance_hash_new(const char *info);
void BKE_node_instance_hash_free(bNodeInstanceHash *hash, bNodeInstanceValueFP valfreefp);
@@ -725,26 +683,23 @@ void BKE_node_instance_hash_remove_untagged(bNodeInstanceHash *hash,
/** \name Node Type Access
* \{ */
bool nodeGroupPoll(const struct bNodeTree *nodetree,
const struct bNodeTree *grouptree,
bool nodeGroupPoll(const bNodeTree *nodetree,
const bNodeTree *grouptree,
const char **r_disabled_hint);
void node_type_base_custom(struct bNodeType *ntype,
const char *idname,
const char *name,
const char *enum_name,
short nclass);
void node_type_base_custom(
bNodeType *ntype, const char *idname, const char *name, const char *enum_name, short nclass);
/**
* \warning Nodes defining a storage type _must_ allocate this for new nodes.
* Otherwise nodes will reload as undefined (#46619).
*/
void node_type_storage(struct bNodeType *ntype,
void node_type_storage(bNodeType *ntype,
const char *storagename,
void (*freefunc)(struct bNode *node),
void (*copyfunc)(struct bNodeTree *dest_ntree,
struct bNode *dest_node,
const struct bNode *src_node));
void (*freefunc)(bNode *node),
void (*copyfunc)(bNodeTree *dest_ntree,
bNode *dest_node,
const bNode *src_node));
/** \} */
@@ -805,21 +760,19 @@ void node_type_storage(struct bNodeType *ntype,
struct NodeTreeIterStore {
bNodeTree *ngroup;
Scene *scene;
struct Material *mat;
Material *mat;
Tex *tex;
struct Light *light;
struct World *world;
struct FreestyleLineStyle *linestyle;
Light *light;
World *world;
FreestyleLineStyle *linestyle;
};
void BKE_node_tree_iter_init(struct NodeTreeIterStore *ntreeiter, struct Main *bmain);
bool BKE_node_tree_iter_step(struct NodeTreeIterStore *ntreeiter,
struct bNodeTree **r_nodetree,
struct ID **r_id);
void BKE_node_tree_iter_init(NodeTreeIterStore *ntreeiter, Main *bmain);
bool BKE_node_tree_iter_step(NodeTreeIterStore *ntreeiter, bNodeTree **r_nodetree, ID **r_id);
#define FOREACH_NODETREE_BEGIN(bmain, _nodetree, _id) \
{ \
struct NodeTreeIterStore _nstore; \
NodeTreeIterStore _nstore; \
bNodeTree *_nodetree; \
ID *_id; \
/* avoid compiler warning about unused variables */ \
@@ -839,7 +792,7 @@ bool BKE_node_tree_iter_step(struct NodeTreeIterStore *ntreeiter,
/** \name Node Tree
*/
void BKE_nodetree_remove_layer_n(struct bNodeTree *ntree, struct Scene *scene, int layer_index);
void BKE_nodetree_remove_layer_n(bNodeTree *ntree, Scene *scene, int layer_index);
/* -------------------------------------------------------------------- */
/** \name Shader Nodes

View File

@@ -1702,6 +1702,12 @@ void OBJECT_OT_shade_smooth_by_angle(wmOperatorType *ot)
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
RNA_def_boolean(ot->srna,
"use_modifier",
true,
"Modifier",
"Add a modifier instead of applying the operation directly to the mesh");
PropertyRNA *prop = RNA_def_property(ot->srna, "angle", PROP_FLOAT, PROP_ANGLE);
RNA_def_property_range(prop, 0.0f, DEG2RADF(180.0f));
RNA_def_property_float_default(prop, DEG2RADF(30.0f));

View File

@@ -8,5 +8,7 @@
#pragma once
struct GPUMatrixState *GPU_matrix_state_create();
void GPU_matrix_state_discard(struct GPUMatrixState *state);
struct GPUMatrixState;
GPUMatrixState *GPU_matrix_state_create();
void GPU_matrix_state_discard(GPUMatrixState *state);