Skip to content

Commit

Permalink
Improved SceneInspector numeric formatting.
Browse files Browse the repository at this point in the history
It now matches the formatting performed by the NumericWidget.

Fixes #88.
  • Loading branch information
johnhaddon committed Apr 16, 2013
1 parent 36d96f2 commit 65727af
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 2 additions & 0 deletions Changes
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@

* Improved SceneInspector shader representation (#147).

* Improved SceneInspector numeric formatting (#88).

0.58.0
======

Expand Down
8 changes: 6 additions & 2 deletions python/GafferSceneUI/SceneInspector.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ def __formatMatrix( self, matrix ) :
for i in range( 0, 4 ) :
result += "<tr>"
for j in range( 0, 4 ) :
result += "<td>" + str( matrix[i,j] ) + "</td>"
result += "<td>" + self.__formatFloat( matrix[i,j] ) + "</td>"
result += "</tr>"
result += "</table>"

Expand All @@ -257,10 +257,14 @@ def __formatBox( self, box ) :
for v in ( box.min, box.max ) :
result += "<tr>"
for i in range( 0, 3 ) :
result += "<td>" + str( v[i] ) + "</td>"
result += "<td>" + self.__formatFloat( v[i] ) + "</td>"
result += "</tr>"
result += "</table>"

return result

def __formatFloat( self, value ) :

return ( "%.4f" % value ).rstrip( '0' ).rstrip( '.' )

GafferUI.EditorWidget.registerType( "SceneInspector", SceneInspector )

0 comments on commit 65727af

Please sign in to comment.