Browse files

Operators on uniqueId;

Maya instance nodes, instance geometries;
Maya light import;
colladaSax error handling;
extensions on maya data model
  • Loading branch information...
1 parent eae45c8 commit 87a3515299364cc81fbe6c4b0fcbfdac58d4f44a @opencollada-sebastian opencollada-sebastian committed Feb 25, 2009
Showing with 11,103 additions and 1,519 deletions.
  1. +2 −1 COLLADAFramework/include/COLLADAFWUniqueId.h
  2. +26 −4 COLLADAFramework/src/COLLADAFWUniqueId.cpp
  3. +0 −3 COLLADAMaya/COLLADAMaya.sln
  4. +16 −1 COLLADAMaya/include/COLLADAMayaBaseImporter.h
  5. +1 −1 COLLADAMaya/include/COLLADAMayaCameraImporter.h
  6. +10 −5 COLLADAMaya/include/COLLADAMayaDocumentImporter.h
  7. +96 −137 COLLADAMaya/include/COLLADAMayaEffectImporter.h
  8. +82 −0 COLLADAMaya/include/COLLADAMayaGeometryBinding.h
  9. +35 −24 COLLADAMaya/include/COLLADAMayaGeometryImporter.h
  10. +3 −9 COLLADAMaya/include/COLLADAMayaImageImporter.h
  11. +1 −1 COLLADAMaya/include/COLLADAMayaLightImporter.h
  12. +3 −1 COLLADAMaya/include/COLLADAMayaMaterialExporter.h
  13. +36 −64 COLLADAMaya/include/COLLADAMayaMaterialImporter.h
  14. +30 −18 COLLADAMaya/include/COLLADAMayaNode.h
  15. +54 −0 COLLADAMaya/include/COLLADAMayaSaxParserErrorHandler.h
  16. +93 −0 COLLADAMaya/include/COLLADAMayaShadingBinding.h
  17. +34 −11 COLLADAMaya/include/COLLADAMayaVisualSceneImporter.h
  18. +24 −0 COLLADAMaya/scripts/COLLADAMaya.vcproj
  19. +37 −0 COLLADAMaya/src/COLLADAMayaBaseImporter.cpp
  20. +25 −9 COLLADAMaya/src/COLLADAMayaCameraImporter.cpp
  21. +6 −4 COLLADAMaya/src/COLLADAMayaConsoleMain.cpp
  22. +83 −18 COLLADAMaya/src/COLLADAMayaDocumentImporter.cpp
  23. +367 −43 COLLADAMaya/src/COLLADAMayaEffectImporter.cpp
  24. +1 −1 COLLADAMaya/src/COLLADAMayaFileTranslator.cpp
  25. +52 −0 COLLADAMaya/src/COLLADAMayaGeometryBinding.cpp
  26. +167 −39 COLLADAMaya/src/COLLADAMayaGeometryImporter.cpp
  27. +11 −12 COLLADAMaya/src/COLLADAMayaImageImporter.cpp
  28. +40 −13 COLLADAMaya/src/COLLADAMayaLightImporter.cpp
  29. +306 −172 COLLADAMaya/src/COLLADAMayaMaterialImporter.cpp
  30. +36 −1 COLLADAMaya/src/COLLADAMayaNode.cpp
  31. +56 −0 COLLADAMaya/src/COLLADAMayaSaxParserErrorHandler.cpp
  32. +70 −0 COLLADAMaya/src/COLLADAMayaShadingBinding.cpp
  33. +211 −88 COLLADAMaya/src/COLLADAMayaVisualSceneImporter.cpp
  34. +1 −1 COLLADAMaya/testsuite/testFile.bat
  35. +2 −2 COLLADAMaya/tools/doxygen_html.cfg
  36. +2 −2 COLLADASaxFrameworkLoader/include/COLLADASaxFWLIError.h
  37. +4 −1 COLLADASaxFrameworkLoader/include/COLLADASaxFWLSaxParserError.h
  38. +809 −809 COLLADASaxFrameworkLoader/src/COLLADASaxFWLColladaParserAutoGenPrivate.cpp
  39. +4 −2 COLLADASaxFrameworkLoader/src/COLLADASaxFWLSaxParserError.cpp
  40. +6 −0 Externals/MayaDataModel/include/MayaDMAddMatrix.h
  41. +90 −0 Externals/MayaDataModel/include/MayaDMAimConstraint.h
  42. +12 −0 Externals/MayaDataModel/include/MayaDMAnimClip.h
  43. +6 −0 Externals/MayaDataModel/include/MayaDMAnnotationShape.h
  44. +6 −0 Externals/MayaDataModel/include/MayaDMAttachCurve.h
  45. +36 −0 Externals/MayaDataModel/include/MayaDMAvgNurbsSurfacePoints.h
  46. +24 −0 Externals/MayaDataModel/include/MayaDMAvgSurfacePoints.h
  47. +42 −0 Externals/MayaDataModel/include/MayaDMBevelPlus.h
  48. +6 −0 Externals/MayaDataModel/include/MayaDMBlend.h
  49. +12 −0 Externals/MayaDataModel/include/MayaDMBlendDevice.h
  50. +54 −0 Externals/MayaDataModel/include/MayaDMBlendShape.h
  51. +6 −0 Externals/MayaDataModel/include/MayaDMBlendWeighted.h
  52. +210 −0 Externals/MayaDataModel/include/MayaDMBrush.h
  53. +6 −0 Externals/MayaDataModel/include/MayaDMCacheBase.h
  54. +48 −0 Externals/MayaDataModel/include/MayaDMCacheBlend.h
  55. +12 −0 Externals/MayaDataModel/include/MayaDMCacheFile.h
  56. +12 −0 Externals/MayaDataModel/include/MayaDMCamera.h
  57. +24 −0 Externals/MayaDataModel/include/MayaDMCharacter.h
  58. +6 −0 Externals/MayaDataModel/include/MayaDMCharacterMap.h
  59. +6 −0 Externals/MayaDataModel/include/MayaDMChoice.h
  60. +18 −0 Externals/MayaDataModel/include/MayaDMChooser.h
  61. +102 −0 Externals/MayaDataModel/include/MayaDMClipLibrary.h
  62. +138 −0 Externals/MayaDataModel/include/MayaDMClipScheduler.h
  63. +6 −0 Externals/MayaDataModel/include/MayaDMCluster.h
  64. +24 −0 Externals/MayaDataModel/include/MayaDMClusterHandle.h
  65. +10 −0 Externals/MayaDataModel/include/MayaDMConnectables.h
  66. +138 −12 Externals/MayaDataModel/include/MayaDMControlPoint.h
  67. +6 −0 Externals/MayaDataModel/include/MayaDMCurveFromMeshEdge.h
  68. +12 −0 Externals/MayaDataModel/include/MayaDMCurveFromSubdivEdge.h
  69. +12 −0 Externals/MayaDataModel/include/MayaDMCurveFromSubdivFace.h
  70. +36 −0 Externals/MayaDataModel/include/MayaDMCurveInfo.h
  71. +12 −0 Externals/MayaDataModel/include/MayaDMCurveIntersect.h
  72. +12 −0 Externals/MayaDataModel/include/MayaDMCurveVarGroup.h
  73. +72 −0 Externals/MayaDataModel/include/MayaDMDagNode.h
  74. +18 −0 Externals/MayaDataModel/include/MayaDMDagPose.h
  75. +90 −0 Externals/MayaDataModel/include/MayaDMDefaultLightList.h
  76. +6 −0 Externals/MayaDataModel/include/MayaDMDefaultRenderUtilityList.h
  77. +6 −0 Externals/MayaDataModel/include/MayaDMDefaultShaderList.h
  78. +6 −0 Externals/MayaDataModel/include/MayaDMDefaultTextureList.h
  79. +18 −0 Externals/MayaDataModel/include/MayaDMDetachCurve.h
  80. +18 −0 Externals/MayaDataModel/include/MayaDMDetachSurface.h
  81. +6 −0 Externals/MayaDataModel/include/MayaDMDisplayLayerManager.h
  82. +30 −0 Externals/MayaDataModel/include/MayaDMDoubleShadingSwitch.h
  83. +66 −0 Externals/MayaDataModel/include/MayaDMDynamicConstraint.h
  84. +6 −0 Externals/MayaDataModel/include/MayaDMExplodeNurbsShell.h
  85. +12 −0 Externals/MayaDataModel/include/MayaDMExpression.h
  86. +12 −0 Externals/MayaDataModel/include/MayaDMFfBlendSrf.h
  87. +12 −0 Externals/MayaDataModel/include/MayaDMFfBlendSrfObsolete.h
  88. +12 −0 Externals/MayaDataModel/include/MayaDMFfd.h
  89. +72 −0 Externals/MayaDataModel/include/MayaDMField.h
  90. +12 −0 Externals/MayaDataModel/include/MayaDMFlexorShape.h
  91. +30 −0 Externals/MayaDataModel/include/MayaDMFlow.h
  92. +414 −0 Externals/MayaDataModel/include/MayaDMFluidShape.h
  93. +72 −0 Externals/MayaDataModel/include/MayaDMFollicle.h
  94. +12 −0 Externals/MayaDataModel/include/MayaDMFrameCache.h
  95. +180 −0 Externals/MayaDataModel/include/MayaDMFurFeedback.h
  96. +18 −0 Externals/MayaDataModel/include/MayaDMGeoConnectable.h
  97. +78 −0 Externals/MayaDataModel/include/MayaDMGeoConnector.h
  98. +18 −0 Externals/MayaDataModel/include/MayaDMGeometryConstraint.h
  99. +24 −0 Externals/MayaDataModel/include/MayaDMGeometryFilter.h
  100. +18 −0 Externals/MayaDataModel/include/MayaDMGeometryShape.h
  101. +12 −0 Externals/MayaDataModel/include/MayaDMGeometryVarGroup.h
  102. +30 −0 Externals/MayaDataModel/include/MayaDMGlobalStitch.h
  103. +12 −0 Externals/MayaDataModel/include/MayaDMHairConstraint.h
  104. +234 −0 Externals/MayaDataModel/include/MayaDMHairSystem.h
  105. +42 −0 Externals/MayaDataModel/include/MayaDMHairTubeShader.h
  106. +6 −0 Externals/MayaDataModel/include/MayaDMHardenPoint.h
  107. +12 −0 Externals/MayaDataModel/include/MayaDMHikEffector.h
  108. +30 −0 Externals/MayaDataModel/include/MayaDMHikHandle.h
  109. +18 −0 Externals/MayaDataModel/include/MayaDMHistorySwitch.h
  110. +6 −0 Externals/MayaDataModel/include/MayaDMHyperGraphInfo.h
  111. +36 −0 Externals/MayaDataModel/include/MayaDMHyperLayout.h
  112. +6 −0 Externals/MayaDataModel/include/MayaDMHyperView.h
  113. +6 −0 Externals/MayaDataModel/include/MayaDMIkEffector.h
  114. +6 −0 Externals/MayaDataModel/include/MayaDMIkSystem.h
  115. +12 −0 Externals/MayaDataModel/include/MayaDMInsertKnotCurve.h
  116. +12 −0 Externals/MayaDataModel/include/MayaDMInsertKnotSurface.h
  117. +6 −0 Externals/MayaDataModel/include/MayaDMInstancer.h
  118. +18 −0 Externals/MayaDataModel/include/MayaDMIntersectSurface.h
  119. +84 −0 Externals/MayaDataModel/include/MayaDMJointCluster.h
  120. +12 −0 Externals/MayaDataModel/include/MayaDMJointFfd.h
  121. +90 −0 Externals/MayaDataModel/include/MayaDMLambert.h
  122. +6 −0 Externals/MayaDataModel/include/MayaDMLattice.h
  123. +78 −0 Externals/MayaDataModel/include/MayaDMLayeredShader.h
  124. +48 −0 Externals/MayaDataModel/include/MayaDMLayeredTexture.h
  125. +45 −0 Externals/MayaDataModel/include/MayaDMLeastSquaresModifier.h
  126. +90 −0 Externals/MayaDataModel/include/MayaDMLightFog.h
  127. +72 −0 Externals/MayaDataModel/include/MayaDMLightLinker.h
  128. +12 −0 Externals/MayaDataModel/include/MayaDMLightList.h
  129. +30 −0 Externals/MayaDataModel/include/MayaDMLineModifier.h
  130. +24 −0 Externals/MayaDataModel/include/MayaDMLocator.h
  131. +18 −0 Externals/MayaDataModel/include/MayaDMLodGroup.h
  132. +12 −0 Externals/MayaDataModel/include/MayaDMLodThresholds.h
  133. +18 −0 Externals/MayaDataModel/include/MayaDMLoft.h
  134. +36 −0 Externals/MayaDataModel/include/MayaDMMakeIllustratorCurves.h
  135. +36 −0 Externals/MayaDataModel/include/MayaDMMakeTextCurves.h
  136. +6 −0 Externals/MayaDataModel/include/MayaDMMaterialInfo.h
  137. +90 −0 Externals/MayaDataModel/include/MayaDMMesh.h
  138. +12 −0 Externals/MayaDataModel/include/MayaDMMeshVarGroup.h
  139. +12 −0 Externals/MayaDataModel/include/MayaDMMotionPath.h
  140. +6 −0 Externals/MayaDataModel/include/MayaDMMpBirailSrf.h
  141. +6 −0 Externals/MayaDataModel/include/MayaDMMultMatrix.h
  142. +6 −0 Externals/MayaDataModel/include/MayaDMNComponent.h
  143. +12 −0 Externals/MayaDataModel/include/MayaDMNetwork.h
  144. +18 −0 Externals/MayaDataModel/include/MayaDMNormalConstraint.h
  145. +42 −0 Externals/MayaDataModel/include/MayaDMNucleus.h
  146. +54 −0 Externals/MayaDataModel/include/MayaDMNurbsCurve.h
  147. +12 −0 Externals/MayaDataModel/include/MayaDMNurbsSurface.h
  148. +24 −0 Externals/MayaDataModel/include/MayaDMObjectSet.h
  149. +72 −0 Externals/MayaDataModel/include/MayaDMOcean.h
  150. +204 −0 Externals/MayaDataModel/include/MayaDMOceanShader.h
  151. +6 −0 Externals/MayaDataModel/include/MayaDMOffsetCos.h
  152. +6 −0 Externals/MayaDataModel/include/MayaDMOffsetCurve.h
  153. +96 −0 Externals/MayaDataModel/include/MayaDMOrientConstraint.h
  154. +240 −0 Externals/MayaDataModel/include/MayaDMParentConstraint.h
  155. +162 −0 Externals/MayaDataModel/include/MayaDMParticle.h
  156. +90 −0 Externals/MayaDataModel/include/MayaDMParticleCloud.h
  157. +6 −0 Externals/MayaDataModel/include/MayaDMPartition.h
  158. +48 −0 Externals/MayaDataModel/include/MayaDMPfxGeometry.h
  159. +48 −0 Externals/MayaDataModel/include/MayaDMPfxToon.h
  160. +6 −0 Externals/MayaDataModel/include/MayaDMPlanarTrimSurface.h
  161. +48 −0 Externals/MayaDataModel/include/MayaDMPlusMinusAverage.h
  162. +90 −0 Externals/MayaDataModel/include/MayaDMPointConstraint.h
  163. +42 −0 Externals/MayaDataModel/include/MayaDMPointEmitter.h
  164. +30 −0 Externals/MayaDataModel/include/MayaDMPolyAppend.h
  165. +30 −0 Externals/MayaDataModel/include/MayaDMPolyAppendVertex.h
  166. +24 −0 Externals/MayaDataModel/include/MayaDMPolyBridgeEdge.h
  167. +120 −0 Externals/MayaDataModel/include/MayaDMPolyColorMod.h
  168. +12 −0 Externals/MayaDataModel/include/MayaDMPolyCrease.h
  169. +30 −0 Externals/MayaDataModel/include/MayaDMPolyCreateFace.h
  170. +24 −0 Externals/MayaDataModel/include/MayaDMPolyExtrudeEdge.h
  171. +24 −0 Externals/MayaDataModel/include/MayaDMPolyExtrudeFace.h
  172. +6 −0 Externals/MayaDataModel/include/MayaDMPolyMoveVertex.h
  173. +6 −0 Externals/MayaDataModel/include/MayaDMPolyReduce.h
  174. +6 −0 Externals/MayaDataModel/include/MayaDMPolySeparate.h
  175. +36 −0 Externals/MayaDataModel/include/MayaDMPolySplit.h
  176. +24 −0 Externals/MayaDataModel/include/MayaDMPolySplitRing.h
  177. +24 −0 Externals/MayaDataModel/include/MayaDMPolyToSubdiv.h
  178. +24 −0 Externals/MayaDataModel/include/MayaDMPolyTweak.h
  179. +48 −0 Externals/MayaDataModel/include/MayaDMPolyTweakUV.h
  180. +12 −0 Externals/MayaDataModel/include/MayaDMPolyUnite.h
  181. +6 −0 Externals/MayaDataModel/include/MayaDMPolyWedgeFace.h
  182. +6 −0 Externals/MayaDataModel/include/MayaDMPostProcessList.h
  183. +6 −0 Externals/MayaDataModel/include/MayaDMProjectCurve.h
  184. +6 −0 Externals/MayaDataModel/include/MayaDMProxyManager.h
  185. +48 −0 Externals/MayaDataModel/include/MayaDMQuadShadingSwitch.h
  186. +36 −0 Externals/MayaDataModel/include/MayaDMRamp.h
  187. +348 −0 Externals/MayaDataModel/include/MayaDMRampShader.h
  188. +18 −0 Externals/MayaDataModel/include/MayaDMRbfSrf.h
  189. +78 −0 Externals/MayaDataModel/include/MayaDMReference.h
  190. +72 −0 Externals/MayaDataModel/include/MayaDMRemapColor.h
  191. +72 −0 Externals/MayaDataModel/include/MayaDMRemapHsv.h
  192. +66 −0 Externals/MayaDataModel/include/MayaDMRemapValue.h
  193. +18 −0 Externals/MayaDataModel/include/MayaDMRenderGlobalsList.h
  194. +42 −0 Externals/MayaDataModel/include/MayaDMRenderLayer.h
  195. +6 −0 Externals/MayaDataModel/include/MayaDMRenderLayerManager.h
  196. +66 −0 Externals/MayaDataModel/include/MayaDMRigidBody.h
  197. +114 −0 Externals/MayaDataModel/include/MayaDMRigidSolver.h
  198. +48 −0 Externals/MayaDataModel/include/MayaDMRoundConstantRadius.h
  199. +6 −0 Externals/MayaDataModel/include/MayaDMSampler.h
  200. +42 −0 Externals/MayaDataModel/include/MayaDMScaleConstraint.h
  201. +18 −0 Externals/MayaDataModel/include/MayaDMSingleShadingSwitch.h
  202. +60 −0 Externals/MayaDataModel/include/MayaDMSkinCluster.h
  203. +6 −0 Externals/MayaDataModel/include/MayaDMSmoothCurve.h
  204. +6 −0 Externals/MayaDataModel/include/MayaDMSmoothTangentSrf.h
  205. +6 −0 Externals/MayaDataModel/include/MayaDMSnapshot.h
  206. +30 −0 Externals/MayaDataModel/include/MayaDMSoftMod.h
  207. +24 −0 Externals/MayaDataModel/include/MayaDMSoftModHandle.h
  208. +54 −0 Externals/MayaDataModel/include/MayaDMSpring.h
  209. +6 −0 Externals/MayaDataModel/include/MayaDMStitchAsNurbsShell.h
  210. +144 −0 Externals/MayaDataModel/include/MayaDMStitchSrf.h
  211. +108 −0 Externals/MayaDataModel/include/MayaDMStroke.h
  212. +24 −0 Externals/MayaDataModel/include/MayaDMSubdTweak.h
  213. +18 −0 Externals/MayaDataModel/include/MayaDMSubdTweakUV.h
  214. +72 −0 Externals/MayaDataModel/include/MayaDMSubdiv.h
  215. +12 −0 Externals/MayaDataModel/include/MayaDMSubdivSurfaceVarGroup.h
  216. +6 −0 Externals/MayaDataModel/include/MayaDMSubdivToNurbs.h
  217. +42 −0 Externals/MayaDataModel/include/MayaDMSubdivToPoly.h
  218. +42 −0 Externals/MayaDataModel/include/MayaDMSurfaceInfo.h
  219. +90 −0 Externals/MayaDataModel/include/MayaDMSurfaceLuminance.h
  220. +12 −0 Externals/MayaDataModel/include/MayaDMSurfaceSampler.h
  221. +96 −0 Externals/MayaDataModel/include/MayaDMSurfaceShape.h
  222. +12 −0 Externals/MayaDataModel/include/MayaDMSurfaceVarGroup.h
  223. +18 −0 Externals/MayaDataModel/include/MayaDMTangentConstraint.h
  224. +48 −0 Externals/MayaDataModel/include/MayaDMTextureToGeom.h
  225. +6 −0 Externals/MayaDataModel/include/MayaDMTransferAttributes.h
  226. +24 −0 Externals/MayaDataModel/include/MayaDMTrim.h
  227. +6 −0 Externals/MayaDataModel/include/MayaDMTrimWithBoundaries.h
  228. +36 −0 Externals/MayaDataModel/include/MayaDMTripleShadingSwitch.h
  229. +60 −0 Externals/MayaDataModel/include/MayaDMTweak.h
  230. +6 −0 Externals/MayaDataModel/include/MayaDMUntrim.h
  231. +90 −0 Externals/MayaDataModel/include/MayaDMUseBackground.h
  232. +6 −0 Externals/MayaDataModel/include/MayaDMUvChooser.h
  233. +132 −0 Externals/MayaDataModel/include/MayaDMVolumeFog.h
  234. +66 −0 Externals/MayaDataModel/include/MayaDMVolumeLight.h
  235. +12 −0 Externals/MayaDataModel/include/MayaDMWeightGeometryFilter.h
  236. +54 −0 Externals/MayaDataModel/include/MayaDMWire.h
  237. +36 −0 Externals/MayaDataModel/include/MayaDMWrap.h
  238. +18 −0 Externals/MayaDataModel/include/MayaDMWtAddMatrix.h
  239. +1 −1 GeneratedSaxParser/include/GeneratedSaxParserParserError.h
  240. +8 −8 GeneratedSaxParser/include/GeneratedSaxParserParserTemplate.h
  241. +1 −1 GeneratedSaxParser/src/GeneratedSaxParserCoutErrorHandler.cpp
View
3 COLLADAFramework/include/COLLADAFWUniqueId.h
@@ -53,8 +53,9 @@ namespace COLLADAFW
bool isValid() const { return mClassId != COLLADA_TYPE::NO_TYPE; }
bool operator<(const UniqueId& rhs) const;
-
+ bool operator>(const UniqueId& rhs) const;
bool operator==(const UniqueId& uid) const;
+ bool operator!=(const UniqueId& uid) const;
};
} // namespace COLLADAFW
View
30 COLLADAFramework/src/COLLADAFWUniqueId.cpp
@@ -27,25 +27,47 @@ namespace COLLADAFW
{
if ( mClassId < rhs.mClassId )
return true;
-
if ( mClassId > rhs.mClassId )
return false;
if ( mObjectId < rhs.mObjectId )
return true;
-
if ( mObjectId > rhs.mObjectId )
return false;
return false;
}
//-------------------------------
+ bool UniqueId::operator>( const UniqueId& rhs ) const
+ {
+ if ( mClassId > rhs.mClassId )
+ return true;
+ if ( mClassId < rhs.mClassId )
+ return false;
+
+ if ( mObjectId > rhs.mObjectId )
+ return true;
+ if ( mObjectId < rhs.mObjectId )
+ return false;
+
+ return false;
+ }
+
+ //-------------------------------
bool UniqueId::operator== ( const UniqueId& uid ) const
{
- if (mClassId != uid.getClassId ()) return false;
- if (mObjectId != uid.getObjectId ()) return false;
+ if ( mClassId != uid.getClassId () ) return false;
+ if ( mObjectId != uid.getObjectId () ) return false;
return true;
}
+ //-------------------------------
+ bool UniqueId::operator!= ( const UniqueId& uid ) const
+ {
+ if ( mClassId != uid.getClassId () ) return true;
+ if ( mObjectId != uid.getObjectId () ) return true;
+ return false;
+ }
+
} // namespace COLLADAFW
View
3 COLLADAMaya/COLLADAMaya.sln
@@ -465,7 +465,4 @@ Global
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
- GlobalSection(ExtensibilityGlobals) = postSolution
- AMDCaProjectFile = C:\netallied\projekte\COLLADA\COLLADANextgen\COLLADAMaya\CodeAnalyst\COLLADAMaya.caw
- EndGlobalSection
EndGlobal
View
17 COLLADAMaya/include/COLLADAMayaBaseImporter.h
@@ -34,14 +34,18 @@ namespace COLLADAMaya
public:
typedef std::set<const COLLADAFW::UniqueId> UniqueIdSet;
+ typedef std::pair<COLLADAFW::UniqueId, COLLADAFW::UniqueId> UniqueIdsPair;
typedef std::map<COLLADAFW::UniqueId, COLLADAFW::UniqueId> UniqueIdUniqueIdMap;
typedef std::map<COLLADAFW::UniqueId, String> UniqueIdNamesMap;
typedef std::vector<const COLLADAFW::UniqueId> UniqueIdVec;
typedef std::map<COLLADAFW::UniqueId, UniqueIdVec> UniqueIdUniqueIdsMap;
- typedef std::map<COLLADAFW::UniqueId, MayaNode> UniqueIdMayaNodesMap;
+ typedef std::vector<MayaNode*> MayaNodesList;
+ typedef std::map<COLLADAFW::UniqueId, MayaNodesList> UniqueIdMayaNodesMap;
+
+ typedef std::map<COLLADAFW::UniqueId, MayaNode*> UniqueIdMayaNodeMap;
typedef std::map<COLLADAFW::UniqueId, MayaDM::Mesh> UniqueIdMayaDMMeshMap;
typedef std::map<COLLADAFW::UniqueId, MayaDM::DependNode*> UniqueIdDependNodeMap;
@@ -75,6 +79,17 @@ namespace COLLADAMaya
MayaDM::double3 toLinearUnit ( const MayaDM::double3& val );
/**
+ * Converts the given value to the angular unit in meters.
+ * For this we need a conversion from radians to degrees and have to look for the up-axis.
+ */
+ MayaDM::double3 toAngularUnit ( const MayaDM::double3& val );
+
+ /**
+ * In depend on the up axis, the order of the values will be changed.
+ */
+ MayaDM::double3 toUpAxisType ( const MayaDM::double3& val );
+
+ /**
* Converts the given value to the linear unit in meters.
* How many real-world meters in one distance unit as a floating-point number.
* For example, 1.0 for the name "meter"; 1000 for the name "kilometer";
View
2 COLLADAMaya/include/COLLADAMayaCameraImporter.h
@@ -45,7 +45,7 @@ namespace COLLADAMaya
/**
* The map holds the unique ids of the camera nodes to the maya specific nodes.
*/
- UniqueIdMayaNodesMap mMayaCameraNodesMap;
+ UniqueIdMayaNodeMap mMayaCameraNodesMap;
public:
View
15 COLLADAMaya/include/COLLADAMayaDocumentImporter.h
@@ -19,14 +19,10 @@
#include "COLLADAMayaStableHeaders.h"
#include "COLLADAMayaPrerequisites.h"
#include "COLLADAMayaNode.h"
+#include "COLLADAMayaSaxParserErrorHandler.h"
#include "COLLADAFWIWriter.h"
#include "COLLADAFWFileInfo.h"
-// #include "COLLADAFWVisualScene.h"
-// #include "COLLADAFWGeometry.h"
-// #include "COLLADAFWMaterial.h"
-// #include "COLLADAFWEffect.h"
-// #include "COLLADAFWCamera.h"
#include "MayaDMMesh.h"
@@ -75,8 +71,10 @@ namespace COLLADAMaya
bool mAssetWritten;
bool mSceneGraphWritten;
+ bool mLibraryNodesWritten;
bool mSceneGraphRead;
+ bool mLibraryNodesRead;
bool mGeometryRead;
bool mCameraRead;
bool mLightRead;
@@ -106,6 +104,9 @@ namespace COLLADAMaya
/** The variable tells, how many times the document is read. */
size_t mNumDocumentParses;
+ /** The error handler for the sax parser. */
+ SaxParserErrorHandler mSaxParserErrorHandler;
+
public:
/** Constructor. */
@@ -164,6 +165,10 @@ namespace COLLADAMaya
LightImporter* getLightImporter () { return mLightImporter; }
const LightImporter* getLightImporter () const { return mLightImporter; }
+ /** Pointer to the image importer. */
+ ImageImporter* getImageImporter () { return mImageImporter; }
+ const ImageImporter* getImageImporter () const { return mImageImporter; }
+
/** This method will be called if an error in the loading process occurred and the loader
cannot continue to to load. The writer should undo all operations that have been performed.
@param errorMessage A message containing informations about the error that occurred.
View
233 COLLADAMaya/include/COLLADAMayaEffectImporter.h
@@ -19,6 +19,10 @@
#include "COLLADAFWEffectCommon.h"
//#include "COLLADAFWFloatOrParam.h"
+#include "MayaDMLambert.h"
+#include "MayaDMBlinn.h"
+#include "MayaDMPhong.h"
+
namespace COLLADAMaya
{
@@ -31,6 +35,18 @@ namespace COLLADAMaya
/** The standard name for a effect without name. */
static const String EFFECT_NAME;
+ /** The standard name for a place2dTexture. */
+ static const String PLACE_2D_TEXTURE_NAME;
+
+ /** The standard name for a place2dTexture. */
+ static const String PLACE_3D_TEXTURE_NAME;
+
+ public:
+
+ typedef std::map<COLLADAFW::UniqueId, MayaDM::Lambert*> UniqueIdLambertMap;
+
+ private:
+
/**
* The enumeration of valid shader attributes.
* We need this for the connections of the effect attributes to textures.
@@ -39,7 +55,9 @@ namespace COLLADAMaya
{
ATTR_COLOR,
ATTR_INCANDESCENE,
- ATTR_TRANSPARENCY,
+ ATTR_TRANSPARENT,
+ ATTR_REFLECTIVE,
+ ATTR_SPECULAR,
ATTR_UNKNOWN
};
@@ -59,16 +77,16 @@ namespace COLLADAMaya
* The type of the effect depends on the attribute.
* It's either an lambert, blinn or phong shader.
*/
- struct ShaderNodeAttribute
+ struct TextureAttribute
{
- MayaDM::DependNode* mShaderNode;
+ MayaDM::Lambert* mShaderNode;
ShaderType mShaderType;
ShaderAttribute mShaderAttribute;
};
private:
- typedef std::map<COLLADAFW::SamplerID, std::vector<ShaderNodeAttribute>> SamplerIdShaderNodesMap;
+ typedef std::map<COLLADAFW::SamplerID, std::vector<TextureAttribute>> SamplerIdShaderNodesMap;
private:
@@ -77,6 +95,11 @@ namespace COLLADAMaya
*/
COLLADABU::IDList mEffectIdList;
+ /**
+ * The list with the unique maya place2dtexture names.
+ */
+ COLLADABU::IDList mPlace2dTextureIdList;
+
/**
* The map holds the unique ids of the nodes to the maya effect name.
*/
@@ -85,7 +108,19 @@ namespace COLLADAMaya
/**
* The map holds the maya effect objects for the connections.
*/
- UniqueIdDependNodeMap mMayaEffectMap;
+ UniqueIdLambertMap mMayaEffectMap;
+
+ /**
+ * The map holds for every unique image id the list of placed2dTextures, which use this image.
+ */
+ // TODO Push the texure placement in the list of texture placements of the image.
+ struct TexturePlacement
+ {
+ COLLADAFW::UniqueId mImageId;
+ COLLADAFW::Sampler::SamplerType mSamplerType;
+ MayaDM::DependNode* mTexturePlacementNode;
+ };
+ std::vector<TexturePlacement*> mTexturePlacements;
/**
* The map holds for every sampler id the shader node attributes,
@@ -105,21 +140,38 @@ namespace COLLADAMaya
bool importEffect ( const COLLADAFW::Effect* effect );
/**
+ * Writes the connections of the effect texture placements to the image files.
+ */
+ void writeConnections ();
+
+ /**
* The map holds the maya material objects.
*/
- MayaDM::DependNode* findMayaEffect ( const COLLADAFW::UniqueId& val ) const;
+ MayaDM::Lambert* findMayaEffect ( const COLLADAFW::UniqueId& effectId ) const;
/**
* The map holds the maya material objects.
*/
- const UniqueIdDependNodeMap& getMayaEffectMap () const { return mMayaEffectMap; }
+ const UniqueIdLambertMap& getMayaEffectMap () const { return mMayaEffectMap; }
private:
/**
+ * Import shader data by type.
+ */
+ void importShaderData (
+ const COLLADAFW::EffectCommon* commonEffect,
+ const COLLADAFW::Effect* effect );
+
+ /**
+ * Create the texture placement and push it to the image in a map.
+ */
+ void importTexturePlacement ( const COLLADAFW::EffectCommon* commonEffect );
+
+ /**
* The map holds the maya material objects.
*/
- void appendEffect ( const COLLADAFW::UniqueId& id, MayaDM::DependNode* effectNode );
+ void appendEffect ( const COLLADAFW::UniqueId& efefctId, MayaDM::Lambert* effectNode );
/**
* Imports a blinn shader effect.
@@ -143,144 +195,51 @@ namespace COLLADAMaya
const COLLADAFW::EffectCommon* commonEffect );
/**
- * Imports the shader attributes.
- */
- template<class T>
- void importShaderAttributes (
+ * Imports the shader attributes.
+ */
+ void importStandardShaderAttributes (
+ MayaDM::Lambert* shaderNode,
+ const COLLADAFW::Effect* effect );
+
+ /**
+ * Imports the shader attributes.
+ */
+ void importLambertShaderAttributes (
const ShaderType& shaderType,
- T* shaderNode,
- const COLLADAFW::Effect* effect,
- const COLLADAFW::EffectCommon* commonEffect )
- {
- // --------------------
- // Get the color and set it into the shader node (if it is a valid color).
- const COLLADAFW::Color& standardColor = effect->getStandardColor ();
- if ( standardColor.isValid () )
- {
- shaderNode->setColor ( MayaDM::float3 ( (float)standardColor.getRed (), (float)standardColor.getGreen (), (float)standardColor.getBlue ()) );
- }
-
- // --------------------
- const COLLADAFW::ColorOrTexture& diffuse = commonEffect->getDiffuse ();
- if ( diffuse.isColor () )
- {
- // Get the color and set it into the shader node (if it is a valid color).
- const COLLADAFW::Color& color = diffuse.getColor ();
- if ( color.isValid () )
- shaderNode->setColor ( MayaDM::float3 ( (float)color.getRed (), (float)color.getGreen (), (float)color.getBlue ()) );
- }
- else
- {
- // Get the texure and the current shader attribute.
- const COLLADAFW::Texture& texture = diffuse.getTexture ();
- ShaderAttribute shaderAttribute = ATTR_COLOR;
-
- // Create a shader node attribute and append it on the list of shader node
- // attributes to the current sampler file id.
- appendShaderNodeAttribute ( texture, shaderType, shaderAttribute, shaderNode );
- }
-
-
- // --------------------
- const COLLADAFW::ColorOrTexture& emission = commonEffect->getEmission ();
- if ( emission.isColor () )
- {
- // Get the color and set it into the shader node (if it is a valid color).
- const COLLADAFW::Color& color = emission.getColor ();
- if ( color.isValid () )
- shaderNode->setIncandescence ( MayaDM::float3 ( (float)color.getRed (), (float)color.getGreen (), (float)color.getBlue ()) );
- }
- else
- {
- // Get the texure and the current shader attribute.
- const COLLADAFW::Texture& texture = diffuse.getTexture ();
- ShaderAttribute shaderAttribute = ATTR_INCANDESCENE;
-
- // Create a shader node attribute and append it on the list of shader node
- // attributes to the current sampler file id.
- appendShaderNodeAttribute ( texture, shaderType, shaderAttribute, shaderNode );
- }
-
- // --------------------
- // TODO
- const COLLADAFW::FloatOrParam& indexOfRefraction = commonEffect->getIndexOfRefraction ();
- shaderNode->setRefractiveIndex ( indexOfRefraction );
-
- // --------------------
- const COLLADAFW::ColorOrTexture& reflective = commonEffect->getReflective ();
- if ( reflective.isColor () )
- {
- // Get the color and set it into the shader node (if it is a valid color).
- const COLLADAFW::Color& color = reflective.getColor ();
- // TODO
- }
-
- // --------------------
- // TODO
- {
- const COLLADAFW::FloatOrParam& reflectivity = commonEffect->getReflectivity ();
-// const COLLADAFW::FloatOrParam::Type& type = reflectivity.getType ();
-// switch ( type )
-// {
-// case COLLADAFW::FloatOrParam::FLOAT:
-// break;
-// case COLLADAFW::FloatOrParam::PARAM:
-// break;
-// default:
-// MGlobal::displayError ( "Unknown param type!" );
-// std::cerr << "Unknown param type!" << endl;
-// break;
-// }
- }
-
- // --------------------
- // TODO Not on lambert shader! Just phong and blinn!
- const COLLADAFW::FloatOrParam& shininess = commonEffect->getShininess ();
-
- // --------------------
- // TODO Not on lambert shader! Just phong and blinn!
- const COLLADAFW::ColorOrTexture& specular = commonEffect->getSpecular ();
- if ( specular.isColor () )
- {
- // Get the color and set it into the shader node (if it is a valid color).
- const COLLADAFW::Color& color = specular.getColor ();
- // TODO
- }
-
- // --------------------
- // TODO
- const COLLADAFW::FloatOrParam& transparency = commonEffect->getTransparency ();
-
- // --------------------
- const COLLADAFW::ColorOrTexture& transparent = commonEffect->getTransparent();
- if ( transparent.isColor () )
- {
- // Get the color and set it into the shader node (if it is a valid color).
- const COLLADAFW::Color& color = transparent.getColor ();
- if ( color.isValid () )
- shaderNode->setTransparency ( MayaDM::float3 ( (float)color.getRed (), (float)color.getGreen (), (float)color.getBlue ()) );
- }
- else
- {
- // Get the texure and the current shader attribute.
- const COLLADAFW::Texture& texture = diffuse.getTexture ();
- ShaderAttribute shaderAttribute = ATTR_INCANDESCENE;
-
- // Create a shader node attribute and append it on the list of shader node
- // attributes to the current sampler file id.
- appendShaderNodeAttribute ( texture, shaderType, shaderAttribute, shaderNode );
- }
- }
+ MayaDM::Lambert* shaderNode,
+ const COLLADAFW::EffectCommon* commonEffect );
+
+ /**
+ * Imports the shader attributes.
+ */
+ void importReflectShaderAttributes (
+ const ShaderType& shaderType,
+ MayaDM::Reflect* shaderNode,
+ const COLLADAFW::EffectCommon* commonEffect );
+
+ /**
+ * Imports the shader attributes.
+ */
+ void importBlinnShaderAttributes (
+ MayaDM::Blinn* shaderNode,
+ const COLLADAFW::EffectCommon* commonEffect );
+
+ /**
+ * Imports the shader attributes.
+ */
+ void importPhongShaderAttributes (
+ MayaDM::Phong* shaderNode,
+ const COLLADAFW::EffectCommon* commonEffect );
/**
* Create a shader node attribute and append it on the list of shader node attributes
* to the current sampler file id.
*/
- void appendShaderNodeAttribute (
+ void appendTextureAttribute (
const COLLADAFW::Texture &texture,
const ShaderType& shaderType,
const ShaderAttribute& shaderAttribute,
- MayaDM::DependNode* shaderNode );
+ MayaDM::Lambert* shaderNode );
/** Disable default copy ctor. */
EffectImporter( const EffectImporter& pre );
View
82 COLLADAMaya/include/COLLADAMayaGeometryBinding.h
@@ -0,0 +1,82 @@
+/*
+ Copyright (c) 2008 NetAllied Systems GmbH
+
+ This file is part of COLLADAFramework.
+
+ Licensed under the MIT Open Source License,
+ for details please see LICENSE file or the website
+ http://www.opensource.org/licenses/mit-license.php
+*/
+
+#ifndef __COLLADAMAYA_GEOMETRYBINDING_H__
+#define __COLLADAMAYA_GEOMETRYBINDING_H__
+
+#include "COLLADAMayaPrerequisites.h"
+
+#include "COLLADAFWUniqueId.h"
+#include "COLLADAFWMaterial.h"
+
+
+namespace COLLADAMaya
+{
+
+ /**
+ * The binding for a geometry and transform node.
+ */
+ class GeometryBinding
+ {
+ private:
+ COLLADAFW::UniqueId mGeometryId;
+ COLLADAFW::UniqueId mTransformId;
+
+ public:
+ GeometryBinding ();
+ GeometryBinding (
+ const COLLADAFW::UniqueId& geometryId,
+ const COLLADAFW::UniqueId& transformId )
+ : mGeometryId (geometryId)
+ , mTransformId (transformId)
+ {}
+ virtual ~GeometryBinding ();
+
+ const COLLADAFW::UniqueId& getGeometryId () const { return mGeometryId; }
+ void setGeometryId ( const COLLADAFW::UniqueId& val ) { mGeometryId = val; }
+
+ const COLLADAFW::UniqueId& getTransformId () const { return mTransformId; }
+ void setTransformId ( const COLLADAFW::UniqueId& val ) { mTransformId = val; }
+
+ bool operator<(const GeometryBinding& rhs) const;
+ bool operator==(const GeometryBinding& uid) const;
+ };
+
+
+
+ class MaterialInfo
+ {
+ private:
+ COLLADAFW::UniqueId mMaterialId;
+ COLLADAFW::MaterialId mShadingEngineId;
+
+ public:
+ MaterialInfo () {}
+ MaterialInfo (
+ const COLLADAFW::UniqueId& materialId,
+ const COLLADAFW::MaterialId& shadingEngineId )
+ : mMaterialId (materialId)
+ , mShadingEngineId (shadingEngineId)
+ {}
+ virtual ~MaterialInfo () {}
+
+ const COLLADAFW::UniqueId& getMaterialId () const { return mMaterialId; }
+ void setMaterialId ( const COLLADAFW::UniqueId& val ) { mMaterialId = val; }
+
+ const COLLADAFW::MaterialId& getShadingEngineId () const { return mShadingEngineId; }
+ void setShadingEngineId ( const COLLADAFW::MaterialId& val ) { mShadingEngineId = val; }
+ };
+ typedef std::map<GeometryBinding, std::vector<MaterialInfo>> GeometryBindingMaterialInfosMap;
+
+
+
+} // namespace COLLADAMAYA
+
+#endif // __COLLADAMAYA_GEOMETRYBINDING_H__
View
59 COLLADAMaya/include/COLLADAMayaGeometryImporter.h
@@ -19,6 +19,7 @@
#include "COLLADAMayaStableHeaders.h"
#include "COLLADAMayaBaseImporter.h"
#include "COLLADAMayaNode.h"
+#include "COLLADAMayaShadingBinding.h"
#include "COLLADAFWMesh.h"
@@ -53,40 +54,30 @@ namespace COLLADAMaya
* Assign the group to the unique geometry id, the transform node
* to the mesh instance and the index of the geometry's primitives.
*/
- class GroupIdAssignment
+ class GroupAssignment
{
private:
MayaDM::GroupId mGroupId;
- COLLADAFW::UniqueId mGeometryId;
+ COLLADAFW::MaterialId mShadingEngineId;
size_t mGeometryInstanceIndex;
size_t mPrimitiveIndex;
public:
- GroupIdAssignment () {}
- GroupIdAssignment (
- MayaDM::GroupId& groupId,
- const COLLADAFW::UniqueId& geometryId,
- const size_t geometryInstanceIndex,
- const size_t primitiveIndex )
- : mGroupId (groupId)
- , mGeometryId (geometryId)
- , mGeometryInstanceIndex (geometryInstanceIndex)
- , mPrimitiveIndex (primitiveIndex)
- {}
- virtual ~GroupIdAssignment () {}
+ GroupAssignment () {}
+ virtual ~GroupAssignment () {}
const MayaDM::GroupId& getGroupId () const { return mGroupId; }
void setGroupId ( MayaDM::GroupId& val ) { mGroupId = val; }
- const COLLADAFW::UniqueId& getGeometryId () const { return mGeometryId; }
- void setGeometryId ( const COLLADAFW::UniqueId& val ) { mGeometryId = val; }
+ const COLLADAFW::MaterialId& getShadingEngineId () const { return mShadingEngineId; }
+ void setShadingEngineId ( const COLLADAFW::MaterialId& val ) { mShadingEngineId = val; }
const size_t getGeometryInstanceIndex () const { return mGeometryInstanceIndex; }
void setGeometryInstanceIndex ( const size_t val ) { mGeometryInstanceIndex = val; }
const size_t getPrimitiveIndex () const { return mPrimitiveIndex; }
void setPrimitiveIndex ( const size_t val ) { mPrimitiveIndex = val; }
};
- typedef std::vector<GroupIdAssignment> GroupIdAssignments;
+
private:
@@ -103,7 +94,7 @@ namespace COLLADAMaya
/**
* The map holds the unique ids of the geometry nodes to the maya specific nodes.
*/
- UniqueIdMayaNodesMap mMayaMeshNodesMap;
+ UniqueIdMayaNodeMap mMayaMeshNodesMap;
/**
* The map holds the unique ids of the nodes to the specific nodes.
@@ -118,17 +109,17 @@ namespace COLLADAMaya
/**
* Assign the group to the unique geometry id, the transform node
- * to the mesh instance and the index of the geometry's primitives.
+ * to the mesh instance and the shading engine.
*/
- GroupIdAssignments mGroupIdAssignments;
+ ShadingBindingGroupInfoMap mShadingBindingGroupMap;
public:
/** Constructor. */
GeometryImporter ( DocumentImporter* documentImporter );
/** Destructor. */
- virtual ~GeometryImporter () {}
+ virtual ~GeometryImporter ();
/** Imports the geometry element. */
void importGeometry ( const COLLADAFW::Geometry* geometry );
@@ -153,6 +144,11 @@ namespace COLLADAMaya
*/
const MayaDM::Mesh* findMayaDMMeshNode ( const COLLADAFW::UniqueId& uniqueId ) const;
+ /**
+ * The map holds the unique ids of the nodes to the specific nodes.
+ */
+ const UniqueIdMayaDMMeshMap& getMayaDMMeshNodesMap () const { return mMayaDMMeshNodesMap; }
+
/**
* Returns a pointer to the vector of indices of the given geometry and shading engine.
* The map holds for every geometry's shading engine a list of the index values of the
@@ -166,7 +162,21 @@ namespace COLLADAMaya
* Assign the group to the unique geometry id, the transform node
* to the mesh instance and the index of the geometry's primitives.
*/
- const GroupIdAssignments& getGroupIdAssignments () const { return mGroupIdAssignments; }
+ const ShadingBindingGroupInfoMap& getShadingBindingGroupMap () const { return mShadingBindingGroupMap; }
+
+ /**
+ * Get the groupId assignement data for the current geometry under the transform.
+ */
+ std::vector<GroupInfo>* findShadingBindingGroups (
+ const COLLADAFW::UniqueId& geometryId,
+ const COLLADAFW::UniqueId& transformId,
+ const COLLADAFW::MaterialId& shadingEngineId );
+
+ /**
+ * Get the groupId assignement data for the current geometry under the transform.
+ */
+ std::vector<GroupInfo>* findShadingBindingGroups (
+ const ShadingBinding& shadingBinding );
private:
@@ -188,15 +198,16 @@ namespace COLLADAMaya
*/
void createGroupNodes (
const COLLADAFW::Mesh* mesh,
- const size_t geometryInstanceIndex );
+ const COLLADAFW::UniqueId& transformNodeId,
+ size_t& geometryInstanceIndex );
/**
* Create the object group instances and the object groups and write it into the maya file.
*/
void writeObjectGroups (
const COLLADAFW::Mesh* mesh,
MayaDM::Mesh &meshNode,
- size_t numNodeInstances );
+ const COLLADAFW::UniqueId& transformNodeId );
/**
* Iterates over the mesh primitives and reads the edge indices.
View
12 COLLADAMaya/include/COLLADAMayaImageImporter.h
@@ -31,7 +31,6 @@ namespace COLLADAMaya
/** The standard name for image without name. */
static const String IMAGE_NAME;
- static const String PLACE_2D_TEXTURE_NAME;
static const String DEFAULT_TEXTURE_LIST;
private:
@@ -45,11 +44,6 @@ namespace COLLADAMaya
COLLADABU::IDList mImageIdList;
/**
- * The list with the unique maya place2dtexture names.
- */
- COLLADABU::IDList mPlace2dTextureIdList;
-
- /**
* The map holds the Maya image file objects for the unique image file ids.
*/
UniqueIdMayaImagesMap mImageIdMayaImageFileMap;
@@ -72,15 +66,15 @@ namespace COLLADAMaya
*/
void writeConnections ();
- private:
-
/**
* Returns a pointer to the maya image file with the given image id,
* or NULL, if it is not in the list.
*/
const MayaDM::File* findMayaImageFile ( const COLLADAFW::UniqueId& imageId );
- };
+ private:
+
+ };
} // namespace COLLADAMAYA
View
2 COLLADAMaya/include/COLLADAMayaLightImporter.h
@@ -64,7 +64,7 @@ namespace COLLADAMaya
* The map holds the unique ids of the light nodes to the maya specific nodes.
* Need for the instances.
*/
- UniqueIdMayaNodesMap mMayaLightNodesMap;
+ UniqueIdMayaNodeMap mMayaLightNodesMap;
/**
* The map holds the maya light objects for the connections.
View
4 COLLADAMaya/include/COLLADAMayaMaterialExporter.h
@@ -50,10 +50,12 @@ namespace COLLADAMaya
class ExportedEffect
{
- MObject* shader; // The shader object, that was use to export the effect
+ MObject* shader; // The shader object, that was used to export the effect
unsigned long mColor; // The color that was used to export the effect
};
+ private:
+
/** Pointer to the document exporter */
DocumentExporter* mDocumentExporter;
View
100 COLLADAMaya/include/COLLADAMayaMaterialImporter.h
@@ -18,6 +18,8 @@
#include "COLLADAMayaStableHeaders.h"
#include "COLLADAMayaBaseImporter.h"
+#include "COLLADAMayaShadingBinding.h"
+#include "COLLADAMayaGeometryBinding.h"
#include "COLLADABUIDList.h"
@@ -64,58 +66,26 @@ namespace COLLADAMaya
/**
* The maya shading engine and material info.
+ * Holds the shadingEngine and the materialInfo.
*/
class ShadingData
{
private:
- MayaDM::ShadingEngine* mShadingEngine;
- MayaDM::MaterialInfo* mMaterialInfo;
+ MayaDM::ShadingEngine mShadingEngine;
+ MayaDM::MaterialInfo mMaterialInfo;
public:
- ShadingData () : mShadingEngine (0), mMaterialInfo (0) {}
- ShadingData (
- MayaDM::ShadingEngine* shadingEngine,
- MayaDM::MaterialInfo* materialInfo )
+ ShadingData () {}
+ ShadingData ( const MayaDM::ShadingEngine& shadingEngine, const MayaDM::MaterialInfo& materialInfo )
: mShadingEngine ( shadingEngine )
, mMaterialInfo ( materialInfo )
{}
- virtual ~ShadingData()
- {
- delete mShadingEngine;
- delete mMaterialInfo;
- }
-
- MayaDM::ShadingEngine* getShadingEngine () const { return mShadingEngine; }
- MayaDM::MaterialInfo* getMaterialInfo () const { return mMaterialInfo; }
- };
- typedef std::map<COLLADAFW::UniqueId, ShadingData*> ShadingDataMap;
-
- private:
-
- /**
- * The binding of a geometry instance to a material.
- */
- class ShadingBinding
- {
- private:
- COLLADAFW::UniqueId mGeometryId;
- COLLADAFW::UniqueId mTransformNodeId;
- COLLADAFW::UniqueId mMaterialId;
- public:
- ShadingBinding () {}
- virtual ~ShadingBinding () {}
-
- const COLLADAFW::UniqueId& getGeometryId () const { return mGeometryId; }
- void setGeometryId ( const COLLADAFW::UniqueId& val ) { mGeometryId = val; }
-
- const COLLADAFW::UniqueId& getTransformNodeId () const { return mTransformNodeId; }
- void setTransformNodeId ( const COLLADAFW::UniqueId& val ) { mTransformNodeId = val; }
-
- const COLLADAFW::UniqueId& getMaterialId () const { return mMaterialId; }
- void setMaterialId ( const COLLADAFW::UniqueId& val ) { mMaterialId = val; }
+ const MayaDM::ShadingEngine& getShadingEngine () const { return mShadingEngine; }
+ const MayaDM::MaterialInfo& getMaterialInfo () const { return mMaterialInfo; }
};
- typedef std::map<COLLADAFW::MaterialId, std::set<ShadingBinding*>> ShadingEngineBindingMap;
+ /** Holds for a material id the shadingEngine and materialInfo. */
+ typedef std::map<COLLADAFW::UniqueId, ShadingData*> ShadingDataMap;
private:
@@ -153,7 +123,7 @@ namespace COLLADAMaya
/**
* The map holds for every shader engine a list of geometry ids, which use this shader engine.
*/
- ShadingEngineBindingMap mShadingEngineBindingMap;
+ GeometryBindingMaterialInfosMap mGeometryBindingMaterialInfosMap;
public:
@@ -168,7 +138,6 @@ namespace COLLADAMaya
/** Write the shader data into the maya file. */
void writeShaderData (
- const COLLADAFW::InstanceGeometry::MaterialBinding& materialBinding,
const COLLADAFW::UniqueId& transformNodeId,
const COLLADAFW::InstanceGeometry* instanceGeometry );
@@ -189,14 +158,20 @@ namespace COLLADAMaya
private:
- /** Connect the material with the shading engine and the material info. */
+ /**
+ * Connect the material with the shading engine and the material info.
+ */
void connectShadingEngines ();
- /** Connect the material with the depending geometries. */
- void connectGeometries ();
+ /**
+ * Connects the shading engines with the object groups.
+ */
+ void connectShadingEngineObjectGroups ();
- /** If there are some object groups, we have to connect them with the geometries. */
- void connectGeometryGroups ();
+ /**
+ * Connects the material with the depending geometries.
+ */
+ void connectGeometries ();
/**
* Connects the default shader list with the materials.
@@ -219,30 +194,27 @@ namespace COLLADAMaya
const COLLADABU::IDList& getShadingEngineIdList () const { return mShadingEngineIdList; }
/**
- * The map with the unique ids of the shading engine to the shading engines itself.
- */
- ShadingData* findShaderData ( const COLLADAFW::UniqueId& val );
+ * Get the shading binding material.
+ */
+ const std::vector<MaterialInfo>* findGeometryBindingMaterialInfos (
+ const COLLADAFW::UniqueId& geometryId,
+ const COLLADAFW::UniqueId& transformId );
/**
- * Returns the effect id of the material.
- */
- const COLLADAFW::UniqueId* findEffectId ( const COLLADAFW::UniqueId& materialId );
+ * Get the shading binding material.
+ */
+ const std::vector<MaterialInfo>* findGeometryBindingMaterialInfos (
+ const GeometryBinding& geometryBinding );
/**
* The map with the unique ids of the shading engine to the shading engines itself.
*/
- void appendShaderData (
- const COLLADAFW::UniqueId& uniqueMaterialId,
- MayaDM::ShadingEngine* shadingEngine,
- MayaDM::MaterialInfo* materialInfo );
+ ShadingData* findShaderData ( const COLLADAFW::UniqueId& shadingEngineId );
/**
- * Find the index of the transform node of the current geometry instance.
- * This is the geometry instance index we use to set the current connection to.
- */
- size_t getGeometryInstanceIndex (
- const COLLADAFW::UniqueId& geometryId,
- const COLLADAFW::UniqueId& transformNodeId );
+ * Returns the effect id of the material.
+ */
+ const COLLADAFW::UniqueId* findEffectId ( const COLLADAFW::UniqueId& materialId );
};
}
View
48 COLLADAMaya/include/COLLADAMayaNode.h
@@ -31,49 +31,61 @@ namespace COLLADAMaya
* The parent node.
*/
MayaNode* mParent;
+
+ /**
+ * The flag, if the node is positioned at the right place. Default is true.
+ * But if a node from <library_nodes> is created, we have to move it later
+ * (the right position in the scene graph depends on the first implementation from there).
+ */
+ bool mIsCorrectPositioned;
public:
- MayaNode () : mParent (0), mName (""), mPath ("") {}
- MayaNode ( COLLADAFW::UniqueId uniqueId, const String name, MayaNode* parent = NULL )
- : mUniqueId ( uniqueId )
- , mName ( name )
- , mParent ( parent )
- , mPath ("")
- {}
+ MayaNode ();
+
+ /**
+ * Constructor.
+ * Copy the uniqueId!
+ */
+ MayaNode (
+ const COLLADAFW::UniqueId uniqueId,
+ const String name,
+ MayaNode* parent = NULL,
+ const bool isCorrectPositioned=true );
+
virtual ~MayaNode() {}
- /** Returns the unique id of the object.*/
+ /**
+ * Returns the unique id of the object.
+ */
const COLLADAFW::UniqueId& getUniqueId() const { return mUniqueId; }
/**
* The parent node.
*/
MayaNode* getParent () { return mParent; }
const MayaNode* getParent () const { return mParent; }
- void setParent ( MayaNode* val )
- {
- mParent = val;
- mPath = "";
- }
+ void setParent ( MayaNode* val );
/**
* The name attribute is the text string name of this element.
* Optional attribute.
*/
const COLLADAMaya::String getName () const { return mName; }
- void setName ( COLLADAMaya::String val )
- {
- mName = val;
- mPath = "";
- }
+ void setName ( COLLADAMaya::String val );
/**
* Get's the node path of the current maya node.
*/
const String getNodePath ();
void setNodePath ( const COLLADAMaya::String& val ) { mPath = val; }
+ /**
+ * The flag, if the node is already created. Default is true;
+ */
+ const bool getIsCorrectPositioned () const { return mIsCorrectPositioned; }
+ void setIsCorrectPositioned ( const bool val ) { mIsCorrectPositioned = val; }
+
};
} // namespace COLLADAMAYA
View
54 COLLADAMaya/include/COLLADAMayaSaxParserErrorHandler.h
@@ -0,0 +1,54 @@
+/*
+ Copyright (c) 2008 NetAllied Systems GmbH
+
+ This file is part of COLLADAFramework.
+
+ Licensed under the MIT Open Source License,
+ for details please see LICENSE file or the website
+ http://www.opensource.org/licenses/mit-license.php
+*/
+
+#ifndef __COLLADAMAYA_SAXPARSERERRORHANDLER_H__
+#define __COLLADAMAYA_SAXPARSERERRORHANDLER_H__
+
+#include "COLLADAMayaPrerequisites.h"
+
+#include "COLLADASaxFWLIErrorHandler.h"
+#include "COLLADASaxFWLSaxParserError.h"
+
+
+namespace COLLADAMaya
+{
+
+ /** TODO Documentation */
+ class SaxParserErrorHandler : public COLLADASaxFWL::IErrorHandler
+ {
+ private:
+
+ public:
+
+ /** Constructor. */
+ SaxParserErrorHandler();
+
+ /** Destructor. */
+ virtual ~SaxParserErrorHandler();
+
+ /**
+ * If this method returns true, the loader stops parsing immediately.
+ * If severity is not CRITICAL and this method returns true, the loader continues loading.
+ */
+ bool virtual handleError ( const COLLADASaxFWL::IError* error );
+
+ private:
+
+ /** Disable default copy ctor. */
+ SaxParserErrorHandler( const SaxParserErrorHandler& pre );
+
+ /** Disable default assignment operator. */
+ const SaxParserErrorHandler& operator= ( const SaxParserErrorHandler& pre );
+
+ };
+
+} // namespace COLLADAMAYA
+
+#endif // __COLLADAMAYA_SAXPARSERERRORHANDLER_H__
View
93 COLLADAMaya/include/COLLADAMayaShadingBinding.h
@@ -0,0 +1,93 @@
+/*
+ Copyright (c) 2008 NetAllied Systems GmbH
+
+ This file is part of COLLADAFramework.
+
+ Licensed under the MIT Open Source License,
+ for details please see LICENSE file or the website
+ http://www.opensource.org/licenses/mit-license.php
+*/
+
+#ifndef __COLLADAMAYA_SHADINGBINDING_H__
+#define __COLLADAMAYA_SHADINGBINDING_H__
+
+#include "COLLADAMayaPrerequisites.h"
+
+#include "COLLADAFWUniqueId.h"
+#include "COLLADAFWMaterial.h"
+
+#include "MayaDMGroupId.h"
+
+
+namespace COLLADAMaya
+{
+
+ /**
+ * The binding for a geometry, transform node and shading engine.
+ */
+ class ShadingBinding
+ {
+ private:
+
+ COLLADAFW::UniqueId mGeometryId;
+ COLLADAFW::UniqueId mTransformId;
+ COLLADAFW::MaterialId mShadingEngineId;
+
+ public:
+
+ ShadingBinding ();
+
+ ShadingBinding (
+ const COLLADAFW::UniqueId& geometryId,
+ const COLLADAFW::UniqueId& transformId,
+ const COLLADAFW::MaterialId& shadingEngineId );
+
+ virtual ~ShadingBinding ();
+
+ const COLLADAFW::UniqueId& getGeometryId () const { return mGeometryId; }
+ void setGeometryId ( const COLLADAFW::UniqueId& val ) { mGeometryId = val; }
+
+ const COLLADAFW::UniqueId& getTransformId () const { return mTransformId; }
+ void setTransformId ( const COLLADAFW::UniqueId& val ) { mTransformId = val; }
+
+ const COLLADAFW::MaterialId& getShadingEngineId () const { return mShadingEngineId; }
+ void setShadingEngineId ( const COLLADAFW::MaterialId& val ) { mShadingEngineId = val; }
+
+ bool operator<(const ShadingBinding& rhs) const;
+ bool operator==(const ShadingBinding& uid) const;
+ };
+ /**
+ * The material binding per primitive element for a geometry, transform node and shading engine.
+ */
+ typedef std::map<ShadingBinding, std::vector<COLLADAFW::UniqueId>> ShadingBindingMaterialMap;
+
+
+ class GroupInfo
+ {
+ private:
+ MayaDM::GroupId mGroupId;
+ COLLADAFW::MaterialId mShadingEngineId;
+
+ public:
+ GroupInfo () {}
+ GroupInfo ( const MayaDM::GroupId& groupId, const COLLADAFW::MaterialId& shadingEngineId )
+ : mGroupId ( groupId )
+ , mShadingEngineId ( shadingEngineId )
+ {}
+ virtual ~GroupInfo () {}
+
+ const MayaDM::GroupId& getGroupId () const { return mGroupId; }
+ void setGroupId ( const MayaDM::GroupId& val ) { mGroupId = val; }
+
+ const COLLADAFW::MaterialId& getShadingEngineId () const { return mShadingEngineId; }
+ void setShadingEngineId ( const COLLADAFW::MaterialId& val ) { mShadingEngineId = val; }
+ };
+ /**
+ * The group binding per primitive element for a geometry, transform node and shading engine.
+ */
+ typedef std::map<ShadingBinding, std::vector<GroupInfo>> ShadingBindingGroupInfoMap;
+
+
+} // namespace COLLADAMAYA
+
+#endif // __COLLADAMAYA_SHADINGBINDING_H__
View
45 COLLADAMaya/include/COLLADAMayaVisualSceneImporter.h
@@ -23,6 +23,7 @@
#include "MayaDMTransform.h"
#include "COLLADAFWVisualScene.h"
+#include "COLLADAFWLibraryNodes.h"
#include "COLLADAFWSkew.h"
#include "COLLADABUIDList.h"
@@ -140,22 +141,32 @@ namespace COLLADAMaya
VisualSceneImporter ( DocumentImporter* documentImporter );
/** Destructor. */
- virtual ~VisualSceneImporter () {}
+ virtual ~VisualSceneImporter ();
/**
* Import the current visual scene with all scene nodes and transforms.
*/
- bool importVisualScene ( const COLLADAFW::VisualScene* visualScene );
+ void importVisualScene ( const COLLADAFW::VisualScene* visualScene );
+
+ /**
+ * Import the library nodes with all nodes.
+ */
+ void importLibraryNodes ( const COLLADAFW::LibraryNodes* libraryNodes );
+
+ /**
+ * Write the parenting informations about node instances into the maya ascii file.
+ */
+ void writeNodeInstances ();
/**
* The map holds the unique ids of the nodes to the full node pathes (contains the name).
*/
- const MayaNode* findMayaTransformNode ( const COLLADAFW::UniqueId& uniqueId ) const;
+ const MayaNodesList* findMayaTransformNode ( const COLLADAFW::UniqueId& transformId ) const;
/**
* The map holds the unique ids of the nodes to the full node pathes (contains the name).
*/
- MayaNode* findMayaTransformNode ( const COLLADAFW::UniqueId& uniqueId );
+ MayaNodesList* findMayaTransformNode ( const COLLADAFW::UniqueId& transformId );
/**
* The map holds for every transform node a list of all existing parent transform nodes
@@ -184,14 +195,31 @@ namespace COLLADAMaya
*/
const UniqueIdVec* findLightTransformIds ( const COLLADAFW::UniqueId& lightId ) const;
+ /**
+ * Determines the number of transform node instances.
+ */
+ size_t getNumTransformInstances (
+ const COLLADAFW::UniqueId& transformId,
+ const bool recursive = false );
+
+ /**
+ * Returns a filled list of all existing pathes to all instances to the current node.
+ */
+ void getTransformPathes (
+ std::vector<String>& transformPathes,
+ const COLLADAFW::UniqueId& transformId,
+ const String childSubPath = "" );
+
private:
/*
* Imports the data of the current node.
*/
void importNode (
const COLLADAFW::Node* rootNode,
- const COLLADAFW::UniqueId* parentNodeId = NULL );
+ MayaNode* parentMayaNode = NULL,
+ const COLLADAFW::UniqueId* parentNodeId = NULL,
+ const bool createNode = true );
/**
* Save the transformation ids to the geometry ids.
@@ -220,11 +248,6 @@ namespace COLLADAMaya
*/
bool readNodeInstances ( const COLLADAFW::Node* node );
- /**
- * Write the parenting informations about node instances into the maya ascii file.
- */
- void writeNodeInstances ();
-
/*
* Transform the input matrix and convert it in a double[4][4] matrix.
*/
@@ -269,7 +292,7 @@ namespace COLLADAMaya
/**
* Creates a node or joint object.
*/
- MayaDM::Transform* createNode (
+ MayaDM::Transform* createMayaNode (
const COLLADAFW::Node* node,
const String& nodeName,
const String& parentNodeName );
View
24 COLLADAMaya/scripts/COLLADAMaya.vcproj
@@ -2687,6 +2687,10 @@
>
</File>
<File
+ RelativePath="..\src\COLLADAMayaGeometryBinding.cpp"
+ >
+ </File>
+ <File
RelativePath="..\src\COLLADAMayaGeometryImporter.cpp"
>
</File>
@@ -2707,6 +2711,14 @@
>
</File>
<File
+ RelativePath="..\src\COLLADAMayaSaxParserErrorHandler.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\src\COLLADAMayaShadingBinding.cpp"
+ >
+ </File>
+ <File
RelativePath="..\src\COLLADAMayaVisualSceneImporter.cpp"
>
</File>
@@ -3528,6 +3540,10 @@
>
</File>
<File
+ RelativePath="..\include\COLLADAMayaGeometryBinding.h"
+ >
+ </File>
+ <File
RelativePath="..\include\COLLADAMayaGeometryImporter.h"
>
<FileConfiguration
@@ -3940,6 +3956,14 @@
>
</File>
<File
+ RelativePath="..\include\COLLADAMayaSaxParserErrorHandler.h"
+ >
+ </File>
+ <File
+ RelativePath="..\include\COLLADAMayaShadingBinding.h"
+ >
+ </File>
+ <File
RelativePath="..\include\COLLADAMayaVisualSceneImporter.h"
>
<FileConfiguration
View
37 COLLADAMaya/src/COLLADAMayaBaseImporter.cpp
@@ -1,6 +1,23 @@
+/*
+ Copyright (c) 2008 NetAllied Systems GmbH
+
+ This file is part of COLLADAMaya.
+
+ Portions of the code are:
+ Copyright (c) 2005-2007 Feeling Software Inc.
+ Copyright (c) 2005-2007 Sony Computer Entertainment America
+ Copyright (c) 2004-2005 Alias Systems Corp.
+
+ Licensed under the MIT Open Source License,
+ for details please see LICENSE file or the website
+ http://www.opensource.org/licenses/mit-license.php
+*/
#include "COLLADAMayaStableHeaders.h"
#include "COLLADAMayaBaseImporter.h"
+#include "math/COLLADABUMathUtils.h"
+
+
namespace COLLADAMaya
{
@@ -27,6 +44,26 @@ namespace COLLADAMaya
}
//-----------------------------
+ MayaDM::double3 BaseImporter::toAngularUnit ( const MayaDM::double3& val )
+ {
+ if ( mDocumentImporter->getUpAxisType () == COLLADAFW::FileInfo::X_UP )
+ return ( MayaDM::double3 ( COLLADABU::Math::Utils::radToDeg ( val[1] ), COLLADABU::Math::Utils::radToDeg ( val[0]*(-1) ), COLLADABU::Math::Utils::radToDeg ( val[2] ) ) );
+ else if ( mDocumentImporter->getUpAxisType () == COLLADAFW::FileInfo::Z_UP )
+ return ( MayaDM::double3 ( COLLADABU::Math::Utils::radToDeg ( val[0] ), COLLADABU::Math::Utils::radToDeg ( val[2] ), COLLADABU::Math::Utils::radToDeg ( val[1]*(-1) ) ) );
+ else return ( MayaDM::double3 ( COLLADABU::Math::Utils::radToDeg ( val[0] ), COLLADABU::Math::Utils::radToDeg ( val[1] ), COLLADABU::Math::Utils::radToDeg ( val[2] ) ) );
+ }
+
+ //-----------------------------
+ MayaDM::double3 BaseImporter::toUpAxisType ( const MayaDM::double3& val )
+ {
+ if ( mDocumentImporter->getUpAxisType () == COLLADAFW::FileInfo::X_UP )
+ return ( MayaDM::double3 ( val[1], val[0]*(-1), val[2] ) );
+ else if ( mDocumentImporter->getUpAxisType () == COLLADAFW::FileInfo::Z_UP )
+ return ( MayaDM::double3 ( val[0], val[2], val[1]*(-1) ) );
+ else return ( MayaDM::double3 ( val[0], val[1], val[2] ) );
+ }
+
+ //-----------------------------
MVector BaseImporter::toLinearUnit ( const MVector& val )
{
if ( mDocumentImporter->getUpAxisType () == COLLADAFW::FileInfo::X_UP )
View
34 COLLADAMaya/src/COLLADAMayaCameraImporter.cpp
@@ -32,6 +32,14 @@ namespace COLLADAMaya
//------------------------------
CameraImporter::~CameraImporter()
{
+ UniqueIdMayaNodeMap::iterator it = mMayaCameraNodesMap.begin ();
+ while ( it != mMayaCameraNodesMap.end () )
+ {
+ MayaNode* mayaNode = it->second;
+ delete mayaNode;
+ ++it;
+ }
+ mMayaCameraNodesMap.clear ();
}
//------------------------------
@@ -43,26 +51,33 @@ namespace COLLADAMaya
// Get the transform nodes, which work with this camera instance.
VisualSceneImporter* visualSceneImporter = getDocumentImporter ()->getVisualSceneImporter ();
- const UniqueIdVec* transformNodes = visualSceneImporter->findCameraTransformIds ( cameraId );
- if ( transformNodes == 0 )
+ const UniqueIdVec* transformNodeIds = visualSceneImporter->findCameraTransformIds ( cameraId );
+ if ( transformNodeIds == 0 )
{
MGlobal::displayError ( "No camera node which implements this camera!" );
std::cerr << "No camera node which implements this camera!" << endl;
}
- UniqueIdVec::const_iterator nodesIter = transformNodes->begin ();
- while ( nodesIter != transformNodes->end () )
+ UniqueIdVec::const_iterator nodesIter = transformNodeIds->begin ();
+ while ( nodesIter != transformNodeIds->end () )
{
// Get the maya node of the current transform node.
const COLLADAFW::UniqueId& transformNodeId = *nodesIter;
- MayaNode* mayaTransformNode = visualSceneImporter->findMayaTransformNode ( transformNodeId );
+ MayaNodesList* mayaTransformNodes = visualSceneImporter->findMayaTransformNode ( transformNodeId );
+ if ( mayaTransformNodes->size () == 0 )
+ {
+ MGlobal::displayError ( "The referenced transform node doesn't exist!" );
+ std::cerr << "The referenced transform node doesn't exist!" << endl;
+ return;
+ }
+ MayaNode* mayaTransformNode = (*mayaTransformNodes) [0];
String transformNodeName = mayaTransformNode->getName ();
// Get the path to the parent transform node.
String transformNodePath = mayaTransformNode->getNodePath ();
// The first reference is a direct one, the others are instances.
- if ( nodesIter == transformNodes->begin() )
+ if ( nodesIter == transformNodeIds->begin() )
{
// Create the current mesh node.
createCamera ( camera, mayaTransformNode );
@@ -91,11 +106,12 @@ namespace COLLADAMaya
String cameraName = camera->getName ();
if ( COLLADABU::Utils::equals ( cameraName, "" ) )
cameraName = CAMERA_NAME;
+ cameraName = DocumentImporter::frameworkNameToMayaName ( cameraName );
cameraName = mCameraIdList.addId ( cameraName );
// Create a maya node object of the current node and push it into the map.
const COLLADAFW::UniqueId& cameraId = camera->getUniqueId ();
- MayaNode mayaMeshNode ( cameraId, cameraName, mayaTransformNode );
+ MayaNode* mayaMeshNode = new MayaNode ( cameraId, cameraName, mayaTransformNode );
mMayaCameraNodesMap [ cameraId ] = mayaMeshNode;
// Create the maya camera object and write it into the maya ascii file.
@@ -256,9 +272,9 @@ namespace COLLADAMaya
// --------------------------------------------
MayaNode* CameraImporter::findMayaCameraNode ( const COLLADAFW::UniqueId& cameraId )
{
- UniqueIdMayaNodesMap::iterator it = mMayaCameraNodesMap.find ( cameraId );
+ UniqueIdMayaNodeMap::iterator it = mMayaCameraNodesMap.find ( cameraId );
if ( it != mMayaCameraNodesMap.end () )
- return &(*it).second;
+ return it->second;
return 0;
}
View
10 COLLADAMaya/src/COLLADAMayaConsoleMain.cpp
@@ -56,12 +56,14 @@ int main(int argc,char** argv)
g_argv=argv;
#endif
- // Activate the error logging
+ // Activate the error logging. The default name of this file is OpenMayaErrorLog located in
+ // the current directory ( "$(MAYA_LOCATION)/bin/OpenMayaErrorLog.txt" ).
MGlobal::startErrorLogging();
- // The default name of this file is OpenMayaErrorLog located in the
- // current directory. This can be changed, however, by calling:
- MGlobal::setErrorLogPathName("$(MAYA_LOCATION)");
+// // The default name of this file is OpenMayaErrorLog located in the
+// // current directory. This can be changed, however, by calling:
+// std::string pathName = "C:/Temp/OpenMayaErrorLog.txt"; //MGlobal::errorLogPathName ().asChar ();
+// MGlobal::setErrorLogPathName ( pathName.c_str () );
char inFileName[MAX_FILENAME_LEN]={0};
char outFileName[MAX_FILENAME_LEN]={0};
View
101 COLLADAMaya/src/COLLADAMayaDocumentImporter.cpp
@@ -53,8 +53,10 @@ namespace COLLADAMaya
, mLightImporter (0)
, mImageImporter (0)
, mSceneGraphWritten (false)
+ , mLibraryNodesWritten (false)
, mAssetWritten (false)
, mSceneGraphRead (false)
+ , mLibraryNodesRead (false)
, mGeometryRead (false)
, mCameraRead (false)
, mLightRead (false)
@@ -125,7 +127,7 @@ namespace COLLADAMaya
{
// TODO
mMayaAsciiFileURI.set ( mColladaFileName );
- mMayaAsciiFileURI.setPathExtension ( ".netallied.import.ma" );
+ mMayaAsciiFileURI.setPathExtension ( ".nextgen.ma" );
String mayaAsciiFileName = mMayaAsciiFileURI.getURIString ();
// Check if the file already exist.
@@ -177,13 +179,36 @@ namespace COLLADAMaya
void DocumentImporter::start ()
{
// Create the maya file.
- bool retValue = createMayaAsciiFile();
+ bool retValue = createMayaAsciiFile ();
assert ( retValue );
}
//-----------------------------
void DocumentImporter::finish ()
{
+ // There has not to be a <library_nodes> tag in the document!
+ if ( mAssetWritten && mSceneGraphWritten && !mLibraryNodesWritten )
+ {
+ mLibraryNodesWritten = true;
+
+ // Write the node instances, when all nodes of the visual scene
+ // and the library nodes are already imported!
+ if ( mSceneGraphWritten && mLibraryNodesWritten )
+ {
+ // Write all the node instances
+ mVisualSceneImporter->writeNodeInstances ();
+ }
+
+ if ( mGeometryRead || mCameraRead || mLightRead || mImageRead )
+ {
+ mGeometryRead = false;
+ mCameraRead = false;
+ mLightRead = false;
+ mImageRead = false;
+ readColladaDocument ();
+ }
+ }
+
// If the last read is ready, we can write the connections and close the file.
--mNumDocumentParses;
if ( mNumDocumentParses == 0 )
@@ -201,7 +226,7 @@ namespace COLLADAMaya
//-----------------------------
void DocumentImporter::readColladaDocument ()
{
- COLLADASaxFWL::Loader loader;
+ COLLADASaxFWL::Loader loader ( &mSaxParserErrorHandler );
COLLADAFW::Root root ( &loader, this );
String filename = getColladaFilename ();
String fileUriString = URI::nativePathToUri ( filename );
@@ -404,9 +429,10 @@ namespace COLLADAMaya
mAssetWritten = true;
- if ( mSceneGraphRead || mGeometryRead || mCameraRead || mLightRead || mImageRead )
+ if ( mSceneGraphRead || mLibraryNodesRead || mGeometryRead || mCameraRead || mLightRead || mImageRead )
{
mSceneGraphRead = false;
+ mLibraryNodesRead = false;
mGeometryRead = false;
mCameraRead = false;
mLightRead = false;
@@ -420,7 +446,7 @@ namespace COLLADAMaya
//-----------------------------
bool DocumentImporter::writeVisualScene ( const COLLADAFW::VisualScene* visualScene )
{
- // Order: asset, scene graph, geometry
+ // Order: asset, scene graph, others
if ( !mAssetWritten )
{
mSceneGraphRead = true;
@@ -435,6 +461,14 @@ namespace COLLADAMaya
mVisualSceneImporter->importVisualScene ( visualScene );
mSceneGraphWritten = true;
+ // Write the node instances, when all nodes of the visual scene
+ // and the library nodes are already imported!
+ if ( mSceneGraphWritten && mLibraryNodesWritten )
+ {
+ // Write all the node instances
+ mVisualSceneImporter->writeNodeInstances ();
+ }
+
if ( mGeometryRead || mCameraRead || mLightRead || mImageRead )
{
mGeometryRead = false;
@@ -448,28 +482,59 @@ namespace COLLADAMaya
}
//-----------------------------
- bool DocumentImporter::writeGeometry ( const COLLADAFW::Geometry* geometry )
+ bool DocumentImporter::writeLibraryNodes ( const COLLADAFW::LibraryNodes* libraryNodes )
{
- // Order: asset, scene graph, geometry
- if ( !mAssetWritten || !mSceneGraphWritten )
+ // Order: asset, scene graph, library nodes, others
+ if ( !mAssetWritten )
{
- mGeometryRead = true;
+ mLibraryNodesRead = true;
return true;
}
+ if ( mLibraryNodesWritten ) return true;
// Create the file, if not already done.
if ( mFile == 0 ) start();
// Import the data.
- mGeometryImporter->importGeometry ( geometry );
+ mVisualSceneImporter->importLibraryNodes ( libraryNodes );
+ mLibraryNodesWritten = true;
+
+ // Write the node instances, when all nodes of the visual scene
+ // and the library nodes are already imported!
+ if ( mSceneGraphWritten && mLibraryNodesWritten )
+ {
+ // Write all the node instances
+ mVisualSceneImporter->writeNodeInstances ();
+ }
+
+ if ( mGeometryRead || mCameraRead || mLightRead || mImageRead )
+ {
+ mGeometryRead = false;
+ mCameraRead = false;
+ mLightRead = false;
+ mImageRead = false;
+ readColladaDocument ();
+ }
return true;
}
//-----------------------------
- bool DocumentImporter::writeLibraryNodes ( const COLLADAFW::LibraryNodes* libraryNodes )