示例#1
0
 internal void Construct(Guid pluginId)
 {
     m_ext  = FileExtension;
     m_load = CanRead;
     m_save = CanWrite;
     m_kind = ContentType;
     UnsafeNativeMethods.CRhCmnContentIOPlugIn_New(m_runtime_serial_number, m_ext, string.Empty, (int)m_kind, m_save, m_load, pluginId);
 }
 //Currently IOPlugIn cannot be initialized from native IO plugins because we don't allow access
 //to the list - so you only get to define custom RhinoCommon ones.
 /// <summary>
 /// Protected constructor to be called from derived class
 /// </summary>
 /// <param name="fileExtension">
 /// File extension associated with this serialize object
 /// </param>
 /// <param name="contentKind">
 /// Type of content created when importing or exporting this file type.
 /// </param>
 /// <param name="canRead">
 /// If true then the file type can be imported and will be included in the
 /// file open box when importing the specified render content type.
 /// </param>
 /// <param name="canWrite">
 /// If true then the file type can be exported and will be included in the
 /// file save box when exporting the specified render content type.
 /// </param>
 protected RenderContentSerializer(string fileExtension, RenderContentKind contentKind, bool canRead, bool canWrite)
 {
   m_runtime_serial_number = m_current_serial_number++;
   m_all_custom_content_io_plugins.Add(m_runtime_serial_number, this);
   m_file_extension = fileExtension;
   m_content_kind = contentKind;
   m_can_read = canRead;
   m_can_write = canWrite;
 }
示例#3
0
 //Currently IOPlugIn cannot be initialized from native IO plugins because we don't allow access
 //to the list - so you only get to define custom RhinoCommon ones.
 /// <summary>
 /// Protected constructor to be called from derived class
 /// </summary>
 /// <param name="fileExtension">
 /// File extension associated with this serialize object
 /// </param>
 /// <param name="contentKind">
 /// Type of content created when importing or exporting this file type.
 /// </param>
 /// <param name="canRead">
 /// If true then the file type can be imported and will be included in the
 /// file open box when importing the specified render content type.
 /// </param>
 /// <param name="canWrite">
 /// If true then the file type can be exported and will be included in the
 /// file save box when exporting the specified render content type.
 /// </param>
 protected RenderContentSerializer(string fileExtension, RenderContentKind contentKind, bool canRead, bool canWrite)
 {
     m_runtime_serial_number = m_current_serial_number++;
     m_all_custom_content_io_plugins.Add(m_runtime_serial_number, this);
     m_file_extension = fileExtension;
     m_content_kind   = contentKind;
     m_can_read       = canRead;
     m_can_write      = canWrite;
 }
示例#4
0
 public CustomRenderContentIoAttribute(String extension,
                                       //String description,
                                       RenderContentKind kind,
                                       bool canLoad,
                                       bool canSave)
 {
     m_ext = extension;
     //m_description = description;
     m_kind  = kind;
     m_bLoad = canLoad;
     m_bSave = canSave;
 }
示例#5
0
 public CustomRenderContentIoAttribute(String extension, 
                                       //String description, 
                                       RenderContentKind kind, 
                                       bool canLoad, 
                                       bool canSave)
 {
   m_ext = extension;
   //m_description = description;
   m_kind = kind;
   m_bLoad = canLoad;
   m_bSave = canSave;
 }
示例#6
0
        internal void Construct(Guid pluginId)
        {
            Type t = GetType();

            object[] attr = t.GetCustomAttributes(typeof(CustomRenderContentIoAttribute), false);
            if (attr != null && attr.Length > 0)
            {
                CustomRenderContentIoAttribute custom = attr[0] as CustomRenderContentIoAttribute;
                if (custom != null)
                {
                    m_ext   = custom.Extension;
                    m_bLoad = custom.CanLoad;
                    m_bSave = custom.CanSave;
                    //m_description = custom.Description;
                    m_kind = custom.Kind;
                }
            }

            String m_description = "";

            UnsafeNativeMethods.CRhCmnContentIOPlugIn_New(m_runtime_serial_number, m_ext, m_description, (int)m_kind, m_bSave, m_bLoad, pluginId);
        }
示例#7
0
 /// <summary>
 /// Shows the content chooser to allow the user to select a new or existing content.
 /// </summary>
 /// <param name="defaultType">The content type that will be initially selected in the 'New' tab.</param>
 /// <param name="defaultInstanceId">The content instance that will be initially selected in the 'Existing' tab.</param>
 /// <param name="kinds">Which content kinds will be displayed.</param>
 /// <param name="instanceIdOut">The UUID of the chosen item. Depending on eRhRdkSccResult, this can be the type id of a content type or the instance id of an existing content.</param>
 /// <param name="flags">Tabs specifications.</param>
 /// <param name="doc">A Rhino document.</param>
 /// <returns>The result.</returns>
 public static ShowContentChooserResults ShowContentChooser(Guid defaultType, Guid defaultInstanceId, RenderContentKind kinds, ref Guid instanceIdOut, ShowContentChooserFlags flags, RhinoDoc doc)
 {
   return (ShowContentChooserResults)UnsafeNativeMethods.Rdk_Globals_ShowContentChooser(defaultType, defaultInstanceId, RenderContent.KindString(kinds), ref instanceIdOut, (int)flags, doc.m_docId);
 }
示例#8
0
 /// <summary>
 /// Accesses any content table given a (single) kind.
 /// </summary>
 /// <param name="kind">A single kind.</param>
 /// <param name="doc">A Rhino document.</param>
 /// <returns>The (render content kind) list.</returns>
 public static ContentList ContentList(RenderContentKind kind, RhinoDoc doc)
 {
   return new ContentList(kind, doc);
 }
 internal RenderContentTableEventArgs(RhinoDoc document, RenderContentKind kind)
 {
     m_rhino_doc    = document;
     m_content_kind = kind;
 }
示例#10
0
    internal static String KindString(RenderContentKind kinds)
    {
      System.Text.StringBuilder sb = new System.Text.StringBuilder();

      if ((kinds & RenderContentKind.Material) == RenderContentKind.Material)
      {
        sb.Append("material");
      }

      if ((kinds & RenderContentKind.Environment) == RenderContentKind.Environment)
      {
        if (sb.Length != 0)
        {
          sb.Append(";");
        }
        sb.Append("environment");
      }

      if ((kinds & RenderContentKind.Texture) == RenderContentKind.Texture)
      {
        if (sb.Length != 0)
        {
          sb.Append(";");
        }
        sb.Append("texture");
      }
      return sb.ToString();
    }
示例#11
0
 internal ContentKindEventArgs(RenderContentKind kind) { m_kind = kind; }
 public SampleRenderContentSerializer(string fileExtension, RenderContentKind contentKind, bool canRead, bool canWrite) : base(fileExtension, contentKind, canRead, canWrite)
 {
 }
    /// <summary>
    /// Determines if this type is of the specified kind.
    /// </summary>
    /// <param name="kind">The render content kind to check against.</param>
    /// <returns>true if this instance is of the specified type.</returns>
	  public bool IsKind(RenderContentKind kind) { return Kind == kind; }
示例#14
0
 internal ContentListEventArgs(RenderContentKind kind, RhinoDoc doc)
 {
     m_content_list = new Rhino.Render.ContentList(kind, doc);
 }
示例#15
0
    internal void Construct(Guid pluginId)
    {
      Type t = GetType();
      object[] attr = t.GetCustomAttributes(typeof(CustomRenderContentIoAttribute), false);
      if (attr != null && attr.Length > 0)
      {
        CustomRenderContentIoAttribute custom = attr[0] as CustomRenderContentIoAttribute;
        if (custom != null)
        {
          m_ext = custom.Extension;
          m_bLoad = custom.CanLoad;
          m_bSave = custom.CanSave;
          //m_description = custom.Description;
          m_kind = custom.Kind;
        }
      }

      String m_description = "";

      UnsafeNativeMethods.CRhCmnContentIOPlugIn_New(m_runtime_serial_number, m_ext, m_description, (int)m_kind, m_bSave, m_bLoad, pluginId);
    }
示例#16
0
 internal static bool ShowIncompatibleContent(RenderContentKind kind) { return 1 == UnsafeNativeMethods.Rdk_Globals_ShowIncompatibleContent(RenderContent.KindString(kind)); }
示例#17
0
 internal static void SetShowIncompatibleContent(RenderContentKind kind, bool bShow) { UnsafeNativeMethods.Rdk_Globals_SetShowIncompatbileContent(RenderContent.KindString(kind), bShow); }
示例#18
0
 internal static bool ShowIncompatibleContent(RenderContentKind kind)
 {
     return(1 == UnsafeNativeMethods.Rdk_Globals_ShowIncompatibleContent(RenderContent.KindString(kind)));
 }
示例#19
0
 internal static void SetShowIncompatibleContent(RenderContentKind kind, bool bShow)
 {
     UnsafeNativeMethods.Rdk_Globals_SetShowIncompatbileContent(RenderContent.KindString(kind), bShow);
 }
示例#20
0
    /// <summary>
    /// Allows the user to choose a content by displaying the Content Chooser dialog.
	  /// The dialog will have OK, Cancel and Help buttons, and optional New and Edit buttons.
    /// </summary>
    /// <param name="instanceId">Sets the initially selected content and receives the instance id of the chosen content.</param>
    /// <param name="kinds">Specifies the kind(s) of content that should be displayed in the chooser.</param>
    /// <param name="flags">Specifies flags controlling the browser.</param>
    /// <param name="doc">A Rhino document.</param>
    /// <returns>true if the operation succeeded.</returns>
    public static bool ChooseContent(ref Guid instanceId, RenderContentKind kinds, ChooseContentFlags flags, RhinoDoc doc)
    {
      return 1 == UnsafeNativeMethods.Rdk_Globals_ChooseContentEx(ref instanceId, RenderContent.KindString(kinds), (int)flags, doc.m_docId);
    }
示例#21
0
 internal CurrentContentChangedEventArgs(RenderContent content, RenderContentKind kind)
   : base(content)
 { m_kind = kind; }
示例#22
0
 internal static bool IsKindEditorVisible(RenderContentKind kind)
 {
   return 1==UnsafeNativeMethods.Rdk_Globals_IsContentEditorVisible(RenderContent.KindString(kind));
 }
示例#23
0
 internal RenderContentTable(RhinoDoc rhinoDoc, RenderContentKind kind)
 {
     //RhinoDoc.LayerTableEvent
     m_rhino_doc           = rhinoDoc;
     m_render_content_kind = kind;
 }
示例#24
0
    /// <summary>
    /// Constructs a new content chosen by the user and add it to the persistent content list.
	  /// This function cannot be used to create temporary content that you delete after use.
	  /// Content created by this function is owned by RDK and appears in the content editor.
    /// </summary>
    /// <param name="defaultType">The default content type.</param>
    /// <param name="defaultInstance">The default selected content instance.</param>
    /// <param name="kinds">Determines which content kinds are allowed to be chosen from the dialog.</param>
    /// <param name="flags">Options for the tab.</param>
    /// <param name="doc">The current Rhino document.</param>
    /// <returns>A new persistent render content.</returns>
    public static RenderContent CreateContentByUser(Guid defaultType, Guid defaultInstance, RenderContentKind kinds, ChooseContentFlags flags, RhinoDoc doc)
    {
      IntPtr pContent = UnsafeNativeMethods.Rdk_Globals_CreateContentByUser(defaultType, defaultInstance, RenderContent.KindString(kinds), (int)flags, doc.m_docId);
      return pContent == IntPtr.Zero ? null : RenderContent.FromPointer(pContent);
    }
示例#25
0
 internal ContentList(RenderContentKind kind, RhinoDoc doc)
 {
     m_kind = kind;
     m_doc  = doc;
 }
示例#26
0
 internal void Construct(Guid pluginId)
 {
   m_ext = FileExtension;
   m_load = CanRead;
   m_save = CanWrite;
   m_kind = ContentType;
   UnsafeNativeMethods.CRhCmnContentIOPlugIn_New(m_runtime_serial_number, m_ext, string.Empty, (int)m_kind, m_save, m_load, pluginId);
 }