Monday 12 December 2011

Maya 2012: Changing channelBox decimal places (precision)

Most maya users know that you can use more decimal places then Maya displays by default.
For example, it is possible to translate an object by 1.11111 although maya will display "1.111".
When you use getAttr, it will return the correct values, but to display in the channel box, very simply under Edit in the channelBox go settings -> Change Precision...
Simple as, decimal places range from 1 to 15.

Friday 9 December 2011

Outlook 2010 - Filter e-mails between specific dates

Sounds to be much simpler than it should be (tbh only really searched for a few minutes), but...
Say you want to filter your emails between dates?
Atm, a specific date was easy enough, but between dates seemed more hassle and the only way I could see was to create a new search filter.
Under "Search" tab, search Tools -> Advanced Find, then "Advanced" tab - and under Define more criteria dropdown select "Date/Time Fields" -> "Received", Condition to "Between", and Value to "<start Date> and  <end Date>" then under "Browse", make sure you check "Include Subfolders", then "Find Now".
It was a pain in the ass, and would love to hear a simpler way of doing it...

Sunday 27 November 2011

Getting the RSS feed from your blogspot blog?

Very simply, just add "/feeds/posts/default?alt=rss" to the end of your blog address. eg http://ldunham.blogspot.com/feeds/posts/default?alt=rss

python dictionaries

Python dictionaries are really, really damn useful in a pipeline. As you store information in a "key: value" type structure, like storing information on a character they repeatedly needs to be called throughout the pipeline, like its rig file path or characterId number. eg "chaInfo={'johnnyId':564,'davidId':565}", so when you call "character['johnnyId']", "564" is returned. Which can then be taken much further... "chaInfo={'johnny':{'num':'cha01','id':546,'file':{'mesh':'johnny_mesh_master.ma','rig':'johnny_rig_master.ma'}}}", so to get the right information you step through them, so for the rig file path you'd call "chaInfo['johnny']['path']['rig']", or the id number "chaInfo['johnny']['id']". So you could have all the information you need regarding an entity or object within a single file, which is very easily called as and when you need it.

Automating Hotkeys

Some people have asked about automating the creation of hotkeys as it can be abit fiddly for them to do it manually. The problem is, like scripting most things, you really need to understand what is actually going on and why. For example, to automate the creating a hotkey to print what is currently selected. The script is simply "print (`ls -sl`);" First of all we need to create a runTimeCommand, which ties the entire script needed to execute under a single runTimeCommand, just like most of maya's own scripts do. runTimeCommand -annotation "Prints whatever is currently selected" -category "User" -commandLanguage "mel" -command ("print (`ls -sl`);") printSelection; This sets up everything we need to display the command in the hotkeyEditor, without it, you can still assign a command to a hotkey but when your try to find it in the hotkey editor, maya will have no knowledge of it.
Now we need to create a nameCommand which ties the a script to execute under a single string command, just like most of maya's own scripts do. nameCommand -annotation "printSelectionNameCommand" -sourceType "mel" -command ("printSelection") printSelectionNameCommand; Finally we assign a key which runs this command with hotkey -keyShortcut "~" -name ("printSelectionNameCommand");Now that does seem like alot of work, but it sets up everything you need and with abit of wotk, most of it could be automated, but the things you would need to check and the info you need to enter, theres pretty much no point creating an alternative version of the hotkeyEditor as it requires the same information. What you could do, however, is to create perhaps hotkey presets, so instead of having to take 3 scripts as you move to a different station (3 being the pref's scripts "userHotkeys.mel", "userNamedCommands.mel" and "userRunTimeCommands.mel"), you could have them those hotkeys into a single custom script which saves its setup as a preset in its own script file. This could be furthered by doing the same with shelves, window prefs etc, all executed from one script rather than having to transfer the entire prefs folder. Its fairly simple, definitely not the best way of going about it, but its certainly possible.

switch cases' and variables

Whilst writing up a switch statement, it appeared that you cant use variables (arrays in this case) as a case statement.

for example int $mode=0 ; string $currentNum="One" ; string $array[]={"One","Two","Three"} ; if($mode==1) $array={"Three","Two","One"} ; switch($currentNum) { case $array[0]: print ("Next in array is "+$array[1]) ; break ; case $array[1]: print ("Next in array is "+$array[2]) ; break ; case $array[2]: print ("Next in array is "+$array[0]) ; break ; } However swapping the case $array[...] with a value like so... int $mode=0 ; string $currentNum="One" ; string $array[]={"One","Two","Three"} ; if($mode==1) $array={"Three","Two","One"} ; switch($currentNum) { case "One": print ("Next in array is "+$array[1]) ; break ; case "Two": print ("Next in array is "+$array[2]) ; break ; case "Three": print ("Next in array is "+$array[0]) ; break ; } Works just fine, which ended me using the old 'else if' instead. I haven't found anything that seems to mention this, and I know there are probably better ways anyway but it did stump me for a while.

Creating 'custom' Hotkeys

Something not everyone seems to be sure about, its fairly simple really.

1. To assign a hotkey, go to the hotkey editor (Window -> Settings/Preferences -> Hotkey Editor). 2. On the left field, you can select which category you would like to create the hotkey under, I recommend "user" as so you can organise custom hotkeys. 3. In the lower right of the window hit “New”, give the command a name and a description. 4. Finally you need to put the command you want to run in the "Command" field, taking into account whether it is mel or python (eg print "Hello World!\n" ; ) 5. Hit “Accept” and it will appear in your hotkey list. 6. Select the newly created Hotkey and on the right where under “Assign New Hotkey”, enter the Hotkey combination you want to use and hit “Query” check whether it is currently already assigned. 7. If its not and your happy to continue hit "Assign".

Done.

Toggling Camera views

Thought i'd start posting up some of the more useful answers i've given on forums. Start off with toggling through camera views, (i believe already possible in 2012 with [ and ] hotkeys) but this script would allow you to enter in the cameras or the order you want to toggle them in, obviously being able to cycle backwards also. Simply just use this script in a hotkey as is to cycle forwards and change the first line from $mode = 0 to $mode = 1 int $mode = 0 ; string $panel = `getPanel -wf` ; string $cam = `modelPanel -q -cam $panel` ; string $view = "persp" ; string $order[] = {"persp","front","side","top"} ; if($mode == 1) $order = {"top","side","front","persp"} ; if($cam == $order[0]) $view = $order[1] ; else if($cam == $order[1]) $view = $order[2] ; else if($cam == $order[2]) $view = $order[3] ; else if($cam == $order[3]) $view = $order[0] ; lookThroughModelPanel $view $panel ;

Saturday 26 November 2011

HTML and CSS

As i was re-designing this blog, checking out examples etc, I noticed a few things i didnt seem to be able to do, like bordering specific code etc (virtually no HTML knowledge btw), so a quick look and i created a nice template using <code> and <breakquote> etc, but there seemed to be alot of code needed for what I wanted and it wasnt very practical. Thats when I found CSS.
So far its been absolutely lovely, very simple, quick and useful (so far anyways) so I took the html template and remade it into css, with a few differences, add tied to the <code> class, which now allows me to use white space, padd, fill etc very quickly, so I thought i'd share it as I had to take pieces from here and there (mainly the css documentation actually).
(I only bothered commenting on the not 100% bleedin' obvious)
.post code{ width:613px; margin: 10px 0px 10px 0px !important; background-color: #444444; font:13px arial,sans-serif; line-height:20px; /*spacing between lines*/ color: #df7401; white-space:pre-wrap;/*preserve white space but keep word wrapping*/ border:solid 1px #777777 !important; border-collapse:separate; padding: 8px !important; /*inside margins of border and text*/ float: left; /*objects orientation (not text, but whole object)*/ }

Friday 25 November 2011

A proper post...?

I've been messing more and more with code recently, mainly python in effort to understand what im doing and how I could do it better.
Well it started off like that anyways, ended up creating spam mailers to some of the guys at work when setting up email notification on tool issues and task completion etc.
I decided this blog needed a paintover and some more interesting posting... so i gave it a paintover, still waiting on the posts :(

Had to delge deeper into shotgun's api (well not that deep...) and come out with a much better sense in using dictionaries and error checking, but only after wanting to deck my monitor and then having the 'oh... ok' moment.

I have been meaning to put an up-to-date(ish) showreel together, and now I've finally got the motivation to get it (well, 'them' really) sorted and sent off before the end of this year, which I will get done alongside the development and release of the animation toolset.

and now... a man chasing his dog.

Tuesday 22 November 2011

ld_selectMe

a useful tool for building script based selection sets (mayas own are node based, so will only work in the scene you build them in). Selection Sets build with this also allows toggling of selection with ctrl+LMB.
Download it here free:
http://www.creativecrash.com/maya/downloads/scripts-plugins/c/ld_selectme-selection-sets

Currently building a customisable animation toolset (ld_animateMe) which will have a range of useful tools that'll save people time (possibly include links to external tools and ablity to add your own).

Its gotta be simple, quick, customisable and FREE!

Tuesday 1 November 2011

simple offset script

very simple but useful offset script which will offset every selected objects SELECTED keyframes (selected in the timeslider) by 1 (can be adjusted by changing $offset var)

int $offset=1 ; string $mySel[]=`ls -sl` ; float $range[]=`timeControl -q -rangeArray $gPlayBackSlider` ; for($i=0;$i<size($mySel);$i++) keyframe -edit -relative -time ($range[0]+":"+$range[1]) -timeChange ($i*$offset) $mySel[$i] ;

Friday 21 October 2011

PyQt4 for maya 2012 x64 (compiled against qt 4.7.1)

heres PyQt4 for maya 2012 x64, also a x86 version in the comments section

http://nathanhorne.com/?p=322

Monday 19 September 2011

handy script

just found this script whilst looking for a way to write maya's scriptEditor output to a file (scene kept crashing, couldn't make out errors etc)
its damn useful, cant believe i've never used this before! (as it writes history as its going)

Tuesday 23 August 2011

alembic

my god... Alembic.mp4

good on houdini, would love autodesk to now use the alembic research, not just support, but proper integration, i really dont think they can afford not to...

Thursday 18 August 2011

Updating...

phew... far too much has happened to post it all but...

Few weeks into new job at Red Wire Media, down Cardiff Bay and I haven't stopped :)

Started with a compact animation toolset, then onto rigging the main characters (with some lovely work on the faces, even if i do say so myself), now onto setting up the maya and deadline to shotgun api, which is surprisingly easy actually. Just abit more practice on a dummy project and should be up and running soon.

Got so many scripts to upload at some point, so started with a modified version of David Lightbown's 2006 "dlUtils_Profiler.mel" (www.davidlightbown.com) which allows you to compare the difference in speed between two mel scripts (example used, compares difference in speed between multiplication and division in maya - multiplication is about 30% faster from what I remember - so instead of using a /2, use * .5 instead! - added bonus, use to avoid / by 0 errors!)
link:
http://www.creativecrash.com/maya/downloads/scripts-plugins/utility-external/c/mel-python-speed-profiler

I use it fairly often, from comparing simple procs to deciding the best/quickest file management solution, and even started to use it to compare the difference in speed between connected multiple nodes, constraints and expressions (I do also use the fps, but it can vary too much).


Sunday 10 July 2011

Nearly over...

Here it comes... about to start the final week on Iconicles, my first contract for Dinamo.

I could never have guessed how rewarding an experience it would be, being in the industry. Also, how lucky we were, getting a year-long contract to (pretty much) build from the ground up a TV show for the BBC straight out of uni.

What I've learnt in the last 12 months has been staggering, and as sad as I am to be leaving, I'm also excited to put everything I've learnt back to start something from scratch again.

Main job will be rigging the characters, props etc then onto animating again but initially I'm guessing I'll be writing the pipeline and animation tools alongside Milan, which will be cool, its pretty rewarding actually, and I'm hoping to start posting up more of my findings as I go along this time, which tbh will probably just be during the first couple of months.

Sunday 27 March 2011

recorder

matt simpkins showed me a neat little node in maya on friday, and asked for an interface for it.

it turned out pretty awesome, when you set it up and start recording, any movements you make on the objects, on almost all attributes (even most custom ones) get recorded in real-time, and gives you an almost mo-cap-like set of keys on those attributes.

theres a few issues with re-recording or keyed object, but hopefully when i get some time, i'll tear into the command scripts and see what i can do.

time permitted, i think i could get a very simple rig set up, animatable with this command, being able to literately animate in real-time :)
that's a looong way off yet, and probably not even possible (otherwise some bright git would've done it by now) but in the mean time, this has probably got the potential to be as useful as the greasePencil tool, but in 3d.

mel. using the "eval" command

just quick note:
using mels "source" command can be a pain in the backside when your trying to combine it with "internalVar" or something.
I noticed this before in scripts but didnt bother trying myself so here goes:
//get user script directory. string $SCRIPTDir=(`internalVar -usd`+"SCRIPT/") ; //create string with source command and script path string $sourceSCRIPT=("source "+"\"" +$SCRIPTDir +"scripts/SCRIPT.mel"+"\"") ; //eval string eval $sourceSCRIPT ; //run sourced script SCRIPT ;

Wednesday 16 February 2011

shoddy shelves

just thought of something, been using maya2011 64bit at work and seem to have an issue with shelf commands defaulting to "mel" even if saved as "python".

instead of thinking about it, i just put my python scripts into a mel wrapper, rather than;
closing maya, and editing the shelf pref flag to -sourceType "python".

duh.

Wednesday 26 January 2011

updates...

been a while, thought I'd update. (I know its all boring text...)

locOnJoints scripts is up and running, can be found on http://www.creativecrash.com/maya/downloads/scripts-plugins/character/c/ld_loconjoints

been very, very busy lately, alot of updating and improving rigs and scripts. let alone a couple of projects for myself and a couple of other projects on the go.

One of which, is the Animal Wall project, and I spent a few hours filming in Cardiff Centre the other night, was well worth the cold for the results :)
Should start putting some more interesting bits up here...