Friendlyskies AoI Forum

You are not logged in.

Announcement

#1 January 29, 2010, 2:32 pm

mayid
42
From: Argentina
Registered: March 29, 2009,
Posts: 1004
Reputation :   
Website

Mirror skeleton script

Mirror skeleton is a nice idea. I suggest It should be part of PM...

Issue is that when using MS script, the skeleton does mirrors, but the movements of the character freeze when using "the green cross". Try it:

http://www.aoi-castellano.com.ar/img_al … o_rana.aoi

The file contents half of a skeleton. If you use the script and generate the other half on Z axis, the half appears. But if you place a green cross in the middle of the character, nothing can be moved lately.

btw, MS script lacks of the "undo" possibility. If you fail choosing the axis, the you have to delete the chained bones manually.

http://www.aoi-castellano.com.ar/img_al_foro/ranas/rana.jpg


Comunidad en español:
www.aoi-castellano.com.ar/ForoBB/index.php
Comunidad de aprendizaje.

Offline

 

#2 May 25, 2010, 1:28 pm

mayid
42
From: Argentina
Registered: March 29, 2009,
Posts: 1004
Reputation :   
Website

Re: Mirror skeleton script

Regarding to the issue that is making the new half of the skeleton to stay quite ( if a green cross is selected ), is there any opinion?

I tried binding the points to the skeleton after the script runs, but that won't solve it. This is the code:

Code:

// function to Mirror the Skeleton    
    mirrorSkeleton(Skeleton skeleton)
    {

        origJoints=skeleton.getJoints();
        
        //
        // assumes joints[0] is the root which defines the mirror axis
        //
        mirIndx=new int[origJoints.length];  //index to hold mirrored joints equivalents
        mirIndx[0]=0;  //root is joint ID number 1
        newJoints=new Joint[origJoints.length-1];
        jointC=origJoints.length;
        //
        for (j=1;j<origJoints.length;j++)
        {
            joints=skeleton.getJoints();  //get updated joints
            // calculate position and orientation of new joints
            jCoords=joints[j].coords.duplicate();
            jPos=jCoords.getOrigin();
            jPos0=joints[0].coords.getOrigin();  // position of root
            // check to see if joint is within tolerance zone
            mirror=true;
            if ((axis==0)&&(Math.abs(jPos.x-jPos0.x)<onAxisTol)) mirror=false;
            if ((axis==1)&&(Math.abs(jPos.y-jPos0.y)<onAxisTol)) mirror=false;
            if ((axis==2)&&(Math.abs(jPos.z-jPos0.z)<onAxisTol)) mirror=false;
            jZDir=jCoords.getZDirection();
            jUpDir=jCoords.getUpDirection();
            if (axis==0)
            {
                newjPos=new Vec3(-jPos.x,jPos.y,jPos.z);
                newjZDir=new Vec3(-jZDir.x,jZDir.y,jZDir.z);
                newjUpDir=new Vec3(-jUpDir.x,jUpDir.y,jUpDir.z);
            }
            if (axis==1)
            {
                newjPos=new Vec3(jPos.x,-jPos.y,jPos.z);
                newjZDir=new Vec3(jZDir.x,-jZDir.y,jZDir.z);
                newjUpDir=new Vec3(jUpDir.x,-jUpDir.y,jUpDir.z);
            }
            if (axis==2)
            {
                newjPos=new Vec3(jPos.x,jPos.y,-jPos.z);
                newjZDir=new Vec3(jZDir.x,jZDir.y,-jZDir.z);
                newjUpDir=new Vec3(jUpDir.x,jUpDir.y,-jUpDir.z);
            }
                jCoords.setOrigin(newjPos);
            jCoords.setOrientation(newjZDir,newjUpDir);
            // create the new joint
            if (mirror)  // if outside the tolerance then mirror it
            {
                newJoints[j-1]=new Joint(jCoords,joints[mirIndx[skeleton.findJointIndex(joints[j].parent.id)]],"bone" + jointC);
                skeleton.addJoint(newJoints[j-1],newJoints[j-1].parent.id);  // add it to the skeleton
                mirIndx[j]=jointC;  // update index
                jointC++;  // increment joint counter
            }
            if (!mirror) mirIndx[j]=j;   //if outside tolerance, don't create new bone
        }
    } // end mirrorSkeleton()

Last edited by mayid (May 25, 2010, 4:54 pm)


Comunidad en español:
www.aoi-castellano.com.ar/ForoBB/index.php
Comunidad de aprendizaje.

Offline

 

#3 May 30, 2010, 1:42 pm

mayid
42
From: Argentina
Registered: March 29, 2009,
Posts: 1004
Reputation :   
Website

Re: Mirror skeleton script

I almost finished the adaptation of the script into a plugin.

Main reasons to do this project are:

- the skeleton is visible when applying the tool, so you can choose the x,y,z axis easily.
- there's a possibility to have an undo level, so changes can be undone.
- there is a bug about moving the resulting skeleton (as i explained in the first post here).

I'm doing this while learning to code, and to learn to code. Then i'll ask Peter to include the tool in the AoI release, not as a plugin but in core.

I have a problems to solve, regarding to the undo level, and i already asked about this in SourceForge today.

Here's the source, the jar, and the bsh script. This release is the first beta. It works indeed.

http://www.aoi-castellano.com.ar/img_al … eleton.zip

Last edited by mayid (May 31, 2010, 12:45 pm)


Comunidad en español:
www.aoi-castellano.com.ar/ForoBB/index.php
Comunidad de aprendizaje.

Offline

 

#4 May 31, 2010, 1:08 pm

mayid
42
From: Argentina
Registered: March 29, 2009,
Posts: 1004
Reputation :   
Website

Re: Mirror skeleton script

Just a couple of points i discovered:


- the bones can still be moved by the red handles. But not directly, with mouse drag.
- the issue occurs when there's more than one joint starting from Root.

* I also found that if you move the Root, then everything returns to normality. *

If you have the mood and the time to check the script, please do. I think this is a nice tool for people animating objects.

Last edited by mayid (May 31, 2010, 1:13 pm)


Comunidad en español:
www.aoi-castellano.com.ar/ForoBB/index.php
Comunidad de aprendizaje.

Offline

 

#5 May 31, 2010, 4:10 pm

Siri
Forum Android
Registered: December 19, 2008,
Posts: 173
Reputation :   

Re: Mirror skeleton script

Hello Mayid,

wow, that's a nice progress.. cool

...the error you've explained in your first post maybe only occurs if the mirror is still on. Is this possible? Why didn't you dissolved the mirror first? Is the mesh of the cute little frog not finished yet? I can not reproduce the problem. Moving the handles works fine.

I got the ArrayIndexOutOFBoundsExeption but your plugin is working fine. No problems so far. I've used the magic stool and created a walk cycle for it with help of the mirrored skeleton smile

...for me it is quite normal to move bones at their handles. Is something wrong with that?

I've posted the news of your upcommig plugin at the German AoI-Board. Is this ok for you? Please have a look... http://www.aoi-board.de/index.php?actio … e=1#b_8258 I've written nice things only, I swear wink

Kind regards
Siri

Last edited by Siri (May 31, 2010, 5:10 pm)


I'm a featherless friend of Blue cool

Offline

 

#6 May 31, 2010, 8:17 pm

mayid
42
From: Argentina
Registered: March 29, 2009,
Posts: 1004
Reputation :   
Website

Re: Mirror skeleton script

I got the ArrayIndexOutOFBoundsExeption

This was solved 20 hs ago. And i overwrote the files then, so you can have it running ok if you download it again.

...the error you've explained in your first post maybe only occurs if the mirror is still on. Is this possible? Why didn't you dissolved the mirror first? Is the mesh of the cute little frog not finished yet? I can not reproduce the problem. Moving the handles works fine.

I posted the frog a couple of moths ago. Applying the mesh mirror before the mirroring the skeleton it's the way to go. However, the bug is about the skeleton "in abstract", not regarding to the mesh at all.

As i said, the little red dots works , but not the joints. I mean, you shouldn't be able to move a joint by drawing it IF there's a green cross marked.   

I've posted the news of your upcommig plugin at the German AoI-Board. Is this ok for you? Please have a look... http://www.aoi-board.de/index.php?actio … e=1#b_8258 I've written nice things only, I swear

I trust you, of course. Nice to know you published this.

About the bug... i wonder if there's a method to refresh the skeleton, as there is one for refreshing the view: updateImage()


Comunidad en español:
www.aoi-castellano.com.ar/ForoBB/index.php
Comunidad de aprendizaje.

Offline

 

#7 June 1, 2010, 2:43 am

Siri
Forum Android
Registered: December 19, 2008,
Posts: 173
Reputation :   

Re: Mirror skeleton script

Ah, ok...

I will try your new version and have a closer look at the marked joints smile

Kind regards
Siri


I'm a featherless friend of Blue cool

Offline

 

#8 June 1, 2010, 9:50 am

mayid
42
From: Argentina
Registered: March 29, 2009,
Posts: 1004
Reputation :   
Website

Re: Mirror skeleton script

Thanks Siri.

Today i managed to set an undo level. So now you can give a step back after mirroring the skeleton.

Remains just the bug here. IS curious that moving the root bone sets back the mobility to the whole skeleton. Mh....  ninjapoof


Comunidad en español:
www.aoi-castellano.com.ar/ForoBB/index.php
Comunidad de aprendizaje.

Offline

 

#9 June 8, 2010, 11:41 am

mayid
42
From: Argentina
Registered: March 29, 2009,
Posts: 1004
Reputation :   
Website

Re: Mirror skeleton script

Finally RELEASED!  No more bugs.

The Mirror Skeleton plugin is working good. You can download it here:
http://www.aoi-castellano.com.ar/img_al … eleton.jar


Comunidad en español:
www.aoi-castellano.com.ar/ForoBB/index.php
Comunidad de aprendizaje.

Offline

 

#10 June 8, 2010, 11:49 am

Siri
Forum Android
Registered: December 19, 2008,
Posts: 173
Reputation :   

Re: Mirror skeleton script

Wow, really good news! Thank you very much for this, Mayid   buttrock

Kind regards

Siri


I'm a featherless friend of Blue cool

Offline

 

#11 June 8, 2010, 12:15 pm

Runnerblood
Workin'
Registered: March 1, 2010,
Posts: 156
Reputation :   

Re: Mirror skeleton script

Siri wrote:

Wow, really good news! Thank you very much for this, Mayid   buttrock

Kind regards

Siri

Yeah, very cool tool, Mayid! teacher I wonder why Peter hadn't thought at this feature in the rigging system...

Thanks,
Alex

PS @ Mayid: Could you consider the idea of helping PeteIhis at the physics plugin? That would be THE MAJOR thing to do this year for AoI. If physics/clothes are ON for AoI, it can be a commercial (but free and open source lol) software. It can be used in better and better animations!!!!!!!

Sorry for being desperate for those plugins lol... I just... want to see a physics plugin with some instructions on the official repository of plugins...

Thanks again,
Alex


My name is Signature... Short Signature detective

Offline

 

#12 June 8, 2010, 12:24 pm

mayid
42
From: Argentina
Registered: March 29, 2009,
Posts: 1004
Reputation :   
Website

Re: Mirror skeleton script

I really like scripting teams. But i'm just making my first practices. I'm not fluid in JAVA. And i got overwhelmed recently. relieved

I know there's an intention to keep AoI simple. But i'd like to see alternative builds, with more plugins inserted in the basic installation. airguitar2

I remember my first steps in aoi, looking for information, etc, and i though that the experiencie could be improved. That's why i'm working on the manual, and on some scripts. wizard


Comunidad en español:
www.aoi-castellano.com.ar/ForoBB/index.php
Comunidad de aprendizaje.

Offline

 

#13 June 9, 2010, 3:51 am

Runnerblood
Workin'
Registered: March 1, 2010,
Posts: 156
Reputation :   

Re: Mirror skeleton script

mayid wrote:

I really like scripting teams. But i'm just making my first practices. I'm not fluid in JAVA. And i got overwhelmed recently. relieved

I know there's an intention to keep AoI simple. But i'd like to see alternative builds, with more plugins inserted in the basic installation. airguitar2

I remember my first steps in aoi, looking for information, etc, and i though that the experiencie could be improved. That's why i'm working on the manual, and on some scripts. wizard

The actual build for AoI is perfect, in my opinion. The main things, as primitive creating, animating, simple texturing etc. must remain like they're now.

The complex features, such as physics, must remain optional plug-ins in my opinion, because they serve to the advanced users. There are 500 downloads daily on AoI at soundforge... Do you believe they're advanced users who download 500 times per day?

Statistically, 180 000 users are coming each year. Let's not believe in that. Let's cut a half. Still,  there are 90 000 people. They are coming not for AoI's features necesarilly (even if I believe AoI has soooooooooooo many features that you can't even explore them all) but as for it's simplicity.

I wanted (first time when I wanted to start 3D CG) to start with blender, but it was like I was continuously hitting a wall. brick


Alex

Last edited by Runnerblood (June 9, 2010, 3:53 am)


My name is Signature... Short Signature detective

Offline

 

Board footer

Powered by PunBB
© Copyright 2002–2005 Rickard Andersson