Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush Python 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

    Script needed!

    Scheduled Pinned Locked Moved SDK Help
    5 Posts 0 Posters 371 Views
    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.
    • H Offline
      Helper
      last edited by

      THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

      On 05/12/2007 at 02:20, xxxxxxxx wrote:

      User Information:
      Cinema 4D Version:   10.5 
      Platform:    Mac  ;  
      Language(s) :   C.O.F.F.E.E  ;

      ---------
      Hi Guys,

      Just wondered if there were any clever people out their who is a dab hand at writing scripts. What I need is a script that finds objects that are always seen by the renderer or always seen by the editor. Basically it finds any object that has a little "green light on" which is hidden away somewhere in the sub folder of a sub folder of a sub folder, basically very time comsuming to find. This would be a great help to many others as well I guess. I would attempt to do this myself but have no experience in this field, zilch.

      If anyone could help out I would be emtremely greatful.

      Many thanks in advance

      1 Reply Last reply Reply Quote 0
      • H Offline
        Helper
        last edited by

        THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

        On 05/12/2007 at 04:55, xxxxxxxx wrote:

        I have been given this script but it does'nt unfold the hierarchy to reveal the object.

        FindVisible(obj)
        {
        while(obj)
        {
             var editorMode = obj#ID_BASEOBJECT_VISIBILITY_EDITOR;
             var rendererMode = obj#ID_BASEOBJECT_VISIBILITY_RENDER;

        if(editorMode == 0 || rendererMode == 0)
             {
              obj->SetBit(BIT_AOBJ);

        var parent = obj->GetUp();

        while(parent)
              {
                  parent->SetBit(BIT_OFOLD);
                  parent = parent->GetUp();
              }
             }

        FindVisible(obj->GetDown());

        obj = obj->GetNext();
        }
        }

        main(doc,op)
        {
        var obj = doc->GetFirstObject();

        FindVisible(obj);
        }

        Then somebody else posted another bit of script to fix this but i dont know how to put both bits of script together to get them to work.

        if(!op) return;

        var state;
        state = op->GetBit(BIT_OFOLD);

        if(state==1)
        {
        CallCommand(100004802); // unfold
        op->DelBit(BIT_OFOLD);
        op->Message(MSG_UPDATE);
        return;
        }

        if(state==0)
        {
        CallCommand(100004803); // fold
        op->SetBit(BIT_OFOLD);
        op->Message(MSG_UPDATE);
        }

        Any help would be very appreciated.

        Thanks

        1 Reply Last reply Reply Quote 0
        • H Offline
          Helper
          last edited by

          THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

          On 05/12/2007 at 09:40, xxxxxxxx wrote:

          These questions arise:

          1. Do you want to unfold to every object with editor/render visibility On or just a particular one?

          2. If the former case, do you want each one selected as well so that the user can tell quickly (in a dense hierarchy) which ones are of interest with respect to the condition (editor/render On)?

          I'm going to try to get the script working but will need these details to have the correct script.

          1 Reply Last reply Reply Quote 0
          • H Offline
            Helper
            last edited by

            THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

            On 05/12/2007 at 10:58, xxxxxxxx wrote:

            This works - but not completely in R10+ though. Don't know why the long route to get the Editor and Render Modes (see code below). The hard part here is controlling the unfolding in R10+.

            > FindVisible(obj)
            > {
            >      var parent;
            >      for (obj; obj; obj = obj->GetNext())
            >      {
            >           if (obj->GetEditorMode()==MODE_ON || obj->GetRenderMode()==MODE_ON)
            >           {
            >                for (parent = obj->GetUp(); parent; parent = parent->GetUp())
            >                {
            >                     parent->SetBit(BIT_OFOLD);
            >                     parent->Message(MSG_UPDATE);
            >                }
            >                obj->SetBit(BIT_AOBJ);
            >           }
            >           FindVisible(obj->GetDown());
            >      }
            > }
            >
            > main(doc,op)
            > {
            >      var obj = doc->GetFirstObject();
            >      FindVisible(obj);
            > }

            The reason that this doesn't completely work in R10+ is because the interface has changed for getting/setting bits - especially folding/unfolding. These are now controlled by four bits (for four managers) and, in C++, a new set of methods to operate on them. COFFEE, unfortunately, has not been updated for R10+. I'll see what can be done for R10+ but don't expect miracles. 🙂

            1 Reply Last reply Reply Quote 0
            • H Offline
              Helper
              last edited by

              THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

              On 07/12/2007 at 01:17, xxxxxxxx wrote:

              Hi Robert,

              Basically I would like it to work in the same way as "scroll first active", just unfolding the necessary null objects after it has isolated the objects. Other scripts put forward have opened everything down the hierarchy, but not sure if this is just an issue with C.O.F.F.E.E in C4D 10.5 as other people have told me? Thats about it really. Identify, locate, Isolate, Unfold/Find.

              Many thanks....

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