AtNode* CScriptedShapeTranslator::CreateArnoldNodes()
{
   std::map<std::string, CScriptedTranslator>::iterator translatorIt;
   MFnDependencyNode fnNode(GetMayaObject());
   
   translatorIt = gTranslators.find(fnNode.typeName().asChar());
   if (translatorIt == gTranslators.end())
   {
      AiMsgError("[mtoa.scriptedTranslators] No command to export node \"%s\" of type %s.", fnNode.name().asChar(), fnNode.typeName().asChar());
      return NULL;
   }
   
   float step = FindMayaPlug("aiStepSize").asFloat();
   bool asVolume =  (step > AI_EPSILON);
   
   m_masterNode = 0;
   
   if (!IsMasterInstance())
   {
      MDagPath masterPath = GetMasterInstance();
      
      CNodeAttrHandle handle(masterPath);
      std::vector<CNodeTranslator*> translators;
      unsigned int n = m_session->GetActiveTranslators(handle, translators);
      
      for (unsigned int i=0; i<n; ++i)
      {
         m_masterNode = translators[i]->GetArnoldRootNode();
         if (m_masterNode)
         {
            break;
         }
      }
   }
   
   if (!m_masterNode)
   {
      if (asVolume && !translatorIt->second.supportVolumes)
      {
         return AddArnoldNode("box");
      }
      else
      {
         return AddArnoldNode("procedural");
      }
   }
   else
   {
      if (asVolume && !translatorIt->second.supportVolumes)
      {
         return AddArnoldNode("ginstance");
      }
      else
      {
         return AddArnoldNode(translatorIt->second.supportInstances ? "ginstance" : "procedural");
      }
   }
}
 virtual AtNode *CreateArnoldNodes()
 {
   m_isMasterDag =  IsMasterInstance();
   m_masterDag = GetMasterInstance();
   if (m_isMasterDag)
   {
       return AddArnoldNode( "procedural" );
   }
   else
   {
       return AddArnoldNode( "ginstance" );
   }
 }
Esempio n. 3
0
		virtual AtNode *CreateArnoldNodes()
		{

#if AI_VERSION_ARCH_NUM >=4 && AI_VERSION_MAJOR_NUM >= 2 
                  m_isMasterDag =  IsMasterInstance(m_masterDag);

                  if (m_isMasterDag)
                  {

                        return AddArnoldNode( "procedural" );
                  }
                  else
                  {
                        return AddArnoldNode( "ginstance" );
                  }
#else 
                  return AddArnoldNode( "procedural" );
#endif
		}