Jump to content
Cinema 4D Plugins

nicolectro

New Member
  • Content count

    5
  • Joined

  • Last visited

Community Reputation

0 Poor

Profile Information

  • First Name
    Nicolas
  • Last Name
    HERLEM
  • C4D Ver
    17 Studio
  1. Create an uvw tag and rename it

    Ok, thanks for your answers on both forums. So, in basic language, and to be sure i understand well, can i translate that action in this way: 1- Define the document 2- Define the object inside the document 3- make a list of all tags attached to this object 4- find the texture tag attached to this object 5- define projection type as cubic 6- create a new tag based on this projection 7- compare the new tag list with the previous one (point 3) 8- give a name to the new tag Is it logical as an approach? At this time point 4&5 are still difficult for me. But i will make it. By the way, in blending your code and mine i obtain the result i want but only if my object and my material are selected in the object manager. As far as i understand, it only works because my material is selected import c4d from c4d import documents, plugins #Welcome to the world of Python def main(): doc = c4d.documents.GetActiveDocument() obj = doc.GetActiveObject() tags = obj.GetTags() def tool(): return plugins.FindPlugin(doc.GetAction(), c4d.PLUGINTYPE_TOOL) def object(): return doc.GetActiveObject() def tag(): return doc.GetActiveTag() def renderdata(): return doc.GetActiveRenderData() def prefs(id): return plugins.FindPlugin(id, c4d.PLUGINTYPE_PREFS) tag()[c4d.TEXTURETAG_PROJECTION]=3 c4d.CallCommand(12235, 12235) # Générer des coordonnées UVW newtags = obj.GetTags() newname = "CUBIC" for tag in newtags: if tag not in tags: # this is your newly created UVW tag # rename it tag.SetName(newname) c4d.EventAdd(); if __name__=='__main__': main()
  2. Create an uvw tag and rename it

    Very nice, thank you. The fact is i didn't know where and what to search but you 've just given me some clues to begin with. So thanks again. Have a nice day.
  3. Create an uvw tag and rename it

    Hi, thank you for your time but this is not exactly what i wanted to do because, as i mentioned earlier, my object as already a first uvw tag (corresponding to the "real" uvw coordinates of the object). I have to "fake" a second uvw tag with a cubic projection set to the active material and rename this tag so the Redshift material understands there is two type of projection on the object it is applied to. In the first screenshot above, you can see red lines are set as UVW projection and i would like the grid to be set as CUIBIC projection (as in the second screenshot). With your code, my first TAG is know called "newName" (or whatever) and the new one is called UVW. But i think it is a good start for me to understand better the way this code works. Unfortunately, as i said, i'm not a programer… Thanks a lot
  4. Create an uvw tag and rename it

    Thank you for your answer but unfortunately this changes the material's name but not the uvw tag's name. As if the tag itself was not selected. Perhaps i'm not creating the uvw tag in a good way. I select my material and do the same as right-click>generate uvw. Is it the best way to do it? I keep searching. Thank you
  5. Hi people, this is my first post on this forum as i didn't expect to use python a day in my life ;) As i'm a Redshift user which needs several UVW tags to understand texture projection, i'd like to make a small script to create a texture tag, change its type and rename it automatically. To be clear, i have an object with UVW coordinates, i apply a texture on it and i want to create a second UVW tag with cubic projection to add bump to my object (for example). Sometimes, i have to do this operation 50 times on a scene so i'd like a script to do that for me. I'm totally newbie. No knowledge at all. I'm only able to create the Cubic Tag but im not able to rename it. So, first question, is it possible? And if possible, once i've created it, how to select it before renaming it? My simple script for now (don't laugh;, yes it's cut and paste): import c4d from c4d import documents, plugins #Welcome to the world of Python def main(): def tool(): return plugins.FindPlugin(doc.GetAction(), c4d.PLUGINTYPE_TOOL) def object(): return doc.GetActiveObject() def tag(): return doc.GetActiveTag() def renderdata(): return doc.GetActiveRenderData() def prefs(id): return plugins.FindPlugin(id, c4d.PLUGINTYPE_PREFS) tag()[c4d.TEXTURETAG_PROJECTION]=3 c4d.CallCommand(12235, 12235) # Générer des coordonnées UVW if __name__=='__main__': main() c4d.EventAdd() Thank you everyone. I'd like to understand. Nico

×