Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
# 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