AttributeError: Parameter value not accessible



  • On 04/02/2014 at 03:25, xxxxxxxx wrote:

    I'm getting this message from inside the GetDEnabling method:

    AttributeError: Parameter value not accessible (object unknown in Python)

    This only occurs sometimes but when it does, it stops execution.
    What could be happening? How can it be prevented?

    Rui Batista



  • On 04/02/2014 at 06:17, xxxxxxxx wrote:

    Hi Rui,

    What version of CINEMA are you running?
    An AttributeError given by GetDEnabling() in some cases was fixed with the R15 SP2.



  • On 04/02/2014 at 08:04, xxxxxxxx wrote:

    I was testing it in R14.
    Is it possible to make it work in R14 and R15?



  • On 04/02/2014 at 08:22, xxxxxxxx wrote:

    If not, how can I turn on/off parameters in the Attribute manager of my plugins, in python?



  • On 04/02/2014 at 09:34, xxxxxxxx wrote:

    Originally posted by xxxxxxxx

    If not, how can I turn on/off parameters in the Attribute manager of my plugins, in python?

    GetDEnabling() is the only method to override.

    Where's the error occurring?
    Do you include a call to the parent class GetDEnabling() in your plugin GetDEnabling()?



  • On 04/02/2014 at 11:14, xxxxxxxx wrote:

    No, I didn't.
    I don't know how to do that :-(



  • On 04/02/2014 at 11:17, xxxxxxxx wrote:

    Originally posted by xxxxxxxx

    No, I didn't.
    I don't know how to do that :-(

    So, what are you doing in GetDEnabling() to get an AttributeError?
    Could you share your code? Without any code it's difficult to tell.



  • On 05/02/2014 at 01:51, xxxxxxxx wrote:

    Here is the code:

    def GetDEnabling(self, node, id, t_data, flags, itemdesc) :

    isoff1=node[AB_ON1]
         isoff2=node[AB_ON2]
         isoff3=node[AB_ON3]

    if (id[0].id == AB_NUM_B1) : return isoff1==1
         if (id[0].id == AB_DENS_B1) : return isoff1==1
         if (id[0].id == AB_START_B1) : return isoff1==1
         if (id[0].id == AB_END_B1) : return isoff1==1
         if (id[0].id == AB_SEED_B1) : return isoff1==1

    if (id[0].id == AB_ON2) : return isoff1==1
         if (id[0].id == AB_NUM_B2) : return (isoff1*isoff2)==1
         if (id[0].id == AB_DENS_B2) : return (isoff1*isoff2)==1
         if (id[0].id == AB_START_B2) : return (isoff1*isoff2)==1
         if (id[0].id == AB_END_B2) : return (isoff1*isoff2)==1
         if (id[0].id == AB_SEED_B2) : return (isoff1*isoff2)==1

    if (id[0].id == AB_ON3) : return (isoff1*isoff2)==1
         if (id[0].id == AB_NUM_B3) : return (isoff1*isoff2*isoff3)==1
         if (id[0].id == AB_DENS_B3) : return (isoff1*isoff2*isoff3)==1
         if (id[0].id == AB_START_B3) : return (isoff1*isoff2*isoff3)==1
         if (id[0].id == AB_END_B3) : return (isoff1*isoff2*isoff3)==1
         if (id[0].id == AB_SEED_B3) : return (isoff1*isoff2*isoff3)==1

    return True



  • On 05/02/2014 at 02:05, xxxxxxxx wrote:

    Maybe CINEMA sometimes gives an empty id variable.
    Have you tried to print its value at the beginning of GetDEnabling()?



  • On 05/02/2014 at 03:03, xxxxxxxx wrote:

    I had tried performing a check, with:

    if id is None: return

    But the error still appears.



  • On 05/02/2014 at 07:58, xxxxxxxx wrote:

    This is probably a long shot. But since you're stuck maybe it's worth trying.
    Take a look at this example code and how the [] brackets are used for the returns.
    And return the super class instead of returning True.

    #This is an example how to hide or grey out a userdata entry in a plugin's GetDEnabling() method  
      
    def GetDEnabling(self, node, id, t_data, flags, itemdesc) :  
      
      if (id[0].id == MY_SPLINE_ID) :  
          return node[MY_CHECKBOX_ID] == 1  
      else:  
          return c4d.plugins.NodeData.GetDEnabling(self, node, id, t_data, flags, itemdesc)
    

    Maybe it's picky about these things?

    -ScottA



  • On 05/02/2014 at 08:14, xxxxxxxx wrote:

    The error message indicates something different. This exception is also raised if you try to access
    a CustomDataType from a BaseContainer which can not be represented in Python. What sorts
    of Parameters are in the description of your plugin? What is the exact line the error is raised at?



  • On 05/02/2014 at 09:00, xxxxxxxx wrote:

    I tried it and it still returns that error.
    I also tried the following:

    def GetDEnabling(self, node, id, t_data, flags, itemdesc) :

    return c4d.plugins.NodeData.GetDEnabling(self, node, id, t_data, flags, itemdesc)

    So, it returns right after entering the method. And the error still happens.

    And I also tried:

    def GetDEnabling(self, node, id, t_data, flags, itemdesc) :

    return True

    And the error still happens.



  • On 05/02/2014 at 09:14, xxxxxxxx wrote:

    I don't know what is line where the error is raised. It does not show up in the Console. Only the sentence:

    AttributeError: Parameter value not accessible
    AttributeError: Parameter value not accessible
    AttributeError: Parameter value not accessible

    Yes, three times, each time the object is created or the document is refreshed.
    What do you mean by parameters in the description? The parameters in the plugins.RegisterPlugin command?



  • On 05/02/2014 at 09:33, xxxxxxxx wrote:

    Could you post your description resource file? The .res file in res/description/



  • On 05/02/2014 at 09:41, xxxxxxxx wrote:

    CONTAINER arbor
    {
         NAME arbor;
         INCLUDE Obase;

    GROUP ID_OBJECTPROPERTIES
              {
              GROUP
                   {
                   BITMAPBUTTON AB_PIC_HEADER1 { ICONID1 1029369; ALIGN_LEFT; }
                   }
              
              SEPARATOR { LINE; }

    LINK AB_TRUNK { ACCEPT {Obase;} }
              
              GROUP
                   {
                   LONG AB_SEGMENTS { MIN 1; MAX 20; }

    SEPARATOR { LINE; }

    LONG AB_SPLINE_TYPE
                        {
                        CYCLE
                             {
                             AB_TP_LINEAR;
                             AB_TP_CUBIC;
                             AB_TP_AKIMA;
                             AB_TP_BSPLINE;
                             }
                        }

    LONG AB_SUBDIVISIONS { MIN 0; MAX 20; }
                   }

    SEPARATOR { LINE; }

    LONG AB_SEED1 { MIN 1; MAX 999999; }

    }

    GROUP AB_B1
              {
              GROUP
                   {
                   BITMAPBUTTON AB_PIC_HEADER2 { ICONID1 1029369; ALIGN_LEFT; }
                   }

    SEPARATOR { LINE; }

    BOOL AB_ON1 {}

    SEPARATOR { LINE; }

    LONG AB_NUM_B1 { MIN 1; MAX 20;}
              REAL AB_START_B1 { MIN 0.0; MAX 99.0; UNIT PERCENT; CUSTOMGUI REALSLIDER; }
              REAL AB_END_B1 { MIN 1.0; MAX 100.0; UNIT PERCENT; CUSTOMGUI REALSLIDER; }
              REAL AB_DENS_B1 { MIN 10.0; MAX 200.0; UNIT PERCENT; CUSTOMGUI REALSLIDER; }

    SEPARATOR { LINE; }

    LONG AB_SEED_B1 { MIN 1; MAX 999999; }
              }

    GROUP AB_B2
              {
              GROUP
                   {
                   BITMAPBUTTON AB_PIC_HEADER3 { ICONID1 1029369; ALIGN_LEFT; }
                   }

    SEPARATOR { LINE; }

    BOOL AB_ON2 {}

    SEPARATOR { LINE; }

    LONG AB_NUM_B2 { MIN 0; MAX 20;}          
              REAL AB_START_B2 { MIN 0.0; MAX 99.0; UNIT PERCENT; CUSTOMGUI REALSLIDER; }
              REAL AB_END_B2 { MIN 1.0; MAX 100.0; UNIT PERCENT; CUSTOMGUI REALSLIDER; }
              REAL AB_DENS_B2 { MIN 10.0; MAX 200.0; UNIT PERCENT; CUSTOMGUI REALSLIDER; }

    SEPARATOR { LINE; }

    LONG AB_SEED_B2 { MIN 1; MAX 999999; }
              }

    GROUP AB_B3
              {
              GROUP
                   {
                   BITMAPBUTTON AB_PIC_HEADER4 { ICONID1 1029369; ALIGN_LEFT; }
                   }

    SEPARATOR { LINE; }

    BOOL AB_ON3 {}

    SEPARATOR { LINE; }

    LONG AB_NUM_B3 { MIN 0; MAX 20;}
              REAL AB_START_B3 { MIN 0.0; MAX 99.0; UNIT PERCENT; CUSTOMGUI REALSLIDER; }
              REAL AB_END_B3 { MIN 1.0; MAX 100.0; UNIT PERCENT; CUSTOMGUI REALSLIDER; }
              REAL AB_DENS_B3 { MIN 10.0; MAX 200.0; UNIT PERCENT; CUSTOMGUI REALSLIDER; }

    SEPARATOR { LINE; }

    LONG AB_SEED_B3 { MIN 1; MAX 999999; }
              }

    GROUP ABOUT
              {
              GROUP
                   {
                   BITMAPBUTTON AB_PIC_HEADER5 { ICONID1 1029369; ALIGN_LEFT; }
                   }

    SEPARATOR { LINE; }

    STATICTEXT ABOUT_ME1 { ANIM OFF; }
              SEPARATOR {LINE;}
              STATICTEXT ABOUT_ME2 { ANIM OFF; }
              }
    }



  • On 05/02/2014 at 16:52, xxxxxxxx wrote:

    Thanks, Rui, I was able to reproduce the problem. I'll take a deep look into it. I've reconstructed your 
    problem in this project:

    https://dl.dropboxusercontent.com/u/99829745/stuff/2014-02-06-getdenabling-parentcall-issue.zip

    Best,
    -Niklas



  • On 05/02/2014 at 17:02, xxxxxxxx wrote:

    I started removing sections of the description with each restart of Cinema until I found what caused the
    issue. It is the BITMAPBUTTON GUIs that cause the exception in the parent call of GetDEnabling().

    Unfortunately, even if you remove your bitmap buttons, it sometimes fails with a TypeError:

    Traceback (most recent call last) :
      File "'test.pyp'", line 8, in GetDEnabling
    TypeError: argument 5
    

    Which is also a known issue of R14 and was fixed in R15. See https://plugincafe.maxon.net/topic/6533/7047_getdenabling-typeerror-on-parentcall

    As a workaround for this issue (and the original if you want to keep your BITMAPBUTTONs) , you can
    use a try-catch block.

        def GetDEnabling(self, *args, **kwargs) :
            # ...
            try:
                return c4d.plugins.ObjectData.GetDEnabling(self, *args, **kwargs)
            except TypeError:
                return True
    

    Best,
    -Niklas



  • On 06/02/2014 at 01:52, xxxxxxxx wrote:

    Thank you for the information, Niklas.

    I tried the following:

    def GetDEnabling(self, node, id, t_data, flags, itemdesc) :

    try:
                   return c4d.plugins.NodeData.GetDEnabling(self, node, id, t_data, flags, itemdesc)

    except AttributeError:
                   return True

    isoff1=node[AB_ON1]
              isoff2=node[AB_ON2]
              isoff3=node[AB_ON3]

    if (id[0].id == AB_NUM_B1) : return isoff1==1
              if (id[0].id == AB_DENS_B1) : return isoff1==1
              if (id[0].id == AB_START_B1) : return isoff1==1
              if (id[0].id == AB_END_B1) : return isoff1==1
              if (id[0].id == AB_SEED_B1) : return isoff1==1

    if (id[0].id == AB_ON2) : return isoff1==1
              if (id[0].id == AB_NUM_B2) : return (isoff1*isoff2)==1
              if (id[0].id == AB_DENS_B2) : return (isoff1*isoff2)==1
              if (id[0].id == AB_START_B2) : return (isoff1*isoff2)==1
              if (id[0].id == AB_END_B2) : return (isoff1*isoff2)==1
              if (id[0].id == AB_SEED_B2) : return (isoff1*isoff2)==1

    if (id[0].id == AB_ON3) : return (isoff1*isoff2)==1
              if (id[0].id == AB_NUM_B3) : return (isoff1*isoff2*isoff3)==1
              if (id[0].id == AB_DENS_B3) : return (isoff1*isoff2*isoff3)==1
              if (id[0].id == AB_START_B3) : return (isoff1*isoff2*isoff3)==1
              if (id[0].id == AB_END_B3) : return (isoff1*isoff2*isoff3)==1
              if (id[0].id == AB_SEED_B3) : return (isoff1*isoff2*isoff3)==1

    return c4d.plugins.NodeData.GetDEnabling(self, node, id, t_data, flags, itemdesc)

    But I still get the same error :-(



  • On 06/02/2014 at 17:51, xxxxxxxx wrote:

    I tried it out in R15 and the error also occurs there.


Log in to reply