THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 09/02/2012 at 18:04, xxxxxxxx wrote:
Yannick Puech, thank you for your answer.
I tried as you guided, but I have still problems.
In my opinion, the problems is caused by the second parameter of GetLink function, Xlayer, corresponds only for shader instances.
C++ HTML documentation reads:
[BaseList2D](file:///F:/ComputerGraphics/REFERENCES/C4D_SDK/C4DR13SDKHTML20110930/help/pages/c4d_baselist/class_BaseList2D66.html)* GetLink(const [BaseDocument](file:///F:/ComputerGraphics/REFERENCES/C4D_SDK/C4DR13SDKHTML20110930/help/pages/c4d_basedocument/class_BaseDocument59.html)* doc, LONG instance)_<_h4_>_
However, I don't know what I have to put the second parameter, LONG instance, to get the BaseObject instance.
My dialogbox, header files and cpp file look like this:
Dialogbox: http://blog.naver.com/gchoi_acts/130130991792
//==================================
// c4d_symbols.h
//==================================
enum
{
// Dialog definitions of IDD_SWAP_POSITION start here
IDD_SWAP_POSITION, // ID of the Dialog Box
IDC_OBJECT1, // ID of the first linkbox
IDC_OBJECT2, // ID of the second linkbox
// Dialog definitions of IDD_SWAP_POSITION end here
// End of symbol definition
_DUMMY_ELEMENT_
};
//==================================
// SwapPosition.h
//==================================
#include "c4d_gui.h"
class SwapPosition : public GeDialog
{
public:
SwapPosition ();
virtual ~SwapPosition ();
virtual Bool CreateLayout(void);
virtual Bool InitValues(void);
virtual Bool Command(LONG id, const BaseContainer &msg);
virtual LONG Message(const BaseContainer& msg, BaseContainer& result);
void UpdateAll(Bool msg);
void \*lastselected;
private:
LONG lastdirty;
BaseDocument* doc;
BaseObject* op1, op2;
LinkBoxGui* linkbox1, linkbox2;
};
//==================================
// SwapPosition.cpp
//==================================
#include "c4d.h"
#include "c4d_symbols.h"
#include "SwapPosition.h"
...
Bool SwapPosition ::Command(LONG id, const BaseContainer &msg)
{
//## GET USER ENTERED DATA:
switch (id)
{
case IDC_OK:
linkbox1 = (LinkBoxGui* )FindCustomGui(IDC_OBJECT1, CUSTOMGUI_LINKBOX);
if(!linkbox1) return FALSE;
op1 = (BaseObject* )linkbox1->GetLink(GetActiveDocument(), Xlayer);
linkbox2 = (LinkBoxGui\* )FindCustomGui(IDC_OBJECT2, CUSTOMGUI_LINKBOX);
if(!linkbox2) return FALSE;
op2 = (BaseObject\* )linkbox2->GetLink(GetActiveDocument(), Xlayer);
GePrint("Object Name : " + op1->GetName()); // <======= ERROR OCCURRED
GePrint("Object Name : " + op2->GetName()); // <======= ERROR OCCURRED
break;
case IDC_CANCEL:
break;
default:
break;
}
return TRUE;
}
...
================================
Thank you for your answer in adavance.
Best regards,
gchoi