On 11/09/2013 at 11:08, xxxxxxxx wrote:
I'm trying to set the XRay parameter of a sphere created with an ObjectPlugin.
However, it is not working in R13, R14 or R15?
Note: Changing the radius in working.
Here is the code:
import c4d, os, sys
from c4d import bitmaps, documents, gui, modules, plugins, utils
PXRAY = 1027
PPREVIEWSIZE = 1028
class C4DEnvironment(plugins.ObjectData) :
def Init(self, op) :
op[PXRAY] = False
op[PPREVIEWSIZE] = 150
return True
def GetVirtualObjects(self, node, hierarchyhelp) :
doc = documents.GetActiveDocument()
c4dnull = c4d.BaseObject(c4d.Onull)
c4dnull[c4d.ID_BASELIST_NAME] = "C4Dome"
preview = c4d.BaseObject(c4d.Osphere)
preview.InsertUnder(c4dnull)
preview[c4d.ID_BASEOBJECT_XRAY] = node[PXRAY]
preview[c4d.PRIM_SPHERE_RAD] = node[PPREVIEWSIZE]
return c4dnull
if __name__ == "__main__":
pluginstr = "XRAY TEST"
path, file = os.path.split(__file__)
bmp = bitmaps.BaseBitmap()
bmp.InitWith(os.path.join(path, "res", "lonlatsweep.tif"))
okyn = plugins.RegisterObjectPlugin(id = 102972625,
str = pluginstr,
g = C4DEnvironment,
description = "c4de", #link naar res directory, etc.
icon = bmp,
info = c4d.OBJECT_GENERATOR)
if (okyn) :
print pluginstr + " initialized."
else: print "Error initializing " + pluginstr
And here the res file:
CONTAINER c4de
{
NAME c4de;
INCLUDE Obase;
GROUP SETTINGS
{
BOOL PXRAY {}
REAL PPREVIEWSIZE { MIN 0; MAX 1000; STEP 1;}
}
}