Merge branch 'master' into sculpt-dev

This commit is contained in:
Pablo Dobarro 2021-06-30 18:12:50 +02:00
commit e8e062f866
115 changed files with 2007 additions and 758 deletions

View File

@ -60,7 +60,7 @@
#include "GPU_init_exit.h"
extern int datatoc_bfont_ttf_size;
extern char datatoc_bfont_ttf[];
extern char const datatoc_bfont_ttf[];
typedef struct _LoggerWindow LoggerWindow;
typedef struct _MultiTestApp MultiTestApp;

View File

@ -509,6 +509,12 @@ geometry_node_categories = [
NodeItem("GeometryNodeCurveLength"),
NodeItem("GeometryNodeCurveReverse"),
]),
GeometryNodeCategory("GEO_PRIMITIVES_CURVE", "Curve Primitives", items=[
NodeItem("GeometryNodeCurveStar"),
NodeItem("GeometryNodeCurveSpiral"),
NodeItem("GeometryNodeCurveQuadraticBezier"),
NodeItem("GeometryNodeCurvePrimitiveBezierSegment"),
]),
GeometryNodeCategory("GEO_GEOMETRY", "Geometry", items=[
NodeItem("GeometryNodeBoundBox"),
NodeItem("GeometryNodeConvexHull"),
@ -540,7 +546,7 @@ geometry_node_categories = [
NodeItem("GeometryNodeSubdivisionSurface"),
NodeItem("GeometryNodeSubdivide"),
]),
GeometryNodeCategory("GEO_PRIMITIVES", "Mesh Primitives", items=[
GeometryNodeCategory("GEO_PRIMITIVES_MESH", "Mesh Primitives", items=[
NodeItem("GeometryNodeMeshCircle"),
NodeItem("GeometryNodeMeshCone"),
NodeItem("GeometryNodeMeshCube"),

View File

@ -151,7 +151,7 @@ typedef struct PoseTree {
struct bArmature *BKE_armature_add(struct Main *bmain, const char *name);
struct bArmature *BKE_armature_from_object(struct Object *ob);
int BKE_armature_bonelist_count(struct ListBase *lb);
int BKE_armature_bonelist_count(const struct ListBase *lb);
void BKE_armature_bonelist_free(struct ListBase *lb, const bool do_id_user);
void BKE_armature_editbonelist_free(struct ListBase *lb, const bool do_id_user);

View File

@ -164,7 +164,8 @@ bool BKE_collection_move(struct Main *bmain,
bool BKE_collection_cycle_find(struct Collection *new_ancestor, struct Collection *collection);
bool BKE_collection_cycles_fix(struct Main *bmain, struct Collection *collection);
bool BKE_collection_has_collection(struct Collection *parent, struct Collection *collection);
bool BKE_collection_has_collection(const struct Collection *parent,
const struct Collection *collection);
void BKE_collection_parent_relations_rebuild(struct Collection *collection);
void BKE_main_collections_parent_relations_rebuild(struct Main *bmain);

View File

@ -227,9 +227,9 @@ struct FCurve *BKE_fcurve_find_by_rna_context_ui(struct bContext *C,
/* Binary search algorithm for finding where to 'insert' BezTriple with given frame number.
* Returns the index to insert at (data already at that index will be offset if replace is 0)
*/
int BKE_fcurve_bezt_binarysearch_index(struct BezTriple array[],
float frame,
int arraylen,
int BKE_fcurve_bezt_binarysearch_index(const struct BezTriple array[],
const float frame,
const int arraylen,
bool *r_replace);
/* fcurve_cache.c */

View File

@ -66,8 +66,8 @@ typedef struct EditFont {
} EditFont;
bool BKE_vfont_is_builtin(struct VFont *vfont);
void BKE_vfont_builtin_register(void *mem, int size);
bool BKE_vfont_is_builtin(const struct VFont *vfont);
void BKE_vfont_builtin_register(const void *mem, int size);
void BKE_vfont_free_data(struct VFont *vfont);
struct VFont *BKE_vfont_builtin_get(void);

View File

@ -90,7 +90,7 @@ typedef struct GPencilPointCoordinates {
float pressure;
} GPencilPointCoordinates;
int BKE_gpencil_stroke_point_count(struct bGPdata *gpd);
int BKE_gpencil_stroke_point_count(const struct bGPdata *gpd);
void BKE_gpencil_point_coords_get(struct bGPdata *gpd, GPencilPointCoordinates *elem_data);
void BKE_gpencil_point_coords_apply(struct bGPdata *gpd, const GPencilPointCoordinates *elem_data);
void BKE_gpencil_point_coords_apply_with_mat4(struct bGPdata *gpd,

View File

@ -76,7 +76,7 @@ void BKE_keyblock_update_from_lattice(struct Lattice *lt, struct KeyBlock *kb);
void BKE_keyblock_convert_from_lattice(struct Lattice *lt, struct KeyBlock *kb);
void BKE_keyblock_convert_to_lattice(struct KeyBlock *kb, struct Lattice *lt);
int BKE_keyblock_curve_element_count(struct ListBase *nurb);
int BKE_keyblock_curve_element_count(const struct ListBase *nurb);
void BKE_keyblock_curve_data_transform(const struct ListBase *nurb,
const float mat[4][4],
const void *src,

View File

@ -92,7 +92,7 @@ bool BKE_layer_collection_activate(struct ViewLayer *view_layer, struct LayerCol
struct LayerCollection *BKE_layer_collection_activate_parent(struct ViewLayer *view_layer,
struct LayerCollection *lc);
int BKE_layer_collection_count(struct ViewLayer *view_layer);
int BKE_layer_collection_count(const struct ViewLayer *view_layer);
struct LayerCollection *BKE_layer_collection_from_index(struct ViewLayer *view_layer,
const int index);
@ -107,8 +107,8 @@ void BKE_layer_collection_local_sync_all(const struct Main *bmain);
void BKE_main_collection_sync_remap(const struct Main *bmain);
struct LayerCollection *BKE_layer_collection_first_from_scene_collection(
struct ViewLayer *view_layer, const struct Collection *collection);
bool BKE_view_layer_has_collection(struct ViewLayer *view_layer,
const struct ViewLayer *view_layer, const struct Collection *collection);
bool BKE_view_layer_has_collection(const struct ViewLayer *view_layer,
const struct Collection *collection);
bool BKE_scene_has_object(struct Scene *scene, struct Object *ob);
@ -367,7 +367,7 @@ void BKE_view_layer_visible_bases_iterator_end(BLI_Iterator *iter);
struct ObjectsInViewLayerParams {
uint no_dup_data : 1;
bool (*filter_fn)(struct Object *ob, void *user_data);
bool (*filter_fn)(const struct Object *ob, void *user_data);
void *filter_userdata;
};
@ -388,7 +388,7 @@ struct ObjectsInModeParams {
int object_mode;
uint no_dup_data : 1;
bool (*filter_fn)(struct Object *ob, void *user_data);
bool (*filter_fn)(const struct Object *ob, void *user_data);
void *filter_userdata;
};
@ -412,8 +412,8 @@ struct Object **BKE_view_layer_array_from_objects_in_mode_params(
BKE_view_layer_array_from_bases_in_mode_params( \
view_layer, v3d, r_len, &(const struct ObjectsInModeParams)__VA_ARGS__)
bool BKE_view_layer_filter_edit_mesh_has_uvs(struct Object *ob, void *user_data);
bool BKE_view_layer_filter_edit_mesh_has_edges(struct Object *ob, void *user_data);
bool BKE_view_layer_filter_edit_mesh_has_uvs(const struct Object *ob, void *user_data);
bool BKE_view_layer_filter_edit_mesh_has_edges(const struct Object *ob, void *user_data);
/* Utility macros that wrap common args (add more as needed). */

View File

@ -1439,6 +1439,10 @@ int ntreeTexExecTree(struct bNodeTree *ntree,
#define GEO_NODE_SEPARATE_COMPONENTS 1059
#define GEO_NODE_CURVE_SUBDIVIDE 1060
#define GEO_NODE_RAYCAST 1061
#define GEO_NODE_CURVE_PRIMITIVE_STAR 1062
#define GEO_NODE_CURVE_PRIMITIVE_SPIRAL 1063
#define GEO_NODE_CURVE_PRIMITIVE_QUADRATIC_BEZIER 1064
#define GEO_NODE_CURVE_PRIMITIVE_BEZIER_SEGMENT 1065
/** \} */

View File

@ -476,7 +476,7 @@ bool BKE_pbvh_node_vert_update_check_any(PBVH *pbvh, PBVHNode *node);
// void BKE_pbvh_node_BB_reset(PBVHNode *node);
// void BKE_pbvh_node_BB_expand(PBVHNode *node, float co[3]);
bool pbvh_has_mask(PBVH *pbvh);
bool pbvh_has_mask(const PBVH *pbvh);
void pbvh_show_mask_set(PBVH *pbvh, bool show_mask);
bool pbvh_has_face_sets(PBVH *pbvh);

View File

@ -172,7 +172,7 @@ void BKE_shaderfx_copydata_ex(struct ShaderFxData *fx,
void BKE_shaderfx_copy(struct ListBase *dst, const struct ListBase *src);
void BKE_shaderfx_foreach_ID_link(struct Object *ob, ShaderFxIDWalkFunc walk, void *userData);
bool BKE_shaderfx_has_gpencil(struct Object *ob);
bool BKE_shaderfx_has_gpencil(const struct Object *ob);
void BKE_shaderfx_blend_write(struct BlendWriter *writer, struct ListBase *fxbase);
void BKE_shaderfx_blend_read_data(struct BlendDataReader *reader, struct ListBase *lb);

View File

@ -48,7 +48,7 @@ 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);
int txt_find_string(struct Text *text, const char *findstr, int wrap, int match_case);
bool txt_has_sel(struct Text *text);
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);
@ -85,8 +85,8 @@ bool txt_uncomment(struct Text *text);
void txt_move_lines(struct Text *text, const 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(struct Text *text);
bool txt_cursor_is_line_end(struct Text *text);
bool txt_cursor_is_line_start(const struct Text *text);
bool txt_cursor_is_line_end(const struct Text *text);
int txt_calc_tab_left(struct TextLine *tl, int ch);
int txt_calc_tab_right(struct TextLine *tl, int ch);

View File

@ -178,7 +178,7 @@ UndoStack *BKE_undosys_stack_create(void);
void BKE_undosys_stack_destroy(UndoStack *ustack);
void BKE_undosys_stack_clear(UndoStack *ustack);
void BKE_undosys_stack_clear_active(UndoStack *ustack);
bool BKE_undosys_stack_has_undo(UndoStack *ustack, const char *name);
bool BKE_undosys_stack_has_undo(const UndoStack *ustack, const char *name);
void BKE_undosys_stack_init_from_main(UndoStack *ustack, struct Main *bmain);
void BKE_undosys_stack_init_from_context(UndoStack *ustack, struct bContext *C);
UndoStep *BKE_undosys_stack_active_with_type(UndoStack *ustack, const UndoType *ut);

View File

@ -358,7 +358,7 @@ bArmature *BKE_armature_from_object(Object *ob)
return NULL;
}
int BKE_armature_bonelist_count(ListBase *lb)
int BKE_armature_bonelist_count(const ListBase *lb)
{
int i = 0;
LISTBASE_FOREACH (Bone *, bone, lb) {

View File

@ -79,7 +79,8 @@ static bool collection_object_remove(Main *bmain,
static CollectionChild *collection_find_child(Collection *parent, Collection *collection);
static CollectionParent *collection_find_parent(Collection *child, Collection *collection);
static bool collection_find_child_recursive(Collection *parent, Collection *collection);
static bool collection_find_child_recursive(const Collection *parent,
const Collection *collection);
/** \} */
@ -1521,9 +1522,9 @@ static CollectionChild *collection_find_child(Collection *parent, Collection *co
return BLI_findptr(&parent->children, collection, offsetof(CollectionChild, collection));
}
static bool collection_find_child_recursive(Collection *parent, Collection *collection)
static bool collection_find_child_recursive(const Collection *parent, const Collection *collection)
{
LISTBASE_FOREACH (CollectionChild *, child, &parent->children) {
LISTBASE_FOREACH (const CollectionChild *, child, &parent->children) {
if (child->collection == collection) {
return true;
}
@ -1536,7 +1537,7 @@ static bool collection_find_child_recursive(Collection *parent, Collection *coll
return false;
}
bool BKE_collection_has_collection(Collection *parent, Collection *collection)
bool BKE_collection_has_collection(const Collection *parent, const Collection *collection)
{
return collection_find_child_recursive(parent, collection);
}

View File

@ -1476,7 +1476,10 @@ static void followpath_get_tarmat(struct Depsgraph *UNUSED(depsgraph),
* to get a time factor. */
curvetime /= cu->pathlen;
if (cu->flag & CU_PATH_CLAMP) {
Nurb *nu = cu->nurb.first;
if (!(nu && nu->flagu & CU_NURB_CYCLIC) && cu->flag & CU_PATH_CLAMP) {
/* If curve is not cyclic, clamp to the begin/end points if the curve clamp option is on.
*/
CLAMP(curvetime, 0.0f, 1.0f);
}
}

View File

@ -510,8 +510,11 @@ FCurve *BKE_fcurve_find_by_rna_context_ui(bContext *C,
* with optional argument for precision required.
* Returns the index to insert at (data already at that index will be offset if replace is 0)
*/
static int BKE_fcurve_bezt_binarysearch_index_ex(
BezTriple array[], float frame, int arraylen, float threshold, bool *r_replace)
static int BKE_fcurve_bezt_binarysearch_index_ex(const BezTriple array[],
const float frame,
const int arraylen,
const float threshold,
bool *r_replace)
{
int start = 0, end = arraylen;
int loopbreaker = 0, maxloop = arraylen * 2;
@ -597,9 +600,9 @@ static int BKE_fcurve_bezt_binarysearch_index_ex(
/* Binary search algorithm for finding where to insert BezTriple. (for use by insert_bezt_fcurve)
* Returns the index to insert at (data already at that index will be offset if replace is 0)
*/
int BKE_fcurve_bezt_binarysearch_index(BezTriple array[],
float frame,
int arraylen,
int BKE_fcurve_bezt_binarysearch_index(const BezTriple array[],
const float frame,
const int arraylen,
bool *r_replace)
{
/* This is just a wrapper which uses the default threshold. */

View File

@ -216,15 +216,15 @@ void BKE_vfont_free_data(struct VFont *vfont)
}
}
static void *builtin_font_data = NULL;
static const void *builtin_font_data = NULL;
static int builtin_font_size = 0;
bool BKE_vfont_is_builtin(struct VFont *vfont)
bool BKE_vfont_is_builtin(const struct VFont *vfont)
{
return STREQ(vfont->filepath, FO_BUILTIN_NAME);
}
void BKE_vfont_builtin_register(void *mem, int size)
void BKE_vfont_builtin_register(const void *mem, int size)
{
builtin_font_data = mem;
builtin_font_size = size;

View File

@ -2616,7 +2616,7 @@ void BKE_gpencil_transform(bGPdata *gpd, const float mat[4][4])
}
/* Used for "move only origins" in object_data_transform.c */
int BKE_gpencil_stroke_point_count(bGPdata *gpd)
int BKE_gpencil_stroke_point_count(const bGPdata *gpd)
{
int total_points = 0;
@ -2624,7 +2624,7 @@ int BKE_gpencil_stroke_point_count(bGPdata *gpd)
return 0;
}
LISTBASE_FOREACH (bGPDlayer *, gpl, &gpd->layers) {
LISTBASE_FOREACH (const bGPDlayer *, gpl, &gpd->layers) {
/* FIXME: For now, we just skip parented layers.
* Otherwise, we have to update each frame to find
* the current parent position/effects.
@ -2633,7 +2633,7 @@ int BKE_gpencil_stroke_point_count(bGPdata *gpd)
continue;
}
LISTBASE_FOREACH (bGPDframe *, gpf, &gpl->frames) {
LISTBASE_FOREACH (const bGPDframe *, gpf, &gpl->frames) {
LISTBASE_FOREACH (bGPDstroke *, gps, &gpf->strokes) {
total_points += gps->totpoints;
}

View File

@ -2048,9 +2048,9 @@ void BKE_keyblock_convert_to_lattice(KeyBlock *kb, Lattice *lt)
/************************* Curve ************************/
int BKE_keyblock_curve_element_count(ListBase *nurb)
int BKE_keyblock_curve_element_count(const ListBase *nurb)
{
Nurb *nu;
const Nurb *nu;
int tot = 0;
nu = nurb->first;

View File

@ -676,10 +676,10 @@ LayerCollection *BKE_layer_collection_activate_parent(ViewLayer *view_layer, Lay
/**
* Recursively get the count of collections
*/
static int collection_count(ListBase *lb)
static int collection_count(const ListBase *lb)
{
int i = 0;
LISTBASE_FOREACH (LayerCollection *, lc, lb) {
LISTBASE_FOREACH (const LayerCollection *, lc, lb) {
i += collection_count(&lc->layer_collections) + 1;
}
return i;
@ -689,7 +689,7 @@ static int collection_count(ListBase *lb)
* Get the total number of collections
* (including all the nested collections)
*/
int BKE_layer_collection_count(ViewLayer *view_layer)
int BKE_layer_collection_count(const ViewLayer *view_layer)
{
return collection_count(&view_layer->layer_collections);
}
@ -1504,7 +1504,7 @@ static LayerCollection *find_layer_collection_by_scene_collection(LayerCollectio
/**
* Return the first matching LayerCollection in the ViewLayer for the Collection.
*/
LayerCollection *BKE_layer_collection_first_from_scene_collection(ViewLayer *view_layer,
LayerCollection *BKE_layer_collection_first_from_scene_collection(const ViewLayer *view_layer,
const Collection *collection)
{
LISTBASE_FOREACH (LayerCollection *, layer_collection, &view_layer->layer_collections) {
@ -1520,7 +1520,7 @@ LayerCollection *BKE_layer_collection_first_from_scene_collection(ViewLayer *vie
/**
* See if view layer has the scene collection linked directly, or indirectly (nested)
*/
bool BKE_view_layer_has_collection(ViewLayer *view_layer, const Collection *collection)
bool BKE_view_layer_has_collection(const ViewLayer *view_layer, const Collection *collection)
{
return BKE_layer_collection_first_from_scene_collection(view_layer, collection) != NULL;
}

View File

@ -164,11 +164,11 @@ Object **BKE_view_layer_array_from_objects_in_mode_params(ViewLayer *view_layer,
/** \name Filter Functions
* \{ */
bool BKE_view_layer_filter_edit_mesh_has_uvs(Object *ob, void *UNUSED(user_data))
bool BKE_view_layer_filter_edit_mesh_has_uvs(const Object *ob, void *UNUSED(user_data))
{
if (ob->type == OB_MESH) {
Mesh *me = ob->data;
BMEditMesh *em = me->edit_mesh;
const Mesh *me = ob->data;
const BMEditMesh *em = me->edit_mesh;
if (em != NULL) {
if (CustomData_get_offset(&em->bm->ldata, CD_MLOOPUV) != -1) {
return true;
@ -178,11 +178,11 @@ bool BKE_view_layer_filter_edit_mesh_has_uvs(Object *ob, void *UNUSED(user_data)
return false;
}
bool BKE_view_layer_filter_edit_mesh_has_edges(Object *ob, void *UNUSED(user_data))
bool BKE_view_layer_filter_edit_mesh_has_edges(const Object *ob, void *UNUSED(user_data))
{
if (ob->type == OB_MESH) {
Mesh *me = ob->data;
BMEditMesh *em = me->edit_mesh;
const Mesh *me = ob->data;
const BMEditMesh *em = me->edit_mesh;
if (em != NULL) {
if (em->bm->totedge != 0) {
return true;

View File

@ -5054,6 +5054,10 @@ static void registerGeometryNodes()
register_node_type_geo_collection_info();
register_node_type_geo_convex_hull();
register_node_type_geo_curve_length();
register_node_type_geo_curve_primitive_bezier_segment();
register_node_type_geo_curve_primitive_quadratic_bezier();
register_node_type_geo_curve_primitive_spiral();
register_node_type_geo_curve_primitive_star();
register_node_type_geo_curve_to_mesh();
register_node_type_geo_curve_to_points();
register_node_type_geo_curve_resample();

View File

@ -3059,7 +3059,7 @@ void pbvh_vertex_iter_init(PBVH *pbvh, PBVHNode *node, PBVHVertexIter *vi, int m
}
}
bool pbvh_has_mask(PBVH *pbvh)
bool pbvh_has_mask(const PBVH *pbvh)
{
switch (pbvh->type) {
case PBVH_GRIDS:

View File

@ -58,9 +58,9 @@ static ShaderFxTypeInfo *shader_fx_types[NUM_SHADER_FX_TYPES] = {NULL};
/* Methods - Evaluation Loops, etc. */
/* check if exist grease pencil effects */
bool BKE_shaderfx_has_gpencil(Object *ob)
bool BKE_shaderfx_has_gpencil(const Object *ob)
{
ShaderFxData *fx;
const ShaderFxData *fx;
for (fx = ob->shader_fx.first; fx; fx = fx->next) {
const ShaderFxTypeInfo *fxi = BKE_shaderfx_get_info(fx->type);
if (fxi->type == eShaderFxType_GpencilType) {

View File

@ -3205,7 +3205,7 @@ void sbObjectToSoftbody(Object *ob)
free_softbody_intern(ob->soft);
}
static bool object_has_edges(Object *ob)
static bool object_has_edges(const Object *ob)
{
if (ob->type == OB_MESH) {
return ((Mesh *)ob->data)->totedge;

View File

@ -781,12 +781,12 @@ static void txt_curs_sel(Text *text, TextLine ***linep, int **charp)
*charp = &text->selc;
}
bool txt_cursor_is_line_start(Text *text)
bool txt_cursor_is_line_start(const Text *text)
{
return (text->selc == 0);
}
bool txt_cursor_is_line_end(Text *text)
bool txt_cursor_is_line_end(const Text *text)
{
return (text->selc == text->sell->len);
}
@ -1239,7 +1239,7 @@ void txt_order_cursors(Text *text, const bool reverse)
}
}
bool txt_has_sel(Text *text)
bool txt_has_sel(const Text *text)
{
return ((text->curl != text->sell) || (text->curc != text->selc));
}

View File

@ -368,10 +368,10 @@ void BKE_undosys_stack_init_from_context(UndoStack *ustack, bContext *C)
}
/* name optional */
bool BKE_undosys_stack_has_undo(UndoStack *ustack, const char *name)
bool BKE_undosys_stack_has_undo(const UndoStack *ustack, const char *name)
{
if (name) {
UndoStep *us = BLI_rfindstring(&ustack->steps, name, offsetof(UndoStep, name));
const UndoStep *us = BLI_rfindstring(&ustack->steps, name, offsetof(UndoStep, name));
return us && us->prev;
}

View File

@ -53,9 +53,9 @@ void BLI_dynstr_appendf(DynStr *__restrict ds, const char *__restrict format, ..
void BLI_dynstr_vappendf(DynStr *__restrict ds, const char *__restrict format, va_list args)
ATTR_PRINTF_FORMAT(2, 0) ATTR_NONNULL(1, 2);
int BLI_dynstr_get_len(DynStr *ds) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL();
char *BLI_dynstr_get_cstring(DynStr *ds) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT ATTR_NONNULL();
void BLI_dynstr_get_cstring_ex(DynStr *__restrict ds, char *__restrict rets) ATTR_NONNULL();
int BLI_dynstr_get_len(const DynStr *ds) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL();
char *BLI_dynstr_get_cstring(const DynStr *ds) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT ATTR_NONNULL();
void BLI_dynstr_get_cstring_ex(const DynStr *__restrict ds, char *__restrict rets) ATTR_NONNULL();
void BLI_dynstr_clear(DynStr *ds) ATTR_NONNULL();
void BLI_dynstr_free(DynStr *ds) ATTR_NONNULL();

View File

@ -57,8 +57,10 @@ void BLI_edgehash_free(EdgeHash *eh, EdgeHashFreeFP free_value);
void BLI_edgehash_print(EdgeHash *eh);
void BLI_edgehash_insert(EdgeHash *eh, unsigned int v0, unsigned int v1, void *val);
bool BLI_edgehash_reinsert(EdgeHash *eh, unsigned int v0, unsigned int v1, void *val);
void *BLI_edgehash_lookup(EdgeHash *eh, unsigned int v0, unsigned int v1) ATTR_WARN_UNUSED_RESULT;
void *BLI_edgehash_lookup_default(EdgeHash *eh,
void *BLI_edgehash_lookup(const EdgeHash *eh,
unsigned int v0,
unsigned int v1) ATTR_WARN_UNUSED_RESULT;
void *BLI_edgehash_lookup_default(const EdgeHash *eh,
unsigned int v0,
unsigned int v1,
void *default_value) ATTR_WARN_UNUSED_RESULT;
@ -73,8 +75,10 @@ bool BLI_edgehash_remove(EdgeHash *eh,
EdgeHashFreeFP free_value);
void *BLI_edgehash_popkey(EdgeHash *eh, unsigned int v0, unsigned int v1) ATTR_WARN_UNUSED_RESULT;
bool BLI_edgehash_haskey(EdgeHash *eh, unsigned int v0, unsigned int v1) ATTR_WARN_UNUSED_RESULT;
int BLI_edgehash_len(EdgeHash *eh) ATTR_WARN_UNUSED_RESULT;
bool BLI_edgehash_haskey(const EdgeHash *eh,
unsigned int v0,
unsigned int v1) ATTR_WARN_UNUSED_RESULT;
int BLI_edgehash_len(const EdgeHash *eh) ATTR_WARN_UNUSED_RESULT;
void BLI_edgehash_clear_ex(EdgeHash *eh, EdgeHashFreeFP free_value, const uint reserve);
void BLI_edgehash_clear(EdgeHash *eh, EdgeHashFreeFP free_value);
@ -86,7 +90,7 @@ BLI_INLINE void BLI_edgehashIterator_step(EdgeHashIterator *ehi)
{
ehi->index++;
}
BLI_INLINE bool BLI_edgehashIterator_isDone(EdgeHashIterator *ehi)
BLI_INLINE bool BLI_edgehashIterator_isDone(const EdgeHashIterator *ehi)
{
return ehi->index >= ehi->length;
}
@ -128,10 +132,12 @@ typedef struct EdgeSetIterator {
EdgeSet *BLI_edgeset_new_ex(const char *info, const 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(EdgeSet *es) ATTR_WARN_UNUSED_RESULT;
int BLI_edgeset_len(const EdgeSet *es) ATTR_WARN_UNUSED_RESULT;
bool BLI_edgeset_add(EdgeSet *es, unsigned int v0, unsigned int v1);
void BLI_edgeset_insert(EdgeSet *es, unsigned int v0, unsigned int v1);
bool BLI_edgeset_haskey(EdgeSet *es, unsigned int v0, unsigned int v1) ATTR_WARN_UNUSED_RESULT;
bool BLI_edgeset_haskey(const EdgeSet *es,
unsigned int v0,
unsigned int v1) ATTR_WARN_UNUSED_RESULT;
void BLI_edgeset_free(EdgeSet *es);
/* rely on inline api for now */
@ -150,7 +156,7 @@ BLI_INLINE void BLI_edgesetIterator_step(EdgeSetIterator *esi)
{
esi->index++;
}
BLI_INLINE bool BLI_edgesetIterator_isDone(EdgeSetIterator *esi)
BLI_INLINE bool BLI_edgesetIterator_isDone(const EdgeSetIterator *esi)
{
return esi->index >= esi->length;
}

View File

@ -87,7 +87,7 @@ GHash *BLI_ghash_new_ex(GHashHashFP hashfp,
GHash *BLI_ghash_new(GHashHashFP hashfp,
GHashCmpFP cmpfp,
const char *info) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT;
GHash *BLI_ghash_copy(GHash *gh,
GHash *BLI_ghash_copy(const GHash *gh,
GHashKeyCopyFP keycopyfp,
GHashValCopyFP valcopyfp) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT;
void BLI_ghash_free(GHash *gh, GHashKeyFreeFP keyfreefp, GHashValFreeFP valfreefp);
@ -96,8 +96,8 @@ void BLI_ghash_insert(GHash *gh, void *key, void *val);
bool BLI_ghash_reinsert(
GHash *gh, void *key, void *val, GHashKeyFreeFP keyfreefp, GHashValFreeFP valfreefp);
void *BLI_ghash_replace_key(GHash *gh, void *key);
void *BLI_ghash_lookup(GHash *gh, const void *key) ATTR_WARN_UNUSED_RESULT;
void *BLI_ghash_lookup_default(GHash *gh,
void *BLI_ghash_lookup(const GHash *gh, const void *key) ATTR_WARN_UNUSED_RESULT;
void *BLI_ghash_lookup_default(const GHash *gh,
const void *key,
void *val_default) ATTR_WARN_UNUSED_RESULT;
void **BLI_ghash_lookup_p(GHash *gh, const void *key) ATTR_WARN_UNUSED_RESULT;
@ -116,10 +116,10 @@ void BLI_ghash_clear_ex(GHash *gh,
void *BLI_ghash_popkey(GHash *gh,
const void *key,
GHashKeyFreeFP keyfreefp) ATTR_WARN_UNUSED_RESULT;
bool BLI_ghash_haskey(GHash *gh, const void *key) ATTR_WARN_UNUSED_RESULT;
bool BLI_ghash_haskey(const GHash *gh, const void *key) ATTR_WARN_UNUSED_RESULT;
bool BLI_ghash_pop(GHash *gh, GHashIterState *state, void **r_key, void **r_val)
ATTR_WARN_UNUSED_RESULT ATTR_NONNULL();
unsigned int BLI_ghash_len(GHash *gh) ATTR_WARN_UNUSED_RESULT;
unsigned int BLI_ghash_len(const GHash *gh) ATTR_WARN_UNUSED_RESULT;
void BLI_ghash_flag_set(GHash *gh, unsigned int flag);
void BLI_ghash_flag_clear(GHash *gh, unsigned int flag);
@ -138,7 +138,7 @@ void BLI_ghashIterator_step(GHashIterator *ghi);
BLI_INLINE void *BLI_ghashIterator_getKey(GHashIterator *ghi) ATTR_WARN_UNUSED_RESULT;
BLI_INLINE void *BLI_ghashIterator_getValue(GHashIterator *ghi) ATTR_WARN_UNUSED_RESULT;
BLI_INLINE void **BLI_ghashIterator_getValue_p(GHashIterator *ghi) ATTR_WARN_UNUSED_RESULT;
BLI_INLINE bool BLI_ghashIterator_done(GHashIterator *ghi) ATTR_WARN_UNUSED_RESULT;
BLI_INLINE bool BLI_ghashIterator_done(const GHashIterator *ghi) ATTR_WARN_UNUSED_RESULT;
struct _gh_Entry {
void *next, *key, *val;
@ -155,7 +155,7 @@ BLI_INLINE void **BLI_ghashIterator_getValue_p(GHashIterator *ghi)
{
return &((struct _gh_Entry *)ghi->curEntry)->val;
}
BLI_INLINE bool BLI_ghashIterator_done(GHashIterator *ghi)
BLI_INLINE bool BLI_ghashIterator_done(const GHashIterator *ghi)
{
return !ghi->curEntry;
}
@ -202,8 +202,8 @@ GSet *BLI_gset_new_ex(GSetHashFP hashfp,
GSet *BLI_gset_new(GSetHashFP hashfp,
GSetCmpFP cmpfp,
const char *info) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT;
GSet *BLI_gset_copy(GSet *gs, GSetKeyCopyFP keycopyfp) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT;
unsigned int BLI_gset_len(GSet *gs) ATTR_WARN_UNUSED_RESULT;
GSet *BLI_gset_copy(const GSet *gs, GSetKeyCopyFP keycopyfp) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT;
unsigned int BLI_gset_len(const GSet *gs) ATTR_WARN_UNUSED_RESULT;
void BLI_gset_flag_set(GSet *gs, unsigned int flag);
void BLI_gset_flag_clear(GSet *gs, unsigned int flag);
void BLI_gset_free(GSet *gs, GSetKeyFreeFP keyfreefp);
@ -212,7 +212,7 @@ bool BLI_gset_add(GSet *gs, void *key);
bool BLI_gset_ensure_p_ex(GSet *gs, const void *key, void ***r_key);
bool BLI_gset_reinsert(GSet *gh, void *key, GSetKeyFreeFP keyfreefp);
void *BLI_gset_replace_key(GSet *gs, void *key);
bool BLI_gset_haskey(GSet *gs, const void *key) ATTR_WARN_UNUSED_RESULT;
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);
@ -220,7 +220,7 @@ void BLI_gset_clear_ex(GSet *gs, GSetKeyFreeFP keyfreefp, const unsigned int nen
void BLI_gset_clear(GSet *gs, GSetKeyFreeFP keyfreefp);
/* When set's are used for key & value. */
void *BLI_gset_lookup(GSet *gs, const void *key) ATTR_WARN_UNUSED_RESULT;
void *BLI_gset_lookup(const GSet *gs, const void *key) ATTR_WARN_UNUSED_RESULT;
void *BLI_gset_pop_key(GSet *gs, const void *key) ATTR_WARN_UNUSED_RESULT;
/** \} */
@ -260,9 +260,9 @@ BLI_INLINE void BLI_gsetIterator_step(GSetIterator *gsi)
{
BLI_ghashIterator_step((GHashIterator *)gsi);
}
BLI_INLINE bool BLI_gsetIterator_done(GSetIterator *gsi)
BLI_INLINE bool BLI_gsetIterator_done(const GSetIterator *gsi)
{
return BLI_ghashIterator_done((GHashIterator *)gsi);
return BLI_ghashIterator_done((const GHashIterator *)gsi);
}
#define GSET_ITER(gs_iter_, gset_) \
@ -282,8 +282,8 @@ BLI_INLINE bool BLI_gsetIterator_done(GSetIterator *gsi)
/* For testing, debugging only */
#ifdef GHASH_INTERNAL_API
int BLI_ghash_buckets_len(GHash *gh);
int BLI_gset_buckets_len(GSet *gs);
int BLI_ghash_buckets_len(const GHash *gh);
int BLI_gset_buckets_len(const GSet *gs);
double BLI_ghash_calc_quality_ex(GHash *gh,
double *r_load,

View File

@ -48,7 +48,7 @@ void BLI_mempool_free(BLI_mempool *pool, void *addr) ATTR_NONNULL(1, 2);
void BLI_mempool_clear_ex(BLI_mempool *pool, const int totelem_reserve) ATTR_NONNULL(1);
void BLI_mempool_clear(BLI_mempool *pool) ATTR_NONNULL(1);
void BLI_mempool_destroy(BLI_mempool *pool) ATTR_NONNULL(1);
int BLI_mempool_len(BLI_mempool *pool) ATTR_NONNULL(1);
int BLI_mempool_len(const BLI_mempool *pool) ATTR_NONNULL(1);
void *BLI_mempool_findelem(BLI_mempool *pool, unsigned int index) ATTR_WARN_UNUSED_RESULT
ATTR_NONNULL(1);

View File

@ -283,7 +283,7 @@ void BLI_dynstr_appendf(DynStr *__restrict ds, const char *__restrict format, ..
* \param ds: The DynStr of interest.
* \return The length of \a ds.
*/
int BLI_dynstr_get_len(DynStr *ds)
int BLI_dynstr_get_len(const DynStr *ds)
{
return ds->curlen;
}
@ -296,10 +296,10 @@ int BLI_dynstr_get_len(DynStr *ds)
* \param ds: The DynStr of interest.
* \param rets: The string to fill.
*/
void BLI_dynstr_get_cstring_ex(DynStr *__restrict ds, char *__restrict rets)
void BLI_dynstr_get_cstring_ex(const DynStr *__restrict ds, char *__restrict rets)
{
char *s;
DynStrElem *dse;
const DynStrElem *dse;
for (s = rets, dse = ds->elems; dse; dse = dse->next) {
int slen = strlen(dse->str);
@ -320,7 +320,7 @@ void BLI_dynstr_get_cstring_ex(DynStr *__restrict ds, char *__restrict rets)
* \param ds: The DynStr of interest.
* \return The contents of \a ds as a c-string.
*/
char *BLI_dynstr_get_cstring(DynStr *ds)
char *BLI_dynstr_get_cstring(const DynStr *ds)
{
char *rets = MEM_mallocN(ds->curlen + 1, "dynstr_cstring");
BLI_dynstr_get_cstring_ex(ds, rets);

View File

@ -122,8 +122,8 @@ struct GHash {
BLI_INLINE void ghash_entry_copy(GHash *gh_dst,
Entry *dst,
GHash *gh_src,
Entry *src,
const GHash *gh_src,
const Entry *src,
GHashKeyCopyFP keycopyfp,
GHashValCopyFP valcopyfp)
{
@ -143,7 +143,7 @@ BLI_INLINE void ghash_entry_copy(GHash *gh_dst,
/**
* Get the full hash for a key.
*/
BLI_INLINE uint ghash_keyhash(GHash *gh, const void *key)
BLI_INLINE uint ghash_keyhash(const GHash *gh, const void *key)
{
return gh->hashfp(key);
}
@ -151,7 +151,7 @@ BLI_INLINE uint ghash_keyhash(GHash *gh, const void *key)
/**
* Get the full hash for an entry.
*/
BLI_INLINE uint ghash_entryhash(GHash *gh, const Entry *e)
BLI_INLINE uint ghash_entryhash(const GHash *gh, const Entry *e)
{
return gh->hashfp(e->key);
}
@ -159,7 +159,7 @@ BLI_INLINE uint ghash_entryhash(GHash *gh, const Entry *e)
/**
* Get the bucket-index for an already-computed full hash.
*/
BLI_INLINE uint ghash_bucket_index(GHash *gh, const uint hash)
BLI_INLINE uint ghash_bucket_index(const GHash *gh, const uint hash)
{
#ifdef GHASH_USE_MODULO_BUCKETS
return hash % gh->nbuckets;
@ -171,7 +171,7 @@ BLI_INLINE uint ghash_bucket_index(GHash *gh, const uint hash)
/**
* Find the index of next used bucket, starting from \a curr_bucket (\a gh is assumed non-empty).
*/
BLI_INLINE uint ghash_find_next_bucket_index(GHash *gh, uint curr_bucket)
BLI_INLINE uint ghash_find_next_bucket_index(const GHash *gh, uint curr_bucket)
{
if (curr_bucket >= gh->nbuckets) {
curr_bucket = 0;
@ -381,7 +381,7 @@ BLI_INLINE void ghash_buckets_reset(GHash *gh, const uint nentries)
* Takes hash and bucket_index arguments to avoid calling #ghash_keyhash and #ghash_bucket_index
* multiple times.
*/
BLI_INLINE Entry *ghash_lookup_entry_ex(GHash *gh, const void *key, const uint bucket_index)
BLI_INLINE Entry *ghash_lookup_entry_ex(const GHash *gh, const void *key, const uint bucket_index)
{
Entry *e;
/* If we do not store GHash, not worth computing it for each entry here!
@ -422,7 +422,7 @@ BLI_INLINE Entry *ghash_lookup_entry_prev_ex(GHash *gh,
/**
* Internal lookup function. Only wraps #ghash_lookup_entry_ex
*/
BLI_INLINE Entry *ghash_lookup_entry(GHash *gh, const void *key)
BLI_INLINE Entry *ghash_lookup_entry(const GHash *gh, const void *key)
{
const uint hash = ghash_keyhash(gh, key);
const uint bucket_index = ghash_bucket_index(gh, hash);
@ -652,7 +652,7 @@ static void ghash_free_cb(GHash *gh, GHashKeyFreeFP keyfreefp, GHashValFreeFP va
/**
* Copy the GHash.
*/
static GHash *ghash_copy(GHash *gh, GHashKeyCopyFP keycopyfp, GHashValCopyFP valcopyfp)
static GHash *ghash_copy(const GHash *gh, GHashKeyCopyFP keycopyfp, GHashValCopyFP valcopyfp)
{
GHash *gh_new;
uint i;
@ -724,7 +724,7 @@ GHash *BLI_ghash_new(GHashHashFP hashfp, GHashCmpFP cmpfp, const char *info)
* Copy given GHash. Keys and values are also copied if relevant callback is provided,
* else pointers remain the same.
*/
GHash *BLI_ghash_copy(GHash *gh, GHashKeyCopyFP keycopyfp, GHashValCopyFP valcopyfp)
GHash *BLI_ghash_copy(const GHash *gh, GHashKeyCopyFP keycopyfp, GHashValCopyFP valcopyfp)
{
return ghash_copy(gh, keycopyfp, valcopyfp);
}
@ -741,7 +741,7 @@ void BLI_ghash_reserve(GHash *gh, const uint nentries_reserve)
/**
* \return size of the GHash.
*/
uint BLI_ghash_len(GHash *gh)
uint BLI_ghash_len(const GHash *gh)
{
return gh->nentries;
}
@ -800,7 +800,7 @@ void *BLI_ghash_replace_key(GHash *gh, void *key)
* \note When NULL is a valid value, use #BLI_ghash_lookup_p to differentiate a missing key
* from a key with a NULL value. (Avoids calling #BLI_ghash_haskey before #BLI_ghash_lookup)
*/
void *BLI_ghash_lookup(GHash *gh, const void *key)
void *BLI_ghash_lookup(const GHash *gh, const void *key)
{
GHashEntry *e = (GHashEntry *)ghash_lookup_entry(gh, key);
BLI_assert(!(gh->flag & GHASH_FLAG_IS_GSET));
@ -810,7 +810,7 @@ void *BLI_ghash_lookup(GHash *gh, const void *key)
/**
* A version of #BLI_ghash_lookup which accepts a fallback argument.
*/
void *BLI_ghash_lookup_default(GHash *gh, const void *key, void *val_default)
void *BLI_ghash_lookup_default(const GHash *gh, const void *key, void *val_default)
{
GHashEntry *e = (GHashEntry *)ghash_lookup_entry(gh, key);
BLI_assert(!(gh->flag & GHASH_FLAG_IS_GSET));
@ -938,7 +938,7 @@ void *BLI_ghash_popkey(GHash *gh, const void *key, GHashKeyFreeFP keyfreefp)
/**
* \return true if the \a key is in \a gh.
*/
bool BLI_ghash_haskey(GHash *gh, const void *key)
bool BLI_ghash_haskey(const GHash *gh, const void *key)
{
return (ghash_lookup_entry(gh, key) != NULL);
}
@ -1130,12 +1130,12 @@ GSet *BLI_gset_new(GSetHashFP hashfp, GSetCmpFP cmpfp, const char *info)
/**
* Copy given GSet. Keys are also copied if callback is provided, else pointers remain the same.
*/
GSet *BLI_gset_copy(GSet *gs, GHashKeyCopyFP keycopyfp)
GSet *BLI_gset_copy(const GSet *gs, GHashKeyCopyFP keycopyfp)
{
return (GSet *)ghash_copy((GHash *)gs, keycopyfp, NULL);
return (GSet *)ghash_copy((const GHash *)gs, keycopyfp, NULL);
}
uint BLI_gset_len(GSet *gs)
uint BLI_gset_len(const GSet *gs)
{
return ((GHash *)gs)->nentries;
}
@ -1172,7 +1172,7 @@ bool BLI_gset_ensure_p_ex(GSet *gs, const void *key, void ***r_key)
{
const uint hash = ghash_keyhash((GHash *)gs, key);
const uint bucket_index = ghash_bucket_index((GHash *)gs, hash);
GSetEntry *e = (GSetEntry *)ghash_lookup_entry_ex((GHash *)gs, key, bucket_index);
GSetEntry *e = (GSetEntry *)ghash_lookup_entry_ex((const GHash *)gs, key, bucket_index);
const bool haskey = (e != NULL);
if (!haskey) {
@ -1213,9 +1213,9 @@ bool BLI_gset_remove(GSet *gs, const void *key, GSetKeyFreeFP keyfreefp)
return BLI_ghash_remove((GHash *)gs, key, keyfreefp, NULL);
}
bool BLI_gset_haskey(GSet *gs, const void *key)
bool BLI_gset_haskey(const GSet *gs, const void *key)
{
return (ghash_lookup_entry((GHash *)gs, key) != NULL);
return (ghash_lookup_entry((const GHash *)gs, key) != NULL);
}
/**
@ -1277,9 +1277,9 @@ void BLI_gset_flag_clear(GSet *gs, uint flag)
/**
* Returns the pointer to the key if it's found.
*/
void *BLI_gset_lookup(GSet *gs, const void *key)
void *BLI_gset_lookup(const GSet *gs, const void *key)
{
Entry *e = ghash_lookup_entry((GHash *)gs, key);
Entry *e = ghash_lookup_entry((const GHash *)gs, key);
return e ? e->key : NULL;
}
@ -1311,13 +1311,13 @@ void *BLI_gset_pop_key(GSet *gs, const void *key)
/**
* \return number of buckets in the GHash.
*/
int BLI_ghash_buckets_len(GHash *gh)
int BLI_ghash_buckets_len(const GHash *gh)
{
return (int)gh->nbuckets;
}
int BLI_gset_buckets_len(GSet *gs)
int BLI_gset_buckets_len(const GSet *gs)
{
return BLI_ghash_buckets_len((GHash *)gs);
return BLI_ghash_buckets_len((const GHash *)gs);
}
/**

View File

@ -452,7 +452,7 @@ void BLI_mempool_free(BLI_mempool *pool, void *addr)
}
}
int BLI_mempool_len(BLI_mempool *pool)
int BLI_mempool_len(const BLI_mempool *pool)
{
return (int)pool->totused;
}

View File

@ -193,7 +193,7 @@ BLI_INLINE EdgeHashEntry *edgehash_insert(EdgeHash *eh, Edge edge, void *value)
}
}
BLI_INLINE EdgeHashEntry *edgehash_lookup_entry(EdgeHash *eh, uint v0, uint v1)
BLI_INLINE EdgeHashEntry *edgehash_lookup_entry(const EdgeHash *eh, uint v0, uint v1)
{
Edge edge = init_edge(v0, v1);
@ -310,7 +310,7 @@ bool BLI_edgehash_reinsert(EdgeHash *eh, uint v0, uint v1, void *value)
/**
* A version of #BLI_edgehash_lookup which accepts a fallback argument.
*/
void *BLI_edgehash_lookup_default(EdgeHash *eh, uint v0, uint v1, void *default_value)
void *BLI_edgehash_lookup_default(const EdgeHash *eh, uint v0, uint v1, void *default_value)
{
EdgeHashEntry *entry = edgehash_lookup_entry(eh, v0, v1);
return entry ? entry->value : default_value;
@ -322,7 +322,7 @@ void *BLI_edgehash_lookup_default(EdgeHash *eh, uint v0, uint v1, void *default_
* to differentiate between key-value being NULL and
* lack of key then see #BLI_edgehash_lookup_p().
*/
void *BLI_edgehash_lookup(EdgeHash *eh, uint v0, uint v1)
void *BLI_edgehash_lookup(const EdgeHash *eh, uint v0, uint v1)
{
EdgeHashEntry *entry = edgehash_lookup_entry(eh, v0, v1);
return entry ? entry->value : NULL;
@ -423,7 +423,7 @@ void *BLI_edgehash_popkey(EdgeHash *eh, uint v0, uint v1)
/**
* Return boolean true/false if edge (v0,v1) in hash.
*/
bool BLI_edgehash_haskey(EdgeHash *eh, uint v0, uint v1)
bool BLI_edgehash_haskey(const EdgeHash *eh, uint v0, uint v1)
{
return edgehash_lookup_entry(eh, v0, v1) != NULL;
}
@ -431,7 +431,7 @@ bool BLI_edgehash_haskey(EdgeHash *eh, uint v0, uint v1)
/**
* Return number of keys in hash.
*/
int BLI_edgehash_len(EdgeHash *eh)
int BLI_edgehash_len(const EdgeHash *eh)
{
return (int)eh->length;
}
@ -533,7 +533,7 @@ void BLI_edgeset_free(EdgeSet *es)
MEM_freeN(es);
}
int BLI_edgeset_len(EdgeSet *es)
int BLI_edgeset_len(const EdgeSet *es)
{
return (int)es->length;
}
@ -608,7 +608,7 @@ void BLI_edgeset_insert(EdgeSet *es, uint v0, uint v1)
}
}
bool BLI_edgeset_haskey(EdgeSet *es, uint v0, uint v1)
bool BLI_edgeset_haskey(const EdgeSet *es, uint v0, uint v1)
{
Edge edge = init_edge(v0, v1);

View File

@ -2411,8 +2411,8 @@ void blo_do_versions_260(FileData *fd, Library *UNUSED(lib), Main *bmain)
}
/* 'Increment' mode disabled for nodes, use true grid snapping instead */
if (scene->toolsettings->snap_node_mode == SCE_SNAP_MODE_INCREMENT) {
scene->toolsettings->snap_node_mode = SCE_SNAP_MODE_GRID;
if (scene->toolsettings->snap_node_mode == 0) { /* SCE_SNAP_MODE_INCREMENT */
scene->toolsettings->snap_node_mode = 8; /* SCE_SNAP_MODE_GRID */
}
#ifdef WITH_FFMPEG

View File

@ -2436,41 +2436,41 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
for (Scene *scene = bmain->scenes.first; scene; scene = scene->id.next) {
switch (scene->toolsettings->snap_mode) {
case 0:
scene->toolsettings->snap_mode = SCE_SNAP_MODE_INCREMENT;
scene->toolsettings->snap_mode = (1 << 4); /* SCE_SNAP_MODE_INCREMENT */
break;
case 1:
scene->toolsettings->snap_mode = SCE_SNAP_MODE_VERTEX;
scene->toolsettings->snap_mode = (1 << 0); /* SCE_SNAP_MODE_VERTEX */
break;
case 2:
scene->toolsettings->snap_mode = SCE_SNAP_MODE_EDGE;
scene->toolsettings->snap_mode = (1 << 1); /* SCE_SNAP_MODE_EDGE */
break;
case 3:
scene->toolsettings->snap_mode = SCE_SNAP_MODE_FACE;
scene->toolsettings->snap_mode = (1 << 2); /* SCE_SNAP_MODE_FACE */
break;
case 4:
scene->toolsettings->snap_mode = SCE_SNAP_MODE_VOLUME;
scene->toolsettings->snap_mode = (1 << 3); /* SCE_SNAP_MODE_VOLUME */
break;
}
switch (scene->toolsettings->snap_node_mode) {
case 5:
scene->toolsettings->snap_node_mode = SCE_SNAP_MODE_NODE_X;
scene->toolsettings->snap_node_mode = (1 << 5); /* SCE_SNAP_MODE_NODE_X */
break;
case 6:
scene->toolsettings->snap_node_mode = SCE_SNAP_MODE_NODE_Y;
scene->toolsettings->snap_node_mode = (1 << 6); /* SCE_SNAP_MODE_NODE_Y */
break;
case 7:
scene->toolsettings->snap_node_mode = SCE_SNAP_MODE_NODE_X | SCE_SNAP_MODE_NODE_Y;
scene->toolsettings->snap_node_mode = (1 << 5) | (1 << 6); /* SCE_SNAP_MODE_NODE_X | SCE_SNAP_MODE_NODE_Y */
break;
case 8:
scene->toolsettings->snap_node_mode = SCE_SNAP_MODE_GRID;
scene->toolsettings->snap_node_mode = (1 << 7); /* SCE_SNAP_MODE_GRID */
break;
}
switch (scene->toolsettings->snap_uv_mode) {
case 0:
scene->toolsettings->snap_uv_mode = SCE_SNAP_MODE_INCREMENT;
scene->toolsettings->snap_uv_mode = (1 << 4); /* SCE_SNAP_MODE_INCREMENT */
break;
case 1:
scene->toolsettings->snap_uv_mode = SCE_SNAP_MODE_VERTEX;
scene->toolsettings->snap_uv_mode = (1 << 0); /* SCE_SNAP_MODE_VERTEX */
break;
}
}

View File

@ -438,8 +438,10 @@ void blo_do_versions_300(FileData *fd, Library *UNUSED(lib), Main *bmain)
tool_settings->snap_flag |= SCE_SNAP_SEQ;
short snap_mode = tool_settings->snap_mode;
short snap_node_mode = tool_settings->snap_node_mode;
short snap_uv_mode = tool_settings->snap_uv_mode;
tool_settings->snap_mode &= ~((1 << 4) | (1 << 5) | (1 << 6));
tool_settings->snap_node_mode &= ~((1 << 5) | (1 << 6));
tool_settings->snap_uv_mode &= ~(1 << 4);
if (snap_mode & (1 << 4)) {
tool_settings->snap_mode |= (1 << 6); /* SCE_SNAP_MODE_INCREMENT */
}
@ -455,6 +457,9 @@ void blo_do_versions_300(FileData *fd, Library *UNUSED(lib), Main *bmain)
if (snap_node_mode & (1 << 6)) {
tool_settings->snap_node_mode |= (1 << 1); /* SCE_SNAP_MODE_NODE_Y */
}
if (snap_uv_mode & (1 << 4)) {
tool_settings->snap_uv_mode |= (1 << 6); /* SCE_SNAP_MODE_INCREMENT */
}
SequencerToolSettings *sequencer_tool_settings = SEQ_tool_settings_ensure(scene);
sequencer_tool_settings->snap_mode = SEQ_SNAP_TO_STRIPS | SEQ_SNAP_TO_PLAYHEAD |

View File

@ -182,7 +182,7 @@ static void displacement_principled_nodes(bNode *node)
}
}
static bool node_has_roughness(bNode *node)
static bool node_has_roughness(const bNode *node)
{
return ELEM(node->type,
SH_NODE_BSDF_ANISOTROPIC,

View File

@ -1217,7 +1217,7 @@ static bool skip_fcurve_with_name(
*
* \return true if F-Curve has errors/is disabled
*/
static bool fcurve_has_errors(FCurve *fcu)
static bool fcurve_has_errors(const FCurve *fcu)
{
/* F-Curve disabled - path eval error */
if (fcu->flag & FCURVE_DISABLED) {
@ -1226,7 +1226,7 @@ static bool fcurve_has_errors(FCurve *fcu)
/* driver? */
if (fcu->driver) {
ChannelDriver *driver = fcu->driver;
const ChannelDriver *driver = fcu->driver;
DriverVar *dvar;
/* error flag on driver usually means that there is an error

View File

@ -2810,7 +2810,7 @@ bool autokeyframe_cfra_can_key(const Scene *scene, ID *id)
/* --------------- API/Per-Datablock Handling ------------------- */
/* Checks if some F-Curve has a keyframe for a given frame */
bool fcurve_frame_has_keyframe(FCurve *fcu, float frame, short filter)
bool fcurve_frame_has_keyframe(const FCurve *fcu, float frame, short filter)
{
/* quick sanity check */
if (ELEM(NULL, fcu, fcu->bezt)) {

View File

@ -111,10 +111,10 @@ static bool swap_selection_bpoint(BPoint *bp)
return select_bpoint(bp, SELECT, SELECT, VISIBLE);
}
bool ED_curve_nurb_select_check(View3D *v3d, Nurb *nu)
bool ED_curve_nurb_select_check(const View3D *v3d, const Nurb *nu)
{
if (nu->type == CU_BEZIER) {
BezTriple *bezt;
const BezTriple *bezt;
int i;
for (i = nu->pntsu, bezt = nu->bezt; i--; bezt++) {
@ -124,7 +124,7 @@ bool ED_curve_nurb_select_check(View3D *v3d, Nurb *nu)
}
}
else {
BPoint *bp;
const BPoint *bp;
int i;
for (i = nu->pntsu * nu->pntsv, bp = nu->bp; i--; bp++) {
@ -136,12 +136,12 @@ bool ED_curve_nurb_select_check(View3D *v3d, Nurb *nu)
return false;
}
int ED_curve_nurb_select_count(View3D *v3d, Nurb *nu)
int ED_curve_nurb_select_count(const View3D *v3d, const Nurb *nu)
{
int sel = 0;
if (nu->type == CU_BEZIER) {
BezTriple *bezt;
const BezTriple *bezt;
int i;
for (i = nu->pntsu, bezt = nu->bezt; i--; bezt++) {
@ -151,7 +151,7 @@ int ED_curve_nurb_select_count(View3D *v3d, Nurb *nu)
}
}
else {
BPoint *bp;
const BPoint *bp;
int i;
for (i = nu->pntsu * nu->pntsv, bp = nu->bp; i--; bp++) {
@ -227,7 +227,7 @@ bool ED_curve_nurb_deselect_all(const Nurb *nu)
return changed;
}
int ED_curve_select_count(View3D *v3d, struct EditNurb *editnurb)
int ED_curve_select_count(const View3D *v3d, const EditNurb *editnurb)
{
int sel = 0;
Nurb *nu;
@ -239,9 +239,9 @@ int ED_curve_select_count(View3D *v3d, struct EditNurb *editnurb)
return sel;
}
bool ED_curve_select_check(View3D *v3d, struct EditNurb *editnurb)
bool ED_curve_select_check(const View3D *v3d, const EditNurb *editnurb)
{
LISTBASE_FOREACH (Nurb *, nu, &editnurb->nurbs) {
LISTBASE_FOREACH (const Nurb *, nu, &editnurb->nurbs) {
if (ED_curve_nurb_select_check(v3d, nu)) {
return true;
}

View File

@ -319,9 +319,9 @@ bool ED_gizmotypes_snap_3d_invert_snap_get(struct wmGizmo *gz)
#endif
}
bool ED_gizmotypes_snap_3d_is_enabled(wmGizmo *gz)
bool ED_gizmotypes_snap_3d_is_enabled(const wmGizmo *gz)
{
SnapGizmo3D *snap_gizmo = (SnapGizmo3D *)gz;
const SnapGizmo3D *snap_gizmo = (const SnapGizmo3D *)gz;
return snap_gizmo->is_enabled;
}

View File

@ -107,7 +107,7 @@ void ED_gpencil_layer_make_cfra_list(bGPDlayer *gpl, ListBase *elems, bool onlys
/* Selection Tools */
/* check if one of the frames in this layer is selected */
bool ED_gpencil_layer_frame_select_check(bGPDlayer *gpl)
bool ED_gpencil_layer_frame_select_check(const bGPDlayer *gpl)
{
/* error checking */
if (gpl == NULL) {
@ -115,7 +115,7 @@ bool ED_gpencil_layer_frame_select_check(bGPDlayer *gpl)
}
/* stop at the first one found */
LISTBASE_FOREACH (bGPDframe *, gpf, &gpl->frames) {
LISTBASE_FOREACH (const bGPDframe *, gpf, &gpl->frames) {
if (gpf->flag & GP_FRAME_SELECT) {
return true;
}

View File

@ -871,20 +871,20 @@ void GPENCIL_OT_frame_clean_loose(wmOperatorType *ot)
}
/* ********************* Clean Duplicated Frames ************************** */
static bool gpencil_frame_is_equal(bGPDframe *gpf_a, bGPDframe *gpf_b)
static bool gpencil_frame_is_equal(const bGPDframe *gpf_a, const bGPDframe *gpf_b)
{
if ((gpf_a == NULL) || (gpf_b == NULL)) {
return false;
}
/* If the number of strokes is different, cannot be equal. */
int totstrokes_a = BLI_listbase_count(&gpf_a->strokes);
int totstrokes_b = BLI_listbase_count(&gpf_b->strokes);
const int totstrokes_a = BLI_listbase_count(&gpf_a->strokes);
const int totstrokes_b = BLI_listbase_count(&gpf_b->strokes);
if ((totstrokes_a == 0) || (totstrokes_b == 0) || (totstrokes_a != totstrokes_b)) {
return false;
}
/* Loop all strokes and check. */
bGPDstroke *gps_a = gpf_a->strokes.first;
bGPDstroke *gps_b = gpf_b->strokes.first;
const bGPDstroke *gps_a = gpf_a->strokes.first;
const bGPDstroke *gps_b = gpf_b->strokes.first;
for (int i = 0; i < totstrokes_a; i++) {
/* If the number of points is different, cannot be equal. */
if (gps_a->totpoints != gps_b->totpoints) {
@ -924,8 +924,8 @@ static bool gpencil_frame_is_equal(bGPDframe *gpf_a, bGPDframe *gpf_b)
/* Loop points and check if equals or not. */
for (int p = 0; p < gps_a->totpoints; p++) {
bGPDspoint *pt_a = &gps_a->points[p];
bGPDspoint *pt_b = &gps_b->points[p];
const bGPDspoint *pt_a = &gps_a->points[p];
const bGPDspoint *pt_b = &gps_b->points[p];
if (!equals_v3v3(&pt_a->x, &pt_b->x)) {
return false;
}

View File

@ -1381,7 +1381,7 @@ static float gpencil_sculpt_rotation_eval_get(tGP_BrushEditData *gso,
return 0.0f;
}
GP_SpaceConversion *gsc = &gso->gsc;
const GP_SpaceConversion *gsc = &gso->gsc;
bGPDstroke *gps_orig = (gps_eval->runtime.gps_orig) ? gps_eval->runtime.gps_orig : gps_eval;
bGPDspoint *pt_orig = &gps_orig->points[pt_eval->runtime.idx_orig];
bGPDspoint *pt_prev_eval = NULL;

View File

@ -3106,8 +3106,8 @@ void ED_gpencil_sbuffer_vertex_color_set(Depsgraph *depsgraph,
}
/* Get the bigger 2D bound box points. */
void ED_gpencil_projected_2d_bound_box(GP_SpaceConversion *gsc,
bGPDstroke *gps,
void ED_gpencil_projected_2d_bound_box(const GP_SpaceConversion *gsc,
const bGPDstroke *gps,
const float diff_mat[4][4],
float r_min[2],
float r_max[2])
@ -3140,7 +3140,7 @@ void ED_gpencil_projected_2d_bound_box(GP_SpaceConversion *gsc,
}
/* Check if the stroke collides with brush. */
bool ED_gpencil_stroke_check_collision(GP_SpaceConversion *gsc,
bool ED_gpencil_stroke_check_collision(const GP_SpaceConversion *gsc,
bGPDstroke *gps,
const float mouse[2],
const int radius,
@ -3175,9 +3175,9 @@ bool ED_gpencil_stroke_check_collision(GP_SpaceConversion *gsc,
* \param diff_mat: View matrix.
* \return True if the point is inside.
*/
bool ED_gpencil_stroke_point_is_inside(bGPDstroke *gps,
GP_SpaceConversion *gsc,
int mouse[2],
bool ED_gpencil_stroke_point_is_inside(const bGPDstroke *gps,
const GP_SpaceConversion *gsc,
const int mouse[2],
const float diff_mat[4][4])
{
bool hit = false;
@ -3190,7 +3190,7 @@ bool ED_gpencil_stroke_point_is_inside(bGPDstroke *gps,
mcoords = MEM_mallocN(sizeof(int[2]) * len, __func__);
/* Convert stroke to 2D array of points. */
bGPDspoint *pt;
const bGPDspoint *pt;
int i;
for (i = 0, pt = gps->points; i < gps->totpoints; i++, pt++) {
bGPDspoint pt2;
@ -3214,7 +3214,7 @@ bool ED_gpencil_stroke_point_is_inside(bGPDstroke *gps,
}
bGPDstroke *ED_gpencil_stroke_nearest_to_ends(bContext *C,
GP_SpaceConversion *gsc,
const GP_SpaceConversion *gsc,
bGPDlayer *gpl,
bGPDframe *gpf,
bGPDstroke *gps,

View File

@ -60,21 +60,21 @@ bool ED_curve_editnurb_select_pick(
struct Nurb *ED_curve_add_nurbs_primitive(
struct bContext *C, struct Object *obedit, float mat[4][4], int type, int newob);
bool ED_curve_nurb_select_check(struct View3D *v3d, struct Nurb *nu);
int ED_curve_nurb_select_count(struct View3D *v3d, struct Nurb *nu);
bool ED_curve_nurb_select_check(const struct View3D *v3d, const struct Nurb *nu);
int ED_curve_nurb_select_count(const struct View3D *v3d, const struct Nurb *nu);
bool ED_curve_nurb_select_all(const struct Nurb *nu);
bool ED_curve_nurb_deselect_all(const struct Nurb *nu);
int ED_curve_join_objects_exec(struct bContext *C, struct wmOperator *op);
/* editcurve_select.c */
bool ED_curve_select_check(struct View3D *v3d, struct EditNurb *editnurb);
bool ED_curve_select_check(const struct View3D *v3d, const struct EditNurb *editnurb);
bool ED_curve_deselect_all(struct EditNurb *editnurb);
bool ED_curve_deselect_all_multi_ex(struct Base **bases, int bases_len);
bool ED_curve_deselect_all_multi(struct bContext *C);
bool ED_curve_select_all(struct EditNurb *editnurb);
bool ED_curve_select_swap(struct EditNurb *editnurb, bool hide_handles);
int ED_curve_select_count(struct View3D *v3d, struct EditNurb *editnurb);
int ED_curve_select_count(const struct View3D *v3d, const struct EditNurb *editnurb);
/* editcurve_undo.c */
void ED_curve_undosys_type(struct UndoType *ut);

View File

@ -30,275 +30,275 @@ extern "C" {
/* Datafiles embedded in Blender */
extern int datatoc_startup_blend_size;
extern char datatoc_startup_blend[];
extern const char datatoc_startup_blend[];
extern int datatoc_preview_blend_size;
extern char datatoc_preview_blend[];
extern const char datatoc_preview_blend[];
extern int datatoc_preview_grease_pencil_blend_size;
extern char datatoc_preview_grease_pencil_blend[];
extern const char datatoc_preview_grease_pencil_blend[];
extern int datatoc_blender_icons16_png_size;
extern char datatoc_blender_icons16_png[];
extern const char datatoc_blender_icons16_png[];
extern int datatoc_blender_icons32_png_size;
extern char datatoc_blender_icons32_png[];
extern const char datatoc_blender_icons32_png[];
extern int datatoc_prvicons_png_size;
extern char datatoc_prvicons_png[];
extern const char datatoc_prvicons_png[];
extern int datatoc_alert_icons_png_size;
extern char datatoc_alert_icons_png[];
extern const char datatoc_alert_icons_png[];
extern int datatoc_blender_logo_png_size;
extern char datatoc_blender_logo_png[];
extern const char datatoc_blender_logo_png[];
extern int datatoc_splash_png_size;
extern char datatoc_splash_png[];
extern const char datatoc_splash_png[];
extern int datatoc_bfont_pfb_size;
extern char datatoc_bfont_pfb[];
extern const char datatoc_bfont_pfb[];
/* Brush icon datafiles */
/* TODO: this could be simplified by putting all
* the brush icons in one file */
extern int datatoc_add_png_size;
extern char datatoc_add_png[];
extern const char datatoc_add_png[];
extern int datatoc_blob_png_size;
extern char datatoc_blob_png[];
extern const char datatoc_blob_png[];
extern int datatoc_blur_png_size;
extern char datatoc_blur_png[];
extern const char datatoc_blur_png[];
extern int datatoc_clay_png_size;
extern char datatoc_clay_png[];
extern const char datatoc_clay_png[];
extern int datatoc_claystrips_png_size;
extern char datatoc_claystrips_png[];
extern const char datatoc_claystrips_png[];
extern int datatoc_clone_png_size;
extern char datatoc_clone_png[];
extern const char datatoc_clone_png[];
extern int datatoc_crease_png_size;
extern char datatoc_crease_png[];
extern const char datatoc_crease_png[];
extern int datatoc_darken_png_size;
extern char datatoc_darken_png[];
extern const char datatoc_darken_png[];
extern int datatoc_draw_png_size;
extern char datatoc_draw_png[];
extern const char datatoc_draw_png[];
extern int datatoc_fill_png_size;
extern char datatoc_fill_png[];
extern const char datatoc_fill_png[];
extern int datatoc_flatten_png_size;
extern char datatoc_flatten_png[];
extern const char datatoc_flatten_png[];
extern int datatoc_grab_png_size;
extern char datatoc_grab_png[];
extern const char datatoc_grab_png[];
extern int datatoc_inflate_png_size;
extern char datatoc_inflate_png[];
extern const char datatoc_inflate_png[];
extern int datatoc_layer_png_size;
extern char datatoc_layer_png[];
extern const char datatoc_layer_png[];
extern int datatoc_lighten_png_size;
extern char datatoc_lighten_png[];
extern const char datatoc_lighten_png[];
extern int datatoc_mask_png_size;
extern char datatoc_mask_png[];
extern const char datatoc_mask_png[];
extern int datatoc_mix_png_size;
extern char datatoc_mix_png[];
extern const char datatoc_mix_png[];
extern int datatoc_multiply_png_size;
extern char datatoc_multiply_png[];
extern const char datatoc_multiply_png[];
extern int datatoc_nudge_png_size;
extern char datatoc_nudge_png[];
extern const char datatoc_nudge_png[];
extern int datatoc_pinch_png_size;
extern char datatoc_pinch_png[];
extern const char datatoc_pinch_png[];
extern int datatoc_scrape_png_size;
extern char datatoc_scrape_png[];
extern const char datatoc_scrape_png[];
extern int datatoc_smear_png_size;
extern char datatoc_smear_png[];
extern const char datatoc_smear_png[];
extern int datatoc_smooth_png_size;
extern char datatoc_smooth_png[];
extern const char datatoc_smooth_png[];
extern int datatoc_snake_hook_png_size;
extern char datatoc_snake_hook_png[];
extern const char datatoc_snake_hook_png[];
extern int datatoc_soften_png_size;
extern char datatoc_soften_png[];
extern const char datatoc_soften_png[];
extern int datatoc_subtract_png_size;
extern char datatoc_subtract_png[];
extern const char datatoc_subtract_png[];
extern int datatoc_texdraw_png_size;
extern char datatoc_texdraw_png[];
extern const char datatoc_texdraw_png[];
extern int datatoc_texfill_png_size;
extern char datatoc_texfill_png[];
extern const char datatoc_texfill_png[];
extern int datatoc_texmask_png_size;
extern char datatoc_texmask_png[];
extern const char datatoc_texmask_png[];
extern int datatoc_thumb_png_size;
extern char datatoc_thumb_png[];
extern const char datatoc_thumb_png[];
extern int datatoc_twist_png_size;
extern char datatoc_twist_png[];
extern const char datatoc_twist_png[];
extern int datatoc_vertexdraw_png_size;
extern char datatoc_vertexdraw_png[];
extern const char datatoc_vertexdraw_png[];
/* Matcap files */
extern int datatoc_mc01_jpg_size;
extern char datatoc_mc01_jpg[];
extern const char datatoc_mc01_jpg[];
extern int datatoc_mc02_jpg_size;
extern char datatoc_mc02_jpg[];
extern const char datatoc_mc02_jpg[];
extern int datatoc_mc03_jpg_size;
extern char datatoc_mc03_jpg[];
extern const char datatoc_mc03_jpg[];
extern int datatoc_mc04_jpg_size;
extern char datatoc_mc04_jpg[];
extern const char datatoc_mc04_jpg[];
extern int datatoc_mc05_jpg_size;
extern char datatoc_mc05_jpg[];
extern const char datatoc_mc05_jpg[];
extern int datatoc_mc06_jpg_size;
extern char datatoc_mc06_jpg[];
extern const char datatoc_mc06_jpg[];
extern int datatoc_mc07_jpg_size;
extern char datatoc_mc07_jpg[];
extern const char datatoc_mc07_jpg[];
extern int datatoc_mc08_jpg_size;
extern char datatoc_mc08_jpg[];
extern const char datatoc_mc08_jpg[];
extern int datatoc_mc09_jpg_size;
extern char datatoc_mc09_jpg[];
extern const char datatoc_mc09_jpg[];
extern int datatoc_mc10_jpg_size;
extern char datatoc_mc10_jpg[];
extern const char datatoc_mc10_jpg[];
extern int datatoc_mc11_jpg_size;
extern char datatoc_mc11_jpg[];
extern const char datatoc_mc11_jpg[];
extern int datatoc_mc12_jpg_size;
extern char datatoc_mc12_jpg[];
extern const char datatoc_mc12_jpg[];
extern int datatoc_mc13_jpg_size;
extern char datatoc_mc13_jpg[];
extern const char datatoc_mc13_jpg[];
extern int datatoc_mc14_jpg_size;
extern char datatoc_mc14_jpg[];
extern const char datatoc_mc14_jpg[];
extern int datatoc_mc15_jpg_size;
extern char datatoc_mc15_jpg[];
extern const char datatoc_mc15_jpg[];
extern int datatoc_mc16_jpg_size;
extern char datatoc_mc16_jpg[];
extern const char datatoc_mc16_jpg[];
extern int datatoc_mc17_jpg_size;
extern char datatoc_mc17_jpg[];
extern const char datatoc_mc17_jpg[];
extern int datatoc_mc18_jpg_size;
extern char datatoc_mc18_jpg[];
extern const char datatoc_mc18_jpg[];
extern int datatoc_mc19_jpg_size;
extern char datatoc_mc19_jpg[];
extern const char datatoc_mc19_jpg[];
extern int datatoc_mc20_jpg_size;
extern char datatoc_mc20_jpg[];
extern const char datatoc_mc20_jpg[];
extern int datatoc_mc21_jpg_size;
extern char datatoc_mc21_jpg[];
extern const char datatoc_mc21_jpg[];
extern int datatoc_mc22_jpg_size;
extern char datatoc_mc22_jpg[];
extern const char datatoc_mc22_jpg[];
extern int datatoc_mc23_jpg_size;
extern char datatoc_mc23_jpg[];
extern const char datatoc_mc23_jpg[];
extern int datatoc_mc24_jpg_size;
extern char datatoc_mc24_jpg[];
extern const char datatoc_mc24_jpg[];
/* grease pencil sculpt brushes files */
extern int datatoc_gp_brush_smooth_png_size;
extern char datatoc_gp_brush_smooth_png[];
extern const char datatoc_gp_brush_smooth_png[];
extern int datatoc_gp_brush_thickness_png_size;
extern char datatoc_gp_brush_thickness_png[];
extern const char datatoc_gp_brush_thickness_png[];
extern int datatoc_gp_brush_strength_png_size;
extern char datatoc_gp_brush_strength_png[];
extern const char datatoc_gp_brush_strength_png[];
extern int datatoc_gp_brush_grab_png_size;
extern char datatoc_gp_brush_grab_png[];
extern const char datatoc_gp_brush_grab_png[];
extern int datatoc_gp_brush_push_png_size;
extern char datatoc_gp_brush_push_png[];
extern const char datatoc_gp_brush_push_png[];
extern int datatoc_gp_brush_twist_png_size;
extern char datatoc_gp_brush_twist_png[];
extern const char datatoc_gp_brush_twist_png[];
extern int datatoc_gp_brush_pinch_png_size;
extern char datatoc_gp_brush_pinch_png[];
extern const char datatoc_gp_brush_pinch_png[];
extern int datatoc_gp_brush_randomize_png_size;
extern char datatoc_gp_brush_randomize_png[];
extern const char datatoc_gp_brush_randomize_png[];
extern int datatoc_gp_brush_clone_png_size;
extern char datatoc_gp_brush_clone_png[];
extern const char datatoc_gp_brush_clone_png[];
extern int datatoc_gp_brush_weight_png_size;
extern char datatoc_gp_brush_weight_png[];
extern const char datatoc_gp_brush_weight_png[];
extern int datatoc_gp_brush_pencil_png_size;
extern char datatoc_gp_brush_pencil_png[];
extern const char datatoc_gp_brush_pencil_png[];
extern int datatoc_gp_brush_pen_png_size;
extern char datatoc_gp_brush_pen_png[];
extern const char datatoc_gp_brush_pen_png[];
extern int datatoc_gp_brush_ink_png_size;
extern char datatoc_gp_brush_ink_png[];
extern const char datatoc_gp_brush_ink_png[];
extern int datatoc_gp_brush_inknoise_png_size;
extern char datatoc_gp_brush_inknoise_png[];
extern const char datatoc_gp_brush_inknoise_png[];
extern int datatoc_gp_brush_block_png_size;
extern char datatoc_gp_brush_block_png[];
extern const char datatoc_gp_brush_block_png[];
extern int datatoc_gp_brush_marker_png_size;
extern char datatoc_gp_brush_marker_png[];
extern const char datatoc_gp_brush_marker_png[];
extern int datatoc_gp_brush_fill_png_size;
extern char datatoc_gp_brush_fill_png[];
extern const char datatoc_gp_brush_fill_png[];
extern int datatoc_gp_brush_airbrush_png_size;
extern char datatoc_gp_brush_airbrush_png[];
extern const char datatoc_gp_brush_airbrush_png[];
extern int datatoc_gp_brush_chisel_png_size;
extern char datatoc_gp_brush_chisel_png[];
extern const char datatoc_gp_brush_chisel_png[];
extern int datatoc_gp_brush_erase_soft_png_size;
extern char datatoc_gp_brush_erase_soft_png[];
extern const char datatoc_gp_brush_erase_soft_png[];
extern int datatoc_gp_brush_erase_hard_png_size;
extern char datatoc_gp_brush_erase_hard_png[];
extern const char datatoc_gp_brush_erase_hard_png[];
extern int datatoc_gp_brush_erase_stroke_png_size;
extern char datatoc_gp_brush_erase_stroke_png[];
extern const char datatoc_gp_brush_erase_stroke_png[];
#ifdef __cplusplus
}

View File

@ -275,7 +275,7 @@ void ED_gizmotypes_snap_3d_flag_clear(struct wmGizmo *gz, eSnapGizmo flag);
bool ED_gizmotypes_snap_3d_flag_test(struct wmGizmo *gz, eSnapGizmo flag);
bool ED_gizmotypes_snap_3d_invert_snap_get(struct wmGizmo *gz);
bool ED_gizmotypes_snap_3d_is_enabled(struct wmGizmo *gz);
bool ED_gizmotypes_snap_3d_is_enabled(const struct wmGizmo *gz);
short ED_gizmotypes_snap_3d_update(struct wmGizmo *gz,
struct Depsgraph *depsgraph,

View File

@ -189,7 +189,7 @@ bool ED_gpencil_layer_frames_looper(struct bGPDlayer *gpl,
bool (*gpf_cb)(struct bGPDframe *, struct Scene *));
void ED_gpencil_layer_make_cfra_list(struct bGPDlayer *gpl, ListBase *elems, bool onlysel);
bool ED_gpencil_layer_frame_select_check(struct bGPDlayer *gpl);
bool ED_gpencil_layer_frame_select_check(const struct bGPDlayer *gpl);
void ED_gpencil_layer_frame_select_set(struct bGPDlayer *gpl, short mode);
void ED_gpencil_layer_frames_select_box(struct bGPDlayer *gpl,
float min,
@ -364,23 +364,23 @@ void ED_gpencil_init_random_settings(struct Brush *brush,
const int mval[2],
struct GpRandomSettings *random_settings);
bool ED_gpencil_stroke_check_collision(struct GP_SpaceConversion *gsc,
bool ED_gpencil_stroke_check_collision(const struct GP_SpaceConversion *gsc,
struct bGPDstroke *gps,
const float mouse[2],
const int radius,
const float diff_mat[4][4]);
bool ED_gpencil_stroke_point_is_inside(struct bGPDstroke *gps,
struct GP_SpaceConversion *gsc,
int mouse[2],
bool ED_gpencil_stroke_point_is_inside(const struct bGPDstroke *gps,
const struct GP_SpaceConversion *gsc,
const int mouse[2],
const float diff_mat[4][4]);
void ED_gpencil_projected_2d_bound_box(struct GP_SpaceConversion *gsc,
struct bGPDstroke *gps,
void ED_gpencil_projected_2d_bound_box(const struct GP_SpaceConversion *gsc,
const struct bGPDstroke *gps,
const float diff_mat[4][4],
float r_min[2],
float r_max[2]);
struct bGPDstroke *ED_gpencil_stroke_nearest_to_ends(struct bContext *C,
struct GP_SpaceConversion *gsc,
const struct GP_SpaceConversion *gsc,
struct bGPDlayer *gpl,
struct bGPDframe *gpf,
struct bGPDstroke *gps,

View File

@ -452,7 +452,7 @@ bool autokeyframe_cfra_can_key(const struct Scene *scene, struct ID *id);
/* Lesser Keyframe Checking API call:
* - Used for the buttons to check for keyframes...
*/
bool fcurve_frame_has_keyframe(struct FCurve *fcu, float frame, short filter);
bool fcurve_frame_has_keyframe(const struct FCurve *fcu, float frame, short filter);
/* Lesser Keyframe Checking API call:
* - Returns whether the current value of a given property differs from the interpolated value.

View File

@ -100,7 +100,7 @@ bool ED_masklayer_frames_looper(struct MaskLayer *mask_layer,
struct Scene *));
void ED_masklayer_make_cfra_list(struct MaskLayer *mask_layer, ListBase *elems, bool onlysel);
bool ED_masklayer_frame_select_check(struct MaskLayer *mask_layer);
bool ED_masklayer_frame_select_check(const struct MaskLayer *mask_layer);
void ED_masklayer_frame_select_set(struct MaskLayer *mask_layer, short mode);
void ED_masklayer_frames_select_box(struct MaskLayer *mask_layer,
float min,

View File

@ -110,7 +110,7 @@ bool ED_node_is_geometry(struct SpaceNode *snode);
void ED_node_shader_default(const struct bContext *C, struct ID *id);
void ED_node_composit_default(const struct bContext *C, struct Scene *scene);
void ED_node_texture_default(const struct bContext *C, struct Tex *tex);
bool ED_node_select_check(ListBase *lb);
bool ED_node_select_check(const ListBase *lb);
void ED_node_select_all(ListBase *lb, int action);
void ED_node_post_apply_transform(struct bContext *C, struct bNodeTree *ntree);
void ED_node_set_active(struct Main *bmain,

View File

@ -62,7 +62,8 @@ struct Object *ED_object_active_context(const struct bContext *C);
void ED_collection_hide_menu_draw(const struct bContext *C, struct uiLayout *layout);
Object **ED_object_array_in_mode_or_selected(struct bContext *C,
bool (*filter_fn)(struct Object *ob, void *user_data),
bool (*filter_fn)(const struct Object *ob,
void *user_data),
void *filter_user_data,
uint *r_objects_len);
@ -387,7 +388,7 @@ void ED_object_mode_generic_exit(struct Main *bmain,
struct Depsgraph *depsgraph,
struct Scene *scene,
struct Object *ob);
bool ED_object_mode_generic_has_data(struct Depsgraph *depsgraph, struct Object *ob);
bool ED_object_mode_generic_has_data(struct Depsgraph *depsgraph, const struct Object *ob);
void ED_object_posemode_set_for_weight_paint(struct bContext *C,
struct Main *bmain,

View File

@ -504,7 +504,6 @@ typedef void (*uiButSearchUpdateFn)(const struct bContext *C,
const char *str,
uiSearchItems *items,
const bool is_first);
typedef void (*uiButSearchArgFreeFn)(void *arg);
typedef bool (*uiButSearchContextMenuFn)(struct bContext *C,
void *arg,
void *active,
@ -533,6 +532,8 @@ typedef void (*uiMenuHandleFunc)(struct bContext *C, void *arg, int event);
*/
typedef bool (*uiMenuStepFunc)(struct bContext *C, int direction, void *arg1);
typedef void (*uiFreeArgFunc)(void *arg);
/* interface_query.c */
bool UI_but_has_tooltip_label(const uiBut *but);
bool UI_but_is_tool(const uiBut *but);
@ -619,11 +620,11 @@ typedef void (*uiBlockCancelFunc)(struct bContext *C, void *arg1);
void UI_popup_block_invoke(struct bContext *C,
uiBlockCreateFunc func,
void *arg,
void (*arg_free)(void *arg));
uiFreeArgFunc arg_free);
void UI_popup_block_invoke_ex(struct bContext *C,
uiBlockCreateFunc func,
void *arg,
void (*arg_free)(void *arg),
uiFreeArgFunc arg_free,
bool can_refresh);
void UI_popup_block_ex(struct bContext *C,
uiBlockCreateFunc func,
@ -1599,7 +1600,7 @@ void UI_but_func_search_set(uiBut *but,
uiButSearchUpdateFn search_update_fn,
void *arg,
const bool free_arg,
uiButSearchArgFreeFn search_arg_free_fn,
uiFreeArgFunc search_arg_free_fn,
uiButHandleFunc search_exec_fn,
void *active);
void UI_but_func_search_set_context_menu(uiBut *but, uiButSearchContextMenuFn context_menu_fn);
@ -1644,7 +1645,7 @@ void UI_but_func_drawextra_set(
void UI_but_func_menu_step_set(uiBut *but, uiMenuStepFunc func);
void UI_but_func_tooltip_set(uiBut *but, uiButToolTipFunc func, void *argN);
void UI_but_func_tooltip_set(uiBut *but, uiButToolTipFunc func, void *arg, uiFreeArgFunc free_arg);
void UI_but_tooltip_refresh(struct bContext *C, uiBut *but);
void UI_but_tooltip_timer_remove(struct bContext *C, uiBut *but);

View File

@ -811,7 +811,8 @@ static void ui_but_update_old_active_from_new(uiBut *oldbut, uiBut *but)
/* Move tooltip from new to old. */
SWAP(uiButToolTipFunc, oldbut->tip_func, but->tip_func);
SWAP(void *, oldbut->tip_argN, but->tip_argN);
SWAP(void *, oldbut->tip_arg, but->tip_arg);
SWAP(uiFreeArgFunc, oldbut->tip_arg_free, but->tip_arg_free);
oldbut->flag = (oldbut->flag & ~flag_copy) | (but->flag & flag_copy);
oldbut->drawflag = (oldbut->drawflag & ~drawflag_copy) | (but->drawflag & drawflag_copy);
@ -822,7 +823,7 @@ static void ui_but_update_old_active_from_new(uiBut *oldbut, uiBut *but)
if (oldbut->type == UI_BTYPE_SEARCH_MENU) {
uiButSearch *search_oldbut = (uiButSearch *)oldbut, *search_but = (uiButSearch *)but;
SWAP(uiButSearchArgFreeFn, search_oldbut->arg_free_fn, search_but->arg_free_fn);
SWAP(uiFreeArgFunc, search_oldbut->arg_free_fn, search_but->arg_free_fn);
SWAP(void *, search_oldbut->arg, search_but->arg);
}
@ -3358,8 +3359,8 @@ static void ui_but_free(const bContext *C, uiBut *but)
MEM_freeN(but->func_argN);
}
if (but->tip_argN) {
MEM_freeN(but->tip_argN);
if (but->tip_arg_free) {
but->tip_arg_free(but->tip_arg);
}
if (but->hold_argN) {
@ -6334,13 +6335,14 @@ void UI_but_func_menu_step_set(uiBut *but, uiMenuStepFunc func)
but->menu_step_func = func;
}
void UI_but_func_tooltip_set(uiBut *but, uiButToolTipFunc func, void *argN)
void UI_but_func_tooltip_set(uiBut *but, uiButToolTipFunc func, void *arg, uiFreeArgFunc free_arg)
{
but->tip_func = func;
if (but->tip_argN) {
MEM_freeN(but->tip_argN);
if (but->tip_arg_free) {
but->tip_arg_free(but->tip_arg);
}
but->tip_argN = argN;
but->tip_arg = arg;
but->tip_arg_free = free_arg;
}
void UI_but_func_pushed_state_set(uiBut *but, uiButPushedStateFunc func, const void *arg)
@ -6630,7 +6632,7 @@ void UI_but_func_search_set(uiBut *but,
uiButSearchUpdateFn search_update_fn,
void *arg,
const bool free_arg,
uiButSearchArgFreeFn search_arg_free_fn,
uiFreeArgFunc search_arg_free_fn,
uiButHandleFunc search_exec_fn,
void *active)
{
@ -6965,7 +6967,7 @@ void UI_but_string_info_get(bContext *C, uiBut *but, ...)
}
else if (type == BUT_GET_TIP) {
if (but->tip_func) {
tmp = but->tip_func(C, but->tip_argN, but->tip);
tmp = but->tip_func(C, but->tip_arg, but->tip);
}
else if (but->tip && but->tip[0]) {
tmp = BLI_strdup(but->tip);

View File

@ -469,7 +469,7 @@ typedef struct uiAfterFunc {
PropertyRNA *rnaprop;
void *search_arg;
uiButSearchArgFreeFn search_arg_free_fn;
uiFreeArgFunc search_arg_free_fn;
bContextStore *context;

View File

@ -221,7 +221,8 @@ struct uiBut {
const char *tip;
uiButToolTipFunc tip_func;
void *tip_argN;
void *tip_arg;
uiFreeArgFunc tip_arg_free;
/** info on why button is disabled, displayed in tooltip */
const char *disabled_info;
@ -316,7 +317,7 @@ typedef struct uiButSearch {
void *item_active;
void *arg;
uiButSearchArgFreeFn arg_free_fn;
uiFreeArgFunc arg_free_fn;
uiButSearchContextMenuFn item_context_menu_fn;
uiButSearchTooltipFn item_tooltip_fn;
@ -704,7 +705,7 @@ struct uiPopupBlockCreate {
uiBlockCreateFunc create_func;
uiBlockHandleCreateFunc handle_create_func;
void *arg;
void (*arg_free)(void *arg);
uiFreeArgFunc arg_free;
int event_xy[2];
@ -828,7 +829,7 @@ uiPopupBlockHandle *ui_popup_block_create(struct bContext *C,
uiBlockCreateFunc create_func,
uiBlockHandleCreateFunc handle_create_func,
void *arg,
void (*arg_free)(void *arg));
uiFreeArgFunc arg_free);
uiPopupBlockHandle *ui_popup_menu_create(struct bContext *C,
struct ARegion *butregion,
uiBut *but,

View File

@ -591,7 +591,7 @@ int UI_popup_menu_invoke(bContext *C, const char *idname, ReportList *reports)
* \{ */
void UI_popup_block_invoke_ex(
bContext *C, uiBlockCreateFunc func, void *arg, void (*arg_free)(void *arg), bool can_refresh)
bContext *C, uiBlockCreateFunc func, void *arg, uiFreeArgFunc arg_free, bool can_refresh)
{
wmWindow *window = CTX_wm_window(C);
uiPopupBlockHandle *handle;
@ -608,10 +608,7 @@ void UI_popup_block_invoke_ex(
WM_event_add_mousemove(window);
}
void UI_popup_block_invoke(bContext *C,
uiBlockCreateFunc func,
void *arg,
void (*arg_free)(void *arg))
void UI_popup_block_invoke(bContext *C, uiBlockCreateFunc func, void *arg, uiFreeArgFunc arg_free)
{
UI_popup_block_invoke_ex(C, func, arg, arg_free, true);
}

View File

@ -773,7 +773,7 @@ uiPopupBlockHandle *ui_popup_block_create(bContext *C,
uiBlockCreateFunc create_func,
uiBlockHandleCreateFunc handle_create_func,
void *arg,
void (*arg_free)(void *arg))
uiFreeArgFunc arg_free)
{
wmWindow *window = CTX_wm_window(C);
uiBut *activebut = UI_context_active_but_get(C);

View File

@ -6205,7 +6205,7 @@ void uiTemplateList(uiLayout *layout,
0,
TIP_("Double click to rename"));
if ((dyntip_data = uilist_item_use_dynamic_tooltip(itemptr, item_dyntip_propname))) {
UI_but_func_tooltip_set(but, uilist_item_tooltip_func, dyntip_data);
UI_but_func_tooltip_set(but, uilist_item_tooltip_func, dyntip_data, MEM_freeN);
}
sub = uiLayoutRow(overlap, false);
@ -6762,7 +6762,7 @@ void uiTemplateRunningJobs(uiLayout *layout, bContext *C)
NULL);
but_progress->progress = progress;
UI_but_func_tooltip_set(&but_progress->but, progress_tooltip_func, tip_arg);
UI_but_func_tooltip_set(&but_progress->but, progress_tooltip_func, tip_arg, MEM_freeN);
}
if (!wm->is_interface_locked) {

View File

@ -3489,7 +3489,7 @@ static void widget_menubut(uiWidgetColors *wcol, rcti *rect, int UNUSED(state),
/**
* Draw menu buttons still with triangles when field is not embossed
*/
static void widget_menubut_embossn(uiBut *UNUSED(but),
static void widget_menubut_embossn(const uiBut *UNUSED(but),
uiWidgetColors *wcol,
rcti *rect,
int UNUSED(state),
@ -3512,7 +3512,7 @@ static void widget_menubut_embossn(uiBut *UNUSED(but),
* Draw number buttons still with triangles when field is not embossed
*/
static void widget_numbut_embossn(
uiBut *UNUSED(but), uiWidgetColors *wcol, rcti *rect, int state, int roundboxalign)
const uiBut *UNUSED(but), uiWidgetColors *wcol, rcti *rect, int state, int roundboxalign)
{
widget_numbut_draw(wcol, rect, state, roundboxalign, true);
}

View File

@ -109,7 +109,7 @@ void ED_masklayer_make_cfra_list(MaskLayer *mask_layer, ListBase *elems, bool on
/* Selection Tools */
/* check if one of the frames in this layer is selected */
bool ED_masklayer_frame_select_check(MaskLayer *mask_layer)
bool ED_masklayer_frame_select_check(const MaskLayer *mask_layer)
{
MaskLayerShape *mask_layer_shape;

View File

@ -157,7 +157,7 @@ Object *ED_object_active_context(const bContext *C)
* (assuming they need to be modified).
*/
Object **ED_object_array_in_mode_or_selected(bContext *C,
bool (*filter_fn)(Object *ob, void *user_data),
bool (*filter_fn)(const Object *ob, void *user_data),
void *filter_user_data,
uint *r_objects_len)
{

View File

@ -413,9 +413,9 @@ void ED_object_mode_generic_exit(struct Main *bmain,
ed_object_mode_generic_exit_ex(bmain, depsgraph, scene, ob, false);
}
bool ED_object_mode_generic_has_data(struct Depsgraph *depsgraph, struct Object *ob)
bool ED_object_mode_generic_has_data(struct Depsgraph *depsgraph, const struct Object *ob)
{
return ed_object_mode_generic_exit_ex(NULL, depsgraph, NULL, ob, true);
return ed_object_mode_generic_exit_ex(NULL, depsgraph, NULL, (Object *)ob, true);
}
/** \} */

View File

@ -83,7 +83,7 @@ static bool vertex_group_supported_poll_ex(bContext *C, const Object *ob);
/** \name Local Utility Functions
* \{ */
static bool object_array_for_wpaint_filter(Object *ob, void *user_data)
static bool object_array_for_wpaint_filter(const Object *ob, void *user_data)
{
bContext *C = user_data;
if (vertex_group_supported_poll_ex(C, ob)) {

View File

@ -103,7 +103,7 @@ static bool object_materials_supported_poll_ex(bContext *C, const Object *ob);
/** \name Local Utilities
* \{ */
static bool object_array_for_shading_edit_mode_enabled_filter(Object *ob, void *user_data)
static bool object_array_for_shading_edit_mode_enabled_filter(const Object *ob, void *user_data)
{
bContext *C = user_data;
if (object_materials_supported_poll_ex(C, ob)) {
@ -120,7 +120,7 @@ static Object **object_array_for_shading_edit_mode_enabled(bContext *C, uint *r_
C, object_array_for_shading_edit_mode_enabled_filter, C, r_objects_len);
}
static bool object_array_for_shading_edit_mode_disabled_filter(Object *ob, void *user_data)
static bool object_array_for_shading_edit_mode_disabled_filter(const Object *ob, void *user_data)
{
bContext *C = user_data;
if (object_materials_supported_poll_ex(C, ob)) {

View File

@ -25,6 +25,8 @@
#include <math.h>
#include <string.h>
#include "MEM_guardedalloc.h"
#include "BLI_alloca.h"
#include "BLI_blenlib.h"
#include "BLI_fileops_types.h"
@ -165,7 +167,7 @@ static void file_draw_icon(const SpaceFile *sfile,
const float a2 = dimmed ? 0.3f : 0.0f;
but = uiDefIconBut(
block, UI_BTYPE_LABEL, 0, icon, x, y, width, height, NULL, 0.0f, 0.0f, a1, a2, NULL);
UI_but_func_tooltip_set(but, file_draw_tooltip_func, BLI_strdup(path));
UI_but_func_tooltip_set(but, file_draw_tooltip_func, BLI_strdup(path), MEM_freeN);
if (drag) {
/* TODO duplicated from file_draw_preview(). */

View File

@ -1285,7 +1285,7 @@ static void node_add_error_message_button(
0,
0,
nullptr);
UI_but_func_tooltip_set(but, node_errors_tooltip_fn, storage_pointer_alloc);
UI_but_func_tooltip_set(but, node_errors_tooltip_fn, storage_pointer_alloc, MEM_freeN);
UI_block_emboss_set(node.block, UI_EMBOSS);
}

View File

@ -1357,9 +1357,9 @@ void NODE_OT_duplicate(wmOperatorType *ot)
ot->srna, "keep_inputs", false, "Keep Inputs", "Keep the input links to duplicated nodes");
}
bool ED_node_select_check(ListBase *lb)
bool ED_node_select_check(const ListBase *lb)
{
LISTBASE_FOREACH (bNode *, node, lb) {
LISTBASE_FOREACH (const bNode *, node, lb) {
if (node->flag & NODE_SELECT) {
return true;
}

View File

@ -1150,7 +1150,7 @@ int constraintModeToIndex(const TransInfo *t)
}
}
bool isLockConstraint(TransInfo *t)
bool isLockConstraint(const TransInfo *t)
{
int mode = t->con.mode;

View File

@ -46,5 +46,5 @@ void postSelectConstraint(TransInfo *t);
void setNearestAxis(TransInfo *t);
int constraintModeToIndex(const TransInfo *t);
char constraintModeToChar(const TransInfo *t);
bool isLockConstraint(TransInfo *t);
bool isLockConstraint(const TransInfo *t);
int getConstraintSpaceDimension(const TransInfo *t);

View File

@ -149,6 +149,8 @@ typedef struct TransData {
short protectflag;
} TransData;
#define TRANSDATA_THREAD_LIMIT 1024
/** #TransData.flag */
enum {
TD_SELECTED = 1 << 0,

View File

@ -29,6 +29,7 @@
#include "BLI_math.h"
#include "BLI_string.h"
#include "BLI_task.h"
#include "BKE_context.h"
#include "BKE_unit.h"
@ -47,9 +48,12 @@
#include "transform_snap.h"
/* -------------------------------------------------------------------- */
/** \name Transform (Bend)
/** \name Transform (Bend) Custom Data
* \{ */
/**
* Custom data, stored in #TransInfo.custom.mode.data
*/
struct BendCustomData {
/* All values are in global space. */
float warp_sta[3];
@ -62,6 +66,122 @@ struct BendCustomData {
float warp_init_dist;
};
/** \} */
/* -------------------------------------------------------------------- */
/** \name Transform (Bend) Element
* \{ */
/**
* \note Small arrays / data-structures should be copied for faster memory access.
*/
struct TransDataArgs_Bend {
const TransInfo *t;
const TransDataContainer *tc;
float angle;
struct BendCustomData bend_data;
const float warp_sta_local[3];
const float warp_end_local[3];
const float warp_end_radius_local[3];
const float pivot_local[3];
bool is_clamp;
};
static void transdata_elem_bend(const TransInfo *t,
const TransDataContainer *tc,
TransData *td,
float angle,
const struct BendCustomData *bend_data,
const float warp_sta_local[3],
const float UNUSED(warp_end_local[3]),
const float warp_end_radius_local[3],
const float pivot_local[3],
bool is_clamp)
{
if (UNLIKELY(angle == 0.0f)) {
copy_v3_v3(td->loc, td->iloc);
return;
}
float vec[3];
float mat[3][3];
float delta[3];
float fac, fac_scaled;
copy_v3_v3(vec, td->iloc);
mul_m3_v3(td->mtx, vec);
fac = line_point_factor_v3(vec, warp_sta_local, warp_end_radius_local);
if (is_clamp) {
CLAMP(fac, 0.0f, 1.0f);
}
if (t->options & CTX_GPENCIL_STROKES) {
/* grease pencil multiframe falloff */
bGPDstroke *gps = (bGPDstroke *)td->extra;
if (gps != NULL) {
fac_scaled = fac * td->factor * gps->runtime.multi_frame_falloff;
}
else {
fac_scaled = fac * td->factor;
}
}
else {
fac_scaled = fac * td->factor;
}
axis_angle_normalized_to_mat3(mat, bend_data->warp_nor, angle * fac_scaled);
interp_v3_v3v3(delta, warp_sta_local, warp_end_radius_local, fac_scaled);
sub_v3_v3(delta, warp_sta_local);
/* delta is subtracted, rotation adds back this offset */
sub_v3_v3(vec, delta);
sub_v3_v3(vec, pivot_local);
mul_m3_v3(mat, vec);
add_v3_v3(vec, pivot_local);
mul_m3_v3(td->smtx, vec);
/* rotation */
if ((t->flag & T_POINTS) == 0) {
ElementRotation(t, tc, td, mat, V3D_AROUND_LOCAL_ORIGINS);
}
/* location */
copy_v3_v3(td->loc, vec);
}
static void transdata_elem_bend_fn(void *__restrict iter_data_v,
const int iter,
const TaskParallelTLS *__restrict UNUSED(tls))
{
struct TransDataArgs_Bend *data = iter_data_v;
TransData *td = &data->tc->data[iter];
if (td->flag & TD_SKIP) {
return;
}
transdata_elem_bend(data->t,
data->tc,
td,
data->angle,
&data->bend_data,
data->warp_sta_local,
data->warp_end_local,
data->warp_end_radius_local,
data->pivot_local,
data->is_clamp);
}
/** \} */
/* -------------------------------------------------------------------- */
/** \name Transform (Bend)
* \{ */
static eRedrawFlag handleEventBend(TransInfo *UNUSED(t), const wmEvent *event)
{
eRedrawFlag status = TREDRAW_NOTHING;
@ -75,12 +195,11 @@ static eRedrawFlag handleEventBend(TransInfo *UNUSED(t), const wmEvent *event)
static void Bend(TransInfo *t, const int UNUSED(mval[2]))
{
float vec[3];
float pivot_global[3];
float warp_end_radius_global[3];
int i;
char str[UI_MAX_DRAW_STR];
const struct BendCustomData *data = t->custom.mode.data;
const struct BendCustomData *bend_data = t->custom.mode.data;
const bool is_clamp = (t->flag & T_ALT_TRANSFORM) == 0;
union {
@ -100,7 +219,7 @@ static void Bend(TransInfo *t, const int UNUSED(mval[2]))
* this isn't essential but nicer to give reasonable snapping values for radius. */
if (t->tsnap.mode & SCE_SNAP_MODE_INCREMENT) {
const float radius_snap = 0.1f;
const float snap_hack = (t->snap[0] * data->warp_init_dist) / radius_snap;
const float snap_hack = (t->snap[0] * bend_data->warp_init_dist) / radius_snap;
values.scale *= snap_hack;
transform_snap_increment(t, values.vector);
values.scale /= snap_hack;
@ -108,7 +227,7 @@ static void Bend(TransInfo *t, const int UNUSED(mval[2]))
#endif
if (applyNumInput(&t->num, values.vector)) {
values.scale = values.scale / data->warp_init_dist;
values.scale = values.scale / bend_data->warp_init_dist;
}
copy_v2_v2(t->values_final, values.vector);
@ -132,34 +251,33 @@ static void Bend(TransInfo *t, const int UNUSED(mval[2]))
sizeof(str),
TIP_("Bend Angle: %.3f Radius: %.4f, Alt, Clamp %s"),
RAD2DEGF(values.angle),
values.scale * data->warp_init_dist,
values.scale * bend_data->warp_init_dist,
WM_bool_as_string(is_clamp));
}
values.angle *= -1.0f;
values.scale *= data->warp_init_dist;
values.scale *= bend_data->warp_init_dist;
/* calc 'data->warp_end' from 'data->warp_end_init' */
copy_v3_v3(warp_end_radius_global, data->warp_end);
dist_ensure_v3_v3fl(warp_end_radius_global, data->warp_sta, values.scale);
copy_v3_v3(warp_end_radius_global, bend_data->warp_end);
dist_ensure_v3_v3fl(warp_end_radius_global, bend_data->warp_sta, values.scale);
/* done */
/* calculate pivot */
copy_v3_v3(pivot_global, data->warp_sta);
copy_v3_v3(pivot_global, bend_data->warp_sta);
if (values.angle > 0.0f) {
madd_v3_v3fl(pivot_global,
data->warp_tan,
bend_data->warp_tan,
-values.scale * shell_angle_to_dist((float)M_PI_2 - values.angle));
}
else {
madd_v3_v3fl(pivot_global,
data->warp_tan,
bend_data->warp_tan,
+values.scale * shell_angle_to_dist((float)M_PI_2 + values.angle));
}
/* TODO(campbell): xform, compensate object center. */
FOREACH_TRANS_DATA_CONTAINER (t, tc) {
TransData *td = tc->data;
float warp_sta_local[3];
float warp_end_local[3];
@ -167,74 +285,52 @@ static void Bend(TransInfo *t, const int UNUSED(mval[2]))
float pivot_local[3];
if (tc->use_local_mat) {
sub_v3_v3v3(warp_sta_local, data->warp_sta, tc->mat[3]);
sub_v3_v3v3(warp_end_local, data->warp_end, tc->mat[3]);
sub_v3_v3v3(warp_sta_local, bend_data->warp_sta, tc->mat[3]);
sub_v3_v3v3(warp_end_local, bend_data->warp_end, tc->mat[3]);
sub_v3_v3v3(warp_end_radius_local, warp_end_radius_global, tc->mat[3]);
sub_v3_v3v3(pivot_local, pivot_global, tc->mat[3]);
}
else {
copy_v3_v3(warp_sta_local, data->warp_sta);
copy_v3_v3(warp_end_local, data->warp_end);
copy_v3_v3(warp_sta_local, bend_data->warp_sta);
copy_v3_v3(warp_end_local, bend_data->warp_end);
copy_v3_v3(warp_end_radius_local, warp_end_radius_global);
copy_v3_v3(pivot_local, pivot_global);
}
for (i = 0; i < tc->data_len; i++, td++) {
float mat[3][3];
float delta[3];
float fac, fac_scaled;
if (tc->data_len < TRANSDATA_THREAD_LIMIT) {
TransData *td = tc->data;
if (td->flag & TD_SKIP) {
continue;
}
if (UNLIKELY(values.angle == 0.0f)) {
copy_v3_v3(td->loc, td->iloc);
continue;
}
copy_v3_v3(vec, td->iloc);
mul_m3_v3(td->mtx, vec);
fac = line_point_factor_v3(vec, warp_sta_local, warp_end_radius_local);
if (is_clamp) {
CLAMP(fac, 0.0f, 1.0f);
}
if (t->options & CTX_GPENCIL_STROKES) {
/* grease pencil multiframe falloff */
bGPDstroke *gps = (bGPDstroke *)td->extra;
if (gps != NULL) {
fac_scaled = fac * td->factor * gps->runtime.multi_frame_falloff;
}
else {
fac_scaled = fac * td->factor;
for (i = 0; i < tc->data_len; i++, td++) {
if (td->flag & TD_SKIP) {
continue;
}
transdata_elem_bend(t,
tc,
td,
values.angle,
bend_data,
warp_sta_local,
warp_end_local,
warp_end_radius_local,
pivot_local,
is_clamp);
}
else {
fac_scaled = fac * td->factor;
}
axis_angle_normalized_to_mat3(mat, data->warp_nor, values.angle * fac_scaled);
interp_v3_v3v3(delta, warp_sta_local, warp_end_radius_local, fac_scaled);
sub_v3_v3(delta, warp_sta_local);
/* delta is subtracted, rotation adds back this offset */
sub_v3_v3(vec, delta);
sub_v3_v3(vec, pivot_local);
mul_m3_v3(mat, vec);
add_v3_v3(vec, pivot_local);
mul_m3_v3(td->smtx, vec);
/* rotation */
if ((t->flag & T_POINTS) == 0) {
ElementRotation(t, tc, td, mat, V3D_AROUND_LOCAL_ORIGINS);
}
/* location */
copy_v3_v3(td->loc, vec);
}
else {
struct TransDataArgs_Bend data = {
.t = t,
.tc = tc,
.angle = values.angle,
.bend_data = *bend_data,
.warp_sta_local = {UNPACK3(warp_sta_local)},
.warp_end_local = {UNPACK3(warp_end_local)},
.warp_end_radius_local = {UNPACK3(warp_end_radius_local)},
.pivot_local = {UNPACK3(pivot_local)},
.is_clamp = is_clamp,
};
TaskParallelSettings settings;
BLI_parallel_range_settings_defaults(&settings);
BLI_task_parallel_range(0, tc->data_len, &data, transdata_elem_bend_fn, &settings);
}
}

View File

@ -25,6 +25,7 @@
#include "BLI_math.h"
#include "BLI_string.h"
#include "BLI_task.h"
#include "BKE_context.h"
#include "BKE_unit.h"
@ -39,6 +40,50 @@
#include "transform_mode.h"
#include "transform_snap.h"
/* -------------------------------------------------------------------- */
/** \name Transform (Bevel Weight) Element
* \{ */
/**
* \note Small arrays / data-structures should be stored copied for faster memory access.
*/
struct TransDataArgs_BevelWeight {
const TransInfo *t;
const TransDataContainer *tc;
float weight;
};
static void transdata_elem_bevel_weight(const TransInfo *UNUSED(t),
const TransDataContainer *UNUSED(tc),
TransData *td,
const float weight)
{
if (td->val == NULL) {
return;
}
*td->val = td->ival + weight * td->factor;
if (*td->val < 0.0f) {
*td->val = 0.0f;
}
if (*td->val > 1.0f) {
*td->val = 1.0f;
}
}
static void transdata_elem_bevel_weight_fn(void *__restrict iter_data_v,
const int iter,
const TaskParallelTLS *__restrict UNUSED(tls))
{
struct TransDataArgs_BevelWeight *data = iter_data_v;
TransData *td = &data->tc->data[iter];
if (td->flag & TD_SKIP) {
return;
}
transdata_elem_bevel_weight(data->t, data->tc, td, data->weight);
}
/** \} */
/* -------------------------------------------------------------------- */
/** \name Transform (Bevel Weight)
* \{ */
@ -83,18 +128,25 @@ static void applyBevelWeight(TransInfo *t, const int UNUSED(mval[2]))
}
FOREACH_TRANS_DATA_CONTAINER (t, tc) {
TransData *td = tc->data;
for (i = 0; i < tc->data_len; i++, td++) {
if (td->val) {
*td->val = td->ival + weight * td->factor;
if (*td->val < 0.0f) {
*td->val = 0.0f;
}
if (*td->val > 1.0f) {
*td->val = 1.0f;
if (tc->data_len < TRANSDATA_THREAD_LIMIT) {
TransData *td = tc->data;
for (i = 0; i < tc->data_len; i++, td++) {
if (td->flag & TD_SKIP) {
continue;
}
transdata_elem_bevel_weight(t, tc, td, weight);
}
}
else {
struct TransDataArgs_BevelWeight data = {
.t = t,
.tc = tc,
.weight = weight,
};
TaskParallelSettings settings;
BLI_parallel_range_settings_defaults(&settings);
BLI_task_parallel_range(0, tc->data_len, &data, transdata_elem_bevel_weight_fn, &settings);
}
}
recalcData(t);

View File

@ -25,6 +25,7 @@
#include "BLI_math.h"
#include "BLI_string.h"
#include "BLI_task.h"
#include "BKE_context.h"
#include "BKE_unit.h"
@ -39,6 +40,51 @@
#include "transform_mode.h"
#include "transform_snap.h"
/* -------------------------------------------------------------------- */
/** \name Transform (Crease) Element
* \{ */
/**
* \note Small arrays / data-structures should be stored copied for faster memory access.
*/
struct TransDataArgs_Crease {
const TransInfo *t;
const TransDataContainer *tc;
float crease;
};
static void transdata_elem_crease(const TransInfo *UNUSED(t),
const TransDataContainer *UNUSED(tc),
TransData *td,
const float crease)
{
if (td->val == NULL) {
return;
}
*td->val = td->ival + crease * td->factor;
if (*td->val < 0.0f) {
*td->val = 0.0f;
}
if (*td->val > 1.0f) {
*td->val = 1.0f;
}
}
static void transdata_elem_crease_fn(void *__restrict iter_data_v,
const int iter,
const TaskParallelTLS *__restrict UNUSED(tls))
{
struct TransDataArgs_Crease *data = iter_data_v;
TransData *td = &data->tc->data[iter];
if (td->flag & TD_SKIP) {
return;
}
transdata_elem_crease(data->t, data->tc, td, data->crease);
}
/** \} */
/* -------------------------------------------------------------------- */
/** \name Transform (Crease)
* \{ */
@ -83,22 +129,25 @@ static void applyCrease(TransInfo *t, const int UNUSED(mval[2]))
}
FOREACH_TRANS_DATA_CONTAINER (t, tc) {
TransData *td = tc->data;
for (i = 0; i < tc->data_len; i++, td++) {
if (td->flag & TD_SKIP) {
continue;
}
if (td->val) {
*td->val = td->ival + crease * td->factor;
if (*td->val < 0.0f) {
*td->val = 0.0f;
}
if (*td->val > 1.0f) {
*td->val = 1.0f;
if (tc->data_len < TRANSDATA_THREAD_LIMIT) {
TransData *td = tc->data;
for (i = 0; i < tc->data_len; i++, td++) {
if (td->flag & TD_SKIP) {
continue;
}
transdata_elem_crease(t, tc, td, crease);
}
}
else {
struct TransDataArgs_Crease data = {
.t = t,
.tc = tc,
.crease = crease,
};
TaskParallelSettings settings;
BLI_parallel_range_settings_defaults(&settings);
BLI_task_parallel_range(0, tc->data_len, &data, transdata_elem_crease_fn, &settings);
}
}
recalcData(t);
@ -124,4 +173,5 @@ void initCrease(TransInfo *t)
t->flag |= T_NO_CONSTRAINT | T_NO_PROJECT;
}
/** \} */

View File

@ -25,6 +25,7 @@
#include "BLI_math.h"
#include "BLI_string.h"
#include "BLI_task.h"
#include "BKE_context.h"
#include "BKE_unit.h"
@ -40,13 +41,83 @@
#include "transform_mode.h"
#include "transform_snap.h"
/* -------------------------------------------------------------------- */
/** \name Transform (Push/Pull) Element
* \{ */
/**
* \note Small arrays / data-structures should be stored copied for faster memory access.
*/
struct TransDataArgs_PushPull {
const TransInfo *t;
const TransDataContainer *tc;
float distance;
const float axis_global[3];
bool is_lock_constraint;
bool is_data_space;
};
static void transdata_elem_push_pull(const TransInfo *t,
const TransDataContainer *tc,
TransData *td,
const float distance,
const float axis_global[3],
const bool is_lock_constraint,
const bool is_data_space)
{
float vec[3];
sub_v3_v3v3(vec, tc->center_local, td->center);
if (t->con.applyRot && t->con.mode & CON_APPLY) {
float axis[3];
copy_v3_v3(axis, axis_global);
t->con.applyRot(t, tc, td, axis, NULL);
mul_m3_v3(td->smtx, axis);
if (is_lock_constraint) {
float dvec[3];
project_v3_v3v3(dvec, vec, axis);
sub_v3_v3(vec, dvec);
}
else {
project_v3_v3v3(vec, vec, axis);
}
}
normalize_v3_length(vec, distance * td->factor);
if (is_data_space) {
mul_m3_v3(td->smtx, vec);
}
add_v3_v3v3(td->loc, td->iloc, vec);
}
static void transdata_elem_push_pull_fn(void *__restrict iter_data_v,
const int iter,
const TaskParallelTLS *__restrict UNUSED(tls))
{
struct TransDataArgs_PushPull *data = iter_data_v;
TransData *td = &data->tc->data[iter];
if (td->flag & TD_SKIP) {
return;
}
transdata_elem_push_pull(data->t,
data->tc,
td,
data->distance,
data->axis_global,
data->is_lock_constraint,
data->is_data_space);
}
/** \} */
/* -------------------------------------------------------------------- */
/** \name Transform (Push/Pull)
* \{ */
static void applyPushPull(TransInfo *t, const int UNUSED(mval[2]))
{
float vec[3], axis_global[3];
float axis_global[3];
float distance;
int i;
char str[UI_MAX_DRAW_STR];
@ -77,37 +148,31 @@ static void applyPushPull(TransInfo *t, const int UNUSED(mval[2]))
t->con.applyRot(t, NULL, NULL, axis_global, NULL);
}
const bool is_lock_constraint = isLockConstraint(t);
const bool is_data_space = (t->options & CTX_POSE_BONE) != 0;
FOREACH_TRANS_DATA_CONTAINER (t, tc) {
TransData *td = tc->data;
for (i = 0; i < tc->data_len; i++, td++) {
if (td->flag & TD_SKIP) {
continue;
}
sub_v3_v3v3(vec, tc->center_local, td->center);
if (t->con.applyRot && t->con.mode & CON_APPLY) {
float axis[3];
copy_v3_v3(axis, axis_global);
t->con.applyRot(t, tc, td, axis, NULL);
mul_m3_v3(td->smtx, axis);
if (isLockConstraint(t)) {
float dvec[3];
project_v3_v3v3(dvec, vec, axis);
sub_v3_v3(vec, dvec);
}
else {
project_v3_v3v3(vec, vec, axis);
if (tc->data_len < TRANSDATA_THREAD_LIMIT) {
TransData *td = tc->data;
for (i = 0; i < tc->data_len; i++, td++) {
if (td->flag & TD_SKIP) {
continue;
}
transdata_elem_push_pull(
t, tc, td, distance, axis_global, is_lock_constraint, is_data_space);
}
normalize_v3_length(vec, distance * td->factor);
if (is_data_space) {
mul_m3_v3(td->smtx, vec);
}
add_v3_v3v3(td->loc, td->iloc, vec);
}
else {
struct TransDataArgs_PushPull data = {
.t = t,
.tc = tc,
.axis_global = {UNPACK3(axis_global)},
.is_lock_constraint = is_lock_constraint,
.is_data_space = is_data_space,
};
TaskParallelSettings settings;
BLI_parallel_range_settings_defaults(&settings);
BLI_task_parallel_range(0, tc->data_len, &data, transdata_elem_push_pull_fn, &settings);
}
}

View File

@ -24,6 +24,7 @@
#include <stdlib.h>
#include "BLI_math.h"
#include "BLI_task.h"
#include "BKE_context.h"
#include "BKE_unit.h"
@ -38,6 +39,30 @@
#include "transform_mode.h"
#include "transform_snap.h"
/* -------------------------------------------------------------------- */
/** \name Transform (Resize) Element
* \{ */
struct ElemResizeData {
const TransInfo *t;
const TransDataContainer *tc;
float mat[3][3];
};
static void element_resize_fn(void *__restrict iter_data_v,
const int iter,
const TaskParallelTLS *__restrict UNUSED(tls))
{
struct ElemResizeData *data = iter_data_v;
TransData *td = &data->tc->data[iter];
if (td->flag & TD_SKIP) {
return;
}
ElementResize(data->t, data->tc, td, data->mat);
}
/** \} */
/* -------------------------------------------------------------------- */
/** \name Transform (Resize)
* \{ */
@ -123,13 +148,27 @@ static void applyResize(TransInfo *t, const int UNUSED(mval[2]))
copy_m3_m3(t->mat, mat); /* used in gizmo */
FOREACH_TRANS_DATA_CONTAINER (t, tc) {
TransData *td = tc->data;
for (i = 0; i < tc->data_len; i++, td++) {
if (td->flag & TD_SKIP) {
continue;
}
ElementResize(t, tc, td, mat);
if (tc->data_len < TRANSDATA_THREAD_LIMIT) {
TransData *td = tc->data;
for (i = 0; i < tc->data_len; i++, td++) {
if (td->flag & TD_SKIP) {
continue;
}
ElementResize(t, tc, td, mat);
}
}
else {
struct ElemResizeData data = {
.t = t,
.tc = tc,
};
copy_m3_m3(data.mat, mat);
TaskParallelSettings settings;
BLI_parallel_range_settings_defaults(&settings);
BLI_task_parallel_range(0, tc->data_len, &data, element_resize_fn, &settings);
}
}

View File

@ -24,6 +24,7 @@
#include <stdlib.h>
#include "BLI_math.h"
#include "BLI_task.h"
#include "BKE_context.h"
#include "BKE_unit.h"
@ -36,6 +37,140 @@
#include "transform_mode.h"
#include "transform_snap.h"
/* -------------------------------------------------------------------- */
/** \name Transform (Rotation) Matrix Cache
* \{ */
struct RotateMatrixCache {
/**
* Counter for needed updates (when we need to update to non-default matrix,
* we also need another update on next iteration to go back to default matrix,
* hence the '2' value used here, instead of a mere boolean).
*/
short do_update_matrix;
float mat[3][3];
};
static void rmat_cache_init(struct RotateMatrixCache *rmc, const float angle, const float axis[3])
{
axis_angle_normalized_to_mat3(rmc->mat, axis, angle);
rmc->do_update_matrix = 0;
}
static void rmat_cache_reset(struct RotateMatrixCache *rmc)
{
rmc->do_update_matrix = 2;
}
static void rmat_cache_update(struct RotateMatrixCache *rmc,
const float axis[3],
const float angle)
{
if (rmc->do_update_matrix > 0) {
axis_angle_normalized_to_mat3(rmc->mat, axis, angle);
rmc->do_update_matrix--;
}
}
/** \} */
/* -------------------------------------------------------------------- */
/** \name Transform (Rotation) Element
* \{ */
/**
* \note Small arrays / data-structures should be stored copied for faster memory access.
*/
struct TransDataArgs_Rotate {
const TransInfo *t;
const TransDataContainer *tc;
const float axis[3];
float angle;
float angle_step;
bool is_large_rotation;
};
struct TransDataArgs_RotateTLS {
struct RotateMatrixCache rmc;
};
static void transdata_elem_rotate(const TransInfo *t,
const TransDataContainer *tc,
TransData *td,
const float axis[3],
const float angle,
const float angle_step,
const bool is_large_rotation,
struct RotateMatrixCache *rmc)
{
float axis_buffer[3];
const float *axis_final = axis;
float angle_final = angle;
if (t->con.applyRot) {
copy_v3_v3(axis_buffer, axis);
axis_final = axis_buffer;
t->con.applyRot(t, tc, td, axis_buffer, NULL);
angle_final = angle * td->factor;
/* Even though final angle might be identical to orig value,
* we have to update the rotation matrix in that case... */
rmat_cache_reset(rmc);
}
else if (t->flag & T_PROP_EDIT) {
angle_final = angle * td->factor;
}
/* Rotation is very likely to be above 180°, we need to do rotation by steps.
* Note that this is only needed when doing 'absolute' rotation
* (i.e. from initial rotation again, typically when using numinput).
* regular incremental rotation (from mouse/widget/...) will be called often enough,
* hence steps are small enough to be properly handled without that complicated trick.
* Note that we can only do that kind of stepped rotation if we have initial rotation values
* (and access to some actual rotation value storage).
* Otherwise, just assume it's useless (e.g. in case of mesh/UV/etc. editing).
* Also need to be in Euler rotation mode, the others never allow more than one turn anyway.
*/
if (is_large_rotation && td->ext != NULL && td->ext->rotOrder == ROT_MODE_EUL) {
copy_v3_v3(td->ext->rot, td->ext->irot);
for (float angle_progress = angle_step; fabsf(angle_progress) < fabsf(angle_final);
angle_progress += angle_step) {
axis_angle_normalized_to_mat3(rmc->mat, axis_final, angle_progress);
ElementRotation(t, tc, td, rmc->mat, t->around);
}
rmat_cache_reset(rmc);
}
else if (angle_final != angle) {
rmat_cache_reset(rmc);
}
rmat_cache_update(rmc, axis_final, angle_final);
ElementRotation(t, tc, td, rmc->mat, t->around);
}
static void transdata_elem_rotate_fn(void *__restrict iter_data_v,
const int iter,
const TaskParallelTLS *__restrict tls)
{
struct TransDataArgs_Rotate *data = iter_data_v;
struct TransDataArgs_RotateTLS *tls_data = tls->userdata_chunk;
TransData *td = &data->tc->data[iter];
if (td->flag & TD_SKIP) {
return;
}
transdata_elem_rotate(data->t,
data->tc,
td,
data->axis,
data->angle,
data->angle_step,
data->is_large_rotation,
&tls_data->rmc);
}
/** \} */
/* -------------------------------------------------------------------- */
/** \name Transform (Rotation)
* \{ */
@ -115,12 +250,9 @@ static float large_rotation_limit(float angle)
static void applyRotationValue(TransInfo *t,
float angle,
float axis[3],
const float axis[3],
const bool is_large_rotation)
{
float mat[3][3];
int i;
const float angle_sign = angle < 0.0f ? -1.0f : 1.0f;
/* We cannot use something too close to 180°, or 'continuous' rotation may fail
* due to computing error... */
@ -132,60 +264,37 @@ static void applyRotationValue(TransInfo *t,
angle = large_rotation_limit(angle);
}
axis_angle_normalized_to_mat3(mat, axis, angle);
/* Counter for needed updates (when we need to update to non-default matrix,
* we also need another update on next iteration to go back to default matrix,
* hence the '2' value used here, instead of a mere boolean). */
short do_update_matrix = 0;
struct RotateMatrixCache rmc = {0};
rmat_cache_init(&rmc, angle, axis);
FOREACH_TRANS_DATA_CONTAINER (t, tc) {
TransData *td = tc->data;
for (i = 0; i < tc->data_len; i++, td++) {
if (td->flag & TD_SKIP) {
continue;
}
float angle_final = angle;
if (t->con.applyRot) {
t->con.applyRot(t, tc, td, axis, NULL);
angle_final = angle * td->factor;
/* Even though final angle might be identical to orig value,
* we have to update the rotation matrix in that case... */
do_update_matrix = 2;
}
else if (t->flag & T_PROP_EDIT) {
angle_final = angle * td->factor;
}
/* Rotation is very likely to be above 180°, we need to do rotation by steps.
* Note that this is only needed when doing 'absolute' rotation
* (i.e. from initial rotation again, typically when using numinput).
* regular incremental rotation (from mouse/widget/...) will be called often enough,
* hence steps are small enough to be properly handled without that complicated trick.
* Note that we can only do that kind of stepped rotation if we have initial rotation values
* (and access to some actual rotation value storage).
* Otherwise, just assume it's useless (e.g. in case of mesh/UV/etc. editing).
* Also need to be in Euler rotation mode, the others never allow more than one turn anyway.
*/
if (is_large_rotation && td->ext != NULL && td->ext->rotOrder == ROT_MODE_EUL) {
copy_v3_v3(td->ext->rot, td->ext->irot);
for (float angle_progress = angle_step; fabsf(angle_progress) < fabsf(angle_final);
angle_progress += angle_step) {
axis_angle_normalized_to_mat3(mat, axis, angle_progress);
ElementRotation(t, tc, td, mat, t->around);
if (tc->data_len < TRANSDATA_THREAD_LIMIT) {
TransData *td = tc->data;
for (int i = 0; i < tc->data_len; i++, td++) {
if (td->flag & TD_SKIP) {
continue;
}
do_update_matrix = 2;
}
else if (angle_final != angle) {
do_update_matrix = 2;
transdata_elem_rotate(t, tc, td, axis, angle, angle_step, is_large_rotation, &rmc);
}
}
else {
struct TransDataArgs_Rotate data = {
.t = t,
.tc = tc,
.axis = {UNPACK3(axis)},
.angle = angle,
.angle_step = angle_step,
.is_large_rotation = is_large_rotation,
};
struct TransDataArgs_RotateTLS tls_data = {
.rmc = rmc,
};
if (do_update_matrix > 0) {
axis_angle_normalized_to_mat3(mat, axis, angle_final);
do_update_matrix--;
}
ElementRotation(t, tc, td, mat, t->around);
TaskParallelSettings settings;
BLI_parallel_range_settings_defaults(&settings);
settings.userdata_chunk = &tls_data;
settings.userdata_chunk_size = sizeof(tls_data);
BLI_task_parallel_range(0, tc->data_len, &data, transdata_elem_rotate_fn, &settings);
}
}
}

View File

@ -27,6 +27,7 @@
#include "BLI_math.h"
#include "BLI_string.h"
#include "BLI_task.h"
#include "BKE_context.h"
#include "BKE_unit.h"
@ -43,6 +44,79 @@
#include "transform_mode.h"
#include "transform_snap.h"
/* -------------------------------------------------------------------- */
/** \name Transform (Shear) Element
* \{ */
/**
* \note Small arrays / data-structures should be stored copied for faster memory access.
*/
struct TransDataArgs_Shear {
const TransInfo *t;
const TransDataContainer *tc;
float mat_final[3][3];
bool is_local_center;
};
static void transdata_elem_shear(const TransInfo *t,
const TransDataContainer *tc,
TransData *td,
const float mat_final[3][3],
const bool is_local_center)
{
float tmat[3][3];
const float *center;
if (t->flag & T_EDIT) {
mul_m3_series(tmat, td->smtx, mat_final, td->mtx);
}
else {
copy_m3_m3(tmat, mat_final);
}
if (is_local_center) {
center = td->center;
}
else {
center = tc->center_local;
}
float vec[3];
sub_v3_v3v3(vec, td->iloc, center);
mul_m3_v3(tmat, vec);
add_v3_v3(vec, center);
sub_v3_v3(vec, td->iloc);
if (t->options & CTX_GPENCIL_STROKES) {
/* Grease pencil multi-frame falloff. */
bGPDstroke *gps = (bGPDstroke *)td->extra;
if (gps != NULL) {
mul_v3_fl(vec, td->factor * gps->runtime.multi_frame_falloff);
}
else {
mul_v3_fl(vec, td->factor);
}
}
else {
mul_v3_fl(vec, td->factor);
}
add_v3_v3v3(td->loc, td->iloc, vec);
}
static void transdata_elem_shear_fn(void *__restrict iter_data_v,
const int iter,
const TaskParallelTLS *__restrict UNUSED(tls))
{
struct TransDataArgs_Shear *data = iter_data_v;
TransData *td = &data->tc->data[iter];
if (td->flag & TD_SKIP) {
return;
}
transdata_elem_shear(data->t, data->tc, td, data->mat_final, data->is_local_center);
}
/** \} */
/* -------------------------------------------------------------------- */
/** \name Transform (Shear)
* \{ */
@ -117,8 +191,7 @@ static eRedrawFlag handleEventShear(TransInfo *t, const wmEvent *event)
static void applyShear(TransInfo *t, const int UNUSED(mval[2]))
{
float vec[3];
float smat[3][3], tmat[3][3], totmat[3][3], axismat[3][3], axismat_inv[3][3];
float smat[3][3], axismat[3][3], axismat_inv[3][3], mat_final[3][3];
float value;
int i;
char str[UI_MAX_DRAW_STR];
@ -157,50 +230,29 @@ static void applyShear(TransInfo *t, const int UNUSED(mval[2]))
cross_v3_v3v3(axismat_inv[1], axismat_inv[0], axismat_inv[2]);
invert_m3_m3(axismat, axismat_inv);
mul_m3_series(totmat, axismat_inv, smat, axismat);
mul_m3_series(mat_final, axismat_inv, smat, axismat);
FOREACH_TRANS_DATA_CONTAINER (t, tc) {
TransData *td = tc->data;
for (i = 0; i < tc->data_len; i++, td++) {
const float *center;
if (td->flag & TD_SKIP) {
continue;
}
if (t->flag & T_EDIT) {
mul_m3_series(tmat, td->smtx, totmat, td->mtx);
}
else {
copy_m3_m3(tmat, totmat);
}
if (is_local_center) {
center = td->center;
}
else {
center = tc->center_local;
}
sub_v3_v3v3(vec, td->iloc, center);
mul_m3_v3(tmat, vec);
add_v3_v3(vec, center);
sub_v3_v3(vec, td->iloc);
if (t->options & CTX_GPENCIL_STROKES) {
/* grease pencil multiframe falloff */
bGPDstroke *gps = (bGPDstroke *)td->extra;
if (gps != NULL) {
mul_v3_fl(vec, td->factor * gps->runtime.multi_frame_falloff);
}
else {
mul_v3_fl(vec, td->factor);
if (tc->data_len < TRANSDATA_THREAD_LIMIT) {
TransData *td = tc->data;
for (i = 0; i < tc->data_len; i++, td++) {
if (td->flag & TD_SKIP) {
continue;
}
transdata_elem_shear(t, tc, td, mat_final, is_local_center);
}
else {
mul_v3_fl(vec, td->factor);
}
}
else {
struct TransDataArgs_Shear data = {
.t = t,
.tc = tc,
.is_local_center = is_local_center,
};
copy_m3_m3(data.mat_final, mat_final);
add_v3_v3v3(td->loc, td->iloc, vec);
TaskParallelSettings settings;
BLI_parallel_range_settings_defaults(&settings);
BLI_task_parallel_range(0, tc->data_len, &data, transdata_elem_shear_fn, &settings);
}
}

View File

@ -25,6 +25,7 @@
#include "BLI_math.h"
#include "BLI_string.h"
#include "BLI_task.h"
#include "BKE_context.h"
#include "BKE_unit.h"
@ -42,6 +43,47 @@
#include "transform_mode.h"
#include "transform_snap.h"
/* -------------------------------------------------------------------- */
/** \name Transform (Shrink-Fatten) Element
* \{ */
/**
* \note Small arrays / data-structures should be stored copied for faster memory access.
*/
struct TransDataArgs_ShrinkFatten {
const TransInfo *t;
const TransDataContainer *tc;
float distance;
};
static void transdata_elem_shrink_fatten(const TransInfo *t,
const TransDataContainer *UNUSED(tc),
TransData *td,
const float distance)
{
/* Get the final offset. */
float tdistance = distance * td->factor;
if (td->ext && (t->flag & T_ALT_TRANSFORM) != 0) {
tdistance *= td->ext->isize[0]; /* shell factor */
}
madd_v3_v3v3fl(td->loc, td->iloc, td->axismtx[2], tdistance);
}
static void transdata_elem_shrink_fatten_fn(void *__restrict iter_data_v,
const int iter,
const TaskParallelTLS *__restrict UNUSED(tls))
{
struct TransDataArgs_ShrinkFatten *data = iter_data_v;
TransData *td = &data->tc->data[iter];
if (td->flag & TD_SKIP) {
return;
}
transdata_elem_shrink_fatten(data->t, data->tc, td, data->distance);
}
/** \} */
/* -------------------------------------------------------------------- */
/** \name Transform (Shrink-Fatten)
* \{ */
@ -114,20 +156,24 @@ static void applyShrinkFatten(TransInfo *t, const int UNUSED(mval[2]))
/* done with header string */
FOREACH_TRANS_DATA_CONTAINER (t, tc) {
TransData *td = tc->data;
for (i = 0; i < tc->data_len; i++, td++) {
float tdistance; /* temp dist */
if (td->flag & TD_SKIP) {
continue;
if (tc->data_len < TRANSDATA_THREAD_LIMIT) {
TransData *td = tc->data;
for (i = 0; i < tc->data_len; i++, td++) {
if (td->flag & TD_SKIP) {
continue;
}
transdata_elem_shrink_fatten(t, tc, td, distance);
}
/* get the final offset */
tdistance = distance * td->factor;
if (td->ext && (t->flag & T_ALT_TRANSFORM) != 0) {
tdistance *= td->ext->isize[0]; /* shell factor */
}
madd_v3_v3v3fl(td->loc, td->iloc, td->axismtx[2], tdistance);
}
else {
struct TransDataArgs_ShrinkFatten data = {
.t = t,
.tc = tc,
.distance = distance,
};
TaskParallelSettings settings;
BLI_parallel_range_settings_defaults(&settings);
BLI_task_parallel_range(0, tc->data_len, &data, transdata_elem_shrink_fatten_fn, &settings);
}
}

View File

@ -24,6 +24,7 @@
#include <stdlib.h>
#include "BLI_math.h"
#include "BLI_task.h"
#include "BKE_context.h"
#include "BKE_unit.h"
@ -37,13 +38,65 @@
#include "transform_mode.h"
#include "transform_snap.h"
/* -------------------------------------------------------------------- */
/** \name Transform (Skin) Element
* \{ */
/**
* \note Small arrays / data-structures should be stored copied for faster memory access.
*/
struct TransDataArgs_SkinResize {
const TransInfo *t;
const TransDataContainer *tc;
float mat_final[3][3];
};
static void transdata_elem_skin_resize(const TransInfo *t,
const TransDataContainer *UNUSED(tc),
TransData *td,
const float mat[3][3])
{
float tmat[3][3], smat[3][3];
float fsize[3];
if (t->flag & T_EDIT) {
mul_m3_m3m3(smat, mat, td->mtx);
mul_m3_m3m3(tmat, td->smtx, smat);
}
else {
copy_m3_m3(tmat, mat);
}
if (t->con.applySize) {
t->con.applySize(t, NULL, NULL, tmat);
}
mat3_to_size(fsize, tmat);
td->loc[0] = td->iloc[0] * (1 + (fsize[0] - 1) * td->factor);
td->loc[1] = td->iloc[1] * (1 + (fsize[1] - 1) * td->factor);
}
static void transdata_elem_skin_resize_fn(void *__restrict iter_data_v,
const int iter,
const TaskParallelTLS *__restrict UNUSED(tls))
{
struct TransDataArgs_SkinResize *data = iter_data_v;
TransData *td = &data->tc->data[iter];
if (td->flag & TD_SKIP) {
return;
}
transdata_elem_skin_resize(data->t, data->tc, td, data->mat_final);
}
/** \} */
/* -------------------------------------------------------------------- */
/** \name Transform (Skin)
* \{ */
static void applySkinResize(TransInfo *t, const int UNUSED(mval[2]))
{
float mat[3][3];
float mat_final[3][3];
int i;
char str[UI_MAX_DRAW_STR];
@ -62,34 +115,29 @@ static void applySkinResize(TransInfo *t, const int UNUSED(mval[2]))
applySnapping(t, t->values_final);
}
size_to_mat3(mat, t->values_final);
size_to_mat3(mat_final, t->values_final);
headerResize(t, t->values_final, str, sizeof(str));
FOREACH_TRANS_DATA_CONTAINER (t, tc) {
TransData *td = tc->data;
for (i = 0; i < tc->data_len; i++, td++) {
float tmat[3][3], smat[3][3];
float fsize[3];
if (td->flag & TD_SKIP) {
continue;
if (tc->data_len < TRANSDATA_THREAD_LIMIT) {
TransData *td = tc->data;
for (i = 0; i < tc->data_len; i++, td++) {
if (td->flag & TD_SKIP) {
continue;
}
transdata_elem_skin_resize(t, tc, td, mat_final);
}
if (t->flag & T_EDIT) {
mul_m3_m3m3(smat, mat, td->mtx);
mul_m3_m3m3(tmat, td->smtx, smat);
}
else {
copy_m3_m3(tmat, mat);
}
if (t->con.applySize) {
t->con.applySize(t, NULL, NULL, tmat);
}
mat3_to_size(fsize, tmat);
td->loc[0] = td->iloc[0] * (1 + (fsize[0] - 1) * td->factor);
td->loc[1] = td->iloc[1] * (1 + (fsize[1] - 1) * td->factor);
}
else {
struct TransDataArgs_SkinResize data = {
.t = t,
.tc = tc,
};
copy_m3_m3(data.mat_final, mat_final);
TaskParallelSettings settings;
BLI_parallel_range_settings_defaults(&settings);
BLI_task_parallel_range(0, tc->data_len, &data, transdata_elem_skin_resize_fn, &settings);
}
}

View File

@ -25,6 +25,7 @@
#include "BLI_math.h"
#include "BLI_string.h"
#include "BLI_task.h"
#include "MEM_guardedalloc.h"
@ -110,6 +111,74 @@ static void to_sphere_radius_update(TransInfo *t)
/** \} */
/* -------------------------------------------------------------------- */
/** \name Transform (ToSphere) Element
* \{ */
/**
* \note Small arrays / data-structures should be stored copied for faster memory access.
*/
struct TransDataArgs_ToSphere {
const TransInfo *t;
const TransDataContainer *tc;
float ratio;
const struct ToSphereInfo to_sphere_info;
bool is_local_center;
bool is_data_space;
};
static void transdata_elem_to_sphere(const TransInfo *UNUSED(t),
const TransDataContainer *tc,
TransData *td,
const float ratio,
const struct ToSphereInfo *to_sphere_info,
const bool is_local_center,
const bool is_data_space)
{
float vec[3];
const float *center = is_local_center ? td->center : tc->center_local;
if (is_data_space) {
copy_v3_v3(vec, td->center);
}
else {
copy_v3_v3(vec, td->iloc);
}
sub_v3_v3(vec, center);
const float radius = normalize_v3(vec);
const float tratio = ratio * td->factor;
mul_v3_fl(vec, radius * (1.0f - tratio) + to_sphere_info->radius * tratio);
add_v3_v3(vec, center);
if (is_data_space) {
sub_v3_v3(vec, td->center);
mul_m3_v3(td->smtx, vec);
add_v3_v3(vec, td->iloc);
}
copy_v3_v3(td->loc, vec);
}
static void transdata_elem_to_sphere_fn(void *__restrict iter_data_v,
const int iter,
const TaskParallelTLS *__restrict UNUSED(tls))
{
struct TransDataArgs_ToSphere *data = iter_data_v;
TransData *td = &data->tc->data[iter];
if (td->flag & TD_SKIP) {
return;
}
transdata_elem_to_sphere(data->t,
data->tc,
td,
data->ratio,
&data->to_sphere_info,
data->is_local_center,
data->is_data_space);
}
/** \} */
/* -------------------------------------------------------------------- */
/** \name Transform (ToSphere)
* \{ */
@ -119,8 +188,7 @@ static void applyToSphere(TransInfo *t, const int UNUSED(mval[2]))
const bool is_local_center = transdata_check_local_center(t, t->around);
const bool is_data_space = (t->options & CTX_POSE_BONE) != 0;
float vec[3];
float ratio, radius;
float ratio;
int i;
char str[UI_MAX_DRAW_STR];
@ -147,40 +215,33 @@ static void applyToSphere(TransInfo *t, const int UNUSED(mval[2]))
BLI_snprintf(str, sizeof(str), TIP_("To Sphere: %.4f %s"), ratio, t->proptext);
}
const struct ToSphereInfo *data = t->custom.mode.data;
if (data->prop_size_prev != t->prop_size) {
const struct ToSphereInfo *to_sphere_info = t->custom.mode.data;
if (to_sphere_info->prop_size_prev != t->prop_size) {
to_sphere_radius_update(t);
}
FOREACH_TRANS_DATA_CONTAINER (t, tc) {
TransData *td = tc->data;
for (i = 0; i < tc->data_len; i++, td++) {
float tratio;
if (td->flag & TD_SKIP) {
continue;
if (tc->data_len < TRANSDATA_THREAD_LIMIT) {
TransData *td = tc->data;
for (i = 0; i < tc->data_len; i++, td++) {
if (td->flag & TD_SKIP) {
continue;
}
transdata_elem_to_sphere(t, tc, td, ratio, to_sphere_info, is_local_center, is_data_space);
}
const float *center = is_local_center ? td->center : tc->center_local;
if (is_data_space) {
copy_v3_v3(vec, td->center);
}
else {
copy_v3_v3(vec, td->iloc);
}
sub_v3_v3(vec, center);
radius = normalize_v3(vec);
tratio = ratio * td->factor;
mul_v3_fl(vec, radius * (1.0f - tratio) + data->radius * tratio);
add_v3_v3(vec, center);
if (is_data_space) {
sub_v3_v3(vec, td->center);
mul_m3_v3(td->smtx, vec);
add_v3_v3(vec, td->iloc);
}
copy_v3_v3(td->loc, vec);
}
else {
struct TransDataArgs_ToSphere data = {
.t = t,
.tc = tc,
.ratio = ratio,
.to_sphere_info = *to_sphere_info,
.is_local_center = is_local_center,
.is_data_space = is_data_space,
};
TaskParallelSettings settings;
BLI_parallel_range_settings_defaults(&settings);
BLI_task_parallel_range(0, tc->data_len, &data, transdata_elem_to_sphere_fn, &settings);
}
}

View File

@ -25,6 +25,7 @@
#include "BLI_math.h"
#include "BLI_string.h"
#include "BLI_task.h"
#include "BKE_context.h"
#include "BKE_unit.h"
@ -39,6 +40,51 @@
#include "transform_mode.h"
#include "transform_snap.h"
/* -------------------------------------------------------------------- */
/** \name Transform (Rotation - Trackball) Element
* \{ */
/**
* \note Small arrays / data-structures should be stored copied for faster memory access.
*/
struct TransDataArgs_Trackball {
const TransInfo *t;
const TransDataContainer *tc;
const float axis[3];
const float angle;
float mat_final[3][3];
};
static void transdata_elem_trackball(const TransInfo *t,
const TransDataContainer *tc,
TransData *td,
const float axis[3],
const float angle,
const float mat_final[3][3])
{
float mat_buf[3][3];
const float(*mat)[3] = mat_final;
if (t->flag & T_PROP_EDIT) {
axis_angle_normalized_to_mat3(mat_buf, axis, td->factor * angle);
mat = mat_buf;
}
ElementRotation(t, tc, td, mat, t->around);
}
static void transdata_elem_trackball_fn(void *__restrict iter_data_v,
const int iter,
const TaskParallelTLS *__restrict UNUSED(tls))
{
struct TransDataArgs_Trackball *data = iter_data_v;
TransData *td = &data->tc->data[iter];
if (td->flag & TD_SKIP) {
return;
}
transdata_elem_trackball(data->t, data->tc, td, data->axis, data->angle, data->mat_final);
}
/** \} */
/* -------------------------------------------------------------------- */
/** \name Transform (Rotation - Trackball)
* \{ */
@ -48,7 +94,7 @@ static void applyTrackballValue(TransInfo *t,
const float axis2[3],
const float angles[2])
{
float mat[3][3];
float mat_final[3][3];
float axis[3];
float angle;
int i;
@ -56,20 +102,30 @@ static void applyTrackballValue(TransInfo *t,
mul_v3_v3fl(axis, axis1, angles[0]);
madd_v3_v3fl(axis, axis2, angles[1]);
angle = normalize_v3(axis);
axis_angle_normalized_to_mat3(mat, axis, angle);
axis_angle_normalized_to_mat3(mat_final, axis, angle);
FOREACH_TRANS_DATA_CONTAINER (t, tc) {
TransData *td = tc->data;
for (i = 0; i < tc->data_len; i++, td++) {
if (td->flag & TD_SKIP) {
continue;
if (tc->data_len < TRANSDATA_THREAD_LIMIT) {
TransData *td = tc->data;
for (i = 0; i < tc->data_len; i++, td++) {
if (td->flag & TD_SKIP) {
continue;
}
transdata_elem_trackball(t, tc, td, axis, angle, mat_final);
}
}
else {
struct TransDataArgs_Trackball data = {
.t = t,
.tc = tc,
.axis = {UNPACK3(axis)},
.angle = angle,
};
copy_m3_m3(data.mat_final, mat_final);
if (t->flag & T_PROP_EDIT) {
axis_angle_normalized_to_mat3(mat, axis, td->factor * angle);
}
ElementRotation(t, tc, td, mat, t->around);
TaskParallelSettings settings;
BLI_parallel_range_settings_defaults(&settings);
BLI_task_parallel_range(0, tc->data_len, &data, transdata_elem_trackball_fn, &settings);
}
}
}

View File

@ -29,6 +29,7 @@
#include "BLI_math.h"
#include "BLI_string.h"
#include "BLI_task.h"
#include "BKE_context.h"
#include "BKE_report.h"
@ -48,6 +49,121 @@
#include "transform_mode.h"
#include "transform_snap.h"
/* -------------------------------------------------------------------- */
/** \name Transform (Translation) Element
* \{ */
/**
* \note Small arrays / data-structures should be stored copied for faster memory access.
*/
struct TransDataArgs_Translate {
const TransInfo *t;
const TransDataContainer *tc;
const float pivot_local[3];
const float vec[3];
bool apply_snap_align_rotation;
bool is_valid_snapping_normal;
};
static void transdata_elem_translate(const TransInfo *t,
const TransDataContainer *tc,
TransData *td,
const float pivot_local[3],
const float vec[3],
const bool apply_snap_align_rotation,
const bool is_valid_snapping_normal)
{
float rotate_offset[3] = {0};
bool use_rotate_offset = false;
/* Handle snapping rotation before doing the translation. */
if (apply_snap_align_rotation) {
float mat[3][3];
if (is_valid_snapping_normal) {
const float *original_normal;
/* In pose mode, we want to align normals with Y axis of bones. */
if (t->options & CTX_POSE_BONE) {
original_normal = td->axismtx[1];
}
else {
original_normal = td->axismtx[2];
}
rotation_between_vecs_to_mat3(mat, original_normal, t->tsnap.snapNormal);
}
else {
unit_m3(mat);
}
ElementRotation_ex(t, tc, td, mat, pivot_local);
if (td->loc) {
use_rotate_offset = true;
sub_v3_v3v3(rotate_offset, td->loc, td->iloc);
}
}
float tvec[3];
if (t->con.applyVec) {
t->con.applyVec(t, tc, td, vec, tvec);
}
else {
copy_v3_v3(tvec, vec);
}
mul_m3_v3(td->smtx, tvec);
if (use_rotate_offset) {
add_v3_v3(tvec, rotate_offset);
}
if (t->options & CTX_GPENCIL_STROKES) {
/* Grease pencil multi-frame falloff. */
bGPDstroke *gps = (bGPDstroke *)td->extra;
if (gps != NULL) {
mul_v3_fl(tvec, td->factor * gps->runtime.multi_frame_falloff);
}
else {
mul_v3_fl(tvec, td->factor);
}
}
else {
/* Proportional editing falloff. */
mul_v3_fl(tvec, td->factor);
}
protectedTransBits(td->protectflag, tvec);
if (td->loc) {
add_v3_v3v3(td->loc, td->iloc, tvec);
}
constraintTransLim(t, td);
}
static void transdata_elem_translate_fn(void *__restrict iter_data_v,
const int iter,
const TaskParallelTLS *__restrict UNUSED(tls))
{
struct TransDataArgs_Translate *data = iter_data_v;
TransData *td = &data->tc->data[iter];
if (td->flag & TD_SKIP) {
return;
}
transdata_elem_translate(data->t,
data->tc,
td,
data->pivot_local,
data->vec,
data->apply_snap_align_rotation,
data->is_valid_snapping_normal);
}
/** \} */
/* -------------------------------------------------------------------- */
/** \name Transform (Translation)
* \{ */
@ -242,96 +358,44 @@ static void ApplySnapTranslation(TransInfo *t, float vec[3])
static void applyTranslationValue(TransInfo *t, const float vec[3])
{
const bool apply_snap_align_rotation = usingSnappingNormal(t);
float tvec[3];
const bool is_valid_snapping_normal = apply_snap_align_rotation && validSnappingNormal(t);
/* Ideally "apply_snap_align_rotation" would only be used when a snap point is found:
* `t->tsnap.status & POINT_INIT` - perhaps this function isn't the best place to apply rotation.
* However snapping rotation needs to be handled before doing the translation
* (unless the pivot is also translated). */
* (unless the pivot_local is also translated). */
FOREACH_TRANS_DATA_CONTAINER (t, tc) {
float pivot[3];
float pivot_local[3];
if (apply_snap_align_rotation) {
copy_v3_v3(pivot, t->tsnap.snapTarget);
copy_v3_v3(pivot_local, t->tsnap.snapTarget);
/* The pivot has to be in local-space (see T49494) */
if (tc->use_local_mat) {
mul_m4_v3(tc->imat, pivot);
mul_m4_v3(tc->imat, pivot_local);
}
}
TransData *td = tc->data;
for (int i = 0; i < tc->data_len; i++, td++) {
if (td->flag & TD_SKIP) {
continue;
}
float rotate_offset[3] = {0};
bool use_rotate_offset = false;
/* Handle snapping rotation before doing the translation. */
if (apply_snap_align_rotation) {
float mat[3][3];
if (validSnappingNormal(t)) {
const float *original_normal;
/* In pose mode, we want to align normals with Y axis of bones. */
if (t->options & CTX_POSE_BONE) {
original_normal = td->axismtx[1];
}
else {
original_normal = td->axismtx[2];
}
rotation_between_vecs_to_mat3(mat, original_normal, t->tsnap.snapNormal);
}
else {
unit_m3(mat);
}
ElementRotation_ex(t, tc, td, mat, pivot);
if (td->loc) {
use_rotate_offset = true;
sub_v3_v3v3(rotate_offset, td->loc, td->iloc);
if (tc->data_len < TRANSDATA_THREAD_LIMIT) {
TransData *td = tc->data;
for (int i = 0; i < tc->data_len; i++, td++) {
if (td->flag & TD_SKIP) {
continue;
}
transdata_elem_translate(
t, tc, td, pivot_local, vec, apply_snap_align_rotation, is_valid_snapping_normal);
}
if (t->con.applyVec) {
t->con.applyVec(t, tc, td, vec, tvec);
}
else {
copy_v3_v3(tvec, vec);
}
mul_m3_v3(td->smtx, tvec);
if (use_rotate_offset) {
add_v3_v3(tvec, rotate_offset);
}
if (t->options & CTX_GPENCIL_STROKES) {
/* Grease pencil multi-frame falloff. */
bGPDstroke *gps = (bGPDstroke *)td->extra;
if (gps != NULL) {
mul_v3_fl(tvec, td->factor * gps->runtime.multi_frame_falloff);
}
else {
mul_v3_fl(tvec, td->factor);
}
}
else {
/* Proportional editing falloff. */
mul_v3_fl(tvec, td->factor);
}
protectedTransBits(td->protectflag, tvec);
if (td->loc) {
add_v3_v3v3(td->loc, td->iloc, tvec);
}
constraintTransLim(t, td);
}
else {
struct TransDataArgs_Translate data = {
.t = t,
.tc = tc,
.pivot_local = {UNPACK3(pivot_local)},
.vec = {UNPACK3(vec)},
.apply_snap_align_rotation = apply_snap_align_rotation,
.is_valid_snapping_normal = is_valid_snapping_normal,
};
TaskParallelSettings settings;
BLI_parallel_range_settings_defaults(&settings);
BLI_task_parallel_range(0, tc->data_len, &data, transdata_elem_translate_fn, &settings);
}
}
}

View File

@ -52,14 +52,14 @@ typedef struct TransSeqSnapData {
/** \name Snap sources
* \{ */
static int seq_get_snap_source_points_count(SeqCollection *snap_sources)
static int seq_get_snap_source_points_len(SeqCollection *snap_sources)
{
return SEQ_collection_count(snap_sources) * 2;
return SEQ_collection_len(snap_sources) * 2;
}
static void seq_snap_source_points_alloc(TransSeqSnapData *snap_data, SeqCollection *snap_sources)
{
const size_t point_count = seq_get_snap_source_points_count(snap_sources);
const size_t point_count = seq_get_snap_source_points_len(snap_sources);
snap_data->source_snap_points = MEM_callocN(sizeof(int) * point_count, __func__);
memset(snap_data->source_snap_points, 0, sizeof(int));
snap_data->source_snap_point_count = point_count;
@ -70,7 +70,7 @@ static int cmp_fn(const void *a, const void *b)
return (*(int *)a - *(int *)b);
}
static void seq_snap_source_points_build(const TransInfo *t,
static void seq_snap_source_points_build(const TransInfo *UNUSED(t),
TransSeqSnapData *snap_data,
SeqCollection *snap_sources)
{
@ -125,7 +125,7 @@ static SeqCollection *query_snap_targets(const TransInfo *t)
}
static int seq_get_snap_target_points_count(const TransInfo *t,
TransSeqSnapData *snap_data,
TransSeqSnapData *UNUSED(snap_data),
SeqCollection *snap_targets)
{
const short snap_mode = t->tsnap.mode;
@ -136,7 +136,7 @@ static int seq_get_snap_target_points_count(const TransInfo *t,
count += 2;
}
count *= SEQ_collection_count(snap_targets);
count *= SEQ_collection_len(snap_targets);
if (snap_mode & SEQ_SNAP_TO_PLAYHEAD) {
count++;

View File

@ -1357,6 +1357,11 @@ typedef struct NodeSwitch {
uint8_t input_type;
} NodeSwitch;
typedef struct NodeGeometryCurvePrimitiveBezierSegment {
/* GeometryNodeCurvePrimitiveBezierSegmentMode. */
uint8_t mode;
} NodeGeometryCurvePrimitiveBezierSegment;
typedef struct NodeGeometryCurveResample {
/* GeometryNodeCurveSampleMode. */
uint8_t mode;
@ -1889,6 +1894,11 @@ typedef enum GeometryNodeMeshLineCountMode {
GEO_NODE_MESH_LINE_COUNT_RESOLUTION = 1,
} GeometryNodeMeshLineCountMode;
typedef enum GeometryNodeCurvePrimitiveBezierSegmentMode {
GEO_NODE_CURVE_PRIMITIVE_BEZIER_SEGMENT_POSITION = 0,
GEO_NODE_CURVE_PRIMITIVE_BEZIER_SEGMENT_OFFSET = 1,
} GeometryNodeCurvePrimitiveBezierSegmentMode;
typedef enum GeometryNodeCurveSampleMode {
GEO_NODE_CURVE_SAMPLE_COUNT = 0,
GEO_NODE_CURVE_SAMPLE_LENGTH = 1,

View File

@ -1358,9 +1358,9 @@ int RNA_parameter_flag(PropertyRNA *prop);
ParameterList *RNA_parameter_list_create(ParameterList *parms, PointerRNA *ptr, FunctionRNA *func);
void RNA_parameter_list_free(ParameterList *parms);
int RNA_parameter_list_size(ParameterList *parms);
int RNA_parameter_list_arg_count(ParameterList *parms);
int RNA_parameter_list_ret_count(ParameterList *parms);
int RNA_parameter_list_size(const ParameterList *parms);
int RNA_parameter_list_arg_count(const ParameterList *parms);
int RNA_parameter_list_ret_count(const ParameterList *parms);
void RNA_parameter_list_begin(ParameterList *parms, ParameterIterator *iter);
void RNA_parameter_list_next(ParameterIterator *iter);

View File

@ -7357,17 +7357,17 @@ void RNA_parameter_list_free(ParameterList *parms)
parms->func = NULL;
}
int RNA_parameter_list_size(ParameterList *parms)
int RNA_parameter_list_size(const ParameterList *parms)
{
return parms->alloc_size;
}
int RNA_parameter_list_arg_count(ParameterList *parms)
int RNA_parameter_list_arg_count(const ParameterList *parms)
{
return parms->arg_count;
}
int RNA_parameter_list_ret_count(ParameterList *parms)
int RNA_parameter_list_ret_count(const ParameterList *parms)
{
return parms->ret_count;
}

View File

@ -2432,7 +2432,7 @@ static void rna_def_fcurve(BlenderRNA *brna)
prop = RNA_def_property(srna, "mute", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "flag", FCURVE_MUTED);
RNA_def_property_override_flag(prop, PROPOVERRIDE_OVERRIDABLE_LIBRARY);
RNA_def_property_ui_text(prop, "Muted", "Disable F-Curve Modifier evaluation");
RNA_def_property_ui_text(prop, "Muted", "Disable F-Curve evaluation");
RNA_def_property_update(prop, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, "rna_FCurve_update_eval");
prop = RNA_def_property(srna, "hide", PROP_BOOLEAN, PROP_NONE);

View File

@ -8967,6 +8967,33 @@ static void def_geo_boolean(StructRNA *srna)
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update");
}
static void def_geo_curve_primitive_bezier_segment(StructRNA *srna)
{
static const EnumPropertyItem mode_items[] = {
{GEO_NODE_CURVE_PRIMITIVE_BEZIER_SEGMENT_POSITION,
"POSITION",
ICON_NONE,
"Position",
"The start and end handles are fixed positions"},
{GEO_NODE_CURVE_PRIMITIVE_BEZIER_SEGMENT_OFFSET,
"OFFSET",
ICON_NONE,
"Offset",
"The start and end handles are offsets from the spline's control points"},
{0, NULL, 0, NULL, NULL},
};
PropertyRNA *prop;
RNA_def_struct_sdna_from(srna, "NodeGeometryCurvePrimitiveBezierSegment", "storage");
prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_items(prop, mode_items);
RNA_def_property_ui_text(prop, "Mode", "Method used to determine control handles");
RNA_def_property_update(prop, NC_NODE | NA_EDITED, "rna_Node_socket_update");
}
static void def_geo_triangulate(StructRNA *srna)
{
PropertyRNA *prop;

View File

@ -584,7 +584,7 @@ static const SocketPropertyType *get_socket_property_type(const bNodeSocket &bso
return &collection_type;
}
case SOCK_TEXTURE: {
static const SocketPropertyType collection_type = {
static const SocketPropertyType texture_type = {
[](const bNodeSocket &socket, const char *name) {
bNodeSocketValueTexture *value = (bNodeSocketValueTexture *)socket.default_value;
IDPropertyTemplate idprop = {0};
@ -602,10 +602,10 @@ static const SocketPropertyType *get_socket_property_type(const bNodeSocket &bso
*(Tex **)r_value = texture;
},
};
return &collection_type;
return &texture_type;
}
case SOCK_MATERIAL: {
static const SocketPropertyType collection_type = {
static const SocketPropertyType material_type = {
[](const bNodeSocket &socket, const char *name) {
bNodeSocketValueMaterial *value = (bNodeSocketValueMaterial *)socket.default_value;
IDPropertyTemplate idprop = {0};
@ -623,7 +623,7 @@ static const SocketPropertyType *get_socket_property_type(const bNodeSocket &bso
*(Material **)r_value = material;
},
};
return &collection_type;
return &material_type;
}
default: {
return nullptr;

View File

@ -163,7 +163,7 @@ void modifier_vgroup_ui(uiLayout *layout,
* Check whether Modifier is a simulation or not. Used for switching to the
* physics/particles context tab.
*/
static int modifier_is_simulation(ModifierData *md)
static int modifier_is_simulation(const ModifierData *md)
{
/* Physic Tab */
if (ELEM(md->type,

View File

@ -164,6 +164,10 @@ set(SRC
geometry/nodes/node_geo_common.cc
geometry/nodes/node_geo_convex_hull.cc
geometry/nodes/node_geo_curve_length.cc
geometry/nodes/node_geo_curve_primitive_bezier_segment.cc
geometry/nodes/node_geo_curve_primitive_quadratic_bezier.cc
geometry/nodes/node_geo_curve_primitive_spiral.cc
geometry/nodes/node_geo_curve_primitive_star.cc
geometry/nodes/node_geo_curve_to_mesh.cc
geometry/nodes/node_geo_curve_to_points.cc
geometry/nodes/node_geo_curve_resample.cc

View File

@ -52,6 +52,10 @@ void register_node_type_geo_bounding_box(void);
void register_node_type_geo_collection_info(void);
void register_node_type_geo_convex_hull(void);
void register_node_type_geo_curve_length(void);
void register_node_type_geo_curve_primitive_bezier_segment(void);
void register_node_type_geo_curve_primitive_quadratic_bezier(void);
void register_node_type_geo_curve_primitive_spiral(void);
void register_node_type_geo_curve_primitive_star(void);
void register_node_type_geo_curve_to_mesh(void);
void register_node_type_geo_curve_to_points(void);
void register_node_type_geo_curve_resample(void);

View File

@ -291,6 +291,10 @@ DefNode(GeometryNode, GEO_NODE_BOUNDING_BOX, 0, "BOUNDING_BOX", BoundBox, "Bound
DefNode(GeometryNode, GEO_NODE_COLLECTION_INFO, def_geo_collection_info, "COLLECTION_INFO", CollectionInfo, "Collection Info", "")
DefNode(GeometryNode, GEO_NODE_CONVEX_HULL, 0, "CONVEX_HULL", ConvexHull, "Convex Hull", "")
DefNode(GeometryNode, GEO_NODE_CURVE_LENGTH, 0, "CURVE_LENGTH", CurveLength, "Curve Length", "")
DefNode(GeometryNode, GEO_NODE_CURVE_PRIMITIVE_BEZIER_SEGMENT, def_geo_curve_primitive_bezier_segment, "CURVE_PRIMITIVE_BEZIER_SEGMENT", CurvePrimitiveBezierSegment, "Bezier Segment", "")
DefNode(GeometryNode, GEO_NODE_CURVE_PRIMITIVE_QUADRATIC_BEZIER, 0, "CURVE_PRIMITIVE_QUADRATIC_BEZIER", CurveQuadraticBezier, "Quadratic Bezier", "")
DefNode(GeometryNode, GEO_NODE_CURVE_PRIMITIVE_STAR, 0, "CURVE_PRIMITIVE_STAR", CurveStar, "Star", "")
DefNode(GeometryNode, GEO_NODE_CURVE_PRIMITIVE_SPIRAL, 0, "CURVE_PRIMITIVE_SPIRAL", CurveSpiral, "Curve Spiral", "")
DefNode(GeometryNode, GEO_NODE_CURVE_RESAMPLE, def_geo_curve_resample, "CURVE_RESAMPLE", CurveResample, "Resample Curve", "")
DefNode(GeometryNode, GEO_NODE_CURVE_SUBDIVIDE, def_geo_curve_subdivide, "CURVE_SUBDIVIDE", CurveSubdivide, "Curve Subdivide", "")
DefNode(GeometryNode, GEO_NODE_CURVE_TO_MESH, 0, "CURVE_TO_MESH", CurveToMesh, "Curve to Mesh", "")

View File

@ -0,0 +1,149 @@
/*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include "BKE_spline.hh"
#include "UI_interface.h"
#include "UI_resources.h"
#include "node_geometry_util.hh"
static bNodeSocketTemplate geo_node_curve_primitive_bezier_segment_in[] = {
{SOCK_INT, N_("Resolution"), 16.0f, 0.0f, 0.0f, 0.0f, 1, 256, PROP_UNSIGNED},
{SOCK_VECTOR, N_("Start"), -1.0f, 0.0f, 0.0f, 0.0f, -FLT_MAX, FLT_MAX, PROP_TRANSLATION},
{SOCK_VECTOR,
N_("Start Handle"),
-0.5f,
0.5f,
0.0f,
0.0f,
-FLT_MAX,
FLT_MAX,
PROP_TRANSLATION},
{SOCK_VECTOR, N_("End Handle"), 0.0f, 0.0f, 0.0f, 0.0f, -FLT_MAX, FLT_MAX, PROP_TRANSLATION},
{SOCK_VECTOR, N_("End"), 1.0f, 0.0f, 0.0f, 0.0f, -FLT_MAX, FLT_MAX, PROP_TRANSLATION},
{-1, ""},
};
static bNodeSocketTemplate geo_node_curve_primitive_bezier_segment_out[] = {
{SOCK_GEOMETRY, N_("Curve")},
{-1, ""},
};
static void geo_node_curve_primitive_bezier_segment_layout(uiLayout *layout,
bContext *UNUSED(C),
PointerRNA *ptr)
{
uiItemR(layout, ptr, "mode", UI_ITEM_R_EXPAND, nullptr, ICON_NONE);
}
namespace blender::nodes {
static void geo_node_curve_primitive_bezier_segment_init(bNodeTree *UNUSED(tree), bNode *node)
{
NodeGeometryCurvePrimitiveBezierSegment *data = (NodeGeometryCurvePrimitiveBezierSegment *)
MEM_callocN(sizeof(NodeGeometryCurvePrimitiveBezierSegment), __func__);
data->mode = GEO_NODE_CURVE_PRIMITIVE_BEZIER_SEGMENT_POSITION;
node->storage = data;
}
static std::unique_ptr<CurveEval> create_bezier_segment_curve(
const float3 start,
const float3 start_handle_right,
const float3 end,
const float3 end_handle_left,
const int resolution,
const GeometryNodeCurvePrimitiveBezierSegmentMode mode)
{
std::unique_ptr<CurveEval> curve = std::make_unique<CurveEval>();
std::unique_ptr<BezierSpline> spline = std::make_unique<BezierSpline>();
if (mode == GEO_NODE_CURVE_PRIMITIVE_BEZIER_SEGMENT_POSITION) {
spline->add_point(start,
BezierSpline::HandleType::Align,
start - (start_handle_right - start) * -1.0f,
BezierSpline::HandleType::Align,
start_handle_right,
1.0f,
0.0f);
spline->add_point(end,
BezierSpline::HandleType::Align,
end_handle_left,
BezierSpline::HandleType::Align,
end - (end_handle_left - end) * -1.0f,
1.0f,
0.0f);
}
else {
spline->add_point(start,
BezierSpline::HandleType::Align,
start - start_handle_right,
BezierSpline::HandleType::Align,
start + start_handle_right,
1.0f,
0.0f);
spline->add_point(end,
BezierSpline::HandleType::Align,
end + end_handle_left,
BezierSpline::HandleType::Align,
end - end_handle_left,
1.0f,
0.0f);
}
spline->set_resolution(resolution);
spline->attributes.reallocate(spline->size());
curve->add_spline(std::move(spline));
curve->attributes.reallocate(curve->splines().size());
return curve;
}
static void geo_node_curve_primitive_bezier_segment_exec(GeoNodeExecParams params)
{
const NodeGeometryCurvePrimitiveBezierSegment *node_storage =
(NodeGeometryCurvePrimitiveBezierSegment *)params.node().storage;
const GeometryNodeCurvePrimitiveBezierSegmentMode mode =
(const GeometryNodeCurvePrimitiveBezierSegmentMode)node_storage->mode;
std::unique_ptr<CurveEval> curve = create_bezier_segment_curve(
params.extract_input<float3>("Start"),
params.extract_input<float3>("Start Handle"),
params.extract_input<float3>("End"),
params.extract_input<float3>("End Handle"),
std::max(params.extract_input<int>("Resolution"), 1),
mode);
params.set_output("Curve", GeometrySet::create_with_curve(curve.release()));
}
} // namespace blender::nodes
void register_node_type_geo_curve_primitive_bezier_segment()
{
static bNodeType ntype;
geo_node_type_base(
&ntype, GEO_NODE_CURVE_PRIMITIVE_BEZIER_SEGMENT, "Bezier Segment", NODE_CLASS_GEOMETRY, 0);
node_type_socket_templates(&ntype,
geo_node_curve_primitive_bezier_segment_in,
geo_node_curve_primitive_bezier_segment_out);
node_type_init(&ntype, blender::nodes::geo_node_curve_primitive_bezier_segment_init);
node_type_storage(&ntype,
"NodeGeometryCurvePrimitiveBezierSegment",
node_free_standard_storage,
node_copy_standard_storage);
ntype.draw_buttons = geo_node_curve_primitive_bezier_segment_layout;
ntype.geometry_node_execute = blender::nodes::geo_node_curve_primitive_bezier_segment_exec;
nodeRegisterType(&ntype);
}

Some files were not shown because too many files have changed in this diff Show More