De-constructing a hierarchy
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 26/11/2010 at 17:25, xxxxxxxx wrote:
I need to create an algorithm that goes through a hierarchy of objects and rebuilds the list in a way that is would be able to rebuild the same hierarchy, later. Lets say:
Cube1
-Platonic1
--SweepNURBS1
---Spline1
---Spline2
--Cube2
---Platonic2
----Sphere1The order of creation is (I believe) :
Cube1
Platonic1 (insert_under Cube1)
Cube2 ( (insert_under Platonic1)
Platonic2 ( (insert_under Cube2)
Sphere1 (insert_under Platonic2)
SweepNURBS (insert_under Platonic1)
Spline2 (insert_under SweepNURBS)
Spline1 (insert_under SweepNURBS)This is because each time I InsertUnder, the inserted object ends up being the first child of its parent.
Is there any algorithm that goes through a hierarchy and returns a list of objects in the correct order so that a new scene could be reconstructed?
I already tried a few times to code such a thing but I'm having no luck
Anyone? Please...Rui Batsita
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 27/11/2010 at 02:29, xxxxxxxx wrote:
Then why don´t you use InsertAfter instead? Insert the SweepNurbs with InsertUnder, then user InsertAfter(sweepnurbs) for cube2. Then go through that hierarchy level again and start doing the same to sweep and cube2 for their children.
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 27/11/2010 at 06:35, xxxxxxxx wrote:
I need to automate the process. If I make it by hand, of course I would make it differently.
But I need to be able to provide any hierarchy to my code and it must create a list in the correct order so that it could all be solved with InsertUnder.
If there was an algorithm that would do what I need listing the objects in the correct order and having a flag telling that I should insert it with InsertUnder or InsertAfter, that would also be fine. -
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 27/11/2010 at 06:44, xxxxxxxx wrote:
I don´t see why you wouldn´t be able to make a recursive function out of my suggestion.
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 29/11/2010 at 16:44, xxxxxxxx wrote:
Me neither
-
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 04/12/2010 at 16:39, xxxxxxxx wrote:
The problem with InsertAfter is that it doesn't seem to work in Python. For example, the following code doesn't work inside a Python Generator:
def main() :
parent=c4d.BaseObject(c4d.Osweep)
profile=c4d.BaseObject(c4d.Osplinecircle)
path=c4d.BaseObject(c4d.Osplinestar)
profile.InsertUnder(parent)
path.InsertAfter(profile)
return parentHowever, the following code does work:
def main() :
parent=c4d.BaseObject(c4d.Osweep)
profile=c4d.BaseObject(c4d.Osplinecircle)
path=c4d.BaseObject(c4d.Osplinestar)
path.InsertUnder(parent)
profile.InsertUnder(parent)
return parentBut I need to insert the path before and then the profile, to create a sweep. This is harder than I thought