Hey sorry for gravedigging.
i have the problem that my tag plugin recognises the difference between rendering and not rendering. unfortunately it also always changes the state in the doc itself and not only in the doc that is rendered
Hey sorry for gravedigging.
i have the problem that my tag plugin recognises the difference between rendering and not rendering. unfortunately it also always changes the state in the doc itself and not only in the doc that is rendered
hey,
found the error. works exactly as i had planned. my code was correct, but i forgot to switch off use fields on the new vertex i mapped.
thanks for the help anyway!
i use a vertext map to manipulate the motion blur in redshift from an object. positive directions are no problem, but the vertext map only seems to store positive values. manipulating it afterwards via python script didn't help either.
which surprises me in particular because the documentation mentions a float as the data type.
in other tools it is easily possible to use negative float values to create the desired effect.
this script breaks an poly object into island, colorized it by random, offset to center of bounding box and some noise. after that i connects all islands again.
its super fast compared to my older "solution"
import c4d
from c4d import gui
import random
def AddVertexColor(s,center,rad):
cnt = s.GetPointCount()
tag = c4d.VariableTag(c4d.Tvertexcolor, cnt)
data = tag.GetDataAddressW()
bs = s.GetPointS()
bs.SelectAll(cnt)
done = []
points = s.GetAllPoints()
r = random.random()
for i in range(cnt):
g = (points[0]-center).GetLength() / rad
b = c4d.utils.noise.Noise(points[0]*0.01,rad)
c = c4d.Vector(r,g,b)
c4d.VertexColorTag.SetColor(data, None, None, i, c)
s.InsertTag(tag)
def main():
random.seed(666)
selection = doc.GetActiveObjects(c4d.GETACTIVEOBJECTFLAGS_NONE)
for s in selection:
center = s.GetMp()
rad = s.GetRad().GetLength()
c4d.CallCommand(12298)
c4d.CallCommand(17891)
mesh = s.GetDown()
while mesh:
AddVertexColor(mesh,center,rad)
mesh = mesh.GetNext()
c4d.CallCommand(100004768)
c4d.CallCommand(16768)
# Execute main()
if __name__=='__main__':
main()
Hey,
i use
c4d.documents.MergeDocument(doc , f, c4d.SCENEFILTER_OBJECTS | c4d.SCENEFILTER_MATERIALS | c4d.SCENEFILTER_MERGESCENE)
now i would like to group this new scene under a NULL. if i do the whole thing via obj.InsertUnder(null) i miss the materials.
which is totally logical but unfortunately not what i have in mind.
So one idea would be to insert the materials separately into the scene by checking the tags. The problem is that I can't be 100% sure that all the materials that are needed will be migrated.
Another approach would be to check which objects are already in the scene and then simply move the newly loaded ones under the zero.
So what is the best way to extend the functionality of MergeDocument to be able to specify a null object as root?
I have several object plugins and they all have the same problem - my custom caching functions work as expected until the document is saved and reopened. In that case the generator object returns an empty object. is there any kind of event I could use to force an update?
I got a setup with a stationary camera. i need to keep the object centered in my view and maximize its size but i can't change the rotation / position of my camera.
what i have so far is the following:
i calculate the center of the objekt and change the offset accordingly to center the object. now if i want to zoom in my offset calculations are wrong again.
edit:
can someone please move the thread into the right subforum?
here is a script i use to color polygon groups. unfortunately a bit slow
import c4d
from c4d import gui
import random
def main():
random.seed(666)
c4d.CallCommand(12139) # point mode
selection = doc.GetActiveObjects(c4d.GETACTIVEOBJECTFLAGS_NONE)
for s in selection:
cnt = s.GetPointCount()
tag = c4d.VariableTag(c4d.Tvertexcolor, cnt)
data = tag.GetDataAddressW()
bs = s.GetPointS()
done = []
for i in range(cnt):
if i in done: continue
r = random.random()
g = random.random()
b = random.random()
c = c4d.Vector4d(r,g,b,1)
bs.DeselectAll()
bs.Select(i)
c4d.CallCommand(12557)
sel = bs.GetAll(cnt)
for index, selected in enumerate(sel):
if not selected: continue
done.append(index)
c4d.VertexColorTag.SetColor(data, None, None, index, c)
done = list(set(done))
s.InsertTag(tag)
# Execute main()
if __name__=='__main__':
main()
forget about it. i removed the c4d.OBJECT_INPUT flag during development and forgot to add it back.
@m_magalhaes said in HOW TO REMOVE GENERATOR CHILDS WHEN CONVERTING VIA "C":
Something you can do is touching the objects either with a dependency list or directly.
Ah - i thought that touch only works with GVO. Never tried it to be honest. This solve at least the visibilty problem.
Hey,
i have built a spline gernerator that modifies a spline, when i convert the object i get my modified spline but also the hirachie remains. however i only need the new spline object.
Since GetContour() unfortunately doesn't support HirachyHelper I don't know how to hide the original objects and how to prevent the original splines from being present after the conversion.
The script change the compression method to zip not to Zips or what i expected: RLE because rle was the given value.
I need to change my exr compression to one scanline at a time but beside using a c4d default document is there any other way to change it directly in a script?
How do I prevent the cinema from running my plugin if I don't start rendering at frame 0?
Ok - than i need to use fields for 3d gradients and other scene based stuff. Thank you for the explantation.
I have a shader with a UV based texture and a 3d gradient in it the shader effector works as espected but i have no idea how to relicate this behavior with a python effector / python plugin
I builded a simple example scene to show what i need to do: uvSpaces.c4d
The shader effector works as desired but i need this behavior into one of my plugins.
The Python effector use the same technique as my plugin does and I also add a toggle for uv and worldspace
Shader Effector:
Python Effector:
After taking a deep dive into the documentation again i figure out that im thinking way to complicated. I use the Cache provided by cinema and write a custom check around it. This avoid using a cached mesh in a baseContainer and also removing a cinema4d breaking memoryleak in my plugin i just found.
So thank you.