returnNewNodes(rnn)

For all the Maya scripting grandpas: For when you import files and want to know whats new: There is actually a returnNewNodes-flag at the file command! In former times (<v9) you had to code that all by yourself.. So there definitively wasn’t everything better! There^ you got it!

I just chatted about that with Nathan:

eRiC
13:02: but when importing.. yea a success statement would be nice
13:02: or an array of imported objects!
13:03: THAT would be good
Naughty
13:03: now that would be very good!
13:03: 🙂
eRiC
13:03: 😀
Naughty
13:03: I had to write a function to do that
eRiC
13:03: yea me too!

That was actually about me finding a candidate for more Maya stupid-ness: In the file command docs at import they write that it returns the filename. That is you put something into it and it gives you back the same… bollocks.

(it fails somehow as there are lots of other commands that do it similar. But here it doesn’t even work! And there is no way of importing without a given filename. Contrary to creating a control for instance.)

returnNewNodes(rnn)

Für die ganzen ollen Maya Scripter: Wenn man Dateien importiert und wissen will was überhaupt reingekommen ist: Es gibt doch tatsächlich nen returnNewNodes-Flag am file command! Früher (<v9) musste man sich sowas alles noch selber coden.. Also war definitiv nicht alles besser! Da^! Den Beweis!

Hab vorhin erst darüber mit Nathan gechattet:

eRiC
13:02: but when importing.. yea a success statement would be nice
13:02: or an array of imported objects!
13:03: THAT would be good
Naughty
13:03: now that would be very good!
13:03: 🙂
eRiC
13:03: 😀
Naughty
13:03: I had to write a function to do that
eRiC
13:03: yea me too!

Da gings eigentlich darum, daß ich dachte ich hätte eine lustige Macke von Maya gefunden: In den file-Kommando-Docs steht beim import flag, daß es den filename zurückgibt. Also gibt man einen Namen an den man dann zurückbekommt… fürn Arsch.

(is leider kein guter Kanditat: Es gibt jede Menge commands die das ähnlich machen. Aber: Hier funktionierts nichmal!! Und es gibt keine Möglichkeit zu importieren ohne nen filename anzugeben. Im Gegensatz zum Erstellen von controls.)

scripting me

Yes! A scripting post. I could apologize (via) but I rather don’t ;]

First the most recent stuff! 2 tiny tiny micro nano releases:

You know, creativity comes from when not satisfied with the present. And this time I again was unsatisfied with the game page of minecraft. When playing on a widesceen display this 8xx width is just too tiny and fullscreen is inapropriate either when you cannot focus on the game entirely… (having these blocky graphics on 1920×1080 doesn’t cut it anyway)

So, I started Firebug over again, stretched minecrafts java applet plus the surrounding layout manually. But this time I thought: “Darn someone must have done this before!” And I was right! Now all the snippets on userscripts.org didn’t seem to work for me. I read some of the code and seems I fixed what was missing:

before / after:

Hooray! And as I browsed through the handful actually installed scripts I’ve seen another stub that seemed to not work so far. First was easy, so lets do another round I thought! This time it was a little more complicated. On golem.de the center column can only found by a class name. But there are functions for that: dustindiaz.com/getelementsbyclass.

before / after:

So I managed to shed a little more light on my JavaScript insight. I don’t know if the ice is already broken and if there will be more now.. But as I read mr.doob already JS was interesting to me already for long.

On the other hand I made huge progress on the Python side. Maya-toolwise that is so far. But I guess I’m far from releasing something. Not to forget that is out now! That means I maybe tinker around with Qt via Python soon 😀

Before I forget!: There is more scripting news! It’s already a little late but important to say: Autohotkey is now Autohotkey_L. Meaning the main developer chris turned away from it and handed over to the really ambitious guy Lexicos. The L version supports objects, arrays, 64bit support and Unicode! うん!

I don’t know what that means for ac’tivAid so far. I’m still willing to support it however and whenever (more importantly 🙁 ) I can. But could be quite some work to finally port it from basic to L.

Whoops I tagged it MEL too…. hmm what can I say about that? Nothing new.. Work still involves a lot of Maya and so Mel but there is no real progression. Mel is dead already. And thats good that way. I still does a lot of workload but it deserves to rest 🙂

usability stuff: findWhenTyping manifest

I love “findWhenTyping”-stuff: You know the new (sllloooooow-ass) search bar in windows vista in the start-menu and in every explorer? (Yes the thing they somehow borrowed from osx..)
In Firefox for instance there is Tools>Options>Advanced>”Search for text when I start typing“. So on any website you can just hit some letter-keys and it finds the occurence.

And they have it in the Options>Application tab as well as in the about:config. Just like it should be: If there is an interface with a list: You just never ever know how long the list can be. Will it be 10 entries or 7000? … I just made this a paradigm myself:

It’s a list? Offer findWhenTyping!

because manual scrolling and seeking just sucks.

Finally I had a little time to build such a thing myself. In our companys Maya-Toolkit (sorry no link, seems offline now) we have a lot of list-dialogs. Actually we have loads of list-dialogs all over the place. But the Maya toolkit is the only spot (thanks to my lame-ass scripting only skills) where I can put my hands on.

exept from the obvious things:

  • on keystroke: list content automatically shows matches only
  • entering nothing shows all entries
  • matching is non-case-sensitive
  • completely keyboard driven – you “can” handle the dialog without the mouse.

I have some additions that I haven’t seen in other similar dialogs:

  • a phrase that does not match anything still shows the last matches – so if you have a spelling mistake the list doesn’t go empty. An empty list would be just useless.
  • first entry is always selected – so you don’t have to extra select something if you already typed the right letters – just hit enter
  • when entering an asterisk * the default asterisks around the *phrase* will be omitted – so you can write start* and it matches everything that begins with start but not with start somewhere within.

What I need to implement in the future because its so useful in the AwesomeBar from firefox:

  • hitting space starts a new search withing the current hits – this means you can combine keywords just with space. For example in your image-folder “cat cap” would find all pictures with “cat” in the name or tag but within this list only the ones with a “caption”-name or tag.

Ok. As I’m unable to finish this right now. I gonna just amend it with a video when I have something to show. :]

Whats going on…

Hmmm been a while, huh? I’m a little rushed from some sides. But there is a lot up!

At the moment I’m actually blogging from the tUM in Karlsruhe Durlach! So Yes! a little demoscene again. And looks like I’m going to do a release myself! okok nothing really special: There is a music loop compo held. Its about a small piece of music (7sec) thats made to be played over again 3 or 4 times without getting boring. Actually my speciallity. Because every time I make music I don’t get past making loops. Finishing a track is not my cup of tea. I like arranging live. Isn’t it more exiting anyway? For apology on this spot I could say that good old Aril Brikha is recording his records this way only (at least I strongly believe he is doing it that way)! :]
If oficially released I gonna make the releases of our group available here.

Not much time for mel scripting though. But theres been at lease a little buzz on cgtalk about melDrop. But looks like I already threw it all over again on paper 😀

Next version melDrop will be only directly available for script authors. Users get the melDrop script in the zips already so they don’t need to bother. Actually that wors already but I have some more thing up my sleeve that I need to work on the interface for. Apropos interface: This is gonna be awesome next version! All settings on one page. All on one view. You click Ok and see the installation progress and thats it. Plus arbitrary number of attached files and shelfButtons and Hotkeys with arbitrary commands.

The blog needs care as well I know.. I’d need to finish the about page and the language integration. But I upgraded to wordpress 2.7! Its not perfect but real cool that the next upgrades will be sans manually copy file by file.

Was so geht…

Hmm ich hab schon ne Weile nix geschrieben, wa? Überfährt mich alles gerade nen bißchen. Aber es ist schon einiges los!

Momentan blogge ich tatsächlich von der tUM in Karlsruhe Durlach! Also: Jau! Wiedermal nen bißchen demoszene :] Und wie es aussieht werde ich selber auch was kleines releasen. Okok: Wirklich dolle is das nich: Es gibt eine Music-Loop-compo. Sprich ein kleines Stück Musike (7sek), das so angelegt ist, daß man es 3-4 Mal hintereinander spielen kann ohne daß es öde wird. Eigentlich meine Spezialität. Denn immer wenn ich bisher Mucke gemacht hab bin ich nicht übers loopen hinausgekommen. Track fertigmachen ist absolut nicht meins. Lieber live arangieren. Ist ja auch spannender. Zur Verteidigung könnte ich an der Stelle sagen, daß (bin ich zumindest ziemlich überzeugt) der gute Aril Brikha seine Platten genauso aufnimmt! :]
Wenns soweit ist werd ich die releases von unserer Gruppe gern hier verfügbar machen.

Für mel scripting ist nicht gerade viel Zeit. Auf cgtalk gabs dann doch noch nen bißchen bla bla über melDrop. Und wie solltes anders sein, hab ich das Ding auf dem Papier sozusagen schon wieder komplett umgebaut 😀
In der nächsten Version wirds nur noch für den Skript Autoren interessant sein. Die melDrop skripte werden dann im Zip immer mitgeliefert, so daß sich der User gar keine Platte darum machen muss. Geht eigentlich auch schon jetzt. Aber ich hab da noch nen paar andere Sachen für die ich das Interface umbauen muss. Apropos interface: Das wird auch echt scheen in der neuen Version: Alle Einstellungen auf einer Seite, alles auf einem Blick. Einmal klicken und man sieht den “Installationsverlauf” (sollte sich alles innerhalb einer halben Sekunde abspielen können) dann is schon fertich. Zudem endlich beliebig viele Files und Shelfbuttons und Hotkeys mit egal welchen commands.

Der Blog an sich läss auch nen bißchen auf sich warten. Ich müsste endlich mal die About seite überarbeiten und die Sprachen vernünftig integrieren. Aber ich hab mittlerweile wordpress 2.7 drauf! Noch nich perfekt, aber schon cool, daß man endlich auch updaten kann ohne den ganzen Mist von Hand zu kopieren.

melDrop

pchew… I got the stone rolling 😀

ok, this is the homepage for melDrop. I gonna fill it by the time. For now its just a placeholder. Stay tuned.

I just uploaded melDrop to highend3D.com but they gonna take a moment to approve it.

Update: Ok melDrop is up at highend3D:

melDrop – Maya script installer

There should be everthing you need to know about that. I updated resetPivot and temporary uploadet melDropEnabler to sendspace to be awailable as long as its not up at highend as well.
Ah yea and I created a little transparent logo!

ok. Lets give it a try. I gonna make a post on cgtalk about that ^^

Update: Ok I posted at cgtalk, percutio (german Maya forum) and now highend3D as well.. No comments so far. Its been 3 days! They don’t like it 🙁

I mean .. its not the video, isn’t it? People say its a little fast. I know.
Shall I make another recording and then everthing goes BAM??! 😀 I don’t think so. Nah whatever.. I gonna use it anyway.

do-what-I-mean-shit with Autohotkey

Hehe :]

Technical director floh wasn’t thrilled.. But I actually was looking for a way to do this long time:

If you script code sometimes you define stuff, a variable e.g. at the point where you finally want to use this variable you need to go back to the definition somehow (via mouse or cursor) copy it and return to the point where you felt like having that variable available. A word-autocomplete might help in that case as well. But if your var has a long prefix and … nah!

What I actually was looking for:

  • you get the idea: Oh I need this from over there
  • I press a hotkey to remember the position
  • you move to the thing you need and select it
  • you press another hotkey

then its finished: The piece you where looking for is at the spot.
Ok now chill the fuck out: I got this:

This has nothing to do with the code editor: Its all Autohotkey:

  • on Ctrl+Ins it figures out the typing-cursor/caret-position (does not always work FF e.g.)
  • places a tooltip and waits for you to press enter
  • you make a selection somewhere else
  • If you press Enter: It gets the selection
  • clicks the mouse to the old position
  • inserts the selection
  • restores clipboard and mouse position

Thats actually it! If you want to take a look at my puny source code:
or even want to test it out without having Autohotkey try the .exe:

http://goodsoul.de/ahk/rememberPosTool.ahk
http://goodsoul.de/ahk/rememberPosTool.exe
(virus total online check link: suspicios file… well it waits for your keystroke.. 😉 )

First I had an ac’tivAid UserHotkey-snippet without the hotkey on/off crap… but somehow UserHotkeys somehow deselects the current window. Need to look into this later… This example works much better. So it doesn’t matter if you click via mouse or select with keyboard.

BUT: now the downsides:

  • I made it cancel when you scroll with the mouseWheel
  • but if you scroll somehow else its broken of course! Works only on screenspace!
  • some apps do not support the caret-position. Like Firefox for instance.

try on your own risk of course ;]

scripting insights – fall-throughs

Oh if you are scripting or coding you might come across those “insights”. This is of course to share my thoughts but to have a place to keep and remember this stuff as well. I mean maybe this is completely bollocks!! Comment if you you think so! :]

Ok: fall-throughs:
As I always try to cover as many cases as possible (within reason of course!) I create a lot of masseges to the user. In this style I really became sick of that huge if-else blocks that have the fall-through-message at the end. These tree like creatures:

if ($condition1)
{
    // do all this ...

    if ($condition2)
    {
        if ($condition3)
        {
            // do this too ....
        }
        else
            error "bla because of ...";
    }
    else if ($condition4)
    {
        // do other stuff ...
    }
    else
        error "bla bla blub...";
}
else
    error "bla bla bla...";

this shows the usual style one would do: But there are major drawbacks: the conditions and the error-messages are at opposite positions. And if you add a condition that might escape the whole thing you’d have to add another “scoping-level”…
Ok, now the insight: I write the escape-relevant conditions in negative style a line in the very front of the script:

if (!$condition1)
    error "because of ...";
else if (!$condition2)
    error "because of ...";
else if (!$condition3)
    error "because of ...";
else if (!$condition4)
    error "because of ...";

// now do stuff ...

With this style I have the conditions right at the error messages. The indentation is much less deep. And all the stuff that could crap up the thing is coupled at a definite place.

Ok.. this might sound like kindergarten to a real programmer but. I felt quite smart when doing so ^^

whatever now I wrote it down. So be it.

blogging about Maya Mel

Well.. as I want to use the site as platform for my MEL-publications and babbling about that I think I might introduce this a little. For you that don’t even know what I’m talking about: Don’t bother reading on :]

Maya is a great tool. Of course its not perfect. But there it reveals another greatness: Its own built in scripting language MEL. As Maya is actually almost completely build by MEL itself its really mighty in Maya.

So when working I asways come across stuff to add and change, making my workflow more and more efficient. Quite often my colleagues and even our companys production pipeline tool profits from these efforts. After years of scripting there is still a lot to learn but I already know quite some about making games with Maya.

I developed myself a kind of manifest to make my tools like. Its not always possible to fulfil all rules and its never finished. But here I think its a very good place to write it down and maybe amend it in the future.

Ok. What can I do to make a tool most enjoyable in Maya:

  • give it a nice selfexplaining name (eriXSuperTool)
  • make it multi-name safe (`ls -sl -l`)
  • make it quite fool safe (at least when its possible to mess stuff up)
  • make stuff context-sensitive (if applicable, if not: )
  • make stuff optional
  • select Maya Window after the action (simple custom windows don’t have hotkeys in Maya, if MayaWindow is selected after the action you can undo, scrubb or pan the view without extra clicking)
  • make UIs sizable if helpful (e.g. for sliders)
  • make values persistent if helpful (if there are many settings to do)
  • close on action if helpful (maybe even optional)
  • auto-convert selection if helpful (context-sensitivity as well, if a tool modifies vertices, why not let the user select faces to modify the verices of the faces)

I’d love to read comments about this. Maybe you have other nice ideas about that of critics. OK. Now I can post a script :]