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

    Problem with a refresh

    SDK Help
    0
    23
    14.1k
    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
      Helper
      last edited by

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

      On 01/01/2008 at 18:59, xxxxxxxx wrote:

      User Information:
      Cinema 4D Version:   10.5 
      Platform:      Mac OSX  ; 
      Language(s) :      XPRESSO  ;

      ---------
      Hi,

      Happy new year!

      I have a dialog plugin with 2 buttons. One decreases the texture projection length, the second increases it (in steps of 10).

      This works, but it I cannot see the changes on the object immediately. I have to deselect my texture tag and select it again. Then the viewport is refreshed.

      I'm sure that I've added the EventAdd() method at the end and that this method is executed.

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

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

        On 01/01/2008 at 21:23, xxxxxxxx wrote:

        Try calling op->Message(MSG_UPDATE) for the object after changing the texture projection length and see if that helps activate the changes automatically.

        I assume that you are doing COFFEE in an XPresso node?

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

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

          On 02/01/2008 at 04:39, xxxxxxxx wrote:

          No. I'm not using XPresso. I'm doing a COFFEE plugin.

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

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

            On 02/01/2008 at 04:49, xxxxxxxx wrote:

            Hmm, the simple Message method on the object didn't work. Only the first time the object really was refreshed.

            I changed the line to
            > doc- >MultiMessage(MSG_UPDATE);
            and now it works. Strange...

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

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

              On 03/01/2008 at 16:13, xxxxxxxx wrote:

              Howdy,

              I was advised by Paul Everett to never send a MultiMessage() to the entire document because it can cause some serious overhead. :o(

              Have you tried using EventAdd(EVENT_FORCEREDRAW)? I'm not sure if that works in coffee like it does in C++, but that's what I've used.

              Adios,
              Cactus Dan

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

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

                On 09/01/2008 at 12:30, xxxxxxxx wrote:

                Hey, thank you Cactus Dan for the hint. EVENT_FORCEREDRAW does work in COFFEE but it is not a solution to my problem.

                Here is what I'm doing in pseudo-code:

                > _
                >      switch (id) {
                >           case B_ACT:
                >                // change texture projection
                >                break;
                >                
                >           case B_REM:
                >                // return to previous saved texture projection
                >                break;
                >                
                >           default:
                >      }
                >      
                >      EventAdd(EVENT_FORCEREDRAW);
                >      return FALSE;
                > _

                Like this the changes are only made the very first time. All the other times I have to select/deselect the texture tag, then I can see the changes.

                Now, if I add the MultiMessage(MSG_UPDATE) methode before the EventAdd(), it works. But if I remove EventAdd(), it won't work at all.

                AND, this method only works in C4D 10.5. I can add as many MultiMessages as I want in 9.1, the view will not be refreshed.

                Any ideas?

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

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

                  On 09/01/2008 at 13:25, xxxxxxxx wrote:

                  Howdy,

                  Well, I'm not sure about coffee, but in C++ while a dialog is open, to get the view to refresh, you can also call:

                  > _
                  > DrawViews(DA_ONLY_ACTIVE_VIEW|DA_NO_THREAD|DA_NO_ANIMATION);
                  > _

                  ... but this may not be available in coffee. :o(

                  Will coffee create a SceneHook plugin? I've also used a SceneHook plugin with C++ for drawing in the view while a dialog is open.

                  Adios,
                  Cactus Dan

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

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

                    On 09/01/2008 at 15:02, xxxxxxxx wrote:

                    DrawViews() is definitely not available in COFFEE.

                    Have you tried to get the Texture tag and/or Material and send Message(MSG_UPDATE)'s to them? It really isn't the object that is changing, it's the material. This might explain why MultiMessage() works - it broadcasts the message to everything in the document including materials. Keep the EventAdd() as well.

                    Can't help with differences between R9 and R10.

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

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

                      On 09/01/2008 at 15:26, xxxxxxxx wrote:

                      Ok, I'm going to try sending a message to tag and material right now.

                      BTW, what is the difference between EventAdd() and the message(msg_update)? They both do the same thing, no? Notifying cinema that something changed and that the viewport needs no be refreshed?

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

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

                        On 09/01/2008 at 15:41, xxxxxxxx wrote:

                        Howdy,

                        Well, I think Message() just sends a message, by calling the Message() function of each node and EventAdd() adds a global event.

                        Adios,
                        Cactus Dan

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

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

                          On 09/01/2008 at 15:50, xxxxxxxx wrote:

                          sigh...

                          I tried this:

                          > tag- >Message(MSG_UPDATE);
                          > mat->Message(MSG_UPDATE);
                          > obj->Message(MSG_UPDATE);
                          > EventAdd();

                          I still only refreshes the first time. And I'm sure that I have the right tag because two lines above I change the projection on the same tag.

                          The only thing that really works is sending an update to the document every time.

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

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

                            On 09/01/2008 at 16:09, xxxxxxxx wrote:

                            Have you considered C++? 🙂

                            Although the MultiMessage() is not recommended, if it works continue using it. Though it's not good that it doesn't work in R9 at all.

                            Another possibility is to do what you said you needed to do manually - deselect and reselect the tag. This can done in COFFEE by setting the BIT_ATAG with SetBit(), DelBit(), ToggleBit(). The problem is that I don't think that these work in R10 - because R10 has made these deprecated for a new set of flags and COFFEE isn't up-to-date to use them.

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

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

                              On 09/01/2008 at 16:46, xxxxxxxx wrote:

                              I heard people say that we have to push Maxon into putting more time into the C.O.F.F.E. developpment, and now I know why. Thought that it could handle such easy things like changing the projection of a material with a button.

                              On the other hand this might be a good occasion for taking a look into C++ (which I once learned in school, but that was a loong time ago) 🙂

                              I tried to use the
                              > doc- >SetActiveTag(obj, tag);
                              method to select a tag, but it seams that COFFEE doesn't provide a way to select NO tag.

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

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

                                On 09/01/2008 at 16:55, xxxxxxxx wrote:

                                Howdy,

                                Did you try this:

                                > _
                                > doc- >SetActiveTag(obj, NULL);
                                > _

                                I'm not sure if that works in coffee, though.

                                Adios,
                                Cactus Dan

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

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

                                  On 09/01/2008 at 17:05, xxxxxxxx wrote:

                                  Yes, I get an error: Incompatible values... NIL / OBJECT

                                  🙂

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

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

                                    On 09/01/2008 at 17:29, xxxxxxxx wrote:

                                    Howdy,

                                    Hmmm, that's too bad. It works that way in C++. Maybe it IS a good time to check into C++. ;o)

                                    Adios,
                                    Cactus Dan

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

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

                                      On 10/01/2008 at 03:42, xxxxxxxx wrote:

                                      Yeah, so in the future I might flood this forum with a lot of noob questions about this and that in C++. So beware, I'm comming. 🙂

                                      I'm probably going to change the username, lol

                                      Anyway, thank you for your help, guys.

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

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

                                        On 10/01/2008 at 03:46, xxxxxxxx wrote:

                                        We are currently investigating why there is a refresh missing.

                                        cheers,
                                        Matthias

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

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

                                          On 17/01/2008 at 08:59, xxxxxxxx wrote:

                                          I think I blamed COFFEE for the wrong reason. C++ has the same problem.

                                          > // setting the projection to UVW
                                          > BaseContainer container = tag- >GetData();
                                          > container.SetData(TEXTURETAG_PROJECTION, 6);
                                          > tag->SetData(container);

                                          Here I changed the projection of a texture tag 'tag'. Then I do a refresh with
                                          > EventAdd(EVENT_FORCEREDRAW);
                                          As already menshioned, this works only for the first time. After that I have to select and deselect the texture tag to make the changes happen. Selection/deselection another object doesn't refresh the scene, only selecting/deselection the texture tag.

                                          I tried several way of doing the refresh in C++.
                                          > tag- >Message(MSG_UPDATE);
                                          > mat->Message(MSG_UPDATE);
                                          > obj->Message(MSG_UPDATE);

                                          I even tried to do the select/deselect mannually as stated by Robert, but none of these work. Only the first time they work.

                                          And since C++ has no MultiMessage() Method I don't know how to make the changes except deleting the texture tag and creating a new one with the new projection.

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

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

                                            On 17/01/2008 at 09:43, xxxxxxxx wrote:

                                            To change the projection here, you need to use something like this:

                                            tag- >SetParameter(DescLevel(TEXTURETAG_PROJECTION), GeData(TEXTURETAG_PROJECTION_UVW), 0L);

                                            You'll find that some parameters can be set using its BaseContainer while others require using SetParameter(). The latter case mainly for parameters displayed in the Attributes Manager which are stored in Description resources.

                                            A better way to work with BaseContainers in C++ is this:

                                            BaseContainer* bc = tag- >GetDataInstance();
                                            bc->SetX(id, value);

                                            Hope that helps! 🙂

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