CUSTOMGUI_TEXTURENAME



  • On 21/09/2013 at 03:06, xxxxxxxx wrote:

    There is this wonderful TEXTURE User Data field, which shows a little icon of the file you have selected.
    I thought I could use CUSTOMGUI_TEXTURENAME to do the same thing in my CommandPlugin.
    However, it is not working. 
    c4d.CUSTOMGUI_TEXTURENAME gives the same results as c4d.CUSTOMGUI_FILENAME.
    You can select a file, but it does not give you this little icon.

            #self.hdrfile = self.AddCustomGui(MY_HDRFILE, c4d.CUSTOMGUI_FILENAME, "", c4d.BFH_SCALEFIT, 0, 0)
            self.hdrfile = self.AddCustomGui(MY_HDRFILE, c4d.CUSTOMGUI_TEXTURENAME, "", c4d.BFH_SCALEFIT, 0, 0) 
    

    Am I doing something wrong or is it not possible and is there then another way to simulate this User Data TEXTURE field / data type?



  • On 21/09/2013 at 03:41, xxxxxxxx wrote:

    Hi,

    I can confirm this behavior. If you take a look into ResEdit for instance, you can find a flag which
    shows the texture icon:

    I though have to say the documentation lacks of this information. You very probably need to set
    a specific value in the customdata container you can pass to AddCustomGui(). I'll report back
    when I know which.

    Best,
    -Niklas



  • On 21/09/2013 at 09:09, xxxxxxxx wrote:

    Ok, thanks.
    I'll await the answer.



  • On 19/12/2013 at 12:59, xxxxxxxx wrote:

    Hi Niklas,

    Any updates on this issue?
    It works using the ResEdit, but the little arrow in front is not showing?
    Should I use a 'fold' setting to show the arrow and the bitmap?



  • On 19/12/2013 at 13:20, xxxxxxxx wrote:

    Hi Pim! Sorry I didn't answer earlier. It is not possible from Python unfortunately. I just answered
    to your topic in the C++ SDK Section.

    Hi Pim,
    you can expand the widget by calling BaseCustomGui::SetLayoutMode(LAYOUTMODE_MAXIMIZED). You can
    get the address of the BaseCustomGui from GeDialog::AddCustomGui() or GeDialog::FindCustomGui().

    PS: The SetLayoutMode() method is not available in Python.

    Best,
    -Niklas

    https://plugincafe.maxon.net/topic/7616/9549_customguitexturename

    EDIT: You need to call this after, not in, CreateLayout() (eg. InitValues())



  • On 19/12/2013 at 14:01, xxxxxxxx wrote:

    ^Using LAYOUTMODE_MAXIMIZED like that in a GeDialog plugin doesn't work Nik.
    It creates a second  unwanted copy of the texturename gizmo.

    Example:

      
    #include "c4d.h"  
    #include "c4d_symbols.h"  
    #include "customgui_filename.h"  
    #include "customgui_texturename.h"  
      
    class MyDialog : public GeDialog  
    {  
      private:  
          TexturenameCustomGui *myTxtfile;  
      
      public:  
          myDialog(void);  
          ~myDialog(void);  
          virtual void DestroyWindow();  
          virtual Bool CreateLayout(void);  
          virtual Bool InitValues(void);  
          virtual Bool Command(LONG id,const BaseContainer &msg);  
          virtual LONG Message(const BaseContainer &msg,BaseContainer &result);  
          virtual Bool GetDDescription(GeListNode *node, Description *description,DESCFLAGS_DESC &flags);          
    };  
      
      
    Bool MyDialog::CreateLayout(void)  
    {  
      BaseContainer textgui;  
      myTxtfile = (TexturenameCustomGui* )AddCustomGui(1111, CUSTOMGUI_TEXTURENAME, "", BFH_SCALEFIT, 0, 0, textgui);  
      myTxtfile->SetLayoutMode(LAYOUTMODE_MAXIMIZED); //<---Creates an unwanted duplicate gizmo!!! :angry:  
      
      return TRUE;  
    }
    

    -ScottA



  • On 19/12/2013 at 14:20, xxxxxxxx wrote:

    You need to call this after CreateLayout() is done. InitValues() would be the perfect place for it. I'll
    update the other post, too.

    #include <c4d.h>
    #include <customgui_texturename.h>
      
    #define PLUGIN_ID 2423423 // TEST ID !!!
      
    class MyDialog : public GeDialog {
      
        TexturenameCustomGui* m_widget;
      
    public:
      
        MyDialog() : GeDialog(), m_widget(NULL) { }
      
        virtual Bool CreateLayout() {
            m_widget = reinterpret_cast<TexturenameCustomGui*>(
                    AddCustomGui(1000, CUSTOMGUI_TEXTURENAME, "", BFH_SCALEFIT, 0, 0, BaseContainer())
            );
            if (m_widget == NULL) {
                GePrint("ERROR: TexturenameCustomGui could not be created.");
                return FALSE;
            }
            return TRUE;
        }
      
        virtual Bool InitValues() {
            m_widget->SetLayoutMode(LAYOUTMODE_MAXIMIZED);
            return TRUE;
        }
      
    };
      
    class MyCommand : public CommandData {
      
        MyDialog m_dlg;
      
    public:
      
        virtual Bool Execute(BaseDocument* doc) {
            return m_dlg.Open(DLG_TYPE_ASYNC, PLUGIN_ID);
        }
      
    };
      
      
    Bool PluginStart() {
        return RegisterCommandPlugin(PLUGIN_ID, "TexturenameCustomGui Test",
                0, NULL, "", gNew MyCommand);
    }
      
    Bool PluginMessage(LONG type, void* pData) {
        return TRUE;
    }
      
    void PluginEnd() {
    }
    


  • On 19/12/2013 at 14:47, xxxxxxxx wrote:

    That's really weird.
    I've never had any problems putting this kind of code in the CreateLayout() method before.
    They've always worked fine in either one. And I've probably done it hundreds of times.
    I guess this is a rare case where it make a difference.

    Thanks,
    -ScottA

    P.S.  Sorry for posting this in both threads. I meant to post it in the C++ forum. But I posted in the Python forum by mistake.


Log in to reply