classDLLPlugin 04

e>

 

Definition at line 58 of file DLLPlugi.h.

References TRUE.

BOOL DLLPlugin::OnPtrMessage PtrMessage  ptrmessage,
HTreeObject **  ptruplink,
LONG  lparam,
Time  time = 0
[inline, virtual]
 

When a user clicks within the property control you will receive a call to your virtual OnPtrMessage function.

BOOL CustomTexture::OnPtrMessage(PtrMessage ptrmessage, HTreeObject
**ptruplink, LONG lparam, Time time)
{
   int i=0;
   switch (ptrmessage )
   {
      case PTM_VALUESTORED: {
         HProperty *dueto = (HProperty*)lparam;
         if (dueto == m_buttonproperty) { // use your properties address here
                         ...
         }
         return TRUE;
      }
      case PTM_DELETED:
         m_mygroup = NULL;
         return TRUE;
      case PTM_RENAMED:
          // Group was renamed, might do something here
          return TRUE;
   return FALSE;
}

If anyone ever deletes the hgroup, the hgroup will notify all of its dependences (classes that called ReassignPtr with it as a parameter) that hgroup is being deleted. It does this through the OnPtrMessage virtual function in your DllPlugin class.

So lets say the user deletes the hgroup in the interface that your plugin has a pointer to. Your DLLPlugin class will receive an OnPtrMessage call that will notify you that the group was deleted.

Parameters:
ptrmessage  - is set to one of the predefined in PtrMessage.
ptruplink  -
lparam  - Holds the HProperty object address (must be casted to the actual object type). If ptrmessage is of type PTM_FPSCHANGED then this parameter points to that new FPS value.
time  -
Note:
PtrMessages are listed in file PtrMessa.h.

Definition at line 63 of file DLLPlugi.h.

References FALSE.

BOOL DLLPlugin::ParseArg const char *  label,
const char *  value
[inline, virtual]
 

Reading saved values back in is the job of ParseArg.

ParseArg is called for each line within the plugin parameters portion of a material file that the standard parser does not understand. This gives you the chance to handle the loading of this data. If you did parse the label, and decide it is one of yours, you should return TRUE, otherwise return FALSE. Here is an example of how to read what we wrote out in the previous example:

BOOL CustomTexture::ParseArg( const char *label, const char *value )
{
   if (strcmp(label, "ShowPreview") == 0) {
      showpreview = (strcmp(value, "ON") == 0);
      return TRUE;
   }
   return FALSE;
}
Note:

ParseArg is called when a v8.5 or earlier file is loaded or when a property not handled by the HProperty and HPropertyInfo derived classes.

Because the standard parser will stop calling this member function whenever it encounters a label that it recognize, the use of standard reserved parser words such as "Ambiance" for instance should be avoided. It is better to customize your labels by appending or prepending some letters such as your initials for example.

Definition at line 57 of file DLLPlugi.h.

References FALSE.

BOOL DLLPlugin::ReassignPtr void *  ptruplink,
HTreeObject newvalue
[inline]
 

ReassignPtr adds information to the assigned object that states that your class has a pointer to it. This information may be used later through calls to OnPtrMessage to let the plugin know that something have happened to the referenced object.

Lets say you have this member variable in your CustumTexture class:

HGroup *m_mygroup;

You can call

ReassignPtr(&m_mygroup,  hgroup);

This will set m_mygroup to hgroup. You do this rather than m_mygroup = group. What ReassignPtr actually does is adds information to the hgroup that states that your class has a pointer to it.

Note:
You do not have to explicitly assign your ptruplinks to NULL if you used DLLPlugin::GetPtrAt properly.
See also:
DLLPlugin::GetPtrAt (int index)
Parameters:
ptruplink  - pointer to the local object pointer which holds the address of the referenced object.
newvalue  - Pointer to the object which is assigned to ptruplink

Definition at line 62 of file DLLPlugi.h.

References m_treeobject, and HTreeObject::ReassignPtr().

Here is the call graph for this function:

BOOL DLLPlugin::Save char *&  label,
char *&  value,
int  count
[inline, virtual]
 

When a plugin specific parameter set is saved to disk, the Save function is called to write out your custom data. Some common examples of things written in this function are boolean variables, and filenames.

Save is continuously called until you return FALSE. The count variable starts out at zero on the first call, and increments for each subsequent call. For each item you wish to write you fill the label and value variables with the appropriate text. For example:

BOOL CustomTexture::Save( char *&label, char *&value, int count )
{
  switch (count) {
  case 0:
     label = "ShowPreview";
     value = showpreview ? "ON" : "OFF";
     return TRUE;
  }
  return FALSE;
}

This would write a line out in the material file that says "ShowPreview=ON". You would add more cases for each line you wish to write out.

Labels should be choosen so that they are not mistaken with any typical reserved labels in the A:M files. See CustomTexture::ParseArg for an explanation.

Note:
The Save function should be used for any data that are not properties derived from HProperty and associated with a derived class of HPropertyInfo. For HProperty associated to an HPropertyInfo. the values are automatically stored using the MatchName as tag.
See also:
HPropertyInfo

Definition at line 56 of file DLLPlugi.h.

References FALSE.