DrawTexture creates a "scene object"?
-
On 18/08/2015 at 11:00, xxxxxxxx wrote:
When I draw a texture in the viewport with BaseDraw.DrawTexture, it behaves like a "scene object".
I mean, if I rotate the view and start dragging on top of the texture, it rotates around the intersection point of the ray sent from the camera to the texture.
Is it possible to make a texture, in the viewport, behave just like a simple image overlay, being ignored by the clicks? -
On 19/08/2015 at 01:36, xxxxxxxx wrote:
Hello,
again, could you provide some code showing what you actually do?
DrawTexture() works with 3D coodinates and will draw the texture in 3d space. If you want to work in 2D space you have to set the current transformation matrix to screen coordinates with SetMatrix_Screen(). Then you can use screen coordinates with DrawTexture.
I guess that you still work with a TagData plugin? It seems the Draw() function of that class cannot be used to create an overlay. Typically this is done using a SceneHook. See also "
2D viewport drawing using a SceneHook
[URL-REMOVED]".Best wishes,
Sebastian
[URL-REMOVED] @maxon: This section contained a non-resolving link which has been removed.
-
On 19/08/2015 at 17:15, xxxxxxxx wrote:
This is my code:
... bd.SetMatrix_Screen() bd.DrawLine2D(c4d.Vector(0, 0, 0), c4d.Vector(0, 0, 0)) if tag[PH_BEHIND]==0: bd.SetDepth(True) trans=int((1.0-tag[PH_OPACITY])*255) bd.SetTransparency(-trans) padr=[c4d.Vector(x,y,0),c4d.Vector(x+w,y,0),c4d.Vector(x+w,y+h,0),c4d.Vector(x,y+h,0)] cadr=[c4d.Vector(1,1,1),c4d.Vector(1,1,1),c4d.Vector(1,1,1),c4d.Vector(1,1,1)] nadr=[c4d.Vector(0,0,-1),c4d.Vector(0,0,-1),c4d.Vector(0,0,-1),c4d.Vector(0,0,-1)] uvadr=[c4d.Vector(0,0,0),c4d.Vector(1,0,0),c4d.Vector(1,1,0),c4d.Vector(0,1,0)] bd.DrawTexture(image,padr,cadr,nadr,uvadr,4,c4d.DRAW_ALPHA_NONE,c4d.DRAW_TEXTUREFLAGS_INTERPOLATION_LINEAR) if tag[PH_BEHIND]==0: bd.SetDepth(True) bd.SetMatrix_Camera()
-
On 20/08/2015 at 08:03, xxxxxxxx wrote:
Hello,
could you explain what specific problem appears with the code you posted? As I mentioned before, it might not be possible to create a flawless overlay using a TagData plugin. This is typically done in a SceneHook as explained in the article I linked above.
Best wishes,
Sebastian -
On 20/08/2015 at 08:46, xxxxxxxx wrote:
I can see that now. So, creating a true overlay that does not interfere with the editor view can only be done with a SceneHook.
I already created a SceneHook plugin before, but it was in C++ and my current plugin is in python.
I guess I will leave it this way. As it is now, users can simply move the image out of the way, if it interferes with their navigation.