CGTalk > Software > Maxon Cinema 4D
Login register
Thread Closed share thread « Previous Thread | Next Thread »  
Thread Tools Search this Thread Display Modes
Old 02-09-2013, 07:57 AM   #1
eikonoklastes's Avatar
Join Date: Oct 2008
Posts: 552
Reset to Default on Selected Attributes?


Is there a way to get the selected attribute(s) and execute a "Reset to Default" via a script?

It seems like this should be available in the Customize Commands Manager, but it's not.
Old 02-09-2013, 11:15 AM   #2
littledevil's Avatar
Join Date: Aug 2002
Posts: 616

i think that is not possible in python.

There are several problems. Some result in the fact, that you cannot access the
SetToDefault command (they are also the reason why you could not find it in the
Command Manager). But these problems could be bypassed. The main problem for
python is, that you cannot get hold of the currently selected description element
in the attribute manger. Or at least i do not know a way how to.

The closest thing i could think of would be a pretty simple - get the selected
object type, create your own instance of it (which will hold the default values)
and copy the bc from your instance into the object you want to reset. but this
approach will obviously flatten out allmost all values. you will only keep the coords,
the object manager flags and the name.

obj = doc.GetActiveObject() defbc = c4d.BaseList2D(obj.GetType()).GetData() obj.SetData(defbc) c4d.EventAdd()
Old 02-10-2013, 12:22 AM   #3
Scott Ayers
Kaiju Creator
Scott Ayers
Join Date: Feb 2005
Posts: 1,034
There's no way to target the currently selected UD with the C++ SDK either. The bit mask for it isn't included in it.
People should be complaining about this to Maxon.

The best we can do is target a UD by it's value type. Or by it's name:
import c4d def main(): #The object that has the UserData on it obj = doc.SearchObject("Cube") #Search for the correct UserData entry by it's name for id, bc in obj.GetUserDataContainer(): if bc.GetString(c4d.DESC_NAME) == "MyUserData": #<---The name to search for index = id[1].id obj[c4d.ID_USERDATA, index] = 0 #<---Set it to some value c4d.EventAdd() if __name__=='__main__': main()

My Gallery
Old 02-10-2013, 12:22 AM   #4
CGTalk Moderation
CGTalk Forum Leader
Join Date: Sep 2003
Posts: 1,066,478
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
Society of Digital Artists

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

All times are GMT. The time now is 03:16 PM.

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