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

    Object scaling

    Scheduled Pinned Locked Moved PYTHON Development
    13 Posts 0 Posters 1.2k 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 03/05/2012 at 06:06, xxxxxxxx wrote:

      Thank you Yannick 🙂

      1. ?

      Originally posted by xxxxxxxx

      To do that you can access the object description. For example drag the cube's Size.x to the edittext in the console, you'll get:

      Cube[c4d.PRIM_CUBE_LEN,c4d.VECTOR_X]
      

      Now you can set the Size.x:

      Cube[c4d.PRIM_CUBE_LEN,c4d.VECTOR_X] *= 2
      

      let me be more precise, i agree with you, but i'm looking for something more 'general'. while this formula will work only with cubes ... i don't know if this is possible, thats why i'm asking 😉

      Originally posted by xxxxxxxx

      By HUD do you main GUI ? What kind of information do you want to ouput ?

      i mean tha same thing when you drag&drop any properties into the viewport, or by doing right click>> Add to the HUD.
      i want to display some integer values, or custom text.
       
      thank you again!
      cheers

      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 03/05/2012 at 07:14, xxxxxxxx wrote:

        Originally posted by xxxxxxxx

        let me be more precise, i agree with you, but i'm looking for something more 'general'. while this formula will work only with cubes ... i don't know if this is possible, thats why i'm asking 😉

        For all primitive objects you can scale them with ID_BASEOBJECT_REL_SCALE:

        Cube[c4d.ID_BASEOBJECT_REL_SCALE,c4d.VECTOR_X] = 2.0
        

        Originally posted by xxxxxxxx

        i mean the same thing when you drag&drop any properties into the viewport, or by doing right click>> Add to the HUD.
        i want to display some integer values, or custom text.

        I'm afraid, this isn't possible to do in Python.

        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 04/05/2012 at 12:09, xxxxxxxx wrote:

          Originally posted by xxxxxxxx

          For all primitive objects you can scale them with ID_BASEOBJECT_REL_SCALE:

          Cube[c4d.ID_BASEOBJECT_REL_SCALE,c4d.VECTOR_X] = 2.0
          

          hmm ... ok!

          Originally posted by xxxxxxxx

          I'm afraid, this isn't possible to do in Python.

          ..which means that is possible in c++?
          thank you!
          Best.

          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/05/2012 at 05:11, xxxxxxxx wrote:

            Originally posted by xxxxxxxx

            Originally posted by xxxxxxxx

            I'm afraid, this isn't possible to do in Python.

            ..which means that is possible in c++?

            In C++ neither.

            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/05/2012 at 05:30, xxxxxxxx wrote:

              you could draw your text with the basedraw class.

              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/05/2012 at 07:42, xxxxxxxx wrote:

                Concerning to what littledevil said, you may use the DrawHelper plugin to enhance your skills with
                the BaseDraw class. 😉 It is similiar to the PyGenerator Object, but instead of generating Objects,
                it enables you to do drawings into the Viewport.

                Available gloabl variables are:

                raw:       the ObjectData Instance of the DrawHelper object
                op:        the BaseObject Instance (like in a PyGenerator)
                drawpass:  the Drawpass
                bd:        the BaseDraw Instance
                bh:        the BaseDrawHelper Instance
                

                Note: Take care that you don't have important scenes opened. I must admit that I have noticed several crashes when closing Cinema 4D and the DrawHelper object is present in your scene.

                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/05/2012 at 14:34, xxxxxxxx wrote:

                  Originally posted by xxxxxxxx

                  you could draw your text with the basedraw class.

                  Yes, it is possible. By first drawing text into a bitmap with the GeClipMap class. Then drawing this bitmap with DrawTexture() into a view BaseDraw.

                  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/05/2012 at 21:07, xxxxxxxx wrote:

                    Originally posted by xxxxxxxx

                    Concerning to what littledevil said, you may use the DrawHelper plugin to enhance your skills with
                    the BaseDraw class. 😉 It is similiar to the PyGenerator Object, but instead of generating Objects,
                    it enables you to do drawings into the Viewport.

                    Available gloabl variables are:

                    raw: the ObjectData Instance of the DrawHelper object
                    op: the BaseObject Instance (like in a PyGenerator)
                    drawpass: the Drawpass
                    bd: the BaseDraw Instance
                    bh: the BaseDrawHelper Instance
                    Note: Take care that you don't have important scenes opened. I must admit that I have noticed several crashes when closing Cinema 4D and the DrawHelper object is present in your scene.

                    Very interresting plugin 👏! thank you NiklasR 😉

                    Originally posted by xxxxxxxx

                    you could draw your text with the basedraw class.

                    Originally posted by xxxxxxxx

                    Originally posted by xxxxxxxx

                    you could draw your text with the basedraw class.

                    Yes, it is possible. By first drawing text into a bitmap with the GeClipMap class. Then drawing this bitmap with DrawTexture() into a view BaseDraw.

                    i'll test this, thnx 😄

                    actually, another problem disturbing me now, in fact i'm trying to make a plugin tool, and i'm trying to understand how to get some values (combobox value, and number) from the subDialog interface.

                    i tried to get them from the 'data' container (cf. mouseinput, draw, etc..)  but it seems empty :S

                    here an example that i did yesterday :

                    import c4d, os
                      
                    IDP = 1000001
                      
                      
                    class myToolDialog(c4d.gui.SubDialog) :
                    	
                    	ID_COMBO	 = 10002
                    	ID_NBR	   = 10003
                    		
                    	def CreateLayout(self) :
                      
                    		self.GroupBegin(10000, c4d.BFH_FIT, 3, 1)
                    		self.GroupBorderSpace(10, 10, 10, 10)
                    		
                    		self.AddStaticText(10001, c4d.BFH_LEFT,0,0," Value  ", c4d.BORDER_NONE)
                    		self.AddComboBox(self.ID_COMBO, c4d.BFH_SCALE | c4d.BFH_FIT, 0, 0, False)
                    		self.AddChild(self.ID_COMBO, 200, " Red ")
                    		self.AddChild(self.ID_COMBO, 201, " Blue ")
                    		self.AddEditNumberArrows(self.ID_NBR, c4d.BFH_FIT)
                    		
                    		self.GroupEnd()
                    		
                      
                    		return True
                      
                      
                      
                    	def InitValues(self) :
                    		self.SetLong(self.ID_COMBO, 200)
                    		self.SetReal(self.ID_NBR, 10)
                    		return True
                      
                      
                    		
                    		
                    		
                    class MyToolPlugin(c4d.plugins.ToolData) :
                      
                      
                    	def MouseInput(self, doc, data, bd, win, msg) :
                    		value   = self.dialog.GetLong(10002)
                    		nbr	 = self.dialog.GetReal(10003)
                    		
                    		#print 'On Click >>> Value : ', value, ' >>> Nbr : ', nbr
                    		return True
                      
                    		
                    	def Draw(self, doc, data, bd, bh, bt, flags) :
                    	
                    		value = self.dialog.GetLong(10002)
                    		nbr	 = self.dialog.GetReal(10003) 
                    		print 'Draw >>> Value : ', value, ' >>> Nbr : ', nbr
                    		
                    		if value == 200:
                    			color = c4d.Vector(1,0,0)
                    		else:
                    			color = c4d.Vector(0,0,1)
                    			
                    		bd.SetMatrix_Matrix(None, c4d.Matrix())		
                    		bd.DrawSphere( c4d.Vector(0,0,0), c4d.Vector(nbr, nbr, nbr), color, 0 )
                    		
                    		return c4d.DRAWRESULT_OK
                      
                    	
                    	
                    	def AllocSubDialog(self, bc) :
                    		self.dialog = myToolDialog()
                    		return self.dialog		
                      
                      
                    if __name__ =='__main__': 
                    	mypath, myfn = os.path.split(__file__)
                    	c4d.plugins.RegisterToolPlugin(id=IDP, str="Test", info=2,icon=None, help="TEst test", dat = MyToolPlugin())  
                    
                    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/05/2012 at 19:42, xxxxxxxx wrote:

                      any idea ?
                      i'm also trying to use external description resources, but the layout isn't loaded :S

                      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 08/05/2012 at 00:34, xxxxxxxx wrote:

                        Originally posted by xxxxxxxx

                        any idea ?
                        i'm also trying to use external description resources, but the layout isn't loaded :S

                        Please have a look at Liquid Painter example to see how this could be done.

                        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 09/05/2012 at 13:57, xxxxxxxx wrote:

                          I'm not very good at dictionaries( because I don't use them very often). And I found the code in the LP plugin quite convoluted and hard to follow.
                          It was quite a frustrating experience for me.

                          I re-wrote my SplineDraw tool using a dictionary in a similar manner. And I think it's a lot simpler and easier to understand how it works the way I wrote it.
                          https://sites.google.com/site/scottayersmedia/SplineDraw_Python.zip

                          -ScottA

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