Hi All,
I'm new to Maxscript and am trying to use Joe Gunn's face switcher script in Max 2015. I got it to run now, but once I dock the floater, I am unable to undock it anymore. Any help is much appreciated...I attached the script.
Thanks!
Forum topic · General Scripting
By szamarron · 2015-04-14
Hi All,
I'm new to Maxscript and am trying to use Joe Gunn's face switcher script in Max 2015. I got it to run now, but once I dock the floater, I am unable to undock it anymore. Any help is much appreciated...I attached the script.
Thanks!
.
miauu · 2015-04-15
First, define your floater as global variable
global FaceFloater = newRolloutFloater "Face Switcher V1.3" 275 176
[/]
then you can use this to undock it:
[code]
cui.FloatDialogBar FaceFloater
Still not working
szamarron · 2015-04-15
Thanks for the reply. I tried different ways of incorporating the code you provided and still am not getting back the floating dialog once I dock it. I have been trying to research it, and may seem like I may have to unregister it before? What am I doing wrong? Thanks
)
global FaceFloater = newRolloutFloater "Face Switcher V1.3" 541 263
cUI.RegisterDialogBar FaceFloater style:#(#cUI_floatable,#cUI_dock_left,#cUI_dock_right,#cui_dock_top,#cui_dock_bottom,#cUI_handles)
cui.FloatDialogBar FaceFloater
addRollout first_roll FaceFloater
.
miauu · 2015-04-15
Try this:
- define the floater as global
- run the script
- dock the UI
- then, as separate script, run
cui.FloatDialogBar FaceFloaterIf it works, you have to put an If...then...else statement in your main code. It will check if the dock state of the UI. IF the UI is not docked - dock it, if the UI is docked - undock it.
Also, check the code:
/*************************************************************************************
Author: Joe Gunn
Company: Joe Gunn 3d
Script Version: Read history below.
Max Version: 2008 and above
Purpose: Facial animation, swapping textures via material IDs
You must USE .bmp files for displaying the thumbnails in the UI_ln.
Also your bmp's must be named in 01.bmp, 02.bmp, all the way to 10.bmp
Bugs:
-Most likely a bunch but it worx
Warning:
-This script is the property of Joe Gunn
-Use this script at your own risk.
-This script can be used in production free of charge.
*************************************************************************************/
rollout first_roll "Character_Faces" width:275 height:170
(
button btnSetD "Set Dir:" pos:[5,11] width:42 height:22 toolTip:"locate your images"
edittext Fdir "" pos:[50,13] width:201 height:17
button btn01 "01" pos:[62,40] width:32 height:32
button btn02 "02" pos:[102,40] width:32 height:32
button btn03 "03" pos:[142,40] width:32 height:32
button btn04 "04" pos:[182,40] width:32 height:32
button btn05 "05" pos:[220,40] width:32 height:32
button btn06 "06" pos:[62,78] width:32 height:32
button btn07 "07" pos:[102,78] width:32 height:32
button btn08 "08" pos:[142,78] width:32 height:32
button btn09 "09" pos:[182,78] width:32 height:32
button btn10 "10" pos:[220,78] width:32 height:32
--LAYER MANAGER
checkbutton LayerMan "" pos:[12,76] width:27 height:27 toolTip:"Layers Toggle" checked:false images:#("UI_ln\Icons\LayerToolbar_24i.bmp", "UI_ln\Icons\LayerToolbar_24i.bmp", 6, 5, 5, 5, 5) across:8
------Open Curve Editor
checkbutton CEdit "CurveEditor" pos:[12,44] width:27 height:27 toolTip:"Curve Toggle" checked:false images:#("UI_ln\Icons\TrackBar_24i.bmp", "UI_ln\Icons\TrackBar_24i.bmp", 2, 2, 2, 2, 2) across:8
HyperLink JD "joegunn3D.com" pos:[6,110] width:77 height:16 visitedcolor:(color 255 0 0) color:(color 0 153 204) address:"www.joegunn3d.com"
GroupBox grptoggles "" pos:[6,33] width:40 height:74
label lbltag "If you don't know...better ask somebody" pos:[54,125] width:191 height:14
button btn_undock "Undock" offset:[50,0]
on btn_undock pressed do
(
cui.FloatDialogBar FaceFloater
)
on btnSetD pressed do
(
local curpath = Fdir.text
local newPath = getSavePath initialDir:(curpath) caption:"Select the path where your Face Images are located"
if newPath != undefined then
(
Fdir.text = newpath
btn01.images = #(Fdir.text + "\01.bmp", Fdir.text + "\01.bmp", 1, 1, 1, 1, 1)
btn02.images = #(Fdir.text + "\02.bmp", Fdir.text + "\02.bmp", 1, 1, 1, 1, 1)
btn03.images = #(Fdir.text + "\03.bmp", Fdir.text + "\03.bmp", 1, 1, 1, 1, 1)
btn04.images = #(Fdir.text + "\04.bmp", Fdir.text + "\04.bmp", 1, 1, 1, 1, 1)
btn05.images = #(Fdir.text + "\05.bmp", Fdir.text + "\05.bmp", 1, 1, 1, 1, 1)
btn06.images = #(Fdir.text + "\06.bmp", Fdir.text + "\06.bmp", 1, 1, 1, 1, 1)
btn07.images = #(Fdir.text + "\07.bmp", Fdir.text + "\07.bmp", 1, 1, 1, 1, 1)
btn08.images = #(Fdir.text + "\08.bmp", Fdir.text + "\08.bmp", 1, 1, 1, 1, 1)
btn09.images = #(Fdir.text + "\09.bmp", Fdir.text + "\09.bmp", 1, 1, 1, 1, 1)
btn10.images = #(Fdir.text + "\10.bmp", Fdir.text + "\10.bmp", 1, 1, 1, 1, 1)
)
)
on btn01 pressed do
(
for i in selection do
if i.modifiers[#Material] != undefined then
i.modifiers[#Material].materialID = 1
)
on btn02 pressed do
(
for i in selection do
if i.modifiers[#Material] != undefined then
i.modifiers[#Material].materialID = 2
)
on btn03 pressed do
(
for i in selection do
if i.modifiers[#Material] != undefined then
i.modifiers[#Material].materialID = 3
)
on btn04 pressed do
(
for i in selection do
if i.modifiers[#Material] != undefined then
i.modifiers[#Material].materialID = 4
)
on btn05 pressed do
(
for i in selection do
if i.modifiers[#Material] != undefined then
i.modifiers[#Material].materialID = 5
)
on btn06 pressed do
(
for i in selection do
if i.modifiers[#Material] != undefined then
i.modifiers[#Material].materialID = 6
)
on btn07 pressed do
(
for i in selection do
if i.modifiers[#Material] != undefined then
i.modifiers[#Material].materialID = 7
)
on btn08 pressed do
(
for i in selection do
if i.modifiers[#Material] != undefined then
i.modifiers[#Material].materialID = 8
)
on btn09 pressed do
(
for i in selection do
if i.modifiers[#Material] != undefined then
i.modifiers[#Material].materialID = 9
)
on btn10 pressed do
(
for i in selection do
if i.modifiers[#Material] != undefined then
i.modifiers[#Material].materialID = 10
)
on LayerMan changed state do
(
if state == on
then macros.run "Layers" "LayerManager" -- Layer Manager
else layermanager.closeDialog()
)
on CEdit changed state do
(
if state == on
then macros.run "Track View" "LaunchFCurveEditor"
else trackviews.close 1
)
)
global FaceFloater = newRolloutFloater "Face Switcher V1.3" 275 176
cUI.RegisterDialogBar FaceFloater style:#(#cUI_floatable,#cUI_dock_left,#cUI_dock_right,#cui_dock_top,#cui_dock_bottom,#cUI_handles)
addRollout first_roll FaceFloater
Use the UNDOCK button to make the UI floatable.
It works!
szamarron · 2015-04-16
I couldn't get it to work in the code itself...not sure how to code the IF statements, but running it as a separate script works! I assigned an icon to this separate command. Thank you for your help...much appreciated!