Your browser does not seem to support JavaScript. As a result, your viewing experience will be diminished, and you have been placed in read-only mode.
Please download a browser that supports JavaScript, or enable it if it's disabled (i.e. NoScript).
@m_adam Dear Maxime thanks for everything! But, unfortunally now that I almost finished this part I realized that all this scripting doen't give me the desired procedural result. It just changes the values once but if i change the values of the PARENT object the OBJECT_A (child) is not updated... Anyway I have to approach it in a different way.
I think I should tag this thread as "SOLVED" and in case I need again help i create a new one. Please advise me Maxime.
Thanks Maxime for jumbing on this topic. I would like to explain again what is that I am looking for.
In c4d R21 , I have 2 objects (at least, there may be more…) that both are driven by UserData (“Parameters” group containig several fileds).
The one object (OBJECT_A) has only 4 fields in its “Parameters” userdata group. The other (PARENT) may have 40, 50 or 60 fields in its “Parameters” userdata group… I want to be able while on OBJECT_A, to retrieve PARENT’s specific userdata field values and overwrite the OBJECT_A initial userdata values of specific fields. I have a Python tag on OBJECT_A and from that Python Tag I have to retrieve specific PARENT’s data (I need only 1 or 2 fields, lets say “Width” and “Depth”). (see screenshot) Zipit helped me and I have retrieved the data from PARENT. (THANKS ZIPIT) I just can’t proceed on passing these values to specific fields of OBJECT_A.
That’s all… First time I use Python and any help would be appreciated. Thanks in advance!
Hello my friend,
I am not an expert in python/plugins but before we get into details, I would like to say that is well known that what you see in picture viewer and in render view (viewport render) is different ESPECIALLY when there are dynamics, deformers etc. I suppose you have a kind of animation , so i suggest to low down your render settings (and your output size) and render some frames (lets say a sequence of 5,10,20 or 30 frames). See the result and then you will see if there is a problem with the fields...
I hope you find the solution.
Cheers
Zipit THANK YOU!!!
I retrieved Parent's values (Width & Depth) Now, I dont know how to change Child's values... I send you the changes I made on your guiding script.
It would be great if you could give me a "final push" so i could solve my weakness on Python. Anyway, you already HELPED ME A LOT!!!
Thanks again man!!!
import c4d #Welcome to the world of Python def get_userdata_symbols(node): # Get the description of the node. description = node.GetDescription(c4d.DESCFLAGS_DESC_NONE) # Build the hash map, we only keep elements where the first # DescLevel of the DescID is the user data id. return {bc[c4d.DESC_NAME]: descid for bc, descid, _ in description if descid[0].id == c4d.ID_USERDATA and descid.GetDepth() > 1} def get_Parent_object(node): node_symbols = get_userdata_symbols(node) print "Child= " , node # ---------> Parent Object descid_linked_objects = node_symbols["Parent_Object"] inexclude_data = node[descid_linked_objects] ParentNode_symbols = get_userdata_symbols(inexclude_data) # Parent Object's parameters if "Parameters" in get_userdata_symbols(inexclude_data): # get Width Wdthid_linked_objects = ParentNode_symbols["Width"] Winexclude_data = inexclude_data[Wdthid_linked_objects] print "Width= ", Winexclude_data # get Depth Dpthid_linked_objects = ParentNode_symbols["Depth"] Dinexclude_data = inexclude_data[Dpthid_linked_objects] print "Depth= ", Dinexclude_data return True else: return False def main(): node = op.GetObject() # Get Parent Object (type of Link) if get_Parent_object(node): # GOT THE PARENT's VALUES' OK... print "now how to change Object_A values with Parent's values?" else: print "Error: Parameters of Parent object are not corect"
Zipit thanks for responding man!
I will give it a shot and will come back to you. Yes you are right... The objects are not nested. So, instead of "Parent-Child" i could rephrase as a "Guide-Guided" relationship.
As long as i can see in your scipt, you read the "Parent" userdata fields and check if userdata exists in the "Object_A". If not, the script creates them and fill their values... THE USERDATA EXIST IN ALL OBJECTS BY DEFAULT. Each object functions on its own. With its own parameters (userdata fields). And optionaly i can set in any of the GUIDED objects the "parent_obect" as the object that its parameters will overwrite the desired original parameter of the "guided" object (by dragging the Parent object into the Link field of the guided object). Then i would like to get the parent's parameter (for example "width", or "depth") and paste it into the Guided's parameter i want.. Anyway, THANK YOU VERY MUCH!!! I will try to work this around and if i get stuck i will let you know! THANKS AGAIN
Hello people!
I am working on "procedural" objects (3d models) using xprersso. Each object (built under a Null object that holds the xpresso tag) has its own parameters under their user data and these objects are stored in content browser and "merge" whichever I want intomy current project.
I can use (insert / merge) as many objects as I need in a new project and very often these objects may have the "parent - child" relation ship, meaning that the "parent" object may overwrite the parameters(user data fields) of the "child". Of cource this is optional (to overwrite or not the "child" parameters).
Here is the help i need. I provide an image with an example, containg 3 objects: Parent , Object_A and Object_B. I whould like to have the oportunity to define if the Object_A parameters ("width" & "depth") should be overwritten from the specific Parent object's parameters by dragging the Parent object (Null) into the A_Parent_Object field (link). Every object (except Parent) by default includes itself in that field.
After all this long speech , in a few words I would like from the xpresso editor, Object_A to access the Parent->width value. Of course I need to do it by scripting and not just by dragging the Parent object inside the Object_A xpresso editor and get the parameters values (width & depth)
Any help would be appreciatted! Thank in advance.
.