I was able to solve it by searching the DescID in the Cloner Description with the Inheritance Name.
Best posts made by Joel
-
RE: Python Cloner Effectors Keyframe
Latest posts made by Joel
-
Create Splines without lines
Hi,
I am tasked with creating programmatically splines with no visible lines between the points.
From the GUI I know I can create a spline with the Spline Pen or an already created spline and then delete the lines between the points using the Break Segment function. However, I don't know where to find any information on how to use the Break Segment from Python or any other option to achieve the same result of a spline without lines connecting the points.Any help is appreciated.
Regards,
Joel -
RE: ExecutePasses to slow
@ferdinand
May I send you the project file and executable via a private channel? -
RE: ExecutePasses to slow
@ferdinand
Thank you for your reply.
As of right now, I am executing all passes as I do not know for sure which passes I need.
As I said I need the position and the base object color of sphere objects that follow a cloner. And this cloner has movements and colors set by inheritances.I have these spheres in a null so my code works in this manner (note I have two arrays for frames one for position and another for color as sometimes are different):
null_spheres = doc.SearchObject('Spheres') spheres_names = [] spheres_loc = [] spheres_col = [] frame_start = 0 frame_end = 12000 project_fps = 24 for i in null_spheres.GetChildren(): spheres_names.append(i.GetName()) spheres_loc.append([]) spheres_col.append([]) frames_loc = list(range(frame_start, frame_end+1, project_fps)) frames_col = list(range(frame_start, frame_end+1, project_fps)) doc.SetTime(c4d.BaseTime(frame_start, project_fps)) doc.ExecutePasses(None, True, True, True, c4d.BUILDFLAGS_NONE) for frame_col in frames_col: t = c4d.BaseTime(frame_col, project_fps) doc.SetTime(t) doc.ExecutePasses(None, True, True, True, c4d.BUILDFLAGS_NONE) for index, sphere in enumerate(spheres_names): op = doc.SearchObject(sphere) col = op[c4d.ID_BASEOBJECT_COLOR] spheres_col[index].append([col.x, col.y, col.z]) if frame_col in frames_loc: pos = op.GetMg().off spheres_loc[index].append([pos.x, pos.y, pos.z])
As of right now, the number of spheres is around 200 but it will increase to 500 so I want to try and speed up this process as much as possible.
-
ExecutePasses to slow
Hi,
I have a project where the Python scripts must gather information, like the position and color, of certain objects at all frames.
As of right now, I am using SetTime and ExecutePasses. This action of SetTime ExecutePasses takes 0.13 seconds however my projects have 12000 frames therefore just the information gathering takes 26 minutes.
Is there a way to speed up this prosses?Thank you for your time.
Regards,
Joel -
RE: Dialog Menu
Creating an instance for each subdialog solved the issue thank you so much.
-
RE: Dialog Menu
I tried using the subdialog as the github example shows. If I just want to do one subdialog change the github example that @mogh posted works just find. However when I add another button so I can switch between the subdialogs the Dialog does not update.
The code I used is a bit modified from the github but more or less the same:
import c4d from c4d import gui ID_SUBDIALOG = 10000 ID_Dialog1_BUTTON = 10001 ID_Dialog2_BUTTON = 10002 class Dialog1(c4d.gui.SubDialog): def CreateLayout(self): self.AddStaticText(1, c4d.BFH_SCALEFIT, 0, 0, "Dialog 1") return True class Dialog2(c4d.gui.SubDialog): def CreateLayout(self): self.AddStaticText(1, c4d.BFH_SCALEFIT, 0, 0, "Dialog 2") return True class MainDialog(c4d.gui.GeDialog): subDialog = Dialog1() def CreateLayout(self): self.GroupBegin(0, c4d.BFH_SCALEFIT, 2) self.AddButton(ID_Dialog1_BUTTON, c4d.BFH_SCALEFIT, name="Dialog1") self.AddButton(ID_Dialog2_BUTTON, c4d.BFH_SCALEFIT, name="Dialog2") self.GroupEnd() self.AddSubDialog(ID_SUBDIALOG, c4d.BFH_SCALEFIT, 100, 100) self.AttachSubDialog(self.subDialog, ID_SUBDIALOG) return True def Command(self, mid, msg): if mid == ID_Dialog1_BUTTON: self.subDialog = Dialog1() self.AttachSubDialog(self.subDialog, ID_SUBDIALOG) print(self.LayoutChanged(ID_SUBDIALOG)) if mid == ID_Dialog2_BUTTON: self.subDialog = Dialog2() self.AttachSubDialog(self.subDialog, ID_SUBDIALOG) print(self.LayoutChanged(ID_SUBDIALOG)) return True if __name__=='__main__': dlg = MainDialog() dlg.Open(c4d.DLG_TYPE_ASYNC, defaultw=900, xpos=-2, ypos=-2)
When I click the buttons the first button click from either button the LayoutChanged returns True but on the second button click from either button returns False.
What am I doing wrong?
-
Dialog Menu
Hi,
I have two dialogs in different python scripts and I would like to join them in a single python script so the user via buttons can choose what dialog to show.I tried searching the forums as well as reading the documentation but I have not been able to find a starting guide to solve this issue.
Does anyone have an idea how I could achieve a solution to this problem?
Thanks so much for your time.
-
RE: Inheritance created by Python script not getting saved
@ferdinand Thank you so much. Adding:
inheritance1.Message(c4d.MSG_MEUPREPARE, doc)
Solved the issue.
-
RE: Inheritance created by Python script not getting saved
@ferdinand Thank you so much, looking forward to your reply.
-
RE: Inheritance created by Python script not getting saved
@ferdinand Is the information that I have provided sufficient?