Wrong Store values in My plugin



  • On 30/07/2018 at 08:56, xxxxxxxx wrote:

    Hi,
    I write a deformer plugin that will store some values to doc[PLUGIN_ID].
    When  my sence have more than one the deformer and I updated one of the them (update that store value in new BaseContainer,and  doc[PLUGIN_ID] =new BaseContainer ), but all of them were updated because I updated doc[PLUGIN_ID] directly,This is not what I want.
    How can I store the value of each deformer separately (for example, it has a unique identifier), which also ensures that I can get the previously stored value from doc[PLUGIN_ID] by this unique identifier?

    (Forgive me for my English is not very good, I hope to express my clear😪)



  • On 31/07/2018 at 02:54, xxxxxxxx wrote:

    Hi,

    this is one of the rare cases, where life is actually easier than you might think.

    You don't need to store the parameters into the document's BaseContainer. Actually every NodeData derived entity (such as your deformer, ObjectData is derived from NodeData) has its own BaseContainer. Even better, if you define the resource files for the parameter description correctly, you don't even have to worry about storing the parameters. It's already handled for you and you can simply access them. Of course if you want or need to, you can also store additional information (not exposed as parameters to the user) in the objects BaseContainer, just take care to avoid ID collisions.

    I recommend to take a look at the Py-SpherifyModifier example. See how it handles the radius and the strength parameters (PYSPHERIFYMODIFIER_RADIUS and PYSPHERIFYMODIFIER_STRENGTH).



  • On 31/07/2018 at 07:09, xxxxxxxx wrote:

    Thank you for your help, Andreas Block!
    But I still don't understand it very well. I hope to use a basecontainer to store index of the many points, so it doesn't need to be seen by the user. In my (.h) file I define XX = 1001, XX = 1002, so I use object[1003] in the code to accept this BaseContainer, although it can, but this BaseContainer does not seem to be saved with the file, the next time you open the file is gone.

    In C++sdk, I saw that  use Custom Data Types ,so should I have to define XX = 1003 in the (.h) file, and then define it in the (.res) file to ensure that the file will be opened next time the BaseContainer still exists!?

    Frustrated, I can't understand ! Can there be some examples of code? 😢



  • On 01/08/2018 at 09:47, xxxxxxxx wrote:

    I need to ask for a bit of patience. I try to follow up on this as soon as possible. Promised.



  • On 01/08/2018 at 23:39, xxxxxxxx wrote:

    Hi,

    sorry, it took so long. Don't be frustrated, I'm sure we can get you there.

    Which version of Cinema 4D are you using?
    There was a bug with retrieving BaseContainers in R18, which got fixed with R19 SP1. To me it sounds a bit like you may experience this bug. Fortunately you can work around it, see this thread: Plugin Specific Data not set

    In any case, if it's just about storing index values of points, a BaseContainer should be perfectly fine, there's absolutely no need to mess around with custom data types.



  • On 02/08/2018 at 04:55, xxxxxxxx wrote:

    Solved, yes, it is R18. There is a new understanding of how to use the deformer's basecontainer. With your help, I have completed two plugins to make my character tools more flexible.This forum is really great! I will use the forum search function so that the problem can be solved without repeating it!

    Thank you for your help and patience,Andreas Block! 😄



  • On 02/08/2018 at 05:11, xxxxxxxx wrote:

    You are welcome, thanks for the kind words.
    Just Andreas, without my last name, is fine. 🙂


Log in to reply