Thanks for looking at this. Does this main that it is at least on the "to do" list again?
Does it still work in c++
J
Posts made by james.thamesview
-
RE: Python reading fields issue
-
Python reading fields issue
Dear community,
is it possible that the method c4d.modules.mograph.FieldInfo.Create() is (currently) bugged ie from 2024 onwards?
As an example:
, (and simplified it a little)
I took this script fromimport c4d from c4d.modules.mograph import FieldInput, FieldInfo, FieldOutput def fieldlist_sampling(op, doc, poslist, fields): pCount = len(poslist) sample_flags = c4d.FIELDSAMPLE_FLAG_VALUE | c4d.FIELDSAMPLE_FLAG_COLOR fieldInput = FieldInput(poslist, allocatedCount=pCount) fieldInfo = FieldInfo.Create(sample_flags, None, doc, 0, 1, fieldInput, op) fieldOutput = FieldOutput.Create(pCount, sample_flags) fields.DirectInitSampling(fieldInfo) samplingSuccess = fields.DirectSample(fieldInput, fieldOutput.GetBlock(), fieldInfo) fields.DirectFreeSampling(fieldInfo) return fieldOutput def main(): count =5 distance = 225 fields = op[c4d.ID_USERDATA,1] null = c4d.BaseObject(c4d.Onull) if not count: return null div = ((count-1)/2)*distance poslist = [c4d.Vector((distance*c)-div,0,0) for c in range(0,count)] samp_list = fieldlist_sampling(op, doc, poslist, fields) # samp_list._value for n,p in enumerate(poslist): cube = c4d.BaseObject(c4d.Ocube) cube.SetRelPos(p) value = c4d.utils.RangeMap(value=samp_list._value[n], mininput=0, maxinput=1, minoutput=20, maxoutput=150, clampval=False) cube[c4d.PRIM_CUBE_LEN] = c4d.Vector(value) cube[c4d.ID_BASEOBJECT_USECOLOR] = 2 cube[c4d.ID_BASEOBJECT_COLOR] = samp_list._color[n] cube.InsertUnder(null) return null
It is for a python generator with a field list in user data (id=1), field list contains a linear field.
When the field is moved the cubes change size and colour, the script is not perfect, it's just to demonstrate.The generator works on 2023 and below but not in 2024 and above
This it the running in 2023:
and this is 2025