• Dragging an object from a treeview

    r20 python
    4
    1
    0 Votes
    4 Posts
    623 Views
    P
    Thanks, sounds a bit complicated, so I have to give it some thoughts. For now, it is enough. -Pim
  • Get mode (object, face, edge, point) with python

    python
    4
    1
    0 Votes
    4 Posts
    748 Views
    W
    Thanks Sebastian.
  • Command() does not honor Dynamic Lists/Variable

    r21 python
    9
    0 Votes
    9 Posts
    920 Views
    B
    When you presented the order of execution of __init__(), CreateLayout and InitValues. That makes total sense especially the 2.2.1 when it resets to an empty list. Thanks for the clarification!
  • Cant select newly created Instance

    python
    7
    0 Votes
    7 Posts
    1k Views
    esanE
    @blastframe Ok was able to retrofit your version to get what I wanted, a bit of guesswork in here, but got the result im after lol import c4d from c4d import gui def createInstance(): obj = op.GetDown() inst = c4d.BaseObject(c4d.Oinstance) # created Instance with Base Object inst[c4d.INSTANCEOBJECT_LINK] = obj # set Instance's reference link # set the name using the object passed to the function inst[c4d.ID_BASELIST_NAME] = "%s Instance"%obj[c4d.ID_BASELIST_NAME] return inst # return the Instance instance def AddLongDataType(obj): # create User Data Container named Picker if obj is None: return bc = c4d.GetCustomDataTypeDefault(c4d.DTYPE_LONG) bc[c4d.DESC_NAME] = "Picker" doc.AddUndo(c4d.UNDO_CHANGE, obj) obj.AddUserData(bc) c4d.EventAdd() def setQuickTab(obj, inst, data): # change User Date container to type Cycle, populate with Children Names descid = data[0][0] bc = data[0][1] children = obj.GetChildren() # Build new cycle options container dynamically cycle = c4d.BaseContainer() for i,child in enumerate(children): cycle.SetData(i, child.GetName()) bc[c4d.DESC_CYCLE] = cycle doc.AddUndo(c4d.UNDO_CHANGE, obj) # Set modified description data container inst.SetUserDataContainer(descid, bc) def main(doc): obj = doc.GetActiveObject() if (obj == None): gui.MessageDialog("Please select the Root of the Assets you wish to Instance.") return doc.StartUndo() inst = createInstance() doc.InsertObject(inst) AddLongDataType(inst) data = inst.GetUserDataContainer() setQuickTab(obj, inst, data) doc.AddUndo(c4d.UNDO_NEW, inst) doc.EndUndo() c4d.EventAdd() if __name__=='__main__': main(doc)
  • Treeview and Right Click

    python r20
    3
    1
    0 Votes
    3 Posts
    420 Views
    P
    @mp5gosu said in Treeview and Right Click: RemoveData() Great, thanks.
  • Stacking Tabs Menu?

    r21 python
    7
    0 Votes
    7 Posts
    826 Views
    B
    @r_gigante Thanks for the response. RE: Extending to get it working for more than one should be trivial. Unfortunately, the whole code is trivial to me being novice. Anyhow, I guess I'll just learn on QuickTabCustomGui on a separate thread. RE: With regard to the "stacked" tabs functionality, as said above Yes, you did. I was wondering if there is an option for the TabGroupBegin as that is somewhat straight forward to me rather than the QuickTabCustomGui. So I guess, this confirms that it is not possible for the TabGroupBegin. Again, no further action required. Will just open another thread for the QuickTabCustomGui.
  • Right Click Contextual Menu on a Button?

    r21 python
    3
    0 Votes
    3 Posts
    618 Views
    B
    @m_adam Works as expected! Thanks again for the sample code, makes everything clear.
  • Retrieving Link from Hyperfile

    python sdk
    3
    1
    0 Votes
    3 Posts
    462 Views
    ?
    Thank you @r_gigante for the reply! Sorry if the intent is unclear: this self-contained script was something I came up with last night to demonstrate an issue I'm having in my plugin which is too many scripts to post to the forums. Since the user can't select an object after the script is running, I added that catch to make sure an object was selected to show what was going wrong. My Goal I am trying to save a link to a scene object and its matrix to a hyperfile so the user can load the hyperfile in another session and restore the link to the object so that I can apply the saved matrix. I don't need the object itself. Update I updated the original script's GetLink() method to pass a reference to the active document, but that did not solve the issue.
  • Free Form GUI Design Layout?

    r21 python
    5
    0 Votes
    5 Posts
    681 Views
    B
    @r_gigante Thanks for the response. Unfortunately, I still can't read C++ codes at the moment. Is there a python equivalent of that page? I can't seem to see one. There is a page for that but it's like a dictionary. It does not contain any sample codes like in C++ If it does not exist, do you have any C++ with an equivalent Python page in the documentation? I'll just to interpolate them as much as possible. ########################## I also checked the Github sample and it does contain a GeUserArea sample But the button part is still in GeDialog. Is it possible to make the GeUserArea part to be clickable like a button?
  • Make Deformer Affect Objects Outside Hierarchy?

    r21 python
    12
    0 Votes
    12 Posts
    2k Views
    B
    @wuzelwazel Yes, I'm referring to the file you uploaded earlier. There is some delay when hitting Undo. You can see it here: https://www.dropbox.com/s/hayep6r4iyowqt5/c4d194_deformer_affect_outside_hierarchy_02.mp4?dl=0 RE: perhaps making sure the objects with the surface deformers are lower down the list In your file, yep they are. That's why I was wondering why there is a lag.
  • 0 Votes
    3 Posts
    943 Views
    r_giganteR
    Hi jhpark, thanks for reaching out us. Aside from the notes left by @blastframe - thanks dude for the remarks - I think it's worthy, thinking of a more generic scene, to mention the need BaseDocument::ExecutePasses() to be sure that everything is actually evaluated before querying the scene rather than the EventAdd() which serves a different scope. This function is responsible to execute the scene evaluation and, consequently to be sure that, moving from a frame to another, all the items in the scene reflect the changes imposed by the frame switch. The approach used by @blastframe actually operates on CTracks and key but, although this approach works fine for your specific case, when more evaluation dependencies are created in the scene you could easily end up in unexpected results. The code could then look like frames_count = 10 # [Set] frames counter for f in range(0, frames_count): doc.SetTime(c4d.BaseTime(f, doc.GetFps())) # evaluate the scene doc.ExecutePasses(None, True, True, True, c4d.BUILDFLAGS_NONE) obj = doc.SearchObject('Cube') # get object position x = int(obj.GetMg().off.x) y = int(obj.GetMg().off.y) z = int(obj.GetMg().off.z) # get object color r = int(obj[c4d.ID_BASEOBJECT_COLOR].x * 255) g = int(obj[c4d.ID_BASEOBJECT_COLOR].y * 255) b = int(obj[c4d.ID_BASEOBJECT_COLOR].z * 255) print("Frame = " + str(f) + ", (X,Y,Z) = " + str(x) + "," + str(y) + "," + str(z) + ", RGB = " + str(r) + "," + str(g) + "," + str(b))
  • Update GeDialog When Button is Pressed?

    r21 python
    6
    0 Votes
    6 Posts
    694 Views
    B
    RE: So if it recreates the same things it is probably because images are not local to your class but only to your function, Ah, gotcha. Thanks for the heads up. Works now as expected
  • Simple way to save images?

    r21 python
    5
    0 Votes
    5 Posts
    568 Views
    M
    @bentraje said in Simple way to save images?: Union This means it can be either a str or either a c4d.storage.MemoryFileStruct. (Both don't really make sense). Cheers, Maxime.
  • Modify Preferences of an Third Party Plug-in?

    r21 python
    3
    0 Votes
    3 Posts
    346 Views
    B
    Hi @zipit Thanks for the response. The thread reference works as expected. Here is the code I used: op = plugins.FindPlugin(1027974) # Retrieved from the script log if op: print op[c4d.XPPREFS_SYSHUD_SHOW] # we know the enum from the console Have a great day ahead!
  • GUI Layout Issues

    python sdk
    4
    2
    0 Votes
    4 Posts
    608 Views
    ?
    @m_adam You are a legend! I've learned a lot about UI in Cinema 4D from this post, thank you very much.
  • Prorender style viewport rendering

    2
    0 Votes
    2 Posts
    441 Views
    r_giganteR
    Hi eldiren, thanks for reaching out us. With regard to your request, please consider that ProRender has been integrated by using a non-public API which among the different features also gives permits to integrate the renderer buffer with the viewport. At the moment aside from the documentation about VideoPostData for non-interactive or semi-interactive rendering purposes and the approach seldom used of representing in a GeUserArea or via the SceneHook::Draw function the results of a renderer buffer, there are not yet examples showing how to integrate external renderers in Cinema 4D. Best, R
  • Insert object in Treeview

    r20 python
    4
    0 Votes
    4 Posts
    1k Views
    P
    Thanks, great explanation! One small issue. Delete doesn't work because objParent' is not defined. Traceback (most recent call last): File "scriptmanager", line 251, in DeletePressed NameError: global name 'objParent' is not defined Here the code that, I think, solves the issue: def DeletePressed(self, root, userdata): "Called when a delete event is received." for tex in reversed(list(TextureObjectIterator(self.listOfTexture))): if tex.IsSelected: objParent = tex.GetParent() # Added listToRemove = objParent.GetChildren() if objParent is not None else self.listOfTexture listToRemove.remove(tex)
  • Access the Object List Xpresso Node for Python Iteration

    python r21
    10
    0 Votes
    10 Posts
    1k Views
    B
    @m_magalhaes RE: Does using the object list iterator is mandatory or not ? For this one, it kinda is since the whole code base rest on the for loop section. RE: you can see in this file that i can use UserData Thanks for the clarification. I see what you mean now. It works on my use case. Have a great day ahead!
  • String compare

    7
    0 Votes
    7 Posts
    874 Views
    C4DSC
    @m_magalhaes Thanks for bringing this up, as it seems I had overlooked it on multiple occasions. Which also points me to the fact that the R19 SDK did have a String::operator == () Also overlooked that all those years. I need better glasses.
  • Bend Deformer Using C++

    c++ r19 sdk
    18
    2
    0 Votes
    18 Posts
    3k Views
    M
    Yes because I've done it