Set data doesn't work for Texture name?

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 04/01/2012 at 13:46, xxxxxxxx wrote:

Just curious why setting the name of a selection tag is different from setting the name of a material tag

see WORKS  - DOESNT WRK Comment

(Python conversion of Script by Steve Pedler - to take the name of a material and apply it to the selection and name of associated selection tag)

import  c4d
from c4d.documents import GetActiveDocument
from c4d import BaseContainer
from c4d.gui import GeDialog
  
def main() :
	c4d.CallCommand(13957);
	doc = GetActiveDocument()
	if doc is None:
		return False
	op      = doc.GetActiveObject()
	if op is None:
		print 'No Object Selected'
		return False
	tag = op.GetFirstTag()
  
	while tag:
		bc = tag.GetDataInstance()
		if tag.CheckType(c4d.Ttexture) :
			matselname = bc.GetData(c4d.TEXTURETAG_RESTRICTION)
			matname = tag[c4d.TEXTURETAG_MATERIAL].GetName()
			seltag = op.GetFirstTag() 
			while seltag:
				bc2 = seltag.GetDataInstance()
				if seltag.GetName() == matselname:
					bc.SetData(c4d.TEXTURETAG_RESTRICTION, matname)
					seltag[c4d.ID_BASELIST_NAME] = matname # WORKS
					# bc2.SetData(c4d.ID_BASELIST_NAME, matname) DOESNT!!!!
					#seltag.SetName(matname) WORKS
				seltag = seltag.GetNext()
		tag = tag.GetNext()
	c4d.EventAdd()   
  
	return True
  
main()

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 05/01/2012 at 02:02, xxxxxxxx wrote:

Anyone?

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 05/01/2012 at 06:09, xxxxxxxx wrote:

or is this a better way ie. NOT using Get Data Instance?

import c4d
from c4d.documents import GetActiveDocument
from c4d import BaseContainer
from c4d.gui import GeDialog
  
def main() :
    c4d.CallCommand(13957);
    doc = GetActiveDocument()
    if doc is None:
        return False
    op = doc.GetActiveObject()
    if op is None:
        print 'No Object Selected'
        return False
    tag = op.GetFirstTag()
    while tag:
        if tag.CheckType(c4d.Ttexture) :
            matname = tag[c4d.TEXTURETAG_MATERIAL].GetName()
            matselname = tag[c4d.TEXTURETAG_RESTRICTION]
            seltag = op.GetFirstTag() 
            while seltag:
                if seltag.GetName() == matselname:
                    tag[c4d.TEXTURETAG_RESTRICTION] = matname
                    seltag[c4d.ID_BASELIST_NAME] = matname # WORKS
                seltag = seltag.GetNext()
        tag = tag.GetNext()
    c4d.EventAdd() 
    return True
main()

THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

On 06/01/2012 at 05:45, xxxxxxxx wrote:

Another one resolved with the help of Scott on the CGSociety Forum