Subdialog, title



  • Sorry if my question is supid but,in a subdialog, how to change this title?
    I tried with self.SetTitle("title"), with self.GroupBegin(id, flags, cols, rows, title="title")
    but it doesn't change anything!

    Something must be slipping away from me.
    0_1550130419889_Dialog.png


  • Global Moderator

    Hi Passion3D,

    I'm wondering why you are speaking of a SubDialog since it seems (from the screenshot) that you are actually in a description? (Correct me if I'm wrong)

    If so you have to modify your .res and especially the NAME parameter. See Resource Manual.

    Cheers,
    Maxime.



  • Hi Maxime

    I didn't make an .res, but coded it in python. And I don't see where to change that title. Here my code:

    def CreateLayout(self):
        self.SetTitle("Options")
        self.GroupBegin(id=2000, flags=c4d.BFH_SCALEFIT, cols=1, rows=2, title="Options", c4dBFV_GRIDGROUP_ALLOW_WEIGHTS)
        self.AddStaticText(2100, c4d.BFH_LEFT, 0, 0, 0, txt(IDS_PARAMS_HELP))

  • Global Moderator

    Hi Passion3D, I'm sorry I didn't get the time to really dig into your issue. While I do not have a high expectation (because the title is defined in the description which host the passed subdialog, and this is not part of the SubDialog itself, so I'm doubtful about what can be done).

    But with that said, I will investigate more Monday and give you a definitive answer.
    Cheers,
    Maxime.



  • No problem Maxime :) take your time ;)
    It's just display and it doesn't stop me from developing the plugin


  • Global Moderator

    Hi Passion3D, unfortunately, with SubDialog it's not possible to change this title bar, but with res file this is possible.

    in res/strings_en-US/description/toolexampleresource.str

    STRINGTABLE ToolExampleResource
    {
            ToolExampleResource "ToolExampleResource";
    	TOOL_EXAMPLE_RESOURCE_MENU "This is a custom Text";
    	TOOL_EXAMPLE_RESOURCE_TEXT "Cliquez sur chaque object que vous voulez mettre sur le sol";
    }
    

    in res/description/toolexampleresource.h

    #ifndef TOOLEXAMPLERESOURCE_H__
    #define TOOLEXAMPLERESOURCE_H__
    
    enum
    {
    	TOOL_EXAMPLE_RESOURCE_MENU = 1000,
    	TOOL_EXAMPLE_RESOURCE_TEXT = 1001,
    };
    
    #endif // TOOLEXAMPLERESOURCE_H__
    

    And in res/description/toolexampleresource.res

    CONTAINER ToolExampleResource
    {
    	NAME ToolExampleResource;
    
    	GROUP TOOL_EXAMPLE_RESOURCE_MENU
    	{
    		DEFAULT 1;
    		STATICTEXT TOOL_EXAMPLE_RESOURCE_TEXT { ANIM OFF; }
    	}
    }
    

    I hope this answers more or less to your question.
    Cheers,
    Maxime.



  • Thank you Maxime
    That's what I concluded. Too bad, it was easier for me to code in python ;)



  • A little novice question :)
    How do I load my resource description?
    While searching in the archives, I understood (I translate with google) that ToolData was different from other plugins, it is not derived from nodedata but uses a subdialog.
    So, let me know if I'm wrong., I can't use a resource description for the parameters of my tool?


  • Global Moderator

    Hey, Passion3D, this goes way deeper than I initially thought. So to make it short, in C++ Cinema 4D offers DescriptionToolData which inherit from ToolData. Sadly returning a description is only possible in DescriptionToolData and not ToolData and Python does not support DescriptionToolData.

    But the nice stuff / tricky part to makes it work in Python is to use the SculptBrush which inherit from DescriptionToolData.

    params = c4d.modules.sculpting.SculptBrushParams()
    c4.dplugins.RegisterSculptBrushPlugin(id=PLUGIN_ID, str="YourPlugin",
                                    info=0, icon=None, 
                                    help="This string is shown in the statusbar",
                                    sculptparams=params,
                                    dat=ExampleTool())
    

    Then in your ScultBrushToolData derived class override these two methods

        def GetToolPluginId(self):
    	    return PLUGIN_ID
    
        def GetResourceSymbol(self):
            return "ToolExampleResource"
    

    This allows you more options and powers since ScultBrushToolData is way more flexible than a simple ToolData.

    If you have any question, please let me know.
    Cheers,
    Maxime.



  • Thank you Maxime, I'll test all this ;)