Mograph Objects Plugin



  • On 30/07/2014 at 12:47, xxxxxxxx wrote:

    User Information:
    Cinema 4D Version:   14 
    Platform:    Mac  ;  
    Language(s) :     C++  ;

    ---------
    Hello,

    I've been looking into the MoData and Effector parts of the C4D sdk and was wondering if I can create an object plugin similar to the MoGraph objects Cinema already has.  There isn't a different kind of plugin for MoGraph objects so would it just be a Generator plugin where I send MSG_EXECUTE_EFFECTOR to each of the Effectors that I want it to use?  I'm just starting to get familiar with MoGraph, so I'm not sure if I'm completely wrong.  Thanks for any help.

    Dan



  • On 06/08/2014 at 15:37, xxxxxxxx wrote:

    I'm still looking into this, but I haven't had much luck and I'm unsure of where to start.  I found this post:   https://plugincafe.maxon.net/topic/5039/4963_modata-filling&OB=ASC but it's pretty old.

    My current understanding of things is that I have to attach a MoGraph DataTag to a ObjectData plugin, I'm not sure what type.  After that I can set the MoData with GetTag(ID_MOTAGDATA), and message the effectors I want to use with Message(MSG_EXECUTE_EFFECTOR, Effector_PassData).

    I think I'm starting to understand it a bit more.



  • On 06/12/2015 at 05:02, xxxxxxxx wrote:

    This is pretty old, but I figured I'd try to bump this up. I managed to properly fill a MoData by filling a MoDataEx and use MoData::SetWithEx(), but that obviously isn't exactly ideal in terms of performance. However, passing the resulting MoData to effectors and let them do their thing appears to work perfectly.

    When I try to directly set MoData, I'm much less successful. It appears that e.g. a random effector which worked properly for the case above, now places all clones at the exact same spot. Perhaps it is possible to publicly share the code behind MoData::SetWithEx()? Shouldn't contain any trade secrets and it would be exactly what's needed to fully understand.

    If that's not possible, here are some more direct questions:

    (1) I'm using MoData::AddArray() to add all arrays using the predefined ids. I'm not assigning names or flags (it seems the copy function didn't do that as well) and I am assuming that using the DescID flavor or AddArray will define the correct types.

    (2) After that I'm using MoData::SetCount() to set the arrays to the correct size. A later call to MoData::GetCount() reports the correct size, but it would be good to know what the ideal time would be to make this call (to avoid reallocations) and whether this count is really automatically applied to all the arrays, so I know I'm not wasting performance here and it is not my error source.

    (3) As a third step, I'm grabbing the arrays by calling MoData::GetMatrixIndexArray(), MoData::GetFloatIndexArray(), etc. using the indices I got back from MoData::AddArray() earlier. This feels a bit weird. Is the MDArray type really just referencing the internal data stored in MoData? I am assuming it does, because there is no function for me to set an array, but it would be nice to know for sure. Maybe something is wrong here?

    (4) This is all I am doing right now, but there are some other functions that I'm not entirely clear about. I fear I might be missing something (flags I don't know about or anything else).

    Would be really cool to get a hand here.

    Best
    Timm



  • On 06/12/2015 at 06:04, xxxxxxxx wrote:

    OK, as a quick followup, I did find this thread:
    https://plugincafe.maxon.net/topic/8650/11316_modata-arrays--mograph-cache-tag-problem-solved

    It contains a bit of example code that initializes the arrays properly. Using that instead (the biggest difference apparently being that I wasn't explicitly specifying the array datatypes) got it to work. Would still be cool to know whether there might be something else I'm missing.

    However, it looks like I'm ok for now.

    Best
    Timm


Log in to reply