Use CallCommand or equivalent by name ?



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

    On 08/02/2011 at 01:56, xxxxxxxx wrote:

    Hi there,

    me again 😂

    is there any way to Call the buttons, dialogs etc via their name they have in the c4d_symbols.h ?

    Like IDD_INFOMANAGER,IDP_TEXTURE_SAVE,IDP_PASTEINTO_SELECTION, etc ?

    Because not every button, function, dialog etc has an ID assigned.

    But I guess it should be possible to simulate a buttonclick on any button the program offers.

    Thank you in advance once more



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

    On 08/02/2011 at 07:17, xxxxxxxx wrote:

    Check out c4d.CallButton() in the main module. I think you have to add c4d. before the button name id. You also supply the object the button is on, like :

    c4d.CallButton(obj, c4d.IDP_TEXTURE_SAVE)



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

    On 09/02/2011 at 01:08, xxxxxxxx wrote:

    Alright, thanks for that.

    I'll give it a try, although I do not think it will work because according to the documentation an integer is required.

    But heja the proof of the pudding is in the heating.

    edit:

    import c4d
    from c4d import *

    obj = doc.GetFirstObject()

    def button_simulate(obj) :
     c4d.CallButton(obj,c4d.SELECTIONOBJECT_RESTORE)
     c4d.EventAdd()

    button_simulate(obj)

    I found the DescID via searching in the c4d_stings.str

    Gr8 that's already one step forward 👏

    so far, so good and now there is the big but:
    is there any chance to load dialogues instead of objects to perform a CallButton ?

    Because I'm still interested in the texturemanagertab in the infomanager.
    Especially accessing the list of textures



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

    On 09/02/2011 at 02:42, xxxxxxxx wrote:

    These IDs are integers, like when you write:

    obj = c4d.BaseObject(c4d.Ocube)

    the c4d.Ocube part is the same as integer 5159, so the code means the same as this :

    obj = c4d.BaseObject(5159)

    The IDs are just to make your code more readable and in case you don't know the number.

    You can find out the number like this :

    id = obj.GetType()
    print id



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

    On 09/02/2011 at 03:56, xxxxxxxx wrote:

    Originally posted by xxxxxxxx

    These IDs are integers

    You are so right, blame it on me

    maybe you have an idea to access the buttons in the dialogues as well ?

    Thanks for sharing your knowledge



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

    On 09/02/2011 at 05:38, xxxxxxxx wrote:

    No blame intended, I've just been working this stuff out myself these past few weeks, mainly by putting all the wrong types into everything !
    I'm not sure how to access the manager dialogues but if I think of anything I work it out, I'll be sure to post.



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

    On 10/02/2011 at 03:19, xxxxxxxx wrote:

    Originally posted by xxxxxxxx

    I've just been working this stuff out myself these past few weeks, mainly by putting all the wrong types into everything !

    So Do I 😣

    As an update, after 2 days trial n error combined with intensive googling there seems to be no way to access those dialogues, or at least if someone found it out he does not reveal the way.



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

    On 11/02/2011 at 05:36, xxxxxxxx wrote:

    CallCommand just accepts BaseList2D objects, dialogs are not accessible. Which button in which dialog do you want to press?



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

    On 11/02/2011 at 08:02, xxxxxxxx wrote:

    Well, nearly any button 

    Just to know how it works.

    But let's take the mark missing textures button for example.
    The DescID is IDC_TEXTURE_CHECKALLTEX.

    Do you know a way to access it ?

    I also tryed to implement the functions of the Button into my Layout via MenuAddCommand, but without any success.

    import c4d, os
    from c4d import *
    from c4d import storage
    from c4d.gui import GeDialog

    BTN_VRAY = {"id": 1028, "name": "CHK_Alle ersetzen", "width": 8, "height": 8}
    BTN_Test = {"id": 1029, "name": "Texturpfad ersetzen", "width": 150, "height": 25}
    TXT_VRAY = {"id": 1030, "name": "Alle ersetzen", "width": 100, "height": 10, "borderstyle": BORDER_NONE}

    class MyDialog(GeDialog) :
      def CreateLayout(self) :
          self.SetTitle("MyDialog")

    self.AddButton(id = BTN_Test["id"],
                              flags=BFH_RIGHT,
                              initw=BTN_Test["width"],
                              inith=BTN_Test["height"],
                              name=BTN_Test["name"])
          if self.MenuAddCommand (c4d.IDM_CM_CLOSEWINDOW) == True:
                  print "Done"

    return True

    def Command(self,id,msg) :
          if id==BTN_Test["id"]:
              MenuAddCommand (c4d.IDM_CM_CLOSEWINDOW) == True

    return True

    dialog = MyDialog()
    dialog.Open(dlgtype=DLG_TYPE_MODAL_RESIZEABLE)


Log in to reply