Subversion Repositories gelsvn

Rev

Rev 412 | Rev 416 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 412 Rev 415
Line 194... Line 194...
194
		return "unknown format";
194
		return "unknown format";
195
	}
195
	}
196
	return "usage: save <name.x3d|name.obj> ";
196
	return "usage: save <name.x3d|name.obj> ";
197
}
197
}
198
 
198
 
-
 
199
////////////////////////////////////////////////////////////////////////////////
-
 
200
/**
-
 
201
 */
199
char* console_save_history(std::vector<std::string> &args)
202
char* ConsoleSaveHistory( std::vector<std::string> &vArgs )
200
{
203
{
201
	if(wantshelp(args)) 
204
    if( vArgs.size() != 0 ) {
202
	{
-
 
203
		theConsole.Printf("usage: save_history <file> ... writes history to file");
205
        theConsole.SaveHistory( vArgs[0] );
204
		return "";
-
 
205
	}
206
    }
206
	if(args.size()>0)
207
    else {
207
	{
-
 
208
		string& file_name = args[0];
-
 
209
		theConsole.SaveHistoryScript(file_name.c_str());
208
        theConsole.SaveHistory();
210
		return "";
-
 
211
	}
209
    }
212
	return "must supply file name\n";
210
	return "";
213
}
211
}
214
 
212
 
-
 
213
////////////////////////////////////////////////////////////////////////////////
-
 
214
/**
-
 
215
 */
215
char* console_exec_script(std::vector<std::string> &args)
216
char* ConsoleLoadHistory( std::vector<std::string> &vArgs )
216
{
217
{
-
 
218
    if( vArgs.size() != 0 ) {
-
 
219
        theConsole.LoadHistory( vArgs[0] );
-
 
220
    }
-
 
221
    else {
-
 
222
        theConsole.LoadHistory();
-
 
223
    }
-
 
224
	return "";
-
 
225
}
-
 
226
 
-
 
227
////////////////////////////////////////////////////////////////////////////////
-
 
228
/**
-
 
229
 */
-
 
230
char* ConsoleClearHistory( std::vector<std::string> &vArgs )
-
 
231
{
217
	if(wantshelp(args)) 
232
	theConsole.ClearHistory();
-
 
233
	return "";
-
 
234
}
-
 
235
 
-
 
236
////////////////////////////////////////////////////////////////////////////////
-
 
237
/**
-
 
238
 */
-
 
239
char* ConsoleStartScript( std::vector<std::string> &vArgs )
-
 
240
{
-
 
241
    theConsole.StartScript();
-
 
242
	return "";
-
 
243
}
-
 
244
 
-
 
245
////////////////////////////////////////////////////////////////////////////////
-
 
246
/**
-
 
247
 */
-
 
248
char* ConsoleStopScript( std::vector<std::string> &vArgs )
218
	{
249
{
-
 
250
    theConsole.StopScript();
-
 
251
	return "";
-
 
252
}
-
 
253
 
-
 
254
////////////////////////////////////////////////////////////////////////////////
-
 
255
/**
-
 
256
 */
219
		theConsole.Printf("usage: source <file> ... runs script");
257
char* ConsoleShowScript( std::vector<std::string> &vArgs )
-
 
258
{
-
 
259
    theConsole.ShowScript();
220
		return "";
260
	return "";
-
 
261
}
-
 
262
 
-
 
263
////////////////////////////////////////////////////////////////////////////////
-
 
264
/**
-
 
265
 */
-
 
266
char* ConsoleRunScript( std::vector<std::string> &vArgs )
-
 
267
{
-
 
268
    theConsole.RunScript();
-
 
269
    return "";
221
	}
270
}
-
 
271
 
-
 
272
////////////////////////////////////////////////////////////////////////////////
-
 
273
/**
-
 
274
 */
-
 
275
char* ConsoleSaveScript( std::vector<std::string> &vArgs )
-
 
276
{
222
	if(args.size()>0)
277
    if( vArgs.size() != 0 ) {
-
 
278
        theConsole.SaveScript( vArgs[0] );
-
 
279
    }
-
 
280
    else {
-
 
281
        theConsole.SaveScript();
-
 
282
    }
-
 
283
	return "";
-
 
284
}
-
 
285
 
-
 
286
////////////////////////////////////////////////////////////////////////////////
-
 
287
/**
-
 
288
 */
-
 
289
char* ConsoleLaunchScript( std::vector<std::string> &vArgs )
223
	{
290
{
224
		string& file_name = args[0];
291
    if( vArgs.size() != 0 ) {
225
		theConsole.ExecuteScript(file_name.c_str());
292
        theConsole.LaunchScript( vArgs[0] );
-
 
293
    } 
-
 
294
    else {
-
 
295
        theConsole.LaunchScript();
-
 
296
    }
226
		return "";
297
	return "";
227
	}
298
}
-
 
299
 
-
 
300
 
-
 
301
////////////////////////////////////////////////////////////////////////////////
-
 
302
/**
-
 
303
 */
-
 
304
char* ConsoleLoad( std::vector<std::string> &vArgs )
-
 
305
{
228
	return "must supply file name\n";
306
    std::string sFile = "cvars.xml";
-
 
307
    std::vector< std::string > vAcceptedSubstrings;
-
 
308
    
-
 
309
    if( vArgs.size() > 0 ) {
-
 
310
        sFile = vArgs[0]; 
-
 
311
        for( size_t i=1; i<vArgs.size(); i++ ) {
-
 
312
            vAcceptedSubstrings.push_back( vArgs[i] );
-
 
313
        }
-
 
314
    }
-
 
315
    theConsole.Printf("Loading file from \"%s\".", sFile.c_str() );
-
 
316
    if( !CVarUtils::Load( sFile, vAcceptedSubstrings) ) {
-
 
317
        theConsole.Printf( "Error loading file.\n" );
-
 
318
    }
-
 
319
    return "";
229
}
320
}
230
 
321
 
231
 
322
 
232
char* console_refine_edges(std::vector<std::string> &args)
323
char* console_refine_edges(std::vector<std::string> &args)
233
{
324
{
Line 1018... Line 1109...
1018
	CreateCVar("noise.perturb_topology", console_noisy_flips);
1109
	CreateCVar("noise.perturb_topology", console_noisy_flips);
1019
	
1110
	
1020
	CreateCVar("dual", console_dual);
1111
	CreateCVar("dual", console_dual);
1021
	
1112
	
1022
	CreateCVar("align", console_align);
1113
	CreateCVar("align", console_align);
-
 
1114
	
1023
	CreateCVar("save_history", console_save_history);
1115
	CVarUtils::CreateCVar( "history.load", ConsoleLoadHistory );
-
 
1116
    CVarUtils::CreateCVar( "history.save", ConsoleSaveHistory );
-
 
1117
    CVarUtils::CreateCVar( "history.clear", ConsoleClearHistory );
-
 
1118
	
-
 
1119
    CVarUtils::CreateCVar( "script.start", ConsoleStartScript );
-
 
1120
    CVarUtils::CreateCVar( "script.stop", ConsoleStopScript );
-
 
1121
    CVarUtils::CreateCVar( "script.show", ConsoleShowScript );
-
 
1122
    CVarUtils::CreateCVar( "script.run", ConsoleRunScript );
-
 
1123
    CVarUtils::CreateCVar( "script.save", ConsoleSaveScript );
1024
	CreateCVar("source", console_exec_script);
1124
    CVarUtils::CreateCVar( "script.launch", ConsoleLaunchScript );
1025
	
1125
	
1026
	
1126
	
1027
}
1127
}
1028
 
1128
 
1029
int main(int argc, char** argv)
1129
int main(int argc, char** argv)