SimplyMaya Forums

Welcome to the forum, feel free to ask questions here.


SM Forums / Maya Questions / Programming / Animating

Programming MEL Scripts, Expressions & Programming Related Topics

Join the conversation. Reply to post
Page 2 of 3 1 2 3
 
Thread Tools
23-11-2002, 03:58 PM   #16
kbrown
Moderator
 
kbrown's Avatar
 
Join Date: Sep 2002
Location: London, UK
Posts: 3,198
Quote:
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
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!
  Reply with quote
23-11-2002, 04:28 PM   #17
BabyDuck
Subscriber
 
BabyDuck's Avatar
 
Join Date: Nov 2002
Location: USA
Posts: 1,170
Quote:
Originally posted by Nem
ooh lots of complicated mel talk
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.

Quote:
*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
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 ...
  Reply with quote
23-11-2002, 04:33 PM   #18
Nem
Subscriber
 
Nem's Avatar
 
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
  Reply with quote
23-11-2002, 04:53 PM   #19
BabyDuck
Subscriber
 
BabyDuck's Avatar
 
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 ...
  Reply with quote
23-11-2002, 04:58 PM   #20
Nem
Subscriber
 
Nem's Avatar
 
Join Date: May 2002
Location: Faringdon, UK
Posts: 1,480
oh right, thought i was gunna do it...phew
thanks babyduck
but i do want to learn this stuff just not atm
what does the iconTextCheckbox function do?
__________________
- Simon

My Website: www.Glass-Prison.com
  Reply with quote
23-11-2002, 05:14 PM   #21
BabyDuck
Subscriber
 
BabyDuck's Avatar
 
Join Date: Nov 2002
Location: USA
Posts: 1,170
Quote:
Originally posted by Nem
oh right, thought i was gunna do it...phew
thanks babyduck
but i do want to learn this stuff 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 )
  Reply with quote
23-11-2002, 05:20 PM   #22
BabyDuck
Subscriber
 
BabyDuck's Avatar
 
Join Date: Nov 2002
Location: USA
Posts: 1,170
oh no, not fully tested, cutKey completely removes the key everywhere - so it needs to be changed
  Reply with quote
23-11-2002, 05:21 PM   #23
Nem
Subscriber
 
Nem's Avatar
 
Join Date: May 2002
Location: Faringdon, UK
Posts: 1,480
oooooh wow, how cool! im liking it 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
  Reply with quote
23-11-2002, 05:46 PM   #24
BabyDuck
Subscriber
 
BabyDuck's Avatar
 
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???
  Reply with quote
23-11-2002, 05:51 PM   #25
Nem
Subscriber
 
Nem's Avatar
 
Join Date: May 2002
Location: Faringdon, UK
Posts: 1,480
well thats madness cos im on an NT based system, how weird
its working just tried a lil ball anim, and it works
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
  Reply with quote
23-11-2002, 06:13 PM   #26
BabyDuck
Subscriber
 
BabyDuck's Avatar
 
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 ...

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;
  Reply with quote
23-11-2002, 06:15 PM   #27
BabyDuck
Subscriber
 
BabyDuck's Avatar
 
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 )
  Reply with quote
24-11-2002, 10:37 AM   #28
BabyDuck
Subscriber
 
BabyDuck's Avatar
 
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

enjoy

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


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;
  Reply with quote
24-11-2002, 08:56 PM   #29
Nem
Subscriber
 
Nem's Avatar
 
Join Date: May 2002
Location: Faringdon, UK
Posts: 1,480
i keep gettin a syntax error, even when i type it out
__________________
- Simon

My Website: www.Glass-Prison.com
  Reply with quote
24-11-2002, 10:09 PM   #30
BabyDuck
Subscriber
 
BabyDuck's Avatar
 
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:
  Reply with quote
Reply
Page 2 of 3 1 2 3

Thread Tools


Similar Threads
Thread Thread Starter Forum Replies Last Post
animating a stroke along a curve marioepsley Animation 2 16-08-2011 12:00 PM
Animating & Light Issues I-Iybrid Maya Basics & Newbie Lounge 4 29-09-2009 07:56 PM
animating apple peel Vurt Maya Basics & Newbie Lounge 1 17-12-2008 06:04 AM
gay darlic arm when animating toby.26 Maya Technical Issues 0 16-11-2008 05:18 PM
How to Modelling a Flower for animating it? otaku Maya Basics & Newbie Lounge 13 30-05-2003 01:00 PM