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
    • Recent
    • Tags
    • Users
    • Login

    include Oextrude

    Scheduled Pinned Locked Moved PYTHON Development
    3 Posts 0 Posters 289 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 09/03/2015 at 10:53, xxxxxxxx wrote:

      Hello guys. Sorry if this is confusing, there's lots of stuff going on.

      Any ways, I am creating a c4d.OBJECT_GENERATOR with VirtualObject;

      In the User Interface I want to have controls that are available in Extrude Nurbs object (Movement, Subdivisions, Caps etc) + my custom controls. So my res file looks like this:

        
      CONTAINER Omyplugin   
      {   
          NAME Omyplugin;   
          INCLUDE Obase;   
        
          GROUP ID_OBJECTPROPERTIES   
          {   
              INCLUDE Oextrude;           # <------- This is where I add Extrude Nurbs controls   
          }   
        
          GROUP GROUP_MESH        # <---------- My custom controls are in new tab   
          {   
           LINK LINK_PROFILESPLINE { ACCEPT { Ospline; Osplinecircle; Osplineprofile; Osplinecontour; Osplinerectangle;   
            Osplinestar; Osplinecogwheel; Osplineflower; Osplinetext; Ospline4side; Osplinenside; 440000054; 1019396; } }   
           REAL MY_NUMBER { MIN 2; MAX 10000; STEP 1; UNIT REAL; }   
      .. etc   
        
          }   
      }   
      

      .h file is like this:

        
      #ifndef _Omyplugin_H_   
      #define _Omyplugin_H_   
        
      enum   
      {        
          GROUP_MESH               = 9000,     # <------ Tab name   
          LINK_PROFILESPLINE          = 1000,     # <------- Instance object   
          MY_NUMBER     = 1001,   
      ...etc   
      };   
      #endif   
      

      .str file:

        
      STRINGTABLE Omyplugin   
      {   
          Omyplugin "Spline Object";   
        
          GROUP_MESH "Generate";   
              LINK_PROFILESPLINE      "Spline Object";   
              MY_NUMBER     "Number of Slices";   
      ..etc   
      

      Then in .pyp file right after "import c4d" and other imports I declare my controls "LINK_PROFILESPLINE = 1000, MY_NUMBER = 1001" etc and set default value for them like this

        
      class MYPLUGIN(plugins.ObjectData) :   
          def __init__(self) :   
              self.SetOptimizeCache(True)   
        
          def Init(self, op) :   
              # Set default values   
              op[MY_NUMBER]   = 10    # <---------- Set 10 as default value   
              ...etc   
      

      NOW THE PROBLEM is that MY NUMBER values updates when changing values in SUBDIVISIONS and vice versa. I DON"T WANT IT!!!
      I probably missed something, didn't initiate Oextrude controls or something - but I have no idea how to do that. What am I missing?

      Thank you

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

        On 09/03/2015 at 11:40, xxxxxxxx wrote:

        Apparently problem goes away once I change MY_NUMBER = 1001 ID to something else in H and PYP files.
        Looks like default ID forc4d.EXTRUDEOBJECT_SUB is also 1001, that's why my values are get messed up.

        However, I'd like to know if I could assign another ID for c4d.EXTRUDEOBJECT_SUB and mess up with my ID that I set for MY_NUMBER.

        Is it doable? Any ideas?

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

          On 09/03/2015 at 12:37, xxxxxxxx wrote:

          I keep answering my own questions:)
          Apparently it's not possible to override default ID's. Had to find it out the hard way. Here's a topic that talks about Ospline, witch is similar to what I need.
          http://forums.cgsociety.org/archive/index.php/t-1044085.html

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