PDA

View Full Version : X Y Controller help


lemasterjg
09-01-2009, 08:19 PM
Hey all

I have one that Iíve been racking my mind over and looking around on the interwebs for days trying to find out. How do I make an X Y controller inside an attribute holder? They are manly seen and used for facial controls, however I have a mechanical device that has actuators that slide forward, left, right, and back. I know how to make them out of splines with float limits but I want to keep the scene clean and have all my controllers inside an attribute holder, is this even possible? Basically I want a single controller that puts out 2 variables, an up/down and a left/right value in one controller.

Any and all help is appreciated

denisT
09-01-2009, 09:06 PM
What's a problem? Create two float attributies (controllers):

(
try(delete $TestAttrNode) catch()
b = box name:"TestAttrNode"
m = EmptyModifier()
a = attributes ccData
(
parameters param rollout:param
(
positionX type:#float animatable:on ui:positionX
positionY type:#float animatable:on ui:positionY
)
rollout param "Parameters"
(
spinner positionX "Position X: " units:#wolrdunits fieldwidth:60 align:#right
spinner positionY "Position Y: " units:#wolrdunits fieldwidth:60 align:#right
)
)
custAttributes.add m controlData
addmodifier b m
modpanel.setCurrentObject m
)

PEN
09-02-2009, 12:53 AM
There was a whole thread where I posted images and working code for this using stright Max script. I have also created very complex systems using dotNet as well and pictureBox controls. You can see those here.

http://paulneale.com/tutorials/dotNet/dotNet.htm

Look up joy stick controls and I'm sure you will find a lot here.

PEN
09-02-2009, 12:54 AM
I should note that the Max script only method will not work in the modifier panel only.

lemasterjg
09-02-2009, 01:10 PM
denisT - I could just make two controllers i just didn't know if there was a multi value controller that I was missing or a method to archive such a controller. The two controllers are a fall back plan but

PEN - thank you I will look into your thread and do some research into Dot Net and maxscript, the lid controls on one of the images posted in the link are exactly what I am looking for.



After doing some quick research and searches on the joystick controller I stumbled across this http://lonerobot.net/?p=72&cpage=1 (http://lonerobot.net/?p=72&cpage=1)

PEN
09-02-2009, 02:36 PM
Pete is one of the dotNet masters around here. Not around the forum much at the moment how ever as I think he has other things on his plate. The joy stick controls you see on my site are just Max and dotNet, no VB or C# harmed in the creation of that UI.

lemasterjg
09-02-2009, 06:53 PM
i'm not sure if the page is just down or if i have to wait longer to read through your tutorial but the pictureBox link is dead or not active on the Right hand side of the page, i've read through and now understand DotNet a little bit more and having some fun with tabs i've hit a little snag with parameters and sub rollouts.



I'm also having issues adding parameters so a subrollout within a rollout, how do i connect my parameters to a case rollout? have i just missed something entirely?


def = attributes V22Ctrl
redefine:def
(
parameters stearingP subRollout:stearingR
(
test type:#float UI:LflapSp
)
rollout V22R "V22 Controls"
(
--add a dot net tab control
dotNetControl tabs "system.windows.forms.tabControl" Width:(V22R.width-10) height:80 offset:[-10,0]
--add a subRollout
subrollout subroll "sub" width:(v22R.width-5) height:390 offset:[-10,-5]

fn showProps obj =
(
-- clear MaxScript Listener
clearListener()
-- displays Properties header
format "Properties:\n"
-- shows all properties for OBJ
showProperties obj
-- displays Methods header
format"\nMethods:\n"
-- shows all Methods for OBJ
showMethods obj
-- displays Events header
format"\nEvents:\n"
-- shows all Events for OBJ
showEvents obj
)

fn initTabs tab labels:#() =
(
--clears Tabs incease of update
tab.TabPages.clear()
--sets tab width to fill to the right
tab.sizeMode=tab.sizeMode.FillToRight
--sets mutliline to true for multiple tab rows
tab.multiline = true
--sets teh width of every tab
tab.itemSize=dotnetObject "System.Drawing.Size" ((tab.width/labels.count)-2) 25
--loops through all labels in the labels array and adds a tab witht the same name
for x in labels do tab.tabpages.add x
)

fn addtabRollout index =
(
for x in subroll.rollouts do removeSubRollout subRoll x

sub = case index of
(
default:
(
rollout stearingR "Stearing"
(

spinner LflapSp "L Flaperon" range:[-100,100,0]
)
)
1:
(
rollout Nacells "Nacells"
(
label title1 "Nacells"
)
)

2:
(
rollout LandingGear "Landing Gear"
(
label title2 "Landing Gear"
)
)

3:
(
rollout Doors "Doors"
(
label title3 "Doors"
)
)

4:
(
rollout Other "Other"
(
label title4 "Other"
)
)
)
addSubRollout subRoll sub
)

on tabs MouseUP senderArg Arg do
(
showProps arg
print senderArg.selectedIndex
addTabRollout senderArg.selectedIndex
)

on V22R open do
(
--runs "showProps" function and passes "tabs" into obj
showProps tabs

--runs "initTabs" function
initTabs tabs labels:#("Stearing","Nacells","Landing Gear","Doors","Other")
addTabRollout 0
)
)
)
custAttributes.add $.modifiers[1] def
def = custAttributes.getDef $.modifiers[1].V22Ctrl

PEN
09-03-2009, 02:05 PM
I don't think that you are going to make that work in any good way. The rollouts need to be local to the def so they will be displayed. Now what you could do it build the rollouts that way, remove them on open and then add them to the sub. That I think would work but it will cause it to be messy.

CGTalk Moderation
09-03-2009, 02:05 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.