Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush Python API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Unread
    • Recent
    • Tags
    • Users
    • Login

    Set data doesn't work for Texture name?

    Scheduled Pinned Locked Moved PYTHON Development
    4 Posts 0 Posters 440 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • H Offline
      Helper
      last edited by

      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()
      
      1 Reply Last reply Reply Quote 0
      • H Offline
        Helper
        last edited by

        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?

        1 Reply Last reply Reply Quote 0
        • H Offline
          Helper
          last edited by

          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()
          
          1 Reply Last reply Reply Quote 0
          • H Offline
            Helper
            last edited by

            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

            1 Reply Last reply Reply Quote 0
            • First post
              Last post