crash after moving timeline



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

    On 14/09/2009 at 08:53, xxxxxxxx wrote:

    User Information:
    Cinema 4D Version:   R11 
    Platform:   Windows  ;   Mac OSX  ; 
    Language(s) :     C++  ;  XPRESSO  ;

    ---------
    Hello,

    i wrote a xpresso node to write converted C4D-Geometry in the geo-file-format. The node works fine and the node only executes if, the geometry is "dirty" (dirtycount has changed). Now my problem. If the frame changes, the system crashs.
    At the moment i don't understand the context between the operations in the Calculation-method and the timeline. Is every frame treated like a own scene or "instance" and so i need for every frame a new thread and have to synchronize them???

    Thanks,
    Oli



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

    On 15/09/2009 at 03:13, xxxxxxxx wrote:

    To write the data in the geo-file, i use the C++-STL ofstream instead of the hyperflile class.
    Could this cause the crash?

    cheers,
    Oli



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

    On 15/09/2009 at 03:21, xxxxxxxx wrote:

    Are you writing files during realtime playback?

    Also if possible post some simplified code.

    cheers,
    Matthias



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

    On 15/09/2009 at 05:01, xxxxxxxx wrote:

    It should write during realtime playback (to save whole sequences) or after manual frame change.

    So here is some code

    > <code>
    > //Calculate
    > Bool AixWrite::Calculate(GvNode *bn, GvPort *port, GvRun *run, GvCalc *calc){
    >      
    >      BaseContainer* data = bn->GetOpContainerInstance();
    >      
    >      if(!data){
    >           
    >           //gib FALSE zurueck
    >           return FALSE;
    >      }
    >
    >         //own Geometrystructure (Cinema4D-Objects can be converted to     
    >         //this one)-->works
    >         AixGeometry toWrite = AixGeometry();
    >      
    >        GeData inputFilename = GeData();
    >
    >        toWrite = *(AixGeometry* ) AixGvCheckAndGetPortGeData(bn, port, run, calc, ports, GVAIXWRITE_INPUT_GEOMETRY_INDEX).GetCustomDataType(CUSTOMDATATYPE_AIXGEOMETRY);
    >      inputFilename = AixGvCheckAndGetPortGeData(bn, port, run, calc, ports, GVAIXWRITE_INPUT_FILENAME_INDEX);
    >
    >         //get actual frame
    >      BaseDocument* doc = bn->GetDocument();
    >      BaseTime time = doc->GetTime();
    >      LONG fps = doc->GetFps();
    >      LONG frame = time.GetFrame(fps);
    >
    > //if DirtyCount is not equal or frame changed, then write geo-File
    >      if(toWrite.GetDirtyCount() != this->inputPorts[0].GetLong() || frame != this->currenFrame){
    >           
    >                //cashes the data
    >           this->inputPorts[0].SetLong(toWrite.GetDirtyCount());
    >           this->currenFrame = frame;
    >           
    >           if(on){
    >                
    >                //FileStream
    >                ofstream out;
    >                
    >                //Wenn eine Pfadangabe vorliegt
    >                if(inputFilename != GeData(NOTOK)){
    >                     
    >                     //open FileStream
    >                              out.open(inputFilename.GetFilename().
    >                              GetString().GetCStringCopy());
    >                }
    >                else if(inputFilename == GeData(NOTOK)){
    >                     
    >                     return FALSE;
    >                }
    >
    >                //geo-File
    >                out << "PGEOMETRY V5" << endl;
    >                
    >                //if there are polys
    >                if(!toWrite.GetNgonArray().empty()){
    >                     //write
    >                     out << "NPoints " << toWrite.GetPointArray().size() << " NPrims " << toWrite.GetNgonArray().size() << endl;
    >                }
    >                //only points
    >                else{
    >                     out << "NPoints " << toWrite.GetPointArray().size() << " NPrims 0" << endl;
    >                }
    >                
    >                out << "NPointGroups 0 NPrimGroups 0" << endl;
    >
    >                       //write points, polys etc........
    >
    >                out << "beginExtra" << endl;
    >                out << "endExtra" << endl;
    >                
    >                //close FilesStream
    >                out.close();
    >           }
    >      }
    >      
    >      return TRUE;
    > }
    > </code>

    cheers,
    Oli



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

    On 15/09/2009 at 07:02, xxxxxxxx wrote:

    One additional question.
    What is the ident-parameter in the hyperfile Open-method and what have i to declare?

    cheers,
    Oli



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

    On 16/09/2009 at 05:42, xxxxxxxx wrote:

    New approach.
    I use now the Cinema4D-BaseFile to write the geo-file. As i thought, the STL causes the crash. So far so godd, but now i have an new problem.
    In one line of the geo-file Cinema writes a number previous to the entry.

    > <code>
    > AutoAlloc<BaseFile> bf;
    >           
    >           if(on){
    >                
    >                if(inputFilename != GeData(NOTOK)){
    >
    >                     bf->Open(inputFilename.GetFilename().GetString(), GE_WRITE, 0, 0, 0, 0);
    >                }
    >
    >             bf->WriteString("PGEOMETRY V5\n");
    >             if(!toWrite.GetNgonArray().empty()){
    >                
    >                 bf->WriteString("NPoints " + LongToString(toWrite.GetPointArray().size()) + " NPrims " + LongToString(toWrite.GetNgonArray().size()) + "\n");
    >                }
    >                else{
    >                     bf->WriteString("NPoints " + LongToString(toWrite.GetPointArray().size()) + " NPrims 0\n");
    >                }
    >                
    >                bf->WriteString("NPointGroups 0 NPrimGroups 0\n");
    >                     
    >                bf->WriteString("NPointAttrib " + LongToString(toWrite.GetAixAttributeArray(AIXPOINT).size()) + " NVertexAttrib " + LongToString(toWrite.GetAixAttributeArray(AIXNLINE).size()) + " NPrimAttrib " + LongToString(toWrite.GetAixAttributeArray(AIXNGON).size()) + " NAttrib 1\n");
    >
    > //..........
    >
    > bf->Close();
    > </code>

    This is a snip of what i get:
    PGEOMETRY V5
    NPoints 8 NPrims 6
    NPointGroups 0 NPrimGroups 0
    8NPointAttrib 0 NVertexAttrib 0 NPrimAttrib 0 NAttrib 1
    Why is there number 8 in front of NPointAttrib
    Thanks, Oli



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

    On 16/09/2009 at 05:52, xxxxxxxx wrote:

    To write ASCII text files I usally use my own WriteString function since the BaseFile::WriteString() seems a bit strange to me.

    My own WriteString()

    > \> Bool WriteString(const String line, BaseFile\* file) \> { \>      if(!file) return FALSE; \> \>      CHAR \*charline = NULL; \>      LONG strlength = line.GetCStringLen(St7bithex); \>      charline = (CHAR\* )GeAlloc(strlength+1); \> \>      if(!charline) return FALSE; \> \>      strlength = line.GetCString(charline, strlength+1, St7bithex); \> \>      LONG i; \>      for(i=0; i<strlength; i++) \>      { \>           if(!file->WriteChar(charline[i])) return FALSE; \>      } \> \>      GeFree(charline); \>       \>      return TRUE; \> } \>

    BaseFile::WriteString()

    > \> Bool BaseFile::WriteString(const String &v;) \> { \>      Bool ok; \>      LONG len = v.GetCStringLen()+1; \>      CHAR \*mem = (CHAR\* ) GeAlloc(sizeof(CHAR)\*len); \>      if (!mem) \>      { \>           SetError(FILEERROR_MEMORY); \>           return FALSE; \>      } \> \>      v.GetCString(mem,len); \>      ok = WriteLong(len) && WriteBytes(mem,len); \>      GeFree(mem); \> \>      return ok; \> } \>

    cheers,
    Matthias



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

    On 16/09/2009 at 06:13, xxxxxxxx wrote:

    Thanks Matthias, your WriteString() works fine and solves my problem.

    cheers,
    Oli



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

    On 17/09/2009 at 07:22, xxxxxxxx wrote:

    Now i have nearly the same problem as before. But now i can change the frame on teh timeline between 3 and 11 times before the system crahs.
    I thought it crahs during the calculation. But the node calculates and writes a "perfect" geo-file and then the system cashs.
    Any ideas?

    cheers,
    Oli



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

    On 18/09/2009 at 07:02, xxxxxxxx wrote:

    no ideas or a guess? i am glad about every proposal.

    cheers Oli



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

    On 18/09/2009 at 07:07, xxxxxxxx wrote:

    Sorry, I had not the time yet to dig deeper into it. Does this only happen from within a XPresso node? What about expressions or generators? This may be something to look into. I will try to find a solution but I have to discuss this with our developers.

    cheers,
    Matthias



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

    On 18/09/2009 at 07:20, xxxxxxxx wrote:

    It happens only in this XPresso Node. The other nodes works fine if i change the frame on the timeline. My generator works too.

    Thanking you in anticipation,

    Oli



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

    On 21/09/2009 at 06:33, xxxxxxxx wrote:

    Ok, I tried to confirm this. I am not sure if the problem is really in the node. Here is the code of a simple node that writes out geometry of a polygon object. It seems to work fine without any crashes. Maybe this helps.

    > \> #include "c4d.h" \> #include "c4d_operatordata.h" \> \> #include "print_node.h" \> \> \> class PrintNode : public GvOperatorData \> { \>           INSTANCEOF(PrintNode,GvOperatorData) \> \>      private: \>           BaseList2D \*result; \>           GvValue \*v1; \>                 \>      public: \>           virtual Bool Init(GeListNode \*node); \> \>           virtual const String     GetDetailedText(GvNode \*bn); \>           virtual const String     GetText(GvNode \*bn); \> \>           virtual Bool               iCreateOperator(GvNode \*bn); \> \>           virtual Bool               AddToCalculationTable(GvNode \*bn, GvRun \*r); \> \>           virtual Bool               InitCalculation(GvNode \*bn, GvCalc \*c, GvRun \*r); \>           virtual void               FreeCalculation(GvNode \*bn, GvCalc \*c); \>           virtual Bool               Calculate(GvNode \*bn, GvPort \*port, GvRun \*r, GvCalc \*c); \> \>           static NodeData\*          Alloc(void) { return gNew PrintNode; } \> }; \> \> Bool PrintNode::Init(GeListNode \*node) \> { \>      result = NULL; \>      return TRUE; \> } \> \> Bool PrintNode::iCreateOperator(GvNode \*bn) \> { \>      bn->SetShowPortNamesState(FALSE); \>      BaseContainer \*bc = bn->GetOpContainerInstance(); if (!bc) return FALSE; \>      return SUPER::iCreateOperator(bn); \> } \> \> const String PrintNode::GetDetailedText(GvNode \*bn) \> { \>      return GvGetOperatorDetailedText(this,bn); \> } \> \> const String PrintNode::GetText(GvNode \*bn) \> { \>      if (result) \>           return result->GetName(); \> \>      return "NULL"; \> } \> \> Bool PrintNode::AddToCalculationTable(GvNode \*bn, GvRun \*r) \> { \>      return r->AddNodeToCalculationTable(bn); \> } \> \> Bool PrintNode::InitCalculation(GvNode \*bn, GvCalc \*c, GvRun \*r) \> { \>      v1 = bn->AllocCalculationHandler(PRINT_NODE_INPUT,c,r,0); if (!v1) return FALSE; \>      return TRUE; \> } \> \> void PrintNode::FreeCalculation(GvNode \*bn, GvCalc \*c) \> { \>      bn->FreeCalculationHandler(v1); \> } \> \> Bool PrintNode::Calculate(GvNode \*bn, GvPort \*port, GvRun \*r, GvCalc \*c) \> { \>      if (!v1->Calculate(bn,GV_PORT_INPUT,r,c)) return FALSE; \> \>      LONG index; \>      if (!v1->GetPort()->GetInstance(result, r, &index;)) return FALSE; \> \>      if (result && c->document && result->GetType() == Opolygon) \>      { \>           AutoAlloc<BaseFile> file; \>           if (!file) return FALSE; \> \>           BaseTime time = c->document->GetTime(); \>           Real fps = c->document->GetFps(); \>           String frame = "c:\ est"+LongToString(time.GetFrame(fps)); \>           Filename fn(frame); \>            \>           if (!file->Open(fn, GE_WRITE, FILE_IGNOREOPEN, GE_INTEL)) return FALSE; \> \>           const Vector \*points = ToPoly(result)->GetPointR(); \>           LONG pcnt = ToPoly(result)->GetPointCount(); \> \>           for (LONG i=0; i<pcnt; i++) \>           { \>                if (!file->WriteVector(points[i])) return FALSE; \>           } \>      } \> \>      return TRUE; \> } \> \> //////////////////////////////// \> \> #define GVPRINTNODE_ID 1010815 \> \> Bool RegisterPrintNode() \> { \>      return GvRegisterOperatorPlugin(GVPRINTNODE_ID, "Print Node", 0, PrintNode::Alloc, "print_node", 0, ID_GV_OPCLASS_TYPE_GENERAL, ID_GV_OPGROUP_TYPE_GENERAL, 0, NULL); \> } \>

    cheers,
    Matthias



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

    On 22/09/2009 at 03:38, xxxxxxxx wrote:

    Thanks Matthias,

    i got it. But it is realy awkward :-).

    I allocate a LONG-array to save the polygoninformation temporarily.

    And there was the problem.

    > \> LONG\* polygon = (LONG\* ) GeAlloc(4 + sizeof(LONG)); //+ instead of \* \>

    Anyway thanks for your help.

    cheers,
    Oli


Log in to reply