Fix #112650: UI: Missing Header Status in Node Editor after Turning off Auto-offset #112657

Merged
Pratik Borhade merged 4 commits from PratikPB2123/blender:112650-node-auto-offset into main 2023-09-23 12:37:37 +02:00
Member

Caused by 42f8b49581
When auto-offset is OFF, garbage characters was displayed due to
uninitialized string.
To fix this, create an empty string and also display status that auto offset is OFF

Caused by 42f8b495815c95211ebd969283ea2bf47fa7c720 When auto-offset is OFF, garbage characters was displayed due to uninitialized string. To fix this, create an empty string and also display status that `auto offset` is OFF
Pratik Borhade added 1 commit 2023-09-21 10:43:49 +02:00
1dd83db21c Fix #112650: UI: Missing Header Status in Node Editor after Turning off Auto-offset
When auto-offset is OFF, garbage characters was displayed due to
uninitialized string.
To fix this, create an empty string and also display status that `auto
offset` is OFF
Pratik Borhade requested review from Leon Schittek 2023-09-21 10:44:15 +02:00
Leon Schittek added 1 commit 2023-09-21 13:03:21 +02:00
Member

Thanks for the fix!

It works well, but I'm not sure about always showing "Auto-offset direction: OFF" in the header.
Now that this is a preference It feels weird to always remind people of something they deliberately turned off - especially since they can't actually enable it while the message is shown.

How about something like this:

diff --git a/source/blender/editors/transform/transform_mode_translate.cc b/source/blender/editors/transform/transform_mode_translate.cc
index c9deb98579a..e33c395f0ef 100644
--- a/source/blender/editors/transform/transform_mode_translate.cc
+++ b/source/blender/editors/transform/transform_mode_translate.cc
@@ -564,7 +564,7 @@ static bool clip_uv_transform_translation(TransInfo *t, float vec[2])

 static void applyTranslation(TransInfo *t)
 {
-  char str[UI_MAX_DRAW_STR];
+  char str[UI_MAX_DRAW_STR] = "";
   float global_dir[3] = {0.0f};

   if (t->flag & T_INPUT_IS_VALUES_FINAL) {
@@ -640,7 +640,7 @@ static void applyTranslation(TransInfo *t)
   headerTranslation(t, (t->con.mode & CON_APPLY) ? t->values_final : global_dir, str);

   recalc_data(t);
-  ED_area_status_text(t->area, str);
+  ED_area_status_text(t->area, (str[0] == '\0') ? nullptr : str);
 }

That way we don't get a status text at all, when there is no information to show.

(Also sorry for the random merge earlier. I accidentally clicked that button when looking at this on my phone :') )

Thanks for the fix! It works well, but I'm not sure about always showing "Auto-offset direction: OFF" in the header. Now that this is a preference It feels weird to always remind people of something they deliberately turned off - especially since they can't actually enable it while the message is shown. How about something like this: ```diff diff --git a/source/blender/editors/transform/transform_mode_translate.cc b/source/blender/editors/transform/transform_mode_translate.cc index c9deb98579a..e33c395f0ef 100644 --- a/source/blender/editors/transform/transform_mode_translate.cc +++ b/source/blender/editors/transform/transform_mode_translate.cc @@ -564,7 +564,7 @@ static bool clip_uv_transform_translation(TransInfo *t, float vec[2]) static void applyTranslation(TransInfo *t) { - char str[UI_MAX_DRAW_STR]; + char str[UI_MAX_DRAW_STR] = ""; float global_dir[3] = {0.0f}; if (t->flag & T_INPUT_IS_VALUES_FINAL) { @@ -640,7 +640,7 @@ static void applyTranslation(TransInfo *t) headerTranslation(t, (t->con.mode & CON_APPLY) ? t->values_final : global_dir, str); recalc_data(t); - ED_area_status_text(t->area, str); + ED_area_status_text(t->area, (str[0] == '\0') ? nullptr : str); } ``` That way we don't get a status text at all, when there is no information to show. (Also sorry for the random merge earlier. I accidentally clicked that button when looking at this on my phone :') )
Pratik Borhade added 2 commits 2023-09-22 11:28:50 +02:00
Leon Schittek approved these changes 2023-09-22 15:14:56 +02:00
Leon Schittek left a comment
Member

Tested it some more and looks good to me. Thanks!

Tested it some more and looks good to me. Thanks!
Leon Schittek added this to the User Interface project 2023-09-22 15:15:41 +02:00
Leon Schittek added the
Interest
Nodes & Physics
label 2023-09-22 15:16:02 +02:00
Pratik Borhade merged commit 90f22739f7 into main 2023-09-23 12:37:37 +02:00
Pratik Borhade deleted branch 112650-node-auto-offset 2023-09-23 12:37:38 +02:00
Author
Member

Merged, thanks for reviewing :)

Merged, thanks for reviewing :)
Sign in to join this conversation.
No reviewers
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
2 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#112657
No description provided.