Contradictory labels in UI. Naming of boolean properties sometimes positive, sometimes negative. #67403

Open
opened 2019-07-21 20:55:15 +02:00 by Nicolas Antille · 9 comments

System Information
Operating system: Any
Graphics card: Any

Blender Version
Broken:
Blender 2.80.74 aka rc2

Short description of error
Inconsistency in naming leads to contradictory info.

Exact steps for others to reproduce the error

  • Open Blender
  • Select an object on the scene (add one if you have nothing...)
  • Go to Object properties panel
  • Scroll down to Visibility
  • Hover "Show in Renders"
  • A pop-up info label reads "Globally disable in renders", so now you're not sure what happens if you check the box
  • Check the box
  • Open the Info Editor, the last line will read "bpy.context.object.hide_render = True"

So now we have three different nomenclatures for the same thing. Two that are contradictory within the UI and one that is the opposite naming of what's in the UI.

Instead of having properties named "show_name" and some others "hide_viewport", all such boolean properties could be named "show_function" or "enable_function" so that you don't have to negate the negation as in hide_viewport = False

Since Blender 2.8 is a breaking release, it is the time when you can implement coherent naming. After that, it's going to be much more difficult.

Of course that's by far not a priority since it doesn't break Blender.

**System Information** Operating system: Any Graphics card: Any **Blender Version** Broken: Blender 2.80.74 aka rc2 **Short description of error** Inconsistency in naming leads to contradictory info. **Exact steps for others to reproduce the error** - Open Blender - Select an object on the scene (add one if you have nothing...) - Go to Object properties panel - Scroll down to Visibility - Hover "Show in Renders" - A pop-up info label reads "Globally disable in renders", so now you're not sure what happens if you check the box - Check the box - Open the Info Editor, the last line will read "bpy.context.object.hide_render = True" So now we have three different nomenclatures for the same thing. Two that are contradictory within the UI and one that is the opposite naming of what's in the UI. Instead of having properties named "show_name" and some others "hide_viewport", all such boolean properties could be named "show_function" or "enable_function" so that you don't have to negate the negation as in hide_viewport = False Since Blender 2.8 is a breaking release, it is the time when you can implement coherent naming. After that, it's going to be much more difficult. Of course that's by far not a priority since it doesn't break Blender.

Added subscriber: @nantille

Added subscriber: @nantille
Member

Added subscribers: @WilliamReynish, @JacquesLucke

Added subscribers: @WilliamReynish, @JacquesLucke
Member

The RNA name is not that important here, but I see the issue with the description saying the opposite than what the checkbox does.
This is because the code for that property is col.prop(ob, "hide_render", text="Show in Renders", toggle=False, invert_checkbox=True). See the invert_checkbox in the end. However, the tooltip is not inverted.

Confirming as low priority. Maybe @WilliamReynish has an opinion on this, but this issue is just not that important....

The RNA name is not that important here, but I see the issue with the description saying the opposite than what the checkbox does. This is because the code for that property is `col.prop(ob, "hide_render", text="Show in Renders", toggle=False, invert_checkbox=True)`. See the `invert_checkbox` in the end. However, the tooltip is not inverted. Confirming as low priority. Maybe @WilliamReynish has an opinion on this, but this issue is just not that important....

We should try and never use double negatives.

Therefore we should not have negative booleans such as 'Dont do X'

We should try and never use double negatives. Therefore we should **not** have negative booleans such as 'Dont do X'

@WilliamReynish Exactly my point. I will let you lobby from within so that developers keep that mind. ;)
"hide_render" and "hide_viewport" are 2.8 properties so even as we speak, core devs are not aligned on this usability view. The next stage is probably "unhide_render" followed by "dont_unhide_render". Joking.

I wouldn't have talked about this if I didn't see some effort in UI/UX for 2.8. Keep up the good work on Blender!

@WilliamReynish Exactly my point. I will let you lobby from within so that developers keep that mind. ;) "hide_render" and "hide_viewport" are 2.8 properties so even as we speak, core devs are not aligned on this usability view. The next stage is probably "unhide_render" followed by "dont_unhide_render". Joking. I wouldn't have talked about this if I didn't see some effort in UI/UX for 2.8. Keep up the good work on Blender!

What you see here, is that the UI layer has inverted the checkbox so it isn't a double negative, which is good.

But in the code it's confusing because it's essentially a tripple-negative.

What you see here, is that the UI layer has inverted the checkbox so it isn't a double negative, which is good. But in the code it's confusing because it's essentially a tripple-negative.
Member

Added subscriber: @JulianEisel

Added subscriber: @JulianEisel
Member

This is a bit of an awkward situation. We can't just change the RNA definition, because that would be an API breaking change. I'd expect that many add-ons and scripts use these properties. One thing we could do is making the tooltip text more general, so that it doesn't describe a specific enabled/disabled state. But I personally find it hard to come up with a good description that follows our usual tooltip language, am open for proposals though :)

Another thing we can do is wrapping the RNA properties with (runtime-only?) properties. E.g. we can do this in Python: P1242: Possible fix for #67403

diff --git a/release/scripts/startup/bl_ui/properties_object.py b/release/scripts/startup/bl_ui/properties_object.py
index bb020084b03..17e4c67a671 100644
--- a/release/scripts/startup/bl_ui/properties_object.py
+++ b/release/scripts/startup/bl_ui/properties_object.py
@@ -23,6 +23,7 @@ from bl_ui.properties_animviz import (
 )
 import bpy
 from bpy.types import Panel, Menu
+from bpy.props import BoolProperty
 from rna_prop_ui import PropertyPanel
 
 
@@ -371,6 +372,27 @@ class OBJECT_PT_motion_paths_display(MotionPathButtonsPanel_display, Panel):
 
         self.draw_settings(context, avs, mpath)
 
+bpy.types.Object.is_visible_viewport = BoolProperty(
+    name="Show in Viewports",
+    description="Enable object to be visible in the viewport",
+    set=lambda object, value: setattr(object, "hide_viewport", not value),
+    get=lambda object: not object.hide_viewport,
+    options={'SKIP_SAVE'},
+    )
+bpy.types.Object.is_visible_render = BoolProperty(
+    name="Show in Renders",
+    description="Enable object to be visible in a render",
+    set=lambda object, value: setattr(object, "hide_render", not value),
+    get=lambda object: not object.hide_render,
+    options={'SKIP_SAVE'},
+    )
+bpy.types.Object.is_selectable = BoolProperty(
+    name="Selectable",
+    description="Enable object to be considered on selection operations",
+    set=lambda object, value: setattr(object, "hide_select", not value),
+    get=lambda object: not object.hide_select,
+    options={'SKIP_SAVE'},
+    )
 
 class OBJECT_PT_visibility(ObjectButtonsPanel, Panel):
     bl_label = "Visibility"
@@ -390,11 +412,11 @@ class OBJECT_PT_visibility(ObjectButtonsPanel, Panel):
         ob = context.object
 
         col = flow.column()
-        col.prop(ob, "hide_viewport", text="Show in Viewports", toggle=False, invert_checkbox=True)
+        col.prop(ob, "is_visible_viewport", toggle=False)
         col = flow.column()
-        col.prop(ob, "hide_render", text="Show in Renders", toggle=False, invert_checkbox=True)
+        col.prop(ob, "is_visible_render", toggle=False)
         col = flow.column()
-        col.prop(ob, "hide_select", text="Selectable", toggle=False, invert_checkbox=True)
+        col.prop(ob, "is_selectable", toggle=False)
 
 
 class OBJECT_PT_custom_props(ObjectButtonsPanel, PropertyPanel, Panel):

(The properties shouldn't use the is_ prefix, ignore that.)

This is a bit of an awkward situation. We can't just change the RNA definition, because that would be an API breaking change. I'd expect that many add-ons and scripts use these properties. One thing we could do is making the tooltip text more general, so that it doesn't describe a specific enabled/disabled state. But I personally find it hard to come up with a good description that follows our usual tooltip language, am open for proposals though :) Another thing we can do is wrapping the RNA properties with (runtime-only?) properties. E.g. we can do this in Python: [P1242: Possible fix for #67403](https://archive.blender.org/developer/P1242.txt) ``` diff --git a/release/scripts/startup/bl_ui/properties_object.py b/release/scripts/startup/bl_ui/properties_object.py index bb020084b03..17e4c67a671 100644 --- a/release/scripts/startup/bl_ui/properties_object.py +++ b/release/scripts/startup/bl_ui/properties_object.py @@ -23,6 +23,7 @@ from bl_ui.properties_animviz import ( ) import bpy from bpy.types import Panel, Menu +from bpy.props import BoolProperty from rna_prop_ui import PropertyPanel @@ -371,6 +372,27 @@ class OBJECT_PT_motion_paths_display(MotionPathButtonsPanel_display, Panel): self.draw_settings(context, avs, mpath) +bpy.types.Object.is_visible_viewport = BoolProperty( + name="Show in Viewports", + description="Enable object to be visible in the viewport", + set=lambda object, value: setattr(object, "hide_viewport", not value), + get=lambda object: not object.hide_viewport, + options={'SKIP_SAVE'}, + ) +bpy.types.Object.is_visible_render = BoolProperty( + name="Show in Renders", + description="Enable object to be visible in a render", + set=lambda object, value: setattr(object, "hide_render", not value), + get=lambda object: not object.hide_render, + options={'SKIP_SAVE'}, + ) +bpy.types.Object.is_selectable = BoolProperty( + name="Selectable", + description="Enable object to be considered on selection operations", + set=lambda object, value: setattr(object, "hide_select", not value), + get=lambda object: not object.hide_select, + options={'SKIP_SAVE'}, + ) class OBJECT_PT_visibility(ObjectButtonsPanel, Panel): bl_label = "Visibility" @@ -390,11 +412,11 @@ class OBJECT_PT_visibility(ObjectButtonsPanel, Panel): ob = context.object col = flow.column() - col.prop(ob, "hide_viewport", text="Show in Viewports", toggle=False, invert_checkbox=True) + col.prop(ob, "is_visible_viewport", toggle=False) col = flow.column() - col.prop(ob, "hide_render", text="Show in Renders", toggle=False, invert_checkbox=True) + col.prop(ob, "is_visible_render", toggle=False) col = flow.column() - col.prop(ob, "hide_select", text="Selectable", toggle=False, invert_checkbox=True) + col.prop(ob, "is_selectable", toggle=False) class OBJECT_PT_custom_props(ObjectButtonsPanel, PropertyPanel, Panel): ``` (The properties shouldn't use the `is_` prefix, ignore that.)
Member

Added subscriber: @Imaginer

Added subscriber: @Imaginer
Philipp Oeser removed the
Interest
User Interface
label 2023-02-10 09:25:29 +01:00
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
5 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#67403
No description provided.