Material Editor does't work consistently



  • On 15/09/2015 at 07:51, xxxxxxxx wrote:

    User Information:
    Cinema 4D Version:   R16 
    Platform:   Windows  ;   
    Language(s) :     C++  ;

    ---------
    Greetings !

    I have created a material plugin.
    In the parameter list, i use checkboxes that cause other parameters to appear/disapppear
    I have also created a GeUserArea in a iCustomGui subclass that i use in the parameter attribute list as CUSTOMGUI. Users can also click this user area to show and hide parameters. At this point everything works fine.

    The problems appear when the user decides to modify the Material using the material editor.
    First of all when they click the GeUserArea, even though some of the parameters must disappear (while others appear), they all remain appeared.

    Even though i use the following code in the GetDDescription the parameter doesn't disappear, while it does in the Material Manager.

    BaseContainer * description_data = description->GetParameterI(DescLevel(parameter_id),params);
    if (description_data)
    	description_data->SetBool(DESC_HIDE, true);
    

    Do i do anything wrong ?
    Is there anything i can do to make Material Editor to listen to these kind of events ?

    Thank you for your time.



  • On 16/09/2015 at 09:13, xxxxxxxx wrote:

    Hi,

    can you perhaps show me some more code from your GetDDescription(). I just tried it here and works as expected.



  • On 17/09/2015 at 02:01, xxxxxxxx wrote:

    Greetings Andreas !

    Lets say i have 6 parameters, 3 bools and 3 goups.
    If bool A is enabled, then group A can be shown.
    The same goes for Bool B -> group B and bool C -> group C.
     
    I use this code to show and hide parameters

    BaseContainer *description_data = description->GetParameterI(DescLevel(parameter_id),params);
    if (description_data)
    	description_data->SetBool(DESC_HIDE, hide_value);
    

    Other than that, I  use a GeUserArea that can be used alternatively to show the groups. That means when the user clicks the GeUserArea in a specific position the corresponding Group becomes visible.

    In GetDDescription i use:

    -hide all groups (using the above code)
    -get string value from GeUserArea
    -Depending on that string value, show the corresponding group.

    The GeUserArea is retrieved using String area_string = data->GetString(AREA_PARAMETER);

    The problem is that when i click the user area, the corresponding group won't be shown in the right area of Material Editor (even though the group is set to visible). The right area is always empty.

    I don't use PARENTMSG anywhere in the .res file.

    Thank you for your time.



  • On 17/09/2015 at 02:32, xxxxxxxx wrote:

    I did some more tests, with static ally (.res file) and dynamically created description parameters. Also with groups. Here, as said before, hiding and unhiding works as expected. Parameters/groups are hidden or shown both in Material Editor and Attribute Manager, depending on a bunch of bool parameters.

    Please show me your GetDDescription() code and not only some snippets.
    For example are you correctly setting the flags?
    If you don't want to show your code publicly, you can also PM me or send a mail to sdk_support@maxon.net



  • On 22/09/2015 at 06:40, xxxxxxxx wrote:

    For everyone else reading this thread: In the meantime peterakos send his code via PM. The following answer is based on findings looking into his code.

    I probably missed, that you tried to get this working in the left column of the Material Editor. This won't work. The left column of the Material Editor is special and a lot of its behavior is hard coded. For example expanding CustomGUIs does not work in the left column, as discussed in Gradient in GetDDescription() thread.
    If you use your code with Bools and Groups on the right side of the Material Editor, you'll see, it will work just as expected.
    My suggestion would be to stick to the concept of standard materials and use the left column only for switching between different pages.



  • On 22/09/2015 at 06:53, xxxxxxxx wrote:

    Hello.

    I really appreciate your help.
    So the problem is in the .res file where is defined what belongs to the left (or right) column

    Here is the structure of my res.

    NAME <any_name>;
    INCLUDE Mpreview;
    GROUP {
    	<My customgui >
    }
      
    GROUP
    {
    	other controls (buttons, bools, numbers)
    }
      
    INCLUDE Mbase;
    GROUP Obaselist {
     ......
    }
      
    <Rest of groups>
      
    INCLUDE Massign;
    

    So whatever exists above Mbase and Obaselist belongs to the left column, is that correct ?

    Thank you.



  • On 23/09/2015 at 05:16, xxxxxxxx wrote:

    hello again.

    I got another question.
    Can i have a left column checkbox to use PARENTMSG for more than one group ?

    Thank you.



  • On 25/09/2015 at 07:05, xxxxxxxx wrote:

    Hi,

    sorry, you had to wait so long for an answer.

    So whatever exists above Mbase and Obaselist belongs to the left column, is that correct ?

    No, not quite. It's actually the Obaselist group, which defines the left column. I suggest to take a look at the resource file of the standard material. You find it in [Cinema_4D_install_dir]/resource/modules/c4dplugin/description. There have a look at mmaterial.res.
    I think, this should also answer the question for more groups.



  • On 28/09/2015 at 23:51, xxxxxxxx wrote:

    Hello again.

    Can i somehow switch pages in the material editor via code ?
    For example, i want to pick an option from a LONG CYCLE parameter and switch pages.
    Is this possible ?

    Thank you.



  • On 29/09/2015 at 00:28, xxxxxxxx wrote:

    Hi,

    in a dialog this would be possible, but not in descriptions. The user may have several open "views" on your material (multiple Material Editors, multiple Attribute Managers). How would you decide, on which view to switch the pages? Also I'm not sure, the user would like it, if you changes his views.



  • On 29/09/2015 at 01:35, xxxxxxxx wrote:

    Hello.

    "How would you decide, on which view to switch the pages?"
    I don't know and that's what i am trying to figure out.

    Is this possible with the Description* parameter of GetDDescription ?
    Also, even if i have multiple views open, whenever i make a change in one of them, the change passes to the others as well.

    I have to use the Material Editor along with this feature: 
    Pick an option in a LONG CYCLE parameter and switch to the corresponding page in Material Editor.

    Thank you.



  • On 29/09/2015 at 01:36, xxxxxxxx wrote:

    No, it is not possible with descriptions.


Log in to reply