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

    Сreation ObjectPlugin (AttributeError) [SOLVED]

    Scheduled Pinned Locked Moved PYTHON Development
    8 Posts 0 Posters 492 Views
    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 Offline
      Helper
      last edited by

      On 26/10/2016 at 03:02, xxxxxxxx wrote:

      I'm trying to create a plugin.
      I cannot get ID BOOL.
      Prompt me please where I have an error

      ConsoleLog:
      AttributeError: 'module' object has no attribute 'ID_TEST1'

      TEST\Test.pyp

      import c4d
      PLUGIN_ID = 1234390
      class Otest(c4d.plugins.ObjectData) :
       def Init(self, op) :
        print c4d.ID_TEST1,c4d.ID_TEST2,c4d.ID_TEST3
        return True
       def GetVirtualObjects(self, op, hierarchyhelp) :
        return c4d.BaseObject(c4d.Ocube)
      if __name__ == "__main__":
       c4d.plugins.RegisterObjectPlugin(id=PLUGIN_ID,str="Test",g=Otest,description="Otest",icon=None,info=c4d.OBJECT_GENERATOR)
      

      TEST\res\description\Otest.h

      #ifndef _OTEST_H_
      #define _OTEST_H_
      enum
      {
       Otest=10000,
       ID_TEST_GROUP=10014,
       ID_TEST1=1015,
       ID_TEST2=1016,
       ID_TEST3=1017,
      };
      #endif
      

      TEST\res\description\Otest.res

      CONTAINER Otest 
      {
       NAME Otest;
       INCLUDE Obase;
        
       GROUP ID_TEST_GROUP
       {
        BOOL ID_TEST1 { ANIM OFF; }
        BOOL ID_TEST2 { ANIM OFF; }
        BOOL ID_TEST3 { ANIM OFF; }
       }
      }
      

      TEST\res\strings_us\description\Otest.str

      STRINGTABLE Otest 
      {
       Otest "Otest";
       ID_TEST_GROUP "TEST";
       ID_TEST1 "TEST1";
       ID_TEST2 "TEST2";
       ID_TEST3 "TEST3";
      }
      
      1 Reply Last reply Reply Quote 0
      • H Offline
        Helper
        last edited by

        On 26/10/2016 at 04:51, xxxxxxxx wrote:

        Originally posted by xxxxxxxx

        C4D adds the resources of a registered plugin to the c4d main module and writes them to "userfolder/prefs/coffeesymbolcache". If you change your resource files, just remove this file and restart C4D. I hope this helps.

        Cheers, Sebastian

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

          On 26/10/2016 at 04:53, xxxxxxxx wrote:

          It is an issue with the Cinema 4D symbol cache. You can search here in the forum about it. Basically, the
          issue is that it is not updated when you change your description, only once when the description file is
          newly discovered by Cinema 4D.

          Personally, I never rely on the symbols to be exported into C4D. Also you can not use the symbols from
          c4d_symbols.h (for your Dialogs) anyway. I always export them into a separate file or format them so I
          can easily copy & paste them into the .pyp file.

          More information here

          https://github.com/nr-plugins/c4ddev

          https://github.com/nr-plugins/c4ddev/wiki/c4ddev_commandline#symbols

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

            On 26/10/2016 at 05:17, xxxxxxxx wrote:

            NiklasR, thank you

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

              On 27/10/2016 at 03:31, xxxxxxxx wrote:

              Tell me again. How to make ID_TEST2 inactive in this plugin?
              When you enable ID_TEST1 to do inactive ID_TEST2

              "self.Enable(c4d.ID_TEST2, False)" in def GetVirtualObjects not work

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

                On 27/10/2016 at 08:09, xxxxxxxx wrote:

                Hello,

                your plugin is a ObjectData plugin based on NodeData. There is no "Enable" function to call.

                To enable or disable parameters dynamically you have to implement NodeData.GetDEnabling().

                best wishes,
                Sebastian

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

                  On 27/10/2016 at 22:37, xxxxxxxx wrote:

                  Tell me how to block modifies curent object in polygonobject

                  Maybe so

                  def Message(self, node, type, data) :
                  	if type==c4d.MSG_EDITABLE_END:
                  		return False
                  

                  But so does not work

                  def Message after

                  "Message" function is executed after "Make Editable"?

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

                    On 28/10/2016 at 00:10, xxxxxxxx wrote:

                    Hello,

                    for questions no longer related to the thread's original topic please open a new thread. Thanks.

                    best wishes,
                    Sebastian

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