SahelFllh / opencollada

Automatically exported from code.google.com/p/opencollada
0 stars 0 forks source link

SetParam does not properly export float<n> with 0's in it #137

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. In Maya, load a cgfx shader that has a float4 parameter
2. Set some elements of the parameter to 0
3. export.

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

        <setparam ref="PlanarReflection_planeDir">
          <float4>1</float4>
        </setparam>
        <setparam ref="PlanarReflection_planePos">
          <float4>1</float4>
        </setparam>

^^ those float4s should be (0,0,1,0) and (0,0,0,1), respectively.

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

openColladaMaya

Please provide any additional information below.

You can fix this by not checking for 0 after the NULL check in 
colladamayamaterialexporter.cpp, in the setSetParam function, for switch cases:

        case cgfxAttrDef::kAttrTypeFloat:

        case cgfxAttrDef::kAttrTypeVector2:

        case cgfxAttrDef::kAttrTypeVector3:
        case cgfxAttrDef::kAttrTypeColor3:

        case cgfxAttrDef::kAttrTypeVector4:
        case cgfxAttrDef::kAttrTypeColor4:

eg:

                    if ( attribute->fNumericDef!=NULL  /*&& attribute->fNumericDef[0]!=0*/ )  

Original issue reported on code.google.com by martin.b...@gmail.com on 19 Nov 2010 at 7:43

GoogleCodeExporter commented 9 years ago
Thanks for providing this fix. It has been applied in revision 785.

Original comment by opencollada2@googlemail.com on 22 Nov 2010 at 8:38