Jump to content

kweso

Registered Member
  • Posts

    257
  • Joined

  • Last visited

  • Days Won

    2

Everything posted by kweso

  1. kweso

    arnold toon

  2. Servus Fritz! Thank you very much! There's a lot in your solution that will help me also in future projects! And thanks for the link to the maxon forum...
  3. Hey all! I hope this is the correct section to post this question. I built myself a little script that allows me to boole multiple objects in one go: import c4d from c4d import gui def main(): doc = c4d.documents.GetActiveDocument() doc.StartUndo() #Don't know if this works like this at all selected = doc.GetActiveObjects(1) while len(selected) > 1: newBool = c4d.BaseObject(c4d.Oboole) doc.AddUndo(c4d.UNDOTYPE_NEW, newBool) doc.InsertObject(newBool) newBool[c4d.BOOLEOBJECT_SINGLE_OBJECT] = True newBool[c4d.BOOLEOBJECT_TYPE] = 0 tmpA = selected.pop(0) tmpA.InsertUnder(newBool) doc.AddUndo(c4d.UNDOTYPE_CHANGE, tmpA) # ??? tmpB = selected.pop(0) tmpB.InsertUnder(newBool) doc.AddUndo(c4d.UNDOTYPE_CHANGE, tmpB) # ??? doc.SetActiveObject(newBool) c4d.CallCommand(12236) doc.AddUndo(c4d.UNDOTYPE_CHANGE, newBool) # ??? newerBool = doc.GetObjects()[0] selected.insert(0, newerBool.GetDown()) c4d.EventAdd(c4d.EVENT_FORCEREDRAW) doc.EndUndo(); if __name__=='__main__': main() Doing this, I thought it would be time to learn about "AddUndo". But it does not work like I thought it would. Would someone be able to point me in the right direction? WARNING: The script like it is now CHRASHES my c4d... If you'd like to use the script delete all "UNDO"-lines. Then it should work. Tyvm! kws EDIT: Yes, I know Booleans are the Crocs of modeling. But for my current task they really speed up my workflow...
  4. Thank you for the solution. Somehow this option must have been active by default on my previous projects. Never used it. Anyway, your are right. There's major clipping goning on when my basket is deforming. I'll animate the position and orientation of my parented object as a quick workaround.
  5. The "badges" should resemble metal plates. Therefor they schould not bend with the "basket" surface. But I still want them stick to it. And orient accodingly... So I think they way to go is clamp constraint (which I dont like due to its unpredictability) or the xpresso solution. At least the position worked for me in previous projects. And I can't see, why it does not now... Thanks anyway. I'll use the surface deformer as a last resort...
  6. Hey all, I have something that should resemble a soft fabric basked (attached to a baby stroller): I use a lowpoly-mesh with a pose morph to deform the thing like it would be folded: Then I have to "badges" that should be attached to the side: But not only does the orientation not work. Also the badges do not follow the deformation. That always worked for me in other projects. Would someone have an idea on how to let the badges follow the deformed mesh in position AND rotation? I know, I could try a clamp constraint. But those always seemed unstable to me in the past. Here`s the c4d (If someone had a spare minute or two): https://drive.google.com/file/d/1Q1ggE4ixOV7qwD6uXMKgGagxJ3Gl77T_/view?usp=sharing Thank you so much in advance! KWS
  7. Now I switched from python to xpresso: But it only works with the last clone. The others seam to add up weight so they have weights of way over 1 even when they're suposed to have 0. Maybe one of you guys can see why. TYVM! kws CloneVel2Weight_Python_Test.c4d
  8. Hey, is there an equivalent of after effects "valueAtTime" in xpresso and/or python in C4D? tyvm!!
  9. Er, quite embarassing. Of course. Didn't see the wood for the trees.... Thank you very much! While I have to say: Rotating B scales X. Strange...
  10. Hey, I got two (later maybe more) objects with different global positions, scales and rotations. Now I'd like to have an additional object that sits between those objects with position, scale and rotation all right in the middle of the others. import c4d def main(): bbb = doc.SearchObject("B") aaa = doc.SearchObject("A") xxx = doc.SearchObject("X") bMG = bbb.GetMg() aMG = aaa.GetMg() xxx.SetMg(bMG*aMG) The "*" is obviously wrong. How would i calculate the average of the Mg's? tyvm, kws
  11. hey, i thought it would be possible to bake a texture directly to an other shader via python without having to save a file / files to the harddisc... realtimeIllumBake.c4d I guess I hit a wall there. But if anyone would have some input, I would highly appreciate it! tyvm, kws
  12. doesnt have to be plight. i just want to check where and how much an objects vertices are hit by any of my many spot lights in the scene. then generate a vertex map from it.
  13. thx for your replies, i've done it with: def message(id, data): if id == c4d.MSG_DESCRIPTION_CHECKUPDATE: print data['descid'][1].id where data['descid'][1].id gives me the id of the user data. this user data has to be on the python tag (would rather have it on the object featuring the py-tag, but it works). did not find a solution to check for matrix changes of particular objects somewhere in the scene.
  14. Hey all, is there anything like the plight-node, that is availiable in xpresso, in python? I looked at c4d.modules.thinkingparticles but could not find something. TYVM! kws
  15. so I would have to set conditions for every possible change, a object could have. is there not a kind of event system in c4d-python? thx
  16. Thx for the input. A really powerful tag. Never payed attention to it. But for this case I fear it is not the way to go. I actually want to transform my objects an then have the script in my python tag react to it (update other objects). And, as i wrote, I want the same for user data. So if i change a slider, i want to e.g. readjust a spline in the scene. Of course, i could just let my function run continuously but that would drain on performance. My example in more detail: I have five n-Side splines and n free form splines. The python script is making the free form splines run through the corners of my n-Sides. So now i want to have a slider controlling the number of sides of my n-Sides. And then add or remove free form splines accordingly my script. As is said, I could let the script run continuously, but that would kill performance. And it is only needed, when the user changes the slider... thx, kws
  17. Hey, with the python tag, is it possible, to have functions be called on certain events (and only then)? Like if I change the transform of a certain object or certain user data fields? tyvm! kws
  18. Hey, thanks to [URL=http://forums.cgsociety.org/showthread.php?f=47&t=1443665]Cairyn[/URL] @ cgtalk I got my setup to control multiple splines with nSides: import c4d import random import math def main(): streaks = [] stkContainer = doc.SearchObject("Splines") stkContChildren = stkContainer.GetChildren() for idx in range(len(stkContChildren)): item = stkContChildren[idx] if "streak" in item.GetName().lower(): item.SetName("streak_" + str(idx+1)) streaks.append(item) handles = [] hndContainer = doc.SearchObject("Handles") hndContChildren = hndContainer.GetChildren() for idx in range(len(hndContChildren)): item = hndContChildren[idx] if "side" in item.GetName().lower(): item.SetName("nSide_" + str(idx+1)) handles.append(item) corners = item[c4d.PRIM_NSIDE_SIDES] radius = item[c4d.PRIM_NSIDE_RADIUS] angle = 360 / corners for cornerID in range(corners): xxx = math.sin(angle*cornerID * math.pi / 180) * radius yyy = math.cos(angle*cornerID * math.pi / 180) * radius globalPos = item.GetMg() * c4d.Vector(0, xxx, yyy) streaks[cornerID].SetPoint(idx, globalPos) streaks[cornerID].Message(c4d.MSG_UPDATE) [/CODE] Works great, but the thing is, the script is already heavy on performance. Is there a possibility to calculate the script ONLY if one of the nSides is moved or otherwise changed? tyvm, kws
  19. hey, i tried this already over at cgtalk, but it seems that here are more c4d-specialized people. so plz excuse the double post... as i see it here you cant read the velocity of a clone directly. i wanted to calculate it myself from MODATA_MATRIX and MODATA_LASTMAT but LASTMAT only works on particles it seems. how would i get the last frames matrix of a clone?or is there an other way to read a clones velocity?tyvm again!
×
×
  • Create New...