PacktPublishing / Python-Scripting-in-Blender

Python Scripting in Blender, published by Packt
MIT License
38 stars 16 forks source link

active vs. selected #3

Open coop101 opened 1 year ago

coop101 commented 1 year ago

P 119 : "As we can see, the list now provides information about which objects are active and/or selected:" Should this read selected only?

pKrime commented 1 year ago

Hi, in that example the active object is displayed as red, selected objects are displayed as black, non selected objects are greyed out, so the intended meaning of that sentence, that we can infer those three states from our panel should be correct?

Please, let me know if I'm missing anything!

p.

coop101 commented 1 year ago

My scripting may be in error but, selected objects are in black, non-selected objects grayed out and nothing for active objects. If the object is active and selected then the symbol is in black otherwise the active only object doesn't show up at all.

On Mon, Jul 3, 2023 at 5:43 PM pKrime @.***> wrote:

Hi, in that example the active object is displayed as red, selected objects are displayed as black, non selected objects are greyed out, so the intended meaning of that sentence, that we can infer those three states from our panel should be correct?

Please, let me know if I'm missing anything!

p.

— Reply to this email directly, view it on GitHub https://github.com/PacktPublishing/Python-Scripting-in-Blender/issues/3#issuecomment-1619181590, or unsubscribe https://github.com/notifications/unsubscribe-auth/AV2AKWFZGMTX6XN5XE3KLGLXOM4J3ANCNFSM6AAAAAAZ42T7O4 . You are receiving this because you authored the thread.Message ID: @.*** com>

pKrime commented 1 year ago

Hi, the red color for active objects is achieved by setting the alert attribute to True, at line 122 of the example

item_layout.alert = ob == context.object

https://github.com/PacktPublishing/Python-Scripting-in-Blender/blob/main/ch5/addons/very_simple_panel.py#L122

I will be happy to check your script if you wish

regards, p.

coop101 commented 1 year ago

I'll get back to my other script later. Just for now, another concern. If you can write " bpy.data.objects['Cube'].select_set(True or False)". Why is it that you can't write "bpy.data.objects['Cube'].active_set(True or False) ". I understand that 'active' and 'select' are completely different aspects in Blender. Would it not make sense to have similar imports and translate the 'active_set' into language that works in Blender. This inconsistency does bother me! I suppose that I can rewrite the import to fit my logic when writing a script.