← All ideas
  • Published 2 Aug 2022

Add 'Display As' in Quick Favorites

I would love to change the 'display as' of an object on the fly.

I mean the Object Properties> ViewPort Display > Display as Textured/Wire/Solid/Bounds.

Edit : Done by -L0Lock- Thanks a lot !

viewport_addon.jpg

0%

Development Status: Done

Upvote 0 Downvote 0
JerX
2 Aug 2022

5 Comments

Lauloque

With the way things currenlty work, that would require to first create an operator for that 🤔

But that's a very specific use case...

In the meantime, you can make your own operator using this code:

import bpy


def main(context):
    for ob in context.scene.objects:
        print(ob)


class Ojbect_OT_setDisplayWire(bpy.types.Operator):
    """Tooltip"""
    bl_idname = "object.set_display_wire"
    bl_label = "Set Viewport Display: Wire"
    bl_options = {'REGISTER', 'UNDO'}

    @classmethod
    def poll(cls, context):
        return context.active_object is not None

    def execute(self, context):
        main(context)
        bpy.context.object.display_type = 'WIRE'
        return {'FINISHED'}


def menu_func(self, context):
    self.layout.operator(SimpleOperator.bl_idname, text=SimpleOperator.bl_label)


# Register and add to the "object" menu (required to also use F3 search "Simple Object Operator" for quick access).
def register():
    bpy.utils.register_class(Ojbect_OT_setDisplayWire)
    bpy.types.VIEW3D_MT_object.append(menu_func)


def unregister():
    bpy.utils.unregister_class(Ojbect_OT_setDisplayWire)
    bpy.types.VIEW3D_MT_object.remove(menu_func)


if __name__ == "__main__":
    register()

Put it in the text editor and hit the run button. Then when you F3 search for the "Set Viewport Display: Wire" operator, you can add it to your favorites from there.

If you need this all the time, you could save the python file in your startup blend file.

2
JerX Author

Thanks a lot -L0Lock- for your script! Two things : it is not useful to use F3 and type Set v.. than use just Q. I want too toggle objects from different displays (wire, textured, ..) not just change to wire.

zuorion

you could save the python file in your startup blend file.

Woudn't making this as add addon (by just adding header) be better :p?

Lauloque

If you want something more complex and that you need often, then yes it would be better to make an addon for it.

Lauloque

I made an actual addon with a menu you can find under the Object menu, and it contains all the possible display.

github.com/L0Lock/setViewportDisplay

see the readme for more info