/// <summary> /// Add a material, environment or texture to the internal RDK document lists as /// top level content. The content must have been returned from /// RenderContent::MakeCopy, NewContentFromType or a similar function that returns /// a non-document content. /// </summary> /// <param name="renderContent">The render content.</param> /// <returns>true on success.</returns> public static bool AddPersistentRenderContent(RenderContent renderContent) { renderContent.AutoDelete = false; return 1 == UnsafeNativeMethods.Rdk_Globals_AddPersistentContent(renderContent.ConstPointer()); }
public bool ChangeChild(RenderContent oldContent, RenderContent newContent) { if (null == oldContent) return false; IntPtr pThis = NonConstPointer(); IntPtr pOld = oldContent.ConstPointer(); IntPtr pNew = null == newContent ? IntPtr.Zero : oldContent.NonConstPointer(); bool success = UnsafeNativeMethods.Rdk_RenderContent_ChangeChild(pThis, pOld, pNew); // If successfully added to the child content list then make sure the newContent // pointer does not get deleted when the managed object is disposed of since the // content is now included in this objects child content list if (success && null != newContent) newContent.m_bAutoDelete = false; return success; }
/// <summary> /// Constructs a new content of the specified type 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. /// To create a temporary content which is owned by you, call RhRdkContentFactories().NewContentFromType(). /// </summary> /// <param name="type">is the type of the content to add.</param> /// <param name="parent">Parent is the parent content. If not NULL, this must be an RDK-owned content that is /// in the persistent content list (either top-level or child). The new content then becomes its child. /// If NULL, the new content is added to the top-level content list instead.</param> /// <param name="childSlotName">ChildSlotName is the unique child identifier to use for the new content when creating it as a child of pParent (i.e., when pParent is not NULL)</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 Create(Guid type, RenderContent parent, String childSlotName, ShowContentChooserFlags flags, RhinoDoc doc) { IntPtr pContent = UnsafeNativeMethods.Rdk_Globals_CreateContentByType(type, parent.ConstPointer(), childSlotName, (int)flags, doc.m_docId); return pContent == IntPtr.Zero ? null : FromPointer(pContent); }
// hiding until I understand what this does /// <summary> /// Implement this to transfer data from another content to this content during creation. /// </summary> /// <param name="oldContent">An old content object from which the implementation may harvest data.</param> /// <returns>The harvested result.</returns> /*public virtual*/ HarvestedResult HarvestData(RenderContent oldContent) { if (IsNativeWrapper()) return (HarvestedResult)UnsafeNativeMethods.Rdk_RenderContent_HarvestData(ConstPointer(), oldContent.ConstPointer()); return (HarvestedResult)UnsafeNativeMethods.Rdk_RenderContent_CallHarvestDataBase(ConstPointer(), oldContent.ConstPointer()); }
/// <summary> /// Call this before tweaking a single content parameter. Undo will cause the parameter to be restored. /// </summary> /// <param name="content">The render content</param> /// <param name="parameterName">The parameter name you are about to change.</param> /// <returns>true if the content was tweaked.</returns> public bool TweakContent(RenderContent content, String parameterName) { return 1 == UnsafeNativeMethods.Rdk_ContentUndo_TweakContent(ConstPointer(), content.ConstPointer(), parameterName); }
/// <summary> /// Call this before modifying or deleting a content. Undo will cause the content to be restored. /// </summary> /// <param name="content">Content you are about to modify.</param> /// <returns>true if the content was modified.</returns> public bool ModifyContent(RenderContent content) { return 1 == UnsafeNativeMethods.Rdk_ContentUndo_ModifyContent(ConstPointer(), content.ConstPointer()); }
internal virtual void CreateCppPointer(RenderContent parentContent, bool isVisibleToAutoUI) { m_pField = UnsafeNativeMethods.Rdk_ContentField_New(parentContent.ConstPointer(), m_sInternal, m_sFriendly, isVisibleToAutoUI ? 0 : 0x8001); }
/// <summary> /// Implement to transfer data from another content to this content during creation. /// </summary> /// <param name="oldContent">An old content object from which the implementation may harvest data.</param> /// <returns>Information about how much data was matched.</returns> /*public virtual*/ MatchDataResult MatchData(RenderContent oldContent) { if (IsNativeWrapper()) return (MatchDataResult)UnsafeNativeMethods.Rdk_RenderContent_HarvestData(ConstPointer(), oldContent.ConstPointer()); return (MatchDataResult)UnsafeNativeMethods.Rdk_RenderContent_CallHarvestDataBase(ConstPointer(), oldContent.ConstPointer()); }