SHARE
TWEET

Untitled

a guest Mar 21st, 2018 87 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //#include "../Maya/MayaMinimalShapeShape.h"
  2.  
  3. #include <string>
  4.  
  5. #include <ai_msg.h>
  6. #include <ai_nodes.h>
  7.  
  8. #include "MayaMinimalShapeArnoldTranslator.h"
  9.  
  10.  
  11. // derived from CShapeTranslator
  12.  
  13. void* MayaMinimalShapeArnoldTranslator::creator()
  14. {
  15.     return new MayaMinimalShapeArnoldTranslator();
  16. }
  17.  
  18.  
  19. AtNode* MayaMinimalShapeArnoldTranslator::CreateArnoldNodes()
  20. {
  21.     // just sphere
  22.     AtNode* sphere_node = AddArnoldNode("sphere");
  23.     return sphere_node;
  24. }
  25.  
  26.  
  27. void MayaMinimalShapeArnoldTranslator::Export(AtNode* i_sphere_node)
  28. {
  29.     // instance 20x
  30.     for(int i=0; i<20; ++i)
  31.     {
  32.         AtNode* current_instance_node = AddArnoldNode( "ginstance" );
  33.  
  34.         AiNodeSetPtr(current_instance_node, "node", (void*)i_sphere_node);
  35.  
  36.         // translate
  37.         AtMatrix _mtx = AiM4Translation( AtVector(50.0f * i, 0, 0) );
  38.         AiNodeSetMatrix(current_instance_node, "matrix", _mtx);
  39.     }
  40.  
  41.     Update(i_sphere_node);
  42. }
  43.  
  44.  
  45. void MayaMinimalShapeArnoldTranslator::Update(AtNode* i_sphere_node)
  46. {
  47.     ExportMatrix(i_sphere_node);
  48.     ProcessRenderFlags(i_sphere_node);
  49.     ExportLightLinking(i_sphere_node);
  50.  
  51.     // update sphere
  52.     AiNodeSetFlt( i_sphere_node, "radius", FindMayaPlug("Scale").asFloat() );
  53. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top