• ZipFile extracting spanned files

    Cinema 4D SDK r20 c++ sdk classic api maxon api
    10
    0 Votes
    10 Posts
    1k Views
    kbarK
    @zipit Really great insights.Totally appreciate all your comments. I have worked with zlib for many years and integrated it into many different platforms, apps and plugins. This is just the first time I have ever looked into splitting or spanning features. Off topic: Would be great to work on compression algorithms again. I keep eyeing up all the image compression formats being used and developed these days. Fun stuff.
  • 0 Votes
    6 Posts
    1k Views
    ferdinandF
    Hi, I am sorry, I hate it myself when people talk in acronyms, assuming everyone knows what they are referring to. PNG stands for Pseudo-random Number Generator. Here is an example for a simple trigonometric pseudo random hash function. Cheers, zipit """A simple example for a very simple "one-at-a-time" Pseudo-random Number Generator (PNG). It is basically just one line of code, which you can find on line 32. """ import c4d import math def hash_11(x, seed=1234, magic=(1234.4567, 98765.4321)): """Returns a pseudo random floating point hash for a floating point number. The hash will lie int the interval [-1, 1] and the function is a very simple generator that exploits the periodicity of the trigonometric functions. A more sophisticated approach would be to exploit avalanche behavior in bit-shift operations on binary data, like the Jenkins Rotation does for example. The postfix in the name (_11) is a common way to denote the inputs and outputs for PNGs. 11 means that it will take one (real) number and return one (real) number. 13 means that it takes one and returns three, i.e. returns an (euclidean) vector. Args: x (float): The value to hash into a pseudo random number. seed (int, optional): The seed value. This could also be a float. magic (tuple, optional): The magic numbers. The second one should be bigger then the first and both should be real numbers. Returns: float: The pseudo random hash for x in the interval [-1, 1]. """ return math.modf(math.sin(x + seed + magic[0]) * magic[1])[0] def hash_13(x, seed=1234, magic=(1234.4567, 98765.4321)): """Returns a pseudo random vector hash for a floating point number. Wraps around hash_11. Returns: c4d.Vector: The pseudo random hash for x in the interval [-1, 1]. """ vx = hash_11(x, seed, magic) vy = hash_11(x + vx, seed, magic) vz = hash_11(x + vy, seed, magic) return c4d.Vector(vx, vy, vz) def main(): """Entry point. """ # Some very crude statistics for the hashes. samples = int(1E6) # Generate 1E6 of each numbers = {i: hash_11(i) for i in range(samples)} vectors = {i: hash_13(i) for i in range(samples)} # Compute their arithmetic mean. amean_numbers = sum(numbers.values()) * (1./samples) amean_vectors = sum(vectors.values()) * (1./samples) # Report the results. print "First three random numbers: ", numbers.values()[:3] print "First three random vectors: ", vectors.values()[:3] msg = "Arithmetic mean of all random numbers (should converge to zero): " print msg, amean_numbers msg = "Arithmetic mean of all random vectors (should converge to zero): " print msg, amean_vectors if __name__ == "__main__": main() First three random numbers: [-0.8036933662078809, 0.20401213006516628, 0.6249060598929645] First three random vectors: [Vector(-0.804, -0.022, -0.872), Vector(0.204, 0.541, 0.115), Vector(0.625, 0.782, 0.896)] Arithmetic mean of all random numbers (should converge to zero): -0.000127638074863 Arithmetic mean of all random vectors (should converge to zero): Vector(0, 0, 0)
  • << Multiple Values>> in Attribute Manager

    Cinema 4D SDK c++ r20 sdk
    3
    0 Votes
    3 Posts
    476 Views
    D
    Thanks! That's exactly what I needed!
  • get bitmap of shader in r20

    Cineware SDK r20 c++
    4
    0 Votes
    4 Posts
    2k Views
    r_giganteR
    Hi @hazzzel thanks for reaching out us. With regard to your question, please consider that you might have to attach a VolumeData to the InitRenderStruct. For this scope please have a look at: Sampling a Shader. Creating a VolumeData about using Render::GetInitialVolumeData() or VolumeData::Alloc() Post #8 in Sample a shader thread. Best, R.
  • Splinefield radius reset to 0 when using takes

    Cinema 4D SDK r20 r21
    3
    0 Votes
    3 Posts
    487 Views
    M
    Hi @pyr I don't think there is anything related to the SDK and its a Cinema 4D bug so I invite you to post it on https://support.maxon.net/open.php On the contrary, if you experience this bug only via a script please post your script here so we can help you. Cheers, Maxime.
  • Unique name for object

    Cinema 4D SDK c++ python r20
    5
    0 Votes
    5 Posts
    785 Views
    C4DSC
    OK ... so I reinvented the wheel. # make unique tag name def makeUniqueTagName(theTag): if theTag != None: obj = theTag.GetObject() # get all names of the tags of same type usedNames = [] if obj != None: tag = obj.GetFirstTag() while tag != None: # skip the tag and # ignore tags of other types if tag != theTag and tag.IsInstanceOf(theTag.GetType()) == True: usedNames.append(tag.GetName()) tag = tag.GetNext() # If the name is already taken we will append a dot and number # and increment the number until a unique name is found. # Note that since we have created the tag we can assume that # the original name does not have a dot and number already. suffix = 0 uniqueName = theTag.GetName() while uniqueName in usedNames: suffix = suffix + 1 uniqueName = theTag.GetName() + '.' + str(suffix) theTag.SetName(uniqueName) return Maybe not the best nor cleanest code, but then again I am not used to code in Python. I am sure others might have a better solution, but this seems to work for what I need, so I am happy with how it turned out.
  • PointInRange details please

    Cinema 4D SDK r20 c++
    3
    0 Votes
    3 Posts
    388 Views
    C4DSC
    @m_magalhaes said in PointInRange details please: But as you can see, this is pretty easy to create your own function, there's nothing fancy True, and I did. I just wanted to bring this up, as the documentation was rather ambiguous.
  • 0 Votes
    6 Posts
    977 Views
    P
    Ah sorry.
  • Post Deformer Spline

    Cinema 4D SDK c++ r20 sdk
    7
    2
    0 Votes
    7 Posts
    1k Views
    D
    @m_magalhaes said in Post Deformer Spline: Thanks, Manuel! This is what I was looking for!
  • GeDialog shadows

    Cinema 4D SDK c++ windows macos r20 r19
    6
    0 Votes
    6 Posts
    1k Views
    ManuelM
    hi, this is the current state: "I think this is related to the ASYNC_POPUPEDIT being a non-resizable, modal dialog - and as such it is displayed kind of "Win legacy style" by the OS. Nothing we actively do set (and something which could change once they do further design overhauls in Win10)" Cheers, Manuel
  • 0 Votes
    4 Posts
    886 Views
    ManuelM
    hi, i'll set that thread to solved tomorrow without further feedback Cheers, Manuel
  • TreeViewFunctions, two LV_USER fields

    Cinema 4D SDK r20 python
    8
    1
    0 Votes
    8 Posts
    960 Views
    P
    Thanks, it is working.
  • 0 Votes
    4 Posts
    915 Views
    M
    Hi @daniell welcome on the plugincafe forum, Don't worry since it's your first post, I've set up it correctly but please for the next one, make sure to read and apply the next rules: Q&A New Functionality. How to Post Questions especially tagging. Finally, regarding your issue, you may find relevant the NodeData::GetDParameter() Manual and NodeData::SetDParameter() Manual. Cheers, Maxime.
  • Custom data+gui access with GetParameter()

    Cinema 4D SDK c++ r21 r20 r19
    6
    0 Votes
    6 Posts
    1k Views
    rsodreR
    @m_magalhaes No hurry, for now there's just one place where I need this, I get it using the BaseContainer. But I will probably use it more often, so if the DOTS example is updated I can replicate the solution to my own type and remove this workaround. Thanks!
  • 0 Votes
    16 Posts
    2k Views
    C4DSC
    @m_adam said in First Time calling SetAction does show the Brush tool's AM: And I did test only on R21 so be sure to check again because I wasn't able to reproduce as you said with default layout in R21. Cheers, Maxime. I am using R21.207 and with default layout see the brush tool in the AM (identical to what happens with R20.059). For safety, I have now tested your solution on R21 and works as expected.
  • Isoparm in Deformer plugin

    Cinema 4D SDK r20 c++ r21
    12
    1 Votes
    12 Posts
    2k Views
    Danchyg1337D
    @r_gigante Thanks for your reply! You were absolutely right about checking input type. When i did a simple type check everything started to work as it should!
  • Modifier dependencies

    Cinema 4D SDK c++ r19 r20 r21 s22
    6
    0 Votes
    6 Posts
    946 Views
    rsodreR
    Hi @m_magalhaes This was research for a feature I'll start implementing soon, and possible refactor. I'll mark as solved and if there's anything else I need I'll open it again. Thanks.
  • CommandData trigger from GeDialog

    Cinema 4D SDK c++ r19 r20 r21
    6
    0 Votes
    6 Posts
    643 Views
    C4DSC
    Nevermind. Trying to explain will probably lead us too far. I was only wondering if messaging was possible between a CommandData and its GeDialog.
  • Cinema 4D R20 plugin's conflict with Redshift

    Cinema 4D SDK r20 c++
    3
    1 Votes
    3 Posts
    680 Views
    Danchyg1337D
    @m_magalhaes No other dependencies. Plugin type is deformer. Yes, i should probably ask it on Redshift forum. Thanks for reply!
  • Copying Layers along with Objects

    Cinema 4D SDK c++ r20 sdk
    6
    0 Votes
    6 Posts
    745 Views
    D
    @Cairyn Thanks again! That's what I was afraid of, but thanks for the information!