Object Use Color Property



  • On 23/03/2013 at 10:16, xxxxxxxx wrote:

    I have script that changes the objects display color. First turning on the Use Color option with this code:

    obj = doc.GetActiveObject()
    bc = obj.GetData()
    bc.SetLong(c4d.ID_BASEOBJECT_USECOLOR, 2)
    obj.SetData(bc)
    

    It even prints the correct value when I print GetLong, but the object doesn't change?



  • On 23/03/2013 at 12:22, xxxxxxxx wrote:

    We're supposed to use the Get&Set Parameters method as much as possible. And only use BaseContainers as a very last resort.

    In Python. That means using a bracketed syntax like this:

    import c4d  
    def main() :  
      obj = doc.GetActiveObject()  
      obj[c4d.ID_BASEOBJECT_USECOLOR]=2     #Equivalent to SetParameter() in C++     
      c4d.EventAdd()  
      
    if __name__=='__main__':  
      main()
    

    -ScottA



  • On 23/03/2013 at 12:56, xxxxxxxx wrote:

    Thanks Scott! I was racking my brain over that simple problem. Still seems like the base container should have worked though.



  • On 24/03/2013 at 09:22, xxxxxxxx wrote:

    BaseContainers don't work for everything. For example, you can't get the attributes of a light that way - you have to use Get/SetParameter.



  • On 24/03/2013 at 11:21, xxxxxxxx wrote:

    Thanks spedler, I guess I'm not really sure why someone would use a BaseContainer then?



  • On 24/03/2013 at 11:39, xxxxxxxx wrote:

    Most parameters are accessible and modifiable via the BaseContainer, but not all. Using the container
    directly offers certain advantages in speed (especially when using the fixed-type setters and getters)
    and usage (eg. merging containers).

    -Niklas



  • On 24/03/2013 at 14:13, xxxxxxxx wrote:

    The things we grab using Get&Set Parameters are set up to work that way by Maxon.
    So it's considered a convenience.
    Plus it's also considered a safer way to work. Since you're using code they set up for us to use.

    The containers are there in case you want to be a mad scientist. Smile
    They let us create something brand new on our own that Maxon hasn't set up for us already.

    -ScottA



  • On 24/03/2013 at 16:54, xxxxxxxx wrote:

    Thanks for clarifying this confusing topic guys! Ill stick to the get/set. It really is much easier to work with.


Log in to reply