LWXPanelID UnMultiply::XPanel() { static LWXPanelControl con[] = { {CH_UNMU, "Unmultiply", "iBoolean"}, {CH_UBGC, "Background Colour", "color"}, {CH_FL2A, "Flare 2 Alpha", "iBoolean"}, {CH_CALP, "Clip Alpha at Threshold", "iBoolean"}, {CH_CRGB, "Clip RGB at Threshold", "iBoolean"}, {CH_THRS, "Threshold", "float"}, 0 }; static LWXPanelDataDesc def[] = { {CH_UNMU, "Unmultiply", "integer"}, {CH_UBGC, "Background Colour", "color"}, {CH_FL2A, "Flare 2 Alpha", "iBoolean"}, {CH_CALP, "Clip Alpha at Threshold", "integer"}, {CH_CRGB, "Clip RGB at Threshold", "integer"}, {CH_THRS, "Threshold", "float"}, 0 }; // Hints static LWXPanelHint hint[] = { XpLABEL( 0, "Alphachannel tools " __DATE__), XpENABLE_(CH_CALP), XpH(CH_THRS), XpH(CH_CRGB), XpEND, XpENABLE_(CH_UNMU), XpH(CH_UBGC), XpEND, XpDIVADD(CH_UBGC), XpDIVADD(CH_FL2A), XpEND }; LWXPanelFuncs *pan_func = NULL; LWXPanelID pan = NULL; pan_func = ( LWXPanelFuncs * )(*global) (LWXPANELFUNCS_GLOBAL, GFUSE_TRANSIENT); pan = (*pan_func->create) (LWXP_VIEW, con); if (!pan) return NULL; (*pan_func->hint) (pan, 0, hint ); //(*pan_func->describe) (pan, def, lwpp::WrapXPanelImageFilter<UnMultiply>::XGet, lwpp::WrapXPanelImageFilter<UnMultiply>::XSet); (*pan_func->viewInst) (pan, this); (*pan_func->setData) (pan, 0, this); return pan; }
/* ====================================================================== Interface() XPanels Interface. Called when the user presses the "Options" button. ====================================================================== */ int Atmosphere::Interface( int version, LWInterface *local, void *serverData ) { UNUSED(serverData); UNUSED(version); if ( !txedf ) return AFUNC_BADGLOBAL; LWXPanelHint hint[] = { XpLABEL( 0, "VFog Settings" ), XpBUTNOTIFY( ID_TXBT, XPanelInterface::LWXPanelBtnClickFunc ), XpSTRLIST( ID_RES, quality ), XpSTRLIST( ID_MARCH, render ), XpGROUP_( ID_GGRP ), XpH( ID_HI ), XpH( ID_LO ), XpH( ID_FA ), XpH( ID_DEN ), XpEND, XpGROUP_( ID_SGRP ), XpH( ID_LUM ), XpH( ID_OPA ), XpH( ID_BCK ), XpH( ID_COL ), XpEND, XpGROUP_( ID_RGRP ), XpH( ID_RES ), XpH( ID_TXTR ), XpH( ID_TXBT ), XpEND, XpENABLE_( ID_MARCH ), XpH( ID_RGRP ), XpEND, XpENABLE_MAP_( ID_BCK, bckMap ), XpH( ID_COL ), XpEND, XpMIN( ID_LUM, 0 ), XpMAX( ID_LUM, 1 ), XpMIN( ID_OPA, 0 ), XpMAX( ID_OPA, 1 ), XpMIN( ID_FA, 0 ), XpMAX( ID_FA, 1 ), XpEND }; // end hint[] CreateViewXPanel (ctrl_list, data_descrip, hint); // FINE because the callback it is in our class LW_XPanel.setUserData(this, ID_TXBT); local->panel = LW_XPanel.getID(); local->options = NULL; local->command = NULL; return AFUNC_OK; }
// OpenUI(): // Opens the user interface. Returns after the panel has been closed. bool ObjectShadowOptions_Interface::OpenUI() { // Destroy the panel if it hasn't been destroyed yet if( panel != NULL ) { (*xpanels->destroy)( panel ); panel = NULL; } // Create the control array static LWXPanelControl controls[] = { { OUI_ABOUT, "About", "vButton" }, { OUI_LIMIT_TO, "Limit To", "iPopChoice" }, { OUI_MATCH_TOGGLE, "Match Name", "iBoolean" }, { OUI_MATCH_STRING, "Name Contains", "string" }, { OUI_SELF_SHADOW, "Self Shadow", "iBoolean" }, { OUI_CAST_SHADOW, "Cast Shadow", "iBoolean" }, { OUI_RECEIVE_SHADOW, "Receive Shadow", "iBoolean" }, { OUI_UNSEEN_BY_RAYS, "Unseen By Rays", "iBoolean" }, { OUI_UNSEEN_BY_CAMERA, "Unseen By Camera", "iBoolean" }, { 0 } }; // Create the data array static LWXPanelDataDesc data[] = { { OUI_ABOUT, "About", "" }, { OUI_LIMIT_TO, "Limit To", "integer" }, { OUI_MATCH_TOGGLE, "Match Name", "integer" }, { OUI_MATCH_STRING, "Name Contains", "string" }, { OUI_SELF_SHADOW, "Self Shadow", "integer" }, { OUI_CAST_SHADOW, "Cast Shadow", "integer" }, { OUI_RECEIVE_SHADOW, "Receive Shadow", "integer" }, { OUI_UNSEEN_BY_RAYS, "Unseen By Rays", "integer" }, { OUI_UNSEEN_BY_CAMERA, "Unseen By Camera", "integer" }, { 0 } }; // Panel Hints Array char title_string[256]; sprintf( title_string, "ObjectShadowOptions -- %c2001 Foundation Imaging, written by Joe Angell", 169 ); static LWXPanelHint panel_hints[] = { XpLABEL( 0, title_string ), XpGROUP_( OUI_GROUP_LIMIT ), XpH( OUI_LIMIT_TO ), XpH( 0 ), XpGROUP_( OUI_GROUP_MATCH ), XpH( OUI_MATCH_TOGGLE ), XpH( OUI_MATCH_STRING ), XpH(0), XpGROUP_( OUI_GROUP_SHADOW ), XpH( OUI_SELF_SHADOW ), XpH( OUI_CAST_SHADOW ), XpH( OUI_RECEIVE_SHADOW ), XpH( 0 ), XpGROUP_( OUI_GROUP_RENDER ), XpH( OUI_UNSEEN_BY_RAYS ), XpH( OUI_UNSEEN_BY_CAMERA ), XpH( 0 ), XpBUTNOTIFY( OUI_ABOUT, HandleAbout ), XpPOPFUNCS( OUI_LIMIT_TO, LimitCount, LimitName ), XpENABLE_( OUI_MATCH_TOGGLE ), XpH( OUI_MATCH_STRING ), XpH( 0 ), XpEND }; // Get XPanels xpanels = (LWXPanelFuncs *)global( LWXPANELFUNCS_GLOBAL, GFUSE_TRANSIENT ); if( xpanels == NULL ) { retval = AFUNC_BADGLOBAL; return false; } // Create the Panel panel = (*xpanels->create)( LWXP_FORM, controls ); if( panel == NULL ) { (*message->error)( "Nullify Error: Unable to create XPanels interface", NULL ); is_ok = false; return false; } // Set up other panel data (*xpanels->describe)( panel, data, NULL, NULL ); (*xpanels->hint)( panel, 0, panel_hints ); // Set up initial values for the panel FSETINT( xpanels, panel, OUI_LIMIT_TO, limit_to ); FSETINT( xpanels, panel, OUI_MATCH_TOGGLE, match_toggle ); FSETINT( xpanels, panel, OUI_SELF_SHADOW, self_shadow ); FSETINT( xpanels, panel, OUI_RECEIVE_SHADOW, receive_shadow ); FSETINT( xpanels, panel, OUI_CAST_SHADOW, cast_shadow ); FSETINT( xpanels, panel, OUI_UNSEEN_BY_CAMERA, unseen_by_camera ); FSETINT( xpanels, panel, OUI_UNSEEN_BY_RAYS, unseen_by_rays ); (*xpanels->formSet)( panel, OUI_MATCH_STRING, match_string ); // Open the panel if( (*xpanels->post)( panel ) != 1 ) { // User Cancel user_abort = true; return false; } return IsOK(); }
static LWXPanelID get_panel( AtmosphereData *dat ) { static LWXPanelControl ctrl_list[] = { { ID_MARCH, "Render Type", "iPopChoice" }, { ID_HI, "Top", "distance" }, { ID_LO, "Bottom", "distance" }, { ID_FA, "Falloff", "percent" }, { ID_DEN, "Nominal Distance", "distance" }, { ID_LUM, "Luminosity", "percent" }, { ID_OPA, "Opacity", "percent" }, { ID_BCK, "Use Backdrop Color", "iBoolean" }, { ID_COL, "Color", "color" }, { ID_RES, "Quality", "iPopChoice" }, { ID_TXTR, "Use Texture", "iBoolean" }, { ID_TXBT, "Edit Texture", "vButton" }, { 0 } }; static LWXPanelDataDesc data_descrip[] = { { ID_MARCH, "Render Type", "integer" }, { ID_HI, "Top", "distance" }, { ID_LO, "Bottom", "distance" }, { ID_FA, "Falloff", "percent" }, { ID_DEN, "Nominal Distance", "distance" }, { ID_LUM, "Luminosity", "percent" }, { ID_OPA, "Opacity", "percent" }, { ID_BCK, "Use Backdrop Color", "integer" }, { ID_COL, "Color", "color" }, { ID_RES, "Quality", "integer" }, { ID_TXTR, "Use Texture", "integer" }, { ID_TXBT, "Edit Texture", NULL }, { 0 }, }; static char *quality[] = { "Very Low", "Low", "Medium", "Good", "Very Good", NULL }; static char *render[] = { "Fast Fog", "Ray Marcher", NULL }; static int bckMap[] = { 1, 0 }; static LWXPanelHint hint[] = { XpLABEL( 0, "VFog Settings" ), XpDESTROYNOTIFY( destroy_notify ), XpBUTNOTIFY( ID_TXBT, button_event ), XpSTRLIST( ID_RES, quality ), XpSTRLIST( ID_MARCH, render ), XpGROUP_( ID_GGRP ), XpH( ID_HI ), XpH( ID_LO ), XpH( ID_FA ), XpH( ID_DEN ), XpEND, XpGROUP_( ID_SGRP ), XpH( ID_LUM ), XpH( ID_OPA ), XpH( ID_BCK ), XpH( ID_COL ), XpEND, XpGROUP_( ID_RGRP ), XpH( ID_RES ), XpH( ID_TXTR ), XpH( ID_TXBT ), XpEND, XpENABLE_( ID_MARCH ), XpH( ID_RGRP ), XpEND, XpENABLE_MAP_( ID_BCK, bckMap ), XpH( ID_COL ), XpEND, XpMIN( ID_LUM, 0 ), XpMAX( ID_LUM, 1 ), XpMIN( ID_OPA, 0 ), XpMAX( ID_OPA, 1 ), XpMIN( ID_FA, 0 ), XpMAX( ID_FA, 1 ), XpEND }; LWXPanelID panel; panel = xpanf->create( LWXP_VIEW, ctrl_list ); if ( panel ) { xpanf->describe( panel, data_descrip, ui_get, ui_set ); xpanf->hint( panel, 0, hint ); xpanf->viewInst( panel, dat ); xpanf->setData( panel, ID_TXBT, dat ); xpanf->setData( panel, 0, dat ); if ( !dat->txedID ) dat->txedID = txedf->subscribe( "FogTexture", TEF_ALL - TEF_USEBTN, NULL, NULL, NULL, NULL ); } return panel; }
/* ====================================================================== Interface() ====================================================================== */ int hotdm::Interface( long version, LWInterface *local, void *serverData ) { UNUSED(version); UNUSED(serverData); static LWXPanelControl ctrl[] = { {ID_RESO, "Resolution", "iSliderText"}, {ID_GLSC, "Global Scale", "distance-env"}, {ID_WAVH, "Wave Height", "distance-env"}, {ID_SWAV, "Shortest Wave", "distance-env"}, {ID_DCHP, "Use Choppiness", "iBoolean"}, {ID_CHOP, "Choppiness", "distance-env"}, {ID_WSPD, "Wind Speed (m/s)", "float-env"}, {ID_WDIR, "Wind Direction (º)", "angle-env"}, {ID_WALG, "Wind Align", "float-env"}, {ID_DREF, "Damp Reflections", "float-env"}, {ID_ODEP, "Ocean Depth", "distance-env"}, {ID_SEED, "Seed", "integer"}, {ID_INTP, "Catmull-Rom Interpolation", "iBoolean"}, {ID_PRES, "Presets", "vPopCmd"}, /* This DOESNT work for displacement plugins, But left the code to see how other controls can be done */ // {ID_NORM, "Do Normals", "iBoolean"}, // {ID_JACB, "Jacobian", "iBoolean"}, { 0 } }; static LWXPanelDataDesc desc[] = { {ID_RESO, "Resolution", "integer"}, {ID_GLSC, "Global Scale", "distance-env"}, {ID_WAVH, "Wave Height", "distance-env"}, {ID_SWAV, "Shortest Wave", "distance-env"}, {ID_DCHP, "Use Choppiness", "integer"}, {ID_CHOP, "Choppiness", "distance-env"}, {ID_WSPD, "Wind Speed (m/s)", "float-env"}, {ID_WDIR, "Wind Direction (º)", "angle-env"}, {ID_WALG, "Wind Align", "float-env"}, {ID_DREF, "Damp Reflections", "float-env"}, {ID_ODEP, "Ocean Depth", "distance-env"}, {ID_SEED, "Seed", "integer"}, {ID_INTP, "Catmull-Rom Interpolation", "integer"}, {ID_PRES, "Presets", "integer"}, /* This DOESNT work for displacement plugins, But left the code to see how other controls can be done */ // {ID_NORM, "Do Normals", "integer"}, // {ID_JACB, "Jacobian", "integer"}, { 0 } }; static LWXPanelHint hints[] = { XpLABEL( 0, "HOT Ocean Toolkit" ), // Enable Use Choppiness and Chopinnes controls XpENABLE_(ID_DCHP),XpH(ID_CHOP),XpEND, /* This DOESNT work for displacement plugins, But left the code to see how other controls can be done */ // XpENABLE_MAP_(ID_DCHP, nrm_map), XpH(ID_NORM),XpEND, XpDIVADD( ID_GLSC ), //Separator after Global Scale XpDIVADD( ID_SWAV ), XpDIVADD( ID_CHOP ), XpDIVADD( ID_WALG ), XpDIVADD( ID_ODEP ), XpDIVADD( ID_INTP ), XpMIN( ID_RESO, 1 ), // Resolution XpMAX( ID_RESO, 12 ), XpSTEP( ID_RESO, 1 ), XpMIN( ID_GLSC, 0 ), // Global Scale XpMAX( ID_GLSC, 5000000 ), XpSTEP( ID_GLSC, 1 ), XpMIN( ID_WAVH, 0 ), // Wave Height XpMAX( ID_WAVH, 5000 ), XpSTEP( ID_WAVH, 1 ), XpMIN( ID_SWAV, 0 ), // Shortest Wave XpMAX( ID_SWAV, 500 ), XpSTEP( ID_SWAV, 1 ), XpMIN( ID_CHOP, 0 ), // Choppiness XpMAX( ID_CHOP, 50 ), XpSTEP( ID_CHOP, 1 ), XpMIN( ID_WSPD, 0 ), // Wind Speed XpMAX( ID_WSPD, 50000 ), XpSTEP( ID_WSPD, 1 ), XpMIN( ID_WALG, 0 ), // Wind Align XpMAX( ID_WALG, 10 ), XpSTEP( ID_WALG, 1 ), XpMIN( ID_DREF, 0 ), // Damp Reflections XpMAX( ID_DREF, 1 ), XpSTEP( ID_DREF, 1 ), XpMIN( ID_ODEP, 0 ), // Ocean Depth XpMAX( ID_ODEP, 50000 ), XpSTEP( ID_ODEP, 1 ), XpEND }; // end hint[] CreateViewXPanel (ctrl, desc, hints); Preset.Setup(LW_XPanel, ID_PRES); local->panel = LW_XPanel.getID(); return AFUNC_OK; }