Plugin Cafe Homepage
Forum Home Forum Home > Plugin Cafe > SDK Help
  New Posts New Posts
  FAQ FAQ  Forum Search   Register Register  Login Login

[SOLVED]Generator GetSettingsInstance

 Post Reply Post Reply
Author
Message
gr4ph0s View Drop Down
Member
Member


Joined: 2015 Jul 07
Location: France
Online Status: Offline
Posts: 429
Post Options Post Options   Quote gr4ph0s Quote  Post ReplyReply Direct Link To This Post Topic: [SOLVED]Generator GetSettingsInstance
    Posted: 2017 Dec 06 at 2:54pm

User Information:

Cinema 4D Version:    
Platform:      
Language(s):       

---------

I'm currently doing a generator. In GetVirtualObjects I create another document in memory, and I would like to get/set data from this tempo doc.
So I used 
BaseObject* MainObjectData::GetVirtualObjects(BaseObject* op, HierarchyHelp* hh)
{
BaseObject* objDown = op->GetDown();
if (!objDown)
return nullptr;

objDown = static_cast<BaseObject*>(objDown->GetClone(COPYFLAGS_0, nullptr));

BaseDocument* copyDoc = BaseDocument::Alloc();
if (!copyDoc)
return nullptr;

BaseObject* nullMaster = BaseObject::Alloc(Onull);
if (!nullMaster)
return nullptr;

copyDoc->InsertObject(nullMaster, nullptr, nullptr);
objDown->InsertUnder(nullMaster);

// I know doc point to the same object of nullmaster
// But in my plugin I get informations from another function and use GetDocument, So I do it in my example.
BaseDocument* doc = objDown->GetDocument();
if (!doc)
return nullptr;

// Always return me nullptr why?
BaseContainer* bc = doc->GetSettingsInstance(DOCUMENTSETTINGS_GENERAL);
if (!bc)
return nullptr;

BaseObject::Free(nullMaster);
BaseDocument::Free(copyDoc);

BaseObject* cube = BaseObject::Alloc(Ocube);
return cube;
}
it's return a nullptr.

This also fails
BaseContainer* bc = doc->GetDataInstance();
if (!bc)
return nullptr;
bc = bc->GetContainerInstance(DOCUMENTSETTINGS_GENERAL);
if (!bc)
return nullptr;


While for different type it's work fine
 doc->GetSettingsInstance(DOCUMENTSETTINGS_DOCUMENT);

Thanks in advance


Edited by gr4ph0s - 2017 Dec 07 at 3:13am
Technical lover.
Back to Top
Andreas Block View Drop Down
Forum Moderator
Forum Moderator
Avatar

Joined: 2014 Oct 01
Location: Hannover
Online Status: Offline
Posts: 1599
Post Options Post Options   Quote Andreas Block Quote  Post ReplyReply Direct Link To This Post Posted: 2017 Dec 07 at 2:13am
Hi,

this actually has nothing to do with the use inside of a ObjectData plugin.
DOCUMENTSETTINGS_GENERAL simply can not be retrieved via GetSettingsInstance(), but only via BaseDocument::GetData().
In the BaseDocument manual this gets mentioned. We'll add this information to the API references, too (by the way, the BaseDocument::GetData() link in the manual currently links to BaseList2D::GetData(), this will be fixed as well).

Cheers,
Andreas
SDK Support Engineer
Back to Top
gr4ph0s View Drop Down
Member
Member


Joined: 2015 Jul 07
Location: France
Online Status: Offline
Posts: 429
Post Options Post Options   Quote gr4ph0s Quote  Post ReplyReply Direct Link To This Post Posted: 2017 Dec 07 at 3:13am
Not sure to understand the pattern decision made behind of this (a function that could fail if a specific parameter is given, while parameter are from the same enum)
But it's work ! 

Thanks.


Edited by gr4ph0s - 2017 Dec 07 at 3:30am
Technical lover.
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Bulletin Board Software by Web Wiz Forums® version 9.61 [Free Express Edition]
Copyright ©2001-2009 Web Wiz

This page was generated in 0.109 seconds.