@ferdinand Perfect! that seemed to do the trick. I'm not entirely sure what's going on in that function but it works. I tried different index positions and it threw an error but it works for the zero index and that's all I really needed. Thanks for the help!
Hi, this is probably an easy question but I'm placing an effector into a cloner and I want to put it in the first position so the cloner reads it first. I see the InExcludeData has the InsertObject() command which always puts the effector in the last position and no option to place at a specific index. Is there a way to specify which index to place the effector?
@zipit thanks for clarifying. Hopefully, there will be something more predictable for IDs in the future.
@zipit Hi Ferdinand, it seems I spoke too soon. At first, it seems that the ID stays consistent. But I noticed when you go into the plugin manager and reload a plugin all the IDs change again:(
It's possible this won't be an issue for users who aren't reloading plugins but there also may be other things that change the ID of all objects.
Is this a bug perhaps or is there really no guarantee that an ID can stay consistent with an object?
@C4DS Thank you to you and all the friendly people that help on this forum! Happy New Year:)
@zipit Hi Ferdinand, yes this is exactly what I was looking for. Sorry, I must have missed the other post. Thanks so much for clarifying with the example code:)
Hi, I searched around for an answer on this but I haven't found anything solid on how to identify an object based on a unique ID of any kind in python. Isn't there something uniquely consistent with each object we can refer to? I need something I can write out to a file and read back later to reference a specific object.
@m_magalhaes @x_nerve Thanks for the update and workaround solutions guys! Hopefully fields can be implemented natively soon!
Hi, I have some python effector code created in an older version of C4D and it still works and looks great in the viewport on the current version(R23) but it renders in the picture viewer as if there is no falloff. I'm positive this is due to switching to fields from the old way of using falloffs. How do I get the python effector to respect fields?
I attached the python effector example taken straight from the C4D SDK. It rendered in the picture viewer fine until I upgraded the falloff method to fields and then it renders in the picture viewer with no effect from the falloff? I imagine it has to do with the SetArray command at the end?
@m_adam Thanks for clarifying!
@m_adam said in Changing parameters broken in S22:
Thanks! @m_adam it worked but I'm just curious why we needed to specify the fixed clone mode to False?
Hi, bit of a newb question. When changing a setting on an object this used to work:
obj[c4d.MG_LINEAR_OBJECT_POSITION,c4d.VECTOR_Y] = 0.0
But now it doesn't, it keeps getting an unexpected type error even though the type should be a float.
I read the sdk saying to use the "original set method" to avoid type errors but I'm not sure what the original method would be?
Thanks Bach! I knew it was going to be something simple like that.
Hi, I'm trying to copy a shader from one material to another. I know how to set the other material to the same type of shader but I don't know how to copy it exactly? for example if the noise parameters were tweaked on the texture we're copying.
The code assumes 2 materials are selected for coping the shader.
#Get the type of shader from 1st Material
shaderType = c4d.BaseList2D(mat[c4d.MATERIAL_LUMINANCE_SHADER].GetType())
#Set shader to same type on 2nd
mat[c4d.MATERIAL_ALPHA_SHADER] = shaderType
@C4DS Thank your reply! I had to come back to this because I had problems with switching back to object context and this solved that!
doc.SetActiveTag() was the key.
doc.SetSelection() was not switching it over to tag mode.
I am selecting tags on an object with python and once the selection is set the attribute manager doesn't update with the tag's attributes. It will if you only have any tag selected before the selection but if an object is selected or nothing is selected the attribute manager won't display anything when the tag is selected:/
Any idea how to get the tag's properties to show up without manually selecting it?
Here is simplified code to illustrate the issue. If you just make a cube primitive and select it this code will select the phong tag. But again the properties of the phong tag dont show up.
from c4d import gui
obj = doc.GetActiveObject()
tags = obj.GetTags()
# Execute main()
@a_block It was the ID. I did use a random number, apparently one too many. I didn't think it would matter for testing but I guess I was wrong! I figured it would be something dumb like that. It was just weird it pointed me to that line for the error. And yes sorry my code snippet was confusing, I thought it was standard practice to put RegisterObjectPlugin on multiple lines for easier reading.
Cinema is complaining about this line of code in my RegisterObjectPlugin function saying "Signed Integer is greater then maximum":
info=c4d.OBJECT_GENERATOR | c4d.OBJECT_ISSPLINE)
I even referenced a working spline plugin and it's the same.
I tried looking the error up and I still have no idea why it thinks this is an issue, any ideas?
@y_puech and @dskeith Thank you both, that is extremely helpful as I didn't see any other documentation on that. I can see how state() could become very dangerous very quickly. I will certainly proceed with caution and hope this will help others will to not abuse the state() function as well:)