1
$\begingroup$

Ok. Let me frame my question and hope someone understands. I have more than 100 objects in my scene. None of them are named properly (and plz don't suggest me to). Now what I want to do is be able to Lock/Unlock (make unselectable or selectable) them directly from the 3D-Viewport and not from the Outliner.

Also, once I've disabled 70 objects, it becomes difficult to find the one I wish to Unlock (make selectable). I know the technique where I can select multiple items and press Alt+click in outliner to make then 'Unselectable' but the same doesn't work if I want to make them selectable (unlock).

So my question, again, is. How do I visually lock and unlock items direclty from the 3D-Viewport?

$\endgroup$
1
  • $\begingroup$ I think I understand the question: you can disable selection of the objects in the viewport and it also disables some changes to them, e.g. proportional editing won't move them. It seems you want the objects to be selectable, but not editable. I don't think there is such functionality in Blender. What should be possible is temporarily enabling selection on all objects, selecting a desired object, and then restoring previous selection settings. Is this a solution you would be interested in? $\endgroup$ Commented Jun 18 at 11:02

1 Answer 1

0
$\begingroup$

What you're asking is kind of a paradoxical question.

Operators in Blender are dependent on the context in which they run, e.g. whether your mouse is over the UV Editor, 3D View, Outliner etc.

Asking this question is almost like asking "How can I rotate objects in the viewport when i select them in the outliner?"

When you toggle selectable or hidden in the Viewport it's not even running an operator at all, it's just toggling an attribute of the object.

You can use a script like this to allow you to do what you want, but you have to remember that if you set an object to be "Locked" in the Viewport and then click away so that it's no longer the active object, you're going to have to go back to the outliner to set it back to selectable. Seems a little pointless.

import bpy

###
# If you just used this operator, you could set the hotkey to a shortcut 
# and you could run it without the menu.

# This is the operator that will allow us to toggle in the viewport.
class ToggleSelectable(bpy.types.Operator):
    """Toggle object as selectable in the 3D Viewport"""
    bl_idname = "object.toggle_selectable"
    bl_label = "Toggle Selectable"

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

    def execute(self, context):
        # get the active object
        obj = context.active_object 
         # the objects current "hide_select" attribute is set to the 
         # opposite of what it currently is.
        obj.hide_select = not obj.hide_select
        return {'FINISHED'}

# This is that class that creates a custom menu that you can put the
# Operator into

class OBJECT_MT_toggle_outliner_settings(bpy.types.Menu):
    bl_label = "Toggle Outliner Settings"
    bl_idname = "OBJECT_MT_toggle_outliner_settings"

    def draw(self, context):
        layout = self.layout
        layout.operator("object.toggle_selectable", icon="RESTRICT_SELECT_OFF")


def register():
    bpy.utils.register_class(OBJECT_MT_toggle_outliner_settings)
    bpy.utils.register_class(ToggleSelectable)

  

def unregister():
    bpy.utils.unregister_class(OBJECT_MT_toggle_outliner_settings)
    bpy.utils.unregister_class(ToggleSelectable)



if __name__ == "__main__":
    register()
    # This function calls the menu itself.
    
    bpy.ops.wm.call_menu(name=OBJECT_MT_toggle_outliner_settings.bl_idname)


You could expand this menu to basically list all "Unselectable object" into their own sub-menu, but that's a scripting effor beyond the scope of this question.

Honestly sounds like you should take a moment and rename your objects, and then just get into the habit of keeping them somewhat legibly named from the start.

Additionally, if you select an object in the 3D View, then hover over the viewport and press Numpad . it will scroll to the object you have selected.

$\endgroup$
2
  • $\begingroup$ Well, if you've ever used SketchUp then you'd know exactly what I'm asking for. Despite being locked the objects can be selected or you can say "highlighted" (also outlined by a different colour than selectable objects) but no operation will take place on them say for example move rotate etc. But you can easily "highlight" them and press a keyboard shortcut to "unlock" them. That's what I want. Makes sense? Simple isn't it? $\endgroup$ Commented Jun 6, 2022 at 18:26
  • $\begingroup$ Ok. So in sketchup how do you do procedural modeling, like bend, array, displace modifiers, sudbivision modeling? How do you do PBR procedural textures in sketchup? Can you sculpt with multiresolution in Sketchup? That's the first thing you'll have to learn about 3D modeling, is that each software has it's pros and cons, and you can either learn to work with them, learn how to translate your knowledge from one package to another, or learn Python/C++ and extend/develop your own version of the software. $\endgroup$
    – Jakemoyo
    Commented Jun 8, 2022 at 19:25

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .