Hi,
I wanted to ask, is there a way for this to be compatible with deformers or similar, I realized that the tag is not capable of drawing the location of the centers of each polygons altered by deformers, it is curious and I wonder if there is a way to solve it.
Cheers
James H.
![](/forum/assets/uploads/profile/4984-profileavatar.png)
Posts made by JH23
-
RE: Get the "Position" of a Polygon
-
RE: access the layers in the shader layer
Hi @i_mazlov ,
This solves my problem, for now I don't think I have another question, and I could consider my problem solved, thanks.
cheers,
James H. -
RE: access the layers in the shader layer
Hola @i_mazlov ,
Yes, it is true, DESCFLAGS_SET_USERINTERACTION does not work with layers, any other contribution to the problem is appreciated, from this I have no other doubt related to this topic, I leave the file here as an example.
example.c4d
cheers,
James H. -
RE: access the layers in the shader layer
Currently my problem would only be the issue of the lack of updating, because now I know that I can change the boolean of the layer with LAYER_S_PARAM_ALL_ACTIVE , but the lack of updating persists, I really don't know what could be causing it is causing.
code example, using the booleans of the layer:import c4d def main(): doc = c4d.documents.GetActiveDocument() obj = op.GetObject() F = obj[c4d.ID_USERDATA,1] FM = doc.GetFirstMaterial() shd = FM.GetFirstShader() layer = shd.GetFirstLayer() i = 0 while True: if layer: if i == F: #layer.SetParameter(c4d.LAYER_S_PARAM_SHADER_BLEND,True) layer.SetParameter(c4d.LAYER_S_PARAM_ALL_ACTIVE,True) else: #layer.SetParameter(c4d.LAYER_S_PARAM_SHADER_BLEND,False) layer.SetParameter(c4d.LAYER_S_PARAM_ALL_ACTIVE,False) layer = layer.GetNext() elif layer == None: break i = i+1 c4d.EventAdd()
-
RE: access the layers in the shader layer
Hi @i_mazlov ,
I have another question and I want to take advantage of this situation to consult, I really also want to be able to change the float that measures the mixing force, (I also wanted to know how to access the rounding) and I could, but now my problem is that it really takes too long, because not to say that it does not react until I manually move this float.
Here is an example:
-
RE: access the layers in the shader layer
Hi @i_mazlov ,
Excuse me for the lack of research, if I usually check if there were similar cases but I don't think I was able to understand it well, thank you very much for showing me these examples, they were really helpful.
the code you wanted:import c4d def ChangeTexturePathOfLayer(layer = c4d.LayerShaderLayer, Vector = c4d.Vector()): bmpShader = layer.GetParameter(c4d.LAYER_S_PARAM_SHADER_LINK) bmpShader[c4d.COLORSHADER_COLOR] = Vector def main(): mat = doc.GetFirstMaterial() if not mat: return shd = mat.GetFirstShader() if shd.CheckType(c4d.Xlayer): ChangeTexturePathOfLayer(shd.GetFirstLayer(), c4d.Vector(0.458823, 0.278431, 0.164705)) c4d.EventAdd() if __name__ == '__main__': main()
I still don't know what c4d.LAYER_S_PARAM_SHADER_LINK does specifically
Well, within the documentation it is only mentioned that int is allowed as a parameter.
Cheers,
James H. -
access the layers in the shader layer
Hi,
Today I was trying to link or access the color within a sahder layer only with python, I know I can get it and change its parameter in the same sahder layer, but my question is more about how I can enter one of these and change its data , as in this case the color, or also the direction of a bitmap. -
RE: update error?
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. -
RE: update error?
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 -
update error?
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.
-
RE: Is it possible to change the mode of the Viewport without callcommands?
Hello @ferdinand
Thank you very much, I had no idea about that, I did know thatMpoints
orMpolygons
existed, but it always related to me withViewportSelect
, this answers my question, I will investigate more about this. -
RE: Is it possible to change the mode of the Viewport without callcommands?
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 -
Is it possible to change the mode of the Viewport without callcommands?
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? -
RE: import presets and be reversible
Hello @ferdinand,
Thank you! His proposal was the best way to solve my problem.
Greetings,
JH23 -
RE: import presets and be reversible
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 followsCode 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.
-
import presets and be reversible
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?
-
RE: preset children of objects?
Hi
Thank you for solving my question, and thank you very much also for the advice.