Chaos Corona Forum
Chaos Corona for 3ds Max => [Max] I need help! => Topic started by: UsmanS on 2025-10-02, 04:20:48
-
Is it possible to have a script or an option inside the corona proxy to display as full mesh when selected ?
-
You could do something like this (not auto selection but I would probably advise against it due to the size of some objects and accidental selections):
fn CProxyViz =
(
for obj in selection do
(
if classof obj == CProxy then
(
if obj.previzType == 2 then obj.previzType = 3 else obj.previzType = 2
)
)
)
try(cui.UnRegisterDialogBar CoronaProxyViz)catch()
try(DestroyDialog CoronaProxyViz)catch()
rollout CoronaProxyViz("CoronaProxyViz")
(
button btn_proxy "Display"
on btn_proxy pressed do CProxyViz()
)
CreateDialog CoronaProxyViz
cui.RegisterDialogBar CoronaProxyViz
If you rather something other than point cloud then change previzType 2 to 0 or 1
Caveat with above is that if you have a mixed selection it will just turn mesh to point cloud and visa versa. Or you can just have 2 buttons instead:
fn CProxyViz isMesh =
(
for obj in selection do
(
if classof obj == CProxy then
(
if isMesh then obj.previzType = 3 else obj.previzType = 2
)
)
)
try(cui.UnRegisterDialogBar CoronaProxyViz)catch()
try(DestroyDialog CoronaProxyViz)catch()
rollout CoronaProxyViz("CoronaProxyViz")
(
button btn_proxy1 "Point Cloud"
button btn_proxy2 "Full Mesh"
on btn_proxy1 pressed do CProxyViz false
on btn_proxy2 pressed do CProxyViz true
)
CreateDialog CoronaProxyViz
cui.RegisterDialogBar CoronaProxyViz
Probably not much different than the Unified Lister but could be handy for quick selections.
-
Actually I gave chatgpt this code and asked it to rewrite it using a callback, seems to do what u want but cant guarantee it (and keeps original display eg. box/point cloud/etc.).
Seems to have some error with deselection, ill take a look when i get time but keeps working even with the error. I noticed it does some things that need fixing, keep you posted. Ok should be fine now, take note when you enable/disable it will deselect everything so just do your selections after toggling the button.
Note: One thing I noticed is that if you duplicate the selected objects while enabled all those objects will remain in mesh display mode permanently.
global CPV_previzStore = #()
global CPV_callbackActive = false
global CoronaProxyVizEnabled = false
fn CPV_restorePreviz objs =
(
for obj in objs where isValidNode obj and classof obj == CProxy do
(
local storedObjs = for e in CPV_previzStore collect e[1]
local idx = findItem storedObjs obj
if (idx > 0 and idx <= CPV_previzStore.count) do
(
obj.previzType = CPV_previzStore[idx][2]
)
)
)
fn CPV_callbackFn =
(
local curSel = selection as array
local storedObjs = for e in CPV_previzStore collect e[1]
-- restore deselected objects
for sObj in storedObjs where (not isDeleted sObj and findItem curSel sObj == 0) do
(
CPV_restorePreviz #(sObj)
local i = findItem (for e in CPV_previzStore collect e[1]) sObj
if i > 0 do deleteItem CPV_previzStore i
)
-- process new selection
for obj in curSel where isValidNode obj and classof obj == CProxy do
(
if (findItem storedObjs obj) == 0 do
(
append CPV_previzStore #(obj, obj.previzType)
obj.previzType = 3 -- show full mesh
)
)
)
fn CPV_toggleCallback =
(
if CPV_callbackActive then
(
callbacks.removeScripts id:#CPV_selChanged
CPV_callbackActive = false
CoronaProxyVizEnabled = false
)
else
(
callbacks.addScript #selectionSetChanged "CPV_callbackFn()" id:#CPV_selChanged
CPV_callbackActive = true
CoronaProxyVizEnabled = true
)
)
try(cui.UnRegisterDialogBar CoronaProxyViz)catch()
try(DestroyDialog CoronaProxyViz)catch()
rollout CoronaProxyViz("CoronaProxyViz")
(
button btn_proxy "CoronaProxyViz Disabled" width:140
on btn_proxy pressed do
(
clearSelection()
CPV_toggleCallback()
if CoronaProxyVizEnabled then btn_proxy.text = "CoronaProxyViz Enabled" else btn_proxy.text = "CoronaProxyViz Disabled"
)
on CoronaProxyViz close do
(
callbacks.removeScripts id:#CPV_selChanged
CPV_callbackActive = false
CPV_previzStore = #()
CoronaProxyVizEnabled = false
)
)
CreateDialog CoronaProxyViz style:#(#style_titlebar, #style_sysmenu, #style_toolwindow)
cui.RegisterDialogBar CoronaProxyViz
If you want this as a button in your toolbar just copy/paste this into the Maxscript editor, select all the text and drag that text to somewhere in your toolbar. You can then right click on the button and change the icon/text.