Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Unread
    • Recent
    • Tags
    • Users
    • Login
    1. Maxon Developers Forum
    2. mocoloco
    3. Posts
    • Profile
    • Following 0
    • Followers 0
    • Topics 14
    • Posts 62
    • Best 3
    • Controversial 0
    • Groups 0

    Posts made by mocoloco

    • RE: Can't get a correct rendering in picture viewer of the current scene running my TAG plugin while it works in viewport

      Hi, thanks for your reply.

      I can't disclose the whole plugin as it is our know how, but anyway I can clarify the goal of it and how it is done.

      So both plugin have the same architecture and are TagData. Both TAG are only use to manipulate Tx, Ty, Tz and Rx, Ry, Rz of some of the objects hierarchy underneath the root node which hold the TagData plugin.

      Those new values update the position or rotation of an objects through Message() when a slider is moved, and Execute() methods to update the whole hierarchy relaying on those sliders assigned to Tx, Ty, Tz, Rx, Ry, Rz.

      The question here is: if I have to consolidate something somewhere to get the rendering as it is in the viewport, what do I have to implement and were? Does that need to be in the Message() method or in Execute()?

      Could you please give me some insight on this, that would be really helpful.

      Thanks!
      Christophe

      posted in Cinema 4D SDK
      mocolocoM
      mocoloco
    • RE: Can't get a correct rendering in picture viewer of the current scene running my TAG plugin while it works in viewport

      Hi,

      @spedler, I had a look on my plugin and I do not find any CopyTo() function related to the TagData object, it's a RegisteredTagPlugin, and I use it to manipulate sibling objects of the root level which have the TAG plugin. From what I understood, all is saved in the BaseDocument() and reloaded when the scene is loaded - which is the case.
      So, I do not understand where the CopyTo() should take place and with which object? I do understand the principle - if that the one should applied here, but really do not know how to set that up here in a TAG Plugin.

      Thanks

      posted in Cinema 4D SDK
      mocolocoM
      mocoloco
    • RE: Can't get a correct rendering in picture viewer of the current scene running my TAG plugin while it works in viewport

      Hello @spedler, thanks for the lead, I'm going to check this and see if it change something or not.

      posted in Cinema 4D SDK
      mocolocoM
      mocoloco
    • RE: Can't get a correct rendering in picture viewer of the current scene running my TAG plugin while it works in viewport

      Hello there,

      Here few more visuals to explain what's going on. I honestly do not know how what I'm getting in the viewport does not render as it is... there is something I really do not understand.

      Screenshot 2023-12-04 at 09.23.33.png

      posted in Cinema 4D SDK
      mocolocoM
      mocoloco
    • Can't get a correct rendering in picture viewer of the current scene running my TAG plugin while it works in viewport

      Hi there,

      There is something that it is hard to understand at my level of knowledge. I have two plugin that are perfectly working in C4D, both of them are TAG plugins attached to the root of a hierarchy and somehow, what I see in the viewport can't be rendered in the Picture Viewer correctly. Some of the object retains other orientation or do not take into account the animation while they are by pressing play in the 3D environment.

      Here few pictures to illustrate the problem,

      1. Viewport capture of the object with the object in yellow that does not render correctly.
        Screenshot 2023-12-01 at 22.42.32.png
      2. The same frame in Render View mode and Interactive Render mode which are also correctly rendered
        Screenshot 2023-12-01 at 22.42.41.png
        Screenshot 2023-12-01 at 22.42.55.png
      3. The render of the same frame sent to the Picture Viewer, were the object is taking a bad orientation on XYZ axis.
        Screenshot 2023-12-01 at 22.43.27.png

      I'm guessing what could cause this kind of issue? Could that be a priority problem or a missing Matrix calculation that occurs in def Execute() of the plugin when rendered normally? Or could that be related to something else I completely missing or skipped?
      On the second plugin the Camera which is linked to the hierarchy seems locked to the current frame I'm in the timeline when I'm starting the render. Like if the animation applied to its parent object is not took into account and so the camera remains still.

      All your light and ideas are more than welcome, I'm completely stuck on this.
      Cheers,

      Christophe

      posted in Cinema 4D SDK 2023 2024 macos python
      mocolocoM
      mocoloco
    • RE: Can REAL MIN / MAX value be changed on Init?

      Hi there,
      Was the issue fixed on R2023 or R2024?

      Thanks,
      Christophe

      posted in Bugs
      mocolocoM
      mocoloco
    • RE: Keyframing the source file on an ImageTexture shader

      Hi,

      A simple addition on CTrack and DescId as I was also faced to this a time ago. You can consult the @ferdinand's explanations and exemples on CTrack to the following post :

      https://developers.maxon.net/forum/topic/14315/solved-how-to-setup-a-ctrack-on-tag-plugin-ui-slider-with-extended-details/8

      Cheers,
      Christophe

      posted in Cinema 4D SDK
      mocolocoM
      mocoloco
    • RE: Struggling on SetParameter for OLight

      Hi @m_adam,

      Thanks a lot for the flags, it does work as expected now.
      Are c4d.DESCFLAGS_GET_NONE and c4d.DESCFLAGS_GET_0 similars?

      Cheers,
      Christophe.

      posted in Cinema 4D SDK
      mocolocoM
      mocoloco
    • RE: Struggling on SetParameter for OLight

      Little addition after looking for a solution and reading more on OLight, it seems that the correct data type is c4d.DTYPE_VECTOR instead of c4d.DTYPE.COLOR. But even with this I can't reach the value.

       # TAG Execute() method
      def Execute(self, tag, doc, op, bt, priority, flags):
          self.tagData = tag.GetDataInstance()
          sim_color = c4d.Vector(0) # For debug purpose, set a black color value
      
          if op.GetType() == c4d.Olight:
              # For debug purpose  
              print( op.GetParameter( c4d.DescID(c4d.DescLevel(c4d.LIGHT_COLOR, c4d.DTYPE_VECTOR, 0)), c4d.DESCFLAGS_GET_PARAM_GET ) )
      
              op.SetParameter( c4d.DescID(c4d.DescLevel(c4d.LIGHT_COLOR, c4d.DTYPE_VECTOR, 0)), sim_color, c4d.DESCFLAGS_SET_USERINTERACTION )
          
              return c4d.EXECUTIONRESULT_OK
      
      posted in Cinema 4D SDK
      mocolocoM
      mocoloco
    • Struggling on SetParameter for OLight

      Hello there!

      I'm starting a new TAG plugin development and I would like to affect OLight parameter, i.e. c4d.LIGHT_COLOR, but my DescId does not reach its target.

      All this is happening in dataTag.Execute.

      Here the code, and the GetParameter returns only None, which means there is something wrong...

       # TAG Execute() method
      def Execute(self, tag, doc, op, bt, priority, flags):
          self.tagData = tag.GetDataInstance()
          sim_color = c4d.Vector(0) # For debug purpose, set a black color value
      
          if op.GetType() == c4d.Olight:
              # For debug purpose  
              print( op.GetParameter( c4d.DescID(c4d.DescLevel(c4d.LIGHT_COLOR, c4d.DTYPE_COLOR, 0)), c4d.DESCFLAGS_GET_PARAM_GET ) )
      
              op.SetParameter( c4d.DescID(c4d.DescLevel(c4d.LIGHT_COLOR, c4d.DTYPE_COLOR, 0)), sim_color, c4d.DESCFLAGS_SET_USERINTERACTION )
          
              return c4d.EXECUTIONRESULT_OK
      

      I tried different flags for SetParameter, but based on @ferdinand explanation on CTrack, it seems that c4d.DESCFLAGS_SET_USERINTERACTION is the good one.

      If someone can light me up on this, that would be awesome.

      Cheers,
      Christophe

      posted in Cinema 4D SDK python s26
      mocolocoM
      mocoloco
    • RE: Back on "message after tag delete" post

      Hi @ferdinand,

      Thanks a lot one more time for all the detailed examples and informations.

      I finally opt to a data container of the node, mostly due to the fact that the hooks are volatile and need to be set all the time. I also ran some tests with globals without having encounter issues, but indeed you need to be careful when handling this approach.

      Cheers,
      Christophe

      posted in Cinema 4D SDK
      mocolocoM
      mocoloco
    • RE: Back on "message after tag delete" post

      Hello @ferdinand,

      First of all many thanks for giving a such precise and well documented answers to issues I'm facing, that is tremendous.

      Then, you confirmed what I noticed and thought about the redundancy of calling/freeing; and like you said maybe I have to approach the problem differently.

      The current plugin I'm working on is use in a really specific case, that way, maybe the approach with the events notification can work. I have to test that based on what you wrote.
      I was asking this because I want to reset some globals var when the TAG is removed - maybe there is a more elegant way to do, but until now I haven't found one yet.

      Have a good day!
      Cheers,

      Christophe

      posted in Cinema 4D SDK
      mocolocoM
      mocoloco
    • Back on "message after tag delete" post

      Hi there,

      I'm looking for a reliable method to know when a TAG is deleted. I was hoping that a destructor exists somehow, it it does not work as expected. I tried __del__(self) as well as NodeData.Free(self, node) in my class. Both are called on TAG deletion, but they are also called on any user interaction, which looks really weird.

      I went through old post, https://developers.maxon.net/forum/topic/7838/10131_message-after-tag-delete?_=1674474478232, which state exactly the same result without any solution.

      Is there a way to know when a TAG has been deleted or destroyed from an object without having to watch constantly the whole hierarchy?

      Thanks a lot,
      Cheers,

      Christophe

      posted in Cinema 4D SDK python s26 sdk
      mocolocoM
      mocoloco
    • RE: Can REAL MIN / MAX value be changed on Init?

      Oh, I didn't know about the to fix tag. Keeping unsolved was much more for the community 😉
      I the meantime I setup the resource file as discussed, and indeed, having higher values prior setting them solve the GUI problem / which is a good fix for me.

      Thanks a lot,
      Cheers,

      Christophe

      posted in Bugs
      mocolocoM
      mocoloco
    • RE: Can REAL MIN / MAX value be changed on Init?

      Good morning @ferdinand,

      Thanks a lot for taking time going though this. That's exactly what I noticed last week. Changed are took into account but they are not reflected on the GUI. The only workaround that seems possible at this moment is to set MIN/MAX sliders values beyond the possible values that could be set on UserData. Doing so GUI should behave correctly.

      Could you please let this thread unsolved for the moment, the time we get a fix on this?

      Have a great day,
      Cheers,

      posted in Bugs
      mocolocoM
      mocoloco
    • RE: Can REAL MIN / MAX value be changed on Init?

      Hi @ferdinand,

      I was quite sure indeed that UNIT PERCENT will work, but I give a try to see. What I do not understand is, when I'm printing all the values existing in desc_X or desc_Y, they looks good, the value is correct, but not took completely into account on the drawing side for CUSTOMGUI REALSLIDER.

      Like I said, if I remove the CUSTOMGUI REALSLIDER; option in the resource file and using REAL as a standard input field, whatever the UNIT I'm using, everything behaves correctly. MIN/MAX values are correctly assigned even though there is multiple REAL that need to be change. That let me lead like you to a bug linked to CUSTOMGUI REALSLIDER when only using UNIT DEGREE.

      No problem to have a look on this next week. I can deal with that for the moment using PERCENT, as is produce slightly the same result. It is just not really convenient to guess a percentage for an angle, but that's OK.

      Many thanks,
      Cheers,

      Christophe

      posted in Bugs
      mocolocoM
      mocoloco
    • RE: Can REAL MIN / MAX value be changed on Init?

      Hi @ferdinand,

      Thanks a lot for your time on this and sorry for the wrong unit on the first example I submitted with METERS instead of DEGREES - at the sometime it seems that it raised some kind of bug link to this ^^.

      Like you wrote, I did convert the value in Radian for all the Parameters and so, but anyway the problem seems linked to the simultaneous use of UNIT DEGREES; CUSTOMGUI REALSLIDER in the resource file.

      I ran a couple of tests and I noticed the following:
      • When only using REAL without CUSTOMGUI REALSLIDER; in the resource file, the field behaves as it should and limits changes works as expected
      • When using CUSTOMGUI REALSLIDER; with UNIT METERS; it does work as well as expected
      • When using UNIT PERCENT; with MIN -100.0; MAX 100.0 and assigning the values by multiplying the slider value by Parameters[--max], printing and assigning the result to a STATICTEXTit displays the right value in degree or rad depending on the final conversion made prior display.
      • When assigning UNIT DEGREES; with CUSTOMGUI REALSLIDER, I'm getting weird behaviour like said previously and like you noticed.

      I haven't had the time to ran test today with INTERFACE_DATA like you suggested. I will try to do that tomorrow and I will keep you in touch about this.

      Cheers,
      Christophe

      posted in Bugs
      mocolocoM
      mocoloco
    • RE: Can REAL MIN / MAX value be changed on Init?

      You can add the following code to see the values before and after new assignment. You will see that the values are correctly changed, but the change does not reach the interface for unknown reason.

      for k,v in desc_Y:
          print(f"Y New, Key {k} / Val {v}")
      
      posted in Bugs
      mocolocoM
      mocoloco
    • RE: Can REAL MIN / MAX value be changed on Init?

      @ferdinand,

      There is something weird going on. I intend to change several sliders accordingly to Parameters, ID_X and ID_Y.
      I adapted the code accordingly, but it seems that only DESC_MAXSLIDER and DESC_MINSLIDER are took into account while DESC_MIN and DESC_MAX stick to previous values. Could that be a bug?

      Screenshot 2023-01-16 at 16.02.40.png

      I let in remarks the code that improve a bit better the result and allows ID_X to be fully set (MIN/MAX as well as MINSLIDER/MAXSLIDER), but the problems remains on ID_Y.

      Screenshot 2023-01-16 at 16.03.14.png

      Here the whole code of GetDDescription(),

      global Parameters
      Parameters = dict()
      Parameters['Xmin'] = -360.0
      Parameters['Xmax'] = 360.0
      Parameters['Ymin'] = -25.0
      Parameters['Ymax'] = 25.0
      
      def GetDDescription(self, node, description, flags):  
          if not description.LoadDescription(node.GetType()):
              return False  
      
          # Change Slider limits accordingly to Parameters values
          # Sliders to modifiy ID_X, ID_Y
      
      
          ## SLIDER ID_X
          if len(Parameters) > 0:
              paramID_X: c4d.DescID = c4d.DescID(c4d.DescLevel(ID_X, c4d.DTYPE_REAL, 0))
              single_X: c4d.DescID = description.GetSingleDescID()
              # Bail when there is a to be evaluated parameter and our parameter is not part off or equal to the to be evaluated parameter.
              if single_X and not paramID_X.IsPartOf(single_X):
                  return True, flags
              # if singleId[0] == mAXIS_X: print (f"singleID found: {singleId} ")
              # Get the description data container instance (GetParameter>I<) for the parameter we want to modify
              desc_X: c4d.BaseContainer = description.GetParameterI(paramID_X)
              if desc_X is None:
                  return True, flags
      
              # if single_X and paramID_X.IsPartOf(single_X):
              #     if paramID_A1.IsPartOf(single_X)[0]:
                      # Write the MAX and MAXSLIDER values based on UserDatas
              desc_X[c4d.DESC_MIN] = c4d.utils.DegToRad(Parameters["Xmin"])
              desc_X[c4d.DESC_MINSLIDER] = c4d.utils.DegToRad(Parameters["Xmin"])
              desc_X[c4d.DESC_MAX] = c4d.utils.DegToRad(Parameters["Xmax"])
              desc_X[c4d.DESC_MAXSLIDER] = c4d.utils.DegToRad(Parameters["Xmax"])
              # if single_X and paramID_X.IsPartOf(single_X):
              #     if paramID_X.IsPartOf(single_X)[0]:
              #         print (f"Found X: {paramID_X.IsPartOf(single_X)[0]} ")
              #         return (True, flags | c4d.DESCFLAGS_DESC_LOADED)
                      
      
              ## SLIDER ID_Y
              paramID_Y: c4d.DescID = c4d.DescID(c4d.DescLevel(mAXIS_Y, c4d.DTYPE_REAL, 0))
              single_Y: c4d.DescID = description.GetSingleDescID()
              # Bail when there is a to be evaluated parameter and our parameter is not part off or equal to the to be evaluated parameter.
              if single_Y and not paramID_Y.IsPartOf(single_Y):
                  return True, flags
              # Get the description data container instance (GetParameter>I<) for the parameter we want to modify
              desc_Y: c4d.BaseContainer = description.GetParameterI(paramID_Y)
              if desc_Y is None:
                  return True, flags
              # Write the MAX and MAXSLIDER values based on UserDatas
              desc_Y[c4d.DESC_MIN] = c4d.utils.DegToRad(Parameters["Ymin"])
              desc_Y[c4d.DESC_MINSLIDER] = c4d.utils.DegToRad(Parameters["Ymin"])
              desc_Y[c4d.DESC_MAX] = c4d.utils.DegToRad(Parameters["Ymax"])
              desc_Y[c4d.DESC_MAXSLIDER] = c4d.utils.DegToRad(Parameters["Ymax"])
              # if single_Y and paramID_A2.IsPartOf(single_Y):    
              #     if paramID_Y.IsPartOf(single_Y)[0]:
              #         print (f"Found Y: {paramID_Y.IsPartOf(single_Y)[0]} ")
              #         return (True, flags | c4d.DESCFLAGS_DESC_LOADED)
                  
      
         return (True, flags | c4d.DESCFLAGS_DESC_LOADED)
      

      Does this trick to change REALSLIDER MIN/MAX values intend to be associated to only on change, and not on several UI object?

      Thanks in advance,
      Cheers,

      Christophe

      posted in Bugs
      mocolocoM
      mocoloco
    • RE: Can REAL MIN / MAX value be changed on Init?

      @ferdinand,

      I found the problem. For a reason I can't explain, going through the new assignment once on the first call of GetDDescription() isn't enough. I thought that I could do the change once on first plugin TAG load/use, then avoid to going through this change each time GetDDescription() is called. But that's isn't the case. It seems that the change need to be perpetual and need to be parsed and evaluated constantly to be seen and changed in the interface ( honestly I found this weird and not really optimised in terms of coding ).

      So, by getting rid of the flag FIRST_INIT (which wasn't in the code above), the code does work as expected.

      Maybe could you explain me why this repetitive reassignment is needed?

      Thanks a lot for your prompt support and all detailed explanation you are providing, it does help a lot.
      Cheers,

      Christophe

      posted in Bugs
      mocolocoM
      mocoloco