本文整理汇总了C++中DynArray::Flush方法的典型用法代码示例。如果您正苦于以下问题:C++ DynArray::Flush方法的具体用法?C++ DynArray::Flush怎么用?C++ DynArray::Flush使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DynArray
的用法示例。
在下文中一共展示了DynArray::Flush方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
// SCWP_Activate
XCALL_ (int) SCWP_Activate( long version, GlobalFunc *global,
void *local, void *serverData ) {
if ( version != LWMODCOMMAND_VERSION )
return AFUNC_BADVERSION;
LWModCommand * command = (LWModCommand *)local;
if( command == NULL )
return AFUNC_BADLOCAL;
// Build a list of parts for the selected polygons
MeshEditOp *op = (command->editBegin)( 0, 0, OPSEL_DIRECT | OPSEL_MODIFY );
parts.Flush();
EDError err = op->polyScan( op->state, SCWP_PolyScan_FindParts, (void *)op, OPLYR_FG );
if( err != EDERR_NONE ) {
op->done( op->state, err, 0 );
} else {
// Select polygons belonging to the selected parts
err = op->polyScan( op->state, SCWP_PolyScan_Select, (void *)op, OPLYR_FG );
op->done( op->state, err, 0 );
}
// Clean up
parts.Flush();
return CSERR_NONE;
}
示例2: HandleLoad
// HandleLoad():
void HandleLoad( LWControl *con, void *data ) {
char path[ MAX_PATH_LENGTH ];
GET_STR( rint->load, path, MAX_PATH_LENGTH );
if( path[0] == '\0' )
return;
if( !DirInfo::Exists( path ) ) {
rint->message->error( "Replace Objects Error: Settings file doesn't exist:", path );
return;
}
pifstream in( path );
if( !in ) {
(*rint->message->error)( "Replace Objects Error: File I/O error occured opening settings file", path );
return;
}
// Read in the header
in.GuessEOLType();
char buffer[ 2048 ];
in >> buffer;
if( stricmp( buffer, "TMP_RPS" ) != 0 ) {
(*rint->message->error)( "Replace Objects Error: File isn't a Replace Objects settings file", path );
return;
}
int version;
in >>version;
if( version != 1 ) {
(*rint->message->error)( "Replace Objects Error: Replace Objects settings file is an unsupported version", path );
return;
}
// Loop through and load the settings
DynArray< ReplaceObjects_SwapObject * > swaps;
ReplaceObjects_SwapObject *new_swap = NULL;
bool store_original_name = false;
while( true ) {
in >> buffer;
if( in.eof() )
break;
if( in.bad() || in.fail() ) {
swaps.Flush();
(*rint->message->error)( "Replace Objects Error: File I/O error occured reading settings file", path );
return;
}
if( new_swap == NULL ) {
if( stricmp( "Swap", buffer ) == 0 ) {
new_swap = new ReplaceObjects_SwapObject;
new_swap->SetUse( false );
swaps.Add( new_swap );
in >> buffer; // Skip the {
} else if( stricmp( "StoreOriginalNames", buffer ) == 0 ) {
store_original_name = true;
}
} else {
示例3: if
// SCWSS_Activate
XCALL_ (int) SCWSS_Activate( long version, GlobalFunc *global,
void *local, void *serverData ) {
if ( version != LWMODCOMMAND_VERSION )
return AFUNC_BADVERSION;
LWModCommand * command = (LWModCommand *)local;
if( command == NULL )
return AFUNC_BADLOCAL;
// Setup
object_funcs = (LWObjectFuncs *)global( LWOBJECTFUNCS_GLOBAL, GFUSE_TRANSIENT );
vmap_count = object_funcs->numVMaps( LWVMAP_PICK );
// Build a list of selection_set_ids for the selected polygons
MeshEditOp *op = (command->editBegin)( 0, 0, OPSEL_DIRECT | OPSEL_MODIFY );
selection_set_ids.Flush();
EDError err = op->pointScan( op->state, SCWSS_PointScan_FindSets, (void *)op, OPLYR_FG );
if( err != EDERR_NONE ) {
op->done( op->state, err, 0 );
} else {
// If there are multiple selection sets, ask the user which one(s) they want
bool do_select = true;
if( selection_set_ids.NumElements() > 1 ) {
// Get some globals
ContextMenuFuncs *context_funcs = (ContextMenuFuncs *)global( LWCONTEXTMENU_GLOBAL, GFUSE_TRANSIENT );
LWPanelFuncs *panel_funcs = (LWPanelFuncs *)global( LWPANELFUNCS_GLOBAL, GFUSE_TRANSIENT );
// Set up te context menu
LWPanPopupDesc menu_desc;
menu_desc.type = LWT_POPUP;
menu_desc.width = 200;
menu_desc.countFn = SelSetCount;
menu_desc.nameFn = SelSetName;
// Set up the panel, open the menu and clean up
LWPanelID panel = panel_funcs->create( "Selection Sets", panel_funcs );
LWContextMenuID menu = context_funcs->cmenuCreate( &menu_desc, NULL );
int index = context_funcs->cmenuDeploy( menu, panel, 0 );
context_funcs->cmenuDestroy( menu );
panel_funcs->destroy( panel );
// Limit to a single selection set or abort, if applicable
if( index == -1 ) {
do_select = false;
} else if( index != (int)selection_set_names.NumElements() ) {
void *id = selection_set_ids[ index ];
selection_set_ids.Reset();
selection_set_ids.Add( id );
}
}
if( do_select ) {
// Select points belonging to the selected selection sets
err = op->pointScan( op->state, SCWSS_PointScan_Select, (void *)op, OPLYR_FG );
op->done( op->state, err, 0 );
}
}
// Clean up
selection_set_ids.Reset();
selection_set_names.Flush();
return CSERR_NONE;
}