pitiwazou
(Pitiwazou)
January 11, 2014, 2:25pm
1
Hi,
I would like to know how to make a simple script to change modes with the tab hotkey.
I would add Object/Edit/Sculpt to a custom menu when I press Tab like this picture.
I d’ont find the good command to do that.
I don’t find the command to show the wire too, so If you know, plz help me
Thank you !
Ced
pitiwazou
(Pitiwazou)
January 11, 2014, 2:36pm
2
I found alternate pie who work’s very well !
http://www.blenderartists.org/forum/showthread.php?317916-An-alternative-to-pies
I have too many bugs with the pie menu addon, so this one is great !
pitiwazou
(Pitiwazou)
January 15, 2014, 3:27pm
3
Hi, I would like to add some features to my menu like wireframe On/Off, xray, but I don’t find the good command.
Can you help me for this plz ?
That’s because object.show_x_ray and object.show_wire are not operators but properties.
For properties you do something like
col.prop(obj, "show_wire", text="Wire")
pitiwazou
(Pitiwazou)
January 15, 2014, 3:58pm
5
If I put this, I don’t have button with wire on the menu.
CoDEmanX
(CoDEmanX)
January 15, 2014, 6:43pm
6
col.operator("wm.context_toggle", text="Xray").data_path = "object.show_x_ray"
col.operator("wm.context_toggle", text="Wire").data_path = "object.show_wire"
pitiwazou
(Pitiwazou)
January 16, 2014, 2:12am
8
Another question !
A friend of mine would like to put the wire and draw all edges on hotkeys, so I did this.
It’s ok, but he want’s to add the wire on all objects on the scene.
I would like to do this on my menu too.
Do you know how to do this ?
you’d have to add a new operator for that, something like this:
import bpy
class AllWires(bpy.types.Operator):
'''Turn on wires for all objects'''
bl_idname = "object.all_wires"
bl_label = "Wires - All objects"
bl_options = {'REGISTER', 'UNDO'}
@classmethod
def poll(cls, context):
return len(bpy.context.scene.objects)>0
def execute(self, context):
for object in bpy.context.scene.objects :
if object.type == 'MESH':
object.show_wire = True
return {'FINISHED'}
def register():
bpy.utils.register_class(AllWires)
def unregister():
bpy.utils.unregister_class(AllWires)
if __name__ == "__main__":
register()
# test call
bpy.ops.object.all_wires()
Of course, this only turns the wires on, it doesn’t toggle them. It’s up to you to add the logic for that
pitiwazou
(Pitiwazou)
January 16, 2014, 4:11am
10
Ok, I see, I’m trying to do that in my custom popup menu !