Jump to content

jed

Limited Member
  • Posts

    2,189
  • Joined

  • Last visited

  • Days Won

    66

Everything posted by jed

  1. I don't know anything about plugins, but I had a similar problem recently when trying to reference a data file located in the same folder as my C4D scene, without resorting to the full path name (ie to make the folder more portable). This code worked for me import c4d, os def main(): directory = doc.GetDocumentPath() # get doc directory datafilepath = os.path.join(directory, 'testfile.txt') # get data file full path you might be able to adapt it to your needs edit - this is the full answer I got from cg society import os def doc_path_join(doc, *filenames): """ Creates an absolute path given by a document and a filename. The document must have a path, otherwise ValueError is raised. Example: doc_path_join(doc, "test.txt") # /example/path/test.txt doc_path_join(doc, "..", "test.txt") # /example/test.txt doc_path_join(doc, "tex", "test.txt") # /example/path/tex/test.txt @param doc Instance of c4d.documents.BaseDocument. Must have a document path. @param filenames Strings as filenames. """ directory = doc.GetDocumentPath() if not directory: raise ValueError("document has no path") return os.path.join(directory, *filenames)
  2. You don't need the rangemapper to convert to percent. XPresso treats 0 - 1 decimal as 0 - 100%. > Mr Pedantic
  3. Another from the guys about the perils of using unconditional jump https://xkcd.com/292/ explanation
  4. coding joke https://xkcd.com/1695/
  5. I thought doc was a built-in variable, although c4d.documents.GetActiveDocument() must exist for a reason - I've seen people include it. I'm with you re MAXON Python SDK - hard going to say the least.
  6. @SFXP some Python stuff for you - rangemap etc cheatsheets.zip BTW I wouldn't recommend learning Python inside C4D - too easy to lock up the program. I use the free Pycharm. https://www.jetbrains.com/pycharm/
  7. XPresso nodes like compare, rangemap, clamp etc have equivalents in Python, but you have to watch out for data type. XPresso is quite forgiving when connecting say real to string, but Python is more strict. Also be aware that integer division gives integer result in Python eg 3 / 2 = 1 have to specify real eg 3.0 / 2 = 1.5 this can trip you up when using current frame as a value, and is due to C4D using 2.7 Python
  8. jed

    Link as Sweep-Contour

    You can put an instance object where the profile shape is in your hierarchy, then swap out the reference object. I've used XPresso here, but you can just drop the object in from the OM without XP. instance.c4d
  9. For some reason, it seems that cinema doesn't like driving global rotation P on that semi-circle object when it's a child. Use local P or pull it out of its parent and it behaves. Another C4D mystery ...
  10. jed

    OSC message, python, C4D

    I looked on the website, and it says ' Open Sound Control server and client implementations in pure python (3.4+) '. If this refers to minimum Python version, you might be out of luck. Current Python seems to be 3.6, but C4D is still on 2.7.
  11. I would have thought some kind of Python lookup table would be easier - especially when entering the data. I'm not much of an expert in color spaces, but here's a rather lame bit of code for RGB output showing what I mean. I've used lists in C4D Python with several thousand elements, so that's not an issue, although with your setup I'm not sure if the limitation is in the user data or the XPresso. lookup.c4d
  12. Using a vibrate tag for light variation sounds a bit convoluted to me (unless the vibrate is also doing other stuff). I'd use a noise node with a rangemapper set to 0.3 min and 0.45 max as @DeCarlo said. You can tweak the noise frequency although, randomness being what it is, the light will never actually be on 30% or 45%. To achieve that, you could maybe output a higher range and use a clamp node set to the desired values. flicker.c4d you mean the massive effort of making 3 nodes ? Maybe @gurugugu wants to learn XPresso.
  13. More info on the base80 wheel - BaseWheel1.7.c4d base80onaspline2.c4d
  14. Look in my file - there's an XPresso tag for the base80 wheel with some matrix math.
  15. The base80 wheel is a bit like Roll It. You adjust the wheel radius and move the assembly using the parent null, and the wheel rotates correctly. In this file the base wheel is in another null, on a spline. base80onaspline.c4d In a vehicle, you can connect a (hidden) base80 wheel rotation to the real wheel rotation using XPresso. Just make sure both wheels have same radius.
  16. Interesting problem. Here's my XPresso python node idea - has press button. Position is local. def main(): global X control = doc.SearchObject('control') X = obj[c4d.ID_BASEOBJECT_REL_POSITION,c4d.VECTOR_X] # get X if control[c4d.ID_USERDATA,1] == 1: # if button pressed X *= -1 control[c4d.ID_USERDATA,1] = 0 # reset button back to off switchx.c4d
  17. I don't think obj has any special meaning (like doc, op etc) - it's more of a convention. Could have been for thing in mylist: <perform task on thing>
  18. jed

    Vacuum Tubes ?

    I turned off my adblocker, and saw an ad at the Cafe for a render farm that boasts 'solid state servers'. Really ? Have they just switched over from vacuum tubes ? I wonder what Cinebench scores you get with a couple of pentodes ... for anyone under 40 - vacuum tubes solid-state
  19. I'd say the best approach is to learn a bit of XPresso and create exactly what you want. It opens up a whole new world of animation possibilities - and is a lot of fun. > my $0.02
  20. I have a theory : programmers just get to do number crunching - but with C4D, programmers get to move stuff around. I guess it's an incentive.
  21. lol - I thought he meant 'piece of ****'
  22. I had a quick Google for Python dictionary and came up with this - make sure you get the correct curly/square brackets (and compile after editing) lookup.c4d in Python, you should also check in menu - script - console for error messages
  23. I use Python, so this is just a guess. In Python double equal is reserved for an equality test, single equal is used to assign a value if Input1 == 'A': Output1 = '1' If you've never used Coffee or Python, maybe you should learn the latter - there's more Python videos on YouTube, and I think Coffee is being phased out of C4D. Although I don't use them, in Python there's 'dictionary' - which is like a list of data pairs that can work as a look-up table to save all the if-this then-that typing.
  24. @pfx the speed's rangemapped down to 50% at max Y. Also there's a cosine of the incline angle component, to allow for a slope being longer than its 'sea level' distance.
  25. This is one of my on-going projects - a unicycle on some landscape. You can manually steer the unicycle in the viewport, but in this video it's switched to random. Uses the Base80 wheel. A breakdown (of sorts) with info about the Base80 wheel here (video). scene omscenes.zip if the scene plays too slow (eg on a laptop), disable any shadows or reduce landscape segments.
×
×
  • Create New...