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

    Python Plug-in Questions

    Scheduled Pinned Locked Moved PYTHON Development
    6 Posts 0 Posters 552 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

      On 16/03/2016 at 02:53, xxxxxxxx wrote:

      Hi!

      I'm creating a very simple plug-in that does the following:

      1.  Creates a window/dialog with 4 file URL fields (text field + button) and import button.
      2.  The user selects 4 .c4d files from the /res folder
      3.  The user hits the import button and the script merges the .c4d files into the current document.

      I come from Maya/Python programming, but I'm very new to C4D/Python.  I check the C++ and Py docs before asking as well.

      Question #01:  What do I pass this command?
      c4d.documents.MergeDocument(doc, name, loadflags[, thread])

      What do I pass to "doc"?
      I keep my plug-in in the Library->Pref->etc. folder on OSX.  How do I get that URL and pass it to "name"?

      I've seen a couple scripts that kind of do this but hopefully after I figure out this simple bit I'll be able to hack away at the rest.

      Thank you for your time.

      Cheers,

      Matt

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

        On 16/03/2016 at 14:02, xxxxxxxx wrote:

        Hi Matt and welcome.

        It refers to the active document
        doc = c4d.documents.GetActiveDocument()

        -b

        Active document
        GetActiveDocument()

        Prefs directory
        c4d.storage.GeGetC4DPath(whichpath)

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

          On 17/03/2016 at 09:58, xxxxxxxx wrote:

          Hey,

          Thanks for the response, that worked great and I figured out how to find the /ref folder using the OS module.

          I have another questions regarding the UI.  How would I go about creating images with text next to them, like the Content Browser?  I'd like to write my own custom version of that, but I don't see a way of adding images.

          Thanks!

          Matt

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

            On 17/03/2016 at 14:50, xxxxxxxx wrote:

            I've never made UI with bitmaps before but i think this might be what you're looking for:
            GeUserArea.DrawBitMap()

            -b

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

              On 18/03/2016 at 01:49, xxxxxxxx wrote:

              As Bonsak already suggested, you can create your own GeUserArea. Probably the most versatile approach in Python.
              A much simpler option would be to use a CustomGUI BitmapButton for the image (turn off button behavior with BITMAPBUTTON_BUTTON) and have the text as static text.
              Depends on your needs and the style you want to achieve, what works best for you.

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

                On 20/03/2016 at 18:11, xxxxxxxx wrote:

                Thank you both for the response.  I tried the Bitmap Button and it works pretty well.  I'm going to do more research into the User Area, that looks promising.

                Cheers,

                Matt

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