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
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Unread
    • Recent
    • Tags
    • Users
    • Login

    Detect error-causing nodes in XPresso

    Cinema 4D SDK
    python
    2
    4
    663
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • K
      kng_ito
      last edited by

      Hi,
      I am trying to write a python script that detects error-occuring nodes in XPresso.
      It seems that there is a method GvNodeMaster.Execute() for checking if the node master is including error node, and returns the type of error.
      However, I tried with an xpresso network with a Math node that divides by zero and an unlinked Obejct node and did not get the expected results.
      Code:

      import c4d
      
      def main() -> None:
          xpresso_tag = op.GetTag(c4d.Texpresso)
          master = xpresso_tag.GetNodeMaster()
          print(master.Execute())
      
      if __name__ == '__main__':
          main()
      

      2fec6ecd-a55d-43b1-954c-700c9bce9d85-image.png

      Result:

      0
      

      I was expecting c4d.GV_CALC_ERR_DIVISION_BY_ZERO which is 10 or c4d.GV_CALC_ERR_UNDEFINED which is 2.
      Am I doing something wrong? Any help would be appreciated.

      i_mazlovI 2 Replies Last reply Reply Quote 0
      • i_mazlovI
        i_mazlov @kng_ito
        last edited by

        Hi @kng_ito,

        Please excuse the delay. You posting is not forgotten and will be processed asap. Unfortunately I'm currently under deadlines pressure and cannot provide fast support.

        Cheers,
        Ilia

        MAXON SDK Specialist
        developers.maxon.net

        1 Reply Last reply Reply Quote 0
        • i_mazlovI
          i_mazlov @kng_ito
          last edited by

          Hi @kng_ito ,

          Please excuse the delayed answer.

          According to our codebase the Execute() function will return GV_CALC_ERR_CALCULATION_FAILED for the calculation errors happening on master or global scope, namely when the GvNodeMaster was not able to calculate successfully (i.e. GvCalcState higher than GV_CALC_STATE_LOCAL_FAILURE). Issues like zero division only cause local failure, hence are not returned as error in Execute() function. Unfortunately, there's not much you can effectively do here.

          In our SDK support meeting Ferdinand suggested an approach of adding intermediate xpresso python node, where you can detect and handle issues yourself. However, this highly depends on your use-case scenario, because if you for example need to batch-process xpresso graphs, this won't be any practical.

          Cheers,
          Ilia

          MAXON SDK Specialist
          developers.maxon.net

          1 Reply Last reply Reply Quote 0
          • K
            kng_ito
            last edited by kng_ito

            Hi @i_mazlov ,

            Unfortunately, the python node approach is not effective for my use case, so I may have to emulate the error conditions on my own for each node.
            In any case, thank you for your answer.

            1 Reply Last reply Reply Quote 0
            • First post
              Last post