On 23/03/2017 at 14:02, xxxxxxxx wrote:
I'm playing about with python effectors again, trying to figure out best approach to controlling clones based on their source object names..
I made a cloner with a range of motext objects inside; 0 .. 9, a.. b, A.. B
My end goal is to be able to set clones to specific characters at specific indices.
So far I have found out about the MODATA_CLONE id value, which defines which cloner child object to use at the specified index.
This is sort of useful I think, but is it the best method for what I want;
Since I couldn't find any easy way to access the name (maybe I missed something obvious?)
I am trying to figure out a way to do it with this MODATA_CLONE value:
I could get all the childs of the cloner object, as an array, look up the letter which I would like to set at a specific index in the cloner, using something like:
def getCValue(childArray, letter) : length = len(childArray) for i, L in enumerate(childArray) : if str(letter) in L.GetName() : return float(i)/length
then to set the new values
childs = clonerObj.GetChildren() value = getCValue(childs, "a") md.SetArray(c4d.MODATA_CLONE, fillArray(value, cnt),True)
This works, but very dodgy-ly as you might imagine, most of the letters work and set the correct clones but sometimes it doesn't work and it's off by one character, I assume because its not quite matching up with the float value which the cloner uses.
Is there a more surefire way to get/set which object is used at a specific index?
Is this the best way to do this?
Thanks for your time!