Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
blender-addons
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
blender
blender-addons
Commits
3984378b
Commit
3984378b
authored
8 years ago
by
meta-androcto
Browse files
Options
Downloads
Patches
Plain Diff
3d nav, consistent ui, code cleanup
parent
8c06e5c7
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
space_view3d_3d_navigation.py
+42
-82
42 additions, 82 deletions
space_view3d_3d_navigation.py
with
42 additions
and
82 deletions
space_view3d_3d_navigation.py
+
42
−
82
View file @
3984378b
...
@@ -27,7 +27,7 @@ bl_info = {
...
@@ -27,7 +27,7 @@ bl_info = {
"
author
"
:
"
Demohero, uriel
"
,
"
author
"
:
"
Demohero, uriel
"
,
"
version
"
:
(
1
,
2
,
1
),
"
version
"
:
(
1
,
2
,
1
),
"
blender
"
:
(
2
,
77
,
0
),
"
blender
"
:
(
2
,
77
,
0
),
"
location
"
:
"
View3D > Tool Shelf >
Navigation
Tab
"
,
"
location
"
:
"
View3D > Tool Shelf >
Display
Tab
"
,
"
description
"
:
"
Navigate the Camera & 3D View from the Toolshelf
"
,
"
description
"
:
"
Navigate the Camera & 3D View from the Toolshelf
"
,
"
warning
"
:
""
,
"
warning
"
:
""
,
"
wiki_url
"
:
"
http://wiki.blender.org/index.php/Extensions:2.6/Py/
"
"
wiki_url
"
:
"
http://wiki.blender.org/index.php/Extensions:2.6/Py/
"
...
@@ -40,7 +40,7 @@ import bpy
...
@@ -40,7 +40,7 @@ import bpy
# main class of this toolbar
# main class of this toolbar
## re-ordered (reversed) Orbit Oprators
## re-ordered (reversed) Orbit Op
e
rators
class
OrbitUpView1
(
bpy
.
types
.
Operator
):
class
OrbitUpView1
(
bpy
.
types
.
Operator
):
bl_idname
=
'
opr.orbit_up_view1
'
bl_idname
=
'
opr.orbit_up_view1
'
bl_label
=
'
Orbit Up View
'
bl_label
=
'
Orbit Up View
'
...
@@ -80,7 +80,7 @@ class OrbitDownView1(bpy.types.Operator):
...
@@ -80,7 +80,7 @@ class OrbitDownView1(bpy.types.Operator):
bpy
.
ops
.
view3d
.
view_orbit
(
type
=
'
ORBITDOWN
'
)
bpy
.
ops
.
view3d
.
view_orbit
(
type
=
'
ORBITDOWN
'
)
return
{
'
FINISHED
'
}
return
{
'
FINISHED
'
}
## re-ordered (reversed) Pan Oprators
## re-ordered (reversed) Pan Op
e
rators
class
PanUpView1
(
bpy
.
types
.
Operator
):
class
PanUpView1
(
bpy
.
types
.
Operator
):
bl_idname
=
'
opr.pan_up_view1
'
bl_idname
=
'
opr.pan_up_view1
'
bl_label
=
'
Pan Up View
'
bl_label
=
'
Pan Up View
'
...
@@ -114,17 +114,17 @@ class PanRightView1(bpy.types.Operator):
...
@@ -114,17 +114,17 @@ class PanRightView1(bpy.types.Operator):
class
PanDownView1
(
bpy
.
types
.
Operator
):
class
PanDownView1
(
bpy
.
types
.
Operator
):
bl_idname
=
'
opr.pan_down_view1
'
bl_idname
=
'
opr.pan_down_view1
'
bl_label
=
'
Pan Down View
'
bl_label
=
'
Pan Down View
'
bl_description
=
'
Pan the view
u
p
'
bl_description
=
'
Pan the view
U
p
'
def
execute
(
self
,
context
):
def
execute
(
self
,
context
):
bpy
.
ops
.
view3d
.
view_pan
(
type
=
'
PANDOWN
'
)
bpy
.
ops
.
view3d
.
view_pan
(
type
=
'
PANDOWN
'
)
return
{
'
FINISHED
'
}
return
{
'
FINISHED
'
}
## Zoom Oprators
## Zoom Op
e
rators
class
ZoomInView1
(
bpy
.
types
.
Operator
):
class
ZoomInView1
(
bpy
.
types
.
Operator
):
bl_idname
=
'
opr.zoom_in_view1
'
bl_idname
=
'
opr.zoom_in_view1
'
bl_label
=
'
Zoom In View
'
bl_label
=
'
Zoom In View
'
bl_description
=
'
Zoom
in i
n the
v
iew
'
bl_description
=
'
Zoom
I
n the
View/Camera V
iew
'
def
execute
(
self
,
context
):
def
execute
(
self
,
context
):
bpy
.
ops
.
view3d
.
zoom
(
delta
=
1
)
bpy
.
ops
.
view3d
.
zoom
(
delta
=
1
)
...
@@ -134,17 +134,17 @@ class ZoomInView1(bpy.types.Operator):
...
@@ -134,17 +134,17 @@ class ZoomInView1(bpy.types.Operator):
class
ZoomOutView1
(
bpy
.
types
.
Operator
):
class
ZoomOutView1
(
bpy
.
types
.
Operator
):
bl_idname
=
'
opr.zoom_out_view1
'
bl_idname
=
'
opr.zoom_out_view1
'
bl_label
=
'
Zoom Out View
'
bl_label
=
'
Zoom Out View
'
bl_description
=
'
Zoom out
i
n the
v
iew
'
bl_description
=
'
Zoom out
I
n the
View/Camera V
iew
'
def
execute
(
self
,
context
):
def
execute
(
self
,
context
):
bpy
.
ops
.
view3d
.
zoom
(
delta
=-
1
)
bpy
.
ops
.
view3d
.
zoom
(
delta
=-
1
)
return
{
'
FINISHED
'
}
return
{
'
FINISHED
'
}
## Roll Oprators
## Roll Op
e
rators
class
RollLeftView1
(
bpy
.
types
.
Operator
):
class
RollLeftView1
(
bpy
.
types
.
Operator
):
bl_idname
=
'
opr.roll_left_view1
'
bl_idname
=
'
opr.roll_left_view1
'
bl_label
=
'
Roll Left View
'
bl_label
=
'
Roll Left View
'
bl_description
=
'
Roll the view
l
eft
'
bl_description
=
'
Roll the view
L
eft
'
def
execute
(
self
,
context
):
def
execute
(
self
,
context
):
bpy
.
ops
.
view3d
.
view_roll
(
angle
=-
0.261799
)
bpy
.
ops
.
view3d
.
view_roll
(
angle
=-
0.261799
)
...
@@ -154,13 +154,13 @@ class RollLeftView1(bpy.types.Operator):
...
@@ -154,13 +154,13 @@ class RollLeftView1(bpy.types.Operator):
class
RollRightView1
(
bpy
.
types
.
Operator
):
class
RollRightView1
(
bpy
.
types
.
Operator
):
bl_idname
=
'
opr.roll_right_view1
'
bl_idname
=
'
opr.roll_right_view1
'
bl_label
=
'
Roll Right View
'
bl_label
=
'
Roll Right View
'
bl_description
=
'
Roll the view
r
ight
'
bl_description
=
'
Roll the view
R
ight
'
def
execute
(
self
,
context
):
def
execute
(
self
,
context
):
bpy
.
ops
.
view3d
.
view_roll
(
angle
=
0.261799
)
bpy
.
ops
.
view3d
.
view_roll
(
angle
=
0.261799
)
return
{
'
FINISHED
'
}
return
{
'
FINISHED
'
}
## View Operators
class
LeftViewpoint1
(
bpy
.
types
.
Operator
):
class
LeftViewpoint1
(
bpy
.
types
.
Operator
):
bl_idname
=
'
opr.left_viewpoint1
'
bl_idname
=
'
opr.left_viewpoint1
'
bl_label
=
'
Left Viewpoint
'
bl_label
=
'
Left Viewpoint
'
...
@@ -220,39 +220,7 @@ class BottomViewpoint1(bpy.types.Operator):
...
@@ -220,39 +220,7 @@ class BottomViewpoint1(bpy.types.Operator):
bpy
.
ops
.
view3d
.
viewnumpad
(
type
=
'
BOTTOM
'
)
bpy
.
ops
.
view3d
.
viewnumpad
(
type
=
'
BOTTOM
'
)
return
{
'
FINISHED
'
}
return
{
'
FINISHED
'
}
# Panel class of this toolbar
class
ShowHideObject1
(
bpy
.
types
.
Operator
):
bl_idname
=
'
opr.show_hide_object1
'
bl_label
=
'
Show/Hide Object
'
bl_description
=
'
Show/hide selected objects
'
bl_options
=
{
'
REGISTER
'
,
'
UNDO
'
}
def
execute
(
self
,
context
):
if
context
.
object
==
None
:
self
.
report
({
'
ERROR
'
},
'
Cannot perform this operation on NoneType objects
'
)
return
{
'
CANCELLED
'
}
if
context
.
object
.
mode
!=
'
OBJECT
'
:
self
.
report
({
'
ERROR
'
},
'
This operation can be performed only in object mode
'
)
return
{
'
CANCELLED
'
}
for
i
in
bpy
.
data
.
objects
:
if
i
.
select
:
if
i
.
hide
:
i
.
hide
=
False
i
.
hide_select
=
False
i
.
hide_render
=
False
else
:
i
.
hide
=
True
i
.
select
=
False
if
i
.
type
not
in
[
'
CAMERA
'
,
'
LAMP
'
]:
i
.
hide_render
=
True
return
{
'
FINISHED
'
}
# main class of this toolbar
class
VIEW3D_PT_3dnavigationPanel
(
bpy
.
types
.
Panel
):
class
VIEW3D_PT_3dnavigationPanel
(
bpy
.
types
.
Panel
):
bl_category
=
"
Display
"
bl_category
=
"
Display
"
bl_space_type
=
"
VIEW_3D
"
bl_space_type
=
"
VIEW_3D
"
...
@@ -284,17 +252,15 @@ class VIEW3D_PT_3dnavigationPanel(bpy.types.Panel):
...
@@ -284,17 +252,15 @@ class VIEW3D_PT_3dnavigationPanel(bpy.types.Panel):
# group of 2 buttons
# group of 2 buttons
col
=
layout
.
column
(
align
=
True
)
col
=
layout
.
column
(
align
=
True
)
col
.
label
(
text
=
"
View to Object:
"
)
col
.
label
(
text
=
"
Lock
View to Object:
"
)
col
.
prop
(
view
,
"
lock_object
"
,
text
=
""
)
col
.
prop
(
view
,
"
lock_object
"
,
text
=
""
)
col
.
operator
(
"
view3d.view_selected
"
,
text
=
"
View to Selected
"
)
col
.
operator
(
"
view3d.view_selected
"
,
text
=
"
View to Selected
"
)
col
=
layout
.
column
(
align
=
True
)
col
=
layout
.
column
(
align
=
True
)
col
.
label
(
text
=
"
Cursor:
"
)
col
.
label
(
text
=
"
Cursor:
"
)
row
=
col
.
row
()
row
=
col
.
row
()
row
.
operator
(
"
view3d.snap_cursor_to_center
"
,
text
=
"
Center
"
)
row
.
operator
(
"
view3d.snap_cursor_to_center
"
,
text
=
"
Center
"
)
row
.
operator
(
"
view3d.view_center_cursor
"
,
text
=
"
View
"
)
row
.
operator
(
"
view3d.view_center_cursor
"
,
text
=
"
View
"
)
col
.
operator
(
"
view3d.snap_cursor_to_selected
"
,
text
=
"
Cursor to Selected
"
)
col
.
operator
(
"
view3d.snap_cursor_to_selected
"
,
text
=
"
Cursor to Selected
"
)
...
@@ -304,48 +270,43 @@ class VIEW3D_PT_pan_navigation1(bpy.types.Panel):
...
@@ -304,48 +270,43 @@ class VIEW3D_PT_pan_navigation1(bpy.types.Panel):
bl_space_type
=
'
VIEW_3D
'
bl_space_type
=
'
VIEW_3D
'
bl_region_type
=
'
TOOLS
'
bl_region_type
=
'
TOOLS
'
bl_category
=
'
Display
'
bl_category
=
'
Display
'
bl_options
=
{
'
DEFAULT_CLOSED
'
}
def
draw
(
self
,
context
):
def
draw
(
self
,
context
):
layout
=
self
.
layout
layout
=
self
.
layout
layout
.
label
(
text
=
'
Screen View Perspective
'
)
layout
.
label
(
text
=
'
Screen View Perspective
'
)
row
=
layout
.
row
()
row
=
layout
.
row
()
box
=
row
.
box
()
row
.
label
(
text
=
'
Pan:
'
)
box
.
label
(
text
=
'
Pan:
'
)
rowr
=
box
.
row
()
rowr
.
operator
(
'
opr.pan_up_view1
'
,
text
=
''
,
icon
=
'
TRIA_DOWN
'
)
rowr
.
operator
(
'
opr.pan_down_view1
'
,
text
=
''
,
icon
=
'
TRIA_UP
'
)
rowr
=
box
.
row
()
rowr
.
operator
(
'
opr.pan_right_view1
'
,
text
=
''
,
icon
=
'
BACK
'
)
rowr
.
operator
(
'
opr.pan_left_view1
'
,
text
=
''
,
icon
=
'
FORWARD
'
)
rowr
=
box
.
row
()
box
=
row
.
box
()
box
.
label
(
text
=
'
Orbit:
'
)
rowr
=
box
.
row
()
rowr
.
operator
(
'
opr.orbit_up_view1
'
,
text
=
''
,
icon
=
'
TRIA_DOWN
'
)
rowr
.
operator
(
'
opr.orbit_down_view1
'
,
text
=
''
,
icon
=
'
TRIA_UP
'
)
rowr
=
box
.
row
()
rowr
.
operator
(
'
opr.orbit_right_view1
'
,
text
=
''
,
icon
=
'
BACK
'
)
rowr
.
operator
(
'
opr.orbit_left_view1
'
,
text
=
''
,
icon
=
'
FORWARD
'
)
rowr
=
box
.
row
()
row
=
layout
.
row
()
row
=
layout
.
row
()
row
.
operator
(
'
opr.pan_down_view1
'
,
text
=
'
Up
'
,
icon
=
'
TRIA_UP
'
)
row
.
operator
(
'
opr.pan_up_view1
'
,
text
=
'
Down
'
,
icon
=
'
TRIA_DOWN
'
)
box
=
row
.
box
()
row
=
layout
.
row
()
box
.
label
(
text
=
'
Zoom:
'
)
row
.
operator
(
'
opr.pan_right_view1
'
,
text
=
'
Left
'
,
icon
=
'
BACK
'
)
rowr
=
box
.
row
()
row
.
operator
(
'
opr.pan_left_view1
'
,
text
=
'
Right
'
,
icon
=
'
FORWARD
'
)
rowrowr
=
rowr
.
row
(
align
=
True
)
rowrowr
.
operator
(
'
opr.zoom_in_view1
'
,
text
=
''
,
icon
=
'
ZOOMIN
'
)
row
=
layout
.
row
()
rowrowr
.
operator
(
'
opr.zoom_out_view1
'
,
text
=
''
,
icon
=
'
ZOOMOUT
'
)
row
.
label
(
text
=
'
Orbit:
'
)
row
=
layout
.
row
()
row
.
operator
(
'
opr.orbit_down_view1
'
,
text
=
'
Up
'
,
icon
=
'
TRIA_UP
'
)
row
.
operator
(
'
opr.orbit_up_view1
'
,
text
=
'
Down
'
,
icon
=
'
TRIA_DOWN
'
)
row
=
layout
.
row
()
row
.
operator
(
'
opr.orbit_right_view1
'
,
text
=
'
Left
'
,
icon
=
'
BACK
'
)
row
.
operator
(
'
opr.orbit_left_view1
'
,
text
=
'
Right
'
,
icon
=
'
FORWARD
'
)
box
=
row
.
box
()
row
=
layout
.
row
()
box
.
label
(
text
=
'
Roll:
'
)
row
.
label
(
text
=
'
Zoom:
'
)
rowr
=
box
.
row
()
row
=
layout
.
row
()
rowrowr
=
rowr
.
row
(
align
=
True
)
row
.
operator
(
'
opr.zoom_in_view1
'
,
text
=
'
In
'
,
icon
=
'
ZOOMIN
'
)
rowrowr
.
operator
(
'
opr.roll_left_view1
'
,
text
=
''
,
icon
=
'
LOOP_BACK
'
)
row
.
operator
(
'
opr.zoom_out_view1
'
,
text
=
'
Out
'
,
icon
=
'
ZOOMOUT
'
)
rowrowr
.
operator
(
'
opr.roll_right_view1
'
,
text
=
''
,
icon
=
'
LOOP_FORWARDS
'
)
row
=
layout
.
row
()
row
.
label
(
text
=
'
Roll:
'
)
row
=
layout
.
row
()
row
.
operator
(
'
opr.roll_left_view1
'
,
text
=
'
Left
'
,
icon
=
'
LOOP_BACK
'
)
row
.
operator
(
'
opr.roll_right_view1
'
,
text
=
'
Right
'
,
icon
=
'
LOOP_FORWARDS
'
)
## Addons Preferences Update Panel
## Addons Preferences Update Panel
def
update_panel
(
self
,
context
):
def
update_panel
(
self
,
context
):
...
@@ -399,7 +360,6 @@ classes = [
...
@@ -399,7 +360,6 @@ classes = [
BackViewpoint1
,
BackViewpoint1
,
TopViewpoint1
,
TopViewpoint1
,
BottomViewpoint1
,
BottomViewpoint1
,
ShowHideObject1
,
NavAddonPreferences
,
NavAddonPreferences
,
]
]
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment