Make Hair Editable according to animation
On 13/10/2015 at 03:06, xxxxxxxx wrote:
Cinema 4D Version: R17
Platform: Windows ;
Language(s) : C++ ;
I try to make hair objects editable according to the current frame.
For primitives, i use ExecutePasses(any_thread,TRUE,TRUE,TRUE,BUILDFLAGS_EXTERNALRENDERER);
to apply the animation to the objects and then making editable. But it seems it doesnt work the same with hair since it doesn't have keyframes.
In a scene consisting of 30 frames with 2-3 animated objects and hair wrapping a sphere, the objects are rendered fine but the hair stay the same as in initial frame.
What can i do to apply the animation to the hair as well ?
On 14/10/2015 at 11:26, xxxxxxxx wrote:
I'm terribly sorry, but I'm not sure I understand. On the one hand you ask how to make a hair object editable at a specific frame. I assume you are talking about spline or polygonal hair here, right? And on the other hand you talk about rendering an animation.
Can you perhaps explain, in what situation (plugin type, function) you are trying to do what?
Please bear with me, maybe I'm a bit slow today.
But I played around a bit with a Python script and assuming you are talking about polygon hair. ExecutePasses() does the job for me, but as hair is a simulation you have to make sure, you simulate every frame.
Here's my script (please forgive, posting a Python script in the C++ forum, but I think you get the idea) :
import c4d from c4d import utils def main() : for t in range(0, 30) : doc.SetTime(c4d.BaseTime(t, doc.GetFps())) doc.ExecutePasses(None, True, True, True, c4d.BUILDFLAGS_INTERNALRENDERER) c4d.EventAdd() hair = doc.SearchObject("Hair") settings = c4d.BaseContainer() objResult = utils.SendModelingCommand(command = c4d.MCOMMAND_CURRENTSTATETOOBJECT, list = [hair], mode = c4d.MODELINGCOMMANDMODE_ALL, bc = settings, doc = doc) doc.InsertObject(objResult) c4d.EventAdd() if __name__=='__main__': main()
On 15/10/2015 at 03:56, xxxxxxxx wrote:
My scene consists of a sphere and a hair object.
In the document i use 60 frames total.
As i see i don't have to add key frames myself.
- Does each frame of the whole track bar is considered a separate keyframe ?
I have used your code and it works. I had to use the ExecutePasses for all the previous frames of the one i want to render.
2) Is this necessary ?
Thank you very much.
On 15/10/2015 at 05:39, xxxxxxxx wrote:
There are no keyframes, just frames. As a simulation, the initial conditions and parameters over the simulation dictate what happens at each frame of the animation.
Since the animation is a simulation, the result at frame n is dependent upon the results of frame 1-(n-1), so it is necessary unfortunately. Using the cache for hair dynamics simulation might help expedite the process.
On 16/10/2015 at 02:10, xxxxxxxx wrote:
Thank you very much for your explanation !
Instead of executing the N-1 passes, can i get the result at frame N directly from hair Cache ? (if it has been already calculated)