Combobox in Combobox in python



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

    On 24/10/2012 at 03:41, xxxxxxxx wrote:

    How to define a combobox in a combobox using Python?
    See for example the Physical Sky > Time and Location > City GUI.



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

    On 24/10/2012 at 06:33, xxxxxxxx wrote:

    Are you talking about having a popup menu displayed when we click on the combo?
    If you take a look at the description of the Physical Sky ( modules\advanced render\sky\res\description\oskyshader.res ) you can see that the City combo is defined as:

    LONG SKY_POS_CITY_COMBO
    {
        PARENTCOLLAPSE;
        CUSTOMGUI SKY_II_CITYLIST;
        ANIM OFF;
    }
    

    So you can see that it's made with custom gadget; unfortunately it's not possible to develop custom GUIs with the Python SDK, only in C++.

    Or are talking about the collapsing of City parameter?
    In its declaration you can see PARENTCOLLAPSE flag and Time Zone attribute is declared with PARENTCOLLAPSE SKY_POS_CITY_COMBO to tell CINEMA his collapse parent:

    LONG SKY_POS_TIMEZONE
    {
        PARENTCOLLAPSE SKY_POS_CITY_COMBO;
        CYCLE
        {
            SKY_POS_TZ_OS;
            SKY_POS_TZ_CUSTOM;
        }
    }
    


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

    On 24/10/2012 at 06:54, xxxxxxxx wrote:

    What I mean is that like the City comboboxx in the Physical Sky, first select the continent, that displays another combobox with all countries on that continent.
    Then select a country, that displays all cities in that country.

    I'm sorry, I do not understand what you mean with "collapsing of City parameter"?



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

    On 24/10/2012 at 07:27, xxxxxxxx wrote:

    Originally posted by xxxxxxxx

    What I mean is that like the City comboboxx in the Physical Sky, first select the continent, that displays another combobox with all countries on that continent.
    Then select a country, that displays all cities in that country.

    This is a dynamic popup menu calculated by the custom GUI.

    Originally posted by xxxxxxxx

    I'm sorry, I do not understand what you mean with "collapsing of City parameter"?

    I'm referring to the parameters that you can show or hide below City parameter.



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

    On 24/10/2012 at 12:02, xxxxxxxx wrote:

    Ok, clear.
    Do you have an example of such a popup menu?

    Sorry, I see you just told me
    "unfortunately it's not possible to develop custom GUIs with the Python SDK, only in C++."



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

    On 25/10/2012 at 03:30, xxxxxxxx wrote:

    Originally posted by xxxxxxxx

    Ok, clear.
    Do you have an example of such a popup menu?

    Sorry, I see you just told me
    "unfortunately it's not possible to develop custom GUIs with the Python SDK, only in C++."

    No, I just said that we can't build custom gadgets in Python but we can of course create dynamic popup menus.
    Here's an example of a recursive popup dialog:

    import c4d
    from c4d import gui
      
    def BuildMenuRecursive(menu, level, maxlevel) :
        offset = 10*level
        menu.SetString(c4d.FIRST_POPUP_ID+offset,   'Item '+str(offset+1))
        menu.SetString(c4d.FIRST_POPUP_ID+offset+1, 'Item '+str(offset+2))
        
        level += 1
        if level==maxlevel:
            menu.SetString(c4d.FIRST_POPUP_ID+offset+2, 'Item '+str(offset+3))
        else:
            submenu = c4d.BaseContainer()
            submenu.SetString(1, 'Item '+str(offset+3))
            BuildMenuRecursive(submenu, level, maxlevel)
            menu.SetContainer(c4d.FIRST_POPUP_ID+offset+2, submenu)
        
        menu.SetString(c4d.FIRST_POPUP_ID+offset+3, 'Item '+str(offset+4))
      
    # Build main menu recursively
    # With a maximum of 5 menus
    menu = c4d.BaseContainer()
    BuildMenuRecursive(menu, 0, 5)
      
    # Show popup dialog
      
    result = gui.ShowPopupDialog(cd=None, bc=menu, x=300, y=300)
    print result
    


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

    On 27/10/2012 at 16:11, xxxxxxxx wrote:

    Thanks, I'll give it a try.


Log in to reply