On 25/08/2014 at 12:51, xxxxxxxx wrote:
how can I detect that the user has changed a property of a shader which is used in a material? For example in the color channel.
Thanks in advance
On 25/08/2014 at 15:23, xxxxxxxx wrote:
I don't think there's a built-in method for detecting that specific change. In similar situations (detecting changes in Layer Selection, etc) - I've cached a copy of the object I'm monitoring and then checked it against the live copy every time there's a c4d.EVMSG_CHANGE message.
On 28/08/2014 at 04:27, xxxxxxxx wrote:
thanks for the reply!
do you have an example script?
I was not able to implement your description?
I have a tag plugin and I want to notify changes of the material which is, as the tag plugin, assigned to an object.
How can I notify an EventMessage in my tag plugin and do the cache?
On 28/08/2014 at 13:07, xxxxxxxx wrote:
a tag's Execute function is called pretty much every time something happens in the scene. So you could check there if the material's dirty state changed:
class ExamplePythonTag(plugins.TagData) :
materialDirtyStatus = 0
def Init(self, node) :
# init your plugin here
def Execute(self, tag, doc, op, bt, priority, flags) :
# search for texture tag
textureTag = op.GetTag(c4d.Ttexture)
if textureTag != None:
# get material
material = textureTag.GetMaterial()
if material != None:
# get dirty state
dirty = material.GetDirty(c4d.DIRTY_DATA)
if dirty != self.materialDirtyStatus:
self.materialDirtyStatus = dirty
On 02/09/2014 at 02:47, xxxxxxxx wrote:
thank you for the reply!
It works !