• How to Add Multiple Redshift Pazzle Matte AOVs

    python
    2
    1
    0 Votes
    2 Posts
    2k Views
    ManuelM
    hi, if you wants to know how many AOVs you need for 10 objects you should use Ceil. After that, some math to have your ID raising by 1. numberOfAOVs = math.ceil(10 / 3.0) # will give you 4 for i in xrange(int(numberOfAOVs)): print ("create aov number {}".format(i)) for j in xrange (3): print ("value of field will be : {}".format(j + i * 3 ) ) I'm not a big fan of retrieving all the objects on each function. But first, make things works, than optimize. (at least at the beginning) Cheers, Manuel
  • Create a Redshift Camera with Python

    python r21
    3
    0 Votes
    3 Posts
    968 Views
    C
    Thanks! For whatever reason I couldn't get that particular code to work, but I eventually figured out a different method. I think my script is finished for now.
  • "Axis Center " Script button reuse problem

    r21 python
    3
    0 Votes
    3 Posts
    1k Views
    X
    Thank you very much for your help to solve the previous doubts. I will continue to work hard.
  • How to move splines in Python Generator?

    3
    1
    0 Votes
    3 Posts
    985 Views
    S
    Thanks for the answer. I will check it.
  • Left-Hand Local Coordinates to Right-Hand Local Coordinates?

    python
    4
    0 Votes
    4 Posts
    2k Views
    dskeithbuckD
    Thank you @zipit and @m_magalhaes for your replies! @zipit your response put me on the right track. The issue was that I was trying to do all of the conversions using C4D's left-handed coordinate matrices, and it was auto-fixing my "malformed" matrices. I ended up porting the Three.js Matrix4 and Euler classes from JS to python and using them in my script. So, the final code (leaving out the ported methods) looked something like: mg = self.op.GetMg() parent_mg = self.op.GetUpMg() c4d_to_three = c4d.Matrix( off=c4d.Vector(0), v1=c4d.Vector(1, 0, 0), v2=c4d.Vector(0, 1, 0), v3=c4d.Vector(0, 0, -1) ) # Convert to new coordinate space # http://www.techart3d.com/2016/02/convert-left-handed-to-right-handed-coordinates/ mg_three_coords = c4d_to_three * mg * c4d_to_three parent_mg_three_coords = c4d_to_three * parent_mg * c4d_to_three mg_mat4 = Matrix4(mg_three_coords) parent_mg_mat4 = Matrix4(parent_mg_three_coords) inv_parent_mg_mat4 = parent_mg_mat4.Clone() inv_parent_mg_mat4 = inv_parent_mg_mat4.Inverse() node_local = inv_parent_mg_mat4.Clone() node_local = node_local.MultiplyMatrices(inv_parent_mg_mat4, mg_mat4) position, scale, rotation = node_local.Decompose() if position != c4d.Vector(0): self.props["position"] = position if scale != c4d.Vector(1): self.props["scale"] = scale if rotation != c4d.Vector(0): self.props["rotation"] = rotation
  • Stuck with loop through tags

    python
    4
    0 Votes
    4 Posts
    1k Views
    ManuelM
    hi @SuperHomiak welcome to the forum. Thanks @zipit for the answer For your next threads, please help us keeping things organised and clean. I know it's not your priority but it really simplify our work here. Q&A New Functionality. How to Post Questions especially the tagging part. I've set the thread to a question and marked zipit answer as the right answer Cheers, Manuel
  • This topic is deleted!

    1
    0 Votes
    1 Posts
    14 Views
    No one has replied
  • Question about IDs for Python Dialog

    python
    3
    0 Votes
    3 Posts
    811 Views
    ManuelM
    hi, I'll set this thread as solved without feedback from your side. Cheers, Manuel
  • Access Class B's function inside Class A?

    r21 python
    5
    0 Votes
    5 Posts
    1k Views
    B
    @Cairyn @zipit @C4DS Thank you all for the responses. I ended up with @C4DS suggestion in using SpecialEventAdd() and CoreMessage for simplicity sake. Have a great day ahead!
  • Python - InExcludeData initialization problem

    5
    1
    0 Votes
    5 Posts
    2k Views
    ferdinandF
    Hi, @SolarPH said in Python - InExcludeData initialization problem: Now I know that initializing the InExcludeData is not InExcludeData.__init__ and the correct way was c4d.InExcludeData(), ... I am not quite sure how you did mean this, but InExcludeData.__init__ is one of the methods called when you invoke c4d.InExcludeData(). Like all double underscore methods __init__ implements an operator, in that case the construction operator. Invoking SomeClass() will first call the constructor SomeClass.__new__ and after that the initialisator SomeClass.__init__. Due to the fact that __new__ only rarely has to be implemented explicitly and because people are accustomed to talking about constructor functions, __init__ is also often called a constructor, while technically it is just the initialisator. A prime example would be both the InExcludeData documentation and my example code, which both talk about a copy constructor, but are actually referring to __init__ and not __new__. Cheers, zipit
  • Create Proper Hierarchical Data for TreeView?

    r21 python
    11
    0 Votes
    11 Posts
    2k Views
    B
    Thanks for the clarification. Have a great day ahead!
  • Hide Layer in Layer Manager

    3
    0 Votes
    3 Posts
    971 Views
    SwinnS
    Got it. Thanks.
  • Remove object from layer

    4
    0 Votes
    4 Posts
    1k Views
    SwinnS
    @PluginStudent said in Remove object from layer: op[c4d.ID_LAYER_LINK] = None op[c4d.ID_LAYER_LINK] = None c4d.EventAdd() did it! Thanks! As you can tell from my previous code, I am hacking my way through Python. If you saw the rest of it, you would probably have to sit down and maybe drink a Gatorade. Or something stronger.
  • PluginsHelpDelegate Info

    r21 r20 c++
    6
    0 Votes
    6 Posts
    1k Views
    ManuelM
    hi, there's nothing more to do in R21/S22, you should maybe post your project to see if there's something wrong. Cheers Manuel
  • Cross platform screencapture code

    5
    0 Votes
    5 Posts
    1k Views
    M
    Hi @C4DS, just to confirm that there is nothing built-in Cinema 4D. For python most of the library in the end only reroutes through OS call and does have a system dependant call, so you will probably end with something like that also in C++. Cheers, Maxime.
  • Render to texture transfer for C4D

    1
    2 Votes
    1 Posts
    1k Views
    No one has replied
  • This topic is deleted!

    1
    1
    0 Votes
    1 Posts
    18 Views
    No one has replied
  • Python script for Rectangle Selection with options

    4
    0 Votes
    4 Posts
    1k Views
    T
    Hi Manuel and @rb_rodrigo, Many thanks for the tips about the Python console and help with the code. I'm a beginner (not even that!) in scripting, so much appreciated. It works as expected now! Cheers, Frederik
  • Setting coordinates for selected faces (Python - Beginner)

    python
    9
    0 Votes
    9 Posts
    3k Views
    M
    You could also retrieve the current matrix of the gizmo with BaseObject.GetModelingAxis. Cheers, Maxime
  • Flock Modifier

    8
    0 Votes
    8 Posts
    3k Views
    fwilleke80F
    I didn't take it as rude, don't worry