Your browser does not seem to support JavaScript. As a result, your viewing experience will be diminished, and you have been placed in read-only mode.
Please download a browser that supports JavaScript, or enable it if it's disabled (i.e. NoScript).
Hello @jferdinand, Apologies for the delay, I examined your example some time ago and I suspect that it does not solve my problem, activating "frame-dependent" causes the update to stop, and it is present in animation again, my intention is to completely remove that delay, both in editor and in animation.
Any kind of help is appreciated.
I apologize, the translator does not help much, as I said, I created a spline chain, where the depth of its handles depends on the length of the spline, my problem was that when I did it with only xpresso, it showed errors when rotating, because it took time update.
thinking that the error was either hierarchy, the spline node, or how to order the xpresso I did the same thing but with a python tag, despite this the same problem was present.
import c4d #Welcome to the world of Python def main(): spline = op[c4d.ID_USERDATA,2] # spline object length = c4d.utils.SplineLengthData(spline) length.Init(spline) Long = length.GetLength() op[c4d.ID_USERDATA,1][10004] = Long /3.783 #[10004] = control depth 1 iKsplinetag op[c4d.ID_USERDATA,1][10014] = Long /3.783 #[10014] = control depth 2 iKsplinetag length.Free() c4d.EventAdd()
And speaking of the number "3,783" I used it only for my purpose as it corrected the strength of the depth of the controls SplineL.c4d
I was trying to include the login data inside the spline handlers but I had updating errors, I thought it was due to hierarchy but I ended up using python tags and still I had the same error, I don't know what's happening.
SplineL.c4d
Hello @ferdinand Thank you very much, I had no idea about that, I did know that Mpoints or Mpolygons existed, but it always related to me with ViewportSelect, this answers my question, I will investigate more about this.
Mpoints
Mpolygons
ViewportSelect
Hello @ferdinand , Thanks for the explanation, but in my case I meant this: I need to make changes to these options, although it is true that they can be done by callcomands, I am interested in knowing if it is possible to avoid their use, I did some research, but didn't find much, I guess it's possible, and I probably didn't understand. still thank you very much for your contribution
It required to make a change of the mode type of the Viewport, when doing it I wondered if there was any way to do the same function without using callcomands. Is it possible?
Hello @ferdinand, Thank you! His proposal was the best way to solve my problem. Greetings, JH23
To be honest, I don't even know what happens, the line of code that I put is all the code there is, even so, I admit that I could not explain myself well. I tried what you proposed and didn't see much of a difference, but trying a few things I solved my problem as follows
Code before correcting
import c4d from c4d import gui def main(): c4d.documents.MergeDocument(doc,'preset://name',c4d.SCENEFILTER_MATERIALS | c4d.SCENEFILTER_OBJECTS)) if __name__=='__main__': main()
Corrected code
import c4d from c4d import gui def main(): doc.StartUndo() doc.AddUndo(c4d.UNDOTYPE_NEW, c4d.documents.MergeDocument(doc,'preset://name',c4d.SCENEFILTER_MATERIALS | c4d.SCENEFILTER_OBJECTS)) doc.EndUndo() c4d.EventAdd() if __name__=='__main__': main()
Even so, I would like to investigate your proposal and I really appreciate your help.
I have been using commonly what is
c4d.documents.MergeDocument(doc,'preset://direction',c4d.SCENEFILTER_OBJECTS | c4d.SCENEFILTER_MATERIALS)
that does not present errors when reversing its action, but an error that I realized is that if I try to return to when I had the preset (for this the preset had texture) it doesn't load its texture or if it does load I had to go back several times, does anyone know why this happens?
Hi Thank you for solving my question, and thank you very much also for the advice.
@m_magalhaes
Hi
in itself the problem is that when performing the complete action when going back the object is outside the father, since it was first created and later placed inside the father
import c4d from c4d import documents, plugins def main(): c4d.documents.MergeDocument(doc,"file location",7) #the preset has already been added doc.StartUndo() child = doc.GetActiveObjects(c4d.GETACTIVEOBJECTFLAGS_NONE) for A in child: doc.AddUndo(c4d.UNDOTYPE_CHANGE, A) A.InsertUnder(father)#the parent would be defined by a link doc.EndUndo() c4d.EventAdd()
I did this since when adding the preset it is already selected, use this to place it inside another object
Hi I have been working on a userdata button that places a preset in the environment, I also wanted to put it inside the end of a joint, my problem is that when performing these steps, when going back the preset is outside the joint, the code generates the preset and then place it inside the board, is there a way to do it directly?
Hi. Oh I understand, thanks for your answer, it has helped me a lot.
I had a doubt, I wanted to place an established texture on the material created, but I don't know how, since the textures part is not a simple link type data in itself, but if I link directly where the link of the image is born is a bitmap but I don't know how it relates to the material.
import c4d def main(): mat = c4d.BaseList2D(c4d.Mmaterial) doc.StartUndo() doc.AddUndo(c4d.UNDOTYPE_NEW, mat) doc.InsertMaterial(mat) mat[c4d.MATERIAL_USE_REFLECTION] = False #mat[c4d.MATERIAL_COLOR_SHADER] ? #Bitmap[c4d.BITMAPSHADER_INTERPOLATION]? #Bitmap[c4d.BITMAPSHADER_FILENAME]? doc.EndUndo() c4d.EventAdd() # Execute main() if __name__=='__main__': main()
@Cairyn Thanks, I'll check it
Hi @m_adam I mean that when creating an Object with BaseObject, when going back it remains in the environment. Cheers
BaseObject
I have a question, this is that every time I use this type of script, when I try to return it stays there, and it is somewhat annoying, I do not know how to fix it, I would be very grateful if you could help me
import c4d from c4d import gui def main(): cube = c4d.BaseObject(c4d.Ocube) doc.InsertObject(cube) c4d.EventAdd() if __name__=='__main__': main()