auto rename null

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

THREAD CLOSED
 
Thread Tools Search this Thread Display Modes
  03 March 2013
auto rename null

is there a plugin or script that will name a new null the same as the parent that I put it under, with a suffix to show its different?
 
  03 March 2013
this will add a null as a child to the currently selected object and name it parentname_null.
import c4d

def main():
    obj = doc.GetActiveObject()
    if obj:
        nob = c4d.BaseObject(c4d.Onull)
        nob.SetName('{0}_{1}'.format(obj.GetName(), 'Null'))
        nob.InsertUnderLast(obj)
        c4d.EventAdd()
    
if __name__=='__main__':
    main()
 
  03 March 2013
thank you very much. perfect :-)

Edit- littledevil, one more request. can you show me how to add to that script a Reset Position and Reset Rotation to all zeros on that new null?

Last edited by oliveoyle : 03 March 2013 at 12:03 AM.
 
  03 March 2013
Try the group each script I wrote here:

http://bretbays.com/2011/10/28/a-co...helper-scripts/
__________________
www.bretbays.com
"We do not - not wag our genitals at one another to make a point!"
 
  03 March 2013
hey bret,
. I just tried it and it is the opposite of what I wanted to do. It is making the nulls as parents and i need the nulls as children.

Last edited by oliveoyle : 03 March 2013 at 12:49 AM.
 
  03 March 2013
gotcha.


Add:

nob.SetRelPos(c4d.Vector(0))
nob.setRelRot(c4d.Vector(0))

to the script above after the InsertUnderLast line
__________________
www.bretbays.com
"We do not - not wag our genitals at one another to make a point!"
 
  03 March 2013
thank you. works as expected. :-)


import c4d

def main():
obj = doc.GetActiveObject()
if obj:
nob = c4d.BaseObject(c4d.Onull)
nob.SetName('{0}_{1}'.format(obj.GetName(), 'Null'))
nob.InsertUnderLast(obj)
c4d.EventAdd()
nob.SetRelPos(c4d.Vector(0))
nob.setRelRot(c4d.Vector(0))

if __name__=='__main__':
main()

Last edited by oliveoyle : 03 March 2013 at 01:23 AM.
 
  03 March 2013
Thread automatically closed

This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
__________________
CGTalk Policy/Legalities
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
 
Thread Closed share thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
CGSociety
Society of Digital Artists
www.cgsociety.org

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump
Miscellaneous

All times are GMT. The time now is 11:54 AM.


Powered by vBulletin
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.