Xpresso Display



  • On 16/05/2015 at 20:49, xxxxxxxx wrote:

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

    ---------
    Hi folks,
    I'm scrapping a node gui system I created to try using the xpresso system. I'm wanting to put this into a GeDialog, but I'm not finding anything that straight out and out explains how to do it. Is someone able to look at the following and guide me as appropriate?

      
    // dialog class level objects  
    GvShape *shape;  
    GvShape *group;  
    GvNodeGUI *nodeGUI;  
    GvNodeMaster *nodeMaster;  
    C4DGadget *XpressoGadget; //<--- do I need this?
    // dialog constructor  
    shape = GvGetWorld()->AllocShape();  
    group = GvGetWorld()->AllocGroupShape();  
    nodeGUI = GvGetWorld()->AllocNodeGUI(shape,group,DLG_EXPERIMENTAL_XPRESSO);  
    nodeMaster = GvGetWorld()->AllocNodeMaster(NULL,TRUE,FALSE);
    // createlayout()  
    nodeGUI->Attach(this,nodeMaster);  
    XpressoGadget = AddUserArea(DLG_EXPERIMENTAL_XPRESSO,BFH_SCALEFIT|BFV_SCALEFIT);  
    AttachUserArea(*nodeGUI->GetUserArea(),XpressoGadget,USERAREA_TABSTOP|USERAREA_HANDLEFOCUS);  
    

    Apart from variations to the above, that's where I've ended up. I'll be needing to create my own nodes themselves at some stage, but before I tread that path I need to see the thing display in the dialog! Where am I tripping up here? Cheers,
    WP.



  • On 16/05/2015 at 21:33, xxxxxxxx wrote:

    afaik that I don't know how to use xpresso nodes/draw them from the SDK "till now" because I didn't dig deep in that direction, the struct C4DGadget is very important here to use with GeUserArea, check AsyncTest.cpp, search for C4DGadget and follow its variable



  • On 16/05/2015 at 22:32, xxxxxxxx wrote:

    Hi Mohamed,
     
    I've used gadgets plenty of times with user areas before, but I'm a little confused with what's meant to work and in what way with the node gui because there was some example code posted some time ago but it didn't use a gadget - it used an enum id! It didn't make any sense to me. I tried switching between an id and gadget in code, but neither made any difference anyway - so there must be something else I haven't got right, possibly before adding it to the dialog in CreateLayout(). 
     
    WP.



  • On 18/05/2015 at 09:39, xxxxxxxx wrote:

    Hello,

    I posted some simple example some while ago in this thread:

    What questions exactly do you have?

    Best wishes,
    Sebastian



  • On 18/05/2015 at 15:41, xxxxxxxx wrote:

    Hi Seb,
     
    I might stick with the gadgets then, just to keep it all the same as other user areas.
     
    That link was where I was doing my 'studies' from - thanks! I guess my questions revolve around why the above code (first post) won't display in my GeDialog. Not sure what else I can post code-wise, let me know if there's something else that can help, but the above xpresso gui code is all I have as far as the gui is concerned. Everything else in the dialog appears to be working as expected. The issue is that there's just no xpresso gui display in the dialog. Should this be enough for the display, or have I missed/left something out?
     
    WP.
     
    EDIT: just if it helps, there's nothing drawn in the display that I can see, so no grid lines, no move/scale etc. I have no idea if the blank space I'm seeing is meant to be blank.



  • On 19/05/2015 at 01:02, xxxxxxxx wrote:

    Hello,

    you are creating the node master using AllocNodeMaster() without a parent object. A node master can only be part of the scene when it has a parent object. This parent object must own the node master and handle it in Read(), Write() and CopyTo().

      
    Bool Init (GeListNode* node)  
    {  
      _master = GvGetWorld()->AllocNodeMaster((BaseList2D* )node);  
      return _master != nullptr;  
    }  
      
    Bool CopyTo(NodeData *dest, GeListNode *snode, GeListNode *dnode, COPYFLAGS flags, AliasTrans *trn)  
    {  
      return _master->CopyTo(((ParentThing* )dest)->_master, flags, trn);  
    };  
      
    void Free(GeListNode *node)  
    {  
    GvGetWorld()->FreeNodeMaster(_master);  
    }  
      
    Bool Read(GeListNode *node, HyperFile *hf, Int32 level)  
    {  
      return _master->ReadObject(hf, true);  
    }  
      
    Bool Write(GeListNode *node, HyperFile *hf)  
    {  
      return _master->WriteObject(hf);  
    }  
      
    Int32 GetBranchInfo(GeListNode *node, BranchInfo *info, Int32 max, GETBRANCHINFO flags)  
    {  
      return _master->GetBranchInfo(info, max, GETBRANCHINFO_0);  
    }  
    

    You cannot create a node master just within a dialog, it needs a parent object (like the Xpresso tag is the parent for the displayed node master). What is your parent object?

    best wishes,
    Sebastian



  • On 19/05/2015 at 01:37, xxxxxxxx wrote:

    Hi Seb,
    I haven't used a parent object because I'm only wanting the xpresso display gui. The display won't be used to interact with scenes. I'm only after the node gui itself.
    Can we use an object stored in memory?
    Or is this not possible?
    WP.



  • On 20/05/2015 at 01:00, xxxxxxxx wrote:

    Hello,

    the Node GUI exists to display a node system of a NodeMaster. That NodeMaster is a reference to an exiting object in your scene; Xpresso exists to interact with the scene or at least be stored with the scene. Without a set NodeMaster the Node GUI won't draw anything.

    Best wishes,
    Sebastian



  • On 20/05/2015 at 03:01, xxxxxxxx wrote:

    Hi Seb,
     
    Can the node gui be used with a document and object held in memory?
     
    WP.



  • On 20/05/2015 at 10:11, xxxxxxxx wrote:

    Hello,

    this would probably not work since the Node Master stores the parent object with a BaseLink that is resolved using the active document.

    Best wishes,
    Sebastian


Log in to reply