Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware 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

    Parameter set in init of MaterialData plugin

    SDK Help
    0
    12
    935
    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
      Helper
      last edited by

      On 03/09/2015 at 14:58, xxxxxxxx wrote:

      Another thing i forgot to mention is that in the first call of SetData of the iCustomGui, the Long value of 
      tristate.GetValue().GetLong() is always 1.

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

        On 04/09/2015 at 01:19, xxxxxxxx wrote:

        Hello,

        does this also happen when you don't use your custom GUI for that parameter or does it only happen in that case?

        Best wishes,
        Sebastian

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

          On 04/09/2015 at 12:11, xxxxxxxx wrote:

          this happens here too!! in my custom data type with tri state, in a material data plugin, there is Init(), SetDParameter() and GetDParameter(),  SetDParameter() is overriding the custom data value before Init(), didn't find a solution yet, help please Sebastian.

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

            On 05/09/2015 at 04:28, xxxxxxxx wrote:

            Hello.

            Here is a more detailed case that explains where the problem resides.

            Lets say i have 2 versions of a Material Data plugin.
            First i use the version 1 which inits MY_PARAMETER to 3.
            I run my project,  save it and then exit c4d.
            Then, I switch to version 2 of Material Data plugin which inits the same param to 9.
            Bu this param is already set to 3 in project.
            So after init in version 2, the param is read from the project file (value 3).

            My question was why the parameter has value where nowhere i set it in the code, so this solves it.
            Thank you.

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

              On 07/09/2015 at 00:01, xxxxxxxx wrote:

              Hello,

              what do you mean with "2 versions of a Material Data plugin"? Two instances of the same class or two different plugin classes? And also, does this behavior only happen with your custom GUI or also without it?

              Best wishes,
              Sebastian

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

                On 07/09/2015 at 00:37, xxxxxxxx wrote:

                Hello.

                By saying 2 versions of material Data Plugin i mean 2 implementation versions of this plugin.
                I use #define _RUN_VERSION_1_ and _RUN_VERSION_2_ to define which one to run each time.

                The reason why i need to do this is because i use different interfaces. Different interfaces equals to different parameters. That means i also use 2 different versions of .res files.

                My mistake was that in version 1 i was setting parameters that didn't actually exist in that implementation (or lets say in the corresponding *.res file).

                Nevertheless in version 2 they were retrieved from the project file and used after the initialization.

                Also this issue appears even without my custom gui .

                Thnx.

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

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

                  Hello,

                  to just to understand what you are saying: you set different #defines, you recompile your plugin and then test it?

                  Do the different versions of your plugin also use different plugin IDs? It not, they are the same plugin for Cinema.

                  Best wishes,
                  Sebastian

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

                    On 08/09/2015 at 00:29, xxxxxxxx wrote:

                    Hello !

                    Originally posted by xxxxxxxx

                    Hello,
                    to just to understand what you are saying: you set different #defines, you recompile your plugin and then test it?

                    Exactly.

                    Also, the different versions don't use different Plugin IDs.

                    My problem is that by mistake, in a previous version of Material Data plugin, 
                    i have used data->setLong(2100, 5) even though parameter 2100 didn't exist.

                    Now (version 2) i have to use 2100 in a totally different case. But the parameter 2100 already exists in user projects with value 5. That means i cannot initialize it properly in Init(...), since the data from project file are retrieved.

                    Here is what can solve my problem:

                    1. find a way to totally clear the parameter 2100 in a project.
                    2. Set the value of parameter 2100 in Init, even though it already has a value in the project file.

                    Thank you !

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

                      On 08/09/2015 at 09:42, xxxxxxxx wrote:

                      Hello,

                      So it seems you don't have a problem with your plugin or your code but with a scene? You can set the version of a plugin in its Register() function, for example in RegisterMaterialPlugin(). This value is useful if you implement Read() and Write().

                      If you want to "delete" a parameter you can try to create some script that accesses the material's BaseContainer in your scene and removes an entry using RemoveData().

                      Best wishes,
                      Sebastian

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

                        On 08/09/2015 at 10:39, xxxxxxxx wrote:

                        Hello.

                        Can i use the RemoveData in the Read() method of the material (no matter the version)?

                        Bool Read (GeListNode* node, HyperFile* hf, Int32 level){
                        	BaseContainer* data = ((BaseList2D* )node)->GetDataInstance();
                        	data->RemoveData(2100);// or data->setLong(2100, 8);
                        	return NodeData::(node, hf, level);
                        }
                        

                        Thank You.

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

                          On 09/09/2015 at 02:08, xxxxxxxx wrote:

                          Hello,

                          it seems that this could work. But I'm not sure if it could have side effects so please test carefully.

                          Best wishes,
                          Sebastian

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