Jump to content

jed

Limited Member
  • Posts

    2,189
  • Joined

  • Last visited

  • Days Won

    66

Everything posted by jed

  1. This makes a cube visible when link is present https://www.dropbox.com/s/arqibkx1hi8p7hb/linktransfer2.c4d?dl=1
  2. I think this does it, link is python node input from Null A link (ie Null B) import c4d #Welcome to the world of Python def main(): null_A = doc.SearchObject('Null A') if link: link[c4d.ID_USERDATA,1] = null_A[c4d.ID_USERDATA,2] link[c4d.ID_USERDATA,2] = null_A[c4d.ID_USERDATA,3] link[c4d.ID_USERDATA,3] = null_A[c4d.ID_USERDATA,4] I used if link because get yellow node error if no link present https://www.dropbox.com/s/uqrkqtyt64bjlna/linktransfer.c4d?dl=1 no guarantees - I'm also a bit of a Python novice edit - to get the correct userdata syntax, I just typed in null_A and dragged the relevant name in from the GUI.
  3. Here's a rangemapper with this ease-ease spline - the spline represents input as X 0 - 1, and output as Y 0 - 1. You make points by ctrl-click - make sure start, end are on 0, 1 etc. Upper and lower must be clamped, or RM will calculate an output when outside the range. I used frame, but I think secs would also be OK https://www.dropbox.com/s/489z0asxthr9nl6/easemapper.c4d?dl=1 edit: just ease in, starts at 0 https://www.dropbox.com/s/sqcvar61wgg92yh/easein.c4d?dl=1
  4. Yes it would be useful - that's what the rangemapper is. Can you explain the difference between what you are describing and this - utils boxstep does this in Python, or you could write your own with if, elif, else etc but that is just re-inventing the wheel.
  5. I'm still not sure why XPresso rangemap doesn't do what you want - it has spline control. There's a Python equivalent Boxstep and an eased version Smoothstep - both map to 0 - 1 details (utils clamp just clamps). I noticed your Python maxoutput is 100 - you do realise that 0-100% for spherify (or anything) is actually 0-1 decimal ? Also GetActiveDocument is not required since doc is a built-in variable.
  6. It's not very clear what you mean by clamp step by step - your file is already proportional between F25 and F50. Do you mean 100% in that range and 0% outside ? In XPresso that's just xpresso version https://www.dropbox.com/s/kju18ew7gbko25t/testxp.c4d?dl=1 python version https://www.dropbox.com/s/lf4mr4usmz1j5u6/testpy.c4d?dl=1 more info required . . .
  7. If you just need to tweak the settings whilst setting up your scene, you could always 'tear off' the panel by clicking the + icon - you can have as many of these as you like
  8. jed

    Spline driven gradient

    You are mapping 2D to 1D, so you need some trig. If you divide the spline point data Yt / Xt this gives you the tangent of the angle of the spline. Taking the atan of this gives you the actual angle. Dividing by 90 gives a %, take that from 1 and you have a number for the bias. https://www.dropbox.com/s/kbt0smfdeeso6ti/mapping.c4d?dl=1 maybe . . .
  9. Can I just add that, unlike a lot of the free 3D models that are online (eg cars, trucks), the Turbosquid drones I bought were the correct C4D format, had sensible hierarchy with English names (ditto the mats) with all the axes centered and aligned - including the propellers, camera etc. Just need a bit of XPresso math to make them go.
  10. I'm sure a lot of you guys have used Turbosquid in the past, but last night I decided to try them out for the 1st time - I bought a couple of quite decent quadcopter drone things for about 25 Euro. The thing that made me laugh though, was when I clicked 'buy' and a warning popped up reminding me I was buying a c4d model not an actual item. I had visions of someone googling 'remote control helicopter' eg for a childs Xmas present, finding a nice one for $400 at TS, clicking buy and when it said 'downloading . . .' going WHAT ? It must have happened at least once for them to have that disclaimer.
  11. Sting makes his first post at C4D Cafe explanation well it does say off-topic, light-hearted + fun
  12. Controlling stuff by disabling XPresso is not the best method IMHO, but you could either keyframe the enable checkbox in attrib manager, or make a second XPresso control window, drag your main XP tag in and use the enable port. In this snip the compare <= gives a 1 for upto F25 for enable, then a 0 to disable.It's a bit more flexible. I'd suggest stopping the follow inside your code - post your scene and I'll have a look. If it's a big scene (or has copyright models etc) strip it down to the relevant part.
  13. I thought that's what the poster meant, although in my little (theoretical) test the string length changed by about 5% when stretched, so if my assumptions were correct the string diameter would only change by 2% - would you even notice a 2% change ? A rubber band gets thinner when you stretch it . . . I 'bow' to your superior knowledge on the subject.
  14. I'm guessing that a string gets thinner when it is stretched on a bow, and the volume is constant. I think the vol of a string is the cross section X length ie volume = pi * R^2 * L so if the volume is constant, R is proportional to the square root of 1/L - so doesn't change much. Try pulling the center point on this 'string' spline - there's an exaggerated circle for comparison. It hardly varies. https://www.dropbox.com/s/disr7u4vjk82on6/bow.c4d?dl=1
  15. Probably easiest to make a separate control XPresso window where your switch drives the enable port for your main XPresso. https://www.dropbox.com/s/m95k4ithd5tv9f8/enablexp.c4d?dl=1
  16. I hate to say this graphos, but I've wasted your time here - that code is too advanced for me to understand, although in a way it illustrates the problems I have with Python. There's a ton of tutorials on YouTube and elsewhere that will teach Python from print('hello world') and up. That's how I am learning regular number-crunching Python. There doesn't seem to be anything explaining C4D-specific Python that starts at 'hello world' - it's either the MAXON manual or nothing, and the MAXON book might as well be in Russian. If I were to type any of the terms in your code into the MAXON website search box, the results would be meaningless to me. TBH I can't tell which are your vars and which are reserved words. It's the same at StackOverflow - you need to be an advanced coder to understand the answers to questions posted by noobs, which sort of defeats the purpose of a forum. As usual, there's an XKCD comic that sums it all up.
  17. @graphos could you give an example of your basecontainer method - sounds interesting.
  18. Same problem with frame dependent on or off. I've noticed a similar thing when I want to print to console for debugging - there has to be an output port connected to a result etc to get a print (although removing the Python output port lets me print). It's no big deal having an extra unwanted port - just puzzling. Maybe it's not a bug - it's a feature, as the saying goes.
  19. Does an XPresso Python node need a connected output port to function correctly? I have a flying helicopter WIP that started life as an XPresso Python node with user data slider inputs and position etc output ports. It worked OK, but I decided to have a go at putting everything in the code ie reading my slider data and writing position + rotation vectors to the helicopter - no ports at all. Trouble is, it kept locking up - and intermittently at that. I thought it was my code, but after a lot of tinkering (trial and error) I found that having a 'dummy' variable connected to a result node - see snip - more or less guaranteed a flying helicopter. I tried a fix I read somewhere about c4d.EventAdd(), to no avail. I also tried copy/paste into a Python tag, but got even weirder reults - when I stopped the timeline, my helicopter kept flying ! Any insights into this output node mystery appreciated. Here's the WIP file - it has a bit of smoothing on the variables to make the aircraft react less jerky to the controls. File's 11MB due to some textures. https://www.dropbox.com/s/muln5vt8o3j4t0j/helicopter7.zip?dl=1
  20. I could be being generous here, but I'm sure sometimes a noob is overwhelmed by the answer and feels a bit embarrassed to say 'can I have that in English'. I realise it's hard to guess the level of knowledge the enquirer has, but if the noob question is 'how do I make this cube look nice?' and the reply is 'use a matrix fracture with a Voroni object and turbulence noise in the reflectance alpha channel with PLA set to negative infinity with a spline deformer mapped to a random vector using Python', the noob will think 'maybe C4D isn't for me'. You see replies here that just say something like 'use a step effector', and I think if the guy knew what a step effector was and how to use it he wouldn't be asking. I've got to admit I'm guilty of both blinding people with science, and being ashamed to ask for a better explanation. Maybe ashamed is a bit strong, but you get my drift.
  21. jed

    RC helicopter

    Thanks for comments. The math is based on how I generated the movement - both spacial and H rotation - of the helicopter, by adding a small value every frame. By varying the amount added, an object can speed up or slow down smoothly. This is a topic that crops up here from time to time when discussing rotation. Generating a rotation angle with angle = time in secs * a constant is fine for constant speed, but changing the speed by varying the constant usually results in the object going backwards or just glitching. Getting the angle by angle = angle at last frame + delta allows for smooth speed change by varying the delta. You can do this in XPresso usually needs zeroing at F0 or in Python def main(): global x frame = doc.GetTime().GetFrame(doc.GetFps()) # get current frame if frame == 0: x = 0 else: x += speed # increment x by speed the XP and the Python are evaluated once per frame, although when presented with the concept of x = x + 1 most folk go WHAT ?
  22. jed

    RC helicopter

    I've been having a bit of fun today doing the math to fly a Lego helicopter I got from Google's Sketchup 3D Warehouse, so I thought I'd share the file. The file's 11MB because there's some tex for the background mountains. I made a short video to show how it works scene https://www.dropbox.com/s/tcnzx19uqtyucg9/helicopter.zip?dl=1 there's a bit of info in the XPresso remarks.
  23. Was surprised to see this the other day - only kidding - I re-inked yesterday's XKCD strip. The original is here. For people who don't know what I'm on about, XKCD is a 3X weekly comic strip about computers, programming, physics and nerdy stuff in general. There's an 'explain xkcd' site for all the strips eg for the above here, where I often find hidden references in what I thought was a simple joke eg the above strip alludes to the Alan Turing film The Imitation Game (which I'd missed). It's quite hard to find a good comic font - I used VTC Letterer Pro for my re-inking. 2 of my XKCD favorites - GOTO, and Code Quality https://www.xkcd.com/
  24. I loaded the preset, but for some reason couldn't see the contents. I unpacked it, and it seems to be 2 compares - is #1 lower than both #2 and #3. I replicated that in this file and it seems OK https://www.dropbox.com/s/263gawpledqc81h/2compares.c4d?dl=1 BTW - I'm out of my depth with baseobject-type python - I just do the regular number crunching variety.
×
×
  • Create New...