Fix poor display of time codes in sequencer Info panel
authorMal Duffin <mal_cando>
Mon, 27 May 2019 11:05:27 +0000 (13:05 +0200)
committerBrecht Van Lommel <brechtvanlommel@gmail.com>
Mon, 27 May 2019 11:31:27 +0000 (13:31 +0200)
Allow using : in labels inside buttons.

Differential Revision: https://developer.blender.org/D4944

release/scripts/startup/bl_ui/space_sequencer.py
source/blender/editors/interface/interface_widgets.c

index dae7c13082f347a4cfda8a8f0677430f99e149e6..62ae500d3a0b3044a5d010467cc27ec8fd567e5a 100644 (file)
@@ -1320,15 +1320,15 @@ class SEQUENCER_PT_info_timecodes(SequencerButtonsPanel, Panel):
         split = sub.split(factor=0.5 + max_factor)
         split.alignment = 'RIGHT'
         split.label(text="Start")
-        split.prop(strip, "frame_start", text=str(bpy.utils.smpte_from_frame(strip.frame_start)).replace(':', ' '))
+        split.prop(strip, "frame_start", text=str(bpy.utils.smpte_from_frame(strip.frame_start)))
         split = sub.split(factor=0.5 + max_factor)
         split.alignment = 'RIGHT'
         split.label(text="End")
-        split.prop(strip, "frame_final_end", text=str(bpy.utils.smpte_from_frame(strip.frame_final_end)).replace(':', ' '))
+        split.prop(strip, "frame_final_end", text=str(bpy.utils.smpte_from_frame(strip.frame_final_end)))
         split = sub.split(factor=0.5 + max_factor)
         split.alignment = 'RIGHT'
         split.label(text="Duration")
-        split.prop(strip, "frame_final_duration", text=str(bpy.utils.smpte_from_frame(strip.frame_final_duration)).replace(':', ' '))
+        split.prop(strip, "frame_final_duration", text=str(bpy.utils.smpte_from_frame(strip.frame_final_duration)))
 
         if not isinstance(strip, bpy.types.EffectSequence):
             layout.alignment = 'RIGHT'
@@ -1336,22 +1336,22 @@ class SEQUENCER_PT_info_timecodes(SequencerButtonsPanel, Panel):
             split = sub.split(factor=0.5 + max_factor, align=True)
             split.alignment = 'RIGHT'
             split.label(text="Soft Trim Start")
-            split.prop(strip, "frame_offset_start", text=str(bpy.utils.smpte_from_frame(strip.frame_offset_start)).replace(':', ' '))
+            split.prop(strip, "frame_offset_start", text=str(bpy.utils.smpte_from_frame(strip.frame_offset_start)))
             split = sub.split(factor=0.5 + max_factor, align=True)
             split.alignment = 'RIGHT'
             split.label(text='End')
-            split.prop(strip, "frame_offset_end", text=str(bpy.utils.smpte_from_frame(strip.frame_offset_end)).replace(':', ' '))
+            split.prop(strip, "frame_offset_end", text=str(bpy.utils.smpte_from_frame(strip.frame_offset_end)))
 
             layout.alignment = 'RIGHT'
             sub = layout.column(align=True)
             split = sub.split(factor=0.5 + max_factor)
             split.alignment = 'RIGHT'
             split.label(text="Hard Trim Start")
-            split.prop(strip, "animation_offset_start", text=str(bpy.utils.smpte_from_frame(strip.animation_offset_start)).replace(':', ' '))
+            split.prop(strip, "animation_offset_start", text=str(bpy.utils.smpte_from_frame(strip.animation_offset_start)))
             split = sub.split(factor=0.5 + max_factor, align=True)
             split.alignment = 'RIGHT'
             split.label(text='End')
-            split.prop(strip, "animation_offset_end", text=str(bpy.utils.smpte_from_frame(strip.animation_offset_end)).replace(':', ' '))
+            split.prop(strip, "animation_offset_end", text=str(bpy.utils.smpte_from_frame(strip.animation_offset_end)))
 
         playhead = frame_current - strip.frame_start
         col = layout.column(align=True)
@@ -1363,7 +1363,7 @@ class SEQUENCER_PT_info_timecodes(SequencerButtonsPanel, Panel):
         split = col.split(factor=0.5 + max_factor)
         split.alignment = 'RIGHT'
         split.label(text="Playhead")
-        split.label(text="%s:   %s" % ((bpy.utils.smpte_from_frame(playhead).replace(':', ' ')), (str(playhead))))
+        split.label(text="%s:   %s" % ((bpy.utils.smpte_from_frame(playhead)), (str(playhead))))
 
         ''' Old data - anyone missing this data?
         col.label(text=iface_("Frame Offset %d:%d") % (strip.frame_offset_start, strip.frame_offset_end),
index e31646f9fdb0919a522035490d091ebc0e3f191d..e9de703db35472784c5156ef6579ceafa37d84c2 100644 (file)
@@ -2185,7 +2185,7 @@ static void widget_draw_text(const uiFontStyle *fstyle,
       ELEM(but->type, UI_BTYPE_NUM, UI_BTYPE_NUM_SLIDER) &&
       /* if we're editing or multi-drag (fake editing), then use left alignment */
       (but->editstr == NULL) && (drawstr == but->drawstr)) {
-    drawstr_right = strchr(drawstr + but->ofs, ':');
+    drawstr_right = strrchr(drawstr + but->ofs, ':');
     if (drawstr_right) {
       drawstr_right++;
       drawstr_left_len = (drawstr_right - drawstr);