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

    Shaderlink not displaying

    Scheduled Pinned Locked Moved PYTHON Development
    2 Posts 0 Posters 152 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 23/06/2014 at 05:07, xxxxxxxx wrote:

      I have a ObjectPlugin with a ShaderLink in the Res file.
      I can set the link, but the link is not displayed. Also when reading the Link I get None, although I set it to a Noise Shader in Init();
      When I set the Link by hand it works and I can read it.

      Here the code.

      import c4d, os, sys
      from c4d import bitmaps, documents, gui, modules,  plugins, utils
        
      #shaderlink test
        
      SHADER      = 9001    
        
      class ShaderlinkTest(plugins.ObjectData) :
          def __init__(self) :
              self.lastframe = False
        
          def Init(self, op) :
              #self.InitAttr(op, link, [SHADER])
              shd = c4d.BaseList2D(c4d.Xnoise)
              op[SHADER]= shd
              print "shd - op[SHADER]: ", shd, op[SHADER]		#seems ok
              return True
        
          def GetVirtualObjects(self, node, hierarchyhelp) :
              print "Shader: ", node[SHADER]				#always None if not set by hand.
              return None
                  
      if __name__ == "__main__":
        
          pluginstr = "Shaderlink v01"
        
          path, file = os.path.split(__file__)
          bmp = bitmaps.BaseBitmap()
          bmp.InitWith(os.path.join(path, "res", "twe.png"))
                             
          okyn = plugins.RegisterObjectPlugin(id = 1029726, str = pluginstr, g = ShaderlinkTest, description = "twe", icon = bmp, info = c4d.OBJECT_GENERATOR)
        
      

      Here the Res file.

      CONTAINER twe
      {
      	NAME twe;
          INCLUDE Obase;
          
          GROUP PARAMS
          {
              BOOL SHOWCON {}
              SHADERLINK SHADER { }
          }   
      		
      }
      
      1 Reply Last reply Reply Quote 0
      • H Offline
        Helper
        last edited by

        On 23/06/2014 at 06:03, xxxxxxxx wrote:

        Again, I did not read other posts good enough.
        I have to store the shader first of course.

        op.InsertShader(shd)

        This now works.

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