Home Coding, Scripting, Shaders

[Maya] Select channel box in MEL?

polycounter lvl 5
Offline / Send Message
jfitch polycounter lvl 5
Hey there,
I'm trying to write a simple script in MEL, at least I hope it's simple, to select a series of joints, toggle select the translate and rotate attributes from the channel box, and then bake simulation (because I want the simulation to only bake those attributes). Does anyone know how to grab those attributes from the channel box? Or a way around that?

Thanks in advance

*edit*
At the current moment I'm grabbing all the values I don't want and locking them, which would work fine. Still curious about the channel box thing though, might be useful for other scripts.

Replies

  • throttlekitty
    I'm no serious scripter, but why do you want/need to use a script to hit a button when you can run the command directly?
  • Bartalon
    Offline / Send Message
    Bartalon polycounter lvl 12
    I wanted to create a scriptJob at one point that would remember the last channel that was highlighted and keep it highlighted as I rotate through different objects for easier keyframing.

    As far as I know, there is no way via MEL commands to highlight a channel within the Channel Box.

    However, if want to always key a specific channel, you can do that without having to highlight anything. You can use [object name] + .tx, .ty, .tz, .rx, .ry, .rz, .sx, .sy, .sz for creating keyframes. So, setKeyframe "joint1.rx"; will key that channel without having to do anything with the Channel Box. Also select "joint1.rx"; should select the actual channel, but will not highlight in the Channel Box.

    Are you just trying to avoid baking keyframes to channels that have no animation data?
  • jfitch
    Offline / Send Message
    jfitch polycounter lvl 5
    The problem is that I'm working with some animators who are less-than-experienced with Maya, and I want to make it as easy as possible for them. I've cut off access to any parameters I don't want them to touch on the control rig by limiting information, but as far as the baking and export process goes it's proved sort of a bitch. Anyway, at this point it seems like I'll be doing the exporting so it doesn't matter!

    Basically when I bake the simulation I want to make sure it doesn't bake anything into scale for the bones, or try to bake any other channels other than translation and rotation, and I want to do this despite what the animator's current settings are for bakeSim. I have a decent setup right now that grabs the skin bones and bakes them with an arg list, was just curious about the channel box thing for future reference.

    Other way to do it is just write down the settings and steps and make them do that, but I thought I'd be nice and set up some kind of automated solution so they can just finish the animation, hit the "bake dat shit" button, and have it bring up the export dialogue with the right fbx settings.
  • bagadonuts
    Offline / Send Message
    bagadonuts polycounter lvl 8
    Did you ever resolve this? I am basically trying to do the same thing and stumbled on this thread doing a google search on the topic.
  • onionhead_o
    Offline / Send Message
    onionhead_o polycounter lvl 16
    I just recently discover a possible route, by using
    channelBox -edit -select InsertAttributeHere mainChannelBox;
    just replace the InsertAttributeHere with your attribute name.
    One thing to note is that it will select the attributes that are currently visible, so anything hidden or collapsed will not be selected.
    it might be dangerous to do edits beside the -select flag due to mainChannelBox being a default channel box.
  • Fuzzification
    Hey sorry if I'm being stupid, I cant get "channelBox -edit -select InsertAttributeHere mainChannelBox;" to work. 

    I use Python, but I get nothing when I run 

    mc.channelBox('mainChannelBox', e=1, select='translateX')selection = mc.channelBox('mainChannelBox', q=1, selectedMainAttributes=1)print selection

    Can anyone see what I'm doing wrong? Thanks a lot
Sign In or Register to comment.