Go Back   The Apple Blog Community > Apple/Mac > Development
Register Social Groups iSpy Members List Search Today's Posts Mark Forums Read FAQ

Development XCode, Cocoa, and all other development

Reply
 
LinkBack Thread Tools Search this Thread
11-08-2007   #1 (permalink)
Operator
 
Join Date: Nov 2007
Posts: 1
sgraae has disabled reputation
Hey All,

I am new to programing as I am to this forum (that new for those interested).
I am not a programmer by profession but I do defently like to tumble around with the codes once in a while - but on a every day basis I deliver graphic design for freelance client.


So here is the question:

I am working with Autodesk Maya / Mental Ray (for rendering) and I am also using zBrush to generate what is known as Displacement maps for my low res models in maya.

To do so I need to do as following (this portion is take from a thread at zBrush central - the zbrush forum
also imf_copy

in osx, it is located inside the maya application. find the application and right click it. you will see a list of options on of which is "show package contents". imf_copy is located in contents, bin folder. change anything in any of vthese folders at your own peril. this is what makes maya work.

if you double-click imf_copy, terminal will open and spit out some data:

/Applications/Alias/maya7.0/Maya.app/Contents/bin/imf_copy; exit
image file copy and conversion utility for mental ray.
usage: /Applications/Alias/maya7.0/Maya.app/Contents/bin/imf_copy [-vegqfpLBrkx]] inimage outimage [outformat [outtype]]
/Applications/Alias/maya7.0/Maya.app/Contents/bin/imf_copy -c [-vgfr] inimage* outimage.map

-v verbose output
-e perform error diffusion
-g G gamma correction with exponent G, default 1.0
-q N if outformat is jpg: compression quality N=1..100
-f F if outformat is map: filter value F, default 1.0 (experimental)
-p if outformat is map: create filtered image pyramid
-L if outformat is map: output little-endian files
-B if outformat is map: output big-endian files
-r if outformat is map: use tiles (remap pixels)
-k K if outformat is exr: select compression algorithm:
K=none, piz, zip, rle, pxr24, default is rle
-c collate up to 20 images to pyramid map, largest first
-x N extract image N=0..19 of pyramid map, largest is 0
logout
[Process completed]

this tells you everything you need to know, if you can understand it.
so you use this by typing in terminal:

/Applications/Alias/maya7.0/Maya.app/Contents/bin/imf_copy -v -p -L Documents/maya/projects/bird/091906/111306/111806/bird_repeltdisp.1001-R32.tif bird.map

so what's going on here. the first bit-
/Applications/Alias/maya7.0/Maya.app/Contents/bin/imf_copy
tells it what application to run

the second bit-
-v -p -L
is a list of options for imf_copy, their meaning is listed in the little printout above. -v = verbose output -p = pyramid map -L = little endian file
little endian is a bit order

the third bit-
Documents/maya/projects/bird/091906/111306/111806/bird_repeltdisp.1001-R32.tif
the file to converted

the fourth bit-
bird.map
the output file name

notice the spaces, they are important.


But in order for me to generate a displacement map that can be used in Maya / Mental Ray I need to do a little work around since I am on a mac - and I have been provided with a script which I am suposed to type in the terminal and that in it's self is okay but I wanted to create a GUI for this command.

And here is as I had imained:

1. Open the Converter.
2. Select which file to convert
3. Select distanation place and file name
4. Convert.
5. Finished

Now that sound simple in my head but I don't know where to start or what to look for - I got Xcode installed but with out a starting point there is no progress :-)

The script which I need to type is:


If you got any information on this matter or tutorials / case studies you want to share I would be really glad - Plus I am not afraid to get my hands dirty and learn a bit...

Thank you in advance...
Sofus
sgraae is offline   Reply With Quote
Sponsored Links
11-08-2007   #2 (permalink)
Concierge
 
mdmunoz's Avatar
 
Join Date: Nov 2006
Location: Davis, CA
Posts: 643
mdmunoz has disabled reputation
Send a message via AIM to mdmunoz
This sounds like something that can be done with Applescript fairly easily, without the complexity of XCode.

I can't see your script, but an applescript application can be created by saving something like this in Script Editor:


Code:
--ask the user for a file to convert
set fileToConvert to choose file

--select destination and name
set fileDestination to choose file name

--do the conversion script, shell script line breaks are replaced by the ";" (semicolon) character
do shell script "script goes here"
The way to get the variables fileToConvert and fileDestination into your script is to use ampersands to put strings together. Here's an example:

Code:
do shell script "shellcommand -abcd " & (quoted form of (POSIX path of fileToConvert)) & " " & (quoted form of (POSIX path of fileDestination))
What I did there was end the quotes for the shell script and insert the Applescript variable name surrounded by two ampersand symbols to connect the strings together. Then I inserted another space (in quotes) and added the next variable using ampersands.

The POSIX path part makes sure we're using the file path with slashes (~/Desktop/file.txt) and the quoted form means we won't get errors with spaces in file names.

If this is confusing, post the script you want to use and I'll see if I can make the script.

Once you have a working script, you just save it in Script Editor as an application bundle (the Startup Screen and Stay Open checkboxes in the save dialog should be unchecked).
__________________
Guy in the Hat

Last edited by mdmunoz; 11-08-2007 at 07:01 PM.
mdmunoz is offline   Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting 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
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT -6. The time now is 11:58 AM.




Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0 RC5
© 2004-2008