DirectEntryScroll rotation

Good Morning. I try to rotate an input control but it does not rotate correctly. Hope someone can help me.

import direct.directbase.DirectStart
from direct.gui.DirectGui import *

entryControl = DirectEntry(text="",width=10000,initialText="",numLines= 1)
control = DirectEntryScroll(entryControl,parent=aspect2d,state=DGG.NORMAL,scale=0.1,clipSize=(-0.1,5.0,-0.5,1.0))

entry = DirectEntry(parent=aspect2d,text="",width=10000,initialText="",numLines= 1,scale=0.1,frameSize=(-0.1,5.0,-0.5,1.0))


control.entry["focus"] = True

If you mean that they do not rotate parallel to each other, then you should use a node that will be a common parent for them.

1 Like

As far as I see, the entries are rotating correctly. Unless the problem is as serega describes above–in which case see their answer–what is the behaviour that you’re expecting, but not seeing?

I seem to understand that they move along their axis randomly.

from direct.showbase.ShowBase import ShowBase
from direct.gui.DirectGui import DirectEntry, DirectEntryScroll, DGG

base = ShowBase()

de = DirectEntry(initialText='Enter Text Here', relief=1, width=100)
des = DirectEntryScroll(de, relief=1, scale=(0.05,1,.05), clipSize=(-20,20,-20,20))


Try to fill in the field, it will shift.

It depends on the text, which is naturally expected. However, it is difficult to position it.

Hmm… Trying your code on my machine, it seems to work as expected: the text advances along the rotated entry. I see no randomness or shifting.

Perhaps this is some sort of graphics-driver bug, then, or an OS-bound issue…?

It is not always possible to return to the original state.

If you fill in the field as much as possible and then delete it, the position will not return to its previous place.

I suspect that the author means clipSize, which remains rectangular. Perhaps this is a flaw.

1 Like

I think the problem here is not the way it rotates but that the scrolled entry isn’t “cut” correct. It only rotates the text entry, not the scissor effect which makes the ends of the scrolled text field not flat.

1 Like

Ah, I see. That is an odd bug! Fair enough, then–and it seems that wolf, above, has an idea of where the problem lies!

1 Like

The behavior of the scrolled entry is a bit odd nontheless. It “grows” a little at first but that might also come from the way it is positioned in the box that cuts the rest of this entry visually. I’m not that fond of the actual internals of this nor how it originally has intentionally been used but I guess the rotation of the scrolled entry should also rotate the effect if possible. This might also fix the other bug you found.
I guess opening up an issue on github would be a good idea for those things.

1 Like

Thanks to everyone for your replies.
Yes, I mean that when the control is turned at that angle it generates a strange effect on the rectangle. It is not keeping its rectangular shape.

This happens only for the directentryscroll control.

1 Like

I’ve opened an issue for this: Clip frame doesn't rotate with entry and scrolled entry · Issue #1148 · panda3d/panda3d · GitHub

Regarding this

This is not really a bug, more of a wrong usage of the clip frame. The entry itself is left aligned which maes the left edge of the entry be its 0-position on the X-Axsis. If the clip frame starts left at 0 the entry will be back at the correct location again once the cursor moves back.


Hmm, I’m not sure a scissor effect can be rotated (for example, when I searched for the rotation of OpenGL glScissor, it seems like that doesn’t work) and looking in the source code of Panda, a ScissorAttrib appears to be defined with a (left, right, bottom, top) frame relative to the current DisplayRegion, so I’m wondering how this could take rotation into account.

In case no fix is possible, one workaround I could imagine is rendering the DirectEntryScroll to a texture buffer and apply the texture to a card that has the same size as the DirectEntryScroll. This card could then be rotated as desired.
Probably a bit too over-complicated to be a viable solution, though :stuck_out_tongue: .

1 Like

Thank you :+1: