[Closed] DotNet Button Optimisation
Hi All,
I am currently working on a UI for animators.
I am not a maxScript expert, and i try to use DotNet.
I create UI with few DotNetButton (something like 30), and for each one i Load an “image” and “BackgroundImage” (only wait i found to fake transparency).
But the loading is too long, to be used in production…
The loading of images is the parameters that take too much time. So i would like to load an image (for all the background UI, on a bitmap) where i render all the buttons…and the buttons will be transparent, and they wil load images only if user go on…
But I don’t find how to make a button fully transparent…If i try to make “.visible =false”, the button state off even if i “mousehover”…same for the “enabled” options. I try to put the “foreColor” and “backColor” to “Empty” or “Transparent”…but the button is gray and not transparent…so i cannot see through , and so see the backgroud image loader on an “bitmap”.
I imagine that it is a simple things to do, but there is too much options in the DotNetButton, i am lost. ^^
thanksForYourHelp
Alex
code would be something like this (but for 30 buttons):
“
global rlSelectionSubRollout2
rollout rlSelectionSubRollout2 “selection” width:540 height:350
(
local vImgBg = (openBitMap @”…imgBg.png”)
local vDotnetImage = (dotNetclass “System.Drawing.image”)
function fSelectNode vType vModel vButtonName=
(
--vType="CH"
--vModel ="kael001_001"
--vButtonName = "dnBt_world"
vFilterModel = filterString vModel "_"
vModelName = vFilterModel[1]
vModelIncr= vFilterModel[vFilterModel.count]
vFilterButtonName = filterString vButtonName "_"
if vFilterButtonName.count >2
then
(
vDescriptionName = vFilterButtonName[2]
for n=3 to vFilterButtonName.count do
(
vDescriptionName = vDescriptionName+"_"+vFilterButtonName[n]
)
)
else
(
vDescriptionName = vFilterButtonName[vFilterButtonName.count]
)
vNodeToSelect = execute ("$"+vType+"_ROOT..."+vModelName+"_A_"+vDescriptionName+"_"+vModelIncr)
if vNodeToSelect.count==1
then
(
if keyboard.controlPressed==true
then
(
selectMore vNodeToSelect
)
else if keyboard.altPressed ==true
then
(
deselect vNodeToSelect
)
else
(
select vNodeToSelect
)
)
)
bitmap itgBackImage "" bitmap:vImgBg align:#center visible:true
dotNetControl dnBt_world "System.Windows.Forms.Button" align:#center width:149 height:12 offset:[(0+0),(-32+0)]
dotNetControl dnBt_walk "System.Windows.Forms.Button" align:#center width:105 height:12 offset:[(0+0),(-28+0)]
dotNetControl dnBt_scaleAll "System.Windows.Forms.Button" align:#center width:23 height:19 offset:[(-100+0),(-12+0)]
on rlSelectionSubRollout2 open do
(
dnBt_world.name = "dnBt_world"
dnBt_world.BackColor = (dotNetClass "System.Drawing.Color").Transparent
dnBt_world.ForeColor = (dotNetClass "System.Drawing.Color").Transparent
dnBt_world.FlatStyle = Flat
dnBt_world.FlatAppearance.BorderSize = 0
dnBt_walk.name = "dnBt_walk"
dnBt_walk.BackColor = (dotNetClass "System.Drawing.Color").Transparent
dnBt_walk.ForeColor = (dotNetClass "System.Drawing.Color").Transparent
dnBt_walk.FlatStyle = Flat
dnBt_walk.FlatAppearance.BorderSize = 0
dnBt_scaleAll.name = "dnBt_scaleAll"
dnBt_scaleAll.BackColor = (dotNetClass "System.Drawing.Color").Transparent
dnBt_scaleAll.ForeColor = (dotNetClass "System.Drawing.Color").Transparent
dnBt_scaleAll.FlatStyle = Flat
dnBt_scaleAll.FlatAppearance.BorderSize = 0
)
on dnBt_world MouseHover arg do
(
try(dnBt_world.image = (vDotnetImage.fromfile (vImgBasePath+"btworldOver.png")))catch()
try(dnBt_world.BackgroundImage = (vDotnetImage.fromfile (vImgBasePath+"imgBgColor.png")))catch()
)
on dnBt_world MouseLeave arg do
(
try(dnBt_world.image = (vDotnetImage.fromfile (vImgBasePath+"btworld.png")))catch()
try(dnBt_world.BackgroundImage = (vDotnetImage.fromfile (vImgBasePath+"imgBgColor.png")))catch()
)
on dnBt_world click arg do
(
fSelectNode rlCubeAnimationTool.ddltChModelTypeList.selected rlCubeAnimationTool.ddltChModelList.selected dnBt_world.Name
)
on dnBt_walk MouseHover arg do
(
try(dnBt_walk.image = (vDotnetImage.fromfile (vImgBasePath+"btwalkOver.png")))catch()
try(dnBt_walk.BackgroundImage = (vDotnetImage.fromfile (vImgBasePath+"imgBgColor.png")))catch()
)
on dnBt_walk MouseLeave arg do
(
try(dnBt_walk.image = (vDotnetImage.fromfile (vImgBasePath+"btwalk.png")))catch()
try(dnBt_walk.BackgroundImage = (vDotnetImage.fromfile (vImgBasePath+"imgBgColor.png")))catch()
)
on dnBt_walk click arg do
(
fSelectNode rlCubeAnimationTool.ddltChModelTypeList.selected rlCubeAnimationTool.ddltChModelList.selected dnBt_walk.Name
)
on dnBt_scaleAll MouseHover arg do
(
try(dnBt_scaleAll.image = (vDotnetImage.fromfile (vImgBasePath+"btscaleAllOver.png")))catch()
try(dnBt_scaleAll.BackgroundImage = (vDotnetImage.fromfile (vImgBasePath+"imgBgColor.png")))catch()
)
on dnBt_scaleAll MouseLeave arg do
(
try(dnBt_scaleAll.image = (vDotnetImage.fromfile (vImgBasePath+"btscaleAll.png")))catch()
try(dnBt_scaleAll.BackgroundImage = (vDotnetImage.fromfile (vImgBasePath+"imgBgColor.png")))catch()
)
on dnBt_scaleAll click arg do
(
fSelectNode rlCubeAnimationTool.ddltChModelTypeList.selected rlCubeAnimationTool.ddltChModelList.selected dnBt_scaleAll.Name
)
)
createDialog rlSelectionSubRollout2
“