First Time calling SetAction does show the Brush tool's AM
-
Hi I can indeed confirm your issue, However, I did remember we also faced this issue during the R22 dev cycle and it is now fixed.
I will get in touch with the development team to know if there is any workaround applicable to your code.Cheers,
Maxime. -
Dev team confirmed this issue is resolved as a side effect of the document mode merging in R22 but they didn't remember exactly why it happened.
I will try to take a look, but since there is an alternative (CallCommand, I know it is not optional because it screws the undo). I will put it as low prio on my side to look at and will be back (don't expect before the end of the week/start of next week).Cheers,
Maxime. -
@m_adam
Sorry to say butCallCommand
is not an option, as in my specific case theDescriptionTool
I want to activate is a hidden plugin, and CallCommand cannot execute hidden ones.
I understand the fact thatCallCommand
cannot call hidden plugins, and I don't assume this to be a bug. But ifSetAction
is an issue to use, andCallCommand
doesn't execute as expected ... then what is one supposed to use? -
Hm,
I never mentioned this, because I thought it is obvious, but since the thread has somehow come to a pass: Have you ever tried to exploit the fact that selecting two tools in row seems to solve the problem? I.e. first select some dummy tool and then the tool you actually want to select?
Cheers,
zipit -
@zipit
I did try to activate a tool when initializing the plugin ... didn't make any difference.But to answer your actual question, I just tried the following:
doc->SetAction(ID_MODELING_ROTATE); doc->SetAction(ID_MODELING_MOVE); doc->SetAction(myPluginID);
Sadly, no difference, the brush tool still gets shown into the AM.
-
Hi,
I am not sure if we are talking about the same thing,
I meant (as extra lazy pseudo-code).edit: Jeah, just like that. But you could try to give Cinema some time to catch up and invoke an
EventAdd()
ordoc->ExecutePasses
between the tool activations.Cheers,
zipit -
Hi @C4DS I tracked it down a bit.
First of all this issue appears only if you are in BodyaPaint Layout mode.The main problem is that in R21 and previous versions, there is 2 tool logics (For BodyPaint and for Classic one) and more problematic, 2 different attribute manager, while in S22 there is only 1 attribute manager.
The issue in R21 is that if there is no Mode selected, and you are in BP mode, SetAction assume that you want to define the BodyPaint Manager and command, so if you define previously the mode to a Polygon mode it will set is to the one you expect.
doc->SetMode(Mpoints); doc->SetAction(ID_MODELING_ROTATE); SyncMessage(EVMSG_TOOLCHANGED, ID_MODELING_ROTATE);
Defining the Mode to a modeling mode and make sure to also send EVMSG_TOOLCHANGED this way the internal state of command manager for BP will also be updated(otherwise you may see the command jump).
Cheers,
Maxime. -
@m_adam said in First Time calling SetAction does show the Brush tool's AM:
First of all this issue appears only if you are in BodyaPaint Layout mode.
Nope!
I am simply starting the application in its default state. The default startup layout, with the default move tool selected.However, I agree that in the default state the Object Model mode is active So, if I indeed perform a mode change to set it to points (probably also edges or polygons will work) I can see the
SetAction
bringing the expected tool settings in the AM.
So, this might be a solution:- Switch mode to points/edge/polygon
- SetAction
- Switch to orginal mode
-
This works:
const Int32 currentMode = doc->GetMode(); // only change mode if current one is different from Mpoints, Medges, Mpolygons or Mpolyedgepoint doc->SetMode(Mpoints); doc->SetAction(MYTOOL_PLUGINID); GeSyncMessage(EVMSG_TOOLCHANGED, MYTOOL_PLUGINID); doc->SetMode(currentMode);
Thanks for the hint.
EDIT:
FYI, note that I have only tested this solution on R20, not R21, but I assume it will behave identical. -
And I did test only on R21 so be sure to check again because I wasn't able to reproduce as you said with default layout in R21.
Cheers,
Maxime. -
@m_adam said in First Time calling SetAction does show the Brush tool's AM:
And I did test only on R21 so be sure to check again because I wasn't able to reproduce as you said with default layout in R21.
Cheers,
Maxime.I am using R21.207 and with default layout see the brush tool in the AM (identical to what happens with R20.059). For safety, I have now tested your solution on R21 and works as expected.