RS ViewDisplayModeProperty : Transparency setting problem

Hi @Dale,

Seems like this one setting is misbehaving when trying to set from the script. All other material properties so far work well, but:

Call Rhino.ViewDisplayModeProperty(Rhino.ViewDisplayModeId("Ghosted"), "Shading\Material\Front Material\Transparency", 0.5)

Seems to only react to 0 or 100 (On/Off), other values have no effect over here.
All other properties in DisplayMode INI files take 0-100 values, Transparency is in 0-1 range, maybe that is the reason? I tried many combinations to try to get, say, 50%, but no luck

Any suggestions how to make this work?



@Jarek - what was the initial value of Transparency before your attempt to change?

– Dale

Hi @Dale,

The “Ghosted” mode UI reports “30” under “Shading Settings”.
When I run:

Rhino.Print Rhino.ViewDisplayModeProperty(Rhino.ViewDisplayModeId("Ghosted"), "Shading\Material\Front Material\Transparency")

the result is:

But here is another thing, which may be a bit more telling: the settings actually update, but the display would not reflect the change until an object is selected in the scene. Rotating the view does not help, or using Rhino.Redraw method. I actually ran into similar issue with a few other ViewDisplayMode settiings, but can’t pinpoint the pattern.

The only thing that I can force to make the update is restoring a NamedView and switching back and forth to another display mode via scripting, so I came up with this:

Private Sub RefreshDisplayMode()
	'refreshed imported display mode by creating temporary named view, restoring it, switchin viewport name and other display mode for panels to refresh
	Dim strCurrentMode : strCurrentMode = Rhino.ViewDisplayModeEx()
	Dim vName: vName = Rhino.CurrentView(): Call Rhino.AddNamedView("TMP") : Call Rhino.RestoreNamedView("TMP") : Call Rhino.DeleteNamedView("TMP")
	Rhino.EnableRedraw False
	Call Rhino.ViewDisplayMode(, 0)
	Call Rhino.ViewDisplayModeEx(, strCurrentMode) 
	Rhino.EnableRedraw True
	Call Rhino.Command("_-ViewportProperties _Title " & chr(34) & vName & chr(34) & " _Enter", False) 
End Sub

If I run that sub after making changes to display mode the transparency (and some other settings) would refresh. I also ran into a few cases (again, no pattern) where changes made to display modes in script runtime would revert back after the script ends.

So - it seems like something is off, somewhere, with the way the displaymode updates are handled by the scripting methods. Sorry about not being able to give you a precise step-by-step how to reproduce the issues; maybe from the above you can get some clues. Ideally we would not need to use the “namedviewrestore” hack to have the changes take place instantly.



Hi @Dale, can you see this refresh issue on your end?