[Bf-blender-cvs] [fd0e4bb4e21] temp-node-error-messages: Compile draw_node.c with C++
Hans Goudey
noreply at git.blender.org
Tue Feb 16 04:49:25 CET 2021
Commit: fd0e4bb4e21120e6762d4ea689657e398b659b3d
Author: Hans Goudey
Date: Mon Feb 15 13:27:48 2021 -0600
Branches: temp-node-error-messages
https://developer.blender.org/rBfd0e4bb4e21120e6762d4ea689657e398b659b3d
Compile draw_node.c with C++
===================================================================
M source/blender/editors/gpencil/gpencil_undo.c
M source/blender/editors/include/ED_gpencil.h
M source/blender/editors/include/ED_node.h
M source/blender/editors/space_node/CMakeLists.txt
R095 source/blender/editors/space_node/node_draw.c source/blender/editors/space_node/node_draw.cc
M source/blender/editors/space_node/node_intern.h
===================================================================
diff --git a/source/blender/editors/gpencil/gpencil_undo.c b/source/blender/editors/gpencil/gpencil_undo.c
index 583878883fa..ede1d3eefaa 100644
--- a/source/blender/editors/gpencil/gpencil_undo.c
+++ b/source/blender/editors/gpencil/gpencil_undo.c
@@ -62,19 +62,23 @@ int ED_gpencil_session_active(void)
return (BLI_listbase_is_empty(&undo_nodes) == false);
}
-int ED_undo_gpencil_step(bContext *C, const eUndoStepDir step)
+/**
+ * \param step: eUndoStepDir.
+ */
+int ED_undo_gpencil_step(bContext *C, const int step)
{
bGPdata **gpd_ptr = NULL, *new_gpd = NULL;
gpd_ptr = ED_gpencil_data_get_pointers(C, NULL);
- if (step == STEP_UNDO) {
+ const eUndoStepDir undo_step = (eUndoStepDir)step;
+ if (undo_step == STEP_UNDO) {
if (cur_node->prev) {
cur_node = cur_node->prev;
new_gpd = cur_node->gpd;
}
}
- else if (step == STEP_REDO) {
+ else if (undo_step == STEP_REDO) {
if (cur_node->next) {
cur_node = cur_node->next;
new_gpd = cur_node->gpd;
diff --git a/source/blender/editors/include/ED_gpencil.h b/source/blender/editors/include/ED_gpencil.h
index 12aef6e9464..2fbf280475b 100644
--- a/source/blender/editors/include/ED_gpencil.h
+++ b/source/blender/editors/include/ED_gpencil.h
@@ -62,8 +62,6 @@ struct bAnimContext;
struct wmKeyConfig;
struct wmOperator;
-enum eUndoStepDir;
-
#define GPENCIL_MINIMUM_JOIN_DIST 20.0f
/* Reproject stroke modes. */
@@ -215,7 +213,7 @@ bool ED_gpencil_anim_copybuf_paste(struct bAnimContext *ac, const short copy_mod
/* ------------ Grease-Pencil Undo System ------------------ */
int ED_gpencil_session_active(void);
-int ED_undo_gpencil_step(struct bContext *C, const enum eUndoStepDir step);
+int ED_undo_gpencil_step(struct bContext *C, const int step); /* eUndoStepDir. */
/* ------------ Grease-Pencil Armature ------------------ */
bool ED_gpencil_add_armature(const struct bContext *C,
diff --git a/source/blender/editors/include/ED_node.h b/source/blender/editors/include/ED_node.h
index 78f354a300d..ea2383457c2 100644
--- a/source/blender/editors/include/ED_node.h
+++ b/source/blender/editors/include/ED_node.h
@@ -80,7 +80,7 @@ void ED_node_sample_set(const float col[4]);
void ED_node_draw_snap(
struct View2D *v2d, const float cent[2], float size, NodeBorder border, unsigned int pos);
-/* node_draw.c */
+/* node_draw.cc */
void ED_node_socket_draw(struct bNodeSocket *sock,
const struct rcti *rect,
const float color[4],
diff --git a/source/blender/editors/space_node/CMakeLists.txt b/source/blender/editors/space_node/CMakeLists.txt
index f4a3bb96aeb..c640b076ba4 100644
--- a/source/blender/editors/space_node/CMakeLists.txt
+++ b/source/blender/editors/space_node/CMakeLists.txt
@@ -40,7 +40,7 @@ set(SRC
drawnode.c
node_add.c
node_buttons.c
- node_draw.c
+ node_draw.cc
node_edit.c
node_gizmo.c
node_group.c
diff --git a/source/blender/editors/space_node/node_draw.c b/source/blender/editors/space_node/node_draw.cc
similarity index 95%
rename from source/blender/editors/space_node/node_draw.c
rename to source/blender/editors/space_node/node_draw.cc
index c7be5f848f7..85519e1bde0 100644
--- a/source/blender/editors/space_node/node_draw.c
+++ b/source/blender/editors/space_node/node_draw.cc
@@ -75,8 +75,11 @@
#endif
/* XXX interface.h */
+
+extern "C" {
extern void ui_draw_dropshadow(
const rctf *rct, float radius, float aspect, float alpha, int select);
+}
float ED_node_grid_size(void)
{
@@ -103,13 +106,13 @@ static bNodeTree *node_tree_from_ID(ID *id)
return ntreeFromID(id);
}
- return NULL;
+ return nullptr;
}
void ED_node_tag_update_id(ID *id)
{
bNodeTree *ntree = node_tree_from_ID(id);
- if (id == NULL || ntree == NULL) {
+ if (id == nullptr || ntree == nullptr) {
return;
}
@@ -156,7 +159,7 @@ void ED_node_tag_update_nodetree(Main *bmain, bNodeTree *ntree, bNode *node)
}
bool do_tag_update = true;
- if (node != NULL) {
+ if (node != nullptr) {
if (!node_connected_to_output(bmain, ntree, node)) {
do_tag_update = false;
}
@@ -196,10 +199,10 @@ static bool compare_nodes(const bNode *a, const bNode *b)
}
/* any selected ancestor moves the node forward */
if (parent->flag & NODE_ACTIVE) {
- a_active = 1;
+ a_active = true;
}
if (parent->flag & NODE_SELECT) {
- a_select = 1;
+ a_select = true;
}
}
for (bNode *parent = b->parent; parent; parent = parent->parent) {
@@ -209,10 +212,10 @@ static bool compare_nodes(const bNode *a, const bNode *b)
}
/* any selected ancestor moves the node forward */
if (parent->flag & NODE_ACTIVE) {
- b_active = 1;
+ b_active = true;
}
if (parent->flag & NODE_SELECT) {
- b_select = 1;
+ b_select = true;
}
}
@@ -245,7 +248,7 @@ void ED_node_sort(bNodeTree *ntree)
int k = 1;
while (k < totnodes) {
- bNode *first_a = ntree->nodes.first;
+ bNode *first_a = (bNode *)ntree->nodes.first;
bNode *first_b = first_a;
do {
@@ -254,7 +257,7 @@ void ED_node_sort(bNodeTree *ntree)
first_b = first_b->next;
}
/* all batches merged? */
- if (first_b == NULL) {
+ if (first_b == nullptr) {
break;
}
@@ -281,7 +284,7 @@ void ED_node_sort(bNodeTree *ntree)
first_b = node_b;
for (; b < k; b++) {
/* all nodes sorted? */
- if (first_b == NULL) {
+ if (first_b == nullptr) {
break;
}
first_b = first_b->next;
@@ -399,7 +402,7 @@ static void node_update_basis(const bContext *C, bNodeTree *ntree, bNode *node)
nsock->typeinfo->draw((bContext *)C, row, &sockptr, &nodeptr, IFACE_(socket_label));
UI_block_align_end(node->block);
- UI_block_layout_resolve(node->block, NULL, &buty);
+ UI_block_layout_resolve(node->block, nullptr, &buty);
/* ensure minimum socket height in case layout is empty */
buty = min_ii(buty, dy - NODE_DY);
@@ -488,7 +491,7 @@ static void node_update_basis(const bContext *C, bNodeTree *ntree, bNode *node)
node->typeinfo->draw_buttons(layout, (bContext *)C, &nodeptr);
UI_block_align_end(node->block);
- UI_block_layout_resolve(node->block, NULL, &buty);
+ UI_block_layout_resolve(node->block, nullptr, &buty);
dy = buty - NODE_DYS / 2;
}
@@ -536,7 +539,7 @@ static void node_update_basis(const bContext *C, bNodeTree *ntree, bNode *node)
nsock->typeinfo->draw((bContext *)C, row, &sockptr, &nodeptr, IFACE_(socket_label));
UI_block_align_end(node->block);
- UI_block_layout_resolve(node->block, NULL, &buty);
+ UI_block_layout_resolve(node->block, nullptr, &buty);
/* ensure minimum socket height in case layout is empty */
buty = min_ii(buty, dy - NODE_DY);
@@ -781,7 +784,7 @@ static void node_socket_draw_multi_input(const float color[4],
UI_draw_roundbox_corner_set(UI_CNR_ALL);
UI_draw_roundbox_4fv_ex(
- &rect, color, NULL, 1.0f, color_outline, outline_width, width - outline_width * 0.5f);
+ &rect, color, nullptr, 1.0f, color_outline, outline_width, width - outline_width * 0.5f);
}
static void node_socket_outline_color_get(bool selected, float r_outline_color[4])
@@ -807,7 +810,7 @@ void node_socket_color_get(
sock->typeinfo->draw_color(C, &ptr, node_ptr, r_color);
- bNode *node = node_ptr->data;
+ bNode *node = (bNode *)node_ptr->data;
if (node->flag & NODE_MUTED) {
r_color[3] *= 0.25f;
}
@@ -957,7 +960,7 @@ static void node_draw_preview(bNodePreview *preview, rctf *prv)
preview->rect,
scale,
scale,
- NULL);
+ nullptr);
GPU_blend(GPU_BLEND_NONE);
@@ -977,7 +980,7 @@ static void node_toggle_button_cb(struct bContext *C, void *node_argv, void *op_
/* select & activate only the button's node */
node_select_single(C, node);
- WM_operator_name_call(C, opname, WM_OP_INVOKE_DEFAULT, NULL);
+ WM_operator_name_call(C, opname, WM_OP_INVOKE_DEFAULT, nullptr);
}
void node_draw_shadow(const SpaceNode *snode, const bNode *node, float radius, float alpha)
@@ -1022,7 +1025,7 @@ void node_draw_sockets(const View2D *v2d,
/* set handle size */
float scale;
- UI_view2d_scale_get(v2d, &scale, NULL);
+ UI_view2d_scale_get(v2d, &scale, nullptr);
scale *= 2.25f * NODE_SOCKSIZE;
if (!select_all) {
@@ -1187,9 +1190,9 @@ static void node_draw_basis(const bContext *C,
float iconbutw = 0.8f * UI_UNIT_X;
/* skip if out of view */
- if (BLI_rctf_isect(&node->totr, &v2d->cur, NULL) == false) {
+ if (BLI_rctf_isect(&node->totr, &v2d->cur, nullptr) == false) {
UI_block_end(C, node->block);
- node->block = NULL;
+ node->block = nullptr;
return;
}
@@ -1213,16 +1216,16 @@ static void node_draw_basis(const bContext *C,
rctf *rct = &node->totr;
UI_draw_roundbox_corner_set(UI_CNR_TOP_LEFT | UI_CNR_TOP_RIGHT);
- UI_draw_roundbox_aa(
- &(const rctf){
- .xmin = rct->xmin,
- .xmax = rct->xmax,
- .ymin = rct->ymax - NODE_DY,
- .ymax = rct->ymax,
- },
- true,
- BASIS_RAD,
- color);
+
+ {
+ const rctf backdrop_rect = {
+ rct->xmin,
+ rct->xmax,
+ rct->ymax - NODE_DY,
+ rct->ymax,
+ };
+ UI_draw_roundbox_aa(&backdrop_rect, true, BASIS_RAD, color);
+ }
/* show/hide icons */
float iconofs = rct->xmax - 0.35f * U.widget_unit;
@@ -1239,7 +1242,7 @@ static void node_draw_basis(const bContext *C,
rct->ymax - NODE_DY,
iconbutw,
UI_UNIT_Y,
- NULL,
+ nullptr,
0,
0,
0,
@@ -1266,7 +1269,7 @@ static void node_draw_basis(const bContext *C,
rct->ymax - NODE_DY,
iconbutw,
UI_UNIT_Y,
- NULL,
+ nullptr,
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list