Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush Python API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Unread
    • Recent
    • Tags
    • Users
    • Login

    GeDialog.LoadDialogResource() Problem

    Scheduled Pinned Locked Moved PYTHON Development
    17 Posts 0 Posters 2.0k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • H Offline
      Helper
      last edited by

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

      On 30/06/2011 at 15:41, xxxxxxxx wrote:

      ScottA,
      I had the same problem with global resource error.  The fix for me was to add my dialog ID's to the c4d_symbols.h file.  Then I was able to access the id's in my python code using c4d.ID_MY_CONTROL

      python code examples:
                 descId = data.get('id')
                  if(descId[0].id == c4d.ID_BUTTON_REFRESH ) :
                      if(self.Debug) : print('Refresh button was pressed')
                      self.UpdateTagObjects(node)

      elif(descId[0].id == c4d.ID_BUTTON_CREATE ) :
                      if(self.Debug) : print('Create button was pressed')
                      self.CreateObjects(node)
                      self.UpdateTagObjects(node)

      c4d_symbols.h file:
           enum
      { // Dialog definitions of IDD_CACHEDIALOG start here IDD_CACHEDIALOG, IDC_CUSTOM1, IDC_CHECK1, // Dialog definitions of IDD_CACHEDIALOG end here ID_CHECK_CHILDREN, ID_DIR_FOLDER, ID_CHECK_ACTIVE, ID_BUTTON_REFRESH , ID_STATIC_OBJ_COUNT, ID_STATIC_USE_COUNT, ID_BUTTON_CREATE , ID_CHECK_DEBUG, ID_FLOAT_SCALE, ID_INT_FRAME_OFFSET, ID_BUTTON_HELP, // End of symbol definition _DUMMY_ELEMENT_ };

      hope this helps

      1 Reply Last reply Reply Quote 0
      • H Offline
        Helper
        last edited by

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

        On 30/06/2011 at 16:22, xxxxxxxx wrote:

        Thanks.
        But I already had them in my symbols.h file.
        I think my problems are inside of  the main pyp file. I'm trying to convert one of my Coffee res based dialog plugins to Python. And I'm running into conversion problems.

        -ScottA

        1 Reply Last reply Reply Quote 0
        • H Offline
          Helper
          last edited by

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

          On 30/06/2011 at 16:50, xxxxxxxx wrote:

          I'm a C# coder and have been struggling with python and C4d for months now... so I'm still am a nubie, but a couple of things jumped out at me in your python code:

          1. the init function should be def __init__(self) :
          2. all methods with in a class definition should have the first parameter as self even if you don't intend to pass any parameters.  Python always passes self
          3. the call to a class method should have the self.  i.e.  self.SetTitle("ResBasedMenu"), I think SetTitle is an inherited method?

          again I'm new at this so please correct me if i'm wrong.

          currently I'm struggling with the description system for my tag plugin, I'm using this so that the properties can be manipulated through the attributes manager.  Apparently not all controls supported in dialogs are supported in descriptions.

          1 Reply Last reply Reply Quote 0
          • H Offline
            Helper
            last edited by

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

            On 30/06/2011 at 17:58, xxxxxxxx wrote:

            I think I've got it figured out now.
            I'm going to work on it a little bit more. Then I'll post it when it's done in case anyone needs a simple example.

            The SDK's (and Maxon) always say that resource based plugins are the best way to go.
            So there really should be a simple dialog example included with the Python SDK.

            -ScottA

            1 Reply Last reply Reply Quote 0
            • H Offline
              Helper
              last edited by

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

              On 01/07/2011 at 03:46, xxxxxxxx wrote:

              Here's some snippet of the RootDialog class used in my Description Editor plugin.

              class RootDialog(GeDialog) :  
                resourceId      = None  
                
                TITLE_DEFAULT   = "Root Dialog"  
                
                def __init__(self, descElement, title = None) :  
                      # Description Object  
                    self.descElement            = descElement  
                
                      # Dialog title  
                    if not title:  
                        self.title              = self.TITLE_DEFAULT  
                    else:  
                        self.title              = title  
                
                    self.result                 = None  
                
                def Init(self) :  
                    self.SetTitle(self.title)  
                
                    return True  
                
                def InitResourceId(self, id) :  
                    if not isinstance(id, int) :  
                        raise TypeError, "InitResourceId: need an integer argument, not %s" % id.__class__.__name__  
                
                    self.resourceId     = id  
                
                def CreateLayout(self) :  
                      # Create dialog layout  
                
                    if self.resourceId is None:  
                        raise RuntimeError, "Dialog resource not initialised!"  
                
                    self.LoadDialogResource(  
                        id          = self.resourceId,  
                        flags       = c4d.BFH_SCALEFIT | c4d.BFV_SCALEFIT,  
                    )  
                
                    self.Init()  
                
                    return True  
                
                [...]
              
              1 Reply Last reply Reply Quote 0
              • H Offline
                Helper
                last edited by

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

                On 01/07/2011 at 12:02, xxxxxxxx wrote:

                After much searching through my collection of code. And a lot of WTF is this crazy thing doing!😂
                I've created a fairly good (simple) asyncronous, dockable, resource based, Dialog example:https://sites.google.com/site/scottayersmedia/ResBasedDialogPlugin_Python.zip

                Here's some interesting things I found along the way:
                -The folder it seems to look for by default is "dialogs"....not "description" <--- That's really weird

                -Using an auto incrementation enum system in the symbols.h file caused strange problems with certain ID numbers in my pyp file. So I had to use the exact same list of ID's in the symbols.h file as the main .pyp code file. And not use an auto increment system at all.

                -Some of the description flags don't seem to be supported(CUSTOMGUI_INLINE, ANIM OFF, ANIM ON, etc...) 😢

                Hope this helps.
                -ScottA

                1 Reply Last reply Reply Quote 0
                • H Offline
                  Helper
                  last edited by

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

                  On 01/07/2011 at 12:48, xxxxxxxx wrote:

                  Originally posted by xxxxxxxx

                  ]Here's some interesting things I found along the way:
                  - The folder it seems to look for by default is "dialogs"....not "description" <--- That's really weird

                  -Using an auto incrementation enum system in the symbols.h file caused strange problems with certain ID numbers in my pyp file.

                  1. Of course ! You are creating a dialog and not a NodeData instance which needs a description.

                  2. Don't know what you mean with it.

                  Did my example help you ?

                  1 Reply Last reply Reply Quote 0
                  • H Offline
                    Helper
                    last edited by

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

                    On 01/07/2011 at 13:15, xxxxxxxx wrote:

                    Many thanks guys for all your helpful pointers & code !
                    These are exactly the examples & info that I was missing in the python for c4d documentation ! Hopefully this thread will help others who struggle with this too.

                    1 Reply Last reply Reply Quote 0
                    • H Offline
                      Helper
                      last edited by

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

                      On 01/07/2011 at 13:16, xxxxxxxx wrote:

                      I have found that the description versus dialogs don't support the same features as well.  And for the widgets that are supported the options are different.
                      for example to create a line separator:
                      SEPARATOR { LINE; }  // for descriptions
                      SEPARATOR { SCALE_H; } //for dialogs

                      I searched the C++ and C.O.F.F.E.E docs and found great info for dialogs, but nothing for the description system.  Am I just missing it?

                      The way I discovered the SEPARATOR options is by looking at the description res files defined for C4D.
                      located here: C:\Program Files\MAXON\CINEMA 4D R12\resource\res\description

                      These files have helped me greatly in building my own description screens.

                      1 Reply Last reply Reply Quote 0
                      • H Offline
                        Helper
                        last edited by

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

                        On 01/07/2011 at 13:46, xxxxxxxx wrote:

                        Originally posted by xxxxxxxx

                        Did my example help you ?

                        Not in this case. I was already deep into building my plugin before you replied.
                        But your input is always helpful.👍

                        The enum thing was a very sneaky problem.
                        I set my first symbols.h item id to start at 100000. Then auto increment. And my GUI items in my .pyp file started at 10001.
                        Everything worked fine. Until I reached the number 100010 in my .pyp file. That gizmo was being ignored, and wouldn't execute my code pointing to it.
                        So auto incrementing enums do work. But only under very limited circumstances.
                        It took me a while to find that sucker too.😠
                        Once I found it. I decided to not use auto incrementing at all. To eliminate any further problems.

                        -ScottA

                        1 Reply Last reply Reply Quote 0
                        • First post
                          Last post