@mikeudin Thx Mike,
Even though I don't speak a word of Russian, I do like your movies
jochemdk
@jochemdk
Working in R20-S2024
Best posts made by jochemdk
-
RE: MographToNulls available for free as a Python scripting tag
-
RE: Wrong random clone displayed issue
@m_adam
Hi, I did some more testing…Things only go wrong with a linearCloner’s offset if:
_ any applied baseEffector has the visibility check turned on
_ has a mograph selection/weight tag
_ and if a linearCloner’s offset >= the smallest index of the selection
_ (so random has nothing to do with it -
RE: WeightManager/Autoweight > set the amount of Joints in Python?
Hi @m_adam, thx for your input, it does reset the WeightManager, but doesn’t do the autoWeighting accordingly..
_First thing I noticed: a difference between int 64 & 32. Not sure if this might be a problem..
Reading the GET> AutoWeight…base.jointcount : <int64> “number of joints”
Reading the SET> AutoWeight…base.jointcount : <int32> “number of joints”_After the WeightManager is being set (to 1 joint in my case), I can’t click on the “Calculate button” manually.
Nothing happens, unless I change the joint count manually to another number. So something in the update hasn’t been applied..
Note that reading the dict says <int32>, until manually changed, than is says <int64> again.._I also tried wmgr.SetDirty(doc) / wmgr.Update(doc) / followed by another c4d.EventAdd().. Perhaps these need a different approach as well?
I tried to find something in the “maxon/frameworks” folders you linked to, but couldn’t find any info on how to tackle this issue.So the current status is still that “default weighting” is applied.
If you can please help in the right direction, it would be greatly appreciated, tia, Jochemimport c4d, maxon from maxon.frameworks import animation def main(): doc = c4d.documents.GetActiveDocument() wmgr = c4d.modules.character.CAWeightMgr #wmgr.SetDirty(doc) heatmap_id = wmgr.GetAutoWeightAlgoId(doc, 1) # heatmap settings = wmgr.GetAutoWeightDictionary(doc, heatmap_id) settings.Set(maxon.frameworks.animation.AUTOWEIGHTPARAMETERS.JOINTCOUNT, 1) settings.Set(maxon.frameworks.animation.AUTOWEIGHTPARAMETERS.SELECTEDPOINTS, False) settings.Set(maxon.frameworks.animation.AUTOWEIGHTPARAMETERS.ALLOWZEROLENGTH, False) wmgr.SetAutoWeightDictionary(doc, settings, heatmap_id) #doc.ExecutePasses(None,True,True,True,flags=c4d.BUILDFLAGS_NONE) c4d.EventAdd() # getWeightTag - setActive firstJoint = doc.GetFirstObject().GetDown().GetDown() # just in my testDoc.. weightTag = (firstJoint.GetWeightTag())["op"] doc.SetActiveTag(weightTag, c4d.SELECTION_NEW) #weightTag.GetObject().SetBit(c4d.BIT_ACTIVE) # update weightManager / doesn't make any difference.. #wmgr.SetDirty(doc) #wmgr.Update(doc) #c4d.EventAdd() # autoWeight func wmgr.SelectAllJoints(doc) bla = wmgr.AutoWeight(doc) print(bla) # prints True, but not in the right way :{ c4d.EventAdd() if __name__=='__main__': main()
Latest posts made by jochemdk
-
Is it safe to change the timeline from the main function of a python tag?
Hi, I'm trying to code according to the treading manual..
But it's not clear to me if changing the timeline can be safely done from the main function of a python tag, or that that kind of functionality needs to be done from the "main tread".
Hope to hear from you, tia, Jochem
# some simplified script.. def set_timeline(): # at the moment this runs (without crashes) from the main function on a python tag.. startFrame = 0 endFrame = 123 # just some numbers.. doc = op.GetDocument() fps = doc.GetFps() minTime = c4d.BaseTime(startFrame,fps) doc.SetMinTime(minTime) doc.SetLoopMinTime(minTime) maxTime = c4d.BaseTime(endFrame, fps) doc.SetMaxTime(maxTime) doc.SetLoopMaxTime(maxTime) def message(msg_type, data): # simplified message function.. # .. if not c4d.threading.GeIsMainThread(): return # safer to call set_timeline() from here?..
-
RE: Axis lock/unlock in message function / UI update?
Yes, a question, where did the "mark as solved" button go
-
RE: Axis lock/unlock in message function / UI update?
Thx a lot @ferdinand !!!
Sorry, was a bit busy the last days, but I'll check asap. -
RE: Axis lock/unlock in message function / UI update?
Hi @i_mazlov
Thx for answering… I’ll try to be clearer - incl. screenshots next time :} & Yes, I was talking about the XYZ-axis mode buttons (and scaleTool).
Now I’m kind of confused, since I do try to stick to the threading rules. I can work around the axis modes, but my most important question is below:
One of the things mentioned on this forum by the devs was that the CallCommand should only be used from within the main thread.
That’s why I did put it in the message function, where I assume(d) it would be safe after:
“if c4d.threading.GeIsMainThread(): 'do some stuff..'”Isn't that kind of the same as from within a Python tag you can use CallCommands within a BUTTON function (where you can also use EventAdd()))?
-
Axis lock/unlock in message function / UI update?
Hi, I’m working with a Python Tag (not a plugin) attached to an object.
The goal is to only let the user scale the object if the document is in objectMode.So, I try setting the XYZ axis states accordingly within the message function.
This kind of works..
_ transformHandles are instantly updated
_ but the XYZ axis icons in the main UI ain't always updated..
_ hovering over the XYZ icons will update the state (which is far from ideal)So, how to update/redraw the generic C4D user interface?..
And is there a cleaner/better way to catch some messageType/Event to handle this?Tia, Jochem
import c4d doc: c4d.documents.BaseDocument op: c4d.BaseTag def message(msg_type, data): if msg_type == c4d.MSG_NOTIFY_EVENT: event_data = data['event_data'] ### ---------------------- the part reacting to UserData buttons ---------------------- ### if event_data['msg_id'] == c4d.MSG_DESCRIPTION_COMMAND: desc_id = event_data['msg_data']['id'] try: if desc_id[1].id == 18: print("some udButton press..") except (IndexError): pass ### ---------------- below: the part reacting to UserData changes ----------------- ### elif event_data['msg_id'] == c4d.MSG_DESCRIPTION_POSTSETPARAMETER and op.GetObject().GetUserDataContainer(): if not c4d.threading.GeIsMainThread(): return print("some udData change..") ### ------------------ which messageType/Event?.. now kind of hacky.. ----------------- ### if doc.GetAction() == 200000089 and c4d.threading.GeIsMainThread(): # scale/mainThread.. if doc.GetMode() == 1: # objMode.. for ax in [12153,12154,12155]: if c4d.IsCommandChecked(ax) == True: c4d.CallCommand(ax) #print("unLocked") elif doc.GetMode() != 1: for ax in [12153,12154,12155]: if c4d.IsCommandChecked(ax) == False: c4d.CallCommand(ax) #print("locked") # this kind of works.. # _ transformHandles are instantly updated # _ but the XYZ axis icons in the main UI ain't always updated.. # _ hovering over the XYZ icons will update the state # so, how to update/redraw the generic C4D user interface?.. # _ & is there a better solution for the above if-block.. def main(): # listen to buttonPresses on host if not op.GetObject().FindEventNotification(doc, op, c4d.NOTIFY_EVENT_MESSAGE) and op[c4d.EXPRESSION_ENABLE] == True: bc = c4d.BaseContainer() op.GetObject().AddEventNotification(op, c4d.NOTIFY_EVENT_MESSAGE, 0, bc) #...
-
RE: Character Defenition Tag - maxon.Id?
Thx Maxim, so I'll have to wait until the next version..
-
Character Defenition Tag - maxon.Id?
Hi,
Before release 2024, the Character Defenition Tag has always been a "Black Box" - at least for Python. I recently discovered that now there is/should be a way to get and set data. I tried to look in various .h-files, the C++ docs, Github etc. but I just can't find the corresponding maxon.InternedId to use.
# small non-working example.. import c4d, maxon def main() -> None: obj = op.GetObject() # from a pyTag.. csTag = None for tag in obj.GetTags(): if tag.GetType() == 1055068: csTag = tag # c4d.modules.character.MTCharacterDefinitionTag break print (csTag.GetExposedBodyPartSettings( > maxon.Id < ))
So, the base question is: what's the maxonId?
& the sub question: is there some python script to get the Ids?Thx in advance, Jochem
-
RE: Userdata not updating correctly on primitive splines & polygons in 2024..
Hi Ferdinand, thx for your answer - although I didn't expect this, considering I never ever had any trouble with the script..
But your point is clear. It means I've got to do some more investigation.. -
Userdata not updating correctly on primitive splines & polygons in 2024..
Hi, I’ve got a simple but strange case in 2024 (while it was working properly before..)
There’s a simple script to hide userData on a python tag.
Depending on the on/off state of the switchBoolean, 1 of the other 2 pieces of user data needs to be hidden.
This works fine on editable splines & polygons, but not on primitive versions - with the exact same tag..So, there must be something happening on the primitive splines and polygons, which I don’t understand..
The pyTags are set to “generators 499”, so that couldn’t be it.The issue is that on the primitives, when the switch says ON, the user date shown say OFF and visa versa..
And only after clicking the “wrong” boolean on the right, the other version will show up. So I need an extra click to get the right result.
(note: working on Mac right now, haven't tested it yet on PC..)Is there anything new to “updating/redrawing” the UI, or is this something to be fixed in a future update?
Kind regards, Jochem