Shaderlink not displaying
-
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 { } } }
-
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.