The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

import-bot (20211) [Avatar] Offline
#1
Re: cusom feedback states for MultiShapes
[Originally posted by author]

You raise an intersting point, and perhaps multi-shaping could have been made
more OO at its core. However, as conceived, multishaping is intended as a
rather low-level building block dealing with the most fundamental aspect of
feedback, such as mouse over, selection, and enabling. As done in the
examples, individual multishapes and their controls (slide, turn, lift) can be
combined and then individually enabled such as through the selection state.
In a sense, this is how an application can introduce the next higher level of
feedback .

You could do something similar to that in the examples where you define roll,
pitch, and yaw controls and associated multishapes. You would associate each
with a different selection state. Selection states are meant for just such a
problem -- select one of many possible states for some high-level control
functionality. One way to assign the states is with the the mouse multi-click
count, as done in the examples. You are free to assign them however you want.
The selection state indices are arbitrary integers. You can define them with
your own class constants such as MyFeedback.SELECT_ROLL, etc. If you would
like to call these modes "statuses", that would be fine too.

The thing to keep in mind is that your feedback manager has to understand how
to convert user interaction into control selections (status). If selection is
via mouse multi-clicking then you can use the manager provided with the 3dui
utility building blocks. If you want to have a dashboard control to do it
then that control will have to drive your composite custom multishape with
your custom selection state indices.

hope this helps
--jon



> Can I define my one feedback-states?
>
> I'd like to have something like Feedback.STATUS_ROLL,
> Feedback.STATUS_PITCH etc. to reflect certain types of object
> manipulations.
>
> Think of a plane where you can modify the attitude of flight with the mouse
> along each axis. For each kind of rotation (roll, pitch, yaw) I'd like to add
> some visual feedback to the model which should be reflected in the
> planes MultiShape by its corresponding status (like STATUS_PITCH, ...)
>
> There seems to be no way but modifying the Feedback-class to add
> some static ints (like Feedback.STATUS_ROLL) and to extend the
> toSatusIndex(int flags) method. But I don't want to modify the j3dui-library.
>
> Of course I could make a subclass of Feeback like PlaneFeedback and
> add my stuff but then MultiShape (and other classes) still user Feedback
> and not PlaneFeedback. So I would have to subclass them too and
> change every occurrence of Feedback with PlaneFeedback.
>
> Unless I misunderstood something I would say that feedback states are
> very hardcoded into the library. A cleaner and more object-oriented way
> would be nice.
>
> But maybe there is a
> better way to do what I want to do.
>
> -Stefan
import-bot (20211) [Avatar] Offline
#2
[Originally posted by stefan_k]

Can I define my one feedback-states?

I'd like to have something like Feedback.STATUS_ROLL,
Feedback.STATUS_PITCH etc. to reflect certain types of object
manipulations.

Think of a plane where you can modify the attitude of flight with the mouse
along each axis. For each kind of rotation (roll, pitch, yaw) I'd like to add
some visual feedback to the model which should be reflected in the
planes MultiShape by its corresponding status (like STATUS_PITCH, ...)

There seems to be no way but modifying the Feedback-class to add
some static ints (like Feedback.STATUS_ROLL) and to extend the
toSatusIndex(int flags) method. But I don't want to modify the j3dui-library.

Of course I could make a subclass of Feeback like PlaneFeedback and
add my stuff but then MultiShape (and other classes) still user Feedback
and not PlaneFeedback. So I would have to subclass them too and
change every occurrence of Feedback with PlaneFeedback.

Unless I misunderstood something I would say that feedback states are
very hardcoded into the library. A cleaner and more object-oriented way
would be nice.

But maybe there is a
better way to do what I want to do.

-Stefan
import-bot (20211) [Avatar] Offline
#3
Re: cusom feedback states for MultiShapes
[Originally posted by stefan_k]

Jon,

I tried to implement the selection states as you suggested but it didn't
work the way I understood your explanation.

I created a MultiSelect object yawSelect and set the select node like this:

yawFeedback.setSelectNote(8192, yawBranch);

added the node to the MultiShape:

status.addNode(yawSelect);

and when the software is running I try to switch to the shape (yawBranch)
by calling:

status.setFeedbackSelect(8192);

which raises a ArrayIndexOutOfBoundsException in
j3dui.feedback.MultiShape.setFeedbackSelect
Feedback.toSelectIndex(_select)

so it's the same thing as with the FEEDBACK.STATUS_??? - If you want to
use your own flags/states/values for setSelectNode()/
setFeedbackSelect() you end up running against the limitation of the
Feedback class.

But maybe I misunderstand the whole issue. I have to admit that I didn't
read your book cover to cover.

In the examples I didn't find any self-defined select-states. Which example
did you mention in wour previous posting?

Best regards and thanks for your reply

Stefan

import-bot (20211) [Avatar] Offline
#4
Re: cusom feedback states for MultiShapes
[Originally posted by author]

Take a look at the MultiShape.MultiShape(int stateCount) constructor and the
accompanying source code. You effectively have to pre-allocate the number of
states you want, which will range from 0 to stateCount-1. I suggest you
create your own class and simply reuse the select states that are already
defined, such as:

public static final int SELECT_ROLL = Feedback.SELECT_DOUBLE;

good luck
--jon