Python Plug-in Questions

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


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.



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

Hi Matt and welcome.

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


Active document

Prefs directory

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


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.



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:


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.

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.