CGTalk > Software Specific Forums > Maxon Cinema 4D
Login register
Thread Closed share thread « Previous Thread | Next Thread »  
 
Thread Tools Search this Thread Display Modes
Old 03-28-2013, 11:08 PM   #1
oliveoyle
PRO
portfolio
Olive Oyle
Master
BHG
BH, United%2BStates
 
Join Date: Jan 2010
Posts: 140
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?
 
Old 03-28-2013, 11:26 PM   #2
littledevil
Meh
 
littledevil's Avatar
portfolio
Ferdinand
Germany
 
Join Date: Aug 2002
Posts: 616
this will add a null as a child to the currently selected object and name it parentname_null.
Code:
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()
 
Old 03-28-2013, 11:58 PM   #3
oliveoyle
PRO
portfolio
Olive Oyle
Master
BHG
BH, United%2BStates
 
Join Date: Jan 2010
Posts: 140
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-29-2013 at 12:03 AM.
 
Old 03-29-2013, 12:19 AM   #4
xfon5168
Jack of All Trades
Bret Bays
Character TD
USA
 
Join Date: Mar 2006
Posts: 1,138
Send a message via AIM to xfon5168
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!"
 
Old 03-29-2013, 12:30 AM   #5
oliveoyle
PRO
portfolio
Olive Oyle
Master
BHG
BH, United%2BStates
 
Join Date: Jan 2010
Posts: 140
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-29-2013 at 12:49 AM.
 
Old 03-29-2013, 12:46 AM   #6
xfon5168
Jack of All Trades
Bret Bays
Character TD
USA
 
Join Date: Mar 2006
Posts: 1,138
Send a message via AIM to xfon5168
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!"
 
Old 03-29-2013, 12:59 AM   #7
oliveoyle
PRO
portfolio
Olive Oyle
Master
BHG
BH, United%2BStates
 
Join Date: Jan 2010
Posts: 140
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-29-2013 at 01:23 AM.
 
Old 03-29-2013, 12:59 AM   #8
CGTalk Moderation
Lord of the posts
CGTalk Forum Leader
 
Join Date: Sep 2003
Posts: 1,066,481
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


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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:47 PM.


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