XSI PPG for Cpp

うーむ、イベントよくわかんのぅ

PPGEventContext使わない?
というわけで中途半端にうp


#define READONLY (siReadOnly | siPersistable)
#define ANIMATABLE (siAnimatable | siPersistable | siKeyable)

static Application app;
static Factory factory = app.GetFactory();

... 他省略 ...

XSIPLUGINCALLBACK CStatus hoge_Execute( CRef& in_ctxt )
{
 Context ctxt( in_ctxt );
 CValueArray args = ctxt.GetAttribute(L"Arguments");

 // 
 // TODO: Put your command implementation here.
 CustomProperty oPSet = factory.CreateObject(L"CustomProperty");
 oPSet.PutName(L"hoge");
 oSel = app.GetSelection().GetItem(0);
 app.LogMessage(oSel.GetAsText());

 Parameter oParam;
 Parameter txtParam;
 Parameter btnParam;
 oPSet.AddParameter(L"Instance", CValue::siString, READONLY, L"", L"", L"instance here.", txtParam);
 oPSet.AddParameter(L"Count", CValue::siInt2, ANIMATABLE, L"", L"", 0, oParam);
 oPSet.AddParameter(L"Position", CValue::siInt1, siPersistable, L"", L"", 0, btnParam);

 PPGLayout oLayout = oPSet.GetPPGLayout();

 oLayout.Clear();
 oLayout.AddGroup(L"Duplicate");
 oLayout.AddItem(L"Instance", L"Target");
 oLayout.AddItem(L"Count", 0);
 oLayout.EndGroup();

 CValueArray radio(6);
 radio[0] = L"Left"; radio[1] = 0;
 radio[2] = L"Center"; radio[3] = 1;
 radio[4] = L"Right"; radio[5] = 2;
 oLayout.AddGroup(L"Position");
 oLayout.AddEnumControl(L"Position", radio, L"Change", siControlRadio);
 oLayout.EndGroup();

 // Logic
 oLayout.PutLanguage(L"JScript");
 oLayout.PutLogic(L"LogMessage(\"test\");");

 CValueArray wParam(5);
 wParam[0] = oPSet;
 wParam[1] = L"Duplicate Item";
 wParam[2] = (LONG)siRecycle;
 wParam[3] = false;
 CValue retval;
 app.ExecuteCommand(L"InspectObj", wParam, retval);

 // 
 // Return a value by setting this attribute:
 ctxt.PutAttribute( L"ReturnValue", true );

 // Return CStatus::Fail if you want to raise a script error
 return CStatus::OK;
}

No comments:

Post a Comment