The LFA Scene Manager for MAYA

The place for artists, modellers, level designers et al to discuss their approaches for creating content for OGRE.
Post Reply
User avatar
metaldev
Orc Shaman
Posts: 761
Joined: Thu Mar 17, 2005 11:56 pm
Location: Boston
x 12
Contact:

Post by metaldev »

although there are some problems with ogre toolbox...
I was able to view my .scenes with it, make sure your assets are in folders that are listed inside the configuration files of ogre toolbox.

User avatar
maxxoros
Greenskin
Posts: 130
Joined: Tue Feb 22, 2005 7:18 pm

Post by maxxoros »

@metaldev
manage to view in ogretoolbox now...
however...I have tried but can not find out material node for mesh

Code: Select all

        <node name="pCube1" id="0">
            <position x="0" y="1.970101485" z="0" />
            <rotation qx="0" qy="0" qz="0" qw="1" />
            <scale x="156.327129" y="-40.12762982" z="156.327129" />
            <entity name="pCube1_entity" id="0" meshFile="pCube1.mesh" static="true" castShadows="false" />
        </node>
        <node name="pCube2" id="2">
            <position x="0" y="40.94138634" z="2.119519158" />
            <rotation qx="0" qy="0" qz="0" qw="1" />
            <scale x="29.94247697" y="29.94247697" z="29.94247697" />
            <entity name="pCube2_entity" id="0" meshFile="pCube2.mesh" static="true" castShadows="false" />
        </node>
        <node name="pointLight1" id="0">
            <position x="-26.95775087" y="25.11902568" z="0" />
            <rotation qx="0" qy="0" qz="0" qw="1" />
            <scale x="1" y="1" z="1" />
            <light name="pointLight1_light" id="0" type="point" visible="true" castShadows="false">
                <colourDiffuse r="1" g="1" b="1" a="1" />
                <colourSpecular r="1" g="1" b="1" a="1" />
                <lightAttenuation range="10" constant="1" linear="0" quadratic="0" />
            </light>
        </node>
Is material node export for each mesh available...
Moreover, I wonder about collidable check box...How it work??I check and can not find any node

User avatar
metaldev
Orc Shaman
Posts: 761
Joined: Thu Mar 17, 2005 11:56 pm
Location: Boston
x 12
Contact:

Post by metaldev »

if it didnt export materials its because you didnt export scene.

the 'collision' box doesnt do anything, and will be removed from the final version... it is left over from the previous version of the script, and i wasn't able to get around to removing it yet.

User avatar
metaldev
Orc Shaman
Posts: 761
Joined: Thu Mar 17, 2005 11:56 pm
Location: Boston
x 12
Contact:

Post by metaldev »

OK!

the Maya scene manager is content complete!
(and using .scene/dotScene)

grab it --->HERE<---

changes include:
-added support for cameras
-added support for sprites and sprite clouds
-added support for particle systems
-added support for lookTargeting and trackTargeting
-fixed bugs with directional lights
-fixed bugs with spot lights
-other misc features and bug fixes


enjoy! :D

NOTE TO USERS WITH OLDER VERSIONS!
this version has had some dramatic internal changes made to support the new features... it will not work with previously tagged objects... so you will either have to delete them or 'HARD delete parameters' before updating... ALSO, the names of all the files have been changed to more appropriate names... so be sure to manually delete the following files before installing:
LFA_customScripts.mel
LFA_exporterReadme.txt
LFA_OGREexporter.mel

User avatar
maxxoros
Greenskin
Posts: 130
Joined: Tue Feb 22, 2005 7:18 pm

Post by maxxoros »

Everything go perfect...but I find there is no way to control the ambient color
<colourAmbient r="0" g="0" b="0" a="0" />
How could I change ambient color? Could you help me
:)

User avatar
metaldev
Orc Shaman
Posts: 761
Joined: Thu Mar 17, 2005 11:56 pm
Location: Boston
x 12
Contact:

Post by metaldev »

cool! :)

you add an ambient light and make it exportable.


read this page i set up:
http://www.lfagames.com/help.htm


also, i dont think that tag works in ogre toolbox :?

joi
Gnome
Posts: 327
Joined: Tue Feb 22, 2005 8:11 pm
Location: brazil

Post by joi »

hey mentaldev! i wanna thank you for all the effort you are putting in! its sure to be apreciated!
maya 7.0, vs 2005, ogre 1.2

User avatar
metaldev
Orc Shaman
Posts: 761
Joined: Thu Mar 17, 2005 11:56 pm
Location: Boston
x 12
Contact:

Post by metaldev »

your welcome joi,

hopefully this stuff will help you and other people out :)

User avatar
maxxoros
Greenskin
Posts: 130
Joined: Tue Feb 22, 2005 7:18 pm

Post by maxxoros »

@metaldev: The script is great...However could you add these more function
-------
1. Massive make exportable...We can select a lot of model and press make exportable, not just a model :)
2. Support for converting to dotsceneoctree.
Because dotsceneoctree seem better for larger scene...and we must run a stand-alone command line convert tool to convert from a dotscene format to a .scene octree
---
The function of this tool is
----------------------------------

Code: Select all

SceneConvert <.scene filename> <MaxTriPerNode> <MaxDepth>
Example code

Code: Select all

SceneConvert MyScene.scene 5000 4
----------------------
This is convert tool http://www.netsoftsol.net/ogre/DSOctree ... t_tool.rar
---
-----------------------------
Could you add these function for the script ....

User avatar
metaldev
Orc Shaman
Posts: 761
Joined: Thu Mar 17, 2005 11:56 pm
Location: Boston
x 12
Contact:

Post by metaldev »

as far as the mass exportable button.. i thought of adding that, but didnt get to it... i promise ill try to put that in the next version for you :)

for now,i did add other options to workaround that... one would be to tag your object before duplicating or instancing... then the duplicates/instances would inherit the export parameters.

the other option is to selection your object, then in the scene manager tool window do file > save parameters ... select your new object then file > load parameters ... now the second object will have the parameters of the first (except the node name, which you should update)

maybe i could add the converter to dotsceneoctree also... id have to look into it.. but might be a while till i get around to adding these things.

Bringer of Darkness
Halfling
Posts: 98
Joined: Thu May 05, 2005 3:57 pm

Post by Bringer of Darkness »

In fact I have already done the mass exportable, but I am afraid it wouldn't be any help to you I have adapted the format to our needs.

Additionaly, when our version will work well, I will publish it later sometimes.
The most important question is, if you want to use some other "game editor" or do you want Maya to handle also game editor.
In the second case, there will be plenty of attributes, you will need to add to your geometries, locators, etc. Therefore I have adapted this exporter to very easily add new attributes (in fact write one line to definitiion file) to any objects you may need (in fact here, if you would like to add new attribute, there needs to be plenty of code modified).
Though not sure, whether anyone here may find such function useful;-)))

User avatar
maxxoros
Greenskin
Posts: 130
Joined: Tue Feb 22, 2005 7:18 pm

Post by maxxoros »

@Bringer of Darkness
I am using maya as level edior, and with .scene format, It s great...
---
mass exportable is neccessary :)
---
Surely we must add new attribute to node to make a real editor...
--
Could you share your mel too :)

User avatar
metaldev
Orc Shaman
Posts: 761
Joined: Thu Mar 17, 2005 11:56 pm
Location: Boston
x 12
Contact:

Post by metaldev »

hey guys!
A new version of LFA scene manager (v1.1) is now available! :)

grab it --->HERE<---


changes include:

mass make exportable-
simply select whatever objects you want and do 'tools > multiple make exportable'... if it is capable of being exported, it will then be so.

locator as entity-
added the ability to use a locator as a mesh... this is useful for incorporating .mesh files into your .scene that have been exported from separate maya files.

select heirarchy-
tools > select heirarchy: selects all nodes that are children, grandchildren greatgrandchildren, etc of the selected objects... this is uselful when building a skeleton or for making sure that every node in a heirarchy has parameters.

changed the way materials are exported-
the way exporting materials were before were admittedly a little confusing... i changed it to be more intuitive as follows:
-only the materials of objects that have "materials" checked will have their material included in the sceneName.material file. simply uncheck "material" to exclude it.
-to export a particular objects material you must now do: 'Tools > Export materials of selected' (this works regardless of 'material' being checked on/off)
the reason i did this is so that you can easily modify a particular material script and not worry about it being overwritten everytime you export.

other small/misc changes were made also.

enjoy!
:D

@maxxoros--
i have the automated conversion to dotscenoctree on my list, but i have to look into it a bit more before implementing. ill try to have it for you on the next version ok :)

User avatar
maxxoros
Greenskin
Posts: 130
Joined: Tue Feb 22, 2005 7:18 pm

Post by maxxoros »

Great when version 1.1 was released :)
---------
However, I want to report some bug/error/annoying thing when using mel and feature we should add :)
-------
1. Duplicate name problem
When we duplocate an object, In export parameter, the name was change to nameojectFOO :) ... This seem good when we duplicate one object...however, if we duplicate more then 3 times an object...We will see problem, the name now is objectnameFOOFOOFOOFOOFOOFOOFOO......opps :( and maya take very very long time to read show the name and I afraid of name limit and problem when using ogre with long name entity ..
Image
So, we should use the way maya use when duplicate object, add number 1,2,3....after name :) or the best get the name from maya like we do when "Make exportable"
----------
2. Maya crash when export a lot of objects, maybe more than 120 :(
If we have the scene like this
Image
I have more than 300 exportable object
And if I export scene, after exporting .material file...maya crash :(...
It end here
Image
If we have about 100 object, maya do not crash BUT we MUST WAIT A LONG TIME before exporting happens...
You can download my scene for testing in this case
My scene
I think the problem just in the loop

Code: Select all

for ($currentNode in $theNodes)
{ 
if (`exportable $currentNode`)
{
string $type = "null";
string $shapeName[] = `listRelatives -s -f $currentNode`;
if (`size($shapeName)` != 0) {$type = `objectType $shapeName[0]`;}
if ($type == "mesh")
{

string $meshToUse[1] = {`returnInstanceOrig $currentNode`};
$alreadyExported = 0;

for ($anExportedMesh in $keepTrackOfExportedMeshes) //check for an already exported mesh
{
if ($anExportedMesh == $meshToUse[0]) 
$alreadyExported = 1;
}

if ($alreadyExported == 0)
{
$exportNum ++;
$keepTrackOfExportedMeshes = `stringArrayCatenate $keepTrackOfExportedMeshes $meshToUse`;
exportMeshWithOGRE $currentNode;
}
else
{$instances++;}
} 
} 
}
//print "here\n";
//print $keepTrackOfExportedMeshes;
Maybe we should optimize the loop by export each 10 object then wait...and continue it? Sorry I do not know much about code so this is just my thought

3. Duplicate group in maya with copy or instance type
Problem with name when duplicate I have said above, but I want to say more about copy or instance because It is an important thing when make scene ... group like tree,grass must be instance
a. Copy type
The problem with copy type just the object name FOOFOOFOO in parent and child
a. Instance type
Instance group, this is really a problem, If we duplicate with instance a group, a new node was create like this and NO TRANSFORM node :(..
Image
So we can not create a new export entity because the new groups still share node with the old one...
Transform node is only created when we un-group the instance group node.
This is the construct of node we must gain when using instance group. But I can not find an automatical way to make this kind of nodes
Image
So, could you make the instance group export automatically

4. Reset transform for child node
// Warning: Did not reset tranformations for group1|branch_183: unparent before resetting transforms. //
reset transforms for 0 objects.
// Warning: Did not reset transforms for 1 objects. See script editor for details. //
We could not do it now :)...
Last edited by maxxoros on Mon Aug 08, 2005 1:24 pm, edited 7 times in total.

Vectrex
Ogre Magi
Posts: 1266
Joined: Tue Aug 12, 2003 1:53 am
Location: Melbourne, Australia
x 1
Contact:

Post by Vectrex »

just want to say great work! It's really appreciated

Bringer of Darkness
Halfling
Posts: 98
Joined: Thu May 05, 2005 3:57 pm

Post by Bringer of Darkness »

See below...
Last edited by Bringer of Darkness on Mon Aug 08, 2005 12:58 pm, edited 1 time in total.

Bringer of Darkness
Halfling
Posts: 98
Joined: Thu May 05, 2005 3:57 pm

Post by Bringer of Darkness »

Here is the alternative fix for duplicate names.
In fact, Maya takes care of the duplicate names itself, so if you make copy of any object, it changes the name approprietly to new unique name.
So, if you have finished copying, just run the Fix Duplicate Names button and you are done...
It only changes the duplicate names...
I know, it is quite "seems easy solution", but in fact I have been trying the other approach, until I realized that this one is much easier and the same way effective (maybe even better, as it creates some unification between Maya name and export name...).
I hope it will help and no mistakes are in - I have a bit different version, but it shouldn't be compatible with the scripts of yours, so I had to adapt it here only;-))
I hope it will works well....

Edit: Sorry for double post, something went wrong:-)
--------------------------------------------------------------------------------
To install:
Open your LFA ogre export script and replace checkDuplicateEntityNames.
I believe MetalDev will include this one in his next release of exporter;-))

--------------------------------------------------------------------------------
global proc int hasDuplicate(string $nameToCheck, string $exportName)
{
if (`objExists $nameToCheck`)
if (`exportable $nameToCheck`)
{
string $allTransformNodes[] = `ls -tr`;
int $i;
int $match = 0;

for ($i = 0; $i < size ($allTransformNodes); $i++)
{
if (`exportable $allTransformNodes[$i]` && `getAttr ($allTransformNodes[$i]+".exportName")` == $exportName)
{
$match++;
if ($match > 1)
return 1;
}
}
}
return 0;
}

global proc checkDuplicateEntityNames(string $nameToCheck)
{
string $exportName = `getAttr ($nameToCheck+".exportName")`;
if (`hasDuplicate $nameToCheck $exportName`)
{
//we use the default Maya name, this should fix the most of the cases
//as Maya takes care of unique names by itself...
setAttr ($nameToCheck + ".exportName") -type "string" $nameToCheck;
}
}

User avatar
maxxoros
Greenskin
Posts: 130
Joined: Tue Feb 22, 2005 7:18 pm

Post by maxxoros »

@Bringer of Darkness
The new Fix Duplicate name function seem good :) and It will help when we sometimes get entity share the same name.
-----------------
However, in this situation, the problem is more specific...if we dubplicate an object, change the name to object1, object2, object3 (the best we get the name from maya)...ect not objectFOO, objectFOOFOO, objectFOOFOOFOO :)

Bringer of Darkness
Halfling
Posts: 98
Joined: Thu May 05, 2005 3:57 pm

Post by Bringer of Darkness »

Yes, I was checking that option as well.
It can be easily added to the native Alias script to check the name duplicity. But on the other hand, I think it might be better to hit one button once after you are done with copying - I haven't checked that, but in larger scenes it might be significantly slowing down duplicating objects, MEL scripts are much slower than native API plugins....

Anyway, it might be nice to have such option indeed (which should be switched off/on). I will check that.

User avatar
maxxoros
Greenskin
Posts: 130
Joined: Tue Feb 22, 2005 7:18 pm

Post by maxxoros »

:)
--
@bringer of Darkness, your script work well, It do not only ternimate the "FOO" in Duplicating object but also prevent us change name of entity to the name of an existing entity...
------------------------------------
And the error happens when export a scene with more than 100 object, I have found the problem (If anyone get time, can test my scene to see the problem with large scene)
The function

Code: Select all

checkAllDuplicateEntityNames
at the start of LFA_exportGeometry cause the crash, the loop is the problem here. We can simply remove because the hack mod by Bringer of Darkness will prevent any Duplicate name :)...The export will happen immediately.
----------------------------------
Another problem with export large scene I forgot to say above: Maya "forget" to convert to .MESH some object
You can test my scene above (remmeber to remove checkAllDuplicateEntityNames in LFA_exportGeometry before do exporting scene and see the number of .MESH we get compare with the number of .XML. I really do not understand the problem here
-------------------------------------
Sorry for bother all, I have thought of another function that will be very helpful, It base on the function of Bringer of Darkness: Reset entity name
When making scene, sometimes we change the name of object and then must return to LFA Scene Manager, change the name to make it fix with name on maya (we should do it to control object better both in Maya and Ogre).
So, the function Reset entity name will automatically get maya object name and set to the entity name in LFA Scene Manager. The function should have 2 ways
1. Reset all the scene
2. Reset selected objects :)
---
@metaldev: so many function and stuff I give out...But they all neccessary function that will help us make maya become the best level editor for Ogre :)

Bringer of Darkness
Halfling
Posts: 98
Joined: Thu May 05, 2005 3:57 pm

Post by Bringer of Darkness »

That's quite an easy function and true, thinking of it, yes, it might work well...
So here it is:-)

You can either call it via console or create a shortcut. Metaldev will include this in his UI for sure in his next version but I am using a different UI and scripts are heavily different as well, so only function has to be enough;-)

It resets either all objects (if nothing is selected), or selected objects names to Maya names...

Just copy and insert it into your LFA exporter...
-----------------------------------------------------------------------------
global proc resetNameSettings()
{
string $selected[] = `ls -sl`;
if (size($selected) == 0)
$selected = `ls -tr`;
int $i;
for ($i =0; $i < size($selected);$i++)
if (`exportable $selected[$i]`)
setAttr ($selected[$i] + ".exportName") -type "string" $selected[$i];
}
------------------------------------------------------------------------------
Additionaly, just came to my mind, that you may find useful script for "mass renaming" - ie, if you have 100 objects and you want them to be named Tree01...Tree100, just simply select, type the following function to the console with "Tree" as argument and it will rename all objects you have selected appropriatly...
Considering the situation we are working in, I have added the UI for this one also, so I am updating the sourcecode...
It definitively is much more comfortable now:-)
Start function with `raiseMassRenameWindow` - actualy I would suggest to make button/item in menu...
Enjoy.
------------------------------------------------------------------------------
global proc raiseMassRenameWindow()
{
int $winWidth = 60;
int $winHeight = 40;

//start window

window -title "Mass Rename"
-menuBar false
-rtf 1
-in "Mass Rename"
-sizeable 1
massRenameWindow;

columnLayout -adj 1 renameTop;

textFieldGrp
-label "Name"
-cw 1 60
-cw 2 125
-text "Type name here..."
-ann "Define the name for objects..."
massName;

rowColumnLayout
-numberOfColumns 3
-cw 1 60
-cw 2 60
-cw 3 60
-cs 2 3
-p renameTop
buttonsLayout;

button -p buttonsLayout -c "renameSelected(`textFieldGrp -q -tx massName`);" -label "Apply" -ann "Apply";
button -p buttonsLayout -c "renameSelected(`textFieldGrp -q -tx massName`);deleteUI massRenameWindow;" -label "Rename" -ann "Renames selected objects...";
button -p buttonsLayout -c "deleteUI massRenameWindow;" -label "Cancel" ;

window -e -s 1 massRenameWindow;
showWindow;
}

global proc renameSelected(string $name)
{
string $selected[] = `ls -sl`;
int $i;
for ($i = 0; $i < size($selected); $i++)
{
string $newName;
if ($i < 10)
$newName = $name + "0" + $i;
else
$newName = $name + $i;
rename $selected[$i] $newName;
}
}
------------------------------------------------------------------------------
Last edited by Bringer of Darkness on Mon Aug 08, 2005 3:20 pm, edited 1 time in total.

User avatar
maxxoros
Greenskin
Posts: 130
Joined: Tue Feb 22, 2005 7:18 pm

Post by maxxoros »

@ Bringer of Darkness
yes, It work well, and I have made a new button for it in my mel :)
------------
So, until now, we have solve problem with
  • 1. Duplicate name problem
    2. Maya crash when export a lot of objects, maybe more than 120
---------
Add two new function
  • 1. Prevent set the same name for entity
    2. Reset entity name
----------
And there are 3 problem left
  • 1. Duplicate instance group: maybe we must write a new function for dublicate object in instance type to use in this case
    2. Reset transform for child node
    3. Maya "forget" to convert to .MESH some object : can not think a way for it
----------
Last edited by maxxoros on Mon Aug 08, 2005 3:55 pm, edited 1 time in total.

Bringer of Darkness
Halfling
Posts: 98
Joined: Thu May 05, 2005 3:57 pm

Post by Bringer of Darkness »

I have updated the function for renaming above in case you would like it.

I believe that a metaldev wouldn't mind modifying and uploading updated scripts. But I would suggest that it might be good, that only one guy (ie metaldev) uploads the new versions of exporter/scene manager, as it would surely much improve the orientation, improvements and further modifying(avoiding one function work in one release and missing/not working in other release...)

Additionaly, the problem with not converting some mesh objects I have solved a quite some time ago, I thought it was fixed in last release of your exporter. In case it isn't, here is the corrected function that needs to be replaced:
-----------------------------------------------------------------------------

Corrected, check below...
Last edited by Bringer of Darkness on Mon Aug 08, 2005 4:44 pm, edited 1 time in total.

User avatar
maxxoros
Greenskin
Posts: 130
Joined: Tue Feb 22, 2005 7:18 pm

Post by maxxoros »

@ Bringer of Darkness : Your script to mass rename object is good one...and Maya also have a good thing to rename object
choose objects Modify -> Prefix hiearchery name
----------
Last edited by maxxoros on Mon Aug 08, 2005 3:56 pm, edited 2 times in total.

Bringer of Darkness
Halfling
Posts: 98
Joined: Thu May 05, 2005 3:57 pm

Post by Bringer of Darkness »

Thanks, I haven't noticed this function in Maya;-))
I was considering using wildcards in my script, maybe later I will improve that to DOS style wildcard characters...Should be nice improvement;-)

Post Reply