Anim8or Community

Please login or register.

Login with username, password and session length
Advanced search  

News:

Ian Ross has just released a book on Anim8or. It's perect for a beginner and a good reference for experienced users. It contains detailed chapters on every aspect, with many examples. Get your own copy here: "Anim8or Tutorial Book"

Author Topic: One way to group objects in hiearchal form  (Read 17250 times)

lppena

  • Sr. Member
  • ****
  • Posts: 299
  • Anim8or, does a body good.
    • View Profile
    • Truespace Anim8or Casual Modeling Forum.
One way to group objects in hiearchal form
« on: July 12, 2012, 01:30:51 pm »

I found that moving blocks of text around is helping me understand a little on how Anim8or can be set to link objects in hiearchal form. I still get frame read and commentary errors, but the model file seems somewhat intact in terms of 3d Exploration being able to display them for viewing. The text block I moved is listed below to show what I copied and moved to be under area of the XSI script that I've been working on from the original script created by Raxx. I could really use some feedback on how to get rid of the frame read and commentary error. I posted a pic of the hiearchal display and actual errors in 3DEX. Thanks, Leroy. PS: I attached the modified script for others to take a look at and possibly modify it some more.

Code: [Select]
$curObject.GetShapes($childShapes);
$shapes.size = 0;
while ($childShapes.size > 0)
    $shapes.push($childShapes.pop());
    
/*$output.print("Frame Frm {\n     FrameTransformMatrix {\n  1.000000,0.000000,0.000000,0.000000,\n  0.000000,1.000000,0.000000,0.000000,\n  0.000000,0.000000,1.000000,0.000000,\n  0.000000,0.000000,0.000000,1.000000;;\n   }\n");*/


while ($shapes.size > 0) {
    $shape = $shapes.pop();
    
        if ($shape.GetKind() == SHAPE_KIND_GROUP) {
        $shape.GetShapes($childShapes);
        
        while ($childShapes.size > 0) {
            $shapes.push($childShapes.pop());

 $output.print("Frame %s {\nFrameTransformMatrix {\n", $shape.name);
  
        $transformMat = $shape.GetGlobalTransform();
        $tr4=$transformMat.Project((0.0,0.0,0.0));
        $tr1=$transformMat.Project((1.0,0.0,0.0))-$tr4;
        $tr2=$transformMat.Project((0.0,1.0,0.0))-$tr4;
        $tr3=$transformMat.Project((0.0,0.0,1.0))-$tr4;
        $output.print("  %.6f,%.6f,%.6f,0.000000,\n",$tr1);
        $output.print("  %.6f,%.6f,%.6f,0.000000,\n",$tr2);
        $output.print("  %.6f,%.6f,%.6f,0.000000,\n",$tr3);
        $output.print("  %.6f,%.6f,%.6f,1.000000;;\n }\n",$tr4);
        

« Last Edit: July 12, 2012, 01:57:00 pm by lppena »
Logged

polyGon_tError

  • Jr. Member
  • **
  • Posts: 50
    • View Profile
some Info about the Modification
« Reply #1 on: January 16, 2014, 03:26:55 am »

lppena - i am not sure if you found any solution, so here is what i think.

you have one Error and one Coding Mistake.

Error :
the Hierarchical Structure of XSI file is wrong. you missed a '}' in closing 'Frame', and make a Duplicate Definition which is caused by moving wrong Block of Code in wrong place.

Coding Mistake:
the Export Script have three part for working with Exporting Object.

1. this part of Code make sure you are not using Group directly. in ASL you can only Export/Use Mesh Data. this part simply 'Pop' all Group Member to an Array.
Code: [Select]
if ($shape.GetKind() == SHAPE_KIND_GROUP) {
        $shape.GetShapes($childShapes);
       
while ($childShapes.size > 0) {
         $shapes.push($childShapes.pop());
/* Fix - Do nothing here */
         }
}
so you are not required to do anything within this 'While' Loop.

2. this part filter any thing that can't be used.
Code: [Select]
else if ($shape.GetKind() == SHAPE_KIND_PATH || $shape.GetKind() == SHAPE_KIND_MODIFIER ||
$shape.GetKind() == SHAPE_KIND_TEXT){
        /* No 3D Mesh to Output. */
           }
...Nothing to do here as well.

3. this is where you do all thing for Exporting. you Process the Mesh Data for the desired Export Format (in this case it is XSI).

*Note: the Output is Functional/Working/Loading - Reason is 3D-Explore (and other few the like Software) is not Written to work Strictly and it's Internal File Parser usually work with Understandable Broken File Structure.

now correct the Code yourself (in case it is not solved) and tell me what you get, thanks.
« Last Edit: January 16, 2014, 04:00:02 am by polyGon_tError »
Logged

lppena

  • Sr. Member
  • ****
  • Posts: 299
  • Anim8or, does a body good.
    • View Profile
    • Truespace Anim8or Casual Modeling Forum.
Re: One way to group objects in hiearchal form
« Reply #2 on: January 16, 2014, 12:26:25 pm »

I'm sorry Poly but I didn't write the exporter and I'm not sure what to do with the hiearchal grouping part. As it was explained to me by another user Grouping objects in Anim8or is not supported the same way as the way Softimage XSI uses it. Perhaps, you could edit the attached exporter script and I could test it out as I did when Raxx did the original script. As he wrote it it works pretty well with the exception of the object group linking. In order for the Video game engine that reads the model file some parts need to linked in sub groups under other groups.

For example it would look something like this:

main_body
             turret
                    recoil
                           hp_cannon
                           hp_gun_1
                           hp_gun_2
hp_special
flame_1
flame_2

I suppose main_body would be the parent object, turret a child object, recoil a child, the hp's as a child of recoil, etc. Hope this helps explain the issues the exporter has problems with. Leroy.
Logged

polyGon_tError

  • Jr. Member
  • **
  • Posts: 50
    • View Profile
Re: One way to group objects in hiearchal form
« Reply #3 on: January 19, 2014, 03:18:15 am »

lppena

i thought you are trying to figure it how the Exporter working and why is the 'Frame' related warning is there - so i replied. since it is edited by Raxx ( he is better in case of Export Script ), so if he don't reply i will try it then (adding Group Mesh Export to XSI Format).
Logged

lppena

  • Sr. Member
  • ****
  • Posts: 299
  • Anim8or, does a body good.
    • View Profile
    • Truespace Anim8or Casual Modeling Forum.
Re: One way to group objects in hiearchal form
« Reply #4 on: January 19, 2014, 04:14:58 am »

lppena

i thought you are trying to figure it how the Exporter working and why is the 'Frame' related warning is there - so i replied. since it is edited by Raxx ( he is better in case of Export Script ), so if he don't reply i will try it then (adding Group Mesh Export to XSI Format).

Raxx did an excellent job of getting the exporter as far as it has come, but he has limited time and if you could take a look at the current script and tweak it that would be most appreciated as sometimes another person can make improvements to make it it more useful in terms of linking object in hierarchal form. I don't have much experience with ASL scripting but I have tweaked a few scripts and test they out as needed. Thanks, Leroy. 
Logged

Raxx

  • Administrator
  • Hero Member
  • *****
  • Posts: 1482
    • View Profile
Re: One way to group objects in hiearchal form
« Reply #5 on: January 26, 2014, 12:02:06 pm »

I'll go ahead and take this up again, Ippena, I'll keep you posted when I have a solution.
Logged

lppena

  • Sr. Member
  • ****
  • Posts: 299
  • Anim8or, does a body good.
    • View Profile
    • Truespace Anim8or Casual Modeling Forum.
Re: One way to group objects in hiearchal form
« Reply #6 on: January 26, 2014, 06:09:16 pm »

Thanks Raxx. Really there's no hurry as I have been working on other projects lately. The work you've done so far is very cool. Leroy.
Logged