Maya 2020 fundamentals - modelling the real world
Get halfway through a model and find it's an unworkable mess? Can't add edge loops where you need them? Can't subdivide a mesh properly? If any of this sounds familiar check this course out.
# 16 23-11-2002 , 03:58 PM
kbrown's Avatar
Moderator
Join Date: Sep 2002
Location: London, UK
Posts: 3,198

Originally posted by BabyDuck
UI shall be hard to do? nope it is easy. you just make a window, put some buttons and assign what you want them to do.

believe me, there are languages where UI is damn hard to implement, mel is real easy to work with user added image

Yeah, the UI with MEL is easy to do if you keep it simple. That's what I meant. Nothing else...


Kari
- My Website
- My IMDB

Do a lot, Fail a lot and Learn a lot!
# 17 23-11-2002 , 04:28 PM
BabyDuck's Avatar
Subscriber
Join Date: Nov 2002
Location: USA
Posts: 1,170

Originally posted by Nem
ooh lots of complicated mel talk user added image
babyduck: ...

no. i mean, the key that gets deleted is only in the time right now - i am not planning delete keys that are in other time. what i tried to explain is, if there is a key set to translateX right now in at least one part of a multiple selection, then it indicates that it is set. and 3 things per attribute would be ok too, so 2 buttons to set and cut the key, and one field indicating if some or none of the objects are keyed right now.

*EDIT*: just had a thought, would it be easier, animation wise, to have a slider in the mel script box as well? cos then you could do all animation in the new window and key it really fast as well without having to go into ur viewport or channel box
there shud also be a button at the bottom which says "Key All" hmm, wonder what that would do user added image

i dont think that would be a brilliant idea - if you dont leave the key window, nothing gets manipulated, and the animation would not do anything at all. if you animate you have to go to next time you want to set a key, manipulate your object via move, skale, whatever - and then set a key for whatever you changed ...

# 18 23-11-2002 , 04:33 PM
Nem's Avatar
Subscriber
Join Date: May 2002
Location: Faringdon, UK
Posts: 1,480
oh right, i get ya
so how shud this thing be started?


- Simon

My Website: www.Glass-Prison.com
# 19 23-11-2002 , 04:53 PM
BabyDuck's Avatar
Subscriber
Join Date: Nov 2002
Location: USA
Posts: 1,170
i am working on good looks right now, but i decided to use a iconTextCheckbox, as you can assign different command if you push it in and out.

the dynamic update will be done later - if you only want to see it how i will do it for one single keyable thing, i can put that mel down ...

# 20 23-11-2002 , 04:58 PM
Nem's Avatar
Subscriber
Join Date: May 2002
Location: Faringdon, UK
Posts: 1,480
oh right, thought i was gunna do it...phew user added image
thanks babyduck
but i do want to learn this stuff user added image just not atm
what does the iconTextCheckbox function do?


- Simon

My Website: www.Glass-Prison.com
# 21 23-11-2002 , 05:14 PM
BabyDuck's Avatar
Subscriber
Join Date: Nov 2002
Location: USA
Posts: 1,170

Originally posted by Nem
oh right, thought i was gunna do it...phew user added image
thanks babyduck
but i do want to learn this stuff user added image just not atm
what does the iconTextCheckbox function do?

ok here it is, works fine, but it is not aware what state it is right now if you press the TX once, it will set the key for translate x for the whole selection. and the button turns red. when you press again, it will delete the key of whole selection and turn the button white. the iconTextCheckBox has 2 functions that are executed when i change the state of it (the onc and ofc, or on long onCommand, offCommand). you can copy that and try it out - not great yet, but this it what the thing will be:

Code:
string $window = `window`;

    columnLayout;

    string $txb = `iconTextCheckBox -style "textOnly" -h 20 -label "TX" -ann "translate X"`;

    iconTextCheckBox -e -onc {"setKeyframe -at tx; iconTextCheckBox -e -bgc 0.5 0.2 0.0 "+$txb+";"} $txb;

    iconTextCheckBox -e -ofc {"cutKey -at tx; iconTextCheckBox -e -bgc 1.0 1.0 1.0 "+$txb+";"} $txb;

    showWindow $window;
(hope this forum supports the code keyword user added image )

# 22 23-11-2002 , 05:20 PM
BabyDuck's Avatar
Subscriber
Join Date: Nov 2002
Location: USA
Posts: 1,170
oh no, not fully tested, cutKey completely removes the key everywhere user added image - so it needs to be changed user added image

# 23 23-11-2002 , 05:21 PM
Nem's Avatar
Subscriber
Join Date: May 2002
Location: Faringdon, UK
Posts: 1,480
oooooh wow, how cool! im liking it user added image first time ive bin excited in a long time!

i get a
Error: Invalid flag: -bgc
when i hit TX

what wud happen if a custom attribute had a longer name?
oh ive noticed that if you open up the window for one object, and while that window is still open and u try it wiv another window, the size gets smaller


- Simon

My Website: www.Glass-Prison.com
# 24 23-11-2002 , 05:46 PM
BabyDuck's Avatar
Subscriber
Join Date: Nov 2002
Location: USA
Posts: 1,170
dang, i tested it - and i found the problem so only the current keyframe gets cut out, but it should find the bgc.

Code:
string $window = `window`;
    columnLayout;
    string $txb = `iconTextCheckBox -style "textOnly" -h 20 -label "TX" -ann "translate X"`;
    iconTextCheckBox -e -onc {"setKeyframe -at tx; iconTextCheckBox -e -backgroundColor 0.5 0.2 0.0 "+$txb+";"} $txb;
    iconTextCheckBox -e -ofc {"cutKey -at tx -t `currentTime -q`; iconTextCheckBox -e -backgroundColor  1.0 1.0 1.0 "+$txb+";"} $txb;
    showWindow $window;
and it is far from useable now. i am not sure, in the bgc it says "windows only flag" does that mean only winNT will like that???

# 25 23-11-2002 , 05:51 PM
Nem's Avatar
Subscriber
Join Date: May 2002
Location: Faringdon, UK
Posts: 1,480
well thats madness cos im on an NT based system, how weird
its working user added image just tried a lil ball anim, and it works user added image
but when i try it i only see one clickable box, and thats TX, the others dont appear for some reason


- Simon

My Website: www.Glass-Prison.com
# 26 23-11-2002 , 06:13 PM
BabyDuck's Avatar
Subscriber
Join Date: Nov 2002
Location: USA
Posts: 1,170
here is a bit better version - made them all buttons and included more than tx - now ty is there as well user added image ...

Code:
window -t "TX and TY";
    rowColumnLayout -numberOfColumns 3;
    string $TXButtonSet = `button -l "setTX"`;
	//pressing this button will set a key for translateX
    button -e -c {"setKeyframe -at tx;"} $TXButtonSet;
    string $TXButtonCut = `button -l "cutTX"`;
	//pressing this button will delete key for translateX right now
    button -e -c {"cutKey -t `currentTime -q` -at tx ;"} $TXButtonCut;
    string $TXButtonCutAll = `button -l "cutAllTX"`;
	//pressing this button will delete key for translateX everywhere
    button -e -c {"cutKey -at tx;"} $TXButtonCutAll;  
 	//same for ty
    string $TYButtonSet = `button -l "setTY"`;
    button -e -c {"setKeyframe -at ty;"} $TYButtonSet;
    string $TYButtonCut = `button -l "cutTY"`;
    button -e -c {"cutKey -t `currentTime -q` -at ty;"} $TYButtonCut;
    string $TYButtonCutAll = `button -l "cutAllTY"`;
    button -e -c {"cutKey -at ty;"} $TYButtonCutAll;
showWindow;

# 27 23-11-2002 , 06:15 PM
BabyDuck's Avatar
Subscriber
Join Date: Nov 2002
Location: USA
Posts: 1,170
but the indicator if you have keys for something atm is driving me nuts - maybe you are satisfied with the last version (of course more attributes needs be added user added image)

# 28 24-11-2002 , 10:37 AM
BabyDuck's Avatar
Subscriber
Join Date: Nov 2002
Location: USA
Posts: 1,170

working now

ok, the script is working: you can set keys and cut keys (now or in whole scene) of ALL keyable attributes. the indicator is still missing if a key is set already or not. and whenever you change the selected objects you have to run the script again, as only that will ensure that all attributes (the custom ones too) will show correctly. the easiest way to use it, is to copy the whole code (be sure you got all) into script editor, there select all, and mmb-drag it to the shelf - a MEL button that runs the setkey will appear user added image

enjoy

p.s.: no comments in code, no docu? i know, dont blame me, it is my first mel try user added image


Code:
string $setKeyKeyable;
if (`window -exists $setKeyKeyable`) deleteUI -window $setKeyKeyable;
$setKeyKeyable = `window -wh 450 400 -t "Set Key Keyable"`;
    rowColumnLayout -numberOfColumns 4;
    string $setB,$cutB,$cutAllB,$attr;
    string $attrList[] = `listAttr -k`;
    if( size($attrList) > 0){
      $attrList = stringArrayRemoveDuplicates($attrList);
      $attrList = sort ($attrList);
      for( $i=0; $i<size($attrList); $i+=1 ) {
          $attr = $attrList[$i];
          text -label $attr -align "center"; $setB = `button -l "set"`;
          $cutB = `button -l "cut"`;
          $cutAllB = `button -l "cutAll"`;
          button -e -c {"setKeyframe -at "+$attr+";"} $setB;
          button -e -c {"cutKey -t `currentTime -q` -at "+$attr+";"} $cutB;
          button -e -c {"cutKey -at "+$attr+";"} $cutAllB;
      }
    } else
      text -label "no keyable";
   setParent ..;
showWindow $setKeyKeyable;

# 29 24-11-2002 , 08:56 PM
Nem's Avatar
Subscriber
Join Date: May 2002
Location: Faringdon, UK
Posts: 1,480
i keep gettin a syntax error, even when i type it out user added image


- Simon

My Website: www.Glass-Prison.com
# 30 24-11-2002 , 10:09 PM
BabyDuck's Avatar
Subscriber
Join Date: Nov 2002
Location: USA
Posts: 1,170
sorry about that nem.

can please anyone else confirm this? i can copy and paste it in script editor from here without problem :argue:

Posting Rules Forum Rules
You may not post new threads | You may not post replies | You may not post attachments | You may not edit your posts | BB code is On | Smilies are On | [IMG] code is On | HTML code is Off

Similar Threads