PDA

View Full Version : Custom Attributes Floater Instance


viro
04-30-2009, 05:16 PM
I am trying to launch an instance of a Custom attributes roll out to a floater. So For instance your animating and you don't want to have to keep picking the object with the attribute holder to get to the controls. So I have a button that launches those controls as a floater. I have the button launching the the floater perfectly. But I was only able to get a 2 sliders working. So i am wondering if there would be a way to launch an instance of the roll out in the floater. Right know the button just launches a floater with the same controls and I get them to use the controllers by using:

spinner Articulate_Front "Articulation" range:[-1,1,0] scale:.001 controller:($MasterArticTruck.modifiers[#Attribute_Holder].motorgradermaster.Articulate_Front.track)


But this sort of thing only works with 2 spinners in the entire interface. And the list boxes and pick buttons I am at a loss as to how to get them to work in the floater and have those settings update in the original Attribute Holder.


group "Floater Controls"
(
button Fcontrols "Launch Controls" width:btW1
)
on Fcontrols pressed do
(
--launch floater
try (cui.unregisterDialogBar FloaterControlsFLOAT) catch() -- If already registered, then unregister.

try (closeRolloutFloater FloaterControlsFLOAT) catch() -- If already open, then close.
rollout FloaterControls "Articulated truck"
(
local btW1=140
local rayDist=$MasterArticTruck.modifiers[#Attribute_Holder].motorgradermaster.rayDist
local carDir=$MasterArticTruck.modifiers[#Attribute_Holder].motorgradermaster.carDir
local ground=$MasterArticTruck.modifiers[#Attribute_Holder].motorgradermaster.ground
group "Auto Wheel Rotation"
(
checkbox Auto_Wheel_Rotation "ON/OFF"
)

group "Manual Wheel Rotation"
(
checkbox Manual_OnOff "ON/OFF"
spinner All "All" range:[-2,2,0] width:btW1 across:2
spinner LF "LF" range:[-2,2,0] width:btW1 across:2
spinner RF "RF" range:[-2,2,0] width:btW1 across:2
spinner RM "RM" range:[-2,2,0] width:btW1 across:2
spinner LM "LM" range:[-2,2,0] width:btW1 across:2
spinner LR "LR" range:[-2,2,0] width:btW1 across:2
spinner RR "RR" range:[-2,2,0] width:btW1
)

group "Suspension"
(
checkbox SuspensionOnOff "ON/OFF"
spinner xeffect "X Effect" width:btW1 across:1
spinner yeffect "Y Effect" width:btW1 across:2
spinner zeffect "Z Effect" width:btW1 across:3
)
group "Dump Bed:"
(
spinner dump "Dump"
controller:($MasterArticTruck.modifiers[#Attribute_Holder].motorgradermaster.dump.track)
)
group"Articulation:"
(
spinner Articulate_Front "Articulation" range:[-1,1,0] scale:.001
controller:($MasterArticTruck.modifiers[#Attribute_Holder].motorgradermaster.Articulate_Front.track)
)
group "Animation:"
(
checkButton reverseCb "Reverse" width:btW1
checkButton set_directionCb "set direction" width:btW1 acroos:2
checkButton manualCb "manual" width:btW1 across:3
)

local btW2=65
group "Initial Direction"
(
radiobuttons intDir "Initial Direction: " labels:#("X","Y","-X","-Y")
--controller:($MasterArticTruck.modifiers[#Attribute_Holder].motorgradermaster.intDir.track)
)

group "Ground"
(
checkbutton CastOff "Turn Off Ground" width:btW1
listBox listObj "Ground Objects:" height:5
pickButton addObject "Add Object" width:btW2 across:2
button deleteObject "Delete" width:btW2
spinner rayDistance "Ray Distance" range:[-1000000,1000000,0] width:btW1
button resetDistance "Reset RayCast Distance" width:btW1
)
fn updateList=
(
nNames=for n in ground collect n.node.name
listObj.items=nNames
theState=intDir.state
intDir.state=theState
)

on intDir changed NewAr do
(
if iintDir.state == 1 then (carDir=[1,0,0])
if intDir.state == 2 then ( carDir=[0,1,0])
if intDir.state== 3 then ( carDir=[-1,0,0])
if intDir.state == 4 then (carDir=[0,-1,0])
updateList()
)

on addObject picked obj do
(
if classOf obj == Editable_mesh then
(
weak = (nodeTransformMonitor node:obj forwardTransformChangeMsgs:false)
appendIfUnique ground weak
updateList()
)
)
on deleteObject pressed do
(
num=listObj.selection
if num!=0 then
(
deleteItem ground num
if listObj.items.count == 0 then ground=undefined
updateList()
)
)

on resetDistance pressed do
(
rayObj = $CasterRF
hitObj = $HitFR
rayDist= distance rayObj hitObj
rayDistance.value=rayDist
)
on rayDistance changed newValue do
(
rayDist=rayDistance.value
)

on motorgrader open do
(
updateList()
rayObj = $CasterRF
hitObj = $HitFR
carDir = carDir
rayDistance.value=rayDist
)
--
)
FloaterControlsFLOAT = NewRolloutFloater "Floater Controls" 500 500
addRollout FloaterControls FloaterControlsFLOAT

cui.registerDialogBar FloaterControlsFLOAT style:#(#cui_floatable, #cui_handles, #cui_dock_all) --registar the floater as dockable
)

ZeBoxx2
04-30-2009, 07:16 PM
Have you had a peek at these...
http://forums.cgsociety.org/showthread.php?t=752318 - How to control Custom Attributes?
and
http://forums.cgsociety.org/showthread.php?f=98&t=756472 - custattributes+ floater rollout
...threads?

They deal specifically with opening a rollout linked to the parameters of a custom attribute definition in a separate dialog/floater.

viro
04-30-2009, 07:28 PM
Ah, thanks again. I guess I didnt look around good enough becuse that is exactly what I am trying to do.

CGTalk Moderation
04-30-2009, 07:28 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.