Accessing MoText Group Parameters



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

    On 03/11/2011 at 19:45, xxxxxxxx wrote:

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

    ---------
    The Transform parameter IDs under each MoText group (Lines, Words etc) are identical.

    If I want to access e.g. Transform position values under the Lines group, it looks as if I need to use the group ID 'MGTEXTOBJECT_GROUPTRANSFORM_LINE' in conjunction with 'ID_MG_TRANSFORM_POSITION'.

    How do I do this?



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

    On 05/11/2011 at 14:46, xxxxxxxx wrote:

    Perhaps some more detailed information is needed.

    The Transform tab Scale value for a Cloner can be accessed with:

    BaseContainer *bc = gen->GetDataInstance(); if(!bc) return;             
    Vector scale = bc->GetVector(ID_MG_TRANSFORM_SCALE);   
    GePrint("scale: " + VectorToString(scale));
    

    In a MoText, ID_MG_TRANSFORM_SCALE can't be accessed directly as the same ID is used under four different groups.

    Using the Letters group as an example, omograph_text.res has this:

    GROUP MGTEXTOBJECT_GROUPCHAR
    {
         SCALE_V;
         GROUP
         {
              COLUMNS 2;
              SCALE_V;

    IN_EXCLUDE     MGTEXTOBJECT_EFFECTORLIST_CHAR
              {
                   SCALE_V;
                   SCALE_H;
                   NUM_FLAGS 1;
                   INIT_STATE 1;
                   IMAGE_01_ON 1018640;
                   IMAGE_01_OFF 1018641;
                   ACCEPT
                   {
                        Obaseeffector;
                   }
              }
              STATICTEXT { JOINEND; }

    VECTOR     MGTEXTOBJECT_AXIS_CHAR
              {
                   UNIT     PERCENT;
                   MIN 0.0;
                   MAX 100.0;
                   CUSTOMGUI VECTOR2D;
              }
              BOOL     MGTEXTOBJECT_AXIS_CHAR_ALIGN
              {
              }
         }
         GROUP MGTEXTOBJECT_GROUPEFFECTOR_CHAR
         {
         }
    }

    MGTEXTOBJECT_GROUPEFFECTOR_CHAR appears to correspond with the Transform parameters. omograph_text.h also lists MGTEXTOBJECT_GROUPTRANSFORM_CHAR. I'm not sure which to use or how many levels are involved.

    I've tried various subcontanier and DescLevel operations to no avail.

    Could someone please provide assistance?



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

    On 07/11/2011 at 15:00, xxxxxxxx wrote:

    I'd like to bump this because there does seem to be a problem with it.
    The transformation panels inside of the MoText object seem to only be accessible though xpresso.

    C++ example :

      
    #include "..\..\..\modules\mograph\res\description\otransform_panel.h"  
    #include "..\..\..\modules\mograph\res\description\omograph_text.h"  
      
    GeData d;  
    obj->GetParameter(DescID(ID_MG_TRANSFORM_SCALE, VECTOR_X), d, (DTYPE_VECTOR, DESCFLAGS_GET_0)); //Result is always zero  
    obj->SetParameter(DescID(ID_MG_TRANSFORM_SCALE, VECTOR_X), GeData(5.0), DESCFLAGS_SET_0);       //No errors..But no changes are executed 
    

    Coffee Example :

    var obj = doc->GetActiveObject();      //The MoText object is active  
    obj#ID_MG_TRANSFORM_SCALE:VECTOR_X = 1;//Invalid description ID
    

    Python Example :

    import c4d  
    def main() :  
      
      obj = doc.GetActiveObject()                     #The MoText object is active  
      obj[c4d.ID_MG_TRANSFORM_SCALE,c4d.VECTOR_X] = 1 #__setitem__ got unexpected type 'int'     
      c4d.EventAdd()  
      
    if __name__=='__main__':  
      main()
    

    I'm still learning this stuff. So I'm probably wrong about this.
    But It sorta looks like they were never added to the API's?

    -ScottA



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

    On 08/11/2011 at 01:30, xxxxxxxx wrote:

    Thanks for taking the time to do some testing Scott.

    The problem with using ID_MG_TRANSFORM_SCALE in this way is that the same ID is used for independent parameters under the All, Lines, Words and Letters groups. A higher-level ID from omograph_text.h has to also be used.



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

    On 08/11/2011 at 07:45, xxxxxxxx wrote:

    Did you figure it out David?
    I did also try using higher ID's in a bunch of different ways. But I still couldn't get it to work.

    example:

    obj->SetParameter(DescID(MGTEXTOBJECT_GROUPLINE, ID_MG_TRANSFORM_SCALE,VECTOR_X), GeData(15.0), DESCFLAGS_SET_0); //Does not work
    

    -ScottA



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

    On 09/11/2011 at 03:53, xxxxxxxx wrote:

    No, unfortunately I don't have a solution Scott.

    Apparently neither do any of the other developers here or Maxon support.



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

    On 09/11/2011 at 06:08, xxxxxxxx wrote:

    Sorry for the delay. I asked the developers and will post the solution if there is one.

    cheers,
    Matthias



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

    On 09/11/2011 at 14:19, xxxxxxxx wrote:

    Thanks Matthias. At least I know I'm not missing something obvious.



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

    On 10/11/2011 at 06:38, xxxxxxxx wrote:

    You need to use the following group offset to obtain the final ID.

      
    MGTEXTOBJECT_GROUPTRANSFORM_ALL  
    MGTEXTOBJECT_GROUPTRANSFORM_LINE  
    MGTEXTOBJECT_GROUPTRANSFORM_WORD  
    MGTEXTOBJECT_GROUPTRANSFORM_CHAR  
    

    Simply add transform ID and group offset ID for the final ID.

    Example:

      
    GeData d;  
    if (op->GetParameter(DescLevel(ID_MG_TRANSFORM_POSITION + MGTEXTOBJECT_GROUPTRANSFORM_LINE),d,DESCFLAGS_GET_0))  
    {  
      GePrint(RealToString(d.GetVector().x));  
    }  
    

    cheers,
    Matthias



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

    On 10/11/2011 at 07:48, xxxxxxxx wrote:

    Thanks Matthias.

    Sorry for being so dense. But I still can't get the SetParameter() to work with your example:

    obj->SetParameter(DescID(ID_MG_TRANSFORM_POSITION, VECTOR_X + MGTEXTOBJECT_GROUPTRANSFORM_LINE), GeData(0.3), DESCFLAGS_SET_0); //Does not change
    

    And what about the scripting languages?
    This plus sign thing doesn't seem to work with them for me either.

    -ScottA

    *Edit- I managed to figure out a way to get it to work:

        BaseObject *obj = doc->GetActiveObject(); //The MoText object is active  
      
      GeData d; //A variable to hold the parameters  
      if (obj->GetParameter(DescLevel(ID_MG_TRANSFORM_POSITION + MGTEXTOBJECT_GROUPTRANSFORM_LINE),d,DESCFLAGS_GET_0))   
       {  
           GePrint(RealToString(d.GetVector().x));  //Print the x Position value  
           Vector newV = Vector(5,0,0);             //Create a new vector position value        
           d.SetVector(newV);                       //Set the vector parameter held in variable d to this new vector value in memory only                    
           obj->SetParameter(DescID(ID_MG_TRANSFORM_POSITION + MGTEXTOBJECT_GROUPTRANSFORM_LINE), GeData(newV), DESCFLAGS_SET_0); //Execute the vector change from memory  
           GePrint(RealToString(d.GetVector().x));  //Print the new x Position value  
       }
    

    Still trying to figure out how to use this with Coffee & Python.

    -ScottA



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

    On 11/11/2011 at 05:00, xxxxxxxx wrote:

    Works like a charm, thanks again Matthias.


Log in to reply