diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-11-06 14:38:44 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-11-06 14:38:44 +0400 |
commit | e936c78251de5bafa99439803ab4fd2caa4df3b2 (patch) | |
tree | 51ccdc2efbab74903cb7b428619726832c3b1ab4 /source/blender/editors | |
parent | 735ab2b22d865570a4585e7088e66a45030ddf2d (diff) | |
parent | b18e661ffcd39b97ac0c8295d778a1cb31339ed8 (diff) |
svn merge ^/trunk/blender -r41503:41575
Diffstat (limited to 'source/blender/editors')
48 files changed, 360 insertions, 317 deletions
diff --git a/source/blender/editors/animation/anim_draw.c b/source/blender/editors/animation/anim_draw.c index 2774bd2cda4..569125e1055 100644 --- a/source/blender/editors/animation/anim_draw.c +++ b/source/blender/editors/animation/anim_draw.c @@ -237,28 +237,6 @@ void ANIM_draw_cfra (const bContext *C, View2D *v2d, short flag) glVertex2fv(vec); glEnd(); - /* Draw dark green line if slow-parenting/time-offset is enabled */ - if (flag & DRAWCFRA_SHOW_TIMEOFS) { - Object *ob= OBACT; - if(ob) { - float timeoffset= give_timeoffset(ob); - // XXX ob->ipoflag is depreceated! - if ((ob->ipoflag & OB_OFFS_OB) && (timeoffset != 0.0f)) { - vec[0]-= timeoffset; /* could avoid calling twice */ - - UI_ThemeColorShade(TH_CFRAME, -30); - - glBegin(GL_LINE_STRIP); - /*vec[1]= v2d->cur.ymax;*/ // this is set already. this line is only included - glVertex2fv(vec); - - vec[1]= v2d->cur.ymin; - glVertex2fv(vec); - glEnd(); - } - } - } - glLineWidth(1.0); /* Draw current frame number in a little box */ diff --git a/source/blender/editors/animation/anim_markers.c b/source/blender/editors/animation/anim_markers.c index 4a359acabd9..aa1af231afd 100644 --- a/source/blender/editors/animation/anim_markers.c +++ b/source/blender/editors/animation/anim_markers.c @@ -1069,6 +1069,8 @@ static int ed_marker_select(bContext *C, wmEvent *evt, int extend, int camera) WM_event_add_notifier(C, NC_SCENE|ND_OB_SELECT, scene); } +#else + (void)camera; #endif WM_event_add_notifier(C, NC_SCENE|ND_MARKERS, NULL); @@ -1493,6 +1495,8 @@ void ED_marker_keymap(wmKeyConfig *keyconf) kmi= WM_keymap_add_item(keymap, "MARKER_OT_select", SELECTMOUSE, KM_PRESS, KM_SHIFT|KM_CTRL, 0); RNA_boolean_set(kmi->ptr, "extend", 1); RNA_boolean_set(kmi->ptr, "camera", 1); +#else + (void)kmi; #endif WM_keymap_verify_item(keymap, "MARKER_OT_select_border", BKEY, KM_PRESS, 0, 0); diff --git a/source/blender/editors/animation/keyframing.c b/source/blender/editors/animation/keyframing.c index fb34245d338..9f466ef52d3 100644 --- a/source/blender/editors/animation/keyframing.c +++ b/source/blender/editors/animation/keyframing.c @@ -911,20 +911,6 @@ short insert_keyframe (ReportList *reports, ID *id, bAction *act, const char gro /* apply NLA-mapping to frame to use (if applicable) */ cfra= BKE_nla_tweakedit_remap(adt, cfra, NLATIME_CONVERT_UNMAP); } - -#if 0 - /* apply special time tweaking */ - // XXX check on this stuff... - if (GS(id->name) == ID_OB) { - //Object *ob= (Object *)id; - - /* ancient time-offset cruft */ - //if ( (ob->ipoflag & OB_OFFS_OB) && (give_timeoffset(ob)) ) { - // /* actually frametofloat calc again! */ - // cfra-= give_timeoffset(ob)*scene->r.framelen; - //} - } -#endif /* key entire array convenience method */ if (array_index == -1) { @@ -1018,20 +1004,6 @@ short delete_keyframe (ReportList *reports, ID *id, bAction *act, const char gro } } -#if 0 - /* apply special time tweaking */ - // XXX check on this stuff... - if (GS(id->name) == ID_OB) { - //Object *ob= (Object *)id; - - /* ancient time-offset cruft */ - //if ( (ob->ipoflag & OB_OFFS_OB) && (give_timeoffset(ob)) ) { - // /* actually frametofloat calc again! */ - // cfra-= give_timeoffset(ob)*scene->r.framelen; - //} - } -#endif - /* key entire array convenience method */ if (array_index == -1) { array_index= 0; diff --git a/source/blender/editors/armature/armature_intern.h b/source/blender/editors/armature/armature_intern.h index 47123b7fb4d..87254c20c0f 100644 --- a/source/blender/editors/armature/armature_intern.h +++ b/source/blender/editors/armature/armature_intern.h @@ -173,7 +173,7 @@ void poseAnim_mapping_refresh(struct bContext *C, struct Scene *scene, struct Ob void poseAnim_mapping_reset(ListBase *pfLinks); void poseAnim_mapping_autoKeyframe(struct bContext *C, struct Scene *scene, struct Object *ob, ListBase *pfLinks, float cframe); -LinkData *poseAnim_mapping_getNextFCurve(ListBase *fcuLinks, LinkData *prev, char *path); +LinkData *poseAnim_mapping_getNextFCurve(ListBase *fcuLinks, LinkData *prev, const char *path); /* ******************************************************* */ /* PoseLib */ @@ -209,13 +209,13 @@ void BIF_sk_selectStroke(struct bContext *C, const int mval[2], short extend); /* duplicate method */ void preEditBoneDuplicate(struct ListBase *editbones); -struct EditBone *duplicateEditBone(struct EditBone *curBone, char *name, struct ListBase *editbones, struct Object *ob); +struct EditBone *duplicateEditBone(struct EditBone *curBone, const char *name, struct ListBase *editbones, struct Object *ob); void updateDuplicateSubtarget(struct EditBone *dupBone, struct ListBase *editbones, struct Object *ob); /* duplicate method (cross objects */ /* editbones is the target list */ -struct EditBone *duplicateEditBoneObjects(struct EditBone *curBone, char *name, struct ListBase *editbones, struct Object *src_ob, struct Object *dst_ob); +struct EditBone *duplicateEditBoneObjects(struct EditBone *curBone, const char *name, struct ListBase *editbones, struct Object *src_ob, struct Object *dst_ob); /* editbones is the source list */ void updateDuplicateSubtargetObjects(struct EditBone *dupBone, struct ListBase *editbones, struct Object *src_ob, struct Object *dst_ob); diff --git a/source/blender/editors/armature/editarmature.c b/source/blender/editors/armature/editarmature.c index d9482ebe292..a8b3ee462ae 100644 --- a/source/blender/editors/armature/editarmature.c +++ b/source/blender/editors/armature/editarmature.c @@ -2523,7 +2523,7 @@ void updateDuplicateSubtarget(EditBone *dupBone, ListBase *editbones, Object *ob } -EditBone *duplicateEditBoneObjects(EditBone *curBone, char *name, ListBase *editbones, Object *src_ob, Object *dst_ob) +EditBone *duplicateEditBoneObjects(EditBone *curBone, const char *name, ListBase *editbones, Object *src_ob, Object *dst_ob) { EditBone *eBone = MEM_mallocN(sizeof(EditBone), "addup_editbone"); @@ -2567,7 +2567,7 @@ EditBone *duplicateEditBoneObjects(EditBone *curBone, char *name, ListBase *edit return eBone; } -EditBone *duplicateEditBone(EditBone *curBone, char *name, ListBase *editbones, Object *ob) +EditBone *duplicateEditBone(EditBone *curBone, const char *name, ListBase *editbones, Object *ob) { return duplicateEditBoneObjects(curBone, name, editbones, ob, ob); } @@ -5319,7 +5319,7 @@ static void constraint_bone_name_fix(Object *ob, ListBase *conlist, char *oldnam /* called by UI for renaming a bone */ /* warning: make sure the original bone was not renamed yet! */ /* seems messy, but thats what you get with not using pointers but channel names :) */ -void ED_armature_bone_rename(bArmature *arm, char *oldnamep, char *newnamep) +void ED_armature_bone_rename(bArmature *arm, const char *oldnamep, const char *newnamep) { Object *ob; char newname[MAXBONENAME]; diff --git a/source/blender/editors/armature/editarmature_sketch.c b/source/blender/editors/armature/editarmature_sketch.c index 31be1efdc1f..d228d4d3772 100644 --- a/source/blender/editors/armature/editarmature_sketch.c +++ b/source/blender/editors/armature/editarmature_sketch.c @@ -187,7 +187,7 @@ void BIF_makeListTemplates(const bContext *C) } } -char *BIF_listTemplates(const bContext *UNUSED(C)) +const char *BIF_listTemplates(const bContext *UNUSED(C)) { GHashIterator ghi; char menu_header[] = "Template%t|None%x0|"; diff --git a/source/blender/editors/armature/poseUtils.c b/source/blender/editors/armature/poseUtils.c index 71cdda7fe15..1a9ff73e5dc 100644 --- a/source/blender/editors/armature/poseUtils.c +++ b/source/blender/editors/armature/poseUtils.c @@ -262,7 +262,7 @@ void poseAnim_mapping_autoKeyframe (bContext *C, Scene *scene, Object *ob, ListB /* find the next F-Curve for a PoseChannel with matching path... * - path is not just the pfl rna_path, since that path doesn't have property info yet */ -LinkData *poseAnim_mapping_getNextFCurve (ListBase *fcuLinks, LinkData *prev, char *path) +LinkData *poseAnim_mapping_getNextFCurve (ListBase *fcuLinks, LinkData *prev, const char *path) { LinkData *first= (prev)? prev->next : (fcuLinks)? fcuLinks->first : NULL; LinkData *ld; diff --git a/source/blender/editors/curve/editcurve.c b/source/blender/editors/curve/editcurve.c index 4f6519bad5b..c010ce7fbf7 100644 --- a/source/blender/editors/curve/editcurve.c +++ b/source/blender/editors/curve/editcurve.c @@ -2812,12 +2812,7 @@ void CURVE_OT_select_inverse(wmOperatorType *ot) /** Divide the line segments associated with the currently selected * curve nodes (Bezier or NURB). If there are no valid segment * selections within the current selection, nothing happens. - * - * @deffunc subdividenurb subdivideNurb(void) - * @return Nothing - * @param None -*/ - + */ static void subdividenurb(Object *obedit, int number_cuts) { Curve *cu= obedit->data; diff --git a/source/blender/editors/gpencil/gpencil_edit.c b/source/blender/editors/gpencil/gpencil_edit.c index c915bc9ea37..d481be94bcc 100644 --- a/source/blender/editors/gpencil/gpencil_edit.c +++ b/source/blender/editors/gpencil/gpencil_edit.c @@ -183,7 +183,10 @@ static int gp_data_add_exec (bContext *C, wmOperator *op) return OPERATOR_CANCELLED; } else { - /* just add new datablock now */ + /* decrement user count and add new datablock */ + bGPdata *gpd= (*gpd_ptr); + + id_us_min(&gpd->id); *gpd_ptr= gpencil_data_addnew("GPencil"); } @@ -231,7 +234,7 @@ static int gp_data_unlink_exec (bContext *C, wmOperator *op) /* just unlink datablock now, decreasing its user count */ bGPdata *gpd= (*gpd_ptr); - gpd->id.us--; + id_us_min(&gpd->id); *gpd_ptr= NULL; } diff --git a/source/blender/editors/include/ED_anim_api.h b/source/blender/editors/include/ED_anim_api.h index 0ac5a9e46ce..6b449f68e1d 100644 --- a/source/blender/editors/include/ED_anim_api.h +++ b/source/blender/editors/include/ED_anim_api.h @@ -462,10 +462,8 @@ enum { DRAWCFRA_SHOW_NUMBOX = (1<<0), /* time indication in seconds or frames */ DRAWCFRA_UNIT_SECONDS = (1<<1), - /* show time-offset line */ - DRAWCFRA_SHOW_TIMEOFS = (1<<2), /* draw indicator extra wide (for timeline) */ - DRAWCFRA_WIDE = (1<<3) + DRAWCFRA_WIDE = (1<<2) } eAnimEditDraw_CurrentFrame; /* main call to draw current-frame indicator in an Animation Editor */ diff --git a/source/blender/editors/include/ED_armature.h b/source/blender/editors/include/ED_armature.h index 121c53f7c65..2e9186b6c2f 100644 --- a/source/blender/editors/include/ED_armature.h +++ b/source/blender/editors/include/ED_armature.h @@ -141,7 +141,7 @@ void create_vgroups_from_armature(struct ReportList *reports, struct Scene *scen void auto_align_armature(struct Scene *scene, struct View3D *v3d, short mode); void unique_editbone_name(struct ListBase *ebones, char *name, EditBone *bone); /* if bone is already in list, pass it as param to ignore it */ -void ED_armature_bone_rename(struct bArmature *arm, char *oldnamep, char *newnamep); +void ED_armature_bone_rename(struct bArmature *arm, const char *oldnamep, const char *newnamep); void undo_push_armature(struct bContext *C, const char *name); @@ -163,7 +163,7 @@ void BIF_deleteSketch(struct bContext *C); void BIF_selectAllSketch(struct bContext *C, int mode); /* -1: deselect, 0: select, 1: toggle */ void BIF_makeListTemplates(const struct bContext *C); -char *BIF_listTemplates(const struct bContext *C); +const char *BIF_listTemplates(const struct bContext *C); int BIF_currentTemplate(const struct bContext *C); void BIF_freeTemplates(struct bContext *C); void BIF_setTemplate(struct bContext *C, int index); diff --git a/source/blender/editors/include/ED_fluidsim.h b/source/blender/editors/include/ED_fluidsim.h index f48b5df56c0..d47ba2bfba9 100644 --- a/source/blender/editors/include/ED_fluidsim.h +++ b/source/blender/editors/include/ED_fluidsim.h @@ -48,9 +48,4 @@ void fluidsimSettingsFree(struct FluidsimSettings* sb); /* duplicate internal data */ struct FluidsimSettings* fluidsimSettingsCopy(struct FluidsimSettings* sb); -/* memory estimate */ -void fluidsimEstimateMemory(struct Object *ob, struct FluidsimSettings *fs, char *value); - #endif /* ED_FLUIDSIM_H */ - - diff --git a/source/blender/editors/include/ED_logic.h b/source/blender/editors/include/ED_logic.h index e6026eb5fee..ce1f2b8faac 100644 --- a/source/blender/editors/include/ED_logic.h +++ b/source/blender/editors/include/ED_logic.h @@ -34,6 +34,3 @@ void ED_operatortypes_logic(void); #endif /* ED_LOGIC_H */ - - - diff --git a/source/blender/editors/include/ED_particle.h b/source/blender/editors/include/ED_particle.h index 48232acf562..d1da9f308fb 100644 --- a/source/blender/editors/include/ED_particle.h +++ b/source/blender/editors/include/ED_particle.h @@ -72,7 +72,7 @@ void PE_undo(struct Scene *scene); void PE_redo(struct Scene *scene); int PE_undo_valid(struct Scene *scene); void PE_undo_number(struct Scene *scene, int nr); -char *PE_undo_get_name(struct Scene *scene, int nr, int *active); +const char *PE_undo_get_name(struct Scene *scene, int nr, int *active); #endif /* ED_PARTICLE_H */ diff --git a/source/blender/editors/include/ED_transform.h b/source/blender/editors/include/ED_transform.h index c644b1d27b4..3a6cbc556d1 100644 --- a/source/blender/editors/include/ED_transform.h +++ b/source/blender/editors/include/ED_transform.h @@ -107,10 +107,12 @@ struct Base; struct Scene; struct Object; +#if 0 /* UNUSED, deprecate? */ void BIF_setSingleAxisConstraint(float vec[3], char *text); void BIF_setDualAxisConstraint(float vec1[3], float vec2[3], char *text); void BIF_setLocalAxisConstraint(char axis, char *text); void BIF_setLocalLockConstraint(char axis, char *text); +#endif int BIF_snappingSupported(struct Object *obedit); @@ -132,7 +134,7 @@ struct EnumPropertyItem *BIF_enumTransformOrientation(struct bContext *C); const char * BIF_menustringTransformOrientation(const struct bContext *C, const char *title); /* the returned value was allocated and needs to be freed after use */ int BIF_countTransformOrientation(const struct bContext *C); -void BIF_TransformSetUndo(char *str); +void BIF_TransformSetUndo(const char *str); void BIF_selectOrientation(void); diff --git a/source/blender/editors/include/ED_view3d.h b/source/blender/editors/include/ED_view3d.h index 884992d8765..aa2ee6adc72 100644 --- a/source/blender/editors/include/ED_view3d.h +++ b/source/blender/editors/include/ED_view3d.h @@ -133,7 +133,6 @@ void ED_view3d_win_to_segment_clip(struct ARegion *ar, struct View3D *v3d, const * In orthographic view the resulting ray_normal will match the view vector. * @param ar The region (used for the window width and height). * @param v3d The 3d viewport (used for near clipping value). - * @param out The resulting normalized world-space direction vector. * @param mval The area relative 2d location (such as event->mval, converted into float[2]). * @param ray_start The world-space starting point of the segment. * @param ray_normal The normalized world-space direction of towards mval. @@ -143,7 +142,7 @@ void ED_view3d_win_to_ray(struct ARegion *ar, struct View3D *v3d, const float mv /** * Calculate a normalized 3d direction vector from the viewpoint towards a global location. * In orthographic view the resulting vector will match the view vector. - * @param ar The region (used for the window width and height). + * @param rv3d The region (used for the window width and height). * @param coord The world-space location. * @param vec The resulting normalized vector. */ @@ -174,6 +173,7 @@ void ED_view3d_from_m4(float mat[][4], float ofs[3], float quat[4], float *dist) * @param ofs The view offset to be set, normally from RegionView3D.ofs. * @param quat The view rotation to be set, quaternion normally from RegionView3D.viewquat. * @param dist The view distance from ofs to be set, normally from RegionView3D.dist. + * @param lens The view lens angle set for cameras and lamps, normally from View3D.lens. */ void ED_view3d_from_object(struct Object *ob, float ofs[3], float quat[4], float *dist, float *lens); diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h index cb18ea37ffc..7a556eddd2b 100644 --- a/source/blender/editors/include/UI_interface.h +++ b/source/blender/editors/include/UI_interface.h @@ -506,8 +506,6 @@ uiBut *uiDefHotKeyevtButS(uiBlock *block, int retval, const char *str, int x1, i uiBut *uiDefSearchBut(uiBlock *block, void *arg, int retval, int icon, int maxlen, int x1, int y1, short x2, short y2, float a1, float a2, const char *tip); -void uiBlockPickerButtons(struct uiBlock *block, float *col, float *hsv, float *old, char *hexcol, char mode, short retval); - uiBut *uiDefAutoButR(uiBlock *block, struct PointerRNA *ptr, struct PropertyRNA *prop, int index, const char *name, int icon, int x1, int y1, int x2, int y2); int uiDefAutoButsRNA(uiLayout *layout, struct PointerRNA *ptr, int (*check_prop)(struct PropertyRNA *), const char label_align); diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c index a6316dc0e9e..dd75f506be8 100644 --- a/source/blender/editors/interface/interface.c +++ b/source/blender/editors/interface/interface.c @@ -766,7 +766,7 @@ static void ui_menu_block_set_keyaccels(uiBlock *block) { uiBut *but; - unsigned int meny_key_mask= 0; + unsigned int menu_key_mask= 0; unsigned char menu_key; const char *str_pt; int pass; @@ -788,8 +788,8 @@ static void ui_menu_block_set_keyaccels(uiBlock *block) if(but->str) { for(str_pt= but->str; *str_pt; ) { menu_key= tolower(*str_pt); - if((menu_key >= 'a' && menu_key <= 'z') && !(meny_key_mask & 1<<(menu_key-'a'))) { - meny_key_mask |= 1<<(menu_key-'a'); + if((menu_key >= 'a' && menu_key <= 'z') && !(menu_key_mask & 1<<(menu_key-'a'))) { + menu_key_mask |= 1<<(menu_key-'a'); break; } @@ -816,7 +816,7 @@ static void ui_menu_block_set_keyaccels(uiBlock *block) } /* if all keys have been used just exit, unlikely */ - if(meny_key_mask == (1<<26)-1) { + if(menu_key_mask == (1<<26)-1) { return; } } @@ -2569,10 +2569,12 @@ static uiBut *ui_def_but(uiBlock *block, int type, int retval, const char *str, if(block->curlayout) ui_layout_add_but(block->curlayout, but); +#ifdef WITH_PYTHON /* if the 'UI_OT_editsource' is running, extract the source info from the button */ if (UI_editsource_enable_check()) { UI_editsource_active_but_test(but); } +#endif return but; } diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index e49cb4898d9..0ba141163b3 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -3216,6 +3216,63 @@ static int ui_numedit_but_HSVCUBE(uiBut *but, uiHandleButtonData *data, int mx, return changed; } +static void ui_ndofedit_but_HSVCUBE(uiBut *but, uiHandleButtonData *data, wmNDOFMotionData *ndof, int shift) +{ + float *hsv= ui_block_hsv_get(but->block); + float rgb[3]; + float sensitivity = (shift?0.15:0.3) * ndof->dt; + + int color_profile = but->block->color_profile; + + if (but->rnaprop) { + if (RNA_property_subtype(but->rnaprop) == PROP_COLOR_GAMMA) + color_profile = BLI_PR_NONE; + } + + ui_get_but_vectorf(but, rgb); + rgb_to_hsv_compat(rgb[0], rgb[1], rgb[2], hsv, hsv+1, hsv+2); + + switch((int)but->a1) { + case UI_GRAD_SV: + hsv[2] += ndof->ry * sensitivity; + hsv[1] += ndof->rx * sensitivity; + break; + case UI_GRAD_HV: + hsv[0] += ndof->ry * sensitivity; + hsv[2] += ndof->rx * sensitivity; + break; + case UI_GRAD_HS: + hsv[0] += ndof->ry * sensitivity; + hsv[1] += ndof->rx * sensitivity; + break; + case UI_GRAD_H: + hsv[0] += ndof->ry * sensitivity; + break; + case UI_GRAD_S: + hsv[1] += ndof->ry * sensitivity; + break; + case UI_GRAD_V: + hsv[2] += ndof->ry * sensitivity; + break; + case UI_GRAD_V_ALT: + /* vertical 'value' strip */ + + /* exception only for value strip - use the range set in but->min/max */ + hsv[2] += ndof->rx * sensitivity; + + if (color_profile) + hsv[2] = srgb_to_linearrgb(hsv[2]); + + CLAMP(hsv[2], but->softmin, but->softmax); + default: + assert(!"invalid hsv type"); + } + + hsv_to_rgb(hsv[0], hsv[1], hsv[2], rgb, rgb+1, rgb+2); + copy_v3_v3(data->vec, rgb); + ui_set_but_vectorf(but, data->vec); +} + static int ui_do_but_HSVCUBE(bContext *C, uiBlock *block, uiBut *but, uiHandleButtonData *data, wmEvent *event) { int mx, my; @@ -3238,8 +3295,18 @@ static int ui_do_but_HSVCUBE(bContext *C, uiBlock *block, uiBut *but, uiHandleBu return WM_UI_HANDLER_BREAK; } + else if (event->type == NDOF_MOTION) { + wmNDOFMotionData *ndof = (wmNDOFMotionData*) event->customdata; + + ui_ndofedit_but_HSVCUBE(but, data, ndof, event->shift); + + button_activate_state(C, but, BUTTON_STATE_EXIT); + ui_apply_button(C, but->block, but, data, 1); + + return WM_UI_HANDLER_BREAK; + } /* XXX hardcoded keymap check.... */ - else if (ELEM(event->type, ZEROKEY, PAD0) && event->val == KM_PRESS) { + else if (event->type == DELKEY && event->val == KM_PRESS) { if (but->a1==UI_GRAD_V_ALT){ int len; @@ -3337,11 +3404,62 @@ static int ui_numedit_but_HSVCIRCLE(uiBut *but, uiHandleButtonData *data, int mx return changed; } +static void ui_ndofedit_but_HSVCIRCLE(uiBut *but, uiHandleButtonData *data, wmNDOFMotionData *ndof, int shift) +{ + float *hsv= ui_block_hsv_get(but->block); + float rgb[3]; + float phi, r /*, sqr */ /* UNUSED */, v[2]; + float sensitivity = (shift ? 0.15f : 0.3f) * ndof->dt; + + ui_get_but_vectorf(but, rgb); + rgb_to_hsv_compat(rgb[0], rgb[1], rgb[2], hsv, hsv+1, hsv+2); + + /* Convert current colour on hue/sat disc to circular coordinates phi, r */ + phi = fmodf(hsv[0]+0.25f, 1.0f) * -2.0f*M_PI; + r = hsv[1]; + /* sqr= r>0.f?sqrtf(r):1; */ /* UNUSED */ + + /* Convert to 2d vectors */ + v[0] = r * cosf(phi); + v[1] = r * sinf(phi); + + /* Use ndof device y and x rotation to move the vector in 2d space */ + v[0] += ndof->ry * sensitivity; + v[1] += ndof->rx * sensitivity; + + /* convert back to polar coords on circle */ + phi = atan2(v[0], v[1])/(2.0f*(float)M_PI) + 0.5f; + + /* use ndof z rotation to additionally rotate hue */ + phi -= ndof->rz * sensitivity * 0.5f; + + r = len_v2(v); + CLAMP(r, 0.0f, 1.0f); + + /* convert back to hsv values, in range [0,1] */ + hsv[0] = fmodf(phi, 1.0f); + hsv[1] = r; + + /* exception, when using color wheel in 'locked' value state: + * allow choosing a hue for black values, by giving a tiny increment */ + if (but->flag & UI_BUT_COLOR_LOCK) { // lock + if (hsv[2] == 0.0f) hsv[2] = 0.0001f; + } + + hsv_to_rgb(hsv[0], hsv[1], hsv[2], data->vec, data->vec+1, data->vec+2); + + if((but->flag & UI_BUT_VEC_SIZE_LOCK) && (data->vec[0] || data->vec[1] || data->vec[2])) { + normalize_v3(data->vec); + mul_v3_fl(data->vec, but->a2); + } + + ui_set_but_vectorf(but, data->vec); +} + static int ui_do_but_HSVCIRCLE(bContext *C, uiBlock *block, uiBut *but, uiHandleButtonData *data, wmEvent *event) { int mx, my; - mx= event->x; my= event->y; ui_window_to_block(data->region, block, &mx, &my); @@ -3360,8 +3478,18 @@ static int ui_do_but_HSVCIRCLE(bContext *C, uiBlock *block, uiBut *but, uiHandle return WM_UI_HANDLER_BREAK; } + else if (event->type == NDOF_MOTION) { + wmNDOFMotionData *ndof = (wmNDOFMotionData*) event->customdata; + + ui_ndofedit_but_HSVCIRCLE(but, data, ndof, event->shift); + + button_activate_state(C, but, BUTTON_STATE_EXIT); + ui_apply_button(C, but->block, but, data, 1); + + return WM_UI_HANDLER_BREAK; + } /* XXX hardcoded keymap check.... */ - else if (ELEM(event->type, ZEROKEY, PAD0) && event->val == KM_PRESS) { + else if (event->type == DELKEY && event->val == KM_PRESS) { int len; /* reset only saturation */ @@ -3810,7 +3938,7 @@ static int ui_do_but_HISTOGRAM(bContext *C, uiBlock *block, uiBut *but, uiHandle return WM_UI_HANDLER_BREAK; } /* XXX hardcoded keymap check.... */ - else if (ELEM(event->type, ZEROKEY, PAD0) && event->val == KM_PRESS) { + else if (event->type == DELKEY && event->val == KM_PRESS) { Histogram *hist = (Histogram *)but->poin; hist->ymax = 1.f; @@ -3893,7 +4021,7 @@ static int ui_do_but_WAVEFORM(bContext *C, uiBlock *block, uiBut *but, uiHandleB return WM_UI_HANDLER_BREAK; } /* XXX hardcoded keymap check.... */ - else if (ELEM(event->type, ZEROKEY, PAD0) && event->val == KM_PRESS) { + else if (event->type == DELKEY && event->val == KM_PRESS) { Scopes *scopes = (Scopes *)but->poin; scopes->wavefrm_yfac = 1.f; diff --git a/source/blender/editors/interface/interface_ops.c b/source/blender/editors/interface/interface_ops.c index 27f94ae8e49..5803054caa7 100644 --- a/source/blender/editors/interface/interface_ops.c +++ b/source/blender/editors/interface/interface_ops.c @@ -43,6 +43,7 @@ #include "BLI_utildefines.h" #include "BKE_context.h" +#include "BKE_screen.h" #include "BKE_global.h" #include "BKE_text.h" /* for UI_OT_reports_to_text */ #include "BKE_report.h" @@ -476,6 +477,7 @@ static void UI_OT_reports_to_textblock(wmOperatorType *ot) ot->exec= reports_to_text_exec; } +#ifdef WITH_PYTHON /* ------------------------------------------------------------------------- */ /* EditSource Utility funcs and operator, @@ -576,24 +578,6 @@ void UI_editsource_active_but_test(uiBut *but) /* editsource operator component */ -static ScrArea *biggest_text_view(bContext *C) -{ - bScreen *sc= CTX_wm_screen(C); - ScrArea *sa, *big= NULL; - int size, maxsize= 0; - - for(sa= sc->areabase.first; sa; sa= sa->next) { - if(sa->spacetype==SPACE_TEXT) { - size= sa->winx * sa->winy; - if(size > maxsize) { - maxsize= size; - big= sa; - } - } - } - return big; -} - static int editsource_text_edit(bContext *C, wmOperator *op, char filepath[240], int line) { @@ -618,7 +602,7 @@ static int editsource_text_edit(bContext *C, wmOperator *op, else { /* naughty!, find text area to set, not good behavior * but since this is a dev tool lets allow it - campbell */ - ScrArea *sa= biggest_text_view(C); + ScrArea *sa= BKE_screen_find_big_area(CTX_wm_screen(C), SPACE_TEXT, 0); if(sa) { SpaceText *st= sa->spacedata.first; st->text= text; @@ -711,6 +695,7 @@ static void UI_OT_editsource(wmOperatorType *ot) ot->exec= editsource_exec; } +#endif /* WITH_PYTHON */ /* ********************************************************* */ /* Registration */ @@ -723,6 +708,9 @@ void UI_buttons_operatortypes(void) WM_operatortype_append(UI_OT_reset_default_button); WM_operatortype_append(UI_OT_copy_to_selected_button); WM_operatortype_append(UI_OT_reports_to_textblock); // XXX: temp? + +#ifdef WITH_PYTHON WM_operatortype_append(UI_OT_editsource); +#endif } diff --git a/source/blender/editors/object/object_add.c b/source/blender/editors/object/object_add.c index 3067059c448..b135aae30d5 100644 --- a/source/blender/editors/object/object_add.c +++ b/source/blender/editors/object/object_add.c @@ -54,6 +54,7 @@ #include "BKE_anim.h" #include "BKE_animsys.h" #include "BKE_armature.h" +#include "BKE_camera.h" #include "BKE_constraint.h" #include "BKE_context.h" #include "BKE_curve.h" @@ -62,6 +63,7 @@ #include "BKE_displist.h" #include "BKE_effect.h" #include "BKE_group.h" +#include "BKE_lamp.h" #include "BKE_lattice.h" #include "BKE_library.h" #include "BKE_key.h" diff --git a/source/blender/editors/object/object_bake.c b/source/blender/editors/object/object_bake.c index 251a86cf996..9dbbb1b8b0a 100644 --- a/source/blender/editors/object/object_bake.c +++ b/source/blender/editors/object/object_bake.c @@ -54,6 +54,7 @@ #include "BLI_math_geom.h" #include "BKE_blender.h" +#include "BKE_screen.h" #include "BKE_context.h" #include "BKE_global.h" #include "BKE_image.h" @@ -1246,24 +1247,6 @@ static int thread_break(void *UNUSED(arg)) return G.afbreek; } -static ScrArea *biggest_image_area(bScreen *screen) -{ - ScrArea *sa, *big= NULL; - int size, maxsize= 0; - - for(sa= screen->areabase.first; sa; sa= sa->next) { - if(sa->spacetype==SPACE_IMAGE) { - size= sa->winx*sa->winy; - if(sa->winx > 10 && sa->winy > 10 && size > maxsize) { - maxsize= size; - big= sa; - } - } - } - return big; -} - - typedef struct BakeRender { Render *re; Main *main; @@ -1314,7 +1297,7 @@ static void init_bake_internal(BakeRender *bkr, bContext *C) /* get editmode results */ ED_object_exit_editmode(C, 0); /* 0 = does not exit editmode */ - bkr->sa= biggest_image_area(CTX_wm_screen(C)); /* can be NULL */ + bkr->sa= BKE_screen_find_big_area(CTX_wm_screen(C), SPACE_IMAGE, 10); /* can be NULL */ bkr->main= CTX_data_main(C); bkr->scene= scene; bkr->actob= (scene->r.bake_flag & R_BAKE_TO_ACTIVE) ? OBACT : NULL; diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c index fa2076457a0..1c94ba1afbb 100644 --- a/source/blender/editors/object/object_edit.c +++ b/source/blender/editors/object/object_edit.c @@ -1183,7 +1183,7 @@ static void copy_attr(Main *bmain, Scene *scene, View3D *v3d, short event) base->object->min_vel= ob->min_vel; base->object->max_vel= ob->max_vel; if (ob->gameflag & OB_BOUNDS) { - base->object->boundtype = ob->boundtype; + base->object->collision_boundtype = ob->collision_boundtype; } base->object->margin= ob->margin; base->object->bsoft= copy_bulletsoftbody(ob->bsoft); diff --git a/source/blender/editors/object/object_relations.c b/source/blender/editors/object/object_relations.c index 84d92318a8f..ae6ec15e911 100644 --- a/source/blender/editors/object/object_relations.c +++ b/source/blender/editors/object/object_relations.c @@ -56,6 +56,7 @@ #include "BKE_action.h" #include "BKE_animsys.h" #include "BKE_armature.h" +#include "BKE_camera.h" #include "BKE_context.h" #include "BKE_constraint.h" #include "BKE_curve.h" @@ -63,6 +64,7 @@ #include "BKE_displist.h" #include "BKE_global.h" #include "BKE_fcurve.h" +#include "BKE_lamp.h" #include "BKE_lattice.h" #include "BKE_library.h" #include "BKE_main.h" @@ -651,7 +653,7 @@ static int parent_set_exec(bContext *C, wmOperator *op) data = con->data; data->tar = par; - get_constraint_target_matrix(scene, con, 0, CONSTRAINT_OBTYPE_OBJECT, NULL, cmat, scene->r.cfra - give_timeoffset(ob)); + get_constraint_target_matrix(scene, con, 0, CONSTRAINT_OBTYPE_OBJECT, NULL, cmat, scene->r.cfra); sub_v3_v3v3(vec, ob->obmat[3], cmat[3]); ob->loc[0] = vec[0]; diff --git a/source/blender/editors/object/object_transform.c b/source/blender/editors/object/object_transform.c index 0d080c7ea01..d60b7b31bf4 100644 --- a/source/blender/editors/object/object_transform.c +++ b/source/blender/editors/object/object_transform.c @@ -646,7 +646,7 @@ static int object_origin_set_exec(bContext *C, wmOperator *op) /* get the view settings if 'around' isnt set and the view is available */ View3D *v3d= CTX_wm_view3d(C); copy_v3_v3(cursor, give_cursor(scene, v3d)); - if(v3d && !RNA_property_is_set(op->ptr, "around")) + if(v3d && !RNA_property_is_set(op->ptr, "center")) around= v3d->around; } diff --git a/source/blender/editors/physics/particle_edit.c b/source/blender/editors/physics/particle_edit.c index 827360505f0..2852c57338a 100644 --- a/source/blender/editors/physics/particle_edit.c +++ b/source/blender/editors/physics/particle_edit.c @@ -4024,7 +4024,7 @@ void PE_undo_number(Scene *scene, int nr) /* get name of undo item, return null if no item with this index */ /* if active pointer, set it to 1 if true */ -char *PE_undo_get_name(Scene *scene, int nr, int *active) +const char *PE_undo_get_name(Scene *scene, int nr, int *active) { PTCacheEdit *edit= PE_get_current(scene, OBACT); PTCacheUndo *undo; diff --git a/source/blender/editors/render/render_preview.c b/source/blender/editors/render/render_preview.c index 9da160948cc..feff1e05d60 100644 --- a/source/blender/editors/render/render_preview.c +++ b/source/blender/editors/render/render_preview.c @@ -70,6 +70,7 @@ #include "BKE_idprop.h" #include "BKE_image.h" #include "BKE_icons.h" +#include "BKE_lamp.h" #include "BKE_library.h" #include "BKE_main.h" #include "BKE_material.h" diff --git a/source/blender/editors/render/render_view.c b/source/blender/editors/render/render_view.c index 47957c0bb5a..d8719c7d7cd 100644 --- a/source/blender/editors/render/render_view.c +++ b/source/blender/editors/render/render_view.c @@ -58,6 +58,7 @@ /* returns biggest area that is not uv/image editor. Note that it uses buttons */ /* window as the last possible alternative. */ +/* would use BKE_screen_find_big_area(...) but this is too specific */ static ScrArea *biggest_non_image_area(bContext *C) { bScreen *sc= CTX_wm_screen(C); @@ -85,22 +86,6 @@ static ScrArea *biggest_non_image_area(bContext *C) return big; } -static ScrArea *biggest_area(bContext *C) -{ - bScreen *sc= CTX_wm_screen(C); - ScrArea *sa, *big= NULL; - int size, maxsize= 0; - - for(sa= sc->areabase.first; sa; sa= sa->next) { - size= sa->winx*sa->winy; - if(size > maxsize) { - maxsize= size; - big= sa; - } - } - return big; -} - static ScrArea *find_area_showing_r_result(bContext *C, wmWindow **win) { wmWindowManager *wm= CTX_wm_manager(C); @@ -206,7 +191,7 @@ void render_view_open(bContext *C, int mx, int my) } else { /* use any area of decent size */ - sa= biggest_area(C); + sa= BKE_screen_find_big_area(CTX_wm_screen(C), -1, 0); if(sa->spacetype!=SPACE_IMAGE) { // XXX newspace(sa, SPACE_IMAGE); sima= sa->spacedata.first; diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c index 7e79849ba40..9d6d663df5c 100644 --- a/source/blender/editors/screen/area.c +++ b/source/blender/editors/screen/area.c @@ -84,19 +84,19 @@ static void region_draw_emboss(ARegion *ar, rcti *scirct) glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA ); /* right */ - glColor4ub(0,0,0, 50); + glColor4ub(0,0,0, 30); sdrawline(rect.xmax, rect.ymin, rect.xmax, rect.ymax); /* bottom */ - glColor4ub(0,0,0, 80); + glColor4ub(0,0,0, 30); sdrawline(rect.xmin, rect.ymin, rect.xmax, rect.ymin); /* top */ - glColor4ub(255,255,255, 60); + glColor4ub(255,255,255, 30); sdrawline(rect.xmin, rect.ymax, rect.xmax, rect.ymax); /* left */ - glColor4ub(255,255,255, 50); + glColor4ub(255,255,255, 30); sdrawline(rect.xmin, rect.ymin, rect.xmin, rect.ymax); glDisable( GL_BLEND ); @@ -414,6 +414,9 @@ void ED_region_do_draw(bContext *C, ARegion *ar) /* note; this sets state, so we can use wmOrtho and friends */ wmSubWindowScissorSet(win, ar->swinid, &ar->drawrct); + + ar->do_draw= 0; + memset(&ar->drawrct, 0, sizeof(ar->drawrct)); UI_SetTheme(sa?sa->spacetype:0, ar->type?ar->type->regionid:0); @@ -429,18 +432,15 @@ void ED_region_do_draw(bContext *C, ARegion *ar) at->draw(C, ar); } + /* XXX test: add convention to end regions always in pixel space, for drawing of borders/gestures etc */ + ED_region_pixelspace(ar); + ED_region_draw_cb_draw(C, ar, REGION_DRAW_POST_PIXEL); uiFreeInactiveBlocks(C, &ar->uiblocks); - + if(sa) region_draw_emboss(ar, &winrct); - - /* XXX test: add convention to end regions always in pixel space, for drawing of borders/gestures etc */ - ED_region_pixelspace(ar); - - ar->do_draw= 0; - memset(&ar->drawrct, 0, sizeof(ar->drawrct)); } /* ********************************** diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c index 1d2bab1862a..bf4d081508f 100644 --- a/source/blender/editors/sculpt_paint/paint_image.c +++ b/source/blender/editors/sculpt_paint/paint_image.c @@ -57,6 +57,7 @@ #include "IMB_imbuf_types.h" #include "DNA_brush_types.h" +#include "DNA_camera_types.h" #include "DNA_mesh_types.h" #include "DNA_meshdata_types.h" #include "DNA_node_types.h" @@ -64,6 +65,7 @@ #include "DNA_scene_types.h" #include "DNA_texture_types.h" +#include "BKE_camera.h" #include "BKE_context.h" #include "BKE_depsgraph.h" #include "BKE_DerivedMesh.h" @@ -3003,7 +3005,8 @@ static void project_paint_begin(ProjPaintState *ps) Object *camera= ps->scene->camera; /* dont actually use these */ - float _viewdx, _viewdy, _ycor, _lens=0.0f; + float _viewdx, _viewdy, _ycor, _lens=0.0f, _sensor_x=DEFAULT_SENSOR_WIDTH, _sensor_y= DEFAULT_SENSOR_HEIGHT; + short _sensor_fit= CAMERA_SENSOR_FIT_AUTO; rctf _viewplane; /* viewmat & viewinv */ @@ -3015,7 +3018,7 @@ static void project_paint_begin(ProjPaintState *ps) object_camera_mode(&ps->scene->r, camera); object_camera_matrix(&ps->scene->r, camera, ps->winx, ps->winy, 0, winmat, &_viewplane, &ps->clipsta, &ps->clipend, - &_lens, &_ycor, &_viewdx, &_viewdy); + &_lens, &_sensor_x, &_sensor_y, &_sensor_fit, &_ycor, &_viewdx, &_viewdy); ps->is_ortho= (ps->scene->r.mode & R_ORTHO) ? 1 : 0; } diff --git a/source/blender/editors/space_file/filelist.c b/source/blender/editors/space_file/filelist.c index e739c5fe22e..deed7ad2a3a 100644 --- a/source/blender/editors/space_file/filelist.c +++ b/source/blender/editors/space_file/filelist.c @@ -666,7 +666,7 @@ struct direntry * filelist_file(struct FileList* filelist, int index) return &filelist->filelist[fidx]; } -int filelist_find(struct FileList* filelist, char *file) +int filelist_find(struct FileList* filelist, const char *filename) { int index = -1; int i; @@ -677,7 +677,7 @@ int filelist_find(struct FileList* filelist, char *file) for (i = 0; i < filelist->numfiles; ++i) { - if ( strcmp(filelist->filelist[i].relname, file) == 0) { /* not dealing with user input so dont need BLI_path_cmp */ + if ( strcmp(filelist->filelist[i].relname, filename) == 0) { /* not dealing with user input so dont need BLI_path_cmp */ index = i; break; } diff --git a/source/blender/editors/space_file/filelist.h b/source/blender/editors/space_file/filelist.h index a7f2a0d1af9..cd4c22df418 100644 --- a/source/blender/editors/space_file/filelist.h +++ b/source/blender/editors/space_file/filelist.h @@ -66,7 +66,7 @@ typedef enum FileCheckType struct FileList * filelist_new(short type); void filelist_init_icons(void); void filelist_free_icons(void); -int filelist_find(struct FileList* filelist, char *file); +int filelist_find(struct FileList* filelist, const char *file); void filelist_free(struct FileList* filelist); void filelist_sort(struct FileList* filelist, short sort); int filelist_numfiles(struct FileList* filelist); diff --git a/source/blender/editors/space_graph/graph_draw.c b/source/blender/editors/space_graph/graph_draw.c index 37e6c0b73c9..7091fe094c6 100644 --- a/source/blender/editors/space_graph/graph_draw.c +++ b/source/blender/editors/space_graph/graph_draw.c @@ -78,11 +78,11 @@ * - intV: integer value containing color info packed into an int * - alpha: float value describing the */ -#define cpackA(intVC, alpha) \ - { \ - float _cpackCol[3]; \ - cpack_to_rgb(intVC, &_cpackCol[0], &_cpackCol[1], &_cpackCol[2]); \ - glColor4f(_cpackCol[0], _cpackCol[1], _cpackCol[2], alpha); \ +#define cpackA(intVC, alpha) \ + { \ + float _cpackCol[3]; \ + cpack_to_rgb(intVC, &_cpackCol[0], &_cpackCol[1], &_cpackCol[2]); \ + glColor4f(_cpackCol[0], _cpackCol[1], _cpackCol[2], alpha); \ } /* *************************** */ diff --git a/source/blender/editors/space_image/image_draw.c b/source/blender/editors/space_image/image_draw.c index 505452f504c..77ac577792c 100644 --- a/source/blender/editors/space_image/image_draw.c +++ b/source/blender/editors/space_image/image_draw.c @@ -127,7 +127,7 @@ static void draw_render_info(Scene *scene, Image *ima, ARegion *ar) BKE_image_release_renderresult(scene, ima); } -void draw_image_info(ARegion *ar, int color_manage, int channels, int x, int y, char *cp, float *fp, int *zp, float *zpf) +void draw_image_info(ARegion *ar, int color_manage, int channels, int x, int y, const char cp[4], const float fp[4], int *zp, float *zpf) { char str[256]; float dx= 6; diff --git a/source/blender/editors/space_image/image_intern.h b/source/blender/editors/space_image/image_intern.h index 4310b5dbae8..04156c80c0e 100644 --- a/source/blender/editors/space_image/image_intern.h +++ b/source/blender/editors/space_image/image_intern.h @@ -55,7 +55,7 @@ void IMAGE_OT_toolbox(struct wmOperatorType *ot); /* image_draw.c */ void draw_image_main(struct SpaceImage *sima, struct ARegion *ar, struct Scene *scene); -void draw_image_info(struct ARegion *ar, int color_manage, int channels, int x, int y, char *cp, float *fp, int *zp, float *zpf); +void draw_image_info(struct ARegion *ar, int color_manage, int channels, int x, int y, const char cp[4], const float fp[4], int *zp, float *zpf); void draw_image_grease_pencil(struct bContext *C, short onlyv2d); /* image_ops.c */ diff --git a/source/blender/editors/space_node/drawnode.c b/source/blender/editors/space_node/drawnode.c index 7a9cf644b55..24ea51567ad 100644 --- a/source/blender/editors/space_node/drawnode.c +++ b/source/blender/editors/space_node/drawnode.c @@ -842,6 +842,11 @@ static void node_draw_group(const bContext *C, ARegion *ar, SpaceNode *snode, bN } } +void node_uifunc_group(uiLayout *layout, bContext *C, PointerRNA *ptr) +{ + uiTemplateIDBrowse(layout, C, ptr, "node_tree", NULL, NULL, NULL); +} + static void node_common_buts_whileloop(uiLayout *layout, bContext *UNUSED(C), PointerRNA *ptr) { uiItemR(layout, ptr, "max_iterations", 0, NULL, 0); @@ -867,7 +872,7 @@ static void node_common_set_butfunc(bNodeType *ntype) { switch(ntype->type) { case NODE_GROUP: -// ntype->uifunc= node_common_buts_group; + ntype->uifunc= node_uifunc_group; ntype->drawfunc= node_draw_group; ntype->drawupdatefunc= node_update_group; break; @@ -2119,7 +2124,7 @@ void draw_nodespace_back_pix(ARegion *ar, SpaceNode *snode, int color_manage) } } -void draw_nodespace_color_info(ARegion *ar, int color_manage, int channels, int x, int y, char *cp, float *fp) +void draw_nodespace_color_info(ARegion *ar, int color_manage, int channels, int x, int y, const char cp[4], const float fp[4]) { char str[256]; float dx= 6; diff --git a/source/blender/editors/space_node/node_intern.h b/source/blender/editors/space_node/node_intern.h index 655d54ac8a7..88b81d0855c 100644 --- a/source/blender/editors/space_node/node_intern.h +++ b/source/blender/editors/space_node/node_intern.h @@ -99,7 +99,7 @@ void node_draw_link_bezier(View2D *v2d, SpaceNode *snode, bNodeLink *link, int t int node_link_bezier_points(View2D *v2d, SpaceNode *snode, bNodeLink *link, float coord_array[][2], int resol); void node_draw_link_straight(View2D *v2d, SpaceNode *snode, bNodeLink *link, int th_col1, int do_shaded, int th_col2, int do_triple, int th_col3 ); void draw_nodespace_back_pix(ARegion *ar, SpaceNode *snode, int color_manage); -void draw_nodespace_color_info(struct ARegion *ar, int color_manage, int channels, int x, int y, char *cp, float *fp); +void draw_nodespace_color_info(struct ARegion *ar, int color_manage, int channels, int x, int y, const char cp[4], const float fp[4]); /* node_edit.c */ void node_tree_from_ID(ID *id, bNodeTree **ntree, bNodeTree **edittree, int *treetype); diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c index cd8739559a1..920494dcec2 100644 --- a/source/blender/editors/space_view3d/drawobject.c +++ b/source/blender/editors/space_view3d/drawobject.c @@ -56,6 +56,7 @@ #include "BLI_utildefines.h" #include "BKE_anim.h" //for the where_on_path function +#include "BKE_camera.h" #include "BKE_constraint.h" // for the get_constraint_target function #include "BKE_curve.h" #include "BKE_DerivedMesh.h" @@ -74,6 +75,7 @@ #include "BKE_paint.h" #include "BKE_particle.h" #include "BKE_pointcache.h" +#include "BKE_scene.h" #include "BKE_unit.h" #include "BKE_tessmesh.h" @@ -106,11 +108,11 @@ /* this condition has been made more complex since editmode can draw textures */ -#define CHECK_OB_DRAWTEXTURE(vd, dt) \ - ((vd->drawtype==OB_TEXTURE && dt>OB_SOLID) || \ +#define CHECK_OB_DRAWTEXTURE(vd, dt) \ + ((vd->drawtype==OB_TEXTURE && dt>OB_SOLID) || \ (vd->drawtype==OB_SOLID && vd->flag2 & V3D_SOLID_TEX)) -static void draw_bounding_volume(Scene *scene, Object *ob); +static void draw_bounding_volume(Scene *scene, Object *ob, char type); static void drawcube_size(float size); static void drawcircle_size(float size); @@ -2786,7 +2788,7 @@ static void draw_mesh_fancy(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D if(dt==OB_BOUNDBOX) { if((v3d->flag2 & V3D_RENDER_OVERRIDE && v3d->drawtype >= OB_WIRE)==0) - draw_bounding_volume(scene, ob); + draw_bounding_volume(scene, ob, ob->boundtype); } else if(hasHaloMat || (totface==0 && totedge==0)) { glPointSize(1.5); @@ -3754,7 +3756,7 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv totpart=psys->totpart; - cfra= bsystem_time(scene, NULL, (float)CFRA, 0.0f); + cfra= BKE_curframe(scene); if(draw_as==PART_DRAW_PATH && psys->pathcache==NULL && psys->childcache==NULL) draw_as=PART_DRAW_DOT; @@ -5552,7 +5554,7 @@ static void get_local_bounds(Object *ob, float center[3], float size[3]) } #endif -static void draw_bb_quadric(BoundBox *bb, short type) +static void draw_bb_quadric(BoundBox *bb, char type) { float size[3], cent[3]; GLUquadricObj *qobj = gluNewQuadric(); @@ -5591,7 +5593,7 @@ static void draw_bb_quadric(BoundBox *bb, short type) gluDeleteQuadric(qobj); } -static void draw_bounding_volume(Scene *scene, Object *ob) +static void draw_bounding_volume(Scene *scene, Object *ob, char type) { BoundBox *bb= NULL; @@ -5617,8 +5619,8 @@ static void draw_bounding_volume(Scene *scene, Object *ob) if(bb==NULL) return; - if(ob->boundtype==OB_BOUND_BOX) draw_box(bb->vec); - else draw_bb_quadric(bb, ob->boundtype); + if(type==OB_BOUND_BOX) draw_box(bb->vec); + else draw_bb_quadric(bb, type); } @@ -5830,7 +5832,6 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag) Object *ob; Curve *cu; RegionView3D *rv3d= ar->regiondata; - //float cfraont; float vec1[3], vec2[3]; unsigned int col=0; int /*sel, drawtype,*/ colindex= 0; @@ -5869,83 +5870,6 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag) /* no return after this point, otherwise leaks */ view3d_cached_text_draw_begin(); - - /* draw keys? */ -#if 0 // XXX old animation system - if(base==(scene->basact) || (base->flag & (SELECT+BA_WAS_SEL))) { - if(flag==0 && warning_recursive==0 && ob!=scene->obedit) { - if(ob->ipo && ob->ipo->showkey && (ob->ipoflag & OB_DRAWKEY)) { - ListBase elems; - CfraElem *ce; - float temp[7][3]; - - warning_recursive= 1; - - elems.first= elems.last= 0; - // warning: no longer checks for certain ob-keys only... (so does this need to use the proper ipokeys then?) - make_cfra_list(ob->ipo, &elems); - - cfraont= (scene->r.cfra); - drawtype= v3d->drawtype; - if(drawtype>OB_WIRE) v3d->drawtype= OB_WIRE; - sel= base->flag; - memcpy(temp, &ob->loc, 7*3*sizeof(float)); - - ipoflag= ob->ipoflag; - ob->ipoflag &= ~OB_OFFS_OB; - - set_no_parent_ipo(1); - disable_speed_curve(1); - - if ((ob->ipoflag & OB_DRAWKEYSEL)==0) { - ce= elems.first; - while(ce) { - if(!ce->sel) { - (scene->r.cfra)= ce->cfra/scene->r.framelen; - - base->flag= 0; - - where_is_object_time(scene, ob, (scene->r.cfra)); - draw_object(scene, ar, v3d, base, 0); - } - ce= ce->next; - } - } - - ce= elems.first; - while(ce) { - if(ce->sel) { - (scene->r.cfra)= ce->cfra/scene->r.framelen; - - base->flag= SELECT; - - where_is_object_time(scene, ob, (scene->r.cfra)); - draw_object(scene, ar, v3d, base, 0); - } - ce= ce->next; - } - - set_no_parent_ipo(0); - disable_speed_curve(0); - - base->flag= sel; - ob->ipoflag= ipoflag; - - /* restore icu->curval */ - (scene->r.cfra)= cfraont; - - memcpy(&ob->loc, temp, 7*3*sizeof(float)); - where_is_object(scene, ob); - v3d->drawtype= drawtype; - - BLI_freelistN(&elems); - - warning_recursive= 0; - } - } - } -#endif // XXX old animation system - /* patch? children objects with a timeoffs change the parents. How to solve! */ /* if( ((int)ob->ctime) != F_(scene->r.cfra)) where_is_object(scene, ob); */ @@ -6003,7 +5927,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag) if(base->flag & (SELECT+BA_WAS_SEL)) { /* uses darker active color for non-active + selected*/ theme_id= TH_GROUP_ACTIVE; - + if(scene->basact != base) { theme_shade= -16; } @@ -6184,7 +6108,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag) } else if(dt==OB_BOUNDBOX) { if((v3d->flag2 & V3D_RENDER_OVERRIDE && v3d->drawtype >= OB_WIRE)==0) - draw_bounding_volume(scene, ob); + draw_bounding_volume(scene, ob, ob->boundtype); } else if(ED_view3d_boundbox_clip(rv3d, ob->obmat, ob->bb ? ob->bb : cu->bb)) empty_object= drawDispList(scene, v3d, rv3d, base, dt); @@ -6200,7 +6124,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag) } else if(dt==OB_BOUNDBOX) { if((v3d->flag2 & V3D_RENDER_OVERRIDE && v3d->drawtype >= OB_WIRE)==0) - draw_bounding_volume(scene, ob); + draw_bounding_volume(scene, ob, ob->boundtype); } else if(ED_view3d_boundbox_clip(rv3d, ob->obmat, ob->bb ? ob->bb : cu->bb)) { empty_object= drawDispList(scene, v3d, rv3d, base, dt); @@ -6217,7 +6141,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag) drawmball(scene, v3d, rv3d, base, dt); else if(dt==OB_BOUNDBOX) { if((v3d->flag2 & V3D_RENDER_OVERRIDE && v3d->drawtype >= OB_WIRE)==0) - draw_bounding_volume(scene, ob); + draw_bounding_volume(scene, ob, ob->boundtype); } else empty_object= drawmball(scene, v3d, rv3d, base, dt); @@ -6459,6 +6383,14 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag) } } + if(ob->gameflag & OB_BOUNDS) { + if(ob->boundtype!=ob->collision_boundtype || (dtx & OB_BOUNDBOX)==0) { + setlinestyle(2); + draw_bounding_volume(scene, ob, ob->collision_boundtype); + setlinestyle(0); + } + } + /* draw extra: after normal draw because of makeDispList */ if(dtx && (G.f & G_RENDER_OGL)==0) { @@ -6466,8 +6398,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag) drawaxes(1.0f, OB_ARROWS); } if(dtx & OB_BOUNDBOX) { - if((v3d->flag2 & V3D_RENDER_OVERRIDE)==0) - draw_bounding_volume(scene, ob); + draw_bounding_volume(scene, ob, ob->boundtype); } if(dtx & OB_TEXSPACE) drawtexspace(ob); if(dtx & OB_DRAWNAME) { @@ -6585,7 +6516,7 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag) for (ct= targets.first; ct; ct= ct->next) { /* calculate target's matrix */ if (cti->get_target_matrix) - cti->get_target_matrix(curcon, cob, ct, bsystem_time(scene, ob, (float)(scene->r.cfra), give_timeoffset(ob))); + cti->get_target_matrix(curcon, cob, ct, BKE_curframe(scene)); else unit_m4(ct->matrix); diff --git a/source/blender/editors/space_view3d/space_view3d.c b/source/blender/editors/space_view3d/space_view3d.c index 04acc7e9b4d..faf4e9412be 100644 --- a/source/blender/editors/space_view3d/space_view3d.c +++ b/source/blender/editors/space_view3d/space_view3d.c @@ -875,6 +875,7 @@ static void view3d_buttons_area_listener(ARegion *ar, wmNotifier *wmn) case ND_MODE: case ND_LAYER: case ND_LAYER_CONTENT: + case ND_TOOLSETTINGS: 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 96031a7b3d3..309578699f7 100644 --- a/source/blender/editors/space_view3d/view3d_draw.c +++ b/source/blender/editors/space_view3d/view3d_draw.c @@ -51,6 +51,7 @@ #include "BLI_utildefines.h" #include "BKE_anim.h" +#include "BKE_camera.h" #include "BKE_context.h" #include "BKE_customdata.h" #include "BKE_image.h" @@ -921,17 +922,34 @@ static void draw_selected_name(Scene *scene, Object *ob) BLF_draw_default(offset, 10, 0.0f, info, sizeof(info)-1); } -void view3d_viewborder_size_get(Scene *scene, ARegion *ar, float size_r[2]) +void view3d_viewborder_size_get(Scene *scene, Object *camob, ARegion *ar, float size_r[2]) { - float winmax= MAX2(ar->winx, ar->winy); float aspect= (scene->r.xsch*scene->r.xasp) / (scene->r.ysch*scene->r.yasp); - - if(aspect > 1.0f) { - size_r[0]= winmax; - size_r[1]= winmax/aspect; - } else { - size_r[0]= winmax*aspect; - size_r[1]= winmax; + short sensor_fit= CAMERA_SENSOR_FIT_AUTO; + + if(camob && camob->type==OB_CAMERA) { + Camera *cam= (Camera *)camob->data; + sensor_fit= cam->sensor_fit; + } + + if(sensor_fit==CAMERA_SENSOR_FIT_AUTO) { + float winmax= MAX2(ar->winx, ar->winy); + + if(aspect > 1.0f) { + size_r[0]= winmax; + size_r[1]= winmax/aspect; + } else { + size_r[0]= winmax*aspect; + size_r[1]= winmax; + } + } + else if(sensor_fit==CAMERA_SENSOR_FIT_HOR) { + size_r[0]= ar->winx; + size_r[1]= ar->winx/aspect; + } + else { + size_r[0]= ar->winy*aspect; + size_r[1]= ar->winy; } } @@ -941,7 +959,7 @@ void ED_view3d_calc_camera_border(Scene *scene, ARegion *ar, View3D *v3d, Region float size[2]; float dx= 0.0f, dy= 0.0f; - view3d_viewborder_size_get(scene, ar, size); + view3d_viewborder_size_get(scene, v3d->camera, ar, size); size[0]= size[0]*zoomfac; size[1]= size[1]*zoomfac; @@ -1208,6 +1226,21 @@ static void drawviewborder(Scene *scene, ARegion *ar, View3D *v3d) uiSetRoundBox(UI_CNR_ALL); uiDrawBox(GL_LINE_LOOP, x1, y1, x2, y2, 12.0); } + if (ca && (ca->flag & CAM_SHOWSENSOR)) { + /* assume fixed sensor width for now */ + + /* float sensor_aspect = ca->sensor_x / ca->sensor_y; */ /* UNUSED */ + float sensor_scale = (x2i-x1i) / ca->sensor_x; + float sensor_height = sensor_scale * ca->sensor_y; + + float ymid = y1i + (y2i-y1i)/2.f; + float sy1= ymid - sensor_height/2.f; + float sy2= ymid + sensor_height/2.f; + + UI_ThemeColorShade(TH_WIRE, 100); + + uiDrawBox(GL_LINE_LOOP, x1i, sy1, x2i, sy2, 2.0f); + } } setlinestyle(0); @@ -2396,10 +2429,12 @@ ImBuf *ED_view3d_draw_offscreen_imbuf(Scene *scene, View3D *v3d, ARegion *ar, in /* render 3d view */ if(rv3d->persp==RV3D_CAMOB && v3d->camera) { float winmat[4][4]; - float _clipsta, _clipend, _lens, _yco, _dx, _dy; + float _clipsta, _clipend, _lens, _yco, _dx, _dy, _sensor_x= DEFAULT_SENSOR_WIDTH, _sensor_y= DEFAULT_SENSOR_HEIGHT; + short _sensor_fit= CAMERA_SENSOR_FIT_AUTO; rctf _viewplane; - object_camera_matrix(&scene->r, v3d->camera, sizex, sizey, 0, winmat, &_viewplane, &_clipsta, &_clipend, &_lens, &_yco, &_dx, &_dy); + object_camera_matrix(&scene->r, v3d->camera, sizex, sizey, 0, winmat, &_viewplane, &_clipsta, &_clipend, &_lens, + &_sensor_x, &_sensor_y, &_sensor_fit, &_yco, &_dx, &_dy); ED_view3d_draw_offscreen(scene, v3d, ar, sizex, sizey, NULL, winmat); } @@ -2454,9 +2489,10 @@ ImBuf *ED_view3d_draw_offscreen_imbuf_simple(Scene *scene, Object *camera, int w invert_m4_m4(rv3d.viewmat, rv3d.viewinv); { - float _yco, _dx, _dy; + float _yco, _dx, _dy, _sensor_x= DEFAULT_SENSOR_WIDTH, _sensor_y= DEFAULT_SENSOR_HEIGHT; + short _sensor_fit= CAMERA_SENSOR_FIT_AUTO; rctf _viewplane; - object_camera_matrix(&scene->r, v3d.camera, width, height, 0, rv3d.winmat, &_viewplane, &v3d.near, &v3d.far, &v3d.lens, &_yco, &_dx, &_dy); + object_camera_matrix(&scene->r, v3d.camera, width, height, 0, rv3d.winmat, &_viewplane, &v3d.near, &v3d.far, &v3d.lens, &_sensor_x, &_sensor_y, &_sensor_fit, &_yco, &_dx, &_dy); } mul_m4_m4m4(rv3d.persmat, rv3d.viewmat, rv3d.winmat); diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c index ea8db17daf0..e7fbdaf1deb 100644 --- a/source/blender/editors/space_view3d/view3d_edit.c +++ b/source/blender/editors/space_view3d/view3d_edit.c @@ -2255,13 +2255,14 @@ static int view3d_center_camera_exec(bContext *C, wmOperator *UNUSED(op)) /* was { ARegion *ar= CTX_wm_region(C); RegionView3D *rv3d= CTX_wm_region_view3d(C); + View3D *v3d= CTX_wm_view3d(C); Scene *scene= CTX_data_scene(C); float xfac, yfac; float size[2]; rv3d->camdx= rv3d->camdy= 0.0f; - view3d_viewborder_size_get(scene, ar, size); + view3d_viewborder_size_get(scene, v3d->camera, ar, size); /* 4px is just a little room from the edge of the area */ xfac= (float)ar->winx / (float)(size[0] + 4); @@ -2523,13 +2524,13 @@ void VIEW3D_OT_zoom_border(wmOperatorType *ot) } /* sets the view to 1:1 camera/render-pixel */ -static void view3d_set_1_to_1_viewborder(Scene *scene, ARegion *ar) +static void view3d_set_1_to_1_viewborder(Scene *scene, ARegion *ar, View3D *v3d) { RegionView3D *rv3d= ar->regiondata; float size[2]; int im_width= (scene->r.size*scene->r.xsch)/100; - view3d_viewborder_size_get(scene, ar, size); + view3d_viewborder_size_get(scene, v3d->camera, ar, size); rv3d->camzoom= BKE_screen_view3d_zoom_from_fac((float)im_width/size[0]); CLAMP(rv3d->camzoom, RV3D_CAMZOOM_MIN, RV3D_CAMZOOM_MAX); @@ -2540,7 +2541,7 @@ static int view3d_zoom_1_to_1_camera_exec(bContext *C, wmOperator *UNUSED(op)) Scene *scene= CTX_data_scene(C); ARegion *ar= CTX_wm_region(C); - view3d_set_1_to_1_viewborder(scene, ar); + view3d_set_1_to_1_viewborder(scene, ar, CTX_wm_view3d(C)); WM_event_add_notifier(C, NC_SPACE|ND_SPACE_VIEW3D, CTX_wm_view3d(C)); diff --git a/source/blender/editors/space_view3d/view3d_header.c b/source/blender/editors/space_view3d/view3d_header.c index b30030a6b9d..a2c8f971aec 100644 --- a/source/blender/editors/space_view3d/view3d_header.c +++ b/source/blender/editors/space_view3d/view3d_header.c @@ -84,9 +84,6 @@ * This can be cleaned when I make some new 'mode' icons. */ -#define TEST_EDITMESH if(obedit==0) return; \ - if( (v3d->lay & obedit->lay)==0 ) return; - /* view3d handler codes */ #define VIEW3D_HANDLER_BACKGROUND 1 #define VIEW3D_HANDLER_PROPERTIES 2 @@ -555,12 +552,9 @@ void uiTemplateHeader3D(uiLayout *layout, struct bContext *C) if(obedit==NULL && v3d->localvd==NULL) { unsigned int ob_lay = ob ? ob->lay : 0; - + /* Layers */ - if (v3d->scenelock) - uiTemplateLayers(layout, &sceneptr, "layers", &v3dptr, "layers_used", ob_lay); - else - uiTemplateLayers(layout, &v3dptr, "layers", &v3dptr, "layers_used", ob_lay); + uiTemplateLayers(layout, v3d->scenelock ? &sceneptr : &v3dptr, "layers", &v3dptr, "layers_used", ob_lay); /* Scene lock */ uiItemR(layout, &v3dptr, "lock_camera_and_layers", UI_ITEM_R_ICON_ONLY, "", ICON_NONE); diff --git a/source/blender/editors/space_view3d/view3d_intern.h b/source/blender/editors/space_view3d/view3d_intern.h index b087c7ac873..b07d2d1ca73 100644 --- a/source/blender/editors/space_view3d/view3d_intern.h +++ b/source/blender/editors/space_view3d/view3d_intern.h @@ -135,7 +135,7 @@ 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(ListBase *lb, Base *base, int flag); -void view3d_viewborder_size_get(struct Scene *scene, struct ARegion *ar, float size_r[2]); +void view3d_viewborder_size_get(struct Scene *scene, struct Object *camob, struct ARegion *ar, float size_r[2]); 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 2ede76e925e..a5251c18160 100644 --- a/source/blender/editors/space_view3d/view3d_view.c +++ b/source/blender/editors/space_view3d/view3d_view.c @@ -964,10 +964,14 @@ int ED_view3d_clip_range_get(View3D *v3d, RegionView3D *rv3d, float *clipsta, fl int ED_view3d_viewplane_get(View3D *v3d, RegionView3D *rv3d, int winxi, int winyi, rctf *viewplane, float *clipsta, float *clipend, float *pixsize) { Camera *cam=NULL; - float lens, fac, x1, y1, x2, y2; + float lens, sensor_x =DEFAULT_SENSOR_WIDTH, sensor_y= DEFAULT_SENSOR_HEIGHT, fac, x1, y1, x2, y2; float winx= (float)winxi, winy= (float)winyi; int orth= 0; - + short sensor_fit= CAMERA_SENSOR_FIT_AUTO; + + /* currnetly using sensor size (depends on fov calculating method) */ + float sensor= DEFAULT_SENSOR_WIDTH; + lens= v3d->lens; *clipsta= v3d->near; @@ -990,8 +994,13 @@ int ED_view3d_viewplane_get(View3D *v3d, RegionView3D *rv3d, int winxi, int winy else if(v3d->camera->type==OB_CAMERA) { cam= v3d->camera->data; lens= cam->lens; + sensor_x= cam->sensor_x; + sensor_y= cam->sensor_y; *clipsta= cam->clipsta; *clipend= cam->clipend; + sensor_fit= cam->sensor_fit; + + sensor= (cam->sensor_fit==CAMERA_SENSOR_FIT_VERT) ? (cam->sensor_y) : (cam->sensor_x); } } } @@ -1022,21 +1031,44 @@ int ED_view3d_viewplane_get(View3D *v3d, RegionView3D *rv3d, int winxi, int winy if(cam && cam->type==CAM_ORTHO) { /* ortho_scale == 1 means exact 1 to 1 mapping */ float dfac= 2.0f*cam->ortho_scale/fac; - - if(winx>winy) x1= -dfac; - else x1= -winx*dfac/winy; + + if(sensor_fit==CAMERA_SENSOR_FIT_AUTO) { + if(winx>winy) { + x1= -dfac; + y1= -winy*dfac/winx; + } + else { + x1= -winx*dfac/winy; + y1= -dfac; + } + } + else if(sensor_fit==CAMERA_SENSOR_FIT_HOR) { + x1= -dfac; + y1= -winy*dfac/winx; + } + else { + x1= -winx*dfac/winy; + y1= -dfac; + } + x2= -x1; - - if(winx>winy) y1= -winy*dfac/winx; - else y1= -dfac; y2= -y1; + orth= 1; } else { float dfac; - if(winx>winy) dfac= 64.0f/(fac*winx*lens); - else dfac= 64.0f/(fac*winy*lens); + if(sensor_fit==CAMERA_SENSOR_FIT_AUTO) { + if(winx>winy) dfac= (sensor_x * 2.0) / (fac*winx*lens); + else dfac= (sensor_x * 2.0) / (fac*winy*lens); + } + else if(sensor_fit==CAMERA_SENSOR_FIT_HOR) { + dfac= (sensor_x * 2.0) / (fac*winx*lens); + } + else { + dfac= (sensor_y * 2.0) / (fac*winy*lens); + } x1= - *clipsta * winx*dfac; x2= -x1; @@ -1055,8 +1087,8 @@ int ED_view3d_viewplane_get(View3D *v3d, RegionView3D *rv3d, int winxi, int winy dy += cam->shifty * cam->ortho_scale; } else { - dx += cam->shiftx * (cam->clipsta / cam->lens) * 32.0f; - dy += cam->shifty * (cam->clipsta / cam->lens) * 32.0f; + dx += cam->shiftx * (cam->clipsta / cam->lens) * sensor; + dy += cam->shifty * (cam->clipsta / cam->lens) * sensor; } x1+= dx; @@ -1074,7 +1106,14 @@ int ED_view3d_viewplane_get(View3D *v3d, RegionView3D *rv3d, int winxi, int winy *pixsize= 1.0f/viewfac; } else { - viewfac= (((winx >= winy)? winx: winy)*lens)/32.0f; + float size= ((winx >= winy)? winx: winy); + + if(sensor_fit==CAMERA_SENSOR_FIT_HOR) + size= winx; + else if(sensor_fit==CAMERA_SENSOR_FIT_VERT) + size= winy; + + viewfac= (size*lens)/sensor; *pixsize= *clipsta/viewfac; } } diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c index 42f28c9fb7c..345172a1c00 100644 --- a/source/blender/editors/transform/transform.c +++ b/source/blender/editors/transform/transform.c @@ -5753,7 +5753,7 @@ int TimeScale(TransInfo *t, const int UNUSED(mval[2])) /* ************************************ */ -void BIF_TransformSetUndo(char *UNUSED(str)) +void BIF_TransformSetUndo(const char *UNUSED(str)) { // TRANSFORM_FIX_ME //Trans.undostr= str; diff --git a/source/blender/editors/util/editmode_undo.c b/source/blender/editors/util/editmode_undo.c index 4aa7a657e95..4776cf0af53 100644 --- a/source/blender/editors/util/editmode_undo.c +++ b/source/blender/editors/util/editmode_undo.c @@ -338,7 +338,7 @@ int undo_editmode_valid(const char *undoname) /* get name of undo item, return null if no item with this index */ /* if active pointer, set it to 1 if true */ -char *undo_editmode_get_name(bContext *C, int nr, int *active) +const char *undo_editmode_get_name(bContext *C, int nr, int *active) { UndoElem *uel; diff --git a/source/blender/editors/util/undo.c b/source/blender/editors/util/undo.c index 6a1819736a2..527537b5efb 100644 --- a/source/blender/editors/util/undo.c +++ b/source/blender/editors/util/undo.c @@ -426,7 +426,7 @@ static EnumPropertyItem *rna_undo_itemf(bContext *C, int undosys, int *totitem) int active, i= 0; while(TRUE) { - char *name= NULL; + const char *name= NULL; if(undosys==UNDOSYSTEM_PARTICLE) { name= PE_undo_get_name(CTX_data_scene(C), i, &active); diff --git a/source/blender/editors/util/util_intern.h b/source/blender/editors/util/util_intern.h index 3e2833ec89a..c6e2d079c28 100644 --- a/source/blender/editors/util/util_intern.h +++ b/source/blender/editors/util/util_intern.h @@ -37,7 +37,7 @@ /* editmode_undo.c */ void undo_editmode_name (struct bContext *C, const char *undoname); int undo_editmode_valid (const char *undoname); -char *undo_editmode_get_name (struct bContext *C, int nr, int *active); +const char *undo_editmode_get_name (struct bContext *C, int nr, int *active); void *undo_editmode_get_prev (struct Object *ob); void undo_editmode_step (struct bContext *C, int step); void undo_editmode_number (struct bContext *C, int nr); |