예제 #1
0
   /// <summary>
   /// Gets AutoInherit on a layer for a specific property.
   /// </summary>
   public static Boolean GetAutoInherit(IILayer layer, NodeLayerProperty prop)
   {
      if (layer == null)
         throw new ArgumentNullException("layer");

      IAppDataChunk chunk = layer.GetAppDataChunk(classID, SClass_ID.Gup, (uint)prop);
      return (chunk != null) ? BitConverter.ToBoolean(chunk.Data, 0) : false;
   }
예제 #2
0
   /// <summary>
   /// Sets AutoInherit on a layer for a specific property.
   /// </summary>
   public static void SetAutoInherit(IILayer layer, NodeLayerProperty prop, Boolean value)
   {
      if (layer == null)
         throw new ArgumentNullException("layer");

      //Set AppDataChunk.
      layer.AddAppDataChunk(classID, SClass_ID.Gup, (uint)prop, BitConverter.GetBytes(value));

      //Update nodes on layer.
      ITab<IINode> nodes = MaxInterfaces.Global.INodeTabNS.Create();
      IILayerProperties layerProperties = MaxInterfaces.IIFPLayerManager.GetLayer(layer.Name);
      layerProperties.Nodes(nodes);

      foreach (IINode node in IINodes.ITabToIEnumerable(nodes))
      {
         setNodeInheritProperty(node, prop, value);
      }
   }
예제 #3
0
   private static void setNodeInheritProperty(IINode node, NodeLayerProperty prop, Boolean value)
   {
      IINodeLayerProperties nodeProps = node.GetInterface(MaxInterfaces.NodeLayerProperties) as IINodeLayerProperties;
      if (nodeProps == null)
         return;

      switch (prop)
      {
         case NodeLayerProperty.Color: nodeProps.ColorByLayer = value; break;
         case NodeLayerProperty.Display: nodeProps.DisplayByLayer = value; break;
         case NodeLayerProperty.GlobalIllumination: nodeProps.GlobalIlluminationByLayer = value; break;
         case NodeLayerProperty.Motion: nodeProps.MotionByLayer = value; break;
         case NodeLayerProperty.Render: nodeProps.RenderByLayer = value; break;
      }
   }