Preset name parsing issue in Property Editor --> Camera Tab --> Safe Areas Panel --> Camera Presets List #54029

Closed
opened 2018-02-08 15:39:26 +01:00 by zdy · 24 comments
Member

System Information
windows 10 pro and Quadro M4000M

Blender Version
Blender 2.79/2.78

Short description of error

Option Typo in Property Editor --> Camera Tab --> Safe Areas Panel --> Camera Presets List:

Item 3 in 16:9 should be 4:3 in 16:9. Snipaste_2018-02-09_15-07-44.png

Exact steps for others to reproduce the error
UI typo, no need of steps to reproduce it.

**System Information** windows 10 pro and Quadro M4000M **Blender Version** Blender 2.79/2.78 **Short description of error** Option Typo in `Property Editor --> Camera Tab --> Safe Areas Panel --> Camera Presets List`: Item `3 in 16:9` should be `4:3 in 16:9`. ![Snipaste_2018-02-09_15-07-44.png](https://archive.blender.org/developer/F2196446/Snipaste_2018-02-09_15-07-44.png) **Exact steps for others to reproduce the error** UI typo, no need of steps to reproduce it.
Author
Member

Added subscriber: @nge

Added subscriber: @nge

Added subscriber: @ideasman42

Added subscriber: @ideasman42

Please state full name of menu item, and full name you propose.

Please state full name of menu item, and full name you propose.
Author
Member

Sorry, I should've pasted the screenshot.
Image Added!

Sorry, I should've pasted the screenshot. Image Added!

Seems this is a drawing glitch, it displays correctly here.

Seems this is a drawing glitch, it displays correctly here.
Member

Added subscriber: @pablovazquez

Added subscriber: @pablovazquez
Member

Must be a glitch, it displays just fine here as well.

Tested in different interface sizes in 2.79 and 2.80.

Must be a glitch, it displays just fine here as well. Tested in different interface sizes in 2.79 and 2.80.
Member

Added subscriber: @xuekepei

Added subscriber: @xuekepei
Member

image.png in non-english system this will display like this.

![image.png](https://archive.blender.org/developer/F2198117/image.png) in non-english system this will display like this.

Added subscriber: @Leroy-Xie

Added subscriber: @Leroy-Xie

image.png

windows 10, 2.79

![image.png](https://archive.blender.org/developer/F2198209/image.png) windows 10, 2.79
Author
Member

I've confirmed this with several of my friends, with windows 7 and windows 10 platform, English and non-English version. It still display with 4: missing.

So, I guess it is a platform-related issue, and should be solved.

I've confirmed this with several of my friends, with windows 7 and windows 10 platform, English and non-English version. It still display with `4:` missing. So, I guess it is a platform-related issue, and should be solved.
Member

Added subscriber: @LazyDodo

Added subscriber: @LazyDodo
Member

I can confirm on windows

I can confirm on windows

Added subscriber: @VukGardasevic

Added subscriber: @VukGardasevic

Also confirming on Windows.
Seems that the patterns of some single digit number_colon_ gets stripped completely. This doesn't occur if there are two digits before the "colon" pattern.

Note: seems that the Camera Presets (in scripts\presets\camera\)uses the digit__colon (the _ are doubled) pattern name. If this is an parsing limitation issue maybe should be added as a note somewhere.

Also confirming on Windows. Seems that the patterns of some **single digit number_colon_** gets stripped completely. This doesn't occur if there are two digits before the "_colon_" pattern. Note: seems that the Camera Presets (in `scripts\presets\camera\`)uses the **digit__colon** (the _ are doubled) pattern name. If this is an parsing limitation issue maybe should be added as a note somewhere.
Vuk Gardašević changed title from Option Typo in `Property Editor --> Camera Tab --> Safe Areas Panel --> Camera Presets List` to Preset name parsing issue in `Property Editor --> Camera Tab --> Safe Areas Panel --> Camera Presets List` 2018-02-09 16:53:28 +01:00

Issue is from this code in bpy.types.py :

            props = layout.operator(
                operator,
                text=display_name(filepath) if display_name else bpy.path.display_name(f),
                translate=False,
            )

Seems that the bpy.path.display_name(f) truncates the f variable like in the described issue. Since f is the file name (2_colon_4_something.py), it shows up like it does currently. Passing the filepath which is the full path to the preset seems to work.

issue_with_preset_path_names.py.png

Issue is from this code in bpy.types.py : ``` props = layout.operator( operator, text=display_name(filepath) if display_name else bpy.path.display_name(f), translate=False, ) ``` Seems that the `bpy.path.display_name(f)` truncates the f variable like in the described issue. Since f is the file name (`2_colon_4_something.py`), it shows up like it does currently. Passing the `filepath` which is the full path to the preset seems to work. ![issue_with_preset_path_names.py.png](https://archive.blender.org/developer/F2200607/issue_with_preset_path_names.py.png)
Member

looks like _clean_utf8 in path.py is taking out what it thinks is the drive letter..

looks like _clean_utf8 in path.py is taking out what it thinks is the drive letter..

Added subscriber: @treybagley

Added subscriber: @treybagley

Hi! Just joined and this sounds like a good first project! I repro this on my machine. What direction do we want to fix this from? Should I change the filename from blender\release\scripts\presets\safe_areas\4_colon_3_in_16_colon_9.py to 4__colon__3__in__16__colon__9.py to match the formatting in scripts\preset\camera? Or do we want to change the parsing?

Hi! Just joined and this sounds like a good first project! I repro this on my machine. What direction do we want to fix this from? Should I change the filename from `blender\release\scripts\presets\safe_areas\4_colon_3_in_16_colon_9.py` to `4__colon__3__in__16__colon__9.py` to match the formatting in `scripts\preset\camera`? Or do we want to change the parsing?

Using double underscores should not be needed, somehow using a back-slash is messing up the logic here.

@VukGardasevic, Using "\scripts\presets\...." is not a valid test, since Python escapes those characters, if you want to test this use r"\scripts\presets\....".

Using double underscores should not be needed, somehow using a back-slash is messing up the logic here. @VukGardasevic, Using `"\scripts\presets\...."` is not a valid test, since Python escapes those characters, if you want to test this use `r"\scripts\presets\...."`.

Passing r to display name seems to work on windows with the regular "" path :)
The culprit seems to be the _clean_utf8(name) function and with name = _os.path.splitext(basename(name))- [x] call, and finally in the def basename(path) the call _os.path.basename(path_base) does trim the name.

>>> bpy.path.display_name("2_colon_4_something.py")

_clean_utf8 passed name parameter is 2:4 Something.Py
path_base in basename is 2:4 Something.Py
_os.path.basename(path_base) in basename is 4 Something.Py
_clean_utf8 _os.path.splitext name is 4 Something
'4 Something'

Sorry for the multiple edits. I've overlooked the basename function call.

Passing r to display name seems to work on windows with the regular "\" path :) The culprit seems to be the `_clean_utf8(name)` function and with *name = _os.path.splitext(basename(name))- [x] call*, and finally in the `def basename(path)` the call `_os.path.basename(path_base)` does trim the name. ``` >>> bpy.path.display_name("2_colon_4_something.py") _clean_utf8 passed name parameter is 2:4 Something.Py path_base in basename is 2:4 Something.Py _os.path.basename(path_base) in basename is 4 Something.Py _clean_utf8 _os.path.splitext name is 4 Something '4 Something' ``` Sorry for the multiple edits. I've overlooked the basename function call.

This issue was referenced by d416e56e70

This issue was referenced by d416e56e70cf08f0d9ce012df67dce2cb597589d

Changed status from 'Open' to: 'Resolved'

Changed status from 'Open' to: 'Resolved'
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
9 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#54029
No description provided.