Skip to content

Instantly share code, notes, and snippets.

@Jeff-LeRoy
Created June 6, 2014 01:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Jeff-LeRoy/28f517c6d29c61c5d744 to your computer and use it in GitHub Desktop.
Save Jeff-LeRoy/28f517c6d29c61c5d744 to your computer and use it in GitHub Desktop.
# python
#
# Author: Jeff LeRoy (extol) www.leroyfx.com
#
# Ex_Wireframe_Toggle.py v1.1
#
#------------------------------------------------------------------------------------------------
#------------------------------------------------------------------------------------------------
# TO DO
#------------------------------------------------------------------------------------------------
#------------------------------------------------------------------------------------------------
mouseView = lx.eval ('query view3dservice mouse.view ?')#get the index of viewport mouse is in
#------------------------------------------------------------------------------------------------
#------------------------------------------------------------------------------------------------
if mouseView >= 0:#not over a popup
lx.eval ('select.viewport fromMouse:1')#select Viewport UnderMouse
underMouseViewType = lx.eval ('query view3dservice view.type ? first')#get the type of viewport
mouseViewShading = lx.eval ('query view3dservice view.shade ? first')#get shading of viewport
if underMouseViewType == "MO3D" and mouseViewShading != 0:#if not UV and not wireframe shading
wirestate = lx.eval ('query view3dservice view.wire ? selected')
if wirestate == 0:#wireframe is off so turn it on
lx.eval ('view3d.wireframeOverlay colored')
if wirestate > 0:#wireframe is on
vertState = lx.eval ('view3d.showVertices ?')
if vertState == 1:#if verts are on
lx.eval ('view3d.showVertices 0')#turn them off
lx.eval ('view3d.wireframeOverlay none')#Turn off wireframe
#------------------------------------------------------------------------------------------------
#-UPDATES----------------------------------------------------------------------------------------
#
# --v1.1
# --Cleaned code, fixed some errors
#------------------------------------------------------------------------------------------------
#------------------------------------------------------------------------------------------------
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment