SOLVED Dialog button hangs C4D

I have a dialog button which hangs when I click it but it only hangs for a specific scene.

From looking at the printout in the python console window, it appears that when I click the 'Submit' button, it never reaches the call to Command()

TTR_PLUGIN_ID = 999121032
TTR_CANCEL_BUTTON = 12003
TTR_SUBMIT_BUTTON = 12004
    def Command(self, id, msg):
        print('TurnTableRenderDialog::Command()')
        print('id = {}'.format(id))
        print('TTR_SUBMIT_BUTTON = {}'.format(TTR_SUBMIT_BUTTON))
        if (id == TTR_SUBMIT_BUTTON):
            print('TTR_SUBMIT_BUTTON')
    def CreateLayout(self):
        '''
        Frame Chunk size,
        Render folder prefix
        Frame range (start, end)
        '''
        self.SetTitle('Submit turn table to Tractor (PlutoWithDamage)')
        self.GroupBegin(id=1013, flags=c4d.BFH_SCALEFIT, cols=1)
        #
        self.GroupBegin(id=1014, flags=c4d.BFH_SCALEFIT, cols=2)

        self.AddStaticText(TTR_COMMENT_LABEL, c4d.BFV_MASK |
                           c4d.BFH_RIGHT, name="Comments")
        self.AddEditText(TTR_COMMENT_EDIT, c4d.BFV_MASK |
                         c4d.BFH_LEFT, initw=400)

        self.AddStaticText(TTR_FRAME_RANGE_LABEL, c4d.BFV_MASK |
                           c4d.BFH_RIGHT, name="Frame range (start,end,step)")
        self.GroupBegin(id=1015, flags=c4d.BFH_SCALEFIT, cols=3)
        self.AddEditNumberArrows(TTR_FRAME_RANGE_START, c4d.BFV_MASK, initw=100)
        self.AddEditNumberArrows(TTR_FRAME_RANGE_END, c4d.BFV_MASK, initw=100)
        self.AddEditNumberArrows(TTR_FRAME_RANGE_STEP, c4d.BFV_MASK, initw=100)
        self.GroupEnd()

        self.GroupEnd()
        #
        self.GroupBegin(id=1016, flags=c4d.BFV_MASK | c4d.BFH_RIGHT, cols=2)
        self.AddButton(TTR_CANCEL_BUTTON, c4d.BFV_MASK |
                       c4d.BFH_RIGHT, initw=100, name="Cancel")
        self.AddButton(TTR_SUBMIT_BUTTON, c4d.BFV_MASK |
                       c4d.BFH_RIGHT, initw=100, name="Submit")
        self.GroupEnd()

Hi @nicholas_yue,

what @m_adam meant with his posting (he did the edit on my post), was that you should get a proper plugin id for TTR_PLUGIN_ID (new plugin ids are currently roughly in the 1,000,000 range, which is why yours does stand out). Probably with the assumption that TTR_PLUGIN_ID is somewhere used as an id to register a plugin.

  1. You do not have to register plugin ids for GeDialog elements, you can just assign ids freely here.
  2. Also within the scope of the script it does not matter what TTR_PLUGIN_ID equates to, since it is not used for registration.
  3. Your menu not loading at all should not be caused by using plugin ids, since the address space for both gadget ids and plugin ids is the same (Int32) and you are not even close to that cap.

To get to the ground of your problem, you should post your modified code and any exceptions Cinema does raise in its console.

Cheers,
Ferdinand

Hi @nicholas_yue,

thank you for reaching out to us. It is a bit unclear to us what you mean by hanging on specific scenes, i.e. we are not able to reproduce this. However, you made the mistake of not conforming to the signatures of both GeDialog.Command and GeDialog.CreateLayout, both being defined as methods with a boolean return type (see docs for details). When fixing that, the code will run as one would expect here on my machine. Below you will find a "fixed" version (I just added an explicit return value to both functions, conforming to signatures).

Cheers,
Ferdinand

import c4d

TTR_PLUGIN_ID = 999121032
TTR_CANCEL_BUTTON = 12003
TTR_SUBMIT_BUTTON = 12004
TTR_COMMENT_LABEL = 0
TTR_COMMENT_EDIT = 1
TTR_FRAME_RANGE_LABEL = 2
TTR_FRAME_RANGE_START = 3
TTR_FRAME_RANGE_END = 4
TTR_FRAME_RANGE_STEP = 5


class MyDialog(c4d.gui.GeDialog):
    """
    """

    def Command(self, id, msg): 
        print('TurnTableRenderDialog::Command()')
        print('id = {}'.format(id))
        print('TTR_SUBMIT_BUTTON = {}'.format(TTR_SUBMIT_BUTTON))
        if (id == TTR_SUBMIT_BUTTON):
            print('TTR_SUBMIT_BUTTON')
        return True

    def CreateLayout(self):
        '''
        Frame Chunk size,
        Render folder prefix
        Frame range (start, end)
        '''
        self.SetTitle('Submit turn table to Tractor (PlutoWithDamage)')
        self.GroupBegin(id=1013, flags=c4d.BFH_SCALEFIT, cols=1)
        #
        self.GroupBegin(id=1014, flags=c4d.BFH_SCALEFIT, cols=2)

        self.AddStaticText(TTR_COMMENT_LABEL, c4d.BFV_MASK |
                           c4d.BFH_RIGHT, name="Comments")
        self.AddEditText(TTR_COMMENT_EDIT, c4d.BFV_MASK |
                         c4d.BFH_LEFT, initw=400)

        self.AddStaticText(TTR_FRAME_RANGE_LABEL, c4d.BFV_MASK |
                           c4d.BFH_RIGHT, name="Frame range (start,end,step)")
        self.GroupBegin(id=1015, flags=c4d.BFH_SCALEFIT, cols=3)
        self.AddEditNumberArrows(
            TTR_FRAME_RANGE_START, c4d.BFV_MASK, initw=100)
        self.AddEditNumberArrows(TTR_FRAME_RANGE_END, c4d.BFV_MASK, initw=100)
        self.AddEditNumberArrows(TTR_FRAME_RANGE_STEP, c4d.BFV_MASK, initw=100)
        self.GroupEnd()

        self.GroupEnd()
        #
        self.GroupBegin(id=1016, flags=c4d.BFV_MASK | c4d.BFH_RIGHT, cols=2)
        self.AddButton(TTR_CANCEL_BUTTON, c4d.BFV_MASK |
                       c4d.BFH_RIGHT, initw=100, name="Cancel")
        self.AddButton(TTR_SUBMIT_BUTTON, c4d.BFV_MASK |
                       c4d.BFH_RIGHT, initw=100, name="Submit")
        self.GroupEnd()
        return True


if __name__ == "__main__":
    dlg = MyDialog()
    dlg.Open(c4d.DLG_TYPE_ASYNC, xpos=-1, ypos=-1, defaultw=500, defaulth=500)

EDIT: Please ensure your Plugin Id come from https://plugincafe.maxon.net/c4dpluginid_cp in order to be sure this is a real Unique ID and nobody else will use it.

I have generated the IDs from the site you recommended.

When I replace the plugin IDs with those generated from https://plugincafe.maxon.net/c4dpluginid_cp the menu would not even load.

Cheers

Hi @nicholas_yue,

what @m_adam meant with his posting (he did the edit on my post), was that you should get a proper plugin id for TTR_PLUGIN_ID (new plugin ids are currently roughly in the 1,000,000 range, which is why yours does stand out). Probably with the assumption that TTR_PLUGIN_ID is somewhere used as an id to register a plugin.

  1. You do not have to register plugin ids for GeDialog elements, you can just assign ids freely here.
  2. Also within the scope of the script it does not matter what TTR_PLUGIN_ID equates to, since it is not used for registration.
  3. Your menu not loading at all should not be caused by using plugin ids, since the address space for both gadget ids and plugin ids is the same (Int32) and you are not even close to that cap.

To get to the ground of your problem, you should post your modified code and any exceptions Cinema does raise in its console.

Cheers,
Ferdinand

@zipit There was a typo when updating to use the new IDs generated from Maxon, it has since been resolved and the plugins are loading.

Cheers

Hi,

without further feedback, we will consider this thread as solved by Monday and flag it accordingly.

Cheers,
Ferdinand