diff options
author | Joseph Eagar <joeedh@gmail.com> | 2010-09-07 09:47:34 +0400 |
---|---|---|
committer | Joseph Eagar <joeedh@gmail.com> | 2010-09-07 09:47:34 +0400 |
commit | 82432d0d99f2101ee2ceba86bdc49669b5fa306f (patch) | |
tree | ada47d0a65cb7614ead93fcdbb3421e5398ff3dc /source/blender/editors | |
parent | 859c5a42f0fe8b9bec0d3ddce1612942942619a7 (diff) | |
parent | 8a320974f1b3e6004db3b3ad64f97742f878cbee (diff) |
merge from trunk at r31523
Diffstat (limited to 'source/blender/editors')
56 files changed, 623 insertions, 466 deletions
diff --git a/source/blender/editors/animation/anim_draw.c b/source/blender/editors/animation/anim_draw.c index f5f50e10bcb..b564780f6c0 100644 --- a/source/blender/editors/animation/anim_draw.c +++ b/source/blender/editors/animation/anim_draw.c @@ -25,6 +25,7 @@ * * ***** END GPL LICENSE BLOCK ***** */ +#include "BLO_sys_types.h" #include "DNA_anim_types.h" #include "DNA_object_types.h" diff --git a/source/blender/editors/animation/anim_ops.c b/source/blender/editors/animation/anim_ops.c index 9570fd64433..9b9c9435518 100644 --- a/source/blender/editors/animation/anim_ops.c +++ b/source/blender/editors/animation/anim_ops.c @@ -29,6 +29,8 @@ #include <stdlib.h> #include <math.h> +#include "BLO_sys_types.h" + #include "DNA_anim_types.h" #include "DNA_scene_types.h" diff --git a/source/blender/editors/animation/fmodifier_ui.c b/source/blender/editors/animation/fmodifier_ui.c index 191316711f4..35e6cb66d45 100644 --- a/source/blender/editors/animation/fmodifier_ui.c +++ b/source/blender/editors/animation/fmodifier_ui.c @@ -583,7 +583,7 @@ static void draw_modifier__stepped(uiLayout *layout, ID *id, FModifier *fcm, sho uiItemR(col, &ptr, "use_frame_end", 0, NULL, 0); subcol = uiLayoutColumn(col, 1); - uiLayoutSetActive(subcol, RNA_boolean_get(&ptr, "use_end_frame")); + uiLayoutSetActive(subcol, RNA_boolean_get(&ptr, "use_frame_end")); uiItemR(subcol, &ptr, "frame_end", 0, NULL, 0); } diff --git a/source/blender/editors/armature/armature_ops.c b/source/blender/editors/armature/armature_ops.c index d5bd09cc8f1..908aa5bb432 100644 --- a/source/blender/editors/armature/armature_ops.c +++ b/source/blender/editors/armature/armature_ops.c @@ -29,7 +29,7 @@ #include <stdlib.h> #include <math.h> - +#include "BLO_sys_types.h" #include "BLI_math.h" #include "BLI_blenlib.h" diff --git a/source/blender/editors/armature/editarmature.c b/source/blender/editors/armature/editarmature.c index c0f84064aba..1c25b12c917 100644 --- a/source/blender/editors/armature/editarmature.c +++ b/source/blender/editors/armature/editarmature.c @@ -5460,6 +5460,8 @@ void ED_armature_bone_rename(bArmature *arm, char *oldnamep, char *newnamep) /* do entire dbase - objects */ for (ob= G.main->object.first; ob; ob= ob->id.next) { + ModifierData *md; + /* we have the object using the armature */ if (arm==ob->data) { Object *cob; @@ -5509,6 +5511,19 @@ void ED_armature_bone_rename(bArmature *arm, char *oldnamep, char *newnamep) } } + /* fix modifiers that might be using this name */ + for (md= ob->modifiers.first; md; md= md->next) { + if (md->type == eModifierType_Hook) { + HookModifierData *hmd = (HookModifierData *)md; + + /* uses armature, so may use the affected bone name */ + if (hmd->object && (hmd->object->data == arm)) { + if (!strcmp(hmd->subtarget, oldname)) + BLI_strncpy(hmd->subtarget, newname, MAXBONENAME); + } + } + } + /* Fix animation data attached to this object */ // TODO: should we be using the database wide version instead (since drivers may break) if (ob->adt) { diff --git a/source/blender/editors/armature/poselib.c b/source/blender/editors/armature/poselib.c index b0b5aedaa70..6fe584c7f98 100644 --- a/source/blender/editors/armature/poselib.c +++ b/source/blender/editors/armature/poselib.c @@ -278,8 +278,16 @@ static void poselib_add_menu_invoke__replacemenu (bContext *C, uiLayout *layout, uiLayoutSetOperatorContext(layout, WM_OP_EXEC_DEFAULT); /* add each marker to this menu */ - for (marker= act->markers.first; marker; marker= marker->next) - uiItemIntO(layout, marker->name, ICON_ARMATURE_DATA, "POSELIB_OT_pose_add", "frame", marker->frame); + for (marker= act->markers.first; marker; marker= marker->next) { + PointerRNA props_ptr; + + props_ptr = uiItemFullO(layout, "POSELIB_OT_pose_add", + marker->name, ICON_ARMATURE_DATA, NULL, + WM_OP_EXEC_DEFAULT, UI_ITEM_O_RETURN_PROPS); + + RNA_int_set(&props_ptr, "frame", marker->frame); + RNA_string_set(&props_ptr, "name", marker->name); +} } static int poselib_add_menu_invoke (bContext *C, wmOperator *op, wmEvent *evt) diff --git a/source/blender/editors/curve/curve_intern.h b/source/blender/editors/curve/curve_intern.h index 10c1bd84262..2567494ddf3 100644 --- a/source/blender/editors/curve/curve_intern.h +++ b/source/blender/editors/curve/curve_intern.h @@ -97,9 +97,9 @@ void CURVE_OT_primitive_nurbs_path_add(struct wmOperatorType *ot); void SURFACE_OT_primitive_nurbs_surface_curve_add(struct wmOperatorType *ot); void SURFACE_OT_primitive_nurbs_surface_circle_add(struct wmOperatorType *ot); void SURFACE_OT_primitive_nurbs_surface_surface_add(struct wmOperatorType *ot); -void SURFACE_OT_primitive_nurbs_surface_tube_add(struct wmOperatorType *ot); +void SURFACE_OT_primitive_nurbs_surface_cylinder_add(struct wmOperatorType *ot); void SURFACE_OT_primitive_nurbs_surface_sphere_add(struct wmOperatorType *ot); -void SURFACE_OT_primitive_nurbs_surface_donut_add(struct wmOperatorType *ot); +void SURFACE_OT_primitive_nurbs_surface_torus_add(struct wmOperatorType *ot); void CURVE_OT_de_select_first(struct wmOperatorType *ot); void CURVE_OT_de_select_last(struct wmOperatorType *ot); diff --git a/source/blender/editors/curve/curve_ops.c b/source/blender/editors/curve/curve_ops.c index b5b6ee4e6da..89c19d93b0f 100644 --- a/source/blender/editors/curve/curve_ops.c +++ b/source/blender/editors/curve/curve_ops.c @@ -105,9 +105,9 @@ void ED_operatortypes_curve(void) WM_operatortype_append(SURFACE_OT_primitive_nurbs_surface_curve_add); WM_operatortype_append(SURFACE_OT_primitive_nurbs_surface_circle_add); WM_operatortype_append(SURFACE_OT_primitive_nurbs_surface_surface_add); - WM_operatortype_append(SURFACE_OT_primitive_nurbs_surface_tube_add); + WM_operatortype_append(SURFACE_OT_primitive_nurbs_surface_cylinder_add); WM_operatortype_append(SURFACE_OT_primitive_nurbs_surface_sphere_add); - WM_operatortype_append(SURFACE_OT_primitive_nurbs_surface_donut_add); + WM_operatortype_append(SURFACE_OT_primitive_nurbs_surface_torus_add); WM_operatortype_append(CURVE_OT_smooth); WM_operatortype_append(CURVE_OT_smooth_radius); diff --git a/source/blender/editors/curve/editcurve.c b/source/blender/editors/curve/editcurve.c index 8af659c62e3..4564b90880f 100644 --- a/source/blender/editors/curve/editcurve.c +++ b/source/blender/editors/curve/editcurve.c @@ -1804,7 +1804,7 @@ void CURVE_OT_switch_direction(wmOperatorType *ot) /****************** set weight operator *******************/ -static int set_weight_exec(bContext *C, wmOperator *op) +static int set_goal_weight_exec(bContext *C, wmOperator *op) { Object *obedit= CTX_data_edit_object(C); ListBase *editnurb= curve_get_editcurve(obedit); @@ -1842,7 +1842,7 @@ void CURVE_OT_spline_weight_set(wmOperatorType *ot) ot->idname= "CURVE_OT_spline_weight_set"; /* api callbacks */ - ot->exec= set_weight_exec; + ot->exec= set_goal_weight_exec; ot->invoke= WM_operator_props_popup; ot->poll= ED_operator_editsurfcurve; @@ -4109,7 +4109,7 @@ void CURVE_OT_spin(wmOperatorType *ot) /* flags */ ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; - RNA_def_float_vector(ot->srna, "center", 3, NULL, -FLT_MAX, FLT_MAX, "Center", "Center in global view space", -FLT_MAX, FLT_MAX); + RNA_def_float_vector_xyz(ot->srna, "center", 3, NULL, -FLT_MAX, FLT_MAX, "Center", "Center in global view space", -FLT_MAX, FLT_MAX); RNA_def_float_vector(ot->srna, "axis", 3, NULL, -1.0f, 1.0f, "Axis", "Axis in global view space", -FLT_MAX, FLT_MAX); } @@ -4278,7 +4278,7 @@ void CURVE_OT_vertex_add(wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; /* properties */ - RNA_def_float_vector(ot->srna, "location", 3, NULL, -FLT_MAX, FLT_MAX, "Location", "Location to add new vertex at.", -1e4, 1e4); + RNA_def_float_vector_xyz(ot->srna, "location", 3, NULL, -FLT_MAX, FLT_MAX, "Location", "Location to add new vertex at.", -1e4, 1e4); } /***************** extrude operator **********************/ @@ -5867,13 +5867,13 @@ Nurb *add_nurbs_primitive(bContext *C, float mat[4][4], int type, int newname) makeknots(nu, 2); } break; - case CU_PRIM_TUBE: /* tube */ + case CU_PRIM_TUBE: /* Cylinder */ if( cutype==CU_NURBS ) { Curve *cu= (Curve*)obedit->data; if(newname) { - rename_id((ID *)obedit, "SurfTube"); - rename_id((ID *)obedit->data, "SurfTube"); + rename_id((ID *)obedit, "SurfCylinder"); + rename_id((ID *)obedit->data, "SurfCylinder"); } nu= add_nurbs_primitive(C, mat, CU_NURBS|CU_PRIM_CIRCLE, 0); /* circle */ @@ -5949,7 +5949,7 @@ Nurb *add_nurbs_primitive(bContext *C, float mat[4][4], int type, int newname) BLI_remlink(editnurb, nu); } break; - case CU_PRIM_DONUT: /* donut */ + case CU_PRIM_DONUT: /* torus */ if( cutype==CU_NURBS ) { float tmp_cent[3] = {0.f, 0.f, 0.f}; float tmp_vec[3] = {0.f, 0.f, 0.f}; @@ -6235,21 +6235,21 @@ void SURFACE_OT_primitive_nurbs_surface_surface_add(wmOperatorType *ot) ED_object_add_generic_props(ot, TRUE); } -static int add_primitive_nurbs_surface_tube_exec(bContext *C, wmOperator *op) +static int add_primitive_nurbs_surface_cylinder_exec(bContext *C, wmOperator *op) { return surf_prim_add(C, op, CU_PRIM_TUBE|CU_NURBS); } -void SURFACE_OT_primitive_nurbs_surface_tube_add(wmOperatorType *ot) +void SURFACE_OT_primitive_nurbs_surface_cylinder_add(wmOperatorType *ot) { /* identifiers */ - ot->name= "Add Surface Tube"; - ot->description= "Construct a Nurbs surface Tube"; - ot->idname= "SURFACE_OT_primitive_nurbs_surface_tube_add"; + ot->name= "Add Surface Cylinder"; + ot->description= "Construct a Nurbs surface Cylinder"; + ot->idname= "SURFACE_OT_primitive_nurbs_surface_cylinder_add"; /* api callbacks */ ot->invoke= ED_object_add_generic_invoke; - ot->exec= add_primitive_nurbs_surface_tube_exec; + ot->exec= add_primitive_nurbs_surface_cylinder_exec; ot->poll= ED_operator_scene_editable; /* flags */ @@ -6281,21 +6281,21 @@ void SURFACE_OT_primitive_nurbs_surface_sphere_add(wmOperatorType *ot) ED_object_add_generic_props(ot, TRUE); } -static int add_primitive_nurbs_surface_donut_exec(bContext *C, wmOperator *op) +static int add_primitive_nurbs_surface_torus_exec(bContext *C, wmOperator *op) { return surf_prim_add(C, op, CU_PRIM_DONUT|CU_NURBS); } -void SURFACE_OT_primitive_nurbs_surface_donut_add(wmOperatorType *ot) +void SURFACE_OT_primitive_nurbs_surface_torus_add(wmOperatorType *ot) { /* identifiers */ - ot->name= "Add Surface Donut"; - ot->description= "Construct a Nurbs surface Donut"; - ot->idname= "SURFACE_OT_primitive_nurbs_surface_donut_add"; + ot->name= "Add Surface Torus"; + ot->description= "Construct a Nurbs surface Torus"; + ot->idname= "SURFACE_OT_primitive_nurbs_surface_torus_add"; /* api callbacks */ ot->invoke= ED_object_add_generic_invoke; - ot->exec= add_primitive_nurbs_surface_donut_exec; + ot->exec= add_primitive_nurbs_surface_torus_exec; ot->poll= ED_operator_scene_editable; /* flags */ diff --git a/source/blender/editors/gpencil/drawgpencil.c b/source/blender/editors/gpencil/drawgpencil.c index 284dac7a0ae..4b8c58a5308 100644 --- a/source/blender/editors/gpencil/drawgpencil.c +++ b/source/blender/editors/gpencil/drawgpencil.c @@ -32,6 +32,7 @@ #include <math.h> #include <float.h> +#include "BLO_sys_types.h" #include "IMB_imbuf_types.h" @@ -42,6 +43,7 @@ #include "DNA_scene_types.h" #include "DNA_screen_types.h" #include "DNA_space_types.h" +#include "DNA_view3d_types.h" #include "BKE_context.h" #include "BKE_global.h" @@ -56,6 +58,7 @@ #include "ED_gpencil.h" #include "ED_sequencer.h" +#include "ED_view3d.h" #include "gpencil_intern.h" @@ -164,8 +167,8 @@ static void gp_draw_stroke_point (bGPDspoint *points, short thickness, short sfl co[1]= (points->y * winy) + offsy; } else { - co[0]= (points->x / 100 * winx); - co[1]= (points->y / 100 * winy); + co[0]= (points->x / 100 * winx) + offsx; + co[1]= (points->y / 100 * winy) + offsy; } /* if thickness is less than GP_DRAWTHICKNESS_SPECIAL, simple dot looks ok @@ -265,8 +268,8 @@ static void gp_draw_stroke (bGPDspoint *points, int totpoints, short thickness, glVertex2f(x, y); } else { - const float x= (pt->x / 100 * winx); - const float y= (pt->y / 100 * winy); + const float x= (pt->x / 100 * winx) + offsx; + const float y= (pt->y / 100 * winy) + offsy; glVertex2f(x, y); } @@ -305,10 +308,10 @@ static void gp_draw_stroke (bGPDspoint *points, int totpoints, short thickness, s1[1]= (pt2->y * winy) + offsy; } else { - s0[0]= (pt1->x / 100 * winx); - s0[1]= (pt1->y / 100 * winy); - s1[0]= (pt2->x / 100 * winx); - s1[1]= (pt2->y / 100 * winy); + s0[0]= (pt1->x / 100 * winx) + offsx; + s0[1]= (pt1->y / 100 * winy) + offsy; + s1[0]= (pt2->x / 100 * winx) + offsx; + s1[1]= (pt2->y / 100 * winy) + offsy; } /* calculate gradient and normal - 'angle'=(ny/nx) */ @@ -453,8 +456,8 @@ static void gp_draw_stroke (bGPDspoint *points, int totpoints, short thickness, glVertex2f(x, y); } else { - const float x= (float)(pt->x / 100 * winx); - const float y= (float)(pt->y / 100 * winy); + const float x= (float)(pt->x / 100 * winx) + offsx; + const float y= (float)(pt->y / 100 * winy) + offsy; glVertex2f(x, y); } @@ -732,25 +735,44 @@ void draw_gpencil_view2d (bContext *C, short onlyv2d) /* draw grease-pencil sketches to specified 3d-view assuming that matrices are already set correctly * Note: this gets called twice - first time with only3d=1 to draw 3d-strokes, second time with only3d=0 for screen-aligned strokes */ -void draw_gpencil_view3d_ext (Scene *scene, ARegion *ar, short only3d) + +void draw_gpencil_view3d_ext (Scene *scene, View3D *v3d, ARegion *ar, short only3d) { bGPdata *gpd; int dflag = 0; + rcti rect; + RegionView3D *rv3d= ar->regiondata; /* check that we have grease-pencil stuff to draw */ gpd= gpencil_data_get_active_v3d(scene); // XXX if(gpd == NULL) return; + /* when rendering to the offscreen buffer we dont want to + * deal with the camera border, otherwise map the coords to the camera border. */ + if(rv3d->persp == RV3D_CAMOB && !(G.f & G_RENDER_OGL)) { + rctf rectf; + view3d_calc_camera_border(scene, ar, rv3d, v3d, &rectf); + BLI_copy_rcti_rctf(&rect, &rectf); + } + else { + rect.xmin= 0; + rect.ymin= 0; + rect.xmax= ar->winx; + rect.ymax= ar->winy; + } + /* draw it! */ if (only3d) dflag |= (GP_DRAWDATA_ONLY3D|GP_DRAWDATA_NOSTATUS); - gp_draw_data(gpd, 0, 0, ar->winx, ar->winy, CFRA, dflag); + + gp_draw_data(gpd, rect.xmin, rect.ymin, rect.xmax, rect.ymax, CFRA, dflag); } void draw_gpencil_view3d (bContext *C, short only3d) { ARegion *ar= CTX_wm_region(C); + View3D *v3d= CTX_wm_view3d(C); Scene *scene= CTX_data_scene(C); - draw_gpencil_view3d_ext(scene, ar, only3d); + draw_gpencil_view3d_ext(scene, v3d, ar, only3d); } /* ************************************************** */ diff --git a/source/blender/editors/gpencil/gpencil_ops.c b/source/blender/editors/gpencil/gpencil_ops.c index d9bd43cc851..b6b2675e6c8 100644 --- a/source/blender/editors/gpencil/gpencil_ops.c +++ b/source/blender/editors/gpencil/gpencil_ops.c @@ -29,8 +29,9 @@ #include <stddef.h> #include <stdio.h> -#include "BLI_blenlib.h" +#include "BLO_sys_types.h" +#include "BLI_blenlib.h" #include "WM_api.h" #include "WM_types.h" diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c index cfa7af99d2a..f218ccd89f1 100644 --- a/source/blender/editors/gpencil/gpencil_paint.c +++ b/source/blender/editors/gpencil/gpencil_paint.c @@ -68,6 +68,9 @@ typedef struct tGPsdata { ScrArea *sa; /* area where painting originated */ ARegion *ar; /* region where painting originated */ View2D *v2d; /* needed for GP_STROKE_2DSPACE */ + rctf *subrect; /* for using the camera rect within the 3d view */ + rctf subrect_data; + #if 0 // XXX review this 2d image stuff... ImBuf *ibuf; /* needed for GP_STROKE_2DIMAGE */ @@ -271,9 +274,15 @@ static void gp_stroke_convertcoords (tGPsdata *p, short mval[], float out[], flo /* 2d - relative to screen (viewport area) */ else { + if(p->subrect == NULL) { /* normal 3D view */ out[0] = (float)(mval[0]) / (float)(p->ar->winx) * 100; out[1] = (float)(mval[1]) / (float)(p->ar->winy) * 100; } + else { /* camera view, use subrect */ + out[0]= ((mval[0] - p->subrect->xmin) / ((p->subrect->xmax - p->subrect->xmin))) * 100; + out[1]= ((mval[1] - p->subrect->ymin) / ((p->subrect->ymax - p->subrect->ymin))) * 100; +} + } } /* add current stroke-point to buffer (returns whether point was successfully added) */ @@ -704,9 +713,15 @@ static void gp_stroke_eraser_dostroke (tGPsdata *p, int mval[], int mvalo[], sho } #endif else { + if(p->subrect == NULL) { /* normal 3D view */ x0= (int)(gps->points->x / 100 * p->ar->winx); y0= (int)(gps->points->y / 100 * p->ar->winy); } + else { /* camera view, use subrect */ + x0= (int)((gps->points->x / 100) * (p->subrect->xmax - p->subrect->xmin)) + p->subrect->xmin; + y0= (int)((gps->points->y / 100) * (p->subrect->ymax - p->subrect->ymin)) + p->subrect->ymin; + } + } /* do boundbox check first */ if (BLI_in_rcti(rect, x0, y0)) { @@ -761,11 +776,19 @@ static void gp_stroke_eraser_dostroke (tGPsdata *p, int mval[], int mvalo[], sho } #endif else { + if(p->subrect == NULL) { /* normal 3D view */ x0= (int)(pt1->x / 100 * p->ar->winx); y0= (int)(pt1->y / 100 * p->ar->winy); x1= (int)(pt2->x / 100 * p->ar->winx); y1= (int)(pt2->y / 100 * p->ar->winy); } + else { /* camera view, use subrect */ + x0= (int)((pt1->x / 100) * (p->subrect->xmax - p->subrect->xmin)) + p->subrect->xmin; + y0= (int)((pt1->y / 100) * (p->subrect->ymax - p->subrect->ymin)) + p->subrect->ymin; + x1= (int)((pt2->x / 100) * (p->subrect->xmax - p->subrect->xmin)) + p->subrect->xmin; + y1= (int)((pt2->y / 100) * (p->subrect->ymax - p->subrect->ymin)) + p->subrect->ymin; + } + } /* check that point segment of the boundbox of the eraser stroke */ if (BLI_in_rcti(rect, x0, y0) || BLI_in_rcti(rect, x1, y1)) { @@ -849,7 +872,8 @@ static tGPsdata *gp_session_initpaint (bContext *C) /* supported views first */ case SPACE_VIEW3D: { - //View3D *v3d= curarea->spacedata.first; + View3D *v3d= curarea->spacedata.first; + RegionView3D *rv3d= ar->regiondata; /* set current area * - must verify that region data is 3D-view (and not something else) @@ -864,6 +888,12 @@ static tGPsdata *gp_session_initpaint (bContext *C) return p; } + /* for camera view set the subrect */ + if(rv3d->persp == RV3D_CAMOB) { + view3d_calc_camera_border(p->scene, p->ar, NULL, v3d, &p->subrect_data); + p->subrect= &p->subrect_data; + } + #if 0 // XXX will this sort of antiquated stuff be restored? /* check that gpencil data is allowed to be drawn */ if ((v3d->flag2 & V3D_DISPGP)==0) { diff --git a/source/blender/editors/include/ED_gpencil.h b/source/blender/editors/include/ED_gpencil.h index 0003cea8147..6c5a0cc3bf3 100644 --- a/source/blender/editors/include/ED_gpencil.h +++ b/source/blender/editors/include/ED_gpencil.h @@ -72,7 +72,7 @@ void ED_operatortypes_gpencil(void); void draw_gpencil_2dimage(struct bContext *C, struct ImBuf *ibuf); void draw_gpencil_view2d(struct bContext *C, short onlyv2d); void draw_gpencil_view3d(struct bContext *C, short only3d); -void draw_gpencil_view3d_ext(struct Scene *scene, struct ARegion *ar, short only3d); +void draw_gpencil_view3d_ext(struct Scene *scene, struct View3D *v3d, struct ARegion *ar, short only3d); void gpencil_panel_standard(const struct bContext *C, struct Panel *pa); diff --git a/source/blender/editors/include/ED_mesh.h b/source/blender/editors/include/ED_mesh.h index ff7ce874303..c898b8b99c3 100644 --- a/source/blender/editors/include/ED_mesh.h +++ b/source/blender/editors/include/ED_mesh.h @@ -194,85 +194,9 @@ void ED_keymap_mesh(struct wmKeyConfig *keyconf); void ED_spacetypes_init(void); void ED_keymap_mesh(struct wmKeyConfig *keyconf); - -struct EditMesh *make_editMesh(struct Scene *scene, struct Object *ob); -void load_editMesh(struct Scene *scene, struct Object *ob, struct EditMesh *em); -void remake_editMesh(struct Scene *scene, struct Object *ob); -void free_editMesh(struct EditMesh *em); - -void recalc_editnormals(struct EditMesh *em); - -void EM_init_index_arrays(struct EditMesh *em, int forVert, int forEdge, int forFace); -void EM_free_index_arrays(void); -struct EditVert *EM_get_vert_for_index(int index); -struct EditEdge *EM_get_edge_for_index(int index); -struct EditFace *EM_get_face_for_index(int index); -int EM_texFaceCheck(struct EditMesh *em); -int EM_vertColorCheck(struct EditMesh *em); - -void undo_push_mesh(struct bContext *C, char *name); - - -/* editmesh_lib.c */ - -struct EditFace *EM_get_actFace(struct EditMesh *em, int sloppy); -void EM_set_actFace(struct EditMesh *em, struct EditFace *efa); -float EM_face_area(struct EditFace *efa); -void EM_add_data_layer(struct EditMesh *em, struct CustomData *data, int type); - -void EM_select_edge(struct EditEdge *eed, int sel); -void EM_select_face(struct EditFace *efa, int sel); -void EM_select_face_fgon(struct EditMesh *em, struct EditFace *efa, int val); -void EM_select_swap(struct EditMesh *em); -void EM_toggle_select_all(struct EditMesh *em); -void EM_select_all(struct EditMesh *em); -void EM_deselect_all(struct EditMesh *em); -void EM_selectmode_flush(struct EditMesh *em); -void EM_deselect_flush(struct EditMesh *em); -void EM_selectmode_set(struct EditMesh *em); -void EM_select_flush(struct EditMesh *em); -void EM_convertsel(struct EditMesh *em, short oldmode, short selectmode); -void EM_validate_selections(struct EditMesh *em); -void EM_selectmode_to_scene(struct Scene *scene, struct Object *obedit); - - /* exported to transform */ -int EM_get_actSelection(struct EditMesh *em, struct EditSelection *ese); -void EM_editselection_normal(float *normal, struct EditSelection *ese); -void EM_editselection_plane(float *plane, struct EditSelection *ese); -void EM_editselection_center(float *center, struct EditSelection *ese); - -struct UvVertMap *EM_make_uv_vert_map(struct EditMesh *em, int selected, int do_face_idx_array, float *limit); -struct UvMapVert *EM_get_uv_map_vert(struct UvVertMap *vmap, unsigned int v); -void EM_free_uv_vert_map(struct UvVertMap *vmap); - -void EM_make_hq_normals(struct EditMesh *em); -void EM_solidify(struct EditMesh *em, float dist); - -int EM_deselect_nth(struct EditMesh *em, int nth); - -/* editmesh_mods.c */ +/* bmesh_mods.c */ extern unsigned int bm_vertoffs, bm_solidoffs, bm_wireoffs; -void EM_cache_x_mirror_vert(struct Object *ob, struct EditMesh *em); -int mouse_mesh(struct bContext *C, short mval[2], short extend); -int EM_check_backbuf(unsigned int index); -int EM_mask_init_backbuf_border(struct ViewContext *vc, short mcords[][2], short tot, short xmin, short ymin, short xmax, short ymax); -void EM_free_backbuf(void); -int EM_init_backbuf_border(struct ViewContext *vc, short xmin, short ymin, short xmax, short ymax); -int EM_init_backbuf_circle(struct ViewContext *vc, short xs, short ys, short rads); - -void EM_hide_mesh(struct EditMesh *em, int swap); -void EM_reveal_mesh(struct EditMesh *em); - -void EM_automerge(struct Scene *scene, struct Object *obedit, int update); - -/* editface.c */ -struct MTFace *EM_get_active_mtface(struct EditMesh *em, struct EditFace **act_efa, struct MCol **mcol, int sloppy); -int face_select(struct bContext *C, struct Object *ob, short mval[2], int extend); -void face_borderselect(struct bContext *C, struct Object *ob, struct rcti *rect, int select, int extend); -void selectall_tface(struct Object *ob, int action); -void select_linked_tfaces(struct bContext *C, struct Object *ob, short mval[2], int mode); -int minmax_tface(struct Scene *sce, float *min, float *max); /* object_vgroup.c */ @@ -306,25 +230,20 @@ struct BMVert *EDBM_findnearestvert(struct ViewContext *vc, int *dist, short sel struct BMEdge *EDBM_findnearestedge(struct ViewContext *vc, int *dist); struct BMFace *EDBM_findnearestface(struct ViewContext *vc, int *dist); -/*needed by edge slide*/ -struct EditVert *editedge_getOtherVert(struct EditEdge *eed, struct EditVert *eve); -struct EditVert *editedge_getSharedVert(struct EditEdge *eed, struct EditEdge *eed2); -int editedge_containsVert(struct EditEdge *eed, struct EditVert *eve); -int editface_containsVert(struct EditFace *efa, struct EditVert *eve); -int editface_containsEdge(struct EditFace *efa, struct EditEdge *eed); -short sharesFace(struct EditMesh *em, struct EditEdge *e1, struct EditEdge *e2); - /* mesh_data.c */ +// void ED_mesh_geometry_add(struct Mesh *mesh, struct ReportList *reports, int verts, int edges, int faces); +void ED_mesh_faces_add(struct Mesh *mesh, struct ReportList *reports, int count); +void ED_mesh_edges_add(struct Mesh *mesh, struct ReportList *reports, int count); +void ED_mesh_vertices_add(struct Mesh *mesh, struct ReportList *reports, int count); -void ED_mesh_geometry_add(struct Mesh *mesh, struct ReportList *reports, int verts, int edges, int faces); void ED_mesh_transform(struct Mesh *me, float *mat); void ED_mesh_calc_normals(struct Mesh *me); -void ED_mesh_material_add(struct Mesh *me, struct Material *ma); +void ED_mesh_material_link(struct Mesh *me, struct Material *ma); void ED_mesh_update(struct Mesh *mesh, struct bContext *C, int calc_edges); -int ED_mesh_uv_texture_add(struct bContext *C, struct Scene *scene, struct Object *ob, struct Mesh *me); +int ED_mesh_uv_texture_add(struct bContext *C, struct Scene *scene, struct Object *ob, struct Mesh *me, const char *name, int active_set); int ED_mesh_uv_texture_remove(struct bContext *C, struct Object *ob, struct Mesh *me); -int ED_mesh_color_add(struct bContext *C, struct Scene *scene, struct Object *ob, struct Mesh *me); +int ED_mesh_color_add(struct bContext *C, struct Scene *scene, struct Object *ob, struct Mesh *me, const char *name, int active_set); int ED_mesh_color_remove(struct bContext *C, struct Object *ob, struct Mesh *me); #endif /* ED_MESH_H */ diff --git a/source/blender/editors/include/ED_view3d.h b/source/blender/editors/include/ED_view3d.h index 471ce965d4c..bd4791055e2 100644 --- a/source/blender/editors/include/ED_view3d.h +++ b/source/blender/editors/include/ED_view3d.h @@ -104,13 +104,14 @@ void viewline(struct ARegion *ar, struct View3D *v3d, float mval[2], float ray_s void viewray(struct ARegion *ar, struct View3D *v3d, float mval[2], float ray_start[3], float ray_normal[3]); int get_view3d_cliprange(struct View3D *v3d, struct RegionView3D *rv3d, float *clipsta, float *clipend); -int get_view3d_viewplane(struct View3D *v3d, struct RegionView3D *rv3d, int winxi, int winyi, rctf *viewplane, float *clipsta, float *clipend, float *pixsize); +int get_view3d_viewplane(struct View3D *v3d, struct RegionView3D *rv3d, int winxi, int winyi, struct rctf *viewplane, float *clipsta, float *clipend, float *pixsize); int get_view3d_ortho(struct View3D *v3d, struct RegionView3D *rv3d); void view3d_get_object_project_mat(struct RegionView3D *v3d, struct Object *ob, float pmat[4][4]); /* computes screen x/y in vec */ void view3d_project_float(struct ARegion *a, float *vec, float *adr, float mat[4][4]); /* computes z, as well as x and y */ void view3d_project_float_v3(struct ARegion *a, float *vec, float *adr, float mat[4][4]); +void view3d_calc_camera_border(struct Scene *scene, struct ARegion *ar, struct RegionView3D *rv3d, struct View3D *v3d, struct rctf *viewborder_r); /* drawobject.c itterators */ void mesh_foreachScreenVert(struct ViewContext *vc, void (*func)(void *userData, struct BMVert *eve, int x, int y, int index), void *userData, int clipVerts); @@ -165,8 +166,8 @@ int ED_view3d_context_activate(struct bContext *C); void ED_view3d_draw_offscreen(struct Scene *scene, struct View3D *v3d, struct ARegion *ar, int winx, int winy, float viewmat[][4], float winmat[][4]); -struct ImBuf *ED_view3d_draw_offscreen_imbuf(struct Scene *scene, struct View3D *v3d, struct ARegion *ar, int sizex, int sizey); -struct ImBuf *ED_view3d_draw_offscreen_imbuf_simple(Scene *scene, int width, int height, int drawtype); +struct ImBuf *ED_view3d_draw_offscreen_imbuf(struct Scene *scene, struct View3D *v3d, struct ARegion *ar, int sizex, int sizey, unsigned int flag); +struct ImBuf *ED_view3d_draw_offscreen_imbuf_simple(Scene *scene, int width, int height, unsigned int flag, int drawtype); void view3d_clipping_local(struct RegionView3D *rv3d, float mat[][4]); diff --git a/source/blender/editors/include/UI_icons.h b/source/blender/editors/include/UI_icons.h index 6a139b124a6..3e8420df7eb 100644 --- a/source/blender/editors/include/UI_icons.h +++ b/source/blender/editors/include/UI_icons.h @@ -345,8 +345,8 @@ DEF_ICON(ICON_MESH_UVSPHERE) DEF_ICON(ICON_MESH_ICOSPHERE) DEF_ICON(ICON_MESH_GRID) DEF_ICON(ICON_MESH_MONKEY) -DEF_ICON(ICON_MESH_TUBE) -DEF_ICON(ICON_MESH_DONUT) +DEF_ICON(ICON_MESH_CYLINDER) +DEF_ICON(ICON_MESH_TORUS) DEF_ICON(ICON_MESH_CONE) DEF_ICON(ICON_BLANK610) DEF_ICON(ICON_BLANK611) @@ -362,16 +362,16 @@ DEF_ICON(ICON_META_PLANE) DEF_ICON(ICON_META_CUBE) DEF_ICON(ICON_META_BALL) DEF_ICON(ICON_META_ELLIPSOID) -DEF_ICON(ICON_META_TUBE) +DEF_ICON(ICON_META_CAPSULE) DEF_ICON(ICON_BLANK625) /* PRIMITIVES */ DEF_ICON(ICON_SURFACE_NCURVE) DEF_ICON(ICON_SURFACE_NCIRCLE) DEF_ICON(ICON_SURFACE_NSURFACE) -DEF_ICON(ICON_SURFACE_NTUBE) +DEF_ICON(ICON_SURFACE_NCYLINDER) DEF_ICON(ICON_SURFACE_NSPHERE) -DEF_ICON(ICON_SURFACE_NDONUT) +DEF_ICON(ICON_SURFACE_NTORUS) DEF_ICON(ICON_BLANK636) DEF_ICON(ICON_BLANK637) DEF_ICON(ICON_BLANK638) diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h index b126c6235d5..40985a918d4 100644 --- a/source/blender/editors/include/UI_interface.h +++ b/source/blender/editors/include/UI_interface.h @@ -135,7 +135,7 @@ typedef struct uiLayout uiLayout; #define UI_MAKE_RIGHT 8192 /* button align flag, for drawing groups together */ -#define UI_BUT_ALIGN (15<<14) +#define UI_BUT_ALIGN (UI_BUT_ALIGN_TOP|UI_BUT_ALIGN_LEFT|UI_BUT_ALIGN_RIGHT|UI_BUT_ALIGN_DOWN) #define UI_BUT_ALIGN_TOP (1<<14) #define UI_BUT_ALIGN_LEFT (1<<15) #define UI_BUT_ALIGN_RIGHT (1<<16) @@ -151,9 +151,10 @@ typedef struct uiLayout uiLayout; #define UI_BUT_UNDO (1<<25) #define UI_BUT_IMMEDIATE (1<<26) #define UI_BUT_NO_TOOLTIP (1<<27) +#define UI_BUT_NO_UTF8 (1<<28) -#define UI_BUT_VEC_SIZE_LOCK (1<<28) /* used to flag if color hsv-circle should keep luminance */ -#define UI_BUT_COLOR_CUBIC (1<<29) /* cubic saturation for the color wheel */ +#define UI_BUT_VEC_SIZE_LOCK (1<<29) /* used to flag if color hsv-circle should keep luminance */ +#define UI_BUT_COLOR_CUBIC (1<<30) /* cubic saturation for the color wheel */ #define UI_PANEL_WIDTH 340 #define UI_COMPACT_PANEL_WIDTH 160 @@ -687,7 +688,6 @@ void uiTemplateWaveform(uiLayout *layout, struct PointerRNA *ptr, char *propname void uiTemplateVectorscope(uiLayout *layout, struct PointerRNA *ptr, char *propname, int expand); void uiTemplateCurveMapping(uiLayout *layout, struct PointerRNA *ptr, char *propname, int type, int levels, int brush); void uiTemplateColorWheel(uiLayout *layout, struct PointerRNA *ptr, char *propname, int value_slider, int lock, int lock_luminosity, int cubic); -void uiTemplateTriColorSet(uiLayout *layout, struct PointerRNA *ptr, char *propname); void uiTemplateLayers(uiLayout *layout, struct PointerRNA *ptr, char *propname, PointerRNA *used_ptr, char *used_propname, int active_layer); void uiTemplateImage(uiLayout *layout, struct bContext *C, struct PointerRNA *ptr, char *propname, struct PointerRNA *userptr, int compact); diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c index 4c86b9480d4..021dcc940e6 100644 --- a/source/blender/editors/interface/interface.c +++ b/source/blender/editors/interface/interface.c @@ -1765,9 +1765,11 @@ static void ui_free_but(const bContext *C, uiBut *but) } if(but->func_argN) MEM_freeN(but->func_argN); if(but->active) { - /* XXX solve later, buttons should be free-able without context? */ + /* XXX solve later, buttons should be free-able without context ideally, + however they may have open tooltips or popup windows, which need to + be closed using a context pointer */ if(C) - ui_button_active_cancel(C, but); + ui_button_active_free(C, but); else if(but->active) MEM_freeN(but->active); @@ -2528,8 +2530,10 @@ uiBut *ui_def_but_rna(uiBlock *block, int type, int retval, char *str, short x1, } } } - else + else { + printf("ui_def_but_rna: property not found: %s.%s\n", RNA_struct_identifier(ptr->type), propname); str= (char*)propname; + } /* now create button */ but= ui_def_but(block, type, retval, str, x1, y1, x2, y2, NULL, min, max, a1, a2, tip); diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index 9d99409a741..9b3b194d74b 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -242,6 +242,20 @@ static int ui_is_a_warp_but(uiBut *but) return FALSE; } +/* file selectors are exempt from utf-8 checks */ +static int ui_is_utf8_but(uiBut *but) +{ + if (but->rnaprop) { + int subtype= RNA_property_subtype(but->rnaprop); + + if(ELEM3(subtype, PROP_FILEPATH, PROP_DIRPATH, PROP_FILENAME)) { + return TRUE; + } + } + + return !(but->flag & UI_BUT_NO_UTF8); +} + /* ********************** button apply/revert ************************/ static ListBase UIAfterFuncs = {NULL, NULL}; @@ -1572,6 +1586,15 @@ static void ui_textedit_begin(bContext *C, uiBut *but, uiHandleButtonData *data) static void ui_textedit_end(bContext *C, uiBut *but, uiHandleButtonData *data) { if(but) { + if(ui_is_utf8_but(but)) { + int strip= BLI_utf8_invalid_strip(but->editstr, strlen(but->editstr)); + /* not a file?, strip non utf-8 chars */ + if(strip) { + /* wont happen often so isnt that annoying to keep it here for a while */ + printf("invalid utf8 - stripped chars %d\n", strip); + } + } + if(data->searchbox) { if(data->cancel==0) ui_searchbox_apply(but, data->searchbox); @@ -4777,7 +4800,7 @@ static void button_activate_init(bContext *C, ARegion *ar, uiBut *but, uiButtonA button_activate_state(C, but, BUTTON_STATE_WAIT_FLASH); } -static void button_activate_exit(bContext *C, uiHandleButtonData *data, uiBut *but, int mousemove) +static void button_activate_exit(bContext *C, uiHandleButtonData *data, uiBut *but, int mousemove, int onfree) { uiBlock *block= but->block; uiBut *bt; @@ -4787,6 +4810,7 @@ static void button_activate_exit(bContext *C, uiHandleButtonData *data, uiBut *b button_activate_state(C, but, BUTTON_STATE_EXIT); /* apply the button action or value */ + if(!onfree) ui_apply_button(C, block, but, data, 0); /* if this button is in a menu, this will set the button return @@ -4802,7 +4826,7 @@ static void button_activate_exit(bContext *C, uiHandleButtonData *data, uiBut *b } } - if(!data->cancel) { + if(!onfree && !data->cancel) { /* autokey & undo push */ ui_apply_autokey_undo(C, but); @@ -4835,6 +4859,7 @@ static void button_activate_exit(bContext *C, uiHandleButtonData *data, uiBut *b but->active= NULL; but->flag &= ~(UI_ACTIVE|UI_SELECT); but->flag |= UI_BUT_LAST_ACTIVE; + if(!onfree) ui_check_but(but); /* adds empty mousemove in queue for re-init handler, in case mouse is @@ -4844,7 +4869,7 @@ static void button_activate_exit(bContext *C, uiHandleButtonData *data, uiBut *b WM_event_add_mousemove(C); } -void ui_button_active_cancel(const bContext *C, uiBut *but) +void ui_button_active_free(const bContext *C, uiBut *but) { uiHandleButtonData *data; @@ -4854,7 +4879,7 @@ void ui_button_active_cancel(const bContext *C, uiBut *but) if(but->active) { data= but->active; data->cancel= 1; - button_activate_exit((bContext*)C, data, but, 0); + button_activate_exit((bContext*)C, data, but, 0, 1); } } @@ -4920,7 +4945,7 @@ static void ui_handle_button_activate(bContext *C, ARegion *ar, uiBut *but, uiBu if(oldbut) { data= oldbut->active; data->cancel= 1; - button_activate_exit(C, data, oldbut, 0); + button_activate_exit(C, data, oldbut, 0, 0); } button_activate_init(C, ar, but, type); @@ -5078,7 +5103,7 @@ static int ui_handle_button_event(bContext *C, wmEvent *event, uiBut *but) postbut= data->postbut; posttype= data->posttype; - button_activate_exit(C, data, but, (postbut == NULL)); + button_activate_exit(C, data, but, (postbut == NULL), 0); /* for jumping to the next button with tab while text editing */ if(postbut) @@ -5182,7 +5207,7 @@ static void ui_handle_button_return_submenu(bContext *C, wmEvent *event, uiBut * if(menu->menuretval != UI_RETURN_OK) data->cancel= 1; - button_activate_exit(C, data, but, 1); + button_activate_exit(C, data, but, 1, 0); } else if(menu->menuretval == UI_RETURN_OUT) { if(event->type==MOUSEMOVE && ui_mouse_inside_button(data->region, but, event->x, event->y)) { @@ -5196,7 +5221,7 @@ static void ui_handle_button_return_submenu(bContext *C, wmEvent *event, uiBut * } else { data->cancel= 1; - button_activate_exit(C, data, but, 1); + button_activate_exit(C, data, but, 1, 0); } } } diff --git a/source/blender/editors/interface/interface_intern.h b/source/blender/editors/interface/interface_intern.h index cb8130573fe..84d6605651b 100644 --- a/source/blender/editors/interface/interface_intern.h +++ b/source/blender/editors/interface/interface_intern.h @@ -456,7 +456,7 @@ void ui_draw_but_IMAGE(ARegion *ar, uiBut *but, struct uiWidgetColors *wcol, rct /* interface_handlers.c */ extern void ui_button_activate_do(struct bContext *C, struct ARegion *ar, uiBut *but); -extern void ui_button_active_cancel(const struct bContext *C, uiBut *but); +extern void ui_button_active_free(const struct bContext *C, uiBut *but); extern int ui_button_is_active(struct ARegion *ar); /* interface_widgets.c */ diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c index 4b522c9ddcb..45ebc9bf136 100644 --- a/source/blender/editors/interface/interface_templates.c +++ b/source/blender/editors/interface/interface_templates.c @@ -69,68 +69,6 @@ void uiTemplateHeader(uiLayout *layout, bContext *C, int menus) else ED_area_header_switchbutton(C, block, 0); } -/********************** DopeSheet Filter Template *************************/ - -void uiTemplateDopeSheetFilter(uiLayout *layout, bContext *C, PointerRNA *ptr) -{ - Main *mainptr= CTX_data_main(C); - ScrArea *sa= CTX_wm_area(C); - uiLayout *row= layout; - short nlaActive= ((sa) && (sa->spacetype==SPACE_NLA)); - - /* most 'generic' filtering options */ - row= uiLayoutRow(layout, 1); - - uiItemR(row, ptr, "show_only_selected", 0, "", 0); - uiItemR(row, ptr, "show_hidden", 0, "", 0); - - /* object-level filtering options */ - row= uiLayoutRow(layout, 1); - uiItemR(row, ptr, "show_transforms", 0, "", 0); - - if (nlaActive) - uiItemR(row, ptr, "show_missing_nla", 0, "", 0); - - /* datatype based - only available datatypes are shown */ - row= uiLayoutRow(layout, 1); - - uiItemR(row, ptr, "show_scenes", 0, "", 0); - uiItemR(row, ptr, "show_worlds", 0, "", 0); - uiItemR(row, ptr, "show_nodes", 0, "", 0); - - if (mainptr && mainptr->mesh.first) - uiItemR(row, ptr, "show_meshes", 0, "", 0); - if (mainptr && mainptr->key.first) - uiItemR(row, ptr, "show_shapekeys", 0, "", 0); - if (mainptr && mainptr->mat.first) - uiItemR(row, ptr, "show_materials", 0, "", 0); - if (mainptr && mainptr->lamp.first) - uiItemR(row, ptr, "show_lamps", 0, "", 0); - if (mainptr && mainptr->tex.first) - uiItemR(row, ptr, "show_textures", 0, "", 0); - if (mainptr && mainptr->camera.first) - uiItemR(row, ptr, "show_cameras", 0, "", 0); - if (mainptr && mainptr->curve.first) - uiItemR(row, ptr, "show_curves", 0, "", 0); - if (mainptr && mainptr->mball.first) - uiItemR(row, ptr, "show_metaballs", 0, "", 0); - if (mainptr && mainptr->armature.first) - uiItemR(row, ptr, "show_armatures", 0, "", 0); - if (mainptr && mainptr->particle.first) - uiItemR(row, ptr, "show_particles", 0, "", 0); - - /* group-based filtering (only when groups are available */ - if (mainptr && mainptr->group.first) { - row= uiLayoutRow(layout, 1); - - uiItemR(row, ptr, "show_only_group_objects", 0, "", 0); - - /* if enabled, show the group selection field too */ - if (RNA_boolean_get(ptr, "show_only_group_objects")) - uiItemR(row, ptr, "filter_group", 0, "", 0); - } -} - /********************** Search Callbacks *************************/ typedef struct TemplateID { @@ -1884,31 +1822,6 @@ void uiTemplateColorWheel(uiLayout *layout, PointerRNA *ptr, char *propname, int uiDefButR(block, HSVCUBE, 0, "", WHEEL_SIZE+6, 0, 14, WHEEL_SIZE, ptr, propname, -1, softmin, softmax, 9, 0, ""); } - -/********************* TriColor (ThemeWireColorSet) Template ************************/ - -void uiTemplateTriColorSet(uiLayout *layout, PointerRNA *ptr, char *propname) -{ - PropertyRNA *prop= RNA_struct_find_property(ptr, propname); - uiLayout *row; - PointerRNA csPtr; - - if (!prop) { - printf("uiTemplateTriColorSet: property not found: %s.%s\n", RNA_struct_identifier(ptr->type), propname); - return; - } - - /* we lay out the data in a row as 3 color swatches */ - row= uiLayoutRow(layout, 1); - - /* nselected, selected, active color swatches */ - csPtr= RNA_property_pointer_get(ptr, prop); - - uiItemR(row, &csPtr, "normal", 0, "", 0); - uiItemR(row, &csPtr, "select", 0, "", 0); - uiItemR(row, &csPtr, "active", 0, "", 0); -} - /********************* Layer Buttons Template ************************/ static void handle_layer_buttons(bContext *C, void *arg1, void *arg2) diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c index 6b7d88d3c28..539be96c4ce 100644 --- a/source/blender/editors/interface/interface_widgets.c +++ b/source/blender/editors/interface/interface_widgets.c @@ -1638,6 +1638,10 @@ void ui_draw_but_HSVCIRCLE(uiBut *but, uiWidgetColors *wcol, rcti *rect) float centx, centy, radius; float rgb[3], hsv[3], hsvo[3], col[3], colcent[3]; int a, tot= 32; + int color_profile = but->block->color_profile; + + if (but->rnaprop && RNA_property_subtype(but->rnaprop) == PROP_COLOR_GAMMA) + color_profile = BLI_PR_NONE; radstep= 2.0f*M_PI/(float)tot; centx= (float)(rect->xmin + rect->xmax)/2; @@ -1656,7 +1660,10 @@ void ui_draw_but_HSVCIRCLE(uiBut *but, uiWidgetColors *wcol, rcti *rect) /* exception: if 'lock' is set * lock the value of the color wheel to 1. * Useful for color correction tools where you're only interested in hue. */ - if (but->flag & UI_BUT_COLOR_LOCK) hsv[2] = 1.f; + if (but->flag & UI_BUT_COLOR_LOCK) + hsv[2] = 1.f; + else if (color_profile) + hsv[2] = linearrgb_to_srgb(hsv[2]); hsv_to_rgb(0.f, 0.f, hsv[2], colcent, colcent+1, colcent+2); @@ -1884,11 +1891,8 @@ static void ui_draw_but_HSV_v(uiBut *but, rcti *rect) float rgb[3], hsv[3], v, range; int color_profile = but->block->color_profile; - if (but->rnaprop) { - if (RNA_property_subtype(but->rnaprop) == PROP_COLOR_GAMMA) { + if (but->rnaprop && RNA_property_subtype(but->rnaprop) == PROP_COLOR_GAMMA) color_profile = BLI_PR_NONE; - } - } ui_get_but_vectorf(but, rgb); rgb_to_hsv(rgb[0], rgb[1], rgb[2], hsv, hsv+1, hsv+2); diff --git a/source/blender/editors/interface/resources.c b/source/blender/editors/interface/resources.c index 227f3a4de1d..1661cf73d53 100644 --- a/source/blender/editors/interface/resources.c +++ b/source/blender/editors/interface/resources.c @@ -1006,6 +1006,10 @@ void init_userdef_do_versions(void) strcpy(U.tempdir, tmp?tmp:"/tmp/"); } + if (U.autokey_mode == 0) { + /* 'add/replace' but not on */ + U.autokey_mode = 2; + } if (U.savetime <= 0) { U.savetime = 1; // XXX error("startup.blend is buggy, please consider removing it.\n"); diff --git a/source/blender/editors/mesh/editbmesh_add.c b/source/blender/editors/mesh/editbmesh_add.c index 20bd2d3d82b..9a9a49b25e0 100644 --- a/source/blender/editors/mesh/editbmesh_add.c +++ b/source/blender/editors/mesh/editbmesh_add.c @@ -284,7 +284,7 @@ void MESH_OT_primitive_circle_add(wmOperatorType *ot) ED_object_add_generic_props(ot, TRUE); } -static int add_primitive_tube_exec(bContext *C, wmOperator *op) +static int add_primitive_cylinder_exec(bContext *C, wmOperator *op) { Object *obedit; Mesh *me; @@ -310,7 +310,7 @@ static int add_primitive_tube_exec(bContext *C, wmOperator *op) make_prim_finish(C, &state, enter_editmode); } -void MESH_OT_primitive_tube_add(wmOperatorType *ot) +void MESH_OT_primitive_cylinder_add(wmOperatorType *ot) { /* identifiers */ ot->name= "Add Tube"; @@ -319,7 +319,7 @@ void MESH_OT_primitive_tube_add(wmOperatorType *ot) /* api callbacks */ ot->invoke= ED_object_add_generic_invoke; - ot->exec= add_primitive_tube_exec; + ot->exec= add_primitive_cylinder_exec; ot->poll= ED_operator_scene_editable; /* flags */ diff --git a/source/blender/editors/mesh/loopcut.c b/source/blender/editors/mesh/loopcut.c index 68ef56ad3ab..282ed48a476 100644 --- a/source/blender/editors/mesh/loopcut.c +++ b/source/blender/editors/mesh/loopcut.c @@ -292,6 +292,8 @@ static void ringsel_finish(bContext *C, wmOperator *op) em->selectmode &= ~SCE_SELECT_FACE; CTX_data_tool_settings(C)->selectmode= em->selectmode; EDBM_selectmode_set(em); + + WM_event_add_notifier(C, NC_SCENE|ND_TOOLSETTINGS, CTX_data_scene(C)); } WM_event_add_notifier(C, NC_GEOM|ND_SELECT|ND_DATA, lcd->ob->data); diff --git a/source/blender/editors/mesh/mesh_data.c b/source/blender/editors/mesh/mesh_data.c index 80dc5331cf8..8e95356f748 100644 --- a/source/blender/editors/mesh/mesh_data.c +++ b/source/blender/editors/mesh/mesh_data.c @@ -163,7 +163,7 @@ static void delete_customdata_layer(bContext *C, Object *ob, CustomDataLayer *la } } -int ED_mesh_uv_texture_add(bContext *C, Scene *scene, Object *ob, Mesh *me) +int ED_mesh_uv_texture_add(bContext *C, Scene *scene, Object *ob, Mesh *me, const char *name, int active_set) { BMEditMesh *em; int layernum; @@ -173,22 +173,26 @@ int ED_mesh_uv_texture_add(bContext *C, Scene *scene, Object *ob, Mesh *me) layernum= CustomData_number_of_layers(&em->bm->pdata, CD_MTEXPOLY); if(layernum >= MAX_MTFACE) - return OPERATOR_CANCELLED; + return 0; - BM_add_data_layer(em->bm, &em->bm->pdata, MAX_MTFACE); - CustomData_set_layer_active(&em->bm->pdata, MAX_MTFACE, layernum); + BM_add_data_layer(em->bm, &em->bm->pdata, CD_MTEXPOLY); + CustomData_set_layer_active(&em->bm->pdata, CD_MTEXPOLY, layernum); + if(active_set || layernum==0) + CustomData_set_layer_active(&em->bm->pdata, CD_MTEXPOLY, layernum); } else { layernum= CustomData_number_of_layers(&me->pdata, MAX_MTFACE); if(layernum >= MAX_MTFACE) - return OPERATOR_CANCELLED; + return 0; if(me->mtface) - CustomData_add_layer(&me->pdata, MAX_MTFACE, CD_DUPLICATE, me->mtpoly, me->totpoly); + CustomData_add_layer_named(&me->pdata, CD_MTEXPOLY, CD_DUPLICATE, me->mtpoly, me->totpoly, name); else - CustomData_add_layer(&me->pdata, MAX_MTFACE, CD_DEFAULT, NULL, me->totpoly); + CustomData_add_layer_named(&me->pdata, CD_MTEXPOLY, CD_DEFAULT, NULL, me->totpoly, name); + + if(active_set || layernum==0) + CustomData_set_layer_active(&me->pdata, CD_MTEXPOLY, layernum); - CustomData_set_layer_active(&me->pdata, MAX_MTFACE, layernum); mesh_update_customdata_pointers(me); } @@ -216,7 +220,7 @@ int ED_mesh_uv_texture_remove(bContext *C, Object *ob, Mesh *me) return 1; } -int ED_mesh_color_add(bContext *C, Scene *scene, Object *ob, Mesh *me) +int ED_mesh_color_add(bContext *C, Scene *scene, Object *ob, Mesh *me, const char *name, int active_set) { BMEditMesh *em; MLoopCol *mcol; @@ -231,6 +235,10 @@ int ED_mesh_color_add(bContext *C, Scene *scene, Object *ob, Mesh *me) BM_add_data_layer(em->bm, &em->bm->pdata, CD_MLOOPCOL); CustomData_set_layer_active(&em->bm->ldata, CD_MLOOPCOL, layernum); + + if(active_set || layernum==0) + CustomData_set_layer_active(&em->bm->ldata, CD_MLOOPCOL, layernum); + } else { layernum= CustomData_number_of_layers(&me->ldata, CD_MLOOPCOL); @@ -240,11 +248,13 @@ int ED_mesh_color_add(bContext *C, Scene *scene, Object *ob, Mesh *me) mcol= me->mloopcol; if(me->mloopcol) - CustomData_add_layer(&me->ldata, CD_MLOOPCOL, CD_DUPLICATE, me->mloopcol, me->totloop); + CustomData_add_layer_named(&me->ldata, CD_MLOOPCOL, CD_DUPLICATE, me->mloopcol, me->totloop, name); else - CustomData_add_layer(&me->ldata, CD_MLOOPCOL, CD_DEFAULT, NULL, me->totloop); + CustomData_add_layer_named(&me->ldata, CD_MLOOPCOL, CD_DEFAULT, NULL, me->totloop, name); + + if(active_set || layernum==0) + CustomData_set_layer_active(&me->ldata, CD_MLOOPCOL, layernum); - CustomData_set_layer_active(&me->ldata, CD_MLOOPCOL, layernum); mesh_update_customdata_pointers(me); /*BMESH_TODO @@ -292,7 +302,7 @@ static int uv_texture_add_exec(bContext *C, wmOperator *op) Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data; Mesh *me= ob->data; - if(!ED_mesh_uv_texture_add(C, scene, ob, me)) + if(!ED_mesh_uv_texture_add(C, scene, ob, me, NULL, TRUE)) return OPERATOR_CANCELLED; return OPERATOR_FINISHED; @@ -426,7 +436,7 @@ static int vertex_color_add_exec(bContext *C, wmOperator *op) Object *ob= CTX_data_pointer_get_type(C, "object", &RNA_Object).data; Mesh *me= ob->data; - if(!ED_mesh_color_add(C, scene, ob, me)) + if(!ED_mesh_color_add(C, scene, ob, me, NULL, TRUE)) return OPERATOR_CANCELLED; return OPERATOR_FINISHED; @@ -721,6 +731,7 @@ static void mesh_add_faces(Mesh *mesh, int len) mesh->totface= totface; } +/* void ED_mesh_geometry_add(Mesh *mesh, ReportList *reports, int verts, int edges, int faces) { if(mesh->edit_btmesh) { @@ -735,33 +746,39 @@ void ED_mesh_geometry_add(Mesh *mesh, ReportList *reports, int verts, int edges, if(faces) mesh_add_faces(mesh, faces); } +*/ -void ED_mesh_calc_normals(Mesh *me) +void ED_mesh_faces_add(Mesh *mesh, ReportList *reports, int count) { - mesh_calc_normals(me->mvert, me->totvert, me->mface, me->totface, NULL); + if(mesh->edit_btmesh) { + BKE_report(reports, RPT_ERROR, "Can't add faces in edit mode."); + return; } -void ED_mesh_material_add(Mesh *me, Material *ma) -{ - int i; - int totcol = me->totcol + 1; - Material **mat; + mesh_add_faces(mesh, count); +} - /* don't add if mesh already has it */ - for(i = 0; i < me->totcol; i++) - if(me->mat[i] == ma) +void ED_mesh_edges_add(Mesh *mesh, ReportList *reports, int count) +{ + if(mesh->edit_btmesh) { + BKE_report(reports, RPT_ERROR, "Can't add edges in edit mode."); return; + } - mat= MEM_callocN(sizeof(void*)*totcol, "newmatar"); - - if(me->totcol) memcpy(mat, me->mat, sizeof(void*) * me->totcol); - if(me->mat) MEM_freeN(me->mat); + mesh_add_edges(mesh, count); +} - me->mat = mat; - me->mat[me->totcol++] = ma; - if(ma) - ma->id.us++; +void ED_mesh_vertices_add(Mesh *mesh, ReportList *reports, int count) +{ + if(mesh->edit_btmesh) { + BKE_report(reports, RPT_ERROR, "Can't add vertices in edit mode."); + return; + } - test_object_materials((ID*)me); + mesh_add_verts(mesh, count); } +void ED_mesh_calc_normals(Mesh *me) +{ + mesh_calc_normals(me->mvert, me->totvert, me->mface, me->totface, NULL); +} diff --git a/source/blender/editors/mesh/mesh_intern.h b/source/blender/editors/mesh/mesh_intern.h index 271cd8a8524..28c72121d2f 100644 --- a/source/blender/editors/mesh/mesh_intern.h +++ b/source/blender/editors/mesh/mesh_intern.h @@ -127,7 +127,7 @@ void MESH_OT_separate(struct wmOperatorType *ot); void MESH_OT_primitive_plane_add(struct wmOperatorType *ot); void MESH_OT_primitive_cube_add(struct wmOperatorType *ot); void MESH_OT_primitive_circle_add(struct wmOperatorType *ot); -void MESH_OT_primitive_tube_add(struct wmOperatorType *ot); +void MESH_OT_primitive_cylinder_add(struct wmOperatorType *ot); void MESH_OT_primitive_cone_add(struct wmOperatorType *ot); void MESH_OT_primitive_grid_add(struct wmOperatorType *ot); void MESH_OT_primitive_monkey_add(struct wmOperatorType *ot); diff --git a/source/blender/editors/mesh/mesh_ops.c b/source/blender/editors/mesh/mesh_ops.c index 648e4f04302..621f20144b5 100644 --- a/source/blender/editors/mesh/mesh_ops.c +++ b/source/blender/editors/mesh/mesh_ops.c @@ -75,7 +75,7 @@ void ED_operatortypes_mesh(void) WM_operatortype_append(MESH_OT_primitive_plane_add); WM_operatortype_append(MESH_OT_primitive_cube_add); WM_operatortype_append(MESH_OT_primitive_circle_add); - WM_operatortype_append(MESH_OT_primitive_tube_add); + WM_operatortype_append(MESH_OT_primitive_cylinder_add); WM_operatortype_append(MESH_OT_primitive_cone_add); WM_operatortype_append(MESH_OT_primitive_grid_add); WM_operatortype_append(MESH_OT_primitive_monkey_add); diff --git a/source/blender/editors/metaball/mball_edit.c b/source/blender/editors/metaball/mball_edit.c index d097caac63d..62ebe84e078 100644 --- a/source/blender/editors/metaball/mball_edit.c +++ b/source/blender/editors/metaball/mball_edit.c @@ -45,6 +45,7 @@ #include "BKE_depsgraph.h" #include "BKE_context.h" +#include "BKE_mball.h" #include "ED_screen.h" #include "ED_view3d.h" @@ -103,53 +104,11 @@ MetaElem *add_metaball_primitive(bContext *C, float mat[4][4], int type, int new ml= ml->next; } - ml= MEM_callocN(sizeof(MetaElem), "metaelem"); - - ml->x= mat[3][0]; - ml->y= mat[3][1]; - ml->z= mat[3][2]; - ml->quat[0]= 1.0; - ml->quat[1]= 0.0; - ml->quat[2]= 0.0; - ml->quat[3]= 0.0; - ml->rad= 2.0; - ml->s= 2.0; - ml->flag= SELECT | MB_SCALE_RAD; - - switch(type) { - case MB_BALL: - ml->type = MB_BALL; - ml->expx= ml->expy= ml->expz= 1.0; - - break; - case MB_TUBE: - ml->type = MB_TUBE; - ml->expx= ml->expy= ml->expz= 1.0; - - break; - case MB_PLANE: - ml->type = MB_PLANE; - ml->expx= ml->expy= ml->expz= 1.0; - - break; - case MB_ELIPSOID: - ml->type = MB_ELIPSOID; - ml->expx= 1.2f; - ml->expy= 0.8f; - ml->expz= 1.0; - - break; - case MB_CUBE: - ml->type = MB_CUBE; - ml->expx= ml->expy= ml->expz= 1.0; - - break; - default: - break; - } - + ml= add_metaball_element(mball, type); + copy_v3_v3(&ml->x, mat[3]); + + ml->flag |= SELECT; mball->lastelem= ml; - return ml; } diff --git a/source/blender/editors/object/object_add.c b/source/blender/editors/object/object_add.c index e60f9db79f6..e4b71368315 100644 --- a/source/blender/editors/object/object_add.c +++ b/source/blender/editors/object/object_add.c @@ -176,7 +176,7 @@ void ED_object_add_generic_props(wmOperatorType *ot, int do_editmode) RNA_def_property_flag(prop, PROP_HIDDEN); } - RNA_def_float_vector(ot->srna, "location", 3, NULL, -FLT_MAX, FLT_MAX, "Location", "Location for the newly added object.", -FLT_MAX, FLT_MAX); + RNA_def_float_vector_xyz(ot->srna, "location", 3, NULL, -FLT_MAX, FLT_MAX, "Location", "Location for the newly added object.", -FLT_MAX, FLT_MAX); RNA_def_float_rotation(ot->srna, "rotation", 3, NULL, -FLT_MAX, FLT_MAX, "Rotation", "Rotation for the newly added object", -FLT_MAX, FLT_MAX); prop = RNA_def_boolean_layer_member(ot->srna, "layers", 20, NULL, "Layer", ""); @@ -256,7 +256,9 @@ int ED_object_add_generic_get_opts(bContext *C, wmOperator *op, float *loc, floa if(v3d && v3d->localvd) *layer |= v3d->lay; - if (RNA_property_is_set(op->ptr, "view_align")) + if(RNA_property_is_set(op->ptr, "rotation")) + view_align = FALSE; + else if (RNA_property_is_set(op->ptr, "view_align")) view_align = RNA_boolean_get(op->ptr, "view_align"); else view_align = U.flag & USER_ADD_VIEWALIGNED; @@ -303,6 +305,8 @@ Object *ED_object_add_type(bContext *C, int type, float *loc, float *rot, int en if(enter_editmode) ED_object_enter_editmode(C, EM_IGNORE_LAYER); + WM_event_add_notifier(C, NC_SCENE|ND_LAYER_CONTENT, scene); + return ob; } @@ -491,7 +495,7 @@ void OBJECT_OT_camera_add(wmOperatorType *ot) static EnumPropertyItem prop_metaball_types[]= { {MB_BALL, "MBALL_BALL", ICON_META_BALL, "Meta Ball", ""}, - {MB_TUBE, "MBALL_TUBE", ICON_META_TUBE, "Meta Tube", ""}, + {MB_TUBE, "MBALL_CAPSULE", ICON_META_CAPSULE, "Meta Capsule", ""}, {MB_PLANE, "MBALL_PLANE", ICON_META_PLANE, "Meta Plane", ""}, {MB_CUBE, "MBALL_CUBE", ICON_META_CUBE, "Meta Cube", ""}, {MB_ELIPSOID, "MBALL_ELLIPSOID", ICON_META_ELLIPSOID, "Meta Ellipsoid", ""}, @@ -501,7 +505,6 @@ static EnumPropertyItem prop_metaball_types[]= { static int object_metaball_add_exec(bContext *C, wmOperator *op) { Object *obedit= CTX_data_edit_object(C); - MetaBall *mball; MetaElem *elem; int newob= 0; int enter_editmode; @@ -523,8 +526,6 @@ static int object_metaball_add_exec(bContext *C, wmOperator *op) ED_object_new_primitive_matrix(C, obedit, loc, rot, mat); elem= (MetaElem*)add_metaball_primitive(C, mat, RNA_enum_get(op->ptr, "type"), newob); - mball= (MetaBall*)obedit->data; - BLI_addtail(mball->editelems, elem); /* userdef */ if (newob && !enter_editmode) { @@ -826,7 +827,8 @@ static int object_delete_exec(bContext *C, wmOperator *op) DAG_scene_sort(bmain, scene); DAG_ids_flush_update(bmain, 0); - WM_event_add_notifier(C, NC_SCENE|ND_OB_ACTIVE, CTX_data_scene(C)); + WM_event_add_notifier(C, NC_SCENE|ND_OB_ACTIVE, scene); + WM_event_add_notifier(C, NC_SCENE|ND_LAYER_CONTENT, scene); return OPERATOR_FINISHED; } diff --git a/source/blender/editors/object/object_modifier.c b/source/blender/editors/object/object_modifier.c index 8bbfce4dd99..4d70ae34e52 100644 --- a/source/blender/editors/object/object_modifier.c +++ b/source/blender/editors/object/object_modifier.c @@ -142,6 +142,7 @@ ModifierData *ED_object_modifier_add(ReportList *reports, Main *bmain, Scene *sc int ED_object_modifier_remove(ReportList *reports, Main *bmain, Scene *scene, Object *ob, ModifierData *md) { ModifierData *obmd; + int sort_depsgraph = 0; /* It seems on rapid delete it is possible to * get called twice on same modifier, so make @@ -174,13 +175,13 @@ int ED_object_modifier_remove(ReportList *reports, Main *bmain, Scene *scene, Ob if(ob->pd) ob->pd->deflect= 0; - DAG_scene_sort(bmain, scene); + sort_depsgraph = 1; } else if(md->type == eModifierType_Surface) { if(ob->pd && ob->pd->shape == PFIELD_SHAPE_SURFACE) ob->pd->shape = PFIELD_SHAPE_PLANE; - DAG_scene_sort(bmain, scene); + sort_depsgraph = 1; } else if(md->type == eModifierType_Smoke) { ob->dt = OB_TEXTURE; @@ -197,6 +198,10 @@ int ED_object_modifier_remove(ReportList *reports, Main *bmain, Scene *scene, Ob DAG_id_flush_update(&ob->id, OB_RECALC_DATA); + /* sorting has to be done after the update so that dynamic systems can react properly */ + if(sort_depsgraph) + DAG_scene_sort(bmain, scene); + return 1; } @@ -464,6 +469,21 @@ static int modifier_apply_obdata(ReportList *reports, Scene *scene, Object *ob, BKE_report(reports, RPT_ERROR, "Cannot apply modifier for this object type"); return 0; } + + /* lattice modifier can be applied to particle system too */ + if(ob->particlesystem.first) { + + ParticleSystem *psys = ob->particlesystem.first; + + for(; psys; psys=psys->next) { + + if(psys->part->type != PART_HAIR) + continue; + + psys_apply_hair_lattice(scene, ob, psys); + } + } + return 1; } diff --git a/source/blender/editors/object/object_relations.c b/source/blender/editors/object/object_relations.c index 76330477418..d23ea57e0e7 100644 --- a/source/blender/editors/object/object_relations.c +++ b/source/blender/editors/object/object_relations.c @@ -1106,6 +1106,8 @@ static int move_to_layer_exec(bContext *C, wmOperator *op) /* warning, active object may be hidden now */ WM_event_add_notifier(C, NC_SCENE|NC_OBJECT|ND_DRAW, scene); /* is NC_SCENE needed ? */ + WM_event_add_notifier(C, NC_SCENE|ND_LAYER_CONTENT, scene); + DAG_scene_sort(bmain, scene); return OPERATOR_FINISHED; diff --git a/source/blender/editors/object/object_vgroup.c b/source/blender/editors/object/object_vgroup.c index 43de351e4c1..3cc0be8d640 100644 --- a/source/blender/editors/object/object_vgroup.c +++ b/source/blender/editors/object/object_vgroup.c @@ -85,7 +85,7 @@ bDeformGroup *ED_vgroup_add_name(Object *ob, char *name) { bDeformGroup *defgroup; - if(!ob) + if(!ob || !ELEM(ob->type, OB_MESH, OB_LATTICE)) return NULL; defgroup = MEM_callocN(sizeof(bDeformGroup), "add deformGroup"); diff --git a/source/blender/editors/physics/particle_edit.c b/source/blender/editors/physics/particle_edit.c index d3f9926cf8c..eaadd3e7d83 100644 --- a/source/blender/editors/physics/particle_edit.c +++ b/source/blender/editors/physics/particle_edit.c @@ -4151,6 +4151,13 @@ static int clear_edited_exec(bContext *C, wmOperator *op) DAG_id_flush_update(&ob->id, OB_RECALC_DATA); } } + else { /* some operation might have protected hair from editing so let's clear the flag */ + psys->recalc |= PSYS_RECALC_RESET; + psys->flag &= ~PSYS_GLOBAL_HAIR; + psys->flag &= ~PSYS_EDITED; + WM_event_add_notifier(C, NC_OBJECT|ND_PARTICLE|NA_EDITED, ob); + DAG_id_flush_update(&ob->id, OB_RECALC_DATA); + } return OPERATOR_FINISHED; } diff --git a/source/blender/editors/render/render_opengl.c b/source/blender/editors/render/render_opengl.c index c0e6ea66bc4..7833f93b3b5 100644 --- a/source/blender/editors/render/render_opengl.c +++ b/source/blender/editors/render/render_opengl.c @@ -116,6 +116,17 @@ static void screen_opengl_render_apply(OGLRender *oglrender) rr= RE_AcquireResultRead(oglrender->re); + /* note on color management: + * looked into how best to deal with color management here and found heres how it should work. + * + * OpenGL materials etc are color corrected, so a float buffer from the graphics card is + * color corrected, without running any conversion functions. + * + * With color correction disabled blender expects the rr->rectf to be non-color managed so + * just do a direct copy from the byte array to the rectf with no conversion too. + * notice IMB_float_from_rect has the profile set so no conversion is done. + */ + if(view_context) { GPU_offscreen_bind(oglrender->ofs); /* bind */ @@ -133,11 +144,8 @@ static void screen_opengl_render_apply(OGLRender *oglrender) GPU_offscreen_unbind(oglrender->ofs); /* unbind */ } else { - ImBuf *ibuf_view= ED_view3d_draw_offscreen_imbuf_simple(scene, oglrender->sizex, oglrender->sizey, OB_SOLID); - IMB_float_from_rect(ibuf_view); - + ImBuf *ibuf_view= ED_view3d_draw_offscreen_imbuf_simple(scene, oglrender->sizex, oglrender->sizey, IB_rectfloat, OB_SOLID); memcpy(rr->rectf, ibuf_view->rect_float, sizeof(float) * 4 * oglrender->sizex * oglrender->sizey); - IMB_freeImBuf(ibuf_view); } diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c index 7e922076f4b..dd5a7d60fbd 100644 --- a/source/blender/editors/sculpt_paint/paint_image.c +++ b/source/blender/editors/sculpt_paint/paint_image.c @@ -5531,7 +5531,7 @@ static int texture_paint_image_from_view_exec(bContext *C, wmOperator *op) if(w > maxsize) w= maxsize; if(h > maxsize) h= maxsize; - ibuf= ED_view3d_draw_offscreen_imbuf(CTX_data_scene(C), CTX_wm_view3d(C), CTX_wm_region(C), w, h); + ibuf= ED_view3d_draw_offscreen_imbuf(CTX_data_scene(C), CTX_wm_view3d(C), CTX_wm_region(C), w, h, IB_rect); image= BKE_add_image_imbuf(ibuf); if(image) { diff --git a/source/blender/editors/space_buttons/space_buttons.c b/source/blender/editors/space_buttons/space_buttons.c index 9d34b827ff9..0b6e752574b 100644 --- a/source/blender/editors/space_buttons/space_buttons.c +++ b/source/blender/editors/space_buttons/space_buttons.c @@ -350,10 +350,12 @@ static void buttons_area_listener(ScrArea *sa, wmNotifier *wmn) ED_area_tag_redraw(sa); break; } + break; /* Listener for preview render, when doing an global undo. */ case NC_WINDOW: ED_area_tag_redraw(sa); sbuts->preview= 1; + break; } if(wmn->data == ND_KEYS) diff --git a/source/blender/editors/space_file/Makefile b/source/blender/editors/space_file/Makefile index 1fc27795f08..4597ffa3f6b 100644 --- a/source/blender/editors/space_file/Makefile +++ b/source/blender/editors/space_file/Makefile @@ -73,4 +73,4 @@ endif ifeq ($(WITH_HDR), true) CPPFLAGS += -DWITH_HDR -endif
\ No newline at end of file +endif diff --git a/source/blender/editors/space_file/file_draw.c b/source/blender/editors/space_file/file_draw.c index f25fab45c7c..5f435aa0cbe 100644 --- a/source/blender/editors/space_file/file_draw.c +++ b/source/blender/editors/space_file/file_draw.c @@ -118,7 +118,7 @@ void file_draw_buttons(const bContext *C, ARegion *ar) const int separator = 4; /* Additional locals. */ - char name[20]; + char name[32]; int loadbutton; int fnumbuttons; int min_x = 10; @@ -177,11 +177,14 @@ void file_draw_buttons(const bContext *C, ARegion *ar) params->dir, 0.0, (float)FILE_MAX-1, 0, 0, "File path."); uiButSetCompleteFunc(but, autocomplete_directory, NULL); + uiButSetFlag(but, UI_BUT_NO_UTF8); + but = uiDefBut(block, TEX, B_FS_FILENAME, "", min_x, line2_y, line2_w-chan_offs, btn_h, params->file, 0.0, (float)FILE_MAXFILE-1, 0, 0, "File name."); uiButSetCompleteFunc(but, autocomplete_file, NULL); + uiButSetFlag(but, UI_BUT_NO_UTF8); } /* Filename number increment / decrement buttons. */ @@ -541,6 +544,7 @@ void file_draw_list(const bContext *C, ARegion *ar) uiBut *but = uiDefBut(block, TEX, 1, "", spos, sy-layout->tile_h-3, but_width, layout->textheight*2, sfile->params->renameedit, 1.0f, (float)sizeof(sfile->params->renameedit),0,0,""); uiButSetRenameFunc(but, renamebutton_cb, file); + uiButSetFlag(but, UI_BUT_NO_UTF8); /* allow non utf8 names */ if ( 0 == uiButActiveOnly(C, block, but)) { file->flags &= ~EDITING; } @@ -628,4 +632,3 @@ void file_draw_list(const bContext *C, ARegion *ar) } - diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c index 818a6181626..3b335487557 100644 --- a/source/blender/editors/space_image/image_ops.c +++ b/source/blender/editors/space_image/image_ops.c @@ -1304,7 +1304,7 @@ static int pack_test(bContext *C, wmOperator *op) return 0; if(ima->source==IMA_SRC_SEQUENCE || ima->source==IMA_SRC_MOVIE) { - BKE_report(op->reports, RPT_ERROR, "Can't pack movie or image sequence."); + BKE_report(op->reports, RPT_ERROR, "Packing movies or image sequences not supported."); return 0; } @@ -1481,7 +1481,7 @@ static int unpack_exec(bContext *C, wmOperator *op) return OPERATOR_CANCELLED; if(ima->source==IMA_SRC_SEQUENCE || ima->source==IMA_SRC_MOVIE) { - BKE_report(op->reports, RPT_ERROR, "Can't unpack movie or image sequence."); + BKE_report(op->reports, RPT_ERROR, "Unpacking movies or image sequences not supported."); return OPERATOR_CANCELLED; } @@ -1506,7 +1506,7 @@ static int unpack_invoke(bContext *C, wmOperator *op, wmEvent *event) return OPERATOR_CANCELLED; if(ima->source==IMA_SRC_SEQUENCE || ima->source==IMA_SRC_MOVIE) { - BKE_report(op->reports, RPT_ERROR, "Can't unpack movie or image sequence."); + BKE_report(op->reports, RPT_ERROR, "Unpacking movies or image sequences not supported."); return OPERATOR_CANCELLED; } diff --git a/source/blender/editors/space_image/space_image.c b/source/blender/editors/space_image/space_image.c index 32e8be83bc5..60b43844034 100644 --- a/source/blender/editors/space_image/space_image.c +++ b/source/blender/editors/space_image/space_image.c @@ -954,7 +954,7 @@ void ED_spacetype_image(void) /* regions: statistics/scope buttons */ art= MEM_callocN(sizeof(ARegionType), "spacetype image region"); art->regionid = RGN_TYPE_PREVIEW; - art->minsizex= 220; // XXX + art->prefsizex= 220; // XXX art->keymapflag= ED_KEYMAP_UI|ED_KEYMAP_FRAMES; art->listener= image_scope_area_listener; art->init= image_scope_area_init; diff --git a/source/blender/editors/space_logic/logic_window.c b/source/blender/editors/space_logic/logic_window.c index 8a703c510c4..4b778e80b0e 100644 --- a/source/blender/editors/space_logic/logic_window.c +++ b/source/blender/editors/space_logic/logic_window.c @@ -3666,7 +3666,7 @@ static void draw_actuator_action(uiLayout *layout, PointerRNA *ptr) uiItemR(row, ptr, "use_continue_last_frame", 0, NULL, 0); row= uiLayoutRow(layout, 0); - if((RNA_enum_get(ptr, "mode") == ACT_ACTION_FROM_PROP)) + if((RNA_enum_get(ptr, "play_mode") == ACT_ACTION_FROM_PROP)) uiItemPointerR(row, ptr, "property", &settings_ptr, "properties", NULL, 0); else { diff --git a/source/blender/editors/space_node/drawnode.c b/source/blender/editors/space_node/drawnode.c index c1b888fcf83..f865c30dc45 100644 --- a/source/blender/editors/space_node/drawnode.c +++ b/source/blender/editors/space_node/drawnode.c @@ -553,7 +553,7 @@ static void node_composit_buts_dblur(uiLayout *layout, bContext *C, PointerRNA * uiLayout *col; uiItemR(layout, ptr, "iterations", 0, NULL, 0); - uiItemR(layout, ptr, "wrap", 0, NULL, 0); + uiItemR(layout, ptr, "use_wrap", 0, NULL, 0); col= uiLayoutColumn(layout, 1); uiItemL(col, "Center:", 0); @@ -601,9 +601,9 @@ static void node_composit_buts_defocus(uiLayout *layout, bContext *C, PointerRNA uiItemR(layout, ptr, "threshold", 0, NULL, 0); col = uiLayoutColumn(layout, 0); - uiItemR(col, ptr, "preview", 0, NULL, 0); + uiItemR(col, ptr, "use_preview", 0, NULL, 0); sub = uiLayoutColumn(col, 0); - uiLayoutSetActive(sub, RNA_boolean_get(ptr, "preview")); + uiLayoutSetActive(sub, RNA_boolean_get(ptr, "use_preview")); uiItemR(sub, ptr, "samples", 0, NULL, 0); col = uiLayoutColumn(layout, 0); @@ -707,13 +707,21 @@ static void node_composit_buts_crop(uiLayout *layout, bContext *C, PointerRNA *p uiLayout *col; uiItemR(layout, ptr, "use_crop_size", 0, NULL, 0); + uiItemR(layout, ptr, "relative", 0, NULL, 0); col= uiLayoutColumn(layout, 1); + if (RNA_boolean_get(ptr, "relative")){ + uiItemR(col, ptr, "rel_min_x", 0, "Left", 0); + uiItemR(col, ptr, "rel_max_x", 0, "Right", 0); + uiItemR(col, ptr, "rel_min_y", 0, "Up", 0); + uiItemR(col, ptr, "rel_max_y", 0, "Down", 0); + } else { uiItemR(col, ptr, "min_x", 0, "Left", 0); uiItemR(col, ptr, "max_x", 0, "Right", 0); uiItemR(col, ptr, "min_y", 0, "Up", 0); uiItemR(col, ptr, "max_y", 0, "Down", 0); } +} static void node_composit_buts_splitviewer(uiLayout *layout, bContext *C, PointerRNA *ptr) { @@ -760,9 +768,9 @@ static void node_composit_buts_hue_sat(uiLayout *layout, bContext *C, PointerRNA uiLayout *col; col =uiLayoutColumn(layout, 0); - uiItemR(col, ptr, "hue", UI_ITEM_R_SLIDER, NULL, 0); - uiItemR(col, ptr, "sat", UI_ITEM_R_SLIDER, NULL, 0); - uiItemR(col, ptr, "val", UI_ITEM_R_SLIDER, NULL, 0); + uiItemR(col, ptr, "color_hue", UI_ITEM_R_SLIDER, NULL, 0); + uiItemR(col, ptr, "color_saturation", UI_ITEM_R_SLIDER, NULL, 0); + uiItemR(col, ptr, "color_value", UI_ITEM_R_SLIDER, NULL, 0); } static void node_composit_buts_dilateerode(uiLayout *layout, bContext *C, PointerRNA *ptr) diff --git a/source/blender/editors/space_outliner/outliner.c b/source/blender/editors/space_outliner/outliner.c index 3865fd213b4..2f32c54a1a5 100644 --- a/source/blender/editors/space_outliner/outliner.c +++ b/source/blender/editors/space_outliner/outliner.c @@ -102,6 +102,8 @@ #define OL_H 19 #define OL_X 18 +#define OL_Y_OFFSET 2 + #define OL_TOG_RESTRICT_VIEWX 54 #define OL_TOG_RESTRICT_SELECTX 36 #define OL_TOG_RESTRICT_RENDERX 18 @@ -2402,7 +2404,7 @@ static int do_outliner_item_activate(bContext *C, Scene *scene, ARegion *ar, Spa return 1; } /* name and first icon */ - else if(mval[0]>te->xs && mval[0]<te->xend) { + else if(mval[0]>te->xs+OL_X && mval[0]<te->xend) { /* always makes active object */ if(tselem->type!=TSE_SEQUENCE && tselem->type!=TSE_SEQ_STRIP && tselem->type!=TSE_SEQUENCE_DUP) @@ -2498,7 +2500,7 @@ static int outliner_item_activate(bContext *C, wmOperator *op, wmEvent *event) int row; /* get row number - 100 here is just a dummy value since we don't need the column */ - UI_view2d_listview_view_to_cell(&ar->v2d, 1000, OL_H, 0.0f, 0.0f, + UI_view2d_listview_view_to_cell(&ar->v2d, 1000, OL_H, 0.0f, OL_Y_OFFSET, fmval[0], fmval[1], NULL, &row); /* select relevant row */ @@ -2599,7 +2601,7 @@ static int do_outliner_item_rename(bContext *C, ARegion *ar, SpaceOops *soops, T TreeStoreElem *tselem= TREESTORE(te); /* name and first icon */ - if(mval[0]>te->xs && mval[0]<te->xend) { + if(mval[0]>te->xs+OL_X && mval[0]<te->xend) { /* can't rename rna datablocks entries */ if(ELEM3(tselem->type, TSE_RNA_STRUCT, TSE_RNA_PROPERTY, TSE_RNA_ARRAY_ELEM)) @@ -4711,13 +4713,13 @@ static void outliner_draw_struct_marks(ARegion *ar, SpaceOops *soops, ListBase * /* selection status */ if((tselem->flag & TSE_CLOSED)==0) if(tselem->type == TSE_RNA_STRUCT) - glRecti(0, *starty+1, (int)ar->v2d.cur.xmax, *starty+OL_H-1); + glRecti(0, *starty+1, (int)ar->v2d.cur.xmax+V2D_SCROLL_WIDTH, *starty+OL_H-1); *starty-= OL_H; if((tselem->flag & TSE_CLOSED)==0) { outliner_draw_struct_marks(ar, soops, &te->subtree, starty); if(tselem->type == TSE_RNA_STRUCT) - fdrawline(0, (float)*starty+OL_H-1, ar->v2d.cur.xmax, (float)*starty+OL_H-1); + fdrawline(0, (float)*starty+OL_H, ar->v2d.cur.xmax+V2D_SCROLL_WIDTH, (float)*starty+OL_H); } } } @@ -4752,24 +4754,24 @@ static void outliner_draw_tree(bContext *C, uiBlock *block, Scene *scene, ARegio /* struct marks */ UI_ThemeColorShadeAlpha(TH_BACK, -15, -200); //UI_ThemeColorShade(TH_BACK, -20); - starty= (int)ar->v2d.tot.ymax-OL_H; + starty= (int)ar->v2d.tot.ymax-OL_H-OL_Y_OFFSET; outliner_draw_struct_marks(ar, soops, &soops->tree, &starty); } /* always draw selection fill before hierarchy */ UI_GetThemeColor3fv(TH_BACK, col); glColor3f(col[0]+0.06f, col[1]+0.08f, col[2]+0.10f); - starty= (int)ar->v2d.tot.ymax-OL_H; + starty= (int)ar->v2d.tot.ymax-OL_H-OL_Y_OFFSET; outliner_draw_selection(ar, soops, &soops->tree, &starty); // grey hierarchy lines UI_ThemeColorBlend(TH_BACK, TH_TEXT, 0.2f); - starty= (int)ar->v2d.tot.ymax-OL_H/2; + starty= (int)ar->v2d.tot.ymax-OL_H/2-OL_Y_OFFSET; startx= 6; outliner_draw_hierarchy(soops, &soops->tree, startx, &starty); // items themselves - starty= (int)ar->v2d.tot.ymax-OL_H; + starty= (int)ar->v2d.tot.ymax-OL_H-OL_Y_OFFSET; startx= 0; for(te= soops->tree.first; te; te= te->next) { outliner_draw_tree_element(C, block, scene, ar, soops, te, startx, &starty); @@ -4783,10 +4785,10 @@ static void outliner_back(ARegion *ar, SpaceOops *soops) UI_ThemeColorShade(TH_BACK, 6); ystart= (int)ar->v2d.tot.ymax; - ystart= OL_H*(ystart/(OL_H)); + ystart= OL_H*(ystart/(OL_H))-OL_Y_OFFSET; while(ystart+2*OL_H > ar->v2d.cur.ymin) { - glRecti(0, ystart, (int)ar->v2d.cur.xmax, ystart+OL_H); + glRecti(0, ystart, (int)ar->v2d.cur.xmax+V2D_SCROLL_WIDTH, ystart+OL_H); ystart-= 2*OL_H; } } @@ -4797,11 +4799,11 @@ static void outliner_draw_restrictcols(ARegion *ar, SpaceOops *soops) /* background underneath */ UI_ThemeColor(TH_BACK); - glRecti((int)ar->v2d.cur.xmax-OL_TOGW, (int)ar->v2d.cur.ymin, (int)ar->v2d.cur.xmax, (int)ar->v2d.cur.ymax); + glRecti((int)ar->v2d.cur.xmax-OL_TOGW, (int)ar->v2d.cur.ymin-V2D_SCROLL_HEIGHT-1, (int)ar->v2d.cur.xmax+V2D_SCROLL_WIDTH, (int)ar->v2d.cur.ymax); UI_ThemeColorShade(TH_BACK, 6); ystart= (int)ar->v2d.tot.ymax; - ystart= OL_H*(ystart/(OL_H)); + ystart= OL_H*(ystart/(OL_H))-OL_Y_OFFSET; while(ystart+2*OL_H > ar->v2d.cur.ymin) { glRecti((int)ar->v2d.cur.xmax-OL_TOGW, ystart, (int)ar->v2d.cur.xmax, ystart+OL_H); @@ -4814,19 +4816,19 @@ static void outliner_draw_restrictcols(ARegion *ar, SpaceOops *soops) fdrawline(ar->v2d.cur.xmax-OL_TOG_RESTRICT_VIEWX, ar->v2d.cur.ymax, ar->v2d.cur.xmax-OL_TOG_RESTRICT_VIEWX, - ar->v2d.cur.ymin); + ar->v2d.cur.ymin - V2D_SCROLL_HEIGHT); /* render */ fdrawline(ar->v2d.cur.xmax-OL_TOG_RESTRICT_SELECTX, ar->v2d.cur.ymax, ar->v2d.cur.xmax-OL_TOG_RESTRICT_SELECTX, - ar->v2d.cur.ymin); + ar->v2d.cur.ymin - V2D_SCROLL_HEIGHT); /* render */ fdrawline(ar->v2d.cur.xmax-OL_TOG_RESTRICT_RENDERX, ar->v2d.cur.ymax, ar->v2d.cur.xmax-OL_TOG_RESTRICT_RENDERX, - ar->v2d.cur.ymin); + ar->v2d.cur.ymin - V2D_SCROLL_HEIGHT); } static void restrictbutton_view_cb(bContext *C, void *poin, void *poin2) @@ -5216,18 +5218,21 @@ static void outliner_draw_rnacols(ARegion *ar, SpaceOops *soops, int sizex) { View2D *v2d= &ar->v2d; + float miny = v2d->cur.ymin-V2D_SCROLL_HEIGHT; + if(miny<v2d->tot.ymin) miny = v2d->tot.ymin; + UI_ThemeColorShadeAlpha(TH_BACK, -15, -200); /* draw column separator lines */ fdrawline((float)sizex, v2d->cur.ymax, (float)sizex, - v2d->cur.ymin); + miny); fdrawline((float)sizex+OL_RNA_COL_SIZEX, v2d->cur.ymax, (float)sizex+OL_RNA_COL_SIZEX, - v2d->cur.ymin); + miny); } static void outliner_draw_rnabuts(uiBlock *block, Scene *scene, ARegion *ar, SpaceOops *soops, int sizex, ListBase *lb) @@ -5531,7 +5536,7 @@ static void outliner_buttons(const bContext *C, uiBlock *block, ARegion *ar, Spa uiBut *bt; TreeElement *te; TreeStoreElem *tselem; - int dx, len; + int spx, dx, len; for(te= lb->first; te; te= te->next) { tselem= TREESTORE(te); @@ -5552,8 +5557,10 @@ static void outliner_buttons(const bContext *C, uiBlock *block, ARegion *ar, Spa dx= (int)UI_GetStringWidth(te->name); if(dx<100) dx= 100; + spx=te->xs+2*OL_X-4; + if(spx+dx+10>ar->v2d.cur.xmax) dx = ar->v2d.cur.xmax-spx-10; - bt= uiDefBut(block, TEX, OL_NAMEBUTTON, "", (short)te->xs+2*OL_X-4, (short)te->ys, dx+10, OL_H-1, te->name, 1.0, (float)len-1, 0, 0, ""); + bt= uiDefBut(block, TEX, OL_NAMEBUTTON, "", spx, (short)te->ys, dx+10, OL_H-1, te->name, 1.0, (float)len-1, 0, 0, ""); uiButSetRenameFunc(bt, namebutton_cb, tselem); /* returns false if button got removed */ @@ -5614,20 +5621,20 @@ void draw_outliner(const bContext *C) /* tweak to display last line (when list bigger than window) */ sizey += V2D_SCROLL_HEIGHT; + /* adds vertical offset */ + sizey += OL_Y_OFFSET; + /* update size of tot-rect (extents of data/viewable area) */ UI_view2d_totRect_set(v2d, sizex, sizey); /* set matrix for 2d-view controls */ UI_view2d_view_ortho(C, v2d); - /* draw outliner stuff (background and hierachy lines) */ + /* draw outliner stuff (background, hierachy lines and names) */ outliner_back(ar, soops); block= uiBeginBlock(C, ar, "outliner buttons", UI_EMBOSS); outliner_draw_tree((bContext *)C, block, scene, ar, soops); - /* draw icons and names */ - outliner_buttons(C, block, ar, soops, &soops->tree); - if(ELEM(soops->outlinevis, SO_DATABLOCKS, SO_USERDEF)) { /* draw rna buttons */ outliner_draw_rnacols(ar, soops, sizex_rna); @@ -5642,6 +5649,9 @@ void draw_outliner(const bContext *C) outliner_draw_restrictbuts(block, scene, ar, soops, &soops->tree); } + /* draw edit buttons if nessecery */ + outliner_buttons(C, block, ar, soops, &soops->tree); + uiEndBlock(C, block); uiDrawBlock(C, block); diff --git a/source/blender/editors/space_time/space_time.c b/source/blender/editors/space_time/space_time.c index d65422ce327..a3c20ee3341 100644 --- a/source/blender/editors/space_time/space_time.c +++ b/source/blender/editors/space_time/space_time.c @@ -509,11 +509,16 @@ static void time_main_area_listener(ARegion *ar, wmNotifier *wmn) break; case NC_SCENE: + switch (wmn->data) { + case ND_FRAME: + case ND_FRAME_RANGE: + case ND_KEYINGSET: + case ND_RENDER_OPTIONS: ED_region_tag_redraw(ar); break; - } } +} /* ************************ header time area region *********************** */ @@ -540,6 +545,7 @@ static void time_header_area_listener(ARegion *ar, wmNotifier *wmn) case NC_SCENE: switch (wmn->data) { case ND_FRAME: + case ND_FRAME_RANGE: case ND_KEYINGSET: case ND_RENDER_OPTIONS: ED_region_tag_redraw(ar); diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c index b6983a8c26f..b26b2af5166 100644 --- a/source/blender/editors/space_view3d/drawobject.c +++ b/source/blender/editors/space_view3d/drawobject.c @@ -903,7 +903,7 @@ static void drawlamp(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base, if(drawcone && !v3d->transp) { /* in this case we need to draw delayed */ - add_view3d_after(v3d, base, V3D_TRANSP, flag); + add_view3d_after(&v3d->afterdraw_transp, base, flag); return; } @@ -2968,7 +2968,20 @@ static int draw_mesh_object(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D } /* GPU_begin_object_materials checked if this is needed */ - if(do_alpha_pass) add_view3d_after(v3d, base, V3D_TRANSP, flag); + if(do_alpha_pass) { + if(ob->dtx & OB_DRAWXRAY) { + add_view3d_after(&v3d->afterdraw_xraytransp, base, flag); + } + else { + add_view3d_after(&v3d->afterdraw_transp, base, flag); + } + } + else if(ob->dtx & OB_DRAWXRAY && ob->dtx & OB_DRAWTRANSP) { + /* special case xray+transp when alpha is 1.0, without this the object vanishes */ + if(v3d->xray == 0 && v3d->transp == 0) { + add_view3d_after(&v3d->afterdraw_xray, base, flag); + } + } return retval; } @@ -3561,7 +3574,7 @@ static void draw_particle(ParticleKey *state, int draw_as, short draw, float pix add_v3_v3v3(pdd->vd, bb_center, xvec); add_v3_v3(pdd->vd, yvec); pdd->vd+=3; - sub_v3_v3v3(pdd->vd, bb_center, vec); + sub_v3_v3v3(pdd->vd, bb_center, xvec); add_v3_v3(pdd->vd, yvec); pdd->vd+=3; sub_v3_v3v3(pdd->vd, bb_center, xvec); @@ -5737,7 +5750,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag) if(!(ob->mode & OB_MODE_PARTICLE_EDIT)) { /* xray and transp are set when it is drawing the 2nd/3rd pass */ if(!v3d->xray && !v3d->transp && (ob->dtx & OB_DRAWXRAY) && !(ob->dtx & OB_DRAWTRANSP)) { - add_view3d_after(v3d, base, V3D_XRAY, flag); + add_view3d_after(&v3d->afterdraw_xray, base, flag); return; } } diff --git a/source/blender/editors/space_view3d/drawvolume.c b/source/blender/editors/space_view3d/drawvolume.c index 65786901868..f8cd34cf849 100644 --- a/source/blender/editors/space_view3d/drawvolume.c +++ b/source/blender/editors/space_view3d/drawvolume.c @@ -116,6 +116,7 @@ static void tend ( void ) { gettimeofday ( &_tend,&tz ); } + #if 0 static double tval() { double t1, t2; @@ -124,6 +125,7 @@ static double tval() return t2-t1; } #endif +#endif struct GPUTexture; diff --git a/source/blender/editors/space_view3d/space_view3d.c b/source/blender/editors/space_view3d/space_view3d.c index ac845ec7ea3..8fbe764c633 100644 --- a/source/blender/editors/space_view3d/space_view3d.c +++ b/source/blender/editors/space_view3d/space_view3d.c @@ -270,7 +270,6 @@ static void view3d_free(SpaceLink *sl) if(vd->localvd) MEM_freeN(vd->localvd); if(vd->properties_storage) MEM_freeN(vd->properties_storage); - } @@ -410,7 +409,6 @@ static int view3d_mat_drop_poll(bContext *C, wmDrag *drag, wmEvent *event) static int view3d_ima_drop_poll(bContext *C, wmDrag *drag, wmEvent *event) { - if( ED_view3d_give_base_under_cursor(C, event->mval) ) { if(drag->type==WM_DRAG_ID) { ID *id= (ID *)drag->poin; if( GS(id->name)==ID_IM ) @@ -420,6 +418,22 @@ static int view3d_ima_drop_poll(bContext *C, wmDrag *drag, wmEvent *event) if(ELEM(drag->icon, 0, ICON_FILE_IMAGE)) /* rule might not work? */ return 1; } + return 0; + } + + +static int view3d_ima_bg_drop_poll(bContext *C, wmDrag *drag, wmEvent *event) +{ + if( ED_view3d_give_base_under_cursor(C, event->mval) ) { + return 0; +} + return view3d_ima_drop_poll(C, drag, event); +} + +static int view3d_ima_ob_drop_poll(bContext *C, wmDrag *drag, wmEvent *event) +{ + if( ED_view3d_give_base_under_cursor(C, event->mval) ) { + return view3d_ima_drop_poll(C, drag, event); } return 0; } @@ -462,7 +476,8 @@ static void view3d_dropboxes(void) WM_dropbox_add(lb, "OBJECT_OT_add_named_cursor", view3d_ob_drop_poll, view3d_ob_drop_copy); WM_dropbox_add(lb, "OBJECT_OT_drop_named_material", view3d_mat_drop_poll, view3d_id_drop_copy); - WM_dropbox_add(lb, "MESH_OT_drop_named_image", view3d_ima_drop_poll, view3d_id_path_drop_copy); + WM_dropbox_add(lb, "MESH_OT_drop_named_image", view3d_ima_ob_drop_poll, view3d_id_path_drop_copy); + WM_dropbox_add(lb, "VIEW3D_OT_add_background_image", view3d_ima_bg_drop_poll, view3d_id_path_drop_copy); } @@ -514,6 +529,37 @@ static void *view3d_main_area_duplicate(void *poin) return NULL; } +static void view3d_recalc_used_layers(ARegion *ar, wmNotifier *wmn) +{ + wmWindow *win= wmn->wm->winactive; + ScrArea *sa; + + if (!win) return; + + sa= win->screen->areabase.first; + + while(sa) { + if(sa->spacetype == SPACE_VIEW3D) + if(BLI_findindex(&sa->regionbase, ar) >= 0) { + View3D *v3d= sa->spacedata.first; + Scene *scene= wmn->reference; + Base *base; + + v3d->lay_used= 0; + base= scene->base.first; + while(base) { + v3d->lay_used|= base->lay; + + base= base->next; + } + + break; + } + + sa= sa->next; + } +} + static void view3d_main_area_listener(ARegion *ar, wmNotifier *wmn) { /* context changes */ @@ -537,6 +583,10 @@ static void view3d_main_area_listener(ARegion *ar, wmNotifier *wmn) break; case NC_SCENE: switch(wmn->data) { + case ND_LAYER_CONTENT: + view3d_recalc_used_layers(ar, wmn); + ED_region_tag_redraw(ar); + break; case ND_FRAME: case ND_TRANSFORM: case ND_OB_ACTIVE: @@ -678,6 +728,7 @@ static void view3d_header_area_listener(ARegion *ar, wmNotifier *wmn) case ND_MODE: case ND_LAYER: case ND_TOOLSETTINGS: + case ND_LAYER_CONTENT: ED_region_tag_redraw(ar); break; } @@ -729,6 +780,7 @@ static void view3d_buttons_area_listener(ARegion *ar, wmNotifier *wmn) case ND_OB_SELECT: case ND_MODE: case ND_LAYER: + case ND_LAYER_CONTENT: ED_region_tag_redraw(ar); break; } diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c index d56b2c35773..0dc505e0146 100644 --- a/source/blender/editors/space_view3d/view3d_draw.c +++ b/source/blender/editors/space_view3d/view3d_draw.c @@ -865,7 +865,7 @@ static void view3d_get_viewborder_size(Scene *scene, ARegion *ar, float size_r[2 } } -void calc_viewborder(Scene *scene, ARegion *ar, RegionView3D *rv3d, View3D *v3d, rctf *viewborder_r) +void view3d_calc_camera_border(Scene *scene, ARegion *ar, RegionView3D *rv3d, View3D *v3d, rctf *viewborder_r) { float zoomfac, size[2]; float dx= 0.0f, dy= 0.0f; @@ -991,7 +991,7 @@ static void drawviewborder(Scene *scene, ARegion *ar, View3D *v3d) if(v3d->camera->type==OB_CAMERA) ca = v3d->camera->data; - calc_viewborder(scene, ar, rv3d, v3d, &viewborder); + view3d_calc_camera_border(scene, ar, rv3d, v3d, &viewborder); /* the offsets */ x1= viewborder.xmin; y1= viewborder.ymin; @@ -1328,7 +1328,7 @@ static void draw_bgpic(Scene *scene, ARegion *ar, View3D *v3d) if(rv3d->persp==RV3D_CAMOB) { rctf vb; - calc_viewborder(scene, ar, rv3d, v3d, &vb); + view3d_calc_camera_border(scene, ar, rv3d, v3d, &vb); x1= vb.xmin; y1= vb.ymin; @@ -1422,64 +1422,77 @@ static void draw_bgpic(Scene *scene, ARegion *ar, View3D *v3d) typedef struct View3DAfter { struct View3DAfter *next, *prev; struct Base *base; - int type, flag; + int flag; } View3DAfter; /* temp storage of Objects that need to be drawn as last */ -void add_view3d_after(View3D *v3d, Base *base, int type, int flag) +void add_view3d_after(ListBase *lb, Base *base, int flag) { View3DAfter *v3da= MEM_callocN(sizeof(View3DAfter), "View 3d after"); - - BLI_addtail(&v3d->afterdraw, v3da); + BLI_addtail(lb, v3da); v3da->base= base; - v3da->type= type; v3da->flag= flag; } +/* disables write in zbuffer and draws it over */ +static void view3d_draw_transp(Scene *scene, ARegion *ar, View3D *v3d) +{ + View3DAfter *v3da, *next; + + glDepthMask(0); + v3d->transp= TRUE; + + for(v3da= v3d->afterdraw_transp.first; v3da; v3da= next) { + next= v3da->next; + draw_object(scene, ar, v3d, v3da->base, v3da->flag); + BLI_remlink(&v3d->afterdraw_transp, v3da); + MEM_freeN(v3da); + } + v3d->transp= FALSE; + + glDepthMask(1); + +} + /* clears zbuffer and draws it over */ static void view3d_draw_xray(Scene *scene, ARegion *ar, View3D *v3d, int clear) { View3DAfter *v3da, *next; - int doit= 0; - for(v3da= v3d->afterdraw.first; v3da; v3da= v3da->next) - if(v3da->type==V3D_XRAY) doit= 1; + if(clear && v3d->zbuf) + glClear(GL_DEPTH_BUFFER_BIT); - if(doit) { - if(clear && v3d->zbuf) glClear(GL_DEPTH_BUFFER_BIT); v3d->xray= TRUE; - - for(v3da= v3d->afterdraw.first; v3da; v3da= next) { + for(v3da= v3d->afterdraw_xray.first; v3da; v3da= next) { next= v3da->next; - if(v3da->type==V3D_XRAY) { draw_object(scene, ar, v3d, v3da->base, v3da->flag); - BLI_remlink(&v3d->afterdraw, v3da); + BLI_remlink(&v3d->afterdraw_xray, v3da); MEM_freeN(v3da); } - } v3d->xray= FALSE; } -} -/* disables write in zbuffer and draws it over */ -static void view3d_draw_transp(Scene *scene, ARegion *ar, View3D *v3d) + +/* clears zbuffer and draws it over */ +static void view3d_draw_xraytransp(Scene *scene, ARegion *ar, View3D *v3d, int clear) { View3DAfter *v3da, *next; - glDepthMask(0); + if(clear && v3d->zbuf) + glClear(GL_DEPTH_BUFFER_BIT); + + v3d->xray= TRUE; v3d->transp= TRUE; - for(v3da= v3d->afterdraw.first; v3da; v3da= next) { + for(v3da= v3d->afterdraw_xraytransp.first; v3da; v3da= next) { next= v3da->next; - if(v3da->type==V3D_TRANSP) { draw_object(scene, ar, v3d, v3da->base, v3da->flag); - BLI_remlink(&v3d->afterdraw, v3da); + BLI_remlink(&v3d->afterdraw_xraytransp, v3da); MEM_freeN(v3da); } - } + v3d->transp= FALSE; - - glDepthMask(1); + v3d->xray= FALSE; } @@ -1675,7 +1688,7 @@ void draw_depth_gpencil(Scene *scene, ARegion *ar, View3D *v3d) v3d->zbuf= TRUE; glEnable(GL_DEPTH_TEST); - draw_gpencil_view3d_ext(scene, ar, 1); + draw_gpencil_view3d_ext(scene, v3d, ar, 1); v3d->zbuf= zbuf; @@ -1743,39 +1756,57 @@ void draw_depth(Scene *scene, ARegion *ar, View3D *v3d, int (* func)(void *)) } /* this isnt that nice, draw xray objects as if they are normal */ - if (v3d->afterdraw.first) { + if ( v3d->afterdraw_transp.first || + v3d->afterdraw_xray.first || + v3d->afterdraw_xraytransp.first + ) { View3DAfter *v3da, *next; - int num = 0; int mask_orig; + v3d->xray= TRUE; /* transp materials can change the depth mask, see #21388 */ glGetIntegerv(GL_DEPTH_WRITEMASK, &mask_orig); + + if(v3d->afterdraw_xray.first || v3d->afterdraw_xraytransp.first) { glDepthFunc(GL_ALWAYS); /* always write into the depth bufer, overwriting front z values */ - for(v3da= v3d->afterdraw.first; v3da; v3da= next) { + for(v3da= v3d->afterdraw_xray.first; v3da; v3da= next) { next= v3da->next; - if(v3da->type==V3D_XRAY) { draw_object(scene, ar, v3d, v3da->base, 0); - num++; } - /* dont remove this time */ + glDepthFunc(GL_LEQUAL); /* Now write the depth buffer normally */ } + + /* draw 3 passes, transp/xray/xraytransp */ v3d->xray= FALSE; + v3d->transp= TRUE; + for(v3da= v3d->afterdraw_transp.first; v3da; v3da= next) { + next= v3da->next; + draw_object(scene, ar, v3d, v3da->base, 0); + BLI_remlink(&v3d->afterdraw_transp, v3da); + MEM_freeN(v3da); + } - glDepthFunc(GL_LEQUAL); /* Now write the depth buffer normally */ - for(v3da= v3d->afterdraw.first; v3da; v3da= next) { + v3d->xray= TRUE; + v3d->transp= FALSE; + for(v3da= v3d->afterdraw_xray.first; v3da; v3da= next) { next= v3da->next; - if(v3da->type==V3D_XRAY) { - v3d->xray= TRUE; v3d->transp= FALSE; - } else if (v3da->type==V3D_TRANSP) { - v3d->xray= FALSE; v3d->transp= TRUE; + draw_object(scene, ar, v3d, v3da->base, 0); + BLI_remlink(&v3d->afterdraw_xray, v3da); + MEM_freeN(v3da); } - draw_object(scene, ar, v3d, v3da->base, 0); /* Draw Xray or Transp objects normally */ - BLI_remlink(&v3d->afterdraw, v3da); + v3d->xray= TRUE; + v3d->transp= TRUE; + for(v3da= v3d->afterdraw_xraytransp.first; v3da; v3da= next) { + next= v3da->next; + draw_object(scene, ar, v3d, v3da->base, 0); + BLI_remlink(&v3d->afterdraw_xraytransp, v3da); MEM_freeN(v3da); } + + v3d->xray= FALSE; v3d->transp= FALSE; @@ -1979,14 +2010,22 @@ void ED_view3d_draw_offscreen(Scene *scene, View3D *v3d, ARegion *ar, int winx, Base *base; float backcol[3]; int bwinx, bwiny; + rcti brect; glPushMatrix(); /* set temporary new size */ bwinx= ar->winx; bwiny= ar->winy; + brect= ar->winrct; + ar->winx= winx; ar->winy= winy; + ar->winrct.xmin= 0; + ar->winrct.ymin= 0; + ar->winrct.xmax= winx; + ar->winrct.ymax= winy; + /* set flags */ G.f |= G_RENDER_OGL; @@ -2045,8 +2084,9 @@ void ED_view3d_draw_offscreen(Scene *scene, View3D *v3d, ARegion *ar, int winx, } /* transp and X-ray afterdraw stuff */ - view3d_draw_transp(scene, ar, v3d); - view3d_draw_xray(scene, ar, v3d, 1); // clears zbuffer if it is used! + if(v3d->afterdraw_transp.first) view3d_draw_transp(scene, ar, v3d); + if(v3d->afterdraw_xray.first) view3d_draw_xray(scene, ar, v3d, 1); // clears zbuffer if it is used! + if(v3d->afterdraw_xraytransp.first) view3d_draw_xraytransp(scene, ar, v3d, 1); /* cleanup */ if(v3d->zbuf) { @@ -2055,12 +2095,12 @@ void ED_view3d_draw_offscreen(Scene *scene, View3D *v3d, ARegion *ar, int winx, } /* draw grease-pencil stuff */ - draw_gpencil_view3d_ext(scene, ar, 1); + draw_gpencil_view3d_ext(scene, v3d, ar, 1); ED_region_pixelspace(ar); /* draw grease-pencil stuff - needed to get paint-buffer shown too (since it's 2D) */ - draw_gpencil_view3d_ext(scene, ar, 0); + draw_gpencil_view3d_ext(scene, v3d, ar, 0); /* freeing the images again here could be done after the operator runs, leaving for now */ GPU_free_images_anim(); @@ -2068,6 +2108,7 @@ void ED_view3d_draw_offscreen(Scene *scene, View3D *v3d, ARegion *ar, int winx, /* restore size */ ar->winx= bwinx; ar->winy= bwiny; + ar->winrct = brect; glPopMatrix(); @@ -2077,7 +2118,7 @@ void ED_view3d_draw_offscreen(Scene *scene, View3D *v3d, ARegion *ar, int winx, } /* utility func for ED_view3d_draw_offscreen */ -ImBuf *ED_view3d_draw_offscreen_imbuf(Scene *scene, View3D *v3d, ARegion *ar, int sizex, int sizey) +ImBuf *ED_view3d_draw_offscreen_imbuf(Scene *scene, View3D *v3d, ARegion *ar, int sizex, int sizey, unsigned int flag) { RegionView3D *rv3d= ar->regiondata; ImBuf *ibuf; @@ -2105,7 +2146,11 @@ ImBuf *ED_view3d_draw_offscreen_imbuf(Scene *scene, View3D *v3d, ARegion *ar, in } /* read in pixels & stamp */ - ibuf= IMB_allocImBuf(sizex, sizey, 24, IB_rect, 0); + ibuf= IMB_allocImBuf(sizex, sizey, 32, flag, 0); + + if(ibuf->rect_float) + glReadPixels(0, 0, sizex, sizey, GL_RGBA, GL_FLOAT, ibuf->rect_float); + else if(ibuf->rect) glReadPixels(0, 0, sizex, sizey, GL_RGBA, GL_UNSIGNED_BYTE, ibuf->rect); //if((scene->r.stamp & R_STAMP_ALL) && (scene->r.stamp & R_STAMP_DRAW)) @@ -2115,11 +2160,14 @@ ImBuf *ED_view3d_draw_offscreen_imbuf(Scene *scene, View3D *v3d, ARegion *ar, in GPU_offscreen_unbind(ofs); GPU_offscreen_free(ofs); + if(ibuf->rect_float && ibuf->rect) + IMB_rect_from_float(ibuf); + return ibuf; } /* creates own 3d views, used by the sequencer */ -ImBuf *ED_view3d_draw_offscreen_imbuf_simple(Scene *scene, int width, int height, int drawtype) +ImBuf *ED_view3d_draw_offscreen_imbuf_simple(Scene *scene, int width, int height, unsigned int flag, int drawtype) { View3D v3d; ARegion ar; @@ -2154,7 +2202,7 @@ ImBuf *ED_view3d_draw_offscreen_imbuf_simple(Scene *scene, int width, int height mul_m4_m4m4(rv3d.persmat, rv3d.viewmat, rv3d.winmat); invert_m4_m4(rv3d.persinv, rv3d.viewinv); - return ED_view3d_draw_offscreen_imbuf(scene, &v3d, &ar, width, height); + return ED_view3d_draw_offscreen_imbuf(scene, &v3d, &ar, width, height, flag); // seq_view3d_cb(scene, cfra, render_size, seqrectx, seqrecty); } @@ -2323,13 +2371,8 @@ void view3d_main_area_draw(const bContext *C, ARegion *ar) /* Transp and X-ray afterdraw stuff for sets is done later */ } - /* extra service in layerbuttons, showing used layers */ - v3d->lay_used = 0; - /* then draw not selected and the duplis, but skip editmode object */ for(base= scene->base.first; base; base= base->next) { - v3d->lay_used |= base->lay; - if(v3d->lay & base->lay) { /* dupli drawing */ @@ -2363,8 +2406,9 @@ void view3d_main_area_draw(const bContext *C, ARegion *ar) // REEB_draw(); /* Transp and X-ray afterdraw stuff */ - view3d_draw_transp(scene, ar, v3d); - view3d_draw_xray(scene, ar, v3d, 1); // clears zbuffer if it is used! + if(v3d->afterdraw_transp.first) view3d_draw_transp(scene, ar, v3d); + if(v3d->afterdraw_xray.first) view3d_draw_xray(scene, ar, v3d, 1); // clears zbuffer if it is used! + if(v3d->afterdraw_xraytransp.first) view3d_draw_xraytransp(scene, ar, v3d, 1); ED_region_draw_cb_draw(C, ar, REGION_DRAW_POST_VIEW); diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c index 3dfa62215ed..6d09da2dbcf 100644 --- a/source/blender/editors/space_view3d/view3d_edit.c +++ b/source/blender/editors/space_view3d/view3d_edit.c @@ -42,6 +42,8 @@ #include "BLI_rand.h" #include "BKE_context.h" +#include "BKE_image.h" +#include "BKE_library.h" #include "BKE_object.h" #include "BKE_paint.h" #include "BKE_report.h" @@ -1605,7 +1607,7 @@ static int render_border_exec(bContext *C, wmOperator *op) rect.ymax= RNA_int_get(op->ptr, "ymax"); /* calculate range */ - calc_viewborder(scene, ar, rv3d, v3d, &vb); + view3d_calc_camera_border(scene, ar, rv3d, v3d, &vb); scene->r.border.xmin= ((float)rect.xmin-vb.xmin)/(vb.xmax-vb.xmin); scene->r.border.ymin= ((float)rect.ymin-vb.ymin)/(vb.ymax-vb.ymin); @@ -2200,7 +2202,7 @@ void VIEW3D_OT_view_persportho(wmOperatorType *ot) /* ******************** add background image operator **************** */ -static int add_background_image_exec(bContext *C, wmOperator *op) +static BGpic *add_background_image(bContext *C) { View3D *v3d= CTX_wm_view3d(C); @@ -2213,14 +2215,51 @@ static int add_background_image_exec(bContext *C, wmOperator *op) BLI_addtail(&v3d->bgpicbase, bgpic); - //ED_region_tag_redraw(v3d); + return bgpic; +} + +static int add_background_image_exec(bContext *C, wmOperator *op) +{ + add_background_image(C); return OPERATOR_FINISHED; } static int add_background_image_invoke(bContext *C, wmOperator *op, wmEvent *event) { - return add_background_image_exec(C, op); + Scene *scene= CTX_data_scene(C); + View3D *v3d= CTX_wm_view3d(C); + Image *ima= NULL; + BGpic *bgpic; + char name[32]; + + /* check input variables */ + if(RNA_property_is_set(op->ptr, "filepath")) { + char path[FILE_MAX]; + + RNA_string_get(op->ptr, "filepath", path); + ima= BKE_add_image_file(path, scene ? scene->r.cfra : 1); +} + else if(RNA_property_is_set(op->ptr, "name")) { + RNA_string_get(op->ptr, "name", name); + ima= (Image *)find_id("IM", name); + } + + bgpic = add_background_image(C); + + if (ima) { + bgpic->ima = ima; + + if(ima->id.us==0) id_us_plus(&ima->id); + else id_lib_extern(&ima->id); + + if (!(v3d->flag & V3D_DISPBGPICS)) + v3d->flag |= V3D_DISPBGPICS; + } + + WM_event_add_notifier(C, NC_SPACE|ND_SPACE_VIEW3D, v3d); + + return OPERATOR_FINISHED; } void VIEW3D_OT_add_background_image(wmOperatorType *ot) @@ -2237,8 +2276,13 @@ void VIEW3D_OT_add_background_image(wmOperatorType *ot) /* flags */ ot->flag = 0; + + /* properties */ + RNA_def_string(ot->srna, "name", "Image", 24, "Name", "Image name to assign."); + RNA_def_string(ot->srna, "filepath", "Path", FILE_MAX, "Filepath", "Path to image file"); } + /* ***** remove image operator ******* */ static int remove_background_image_exec(bContext *C, wmOperator *op) { @@ -2274,6 +2318,7 @@ void VIEW3D_OT_remove_background_image(wmOperatorType *ot) RNA_def_int(ot->srna, "index", 0, 0, INT_MAX, "Index", "Background image index to remove ", 0, INT_MAX); } + /* ********************* set clipping operator ****************** */ static void calc_clipping_plane(float clip[6][4], BoundBox *clipbb) diff --git a/source/blender/editors/space_view3d/view3d_intern.h b/source/blender/editors/space_view3d/view3d_intern.h index 173d8256269..7a45a43ddd4 100644 --- a/source/blender/editors/space_view3d/view3d_intern.h +++ b/source/blender/editors/space_view3d/view3d_intern.h @@ -56,6 +56,7 @@ struct bMotionPath; #define V3D_XRAY 1 #define V3D_TRANSP 2 +#define V3D_XRAYTRANSP 4 #define V3D_SELECT_MOUSE 1 @@ -125,8 +126,7 @@ void draw_depth(Scene *scene, struct ARegion *ar, View3D *v3d, int (* func)(void void draw_depth_gpencil(Scene *scene, ARegion *ar, View3D *v3d); void view3d_clr_clipping(void); void view3d_set_clipping(RegionView3D *rv3d); -void add_view3d_after(View3D *v3d, Base *base, int type, int flag); -void calc_viewborder(Scene *scene, struct ARegion *ar, struct RegionView3D *rv3d, View3D *v3d, rctf *viewborder_r); +void add_view3d_after(ListBase *lb, Base *base, int flag); void circf(float x, float y, float rad); void circ(float x, float y, float rad); diff --git a/source/blender/editors/space_view3d/view3d_view.c b/source/blender/editors/space_view3d/view3d_view.c index 04a4167175c..64289f9bd0a 100644 --- a/source/blender/editors/space_view3d/view3d_view.c +++ b/source/blender/editors/space_view3d/view3d_view.c @@ -403,6 +403,10 @@ static int view3d_setcameratoview_exec(bContext *C, wmOperator *op) View3D *v3d = CTX_wm_view3d(C); RegionView3D *rv3d= CTX_wm_region_view3d(C); + copy_qt_qt(rv3d->lviewquat, rv3d->viewquat); + rv3d->lview= rv3d->view; + rv3d->lpersp= rv3d->persp; + setcameratoview3d(v3d, rv3d, v3d->camera); rv3d->persp = RV3D_CAMOB; @@ -1805,7 +1809,7 @@ static int game_engine_exec(bContext *C, wmOperator *op) if(rv3d->persp==RV3D_CAMOB && startscene->gm.framing.type == SCE_GAMEFRAMING_BARS && startscene->gm.stereoflag != STEREO_DOME) { /* Letterbox */ rctf cam_framef; - calc_viewborder(startscene, ar, rv3d, CTX_wm_view3d(C), &cam_framef); + view3d_calc_camera_border(startscene, ar, rv3d, CTX_wm_view3d(C), &cam_framef); cam_frame.xmin = cam_framef.xmin + ar->winrct.xmin; cam_frame.xmax = cam_framef.xmax + ar->winrct.xmin; cam_frame.ymin = cam_framef.ymin + ar->winrct.ymin; diff --git a/source/blender/editors/transform/SConscript b/source/blender/editors/transform/SConscript index 9e5244f8577..173eb8ce31d 100644 --- a/source/blender/editors/transform/SConscript +++ b/source/blender/editors/transform/SConscript @@ -8,4 +8,4 @@ incs += ' ../../windowmanager #/intern/guardedalloc #/extern/glew/include' incs += ' ../../render/extern/include' incs += ' ../../gpu ../../makesrna ../../bmesh' -env.BlenderLib ( 'bf_editors_transform', sources, Split(incs), [], libtype=['core'], priority=[40] )
\ No newline at end of file +env.BlenderLib ( 'bf_editors_transform', sources, Split(incs), [], libtype=['core'], priority=[40] ) diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c index 8c08b71eacd..08ae8ff10a1 100644 --- a/source/blender/editors/transform/transform.c +++ b/source/blender/editors/transform/transform.c @@ -3524,7 +3524,7 @@ void initTilt(TransInfo *t) t->num.increment = t->snap[1]; - t->flag |= T_NO_CONSTRAINT; + t->flag |= T_NO_CONSTRAINT|T_NO_PROJECT; } @@ -4134,7 +4134,7 @@ void initBoneEnvelope(TransInfo *t) t->num.increment = t->snap[1]; - t->flag |= T_NO_CONSTRAINT; + t->flag |= T_NO_CONSTRAINT|T_NO_PROJECT; } int BoneEnvelope(TransInfo *t, short mval[2]) @@ -5229,7 +5229,7 @@ void initBoneRoll(TransInfo *t) t->num.increment = 1.0f; - t->flag |= T_NO_CONSTRAINT; + t->flag |= T_NO_CONSTRAINT|T_NO_PROJECT; } int BoneRoll(TransInfo *t, short mval[2]) diff --git a/source/blender/editors/transform/transform_ops.c b/source/blender/editors/transform/transform_ops.c index 4cecc41ae5f..b2d6fe4ea34 100644 --- a/source/blender/editors/transform/transform_ops.c +++ b/source/blender/editors/transform/transform_ops.c @@ -465,7 +465,7 @@ void TRANSFORM_OT_translate(struct wmOperatorType *ot) ot->cancel = transform_cancel; ot->poll = ED_operator_areaactive; - RNA_def_float_vector(ot->srna, "value", 3, NULL, -FLT_MAX, FLT_MAX, "Vector", "", -FLT_MAX, FLT_MAX); + RNA_def_float_vector_xyz(ot->srna, "value", 3, NULL, -FLT_MAX, FLT_MAX, "Vector", "", -FLT_MAX, FLT_MAX); Transform_Properties(ot, P_CONSTRAINT|P_PROPORTIONAL|P_MIRROR|P_ALIGN_SNAP); } @@ -851,7 +851,7 @@ void transform_keymap_for_space(wmKeyConfig *keyconf, wmKeyMap *keymap, int spac km = WM_keymap_add_item(keymap, OP_MIRROR, MKEY, KM_PRESS, KM_CTRL, 0); km = WM_keymap_add_item(keymap, "WM_OT_context_toggle", TABKEY, KM_PRESS, KM_SHIFT, 0); - RNA_string_set(km->ptr, "data_path", "tool_settings.snap"); + RNA_string_set(km->ptr, "data_path", "tool_settings.use_snap"); km = WM_keymap_add_item(keymap, "TRANSFORM_OT_snap_type", TABKEY, KM_PRESS, KM_SHIFT|KM_CTRL, 0); @@ -929,7 +929,7 @@ void transform_keymap_for_space(wmKeyConfig *keyconf, wmKeyMap *keymap, int spac km = WM_keymap_add_item(keymap, "TRANSFORM_OT_mirror", MKEY, KM_PRESS, KM_CTRL, 0); km = WM_keymap_add_item(keymap, "WM_OT_context_toggle", TABKEY, KM_PRESS, KM_SHIFT, 0); - RNA_string_set(km->ptr, "data_path", "tool_settings.snap"); + RNA_string_set(km->ptr, "data_path", "tool_settings.use_snap"); break; default: break; diff --git a/source/blender/editors/util/undo.c b/source/blender/editors/util/undo.c index 283e2b49f0d..e5128ea784a 100644 --- a/source/blender/editors/util/undo.c +++ b/source/blender/editors/util/undo.c @@ -163,6 +163,8 @@ static int ed_undo_step(bContext *C, int step, const char *undoname) BKE_undo_name(C, undoname); else BKE_undo_step(C, step); + + WM_event_add_notifier(C, NC_SCENE|ND_LAYER_CONTENT, CTX_data_scene(C)); } } |