ModelingCommandData in R9

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

On 19/11/2004 at 12:20, xxxxxxxx wrote:

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

---------
Howdy,

I noticed that the ModelingCommandData in R9 has changed from what it was in R8.5:

struct ModelingCommandData
{
public:
BaseDocument* doc;
BaseObject* op;
BaseContainer* bc;
LONG mode;
LONG flags;
BaseObject* result1;
void* result2;
};

Now in R9 it is:
struct ModelingCommandData
{     
     ModelingCommandData() { doc=NULL; op=NULL; bc=NULL; mode=0; flags=0; result_ex=NULL; result=NULL; version=1; arr=NULL; }
     ~ModelingCommandData();

BaseDocument*          doc;
     BaseObject*               op;
     BaseContainer*     bc;
     LONG                              mode;
     LONG                              flags;

BaseObject*               result_ex; // don't use
     LONG                               version;
     AtomArray*      arr;
     AtomArray*      result;
};

The R8.5 documentation says this:
----------------------------------
BaseObject* result1

Resulting object for commands that create a new object. Not used if MODELINGCOMMANDFLAG_CREATEUNDO is set inflags.

Note: You need to free this object yourself afterwards, or insert it into a document.

void* result2

Not used currently.
-------------------------------------

In R8.5 if using MCOMMAND_CURRENTSTATETOOBJECT the mcd.result1 is the resulting object, but the R9 struct says "BaseObject* result_ex; // don't use " and the only other result is an AtomArray.

So, I reckon my question is how do I use this in R9?

Adios,
Cactus Dan

P.S. Any idea when the R9 SDK documentation will be released?

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

On 19/11/2004 at 12:32, xxxxxxxx wrote:

Hi,

yes, this was necessary due to Multiselection I think. If the user selects several objects and you call this modeling command, result_ex couldn´t take it, so everything is now passed to the Atomarray.

If you are sure there is only one object selected you could get the resulting object just like this:

BaseObject* res = static_cast<BaseObject*>(result->GetIndex(0));

//I assume result is used and not arr

If there are several files, just loop through the indices. something like this:

for(LONG i=0;i<result->GetCount();i++) {  
res = static_cast<BaseObject*>(result->GetIndex(i));  
//Do something with this object...  
}

Well, that´s how I would handle it 🙂

And no, there were no announcements yet when the docs are ready.

Katachi

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

On 19/11/2004 at 13:03, xxxxxxxx wrote:

Howdy,

Ah, OK. There will only be one object from an object link in the tag, so I reckon the first example should work.

Thanks, Samir.

Adios,
Cactus Dan

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

On 19/11/2004 at 16:44, xxxxxxxx wrote:

Howdy,

OK, it works, but it's returning the object in it's "undeformed" state (probably because the deformation is on it's parent Null object). Is there a way to return just the object in it's deformed state without using MCOMMAND_CURRENTSTATETOOBJECT on it's parent?

I looked in the SDK documentation and found this:
-----------------------------------
MCOMMAND_CURRENTSTATETOOBJECT

Current state to object (returns object)

Container ID                                                               Type            Description

MDATA_CURRENTSTATETOOBJECT_INHERITANCE            Bool       Use inheritance.

MDATA_CURRENTSTATETOOBJECT_KEEPANIMATION          Bool       Keep animation.
-------------------------------------
MCOMMAND_CURRENTSTATETOOBJECT has a container called MDATA_CURRENTSTATETOOBJECT_INHERITANCE but I don't understand what this is used for or exactly how to set it. I did a search here and in the archives but found nothing indicating it's usage.

Adios,
Cactus Dan

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

On 15/06/2006 at 12:25, xxxxxxxx wrote:

I'll like to know too how to set MDATA_CURRENTSTATETOOBJECT_INHERITANCE and MDATA_CURRENTSTATETOOBJECT_KEEPANIMATION in 9.1 Sdk.

ModelingCommandData cd;
     cd.doc = op->GetDocument();
     cd.op = geo;
     if (!SendModelingCommand(MCOMMAND_CURRENTSTATETOOBJECT, cd)) return FALSE;
     AtomArray* result=cd.result;
     BaseObject *Temp_Obj=NULL;
     GePrint("Atoms Number:" + LongToString(result->GetCount() ) );
     for (LONG k=0; TRUE; k++) {
          Temp_Obj=(BaseObject* ) result->GetIndex(k);
          if (Temp_Obj) GePrint("Index:" + LongToString(k) + " Name:" +Temp_Obj->GetName()); else return FALSE;
     }

i see a post where suggest to use      
cd.mode = MDATA_CURRENTSTATETOOBJECT_INHERITANCE | MDATA_CURRENTSTATETOOBJECT_KEEPANIMATION;

but if i start from null object that contain several objects, deformer.. GetCount return always 1.

At last.. i need to know from a deformed object the Undeformed geometry and the deformed geometry. (vertex position)

With CurrentStateToObject i always get the deformed geoemtry.

Thanks in advance
Renato T.

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

On 15/06/2006 at 16:16, xxxxxxxx wrote:

ModelingCommandData cd;
     cd.doc = op->GetDocument();
     cd.arr = (AtomArray* ) geo;
     BaseContainer bc;
     cd.mode=MODIFY_ALL; //????
     bc.SetBool(MDATA_CURRENTSTATETOOBJECT_INHERITANCE,TRUE);
     bc.SetBool(MDATA_CURRENTSTATETOOBJECT_KEEPANIMATION,TRUE);
     cd.bc=&bc;
     if (!SendModelingCommand(MCOMMAND_CURRENTSTATETOOBJECT, cd))
          return FALSE;

is not working.. always 1 element in array.

What's i'm wrong?

cheers
Renato