import Blender
m=Blender.NMesh.GetRaw('Plane')
m.mode=128
m.update()
I wish I understood the purpose of that code. The simplicity implies that its very effective and important. Could you at least put a comment in the code that says what it does??
Well, that didn’t work overhere …
Traceback (most recent call last):
File “Text”, line 5, in ?
AttributeError: ‘NoneType’ object has no attribute ‘mode’
but I tried the following:
import Blender
m=Blender.Object.GetSelected()[0].getData()
m.mode = 128
m.update()
which did work.
And m.mode = 256 does the opposite
And does not work if the object is not a mesh
or alterate twoside option
import Blender
set_subsurf=128
set_twoside=4
set_drawnormal=32
O=Blender.Object.GetSelected()[0]
##------ just and only for meshes
if O.getType()=='Mesh':
m=O.getData()
print m.mode
## --- if not in subsurf -----
if not (m.mode & set_subsurf):
m.mode+=set_subsurf
else:
##-- yet subsurfed so subsurf is removed
m.mode-=set_subsurf
##--- console control ---
print m.mode
##--- activate the new choise---
m.update()
Blender.Window.RedrawAll()
Just a problem : now the mesh is not visible!!
_it becomes unvisible, yes, but if you tab-tab it (in and out of edit mode), it magikaly appears again. This happened to me couple of times before, mainly when using the decimator.
I kindly give my permission to use name the tedi trick for above described tab-tab trick.
Maybe you should harrass the coders team with this problemo - just to keep them amused and in shape ?