Jump to content


Regular Member
  • Content Count

  • Joined

  • Last visited

  • Days Won


MighT last won the day on December 22 2019

MighT had the most liked content!

Community Reputation

18 Noble Beginner

About MighT

  • Rank
    Cafe Ronin

Profile Information

  • First Name
  • Last Name
  • C4D Version
  • Website URL
    Intel Core i7-3930K, nvidia GTTX1070
  • Location
    Hannover, Germany

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Hi, such questions are probably better asked over at the Plugin Café, where MAXON provides free support for developers. Anyway, looking at the InstanceObject's __init__() function's documentation, it doesn't support a parameter to set the reference object, as you try to do it. Instead you could either set the "Reference Object" parameter like any other parameter or simply call the provided SetReferenceObject() function. Like so (the undo stuff is completely optional): import c4d def main(): if op is None: return inst = c4d.InstanceObject() inst.SetReferenceObject(op) doc.StartUndo() doc.InsertObject(inst) doc.AddUndo(c4d.UNDO_NEW, inst) doc.EndUndo() c4d.EventAdd() if __name__=='__main__': main() Furthermore, as you can see in my example, in Script Manager there are some global variables predefined (actually that's true for all places, where one can use Python in C4D, yet, the available ones and their content differ a bit): 'op' is the currently active object 'doc' is the currently active document ... So there's no need to use GetActiveObject() in this context. For more information I really recommend the docs and above mentioned Plugin Café as it already contains answers to loads of questions. One additional note: As you are using InstanceObject class, which got introduced in R20, you'd probably want to update your profile with the actual version of C4D you are using. This will help people tremendously in helping you. Cheers Edit: Fixed description of 'doc'
  2. You could make the Hemisphere editable (e.g. by pressing c) and afterwards it's just one click using Close Polygon Hole (in R21 in Mesh menu -> Add -> Close Polygon Hole, or press m followed by d). This results in an ngon closing the hole, which may or may not be desirable. I'm sure there are other more sophisticated ways resulting in more controllable topology, but I'll leave this to @Hrvoje (or one of the other pros in this forum). Cheers
  3. You may want to take a look at the Parent Constraint tag (or rather Constrain tag with Parent option set): Cheers
  4. You can't, there's only one Material Manager. But you may have noticed that in parallel to the Material Editor you also see your material settings in the Attribute Manager (yes, it looks slightly different, as the channels are organized in tabs). Attribute Managers you can have multiple and they can be locked in mode and/or entity they are showing. It can also be opened from Material Editor: In the Attribute Manager there's one more icon between the lock and the marked icon. The lock and this additional one are for locking mode and entity. See the online help for details. Cheers
  5. You could try the Push Apart effector. I guess. But difficult to judge without knowing the scene. But I'd definitely try that before any larger weapons. Cheers Sorry, I overlooked you are on R16. Push Apart effector is only available since R18.
  6. While I don't experience this issue, something like this could well be related to HiDPI and/or screen scaling (which has also been worked on for R21). So I guess anyone jumping onto this topic would like to get more information: OS? Screen resolution? Any OS screen scaling activated? Cheers
  7. Yes, I have been working for MAXON for four and a half years. Not sure about the specialist, though, probably rather something. And I sure have a good time Something like this can not work (not completely true, in Python there are means to pull it off, but that's a completely different ballpark). In short, you can not (as said above, in theory you could in Python, but not as simple as you did) create code from a string. The string itself (not the text represented by it) is an object and therefore, even if not immediately visible rather behaves like a variable. Leaving the quotation aside, you have written something like this: op[a + b] This is a simple function call on op. This is identical: op.__getitem__(a + b) So you have written: a = "c4d." b = bc[c4d.DESC_IDENT] op.__getitem__(a + b) b results from reading the description ID from the BaseContainer, basically an integer, lets say 42. Via type conversion a + b results in a string: "c4d.42" So, already it does not look as what you intended, probably something like c4d.PARAMID. But even if it resulted in a correct string, it's still a string, not code. For example c4d.DESC_NAME is a "constant" (lets keep it simple), in this case representing a reference to a integer value, namely 1. You tried to build the name of such a constant using a string. But instead of trying to interpret your string as the name of something else (I'd actually call it a symbol), it will simply pass the value (rather a reference to the value), which will then be interpreted as an integer (as that's what __getitem__() expects) by __getitem__(). Without going any deeper, please believe me the value of the string "c4d.PARAMID" is in no way 42 (the value assumed in the beginning). And without additional means there's no way for Python to know, that it should actually interpret the content of the string as code (or the reference to an ID) as you intended. Did I sufficiently confuse you? I could try to elaborate a bit more, e.g. via Skype, just contact me via PM. With sufficient interest also in a group. Cheers
  8. This is something, that would probably better be discussed in PluginCafé. Anyway, I'm not sure, I understand your first question. What kind of concatenation? And why? What's your final intent? Inside the loop you already have the DescID you need for parameter access: op[paramid] Your second question boils down to understanding DescIDs and DescLevels. I can't explain the entire concept here. There's some more explanation in the Python docs and I think, it's well explained in the C++ docs: Description manual and DescID manual. In short, with basic (or generic) datatypes (like e.g. integer, float, string,...) it's nice and easy. The parameter has an ID and a datatype, both stored in one single DescLevel. But what, if a datatype is more complex. Like a Vector, it consists of multiple float values. Is the type Vector or is it float? Here multiple DescLevels come into play. On the first level a Vector looks like a vector and then there's the second level describing the next lower level of the data type (every component of the vector is a float (or anything else, like a Vector of strings). For User Data it's basically the same. You have a complex data type (User Data), which needs more detailed explanation on the next level (actual UD ID, data type,...). The Description BaseContainer in the end just contains further details (name, value ranges, widget to use,...) needed to render the parameter in a Description Custom GUI (like e.g. used for the Attribute Manager). Long story short, maybe a few lines of code can shed some more light: import c4d def main(): if op is None: return description = op.GetDescription(c4d.DESCFLAGS_DESC_NONE) for bc, paramid, groupid in description: print paramid # see structure of DescIDs, user data has two levels (except for the root iuser data groups) if paramid[0].id == c4d.ID_USERDATA: # exclude groups (including the root one) from inspection if len(paramid) > 1 and paramid[1].dtype != c4d.DTYPE_GROUP: # the second DescLevel has the user data ID and type print 'User data ID/type:', paramid[1].id, paramid[1].dtype print 'Parameter: %s = %d' % (bc[c4d.DESC_NAME], op[paramid]) if __name__=='__main__': main() I hope this helps. Cheers
  9. I think, you are looking for the Camera Calibrator tag. Cheers
  10. Can you upload the scene? To be honest I still haven't fully understood, but I'd take a look, if there's a generic scripting solution.
  11. From this screenshot I can only guess, that you mean similarity topology-wise. I could imagine thousands of other similarity criteria: * Similar length of edges or entire loop * Similar orientation of loop * All edges in a similar region of space * All edges with a similar direction in space * All edges belonging to polys with the same material * For closed loops, all loops with a similar "surface" (area bounded by the edges) * ... * or a combination of all of the above I'm pretty sure, without you taking the time to describe the problem precisely, it will be hard to get help.
  12. What are the same selections? What makes them identical?
  13. Is this more of a practice on how to accomplish this? Otherwise I'd suggest the use of the Convert Selection command.This can also be used via Python (MCOMMAND_CONVERTSELECTION) with SendModelingCommand(). By the way, are you aware of Plugin Café? There MAXON pays a team to answer questions like these and often the answer can already be found there right away. Having said this, we (sorry, I didn't mean to MoClone myself, I was thinking of the community of this forum) could certainly also talk you through this here. The thing is, C4D doesn't really know the concept of an edge, there are only points/vertices and polygons. Edges are implicitly defined due to the order of points which form a polygon. The Neighbor class you are already using provides some helpers to make this a little easier. Yet, it's no one liner. Actually the docs of the Neighbor class already contain roughly the code you need in the description of GetPolygonInfo(). So, if this is more a learning thing, I'd suggest to start there. Cheers
  14. I think, this has safety reasons. After a User Data parameter got defined, it's respective data is stored in a BaseContainer of the entity. And this value may now be used in a gazillion ways all over C4D, Xpresso, Animation,... I wouldn't take for granted, something expecting data of a certain type behaving gracefully when the data type suddenly changes. I'd call this defensive design. What is actually the issue? I do use User Data a lot, e.g. for UI prototyping, and it was never a real issue for me. If I need to change the datatype, I simply create a new parameter as you described and done. Why would I need to worry about the new ID (except changing it in one define in my code). Although I admit (and maybe this is also your main issue), it's a bit sub-optimal, to say the least, one can not see the new ID before closing and re-opening the dialog. In situations with already cluttered IDs (due to a lot of addition and removal of user data) it can get tedious. Which probably also answers my initial question... yet, I don't think, I would need the option to change an existing ID, but rather an option to see the ID of freshly created user data.
  15. Oh, sorry, you misunderstood. Please send them just your own issues and thoughts. I wouldn't want mine to falsely multiply. Seeing this thread we'll overlap anyway. At least for the Script Manager maybe we could get an option to autosave the script on pressing the Execute button. At least users wouldn't loose any scripts by stupid mistakes anymore. If we then could get the option to have external scripts also in Python Generator and Tag (and so on), this autosaving could help there as well. Is probably an easier change than asking MAXON to tackle Pyhon's global lock (which is the real problem behind those lockups), which may not even be technically possible or feasible. Regarding c4dpy: At least if you are Windows, it's well worth taking a look at Visual Studio Code. It's more an editor, than an IDE, yet with nice features. In PluginCafe Donovan also demonstrates the use of PyCharm with c4dpy.

Latest Topics

Latest Comments

  • Create New...