Difference between revisions of "Advanced Sculptie Exporter From Maya"

From Second Life Wiki
Jump to navigation Jump to search
 
(29 intermediate revisions by 10 users not shown)
Line 1: Line 1:
(this is bare bones template for communal work - please, PLEASE, feel free to rewrite every word here.  in fact, the first person to do a major clean-up becomes my new best friend.  an original copy of the tutorial (complete with graphics and witty banter) is available at http://www.qarl.com/qLab/?p=49 )
{{Help|Object=*}}[[Image:Qlab_ant.jpg|right]]


the idea here is to take an entire maya scene (modeled with NURBS, that is) and import it directly into SL, complete with surface textures and baked lighting and all position/scale/rotation information. it builds upon the maya exporter we released with the initial sculptie launch.
''(this is bare bones template for communal work - please, PLEASE, feel free to rewrite every word here.  in fact, the first person to do a major clean-up becomes my new best buddy.  an original copy of the tutorial (complete with graphics and witty banter) is available at [http://www.qarl.com/qLab/?p=49 qLab] ALSO - if you feel so inclined, feel free to improve upon the codebase.) --[[User:Qarl Linden|Qarl Linden]] 09:53, 21 June 2007 (PDT)''


first-up in an example maya scene.  here we have a generous contribution from Bret St. Clair, his ant: http://www.qarl.com/qLab/pile/ant/ant.ma (can we store these files in the wiki itself, so that they too can be modified?)
== Overview ==
[[Image:Qlab_maya.jpg|150px|left]]


with the maya scene open, now execute this mel script: http://www.qarl.com/qLab/pile/ant/sculpt.mel
The idea here is to take an entire Maya scene, modeled with NURBS, and import it directly into Second Life complete with surface textures, baked lighting and all position/scale/rotation information. It builds upon the maya exporter we released with the initial sculptie launch.


the option to "Bake surface textures" will do just that - create one surface texture per prim, to be applied later. unfortunately, our maya ant has no interesting textures (he's white) but we do capture his lighting (and shadows.)  you also want to click "Generate Primscript" which creates a file describing the scene.
First-up in an example Maya scene:  here we have a generous contribution from Bret St. Clair, his ant: [http://www.qarl.com/qLab/pile/ant/ant.ma ant.ma]


the next bit is tedious. first, create a prim called "qDynaPrim". into this place all the textures above (you'll want to bulk upload them) together with the following scripts:
<!--
: (can we store these files in the wiki itself, so that they too can be modified?)
:: (script is too big for wiki page, otherwise this link would work [http://wiki.secondlife.com/w/index.php?action=raw&ctype=text/javascript&dontcountme=s&title=Advanced_Sculptie_Exporter_From_Maya/ant.ma ant.ma] - Dz)
-->


http://www.qarl.com/qLab/pile/ant/prim
== Maya Scripts ==
http://www.qarl.com/qLab/pile/ant/texture
[[Image:Qlab sculpt.jpg|150px|left]]
http://www.qarl.com/qLab/pile/ant/transform
http://www.qarl.com/qLab/pile/ant/shape


the scripts were generated with my qLab code - which may explain why they're a bit funny.
With the maya scene open, now execute this mel script: [http://www.qarl.com/qLab/pile/ant/sculpt.mel sculpt.mel]


now create another prim and call it "ant maker" (this name isn't terribly important) and put the "qDynaPrim" into it (THIS name is important.)  also put http://www.qarl.com/qLab/pile/ant/primscript into it.
The option to "Bake surface textures" will do just that - create one surface texture per prim, to be applied later. Unfortunately, our Maya ant has no interesting textures (he's white) but we do capture his lighting (and shadows). You also want to click "Generate Primscript," which creates a file describing the scene.


this "primscript" script will read your primscript file - rez copies of the "qDynaPrim" - and send them commands to control their shape/position/appearance.
== In-world Scripts ==
The next bit is tedious. First, create a prim called "qDynaPrim". Into this, place all the textures above together with the following scripts:


now you need only invoke the primscript command (which listens on channel 500.)  create a notecard containing the primscript, get its UUID, and say <code>/500 primscript -script 32fad6a2-630e-aaf0-2659-817ea00b1052</code>. course you'll want to replace that UUID with your own - especially if you want to make something OTHER than ants.
* [http://www.qarl.com/qLab/pile/ant/prim prim]
* [http://www.qarl.com/qLab/pile/ant/texture texture]
* [http://www.qarl.com/qLab/pile/ant/transform transform]
* [http://www.qarl.com/qLab/pile/ant/shape shape]


hope you enjoy.
(These scripts were generated with the qLab assembler - which may explain why they look a bit funny.)
 
Now create another prim and call it "ant maker" (this name isn't terribly important) and put the "qDynaPrim" into it (THIS name is important). Put the [http://www.qarl.com/qLab/pile/ant/primscript prim script] into it, also.  Be sure the 'Running' box is checked, otherwise it didn't compile correctly which means that it wasn't copied and pasted correctly.
 
This "primscript" will read your primscript file - rez copies of the "qDynaPrim" - and send them commands to control their shape/position/appearance.
 
Now you need only to invoke the primscript command (which listens on channel 500). Create a notecard (any name) containing the Maya-generated primscript, get its UUID, and say:
<pre>/500 primscript -script 32fad6a2-630e-aaf0-2659-817ea00b1052</pre>
Of course, you'll want to replace that UUID with your own - especially if you want to make something OTHER than ants.
 
Hope you enjoy.
 
[[Image:Qlab_bad_ant.jpg]]
 
(There appears to be a problem with the checkbox for "Generate primscript" on Maya 8.5 on Win32.  One solution is to set $generate_primscript to 1 manually in the script.)
 
----
Setting "-scrollable 1;" to 0 in the script will show the checkbox for Generate Primscript for Maya 8.5 on Win32. [[User:Tanner Devonshire|Tanner Devonshire]] 08:48, 16 July 2007 (PDT)
(If you are having trouble locating your scripts, "drive letter"/Program Files/Autodesk/Maya Bonus Tools/Scripts seems to be the default folder for the primscripts)
----
For Maya 2008 I found the primscript at [drive letter]\Program Files\Autodesk\Maya2008\bin
 
==Automated Import To Second Life==
Using the [[Importprimscript]] program you can automatically import the exported folder from Maya including lossless sculpt maps, compressed textures, and a linked full-mod model of the scene rezzed. You will need .NET 2.0 runtime libraries or Mono to run the program.
==Maya for Linux Dialog Formatting Bug==
Unfortunately there's a bug in the MEL implementation in Maya for Linux such that widget control group boxes do not necessarily automatically size themselves to fit the widgets they contain as the Windows version does, unless they've been explicitly told to do this.  The script '''sculpt.mel''' available at the link above will have to be hand-modified to account for this difference, so that it works on Linux installations of Maya.  This bug has been present in Maya since version 6. 
 
In the MEL script, in the global procedure '''llSculptEditor()''', replace this line:
scrollLayout;
with this one:
scrollLayout -childResizable 1 -defineTemplate DefaultTemplate;
and all will be well.
 
[[Category:Sculpted_Prims]]

Latest revision as of 13:07, 7 February 2011

Qlab ant.jpg

(this is bare bones template for communal work - please, PLEASE, feel free to rewrite every word here. in fact, the first person to do a major clean-up becomes my new best buddy. an original copy of the tutorial (complete with graphics and witty banter) is available at qLab ALSO - if you feel so inclined, feel free to improve upon the codebase.) --Qarl Linden 09:53, 21 June 2007 (PDT)

Overview

Qlab maya.jpg

The idea here is to take an entire Maya scene, modeled with NURBS, and import it directly into Second Life complete with surface textures, baked lighting and all position/scale/rotation information. It builds upon the maya exporter we released with the initial sculptie launch.

First-up in an example Maya scene: here we have a generous contribution from Bret St. Clair, his ant: ant.ma


Maya Scripts

Qlab sculpt.jpg

With the maya scene open, now execute this mel script: sculpt.mel

The option to "Bake surface textures" will do just that - create one surface texture per prim, to be applied later. Unfortunately, our Maya ant has no interesting textures (he's white) but we do capture his lighting (and shadows). You also want to click "Generate Primscript," which creates a file describing the scene.

In-world Scripts

The next bit is tedious. First, create a prim called "qDynaPrim". Into this, place all the textures above together with the following scripts:

(These scripts were generated with the qLab assembler - which may explain why they look a bit funny.)

Now create another prim and call it "ant maker" (this name isn't terribly important) and put the "qDynaPrim" into it (THIS name is important). Put the prim script into it, also. Be sure the 'Running' box is checked, otherwise it didn't compile correctly which means that it wasn't copied and pasted correctly.

This "primscript" will read your primscript file - rez copies of the "qDynaPrim" - and send them commands to control their shape/position/appearance.

Now you need only to invoke the primscript command (which listens on channel 500). Create a notecard (any name) containing the Maya-generated primscript, get its UUID, and say:

/500 primscript -script 32fad6a2-630e-aaf0-2659-817ea00b1052

Of course, you'll want to replace that UUID with your own - especially if you want to make something OTHER than ants.

Hope you enjoy.

Qlab bad ant.jpg

(There appears to be a problem with the checkbox for "Generate primscript" on Maya 8.5 on Win32. One solution is to set $generate_primscript to 1 manually in the script.)


Setting "-scrollable 1;" to 0 in the script will show the checkbox for Generate Primscript for Maya 8.5 on Win32. Tanner Devonshire 08:48, 16 July 2007 (PDT) (If you are having trouble locating your scripts, "drive letter"/Program Files/Autodesk/Maya Bonus Tools/Scripts seems to be the default folder for the primscripts)


For Maya 2008 I found the primscript at [drive letter]\Program Files\Autodesk\Maya2008\bin

Automated Import To Second Life

Using the Importprimscript program you can automatically import the exported folder from Maya including lossless sculpt maps, compressed textures, and a linked full-mod model of the scene rezzed. You will need .NET 2.0 runtime libraries or Mono to run the program.

Maya for Linux Dialog Formatting Bug

Unfortunately there's a bug in the MEL implementation in Maya for Linux such that widget control group boxes do not necessarily automatically size themselves to fit the widgets they contain as the Windows version does, unless they've been explicitly told to do this. The script sculpt.mel available at the link above will have to be hand-modified to account for this difference, so that it works on Linux installations of Maya. This bug has been present in Maya since version 6.

In the MEL script, in the global procedure llSculptEditor(), replace this line:

scrollLayout;

with this one:

scrollLayout -childResizable 1 -defineTemplate DefaultTemplate;

and all will be well.