Fix #107009: Setting Text Object Styles #107048
No reviewers
Labels
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
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#107048
Loading…
Reference in New Issue
No description provided.
Delete Branch "Harley/blender:CurveStyles"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
This allows toggling of text styles of selected text and at the current
mouse cursor position if nothing is selected.
Investigating this bug report and examining the code of GSoC student Yash Dabhade (yashdabhade), I think this PR is all we actually need for text style changes to work in a more logical way.
The current issue is that we have buttons that reliably show if the character at the cursor position is bold, italics, etc. However clicking these buttons doesn't do what users would expect, as they don't change the style of any selected text. They only change the style flags at the mouse position so any new text entered will use that style. We also have a "Text" menu with items to "Toggle Bold", etc. However these only work on the selected text and will NOT change the style for new text added. So we have two very different style-changing options that work in unexpected ways. This PR just makes them both work the same.
So for the text menu items, if anything is selected it will continue to work as today. But if nothing it selected it won't just error out but will instead set that style for following text:
For the text style buttons, they show the same information as now, but clicking them will change the style for following text if nothing is selected. But if anything is selected it will change it:
While this is an improvement on the current state, the buttons can take the selected state into account (so a selection with mixed state doesn't show as bold) - this is how most word processors work.
The original patch from yashdabhade implemented this and I think it's worth following this logic.
As a intermediate change this seems OK, but I think it would be best to implement style buttons that follow the entire selection.
Fix #107009: Setting Text Object Stylesto WIP: Fix #107009: Setting Text Object Styles@ideasman42 - Now properly showing the combined styles of the selected text. Will only consider a portion as bold if every character is bold, etc.
@ -368,3 +366,1 @@
row.prop(char, "use_italic", toggle=True)
row.prop(char, "use_underline", toggle=True)
row.prop(char, "use_small_caps", toggle=True)
if text.is_selected == False :
if not text.is_selected:
...@ -44,1 +44,4 @@
/* Combined styles (#CharInfo.flag) for selected string. A flag will be
* set only if ALL characters in the selected string have it. */
int selected_flag;
Prefer this includes the term char_info or style, e.g.
select_char_info_flag
@ -1144,0 +1145,4 @@
* remove one if ANY characters do not have it. Break out if we've removed them all. */
ef->selected_flag = CU_CHINFO_BOLD | CU_CHINFO_ITALIC | CU_CHINFO_UNDERLINE |
CU_CHINFO_SMALLCAPS;
for (int k = selstart; k <= selend && ef->selected_flag; k++) {
Checking each flag isn't needed.
ef->selected_flag &= info->flag;
masks out flags as intended.@ -838,6 +838,15 @@ static bool rna_Curve_is_editmode_get(PointerRNA *ptr)
}
}
static bool rna_Curve_is_selected(PointerRNA *ptr)
The name is misleading,
rna_TextCurve_has_selection
(RNA terms this aTextCurve
).@ -1275,0 +1302,4 @@
RNA_def_property_ui_text(prop, "Selected Smallcaps", "Whether the selected text is small caps");
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
prop = RNA_def_property(srna, "is_selected", PROP_BOOLEAN, PROP_NONE);
Prefer
has_selection
asis_selected
makes it seem it might be the object selection.WIP: Fix #107009: Setting Text Object Stylesto Fix #107009: Setting Text Object StylesApproving with minor request.
@ -1273,2 +1282,4 @@
RNA_def_property_ui_text(prop, "Fast Editing", "Don't fill polygons while editing");
RNA_def_property_update(prop, 0, "rna_Curve_update_data");
prop = RNA_def_property(srna, "select_is_underline", PROP_BOOLEAN, PROP_NONE);
Generally
is_/has_
... etc are prefixes.is_select_bold
... etc.@blender-bot build