THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 12/07/2008 at 05:25, xxxxxxxx wrote:
UserArea / Images:
I'm not sure how you intend to display these bitmaps, but I have a dialog with two UserAreas on it that display static images. I created a 'LogoBmp' class, derived from the GeUserArea class, like so...
#include "c4d.h"
class LogoBmp : public GeUserArea
{
private:
#ifdef _V7SDK_
BaseBitmap *m_pBmp;
#else
AutoAlloc<BaseBitmap> m_pBmp;
#endif
public:
Bool Logoname(char *szName);
#ifdef _R10p1_SDK_
virtual void DrawMsg(LONG x1,LONG y1,LONG x2,LONG y2,const BaseContainer &msg);
#else
virtual void Draw(LONG x1, LONG y1, LONG x2, LONG y2);
#endif
};
...and here is the code part...
#include "logo.h"
Bool LogoBmp::Logoname(char *szName)
{
#ifdef _V7SDK_
m_pBmp = AllocBaseBitmap();
#endif
if( !m_pBmp || m_pBmp->Init(GeGetPluginPath()+String("res")+String(szName))!=IMAGE_OK )
return false;
return true;
}
#ifdef _R10p1_SDK_
void LogoBmp::DrawMsg(LONG x1, LONG y1, LONG x2, LONG y2,const BaseContainer &msg)
{
LONG wid = x2-x1;
LONG hgt = y2-y1;
if( m_pBmp )
DrawBitmap(m_pBmp, x1, y1, wid, hgt, 0, 0, m_pBmp->GetBw(), m_pBmp->GetBh(), BMP_NORMALSCALED | BMP_ALLOWALPHA);
}
#else
void LogoBmp::Draw(LONG x1, LONG y1, LONG x2, LONG y2)
{
LONG wid = x2-x1;
LONG hgt = y2-y1;
if( m_pBmp )
DrawBitmap(m_pBmp, x1, y1, wid, hgt, 0, 0, m_pBmp->GetBw(), m_pBmp->GetBh(), BMP_NORMALSCALED | BMP_ALLOWALPHA);
}
#endif
...I then derive my options dialog class from a GeModalDialog, and use the above class to get my two images displayed...
// my options dialog class
class LoadOptsDialog : public GeModalDialog
{
private:
LogoBmp m_riplogo;
LogoBmp m_tidelogo;
ObjLoader *ppbj;
Bool m_presetsAdded;
void AddPresets(void);
void GetDlgValues(void);
void SetDlgValues(void);
public:
LoadOptsDialog(ObjLoader *pbj);
virtual Bool CreateLayout(void);
virtual Bool InitValues(void);
virtual Bool Command(LONG id, const BaseContainer &msg);
virtual Bool AskClose(void);
};
// Constructor
LoadOptsDialog::LoadOptsDialog(ObjLoader *pbj)
{
m_presetsAdded = false;
m_riplogo.Logoname("redilogo.tif");
m_tidelogo.Logoname("riptide.tif");
ppbj = pbj;
}
Bool LoadOptsDialog::CreateLayout(void)
{
if( !(GeModalDialog::CreateLayout() && LoadDialogResource(DLG_IMPFILE,NULL,0)))
return FALSE;
AttachUserArea(m_riplogo, IDC_MPLOGO);
AttachUserArea(m_tidelogo, IDC_MPRTLOGO);
AddPresets();
return TRUE;
}
...I hadn't tried changing the images, but you might be able to do that later just by calling the Logoname() routine again (which calls Init() ) with new filenames and refreshing the display - but I'd look up the GeUserArea docs to see what it says about this.
File Open Dialog:
This is pretty straight-forward, just create a Filename variable and call it's FileSelect() method. Like so...
Filename fName;
String titleStr = String("Import .obj File");
if( !fName.FileSelect(FSTYPE_SCENES,0,&titleStr) )
return false;
Create Scene Objects / Tips:
Yes, you can create scene objects and such... the best 'tutorial' is to compile the SDK example plugins, play with them to see what they do and if one does something you need, go look at it's source to see how it does it (ie. add some object/deformer/shader/whatever). Then use the SDK docs to look up various classes and topics.
Cheers,
Keith