Your browser does not seem to support JavaScript. As a result, your viewing experience will be diminished, and you have been placed in read-only mode.
Please download a browser that supports JavaScript, or enable it if it's disabled (i.e. NoScript).
THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 02/05/2012 at 14:45, xxxxxxxx wrote:
hi,
here an example of what i'm trying to do,
#transform a 45° rotated cube into lozenge by making 200% scale on the X-axis obj = doc.GetActiveObject() obj_Mat = obj.GetMg() #my cube matrix sc_vec = c4d.Vector(2,1,1) sc_mat = c4d.utils.MatrixScale(sc_vec) myObj.SetMg(obj_Mat.GetNormalized()*sc_mat) ##result : local x scaling
thanks in advance
On 02/05/2012 at 23:58, xxxxxxxx wrote:
Hi,
Originally posted by xxxxxxxx how to change the size of my " Primitive" object without changing it's scale ?
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
Originally posted by xxxxxxxx is it possible to add some informations to the HUD using python?
By HUD do you main GUI ? What kind of information do you want to ouput ?
On 03/05/2012 at 06:06, xxxxxxxx wrote:
Thank you Yannick
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
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 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.
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.
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++?
..which means that is possible in c++?
In C++ neither.
On 05/05/2012 at 05:30, xxxxxxxx wrote:
you could draw your text with the basedraw class.
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.
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.
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.
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 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())
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
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.
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