Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/editors')
-rw-r--r--source/blender/editors/animation/anim_filter.c6
-rw-r--r--source/blender/editors/animation/keyframes_draw.c12
-rw-r--r--source/blender/editors/armature/editarmature.c3
-rw-r--r--source/blender/editors/armature/meshlaplacian.c22
-rw-r--r--source/blender/editors/curve/editcurve.c27
-rw-r--r--source/blender/editors/gpencil/gpencil_buttons.c2
-rw-r--r--source/blender/editors/include/ED_anim_api.h2
-rw-r--r--source/blender/editors/include/ED_node.h10
-rw-r--r--source/blender/editors/include/ED_object.h6
-rw-r--r--source/blender/editors/include/ED_transform.h2
-rw-r--r--source/blender/editors/include/UI_view2d.h1
-rw-r--r--source/blender/editors/interface/interface_draw.c6
-rw-r--r--source/blender/editors/interface/resources.c4
-rw-r--r--source/blender/editors/interface/view2d.c48
-rw-r--r--source/blender/editors/io/CMakeLists.txt4
-rw-r--r--source/blender/editors/io/io_collada.c34
-rw-r--r--source/blender/editors/io/io_ops.h2
-rw-r--r--source/blender/editors/mesh/editmesh_knife.c6
-rw-r--r--source/blender/editors/mesh/editmesh_loopcut.c8
-rw-r--r--source/blender/editors/mesh/editmesh_rip.c2
-rw-r--r--source/blender/editors/mesh/editmesh_select.c72
-rw-r--r--source/blender/editors/mesh/editmesh_slide.c4
-rw-r--r--source/blender/editors/mesh/editmesh_tools.c72
-rw-r--r--source/blender/editors/mesh/editmesh_utils.c4
-rw-r--r--source/blender/editors/mesh/meshtools.c20
-rw-r--r--source/blender/editors/object/object_bake.c12
-rw-r--r--source/blender/editors/object/object_edit.c2
-rw-r--r--source/blender/editors/object/object_group.c4
-rw-r--r--source/blender/editors/object/object_modifier.c189
-rw-r--r--source/blender/editors/object/object_select.c2
-rw-r--r--source/blender/editors/screen/screen_ops.c2
-rw-r--r--source/blender/editors/sculpt_paint/paint_image.c4
-rw-r--r--source/blender/editors/sculpt_paint/sculpt.c46
-rw-r--r--source/blender/editors/space_action/action_select.c21
-rw-r--r--source/blender/editors/space_clip/clip_editor.c7
-rw-r--r--source/blender/editors/space_clip/tracking_ops.c9
-rw-r--r--source/blender/editors/space_node/drawnode.c94
-rw-r--r--source/blender/editors/space_node/node_draw.c9
-rw-r--r--source/blender/editors/space_node/node_templates.c152
-rw-r--r--source/blender/editors/space_node/space_node.c316
-rw-r--r--source/blender/editors/space_sequencer/sequencer_buttons.c2
-rw-r--r--source/blender/editors/space_sequencer/sequencer_edit.c7
-rw-r--r--source/blender/editors/space_sequencer/sequencer_select.c4
-rw-r--r--source/blender/editors/space_text/text_ops.c6
-rw-r--r--source/blender/editors/space_userpref/space_userpref.c84
-rw-r--r--source/blender/editors/space_view3d/drawobject.c12
-rw-r--r--source/blender/editors/space_view3d/view3d_draw.c10
-rw-r--r--source/blender/editors/space_view3d/view3d_view.c4
-rw-r--r--source/blender/editors/transform/transform.c27
-rw-r--r--source/blender/editors/transform/transform.h1
-rw-r--r--source/blender/editors/transform/transform_constraints.c18
-rw-r--r--source/blender/editors/transform/transform_conversions.c16
-rw-r--r--source/blender/editors/transform/transform_snap.c278
53 files changed, 1125 insertions, 592 deletions
diff --git a/source/blender/editors/animation/anim_filter.c b/source/blender/editors/animation/anim_filter.c
index c9b0f55740a..7f957d49fa3 100644
--- a/source/blender/editors/animation/anim_filter.c
+++ b/source/blender/editors/animation/anim_filter.c
@@ -2464,13 +2464,15 @@ size_t ANIM_animdata_filter(bAnimContext *ac, ListBase *anim_data, int filter_mo
case ANIMCONT_GPENCIL:
{
- items = animdata_filter_gpencil(anim_data, data, filter_mode);
+ if (animdata_filter_dopesheet_summary(ac, anim_data, filter_mode, &items))
+ items = animdata_filter_gpencil(anim_data, data, filter_mode);
}
break;
case ANIMCONT_MASK:
{
- items = animdata_filter_mask(anim_data, data, filter_mode);
+ if (animdata_filter_dopesheet_summary(ac, anim_data, filter_mode, &items))
+ items = animdata_filter_mask(anim_data, data, filter_mode);
}
break;
diff --git a/source/blender/editors/animation/keyframes_draw.c b/source/blender/editors/animation/keyframes_draw.c
index e6fc4d5a168..46a89963ad9 100644
--- a/source/blender/editors/animation/keyframes_draw.c
+++ b/source/blender/editors/animation/keyframes_draw.c
@@ -847,9 +847,17 @@ void summary_to_keylist(bAnimContext *ac, DLRBT_Tree *keys, DLRBT_Tree *blocks)
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
/* loop through each F-Curve, grabbing the keyframes */
- for (ale = anim_data.first; ale; ale = ale->next)
+ for (ale = anim_data.first; ale; ale = ale->next) {
fcurve_to_keylist(ale->adt, ale->data, keys, blocks);
-
+
+ if (ale->datatype == ALE_MASKLAY) {
+ mask_to_keylist(ac->ads, ale->data, keys);
+ }
+ else if (ale->datatype == ALE_GPFRAME) {
+ gpl_to_keylist(ac->ads, ale->data, keys);
+ }
+ }
+
BLI_freelistN(&anim_data);
}
}
diff --git a/source/blender/editors/armature/editarmature.c b/source/blender/editors/armature/editarmature.c
index ea3c8685525..d4755fc95cd 100644
--- a/source/blender/editors/armature/editarmature.c
+++ b/source/blender/editors/armature/editarmature.c
@@ -4828,6 +4828,9 @@ static void add_verts_to_dgroups(ReportList *reports, Scene *scene, Object *ob,
if (numbones == 0)
return;
+ if (ED_vgroup_data_create(ob->data) == FALSE)
+ return;
+
/* create an array of pointer to bones that are skinnable
* and fill it with all of the skinnable bones */
bonelist = MEM_callocN(numbones * sizeof(Bone *), "bonelist");
diff --git a/source/blender/editors/armature/meshlaplacian.c b/source/blender/editors/armature/meshlaplacian.c
index ab96656406e..6b6d2a1505f 100644
--- a/source/blender/editors/armature/meshlaplacian.c
+++ b/source/blender/editors/armature/meshlaplacian.c
@@ -667,25 +667,27 @@ void heat_bone_weighting(Object *ob, Mesh *me, float (*verts)[3], int numsource,
*err_str = NULL;
/* count triangles and create mask */
- if ( (use_face_sel = (me->editflag & ME_EDIT_PAINT_MASK) != 0) ||
- (use_vert_sel = ((me->editflag & ME_EDIT_VERT_SEL) != 0)))
+ if ((use_face_sel = (me->editflag & ME_EDIT_PAINT_MASK) != 0) ||
+ (use_vert_sel = ((me->editflag & ME_EDIT_VERT_SEL) != 0)))
{
mask = MEM_callocN(sizeof(int) * me->totvert, "heat_bone_weighting mask");
- }
- for (a = 0, mp = me->mpoly; a < me->totpoly; mp++, a++) {
/* (added selectedVerts content for vertex mask, they used to just equal 1) */
if (use_vert_sel) {
- for (j = 0, ml = me->mloop + mp->loopstart; j < mp->totloop; j++, ml++) {
- if (use_vert_sel) {
- mask[ml->v] = (mvert[ml->v].flag & SELECT) != 0;
+ for (a = 0, mp = me->mpoly; a < me->totpoly; mp++, a++) {
+ for (j = 0, ml = me->mloop + mp->loopstart; j < mp->totloop; j++, ml++) {
+ if (use_vert_sel) {
+ mask[ml->v] = (mvert[ml->v].flag & SELECT) != 0;
+ }
}
}
}
else if (use_face_sel) {
- if (mp->flag & ME_FACE_SEL) {
- for (j = 0, ml = me->mloop + mp->loopstart; j < mp->totloop; j++, ml++) {
- mask[ml->v] = 1;
+ for (a = 0, mp = me->mpoly; a < me->totpoly; mp++, a++) {
+ if (mp->flag & ME_FACE_SEL) {
+ for (j = 0, ml = me->mloop + mp->loopstart; j < mp->totloop; j++, ml++) {
+ mask[ml->v] = 1;
+ }
}
}
}
diff --git a/source/blender/editors/curve/editcurve.c b/source/blender/editors/curve/editcurve.c
index 2fa7b4b2126..032b999c60f 100644
--- a/source/blender/editors/curve/editcurve.c
+++ b/source/blender/editors/curve/editcurve.c
@@ -1199,8 +1199,6 @@ void load_editNurb(Object *obedit)
if (obedit == NULL) return;
- set_actNurb(obedit, NULL);
-
if (ELEM(obedit->type, OB_CURVE, OB_SURF)) {
Curve *cu = obedit->data;
Nurb *nu, *newnu;
@@ -1222,8 +1220,6 @@ void load_editNurb(Object *obedit)
BKE_nurbList_free(&oldnurb);
}
-
- set_actNurb(obedit, NULL);
}
/* make copy in cu->editnurb */
@@ -1234,7 +1230,6 @@ void make_editNurb(Object *obedit)
Nurb *nu, *newnu, *nu_act = NULL;
KeyBlock *actkey;
-
set_actNurb(obedit, NULL);
if (ELEM(obedit->type, OB_CURVE, OB_SURF)) {
@@ -3937,7 +3932,6 @@ static int make_segment_exec(bContext *C, wmOperator *op)
ListBase *nubase = object_editcurve_get(obedit);
Nurb *nu, *nu1 = NULL, *nu2 = NULL;
BPoint *bp;
- float *fp, offset;
int a, ok = 0;
/* first decide if this is a surface merge! */
@@ -4053,25 +4047,12 @@ static int make_segment_exec(bContext *C, wmOperator *op)
/* now join the knots */
if (nu1->type == CU_NURBS) {
- if (nu1->knotsu == NULL) {
- BKE_nurb_knot_calc_u(nu1);
- }
- else {
- fp = MEM_mallocN(sizeof(float) * KNOTSU(nu1), "addsegment3");
- memcpy(fp, nu1->knotsu, sizeof(float) * a);
+ if (nu1->knotsu != NULL) {
MEM_freeN(nu1->knotsu);
- nu1->knotsu = fp;
-
-
- offset = nu1->knotsu[a - 1] + 1.0f;
- fp = nu1->knotsu + a;
- for (a = 0; a < nu2->pntsu; a++, fp++) {
- if (nu2->knotsu)
- *fp = offset + nu2->knotsu[a + 1];
- else
- *fp = offset;
- }
+ nu1->knotsu = NULL;
}
+
+ BKE_nurb_knot_calc_u(nu1);
}
BKE_nurb_free(nu2); nu2 = NULL;
}
diff --git a/source/blender/editors/gpencil/gpencil_buttons.c b/source/blender/editors/gpencil/gpencil_buttons.c
index dabc0ad1081..d90ec02b0c1 100644
--- a/source/blender/editors/gpencil/gpencil_buttons.c
+++ b/source/blender/editors/gpencil/gpencil_buttons.c
@@ -126,7 +126,7 @@ static void gp_drawui_layer(uiLayout *layout, bGPdata *gpd, bGPDlayer *gpl, cons
block = uiLayoutGetBlock(sub);
icon = (gpl->flag & GP_LAYER_ACTIVE) ? ICON_RADIOBUT_ON : ICON_RADIOBUT_OFF;
but = uiDefIconButBitI(block, TOG, GP_LAYER_ACTIVE, 0, icon, 0, 0, UI_UNIT_X, UI_UNIT_Y,
- &gpd->flag, 0.0, 0.0, 0.0, 0.0, TIP_("Set active layer"));
+ &gpl->flag, 0.0, 0.0, 0.0, 0.0, TIP_("Set active layer"));
uiButSetFunc(but, gp_ui_activelayer_cb, gpd, gpl);
/* locked */
diff --git a/source/blender/editors/include/ED_anim_api.h b/source/blender/editors/include/ED_anim_api.h
index 7afa9fe8bc5..fbddd26c959 100644
--- a/source/blender/editors/include/ED_anim_api.h
+++ b/source/blender/editors/include/ED_anim_api.h
@@ -178,7 +178,7 @@ typedef enum eAnim_KeyType {
ALE_NONE = 0, /* no keyframe data */
ALE_FCURVE, /* F-Curve */
ALE_GPFRAME, /* Grease Pencil Frames */
- ALE_MASKLAY, /* Mask */
+ ALE_MASKLAY, /* Mask */
ALE_NLASTRIP, /* NLA Strips */
ALE_ALL, /* All channels summary */
diff --git a/source/blender/editors/include/ED_node.h b/source/blender/editors/include/ED_node.h
index 0979e3ec92b..6f86d01fb98 100644
--- a/source/blender/editors/include/ED_node.h
+++ b/source/blender/editors/include/ED_node.h
@@ -41,10 +41,20 @@ struct bNodeTree;
struct bNode;
struct bNodeTree;
struct ScrArea;
+struct View2D;
+
+typedef enum {
+ NODE_TOP = 1,
+ NODE_BOTTOM = 2,
+ NODE_LEFT = 4,
+ NODE_RIGHT = 8
+} NodeBorder;
/* drawnode.c */
void ED_init_node_butfuncs(void);
+void drawnodesnap(struct View2D *v2d, const float cent[2], float size, NodeBorder border);
+
/* node_draw.c */
void ED_node_tree_update(struct SpaceNode *snode, struct Scene *scene);
void ED_node_changed_update(struct ID *id, struct bNode *node);
diff --git a/source/blender/editors/include/ED_object.h b/source/blender/editors/include/ED_object.h
index 9c10a270ef8..9209bbb2db7 100644
--- a/source/blender/editors/include/ED_object.h
+++ b/source/blender/editors/include/ED_object.h
@@ -176,6 +176,12 @@ int ED_object_modifier_apply(struct ReportList *reports, struct Scene *scene,
struct Object *ob, struct ModifierData *md, int mode);
int ED_object_modifier_copy(struct ReportList *reports, struct Object *ob, struct ModifierData *md);
+int ED_object_iter_other(struct Main *bmain, struct Object *orig_ob, int include_orig,
+ int (*callback)(struct Object *ob, void *callback_data),
+ void *callback_data);
+
+int ED_object_multires_update_totlevels_cb(struct Object *ob, void *totlevel_v);
+
#ifdef __cplusplus
}
#endif
diff --git a/source/blender/editors/include/ED_transform.h b/source/blender/editors/include/ED_transform.h
index 608df8dd9b3..d7e9fc323a6 100644
--- a/source/blender/editors/include/ED_transform.h
+++ b/source/blender/editors/include/ED_transform.h
@@ -180,6 +180,8 @@ int peelObjectsTransForm(struct TransInfo *t, struct ListBase *depth_peels, cons
int peelObjectsContext(struct bContext *C, struct ListBase *depth_peels, const float mval[2], SnapMode mode);
int snapObjectsTransform(struct TransInfo *t, const float mval[2], int *r_dist, float r_loc[3], float r_no[3], SnapMode mode);
int snapObjectsContext(struct bContext *C, const float mval[2], int *r_dist, float r_loc[3], float r_no[3], SnapMode mode);
+int snapNodesTransform(struct TransInfo *t, const int mval[2], int *r_dist, float r_loc[2], char *r_node_border, SnapMode mode);
+int snapNodesContext(struct bContext *C, const int mval[2], int *r_dist, float r_loc[2], char *r_node_border, SnapMode mode);
#endif
diff --git a/source/blender/editors/include/UI_view2d.h b/source/blender/editors/include/UI_view2d.h
index 469388219d6..5039a30b61a 100644
--- a/source/blender/editors/include/UI_view2d.h
+++ b/source/blender/editors/include/UI_view2d.h
@@ -166,6 +166,7 @@ void UI_view2d_view_restore(const struct bContext *C);
View2DGrid *UI_view2d_grid_calc(struct Scene *scene, struct View2D *v2d, short xunits, short xclamp, short yunits, short yclamp, int winx, int winy);
void UI_view2d_grid_draw(struct View2D *v2d, View2DGrid *grid, int flag);
void UI_view2d_constant_grid_draw(struct View2D *v2d);
+void UI_view2d_multi_grid_draw(struct View2D *v2d, float step, int level_size, int totlevels);
void UI_view2d_grid_size(View2DGrid *grid, float *r_dx, float *r_dy);
void UI_view2d_grid_free(View2DGrid *grid);
diff --git a/source/blender/editors/interface/interface_draw.c b/source/blender/editors/interface/interface_draw.c
index c14e27562b4..f173e7ce630 100644
--- a/source/blender/editors/interface/interface_draw.c
+++ b/source/blender/editors/interface/interface_draw.c
@@ -1376,9 +1376,11 @@ void ui_draw_but_CURVE(ARegion *ar, uiBut *but, uiWidgetColors *wcol, rcti *rect
ui_draw_gradient(&grid, col, UI_GRAD_H, 1.0f);
/* grid, hsv uses different grid */
- gl_shaded_color((unsigned char *)wcol->inner, -16);
- /* TODO, grid lines does not line up with colors, need to look into this */
+ glEnable(GL_BLEND);
+ glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+ glColor4ub(0, 0, 0, 48);
ui_draw_but_curve_grid(rect, zoomx, zoomy, offsx, offsy, 0.1666666f);
+ glDisable(GL_BLEND);
}
else {
if (cumap->flag & CUMA_DO_CLIP) {
diff --git a/source/blender/editors/interface/resources.c b/source/blender/editors/interface/resources.c
index e5a10dc9201..b202672a2c7 100644
--- a/source/blender/editors/interface/resources.c
+++ b/source/blender/editors/interface/resources.c
@@ -1894,8 +1894,8 @@ void init_userdef_do_versions(void)
rgba_char_args_set(btheme->tact.anim_active, 204, 112, 26, 102);
/* NLA Colors */
- rgba_char_args_set(btheme->tnla.anim_active, 204, 112, 26, 102); /* same as dopesheet above */
- rgba_char_args_set(btheme->tnla.anim_non_active,153, 135, 97, 77);
+ rgba_char_args_set(btheme->tnla.anim_active, 204, 112, 26, 102); /* same as dopesheet above */
+ rgba_char_args_set(btheme->tnla.anim_non_active, 153, 135, 97, 77);
rgba_char_args_set(btheme->tnla.nla_tweaking, 77, 243, 26, 77);
rgba_char_args_set(btheme->tnla.nla_tweakdupli, 217, 0, 0, 255);
diff --git a/source/blender/editors/interface/view2d.c b/source/blender/editors/interface/view2d.c
index 51e1b30f0bf..6dbf53cba72 100644
--- a/source/blender/editors/interface/view2d.c
+++ b/source/blender/editors/interface/view2d.c
@@ -1328,6 +1328,54 @@ void UI_view2d_constant_grid_draw(View2D *v2d)
glEnd();
}
+/* Draw a multi-level grid in given 2d-region */
+void UI_view2d_multi_grid_draw(View2D *v2d, float step, int level_size, int totlevels)
+{
+ int offset = -10;
+ float lstep = step;
+ int level;
+
+ for (level = 0; level < totlevels; ++level) {
+ int i;
+ float start;
+
+ UI_ThemeColorShade(TH_BACK, offset);
+
+ i = (v2d->cur.xmin >= 0.0f ? -(int)(-v2d->cur.xmin / lstep) : (int)(v2d->cur.xmin / lstep));
+ start = i * lstep;
+
+ glBegin(GL_LINES);
+ for (; start < v2d->cur.xmax; start += lstep, ++i) {
+ if (i == 0 || (level < totlevels - 1 && i % level_size == 0))
+ continue;
+ glVertex2f(start, v2d->cur.ymin);
+ glVertex2f(start, v2d->cur.ymax);
+ }
+
+ i = (v2d->cur.ymin >= 0.0f ? -(int)(-v2d->cur.ymin / lstep) : (int)(v2d->cur.ymin / lstep));
+ start = i * lstep;
+
+ for (; start < v2d->cur.ymax; start += lstep, ++i) {
+ if (i == 0 || (level < totlevels - 1 && i % level_size == 0))
+ continue;
+ glVertex2f(v2d->cur.xmin, start);
+ glVertex2f(v2d->cur.xmax, start);
+ }
+
+ /* X and Y axis */
+ UI_ThemeColorShade(TH_BACK, offset - 8);
+ glVertex2f(0.0f, v2d->cur.ymin);
+ glVertex2f(0.0f, v2d->cur.ymax);
+ glVertex2f(v2d->cur.xmin, 0.0f);
+ glVertex2f(v2d->cur.xmax, 0.0f);
+
+ glEnd();
+
+ lstep *= level_size;
+ offset -= 6;
+ }
+}
+
/* the price we pay for not exposting structs :( */
void UI_view2d_grid_size(View2DGrid *grid, float *r_dx, float *r_dy)
{
diff --git a/source/blender/editors/io/CMakeLists.txt b/source/blender/editors/io/CMakeLists.txt
index 0c417c5dfb9..7db23041c88 100644
--- a/source/blender/editors/io/CMakeLists.txt
+++ b/source/blender/editors/io/CMakeLists.txt
@@ -31,6 +31,10 @@ set(INC
../../collada
)
+set(INC_SYS
+
+)
+
set(SRC
io_collada.c
io_ops.c
diff --git a/source/blender/editors/io/io_collada.c b/source/blender/editors/io/io_collada.c
index dca38e53934..20ac3333115 100644
--- a/source/blender/editors/io/io_collada.c
+++ b/source/blender/editors/io/io_collada.c
@@ -24,7 +24,7 @@
* ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editors/io/collada.c
+/** \file blender/editors/io/io_collada.c
* \ingroup collada
*/
#ifdef WITH_COLLADA
@@ -157,59 +157,59 @@ void uiCollada_exportSettings(uiLayout *layout, PointerRNA *imfptr)
row = uiLayoutRow(box, 0);
split = uiLayoutSplit(row, 0.6f, UI_LAYOUT_ALIGN_RIGHT);
- col = uiLayoutColumn(split,0);
+ col = uiLayoutColumn(split, FALSE);
uiItemR(col, imfptr, "apply_modifiers", 0, NULL, ICON_NONE);
- col = uiLayoutColumn(split,0);
+ col = uiLayoutColumn(split, FALSE);
uiItemR(col, imfptr, "export_mesh_type_selection", 0, "", ICON_NONE);
uiLayoutSetEnabled(col, RNA_boolean_get(imfptr, "apply_modifiers"));
- row = uiLayoutRow(box, 0);
+ row = uiLayoutRow(box, FALSE);
uiItemR(row, imfptr, "selected", 0, NULL, ICON_NONE);
- row = uiLayoutRow(box, 0);
+ row = uiLayoutRow(box, FALSE);
uiItemR(row, imfptr, "include_children", 0, NULL, ICON_NONE);
uiLayoutSetEnabled(row, RNA_boolean_get(imfptr, "selected"));
- row = uiLayoutRow(box, 0);
+ row = uiLayoutRow(box, FALSE);
uiItemR(row, imfptr, "include_armatures", 0, NULL, ICON_NONE);
uiLayoutSetEnabled(row, RNA_boolean_get(imfptr, "selected"));
// Texture options
box = uiLayoutBox(layout);
- row = uiLayoutRow(box, 0);
+ row = uiLayoutRow(box, FALSE);
uiItemL(row, IFACE_("Texture Options:"), ICON_TEXTURE_DATA);
- row = uiLayoutRow(box, 0);
+ row = uiLayoutRow(box, FALSE);
uiItemR(row, imfptr, "active_uv_only", 0, NULL, ICON_NONE);
- row = uiLayoutRow(box, 0);
+ row = uiLayoutRow(box, FALSE);
uiItemR(row, imfptr, "include_uv_textures", 0, NULL, ICON_NONE);
- row = uiLayoutRow(box, 0);
+ row = uiLayoutRow(box, FALSE);
uiItemR(row, imfptr, "include_material_textures", 0, NULL, ICON_NONE);
- row = uiLayoutRow(box, 0);
+ row = uiLayoutRow(box, FALSE);
uiItemR(row, imfptr, "use_texture_copies", 1, NULL, ICON_NONE);
// Armature options
box = uiLayoutBox(layout);
- row = uiLayoutRow(box, 0);
+ row = uiLayoutRow(box, FALSE);
uiItemL(row, IFACE_("Armature Options:"), ICON_ARMATURE_DATA);
- row = uiLayoutRow(box, 0);
+ row = uiLayoutRow(box, FALSE);
uiItemR(row, imfptr, "deform_bones_only", 0, NULL, ICON_NONE);
- row = uiLayoutRow(box, 0);
+ row = uiLayoutRow(box, FALSE);
uiItemR(row, imfptr, "second_life", 0, NULL, ICON_NONE);
/* Collada options: */
box = uiLayoutBox(layout);
- row = uiLayoutRow(box, 0);
+ row = uiLayoutRow(box, FALSE);
uiItemL(row, IFACE_("Collada Options:"), ICON_MODIFIER);
- row = uiLayoutRow(box, 0);
+ row = uiLayoutRow(box, FALSE);
uiItemR(row, imfptr, "use_object_instantiation", 0, NULL, ICON_NONE);
- row = uiLayoutRow(box, 0);
+ row = uiLayoutRow(box, FALSE);
uiItemR(row, imfptr, "sort_by_name", 0, NULL, ICON_NONE);
}
diff --git a/source/blender/editors/io/io_ops.h b/source/blender/editors/io/io_ops.h
index 1e2c4443e43..4c04b349655 100644
--- a/source/blender/editors/io/io_ops.h
+++ b/source/blender/editors/io/io_ops.h
@@ -24,7 +24,7 @@
* ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/editor/io/io_collada.h
+/** \file blender/editor/io/io_ops.h
* \ingroup editor/io
*/
diff --git a/source/blender/editors/mesh/editmesh_knife.c b/source/blender/editors/mesh/editmesh_knife.c
index 898399f723d..2ceb8aeef26 100644
--- a/source/blender/editors/mesh/editmesh_knife.c
+++ b/source/blender/editors/mesh/editmesh_knife.c
@@ -2007,9 +2007,9 @@ static void knifenet_fill_faces(KnifeTool_OpData *kcd)
remerge_faces(kcd);
/* delete left over faces */
- BMO_op_callf(bm, "del geom=%ff context=%i", DEL, DEL_ONLYFACES);
- BMO_op_callf(bm, "del geom=%fe context=%i", DEL, DEL_EDGES);
- BMO_op_callf(bm, "del geom=%fv context=%i", DEL, DEL_VERTS);
+ BMO_op_callf(bm, "delete geom=%ff context=%i", DEL, DEL_ONLYFACES);
+ BMO_op_callf(bm, "delete geom=%fe context=%i", DEL, DEL_EDGES);
+ BMO_op_callf(bm, "delete geom=%fv context=%i", DEL, DEL_VERTS);
if (face_nets)
MEM_freeN(face_nets);
diff --git a/source/blender/editors/mesh/editmesh_loopcut.c b/source/blender/editors/mesh/editmesh_loopcut.c
index 15e3033b7eb..eb2aabd88b8 100644
--- a/source/blender/editors/mesh/editmesh_loopcut.c
+++ b/source/blender/editors/mesh/editmesh_loopcut.c
@@ -313,10 +313,13 @@ static void ringsel_finish(bContext *C, wmOperator *op)
edgering_sel(lcd, cuts, 1);
if (lcd->do_cut) {
+ /* Enable gridfill, so that intersecting loopcut works as one would expect.
+ * Note though that it will break edgeslide in this specific case.
+ * See [#31939]. */
BM_mesh_esubdivide(em->bm, BM_ELEM_SELECT,
0.0f, 0.0f, 0.0f,
cuts,
- SUBDIV_SELECT_LOOPCUT, SUBD_PATH, 0, FALSE, 0);
+ SUBDIV_SELECT_LOOPCUT, SUBD_PATH, 0, TRUE, 0);
/* force edge slide to edge select mode in in face select mode */
if (em->selectmode & SCE_SELECT_FACE) {
@@ -336,7 +339,8 @@ static void ringsel_finish(bContext *C, wmOperator *op)
DAG_id_tag_update(lcd->ob->data, 0);
}
else {
-
+ /* XXX Is this piece of code ever used now? Simple loop select is now
+ * in editmesh_select.c (around line 1000)... */
/* sets as active, useful for other tools */
if (em->selectmode & SCE_SELECT_VERTEX)
BM_select_history_store(em->bm, lcd->eed->v1); /* low priority TODO, get vertrex close to mouse */
diff --git a/source/blender/editors/mesh/editmesh_rip.c b/source/blender/editors/mesh/editmesh_rip.c
index 1bcd5cee111..f71ec56ca5f 100644
--- a/source/blender/editors/mesh/editmesh_rip.c
+++ b/source/blender/editors/mesh/editmesh_rip.c
@@ -347,7 +347,7 @@ static int edbm_rip_call_edgesplit(BMEditMesh *em, wmOperator *op)
{
BMOperator bmop;
- if (!EDBM_op_init(em, &bmop, op, "edgesplit edges=%he verts=%hv use_verts=%b",
+ if (!EDBM_op_init(em, &bmop, op, "split_edges edges=%he verts=%hv use_verts=%b",
BM_ELEM_TAG, BM_ELEM_SELECT, TRUE))
{
return FALSE;
diff --git a/source/blender/editors/mesh/editmesh_select.c b/source/blender/editors/mesh/editmesh_select.c
index 6940b05e86c..fa637b6d6ce 100644
--- a/source/blender/editors/mesh/editmesh_select.c
+++ b/source/blender/editors/mesh/editmesh_select.c
@@ -712,7 +712,7 @@ static int similar_face_select_exec(bContext *C, wmOperator *op)
float thresh = RNA_float_get(op->ptr, "threshold");
/* initialize the bmop using EDBM api, which does various ui error reporting and other stuff */
- EDBM_op_init(em, &bmop, op, "similarfaces faces=%hf type=%i thresh=%f", BM_ELEM_SELECT, type, thresh);
+ EDBM_op_init(em, &bmop, op, "similar_faces faces=%hf type=%i thresh=%f", BM_ELEM_SELECT, type, thresh);
/* execute the operator */
BMO_op_exec(em->bm, &bmop);
@@ -750,7 +750,7 @@ static int similar_edge_select_exec(bContext *C, wmOperator *op)
float thresh = RNA_float_get(op->ptr, "threshold");
/* initialize the bmop using EDBM api, which does various ui error reporting and other stuff */
- EDBM_op_init(em, &bmop, op, "similaredges edges=%he type=%i thresh=%f", BM_ELEM_SELECT, type, thresh);
+ EDBM_op_init(em, &bmop, op, "similar_edges edges=%he type=%i thresh=%f", BM_ELEM_SELECT, type, thresh);
/* execute the operator */
BMO_op_exec(em->bm, &bmop);
@@ -791,7 +791,7 @@ static int similar_vert_select_exec(bContext *C, wmOperator *op)
float thresh = RNA_float_get(op->ptr, "threshold");
/* initialize the bmop using EDBM api, which does various ui error reporting and other stuff */
- EDBM_op_init(em, &bmop, op, "similarverts verts=%hv type=%i thresh=%f", BM_ELEM_SELECT, type, thresh);
+ EDBM_op_init(em, &bmop, op, "similar_verts verts=%hv type=%i thresh=%f", BM_ELEM_SELECT, type, thresh);
/* execute the operator */
BMO_op_exec(em->bm, &bmop);
@@ -1003,12 +1003,13 @@ static void mouse_mesh_loop(bContext *C, int mval[2], short extend, short ring)
BMEdge *eed;
int select = TRUE;
int dist = 50;
-
+ float mvalf[2];
+
em_setup_viewcontext(C, &vc);
- vc.mval[0] = mval[0];
- vc.mval[1] = mval[1];
+ mvalf[0] = (float)(vc.mval[0] = mval[0]);
+ mvalf[1] = (float)(vc.mval[1] = mval[1]);
em = vc.em;
-
+
/* no afterqueue (yet), so we check it now, otherwise the bm_xxxofs indices are bad */
view3d_validate_backbuf(&vc);
@@ -1043,26 +1044,59 @@ static void mouse_mesh_loop(bContext *C, int mval[2], short extend, short ring)
}
EDBM_selectmode_flush(em);
-// if (EM_texFaceCheck())
-
+
/* sets as active, useful for other tools */
-#if 0
if (select) {
if (em->selectmode & SCE_SELECT_VERTEX) {
- /* TODO: would be nice if the edge vertex chosen here
- * was the one closer to the selection pointer, instead
- * of arbitrarily selecting the first one */
- BM_select_history_store(em->bm, eed->v1);
+ /* Find nearest vert from mouse. */
+ float v1_co[2], v2_co[2];
+
+ /* We can't be sure this has already been set... */
+ ED_view3d_init_mats_rv3d(vc.obedit, vc.rv3d);
+ project_float_noclip(vc.ar, eed->v1->co, v1_co);
+ project_float_noclip(vc.ar, eed->v2->co, v2_co);
+#if 0
+ printf("mouse to v1: %f\nmouse to v2: %f\n", len_squared_v2v2(mvalf, v1_co),
+ len_squared_v2v2(mvalf, v2_co));
+#endif
+ if (len_squared_v2v2(mvalf, v1_co) < len_squared_v2v2(mvalf, v2_co))
+ BM_select_history_store(em->bm, eed->v1);
+ else
+ BM_select_history_store(em->bm, eed->v2);
}
else if (em->selectmode & SCE_SELECT_EDGE) {
BM_select_history_store(em->bm, eed);
}
- /* TODO: would be nice if the nearest face that
- * belongs to the selected edge could be set to
- * active here in face select mode */
+ else if (em->selectmode & SCE_SELECT_FACE) {
+ /* Select the face of eed which is the nearest of mouse. */
+ BMFace *f, *efa = NULL;
+ BMIter iterf;
+ float best_dist = MAXFLOAT;
+
+ /* We can't be sure this has already been set... */
+ ED_view3d_init_mats_rv3d(vc.obedit, vc.rv3d);
+
+ BM_ITER_ELEM(f, &iterf, eed, BM_FACES_OF_EDGE) {
+ if (BM_elem_flag_test(f, BM_ELEM_SELECT)) {
+ float cent[3];
+ float co[2], tdist;
+
+ BM_face_calc_center_mean(f, cent);
+ project_float_noclip(vc.ar, cent, co);
+ tdist = len_squared_v2v2(mvalf, co);
+ if (tdist < best_dist) {
+/* printf("Best face: %p (%f)\n", f, tdist);*/
+ best_dist = tdist;
+ efa = f;
+ }
+ }
+ }
+ if (efa) {
+ BM_active_face_set(em->bm, efa);
+ BM_select_history_store(em->bm, efa);
+ }
+ }
}
-#endif
- mouse_mesh(C, mval, select, TRUE, FALSE);
WM_event_add_notifier(C, NC_GEOM | ND_SELECT, vc.obedit);
}
diff --git a/source/blender/editors/mesh/editmesh_slide.c b/source/blender/editors/mesh/editmesh_slide.c
index a86a274eb70..f08c229d38a 100644
--- a/source/blender/editors/mesh/editmesh_slide.c
+++ b/source/blender/editors/mesh/editmesh_slide.c
@@ -211,7 +211,7 @@ static void vtx_slide_confirm(bContext *C, wmOperator *op)
if (other_d < vso->snap_threshold) {
BM_vert_select_set(bm, other, TRUE);
BM_vert_select_set(bm, vso->start_vtx, TRUE);
- EDBM_op_callf(em, op, "pointmerge verts=%hv mergeco=%v", BM_ELEM_SELECT, other->co);
+ EDBM_op_callf(em, op, "pointmerge verts=%hv merge_co=%v", BM_ELEM_SELECT, other->co);
EDBM_flag_disable_all(em, BM_ELEM_SELECT);
}
else {
@@ -687,7 +687,7 @@ static int edbm_vertex_slide_exec(bContext *C, wmOperator *op)
/* Prepare operator */
if (!EDBM_op_init(em, &bmop, op,
- "vertex_slide vert=%e edge=%hev distance_t=%f",
+ "slide_vert vert=%e edge=%hev distance_t=%f",
start_vert, BM_ELEM_SELECT, distance_t))
{
return OPERATOR_CANCELLED;
diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c
index 09475db0ed2..3e68e18d956 100644
--- a/source/blender/editors/mesh/editmesh_tools.c
+++ b/source/blender/editors/mesh/editmesh_tools.c
@@ -172,7 +172,7 @@ void EMBM_project_snap_verts(bContext *C, ARegion *ar, Object *obedit, BMEditMes
/* individual face extrude */
/* will use vertex normals for extrusion directions, so *nor is unaffected */
-static short edbm_extrude_face_indiv(BMEditMesh *em, wmOperator *op, const char hflag, float *UNUSED(nor))
+static short edbm_extrude_discrete_faces(BMEditMesh *em, wmOperator *op, const char hflag, float *UNUSED(nor))
{
BMOIter siter;
BMIter liter;
@@ -180,7 +180,7 @@ static short edbm_extrude_face_indiv(BMEditMesh *em, wmOperator *op, const char
BMLoop *l;
BMOperator bmop;
- EDBM_op_init(em, &bmop, op, "extrude_face_indiv faces=%hf", hflag);
+ EDBM_op_init(em, &bmop, op, "extrude_discrete_faces faces=%hf", hflag);
/* deselect original verts */
EDBM_flag_disable_all(em, BM_ELEM_SELECT);
@@ -473,7 +473,7 @@ static int edbm_extrude_mesh(Scene *scene, Object *obedit, BMEditMesh *em, wmOpe
else if (nr == 1) transmode = edbm_extrude_edge(obedit, em, BM_ELEM_SELECT, nor);
else if (nr == 4) transmode = edbm_extrude_verts_indiv(em, op, BM_ELEM_SELECT, nor);
else if (nr == 3) transmode = edbm_extrude_edges_indiv(em, op, BM_ELEM_SELECT, nor);
- else transmode = edbm_extrude_face_indiv(em, op, BM_ELEM_SELECT, nor);
+ else transmode = edbm_extrude_discrete_faces(em, op, BM_ELEM_SELECT, nor);
if (transmode == 0) {
BKE_report(op->reports, RPT_ERROR, "Not a valid selection for extrude");
@@ -614,7 +614,7 @@ static int edbm_extrude_faces_exec(bContext *C, wmOperator *op)
BMEditMesh *em = BMEdit_FromObject(obedit);
float nor[3];
- edbm_extrude_face_indiv(em, op, BM_ELEM_SELECT, nor);
+ edbm_extrude_discrete_faces(em, op, BM_ELEM_SELECT, nor);
EDBM_update_generic(C, em, TRUE);
@@ -853,7 +853,7 @@ static int edbm_dupli_extrude_cursor_invoke(bContext *C, wmOperator *op, wmEvent
invert_m4_m4(vc.obedit->imat, vc.obedit->obmat);
mul_m4_v3(vc.obedit->imat, min); // back in object space
- EDBM_op_init(vc.em, &bmop, op, "makevert co=%v", min);
+ EDBM_op_init(vc.em, &bmop, op, "create_vert co=%v", min);
BMO_op_exec(vc.em->bm, &bmop);
BMO_ITER (v1, &oiter, vc.em->bm, &bmop, "newvertout", BM_VERT) {
@@ -912,24 +912,24 @@ static int edbm_delete_exec(bContext *C, wmOperator *op)
int type = RNA_enum_get(op->ptr, "type");
if (type == 0) {
- if (!EDBM_op_callf(em, op, "del geom=%hv context=%i", BM_ELEM_SELECT, DEL_VERTS)) /* Erase Vertices */
+ if (!EDBM_op_callf(em, op, "delete geom=%hv context=%i", BM_ELEM_SELECT, DEL_VERTS)) /* Erase Vertices */
return OPERATOR_CANCELLED;
}
else if (type == 1) {
- if (!EDBM_op_callf(em, op, "del geom=%he context=%i", BM_ELEM_SELECT, DEL_EDGES)) /* Erase Edges */
+ if (!EDBM_op_callf(em, op, "delete geom=%he context=%i", BM_ELEM_SELECT, DEL_EDGES)) /* Erase Edges */
return OPERATOR_CANCELLED;
}
else if (type == 2) {
- if (!EDBM_op_callf(em, op, "del geom=%hf context=%i", BM_ELEM_SELECT, DEL_FACES)) /* Erase Faces */
+ if (!EDBM_op_callf(em, op, "delete geom=%hf context=%i", BM_ELEM_SELECT, DEL_FACES)) /* Erase Faces */
return OPERATOR_CANCELLED;
}
else if (type == 3) {
- if (!EDBM_op_callf(em, op, "del geom=%hef context=%i", BM_ELEM_SELECT, DEL_EDGESFACES)) /* Edges and Faces */
+ if (!EDBM_op_callf(em, op, "delete geom=%hef context=%i", BM_ELEM_SELECT, DEL_EDGESFACES)) /* Edges and Faces */
return OPERATOR_CANCELLED;
}
else if (type == 4) {
//"Erase Only Faces";
- if (!EDBM_op_callf(em, op, "del geom=%hf context=%i",
+ if (!EDBM_op_callf(em, op, "delete geom=%hf context=%i",
BM_ELEM_SELECT, DEL_ONLYFACES))
{
return OPERATOR_CANCELLED;
@@ -1197,7 +1197,7 @@ static int edbm_vert_connect(bContext *C, wmOperator *op)
BMOperator bmop;
int len = 0;
- if (!EDBM_op_init(em, &bmop, op, "connectverts verts=%hv", BM_ELEM_SELECT)) {
+ if (!EDBM_op_init(em, &bmop, op, "connect_verts verts=%hv", BM_ELEM_SELECT)) {
return OPERATOR_CANCELLED;
}
BMO_op_exec(bm, &bmop);
@@ -1234,7 +1234,7 @@ static int edbm_edge_split_exec(bContext *C, wmOperator *op)
BMOperator bmop;
int len = 0;
- if (!EDBM_op_init(em, &bmop, op, "edgesplit edges=%he", BM_ELEM_SELECT)) {
+ if (!EDBM_op_init(em, &bmop, op, "split_edges edges=%he", BM_ELEM_SELECT)) {
return OPERATOR_CANCELLED;
}
BMO_op_exec(bm, &bmop);
@@ -1271,7 +1271,7 @@ static int edbm_duplicate_exec(bContext *C, wmOperator *op)
BMEditMesh *em = BMEdit_FromObject(ob);
BMOperator bmop;
- EDBM_op_init(em, &bmop, op, "dupe geom=%hvef", BM_ELEM_SELECT);
+ EDBM_op_init(em, &bmop, op, "duplicate geom=%hvef", BM_ELEM_SELECT);
BMO_op_exec(em->bm, &bmop);
EDBM_flag_disable_all(em, BM_ELEM_SELECT);
@@ -1318,7 +1318,7 @@ static int edbm_flip_normals_exec(bContext *C, wmOperator *op)
Object *obedit = CTX_data_edit_object(C);
BMEditMesh *em = BMEdit_FromObject(obedit);
- if (!EDBM_op_callf(em, op, "reversefaces faces=%hf", BM_ELEM_SELECT))
+ if (!EDBM_op_callf(em, op, "reverse_faces faces=%hf", BM_ELEM_SELECT))
return OPERATOR_CANCELLED;
EDBM_update_generic(C, em, TRUE);
@@ -1386,7 +1386,7 @@ static int edbm_edge_rotate_selected_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
}
- EDBM_op_init(em, &bmop, op, "edgerotate edges=%he ccw=%b", BM_ELEM_TAG, do_ccw);
+ EDBM_op_init(em, &bmop, op, "rotate_edges edges=%he ccw=%b", BM_ELEM_TAG, do_ccw);
/* avoids leaving old verts selected which can be a problem running multiple times,
* since this means the edges become selected around the face which then attempt to rotate */
@@ -1490,11 +1490,11 @@ static int edbm_normals_make_consistent_exec(bContext *C, wmOperator *op)
/* doflip has to do with bmesh_rationalize_normals, it's an internal
* thing */
- if (!EDBM_op_callf(em, op, "righthandfaces faces=%hf do_flip=%b", BM_ELEM_SELECT, TRUE))
+ if (!EDBM_op_callf(em, op, "recalc_face_normals faces=%hf do_flip=%b", BM_ELEM_SELECT, TRUE))
return OPERATOR_CANCELLED;
if (RNA_boolean_get(op->ptr, "inside"))
- EDBM_op_callf(em, op, "reversefaces faces=%hf", BM_ELEM_SELECT);
+ EDBM_op_callf(em, op, "reverse_faces faces=%hf", BM_ELEM_SELECT);
EDBM_update_generic(C, em, TRUE);
@@ -1560,7 +1560,7 @@ static int edbm_do_smooth_vertex_exec(bContext *C, wmOperator *op)
for (i = 0; i < repeat; i++) {
if (!EDBM_op_callf(em, op,
- "vertexsmooth verts=%hv mirror_clip_x=%b mirror_clip_y=%b mirror_clip_z=%b clipdist=%f",
+ "smooth_vert verts=%hv mirror_clip_x=%b mirror_clip_y=%b mirror_clip_z=%b clipdist=%f",
BM_ELEM_SELECT, mirrx, mirry, mirrz, clipdist))
{
return OPERATOR_CANCELLED;
@@ -1678,7 +1678,7 @@ static int edbm_rotate_uvs_exec(bContext *C, wmOperator *op)
int dir = RNA_enum_get(op->ptr, "direction");
/* initialize the bmop using EDBM api, which does various ui error reporting and other stuff */
- EDBM_op_init(em, &bmop, op, "face_rotateuvs faces=%hf dir=%i", BM_ELEM_SELECT, dir);
+ EDBM_op_init(em, &bmop, op, "rotate_uvs faces=%hf dir=%i", BM_ELEM_SELECT, dir);
/* execute the operator */
BMO_op_exec(em->bm, &bmop);
@@ -1701,7 +1701,7 @@ static int edbm_reverse_uvs_exec(bContext *C, wmOperator *op)
BMOperator bmop;
/* initialize the bmop using EDBM api, which does various ui error reporting and other stuff */
- EDBM_op_init(em, &bmop, op, "face_reverseuvs faces=%hf", BM_ELEM_SELECT);
+ EDBM_op_init(em, &bmop, op, "reverse_uvs faces=%hf", BM_ELEM_SELECT);
/* execute the operator */
BMO_op_exec(em->bm, &bmop);
@@ -1727,7 +1727,7 @@ static int edbm_rotate_colors_exec(bContext *C, wmOperator *op)
int dir = RNA_enum_get(op->ptr, "direction");
/* initialize the bmop using EDBM api, which does various ui error reporting and other stuff */
- EDBM_op_init(em, &bmop, op, "face_rotatecolors faces=%hf dir=%i", BM_ELEM_SELECT, dir);
+ EDBM_op_init(em, &bmop, op, "rotate_colors faces=%hf dir=%i", BM_ELEM_SELECT, dir);
/* execute the operator */
BMO_op_exec(em->bm, &bmop);
@@ -1752,7 +1752,7 @@ static int edbm_reverse_colors_exec(bContext *C, wmOperator *op)
BMOperator bmop;
/* initialize the bmop using EDBM api, which does various ui error reporting and other stuff */
- EDBM_op_init(em, &bmop, op, "face_reversecolors faces=%hf", BM_ELEM_SELECT);
+ EDBM_op_init(em, &bmop, op, "reverse_colors faces=%hf", BM_ELEM_SELECT);
/* execute the operator */
BMO_op_exec(em->bm, &bmop);
@@ -1865,7 +1865,7 @@ static int merge_firstlast(BMEditMesh *em, int first, int uvmerge, wmOperator *w
return OPERATOR_CANCELLED;
}
- if (!EDBM_op_callf(em, wmop, "pointmerge verts=%hv mergeco=%v", BM_ELEM_SELECT, mergevert->co))
+ if (!EDBM_op_callf(em, wmop, "pointmerge verts=%hv merge_co=%v", BM_ELEM_SELECT, mergevert->co))
return OPERATOR_CANCELLED;
return OPERATOR_FINISHED;
@@ -1906,11 +1906,11 @@ static int merge_target(BMEditMesh *em, Scene *scene, View3D *v3d, Object *ob,
return OPERATOR_CANCELLED;
if (uvmerge) {
- if (!EDBM_op_callf(em, wmop, "vert_average_facedata verts=%hv", BM_ELEM_SELECT))
+ if (!EDBM_op_callf(em, wmop, "average_vert_facedata verts=%hv", BM_ELEM_SELECT))
return OPERATOR_CANCELLED;
}
- if (!EDBM_op_callf(em, wmop, "pointmerge verts=%hv mergeco=%v", BM_ELEM_SELECT, co))
+ if (!EDBM_op_callf(em, wmop, "pointmerge verts=%hv merge_co=%v", BM_ELEM_SELECT, co))
return OPERATOR_CANCELLED;
return OPERATOR_FINISHED;
@@ -2032,12 +2032,12 @@ static int edbm_remove_doubles_exec(bContext *C, wmOperator *op)
BMOperator bmop;
int count;
- EDBM_op_init(em, &bmop, op, "finddoubles verts=%hv dist=%f", BM_ELEM_SELECT, RNA_float_get(op->ptr, "mergedist"));
+ EDBM_op_init(em, &bmop, op, "find_doubles verts=%hv dist=%f", BM_ELEM_SELECT, RNA_float_get(op->ptr, "mergedist"));
BMO_op_exec(em->bm, &bmop);
count = BMO_slot_map_count(em->bm, &bmop, "targetmapout");
- if (!EDBM_op_callf(em, op, "weldverts targetmap=%s", &bmop, "targetmapout")) {
+ if (!EDBM_op_callf(em, op, "weld_verts targetmap=%s", &bmop, "targetmapout")) {
BMO_op_finish(em->bm, &bmop);
return OPERATOR_CANCELLED;
}
@@ -2109,7 +2109,7 @@ static int edbm_select_vertex_path_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
/* initialize the bmop using EDBM api, which does various ui error reporting and other stuff */
- EDBM_op_init(em, &bmop, op, "vertexshortestpath startv=%e endv=%e type=%i", sv->ele, ev->ele, type);
+ EDBM_op_init(em, &bmop, op, "shortest_path startv=%e endv=%e type=%i", sv->ele, ev->ele, type);
/* execute the operator */
BMO_op_exec(em->bm, &bmop);
@@ -2714,7 +2714,7 @@ static int edbm_knife_cut_exec(bContext *C, wmOperator *op)
BLI_ghash_insert(gh, bv, scr);
}
- if (!EDBM_op_init(em, &bmop, op, "esubd")) {
+ if (!EDBM_op_init(em, &bmop, op, "subdivide_edges")) {
return OPERATOR_CANCELLED;
}
@@ -2819,8 +2819,8 @@ static int mesh_separate_selected(Main *bmain, Scene *scene, Base *editbase, wmO
ED_base_object_select(basenew, BA_DESELECT);
- EDBM_op_callf(em, wmop, "dupe geom=%hvef dest=%p", BM_ELEM_SELECT, bm_new);
- EDBM_op_callf(em, wmop, "del geom=%hvef context=%i", BM_ELEM_SELECT, DEL_FACES);
+ EDBM_op_callf(em, wmop, "duplicate geom=%hvef dest=%p", BM_ELEM_SELECT, bm_new);
+ EDBM_op_callf(em, wmop, "delete geom=%hvef context=%i", BM_ELEM_SELECT, DEL_FACES);
/* clean up any loose edges */
BM_ITER_MESH (e, &iter, em->bm, BM_EDGES_OF_MESH) {
@@ -2831,7 +2831,7 @@ static int mesh_separate_selected(Main *bmain, Scene *scene, Base *editbase, wmO
BM_edge_select_set(em->bm, e, FALSE);
}
}
- EDBM_op_callf(em, wmop, "del geom=%hvef context=%i", BM_ELEM_SELECT, DEL_EDGES);
+ EDBM_op_callf(em, wmop, "delete geom=%hvef context=%i", BM_ELEM_SELECT, DEL_EDGES);
/* clean up any loose verts */
BM_ITER_MESH (v, &iter, em->bm, BM_VERTS_OF_MESH) {
@@ -2843,7 +2843,7 @@ static int mesh_separate_selected(Main *bmain, Scene *scene, Base *editbase, wmO
}
}
- EDBM_op_callf(em, wmop, "del geom=%hvef context=%i", BM_ELEM_SELECT, DEL_VERTS);
+ EDBM_op_callf(em, wmop, "delete geom=%hvef context=%i", BM_ELEM_SELECT, DEL_VERTS);
BM_mesh_normals_update(bm_new, TRUE);
@@ -4966,7 +4966,7 @@ static int edbm_wireframe_exec(bContext *C, wmOperator *op)
BM_mesh_elem_hflag_disable_all(em->bm, BM_FACE, BM_ELEM_TAG, FALSE);
BMO_slot_buffer_hflag_enable(em->bm, &bmop, "faces", BM_FACE, BM_ELEM_TAG, FALSE);
- BMO_op_callf(em->bm, "del geom=%hvef context=%i", BM_ELEM_TAG, DEL_FACES);
+ BMO_op_callf(em->bm, "delete geom=%hvef context=%i", BM_ELEM_TAG, DEL_FACES);
}
BM_mesh_elem_hflag_disable_all(em->bm, BM_VERT | BM_EDGE | BM_FACE, BM_ELEM_SELECT, FALSE);
@@ -5032,7 +5032,7 @@ static int edbm_convex_hull_exec(bContext *C, wmOperator *op)
/* Delete unused vertices, edges, and faces */
if (RNA_boolean_get(op->ptr, "delete_unused")) {
- if (!EDBM_op_callf(em, op, "del geom=%s context=%i",
+ if (!EDBM_op_callf(em, op, "delete geom=%s context=%i",
&bmop, "unused_geom", DEL_ONLYTAGGED))
{
EDBM_op_finish(em, &bmop, op, TRUE);
@@ -5042,7 +5042,7 @@ static int edbm_convex_hull_exec(bContext *C, wmOperator *op)
/* Delete hole edges/faces */
if (RNA_boolean_get(op->ptr, "make_holes")) {
- if (!EDBM_op_callf(em, op, "del geom=%s context=%i",
+ if (!EDBM_op_callf(em, op, "delete geom=%s context=%i",
&bmop, "holes_geom", DEL_ONLYTAGGED))
{
EDBM_op_finish(em, &bmop, op, TRUE);
diff --git a/source/blender/editors/mesh/editmesh_utils.c b/source/blender/editors/mesh/editmesh_utils.c
index c3fbb2e8c16..4952dd3f09a 100644
--- a/source/blender/editors/mesh/editmesh_utils.c
+++ b/source/blender/editors/mesh/editmesh_utils.c
@@ -485,7 +485,7 @@ void EDBM_select_more(BMEditMesh *em)
int use_faces = em->selectmode == SCE_SELECT_FACE;
BMO_op_initf(em->bm, &bmop,
- "regionextend geom=%hvef constrict=%b use_faces=%b",
+ "region_extend geom=%hvef constrict=%b use_faces=%b",
BM_ELEM_SELECT, FALSE, use_faces);
BMO_op_exec(em->bm, &bmop);
/* don't flush selection in edge/vertex mode */
@@ -501,7 +501,7 @@ void EDBM_select_less(BMEditMesh *em)
int use_faces = em->selectmode == SCE_SELECT_FACE;
BMO_op_initf(em->bm, &bmop,
- "regionextend geom=%hvef constrict=%b use_faces=%b",
+ "region_extend geom=%hvef constrict=%b use_faces=%b",
BM_ELEM_SELECT, TRUE, use_faces);
BMO_op_exec(em->bm, &bmop);
/* don't flush selection in edge/vertex mode */
diff --git a/source/blender/editors/mesh/meshtools.c b/source/blender/editors/mesh/meshtools.c
index 59a0475ebb5..cdbf5751ea1 100644
--- a/source/blender/editors/mesh/meshtools.c
+++ b/source/blender/editors/mesh/meshtools.c
@@ -45,6 +45,7 @@
#include "DNA_key_types.h"
#include "DNA_material_types.h"
#include "DNA_meshdata_types.h"
+#include "DNA_modifier_types.h"
#include "DNA_object_types.h"
#include "DNA_scene_types.h"
@@ -418,8 +419,17 @@ int join_mesh_exec(bContext *C, wmOperator *op)
}
if (me->totloop) {
- if (base->object != ob)
+ if (base->object != ob) {
+ MultiresModifierData *mmd;
+
multiresModifier_prepare_join(scene, base->object, ob);
+
+ if ((mmd = get_multires_modifier(scene, base->object, TRUE))) {
+ ED_object_iter_other(bmain, base->object, TRUE,
+ ED_object_multires_update_totlevels_cb,
+ &mmd->totlvl);
+ }
+ }
CustomData_merge(&me->ldata, &ldata, CD_MASK_MESH, CD_DEFAULT, totloop);
CustomData_copy_data(&me->ldata, &ldata, 0, loopofs, me->totloop);
@@ -888,7 +898,7 @@ int mesh_mirrtopo_table(Object *ob, char mode)
return 0;
}
-static int mesh_get_x_mirror_vert_spacial(Object *ob, int index)
+static int mesh_get_x_mirror_vert_spatial(Object *ob, int index)
{
Mesh *me = ob->data;
MVert *mvert;
@@ -916,12 +926,12 @@ int mesh_get_x_mirror_vert(Object *ob, int index)
return mesh_get_x_mirror_vert_topo(ob, index);
}
else {
- return mesh_get_x_mirror_vert_spacial(ob, index);
+ return mesh_get_x_mirror_vert_spatial(ob, index);
}
return 0;
}
-static BMVert *editbmesh_get_x_mirror_vert_spacial(Object *ob, BMEditMesh *em, const float co[3])
+static BMVert *editbmesh_get_x_mirror_vert_spatial(Object *ob, BMEditMesh *em, const float co[3])
{
float vec[3];
intptr_t poinval;
@@ -979,7 +989,7 @@ BMVert *editbmesh_get_x_mirror_vert(Object *ob, struct BMEditMesh *em, BMVert *e
return editbmesh_get_x_mirror_vert_topo(ob, em, eve, index);
}
else {
- return editbmesh_get_x_mirror_vert_spacial(ob, em, co);
+ return editbmesh_get_x_mirror_vert_spatial(ob, em, co);
}
}
diff --git a/source/blender/editors/object/object_bake.c b/source/blender/editors/object/object_bake.c
index 810fe244984..e1c715952d1 100644
--- a/source/blender/editors/object/object_bake.c
+++ b/source/blender/editors/object/object_bake.c
@@ -616,13 +616,15 @@ static void *init_heights_data(MultiresBakeRender *bkr, Image *ima)
CLAMP(ss_lvl, 0, 6);
- smd.levels = smd.renderLevels = ss_lvl;
- smd.flags |= eSubsurfModifierFlag_SubsurfUv;
+ if (ss_lvl > 0) {
+ smd.levels = smd.renderLevels = ss_lvl;
+ smd.flags |= eSubsurfModifierFlag_SubsurfUv;
- if (bkr->simple)
- smd.subdivType = ME_SIMPLE_SUBSURF;
+ if (bkr->simple)
+ smd.subdivType = ME_SIMPLE_SUBSURF;
- height_data->ssdm = subsurf_make_derived_from_derived(bkr->lores_dm, &smd, NULL, 0);
+ height_data->ssdm = subsurf_make_derived_from_derived(bkr->lores_dm, &smd, NULL, 0);
+ }
}
height_data->origindex = lodm->getTessFaceDataArray(lodm, CD_ORIGINDEX);
diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c
index 908c0a6f4f2..35ee641d2c1 100644
--- a/source/blender/editors/object/object_edit.c
+++ b/source/blender/editors/object/object_edit.c
@@ -106,7 +106,7 @@
/* ************* XXX **************** */
static void error(const char *UNUSED(arg)) {}
static void waitcursor(int UNUSED(val)) {}
-static int pupmenu(const char *UNUSED(msg)) {return 0;}
+static int pupmenu(const char *UNUSED(msg)) { return 0; }
/* port over here */
static void error_libdata(void) {}
diff --git a/source/blender/editors/object/object_group.c b/source/blender/editors/object/object_group.c
index 48104c9274d..c9851c6a0db 100644
--- a/source/blender/editors/object/object_group.c
+++ b/source/blender/editors/object/object_group.c
@@ -237,7 +237,7 @@ static int group_objects_remove_exec(bContext *C, wmOperator *op)
/* can be called with C == NULL */
static EnumPropertyItem *group_objects_remove_itemf(bContext *C, PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), int *free)
{
- Object *ob = ED_object_context(C);
+ Object *ob;
EnumPropertyItem *item = NULL, item_tmp = {0};
int totitem = 0;
@@ -245,6 +245,8 @@ static EnumPropertyItem *group_objects_remove_itemf(bContext *C, PointerRNA *UNU
return DummyRNA_NULL_items;
}
+ ob = ED_object_context(C);
+
/* check that the action exists */
if (ob) {
Group *group = NULL;
diff --git a/source/blender/editors/object/object_modifier.c b/source/blender/editors/object/object_modifier.c
index d6b5fb9fc10..aab3d8afb22 100644
--- a/source/blender/editors/object/object_modifier.c
+++ b/source/blender/editors/object/object_modifier.c
@@ -173,7 +173,100 @@ ModifierData *ED_object_modifier_add(ReportList *reports, Main *bmain, Scene *sc
return new_md;
}
-static int object_modifier_remove(Object *ob, ModifierData *md, int *sort_depsgraph)
+/* Return TRUE if the object has a modifier of type 'type' other than
+ * the modifier pointed to be 'exclude', otherwise returns FALSE. */
+static int object_has_modifier(const Object *ob, const ModifierData *exclude,
+ ModifierType type)
+{
+ ModifierData *md;
+
+ for (md = ob->modifiers.first; md; md = md->next) {
+ if ((md != exclude) && (md->type == type))
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+/* If the object data of 'orig_ob' has other users, run 'callback' on
+ * each of them.
+ *
+ * If include_orig is TRUE, the callback will run on 'orig_ob' too.
+ *
+ * If the callback ever returns TRUE, iteration will stop and the
+ * function value will be TRUE. Otherwise the function returns FALSE.
+ */
+int ED_object_iter_other(Main *bmain, Object *orig_ob, int include_orig,
+ int (*callback)(Object *ob, void *callback_data),
+ void *callback_data)
+{
+ ID *ob_data_id = orig_ob->data;
+ int users = ob_data_id->us;
+
+ if (ob_data_id->flag & LIB_FAKEUSER)
+ users--;
+
+ /* First check that the object's data has multiple users */
+ if (users > 1) {
+ Object *ob;
+ int totfound = include_orig ? 0 : 1;
+
+ for (ob = bmain->object.first; ob && totfound < users;
+ ob = ob->id.next)
+ {
+ if (((ob != orig_ob) || include_orig) &&
+ (ob->data == orig_ob->data))
+ {
+ if (callback(ob, callback_data))
+ return TRUE;
+
+ totfound++;
+ }
+ }
+ }
+ else if (include_orig) {
+ return callback(orig_ob, callback_data);
+ }
+
+ return FALSE;
+}
+
+static int object_has_modifier_cb(Object *ob, void *data)
+{
+ ModifierType type = *((ModifierType*)data);
+
+ return object_has_modifier(ob, NULL, type);
+}
+
+/* Use with ED_object_iter_other(). Sets the total number of levels
+ * for any multires modifiers on the object to the int pointed to by
+ * callback_data. */
+int ED_object_multires_update_totlevels_cb(Object *ob, void *totlevel_v)
+{
+ ModifierData *md;
+ int totlevel = *((int*)totlevel_v);
+
+ for (md = ob->modifiers.first; md; md = md->next) {
+ if (md->type == eModifierType_Multires) {
+ multires_set_tot_level(ob, (MultiresModifierData *)md, totlevel);
+ DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
+ }
+ }
+ return FALSE;
+}
+
+/* Return TRUE if no modifier of type 'type' other than 'exclude' */
+static int object_modifier_safe_to_delete(Main *bmain, Object *ob,
+ ModifierData *exclude,
+ ModifierType type)
+{
+ return (!object_has_modifier(ob, exclude, type) &&
+ !ED_object_iter_other(bmain, ob, FALSE,
+ object_has_modifier_cb, &type));
+}
+
+static int object_modifier_remove(Main *bmain, Object *ob, ModifierData *md,
+ int *sort_depsgraph)
{
ModifierData *obmd;
@@ -218,33 +311,13 @@ static int object_modifier_remove(Object *ob, ModifierData *md, int *sort_depsgr
ob->dt = OB_TEXTURE;
}
else if (md->type == eModifierType_Multires) {
- int ok = 1;
- ModifierData *tmpmd;
-
- /* ensure MDISPS CustomData layer isn't used by another multires modifiers */
- for (tmpmd = ob->modifiers.first; tmpmd; tmpmd = tmpmd->next)
- if (tmpmd != md && tmpmd->type == eModifierType_Multires) {
- ok = 0;
- break;
- }
-
- if (ok) {
+ /* Delete MDisps layer if not used by another multires modifier */
+ if (object_modifier_safe_to_delete(bmain, ob, md, eModifierType_Multires))
multires_customdata_delete(ob->data);
- }
}
else if (md->type == eModifierType_Skin) {
- int ok = 1;
- ModifierData *tmpmd;
-
- /* ensure skin CustomData layer isn't used by another skin modifier */
- for (tmpmd = ob->modifiers.first; tmpmd; tmpmd = tmpmd->next) {
- if (tmpmd != md && tmpmd->type == eModifierType_Skin) {
- ok = 0;
- break;
- }
- }
-
- if (ok)
+ /* Delete MVertSkin layer if not used by another skin modifier */
+ if (object_modifier_safe_to_delete(bmain, ob, md, eModifierType_Skin))
modifier_skin_customdata_delete(ob);
}
@@ -265,7 +338,7 @@ int ED_object_modifier_remove(ReportList *reports, Main *bmain, Scene *scene, Ob
int sort_depsgraph = 0;
int ok;
- ok = object_modifier_remove(ob, md, &sort_depsgraph);
+ ok = object_modifier_remove(bmain, ob, md, &sort_depsgraph);
if (!ok) {
BKE_reportf(reports, RPT_ERROR, "Modifier '%s' not in object '%s'", ob->id.name, md->name);
@@ -294,7 +367,7 @@ void ED_object_modifier_clear(Main *bmain, Scene *scene, Object *ob)
next_md = md->next;
- object_modifier_remove(ob, md, &sort_depsgraph);
+ object_modifier_remove(bmain, ob, md, &sort_depsgraph);
md = next_md;
}
@@ -771,19 +844,21 @@ static void edit_modifier_properties(wmOperatorType *ot)
static int edit_modifier_invoke_properties(bContext *C, wmOperator *op)
{
- PointerRNA ptr = CTX_data_pointer_get_type(C, "modifier", &RNA_Modifier);
ModifierData *md;
- if (RNA_struct_property_is_set(op->ptr, "modifier"))
- return 1;
-
- if (ptr.data) {
- md = ptr.data;
- RNA_string_set(op->ptr, "modifier", md->name);
- return 1;
+ if (RNA_struct_property_is_set(op->ptr, "modifier")) {
+ return TRUE;
}
-
- return 0;
+ else {
+ PointerRNA ptr = CTX_data_pointer_get_type(C, "modifier", &RNA_Modifier);
+ if (ptr.data) {
+ md = ptr.data;
+ RNA_string_set(op->ptr, "modifier", md->name);
+ return TRUE;
+ }
+ }
+
+ return FALSE;
}
static ModifierData *edit_modifier_property_get(wmOperator *op, Object *ob, int type)
@@ -843,7 +918,7 @@ void OBJECT_OT_modifier_remove(wmOperatorType *ot)
ot->poll = edit_modifier_poll;
/* flags */
- ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_INTERNAL;
edit_modifier_properties(ot);
}
@@ -882,7 +957,7 @@ void OBJECT_OT_modifier_move_up(wmOperatorType *ot)
ot->poll = edit_modifier_poll;
/* flags */
- ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_INTERNAL;
edit_modifier_properties(ot);
}
@@ -921,7 +996,7 @@ void OBJECT_OT_modifier_move_down(wmOperatorType *ot)
ot->poll = edit_modifier_poll;
/* flags */
- ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_INTERNAL;
edit_modifier_properties(ot);
}
@@ -969,7 +1044,7 @@ void OBJECT_OT_modifier_apply(wmOperatorType *ot)
ot->poll = edit_modifier_poll;
/* flags */
- ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_INTERNAL;
RNA_def_enum(ot->srna, "apply_as", modifier_apply_as_items, MODIFIER_APPLY_DATA, "Apply as", "How to apply the modifier to the geometry");
edit_modifier_properties(ot);
@@ -1012,7 +1087,7 @@ void OBJECT_OT_modifier_convert(wmOperatorType *ot)
ot->poll = edit_modifier_poll;
/* flags */
- ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_INTERNAL;
edit_modifier_properties(ot);
}
@@ -1051,7 +1126,7 @@ void OBJECT_OT_modifier_copy(wmOperatorType *ot)
ot->poll = edit_modifier_poll;
/* flags */
- ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_INTERNAL;
edit_modifier_properties(ot);
}
@@ -1071,6 +1146,10 @@ static int multires_higher_levels_delete_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
multiresModifier_del_levels(mmd, ob, 1);
+
+ ED_object_iter_other(CTX_data_main(C), ob, TRUE,
+ ED_object_multires_update_totlevels_cb,
+ &mmd->totlvl);
WM_event_add_notifier(C, NC_OBJECT | ND_MODIFIER, ob);
@@ -1096,7 +1175,7 @@ void OBJECT_OT_multires_higher_levels_delete(wmOperatorType *ot)
ot->exec = multires_higher_levels_delete_exec;
/* flags */
- ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_INTERNAL;
edit_modifier_properties(ot);
}
@@ -1112,6 +1191,10 @@ static int multires_subdivide_exec(bContext *C, wmOperator *op)
multiresModifier_subdivide(mmd, ob, 0, mmd->simple);
+ ED_object_iter_other(CTX_data_main(C), ob, TRUE,
+ ED_object_multires_update_totlevels_cb,
+ &mmd->totlvl);
+
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
WM_event_add_notifier(C, NC_OBJECT | ND_MODIFIER, ob);
@@ -1137,7 +1220,7 @@ void OBJECT_OT_multires_subdivide(wmOperatorType *ot)
ot->exec = multires_subdivide_exec;
/* flags */
- ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_INTERNAL;
edit_modifier_properties(ot);
}
@@ -1201,7 +1284,7 @@ void OBJECT_OT_multires_reshape(wmOperatorType *ot)
ot->exec = multires_reshape_exec;
/* flags */
- ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_INTERNAL;
edit_modifier_properties(ot);
}
@@ -1276,7 +1359,7 @@ void OBJECT_OT_multires_external_save(wmOperatorType *ot)
ot->poll = multires_poll;
/* flags */
- ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_INTERNAL;
WM_operator_properties_filesel(ot, FOLDERFILE | BTXFILE, FILE_SPECIAL, FILE_SAVE, WM_FILESEL_FILEPATH | WM_FILESEL_RELPATH, FILE_DEFAULTDISPLAY);
edit_modifier_properties(ot);
@@ -1348,7 +1431,7 @@ void OBJECT_OT_multires_base_apply(wmOperatorType *ot)
ot->exec = multires_base_apply_exec;
/* flags */
- ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_INTERNAL;
edit_modifier_properties(ot);
}
@@ -1673,7 +1756,7 @@ static Object *modifier_skin_armature_create(struct Scene *scene,
edges_visited = BLI_BITMAP_NEW(me->totedge, "edge_visited");
/* note: we use EditBones here, easier to set them up and use
- * edit-armature functions to convert back to regular bones */
+ * edit-armature functions to convert back to regular bones */
for (v = 0; v < me->totvert; v++) {
if (mvert_skin[v].flag & MVERT_SKIN_ROOT) {
EditBone *bone = NULL;
@@ -1763,7 +1846,7 @@ void OBJECT_OT_skin_armature_create(wmOperatorType *ot)
ot->exec = skin_armature_create_exec;
/* flags */
- ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_INTERNAL;
edit_modifier_properties(ot);
}
@@ -1858,7 +1941,7 @@ void OBJECT_OT_meshdeform_bind(wmOperatorType *ot)
ot->exec = meshdeform_bind_exec;
/* flags */
- ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_INTERNAL;
edit_modifier_properties(ot);
}
@@ -1905,7 +1988,7 @@ void OBJECT_OT_explode_refresh(wmOperatorType *ot)
ot->exec = explode_refresh_exec;
/* flags */
- ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_INTERNAL;
edit_modifier_properties(ot);
}
@@ -2120,7 +2203,7 @@ void OBJECT_OT_ocean_bake(wmOperatorType *ot)
ot->exec = ocean_bake_exec;
/* flags */
- ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
+ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_INTERNAL;
edit_modifier_properties(ot);
RNA_def_boolean(ot->srna, "free", FALSE, "Free", "Free the bake, rather than generating it");
diff --git a/source/blender/editors/object/object_select.c b/source/blender/editors/object/object_select.c
index 89f018a1b76..3d3f4ef1260 100644
--- a/source/blender/editors/object/object_select.c
+++ b/source/blender/editors/object/object_select.c
@@ -270,7 +270,7 @@ static int object_select_linked_exec(bContext *C, wmOperator *op)
{
if (nr == 1) {
// XXX old animation system
- //if (base->object->ipo==ipo) base->flag |= SELECT;
+ //if (base->object->ipo == ipo) base->flag |= SELECT;
//changed = 1;
}
else if (nr == 2) {
diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c
index cacd6d01291..6782cd55a8b 100644
--- a/source/blender/editors/screen/screen_ops.c
+++ b/source/blender/editors/screen/screen_ops.c
@@ -458,7 +458,7 @@ int ED_operator_editmball(bContext *C)
int ED_operator_mask(bContext *C)
{
- SpaceClip *sc= CTX_wm_space_clip(C);
+ SpaceClip *sc = CTX_wm_space_clip(C);
return ED_space_clip_check_show_maskedit(sc);
}
diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c
index a1ade77d068..6a8f7db5fc9 100644
--- a/source/blender/editors/sculpt_paint/paint_image.c
+++ b/source/blender/editors/sculpt_paint/paint_image.c
@@ -4935,7 +4935,7 @@ static int texture_paint_init(bContext *C, wmOperator *op)
if (BKE_brush_size_get(scene, brush) < 2)
BKE_brush_size_set(scene, brush, 2);
- /* allocate and initialize spacial data structures */
+ /* allocate and initialize spatial data structures */
project_paint_begin(&pop->ps);
if (pop->ps.dm == NULL)
@@ -5728,7 +5728,7 @@ static int texture_paint_camera_project_exec(bContext *C, wmOperator *op)
undo_paint_push_begin(UNDO_PAINT_IMAGE, op->type->name,
image_undo_restore, image_undo_free);
- /* allocate and initialize spacial data structures */
+ /* allocate and initialize spatial data structures */
project_paint_begin(&ps);
if (ps.dm == NULL) {
diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c
index e6c061a06ec..bfac2922c2b 100644
--- a/source/blender/editors/sculpt_paint/sculpt.c
+++ b/source/blender/editors/sculpt_paint/sculpt.c
@@ -3145,40 +3145,46 @@ static const char *sculpt_tool_name(Sculpt *sd)
{
Brush *brush = paint_brush(&sd->paint);
- switch (brush->sculpt_tool) {
+ switch ((BrushSculptTool)brush->sculpt_tool) {
case SCULPT_TOOL_DRAW:
- return "Draw Brush"; break;
+ return "Draw Brush";
case SCULPT_TOOL_SMOOTH:
- return "Smooth Brush"; break;
+ return "Smooth Brush";
case SCULPT_TOOL_CREASE:
- return "Crease Brush"; break;
+ return "Crease Brush";
case SCULPT_TOOL_BLOB:
- return "Blob Brush"; break;
+ return "Blob Brush";
case SCULPT_TOOL_PINCH:
- return "Pinch Brush"; break;
+ return "Pinch Brush";
case SCULPT_TOOL_INFLATE:
- return "Inflate Brush"; break;
+ return "Inflate Brush";
case SCULPT_TOOL_GRAB:
- return "Grab Brush"; break;
+ return "Grab Brush";
case SCULPT_TOOL_NUDGE:
- return "Nudge Brush"; break;
+ return "Nudge Brush";
case SCULPT_TOOL_THUMB:
- return "Thumb Brush"; break;
+ return "Thumb Brush";
case SCULPT_TOOL_LAYER:
- return "Layer Brush"; break;
+ return "Layer Brush";
case SCULPT_TOOL_FLATTEN:
- return "Flatten Brush"; break;
+ return "Flatten Brush";
case SCULPT_TOOL_CLAY:
- return "Clay Brush"; break;
+ return "Clay Brush";
case SCULPT_TOOL_CLAY_STRIPS:
- return "Clay Strips Brush"; break;
+ return "Clay Strips Brush";
case SCULPT_TOOL_FILL:
- return "Fill Brush"; break;
+ return "Fill Brush";
case SCULPT_TOOL_SCRAPE:
- return "Scrape Brush"; break;
- default:
- return "Sculpting"; break;
+ return "Scrape Brush";
+ case SCULPT_TOOL_SNAKE_HOOK:
+ return "Snake Hook Brush";
+ case SCULPT_TOOL_ROTATE:
+ return "Rotate Brush";
+ case SCULPT_TOOL_MASK:
+ return "Mask Brush";
}
+
+ return "Sculpting";
}
/**
@@ -3639,8 +3645,8 @@ static void sculpt_update_cache_variants(bContext *C, Sculpt *sd, Object *ob,
}
/* Returns true iff any of the smoothing modes are active (currently
- one of smooth brush, autosmooth, mask smooth, or shift-key
- smooth) */
+ * one of smooth brush, autosmooth, mask smooth, or shift-key
+ * smooth) */
static int sculpt_any_smooth_mode(const Brush *brush,
StrokeCache *cache,
int stroke_mode)
diff --git a/source/blender/editors/space_action/action_select.c b/source/blender/editors/space_action/action_select.c
index 539a32161e5..b42c6406362 100644
--- a/source/blender/editors/space_action/action_select.c
+++ b/source/blender/editors/space_action/action_select.c
@@ -930,8 +930,25 @@ static void actkeys_mselect_single(bAnimContext *ac, bAnimListElem *ale, short s
ED_gpencil_select_frame(ale->data, selx, select_mode);
else if (ale->type == ANIMTYPE_MASKLAYER)
ED_mask_select_frame(ale->data, selx, select_mode);
- else
- ANIM_animchannel_keyframes_loop(&ked, ac->ads, ale, ok_cb, select_cb, NULL);
+ else {
+ if (ELEM(ac->datatype, ANIMCONT_GPENCIL, ANIMCONT_MASK) &&
+ (ale->type == ANIMTYPE_SUMMARY) && (ale->datatype == ALE_ALL))
+ {
+ ListBase anim_data = {NULL, NULL};
+ int filter;
+ filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE /*| ANIMFILTER_CURVESONLY */ | ANIMFILTER_NODUPLIS);
+ ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
+ for (ale = anim_data.first; ale; ale = ale->next) {
+ if (ale->type == ANIMTYPE_GPLAYER)
+ ED_gpencil_select_frame(ale->data, selx, select_mode);
+ else if (ale->type == ANIMTYPE_MASKLAYER)
+ ED_mask_select_frame(ale->data, selx, select_mode);
+ }
+ }
+ else {
+ ANIM_animchannel_keyframes_loop(&ked, ac->ads, ale, ok_cb, select_cb, NULL);
+ }
+ }
}
/* Option 2) Selects all the keyframes on either side of the current frame (depends on which side the mouse is on) */
diff --git a/source/blender/editors/space_clip/clip_editor.c b/source/blender/editors/space_clip/clip_editor.c
index b57b16707d4..224a250fe4c 100644
--- a/source/blender/editors/space_clip/clip_editor.c
+++ b/source/blender/editors/space_clip/clip_editor.c
@@ -177,6 +177,13 @@ void ED_space_clip_get_aspect_dimension_aware(SpaceClip *sc, float *aspx, float
* mainly this is sued for transformation stuff
*/
+ if (!sc->clip) {
+ *aspx = 1.0f;
+ *aspy = 1.0f;
+
+ return;
+ }
+
ED_space_clip_get_aspect(sc, aspx, aspy);
BKE_movieclip_get_size(sc->clip, &sc->user, &w, &h);
diff --git a/source/blender/editors/space_clip/tracking_ops.c b/source/blender/editors/space_clip/tracking_ops.c
index af2847492ad..2e4ba844646 100644
--- a/source/blender/editors/space_clip/tracking_ops.c
+++ b/source/blender/editors/space_clip/tracking_ops.c
@@ -1586,14 +1586,15 @@ static int clear_track_path_exec(bContext *C, wmOperator *op)
{
SpaceClip *sc = CTX_wm_space_clip(C);
MovieClip *clip = ED_space_clip_get_clip(sc);
+ MovieTracking *tracking = &clip->tracking;
MovieTrackingTrack *track;
- ListBase *tracksbase = BKE_tracking_get_active_tracks(&clip->tracking);
+ ListBase *tracksbase = BKE_tracking_get_active_tracks(tracking);
int action = RNA_enum_get(op->ptr, "action");
int clear_active = RNA_boolean_get(op->ptr, "clear_active");
int framenr = ED_space_clip_get_clip_frame_number(sc);
if (clear_active) {
- track = BKE_tracking_track_get_active(&clip->tracking);
+ track = BKE_tracking_track_get_active(tracking);
BKE_tracking_track_path_clear(track, framenr, action);
}
else {
@@ -1606,6 +1607,7 @@ static int clear_track_path_exec(bContext *C, wmOperator *op)
}
}
+ BKE_tracking_dopesheet_tag_update(tracking);
WM_event_add_notifier(C, NC_MOVIECLIP | NA_EVALUATED, clip);
return OPERATOR_FINISHED;
@@ -2606,6 +2608,7 @@ static int detect_features_exec(bContext *C, wmOperator *op)
IMB_freeImBuf(ibuf);
+ BKE_tracking_dopesheet_tag_update(tracking);
WM_event_add_notifier(C, NC_MOVIECLIP | NA_EDITED, NULL);
return OPERATOR_FINISHED;
@@ -3329,7 +3332,7 @@ static int tracking_object_remove_exec(bContext *C, wmOperator *op)
void CLIP_OT_tracking_object_remove(wmOperatorType *ot)
{
/* identifiers */
- ot->name = "Movie Tracking Object";
+ ot->name = "Remove Tracking Object";
ot->description = "Remove object for tracking";
ot->idname = "CLIP_OT_tracking_object_remove";
diff --git a/source/blender/editors/space_node/drawnode.c b/source/blender/editors/space_node/drawnode.c
index 22017a2d8b9..a4fb4d7dfee 100644
--- a/source/blender/editors/space_node/drawnode.c
+++ b/source/blender/editors/space_node/drawnode.c
@@ -1194,7 +1194,7 @@ static void node_common_set_butfunc(bNodeType *ntype)
/* ****************** BUTTON CALLBACKS FOR SHADER NODES ***************** */
-static void node_buts_image_user(uiLayout *layout, bContext *C, PointerRNA *imaptr, PointerRNA *iuserptr)
+static void node_buts_image_user(uiLayout *layout, bContext *C, PointerRNA *ptr, PointerRNA *imaptr, PointerRNA *iuserptr)
{
uiLayout *col;
int source;
@@ -1220,18 +1220,17 @@ static void node_buts_image_user(uiLayout *layout, bContext *C, PointerRNA *imap
if (ELEM(source, IMA_SRC_SEQUENCE, IMA_SRC_MOVIE)) {
col = uiLayoutColumn(layout, TRUE);
- uiItemR(col, iuserptr, "frame_duration", 0, NULL, ICON_NONE);
- uiItemR(col, iuserptr, "frame_start", 0, NULL, ICON_NONE);
- uiItemR(col, iuserptr, "frame_offset", 0, NULL, ICON_NONE);
- uiItemR(col, iuserptr, "use_cyclic", 0, NULL, ICON_NONE);
- uiItemR(col, iuserptr, "use_auto_refresh", UI_ITEM_R_ICON_ONLY, NULL, ICON_NONE);
+ uiItemR(col, ptr, "frame_duration", 0, NULL, ICON_NONE);
+ uiItemR(col, ptr, "frame_start", 0, NULL, ICON_NONE);
+ uiItemR(col, ptr, "frame_offset", 0, NULL, ICON_NONE);
+ uiItemR(col, ptr, "use_cyclic", 0, NULL, ICON_NONE);
+ uiItemR(col, ptr, "use_auto_refresh", UI_ITEM_R_ICON_ONLY, NULL, ICON_NONE);
}
col = uiLayoutColumn(layout, FALSE);
if (RNA_enum_get(imaptr, "type") == IMA_TYPE_MULTILAYER)
- uiItemR(col, iuserptr, "layer", 0, NULL, ICON_NONE);
-
+ uiItemR(col, ptr, "layer", 0, NULL, ICON_NONE);
}
static void node_shader_buts_material(uiLayout *layout, bContext *C, PointerRNA *ptr)
@@ -1311,7 +1310,10 @@ static void node_shader_buts_tex_image(uiLayout *layout, bContext *C, PointerRNA
uiTemplateID(layout, C, ptr, "image", NULL, "IMAGE_OT_open", NULL);
uiItemR(layout, ptr, "color_space", 0, "", ICON_NONE);
- node_buts_image_user(layout, C, &imaptr, &iuserptr);
+ /* note: image user properties used directly here, unlike compositor image node,
+ * which redefines them in the node struct RNA to get proper updates.
+ */
+ node_buts_image_user(layout, C, &iuserptr, &imaptr, &iuserptr);
}
static void node_shader_buts_tex_environment(uiLayout *layout, bContext *C, PointerRNA *ptr)
@@ -1323,7 +1325,7 @@ static void node_shader_buts_tex_environment(uiLayout *layout, bContext *C, Poin
uiItemR(layout, ptr, "color_space", 0, "", ICON_NONE);
uiItemR(layout, ptr, "projection", 0, "", ICON_NONE);
- node_buts_image_user(layout, C, &imaptr, &iuserptr);
+ node_buts_image_user(layout, C, ptr, &imaptr, &iuserptr);
}
static void node_shader_buts_tex_sky(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr)
@@ -1456,7 +1458,7 @@ static void node_composit_buts_image(uiLayout *layout, bContext *C, PointerRNA *
imaptr = RNA_pointer_get(ptr, "image");
RNA_pointer_create((ID *)ptr->id.data, &RNA_ImageUser, node->storage, &iuserptr);
- node_buts_image_user(layout, C, &imaptr, &iuserptr);
+ node_buts_image_user(layout, C, ptr, &imaptr, &iuserptr);
}
static void node_composit_buts_renderlayers(uiLayout *layout, bContext *C, PointerRNA *ptr)
@@ -2482,6 +2484,8 @@ static void node_composit_buts_keying(uiLayout *layout, bContext *UNUSED(C), Poi
uiItemR(layout, ptr, "clip_black", 0, NULL, ICON_NONE);
uiItemR(layout, ptr, "clip_white", 0, NULL, ICON_NONE);
uiItemR(layout, ptr, "dilate_distance", 0, NULL, ICON_NONE);
+ uiItemR(layout, ptr, "feather_falloff", 0, NULL, ICON_NONE);
+ uiItemR(layout, ptr, "feather_distance", 0, NULL, ICON_NONE);
uiItemR(layout, ptr, "blur_post", 0, NULL, ICON_NONE);
}
@@ -3316,40 +3320,62 @@ void node_draw_link(View2D *v2d, SpaceNode *snode, bNodeLink *link)
do_triple = TRUE;
}
else {
+ int cycle = 0;
+
/* going to give issues once... */
if (link->tosock->flag & SOCK_UNAVAIL)
return;
if (link->fromsock->flag & SOCK_UNAVAIL)
return;
- /* a bit ugly... but thats how we detect the internal group links */
- if (!link->fromnode || !link->tonode) {
- UI_ThemeColorBlend(TH_BACK, TH_WIRE, 0.5f);
- do_shaded = FALSE;
- }
- else {
- /* check cyclic */
- if ((link->fromnode->level >= link->tonode->level && link->tonode->level != 0xFFF) && (link->flag & NODE_LINK_VALID)) {
- /* special indicated link, on drop-node */
- if (link->flag & NODE_LINKFLAG_HILITE) {
- th_col1 = th_col2 = TH_ACTIVE;
- }
- else {
- /* regular link */
- if (link->fromnode->flag & SELECT)
- th_col1 = TH_EDGE_SELECT;
- if (link->tonode->flag & SELECT)
- th_col2 = TH_EDGE_SELECT;
- }
- do_shaded = TRUE;
- do_triple = TRUE;
- }
+ /* check cyclic */
+ if (link->fromnode && link->tonode)
+ cycle = (link->fromnode->level < link->tonode->level || link->tonode->level == 0xFFF);
+ if (!cycle && (link->flag & NODE_LINK_VALID)) {
+ /* special indicated link, on drop-node */
+ if (link->flag & NODE_LINKFLAG_HILITE) {
+ th_col1 = th_col2 = TH_ACTIVE;
+ }
else {
- th_col1 = TH_REDALERT;
+ /* regular link */
+ if (link->fromnode && link->fromnode->flag & SELECT)
+ th_col1 = TH_EDGE_SELECT;
+ if (link->tonode && link->tonode->flag & SELECT)
+ th_col2 = TH_EDGE_SELECT;
}
+ do_shaded = TRUE;
+ do_triple = TRUE;
+ }
+ else {
+ th_col1 = TH_REDALERT;
}
}
node_draw_link_bezier(v2d, snode, link, th_col1, do_shaded, th_col2, do_triple, th_col3);
// node_draw_link_straight(v2d, snode, link, th_col1, do_shaded, th_col2, do_triple, th_col3);
}
+
+void drawnodesnap(View2D *v2d, const float cent[2], float size, NodeBorder border)
+{
+ glBegin(GL_LINES);
+
+ if (border & (NODE_LEFT | NODE_RIGHT)) {
+ glVertex2f(cent[0], v2d->cur.ymin);
+ glVertex2f(cent[0], v2d->cur.ymax);
+ }
+ else {
+ glVertex2f(cent[0], cent[1] - size);
+ glVertex2f(cent[0], cent[1] + size);
+ }
+
+ if (border & (NODE_TOP | NODE_BOTTOM)) {
+ glVertex2f(v2d->cur.xmin, cent[1]);
+ glVertex2f(v2d->cur.xmax, cent[1]);
+ }
+ else {
+ glVertex2f(cent[0] - size, cent[1]);
+ glVertex2f(cent[0] + size, cent[1]);
+ }
+
+ glEnd();
+}
diff --git a/source/blender/editors/space_node/node_draw.c b/source/blender/editors/space_node/node_draw.c
index c65bbd6e15f..17d7530d2a7 100644
--- a/source/blender/editors/space_node/node_draw.c
+++ b/source/blender/editors/space_node/node_draw.c
@@ -65,6 +65,7 @@
#include "ED_node.h"
#include "ED_gpencil.h"
+#include "ED_space_api.h"
#include "UI_interface.h"
#include "UI_interface_icons.h"
@@ -1087,6 +1088,8 @@ void drawnodespace(const bContext *C, ARegion *ar, View2D *v2d)
//uiFreeBlocksWin(&sa->uiblocks, sa->win);
+ ED_region_draw_cb_draw(C, ar, REGION_DRAW_PRE_VIEW);
+
/* only set once */
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_MAP1_VERTEX_3);
@@ -1095,7 +1098,9 @@ void drawnodespace(const bContext *C, ARegion *ar, View2D *v2d)
snode->aspect= (v2d->cur.xmax - v2d->cur.xmin)/((float)ar->winx);
// XXX snode->curfont= uiSetCurFont_ext(snode->aspect);
- UI_view2d_constant_grid_draw(v2d);
+ /* grid */
+ UI_view2d_multi_grid_draw(v2d, 25.0f, 5, 2);
+
/* backdrop */
draw_nodespace_back_pix(ar, snode, color_manage);
@@ -1137,6 +1142,8 @@ void drawnodespace(const bContext *C, ARegion *ar, View2D *v2d)
glDisable(GL_LINE_SMOOTH);
glDisable(GL_BLEND);
+ ED_region_draw_cb_draw(C, ar, REGION_DRAW_POST_VIEW);
+
/* draw grease-pencil ('canvas' strokes) */
if (snode->nodetree)
draw_gpencil_view2d(C, 1);
diff --git a/source/blender/editors/space_node/node_templates.c b/source/blender/editors/space_node/node_templates.c
index bf0e539efe7..f12c7941e1d 100644
--- a/source/blender/editors/space_node/node_templates.c
+++ b/source/blender/editors/space_node/node_templates.c
@@ -68,11 +68,11 @@ static void node_tag_recursive(bNode *node)
bNodeSocket *input;
if (!node || (node->flag & NODE_TEST))
- return; /* in case of cycles */
-
+ return; /* in case of cycles */
+
node->flag |= NODE_TEST;
- for (input=node->inputs.first; input; input=input->next)
+ for (input = node->inputs.first; input; input = input->next)
if (input->link)
node_tag_recursive(input->link->fromnode);
}
@@ -82,11 +82,11 @@ static void node_clear_recursive(bNode *node)
bNodeSocket *input;
if (!node || !(node->flag & NODE_TEST))
- return; /* in case of cycles */
-
+ return; /* in case of cycles */
+
node->flag &= ~NODE_TEST;
- for (input=node->inputs.first; input; input=input->next)
+ for (input = node->inputs.first; input; input = input->next)
if (input->link)
node_clear_recursive(input->link->fromnode);
}
@@ -100,20 +100,20 @@ static void node_remove_linked(bNodeTree *ntree, bNode *rem_node)
return;
/* tag linked nodes to be removed */
- for (node=ntree->nodes.first; node; node=node->next)
+ for (node = ntree->nodes.first; node; node = node->next)
node->flag &= ~NODE_TEST;
-
+
node_tag_recursive(rem_node);
/* clear tags on nodes that are still used by other nodes */
- for (node=ntree->nodes.first; node; node=node->next)
+ for (node = ntree->nodes.first; node; node = node->next)
if (!(node->flag & NODE_TEST))
- for (sock=node->inputs.first; sock; sock=sock->next)
+ for (sock = node->inputs.first; sock; sock = sock->next)
if (sock->link && sock->link->fromnode != rem_node)
node_clear_recursive(sock->link->fromnode);
/* remove nodes */
- for (node=ntree->nodes.first; node; node=next) {
+ for (node = ntree->nodes.first; node; node = next) {
next = node->next;
if (node->flag & NODE_TEST) {
@@ -166,7 +166,7 @@ static void node_socket_add_replace(Main *bmain, bNodeTree *ntree, bNode *node_t
}
/* find existing node that we can use */
- for (node_from=ntree->nodes.first; node_from; node_from=node_from->next)
+ for (node_from = ntree->nodes.first; node_from; node_from = node_from->next)
if (node_from->type == ntemp->type)
break;
@@ -181,7 +181,7 @@ static void node_socket_add_replace(Main *bmain, bNodeTree *ntree, bNode *node_t
node_from = node_prev;
}
else if (!node_from) {
- node_from= nodeAddNode(ntree, ntemp);
+ node_from = nodeAddNode(ntree, ntemp);
node_from->locx = node_to->locx - (node_from->typeinfo->width + 50);
node_from->locy = node_to->locy;
@@ -199,11 +199,11 @@ static void node_socket_add_replace(Main *bmain, bNodeTree *ntree, bNode *node_t
if (node_prev && node_from != node_prev) {
bNodeSocket *sock_prev, *sock_from;
- for (sock_prev=node_prev->inputs.first; sock_prev; sock_prev=sock_prev->next) {
- for (sock_from=node_from->inputs.first; sock_from; sock_from=sock_from->next) {
+ for (sock_prev = node_prev->inputs.first; sock_prev; sock_prev = sock_prev->next) {
+ for (sock_from = node_from->inputs.first; sock_from; sock_from = sock_from->next) {
if (nodeCountSocketLinks(ntree, sock_from) >= sock_from->limit)
continue;
-
+
if (strcmp(sock_prev->name, sock_from->name) == 0 && sock_prev->type == sock_from->type) {
bNodeLink *link = sock_prev->link;
@@ -239,9 +239,9 @@ static void node_socket_add_replace(Main *bmain, bNodeTree *ntree, bNode *node_t
/****************************** Node Link Menu *******************************/
-#define UI_NODE_LINK_ADD 0
-#define UI_NODE_LINK_DISCONNECT -1
-#define UI_NODE_LINK_REMOVE -2
+#define UI_NODE_LINK_ADD 0
+#define UI_NODE_LINK_DISCONNECT -1
+#define UI_NODE_LINK_REMOVE -2
typedef struct NodeLinkArg {
Main *bmain;
@@ -259,7 +259,7 @@ typedef struct NodeLinkArg {
static void ui_node_link(bContext *C, void *arg_p, void *event_p)
{
- NodeLinkArg *arg = (NodeLinkArg*)arg_p;
+ NodeLinkArg *arg = (NodeLinkArg *)arg_p;
Main *bmain = arg->bmain;
bNode *node_to = arg->node;
bNodeSocket *sock_to = arg->sock;
@@ -278,7 +278,7 @@ static void ui_node_link(bContext *C, void *arg_p, void *event_p)
node_socket_remove(bmain, ntree, node_to, sock_to);
else
node_socket_add_replace(bmain, ntree, node_to, sock_to, &ntemp, arg->output);
-
+
ED_undo_push(C, "Node input modify");
}
@@ -290,7 +290,7 @@ static void ui_node_sock_name(bNodeSocket *sock, char name[UI_MAX_NAME_STR])
if (node->type == NODE_GROUP) {
if (node->id)
- BLI_strncpy(node_name, node->id->name+2, UI_MAX_NAME_STR);
+ BLI_strncpy(node_name, node->id->name + 2, UI_MAX_NAME_STR);
else
BLI_strncpy(node_name, N_("Group"), UI_MAX_NAME_STR);
}
@@ -331,17 +331,17 @@ static void ui_node_menu_column(NodeLinkArg *arg, int nclass, const char *cname)
bNodeTree *ngroup;
NodeLinkArg *argN;
int first = 1;
- int compatibility= 0;
+ int compatibility = 0;
if (ntree->type == NTREE_SHADER) {
if (BKE_scene_use_new_shading_nodes(arg->scene))
- compatibility= NODE_NEW_SHADING;
+ compatibility = NODE_NEW_SHADING;
else
- compatibility= NODE_OLD_SHADING;
+ compatibility = NODE_OLD_SHADING;
}
if (nclass == NODE_CLASS_GROUP) {
- for (ngroup=bmain->nodetree.first; ngroup; ngroup=ngroup->id.next) {
+ for (ngroup = bmain->nodetree.first; ngroup; ngroup = ngroup->id.next) {
bNodeSocket *gsock;
char name[UI_MAX_NAME_STR];
int i, j, num = 0;
@@ -349,11 +349,11 @@ static void ui_node_menu_column(NodeLinkArg *arg, int nclass, const char *cname)
if (ngroup->type != ntree->type)
continue;
- for (gsock=ngroup->inputs.first; gsock; gsock=gsock->next)
+ for (gsock = ngroup->inputs.first; gsock; gsock = gsock->next)
if (ui_compatible_sockets(gsock->type, sock->type))
num++;
- for (i=0, j=0, gsock=ngroup->outputs.first; gsock; gsock=gsock->next, i++) {
+ for (i = 0, j = 0, gsock = ngroup->outputs.first; gsock; gsock = gsock->next, i++) {
if (!ui_compatible_sockets(gsock->type, sock->type))
continue;
@@ -362,27 +362,27 @@ static void ui_node_menu_column(NodeLinkArg *arg, int nclass, const char *cname)
uiBlockSetCurLayout(block, column);
uiItemL(column, IFACE_(cname), ICON_NODE);
- but= block->buttons.last;
- but->flag= UI_TEXT_LEFT;
+ but = block->buttons.last;
+ but->flag = UI_TEXT_LEFT;
first = 0;
}
if (num > 1) {
if (j == 0) {
- uiItemL(column, ngroup->id.name+2, ICON_NODE);
- but= block->buttons.last;
- but->flag= UI_TEXT_LEFT;
+ uiItemL(column, ngroup->id.name + 2, ICON_NODE);
+ but = block->buttons.last;
+ but->flag = UI_TEXT_LEFT;
}
BLI_snprintf(name, UI_MAX_NAME_STR, " %s", gsock->name);
j++;
}
else
- BLI_strncpy(name, ngroup->id.name+2, UI_MAX_NAME_STR);
+ BLI_strncpy(name, ngroup->id.name + 2, UI_MAX_NAME_STR);
- but = uiDefBut(block, BUT, 0, ngroup->id.name+2, 0, 0, UI_UNIT_X*4, UI_UNIT_Y,
- NULL, 0.0, 0.0, 0.0, 0.0, TIP_("Add node to input"));
+ but = uiDefBut(block, BUT, 0, ngroup->id.name + 2, 0, 0, UI_UNIT_X * 4, UI_UNIT_Y,
+ NULL, 0.0, 0.0, 0.0, 0.0, TIP_("Add node to input"));
argN = MEM_dupallocN(arg);
argN->type = NODE_GROUP;
@@ -393,9 +393,9 @@ static void ui_node_menu_column(NodeLinkArg *arg, int nclass, const char *cname)
}
}
else {
- bNodeTreeType *ttype= ntreeGetType(ntree->type);
+ bNodeTreeType *ttype = ntreeGetType(ntree->type);
- for (ntype=ttype->node_types.first; ntype; ntype=ntype->next) {
+ for (ntype = ttype->node_types.first; ntype; ntype = ntype->next) {
bNodeSocketTemplate *stemp;
char name[UI_MAX_NAME_STR];
int i, j, num = 0;
@@ -406,11 +406,11 @@ static void ui_node_menu_column(NodeLinkArg *arg, int nclass, const char *cname)
if (ntype->nclass != nclass)
continue;
- for (i=0, stemp=ntype->outputs; stemp && stemp->type != -1; stemp++, i++)
+ for (i = 0, stemp = ntype->outputs; stemp && stemp->type != -1; stemp++, i++)
if (ui_compatible_sockets(stemp->type, sock->type))
num++;
- for (i=0, j=0, stemp=ntype->outputs; stemp && stemp->type != -1; stemp++, i++) {
+ for (i = 0, j = 0, stemp = ntype->outputs; stemp && stemp->type != -1; stemp++, i++) {
if (!ui_compatible_sockets(stemp->type, sock->type))
continue;
@@ -419,8 +419,8 @@ static void ui_node_menu_column(NodeLinkArg *arg, int nclass, const char *cname)
uiBlockSetCurLayout(block, column);
uiItemL(column, IFACE_(cname), ICON_NODE);
- but= block->buttons.last;
- but->flag= UI_TEXT_LEFT;
+ but = block->buttons.last;
+ but->flag = UI_TEXT_LEFT;
first = 0;
}
@@ -428,8 +428,8 @@ static void ui_node_menu_column(NodeLinkArg *arg, int nclass, const char *cname)
if (num > 1) {
if (j == 0) {
uiItemL(column, IFACE_(ntype->name), ICON_NODE);
- but= block->buttons.last;
- but->flag= UI_TEXT_LEFT;
+ but = block->buttons.last;
+ but->flag = UI_TEXT_LEFT;
}
BLI_snprintf(name, UI_MAX_NAME_STR, " %s", IFACE_(stemp->name));
@@ -438,8 +438,8 @@ static void ui_node_menu_column(NodeLinkArg *arg, int nclass, const char *cname)
else
BLI_strncpy(name, IFACE_(ntype->name), UI_MAX_NAME_STR);
- but = uiDefBut(block, BUT, 0, name, 0, 0, UI_UNIT_X*4, UI_UNIT_Y,
- NULL, 0.0, 0.0, 0.0, 0.0, TIP_("Add node to input"));
+ but = uiDefBut(block, BUT, 0, name, 0, 0, UI_UNIT_X * 4, UI_UNIT_Y,
+ NULL, 0.0, 0.0, 0.0, 0.0, TIP_("Add node to input"));
argN = MEM_dupallocN(arg);
argN->type = ntype->type;
@@ -452,7 +452,7 @@ static void ui_node_menu_column(NodeLinkArg *arg, int nclass, const char *cname)
static void node_menu_column_foreach_cb(void *calldata, int nclass, const char *name)
{
- NodeLinkArg *arg = (NodeLinkArg*)calldata;
+ NodeLinkArg *arg = (NodeLinkArg *)calldata;
if (!ELEM(nclass, NODE_CLASS_GROUP, NODE_CLASS_LAYOUT))
ui_node_menu_column(arg, nclass, name);
@@ -460,22 +460,22 @@ static void node_menu_column_foreach_cb(void *calldata, int nclass, const char *
static void ui_template_node_link_menu(bContext *C, uiLayout *layout, void *but_p)
{
- Main *bmain= CTX_data_main(C);
- Scene *scene= CTX_data_scene(C);
+ Main *bmain = CTX_data_main(C);
+ Scene *scene = CTX_data_scene(C);
uiBlock *block = uiLayoutGetBlock(layout);
- uiBut *but = (uiBut*)but_p;
+ uiBut *but = (uiBut *)but_p;
uiLayout *split, *column;
- NodeLinkArg *arg = (NodeLinkArg*)but->func_argN;
+ NodeLinkArg *arg = (NodeLinkArg *)but->func_argN;
bNodeSocket *sock = arg->sock;
- bNodeTreeType *ntreetype= ntreeGetType(arg->ntree->type);
+ bNodeTreeType *ntreetype = ntreeGetType(arg->ntree->type);
uiBlockSetCurLayout(block, layout);
split = uiLayoutSplit(layout, 0.0f, FALSE);
- arg->bmain= bmain;
- arg->scene= scene;
- arg->layout= split;
-
+ arg->bmain = bmain;
+ arg->scene = scene;
+ arg->layout = split;
+
if (ntreetype && ntreetype->foreach_nodeclass)
ntreetype->foreach_nodeclass(scene, arg, node_menu_column_foreach_cb);
@@ -484,15 +484,15 @@ static void ui_template_node_link_menu(bContext *C, uiLayout *layout, void *but_
if (sock->link) {
uiItemL(column, IFACE_("Link"), ICON_NONE);
- but= block->buttons.last;
- but->flag= UI_TEXT_LEFT;
+ but = block->buttons.last;
+ but->flag = UI_TEXT_LEFT;
- but = uiDefBut(block, BUT, 0, IFACE_("Remove"), 0, 0, UI_UNIT_X*4, UI_UNIT_Y,
- NULL, 0.0, 0.0, 0.0, 0.0, TIP_("Remove nodes connected to the input"));
+ but = uiDefBut(block, BUT, 0, IFACE_("Remove"), 0, 0, UI_UNIT_X * 4, UI_UNIT_Y,
+ NULL, 0.0, 0.0, 0.0, 0.0, TIP_("Remove nodes connected to the input"));
uiButSetNFunc(but, ui_node_link, MEM_dupallocN(arg), SET_INT_IN_POINTER(UI_NODE_LINK_REMOVE));
- but = uiDefBut(block, BUT, 0, IFACE_("Disconnect"), 0, 0, UI_UNIT_X*4, UI_UNIT_Y,
- NULL, 0.0, 0.0, 0.0, 0.0, TIP_("Disconnect nodes connected to the input"));
+ but = uiDefBut(block, BUT, 0, IFACE_("Disconnect"), 0, 0, UI_UNIT_X * 4, UI_UNIT_Y,
+ NULL, 0.0, 0.0, 0.0, 0.0, TIP_("Disconnect nodes connected to the input"));
uiButSetNFunc(but, ui_node_link, MEM_dupallocN(arg), SET_INT_IN_POINTER(UI_NODE_LINK_DISCONNECT));
}
@@ -517,14 +517,14 @@ void uiTemplateNodeLink(uiLayout *layout, bNodeTree *ntree, bNode *node, bNodeSo
if (sock->link || sock->type == SOCK_SHADER || (sock->flag & SOCK_HIDE_VALUE)) {
char name[UI_MAX_NAME_STR];
ui_node_sock_name(sock, name);
- but = uiDefMenuBut(block, ui_template_node_link_menu, NULL, name, 0, 0, UI_UNIT_X*4, UI_UNIT_Y, "");
+ but = uiDefMenuBut(block, ui_template_node_link_menu, NULL, name, 0, 0, UI_UNIT_X * 4, UI_UNIT_Y, "");
}
else
but = uiDefIconMenuBut(block, ui_template_node_link_menu, NULL, ICON_NONE, 0, 0, UI_UNIT_X, UI_UNIT_Y, "");
- but->type= MENU;
- but->flag |= UI_TEXT_LEFT|UI_BUT_NODE_LINK;
- but->poin= (char*)but;
+ but->type = MENU;
+ but->flag |= UI_TEXT_LEFT | UI_BUT_NODE_LINK;
+ but->poin = (char *)but;
but->func_argN = arg;
if (sock->link && sock->link->fromnode)
@@ -535,7 +535,7 @@ void uiTemplateNodeLink(uiLayout *layout, bNodeTree *ntree, bNode *node, bNodeSo
/**************************** Node Tree Layout *******************************/
static void ui_node_draw_input(uiLayout *layout, bContext *C,
- bNodeTree *ntree, bNode *node, bNodeSocket *input, int depth);
+ bNodeTree *ntree, bNode *node, bNodeSocket *input, int depth);
static void ui_node_draw_node(uiLayout *layout, bContext *C, bNodeTree *ntree, bNode *node, int depth)
{
@@ -555,8 +555,8 @@ static void ui_node_draw_node(uiLayout *layout, bContext *C, bNodeTree *ntree, b
}
}
- for (input=node->inputs.first; input; input=input->next)
- ui_node_draw_input(layout, C, ntree, node, input, depth+1);
+ for (input = node->inputs.first; input; input = input->next)
+ ui_node_draw_input(layout, C, ntree, node, input, depth + 1);
}
static void ui_node_draw_input(uiLayout *layout, bContext *C, bNodeTree *ntree, bNode *node, bNodeSocket *input, int depth)
@@ -567,7 +567,7 @@ static void ui_node_draw_input(uiLayout *layout, bContext *C, bNodeTree *ntree,
uiLayout *split, *row, *col;
bNode *lnode;
char label[UI_MAX_NAME_STR];
- int indent = (depth > 1)? 2*(depth - 1): 0;
+ int indent = (depth > 1) ? 2 * (depth - 1) : 0;
int dependency_loop;
if (input->flag & SOCK_UNAVAIL)
@@ -575,7 +575,7 @@ static void ui_node_draw_input(uiLayout *layout, bContext *C, bNodeTree *ntree,
/* to avoid eternal loops on cyclic dependencies */
node->flag |= NODE_TEST;
- lnode = (input->link)? input->link->fromnode: NULL;
+ lnode = (input->link) ? input->link->fromnode : NULL;
dependency_loop = (lnode && (lnode->flag & NODE_TEST));
if (dependency_loop)
@@ -598,21 +598,21 @@ static void ui_node_draw_input(uiLayout *layout, bContext *C, bNodeTree *ntree,
uiBlockSetEmboss(block, UI_EMBOSSN);
if (lnode && (lnode->inputs.first || (lnode->typeinfo->uifunc && lnode->type != NODE_GROUP))) {
- int icon = (input->flag & SOCK_COLLAPSED)? ICON_DISCLOSURE_TRI_RIGHT: ICON_DISCLOSURE_TRI_DOWN;
+ int icon = (input->flag & SOCK_COLLAPSED) ? ICON_DISCLOSURE_TRI_RIGHT : ICON_DISCLOSURE_TRI_DOWN;
uiItemR(row, &inputptr, "show_expanded", UI_ITEM_R_ICON_ONLY, "", icon);
}
else
uiItemL(row, "", ICON_BLANK1);
bt = block->buttons.last;
- bt->x2 = UI_UNIT_X/2;
+ bt->x2 = UI_UNIT_X / 2;
uiBlockSetEmboss(block, UI_EMBOSS);
}
uiItemL(row, label, ICON_NONE);
- bt= block->buttons.last;
- bt->flag= UI_TEXT_LEFT;
+ bt = block->buttons.last;
+ bt->flag = UI_TEXT_LEFT;
if (dependency_loop) {
row = uiLayoutRow(split, FALSE);
@@ -661,7 +661,7 @@ void uiTemplateNodeView(uiLayout *layout, bContext *C, bNodeTree *ntree, bNode *
return;
/* clear for cycle check */
- for (tnode=ntree->nodes.first; tnode; tnode=tnode->next)
+ for (tnode = ntree->nodes.first; tnode; tnode = tnode->next)
tnode->flag &= ~NODE_TEST;
if (input)
diff --git a/source/blender/editors/space_node/space_node.c b/source/blender/editors/space_node/space_node.c
index e069ba2a5fc..3a834ef6331 100644
--- a/source/blender/editors/space_node/space_node.c
+++ b/source/blender/editors/space_node/space_node.c
@@ -4,7 +4,7 @@
* 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.
+ * 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
@@ -18,7 +18,7 @@
* The Original Code is Copyright (C) 2008 Blender Foundation.
* All rights reserved.
*
- *
+ *
* Contributor(s): Blender Foundation
*
* ***** END GPL LICENSE BLOCK *****
@@ -63,7 +63,7 @@
#include "RNA_access.h"
-#include "node_intern.h" // own include
+#include "node_intern.h" // own include
/* ******************** manage regions ********************* */
@@ -71,23 +71,23 @@ ARegion *node_has_buttons_region(ScrArea *sa)
{
ARegion *ar, *arnew;
- ar= BKE_area_find_region_type(sa, RGN_TYPE_UI);
+ ar = BKE_area_find_region_type(sa, RGN_TYPE_UI);
if (ar) return ar;
-
+
/* add subdiv level; after header */
- ar= BKE_area_find_region_type(sa, RGN_TYPE_HEADER);
+ ar = BKE_area_find_region_type(sa, RGN_TYPE_HEADER);
/* is error! */
- if (ar==NULL) return NULL;
-
- arnew= MEM_callocN(sizeof(ARegion), "buttons for node");
-
+ if (ar == NULL) return NULL;
+
+ arnew = MEM_callocN(sizeof(ARegion), "buttons for node");
+
BLI_insertlinkafter(&sa->regionbase, ar, arnew);
- arnew->regiontype= RGN_TYPE_UI;
- arnew->alignment= RGN_ALIGN_RIGHT;
-
+ arnew->regiontype = RGN_TYPE_UI;
+ arnew->alignment = RGN_ALIGN_RIGHT;
+
arnew->flag = RGN_FLAG_HIDDEN;
-
+
return arnew;
}
@@ -97,64 +97,64 @@ static SpaceLink *node_new(const bContext *UNUSED(C))
{
ARegion *ar;
SpaceNode *snode;
-
- snode= MEM_callocN(sizeof(SpaceNode), "initnode");
- snode->spacetype= SPACE_NODE;
-
+
+ snode = MEM_callocN(sizeof(SpaceNode), "initnode");
+ snode->spacetype = SPACE_NODE;
+
/* backdrop */
snode->zoom = 1.0f;
-
+
/* header */
- ar= MEM_callocN(sizeof(ARegion), "header for node");
-
+ ar = MEM_callocN(sizeof(ARegion), "header for node");
+
BLI_addtail(&snode->regionbase, ar);
- ar->regiontype= RGN_TYPE_HEADER;
- ar->alignment= RGN_ALIGN_BOTTOM;
-
+ ar->regiontype = RGN_TYPE_HEADER;
+ ar->alignment = RGN_ALIGN_BOTTOM;
+
/* buttons/list view */
- ar= MEM_callocN(sizeof(ARegion), "buttons for node");
-
+ ar = MEM_callocN(sizeof(ARegion), "buttons for node");
+
BLI_addtail(&snode->regionbase, ar);
- ar->regiontype= RGN_TYPE_UI;
- ar->alignment= RGN_ALIGN_RIGHT;
+ ar->regiontype = RGN_TYPE_UI;
+ ar->alignment = RGN_ALIGN_RIGHT;
ar->flag = RGN_FLAG_HIDDEN;
-
+
/* main area */
- ar= MEM_callocN(sizeof(ARegion), "main area for node");
-
+ ar = MEM_callocN(sizeof(ARegion), "main area for node");
+
BLI_addtail(&snode->regionbase, ar);
- ar->regiontype= RGN_TYPE_WINDOW;
-
+ ar->regiontype = RGN_TYPE_WINDOW;
+
ar->v2d.tot.xmin = -256.0f;
ar->v2d.tot.ymin = -256.0f;
ar->v2d.tot.xmax = 768.0f;
ar->v2d.tot.ymax = 768.0f;
-
+
ar->v2d.cur.xmin = -256.0f;
ar->v2d.cur.ymin = -256.0f;
ar->v2d.cur.xmax = 768.0f;
ar->v2d.cur.ymax = 768.0f;
-
- ar->v2d.min[0]= 1.0f;
- ar->v2d.min[1]= 1.0f;
-
- ar->v2d.max[0]= 32000.0f;
- ar->v2d.max[1]= 32000.0f;
-
- ar->v2d.minzoom= 0.09f;
- ar->v2d.maxzoom= 2.31f;
-
- ar->v2d.scroll= (V2D_SCROLL_RIGHT|V2D_SCROLL_BOTTOM);
- ar->v2d.keepzoom= V2D_LIMITZOOM|V2D_KEEPASPECT;
- ar->v2d.keeptot= 0;
-
+
+ ar->v2d.min[0] = 1.0f;
+ ar->v2d.min[1] = 1.0f;
+
+ ar->v2d.max[0] = 32000.0f;
+ ar->v2d.max[1] = 32000.0f;
+
+ ar->v2d.minzoom = 0.09f;
+ ar->v2d.maxzoom = 2.31f;
+
+ ar->v2d.scroll = (V2D_SCROLL_RIGHT | V2D_SCROLL_BOTTOM);
+ ar->v2d.keepzoom = V2D_LIMITZOOM | V2D_KEEPASPECT;
+ ar->v2d.keeptot = 0;
+
return (SpaceLink *)snode;
}
/* not spacelink itself */
static void node_free(SpaceLink *UNUSED(sl))
-{
-
+{
+
}
@@ -167,10 +167,10 @@ static void node_init(struct wmWindowManager *UNUSED(wm), ScrArea *UNUSED(sa))
static void node_area_listener(ScrArea *sa, wmNotifier *wmn)
{
/* note, ED_area_tag_refresh will re-execute compositor */
- SpaceNode *snode= sa->spacedata.first;
- int type= snode->treetype;
+ SpaceNode *snode = sa->spacedata.first;
+ int type = snode->treetype;
short shader_type = snode->shaderfrom;
-
+
/* preview renders */
switch (wmn->category) {
case NC_SCENE:
@@ -183,9 +183,9 @@ static void node_area_listener(ScrArea *sa, wmNotifier *wmn)
ED_area_tag_redraw(sa);
break;
case ND_TRANSFORM_DONE:
- if (type==NTREE_COMPOSIT) {
+ if (type == NTREE_COMPOSIT) {
if (snode->flag & SNODE_AUTO_RENDER) {
- snode->recalc= 1;
+ snode->recalc = 1;
ED_area_tag_refresh(sa);
}
}
@@ -193,43 +193,43 @@ static void node_area_listener(ScrArea *sa, wmNotifier *wmn)
}
break;
case NC_WM:
- if (wmn->data==ND_FILEREAD)
+ if (wmn->data == ND_FILEREAD)
ED_area_tag_refresh(sa);
break;
-
+
/* future: add ID checks? */
case NC_MATERIAL:
- if (type==NTREE_SHADER) {
- if (wmn->data==ND_SHADING)
+ if (type == NTREE_SHADER) {
+ if (wmn->data == ND_SHADING)
ED_area_tag_refresh(sa);
- else if (wmn->data==ND_SHADING_DRAW)
+ else if (wmn->data == ND_SHADING_DRAW)
ED_area_tag_refresh(sa);
- else if (wmn->action==NA_ADDED && snode->edittree)
+ else if (wmn->action == NA_ADDED && snode->edittree)
nodeSetActiveID(snode->edittree, ID_MA, wmn->reference);
-
+
}
break;
case NC_TEXTURE:
- if (type==NTREE_SHADER || type==NTREE_TEXTURE) {
- if (wmn->data==ND_NODES)
+ if (type == NTREE_SHADER || type == NTREE_TEXTURE) {
+ if (wmn->data == ND_NODES)
ED_area_tag_refresh(sa);
}
break;
case NC_WORLD:
- if (type==NTREE_SHADER && shader_type==SNODE_SHADER_WORLD) {
- ED_area_tag_refresh(sa);
+ if (type == NTREE_SHADER && shader_type == SNODE_SHADER_WORLD) {
+ ED_area_tag_refresh(sa);
}
break;
case NC_OBJECT:
- if (type==NTREE_SHADER) {
- if (wmn->data==ND_OB_SHADING)
+ if (type == NTREE_SHADER) {
+ if (wmn->data == ND_OB_SHADING)
ED_area_tag_refresh(sa);
}
break;
case NC_SPACE:
- if (wmn->data==ND_SPACE_NODE)
+ if (wmn->data == ND_SPACE_NODE)
ED_area_tag_refresh(sa);
- else if (wmn->data==ND_SPACE_NODE_VIEW)
+ else if (wmn->data == ND_SPACE_NODE_VIEW)
ED_area_tag_redraw(sa);
break;
case NC_NODE:
@@ -247,7 +247,7 @@ static void node_area_listener(ScrArea *sa, wmNotifier *wmn)
break;
case NC_MASK:
if (wmn->action == NA_EDITED) {
- if (type==NTREE_COMPOSIT) {
+ if (type == NTREE_COMPOSIT) {
ED_area_tag_refresh(sa);
}
}
@@ -255,7 +255,7 @@ static void node_area_listener(ScrArea *sa, wmNotifier *wmn)
case NC_IMAGE:
if (wmn->action == NA_EDITED) {
- if (type==NTREE_COMPOSIT) {
+ if (type == NTREE_COMPOSIT) {
/* note that nodeUpdateID is already called by BKE_image_signal() on all
* scenes so really this is just to know if the images is used in the compo else
* painting on images could become very slow when the compositor is open. */
@@ -270,42 +270,42 @@ static void node_area_listener(ScrArea *sa, wmNotifier *wmn)
static void node_area_refresh(const struct bContext *C, struct ScrArea *sa)
{
/* default now: refresh node is starting preview */
- SpaceNode *snode= sa->spacedata.first;
+ SpaceNode *snode = sa->spacedata.first;
snode_set_context(snode, CTX_data_scene(C));
-
+
if (snode->nodetree) {
- if (snode->treetype==NTREE_SHADER) {
+ if (snode->treetype == NTREE_SHADER) {
if (GS(snode->id->name) == ID_MA) {
- Material *ma= (Material *)snode->id;
+ Material *ma = (Material *)snode->id;
if (ma->use_nodes)
ED_preview_shader_job(C, sa, snode->id, NULL, NULL, 100, 100, PR_NODE_RENDER);
}
else if (GS(snode->id->name) == ID_LA) {
- Lamp *la= (Lamp *)snode->id;
+ Lamp *la = (Lamp *)snode->id;
if (la->use_nodes)
ED_preview_shader_job(C, sa, snode->id, NULL, NULL, 100, 100, PR_NODE_RENDER);
}
else if (GS(snode->id->name) == ID_WO) {
- World *wo= (World *)snode->id;
+ World *wo = (World *)snode->id;
if (wo->use_nodes)
ED_preview_shader_job(C, sa, snode->id, NULL, NULL, 100, 100, PR_NODE_RENDER);
}
}
- else if (snode->treetype==NTREE_COMPOSIT) {
- Scene *scene= (Scene *)snode->id;
+ else if (snode->treetype == NTREE_COMPOSIT) {
+ Scene *scene = (Scene *)snode->id;
if (scene->use_nodes) {
/* recalc is set on 3d view changes for auto compo */
if (snode->recalc) {
- snode->recalc= 0;
- node_render_changed_exec((struct bContext*)C, NULL);
+ snode->recalc = 0;
+ node_render_changed_exec((struct bContext *)C, NULL);
}
- else
+ else
snode_composite_job(C, sa);
}
}
- else if (snode->treetype==NTREE_TEXTURE) {
- Tex *tex= (Tex *)snode->id;
+ else if (snode->treetype == NTREE_TEXTURE) {
+ Tex *tex = (Tex *)snode->id;
if (tex->use_nodes) {
ED_preview_shader_job(C, sa, snode->id, NULL, NULL, 100, 100, PR_NODE_RENDER);
}
@@ -315,12 +315,12 @@ static void node_area_refresh(const struct bContext *C, struct ScrArea *sa)
static SpaceLink *node_duplicate(SpaceLink *sl)
{
- SpaceNode *snoden= MEM_dupallocN(sl);
-
+ SpaceNode *snoden = MEM_dupallocN(sl);
+
/* clear or remove stuff from old */
- snoden->nodetree= NULL;
- snoden->linkdrag.first= snoden->linkdrag.last= NULL;
-
+ snoden->nodetree = NULL;
+ snoden->linkdrag.first = snoden->linkdrag.last = NULL;
+
return (SpaceLink *)snoden;
}
@@ -331,7 +331,7 @@ static void node_buttons_area_init(wmWindowManager *wm, ARegion *ar)
wmKeyMap *keymap;
ED_region_panels_init(wm, ar);
-
+
keymap = WM_keymap_find(wm->defaultconf, "Node Generic", SPACE_NODE, 0);
WM_event_add_keymap_handler(&ar->handlers, keymap);
}
@@ -343,12 +343,12 @@ static void node_buttons_area_draw(const bContext *C, ARegion *ar)
static void node_cursor(wmWindow *win, ScrArea *sa, ARegion *ar)
{
- SpaceNode *snode= sa->spacedata.first;
-
+ SpaceNode *snode = sa->spacedata.first;
+
/* convert mouse coordinates to v2d space */
UI_view2d_region_to_view(&ar->v2d, win->eventstate->x - ar->winrct.xmin, win->eventstate->y - ar->winrct.ymin,
&snode->mx, &snode->my);
-
+
node_set_cursor(win, snode);
}
@@ -357,26 +357,26 @@ static void node_main_area_init(wmWindowManager *wm, ARegion *ar)
{
wmKeyMap *keymap;
ListBase *lb;
-
+
UI_view2d_region_reinit(&ar->v2d, V2D_COMMONVIEW_CUSTOM, ar->winx, ar->winy);
-
+
/* own keymaps */
keymap = WM_keymap_find(wm->defaultconf, "Node Generic", SPACE_NODE, 0);
WM_event_add_keymap_handler(&ar->handlers, keymap);
-
+
keymap = WM_keymap_find(wm->defaultconf, "Node Editor", SPACE_NODE, 0);
WM_event_add_keymap_handler_bb(&ar->handlers, keymap, &ar->v2d.mask, &ar->winrct);
-
+
/* add drop boxes */
lb = WM_dropboxmap_find("Node Editor", SPACE_NODE, RGN_TYPE_WINDOW);
-
+
WM_event_add_dropbox_handler(&ar->handlers, lb);
}
static void node_main_area_draw(const bContext *C, ARegion *ar)
{
- View2D *v2d= &ar->v2d;
-
+ View2D *v2d = &ar->v2d;
+
drawnodespace(C, ar, v2d);
}
@@ -385,13 +385,13 @@ static void node_main_area_draw(const bContext *C, ARegion *ar)
static int node_drop_poll(bContext *UNUSED(C), wmDrag *drag, wmEvent *UNUSED(event))
{
- if (drag->type==WM_DRAG_ID) {
- ID *id= (ID *)drag->poin;
- if ( GS(id->name)==ID_IM )
+ if (drag->type == WM_DRAG_ID) {
+ ID *id = (ID *)drag->poin;
+ if (GS(id->name) == ID_IM)
return 1;
}
- else if (drag->type==WM_DRAG_PATH) {
- if (ELEM(drag->icon, 0, ICON_FILE_IMAGE)) /* rule might not work? */
+ else if (drag->type == WM_DRAG_PATH) {
+ if (ELEM(drag->icon, 0, ICON_FILE_IMAGE)) /* rule might not work? */
return 1;
}
return 0;
@@ -399,10 +399,10 @@ static int node_drop_poll(bContext *UNUSED(C), wmDrag *drag, wmEvent *UNUSED(eve
static void node_id_path_drop_copy(wmDrag *drag, wmDropBox *drop)
{
- ID *id= (ID *)drag->poin;
-
+ ID *id = (ID *)drag->poin;
+
if (id) {
- RNA_string_set(drop->ptr, "name", id->name+2);
+ RNA_string_set(drop->ptr, "name", id->name + 2);
}
if (drag->path[0]) {
RNA_string_set(drop->ptr, "filepath", drag->path);
@@ -412,10 +412,10 @@ static void node_id_path_drop_copy(wmDrag *drag, wmDropBox *drop)
/* this region dropbox definition */
static void node_dropboxes(void)
{
- ListBase *lb= WM_dropboxmap_find("Node Editor", SPACE_NODE, RGN_TYPE_WINDOW);
-
+ ListBase *lb = WM_dropboxmap_find("Node Editor", SPACE_NODE, RGN_TYPE_WINDOW);
+
WM_dropbox_add(lb, "NODE_OT_add_file", node_drop_poll, node_id_path_drop_copy);
-
+
}
/* ************* end drop *********** */
@@ -429,8 +429,8 @@ static void node_header_area_init(wmWindowManager *UNUSED(wm), ARegion *ar)
static void node_header_area_draw(const bContext *C, ARegion *ar)
{
- SpaceNode *snode= CTX_wm_space_node(C);
- Scene *scene= CTX_data_scene(C);
+ SpaceNode *snode = CTX_wm_space_node(C);
+ Scene *scene = CTX_data_scene(C);
/* find and set the context */
snode_set_context(snode, scene);
@@ -444,11 +444,11 @@ static void node_region_listener(ARegion *ar, wmNotifier *wmn)
/* context changes */
switch (wmn->category) {
case NC_SPACE:
- if (wmn->data==ND_SPACE_NODE)
+ if (wmn->data == ND_SPACE_NODE)
ED_region_tag_redraw(ar);
break;
case NC_SCREEN:
- if (wmn->data == ND_GPENCIL)
+ if (wmn->data == ND_GPENCIL)
ED_region_tag_redraw(ar);
break;
case NC_SCENE:
@@ -458,7 +458,7 @@ static void node_region_listener(ARegion *ar, wmNotifier *wmn)
ED_region_tag_redraw(ar);
break;
case NC_OBJECT:
- if (wmn->data==ND_OB_SHADING)
+ if (wmn->data == ND_OB_SHADING)
ED_region_tag_redraw(ar);
break;
case NC_ID:
@@ -472,17 +472,17 @@ const char *node_context_dir[] = {"selected_nodes", "active_node", NULL};
static int node_context(const bContext *C, const char *member, bContextDataResult *result)
{
- SpaceNode *snode= CTX_wm_space_node(C);
-
+ SpaceNode *snode = CTX_wm_space_node(C);
+
if (CTX_data_dir(member)) {
CTX_data_dir_set(result, node_context_dir);
return 1;
}
else if (CTX_data_equals(member, "selected_nodes")) {
bNode *node;
-
+
if (snode->edittree) {
- for (node=snode->edittree->nodes.last; node; node=node->prev) {
+ for (node = snode->edittree->nodes.last; node; node = node->prev) {
if (node->flag & NODE_SELECT) {
CTX_data_list_add(result, &snode->edittree->id, &RNA_Node, node);
}
@@ -500,67 +500,67 @@ static int node_context(const bContext *C, const char *member, bContextDataResul
CTX_data_type_set(result, CTX_DATA_TYPE_POINTER);
return 1;
}
-
+
return 0;
}
/* only called once, from space/spacetypes.c */
void ED_spacetype_node(void)
{
- SpaceType *st= MEM_callocN(sizeof(SpaceType), "spacetype node");
+ SpaceType *st = MEM_callocN(sizeof(SpaceType), "spacetype node");
ARegionType *art;
-
- st->spaceid= SPACE_NODE;
+
+ st->spaceid = SPACE_NODE;
strncpy(st->name, "Node", BKE_ST_MAXNAME);
-
- st->new= node_new;
- st->free= node_free;
- st->init= node_init;
- st->duplicate= node_duplicate;
- st->operatortypes= node_operatortypes;
- st->keymap= node_keymap;
- st->listener= node_area_listener;
- st->refresh= node_area_refresh;
- st->context= node_context;
+
+ st->new = node_new;
+ st->free = node_free;
+ st->init = node_init;
+ st->duplicate = node_duplicate;
+ st->operatortypes = node_operatortypes;
+ st->keymap = node_keymap;
+ st->listener = node_area_listener;
+ st->refresh = node_area_refresh;
+ st->context = node_context;
st->dropboxes = node_dropboxes;
-
+
/* regions: main window */
- art= MEM_callocN(sizeof(ARegionType), "spacetype node region");
+ art = MEM_callocN(sizeof(ARegionType), "spacetype node region");
art->regionid = RGN_TYPE_WINDOW;
- art->init= node_main_area_init;
- art->draw= node_main_area_draw;
- art->listener= node_region_listener;
+ art->init = node_main_area_init;
+ art->draw = node_main_area_draw;
+ art->listener = node_region_listener;
art->cursor = node_cursor;
art->event_cursor = TRUE;
- art->keymapflag= ED_KEYMAP_UI|ED_KEYMAP_VIEW2D|ED_KEYMAP_FRAMES|ED_KEYMAP_GPENCIL;
+ art->keymapflag = ED_KEYMAP_UI | ED_KEYMAP_VIEW2D | ED_KEYMAP_FRAMES | ED_KEYMAP_GPENCIL;
BLI_addhead(&st->regiontypes, art);
-
+
/* regions: header */
- art= MEM_callocN(sizeof(ARegionType), "spacetype node region");
+ art = MEM_callocN(sizeof(ARegionType), "spacetype node region");
art->regionid = RGN_TYPE_HEADER;
- art->prefsizey= HEADERY;
- art->keymapflag= ED_KEYMAP_UI|ED_KEYMAP_VIEW2D|ED_KEYMAP_FRAMES|ED_KEYMAP_HEADER;
- art->listener= node_region_listener;
- art->init= node_header_area_init;
- art->draw= node_header_area_draw;
-
+ art->prefsizey = HEADERY;
+ art->keymapflag = ED_KEYMAP_UI | ED_KEYMAP_VIEW2D | ED_KEYMAP_FRAMES | ED_KEYMAP_HEADER;
+ art->listener = node_region_listener;
+ art->init = node_header_area_init;
+ art->draw = node_header_area_draw;
+
BLI_addhead(&st->regiontypes, art);
node_menus_register();
-
+
/* regions: listview/buttons */
- art= MEM_callocN(sizeof(ARegionType), "spacetype node region");
+ art = MEM_callocN(sizeof(ARegionType), "spacetype node region");
art->regionid = RGN_TYPE_UI;
- art->prefsizex= 180; // XXX
- art->keymapflag= ED_KEYMAP_UI|ED_KEYMAP_FRAMES;
- art->listener= node_region_listener;
- art->init= node_buttons_area_init;
- art->draw= node_buttons_area_draw;
+ art->prefsizex = 180; // XXX
+ art->keymapflag = ED_KEYMAP_UI | ED_KEYMAP_FRAMES;
+ art->listener = node_region_listener;
+ art->init = node_buttons_area_init;
+ art->draw = node_buttons_area_draw;
BLI_addhead(&st->regiontypes, art);
-
+
node_buttons_register(art);
-
+
BKE_spacetype_register(st);
}
diff --git a/source/blender/editors/space_sequencer/sequencer_buttons.c b/source/blender/editors/space_sequencer/sequencer_buttons.c
index 1e452f2052d..7dbcabedccc 100644
--- a/source/blender/editors/space_sequencer/sequencer_buttons.c
+++ b/source/blender/editors/space_sequencer/sequencer_buttons.c
@@ -58,7 +58,7 @@ void sequencer_buttons_register(ARegionType *art)
pt = MEM_callocN(sizeof(PanelType), "spacetype sequencer panel gpencil");
strcpy(pt->idname, "SEQUENCER_PT_gpencil");
strcpy(pt->label, N_("Grease Pencil"));
- pt->draw= gpencil_panel_standard;
+ pt->draw = gpencil_panel_standard;
BLI_addtail(&art->paneltypes, pt);
}
diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c b/source/blender/editors/space_sequencer/sequencer_edit.c
index bc8133cded6..7ed5c77ed1f 100644
--- a/source/blender/editors/space_sequencer/sequencer_edit.c
+++ b/source/blender/editors/space_sequencer/sequencer_edit.c
@@ -2694,8 +2694,11 @@ static int sequencer_swap_data_exec(bContext *C, wmOperator *op)
return OPERATOR_CANCELLED;
}
- sound_remove_scene_sound(scene, seq_act->scene_sound);
- sound_remove_scene_sound(scene, seq_other->scene_sound);
+ if (seq_act->scene_sound)
+ sound_remove_scene_sound(scene, seq_act->scene_sound);
+
+ if (seq_other->scene_sound)
+ sound_remove_scene_sound(scene, seq_other->scene_sound);
seq_act->scene_sound = NULL;
seq_other->scene_sound = NULL;
diff --git a/source/blender/editors/space_sequencer/sequencer_select.c b/source/blender/editors/space_sequencer/sequencer_select.c
index b03edfc61b9..a55f0edc06c 100644
--- a/source/blender/editors/space_sequencer/sequencer_select.c
+++ b/source/blender/editors/space_sequencer/sequencer_select.c
@@ -587,14 +587,14 @@ static int select_more_less_seq__internal(Scene *scene, int sel, int linked)
/* only get unselected nabours */
neighbor = find_neighboring_sequence(scene, seq, SEQ_SIDE_LEFT, isel);
if (neighbor) {
- if (sel) {neighbor->flag |= SELECT; recurs_sel_seq(neighbor); }
+ if (sel) { neighbor->flag |= SELECT; recurs_sel_seq(neighbor); }
else neighbor->flag &= ~SELECT;
if (linked == 0) neighbor->tmp = (Sequence *)1;
change = 1;
}
neighbor = find_neighboring_sequence(scene, seq, SEQ_SIDE_RIGHT, isel);
if (neighbor) {
- if (sel) {neighbor->flag |= SELECT; recurs_sel_seq(neighbor); }
+ if (sel) { neighbor->flag |= SELECT; recurs_sel_seq(neighbor); }
else neighbor->flag &= ~SELECT;
if (linked == 0) neighbor->tmp = (void *)1;
change = 1;
diff --git a/source/blender/editors/space_text/text_ops.c b/source/blender/editors/space_text/text_ops.c
index 3ebc4eb974c..f0275fb6584 100644
--- a/source/blender/editors/space_text/text_ops.c
+++ b/source/blender/editors/space_text/text_ops.c
@@ -830,7 +830,7 @@ void TEXT_OT_paste(wmOperatorType *ot)
static int text_duplicate_line_exec(bContext *C, wmOperator *UNUSED(op))
{
- Text *text= CTX_data_edit_text(C);
+ Text *text = CTX_data_edit_text(C);
txt_duplicate_line(text);
@@ -1341,7 +1341,7 @@ static int move_lines_exec(bContext *C, wmOperator *op)
txt_move_lines(text, direction);
text_update_cursor_moved(C);
- WM_event_add_notifier(C, NC_TEXT|NA_EDITED, text);
+ WM_event_add_notifier(C, NC_TEXT | NA_EDITED, text);
/* run the script while editing, evil but useful */
if (CTX_wm_space_text(C)->live_edit)
@@ -1352,7 +1352,7 @@ static int move_lines_exec(bContext *C, wmOperator *op)
void TEXT_OT_move_lines(wmOperatorType *ot)
{
- static EnumPropertyItem direction_items[]= {
+ static EnumPropertyItem direction_items[] = {
{TXT_MOVE_LINE_UP, "UP", 0, "Up", ""},
{TXT_MOVE_LINE_DOWN, "DOWN", 0, "Down", ""},
{0, NULL, 0, NULL, NULL}
diff --git a/source/blender/editors/space_userpref/space_userpref.c b/source/blender/editors/space_userpref/space_userpref.c
index 248f73b9ab6..5376b82f24c 100644
--- a/source/blender/editors/space_userpref/space_userpref.c
+++ b/source/blender/editors/space_userpref/space_userpref.c
@@ -57,23 +57,23 @@ static SpaceLink *userpref_new(const bContext *UNUSED(C))
{
ARegion *ar;
SpaceUserPref *spref;
-
- spref= MEM_callocN(sizeof(SpaceUserPref), "inituserpref");
- spref->spacetype= SPACE_USERPREF;
-
+
+ spref = MEM_callocN(sizeof(SpaceUserPref), "inituserpref");
+ spref->spacetype = SPACE_USERPREF;
+
/* header */
- ar= MEM_callocN(sizeof(ARegion), "header for userpref");
-
+ ar = MEM_callocN(sizeof(ARegion), "header for userpref");
+
BLI_addtail(&spref->regionbase, ar);
- ar->regiontype= RGN_TYPE_HEADER;
- ar->alignment= RGN_ALIGN_BOTTOM;
-
+ ar->regiontype = RGN_TYPE_HEADER;
+ ar->alignment = RGN_ALIGN_BOTTOM;
+
/* main area */
- ar= MEM_callocN(sizeof(ARegion), "main area for userpref");
-
+ ar = MEM_callocN(sizeof(ARegion), "main area for userpref");
+
BLI_addtail(&spref->regionbase, ar);
- ar->regiontype= RGN_TYPE_WINDOW;
-
+ ar->regiontype = RGN_TYPE_WINDOW;
+
return (SpaceLink *)spref;
}
@@ -93,10 +93,10 @@ static void userpref_init(struct wmWindowManager *UNUSED(wm), ScrArea *UNUSED(sa
static SpaceLink *userpref_duplicate(SpaceLink *sl)
{
- SpaceUserPref *sprefn= MEM_dupallocN(sl);
-
+ SpaceUserPref *sprefn = MEM_dupallocN(sl);
+
/* clear or remove stuff from old */
-
+
return (SpaceLink *)sprefn;
}
@@ -155,41 +155,41 @@ static void userpref_header_listener(ARegion *UNUSED(ar), wmNotifier *UNUSED(wmn
/* only called once, from space/spacetypes.c */
void ED_spacetype_userpref(void)
{
- SpaceType *st= MEM_callocN(sizeof(SpaceType), "spacetype userpref");
+ SpaceType *st = MEM_callocN(sizeof(SpaceType), "spacetype userpref");
ARegionType *art;
-
- st->spaceid= SPACE_USERPREF;
+
+ st->spaceid = SPACE_USERPREF;
strncpy(st->name, "Userpref", BKE_ST_MAXNAME);
-
- st->new= userpref_new;
- st->free= userpref_free;
- st->init= userpref_init;
- st->duplicate= userpref_duplicate;
- st->operatortypes= userpref_operatortypes;
- st->keymap= userpref_keymap;
-
+
+ st->new = userpref_new;
+ st->free = userpref_free;
+ st->init = userpref_init;
+ st->duplicate = userpref_duplicate;
+ st->operatortypes = userpref_operatortypes;
+ st->keymap = userpref_keymap;
+
/* regions: main window */
- art= MEM_callocN(sizeof(ARegionType), "spacetype userpref region");
+ art = MEM_callocN(sizeof(ARegionType), "spacetype userpref region");
art->regionid = RGN_TYPE_WINDOW;
- art->init= userpref_main_area_init;
- art->draw= userpref_main_area_draw;
- art->listener= userpref_main_area_listener;
- art->keymapflag= ED_KEYMAP_UI;
+ art->init = userpref_main_area_init;
+ art->draw = userpref_main_area_draw;
+ art->listener = userpref_main_area_listener;
+ art->keymapflag = ED_KEYMAP_UI;
BLI_addhead(&st->regiontypes, art);
-
+
/* regions: header */
- art= MEM_callocN(sizeof(ARegionType), "spacetype userpref region");
+ art = MEM_callocN(sizeof(ARegionType), "spacetype userpref region");
art->regionid = RGN_TYPE_HEADER;
- art->prefsizey= HEADERY;
- art->keymapflag= ED_KEYMAP_UI|ED_KEYMAP_VIEW2D|ED_KEYMAP_HEADER;
- art->listener= userpref_header_listener;
- art->init= userpref_header_area_init;
- art->draw= userpref_header_area_draw;
-
+ art->prefsizey = HEADERY;
+ art->keymapflag = ED_KEYMAP_UI | ED_KEYMAP_VIEW2D | ED_KEYMAP_HEADER;
+ art->listener = userpref_header_listener;
+ art->init = userpref_header_area_init;
+ art->draw = userpref_header_area_draw;
+
BLI_addhead(&st->regiontypes, art);
-
-
+
+
BKE_spacetype_register(st);
}
diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c
index 3be74b2811d..7210944d3e7 100644
--- a/source/blender/editors/space_view3d/drawobject.c
+++ b/source/blender/editors/space_view3d/drawobject.c
@@ -6472,7 +6472,7 @@ static void draw_hooks(Object *ob)
}
}
-static void drawRBpivot(bRigidBodyJointConstraint *data, const unsigned char ob_wire_col[4])
+static void draw_rigid_body_pivot(bRigidBodyJointConstraint *data, const unsigned char ob_wire_col[4])
{
const char *axis_str[3] = {"px", "py", "pz"};
int axis;
@@ -7098,12 +7098,13 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, const short
if (con->type == CONSTRAINT_TYPE_RIGIDBODYJOINT) {
bRigidBodyJointConstraint *data = (bRigidBodyJointConstraint *)con->data;
if (data->flag & CONSTRAINT_DRAW_PIVOT)
- drawRBpivot(data, ob_wire_col);
+ draw_rigid_body_pivot(data, ob_wire_col);
}
}
if (ob->gameflag & OB_BOUNDS) {
if (ob->boundtype != ob->collision_boundtype || (dtx & OB_BOUNDBOX) == 0) {
+
setlinestyle(2);
draw_bounding_volume(scene, ob, ob->collision_boundtype);
setlinestyle(0);
@@ -7138,8 +7139,11 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, const short
}
if (dt <= OB_SOLID && (v3d->flag2 & V3D_RENDER_OVERRIDE) == 0) {
- if ((ob->gameflag & OB_DYNAMIC) ||
- ((ob->gameflag & OB_BOUNDS) && (ob->boundtype == OB_BOUND_SPHERE)))
+ if (((ob->gameflag & OB_DYNAMIC) &&
+ !ELEM(ob->collision_boundtype, OB_BOUND_TRIANGLE_MESH, OB_BOUND_CONVEX_HULL)) ||
+
+ ((ob->gameflag & OB_BOUNDS) &&
+ (ob->boundtype == OB_BOUND_SPHERE)))
{
float imat[4][4], vec[3] = {0.0f, 0.0f, 0.0f};
diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c
index 709de274b8b..2d4fbb90ae1 100644
--- a/source/blender/editors/space_view3d/view3d_draw.c
+++ b/source/blender/editors/space_view3d/view3d_draw.c
@@ -2795,6 +2795,14 @@ static void draw_viewport_fps(Scene *scene, ARegion *ar)
static void view3d_main_area_draw_objects(const bContext *C, ARegion *ar, const char **grid_unit);
+static int view3d_main_area_do_render_draw(const bContext *C)
+{
+ Scene *scene = CTX_data_scene(C);
+ RenderEngineType *type = RE_engines_find(scene->r.engine);
+
+ return (type && type->view_update && type->view_draw);
+}
+
static int view3d_main_area_draw_engine(const bContext *C, ARegion *ar, int draw_border)
{
Scene *scene = CTX_data_scene(C);
@@ -3131,7 +3139,7 @@ void view3d_main_area_draw(const bContext *C, ARegion *ar)
int draw_border = (rv3d->persp == RV3D_CAMOB && (scene->r.mode & R_BORDER));
/* draw viewport using opengl */
- if (v3d->drawtype != OB_RENDER || draw_border) {
+ if (v3d->drawtype != OB_RENDER || !view3d_main_area_do_render_draw(C) || draw_border) {
view3d_main_area_draw_objects(C, ar, &grid_unit);
ED_region_pixelspace(ar);
}
diff --git a/source/blender/editors/space_view3d/view3d_view.c b/source/blender/editors/space_view3d/view3d_view.c
index 8fb012a18d6..4782b95ba1c 100644
--- a/source/blender/editors/space_view3d/view3d_view.c
+++ b/source/blender/editors/space_view3d/view3d_view.c
@@ -1564,13 +1564,15 @@ static void endlocalview(Main *bmain, Scene *scene, ScrArea *sa)
static int localview_exec(bContext *C, wmOperator *UNUSED(unused))
{
+ Main *bmain = CTX_data_main(C);
View3D *v3d = CTX_wm_view3d(C);
if (v3d->localvd)
endlocalview(CTX_data_main(C), CTX_data_scene(C), CTX_wm_area(C));
else
initlocalview(CTX_data_main(C), CTX_data_scene(C), CTX_wm_area(C));
-
+
+ DAG_id_type_tag(bmain, ID_OB);
ED_area_tag_redraw(CTX_wm_area(C));
return OPERATOR_FINISHED;
diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c
index e97df15543f..0f5f8970190 100644
--- a/source/blender/editors/transform/transform.c
+++ b/source/blender/editors/transform/transform.c
@@ -1652,6 +1652,12 @@ int initTransform(bContext *C, TransInfo *t, wmOperator *op, wmEvent *event, int
unit_m3(t->spacemtx);
t->draw_handle_view = ED_region_draw_cb_activate(t->ar->type, drawTransformView, t, REGION_DRAW_POST_VIEW);
}
+ else if (t->spacetype == SPACE_NODE) {
+ unit_m3(t->spacemtx);
+ /*t->draw_handle_apply = ED_region_draw_cb_activate(t->ar->type, drawTransformApply, t, REGION_DRAW_PRE_VIEW);*/
+ t->draw_handle_view = ED_region_draw_cb_activate(t->ar->type, drawTransformView, t, REGION_DRAW_POST_VIEW);
+ /*t->draw_handle_cursor = WM_paint_cursor_activate(CTX_wm_manager(C), helpline_poll, drawHelpline, t);*/
+ }
else
unit_m3(t->spacemtx);
@@ -2170,8 +2176,8 @@ static void constraintob_from_transdata(bConstraintOb *cob, TransData *td)
if (td->ext->rotOrder == ROT_MODE_QUAT) {
/* quats */
/* objects and bones do normalization first too, otherwise
- * we don't necessarily end up with a rotation matrix, and
- * then conversion back to quat gives a different result */
+ * we don't necessarily end up with a rotation matrix, and
+ * then conversion back to quat gives a different result */
float quat[4];
normalize_qt_qt(quat, td->ext->quat);
quat_to_mat4(cob->matrix, quat);
@@ -3542,6 +3548,11 @@ void initTranslation(TransInfo *t)
t->snap[1] = 0.125f;
t->snap[2] = 0.0625f;
}
+ else if (t->spacetype == SPACE_NODE) {
+ t->snap[0] = 0.0f;
+ t->snap[1] = 125.0f;
+ t->snap[2] = 25.0f;
+ }
else {
t->snap[0] = 0.0f;
t->snap[1] = t->snap[2] = 1.0f;
@@ -5004,7 +5015,6 @@ void projectSVData(TransInfo *t, int final)
for (i = 0, sv = sld->sv; i < sld->totsv; sv++, i++) {
BMIter fiter;
BMFace *f;
-
/* BMESH_TODO, this interpolates between vertex/loops which are not moved
* (are only apart of a face attached to a slide vert), couldn't we iterate BM_LOOPS_OF_VERT
@@ -5034,6 +5044,8 @@ void projectSVData(TransInfo *t, int final)
/* project onto copied projection face */
BM_ITER_ELEM (l, &liter, f, BM_LOOPS_OF_FACE) {
+ /* only affected verts will get interpolated */
+ char affected = FALSE;
f_copy_flip = f_copy;
if (BM_elem_flag_test(l->e, BM_ELEM_SELECT) || BM_elem_flag_test(l->prev->e, BM_ELEM_SELECT)) {
@@ -5058,6 +5070,8 @@ void projectSVData(TransInfo *t, int final)
if (!f_copy_flip) {
continue; /* shouldn't happen, but protection */
}
+
+ affected = TRUE;
}
else {
/* the loop is attached to only one vertex and not a selected edge,
@@ -5094,10 +5108,15 @@ void projectSVData(TransInfo *t, int final)
f_copy_flip = BLI_smallhash_lookup(&sld->origfaces, (uintptr_t)e_sel->l->radial_next->f);
}
}
+
+ affected = TRUE;
}
}
+ if(!affected)
+ continue;
+
/* only loop data, no vertex data since that contains shape keys,
* and we do not want to mess up other shape keys */
BM_loop_interp_from_face(em->bm, l, f_copy_flip, FALSE, FALSE);
@@ -5122,7 +5141,7 @@ void projectSVData(TransInfo *t, int final)
}
}
}
-
+
BLI_smallhash_release(&visit);
}
diff --git a/source/blender/editors/transform/transform.h b/source/blender/editors/transform/transform.h
index fdc09c1bed0..3ab5bf7bbfb 100644
--- a/source/blender/editors/transform/transform.h
+++ b/source/blender/editors/transform/transform.h
@@ -86,6 +86,7 @@ typedef struct TransSnap {
float snapTarget[3]; /* to this point */
float snapNormal[3];
float snapTangent[3];
+ char snapNodeBorder;
ListBase points;
TransSnapPoint *selectedPoint;
float dist; // Distance from snapPoint to snapTarget
diff --git a/source/blender/editors/transform/transform_constraints.c b/source/blender/editors/transform/transform_constraints.c
index d2910c5b602..034ea3eb704 100644
--- a/source/blender/editors/transform/transform_constraints.c
+++ b/source/blender/editors/transform/transform_constraints.c
@@ -276,7 +276,7 @@ static void axisProjection(TransInfo *t, float axis[3], float in[3], float out[3
sub_v3_v3v3(out, i1, t_con_center);
/* possible some values become nan when
- * viewpoint and object are both zero */
+ * viewpoint and object are both zero */
if (!finite(out[0])) out[0] = 0.0f;
if (!finite(out[1])) out[1] = 0.0f;
if (!finite(out[2])) out[2] = 0.0f;
@@ -306,7 +306,7 @@ static void planeProjection(TransInfo *t, float in[3], float out[3])
}
/*
- * Generic callback for constant spacial constraints applied to linear motion
+ * Generic callback for constant spatial constraints applied to linear motion
*
* The IN vector in projected into the constrained space and then further
* projected along the view vector.
@@ -404,9 +404,7 @@ static void applyObjectConstraintVec(TransInfo *t, TransData *td, float in[3], f
}
/*
- * Generic callback for constant spacial constraints applied to resize motion
- *
- *
+ * Generic callback for constant spatial constraints applied to resize motion
*/
static void applyAxisConstraintSize(TransInfo *t, TransData *td, float smat[3][3])
@@ -430,9 +428,7 @@ static void applyAxisConstraintSize(TransInfo *t, TransData *td, float smat[3][3
}
/*
- * Callback for object based spacial constraints applied to resize motion
- *
- *
+ * Callback for object based spatial constraints applied to resize motion
*/
static void applyObjectConstraintSize(TransInfo *t, TransData *td, float smat[3][3])
@@ -459,7 +455,7 @@ static void applyObjectConstraintSize(TransInfo *t, TransData *td, float smat[3]
}
/*
- * Generic callback for constant spacial constraints applied to rotations
+ * Generic callback for constant spatial constraints applied to rotations
*
* The rotation axis is copied into VEC.
*
@@ -501,7 +497,7 @@ static void applyAxisConstraintRot(TransInfo *t, TransData *td, float vec[3], fl
}
/*
- * Callback for object based spacial constraints applied to rotations
+ * Callback for object based spatial constraints applied to rotations
*
* The rotation axis is copied into VEC.
*
@@ -644,7 +640,7 @@ void drawConstraint(TransInfo *t)
{
TransCon *tc = &(t->con);
- if (!ELEM(t->spacetype, SPACE_VIEW3D, SPACE_IMAGE))
+ if (!ELEM3(t->spacetype, SPACE_VIEW3D, SPACE_IMAGE, SPACE_NODE))
return;
if (!(tc->mode & CON_APPLY))
return;
diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c
index e924ce15286..af0b33d58ae 100644
--- a/source/blender/editors/transform/transform_conversions.c
+++ b/source/blender/editors/transform/transform_conversions.c
@@ -2819,7 +2819,7 @@ static void posttrans_mask_clean(Mask *mask)
short added = 0;
masklay_shape_new = masklay_shape->next;
- if (masklay_shape->flag & GP_FRAME_SELECT) {
+ if (masklay_shape->flag & MASK_SHAPE_SELECT) {
BLI_remlink(&masklay->splines_shapes, masklay_shape);
/* find place to add them in buffer
@@ -5516,8 +5516,11 @@ static void NodeToTransData(TransData *td, TransData2D *td2d, bNode *node)
}
td->loc = td2d->loc;
- copy_v3_v3(td->center, td->loc);
copy_v3_v3(td->iloc, td->loc);
+ /* use node center instead of origin (top-left corner) */
+ td->center[0] = node->locx + 0.5f * (node->totr.xmax - node->totr.xmin);
+ td->center[1] = node->locy - 0.5f * (node->totr.ymax - node->totr.ymin); /* node height is used negative */
+ td->center[2] = 0.0f;
memset(td->axismtx, 0, sizeof(td->axismtx));
td->axismtx[2][2] = 1.0f;
@@ -5529,6 +5532,8 @@ static void NodeToTransData(TransData *td, TransData2D *td2d, bNode *node)
unit_m3(td->mtx);
unit_m3(td->smtx);
+
+ td->extra = node;
}
static void createTransNodeData(bContext *C, TransInfo *t)
@@ -5913,9 +5918,12 @@ static void createTransTrackingData(bContext *C, TransInfo *t)
t->total = 0;
+ if (!clip)
+ return;
+
BKE_movieclip_get_size(clip, &sc->user, &width, &height);
- if (!clip || width == 0 || height == 0)
+ if (width == 0 || height == 0)
return;
if (ar->regiontype == RGN_TYPE_PREVIEW) {
@@ -6321,7 +6329,7 @@ void createTransData(bContext *C, TransInfo *t)
#endif
}
else if (t->spacetype == SPACE_NODE) {
- t->flag |= T_2D_EDIT | T_POINTS;
+ t->flag |= T_POINTS | T_2D_EDIT;
createTransNodeData(C, t);
if (t->data && (t->flag & T_PROP_EDIT)) {
sort_trans_data(t); // makes selected become first in array
diff --git a/source/blender/editors/transform/transform_snap.c b/source/blender/editors/transform/transform_snap.c
index 90b67951614..c49e1715f34 100644
--- a/source/blender/editors/transform/transform_snap.c
+++ b/source/blender/editors/transform/transform_snap.c
@@ -42,6 +42,7 @@
#include "DNA_object_types.h"
#include "DNA_mesh_types.h"
#include "DNA_meshdata_types.h" // Temporary, for snapping to other unselected meshes
+#include "DNA_node_types.h"
#include "DNA_space_types.h"
#include "DNA_screen_types.h"
#include "DNA_view3d_types.h"
@@ -74,6 +75,7 @@
#include "ED_armature.h"
#include "ED_image.h"
#include "ED_mesh.h"
+#include "ED_node.h"
#include "ED_uvedit.h"
#include "ED_view3d.h"
@@ -113,6 +115,9 @@ static float ResizeBetween(TransInfo *t, float p1[3], float p2[3]);
/****************** IMPLEMENTATIONS *********************/
+static int snapNodeTest(View2D *v2d, bNode *node, SnapMode mode);
+static NodeBorder snapNodeBorder(int snap_node_mode);
+
#if 0
int BIF_snappingSupported(Object *obedit)
{
@@ -140,19 +145,22 @@ int activeSnap(TransInfo *t)
void drawSnapping(const struct bContext *C, TransInfo *t)
{
- if (validSnap(t) && activeSnap(t)) {
-
- unsigned char col[4], selectedCol[4], activeCol[4];
- UI_GetThemeColor3ubv(TH_TRANSFORM, col);
- col[3] = 128;
-
- UI_GetThemeColor3ubv(TH_SELECT, selectedCol);
- selectedCol[3] = 128;
-
- UI_GetThemeColor3ubv(TH_ACTIVE, activeCol);
- activeCol[3] = 192;
-
- if (t->spacetype == SPACE_VIEW3D) {
+ unsigned char col[4], selectedCol[4], activeCol[4];
+
+ if (!activeSnap(t))
+ return;
+
+ UI_GetThemeColor3ubv(TH_TRANSFORM, col);
+ col[3] = 128;
+
+ UI_GetThemeColor3ubv(TH_SELECT, selectedCol);
+ selectedCol[3] = 128;
+
+ UI_GetThemeColor3ubv(TH_ACTIVE, activeCol);
+ activeCol[3] = 192;
+
+ if (t->spacetype == SPACE_VIEW3D) {
+ if (validSnap(t)) {
TransSnapPoint *p;
View3D *v3d = CTX_wm_view3d(C);
RegionView3D *rv3d = CTX_wm_region_view3d(C);
@@ -160,11 +168,11 @@ void drawSnapping(const struct bContext *C, TransInfo *t)
float size;
glDisable(GL_DEPTH_TEST);
-
+
size = 2.5f * UI_GetThemeValuef(TH_VERTEX_SIZE);
-
+
invert_m4_m4(imat, rv3d->viewmat);
-
+
for (p = t->tsnap.points.first; p; p = p->next) {
if (p == t->tsnap.selectedPoint) {
glColor4ubv(selectedCol);
@@ -172,20 +180,20 @@ void drawSnapping(const struct bContext *C, TransInfo *t)
else {
glColor4ubv(col);
}
-
+
drawcircball(GL_LINE_LOOP, p->co, ED_view3d_pixel_size(rv3d, p->co) * size * 0.75f, imat);
}
-
+
if (t->tsnap.status & POINT_INIT) {
glColor4ubv(activeCol);
-
+
drawcircball(GL_LINE_LOOP, t->tsnap.snapPoint, ED_view3d_pixel_size(rv3d, t->tsnap.snapPoint) * size, imat);
}
/* draw normal if needed */
if (usingSnappingNormal(t) && validSnappingNormal(t)) {
glColor4ubv(activeCol);
-
+
glBegin(GL_LINES);
glVertex3f(t->tsnap.snapPoint[0], t->tsnap.snapPoint[1], t->tsnap.snapPoint[2]);
glVertex3f(t->tsnap.snapPoint[0] + t->tsnap.snapNormal[0],
@@ -197,7 +205,9 @@ void drawSnapping(const struct bContext *C, TransInfo *t)
if (v3d->zbuf)
glEnable(GL_DEPTH_TEST);
}
- else if (t->spacetype == SPACE_IMAGE) {
+ }
+ else if (t->spacetype == SPACE_IMAGE) {
+ if (validSnap(t)) {
/* This will not draw, and Im nor sure why - campbell */
#if 0
float xuser_asp, yuser_asp;
@@ -228,7 +238,36 @@ void drawSnapping(const struct bContext *C, TransInfo *t)
glTranslatef(-t->tsnap.snapPoint[0], -t->tsnap.snapPoint[1], 0.0f);
setlinestyle(0);
#endif
+ }
+ }
+ else if (t->spacetype == SPACE_NODE) {
+ if (validSnap(t)) {
+ ARegion *ar = CTX_wm_region(C);
+ TransSnapPoint *p;
+ float size;
+
+ size = 2.5f * UI_GetThemeValuef(TH_VERTEX_SIZE);
+
+ glEnable(GL_BLEND);
+ for (p = t->tsnap.points.first; p; p = p->next) {
+ if (p == t->tsnap.selectedPoint) {
+ glColor4ubv(selectedCol);
+ }
+ else {
+ glColor4ubv(col);
+ }
+
+ drawnodesnap(&ar->v2d, p->co, size, 0);
+ }
+
+ if (t->tsnap.status & POINT_INIT) {
+ glColor4ubv(activeCol);
+
+ drawnodesnap(&ar->v2d, t->tsnap.snapPoint, size, t->tsnap.snapNodeBorder);
+ }
+
+ glDisable(GL_BLEND);
}
}
}
@@ -349,6 +388,8 @@ void resetSnapping(TransInfo *t)
t->tsnap.snapNormal[0] = 0;
t->tsnap.snapNormal[1] = 0;
t->tsnap.snapNormal[2] = 0;
+
+ t->tsnap.snapNodeBorder = 0;
}
int usingSnappingNormal(TransInfo *t)
@@ -373,12 +414,20 @@ static void initSnappingMode(TransInfo *t)
Object *obedit = t->obedit;
Scene *scene = t->scene;
- /* force project off when not supported */
- if (ts->snap_mode != SCE_SNAP_MODE_FACE) {
+ if (t->spacetype == SPACE_NODE) {
+ /* force project off when not supported */
t->tsnap.project = 0;
+
+ t->tsnap.mode = ts->snap_node_mode;
+ }
+ else {
+ /* force project off when not supported */
+ if (ts->snap_mode != SCE_SNAP_MODE_FACE) {
+ t->tsnap.project = 0;
+ }
+
+ t->tsnap.mode = ts->snap_mode;
}
-
- t->tsnap.mode = ts->snap_mode;
if ((t->spacetype == SPACE_VIEW3D || t->spacetype == SPACE_IMAGE) && /* Only 3D view or UV */
(t->flag & T_CAMERA) == 0) /* Not with camera selected in camera view */
@@ -414,6 +463,19 @@ static void initSnappingMode(TransInfo *t)
t->tsnap.mode = SCE_SNAP_MODE_INCREMENT;
}
}
+ else if (t->spacetype == SPACE_NODE)
+ {
+ setSnappingCallback(t);
+
+ if (t->tsnap.applySnap != NULL)
+ {
+ t->tsnap.modeSelect = SNAP_NOT_SELECTED;
+ }
+ else {
+ /* Grid if snap is not possible */
+ t->tsnap.mode = SCE_SNAP_MODE_INCREMENT;
+ }
+ }
else {
/* Always grid outside of 3D view */
t->tsnap.mode = SCE_SNAP_MODE_INCREMENT;
@@ -459,7 +521,7 @@ void initSnapping(TransInfo *t, wmOperator *op)
}
/* use scene defaults only when transform is modal */
else if (t->flag & T_MODAL) {
- if (ELEM(t->spacetype, SPACE_VIEW3D, SPACE_IMAGE)) {
+ if (ELEM3(t->spacetype, SPACE_VIEW3D, SPACE_IMAGE, SPACE_NODE)) {
if (ts->snap_flag & SCE_SNAP) {
t->modifiers |= MOD_SNAP;
}
@@ -624,7 +686,17 @@ static void ApplySnapTranslation(TransInfo *t, float vec[3])
{
float point[3];
getSnapPoint(t, point);
- sub_v3_v3v3(vec, point, t->tsnap.snapTarget);
+
+ if (t->spacetype == SPACE_NODE) {
+ char border = t->tsnap.snapNodeBorder;
+ if (border & (NODE_LEFT | NODE_RIGHT))
+ vec[0] = point[0] - t->tsnap.snapTarget[0];
+ if (border & (NODE_BOTTOM | NODE_TOP))
+ vec[1] = point[1] - t->tsnap.snapTarget[1];
+ }
+ else {
+ sub_v3_v3v3(vec, point, t->tsnap.snapTarget);
+ }
}
static void ApplySnapRotation(TransInfo *t, float *value)
@@ -879,20 +951,57 @@ static void CalcSnapGeometry(TransInfo *t, float *UNUSED(vec))
t->tsnap.status &= ~POINT_INIT;
}
}
+ else if (t->spacetype == SPACE_NODE) {
+ float loc[2];
+ int dist = SNAP_MIN_DISTANCE; // Use a user defined value here
+ char node_border;
+
+ if (snapNodesTransform(t, t->mval, &dist, loc, &node_border, t->tsnap.modeSelect)) {
+ copy_v2_v2(t->tsnap.snapPoint, loc);
+ t->tsnap.snapNodeBorder = node_border;
+
+ t->tsnap.status |= POINT_INIT;
+ }
+ else {
+ t->tsnap.status &= ~POINT_INIT;
+ }
+ }
}
/********************** TARGET **************************/
+static void TargetSnapOffset(TransInfo *t, TransData *td)
+{
+ if (t->spacetype == SPACE_NODE && td != NULL) {
+ bNode *node = td->extra;
+ char border = t->tsnap.snapNodeBorder;
+ float width = node->totr.xmax - node->totr.xmin;
+ float height = node->totr.ymax - node->totr.ymin;
+
+ if (border & NODE_LEFT)
+ t->tsnap.snapTarget[0] -= 0.5f * width;
+ if (border & NODE_RIGHT)
+ t->tsnap.snapTarget[0] += 0.5f * width;
+ if (border & NODE_BOTTOM)
+ t->tsnap.snapTarget[1] -= 0.5f * height;
+ if (border & NODE_TOP)
+ t->tsnap.snapTarget[1] += 0.5f * height;
+ }
+}
+
static void TargetSnapCenter(TransInfo *t)
{
/* Only need to calculate once */
if ((t->tsnap.status & TARGET_INIT) == 0) {
copy_v3_v3(t->tsnap.snapTarget, t->center);
+
if (t->flag & (T_EDIT | T_POSE)) {
Object *ob = t->obedit ? t->obedit : t->poseobj;
mul_m4_v3(ob->obmat, t->tsnap.snapTarget);
}
+ TargetSnapOffset(t, NULL);
+
t->tsnap.status |= TARGET_INIT;
}
}
@@ -914,12 +1023,14 @@ static void TargetSnapActive(TransInfo *t)
if (active_td) {
copy_v3_v3(t->tsnap.snapTarget, active_td->center);
-
+
if (t->flag & (T_EDIT | T_POSE)) {
Object *ob = t->obedit ? t->obedit : t->poseobj;
mul_m4_v3(ob->obmat, t->tsnap.snapTarget);
}
+ TargetSnapOffset(t, active_td);
+
t->tsnap.status |= TARGET_INIT;
}
/* No active, default to median */
@@ -953,6 +1064,8 @@ static void TargetSnapMedian(TransInfo *t)
mul_m4_v3(ob->obmat, t->tsnap.snapTarget);
}
+ TargetSnapOffset(t, NULL);
+
t->tsnap.status |= TARGET_INIT;
}
}
@@ -1029,6 +1142,8 @@ static void TargetSnapClosest(TransInfo *t)
}
}
+ TargetSnapOffset(t, closest);
+
t->tsnap.status |= TARGET_INIT;
}
}
@@ -1876,6 +1991,113 @@ int peelObjectsContext(bContext *C, ListBase *depth_peels, const float mval[2],
return peelObjects(CTX_data_scene(C), v3d, CTX_wm_region(C), CTX_data_edit_object(C), depth_peels, mval, mode);
}
+/******************** NODES ***********************************/
+
+static int snapNodeTest(View2D *v2d, bNode *node, SnapMode mode)
+{
+ /* node is use for snapping only if a) snap mode matches and b) node is inside the view */
+ return ((mode == SNAP_NOT_SELECTED && !(node->flag & NODE_SELECT)) ||
+ (mode == SNAP_ALL && !(node->flag & NODE_ACTIVE))) &&
+ (node->totr.xmin < v2d->cur.xmax && node->totr.xmax > v2d->cur.xmin &&
+ node->totr.ymin < v2d->cur.ymax && node->totr.ymax > v2d->cur.ymin);
+}
+
+static NodeBorder snapNodeBorder(int snap_node_mode)
+{
+ switch (snap_node_mode) {
+ case SCE_SNAP_MODE_NODE_X:
+ return NODE_LEFT | NODE_RIGHT;
+ case SCE_SNAP_MODE_NODE_Y:
+ return NODE_TOP | NODE_BOTTOM;
+ case SCE_SNAP_MODE_NODE_XY:
+ return NODE_LEFT | NODE_RIGHT | NODE_TOP | NODE_BOTTOM;
+ }
+ return 0;
+}
+
+static int snapNode(ToolSettings *ts, SpaceNode *UNUSED(snode), ARegion *ar, bNode *node, const int mval[2],
+ float r_loc[2], int *r_dist, char *r_node_border)
+{
+ View2D *v2d = &ar->v2d;
+ NodeBorder border = snapNodeBorder(ts->snap_node_mode);
+ int retval = 0;
+ rcti totr;
+ int new_dist;
+
+ UI_view2d_to_region_no_clip(v2d, node->totr.xmin, node->totr.ymin, &totr.xmin, &totr.ymin);
+ UI_view2d_to_region_no_clip(v2d, node->totr.xmax, node->totr.ymax, &totr.xmax, &totr.ymax);
+
+ if (border & NODE_LEFT) {
+ new_dist = abs(totr.xmin - mval[0]);
+ if (new_dist < *r_dist) {
+ UI_view2d_region_to_view(v2d, totr.xmin, mval[1], &r_loc[0], &r_loc[1]);
+ *r_dist = new_dist;
+ *r_node_border = NODE_LEFT;
+ retval = 1;
+ }
+ }
+
+ if (border & NODE_RIGHT) {
+ new_dist = abs(totr.xmax - mval[0]);
+ if (new_dist < *r_dist) {
+ UI_view2d_region_to_view(v2d, totr.xmax, mval[1], &r_loc[0], &r_loc[1]);
+ *r_dist = new_dist;
+ *r_node_border = NODE_RIGHT;
+ retval = 1;
+ }
+ }
+
+ if (border & NODE_BOTTOM) {
+ new_dist = abs(totr.ymin - mval[1]);
+ if (new_dist < *r_dist) {
+ UI_view2d_region_to_view(v2d, mval[0], totr.ymin, &r_loc[0], &r_loc[1]);
+ *r_dist = new_dist;
+ *r_node_border = NODE_BOTTOM;
+ retval = 1;
+ }
+ }
+
+ if (border & NODE_TOP) {
+ new_dist = abs(totr.ymax - mval[1]);
+ if (new_dist < *r_dist) {
+ UI_view2d_region_to_view(v2d, mval[0], totr.ymax, &r_loc[0], &r_loc[1]);
+ *r_dist = new_dist;
+ *r_node_border = NODE_TOP;
+ retval = 1;
+ }
+ }
+
+ return retval;
+}
+
+static int snapNodes(ToolSettings *ts, SpaceNode *snode, ARegion *ar, const int mval[2],
+ int *r_dist, float r_loc[2], char *r_node_border, SnapMode mode)
+{
+ bNodeTree *ntree = snode->edittree;
+ bNode *node;
+ int retval = 0;
+
+ *r_node_border = 0;
+
+ for (node = ntree->nodes.first; node; node = node->next) {
+ if (snapNodeTest(&ar->v2d, node, mode))
+ retval |= snapNode(ts, snode, ar, node, mval, r_loc, r_dist, r_node_border);
+ }
+
+ return retval;
+}
+
+int snapNodesTransform(TransInfo *t, const int mval[2], int *r_dist, float r_loc[2], char *r_node_border, SnapMode mode)
+{
+ return snapNodes(t->settings, t->sa->spacedata.first, t->ar, mval, r_dist, r_loc, r_node_border, mode);
+}
+
+int snapNodesContext(bContext *C, const int mval[2], int *r_dist, float r_loc[2], char *r_node_border, SnapMode mode)
+{
+ Scene *scene = CTX_data_scene(C);
+ return snapNodes(scene->toolsettings, CTX_wm_space_node(C), CTX_wm_region(C), mval, r_dist, r_loc, r_node_border, mode);
+}
+
/*================================================================*/
static void applyGrid(TransInfo *t, float *val, int max_index, float fac[3], GearsType action);