Notifications
Clear all

[Closed] Misc info in the wieports

Howdy!

Since i’m working almost all the time in expert mode (i have a really small monitor) so i’m wondering do you know a script for displaying in the viewport whether ‘ignore backface’ is on or off? Or displaying the snap mode, scale mode and so on…

Regards
-g

2 Replies

Hi, i have this little thingy, it displays some information in the upper left corner of the viewport, under the viewport name.
it uses a redrawViewCallback for updating, so it might decrease performance, but i think it’s only noticeable while playing back an animation…

you can edit the script so it shows the information you want, it currently shows the selected object(s), transform mode, coordsys, snapmode and subobjectlevel, but you can add as many as you want, just look at the VP_Infos() function, that’s where the text is set up.

hope it helps!

--- ShowViewportStats
     ---
     --- Write specific information into the viewport
     
     
     struct VP_InfoText (textArray = #(), color = #())
     
    function write_VP_Text infoText =            --- write text into viewport
     (
         gw.resetUpdateRect()
         gw.setTransform(Matrix3 1)
     
         LineCount = infoText.textArray.count
         tSizeArray = #()
         for tl = 1 to LineCount do append tSizeArray (gw.GetTextExtent infoText.textArray[tl]).x
         maxX = amax tSizeArray
         ySize1 = (gw.GetTextExtent infoText.textArray[1]).y
         ySize = ySize1 * LineCount    
     
         theColor = black
         for tl = 1 to LineCount do 
         (
             if infoText.color[tl] != undefined then theColor = infoText.color[tl]
            gw.wText [5, 35 + (ySize1 * ( tl - 1)) - 3 ,0] infoText.textArray[tl] color:theColor
         )
         gw.enlargeUpdateRect #whole
         gw.updateScreen() 
     )
     
     
    function VP_Infos =                      --- setup text
     (
        newText = VP_InfoText()                 --- create new Text Object
         
         curObj = getCurrentSelection()
    if curObj.count != 0 do                 --- add selected Objects
         (
             objText = "Node: "
             for o=1 to curObj.count do objText = ObjText + curObj[o].name + ", "
             objText = subString objText 1 (objText.count - 2)
             append newText.textArray objText
             append newText.color black
         )
         
    cMode = toolMode.commandMode as String             --- add current Transform Mode
         append newText.textArray ("Transform: " + cMode)
         append newText.color black
         
    cCoord = (getRefCoordSys()) as string             --- add current CoordSys
         if cCoord == "hybrid" then cCoord = "view"
         append newText.textArray ("CoordSys: " + cCoord)
         append newText.color black
     
    if snapMode.active == true then                  --- add SnapMode
         (
             snapText = "Snapmode: " + (snapMode.type as string)
             append newText.textArray snaptext
             append newText.color black
         )
         
    if ((subobjectlevel != undefined) and (subobjectlevel != 0)) then        --- add Subobjectlevel
         (
             subText = "Subobject Level: " + (subobjectlevel as string)
             append newText.textArray subtext
             append newText.color black
         )
     
         write_VP_Text newText
     )
     
     rollout ro_ShowViewportStats "VP Stats"
     (
         checkbutton ui_start "Enable" pos:[5,5] width:70 height:20
         
         on ui_start changed state do
         (
             if state == true do
             (
                 registerRedrawViewsCallBack VP_Infos
                 redrawViews()
                 ui_start.caption = "Disable"
             )
             
             if state == false do
             (
                 unregisterRedrawViewsCallBack VP_Infos
                 gw.enlargeUpdateRect #whole
                 gw.updateScreen() 
                 redrawViews()
                 ui_start.caption = "Enable"
             )
         )
         
         on ro_ShowViewportStats close do 
         (
             unregisterRedrawViewsCallBack VP_Infos 
             gc()
         )
     )
     
     createDialog ro_ShowViewportStats width:80 height:30 style:#(#style_toolwindow, #style_sysmenu)

Thank you, Cthulhu!

I’ll try to modify the script and if i succeed i’ll post it here.

Thanka again.