Disabling automatic rotation

Have jReality programming problems or questions? Post them here.
Post Reply
AlfredoDN
Posts: 3
Joined: Wed 2. Mar 2011, 10:52

Disabling automatic rotation

Post by AlfredoDN » Wed 2. Mar 2011, 11:11

Hi everyone,
in first place good job, I really like your work on JReality.
I've been searching for a while in the forum but I haven't found nothing useful.
I want to get rid of the automatic rotation performed by the rotate tool when I mouse-drag an object in the viewer. I simply want to prevent JReality to further move an object dragged. I hope to have been clear.
Second (but less important):
- Is it possibile to get rid of the window labeled "Jreality" in the example SimpleViewer.java?

Bye,
Alfredo

sechel
Posts: 69
Joined: Tue 2. Oct 2007, 09:20

Re: Disabling automatic rotation

Post by sechel » Wed 2. Mar 2011, 21:19

The code of SimpleViewer.java was a bad example. I changed the main method to reflect the different ways of using JRViewer.

Code: Select all

	public static void main(String[] args)	{
		SceneGraphComponent world = new SceneGraphComponent();
		world.setGeometry(Primitives.sharedIcosahedron);
		View.setTitle("The Icosahedron");
		View.setIcon(getIcon("color_swatch.png"));
		JRViewer v = JRViewer.createJRViewer(world);
		
		if (true) {
			v.startup();
		} else {  // you could also do this but you loose the menu and tool bar?
			v.startupLocal();
			Viewer viewer = v.getViewer();
	       		JFrame f = new JFrame();
	        	f.getContentPane().add((Component)viewer.getViewingComponent());
	        	f.setSize(512, 512);
	        	f.validate();
	        	f.setVisible(true);
		}
	}
The rotate tool is part of the "ContentUI" Plugin Set. There are numerous ways to disable or not install the rotate tool. here are just a few of those:
After startup call

Code: Select all

v.startup();
c.getPlugin(ContentTools.class).setRotationEnabled(false);
Or don't use the ContentTools Plugin i.e. don't register the plugin before startup.
Or disable the rotation tool manually by clicking the button in the tool bar. The state of that button is stored in a preference file if you configure your application to do so.

AlfredoDN
Posts: 3
Joined: Wed 2. Mar 2011, 10:52

Re: Disabling automatic rotation

Post by AlfredoDN » Thu 3. Mar 2011, 10:47

Hi, thanks for your reply.
Unfortunately, I think I've been unclear.
I want JReality RotateTool, because I want to be able to rotate an object, but I don't want that, when I rotate an object, sometimes it continues to rotate indefinitely! It stops only when I click on the object itself or in the outside world. Is this a bug of a correct behaviour?
I'm using Jreality under Mac Os 10.6.6, 64 bit.

Bye,
Alfredo

sechel
Posts: 69
Joined: Tue 2. Oct 2007, 09:20

Re: Disabling automatic rotation

Post by sechel » Thu 3. Mar 2011, 12:58

Hi Alfredo,
this behavior is intended. There however is an inconvenient reaction in some cases, where
the rotate tool keeps spinning even if you just clicked. I consider this a bug. If you want to have a look into the source code of the RotateTool you find it here:
src-tool/de.jreality.tools.RotateTool
Stefan

User avatar
steffen
Posts: 186
Joined: Fri 16. Jun 2006, 13:30
Location: TU Berlin
Contact:

Re: Disabling automatic rotation

Post by steffen » Fri 4. Mar 2011, 08:24

The idea is that you can "push" the object into a rotation. If you want to disable that, use

Code: Select all

rotateTool.setAnimTimeMax(0);
Steffen.

AlfredoDN
Posts: 3
Joined: Wed 2. Mar 2011, 10:52

Re: Disabling automatic rotation

Post by AlfredoDN » Fri 4. Mar 2011, 10:27

Thanks guys,
browsing into the source code I've found nothing but the solution given by steffen and it works :)

Bye,
Alfredo

Post Reply