Skip to main content
17 events
when toggle format what by license comment
Apr 2, 2022 at 13:36 comment added Marty Fouts @Ratt It would be safer, because it would prevent mistakes if the code was later modified to add something that changed selected_objects, and yes it is possible that setting hide_select might reorder selected_objects. Good spot.
Apr 2, 2022 at 5:50 comment added Ratt Just out of curiosity wouldn't for object in list(bpy.context.selected_objects): be safer execution since setting object.hide_select = True is modifying bpy.context.selected_objects each loop iteration?
Apr 1, 2022 at 23:56 comment added Marty Fouts Let us continue this discussion in chat.
Apr 1, 2022 at 23:42 comment added Marc Volkers How do I make this work for the pie menu :) I'm a novice in python. I see in running in the scripting window, but I kinda need it working as a fast command (how do I convert this so i can call it via hotkey, piemenu etc)
Apr 1, 2022 at 22:40 comment added Marty Fouts You're not running the script @MarcVolkers. If you're invoking the code from a pie menu that means you stuffed it in an operator. Edit your question and show the actual code from the operator, probably the execute routine, and I'll update my answer. (Hint: the operator takes a context variable, so you want to use it instead of bpy.context.)
Apr 1, 2022 at 21:18 comment added Marc Volkers Youtube video showing it's only freezing one object in selected objects. youtube.com/watch?v=X3OO1GpUNaA | I'm running the script through pie menus,
Apr 1, 2022 at 20:32 history edited Marty Fouts CC BY-SA 4.0
deleted 571 characters in body
Apr 1, 2022 at 20:30 comment added Marty Fouts The top code should be freezing the entire group. As we discussed in the comments, the second one, as written, isn't. So I removed the second one to avoid confusion.
Apr 1, 2022 at 20:28 comment added Marc Volkers It's not freezing the entire group still, just 1 out of max group
Apr 1, 2022 at 20:17 history edited Marty Fouts CC BY-SA 4.0
added 73 characters in body
Apr 1, 2022 at 20:16 comment added Marty Fouts @Gorgious you're absolutely right on bpy.context.object and on unselect. Editing answer now.
Apr 1, 2022 at 20:12 comment added Gorgious fwiw I don't think that even indented properly the original code would work, bpy.context.object points to the active object, so the loop will make the same object unselectable many times. Also although it's valid in this context maybe a word of warning that using object in python is not advised since it overrides the base type object. And making an object unselectable automatically unselects it from the viewport (not from the outliner though) :)
Apr 1, 2022 at 20:08 comment added Marty Fouts @MarcVolkers My first example above will do what you wanted. So would the code you posted, formatted the way I have it now.
Apr 1, 2022 at 20:07 history edited Marty Fouts CC BY-SA 4.0
added 198 characters in body
Apr 1, 2022 at 19:33 comment added Marc Volkers Cheers, I wasn't trying to write code, I was just giving an idea what I wanted by looking online for examples.
Apr 1, 2022 at 19:24 comment added Marty Fouts also notice that the SEL_OBJS line should be separated by a return from the ACT_OBJ line because they are two separate statements.
Apr 1, 2022 at 19:18 history answered Marty Fouts CC BY-SA 4.0