THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 30/10/2012 at 05:05, xxxxxxxx wrote:
Finally got back to a bit of programming.
I want to put something at the centre of the perspective view as a guide.
What is the best method to use here to plot my line
ie how do I always guarantee the centre of the viewport when it is something that changes?
On 30/10/2012 at 11:05, xxxxxxxx wrote:
If you mean something like crosshairs you could use the bd.GetFrame() in the Draw function to get the screen dimensions and calculate the center.
Then you could draw there a point, a line or a circle with the corresponding 2D BaseDraw functions.
Hope that helps.
On 31/10/2012 at 03:25, xxxxxxxx wrote:
thanks for hint
On 08/11/2012 at 01:20, xxxxxxxx wrote:
After various tinkerings
Do I take it that cannot be done in a simple script?
Doing it in a tag seems cumbersome and even that doesn't seem to work in the python generator
only sensible options appears to be to write a full blown plugin?
Seems real overkill when I just want a user defined circle on the screen
or have I missed something
On 08/11/2012 at 11:11, xxxxxxxx wrote:
I'm not quite sure what you're trying to do.
If you put a python tag with this code on an object it will jump to the center of your camera:
from c4d import utils
#Welcome to the world of Python
def main() :
bd = doc.GetActiveBaseDraw()
cam = bd.GetSceneCamera(doc)
mg = cam.GetMg()
tm = c4d.utils.MatrixMove(c4d.Vector(0,0,10)) #Move the object a little bit in front of the camera
mg = mg * tm
I tried it with a circle spline with a diameter of 0.1cm and this should do the trick, if that's what you're after. This only works if the playhead in your timeline is moving or any other event happens, not by just moving the camera.
On 11/11/2012 at 15:24, xxxxxxxx wrote:
Just want a variable circle that centres in the viewport. ie a drawn circle not and OM object.
On 12/11/2012 at 01:07, xxxxxxxx wrote:
It's easy enough to obtain a viewport, get a BaseDraw, and draw a circle on the screen. The problem you have is that it won't stay there. As soon as there's a screen update, it might disappear.
So what you need is some way to ensure that your drawing routine is called every time there is a screen update. That's why you can't use a script, because that's only executed once. You need a plugin with a Draw() function as part of its interface. Lots of them do - ObjectData, TagData, ToolData, SceneHookData, etc.
I'd look at a SceneHookData in the first instance, if you can do those in Python. If not, a TagData would be the next choice for me.
On 13/11/2012 at 01:54, xxxxxxxx wrote:
That was the problem. Trying to work out how to keep the thing visible. A tag seems really clunky - will take a look at SceneHookData.