google-code-export / papervision3d

Automatically exported from code.google.com/p/papervision3d
1 stars 1 forks source link

Collada exported from 3DSMax with scaling animation does not work #271

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Create a 3DSMax file with a scaling keyframe animation
2. Export with the OpenCollada exporter
3. Import the collada file into papervision and play the animation

What is the expected output? What do you see instead?

The scaling animation does not occur.

What version of the product are you using? On what operating system?

Papervision3D 2.0.0 (March 12th, 2009), MacOSX

Please provide any additional information below.

The problem is that the scale animation is exported as a single array, like so:

<source id="node-Box01_scale-input">
        <float_array id="node-Box01_scale-input-array" count="3">0.1 0.5 0.6</float_array>
        <technique_common>
          <accessor source="#node-Box01_scale-input-array" count="3" stride="1">
            <param name="TIME" type="float"/>
          </accessor>
        </technique_common>
      </source>
      <source id="node-Box01_scale-output">
        <float_array id="node-Box01_scale-output-array" count="9">0 0 0 1 1 1 0 0 0</float_array>
        <technique_common>
          <accessor source="#node-Box01_scale-output-array" count="3" stride="3">
            <param name="X" type="float"/>
            <param name="Y" type="float"/>
            <param name="Z" type="float"/>
          </accessor>
        </technique_common>
      </source>

I got it to work by making the following change in DAE.cs:

else if(channel && channel.syntax.member == "Z")
                        {
                            for(j = 0; j < input.length; j++)
                            {
                                sc0.addKey(new LinearCurveKey3D(input[j], orig[0]));
                                sc1.addKey(new LinearCurveKey3D(input[j], orig[1]));
                                sc2.addKey(new LinearCurveKey3D(input[j], output[j]));  
                            }
                        }
                        else
                        {
                            sc0.addKey(new LinearCurveKey3D(0, orig[0]));
                            sc1.addKey(new LinearCurveKey3D(0, orig[1]));
                            sc2.addKey(new LinearCurveKey3D(0, orig[2]));
                        }

to

                        else if(channel && channel.syntax.member == "Z")
                        {
                            for(j = 0; j < input.length; j++)
                            {
                                sc0.addKey(new LinearCurveKey3D(input[j], orig[0]));
                                sc1.addKey(new LinearCurveKey3D(input[j], orig[1]));
                                sc2.addKey(new LinearCurveKey3D(input[j], output[j]));  
                            }
                        }
                        else
                        {
                            for(j = 0; j < input.length; j++)
                            {
                                sc0.addKey(new LinearCurveKey3D(input[j], output[j][0]));
                                sc1.addKey(new LinearCurveKey3D(input[j], output[j][1]));
                                sc2.addKey(new LinearCurveKey3D(input[j], output[j][2]));   
                            }
                        }

Original issue reported on code.google.com by keit...@gmail.com on 8 Jul 2010 at 5:15