Help parsing a Description resource



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

    On 21/07/2011 at 15:14, xxxxxxxx wrote:

    So I'm trying to get a simple Object Plugin to work and I've got it so it's almost there but I keep getting an error when I launch the plugin in C4D.  The plug does work but I can't figure out why it keeps throwing this error when it is launched:

    Thanks for taking a look.

    The directory structure is:

    Othreadconnect/
      ThreadConnect.pyp
      res/
        c4d_symbols.h
        description/
          Othreadconnect.h
          Othreadconnect.res
        strings_us/
          dialogs/
            Othreadconnect.str
        othreadconnect.tif
    

    This is the code:

    ThreadConnect_b02.pyp

    #!/usr/bin/env python
    # encoding: utf-8
      
    """
    ThreadConnect_b02.pyp
      
    """
      
    import  sys
    import  os
    import  math
    import  c4d
    from    c4d                     import plugins, utils, bitmaps
      
    Plugin_ID=1000005
      
      
    class ThreadConnect(plugins.ObjectData) :
        '''Thread Connect Generator'''
        
        def __init__(self) :
            self.SetOptimizeCache(True)
        
        def Init(self, op) :
            self.InitAttr(op, int, [10001])
      
            op[10001]= 8
            return True
        
      
    if __name__ == '__main__':
        dir, file = os.path.split(__file__)
        bmp = bitmaps.BaseBitmap()
        fn = os.path.join(dir, "res", "othreadconnect.tif")
        bmp.InitWith(fn)
        plugins.RegisterObjectPlugin(id = Plugin_ID, 
                                    str = "Thread Connect Beta .02", 
                                    g = ThreadConnect, 
                                    description = "Othreadconnect",
                                    info = c4d.OBJECT_GENERATOR, 
                                    icon = bmp)
    

    Othreadconnect.res

    CONTAINER Othreadconnect
    {
        NAME    Othreadconnect;
        INCLUDE Obase;
      
        GROUP       ID_OBJECTPROPERTIES
        {
            LONG    POINTS
            {
                MIN 1;
            }
        }
    }
      
    

    Othreadconnect.h

    #ifndef _Othreadconnect_
    #define _Othreadconnect_
      
    enum
    {
        POINTS          = 10001
    };
      
    #endif
    

    c4d_symbols.h

    enum
    {
        // End of symbol definition
        _DUMMY_ELEMENT_
    };
    

    Othreadconnect.str

    DIALOGSTRINGS Othreadconnect
    {
      Othreadconnect   "Thread Connect";
      
      POINTS   "Number of Points";
    }
    


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

    On 22/07/2011 at 02:04, xxxxxxxx wrote:

    You may want to check out Description Editor.

    Originally posted by xxxxxxxx

        strings_us/  
          _dialogs_ /  
            Othreadconnect.str  
        othreadconnect.tif
    
    in strings_us, the folder must be called 'description' not **'** dialogs **'**.  
    


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

    On 22/07/2011 at 07:42, xxxxxxxx wrote:

    In addition to what Nux said.
    The first line in your .str file should also read like this:  STRINGTABLE Othreadconnect

    -ScottA



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

    On 22/07/2011 at 08:27, xxxxxxxx wrote:

    Actually that dir list was a typo, it was actually a 'description' folder in the dir structure not dialogs.  But I swapped out DIALOGSTRINGS for STRINGTABLE and still got the same error.  I'm going to try to use Nux's plugin.  Which looks pretty amazing, btw.  Thanks for your hard work, Nux and your help, Scott.



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

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

    Very cool, Nux.  I just tried it out and it worked great.

    One thing though, when I put together this description I had to manually go into the Othreadconnect.h file and assign this parameter an ID value.  Which I then had to add into my .pyp code.  Is this normal or am I doing something wrong in my code implementation?

    Again, many thanks!

    Edit :  whoops, thought I got it working by enumerating at the top of the .pyp file but I was wrong.  Any idea on what I'm doing wrong wrt assigning parameters ID values?



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

    On 22/07/2011 at 10:32, xxxxxxxx wrote:

    Originally posted by xxxxxxxx

    Actually that dir list was a typo, it was actually a 'description' folder in the dir structure not dialogs.  But I swapped out DIALOGSTRINGS for STRINGTABLE and still got the same error.

    -I copied your code.
    -Used "description" in the strings_us folder.
    -Replaced "DIALOGSTRINGS" with "STRINGTABLE"
    And it runs perfectly with no errors.

    It sounds like maybe you got caught by the old "coffeesymbolcache" problem.
    If you don't delete that cache file every time you edit the various resource files. Your changes won't take effect.

    -ScottA



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

    On 22/07/2011 at 12:10, xxxxxxxx wrote:

    Cool good to know, any idea where that file might be?  Search doesn't seem to find it anywhere, neither does it work if I reveal all hidden files.  I'm on OS X, btw.  thanks



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

    On 22/07/2011 at 12:59, xxxxxxxx wrote:

    I'm not familiar with OSX. So I can't say for sure where it is on your system.
    On Windows it's located inside the prefs folder.  And that "prefs" folder is found under the folder that C4D targets in the preferences settings.

    Nux posted a python file a while back that will automatically delete that cache for you when C4D starts. But you'll have to edit the path to suit your specific system.
    It's very handy.

    IMHO. This coffeecache thing should be a sticky thread here. With big bold letters.
    It's something everyone new gets caught on. And it's not obvious.

    -ScottA


Log in to reply