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

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2011-04-28 12:26:49 +0400
committerCampbell Barton <ideasman42@gmail.com>2011-04-28 12:26:49 +0400
commit06dc54837d70a18bf687c6dbf8f4500a0e9abc85 (patch)
treec6fbce695aaa84a3c6fc172a7679defd802673c5 /source/blender/editors/space_view3d/space_view3d.c
parent49238a323de8d901296cd7c8e5090911c9962168 (diff)
fix [#27193] view/camera/set active object as camera sometimes "disabled" in gui (grayed out)
When in quad split view, operators that only apply to the unlocked region can now be accessed from menus and when the mouse is over a locked view. Applied to: - VIEW3D_OT_object_as_camera - VIEW3D_OT_view_persportho - VIEW3D_OT_view_orbit - VIEW3D_OT_viewnumpad
Diffstat (limited to 'source/blender/editors/space_view3d/space_view3d.c')
-rw-r--r--source/blender/editors/space_view3d/space_view3d.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/source/blender/editors/space_view3d/space_view3d.c b/source/blender/editors/space_view3d/space_view3d.c
index a8cdc99645d..93d86f2d97b 100644
--- a/source/blender/editors/space_view3d/space_view3d.c
+++ b/source/blender/editors/space_view3d/space_view3d.c
@@ -156,6 +156,44 @@ RegionView3D *ED_view3d_context_rv3d(bContext *C)
return rv3d;
}
+/* ideally would return an rv3d but in some cases the region is needed too
+ * so return that, the caller can then access the ar->regiondata */
+ARegion *ED_view3d_context_region_unlock(bContext *C)
+{
+ ScrArea *sa= CTX_wm_area(C);
+ if(sa && sa->spacetype==SPACE_VIEW3D) {
+ ARegion *ar= CTX_wm_region(C);
+ if(ar) {
+ RegionView3D *rv3d= ar->regiondata;
+ if(rv3d && rv3d->viewlock == 0) {
+ return ar;
+ }
+ else {
+ ARegion *ar_unlock_user= NULL;
+ ARegion *ar_unlock= NULL;
+ for(ar= sa->regionbase.first; ar; ar= ar->next) {
+ /* find the first unlocked rv3d */
+ if(ar->regiondata && ar->regiontype == RGN_TYPE_WINDOW) {
+ rv3d= ar->regiondata;
+ if(rv3d->viewlock == 0) {
+ ar_unlock= ar;
+ if(rv3d->persp==RV3D_PERSP || rv3d->persp==RV3D_CAMOB) {
+ ar_unlock_user= ar;
+ break;
+ }
+ }
+ }
+ }
+
+ /* camera/perspective view get priority when the active region is locked */
+ if(ar_unlock_user) return ar_unlock_user;
+ if(ar_unlock) return ar_unlock;
+ }
+ }
+ }
+ return NULL;
+}
+
/* Most of the time this isn't needed since you could assume the view matrix was
* set while drawing, however when functions like mesh_foreachScreenVert are
* called by selection tools, we can't be sure this object was the last.