Moving points via slider [SOLVED]



  • On 14/12/2014 at 08:36, xxxxxxxx wrote:

    I wonder if there is a way to add a Image to ones post?
    There is a option here "Insert Image" but I have no clue how it works??



  • On 14/12/2014 at 08:58, xxxxxxxx wrote:

    Why do you post this in the Python subforum?



  • On 14/12/2014 at 19:28, xxxxxxxx wrote:

    Because I have a python scripting problem and the best way to describe my problem would be with a image or two and I thought maybe someone here know how to do it



  • On 14/12/2014 at 20:00, xxxxxxxx wrote:

    Let me try and explain.

    Say I have 5 points all at diff positions. I want to move the points with a slider but the target position for each point is not the same. ex: 1 = 0.5 Y, 2 = 0.6 Y, 3 = 0.7 Y and so on.

    Is there a way to achieve this??



  • On 15/12/2014 at 04:36, xxxxxxxx wrote:

    Hi carel5103,

    at first I'd like to second Niklas' request. Even if you were preparing for a Python related question, your "Image upload" question does not belong into this subforum.
    Image upload by the way is quite simple. Just don't use the "Quick reply" feature at the bottom of the page, but use the "Post Reply" button below the last post. There you have a button to upload an image.

    Now, to your actual question:
    Actually I should leave this for the community, as I don't see a SDK related question here.
    But anyway, my suggestion is to use the slider value as an offset to the point positions. Wouldn't that be possible?



  • On 15/12/2014 at 07:09, xxxxxxxx wrote:

    Geez, Sorry for the "Image upload" question in the wrong subforum.
    Image upload by the way is Not so quite simple for me. I tried it the "quite simple" way on more than one computer and it wont let me upload my own images.But lets forget the image problem now, its in the wrong subforum 😉

    My problem is not the moving of the points. I know how to do that. My problem is moving all of them at once with "one slider" but different distances.

    Thanks



  • On 15/12/2014 at 13:34, xxxxxxxx wrote:

    Hello,
    ther are several ways to do what you want.
    One could be like the morph target does it with an initial and a target state.
    a simple example you need an active polygon object for the script:

      
    import c4d  
    from c4d import gui  
      
      
    class SliderDlg(gui.GeDialog) :  
        
      initial = []  
      destination = {}  
      
      def CreateLayout(self) :  
      
          self.TabGroupBegin(204, flags= c4d.BFV_TOP|c4d.BFH_SCALEFIT, tabtype=c4d.TAB_TABS)  
          self.AddEditSlider(101, c4d.BFH_SCALEFIT, initw=50, inith=0)  
          self.GroupEnd()  
          return True  
      
      def InitValues(self) :  
      
          self.SetFloat(101, 0, min=0, max=1, step=.01, format=c4d.FORMAT_PERCENT)  
          self.InitialState()  
          self.Destination()  
          return True  
      
      def InitialState(self) :  
          if not op:return False  
          if op.IsInstanceOf(c4d.Opolygon) == True:  
                
              plist=[]  
              for i in xrange(3) :  
                  plist.append(op.GetPoint(i))             
          self.initial = plist  
            
      def Destination(self) :  
          destdict = {0:c4d.Vector(0,0,100),1:c4d.Vector(0,100,0),2:c4d.Vector(100,0,0)}  
          self.destination = destdict  
            
                
      def Command(self, id, msg) :  
      
          if id == 101:  
              if not op:return False  
              if op.IsInstanceOf(c4d.Opolygon) == True:  
      
                  per =  self.GetFloat(101)     
                  for i in xrange(3) :  
                        
                      newp = per*self.destination[i]+self.initial[i]  
                      op.SetPoint(i,newp)  
                        
                  op.Message(c4d.MSG_UPDATE)  
                  c4d.DrawViews(c4d.DRAWFLAGS_ONLY_ACTIVE_VIEW|c4d.DRAWFLAGS_NO_THREAD|c4d.DRAWFLAGS_NO_REDUCTION|c4d.DRAWFLAGS_STATICBREAK)          
                  c4d.EventAdd()  
                    
          return True  
    dialog = SliderDlg()  
    dialog.Open(c4d.DLG_TYPE_ASYNC)  
      
    

    Best wishes
    Martin



  • On 15/12/2014 at 19:29, xxxxxxxx wrote:

    Thank you Martin, you rock 👍👍


Log in to reply