コード例 #1
0
ファイル: dented.c プロジェクト: jangellx/TMProLWPlugIns
/*
 * NonModal VIEW Panel Interface
 *
 * NonModal interfaces are created on activation.
 */
int
DentedInterface (long version, GlobalFunc *global, LWInterface *iface,
  void *serverdata )
{
  int			 rc = AFUNC_OK;
  LWXPanelID     panID = NULL;
  Dented		*inst = NULL;

  // These are the control lists and configuration hints
  static LWXPanelControl DT_ctrl_list[] = {
   { OPTS_SCALE,         "Scale",          "float-env" },
   { OPTS_POWER,         "Power",          "float-env" },
   { OPTS_FREQUENCY,     "Frequency",      "float-env" },
   { OPTS_OCTAVES,       "Octaves",        "float-env" },
   { OPTS_FNOISE,        "Noise Type",     "iPopChoice" },
   {0}
  };

  static LWXPanelDataDesc DT_data_descrip[] = {
   { OPTS_SCALE,         "Scale",          "float-env" },
   { OPTS_POWER,         "Power",          "float-env" },
   { OPTS_FREQUENCY,     "Frequency",      "float-env" },
   { OPTS_OCTAVES,       "Octaves",        "float-env" },
   { OPTS_FNOISE,        "Noise Type",     "integer" },
   {0}
  };

  static LWXPanelHint DT_hint[] = {
    XpSTRLIST(OPTS_FNOISE, FNoise),
    XpRANGE(OPTS_SCALE, -10, 10, 1),
    XpRANGE(OPTS_POWER, -5, 5, 1),
    XpRANGE(OPTS_FREQUENCY, -5, 5, 1),
    XpRANGE(OPTS_OCTAVES, 0, 10, 1),
    XpH(OPTS_SCALE), XpEND,
    XpH(OPTS_POWER), XpEND,
    XpH(OPTS_FREQUENCY), XpEND,
    XpH(OPTS_OCTAVES), XpEND,
    XpH(OPTS_FNOISE), XpEND,
    XpLABEL(0,"Dented"),
    XpDESTROYNOTIFY(DT_view_destroy),
    XpEND
  };

  // Check the version
  // NOTE: The interface version is different from handler version
  if ( version != LWINTERFACE_VERSION )
    return (AFUNC_BADVERSION);

  xpfunc = global(LWXPANELFUNCS_GLOBAL, GFUSE_TRANSIENT);

  if ( !xpfunc )
    return AFUNC_BADGLOBAL;

  inst = (Dented *) iface->inst;

  // If we already have an XPanel which has not been destroyed,
  // we can destroy it and create another, or return the existing instance.
  
    // Create panel
    panID = (*xpfunc->create)( LWXP_VIEW, DT_ctrl_list );
    if (panID) {

      // Apply some hints
      (*xpfunc->hint) ( panID, 0, DT_hint );

      // Describe the structure of the data instance to the panel
      (*xpfunc->describe)( panID, DT_data_descrip, DT_view_get, DT_view_set );

      // Now give the data instance to the panel
      (*xpfunc->viewInst)( panID, inst );

      // Set the userdata
      (*xpfunc->setData)(panID, 0, inst);
  	}

    // Set the interface panel pointer
    iface->panel = panID;

  // Return and let LightWave play with the panel :)
  return rc;
}
コード例 #2
0
ファイル: coriolis.c プロジェクト: DimondTheCat/xray
/*
 * NonModal VIEW Panel Interface
 *
 * NonModal interfaces are created on activation.
 */
int
CoriolisInterface (long version, GlobalFunc *global, LWInterface *iface,
  void *serverdata )
{
  int        rc = AFUNC_OK;
  LWXPanelID     panID = NULL;
  Coriolis     *inst = NULL;

  // These are the control lists and configuration hints
  static LWXPanelControl CS_ctrl_list[] = {
	{ OPTS_SCALE,      "Coriolis Scale",   "float-env" },
	{ OPTS_TWIST,      "Coriolis Twist",   "float-env" },
	{ OPTS_OFFSET,     "Coriolis Offset",  "float-env" },
	{ OPTS_INCREMENT,  "Increment",        "float-env" },
	{ OPTS_LACUNARITY, "Lacunarity",       "float-env" },
	{ OPTS_OCTAVES,    "Octaves",          "float-env" },
	{ OPTS_FNOISE,     "Noise Type",       "iPopChoice" },
	{0}
  };

  static LWXPanelDataDesc CS_data_descrip[] = {
	{ OPTS_SCALE,      "Coriolis Scale",   "float-env" },
	{ OPTS_TWIST,      "Coriolis Twist",   "float-env" },
	{ OPTS_OFFSET,     "Coriolis Offset",  "float-env" },
	{ OPTS_INCREMENT,  "Increment",        "float-env" },
	{ OPTS_LACUNARITY, "Lacunarity",       "float-env" },
	{ OPTS_OCTAVES,    "Octaves",          "float-env" },
	{ OPTS_FNOISE,     "Noise Type",       "integer" },
	{0}
  };

  static LWXPanelHint CS_hint[] = {
	 XpRANGE(OPTS_SCALE, -10, 10, 1),
	 XpRANGE(OPTS_TWIST, -5, 5, 1),
	 XpRANGE(OPTS_OFFSET, -5, 5, 1),
	 XpH(OPTS_SCALE), XpEND,
	 XpH(OPTS_TWIST), XpEND,
	 XpH(OPTS_OFFSET), XpEND,
	 XpLABEL(0,"Coriolis"),
	 XpDESTROYNOTIFY(CS_view_destroy),
	 XpEND
  };

  // Check the version
  // NOTE: The interface version is different from handler version
  if ( version != LWINTERFACE_VERSION )
	 return (AFUNC_BADVERSION);

  xpfunc = global(LWXPANELFUNCS_GLOBAL, GFUSE_TRANSIENT);

  if ( !xpfunc )
	 return AFUNC_BADGLOBAL;

  inst = (Coriolis *) iface->inst;

  // If we already have an XPanel which has not been destroyed,
  // we can destroy it and create another, or return the existing instance.

	// Create panel
	 panID = (*xpfunc->create)( LWXP_VIEW, CS_ctrl_list );
	 if (panID) {

	  // Apply some hints
		(*xpfunc->hint) ( panID, 0, CS_hint );
		(*xpfunc->hint) ( panID, 0, OPTS3_hint );

	  // Describe the structure of the data instance to the panel
		(*xpfunc->describe)( panID, CS_data_descrip, CS_view_get, CS_view_set );

		// Now give the data instance to the panel
	  (*xpfunc->viewInst)( panID, inst );

		// Set the userdata
		(*xpfunc->setData)(panID, 0, inst);

	}

	 // Set the interface panel pointer
	 iface->panel = panID;


  // Return and let LightWave play with the panel :)
  return rc;
}