Hey Leo,
I think this thread from earlier is what you need using a python effector.
https://developers.maxon.net/forum/topic/10968/python-effectors/5
Hey Leo,
I think this thread from earlier is what you need using a python effector.
https://developers.maxon.net/forum/topic/10968/python-effectors/5
Thank you m_adam that works perfectly now. Is that bug in all versions of cinema?
Hey Leo,
I think this thread from earlier is what you need using a python effector.
https://developers.maxon.net/forum/topic/10968/python-effectors/5
Hey,
I'm trying to control a shader from some userdata but I keep getting this error:
Traceback (most recent call last):
File "'Python'", line 6, in main
AttributeError: parameter access failed
I'm not sure what I'm missing here.
https://www.dropbox.com/s/0pvpjbiiofqdwg5/LinkShader_Py.c4d?dl=0
import c4d
def main():
ShaderOb = op[c4d.ID_USERDATA,3]
ShaderOp = op[c4d.ID_USERDATA,c4d.ID_MG_SHADER_SHADER]
ChannOp = op[c4d.ID_USERDATA,c4d.ID_MG_SHADER_CHANNELSELECT]
ShaderOb[c4d.ID_MG_SHADER_SHADER] = op[c4d.ID_USERDATA,c4d.ID_MG_SHADER_SHADER]
ShaderOb[c4d.ID_MG_SHADER_CHANNELSELECT] = op[c4d.ID_USERDATA,c4d.ID_MG_SHADER_CHANNELSELECT]
Yeah I have control of all my userdata and objects already. Maybe this linked file will help? Both objects have the same userdata on the attached tag but the plugin version attaches it's userdata to the parent object like the phong tag does.
https://www.dropbox.com/s/11hrs39qhhayqpk/PythonTag_Test_v1.c4d?dl=0
Thanks y_puech, so is there no way to give a python tag the same functionality that comes when you add a plugin tag to an object? That seems to share userdata with the object it's attached to.
Hi, I'm transferring an expresso setup I have into a python tag object. I have my python tag attached to a null in the scene and I'd like to be able to see the userdata of the python tag attached to the null like I can if I add a Compositing tag. I tried this code below but that only copies the userdata instead of linking it. Any ideas would be super helpful!
import c4d
from c4d import gui
def main():
target = op[c4d.ID_USERDATA,5] #The null I want to transfer the userdata to
obj = op #The userdata I want to transfer
for id, bc in obj.GetUserDataContainer():
target.SetUserDataContainer(id, bc)
block = op [c4d.ID_USERDATA,4]
color = op [c4d.ID_USERDATA,2]
block[c4d.ID_BASEOBJECT_COLOR] = c4d.Vector(color)
Thanks dskeith, that code worked perfectly. Thanks for that!
Hi everyone,
I've made a simply python effector that allows me to manipulate the color of a effected cloner. That works fine but when I creat an instance of that object and start moving it in 3D space, I get a ton of these errors:
Traceback (most recent call last):
File "'<Python>'", line 18, in main
TypeError: object of type 'NoneType' has no len()
https://www.dropbox.com/s/4cui1f7t8a1l0n9/PyEffectorTest_v1.c4d?dl=0
import c4d
from c4d.modules import mograph as mo
#Welcome to the world of Python
def main():
linked = op[c4d.ID_USERDATA,1]
md = mo.GeGetMoData(op)
md2 = mo.GeGetMoData(linked)
EB = op[c4d.ID_USERDATA,2]
if md is None: return False
cnt = md.GetCount()
clr = md.GetArray(c4d.MODATA_COLOR)
clr2 = md2.GetArray(c4d.MODATA_COLOR)
if cnt > 0:
print cnt
#for i in xrange(0,cnt):
#clr[i] = clr2[i] + (clr2[i] * c4d.Vector(EB))
md.SetArray(c4d.MODATA_COLOR, clr, True)
return True
c4d.EventAdd()
if __name__=='__main__':
main()
Does anyone have an idea how to get around this?