0

I want to use this add-on, so the Python code has to be Single line https://github.com/InamuraJIN/CommandRecorder

I was able to select Empty in this Python bpy.ops.object.select_pattern(pattern="Empty") However, this command does not select the object in Python as active

I don't want it Python allowed me to select objects with matching names But it's not Active Select.

I want to do. Active selection of the currently selected object + specified Name Object enter image description here I use Google Translate

InamuraJIN
  • 157
  • 9
  • Hi! Having a hard time to understand what you'd like to do. You can get the current selection by using bpy.context.selected_objects and filter the selection by type via Object.type: https://blender.stackexchange.com/questions/132825/python-selecting-object-by-name-in-2-8/132829#132829 Alternatively: https://blender.stackexchange.com/questions/125114/how-to-get-the-class-of-selected-object-in-blender-2-8 Does that help? Otherwise please take your time, edit your question and explain in detail what you'd like to achieve. – brockmann Jul 09 '20 at 18:20
  • Thank you. I've just added the Image – InamuraJIN Jul 10 '20 at 01:03
  • No problem. Means you'd like to be able to select and highlight all objects starting with "Cube"? ...or only one object matching the "Cube" string? What's the reason using this add-on? – brockmann Jul 10 '20 at 09:57
  • Active selection if the object name is an exact match to "Cube". And we want to keep the currently selected object in the multiple selection state I'm thinking about joining afterwards, etc. – InamuraJIN Jul 10 '20 at 11:21
  • Ok, thanks. You would have to set the active object via ViewLayer. Did you already tried: bpy.context.view_layer.objects.active = bpy.context.scene.objects.get("Cube") as suggested in the answer I've linked to? Also, if you'd like to join objects you can override the operator: https://blender.stackexchange.com/a/133024/31447 so no need to set the active object... – brockmann Jul 10 '20 at 12:03
  • Thank you. This code doesn't seem to be able to select Active I want to run the state of the manual selection at the end of this video in Python. https://i.imgur.com/2V6GTqz.mp4 – InamuraJIN Jul 10 '20 at 12:24
  • Head over to the scripting workspace and use the console to test (works). – brockmann Jul 10 '20 at 12:27
  • This add-on, just like PhotoShop's Action, allows you to register and execute multiple simple tasks I think this Active Select will help me in many ways – InamuraJIN Jul 10 '20 at 12:28
  • For some reason, it looks like only the pivot is selected – InamuraJIN Jul 10 '20 at 12:30
  • If so (the pivot is selected), you nailed it, done. – brockmann Jul 10 '20 at 12:33
  • What's "Nailed"?” Active object is not a selected mesh” I get an error message like this – InamuraJIN Jul 10 '20 at 13:21
  • As we all know, cubes are meshes so it seems your cube is not the "active object" for whatever reason. Also, you most likely have to select it as well: bpy.context.scene.objects.get("Cube").select_set(True) depending on what you do... – brockmann Jul 10 '20 at 13:35
  • https://i.imgur.com/quLTCLO.mp4 Thank you so much! I put those two lines together and it was properly selected! It's no problem if you can't do it, but is it possible to make these on one line? By the way, you can't use ";". – InamuraJIN Jul 10 '20 at 14:15
  • I guess, you can not combine both lines - I'm not sure what the add-on is doing under the hood though. Can't test it really, the addon crashes all the time when running it on blender 2.83/linux. – brockmann Jul 10 '20 at 14:29
  • Okay, thank you very much. Oh. I'm Windows. can you see the error message? I don't know if I can handle it, but I'd like to make it a to-do list – InamuraJIN Jul 10 '20 at 15:11

0 Answers0