Page Menu
Home
Search
Configure Global Search
Log In
Files
F24545
view3d_tools_1_2.py
Public
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Authored By
koil (koilz)
Nov 13 2013, 5:19 PM
Size
17 KB
Subscribers
None
view3d_tools_1_2.py
View Options
# ##### BEGIN GPL LICENSE BLOCK #####
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
# ##### END GPL LICENSE BLOCK #####
bl_info
=
{
"name"
:
"View 3D Icon Tools 1.2"
,
"author"
:
"Koilz @ wiki.blender.org"
,
"version"
:
(
1
,
2
),
"blender"
:
(
2
,
6
,
6
),
"location"
:
"Editors > View 3D > Tools (t) or Properties (N) > Tools"
,
"description"
:
"Icon Tools. set switch = 'UI' for properties."
,
"wiki_url"
:
"http://wiki.blender.org/index.php/User:Koilz/13.03.06_View3D_Tools"
,
"category"
:
"3D View"
}
import
bpy
from
bpy.types
import
Header
,
Menu
,
Panel
global
switch
switch
=
'TOOLS'
# set to 'UI' for properties
bpy
.
types
.
Scene
.
sm
=
bpy
.
props
.
BoolProperty
(
default
=
1
)
# main basic
bpy
.
types
.
Scene
.
so
=
bpy
.
props
.
BoolProperty
(
default
=
1
)
# object dynamic
bpy
.
types
.
Scene
.
se
=
bpy
.
props
.
BoolProperty
(
default
=
1
)
# extra useful
""" ------------------------------------------------ """
""" draw_main """
def
draw_main
(
context
,
layout
,
col
,
row
):
scene
=
context
.
scene
active_object
=
context
.
active_object
row
=
col
.
row
(
align
=
True
)
if
bpy
.
context
.
scene
.
sm
:
""" View """
row
=
col
.
row
(
align
=
True
)
row
.
operator
(
"view3d.view_persportho"
,
text
=
"View"
)
row
.
operator
(
"mesh.primitive_plane_add"
,
icon
=
'MESH_PLANE'
,
text
=
""
)
row
.
operator
(
"mesh.primitive_cube_add"
,
icon
=
'MESH_CUBE'
,
text
=
""
)
row
.
operator
(
"mesh.primitive_circle_add"
,
icon
=
'MESH_CIRCLE'
,
text
=
""
)
row
.
operator
(
"mesh.primitive_uv_sphere_add"
,
icon
=
'MESH_UVSPHERE'
,
text
=
""
)
row
.
operator
(
"mesh.primitive_ico_sphere_add"
,
icon
=
'MESH_ICOSPHERE'
,
text
=
""
)
""" Origin """
row
=
col
.
row
(
align
=
True
)
row
.
operator
(
"object.origin_set"
,
text
=
"Origin"
)
row
.
operator
(
"mesh.primitive_grid_add"
,
icon
=
'MESH_GRID'
,
text
=
""
)
row
.
operator
(
"mesh.primitive_monkey_add"
,
icon
=
'MESH_MONKEY'
,
text
=
""
)
row
.
operator
(
"mesh.primitive_cylinder_add"
,
icon
=
'MESH_CYLINDER'
,
text
=
""
)
row
.
operator
(
"mesh.primitive_torus_add"
,
icon
=
'MESH_TORUS'
,
text
=
""
)
row
.
operator
(
"mesh.primitive_cone_add"
,
icon
=
'MESH_CONE'
,
text
=
""
)
""" Add Curve """
row
=
col
.
row
(
align
=
True
)
row
.
operator
(
"transform.translate"
,
text
=
"Locate"
)
row
.
operator
(
"curve.primitive_bezier_curve_add"
,
icon
=
'CURVE_BEZCURVE'
,
text
=
""
)
row
.
operator
(
"curve.primitive_bezier_circle_add"
,
icon
=
'CURVE_BEZCIRCLE'
,
text
=
""
)
row
.
operator
(
"curve.primitive_nurbs_curve_add"
,
icon
=
'CURVE_NCURVE'
,
text
=
""
)
row
.
operator
(
"curve.primitive_nurbs_circle_add"
,
icon
=
'CURVE_NCIRCLE'
,
text
=
""
)
row
.
operator
(
"curve.primitive_nurbs_path_add"
,
icon
=
'CURVE_PATH'
,
text
=
""
)
""" Add Surface """
row
=
col
.
row
(
align
=
True
)
row
.
operator
(
"transform.rotate"
)
row
.
operator
(
"surface.primitive_nurbs_surface_circle_add"
,
icon
=
'SURFACE_NCIRCLE'
,
text
=
""
)
row
.
operator
(
"surface.primitive_nurbs_surface_surface_add"
,
icon
=
'SURFACE_NSURFACE'
,
text
=
""
)
row
.
operator
(
"surface.primitive_nurbs_surface_cylinder_add"
,
icon
=
'SURFACE_NCYLINDER'
,
text
=
""
)
row
.
operator
(
"surface.primitive_nurbs_surface_sphere_add"
,
icon
=
'SURFACE_NSPHERE'
,
text
=
""
)
row
.
operator
(
"surface.primitive_nurbs_surface_torus_add"
,
icon
=
'SURFACE_NTORUS'
,
text
=
""
)
""" Add """
row
=
col
.
row
(
align
=
True
)
row
.
operator
(
"transform.resize"
,
text
=
"Scale"
)
row
.
operator
(
"object.armature_add"
,
text
=
""
,
icon
=
"BONE_DATA"
)
row
.
operator
(
"object.add"
,
text
=
""
,
icon
=
"OUTLINER_OB_LATTICE"
)
.
type
=
"LATTICE"
row
.
operator
(
"object.speaker_add"
,
icon
=
'OUTLINER_OB_SPEAKER'
,
text
=
""
)
row
.
operator
(
"object.camera_add"
,
icon
=
'OUTLINER_OB_CAMERA'
,
text
=
""
)
row
.
operator
(
"object.lamp_add"
,
icon
=
'OUTLINER_OB_LAMP'
,
text
=
""
)
""" ------------------------------------------------ """
""" ------------------------------------------------ """
""" draw_extra """
def
draw_extra
(
context
,
layout
,
col
,
row
):
if
bpy
.
context
.
scene
.
se
:
scene
=
context
.
scene
active_object
=
context
.
active_object
row
=
col
.
row
(
align
=
True
)
if
bpy
.
context
.
mode
==
"OBJECT"
or
bpy
.
context
.
mode
==
"POSE"
:
""" Keyframes """
if
active_object
and
active_object
.
type
in
{
'MESH'
,
'CURVE'
,
'SURFACE'
,
'ARMATURE'
}:
col
=
layout
.
column
(
align
=
True
)
col
.
label
(
text
=
"Keyframes (I) (Alt+I)"
)
row
=
col
.
row
(
align
=
True
)
row
.
operator
(
"anim.keyframe_insert_menu"
,
icon
=
'ZOOMIN'
,
text
=
""
)
row
.
operator
(
"anim.keyframe_delete_v3d"
,
icon
=
'ZOOMOUT'
,
text
=
""
)
row
.
prop_search
(
scene
.
keying_sets_all
,
"active"
,
scene
,
"keying_sets_all"
,
text
=
""
)
row
.
operator
(
"anim.keyframe_insert"
,
text
=
""
,
icon
=
'KEY_HLT'
)
row
.
operator
(
"anim.keyframe_delete"
,
text
=
""
,
icon
=
'KEY_DEHLT'
)
split
=
layout
.
split
()
""" Grease """
col
=
split
.
column
(
align
=
True
)
row
=
col
.
row
(
align
=
True
)
row
.
prop
(
context
.
tool_settings
,
"use_grease_pencil_sessions"
,
text
=
""
)
row
.
label
(
text
=
"Grease"
)
row
=
col
.
row
(
align
=
True
)
row
.
operator
(
"gpencil.draw"
,
text
=
""
,
icon
=
"GREASEPENCIL"
)
.
mode
=
'DRAW'
row
.
operator
(
"gpencil.draw"
,
text
=
""
,
icon
=
"OUTLINER_OB_CURVE"
)
.
mode
=
'DRAW_STRAIGHT'
row
.
operator
(
"gpencil.draw"
,
text
=
""
,
icon
=
"OUTLINER_OB_MESH"
)
.
mode
=
'DRAW_POLY'
row
.
operator
(
"gpencil.draw"
,
text
=
""
,
icon
=
"PANEL_CLOSE"
)
.
mode
=
'ERASER'
""" Motion """
col
=
split
.
column
(
align
=
True
)
col
.
label
(
text
=
"Motion Paths"
)
row
=
col
.
row
(
align
=
True
)
row
.
operator
(
"object.paths_calculate"
,
text
=
""
,
icon
=
"ANIM_DATA"
)
row
.
operator
(
"object.paths_clear"
,
text
=
""
,
icon
=
"PANEL_CLOSE"
)
""" ------------------------------------------------ """
""" ------------------------------------------------ """
""" Object Mode """
class
VIEW3D_PT_tools_objectmode
(
Panel
):
bl_space_type
=
'VIEW_3D'
bl_region_type
=
switch
bl_context
=
"objectmode"
# required for tools
bl_label
=
"Tools"
@classmethod
# required for properties
def
poll
(
cls
,
context
):
return
(
context
.
active_object
and
(
context
.
mode
==
'OBJECT'
))
def
draw
(
self
,
context
):
layout
=
self
.
layout
scene
=
context
.
scene
active_object
=
context
.
active_object
col
=
layout
.
column
(
align
=
True
)
row
=
col
.
row
(
align
=
True
)
row
.
prop
(
bpy
.
context
.
scene
,
"sm"
,
text
=
"Main"
,
icon
=
"GHOST"
)
draw_main
(
context
,
layout
,
col
,
row
)
row
=
col
.
row
(
align
=
True
)
row
.
prop
(
bpy
.
context
.
scene
,
"so"
,
text
=
"Object"
,
icon
=
"GHOST"
)
if
bpy
.
context
.
scene
.
so
:
""" Object """
row
=
col
.
row
(
align
=
True
)
if
active_object
and
active_object
.
type
in
{
'MESH'
,
'CURVE'
,
'SURFACE'
}:
row
.
operator
(
"object.shade_smooth"
,
text
=
"Smooth"
)
row
.
operator
(
"object.shade_flat"
,
text
=
"Flat"
)
col
.
operator
(
"object.delete"
,
text
=
"Delete"
)
col
.
operator
(
"object.duplicate_move"
,
text
=
"Duplicate"
)
col
.
operator
(
"object.join"
,
text
=
"Join"
)
row
=
col
.
row
(
align
=
True
)
row
.
prop
(
bpy
.
context
.
scene
,
"se"
,
text
=
"Extra"
,
icon
=
"GHOST"
)
draw_extra
(
context
,
layout
,
col
,
row
)
""" ------------------------------------------------ """
""" ------------------------------------------------ """
""" Edit Mode Mesh """
class
VIEW3D_PT_tools_meshedit
(
Panel
):
bl_space_type
=
'VIEW_3D'
bl_region_type
=
switch
bl_context
=
"mesh_edit"
# required for tools
bl_label
=
"Tools"
@classmethod
# required for properties
def
poll
(
cls
,
context
):
return
(
context
.
active_object
and
(
context
.
mode
==
'EDIT_MESH'
))
def
draw
(
self
,
context
):
layout
=
self
.
layout
scene
=
context
.
scene
active_object
=
context
.
active_object
col
=
layout
.
column
(
align
=
True
)
row
=
col
.
row
(
align
=
True
)
row
.
prop
(
bpy
.
context
.
scene
,
"sm"
,
text
=
"Main"
,
icon
=
"GHOST"
)
draw_main
(
context
,
layout
,
col
,
row
)
row
=
col
.
row
(
align
=
True
)
row
.
prop
(
bpy
.
context
.
scene
,
"so"
,
text
=
"Mesh"
,
icon
=
"GHOST"
)
if
bpy
.
context
.
scene
.
so
:
""" Mesh """
row
=
col
.
row
(
align
=
True
)
row
.
operator
(
"mesh.faces_shade_smooth"
,
text
=
"Smooth"
)
row
.
operator
(
"mesh.faces_shade_flat"
,
text
=
"Flat"
)
col
.
menu
(
"VIEW3D_MT_edit_mesh_delete"
)
col
.
operator
(
"view3d.edit_mesh_extrude_move_normal"
,
text
=
"Extrude"
)
col
.
operator
(
"mesh.duplicate_move"
,
text
=
"Duplicate"
)
col
.
operator
(
"mesh.merge"
)
col
=
layout
.
column
(
align
=
True
)
row
=
col
.
row
(
align
=
True
)
row
.
operator
(
"mesh.subdivide"
)
row
.
operator
(
"mesh.unsubdivide"
)
row
=
col
.
row
(
align
=
True
)
row
.
operator
(
"mesh.loopcut_slide"
,
text
=
"Loop Cut"
)
row
.
operator
(
"transform.edge_slide"
)
row
=
col
.
row
(
align
=
True
)
props
=
row
.
operator
(
"mesh.knife_tool"
,
text
=
"Knife All"
)
props
.
use_occlude_geometry
=
True
props
.
only_selected
=
False
props
=
row
.
operator
(
"mesh.knife_tool"
,
text
=
"Knife Sel"
)
props
.
use_occlude_geometry
=
False
props
.
only_selected
=
True
row
=
col
.
row
(
align
=
True
)
row
.
operator
(
"mesh.edge_split"
)
row
.
operator
(
"mesh.bridge_edge_loops"
,
text
=
"Edge Bridge"
)
row
=
col
.
row
(
align
=
True
)
row
.
operator
(
"mesh.rip_move"
)
row
.
operator
(
"mesh.rip_move_fill"
)
row
=
col
.
row
(
align
=
True
)
row
.
operator
(
"mesh.split"
)
row
.
operator
(
"mesh.separate"
)
row
=
col
.
row
(
align
=
True
)
row
.
operator
(
"mesh.edge_rotate"
,
text
=
"RE CW"
)
row
.
operator
(
"mesh.edge_rotate"
,
text
=
"RE CCW"
)
.
use_ccw
=
True
row
=
col
.
row
(
align
=
True
)
row
.
operator
(
"transform.edge_slide"
)
row
.
operator
(
"mesh.vert_slide"
)
row
=
col
.
row
(
align
=
True
)
row
.
operator
(
"mesh.loop_multi_select"
,
text
=
"Edge Loop"
)
row
.
operator
(
"mesh.loop_multi_select"
,
text
=
"Edge Ring"
)
.
ring
=
True
row
=
col
.
row
(
align
=
True
)
row
.
operator
(
"mesh.normals_make_consistent"
,
text
=
"N Recalc"
)
row
.
operator
(
"mesh.flip_normals"
,
text
=
"N Flip"
)
row
=
col
.
row
(
align
=
True
)
row
.
operator
(
"mesh.noise"
)
row
.
operator
(
"mesh.vertices_smooth"
,
text
=
"Smooth"
)
row
=
col
.
row
(
align
=
True
)
row
.
operator
(
"mesh.quads_convert_to_tris"
,
text
=
"Quad to Tri"
)
row
.
operator
(
"mesh.tris_convert_to_quads"
,
text
=
"Tri to Quad"
)
row
=
col
.
row
(
align
=
True
)
row
.
operator
(
"mesh.remove_doubles"
,
text
=
"Rem Doubles"
)
row
.
operator
(
"mesh.symmetrize"
)
col
=
layout
.
column
(
align
=
True
)
row
=
col
.
row
(
align
=
True
)
row
.
operator
(
"wm.call_menu"
,
text
=
"UV Unwrap"
)
.
name
=
"VIEW3D_MT_uv_map"
row
=
col
.
row
(
align
=
True
)
row
.
operator
(
"mesh.mark_seam"
)
.
clear
=
False
row
.
operator
(
"mesh.mark_seam"
,
text
=
"Clear Seam"
)
.
clear
=
True
row
=
col
.
row
(
align
=
True
)
row
.
prop
(
bpy
.
context
.
scene
,
"se"
,
text
=
"Extra"
,
icon
=
"GHOST"
)
draw_extra
(
context
,
layout
,
col
,
row
)
""" ------------------------------------------------ """
""" ------------------------------------------------ """
""" Edit Mode Armature """
class
VIEW3D_PT_tools_armatureedit
(
Panel
):
bl_space_type
=
'VIEW_3D'
bl_region_type
=
switch
bl_context
=
"armature_edit"
# required for tools
bl_label
=
"Tools"
@classmethod
# required for properties
def
poll
(
cls
,
context
):
return
(
context
.
active_object
and
(
context
.
mode
==
'EDIT_ARMATURE'
))
def
draw
(
self
,
context
):
layout
=
self
.
layout
scene
=
context
.
scene
active_object
=
context
.
active_object
col
=
layout
.
column
(
align
=
True
)
row
=
col
.
row
(
align
=
True
)
row
.
prop
(
bpy
.
context
.
scene
,
"sm"
,
text
=
"Main"
,
icon
=
"GHOST"
)
draw_main
(
context
,
layout
,
col
,
row
)
row
=
col
.
row
(
align
=
True
)
row
.
prop
(
bpy
.
context
.
scene
,
"so"
,
text
=
"Armature"
,
icon
=
"GHOST"
)
if
bpy
.
context
.
scene
.
so
:
""" Armature """
row
=
col
.
row
(
align
=
True
)
row
.
operator
(
"armature.bone_primitive_add"
,
text
=
"Add"
)
row
=
col
.
row
(
align
=
True
)
row
.
operator
(
"armature.extrude_move"
,
text
=
"Extrude"
)
row
=
col
.
row
(
align
=
True
)
row
.
operator
(
"armature.duplicate_move"
,
text
=
"Duplicate"
)
row
=
col
.
row
(
align
=
True
)
row
.
operator
(
"armature.merge"
)
col
=
layout
.
column
(
align
=
True
)
row
=
col
.
row
(
align
=
True
)
row
.
operator
(
"armature.subdivide"
,
text
=
"Subdivide"
)
row
.
operator
(
"armature.subdivide"
,
text
=
"Subdivide 2"
)
.
number_cuts
=
2
row
=
col
.
row
(
align
=
True
)
row
.
operator
(
"armature.select_hierarchy"
)
.
direction
=
"PARENT"
row
.
operator
(
"armature.select_hierarchy"
)
.
direction
=
"CHILD"
row
=
col
.
row
(
align
=
True
)
row
.
operator
(
"armature.fill"
,
text
=
"Fill Between"
)
row
.
operator
(
"armature.switch_direction"
)
row
=
col
.
row
(
align
=
True
)
row
.
operator
(
"armature.parent_set"
)
row
.
operator
(
"armature.parent_clear"
)
row
=
col
.
row
(
align
=
True
)
row
.
operator
(
"armature.calculate_roll"
)
row
.
operator
(
"armature.switch_direction"
)
row
=
col
.
row
(
align
=
True
)
row
.
prop
(
bpy
.
context
.
scene
,
"se"
,
text
=
"Extra"
,
icon
=
"GHOST"
)
draw_extra
(
context
,
layout
,
col
,
row
)
""" ------------------------------------------------ """
""" ------------------------------------------------ """
""" Pose Mode Armature """
class
VIEW3D_PT_tools_posemode
(
Panel
):
bl_space_type
=
'VIEW_3D'
bl_region_type
=
switch
bl_context
=
"posemode"
# required for tools
bl_label
=
"Tools"
@classmethod
# required for properties
def
poll
(
cls
,
context
):
return
(
context
.
active_object
and
(
context
.
mode
==
'POSE'
))
def
draw
(
self
,
context
):
layout
=
self
.
layout
scene
=
context
.
scene
active_object
=
context
.
active_object
col
=
layout
.
column
(
align
=
True
)
row
=
col
.
row
(
align
=
True
)
row
.
prop
(
bpy
.
context
.
scene
,
"sm"
,
text
=
"Main"
,
icon
=
"GHOST"
)
draw_main
(
context
,
layout
,
col
,
row
)
""" Pose """
row
=
col
.
row
(
align
=
True
)
row
.
prop
(
bpy
.
context
.
scene
,
"so"
,
text
=
"Pose"
,
icon
=
"GHOST"
)
if
bpy
.
context
.
scene
.
so
:
row
=
col
.
row
(
align
=
True
)
row
.
operator
(
"poselib.pose_add"
,
text
=
"Add To Library"
)
row
=
col
.
row
(
align
=
True
)
row
.
operator
(
"pose.copy"
)
row
.
operator
(
"pose.paste"
)
row
=
col
.
row
(
align
=
True
)
row
.
operator
(
"pose.loc_clear"
,
text
=
"Clear Loc"
)
row
.
operator
(
"pose.rot_clear"
,
text
=
"Clear Rot"
)
row
=
col
.
row
(
align
=
True
)
row
.
operator
(
"pose.scale_clear"
,
text
=
"Clear Scale"
)
row
.
operator
(
"pose.transforms_clear"
,
text
=
"Clear All"
)
row
=
col
.
row
(
align
=
True
)
row
.
prop
(
bpy
.
context
.
scene
,
"se"
,
text
=
"Extra"
,
icon
=
"GHOST"
)
draw_extra
(
context
,
layout
,
col
,
row
)
""" ------------------------------------------------ """
def
register
():
bpy
.
utils
.
register_class
(
VIEW3D_PT_tools_objectmode
)
bpy
.
utils
.
register_class
(
VIEW3D_PT_tools_meshedit
)
bpy
.
utils
.
register_class
(
VIEW3D_PT_tools_armatureedit
)
bpy
.
utils
.
register_class
(
VIEW3D_PT_tools_posemode
)
def
unregister
():
bpy
.
utils
.
unregister_class
(
VIEW3D_PT_tools_objectmode
)
bpy
.
utils
.
unregister_class
(
VIEW3D_PT_tools_meshedit
)
bpy
.
utils
.
unregister_class
(
VIEW3D_PT_tools_armatureedit
)
bpy
.
utils
.
unregister_class
(
VIEW3D_PT_tools_posemode
)
if
__name__
==
"__main__"
:
register
()
File Metadata
Details
Mime Type
text/x-python
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
27/06/9d02ee033e014887d32164c6f34c
Event Timeline
Log In to Comment