diff options
author | Miika Hamalainen <blender@miikah.org> | 2012-07-04 21:15:05 +0400 |
---|---|---|
committer | Miika Hamalainen <blender@miikah.org> | 2012-07-04 21:15:05 +0400 |
commit | 9324503b84a06f76af072131da947547c84698ed (patch) | |
tree | b9336118dcf8df9e9ca4888d9ee3ac9fec2c2798 /source/blender/editors | |
parent | 234c338655fc49efef0b7ffe0ef6736e8630411a (diff) | |
parent | 958cf139f6587df631944f6ec0fcb4111c7e58fa (diff) |
Merge with trunk r48602
Diffstat (limited to 'source/blender/editors')
82 files changed, 998 insertions, 601 deletions
diff --git a/source/blender/editors/animation/drivers.c b/source/blender/editors/animation/drivers.c index 4a5966948ae..672e11ac613 100644 --- a/source/blender/editors/animation/drivers.c +++ b/source/blender/editors/animation/drivers.c @@ -416,6 +416,7 @@ static char *get_driver_path_hack(bContext *C, PointerRNA *ptr, PropertyRNA *pro char *basepath = RNA_path_from_ID_to_property(ptr, prop); char *path = basepath; /* in case no remapping is needed */ + /* Remapping will only be performed in the Properties Editor, as only this * restricts the subspace of options to the 'active' data (a manageable state) */ @@ -426,23 +427,6 @@ static char *get_driver_path_hack(bContext *C, PointerRNA *ptr, PropertyRNA *pro if (ob && id) { /* only id-types which can be remapped to go through objects should be considered */ switch (GS(id->name)) { - case ID_MA: /* materials */ - { - Material *ma = give_current_material(ob, ob->actcol); - - /* assumes: material will only be shown if it is active objects's active material it's ok */ - if ((ID *)ma == id) { - /* create new path */ - // TODO: use RNA path functions to construct instead? - path = BLI_sprintfN("material_slots[\"%s\"].material.%s", - ma->id.name + 2, basepath); - - /* free old one */ - MEM_freeN(basepath); - } - } - break; - case ID_TE: /* textures */ { Material *ma = give_current_material(ob, ob->actcol); @@ -452,6 +436,7 @@ static char *get_driver_path_hack(bContext *C, PointerRNA *ptr, PropertyRNA *pro if ((ID *)tex == id) { /* create new path */ // TODO: use RNA path functions to construct step by step instead? + // FIXME: maybe this isn't even needed anymore... path = BLI_sprintfN("material_slots[\"%s\"].material.texture_slots[\"%s\"].texture.%s", ma->id.name + 2, tex->id.name + 2, basepath); diff --git a/source/blender/editors/animation/keyframing.c b/source/blender/editors/animation/keyframing.c index 6250424d655..0c9a6ff6bf1 100644 --- a/source/blender/editors/animation/keyframing.c +++ b/source/blender/editors/animation/keyframing.c @@ -201,7 +201,7 @@ FCurve *verify_fcurve(bAction *act, const char group[], PointerRNA *ptr, grp = (bActionGroup *)BLI_findlink(&pose->agroups, (pchan->agrp_index - 1)); if (grp) { agrp->customCol = grp->customCol; - action_group_colors_sync(agrp); + action_group_colors_sync(agrp, grp); } } } @@ -1581,7 +1581,7 @@ void ANIM_OT_keyframe_delete_button(wmOperatorType *ot) ot->flag = OPTYPE_UNDO; /* properties */ - RNA_def_boolean(ot->srna, "all", 1, "All", "Delete keyfames from all elements of the array"); + RNA_def_boolean(ot->srna, "all", 1, "All", "Delete keyframes from all elements of the array"); } /* ******************************************* */ diff --git a/source/blender/editors/armature/armature_intern.h b/source/blender/editors/armature/armature_intern.h index 0760b384ecd..ddf66a6169b 100644 --- a/source/blender/editors/armature/armature_intern.h +++ b/source/blender/editors/armature/armature_intern.h @@ -183,7 +183,7 @@ LinkData *poseAnim_mapping_getNextFCurve(ListBase *fcuLinks, LinkData *prev, con void POSELIB_OT_new(struct wmOperatorType *ot); void POSELIB_OT_unlink(struct wmOperatorType *ot); -void POSELIB_OT_action_sanitise(struct wmOperatorType *ot); +void POSELIB_OT_action_sanitize(struct wmOperatorType *ot); void POSELIB_OT_pose_add(struct wmOperatorType *ot); void POSELIB_OT_pose_remove(struct wmOperatorType *ot); diff --git a/source/blender/editors/armature/armature_ops.c b/source/blender/editors/armature/armature_ops.c index f3461f71391..59ee90c553b 100644 --- a/source/blender/editors/armature/armature_ops.c +++ b/source/blender/editors/armature/armature_ops.c @@ -159,7 +159,7 @@ void ED_operatortypes_armature(void) WM_operatortype_append(POSELIB_OT_new); WM_operatortype_append(POSELIB_OT_unlink); - WM_operatortype_append(POSELIB_OT_action_sanitise); + WM_operatortype_append(POSELIB_OT_action_sanitize); /* POSE SLIDING */ WM_operatortype_append(POSE_OT_push); diff --git a/source/blender/editors/armature/editarmature.c b/source/blender/editors/armature/editarmature.c index ea3c8685525..6cef843d828 100644 --- a/source/blender/editors/armature/editarmature.c +++ b/source/blender/editors/armature/editarmature.c @@ -4563,7 +4563,7 @@ int ED_do_pose_selectbuffer(Scene *scene, Base *base, unsigned int *buffer, shor DAG_id_tag_update(&ob_act->id, OB_RECALC_DATA); } } - /* if there are some dependencies for visualising armature state + /* if there are some dependencies for visualizing armature state * (e.g. Mask Modifier in 'Armature' mode), force update */ else if (arm->flag & ARM_HAS_VIZ_DEPS) { @@ -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/armature/poseSlide.c b/source/blender/editors/armature/poseSlide.c index 824a39374fd..51700793791 100644 --- a/source/blender/editors/armature/poseSlide.c +++ b/source/blender/editors/armature/poseSlide.c @@ -220,7 +220,7 @@ static void pose_slide_apply_val(tPoseSlideOp *pso, FCurve *fcu, float *val) else { /* - these weights are derived from the relative distance of these * poses from the current frame - * - they then get normalised so that they only sum up to 1 + * - they then get normalized so that they only sum up to 1 */ float wtot; diff --git a/source/blender/editors/armature/poselib.c b/source/blender/editors/armature/poselib.c index 18e3d967835..ee54fc2c6fe 100644 --- a/source/blender/editors/armature/poselib.c +++ b/source/blender/editors/armature/poselib.c @@ -288,7 +288,7 @@ void POSELIB_OT_unlink(wmOperatorType *ot) /* This tool automagically generates/validates poselib data so that it corresponds to the data * in the action. This is for use in making existing actions usable as poselibs. */ -static int poselib_sanitise_exec(bContext *C, wmOperator *op) +static int poselib_sanitize_exec(bContext *C, wmOperator *op) { Object *ob = get_poselib_object(C); bAction *act = (ob) ? ob->poselib : NULL; @@ -353,15 +353,15 @@ static int poselib_sanitise_exec(bContext *C, wmOperator *op) return OPERATOR_FINISHED; } -void POSELIB_OT_action_sanitise(wmOperatorType *ot) +void POSELIB_OT_action_sanitize(wmOperatorType *ot) { /* identifiers */ - ot->name = "Sanitise Pose Library Action"; - ot->idname = "POSELIB_OT_action_sanitise"; + ot->name = "Sanitize Pose Library Action"; + ot->idname = "POSELIB_OT_action_sanitize"; ot->description = "Make action suitable for use as a Pose Library"; /* callbacks */ - ot->exec = poselib_sanitise_exec; + ot->exec = poselib_sanitize_exec; ot->poll = has_poselib_pose_data_poll; /* flags */ diff --git a/source/blender/editors/curve/editcurve.c b/source/blender/editors/curve/editcurve.c index 032b999c60f..e8a71a35576 100644 --- a/source/blender/editors/curve/editcurve.c +++ b/source/blender/editors/curve/editcurve.c @@ -2368,7 +2368,7 @@ void CURVE_OT_smooth_radius(wmOperatorType *ot) { /* identifiers */ ot->name = "Smooth Curve Radius"; - ot->description = "Flatten radiuses of selected points"; + ot->description = "Flatten radii of selected points"; ot->idname = "CURVE_OT_smooth_radius"; /* api clastbacks */ @@ -3932,7 +3932,8 @@ static int make_segment_exec(bContext *C, wmOperator *op) ListBase *nubase = object_editcurve_get(obedit); Nurb *nu, *nu1 = NULL, *nu2 = NULL; BPoint *bp; - int a, ok = 0; + int ok = 0; + /* int a; */ /* UNUSED */ /* first decide if this is a surface merge! */ if (obedit->type == OB_SURF) nu = nubase->first; @@ -4040,7 +4041,7 @@ static int make_segment_exec(bContext *C, wmOperator *op) MEM_freeN(nu1->bp); nu1->bp = bp; - a = nu1->pntsu + nu1->orderu; + /* a = nu1->pntsu + nu1->orderu; */ /* UNUSED */ nu1->pntsu += nu2->pntsu; BLI_remlink(nubase, nu2); diff --git a/source/blender/editors/gpencil/drawgpencil.c b/source/blender/editors/gpencil/drawgpencil.c index fa555b0ddb8..6d113cbb924 100644 --- a/source/blender/editors/gpencil/drawgpencil.c +++ b/source/blender/editors/gpencil/drawgpencil.c @@ -281,7 +281,7 @@ static void gp_draw_stroke(bGPDspoint *points, int totpoints, short thickness_s, } /* tessellation code - draw stroke as series of connected quads with connection - * edges rotated to minimise shrinking artifacts, and rounded endcaps + * edges rotated to minimize shrinking artifacts, and rounded endcaps */ else { bGPDspoint *pt1, *pt2; diff --git a/source/blender/editors/gpencil/editaction_gpencil.c b/source/blender/editors/gpencil/editaction_gpencil.c index a7beaa74eb7..b69db0040b5 100644 --- a/source/blender/editors/gpencil/editaction_gpencil.c +++ b/source/blender/editors/gpencil/editaction_gpencil.c @@ -399,7 +399,7 @@ void paste_gpdata(Scene *scene) /* this should be the right frame... as it may be a pre-existing frame, * must make sure that only compatible stroke types get copied over * - we cannot just add a duplicate frame, as that would cause errors - * - need to check for compatible types to minimise memory usage (copying 'junk' over) + * - need to check for compatible types to minimize memory usage (copying 'junk' over) */ for (gps = gpfs->strokes.first; gps; gps = gps->next) { short stroke_ok; 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_screen_types.h b/source/blender/editors/include/ED_screen_types.h index c53dca47da9..6b9d8385ac3 100644 --- a/source/blender/editors/include/ED_screen_types.h +++ b/source/blender/editors/include/ED_screen_types.h @@ -76,10 +76,10 @@ typedef struct ScreenFrameRateInfo { /* Enum for Action Zone Edges. Which edge of area is action zone. */ typedef enum { - AE_RIGHT_TO_TOPLEFT, /* Region located on the left, _right_ edge is action zone. Region minimised to the top left */ - AE_LEFT_TO_TOPRIGHT, /* Region located on the right, _left_ edge is action zone. Region minimised to the top right */ - AE_TOP_TO_BOTTOMRIGHT, /* Region located at the bottom, _top_ edge is action zone. Region minimised to the bottom right */ - AE_BOTTOM_TO_TOPLEFT /* Region located at the top, _bottom_edge is action zone. Region minimised to the top left */ + AE_RIGHT_TO_TOPLEFT, /* Region located on the left, _right_ edge is action zone. Region minimized to the top left */ + AE_LEFT_TO_TOPRIGHT, /* Region located on the right, _left_ edge is action zone. Region minimized to the top right */ + AE_TOP_TO_BOTTOMRIGHT, /* Region located at the bottom, _top_ edge is action zone. Region minimized to the bottom right */ + AE_BOTTOM_TO_TOPLEFT /* Region located at the top, _bottom_edge is action zone. Region minimized to the top left */ } AZEdge; /* for editing areas/regions */ 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.c b/source/blender/editors/interface/interface.c index d26c8cefdf0..49d56d427ba 100644 --- a/source/blender/editors/interface/interface.c +++ b/source/blender/editors/interface/interface.c @@ -498,7 +498,7 @@ static int ui_but_float_precision(uiBut *but, double value) return prec; } -static void ui_draw_linkline(uiLinkLine *line, int hilightActiveLines) +static void ui_draw_linkline(uiLinkLine *line, int highlightActiveLines) { rcti rect; @@ -511,7 +511,7 @@ static void ui_draw_linkline(uiLinkLine *line, int hilightActiveLines) if (line->flag & UI_SELECT) glColor3ub(100, 100, 100); - else if (hilightActiveLines && ((line->from->flag & UI_ACTIVE) || (line->to->flag & UI_ACTIVE))) + else if (highlightActiveLines && ((line->from->flag & UI_ACTIVE) || (line->to->flag & UI_ACTIVE))) UI_ThemeColor(TH_TEXT_HI); else glColor3ub(0, 0, 0); @@ -919,7 +919,7 @@ void uiEndBlock(const bContext *C, uiBlock *block) if (ui_but_update_from_old_block(C, block, &but)) ui_check_but(but); - /* temp? Proper check for greying out */ + /* temp? Proper check for graying out */ if (but->optype) { wmOperatorType *ot = but->optype; diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index b82e7c3a1e2..30c5f2fbe40 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -3362,7 +3362,7 @@ static void ui_ndofedit_but_HSVCIRCLE(uiBut *but, uiHandleButtonData *data, wmND ui_get_but_vectorf(but, rgb); rgb_to_hsv_compat_v(rgb, hsv); - /* Convert current colour on hue/sat disc to circular coordinates phi, r */ + /* Convert current color on hue/sat disc to circular coordinates phi, r */ phi = fmodf(hsv[0] + 0.25f, 1.0f) * -2.0f * (float)M_PI; r = hsv[1]; /* sqr= r>0.f?sqrtf(r):1; */ /* UNUSED */ @@ -5009,7 +5009,7 @@ static uiBut *ui_but_find_mouse_over(ARegion *ar, int x, int y) ui_window_to_block(ar, block, &mx, &my); for (but = block->buttons.first; but; but = but->next) { - /* note, LABEL is included for hilights, this allows drags */ + /* note, LABEL is included for highlights, this allows drags */ if (but->type == LABEL && but->dragpoin == NULL) continue; if (ELEM3(but->type, ROUNDBOX, SEPR, LISTBOX)) diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c index d87ca0f7bb6..e6a4c260d0f 100644 --- a/source/blender/editors/interface/interface_templates.c +++ b/source/blender/editors/interface/interface_templates.c @@ -782,7 +782,7 @@ static uiLayout *draw_modifier(uiLayout *layout, Scene *scene, Object *ob, if (modifier_couldBeCage(scene, md) && (index <= lastCageIndex)) { /* -- convert to rna ? */ but = uiDefIconButBitI(block, TOG, eModifierMode_OnCage, 0, ICON_MESH_DATA, 0, 0, UI_UNIT_X - 2, UI_UNIT_Y, &md->mode, 0.0, 0.0, 0.0, 0.0, - TIP_("Apply modifier to editing cage during Editmode")); + TIP_("Apply modifier to editing cage during Edit mode")); if (index < cageIndex) uiButSetFlag(but, UI_BUT_DISABLED); uiButSetFunc(but, modifiers_setOnCage, ob, md); @@ -1051,7 +1051,7 @@ static uiLayout *draw_constraint(uiLayout *layout, Object *ob, bConstraint *con) * as that poses problems when restoring them, so disable the "up" button where * it may cause this situation. * - * Up/Down buttons should only be shown (or not greyed - todo) if they serve some purpose. + * Up/Down buttons should only be shown (or not grayed - todo) if they serve some purpose. */ if (proxylocked_constraints_owner(ob, pchan)) { if (con->prev) { @@ -2679,7 +2679,7 @@ void uiTemplateReportsBanner(uiLayout *layout, bContext *C) but->col[3] = 255; but = uiDefBut(block, ROUNDBOX, 0, "", UI_UNIT_X + 10, 0, UI_UNIT_X + width, UI_UNIT_Y, NULL, 0.0f, 0.0f, 0, 0, ""); - but->col[0] = but->col[1] = but->col[2] = FTOCHAR(rti->greyscale); + but->col[0] = but->col[1] = but->col[2] = FTOCHAR(rti->grayscale); but->col[3] = 255; uiBlockEndAlign(block); @@ -2699,7 +2699,8 @@ void uiTemplateReportsBanner(uiLayout *layout, bContext *C) uiBlockSetEmboss(block, UI_EMBOSSN); if (reports->list.first != reports->list.last) - uiDefIconButO(block, BUT, "UI_OT_reports_to_textblock", WM_OP_INVOKE_REGION_WIN, icon, 2, 0, UI_UNIT_X, UI_UNIT_Y, TIP_("Click to see rest of reports in textblock: 'Recent Reports'")); + uiDefIconButO(block, BUT, "UI_OT_reports_to_textblock", WM_OP_INVOKE_REGION_WIN, icon, 2, 0, + UI_UNIT_X, UI_UNIT_Y, TIP_("Click to see the remaining reports in text block: 'Recent Reports'")); else uiDefIconBut(block, LABEL, 0, icon, 2, 0, UI_UNIT_X, UI_UNIT_Y, NULL, 0.0f, 0.0f, 0, 0, ""); diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c index 07b1217b1bd..5ee89bb418f 100644 --- a/source/blender/editors/interface/interface_widgets.c +++ b/source/blender/editors/interface/interface_widgets.c @@ -1434,7 +1434,7 @@ static struct uiWidgetColors wcol_menu_back = { 25, -20 }; -/* tooltip colour */ +/* tooltip color */ static struct uiWidgetColors wcol_tooltip = { {0, 0, 0, 255}, {25, 25, 25, 230}, diff --git a/source/blender/editors/interface/resources.c b/source/blender/editors/interface/resources.c index fe46a5dc9c5..407b2308af8 100644 --- a/source/blender/editors/interface/resources.c +++ b/source/blender/editors/interface/resources.c @@ -1888,8 +1888,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..392aae1632d 100644 --- a/source/blender/editors/interface/view2d.c +++ b/source/blender/editors/interface/view2d.c @@ -431,7 +431,7 @@ void UI_view2d_curRect_validate_resize(View2D *v2d, int resize) /* curRatio = height / width; */ /* UNUSED */ winRatio = winy / winx; - /* both sizes change (area/region maximised) */ + /* both sizes change (area/region maximized) */ if (do_x == do_y) { if (do_x && do_y) { /* here is 1,1 case, so all others must be 0,0 */ @@ -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..77808d0a00d 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); } @@ -276,7 +276,7 @@ void WM_OT_collada_export(wmOperatorType *ot) RNA_def_boolean(ot->srna, "include_material_textures", 0, "Include Material Textures", "Export textures assigned to the object Materials"); - RNA_def_boolean(ot->srna, "use_texture_copies", 1, "copy", + RNA_def_boolean(ot->srna, "use_texture_copies", 1, "Copy", "Copy textures to same folder where the .dae file is exported"); 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/mask/mask_draw.c b/source/blender/editors/mask/mask_draw.c index 83337a18223..f080b9f96e7 100644 --- a/source/blender/editors/mask/mask_draw.c +++ b/source/blender/editors/mask/mask_draw.c @@ -192,9 +192,9 @@ static void draw_spline_points(MaskLayer *masklay, MaskSpline *spline, /* this could be split into its own loop */ if (draw_type == MASK_DT_OUTLINE) { - const unsigned char rgb_grey[4] = {0x60, 0x60, 0x60, 0xff}; + const unsigned char rgb_gray[4] = {0x60, 0x60, 0x60, 0xff}; glLineWidth(3); - glColor4ubv(rgb_grey); + glColor4ubv(rgb_gray); glBegin(GL_LINES); glVertex3fv(vert); glVertex3fv(handle); diff --git a/source/blender/editors/mask/mask_edit.c b/source/blender/editors/mask/mask_edit.c index 6e0da5fd756..cce7e26115e 100644 --- a/source/blender/editors/mask/mask_edit.c +++ b/source/blender/editors/mask/mask_edit.c @@ -310,7 +310,8 @@ void ED_keymap_mask(wmKeyConfig *keyconf) WM_keymap_add_item(keymap, "MASK_OT_normals_make_consistent", NKEY, KM_PRESS, KM_CTRL, 0); // WM_keymap_add_item(keymap, "MASK_OT_feather_weight_clear", SKEY, KM_PRESS, KM_ALT, 0); /* ... matches curve editmode */ - RNA_enum_set(WM_keymap_add_item(keymap, "TRANSFORM_OT_transform", SKEY, KM_PRESS, KM_ALT, 0)->ptr, "mode", TFM_MASK_SHRINKFATTEN); + RNA_enum_set(WM_keymap_add_item(keymap, "TRANSFORM_OT_transform", SKEY, KM_PRESS, KM_ALT, 0)->ptr, + "mode", TFM_MASK_SHRINKFATTEN); /* relationships */ WM_keymap_add_item(keymap, "MASK_OT_parent_set", PKEY, KM_PRESS, KM_CTRL, 0); @@ -329,13 +330,15 @@ void ED_operatormacros_mask(void) wmOperatorType *ot; wmOperatorTypeMacro *otmacro; - ot = WM_operatortype_append_macro("MASK_OT_add_vertex_slide", "Add Vertex and Slide", "Add new vertex and slide it", OPTYPE_UNDO | OPTYPE_REGISTER); + ot = WM_operatortype_append_macro("MASK_OT_add_vertex_slide", "Add Vertex and Slide", + "Add new vertex and slide it", OPTYPE_UNDO | OPTYPE_REGISTER); ot->description = "Add new vertex and slide it"; WM_operatortype_macro_define(ot, "MASK_OT_add_vertex"); otmacro = WM_operatortype_macro_define(ot, "TRANSFORM_OT_translate"); RNA_boolean_set(otmacro->ptr, "release_confirm", TRUE); - ot = WM_operatortype_append_macro("MASK_OT_add_feather_vertex_slide", "Add Feather Vertex and Slide", "Add new vertex to feater and slide it", OPTYPE_UNDO | OPTYPE_REGISTER); + ot = WM_operatortype_append_macro("MASK_OT_add_feather_vertex_slide", "Add Feather Vertex and Slide", + "Add new vertex to feather and slide it", OPTYPE_UNDO | OPTYPE_REGISTER); ot->description = "Add new feather vertex and slide it"; WM_operatortype_macro_define(ot, "MASK_OT_add_feather_vertex"); otmacro = WM_operatortype_macro_define(ot, "MASK_OT_slide_point"); diff --git a/source/blender/editors/mask/mask_shapekey.c b/source/blender/editors/mask/mask_shapekey.c index a619ac7e3cd..c5b9fc33a9b 100644 --- a/source/blender/editors/mask/mask_shapekey.c +++ b/source/blender/editors/mask/mask_shapekey.c @@ -229,7 +229,7 @@ void MASK_OT_shape_key_feather_reset(wmOperatorType *ot) { /* identifiers */ ot->name = "Feather Reset Animation"; - ot->description = "Resets fearther weights on all selected points animation values"; + ot->description = "Reset feather weights on all selected points animation values"; ot->idname = "MASK_OT_shape_key_feather_reset"; /* api callbacks */ @@ -394,7 +394,7 @@ void MASK_OT_shape_key_rekey(wmOperatorType *ot) { /* identifiers */ ot->name = "Re-Key Points of Selected Shapes"; - ot->description = "Recalculates animation data on selected points for frames selected in the dopesheet"; + ot->description = "Recalculate animation data on selected points for frames selected in the dopesheet"; ot->idname = "MASK_OT_shape_key_rekey"; /* api callbacks */ 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 0ef62e536fa..5404eb3bea6 100644 --- a/source/blender/editors/mesh/editmesh_select.c +++ b/source/blender/editors/mesh/editmesh_select.c @@ -710,7 +710,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); @@ -748,7 +748,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); @@ -789,7 +789,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); 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 0f7d4c5c547..0f13df4c777 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); @@ -2892,11 +2892,9 @@ static int mesh_separate_material(Main *bmain, Scene *scene, Base *editbase, wmO static int mesh_separate_loose(Main *bmain, Scene *scene, Base *editbase, wmOperator *wmop) { int i; - BMVert *v; BMEdge *e; BMVert *v_seed; BMWalker walker; - BMIter iter; int result = FALSE; Object *obedit = editbase->object; BMEditMesh *em = BMEdit_FromObject(obedit); @@ -2913,11 +2911,7 @@ static int mesh_separate_loose(Main *bmain, Scene *scene, Base *editbase, wmOper * original mesh.*/ for (i = 0; i < max_iter; i++) { /* Get a seed vertex to start the walk */ - v_seed = NULL; - BM_ITER_MESH (v, &iter, bm, BM_VERTS_OF_MESH) { - v_seed = v; - break; - } + v_seed = BM_iter_at_index(bm, BM_VERTS_OF_MESH, NULL, 0); /* No vertices available, can't do anything */ if (v_seed == NULL) { @@ -4187,11 +4181,11 @@ void MESH_OT_sort_elements(wmOperatorType *ot) { static EnumPropertyItem type_items[] = { {SRT_VIEW_ZAXIS, "VIEW_ZAXIS", 0, "View Z Axis", - "Sort selected elements from farest to nearest one in current view"}, + "Sort selected elements from farthest to nearest one in current view"}, {SRT_VIEW_XAXIS, "VIEW_XAXIS", 0, "View X Axis", "Sort selected elements from left to right one in current view"}, {SRT_CURSOR_DISTANCE, "CURSOR_DISTANCE", 0, "Cursor Distance", - "Sort selected elements from nearest to farest from 3D cursor"}, + "Sort selected elements from nearest to farthest from 3D cursor"}, {SRT_MATERIAL, "MATERIAL", 0, "Material", "Sort selected elements from smallest to greatest material index (faces only!)"}, {SRT_SELECTED, "SELECTED", 0, "Selected", @@ -4966,7 +4960,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 +5026,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 +5036,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 6d6165e2729..cdbf5751ea1 100644 --- a/source/blender/editors/mesh/meshtools.c +++ b/source/blender/editors/mesh/meshtools.c @@ -898,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; @@ -926,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; @@ -989,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/metaball/mball_edit.c b/source/blender/editors/metaball/mball_edit.c index 7b7aaf5a3db..50d5569c483 100644 --- a/source/blender/editors/metaball/mball_edit.c +++ b/source/blender/editors/metaball/mball_edit.c @@ -228,7 +228,8 @@ void MBALL_OT_select_random_metaelems(struct wmOperatorType *ot) ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; /* properties */ - RNA_def_float_percentage(ot->srna, "percent", 0.5f, 0.0f, 1.0f, "Percent", "Percentage of metaelems to select randomly", 0.0001f, 1.0f); + RNA_def_float_percentage(ot->srna, "percent", 0.5f, 0.0f, 1.0f, "Percent", + "Percentage of metaelements to select randomly", 0.0001f, 1.0f); } /***************************** Duplicate operator *****************************/ 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_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 b3be18dfb9c..aab3d8afb22 100644 --- a/source/blender/editors/object/object_modifier.c +++ b/source/blender/editors/object/object_modifier.c @@ -176,7 +176,7 @@ ModifierData *ED_object_modifier_add(ReportList *reports, Main *bmain, Scene *sc /* 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) + ModifierType type) { ModifierData *md; @@ -195,10 +195,10 @@ static int object_has_modifier(const Object *ob, const ModifierData *exclude, * * 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) + int (*callback)(Object *ob, void *callback_data), + void *callback_data) { ID *ob_data_id = orig_ob->data; int users = ob_data_id->us; @@ -239,8 +239,8 @@ static int object_has_modifier_cb(Object *ob, void *data) } /* 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. */ + * 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; @@ -257,16 +257,16 @@ int ED_object_multires_update_totlevels_cb(Object *ob, void *totlevel_v) /* 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) + ModifierData *exclude, + ModifierType type) { return (!object_has_modifier(ob, exclude, type) && - !ED_object_iter_other(bmain, ob, FALSE, - object_has_modifier_cb, &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) + int *sort_depsgraph) { ModifierData *obmd; @@ -844,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) @@ -916,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); } @@ -955,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); } @@ -994,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); } @@ -1042,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); @@ -1085,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); } @@ -1124,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); } @@ -1173,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); } @@ -1218,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); } @@ -1282,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); } @@ -1357,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); @@ -1429,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); } @@ -1754,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; @@ -1844,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); } @@ -1939,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); } @@ -1986,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); } @@ -2201,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/physics/physics_fluid.c b/source/blender/editors/physics/physics_fluid.c index b31e5c0aea3..2e58fa85a11 100644 --- a/source/blender/editors/physics/physics_fluid.c +++ b/source/blender/editors/physics/physics_fluid.c @@ -567,11 +567,14 @@ static void export_fluid_objects(ListBase *fobjects, Scene *scene, int length) if (deform) { fsmesh.channelSizeVertices = length; fsmesh.channelVertices = fobj->VertexCache; - - // remove channels + + /* remove channels */ fsmesh.channelTranslation = fsmesh.channelRotation = - fsmesh.channelScale = NULL; + fsmesh.channelScale = NULL; + + /* Override user settings, only noslip is supported here! */ + fsmesh.obstacleType = FLUIDSIM_OBSTACLE_NOSLIP; } elbeemAddMesh(&fsmesh); diff --git a/source/blender/editors/render/render_opengl.c b/source/blender/editors/render/render_opengl.c index de3d2d4e871..d37a16cb1bb 100644 --- a/source/blender/editors/render/render_opengl.c +++ b/source/blender/editors/render/render_opengl.c @@ -518,7 +518,7 @@ static int screen_opengl_render_anim_step(bContext *C, wmOperator *op) ibuf = BKE_image_acquire_ibuf(oglrender->ima, &oglrender->iuser, &lock); if (ibuf) { - /* color -> greyscale */ + /* color -> grayscale */ /* editing directly would alter the render view */ if (scene->r.im_format.planes == R_IMF_PLANES_BW) { ImBuf *ibuf_bw = IMB_dupImBuf(ibuf); diff --git a/source/blender/editors/screen/screen_edit.c b/source/blender/editors/screen/screen_edit.c index 3533a337aa1..a638aac9423 100644 --- a/source/blender/editors/screen/screen_edit.c +++ b/source/blender/editors/screen/screen_edit.c @@ -862,7 +862,7 @@ static void draw_join_shape(ScrArea *sa, char dir) draw_horizontal_join_shape(sa, dir); } -/* draw screen area darker with arrow (visualisation of future joining) */ +/* draw screen area darker with arrow (visualization of future joining) */ static void scrarea_draw_shape_dark(ScrArea *sa, char dir) { glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); diff --git a/source/blender/editors/screen/screen_ops.c b/source/blender/editors/screen/screen_ops.c index cacd6d01291..6be276dea14 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); } @@ -2826,7 +2826,7 @@ static int header_toolbox_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *U uiItemS(layout); - /* file browser should be fullscreen all the time, but other regions can be maximised/restored... */ + /* file browser should be fullscreen all the time, but other regions can be maximized/restored... */ if (sa->spacetype != SPACE_FILE) { if (sa->full) uiItemO(layout, "Tile Area", ICON_NONE, "SCREEN_OT_screen_full_area"); 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/paint_vertex.c b/source/blender/editors/sculpt_paint/paint_vertex.c index 3c37ad8cf2a..1b62ba8a7e0 100644 --- a/source/blender/editors/sculpt_paint/paint_vertex.c +++ b/source/blender/editors/sculpt_paint/paint_vertex.c @@ -3045,7 +3045,7 @@ static int weight_from_bones_exec(bContext *C, wmOperator *op) void PAINT_OT_weight_from_bones(wmOperatorType *ot) { static EnumPropertyItem type_items[] = { - {ARM_GROUPS_AUTO, "AUTOMATIC", 0, "Automatic", "Automatic weights froms bones"}, + {ARM_GROUPS_AUTO, "AUTOMATIC", 0, "Automatic", "Automatic weights from bones"}, {ARM_GROUPS_ENVELOPE, "ENVELOPES", 0, "From Envelopes", "Weights from envelopes with user defined radius"}, {0, NULL, 0, NULL, 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_clip/clip_ops.c b/source/blender/editors/space_clip/clip_ops.c index e76edcf0290..9d1f52568b4 100644 --- a/source/blender/editors/space_clip/clip_ops.c +++ b/source/blender/editors/space_clip/clip_ops.c @@ -654,7 +654,7 @@ void CLIP_OT_view_zoom_out(wmOperatorType *ot) /* properties */ RNA_def_float_vector(ot->srna, "location", 2, NULL, -FLT_MAX, FLT_MAX, "Location", - "Cursor location in normalised (0.0-1.0) coordinates", -10.0f, 10.0f); + "Cursor location in normalized (0.0-1.0) coordinates", -10.0f, 10.0f); } /********************** view zoom ratio operator *********************/ diff --git a/source/blender/editors/space_file/file_intern.h b/source/blender/editors/space_file/file_intern.h index 3ad6614d356..a07a560328c 100644 --- a/source/blender/editors/space_file/file_intern.h +++ b/source/blender/editors/space_file/file_intern.h @@ -91,7 +91,7 @@ int file_directory_exec(bContext *C, struct wmOperator *unused); int file_directory_new_exec(bContext *C, struct wmOperator *unused); int file_delete_exec(bContext *C, struct wmOperator *unused); -int file_hilight_set(struct SpaceFile *sfile, struct ARegion *ar, int mx, int my); +int file_highlight_set(struct SpaceFile *sfile, struct ARegion *ar, int mx, int my); void file_sfile_to_operator(struct wmOperator *op, struct SpaceFile *sfile, char *filepath); void file_operator_to_sfile(struct SpaceFile *sfile, struct wmOperator *op); diff --git a/source/blender/editors/space_file/file_ops.c b/source/blender/editors/space_file/file_ops.c index 0cf3586e659..2d778b94216 100644 --- a/source/blender/editors/space_file/file_ops.c +++ b/source/blender/editors/space_file/file_ops.c @@ -515,7 +515,7 @@ void FILE_OT_delete_bookmark(wmOperatorType *ot) RNA_def_int(ot->srna, "index", -1, -1, 20000, "Index", "", -1, 20000); } -int file_hilight_set(SpaceFile *sfile, ARegion *ar, int mx, int my) +int file_highlight_set(SpaceFile *sfile, ARegion *ar, int mx, int my) { View2D *v2d = &ar->v2d; FileSelectParams *params; @@ -555,7 +555,7 @@ static int file_highlight_invoke(bContext *C, wmOperator *UNUSED(op), wmEvent *e ARegion *ar = CTX_wm_region(C); SpaceFile *sfile = CTX_wm_space_file(C); - if (!file_hilight_set(sfile, ar, event->x, event->y)) + if (!file_highlight_set(sfile, ar, event->x, event->y)) return OPERATOR_CANCELLED; ED_area_tag_redraw(CTX_wm_area(C)); diff --git a/source/blender/editors/space_file/space_file.c b/source/blender/editors/space_file/space_file.c index 79979603f54..95d5483b42c 100644 --- a/source/blender/editors/space_file/space_file.c +++ b/source/blender/editors/space_file/space_file.c @@ -356,7 +356,7 @@ static void file_main_area_draw(const bContext *C, ARegion *ar) /* on first read, find active file */ if (params->active_file == -1) { wmEvent *event = CTX_wm_window(C)->eventstate; - file_hilight_set(sfile, ar, event->x, event->y); + file_highlight_set(sfile, ar, event->x, event->y); } file_draw_list(C, ar); diff --git a/source/blender/editors/space_graph/graph_draw.c b/source/blender/editors/space_graph/graph_draw.c index ddca0030cf5..870e9bb8168 100644 --- a/source/blender/editors/space_graph/graph_draw.c +++ b/source/blender/editors/space_graph/graph_draw.c @@ -276,7 +276,7 @@ static void draw_fcurve_vertices(SpaceIpo *sipo, ARegion *ar, FCurve *fcu, short View2D *v2d = &ar->v2d; /* only draw points if curve is visible - * - draw unselected points before selected points as separate passes to minimise color-changing overhead + * - draw unselected points before selected points as separate passes to minimize color-changing overhead * (XXX dunno if this is faster than drawing all in one pass though) * and also to make sure in the case of overlapping points that the selected is always visible * - draw handles before keyframes, so that keyframes will overlap handles (keyframes are more important for users) @@ -851,7 +851,7 @@ void graph_draw_curves(bAnimContext *ac, SpaceIpo *sipo, ARegion *ar, View2DGrid setlinestyle(2); } if ( ((fcu->grp) && (fcu->grp->flag & AGRP_MUTED)) || (fcu->flag & FCURVE_MUTED) ) { - /* muted curves are drawn in a greyish hue */ + /* muted curves are drawn in a grayish hue */ // XXX should we have some variations? UI_ThemeColorShade(TH_HEADER, 50); } diff --git a/source/blender/editors/space_graph/space_graph.c b/source/blender/editors/space_graph/space_graph.c index 756e6997fc8..f4cb4ec3d05 100644 --- a/source/blender/editors/space_graph/space_graph.c +++ b/source/blender/editors/space_graph/space_graph.c @@ -189,6 +189,8 @@ static void graph_init(struct wmWindowManager *UNUSED(wm), ScrArea *sa) sipo->ads->source = (ID *)(G.main->scene.first); // FIXME: this is a really nasty hack here for now... } + /* force immediate init of any invalid F-Curve colors */ + sipo->flag |= SIPO_TEMP_NEEDCHANSYNC; ED_area_tag_refresh(sa); } @@ -477,7 +479,13 @@ static void graph_listener(ScrArea *sa, wmNotifier *wmn) if (wmn->data == ND_SPACE_GRAPH) ED_area_tag_redraw(sa); break; - + case NC_WINDOW: + if (sipo->flag & SIPO_TEMP_NEEDCHANSYNC) { + /* force redraw/refresh after undo/redo - prevents "black curve" problem */ + ED_area_tag_refresh(sa); + } + break; + // XXX: restore the case below if not enough updates occur... //default: // if (wmn->data==ND_KEYS) diff --git a/source/blender/editors/space_image/image_buttons.c b/source/blender/editors/space_image/image_buttons.c index aa596b8b635..92c339d7672 100644 --- a/source/blender/editors/space_image/image_buttons.c +++ b/source/blender/editors/space_image/image_buttons.c @@ -148,7 +148,7 @@ static void image_info(Scene *scene, ImageUser *iuser, Image *ima, ImBuf *ibuf, /* the frame number, even if we cant */ if (ima->source == IMA_SRC_SEQUENCE) { /* don't use iuser->framenr directly because it may not be updated if auto-refresh is off */ - const int framenr = BKE_image_user_frame_get(iuser, CFRA, 0); + const int framenr = BKE_image_user_frame_get(iuser, CFRA, 0, NULL); ofs += sprintf(str + ofs, IFACE_(", Frame: %d"), framenr); } diff --git a/source/blender/editors/space_info/info_ops.c b/source/blender/editors/space_info/info_ops.c index 080f12bf35b..33a2d5c18c5 100644 --- a/source/blender/editors/space_info/info_ops.c +++ b/source/blender/editors/space_info/info_ops.c @@ -340,7 +340,7 @@ static int update_reports_display_invoke(bContext *C, wmOperator *UNUSED(op), wm ReportTimerInfo *rti; float progress = 0.0, color_progress = 0.0; float neutral_col[3] = {0.35, 0.35, 0.35}; - float neutral_grey = 0.6; + float neutral_gray = 0.6; float timeout = 0.0, color_timeout = 0.0; int send_note = 0; @@ -385,7 +385,7 @@ static int update_reports_display_invoke(bContext *C, wmOperator *UNUSED(op), wm rti->col[1] = 0.45; rti->col[2] = 0.7; } - rti->greyscale = 0.75; + rti->grayscale = 0.75; rti->widthfac = 1.0; } @@ -398,7 +398,7 @@ static int update_reports_display_invoke(bContext *C, wmOperator *UNUSED(op), wm /* fade colors out sharply according to progress through fade-out duration */ interp_v3_v3v3(rti->col, rti->col, neutral_col, color_progress); - rti->greyscale = interpf(neutral_grey, rti->greyscale, color_progress); + rti->grayscale = interpf(neutral_gray, rti->grayscale, color_progress); } /* collapse report at end of timeout */ diff --git a/source/blender/editors/space_nla/nla_draw.c b/source/blender/editors/space_nla/nla_draw.c index 7eb0f676707..92f014fd804 100644 --- a/source/blender/editors/space_nla/nla_draw.c +++ b/source/blender/editors/space_nla/nla_draw.c @@ -89,7 +89,7 @@ static void nla_action_get_color(AnimData *adt, bAction *act, float color[4]) UI_GetThemeColor4fv(TH_ANIM_ACTIVE, color); } else { - /* greyish-red color */ + /* grayish-red color */ UI_GetThemeColor4fv(TH_ANIM_INACTIVE, color); } } @@ -217,7 +217,7 @@ static void nla_draw_strip_curves(NlaStrip *strip, float yminc, float ymaxc) { const float yheight = ymaxc - yminc; - /* drawing color is simply a light-grey */ + /* drawing color is simply a light-gray */ // TODO: is this color suitable? // XXX nasty hacked color for now... which looks quite bad too... glColor3f(0.7f, 0.7f, 0.7f); @@ -480,7 +480,7 @@ static void nla_draw_strip_text(AnimData *adt, NlaTrack *nlt, NlaStrip *strip, i static void nla_draw_strip_frames_text(NlaTrack *UNUSED(nlt), NlaStrip *strip, View2D *v2d, float UNUSED(yminc), float ymaxc) { const float ytol = 1.0f; /* small offset to vertical positioning of text, for legibility */ - const char col[4] = {220, 220, 220, 255}; /* light grey */ + const char col[4] = {220, 220, 220, 255}; /* light gray */ char numstr[32] = ""; @@ -551,7 +551,7 @@ void draw_nla_main_data(bAnimContext *ac, SpaceNla *snla, ARegion *ar) /* draw each strip in the track (if visible) */ for (strip = nlt->strips.first, index = 1; strip; strip = strip->next, index++) { if (BKE_nlastrip_within_bounds(strip, v2d->cur.xmin, v2d->cur.xmax)) { - /* draw the visualisation of the strip */ + /* draw the visualization of the strip */ nla_draw_strip(snla, adt, nlt, strip, v2d, yminc, ymaxc); /* add the text for this strip to the cache */ diff --git a/source/blender/editors/space_node/drawnode.c b/source/blender/editors/space_node/drawnode.c index 69f2867535a..daab0ce0f5f 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; @@ -1213,25 +1213,24 @@ static void node_buts_image_user(uiLayout *layout, bContext *C, PointerRNA *imap Scene *scene = CTX_data_scene(C); ImageUser *iuser = iuserptr->data; char numstr[32]; - const int framenr = BKE_image_user_frame_get(iuser, CFRA, 0); + const int framenr = BKE_image_user_frame_get(iuser, CFRA, 0, NULL); BLI_snprintf(numstr, sizeof(numstr), IFACE_("Frame: %d"), framenr); uiItemL(layout, numstr, ICON_NONE); } 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) @@ -3352,3 +3354,28 @@ void node_draw_link(View2D *v2d, SpaceNode *snode, bNodeLink *link) 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..65646c855b7 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" @@ -723,6 +724,12 @@ static void node_draw_basis(const bContext *C, ARegion *ar, SpaceNode *snode, bN if (node->flag & NODE_MUTED) UI_ThemeColorBlend(color_id, TH_REDALERT, 0.5f); + if (ntree->type == NTREE_COMPOSIT && (snode->flag&SNODE_SHOW_HIGHLIGHT)) { + if (node->highlight) { + UI_ThemeColorBlend(color_id, TH_ACTIVE, 0.5f); + node->highlight = 0; + } + } uiSetRoundBox(UI_CNR_TOP_LEFT | UI_CNR_TOP_RIGHT); uiRoundBox(rct->xmin, rct->ymax-NODE_DY, rct->xmax, rct->ymax, BASIS_RAD); @@ -804,7 +811,7 @@ static void node_draw_basis(const bContext *C, ARegion *ar, SpaceNode *snode, bN glDisable(GL_BLEND); /* outline active and selected emphasis */ - if ( node->flag & (NODE_ACTIVE|SELECT) ) { + if ( node->flag & (NODE_ACTIVE|SELECT)) { glEnable(GL_BLEND); glEnable(GL_LINE_SMOOTH); @@ -861,7 +868,7 @@ static void node_draw_basis(const bContext *C, ARegion *ar, SpaceNode *snode, bN node->block= NULL; } -static void node_draw_hidden(const bContext *C, ARegion *ar, SpaceNode *snode, bNode *node) +static void node_draw_hidden(const bContext *C, ARegion *ar, SpaceNode *snode, bNodeTree *ntree, bNode *node) { bNodeSocket *sock; rctf *rct= &node->totr; @@ -878,10 +885,18 @@ static void node_draw_hidden(const bContext *C, ARegion *ar, SpaceNode *snode, b UI_ThemeColor(color_id); if (node->flag & NODE_MUTED) UI_ThemeColorBlend(color_id, TH_REDALERT, 0.5f); + + if (ntree->type == NTREE_COMPOSIT && (snode->flag&SNODE_SHOW_HIGHLIGHT)) { + if (node->highlight) { + UI_ThemeColorBlend(color_id, TH_ACTIVE, 0.5f); + node->highlight = 0; + } + } + uiRoundBox(rct->xmin, rct->ymin, rct->xmax, rct->ymax, hiddenrad); /* outline active and selected emphasis */ - if ( node->flag & (NODE_ACTIVE|SELECT) ) { + if ( node->flag & (NODE_ACTIVE|SELECT)) { glEnable(GL_BLEND); glEnable(GL_LINE_SMOOTH); @@ -1004,7 +1019,7 @@ void node_set_cursor(wmWindow *win, SpaceNode *snode) void node_draw_default(const bContext *C, ARegion *ar, SpaceNode *snode, bNodeTree *ntree, bNode *node) { if (node->flag & NODE_HIDDEN) - node_draw_hidden(C, ar, snode, node); + node_draw_hidden(C, ar, snode, ntree, node); else node_draw_basis(C, ar, snode, ntree, node); } @@ -1087,6 +1102,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 +1112,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 +1156,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_edit.c b/source/blender/editors/space_node/node_edit.c index 48f772e8008..9a6906c43bc 100644 --- a/source/blender/editors/space_node/node_edit.c +++ b/source/blender/editors/space_node/node_edit.c @@ -1643,7 +1643,7 @@ void NODE_OT_backimage_zoom(wmOperatorType *ot) /* identifiers */ ot->name = "Background Image Zoom"; ot->idname = "NODE_OT_backimage_zoom"; - ot->description = "Zoom in/out the brackground image"; + ot->description = "Zoom in/out the background image"; /* api callbacks */ ot->exec = backimage_zoom; 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..349259ad71b 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,12 +444,19 @@ 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) - ED_region_tag_redraw(ar); + switch (wmn->data) { + case ND_GPENCIL: + ED_region_tag_redraw(ar); + break; + case ND_SCREENCAST: + case ND_ANIMPLAY: + ED_region_tag_redraw(ar); + break; + } break; case NC_SCENE: case NC_MATERIAL: @@ -458,7 +465,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 +479,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 +507,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_outliner/outliner_draw.c b/source/blender/editors/space_outliner/outliner_draw.c index 2f5e32c61d1..42fdd5173d4 100644 --- a/source/blender/editors/space_outliner/outliner_draw.c +++ b/source/blender/editors/space_outliner/outliner_draw.c @@ -1541,7 +1541,7 @@ static void outliner_draw_tree(bContext *C, uiBlock *block, Scene *scene, ARegio starty = (int)ar->v2d.tot.ymax - UI_UNIT_Y - OL_Y_OFFSET; outliner_draw_selection(ar, soops, &soops->tree, &starty); - // grey hierarchy lines + // gray hierarchy lines UI_ThemeColorBlend(TH_BACK, TH_TEXT, 0.4f); starty = (int)ar->v2d.tot.ymax - UI_UNIT_Y / 2 - OL_Y_OFFSET; startx = 6; diff --git a/source/blender/editors/space_outliner/outliner_edit.c b/source/blender/editors/space_outliner/outliner_edit.c index eb740e441b7..449914feae4 100644 --- a/source/blender/editors/space_outliner/outliner_edit.c +++ b/source/blender/editors/space_outliner/outliner_edit.c @@ -1360,7 +1360,7 @@ void OUTLINER_OT_keyingset_add_selected(wmOperatorType *ot) /* identifiers */ ot->idname = "OUTLINER_OT_keyingset_add_selected"; ot->name = "Keying Set Add Selected"; - ot->description = "Add selected items (blue-grey rows) to active Keying Set"; + ot->description = "Add selected items (blue-gray rows) to active Keying Set"; /* api callbacks */ ot->exec = outliner_keyingset_additems_exec; @@ -1397,7 +1397,7 @@ void OUTLINER_OT_keyingset_remove_selected(wmOperatorType *ot) /* identifiers */ ot->idname = "OUTLINER_OT_keyingset_remove_selected"; ot->name = "Keying Set Remove Selected"; - ot->description = "Remove selected items (blue-grey rows) from active Keying Set"; + ot->description = "Remove selected items (blue-gray rows) from active Keying Set"; /* api callbacks */ ot->exec = outliner_keyingset_removeitems_exec; diff --git a/source/blender/editors/space_outliner/outliner_select.c b/source/blender/editors/space_outliner/outliner_select.c index 812fba50295..096713f9cd3 100644 --- a/source/blender/editors/space_outliner/outliner_select.c +++ b/source/blender/editors/space_outliner/outliner_select.c @@ -69,7 +69,7 @@ #include "outliner_intern.h" /* ****************************************************** */ -/* Outliner Selection (grey-blue highlight for rows) */ +/* Outliner Selection (gray-blue highlight for rows) */ static int outliner_select(SpaceOops *soops, ListBase *lb, int *index, short *selecting) { 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_draw.c b/source/blender/editors/space_sequencer/sequencer_draw.c index 9148373cb2d..38f29e8816e 100644 --- a/source/blender/editors/space_sequencer/sequencer_draw.c +++ b/source/blender/editors/space_sequencer/sequencer_draw.c @@ -1076,7 +1076,7 @@ static void draw_seq_backdrop(View2D *v2d) { int i; - /* darker grey overlay over the view backdrop */ + /* darker gray overlay over the view backdrop */ UI_ThemeColorShade(TH_BACK, -20); glRectf(v2d->cur.xmin, -1.0, v2d->cur.xmax, 1.0); diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c b/source/blender/editors/space_sequencer/sequencer_edit.c index bc8133cded6..1c3d2b61488 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; @@ -2802,7 +2805,7 @@ void SEQUENCER_OT_rebuild_proxy(wmOperatorType *ot) /* identifiers */ ot->name = "Rebuild Proxy and Timecode Indices"; ot->idname = "SEQUENCER_OT_rebuild_proxy"; - ot->description = "Rebuild all selected proxies and timecode indeces using the job system"; + ot->description = "Rebuild all selected proxies and timecode indices using the job system"; /* api callbacks */ ot->exec = sequencer_rebuild_proxy_exec; diff --git a/source/blender/editors/space_sequencer/space_sequencer.c b/source/blender/editors/space_sequencer/space_sequencer.c index b8bf764fabc..cabc761161e 100644 --- a/source/blender/editors/space_sequencer/space_sequencer.c +++ b/source/blender/editors/space_sequencer/space_sequencer.c @@ -454,6 +454,10 @@ static void sequencer_main_area_listener(ARegion *ar, wmNotifier *wmn) if (wmn->action == NA_RENAME) ED_region_tag_redraw(ar); break; + case NC_SCREEN: + if (ELEM(wmn->data, ND_SCREENCAST, ND_ANIMPLAY)) + ED_region_tag_redraw(ar); + break; } } 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/drawarmature.c b/source/blender/editors/space_view3d/drawarmature.c index e51f7a312eb..33aada7b811 100644 --- a/source/blender/editors/space_view3d/drawarmature.c +++ b/source/blender/editors/space_view3d/drawarmature.c @@ -2269,7 +2269,7 @@ static void draw_ebones(View3D *v3d, ARegion *ar, Object *ob, const short dt) } } -/* ****************************** Armature Visualisation ******************************** */ +/* ****************************** Armature Visualization ******************************** */ /* ---------- Paths --------- */ diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c index b1d06c6091b..4f6e5ecd1dc 100644 --- a/source/blender/editors/space_view3d/drawobject.c +++ b/source/blender/editors/space_view3d/drawobject.c @@ -6442,7 +6442,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; @@ -7072,12 +7072,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); @@ -7112,8 +7113,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_buttons.c b/source/blender/editors/space_view3d/view3d_buttons.c index a9941dc326a..6cfa828024d 100644 --- a/source/blender/editors/space_view3d/view3d_buttons.c +++ b/source/blender/editors/space_view3d/view3d_buttons.c @@ -856,7 +856,7 @@ static void view3d_panel_vgroup(const bContext *C, Panel *pa) uiDefBut(block, BUT, B_VGRP_PNL_NORMALIZE, IFACE_("Normalize"), 0, yco, 100, 20, NULL, 0, 0, 0, 0, TIP_("Normalize active vertex weights")); uiDefBut(block, BUT, B_VGRP_PNL_COPY, IFACE_("Copy"), 100, yco, 100, 20, - NULL, 0, 0, 0, 0, TIP_("Copy active vertex to other seleted verts")); + NULL, 0, 0, 0, 0, TIP_("Copy active vertex to other selected verts")); uiBlockEndAlign(block); } } diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c index 2d4fbb90ae1..e6ea42aa5ba 100644 --- a/source/blender/editors/space_view3d/view3d_draw.c +++ b/source/blender/editors/space_view3d/view3d_draw.c @@ -1561,7 +1561,12 @@ static void view3d_draw_bgpic(Scene *scene, ARegion *ar, View3D *v3d, if (ima == NULL) continue; BKE_image_user_frame_calc(&bgpic->iuser, CFRA, 0); - ibuf = BKE_image_get_ibuf(ima, &bgpic->iuser); + if (ima->source == IMA_SRC_SEQUENCE && !(bgpic->iuser.flag & IMA_USER_FRAME_IN_RANGE)) { + ibuf = NULL; /* frame is out of range, dont show */ + } + else { + ibuf = BKE_image_get_ibuf(ima, &bgpic->iuser); + } image_aspect[0] = ima->aspx; image_aspect[1] = ima->aspx; diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c index cedb09e187c..164c1dd7c12 100644 --- a/source/blender/editors/transform/transform.c +++ b/source/blender/editors/transform/transform.c @@ -1655,6 +1655,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 f3a846daf29..af0b33d58ae 100644 --- a/source/blender/editors/transform/transform_conversions.c +++ b/source/blender/editors/transform/transform_conversions.c @@ -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) @@ -6324,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_manipulator.c b/source/blender/editors/transform/transform_manipulator.c index b3ccf004810..1507dbfddda 100644 --- a/source/blender/editors/transform/transform_manipulator.c +++ b/source/blender/editors/transform/transform_manipulator.c @@ -745,7 +745,7 @@ static char axisBlendAngle(float angle) } /* three colors can be set; - * grey for ghosting + * gray for ghosting * moving: in transform theme color * else the red/green/blue */ 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); diff --git a/source/blender/editors/uvedit/uvedit_draw.c b/source/blender/editors/uvedit/uvedit_draw.c index d52463cf406..17c57b1f6e4 100644 --- a/source/blender/editors/uvedit/uvedit_draw.c +++ b/source/blender/editors/uvedit/uvedit_draw.c @@ -133,7 +133,7 @@ static void draw_uvs_shadow(Object *obedit) BMIter iter, liter; MLoopUV *luv; - /* draws the grey mesh when painting */ + /* draws the gray mesh when painting */ glColor3ub(112, 112, 112); BM_ITER_MESH (efa, &iter, bm, BM_FACES_OF_MESH) { diff --git a/source/blender/editors/uvedit/uvedit_ops.c b/source/blender/editors/uvedit/uvedit_ops.c index b15df9c3e89..216ac61b628 100644 --- a/source/blender/editors/uvedit/uvedit_ops.c +++ b/source/blender/editors/uvedit/uvedit_ops.c @@ -3402,7 +3402,8 @@ static void UV_OT_cursor_set(wmOperatorType *ot) ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; /* properties */ - RNA_def_float_vector(ot->srna, "location", 2, NULL, -FLT_MAX, FLT_MAX, "Location", "Cursor location in normalised (0.0-1.0) coordinates", -10.0f, 10.0f); + RNA_def_float_vector(ot->srna, "location", 2, NULL, -FLT_MAX, FLT_MAX, "Location", + "Cursor location in normalized (0.0-1.0) coordinates", -10.0f, 10.0f); } /********************** set tile operator **********************/ |