-
Posts
361 -
Joined
-
Last visited
-
Days Won
15
Content Type
Profiles
Blogs
Forums
Gallery
Pipeline Tools
3D Wiki
Plugin List
Store
Downloads
Everything posted by kalugin
-
Be aware that grouping them under a null can mess up your object hierarchy (If the parent is enabled, but has children that are not, they will still end up in the null. If you don't include the children, how do you decide where they should stay as a child of which exact object? You get the idea π select enabled: import c4d # import the c4d module def main(): # define the "main" function enabled_objects = [] # create an empty list to store all enabled objects for later obj = doc.GetFirstObject() # get the first object in the object manager while obj: # while there is an object (this is explained later) obj.DelBit(c4d.BIT_ACTIVE) # deselect the object if obj[c4d.ID_BASEOBJECT_GENERATOR_FLAG]: # if the object is enabled... enabled_objects.append(obj) # append that object to the list of enabled objects obj = walker(obj) # use the "walker" function to determine the next object that needs to be evaluated (check the "walker" function comments) for obj in enabled_objects: # for every object in the list of enabled objects, that we've collected earlier obj.SetBit(c4d.BIT_ACTIVE) # set that object as "active" in the object manager c4d.EventAdd() # this is needed to update C4D to show the changes we've made def walker(obj): # define the "walker" function if not obj: # if the obj is None the function will return None. This will break the "while obj" loop return elif obj.GetDown(): # if the obj has a child object return obj.GetDown() # return that object to the "while obj" loop while obj.GetUp() and not obj.GetNext(): # if obj has a parent and obj doesn't have a child... obj = obj.GetUp() # set obj to be the obj's parent return obj.GetNext() # return the object that's AFTER the current obj (not under) if __name__=='__main__': # this line makes sure that you are currently executing this script. Doesn't make any difference in this case, but it's good to now :) main() # execute the function defined in "def main()" line group enabled under a null: import c4d # import the c4d module def main(): # define the "main" function doc.StartUndo() # start an undo list of commands enabled_objects = [] # create an empty list to store all enabled objects for later obj = doc.GetFirstObject() # get the first object in the object manager while obj: # while there is an object (this is explained later) obj.DelBit(c4d.BIT_ACTIVE) # deselect the object if obj[c4d.ID_BASEOBJECT_GENERATOR_FLAG]: # if the object is enabled... enabled_objects.append(obj) # append that object to the list of enabled objects obj = walker(obj) # use the "walker" function to determine the next object that needs to be evaluated (check the "walker" function comments) for obj in enabled_objects: # for every object in the list of enabled objects, that we've collected earlier obj.SetBit(c4d.BIT_ACTIVE) # set that object as "active" in the object manager groupEnabled(enabled_objects) # call the "groupEnabled" function and pass the list of the collected enabled objects doc.EndUndo() # end the undo list of commands c4d.EventAdd() # this is needed to update C4D to show the changes we've made def groupEnabled(enabled_objects): # define the "groupEnabled" function, which takes a list of objects to group under a new null new_null = c4d.BaseObject(c4d.Onull) # create a new null object in the memory (it will be inserted in the document later) doc.AddUndo(c4d.UNDOTYPE_NEWOBJ, new_null) # adds the creation of a new object to the undo list. Always done AFTER creating the object. for obj in enabled_objects: # for every object in the list that is passed as the "enabled_objects" argument for this function do... doc.AddUndo(c4d.UNDOTYPE_CHANGE, obj) # add an undo step for changing the hierarchy of the object. ALWAYS done BEFORE changing it. obj.InsertUnder(new_null) # add that object as a child of the newly created null. doc.InsertObject(new_null) # finally, add the null to the doc. "InsertObject" will always place it as the first object in the hierarchy. def walker(obj): # define the "walker" function if not obj: # if the obj is None the function will return None. This will break the "while obj" loop return elif obj.GetDown(): # if the obj has a child object return obj.GetDown() # return that object to the "while obj" loop while obj.GetUp() and not obj.GetNext(): # if obj has a parent and obj doesn't have a child... obj = obj.GetUp() # set obj to be the obj's parent return obj.GetNext() # return the object that's AFTER the current obj (not under) if __name__=='__main__': # this line makes sure that you are currently executing this script. Doesn't make any difference in this case, but it's good to now :) main() # execute the function defined in "def main()" line group enabled under a null.py select enabled.py
-
Maybe it's time to open the forum again and bring back the ads?
kalugin replied to No One's topic in Discussions
@lieberat which point you saw me being against payed membership? I bet that a "visible" forum would generate more new users than a paywall blocked one. -
Maybe it's time to open the forum again and bring back the ads?
kalugin replied to No One's topic in Discussions
I'm a member of the forum from the "3dKiwi" era. After the switch of captains there was as bit of upgrading the forum (which took a bit to be honest). I have nothing against paying for the membership, but ARE YOU SERIOUS guys? People are searching for a solution to a problem -> they find a link in google -> you have to pay to find out if this will solve your problem. NOPE. I would never do that. I'm paying my sub just because this was and still is the best C4D forum and I like helping other guys when I can. READING THE ANSWERS SHOULD BE FREE!. -
Maybe it's time to open the forum again and bring back the ads?
kalugin replied to No One's topic in Discussions
I would also agree that the users should be able to see what they are paying for π -
Still the same.
-
@Tim SeyerPython is the easiest way for me π That doesn't mean it's the only way. Actually the same thing can be done with expresso, nodes or maybe some other way that we haven't thought about. You can make the generator object a child of whatever object you like and animate it anyway you like. I'm using a vibrate tag to simulate random movement. The python part just uses the scattered points to draw a spline from the point to the origin of the generator. Nothing more. I can strip the code a lot and comment it, so it's more understandable, but this was just a prototyping process, where you try a lot of things one over another so that's why it isn't so clean. I was just curious if it can be done. If I have more spare time I'll clean the example scene and try to figure out the tentacles "spreading/touching" the ground. If you like Blender more - go with it π Just choose a software that suits you and dig into it. I guess there are a lot of examples for workflows that are easier in C4D than in Blender, but I don't like waving flags for anything. For me it's important to suite my needs, not to be able to do everything in one package.
-
yeah, so it's a voxel grid data with neighbouring relations.
-
@Cerberamy bet is that liquid simulations are on the way π That is a particle simulation for sure. Both gases and liquids can be called "fluid dynamics", but the way that they are simulated is usually quite different.
-
As far as I understand it - Pyro is not a particle simulator. More like a data voxel grid. Think of a vector field, but more complex. It doesn't actually involve any unique/individual particles traveling through the simulation. But maybe I'm wrong...
-
and my favorite settings so far: mimic_0001.c4d
-
a little update. This could definitely work. I think I'll do some more tweaking. It's fun π mimic.zip
-
absolutely doable in native C4D. Just a proof of concept, but with the right amount of tweaking... The code in the python generator is a bit trashy, but it's just a test anyway π mimic.mp4 mimic.zip
-
I also had a run with that, but I can't find the thread π EDIT: Found it.
-
Looks like a proof of concept. I understand why a programmer would play with the idea of implementing it in C4D, but other than that - it's absolutely useless π
-
Difficulty: 0 :) Relaunch.py
-
import c4d def main(): objs = doc.GetActiveObjects(0) for obj in objs: inst = c4d.BaseObject(c4d.Oinstance) inst.InsertAfter(obj) inst[c4d.INSTANCEOBJECT_LINK] = obj inst.SetName(obj.GetName()+"_inst") c4d.EventAdd() if __name__=='__main__': main() Enjoy π
-
ideally - you should share your code π
-
your condition should be like this: if child[c4d.ID_BASELIST_NAME] == "YOUR_NAME_FILTER" and child[c4d.ID_BASEOBJECT_GENERATOR_FLAG] and child.GetType() != c4d.Onull: # your code goes here PS: if you are wondering - you can check True or False values without "==". lets say you have a variable boolean = True. You can check it just by "if boolean:" or "if not boolean:"
-
does anyone happen to have the offline python sdk? I always knew this will happen at some point and now I don't have it π
-
enjoy π Spacer.zip
-
oops π
-
@ChrisMyatt You can select multiple nulls π
-
@ChrisMyatt Something like this? import c4d def main(): if len(doc.GetActiveObjects(0)) == 0: print "No objects selected" return for obj in doc.GetActiveObjects(0): if obj.GetType() == c4d.Onull: childlist = op.GetChildren() if not childlist: print "No children to select" continue for index, node in enumerate(childlist): doc.SetActiveObject(node, c4d.SELECTION_NEW if index == 0 else c4d.SELECTION_ADD) c4d.CallCommand(16768) c4d.EventAdd() if __name__=='__main__': main()
-
well, that was a lot of comments. I'm glad that I have enough beer Fixed some issues while commenting. Random option was not working in picture viewer. Also fixed some other little bugs. Have fun. If any of the coders have any advice regarding the code - I'd be glad to learn some tips and tricks. Spacer.zip
-
yeah, once I'm sure it works :) And I like to clean and comment the code that I share in the forum. That way it's more useful for everyone. I know when I started coding for c4d, how I was starving for someone to share anything to learn from