Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- static void PSEventCallback(DescriptorEventID event, PIActionDescriptor inputDesc, PIDialogRecordOptions options, void *data)
- {
- debugOut("Event: %s", PIUIDToChar(event));
- unsigned int descCount = 0;
- SPErr err = 0;
- if ((err = sPSActionDescriptor->GetCount(inputDesc, &descCount)))
- {
- debugOutError("sPSActionDescriptor->GetCount() returned %d", err);
- return;
- }
- for (unsigned int c = 0; c < descCount; ++c)
- {
- // get the key for this item
- DescriptorKeyID thisKeyID;
- if ((err = sPSActionDescriptor->GetKey(inputDesc, c, &thisKeyID)))
- {
- debugOutError("sPSActionDescriptor->GetKey() returned %d", err);
- continue;
- }
- // get the type for this key
- DescriptorTypeID typeID;
- if ((err = sPSActionDescriptor->GetType(inputDesc, thisKeyID, &typeID)))
- {
- debugOutError("sPSActionDescriptor->GetType() returned %d", err);
- continue;
- }
- debugOut("typeID: %d", typeID);
- if (typeID != typeObjectSpecifier)
- continue;
- // Pull the info
- PIActionReference refValue = 0;
- if ((err = sPSActionDescriptor->GetReference(inputDesc, thisKeyID, &refValue)))
- {
- debugOutError("sPSActionDescriptor->GetReference() returned %d", err);
- continue;
- }
- if (!refValue)
- continue;
- // Get class name
- DescriptorClassID classID;
- if ((err = sPSActionReference->GetDesiredClass(refValue, &classID)))
- {
- debugOutError("sPSActionReference->GetDesiredClass() returned %d", err);
- continue;
- }
- char classStr[255] = { 0 };
- if ((err = sPSActionControl->TypeIDToStringID(classID, classStr, 255)))
- {
- debugOutError("sPSActionControl->TypeIDToStringID() returned %d", err);
- continue;
- }
- if (strstr(classStr, "Tool"))
- sendToolToPlugin(classStr);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement