Tag plugin & attribute manager in COFFEE



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

    On 22/07/2011 at 13:48, xxxxxxxx wrote:

    User Information:
    Cinema 4D Version:   R12 
    Platform:   Windows  ;   
    Language(s) :   C.O.F.F.E.E  ;

    ---------
    Hello there :)

    I've been looking for a solution to this problem for hours but couldn't find anything helpful.
    I'm writing a tag plugin and I want it to be configurable from the attribute manager.
    I know I have to write a description file, but I don't know what to do next.
    How do I tell C4D to use this file? Apparently there is no RegisterPluginTag() method in COFFEE so I can't pass it when I register the plugin.

    Oh, and I had another question: my plugin works with a camera that the user should select, so I need a control in the attribute manager into which the user can drag&drop a camera from the objects list, any idea how to do that?

    Those might be beginner questions but the COFFEE documentation is really not helpful at all, and apparently not even complete, I hope it will be revamped in future versions :/

    Thanks :)



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

    On 22/07/2011 at 14:09, xxxxxxxx wrote:

    COFFEE Plugin Expressin Tags and AM = no go.
    You must use Userdata.

    I recommend using Python for this.

    Cheers
    Lennart



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

    On 22/07/2011 at 14:09, xxxxxxxx wrote:

    Sorry, descriptions are not supported by COFFEE plugins.

    cheers,
    Matthias



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

    On 22/07/2011 at 15:39, xxxxxxxx wrote:

    Ok, I guess I'll move to Python then. Thanks :)
    Any idea about my second question?



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

    On 22/07/2011 at 17:24, xxxxxxxx wrote:

    For your second question, just use a link field. Check the docs for the LINK description element.

    cheers,
    Matthias



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

    On 23/07/2011 at 06:34, xxxxxxxx wrote:

    Thanks :)
    I found the description docs and wrote my files but now I get two errors when I create my tag, that I can't figure out how to fix. If anyone could help it would be cool...

    1- Dialog Resource is corrupted (filename does not match dialog id)
    ...but it does:

    CONTAINER Tdnode
    {
      NAME Tdnode;

    And the files are called:
    - res/description/Tdnode.res
    - res/description/Tdnode.h
    - res/strings_us/description/Tdnode.str

    2- Error reading resource file 'C:\Program Files\MAXON\CINEMA 4D R12\plugins\dagonbatch\res\description dnode.h'     Line 6
    And here's my Tdnode.h file:

    01|   #ifndef _Tdnode_H_
    02|   #define _Tdnode_H_
    03|  
    04|   enum
    05|   {
    06|    DGN_NODE_NAME = 1001;
    07|     DGN_NODE_CAMERA = 1002;
    08|   };
    09|  
    10|   #endif



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

    On 23/07/2011 at 06:58, xxxxxxxx wrote:

    Enums are seperated by commas not by semicolons. Like this:

      
    #ifndef _Tdnode_H_  
    #define _Tdnode_H_  
      
    enum  
    {  
      DGN_NODE_NAME = 1001,  
      DGN_NODE_CAMERA = 1002  
    };  
      
    #endif  
    

    cheers,
    Matthias



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

    On 23/07/2011 at 07:26, xxxxxxxx wrote:

    Oops indeed.

    I'm still getting the other error though.
    And a new one in the res file on line 6:

    01| CONTAINER Tdnode
    02| {
    03|  NAME Tdnode;
    04| 
    05|  GROUP ID_NODEPROPERTIES
    06|  {
    07|    EDITTEXT DGN_NODE_NAME { ANIM OFF; }
    08|    LINK DGN_NODE_CAMERA { ANIM OFF; ACCEPT { Ocamera; } }
    09|  }
    10|}

    I don't see what's wrong here as line #6 only contains a { ...

    Thanks for the fast reply.



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

    On 23/07/2011 at 07:58, xxxxxxxx wrote:

    You may want to check out Description Editor.

    I can't spot the error here. Can you provide the full source ?

    Cheers,
    niklas



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

    On 23/07/2011 at 08:07, xxxxxxxx wrote:

    It looks like you are mixing things up. If your plugin is in COFFEE, it MUST use a dialog, not a description (the format is different). If you're using Python or C++ you can use either dialogs or descriptions.

    But you can't load a description resource into a dialog or a dialog resource into a description. What you've written is a description resource (they all start with CONTAINER) rather than a dialog (which all start with DIALOG). What are you loading the resource into?



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

    On 23/07/2011 at 09:14, xxxxxxxx wrote:

    Originally posted by xxxxxxxx

    What are you loading the resource into?

    I'm using Python now, and it's a description I want.

    Originally posted by xxxxxxxx

    You may want to check out Description Editor.

    I can't spot the error here. Can you provide the full source ?

    Cheers,
    niklas

    I re-created my description using this editor and I'm still getting the "Dialog Resource is corrupted" error.

    I'm also getting those:

    - Symbol 'Node' not found, File 'C:\Program Files\MAXON\CINEMA 4D R12\plugins\dagonbatch3\res\description dnode.res', Line 3 Fixed

    - Error reading resource, file 'C:\Program Files\MAXON\CINEMA 4D R12\plugins\dagonbatch3\res\description dnode.res', Line 9 Fixed, replaced EDITTEXT by STRING

    Here's the code generated by editor:

    /res/description/Tdnode.res

    CONTAINER Tdnode {  
        
      NAME Tdnode;  
      INCLUDE Tbase;  
        
      GROUP ID_NODEPROPERTIES {  
          COLUMNS 1;  
          DEFAULT 1;  
          STRING DGN_NODE_NAME { ANIM OFF; }  
          LINK DGN_NODE_CAMERA { ANIM OFF; ACCEPT { Ocamera; } }  
      }  
    }
    

    /res/description/Tdnode.h

    #ifndef _TDNODE_H_  
    #define _TDNODE_H_  
      
    enum {  
      Tdnode = 10000,  
      ID_NODEPROPERTIES,  
      DGN_NODE_NAME,  
      DGN_NODE_CAMERA,  
    };  
    #endif
    

    /res/strings_us/description/Tdnode.str

    STRINGTABLE Tdnode {  
      Tdnode "Dagon Node Properties";  
      ID_NODEPROPERTIES "Node";  
      DGN_NODE_NAME "Node name";  
      DGN_NODE_CAMERA "Camera";  
    }
    

    /res/c4d_symbols.h

    enum  
    {  
      // End of symbol definition  
      _DUMMY_ELEMENT_  
    };
    

    I didn't write any code for my plugin yet, I'm just trying to make the tag work:
    /DagonNodeData.pyp

    import os  
    import c4d  
    from c4d import plugins, bitmaps  
      
    PLUGIN_ID = 1234   # Testing  
      
    class DagonNodeData(plugins.TagData) :  
      """Dagon Node Tag"""  
      
      
      
    if __name__ == "__main__":  
      path, fn = os.path.split(__file__)  
      bmp = bitmaps.BaseBitmap()  
      bmp.InitWith(os.path.join(path, "res", "DGN_NODE_TAG.tif"))  
      plugins.RegisterTagPlugin(id=PLUGIN_ID, str="Dagon Node",  
                                  g=DagonNodeData,  
                                  description="Tdnode.res",  
                                  icon=bmp,  
                                  info=c4d.TAG_VISIBLE)
    


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

    On 23/07/2011 at 09:23, xxxxxxxx wrote:

    The editor does not yet take care of that you use the right names for the elements.

    CONTAINER Tdnode {  
        
        
              
          NAME Tdnode;  // instead of _NAME Node;_  
           INCLUDE Tbase;  
            
          GROUP ID_NODEPROPERTIES {  
              COLUMNS 1;  
              DEFAULT 1;  
              STRING DGN_NODE_NAME { ANIM OFF; }  // _EDITTEXT_ is not available in descriptions  
               LINK DGN_NODE_CAMERA { ANIM OFF; ACCEPT { Ocamera; } }  
          }  
        }
    
    And when registering, you don't add an .res to the description name.  
    
      
          plugins.RegisterTagPlugin(id=PLUGIN_ID, str="Dagon Node",  
                                      g=DagonNodeData,  
                                      description="Tdnode",  # instead of _"Tdnode.res"_  
                                       icon=bmp,  
                                      info=c4d.TAG_VISIBLE)
    
    Cheers,  
    Niklas  
    


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

    On 23/07/2011 at 09:38, xxxxxxxx wrote:

    That fixed the problem :D
    Thanks a lot, fellow Nux :)


Log in to reply