R12 Exporter

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 07/12/2011 at 12:21, xxxxxxxx wrote:

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

---------
hello all!

http://imageshack.us/photo/my-images/689/39340302.jpg

  
    
    
    Object = Document->GetFirstObject();
    GeOutString(Object->GetName(), GEMB_OK);

There is an error

How to be run on all objects and will receive their names?

Forgive for my English, I write through the translator

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 08/12/2011 at 01:44, xxxxxxxx wrote:

Here is an example how to iterate through all objects of a document and print their names.

  
void WriteObjects(BaseObject *op)  
{  
  while (op)  
  {  
      // do something, for example print name  
      GePrint(op->GetName());  
        
      WriteObjects(op->GetDown());  
      op=op->GetNext();  
  }  
}  
  
  
...  
  
WriteObjects(doc->GetFirstObject());  

cheers,
Matthias

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 08/12/2011 at 04:10, xxxxxxxx wrote:

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 08/12/2011 at 05:51, xxxxxxxx wrote:

Please start Cinema from the Visual Sudio debugger to see where in your code Cinema is crashing.

By the way, it is not necessary to pre-allocate a document (m_Document) for BaseDocument::Polygonize.

Just write something like this:

  
BaseDocument *m_Document = NULL;  
m_Document = Doc->Polygonize();  

cheers,
Matthias

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 08/12/2011 at 06:28, xxxxxxxx wrote:

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 08/12/2011 at 06:37, xxxxxxxx wrote:

Sorry, I can not debug your code for you. This is beyond the scope of the SDK support.

Just an idea, have you tried to make your WriteObjects function not a class member?

cheers,
Matthias

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 08/12/2011 at 07:17, xxxxxxxx wrote:

In that case I receive

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 08/12/2011 at 07:41, xxxxxxxx wrote:

Please try in a simple CommandData plugin if you get the same crash.

cheers,
Matthias

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 08/12/2011 at 10:20, xxxxxxxx wrote:

The same situation and with CommandData

  
void WriteObjects(BaseObject* ParentObject)  
{  
  while(ParentObject)  
  {  
      WriteObjects(ParentObject->GetDown());  
      ParentObject = ParentObject->GetNext();  
  }  
}  
  
class CExporter : public CommandData  
{  
public:  
  Bool Execute(BaseDocument* Document) {  
      BaseObject* ParentObject = Document->GetFirstObject();  
      WriteObjects(ParentObject);  
  
      return m_Dialog.Open(DLG_TYPE_ASYNC, ID_DIALOG,-1,-1);  
  }  
private:  
  CDialog m_Dialog;  
};  
  
Bool PluginStart()  
{  
  if(!RegisterCommandPlugin(ID_PLUGIN, "MyPlugin", 0, 0L, "Description", gNew CExporter))  
  {  
      return FALSE;  
  }  
    
  return TRUE;  
}  
  
void PluginEnd()  
{  
}  
  
Bool PluginMessage(LONG ID, void* Data)  
{  
  return FALSE;  
}  

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 09/12/2011 at 06:17, xxxxxxxx wrote:

I used quite the same code some days ago and your iteration should definitely work.

1. What happens if you remove that dialog stuff?
2. Why are you using "CDialog"? Please use "GeDialog" or any of the classes derived from GeDialog.

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 09/12/2011 at 06:33, xxxxxxxx wrote:

c4dJack

  
#ifndef DIALOG_H  
#define DIALOG_H  
  
#include "preprocessor.h"  
  
class CDialog : public GeDialog/*GeModalDialog*/  
{  
public:  
 CDialog();  
 virtual ~CDialog();  
   
  virtual Bool CreateLayout();  
  virtual Bool InitValues();  
  virtual Bool Command(LONG ID, const BaseContainer& Message);  
};  
  
#endif   
  
CDialog::CDialog()  
{  
}  
  
CDialog::~CDialog()  
{  
}  
  
Bool CDialog::CreateLayout()  
{  
  this->SetTitle("tool");  
  GroupSpace(50, 50);  
  
  AddButton(BTN_SAVEMESH, BFH_LEFT, 0, 0, "Save");  
   
  return TRUE;  
}  
  
Bool CDialog::InitValues()  
{  
  return TRUE;  
}  
  
Bool CDialog::Command(LONG ID, const BaseContainer& Message)  
{  
  switch(ID)  
  {  
      case BTN_SAVEMESH:  
      {  
          BaseDocument* Document = GetActiveDocument();  
          WriteObjects(ParentObject);  // <----------  
  
          StatusSetText("Mesh saved");  
      }  
      break;  
  }  
  return TRUE;  
}  

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 09/12/2011 at 07:15, xxxxxxxx wrote:

Ah, ok. You derived your CDialog class from GeDialog. That should be ok.

Anyway in your last piece of code there was a little error.

  
Bool CDialog::Command(LONG ID, const BaseContainer& Message)   
{   
    switch(ID)   
    {   
        case BTN_SAVEMESH:   
        {   
            BaseDocument* Document = GetActiveDocument();   
            if (!Document) return FALSE; // <---------- FIX   
            WriteObjects(Document->GetFirstObject()); // <---------- FIX   
  
            StatusSetText("Mesh saved");   
        }   
        break;   
    }   
    return TRUE;   
}