Post #4483: ![](https://blenderartists.org/user_avatar/blenderartists.org/adam_szalai/48/902

📋 Metadata

🏷️ Tags

python-scripting intermediate solved

  • Pie Menu Editor
  • Macro Editor
  • Python Scripting

💬 Content

Adam_Szalai:

Just curious how do You know how to “convert” a toogle command into this true false? :slight_smile:
I mean the toogle command looks totally different from the true false one.

In this specific case there is a property being turned on and off so there has to be a direct way to do it, so you search ‘xray toggle python blender’ or you look it up in this same thread (when roaoao was active he solved some really complex problems)

So the answer at the end is just to google it, but you need to have some idea of python to know what you are looking for.

for example: ‘blender python edit mode’ leads us to a blender stackexchange post that has:

import bpy

for obj in bpy.data.objects:

    if obj.name[0:4] == "Text" and obj.type == "MESH":

        bpy.context.scene.objects.active = obj
        bpy.ops.object.mode_set(mode = 'EDIT')
        print(bpy.context.mode)


        #bpy.ops.mesh.select_all(action = 'SELECT')
        #print(bpy.ops.mesh.remove_doubles(0.0001))
        bpy.ops.object.mode_set(mode = 'OBJECT')

What you need would be:

bpy.ops.object.mode_set(mode = 'EDIT')



bpy.ops.object.mode_set(mode = 'OBJECT')

To get a specific mode, and since its an operator pie menu should also give you more options

imageimage694×258 24.1 KB


❤️ 2 likes


🔗 View on Blender Artists