Hopefully someone is still around to answer this question:
I have written tons of scripts over the years. One technique I use for
creating non-modal dialogs is to create a view and populate it with a
dynamically generated custom property so nothing needs to hang around at the
scene root. This allows the tool to be non-modal so the user can use it
again and again without having to re-launch the tool or be locked into only
using that tool.
example (JScript):
// Create a dynamic custom property not attached to anything in the scene.
var oCustomProperty = XSIFactory.CreateObject( "CustomProperty" );
oCustomProperty.Name = "MyPPG";
// Add a scalar parameter called "somevalue" with default value 0.5 and
range [0...1]
oCustomProperty.AddParameter( "somevalue", siFloat, siClassifUnknown,
siSilent, "", "", "", 0.5, 0, 1, 0, 1 );
// Create the layout, add the parameter, then rename it 'ratio'.
var oPPGLayout = oCustomProperty.PPGLayout;
oPPGLayout.Clear();
var oPPGItem = oPPGLayout.AddItem( "somevalue", "ratio", siControlNumber );
oPPGItem.LabelMinPixels = 90;
// define callbacks
oPPGLayout.Language = "JScript"
oPPGLayout.Logic = OnInit.toString() + somevalue_OnChanged.toString()
// embed the custom property into a 'view'
var oView = Application.Desktop.ActiveLayout.CreateView( "Property Panel" );
oView.SetAttribute( "targetcontent", oCustomProperty );
// set dimensions, then display the view as a non-modal dialog box
oView.Resize( 500, 300 );
oView.Visibility = true;
function OnInit()
{
PPG.Refresh();
}
function somevalue_OnChanged()
{
LogMessage( "Hey, put it back!", siComment );
}
I have some old C++ code I need to update and noticed it creates a custom
property at the scene root, then uses InspectObj() to display the custom
property as a modal dialog. I want to convert it to use the above technique
to make it non-modal and not litter the scene root. I have already
converted all the code and am successfully displaying the view, but clicking
buttons, adjusting sliders, etc.. is not triggering the PPGEvent callback
(equivalent to _OnInit() and _OnChanged() in scripting) to allow the tool to
respond to user interaction. The difficulty is with PPGLayout.PutLogic()
(PPGLayout.Logic in scripting) which only accepts scripted code.
Question: How do I define/register the callbacks for a non-modal custom
property in a C++ (other than defining a self installing custom property
plugin)?
Matt
------
Softimage Mailing List.
To unsubscribe, send a mail to [email protected] with
"unsubscribe" in the subject, and reply to confirm.