Wrong random clone displayed issue
-
Hi @jochemdk, thanks a lot looks like you found a bug. I opened a bug report to our development team
Another workaround is to use the effector not to define the visibility of an object but to define its scale to absolute 0.
This is more efficient since you don't have to re-enable the effector (which can be an issue and cause other dirty issues) since the effector needs to change the data generated by the cloner.Cheers,
Maxime. -
@m_adam
Thx I thought it was a bug... I know how to control stuff myself, but this is about catching all kinds of things from "some" user's hierarchy - including cloners in cloners and animated moSelections/Weights. -
This post is deleted! -
@m_adam
Hi, I did some more testing…Things only go wrong with a linearCloner’s offset if:
_ any applied baseEffector has the visibility check turned on
_ has a mograph selection/weight tag
_ and if a linearCloner’s offset >= the smallest index of the selection
_ (so random has nothing to do with it -
Thanks a lot for your additional testing, I will for sure attach it to the bug report
-
@m_adam
Hi Maxime, One additional remark + a question…I’m trying to build a minimum set of rules to avoid the dis/enabling of effectors if not really necessary. I can’t use moFlags to check whether a clone is visible or not, and that’s where the issue might be:
1_ Given the example in the previous post (with offset 2), the moFlags read something like [2,2,2,1,0,1,…..]. Flag 2 being “permanently disabled”. If it means that behind the scenes index 2 is totally ignored, this is where the problem might be…
2A_ So reading moFlags doesn’t give me the info I need. For the moSelections I was able to find the first index of an invisible clone via “baseSelection.GetAll(count)”. So everything fine here…
2B_ I’ve spend many hours trying to find a formula to find the (first) invisible clone with moWeights. Given any weight float value between 0 & 1, a clone gets invisible based on the strength & maximum value sliders (which are not limited and can go way past +/- 100%..).
The question: What is the formula (with strength & maximum) to check whether a weighted clone gets invisible?
Tia, Jochem
(If you want I can start a new thread, but this is so closely related…)One function added in the script below:
""" After some code I know which linearCloners have a moSel/Weight tag with the same name as the baseEffector selection string... Per effector - with visibility turned on - I run the func below to check what the minimal offset is (for multiple cloners) & return "update" True if the minOffset is >= the selection index where a clone gets invisible... The passed moSelDict has selection strings as keys & indices of an inexList as values. """ def checkUpd(effector, moSelDict): minOff = 999999 minSelIdx = 999998 for moInd in moSelDict[effector[c4d.ID_MG_BASEEFFECTOR_SELECTION]]: moObj = op[c4d.ID_USERDATA,5].ObjectFromIndex(doc,moInd) # moObj = cloner / index from a linearCloner in-exclusion list.. if moObj[c4d.MG_LINEAR_OFFSET] < minOff: minOff = moObj[c4d.MG_LINEAR_OFFSET] for tag in moObj.GetTags(): if tag.CheckType(1021338) and tag.GetName() == effector[c4d.ID_MG_BASEEFFECTOR_SELECTION]: # selection bs = mograph.GeGetMoDataSelection(tag) count = moObj[c4d.MG_LINEAR_COUNT] + moObj[c4d.MG_LINEAR_OFFSET] try: minSel = bs.GetAll(count).index(1) # << here is where I can find the correct (in)visible selection values for moSelections except ValueError: break # selectionTag with no selection.. if minSel < minSelIdx: minSelIdx = minSel break elif tag.CheckType(440000231) and tag.GetName() == effector[c4d.ID_MG_BASEEFFECTOR_SELECTION]: # weight strength = effector[c4d.ID_MG_BASEEFFECTOR_STRENGTH] maximum = effector[c4d.ID_MG_BASEEFFECTOR_MAXSTRENGTH] # WHAT IS THE FORMULA TO GET (IN)VISIBLE STATE OF A WEIGHTED CLONE, BASED ON THE 2 VALUES ABOVE?.. bs = mograph.GeGetMoDataWeights(tag) minSel = 999999 for w in range(len(bs)): if bs[w] > 0.0: # << this is of course not optimal :) minSel = w break if minSel < minSelIdx: minSelIdx = minSel break if minOff >= minSelIdx: return True return False
Edit:
It turns out I need a formula for the strength/maximum values for the moSelection version as well. I plotted some values (in excel:) for various combinations of strength/maximum with moSelections/moWeights. All show an exponential growth(/decay) curve... I know you're not supposed to write scripts for others, but if you've got some code lying around - it would be brilliant. -
Hi sorry for the late reply,
Just to let you know I'm still on it.
For the moment I didn't found such a formula.
There are multiple passes to calculate the real strength then at the end there isSetBit(mdflags[i], MOGENFLAG_CLONE_ON, vis > 0.5_f);
But I will keep searching since for the moment I only looked at how Mograph works in general and not particularity to the linear Cloner.
Note that since workaround exists (aka setting clone scale to absolute -1), I do this research as low-priority (so when I get time)
Cheers,
Maxime. -
@m_adam
Thx anyway, hope to hear from you one day... all the best for the next year -
Hi, unfortunately, I didn't get the time to get back to the topic, and I'm pretty doubtfully to find time for it, as a workaround exist (of course this is far from perfect but I can't do more)
There is no clear formula but it's a mixture of multiple layers of Addition + Removal according to some conditions, which makes it very hard to produce a clear formula over the result.
Sorry, I hope you didn't have too much hope regarding my investigation.
Cheers,
Maxime. -
Hi @jochemdk,
without further questions or feedback, we will consider this thread as solved by Monday and flag it accordingly.
Cheers,
Ferdinand