Setting Xref parameters partly working

On 11/10/2016 at 07:02, xxxxxxxx wrote:

User Information:
Cinema 4D Version:   17 
Platform:   Windows  ;   
Language(s) :     C++  ;


I am trying to make a system to easily add xref files (preset scenes) to a current document.
The xref file should have 'encapsulated' off as on the main null in the xref are user data settings I want to expose directly without having to open the tree.
But running into an odd issue.

I tried setting the 'encapsulated' boolean thru script but that wouldn't work. So I found a workaround. Cinema remembers the last setting, so I open cinema4D and set the 'encapsulated' option off in the 'Add Xref' settings and import a xref. Then close c4d.

Then when I open it again and use my plugin to import an Xref, I end up with 2 xref objects. 
One indeed 'encapsulated' and one empty xref object.

Below is the code I am using.
I am rather new to the whole c++ plugin development, any help would be appreciated.


BaseDocument *doc = GetActiveDocument();
BaseObject* xref = BaseObject::Alloc(Oxref);
xref->SetParameter(ID_BASELIST_NAME, xrefName, DESCFLAGS_SET_0);

On 12/10/2016 at 02:29, xxxxxxxx wrote:

Hello and welcome,

the "Encapsulated" option is actually no parameter of the Xref object. Is is some form of additional data that is stored with the Xref system in the background for each Xref. Unfortunately there is no easy and save way to edit this data for a given Xref object.

Best wishes,

On 13/10/2016 at 05:39, xxxxxxxx wrote:

Hi Sebastian,

Thanks for your reply.
Ok, so no acces to the deeper options for the Xrefs. But once importing a Xref with the setting off keeps it off so that's ok.

But why am I getting 2 xref files, any clue on that maybe?


On 14/10/2016 at 01:15, xxxxxxxx wrote:


I can reproduce the issue. It seems that the only save way to create an Xref object is using the "Add Xref" command. Right now I don't see a way to properly create an Xref taking all options into account.

best wishes,

On 17/10/2016 at 02:14, xxxxxxxx wrote:

That's a bummer.
The whole idea of the plugin is to have quick access to the prepared xref files.

Thanks for the effort.